Removed unneeded whitespace.

This commit is contained in:
n-a-c-h
2005-06-02 01:05:50 +00:00
parent b13fbb8f41
commit 57eed11457
70 changed files with 1570 additions and 1570 deletions

View File

@@ -22,17 +22,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
/* /*
Introducing 'the "DJGPP/MinGW/MSVC/GCC on *nix compatible" call asm function Introducing 'the "DJGPP/MinGW/MSVC/GCC on *nix compatible" call asm function
safely from C/C++' macro function! safely from C/C++' macro function!
Usage: Usage:
asm_call( func_name ); asm_call( func_name );
That's all there is to it!!! That's all there is to it!!!
Note: Make sure this is used on a line by itself if the file will ever be Note: Make sure this is used on a line by itself if the file will ever be
compiled with MSVC, since it's preproccessor won't parse the inline compiled with MSVC, since it's preproccessor won't parse the inline
assembly correctly if other stuff are on the line assembly correctly if other stuff are on the line
Note: This will not work with GCC when using the parameter -MASM=intel Note: This will not work with GCC when using the parameter -MASM=intel

View File

@@ -289,7 +289,7 @@ void C4Op0D()
} }
#define READ_WORD(s) (*(unsigned short *) (s)) #define READ_WORD(s) (*(unsigned short *) (s))
void C4Op22() void C4Op22()
{ {
extern unsigned char *C4Ram; extern unsigned char *C4Ram;
short angle1 = READ_WORD(C4Ram+0x1f8c) & 0x1ff; short angle1 = READ_WORD(C4Ram+0x1f8c) & 0x1ff;
@@ -298,7 +298,7 @@ void C4Op22()
int tan2 = Tan(angle2); int tan2 = Tan(angle2);
short y = READ_WORD(C4Ram+0x1f83) - READ_WORD(C4Ram+0x1f89); short y = READ_WORD(C4Ram+0x1f83) - READ_WORD(C4Ram+0x1f89);
short left, right; short left, right;
int j; int j;
for (j = 0; j < 225; j++, y++) for (j = 0; j < 225; j++, y++)
{ {
@@ -311,11 +311,11 @@ void C4Op22()
{ {
left = 1; left = 1;
right = 0; right = 0;
} }
else if (left < 0) else if (left < 0)
{ {
left = 0; left = 0;
} }
else if (right < 0) else if (right < 0)
{ {
right = 0; right = 0;
@@ -324,11 +324,11 @@ void C4Op22()
{ {
left = 255; left = 255;
right = 254; right = 254;
} }
else if (left > 255) else if (left > 255)
{ {
left = 255; left = 255;
} }
else if (right > 255) else if (right > 255)
{ {
right = 255; right = 255;

View File

@@ -57,7 +57,7 @@ void Log_Message (char *Message, ...)
va_start(ap,Message); va_start(ap,Message);
vsprintf(Msg,Message,ap ); vsprintf(Msg,Message,ap );
va_end(ap); va_end(ap);
strcat(Msg,"\r\n\0"); strcat(Msg,"\r\n\0");
fwrite(Msg,strlen(Msg),1,LogFile); fwrite(Msg,strlen(Msg),1,LogFile);
fflush (LogFile); fflush (LogFile);
@@ -69,7 +69,7 @@ void Start_Log (void)
// [4/15/2001] char *p; // [4/15/2001] char *p;
strcpy(LogFileName,"dsp1emu.log\0"); strcpy(LogFileName,"dsp1emu.log\0");
LogFile = fopen(LogFileName,"wb"); LogFile = fopen(LogFileName,"wb");
} }
@@ -85,133 +85,133 @@ void Stop_Log (void)
#endif #endif
const unsigned short DSP1ROM[1024] = { const unsigned short DSP1ROM[1024] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020,
0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000,
0x4000, 0x7fff, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x4000, 0x7fff, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200,
0x0100, 0x0080, 0x0040, 0x0020, 0x0001, 0x0008, 0x0004, 0x0002, 0x0100, 0x0080, 0x0040, 0x0020, 0x0001, 0x0008, 0x0004, 0x0002,
0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x8000, 0xffe5, 0x0100, 0x7fff, 0x7f02, 0x7e08, 0x0000, 0x0000, 0x8000, 0xffe5, 0x0100, 0x7fff, 0x7f02, 0x7e08,
0x7d12, 0x7c1f, 0x7b30, 0x7a45, 0x795d, 0x7878, 0x7797, 0x76ba, 0x7d12, 0x7c1f, 0x7b30, 0x7a45, 0x795d, 0x7878, 0x7797, 0x76ba,
0x75df, 0x7507, 0x7433, 0x7361, 0x7293, 0x71c7, 0x70fe, 0x7038, 0x75df, 0x7507, 0x7433, 0x7361, 0x7293, 0x71c7, 0x70fe, 0x7038,
0x6f75, 0x6eb4, 0x6df6, 0x6d3a, 0x6c81, 0x6bca, 0x6b16, 0x6a64, 0x6f75, 0x6eb4, 0x6df6, 0x6d3a, 0x6c81, 0x6bca, 0x6b16, 0x6a64,
0x69b4, 0x6907, 0x685b, 0x67b2, 0x670b, 0x6666, 0x65c4, 0x6523, 0x69b4, 0x6907, 0x685b, 0x67b2, 0x670b, 0x6666, 0x65c4, 0x6523,
0x6484, 0x63e7, 0x634c, 0x62b3, 0x621c, 0x6186, 0x60f2, 0x6060, 0x6484, 0x63e7, 0x634c, 0x62b3, 0x621c, 0x6186, 0x60f2, 0x6060,
0x5fd0, 0x5f41, 0x5eb5, 0x5e29, 0x5d9f, 0x5d17, 0x5c91, 0x5c0c, 0x5fd0, 0x5f41, 0x5eb5, 0x5e29, 0x5d9f, 0x5d17, 0x5c91, 0x5c0c,
0x5b88, 0x5b06, 0x5a85, 0x5a06, 0x5988, 0x590b, 0x5890, 0x5816, 0x5b88, 0x5b06, 0x5a85, 0x5a06, 0x5988, 0x590b, 0x5890, 0x5816,
0x579d, 0x5726, 0x56b0, 0x563b, 0x55c8, 0x5555, 0x54e4, 0x5474, 0x579d, 0x5726, 0x56b0, 0x563b, 0x55c8, 0x5555, 0x54e4, 0x5474,
0x5405, 0x5398, 0x532b, 0x52bf, 0x5255, 0x51ec, 0x5183, 0x511c, 0x5405, 0x5398, 0x532b, 0x52bf, 0x5255, 0x51ec, 0x5183, 0x511c,
0x50b6, 0x5050, 0x4fec, 0x4f89, 0x4f26, 0x4ec5, 0x4e64, 0x4e05, 0x50b6, 0x5050, 0x4fec, 0x4f89, 0x4f26, 0x4ec5, 0x4e64, 0x4e05,
0x4da6, 0x4d48, 0x4cec, 0x4c90, 0x4c34, 0x4bda, 0x4b81, 0x4b28, 0x4da6, 0x4d48, 0x4cec, 0x4c90, 0x4c34, 0x4bda, 0x4b81, 0x4b28,
0x4ad0, 0x4a79, 0x4a23, 0x49cd, 0x4979, 0x4925, 0x48d1, 0x487f, 0x4ad0, 0x4a79, 0x4a23, 0x49cd, 0x4979, 0x4925, 0x48d1, 0x487f,
0x482d, 0x47dc, 0x478c, 0x473c, 0x46ed, 0x469f, 0x4651, 0x4604, 0x482d, 0x47dc, 0x478c, 0x473c, 0x46ed, 0x469f, 0x4651, 0x4604,
0x45b8, 0x456c, 0x4521, 0x44d7, 0x448d, 0x4444, 0x43fc, 0x43b4, 0x45b8, 0x456c, 0x4521, 0x44d7, 0x448d, 0x4444, 0x43fc, 0x43b4,
0x436d, 0x4326, 0x42e0, 0x429a, 0x4255, 0x4211, 0x41cd, 0x4189, 0x436d, 0x4326, 0x42e0, 0x429a, 0x4255, 0x4211, 0x41cd, 0x4189,
0x4146, 0x4104, 0x40c2, 0x4081, 0x4040, 0x3fff, 0x41f7, 0x43e1, 0x4146, 0x4104, 0x40c2, 0x4081, 0x4040, 0x3fff, 0x41f7, 0x43e1,
0x45bd, 0x478d, 0x4951, 0x4b0b, 0x4cbb, 0x4e61, 0x4fff, 0x5194, 0x45bd, 0x478d, 0x4951, 0x4b0b, 0x4cbb, 0x4e61, 0x4fff, 0x5194,
0x5322, 0x54a9, 0x5628, 0x57a2, 0x5914, 0x5a81, 0x5be9, 0x5d4a, 0x5322, 0x54a9, 0x5628, 0x57a2, 0x5914, 0x5a81, 0x5be9, 0x5d4a,
0x5ea7, 0x5fff, 0x6152, 0x62a0, 0x63ea, 0x6530, 0x6672, 0x67b0, 0x5ea7, 0x5fff, 0x6152, 0x62a0, 0x63ea, 0x6530, 0x6672, 0x67b0,
0x68ea, 0x6a20, 0x6b53, 0x6c83, 0x6daf, 0x6ed9, 0x6fff, 0x7122, 0x68ea, 0x6a20, 0x6b53, 0x6c83, 0x6daf, 0x6ed9, 0x6fff, 0x7122,
0x7242, 0x735f, 0x747a, 0x7592, 0x76a7, 0x77ba, 0x78cb, 0x79d9, 0x7242, 0x735f, 0x747a, 0x7592, 0x76a7, 0x77ba, 0x78cb, 0x79d9,
0x7ae5, 0x7bee, 0x7cf5, 0x7dfa, 0x7efe, 0x7fff, 0x0000, 0x0324, 0x7ae5, 0x7bee, 0x7cf5, 0x7dfa, 0x7efe, 0x7fff, 0x0000, 0x0324,
0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, 0x18f8, 0x1c0b, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, 0x18f8, 0x1c0b,
0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, 0x30fb, 0x33de, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, 0x30fb, 0x33de,
0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, 0x471c, 0x49b4, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, 0x471c, 0x49b4,
0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, 0x5a82, 0x5cb4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, 0x5a82, 0x5cb4,
0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, 0x6a6d, 0x6c24, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, 0x6a6d, 0x6c24,
0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, 0x7641, 0x776c, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, 0x7641, 0x776c,
0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, 0x7d8a, 0x7e1d, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, 0x7d8a, 0x7e1d,
0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, 0x7fff, 0x7ff6, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, 0x7fff, 0x7ff6,
0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3, 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3,
0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504, 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504,
0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6, 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6,
0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842, 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842,
0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a,
0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11,
0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2,
0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x7fff, 0x7ff6, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x7fff, 0x7ff6,
0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3, 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3,
0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504, 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504,
0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6, 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6,
0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842, 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842,
0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a,
0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11,
0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2,
0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x0000, 0xfcdc, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x0000, 0xfcdc,
0xf9b9, 0xf696, 0xf375, 0xf055, 0xed38, 0xea1e, 0xe708, 0xe3f5, 0xf9b9, 0xf696, 0xf375, 0xf055, 0xed38, 0xea1e, 0xe708, 0xe3f5,
0xe0e7, 0xdddd, 0xdad8, 0xd7da, 0xd4e1, 0xd1ef, 0xcf05, 0xcc22, 0xe0e7, 0xdddd, 0xdad8, 0xd7da, 0xd4e1, 0xd1ef, 0xcf05, 0xcc22,
0xc946, 0xc674, 0xc3aa, 0xc0e9, 0xbe32, 0xbb86, 0xb8e4, 0xb64c, 0xc946, 0xc674, 0xc3aa, 0xc0e9, 0xbe32, 0xbb86, 0xb8e4, 0xb64c,
0xb3c1, 0xb141, 0xaecd, 0xac65, 0xaa0b, 0xa7be, 0xa57e, 0xa34c, 0xb3c1, 0xb141, 0xaecd, 0xac65, 0xaa0b, 0xa7be, 0xa57e, 0xa34c,
0xa129, 0x9f14, 0x9d0e, 0x9b18, 0x9931, 0x975a, 0x9593, 0x93dc, 0xa129, 0x9f14, 0x9d0e, 0x9b18, 0x9931, 0x975a, 0x9593, 0x93dc,
0x9236, 0x90a1, 0x8f1e, 0x8dab, 0x8c4b, 0x8afc, 0x89bf, 0x8894, 0x9236, 0x90a1, 0x8f1e, 0x8dab, 0x8c4b, 0x8afc, 0x89bf, 0x8894,
0x877c, 0x8676, 0x8583, 0x84a3, 0x83d7, 0x831d, 0x8276, 0x81e3, 0x877c, 0x8676, 0x8583, 0x84a3, 0x83d7, 0x831d, 0x8276, 0x81e3,
0x8163, 0x80f7, 0x809e, 0x8059, 0x8028, 0x800a, 0x6488, 0x0080, 0x8163, 0x80f7, 0x809e, 0x8059, 0x8028, 0x800a, 0x6488, 0x0080,
0x03ff, 0x0116, 0x0002, 0x0080, 0x4000, 0x3fd7, 0x3faf, 0x3f86, 0x03ff, 0x0116, 0x0002, 0x0080, 0x4000, 0x3fd7, 0x3faf, 0x3f86,
0x3f5d, 0x3f34, 0x3f0c, 0x3ee3, 0x3eba, 0x3e91, 0x3e68, 0x3e40, 0x3f5d, 0x3f34, 0x3f0c, 0x3ee3, 0x3eba, 0x3e91, 0x3e68, 0x3e40,
0x3e17, 0x3dee, 0x3dc5, 0x3d9c, 0x3d74, 0x3d4b, 0x3d22, 0x3cf9, 0x3e17, 0x3dee, 0x3dc5, 0x3d9c, 0x3d74, 0x3d4b, 0x3d22, 0x3cf9,
0x3cd0, 0x3ca7, 0x3c7f, 0x3c56, 0x3c2d, 0x3c04, 0x3bdb, 0x3bb2, 0x3cd0, 0x3ca7, 0x3c7f, 0x3c56, 0x3c2d, 0x3c04, 0x3bdb, 0x3bb2,
0x3b89, 0x3b60, 0x3b37, 0x3b0e, 0x3ae5, 0x3abc, 0x3a93, 0x3a69, 0x3b89, 0x3b60, 0x3b37, 0x3b0e, 0x3ae5, 0x3abc, 0x3a93, 0x3a69,
0x3a40, 0x3a17, 0x39ee, 0x39c5, 0x399c, 0x3972, 0x3949, 0x3920, 0x3a40, 0x3a17, 0x39ee, 0x39c5, 0x399c, 0x3972, 0x3949, 0x3920,
0x38f6, 0x38cd, 0x38a4, 0x387a, 0x3851, 0x3827, 0x37fe, 0x37d4, 0x38f6, 0x38cd, 0x38a4, 0x387a, 0x3851, 0x3827, 0x37fe, 0x37d4,
0x37aa, 0x3781, 0x3757, 0x372d, 0x3704, 0x36da, 0x36b0, 0x3686, 0x37aa, 0x3781, 0x3757, 0x372d, 0x3704, 0x36da, 0x36b0, 0x3686,
0x365c, 0x3632, 0x3609, 0x35df, 0x35b4, 0x358a, 0x3560, 0x3536, 0x365c, 0x3632, 0x3609, 0x35df, 0x35b4, 0x358a, 0x3560, 0x3536,
0x350c, 0x34e1, 0x34b7, 0x348d, 0x3462, 0x3438, 0x340d, 0x33e3, 0x350c, 0x34e1, 0x34b7, 0x348d, 0x3462, 0x3438, 0x340d, 0x33e3,
0x33b8, 0x338d, 0x3363, 0x3338, 0x330d, 0x32e2, 0x32b7, 0x328c, 0x33b8, 0x338d, 0x3363, 0x3338, 0x330d, 0x32e2, 0x32b7, 0x328c,
0x3261, 0x3236, 0x320b, 0x31df, 0x31b4, 0x3188, 0x315d, 0x3131, 0x3261, 0x3236, 0x320b, 0x31df, 0x31b4, 0x3188, 0x315d, 0x3131,
0x3106, 0x30da, 0x30ae, 0x3083, 0x3057, 0x302b, 0x2fff, 0x2fd2, 0x3106, 0x30da, 0x30ae, 0x3083, 0x3057, 0x302b, 0x2fff, 0x2fd2,
0x2fa6, 0x2f7a, 0x2f4d, 0x2f21, 0x2ef4, 0x2ec8, 0x2e9b, 0x2e6e, 0x2fa6, 0x2f7a, 0x2f4d, 0x2f21, 0x2ef4, 0x2ec8, 0x2e9b, 0x2e6e,
0x2e41, 0x2e14, 0x2de7, 0x2dba, 0x2d8d, 0x2d60, 0x2d32, 0x2d05, 0x2e41, 0x2e14, 0x2de7, 0x2dba, 0x2d8d, 0x2d60, 0x2d32, 0x2d05,
0x2cd7, 0x2ca9, 0x2c7b, 0x2c4d, 0x2c1f, 0x2bf1, 0x2bc3, 0x2b94, 0x2cd7, 0x2ca9, 0x2c7b, 0x2c4d, 0x2c1f, 0x2bf1, 0x2bc3, 0x2b94,
0x2b66, 0x2b37, 0x2b09, 0x2ada, 0x2aab, 0x2a7c, 0x2a4c, 0x2a1d, 0x2b66, 0x2b37, 0x2b09, 0x2ada, 0x2aab, 0x2a7c, 0x2a4c, 0x2a1d,
0x29ed, 0x29be, 0x298e, 0x295e, 0x292e, 0x28fe, 0x28ce, 0x289d, 0x29ed, 0x29be, 0x298e, 0x295e, 0x292e, 0x28fe, 0x28ce, 0x289d,
0x286d, 0x283c, 0x280b, 0x27da, 0x27a9, 0x2777, 0x2746, 0x2714, 0x286d, 0x283c, 0x280b, 0x27da, 0x27a9, 0x2777, 0x2746, 0x2714,
0x26e2, 0x26b0, 0x267e, 0x264c, 0x2619, 0x25e7, 0x25b4, 0x2581, 0x26e2, 0x26b0, 0x267e, 0x264c, 0x2619, 0x25e7, 0x25b4, 0x2581,
0x254d, 0x251a, 0x24e6, 0x24b2, 0x247e, 0x244a, 0x2415, 0x23e1, 0x254d, 0x251a, 0x24e6, 0x24b2, 0x247e, 0x244a, 0x2415, 0x23e1,
0x23ac, 0x2376, 0x2341, 0x230b, 0x22d6, 0x229f, 0x2269, 0x2232, 0x23ac, 0x2376, 0x2341, 0x230b, 0x22d6, 0x229f, 0x2269, 0x2232,
0x21fc, 0x21c4, 0x218d, 0x2155, 0x211d, 0x20e5, 0x20ad, 0x2074, 0x21fc, 0x21c4, 0x218d, 0x2155, 0x211d, 0x20e5, 0x20ad, 0x2074,
0x203b, 0x2001, 0x1fc7, 0x1f8d, 0x1f53, 0x1f18, 0x1edd, 0x1ea1, 0x203b, 0x2001, 0x1fc7, 0x1f8d, 0x1f53, 0x1f18, 0x1edd, 0x1ea1,
0x1e66, 0x1e29, 0x1ded, 0x1db0, 0x1d72, 0x1d35, 0x1cf6, 0x1cb8, 0x1e66, 0x1e29, 0x1ded, 0x1db0, 0x1d72, 0x1d35, 0x1cf6, 0x1cb8,
0x1c79, 0x1c39, 0x1bf9, 0x1bb8, 0x1b77, 0x1b36, 0x1af4, 0x1ab1, 0x1c79, 0x1c39, 0x1bf9, 0x1bb8, 0x1b77, 0x1b36, 0x1af4, 0x1ab1,
0x1a6e, 0x1a2a, 0x19e6, 0x19a1, 0x195c, 0x1915, 0x18ce, 0x1887, 0x1a6e, 0x1a2a, 0x19e6, 0x19a1, 0x195c, 0x1915, 0x18ce, 0x1887,
0x183f, 0x17f5, 0x17ac, 0x1761, 0x1715, 0x16c9, 0x167c, 0x162e, 0x183f, 0x17f5, 0x17ac, 0x1761, 0x1715, 0x16c9, 0x167c, 0x162e,
0x15df, 0x158e, 0x153d, 0x14eb, 0x1497, 0x1442, 0x13ec, 0x1395, 0x15df, 0x158e, 0x153d, 0x14eb, 0x1497, 0x1442, 0x13ec, 0x1395,
0x133c, 0x12e2, 0x1286, 0x1228, 0x11c9, 0x1167, 0x1104, 0x109e, 0x133c, 0x12e2, 0x1286, 0x1228, 0x11c9, 0x1167, 0x1104, 0x109e,
0x1036, 0x0fcc, 0x0f5f, 0x0eef, 0x0e7b, 0x0e04, 0x0d89, 0x0d0a, 0x1036, 0x0fcc, 0x0f5f, 0x0eef, 0x0e7b, 0x0e04, 0x0d89, 0x0d0a,
0x0c86, 0x0bfd, 0x0b6d, 0x0ad6, 0x0a36, 0x098d, 0x08d7, 0x0811, 0x0c86, 0x0bfd, 0x0b6d, 0x0ad6, 0x0a36, 0x098d, 0x08d7, 0x0811,
0x0736, 0x063e, 0x0519, 0x039a, 0x0000, 0x7fff, 0x0100, 0x0080, 0x0736, 0x063e, 0x0519, 0x039a, 0x0000, 0x7fff, 0x0100, 0x0080,
0x021d, 0x00c8, 0x00ce, 0x0048, 0x0a26, 0x277a, 0x00ce, 0x6488, 0x021d, 0x00c8, 0x00ce, 0x0048, 0x0a26, 0x277a, 0x00ce, 0x6488,
0x14ac, 0x0001, 0x00f9, 0x00fc, 0x00ff, 0x00fc, 0x00f9, 0xffff, 0x14ac, 0x0001, 0x00f9, 0x00fc, 0x00ff, 0x00fc, 0x00f9, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
/***************************************************************************\ /***************************************************************************\
@@ -232,7 +232,7 @@ double SinTable2[INCR];
double Atan(double x) double Atan(double x)
{ {
if ((x>=1) || (x<=1)) if ((x>=1) || (x<=1))
return (x/(1+0.28*x*x)); return (x/(1+0.28*x*x));
else else
return (PI/2 - Atan(1/x)); return (PI/2 - Atan(1/x));
@@ -303,12 +303,12 @@ void DSP1_Inverse(short Coefficient, short Exponent, short *iCoefficient, short
// Step Two: Remove Sign // Step Two: Remove Sign
if (Coefficient < 0) if (Coefficient < 0)
{ {
if (Coefficient < -32767) Coefficient = -32767; if (Coefficient < -32767) Coefficient = -32767;
Coefficient = -Coefficient; Coefficient = -Coefficient;
Sign = -1; Sign = -1;
} }
// Step Three: Normalize // Step Three: Normalize
while (Coefficient < 0x4000) while (Coefficient < 0x4000)
{ {
@@ -603,7 +603,7 @@ void DSPOp02()
ViewerX1=Sin(Angle(Op02AZS))*Sin(Angle(Op02AAS)); ViewerX1=Sin(Angle(Op02AZS))*Sin(Angle(Op02AAS));
ViewerY1=Sin(Angle(Op02AZS))*Cos(Angle(Op02AAS)); ViewerY1=Sin(Angle(Op02AZS))*Cos(Angle(Op02AAS));
#ifdef debug02 #ifdef debug02
printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n",ViewerX1,ViewerY1, printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n",ViewerX1,ViewerY1,
ViewerZ1); ViewerZ1);
@@ -1005,7 +1005,7 @@ void DSPOp06()
Log_Message("OP06 H:%d V:%d S:%d",Op06H,Op06V,Op06S); Log_Message("OP06 H:%d V:%d S:%d",Op06H,Op06V,Op06S);
#endif #endif
} }
#endif #endif
short matrixC[3][3]; short matrixC[3][3];
@@ -1214,22 +1214,22 @@ short Op14Yrr;
void DSPOp14() void DSPOp14()
{ {
short CSec, ESec, CTan, CSin, C, E; short CSec, ESec, CTan, CSin, C, E;
DSP1_Inverse(DSP1_Cos(Op14Xr), 0, &CSec, &ESec); DSP1_Inverse(DSP1_Cos(Op14Xr), 0, &CSec, &ESec);
// Rotation Around Z // Rotation Around Z
DSP1_NormalizeDouble(Op14U * DSP1_Cos(Op14Yr) - Op14F * DSP1_Sin(Op14Yr), &C, &E); DSP1_NormalizeDouble(Op14U * DSP1_Cos(Op14Yr) - Op14F * DSP1_Sin(Op14Yr), &C, &E);
E = ESec - E; E = ESec - E;
DSP1_Normalize(C * CSec >> 15, &C, &E); DSP1_Normalize(C * CSec >> 15, &C, &E);
if (E > 0) { if (E > 0) {
if (C > 0) C = 32767; else if (C < 0) C = -32767; if (C > 0) C = 32767; else if (C < 0) C = -32767;
} else { } else {
if (E < 0) C = C * DSP1ROM[0x31 + E] >> 15; if (E < 0) C = C * DSP1ROM[0x31 + E] >> 15;
} }
Op14Zrr = Op14Zr + C; Op14Zrr = Op14Zr + C;
// Rotation Around X // Rotation Around X
@@ -1245,7 +1245,7 @@ void DSPOp14()
CTan = CSec * CSin >> 15; CTan = CSec * CSin >> 15;
DSP1_Normalize(-(C * CTan >> 15), &C, &E); DSP1_Normalize(-(C * CTan >> 15), &C, &E);
if (E > 0) { if (E > 0) {
if (C > 0) C = 32767; else if (C < 0) C = -32767; if (C > 0) C = 32767; else if (C < 0) C = -32767;
} else { } else {
@@ -1297,7 +1297,7 @@ void DSPOp0B()
} }
void DSPOp1B() void DSPOp1B()
{ {
Op1BS = (Op1BX * matrixB[0][0] + Op1BY * matrixB[0][1] + Op1BZ * matrixB[0][2]) >> 15; Op1BS = (Op1BX * matrixB[0][0] + Op1BY * matrixB[0][1] + Op1BZ * matrixB[0][2]) >> 15;
#ifdef DebugDSP1 #ifdef DebugDSP1
@@ -1405,7 +1405,7 @@ void DSPOp1C()
Op1CX1 = (Op1CXBR * DSP1_Cos(Op1CY) >> 15) - (Op1CZBR * DSP1_Sin(Op1CY) >> 15); Op1CX1 = (Op1CXBR * DSP1_Cos(Op1CY) >> 15) - (Op1CZBR * DSP1_Sin(Op1CY) >> 15);
Op1CXAR = Op1CX1; Op1CZBR = Op1CZ1; Op1CXAR = Op1CX1; Op1CZBR = Op1CZ1;
// Rotate Around Op1CX1 // Rotate Around Op1CX1
Op1CY1 = (Op1CZBR * DSP1_Sin(Op1CX) >> 15) + (Op1CYBR * DSP1_Cos(Op1CX) >> 15); Op1CY1 = (Op1CZBR * DSP1_Sin(Op1CX) >> 15) + (Op1CYBR * DSP1_Cos(Op1CX) >> 15);
Op1CZ1 = (Op1CZBR * DSP1_Cos(Op1CX) >> 15) - (Op1CYBR * DSP1_Sin(Op1CX) >> 15); Op1CZ1 = (Op1CZBR * DSP1_Cos(Op1CX) >> 15) - (Op1CYBR * DSP1_Sin(Op1CX) >> 15);
Op1CYAR = Op1CY1; Op1CZAR = Op1CZ1; Op1CYAR = Op1CY1; Op1CZAR = Op1CZ1;

View File

@@ -50,7 +50,7 @@ Fixed-point math reminder:
#define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d) #define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d)
#define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d) #define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d)
struct struct
{ {
bool8 waiting4command; bool8 waiting4command;
bool8 half_command; bool8 half_command;
@@ -428,7 +428,7 @@ void DSP4_OP01()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(1) resume1 : DSP4_WAIT(1) resume1 :
// check for termination // check for termination
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
@@ -469,7 +469,7 @@ void DSP4_OP01()
// already have 2 bytes read // already have 2 bytes read
DSP4.in_count = 6; DSP4.in_count = 6;
DSP4_WAIT(3) resume3 : DSP4_WAIT(3) resume3 :
// inspect inputs // inspect inputs
world_ddy = DSP4_READ_WORD(); world_ddy = DSP4_READ_WORD();
@@ -662,7 +662,7 @@ void DSP4_OP07()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(1) resume1 : DSP4_WAIT(1) resume1 :
// check for opcode termination // check for opcode termination
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
@@ -671,7 +671,7 @@ void DSP4_OP07()
// already have 2 bytes in queue // already have 2 bytes in queue
DSP4.in_count = 10; DSP4.in_count = 10;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// inspect inputs // inspect inputs
view_y2 = DSP4_READ_WORD(); view_y2 = DSP4_READ_WORD();
@@ -832,7 +832,7 @@ void DSP4_OP08()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(1) resume1 : DSP4_WAIT(1) resume1 :
// terminate op // terminate op
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
@@ -842,7 +842,7 @@ void DSP4_OP08()
// already have 2 bytes in queue // already have 2 bytes in queue
DSP4.in_count = 16; DSP4.in_count = 16;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// look at guidelines for both polygon shapes // look at guidelines for both polygon shapes
view_x[0] = DSP4_READ_WORD(); view_x[0] = DSP4_READ_WORD();
@@ -1051,7 +1051,7 @@ void DSP4_OP09()
// check for new sprites // check for new sprites
DSP4.in_count = 4; DSP4.in_count = 4;
DSP4_WAIT(1) resume1 : DSP4_WAIT(1) resume1 :
//////////////////////////////////////////////// ////////////////////////////////////////////////
// raster overdraw check // raster overdraw check
@@ -1094,7 +1094,7 @@ void DSP4_OP09()
// we already have 4 bytes we want // we already have 4 bytes we want
DSP4.in_count = 14; DSP4.in_count = 14;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// filter inputs // filter inputs
energy = DSP4_READ_WORD(); energy = DSP4_READ_WORD();
@@ -1127,7 +1127,7 @@ void DSP4_OP09()
// grab a few remaining vehicle values // grab a few remaining vehicle values
DSP4.in_count = 4; DSP4.in_count = 4;
DSP4_WAIT(3) resume3 : DSP4_WAIT(3) resume3 :
// add vertical lift factor // add vertical lift factor
sprite_y += DSP4_READ_WORD(); sprite_y += DSP4_READ_WORD();
@@ -1140,7 +1140,7 @@ void DSP4_OP09()
// we already have 4 bytes we want // we already have 4 bytes we want
DSP4.in_count = 10; DSP4.in_count = 10;
DSP4_WAIT(4) resume4 : DSP4_WAIT(4) resume4 :
// sort loop inputs // sort loop inputs
poly_cx[0][0] = DSP4_READ_WORD(); poly_cx[0][0] = DSP4_READ_WORD();
@@ -1170,18 +1170,18 @@ void DSP4_OP09()
do do
{ {
uint16 header; uint16 header;
int16 sp_x, sp_y, sp_attr, sp_dattr; int16 sp_x, sp_y, sp_attr, sp_dattr;
int16 sp_dx, sp_dy; int16 sp_dx, sp_dy;
int16 pixels; int16 pixels;
bool8 draw; bool8 draw;
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(5) resume5 : DSP4_WAIT(5) resume5 :
draw = TRUE; draw = TRUE;
// opcode termination // opcode termination
raster = DSP4_READ_WORD(); raster = DSP4_READ_WORD();
if (raster == -0x8000) if (raster == -0x8000)
@@ -1212,10 +1212,10 @@ void DSP4_OP09()
// read in rest of sprite data // read in rest of sprite data
DSP4.in_count = 4; DSP4.in_count = 4;
DSP4_WAIT(6) resume6 : DSP4_WAIT(6) resume6 :
draw = TRUE; draw = TRUE;
///////////////////////////////////// /////////////////////////////////////
// process tile data // process tile data
@@ -1427,7 +1427,7 @@ void DSP4_OP0D()
view_yofs2 = (world_yofs * distance >> 15) + poly_bottom[0][0] - view_y2; view_yofs2 = (world_yofs * distance >> 15) + poly_bottom[0][0] - view_y2;
// 1. World x-location before transformation // 1. World x-location before transformation
// 2. Viewer x-position at the current // 2. Viewer x-position at the current
// 3. World y-location before perspective projection // 3. World y-location before perspective projection
// 4. Viewer y-position below the horizon // 4. Viewer y-position below the horizon
// 5. Number of raster lines drawn in this iteration // 5. Number of raster lines drawn in this iteration
@@ -1528,9 +1528,9 @@ void DSP4_OP0D()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(1) resume1 : DSP4_WAIT(1) resume1 :
// inspect input // inspect input
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
// terminate op // terminate op
@@ -1539,7 +1539,7 @@ void DSP4_OP0D()
// already have 2 bytes in queue // already have 2 bytes in queue
DSP4.in_count = 6; DSP4.in_count = 6;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// inspect inputs // inspect inputs
world_ddy = DSP4_READ_WORD(); world_ddy = DSP4_READ_WORD();
@@ -1680,7 +1680,7 @@ void DSP4_OP0F()
// grab inputs // grab inputs
DSP4.in_count = 4; DSP4.in_count = 4;
DSP4_WAIT(1); DSP4_WAIT(1);
resume1 : resume1 :
for (;;) for (;;)
{ {
int16 distance; int16 distance;
@@ -1763,7 +1763,7 @@ void DSP4_OP0F()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// check for termination // check for termination
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
@@ -1804,7 +1804,7 @@ void DSP4_OP0F()
// already have 2 bytes in queue // already have 2 bytes in queue
DSP4.in_count = 6; DSP4.in_count = 6;
DSP4_WAIT(4) resume4 : DSP4_WAIT(4) resume4 :
// inspect inputs // inspect inputs
world_ddy = DSP4_READ_WORD(); world_ddy = DSP4_READ_WORD();
@@ -1925,7 +1925,7 @@ void DSP4_OP10()
// grab inputs // grab inputs
DSP4.in_count = 4; DSP4.in_count = 4;
DSP4_WAIT(1); DSP4_WAIT(1);
resume1 : resume1 :
for (;;) for (;;)
{ {
int16 distance; int16 distance;
@@ -2006,7 +2006,7 @@ void DSP4_OP10()
// scan next command // scan next command
DSP4.in_count = 2; DSP4.in_count = 2;
DSP4_WAIT(2) resume2 : DSP4_WAIT(2) resume2 :
// check for opcode termination // check for opcode termination
distance = DSP4_READ_WORD(); distance = DSP4_READ_WORD();
@@ -2015,7 +2015,7 @@ void DSP4_OP10()
// already have 2 bytes in queue // already have 2 bytes in queue
DSP4.in_count = 10; DSP4.in_count = 10;
DSP4_WAIT(3) resume3 : DSP4_WAIT(3) resume3 :
// inspect inputs // inspect inputs
@@ -2064,7 +2064,7 @@ void DSP4SetByte()
DSP4.out_index++; DSP4.out_index++;
return; return;
} }
if (DSP4.waiting4command) if (DSP4.waiting4command)
{ {
if (DSP4.half_command) if (DSP4.half_command)
@@ -2127,14 +2127,14 @@ void DSP4SetByte()
DSP4.parameters[DSP4.in_index] = dsp4_byte; DSP4.parameters[DSP4.in_index] = dsp4_byte;
DSP4.in_index++; DSP4.in_index++;
} }
if (!DSP4.waiting4command && DSP4.in_count == DSP4.in_index) if (!DSP4.waiting4command && DSP4.in_count == DSP4.in_index)
{ {
// Actually execute the command // Actually execute the command
DSP4.waiting4command = TRUE; DSP4.waiting4command = TRUE;
DSP4.out_index = 0; DSP4.out_index = 0;
DSP4.in_index = 0; DSP4.in_index = 0;
switch (DSP4.command) switch (DSP4.command)
{ {
// 16-bit multiplication // 16-bit multiplication
@@ -2147,7 +2147,7 @@ void DSP4SetByte()
multiplicand = DSP4_READ_WORD(); multiplicand = DSP4_READ_WORD();
DSP4_Multiply(multiplicand, multiplier, &product); DSP4_Multiply(multiplicand, multiplier, &product);
DSP4_CLEAR_OUT(); DSP4_CLEAR_OUT();
DSP4_WRITE_WORD(product); DSP4_WRITE_WORD(product);
DSP4_WRITE_WORD(product >> 16); DSP4_WRITE_WORD(product >> 16);
@@ -2165,7 +2165,7 @@ void DSP4SetByte()
// clear OAM // clear OAM
case 0x0005: case 0x0005:
DSP4_OP05(); break; DSP4_OP05(); break;
// transfer OAM // transfer OAM
case 0x0006: case 0x0006:
DSP4_OP06(); break; DSP4_OP06(); break;
@@ -2189,9 +2189,9 @@ void DSP4SetByte()
int16 in2a = DSP4_READ_WORD(); int16 in2a = DSP4_READ_WORD();
int16 in3a = DSP4_READ_WORD(); int16 in3a = DSP4_READ_WORD();
int16 out1a, out2a, out3a, out4a; int16 out1a, out2a, out3a, out4a;
DSP4_OP0A(in2a, &out2a, &out1a, &out4a, &out3a); DSP4_OP0A(in2a, &out2a, &out1a, &out4a, &out3a);
DSP4_CLEAR_OUT(); DSP4_CLEAR_OUT();
DSP4_WRITE_WORD(out1a); DSP4_WRITE_WORD(out1a);
DSP4_WRITE_WORD(out2a); DSP4_WRITE_WORD(out2a);
@@ -2209,7 +2209,7 @@ void DSP4SetByte()
bool8 draw = 1; bool8 draw = 1;
DSP4_CLEAR_OUT(); DSP4_CLEAR_OUT();
DSP4_OP0B(&draw, sp_x, sp_y, sp_attr, 0, 1); DSP4_OP0B(&draw, sp_x, sp_y, sp_attr, 0, 1);
} }
break; break;
@@ -2242,7 +2242,7 @@ void DSP4SetByte()
a = DSP4_READ_WORD(); a = DSP4_READ_WORD();
DSP4_OP11(a, b, c, d, &m); DSP4_OP11(a, b, c, d, &m);
DSP4_CLEAR_OUT(); DSP4_CLEAR_OUT();
DSP4_WRITE_WORD(m); DSP4_WRITE_WORD(m);

View File

@@ -21,7 +21,7 @@
%include "macros.mac" %include "macros.mac"
EXTSYM dsp4_address,dsp4_byte,DSP4GetByte,DSP4SetByte EXTSYM dsp4_address,dsp4_byte,DSP4GetByte,DSP4SetByte
EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8 EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8
SECTION .text SECTION .text
@@ -53,19 +53,19 @@ NEWSYM DSP4Write8b
call DSP4SetByte call DSP4SetByte
popad popad
ret ret
NEWSYM DSP4Read16b NEWSYM DSP4Read16b
RouteAccess regaccessbankr16 RouteAccess regaccessbankr16
mov word[dsp4_address],cx mov word[dsp4_address],cx
pushad pushad
call DSP4GetByte call DSP4GetByte
mov al,byte[dsp4_byte] mov al,byte[dsp4_byte]
mov byte[dsp4temp],al mov byte[dsp4temp],al
inc word[dsp4_address] inc word[dsp4_address]
call DSP4GetByte call DSP4GetByte
popad popad
mov al,byte[dsp4temp] mov al,byte[dsp4temp]
mov ah,byte[dsp4_byte] mov ah,byte[dsp4_byte]
ret ret
NEWSYM DSP4Write16b NEWSYM DSP4Write16b
@@ -81,6 +81,6 @@ NEWSYM DSP4Write16b
call DSP4SetByte call DSP4SetByte
popad popad
ret ret
SECTION .bss SECTION .bss
NEWSYM dsp4temp, resb 1 NEWSYM dsp4temp, resb 1

View File

@@ -58,30 +58,30 @@ NEWSYM SfxR6, dd 0 ; multiplier for fmult and lmult
NEWSYM SfxR7, dd 0 ; fixed point texel X position for merge NEWSYM SfxR7, dd 0 ; fixed point texel X position for merge
NEWSYM SfxR8, dd 0 ; fixed point texel Y position for merge NEWSYM SfxR8, dd 0 ; fixed point texel Y position for merge
NEWSYM SfxR9, dd 0 ; NEWSYM SfxR9, dd 0 ;
NEWSYM SfxR10, dd 0 ; NEWSYM SfxR10, dd 0 ;
NEWSYM SfxR11, dd 0 ; return address set by link NEWSYM SfxR11, dd 0 ; return address set by link
NEWSYM SfxR12, dd 0 ; loop counter NEWSYM SfxR12, dd 0 ; loop counter
NEWSYM SfxR13, dd 0 ; loop point address NEWSYM SfxR13, dd 0 ; loop point address
NEWSYM SfxR14, dd 0 ; rom address for getb, getbh, getbl, getbs NEWSYM SfxR14, dd 0 ; rom address for getb, getbh, getbl, getbs
NEWSYM SfxR15, dd 0 ; program counter NEWSYM SfxR15, dd 0 ; program counter
NEWSYM SfxSFR, dd 0 ; status flag register (16bit) NEWSYM SfxSFR, dd 0 ; status flag register (16bit)
;SFR status flag register bits: ;SFR status flag register bits:
; 0 - ; 0 -
; 1 Z Zero flag ; 1 Z Zero flag
; 2 CY Carry flag ; 2 CY Carry flag
; 3 S Sign flag ; 3 S Sign flag
; 4 OV Overflow flag ; 4 OV Overflow flag
; 5 G Go flag (set to 1 when the GSU is running) ; 5 G Go flag (set to 1 when the GSU is running)
; 6 R Set to 1 when reading ROM using R14 address ; 6 R Set to 1 when reading ROM using R14 address
; 7 - ; 7 -
; 8 ALT1 Mode set-up flag for the next instruction ; 8 ALT1 Mode set-up flag for the next instruction
; 9 ALT2 Mode set-up flag for the next instruction ; 9 ALT2 Mode set-up flag for the next instruction
;10 IL Immediate lower 8-bit flag ;10 IL Immediate lower 8-bit flag
;11 IH Immediate higher 8-bit flag ;11 IH Immediate higher 8-bit flag
;12 B Set to 1 when the WITH instruction is executed ;12 B Set to 1 when the WITH instruction is executed
;13 - ;13 -
;14 - ;14 -
;15 IRQ Set to 1 when GSU caused an interrupt ;15 IRQ Set to 1 when GSU caused an interrupt
; Set to 0 when read by 658c16 ; Set to 0 when read by 658c16
@@ -363,29 +363,29 @@ NEWSYM FxOp0F ; BVS branch on overflow set ; Verified.
NEWSYM FxOp10 ; TO RN set register n as destination register NEWSYM FxOp10 ; TO RN set register n as destination register
TORN 0 TORN 0
NEWSYM FxOp11 ; TO RN set register n as destination register NEWSYM FxOp11 ; TO RN set register n as destination register
TORN 1 TORN 1
NEWSYM FxOp12 ; TO RN set register n as destination register NEWSYM FxOp12 ; TO RN set register n as destination register
TORN 2 TORN 2
NEWSYM FxOp13 ; TO RN set register n as destination register NEWSYM FxOp13 ; TO RN set register n as destination register
TORN 3 TORN 3
NEWSYM FxOp14 ; TO RN set register n as destination register NEWSYM FxOp14 ; TO RN set register n as destination register
TORN 4 TORN 4
NEWSYM FxOp15 ; TO RN set register n as destination register NEWSYM FxOp15 ; TO RN set register n as destination register
TORN 5 TORN 5
NEWSYM FxOp16 ; TO RN set register n as destination register NEWSYM FxOp16 ; TO RN set register n as destination register
TORN 6 TORN 6
NEWSYM FxOp17 ; TO RN set register n as destination register NEWSYM FxOp17 ; TO RN set register n as destination register
TORN 7 TORN 7
NEWSYM FxOp18 ; TO RN set register n as destination register NEWSYM FxOp18 ; TO RN set register n as destination register
TORN 8 TORN 8
NEWSYM FxOp19 ; TO RN set register n as destination register NEWSYM FxOp19 ; TO RN set register n as destination register
TORN 9 TORN 9
NEWSYM FxOp1A ; TO RN set register n as destination register NEWSYM FxOp1A ; TO RN set register n as destination register
TORN 10 TORN 10
NEWSYM FxOp1B ; TO RN set register n as destination register NEWSYM FxOp1B ; TO RN set register n as destination register
TORN 11 TORN 11
NEWSYM FxOp1C ; TO RN set register n as destination register NEWSYM FxOp1C ; TO RN set register n as destination register
TORN 12 TORN 12
NEWSYM FxOp1D ; TO RN set register n as destination register NEWSYM FxOp1D ; TO RN set register n as destination register
TORN 13 TORN 13
NEWSYM FxOp1E ; TO RN set register n as destination register NEWSYM FxOp1E ; TO RN set register n as destination register
@@ -587,21 +587,21 @@ NEWSYM FxOp4B ; LDW RN load word from RAM
LDWRN 11 LDWRN 11
NEWSYM FxOp40A1 ; LDB RN load byte from RAM NEWSYM FxOp40A1 ; LDB RN load byte from RAM
LDBRN 0 LDBRN 0
NEWSYM FxOp41A1 ; LDB RN load byte from RAM NEWSYM FxOp41A1 ; LDB RN load byte from RAM
LDBRN 1 LDBRN 1
NEWSYM FxOp42A1 ; LDB RN load byte from RAM NEWSYM FxOp42A1 ; LDB RN load byte from RAM
LDBRN 2 LDBRN 2
NEWSYM FxOp43A1 ; LDB RN load byte from RAM NEWSYM FxOp43A1 ; LDB RN load byte from RAM
LDBRN 3 LDBRN 3
NEWSYM FxOp44A1 ; LDB RN load byte from RAM NEWSYM FxOp44A1 ; LDB RN load byte from RAM
LDBRN 4 LDBRN 4
NEWSYM FxOp45A1 ; LDB RN load byte from RAM NEWSYM FxOp45A1 ; LDB RN load byte from RAM
LDBRN 5 LDBRN 5
NEWSYM FxOp46A1 ; LDB RN load byte from RAM NEWSYM FxOp46A1 ; LDB RN load byte from RAM
LDBRN 6 LDBRN 6
NEWSYM FxOp47A1 ; LDB RN load byte from RAM NEWSYM FxOp47A1 ; LDB RN load byte from RAM
LDBRN 7 LDBRN 7
NEWSYM FxOp48A1 ; LDB RN load byte from RAM NEWSYM FxOp48A1 ; LDB RN load byte from RAM
LDBRN 8 LDBRN 8
NEWSYM FxOp49A1 ; LDB RN load byte from RAM NEWSYM FxOp49A1 ; LDB RN load byte from RAM
@@ -1036,7 +1036,7 @@ NEWSYM FxOp4CA1 ; RPIX read color of the pixel with R1,R2 as x,y
NEWSYM FxOp4D ; SWAP swap upper and lower byte of a register ; V NEWSYM FxOp4D ; SWAP swap upper and lower byte of a register ; V
mov eax,[esi] ; Read Source mov eax,[esi] ; Read Source
FETCHPIPE FETCHPIPE
ror ax,8 ror ax,8
inc ebp ; Increase program counter inc ebp ; Increase program counter
mov [SfxSignZero],eax mov [SfxSignZero],eax
mov [edi],eax ; Write Destination mov [edi],eax ; Write Destination
@@ -1650,35 +1650,35 @@ NEWSYM FxOp7FA3 ; BICIRN register & ~immediate
BICIRN 15 ^ 0FFFFh BICIRN 15 ^ 0FFFFh
NEWSYM FxOp80 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp80 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 0 MULTRN 0
NEWSYM FxOp81 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp81 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 1 MULTRN 1
NEWSYM FxOp82 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp82 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 2 MULTRN 2
NEWSYM FxOp83 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp83 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 3 MULTRN 3
NEWSYM FxOp84 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp84 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 4 MULTRN 4
NEWSYM FxOp85 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp85 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 5 MULTRN 5
NEWSYM FxOp86 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp86 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 6 MULTRN 6
NEWSYM FxOp87 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp87 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 7 MULTRN 7
NEWSYM FxOp88 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp88 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 8 MULTRN 8
NEWSYM FxOp89 ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp89 ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 9 MULTRN 9
NEWSYM FxOp8A ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8A ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 10 MULTRN 10
NEWSYM FxOp8B ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8B ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 11 MULTRN 11
NEWSYM FxOp8C ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8C ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 12 MULTRN 12
NEWSYM FxOp8D ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8D ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 13 MULTRN 13
NEWSYM FxOp8E ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8E ; MULTRN 8 bit to 16 bit signed multiply, register * register
MULTRN 14 MULTRN 14
NEWSYM FxOp8F ; MULTRN 8 bit to 16 bit signed multiply, register * register NEWSYM FxOp8F ; MULTRN 8 bit to 16 bit signed multiply, register * register
FETCHPIPE FETCHPIPE
mov ebx,ebp mov ebx,ebp

View File

@@ -188,29 +188,29 @@ NEWSYM FxOpb0F ; BVS branch on overflow set ; Verified.
NEWSYM FxOpb10 ; TO RN set register n as destination register NEWSYM FxOpb10 ; TO RN set register n as destination register
TORNb 0 TORNb 0
NEWSYM FxOpb11 ; TO RN set register n as destination register NEWSYM FxOpb11 ; TO RN set register n as destination register
TORNb 1 TORNb 1
NEWSYM FxOpb12 ; TO RN set register n as destination register NEWSYM FxOpb12 ; TO RN set register n as destination register
TORNb 2 TORNb 2
NEWSYM FxOpb13 ; TO RN set register n as destination register NEWSYM FxOpb13 ; TO RN set register n as destination register
TORNb 3 TORNb 3
NEWSYM FxOpb14 ; TO RN set register n as destination register NEWSYM FxOpb14 ; TO RN set register n as destination register
TORNb 4 TORNb 4
NEWSYM FxOpb15 ; TO RN set register n as destination register NEWSYM FxOpb15 ; TO RN set register n as destination register
TORNb 5 TORNb 5
NEWSYM FxOpb16 ; TO RN set register n as destination register NEWSYM FxOpb16 ; TO RN set register n as destination register
TORNb 6 TORNb 6
NEWSYM FxOpb17 ; TO RN set register n as destination register NEWSYM FxOpb17 ; TO RN set register n as destination register
TORNb 7 TORNb 7
NEWSYM FxOpb18 ; TO RN set register n as destination register NEWSYM FxOpb18 ; TO RN set register n as destination register
TORNb 8 TORNb 8
NEWSYM FxOpb19 ; TO RN set register n as destination register NEWSYM FxOpb19 ; TO RN set register n as destination register
TORNb 9 TORNb 9
NEWSYM FxOpb1A ; TO RN set register n as destination register NEWSYM FxOpb1A ; TO RN set register n as destination register
TORNb 10 TORNb 10
NEWSYM FxOpb1B ; TO RN set register n as destination register NEWSYM FxOpb1B ; TO RN set register n as destination register
TORNb 11 TORNb 11
NEWSYM FxOpb1C ; TO RN set register n as destination register NEWSYM FxOpb1C ; TO RN set register n as destination register
TORNb 12 TORNb 12
NEWSYM FxOpb1D ; TO RN set register n as destination register NEWSYM FxOpb1D ; TO RN set register n as destination register
TORNb 13 TORNb 13
NEWSYM FxOpb1E ; TO RN set register n as destination register NEWSYM FxOpb1E ; TO RN set register n as destination register
@@ -504,29 +504,29 @@ NEWSYM FxOpc0F ; BVS branch on overflow set ; Verified.
NEWSYM FxOpc10 ; TO RN set register n as destination register NEWSYM FxOpc10 ; TO RN set register n as destination register
TORNc 0 TORNc 0
NEWSYM FxOpc11 ; TO RN set register n as destination register NEWSYM FxOpc11 ; TO RN set register n as destination register
TORNc 1 TORNc 1
NEWSYM FxOpc12 ; TO RN set register n as destination register NEWSYM FxOpc12 ; TO RN set register n as destination register
TORNc 2 TORNc 2
NEWSYM FxOpc13 ; TO RN set register n as destination register NEWSYM FxOpc13 ; TO RN set register n as destination register
TORNc 3 TORNc 3
NEWSYM FxOpc14 ; TO RN set register n as destination register NEWSYM FxOpc14 ; TO RN set register n as destination register
TORNc 4 TORNc 4
NEWSYM FxOpc15 ; TO RN set register n as destination register NEWSYM FxOpc15 ; TO RN set register n as destination register
TORNc 5 TORNc 5
NEWSYM FxOpc16 ; TO RN set register n as destination register NEWSYM FxOpc16 ; TO RN set register n as destination register
TORNc 6 TORNc 6
NEWSYM FxOpc17 ; TO RN set register n as destination register NEWSYM FxOpc17 ; TO RN set register n as destination register
TORNc 7 TORNc 7
NEWSYM FxOpc18 ; TO RN set register n as destination register NEWSYM FxOpc18 ; TO RN set register n as destination register
TORNc 8 TORNc 8
NEWSYM FxOpc19 ; TO RN set register n as destination register NEWSYM FxOpc19 ; TO RN set register n as destination register
TORNc 9 TORNc 9
NEWSYM FxOpc1A ; TO RN set register n as destination register NEWSYM FxOpc1A ; TO RN set register n as destination register
TORNc 10 TORNc 10
NEWSYM FxOpc1B ; TO RN set register n as destination register NEWSYM FxOpc1B ; TO RN set register n as destination register
TORNc 11 TORNc 11
NEWSYM FxOpc1C ; TO RN set register n as destination register NEWSYM FxOpc1C ; TO RN set register n as destination register
TORNc 12 TORNc 12
NEWSYM FxOpc1D ; TO RN set register n as destination register NEWSYM FxOpc1D ; TO RN set register n as destination register
TORNc 13 TORNc 13
NEWSYM FxOpc1E ; TO RN set register n as destination register NEWSYM FxOpc1E ; TO RN set register n as destination register

View File

@@ -264,29 +264,29 @@ NEWSYM FxOpd0F ; BVS branch on overflow set ; Verified.
NEWSYM FxOpd10 ; TO RN set register n as destination register NEWSYM FxOpd10 ; TO RN set register n as destination register
TORNd 0 TORNd 0
NEWSYM FxOpd11 ; TO RN set register n as destination register NEWSYM FxOpd11 ; TO RN set register n as destination register
TORNd 1 TORNd 1
NEWSYM FxOpd12 ; TO RN set register n as destination register NEWSYM FxOpd12 ; TO RN set register n as destination register
TORNd 2 TORNd 2
NEWSYM FxOpd13 ; TO RN set register n as destination register NEWSYM FxOpd13 ; TO RN set register n as destination register
TORNd 3 TORNd 3
NEWSYM FxOpd14 ; TO RN set register n as destination register NEWSYM FxOpd14 ; TO RN set register n as destination register
TORNd 4 TORNd 4
NEWSYM FxOpd15 ; TO RN set register n as destination register NEWSYM FxOpd15 ; TO RN set register n as destination register
TORNd 5 TORNd 5
NEWSYM FxOpd16 ; TO RN set register n as destination register NEWSYM FxOpd16 ; TO RN set register n as destination register
TORNd 6 TORNd 6
NEWSYM FxOpd17 ; TO RN set register n as destination register NEWSYM FxOpd17 ; TO RN set register n as destination register
TORNd 7 TORNd 7
NEWSYM FxOpd18 ; TO RN set register n as destination register NEWSYM FxOpd18 ; TO RN set register n as destination register
TORNd 8 TORNd 8
NEWSYM FxOpd19 ; TO RN set register n as destination register NEWSYM FxOpd19 ; TO RN set register n as destination register
TORNd 9 TORNd 9
NEWSYM FxOpd1A ; TO RN set register n as destination register NEWSYM FxOpd1A ; TO RN set register n as destination register
TORNd 10 TORNd 10
NEWSYM FxOpd1B ; TO RN set register n as destination register NEWSYM FxOpd1B ; TO RN set register n as destination register
TORNd 11 TORNd 11
NEWSYM FxOpd1C ; TO RN set register n as destination register NEWSYM FxOpd1C ; TO RN set register n as destination register
TORNd 12 TORNd 12
NEWSYM FxOpd1D ; TO RN set register n as destination register NEWSYM FxOpd1D ; TO RN set register n as destination register
TORNd 13 TORNd 13
NEWSYM FxOpd1E ; TO RN set register n as destination register NEWSYM FxOpd1E ; TO RN set register n as destination register
@@ -488,21 +488,21 @@ NEWSYM FxOpd4B ; LDW RN load word from RAM
LDWRNc 11 LDWRNc 11
NEWSYM FxOpd40A1 ; LDB RN load byte from RAM NEWSYM FxOpd40A1 ; LDB RN load byte from RAM
LDBRNc 0 LDBRNc 0
NEWSYM FxOpd41A1 ; LDB RN load byte from RAM NEWSYM FxOpd41A1 ; LDB RN load byte from RAM
LDBRNc 1 LDBRNc 1
NEWSYM FxOpd42A1 ; LDB RN load byte from RAM NEWSYM FxOpd42A1 ; LDB RN load byte from RAM
LDBRNc 2 LDBRNc 2
NEWSYM FxOpd43A1 ; LDB RN load byte from RAM NEWSYM FxOpd43A1 ; LDB RN load byte from RAM
LDBRNc 3 LDBRNc 3
NEWSYM FxOpd44A1 ; LDB RN load byte from RAM NEWSYM FxOpd44A1 ; LDB RN load byte from RAM
LDBRNc 4 LDBRNc 4
NEWSYM FxOpd45A1 ; LDB RN load byte from RAM NEWSYM FxOpd45A1 ; LDB RN load byte from RAM
LDBRNc 5 LDBRNc 5
NEWSYM FxOpd46A1 ; LDB RN load byte from RAM NEWSYM FxOpd46A1 ; LDB RN load byte from RAM
LDBRNc 6 LDBRNc 6
NEWSYM FxOpd47A1 ; LDB RN load byte from RAM NEWSYM FxOpd47A1 ; LDB RN load byte from RAM
LDBRNc 7 LDBRNc 7
NEWSYM FxOpd48A1 ; LDB RN load byte from RAM NEWSYM FxOpd48A1 ; LDB RN load byte from RAM
LDBRNc 8 LDBRNc 8
NEWSYM FxOpd49A1 ; LDB RN load byte from RAM NEWSYM FxOpd49A1 ; LDB RN load byte from RAM
@@ -937,7 +937,7 @@ NEWSYM FxOpd4CA1 ; RPIX read color of the pixel with R1,R2 as x,y
NEWSYM FxOpd4D ; SWAP swap upper and lower byte of a register ; V NEWSYM FxOpd4D ; SWAP swap upper and lower byte of a register ; V
mov eax,[esi] ; Read Source mov eax,[esi] ; Read Source
FETCHPIPE FETCHPIPE
ror ax,8 ror ax,8
inc ebp ; Increase program counter inc ebp ; Increase program counter
mov [SfxSignZero],eax mov [SfxSignZero],eax
mov [edi],eax ; Write Destination mov [edi],eax ; Write Destination
@@ -1552,35 +1552,35 @@ NEWSYM FxOpd7FA3 ; BICIRNc register & ~immediate
BICIRNc 15 ^ 0FFFFh BICIRNc 15 ^ 0FFFFh
NEWSYM FxOpd80 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd80 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 0 MULTRNc 0
NEWSYM FxOpd81 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd81 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 1 MULTRNc 1
NEWSYM FxOpd82 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd82 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 2 MULTRNc 2
NEWSYM FxOpd83 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd83 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 3 MULTRNc 3
NEWSYM FxOpd84 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd84 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 4 MULTRNc 4
NEWSYM FxOpd85 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd85 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 5 MULTRNc 5
NEWSYM FxOpd86 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd86 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 6 MULTRNc 6
NEWSYM FxOpd87 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd87 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 7 MULTRNc 7
NEWSYM FxOpd88 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd88 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 8 MULTRNc 8
NEWSYM FxOpd89 ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd89 ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 9 MULTRNc 9
NEWSYM FxOpd8A ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8A ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 10 MULTRNc 10
NEWSYM FxOpd8B ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8B ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 11 MULTRNc 11
NEWSYM FxOpd8C ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8C ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 12 MULTRNc 12
NEWSYM FxOpd8D ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8D ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 13 MULTRNc 13
NEWSYM FxOpd8E ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8E ; MULTRNc 8 bit to 16 bit signed multiply, register * register
MULTRNc 14 MULTRNc 14
NEWSYM FxOpd8F ; MULTRNc 8 bit to 16 bit signed multiply, register * register NEWSYM FxOpd8F ; MULTRNc 8 bit to 16 bit signed multiply, register * register
FETCHPIPE FETCHPIPE
mov ebx,ebp mov ebx,ebp

View File

@@ -32,8 +32,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* of thanks and credit for figuring this out. * of thanks and credit for figuring this out.
* *
* Andreas says: * Andreas says:
* The author is greatly indebted with The Dumper, without whose help and * The author is greatly indebted with The Dumper, without whose help and
* patience providing him with real S-DD1 data the research had never been * patience providing him with real S-DD1 data the research had never been
* possible. He also wish to note that in the very beggining of his research, * possible. He also wish to note that in the very beggining of his research,
* Neviksti had done some steps in the right direction. By last, the author is * Neviksti had done some steps in the right direction. By last, the author is
* indirectly indebted to all the people that worked and contributed in the * indirectly indebted to all the people that worked and contributed in the
@@ -163,7 +163,7 @@ INLINE unsigned char ProbGetBit(unsigned char context){
INLINE unsigned char GetBit(unsigned char cur_bitplane){ INLINE unsigned char GetBit(unsigned char cur_bitplane){
unsigned char bit; unsigned char bit;
bit=ProbGetBit(((cur_bitplane&1)<<4) bit=ProbGetBit(((cur_bitplane&1)<<4)
| ((prev_bits[cur_bitplane]&high_context_bits)>>5) | ((prev_bits[cur_bitplane]&high_context_bits)>>5)
| (prev_bits[cur_bitplane]&low_context_bits)); | (prev_bits[cur_bitplane]&low_context_bits));

View File

@@ -206,7 +206,7 @@ void ST010_OP01(short x0, short y0, short *x1, short *y1, short *Quadrant, short
else else
{ {
*x1 = x0; *x1 = x0;
*y1 = y0; *y1 = y0;
*Quadrant = 0x0000; *Quadrant = 0x0000;
} }
@@ -238,7 +238,7 @@ void ST010_Rotate(short Theta, short X0, short Y0, short *X1, short *Y1)
*Y1 = (Y0 * ST010_Cos(Theta) >> 15) - (X0 * ST010_Sin(Theta) >> 15); *Y1 = (Y0 * ST010_Cos(Theta) >> 15) - (X0 * ST010_Sin(Theta) >> 15);
} }
void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32]) void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
{ {
bool Sorted; bool Sorted;
uint16 Temp; uint16 Temp;
@@ -251,12 +251,12 @@ void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
Sorted = true; Sorted = true;
for (i = 0; i < Positions - 1; i++) for (i = 0; i < Positions - 1; i++)
{ {
if (Places[i] < Places[i + 1]) if (Places[i] < Places[i + 1])
{ {
Temp = Places[i + 1]; Temp = Places[i + 1];
Places[i + 1] = Places[i]; Places[i + 1] = Places[i];
Places[i] = Temp; Places[i] = Temp;
Temp = Drivers[i + 1]; Temp = Drivers[i + 1];
Drivers[i + 1] = Drivers[i]; Drivers[i + 1] = Drivers[i];
Drivers[i] = Temp; Drivers[i] = Temp;
@@ -278,13 +278,13 @@ void ST010DoCommand(void)
{ {
/* /*
Calculate track data based on direction coords Calculate track data based on direction coords
Input Input
0x0000-0x0001 : DX (signed) 0x0000-0x0001 : DX (signed)
0x0002-0x0003 : DY (signed) 0x0002-0x0003 : DY (signed)
Output Output
0x0010-0x0011 : Angle (signed) 0x0010-0x0011 : Angle (signed)
*/ */
case 0x01: case 0x01:
{ {
@@ -295,13 +295,13 @@ void ST010DoCommand(void)
break; break;
//Sorts a bunch of values by weight //Sorts a bunch of values by weight
case 0x02: case 0x02:
{ {
ST010_SortDrivers(*(short*)&SRAM[0x0024], (uint16*)&SRAM[0x0040], (uint16*)&SRAM[0x0080]); ST010_SortDrivers(*(short*)&SRAM[0x0024], (uint16*)&SRAM[0x0040], (uint16*)&SRAM[0x0080]);
} }
break; break;
/* /*
Two Dimensional Coordinate Scale Two Dimensional Coordinate Scale
@@ -312,8 +312,8 @@ void ST010DoCommand(void)
Output Output
0x0010-0x0013 : X1 (signed) 0x0010-0x0013 : X1 (signed)
0x0014-0x0017 : Y1 (signed) 0x0014-0x0017 : Y1 (signed)
*/ */
case 0x03: case 0x03:
{ {
ST010_Scale(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (int *)&SRAM[0x10], (int *)&SRAM[0x14]); ST010_Scale(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (int *)&SRAM[0x10], (int *)&SRAM[0x14]);
@@ -344,7 +344,7 @@ void ST010DoCommand(void)
//Target (x,y) coordinates //Target (x,y) coordinates
int16 ypos_max = ST010_WORD(0x00C0); int16 ypos_max = ST010_WORD(0x00C0);
int16 xpos_max = ST010_WORD(0x00C2); int16 xpos_max = ST010_WORD(0x00C2);
//Current coordinates and direction //Current coordinates and direction
int32 ypos = SRAM[0xC4]|(SRAM[0xC5]<<8)|(SRAM[0xC6]<<16)|(SRAM[0xC7]<<24); int32 ypos = SRAM[0xC4]|(SRAM[0xC5]<<8)|(SRAM[0xC6]<<16)|(SRAM[0xC7]<<24);
int32 xpos = SRAM[0xC8]|(SRAM[0xC9]<<8)|(SRAM[0xCA]<<16)|(SRAM[0xCB]<<24); int32 xpos = SRAM[0xC8]|(SRAM[0xC9]<<8)|(SRAM[0xCA]<<16)|(SRAM[0xCB]<<24);
@@ -395,7 +395,7 @@ void ST010DoCommand(void)
{ {
speed = 0x100; speed = 0x100;
} }
//Slow down for sharp curves //Slow down for sharp curves
else if (abs(o1-rot)>=0x1000) else if (abs(o1-rot)>=0x1000)
{ {
@@ -476,7 +476,7 @@ void ST010DoCommand(void)
SRAM[0x00DD]=(uint8)(flags >> 8); SRAM[0x00DD]=(uint8)(flags >> 8);
} }
break; break;
/* /*
16-bit Multiplication 16-bit Multiplication
@@ -493,7 +493,7 @@ void ST010DoCommand(void)
} }
break; break;
/* /*
Mode 7 Raster Data Calculation Mode 7 Raster Data Calculation
Input Input
@@ -503,7 +503,7 @@ void ST010DoCommand(void)
0x0250-0x03af : Mode 7 Matrix B 0x0250-0x03af : Mode 7 Matrix B
0x03b0-0x050f : Mode 7 Matrix C 0x03b0-0x050f : Mode 7 Matrix C
0x0510-0x066f : Mode 7 Matrix D 0x0510-0x066f : Mode 7 Matrix D
*/ */
case 0x07: case 0x07:
{ {
@@ -519,7 +519,7 @@ void ST010DoCommand(void)
SRAM[0x00f0 + offset]=(uint8)(data); SRAM[0x00f0 + offset]=(uint8)(data);
SRAM[0x00f1 + offset]=(uint8)(data >> 8); SRAM[0x00f1 + offset]=(uint8)(data >> 8);
SRAM[0x0510 + offset]=(uint8)(data); SRAM[0x0510 + offset]=(uint8)(data);
SRAM[0x0511 + offset]=(uint8)(data >> 8); SRAM[0x0511 + offset]=(uint8)(data >> 8);
//Calculate Mode 7 Matrix B/C data //Calculate Mode 7 Matrix B/C data
data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15; data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15;
@@ -527,10 +527,10 @@ void ST010DoCommand(void)
SRAM[0x0251 + offset]=(uint8)(data >> 8); SRAM[0x0251 + offset]=(uint8)(data >> 8);
if (data) { data = ~data; } if (data) { data = ~data; }
SRAM[0x03b0 + offset]=(uint8)(data); SRAM[0x03b0 + offset]=(uint8)(data);
SRAM[0x03b1 + offset]=(uint8)(data >> 8); SRAM[0x03b1 + offset]=(uint8)(data >> 8);
offset += 2; offset += 2;
} }
@@ -551,7 +551,7 @@ void ST010DoCommand(void)
0x0010-0x0011 : X1 (signed) 0x0010-0x0011 : X1 (signed)
0x0012-0x0013 : Y1 (signed) 0x0012-0x0013 : Y1 (signed)
*/ */
case 0x08: case 0x08:
{ {
ST010_Rotate(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (short *)&SRAM[0x10], (short *)&SRAM[0x12]); ST010_Rotate(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (short *)&SRAM[0x10], (short *)&SRAM[0x12]);

View File

@@ -438,7 +438,7 @@ NEWSYM reg3010w
ret ret
NEWSYM reg3011w NEWSYM reg3011w
mov [SfxR8+1],al mov [SfxR8+1],al
ret ret
NEWSYM reg3012w NEWSYM reg3012w
mov [SfxR9],al mov [SfxR9],al
ret ret

View File

@@ -590,7 +590,7 @@ NEWSYM AdjustFrequency
.fir_mmx .fir_mmx
mov ebx, DSPInterpolate_8 mov ebx, DSPInterpolate_8
.notgaussian .notgaussian
mov [DSPInterpolate],ebx mov [DSPInterpolate],ebx
@@ -4876,7 +4876,7 @@ NEWSYM EchoStereo
jne near %2 jne near %2
mov ebp,%1 mov ebp,%1
mov dword[powhack],1<<%1 mov dword[powhack],1<<%1
mov eax,%1 mov eax,%1
dec al dec al
cmp al,0FFh cmp al,0FFh
@@ -5227,10 +5227,10 @@ NEWSYM ProcessSoundBuffer
cmp byte[EMUPause],1 cmp byte[EMUPause],1
jne .nopause jne .nopause
ret ret
.nopause .nopause
; Process the sound :I ; Process the sound :I
ProcessVoiceHandler16 0,ProcessVoice116,1,254 ProcessVoiceHandler16 0,ProcessVoice116,1,254
NEWSYM ProcessVoice116 NEWSYM ProcessVoice116
ProcessVoiceHandler16 1,ProcessVoice216,2,253 ProcessVoiceHandler16 1,ProcessVoice216,2,253

View File

@@ -103,7 +103,7 @@ NEWSYM ProcessRewind
call BackupPauseFrame call BackupPauseFrame
popad popad
.notpauserewind .notpauserewind
mov esi,[tempesi] mov esi,[tempesi]
mov edi,[tempedi] mov edi,[tempedi]
mov ebp,[tempebp] mov ebp,[tempebp]
@@ -1442,7 +1442,7 @@ NEWSYM cpuover
mov ebp,[tempebp] mov ebp,[tempebp]
mov edx,[tempedx] mov edx,[tempedx]
.nopauseframemode3 .nopauseframemode3
cmp byte[EMUPause],1 cmp byte[EMUPause],1
jne .noemupause jne .noemupause
@@ -1451,14 +1451,14 @@ NEWSYM cpuover
mov [tempedx],edx mov [tempedx],edx
mov [tempesi],esi mov [tempesi],esi
mov [tempedi],edi mov [tempedi],edi
mov [tempebp],ebp mov [tempebp],ebp
pushad pushad
call BackupPauseFrame call BackupPauseFrame
popad popad
.nopauseframemode1 .nopauseframemode1
call ProcessRewind call ProcessRewind
cmp byte[PauseFrameMode],2 cmp byte[PauseFrameMode],2
jne .nopauseframemode2 jne .nopauseframemode2
mov byte[PauseFrameMode],3 mov byte[PauseFrameMode],3
@@ -1477,7 +1477,7 @@ NEWSYM cpuover
call showvideo call showvideo
call cachevideo call cachevideo
popad popad
jmp .nonewgfx jmp .nonewgfx
.noemupause .noemupause

View File

@@ -36,7 +36,7 @@
inc ebp inc ebp
add ebp,ebx add ebp,ebx
ret ret
%endmacro %endmacro
; tcall instruction ; tcall instruction
%macro spctcall 1 %macro spctcall 1

View File

@@ -466,7 +466,7 @@ NEWSYM SBHandler16
inc dword[sbhandexec] inc dword[sbhandexec]
cmp byte [vibracard], 1 cmp byte [vibracard], 1
je .donotcallcmdapos je .donotcallcmdapos
call GetCDMAPos call GetCDMAPos
.donotcallcmdapos .donotcallcmdapos

View File

@@ -208,7 +208,7 @@ NEWSYM InitVesa2
jnc .int1ok jnc .int1ok
mov edx,.noint1message mov edx,.noint1message
jmp VESA2EXITTODOS jmp VESA2EXITTODOS
.int1ok ; Real mode int successful!!! .int1ok ; Real mode int successful!!!
mov eax,[RMREGS.eax] mov eax,[RMREGS.eax]
@@ -222,7 +222,7 @@ NEWSYM InitVesa2
jz .vesadetected ; Check for presence of vesa jz .vesadetected ; Check for presence of vesa
mov edx,.novesamessage mov edx,.novesamessage
jmp VESA2EXITTODOS jmp VESA2EXITTODOS
.vesadetected .vesadetected
cmp word[fs:0004],200h cmp word[fs:0004],200h
@@ -608,7 +608,7 @@ NEWSYM InitVesa2
jz .modesetok jz .modesetok
mov edx,.unableset mov edx,.unableset
jmp VESA2EXITTODOS ; Failure!!! jmp VESA2EXITTODOS ; Failure!!!
.modesetok .modesetok
;******************************* EXTRA BIT **************************** ;******************************* EXTRA BIT ****************************

View File

@@ -91,7 +91,7 @@ SECTION .data
dw 03d4h,04a04h,03d4h,09a05h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h dw 03d4h,04a04h,03d4h,09a05h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h
dw 03d4h,06109h,03d4h,0da10h,03d4h,0ac11h,03d4h,0bf12h,03d4h,02013h dw 03d4h,06109h,03d4h,0da10h,03d4h,0ac11h,03d4h,0bf12h,03d4h,02013h
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
dw 03c4h,00e04h,03cEh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h dw 03c4h,00e04h,03cEh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
dd 0 dd 0
.Mode256x240c .Mode256x240c
@@ -107,7 +107,7 @@ SECTION .data
dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,0b207h,03d4h,00008h dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,0b207h,03d4h,00008h
dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0FF12h,03d4h,02013h dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0FF12h,03d4h,02013h
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
dd 0 dd 0
.Mode256x256cs .Mode256x256cs
@@ -115,7 +115,7 @@ SECTION .data
dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,01d07h,03d4h,00008h dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,01d07h,03d4h,00008h
dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02013h dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02013h
dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h
dw 03c4h,00e04h,03ceh,04005h,03cEh,00506h,03c0h,04110h,03c0h,00013h dw 03c4h,00e04h,03ceh,04005h,03cEh,00506h,03c0h,04110h,03c0h,00013h
dd 0 dd 0
.Mode320x224 .Mode320x224
@@ -131,7 +131,7 @@ SECTION .data
dw 03d4h,05404h,03d4h,08005h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h dw 03d4h,05404h,03d4h,08005h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h
dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02813h dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02813h
dw 03d4h,00014h,03d4h,0e715h,03d4h,00616h,03d4h,0e317h,03c4h,00101h dw 03d4h,00014h,03d4h,0e715h,03d4h,00616h,03d4h,0e317h,03c4h,00101h
dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h
dd 0 dd 0
.Mode320x256 .Mode320x256

View File

@@ -114,7 +114,7 @@ DWORD ZOpenFile()
{ {
if(ZOpenMode==0) if(ZOpenMode==0)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
@@ -127,11 +127,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==1) if(ZOpenMode==1)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -140,11 +140,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==2) if(ZOpenMode==2)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"r+b");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -172,7 +172,7 @@ DWORD ZFileSeek()
mode = SEEK_SET; mode = SEEK_SET;
else if (ZFileSeekMode==1) { else if (ZFileSeekMode==1) {
mode = SEEK_END; mode = SEEK_END;
if (TextFile==0) if (TextFile==0)
printf("Warning : gzseek(SEEK_END) not supported"); printf("Warning : gzseek(SEEK_END) not supported");
} else return (0xFFFFFFFF); } else return (0xFFFFFFFF);
@@ -194,8 +194,8 @@ DWORD ZFileRead()
ZFileReadSize, ZFileReadSize,
FILEHANDLE[ZFileReadHandle])); FILEHANDLE[ZFileReadHandle]));
else else
return(gzread(FILEHANDLE[ZFileReadHandle], return(gzread(FILEHANDLE[ZFileReadHandle],
ZFileReadBlock, ZFileReadBlock,
ZFileReadSize)); ZFileReadSize));
} }
@@ -209,11 +209,11 @@ DWORD ZFileWrite()
ZFileWriteSize, ZFileWriteSize,
FILEHANDLE[ZFileWriteHandle]); FILEHANDLE[ZFileWriteHandle]);
else else
res = gzwrite(FILEHANDLE[ZFileWriteHandle], res = gzwrite(FILEHANDLE[ZFileWriteHandle],
ZFileWriteBlock, ZFileWriteBlock,
ZFileWriteSize); ZFileWriteSize);
if (res!=ZFileWriteSize) if (res!=ZFileWriteSize)
return(0xFFFFFFFF); return(0xFFFFFFFF);
return(0); return(0);

View File

@@ -109,7 +109,7 @@ void genpal()
{ {
pal[i]=pal[i-1]; pal[i]=pal[i-1];
{ {
struct colorvalue *with = &pal[i]; struct colorvalue *with = &pal[i];
if (with->r<255) with->r += 1; if (with->r<255) with->r += 1;
if (with->r<255) with->r += 1; if (with->r<255) with->r += 1;
@@ -125,8 +125,8 @@ int started = 0;
#if 0 // emulating Turbo Pascal #if 0 // emulating Turbo Pascal
unsigned int randseed; unsigned int randseed;
const unsigned modulus = 2147483647; const unsigned modulus = 2147483647;
const unsigned factor = 397204094; const unsigned factor = 397204094;
void Randomize() void Randomize()
{ {
@@ -136,13 +136,13 @@ void Randomize()
unsigned int randint(unsigned range) unsigned int randint(unsigned range)
{ {
randseed = randseed * factor % modulus; randseed = randseed * factor % modulus;
return range ? randseed % range : 0; return range ? randseed % range : 0;
} }
double randreal() double randreal()
{ {
randseed = randseed * factor % modulus; randseed = randseed * factor % modulus;
return (double)randseed / modulus; return (double)randseed / modulus;
} }
int rand1(int r) /* Return a random number between -R And R*/ int rand1(int r) /* Return a random number between -R And R*/
@@ -241,14 +241,14 @@ int v;
if ((v==0) || if ((v==0) ||
(v<decay) || (v<decay) ||
(i<=xstart) || (i<=xstart) ||
(i>=xend)) (i>=xend))
pt[(j-1)*BUF_WIDTH + i] = 0; pt[(j-1)*BUF_WIDTH + i] = 0;
else else
pt[((j-1)*BUF_WIDTH) + (i-(randint(3)-1))] = v - randint(decay); pt[((j-1)*BUF_WIDTH) + (i-(randint(3)-1))] = v - randint(decay);
} }
/*Match?*/ /*Match?*/
if (randint(150)==0) if (randint(150)==0)
memset(flamearray + xstart + randint(xend-xstart-5),255,5); memset(flamearray + xstart + randint(xend-xstart-5),255,5);
/*This loop controls the "root" of the /*This loop controls the "root" of the

View File

@@ -26,394 +26,394 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
int FSinTab[2048] = int FSinTab[2048] =
{ {
0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, 2613, 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, 2613,
2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, 5222, 2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, 5222,
5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, 7822, 5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, 7822,
8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, 10410, 8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, 10410,
10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, 12588, 10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, 12588,
12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, 14751, 12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, 14751,
14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, 16897, 14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, 16897,
17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, 19024, 17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, 19024,
19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, 21129, 19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, 21129,
21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, 23210, 21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, 23210,
23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, 25265, 23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, 25265,
25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, 27291, 25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, 27291,
27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, 29285, 27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, 29285,
29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, 31247, 29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, 31247,
31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, 33173, 31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, 33173,
33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, 35061, 33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, 35061,
35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, 36909, 35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, 36909,
37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, 38716, 37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, 38716,
38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, 40478, 38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, 40478,
40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, 42194, 40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, 42194,
42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, 43862, 42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, 43862,
44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, 45480, 44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, 45480,
45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, 47046, 45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, 47046,
47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, 48558, 47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, 48558,
48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, 50016, 48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, 50016,
50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, 51416, 50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, 51416,
51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, 52758, 51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, 52758,
52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, 54040, 52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, 54040,
54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, 55260, 54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, 55260,
55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, 56417, 55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, 56417,
56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, 57510, 56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, 57510,
57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, 58538, 57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, 58538,
58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, 59499, 58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, 59499,
59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, 60392, 59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, 60392,
60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, 61216, 60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, 61216,
61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, 61971, 61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, 61971,
62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, 62655, 62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, 62655,
62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, 63268, 62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, 63268,
63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, 63808, 63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, 63808,
63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, 64276, 63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, 64276,
64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, 64671, 64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, 64671,
64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, 64992, 64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, 64992,
65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, 65239, 65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, 65239,
65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, 65412, 65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, 65412,
65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, 65511, 65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, 65511,
65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535, 65536, 65535, 65534, 65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535, 65536, 65535, 65534,
65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, 65498, 65491, 65483, 65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, 65498, 65491, 65483,
65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, 65386, 65372, 65358, 65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, 65386, 65372, 65358,
65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, 65200, 65179, 65158, 65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, 65200, 65179, 65158,
65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, 64939, 64912, 64884, 65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, 64939, 64912, 64884,
64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, 64605, 64571, 64536, 64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, 64605, 64571, 64536,
64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, 64197, 64156, 64115, 64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, 64197, 64156, 64115,
64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, 63715, 63668, 63620, 64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, 63715, 63668, 63620,
63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, 63162, 63108, 63053, 63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, 63162, 63108, 63053,
62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, 62536, 62475, 62414, 62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, 62536, 62475, 62414,
62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, 61839, 61772, 61705, 62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, 61839, 61772, 61705,
61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, 61071, 60998, 60924, 61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, 61071, 60998, 60924,
60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, 60235, 60155, 60075, 60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, 60235, 60155, 60075,
59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, 59329, 59243, 59157, 59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, 59329, 59243, 59157,
59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, 58356, 58264, 58172, 59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, 58356, 58264, 58172,
58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, 57316, 57219, 57120, 58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, 57316, 57219, 57120,
57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, 56212, 56108, 56004, 57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, 56212, 56108, 56004,
55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, 55043, 54933, 54823, 55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, 55043, 54933, 54823,
54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, 53811, 53696, 53581, 54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, 53811, 53696, 53581,
53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, 52518, 52398, 52277, 53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, 52518, 52398, 52277,
52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, 51166, 51040, 50914, 52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, 51166, 51040, 50914,
50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, 49755, 49624, 49492, 50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, 49755, 49624, 49492,
49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, 48288, 48151, 48015, 49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, 48288, 48151, 48015,
47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, 46765, 46624, 46482, 47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, 46765, 46624, 46482,
46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, 45189, 45043, 44897, 46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, 45189, 45043, 44897,
44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, 43562, 43412, 43261, 44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, 43562, 43412, 43261,
43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, 41885, 41730, 41575, 43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, 41885, 41730, 41575,
41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, 40161, 40002, 39842, 41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, 40161, 40002, 39842,
39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, 38390, 38227, 38064, 39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, 38390, 38227, 38064,
37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, 36576, 36409, 36242, 37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, 36576, 36409, 36242,
36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, 34721, 34550, 34379, 36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, 34721, 34550, 34379,
34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, 32826, 32651, 32477, 34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, 32826, 32651, 32477,
32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, 30893, 30715, 30538, 32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, 30893, 30715, 30538,
30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, 28925, 28745, 28564, 30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, 28925, 28745, 28564,
28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, 26925, 26741, 26557, 28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, 26925, 26741, 26557,
26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, 24893, 24707, 24521, 26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, 24893, 24707, 24521,
24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, 22833, 22645, 22456, 24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, 22833, 22645, 22456,
22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, 20748, 20557, 20366, 22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, 20748, 20557, 20366,
20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, 18638, 18446, 18253, 20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, 18638, 18446, 18253,
18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, 16508, 16313, 16118, 18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, 16508, 16313, 16118,
15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, 14359, 14162, 13966, 15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, 14359, 14162, 13966,
13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, 12193, 11995, 11797, 13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, 12193, 11995, 11797,
11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, 10013, 9814, 9616, 9417, 11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, 10013, 9814, 9616, 9417,
9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, 7423, 7223, 7023, 6823, 9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, 7423, 7223, 7023, 6823,
6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, 4821, 4620, 4420, 4219, 6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, 4821, 4620, 4420, 4219,
4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, 2211, 2010, 1809, 1608, 4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, 2211, 2010, 1809, 1608,
1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, -603, -804, -1005, -1206, 1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, -603, -804, -1005, -1206,
-1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, -3014, -3215, -3416, -1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, -3014, -3215, -3416,
-3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, -5222, -5422, -5622, -3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, -5222, -5422, -5622,
-5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, -7423, -7623, -7822, -5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, -7423, -7623, -7822,
-8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, -9616, -9814, -10013, -8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, -9616, -9814, -10013,
-10212, -10410, -10609, -10807, -11006, -11204, -11402, -11600, -11797, -11995, -10212, -10410, -10609, -10807, -11006, -11204, -11402, -11600, -11797, -11995,
-12193, -12390, -12588, -12785, -12982, -13179, -13376, -13573, -13769, -13966, -12193, -12390, -12588, -12785, -12982, -13179, -13376, -13573, -13769, -13966,
-14162, -14359, -14555, -14751, -14946, -15142, -15338, -15533, -15728, -15923, -14162, -14359, -14555, -14751, -14946, -15142, -15338, -15533, -15728, -15923,
-16118, -16313, -16508, -16702, -16897, -17091, -17285, -17479, -17672, -17866, -16118, -16313, -16508, -16702, -16897, -17091, -17285, -17479, -17672, -17866,
-18059, -18253, -18446, -18638, -18831, -19024, -19216, -19408, -19600, -19792, -18059, -18253, -18446, -18638, -18831, -19024, -19216, -19408, -19600, -19792,
-19983, -20175, -20366, -20557, -20748, -20938, -21129, -21319, -21509, -21699, -19983, -20175, -20366, -20557, -20748, -20938, -21129, -21319, -21509, -21699,
-21889, -22078, -22267, -22456, -22645, -22833, -23022, -23210, -23398, -23586, -21889, -22078, -22267, -22456, -22645, -22833, -23022, -23210, -23398, -23586,
-23773, -23960, -24147, -24334, -24521, -24707, -24893, -25079, -25265, -25450, -23773, -23960, -24147, -24334, -24521, -24707, -24893, -25079, -25265, -25450,
-25635, -25820, -26005, -26189, -26373, -26557, -26741, -26925, -27108, -27291, -25635, -25820, -26005, -26189, -26373, -26557, -26741, -26925, -27108, -27291,
-27473, -27656, -27838, -28020, -28201, -28383, -28564, -28745, -28925, -29105, -27473, -27656, -27838, -28020, -28201, -28383, -28564, -28745, -28925, -29105,
-29285, -29465, -29645, -29824, -30003, -30181, -30360, -30538, -30715, -30893, -29285, -29465, -29645, -29824, -30003, -30181, -30360, -30538, -30715, -30893,
-31070, -31247, -31424, -31600, -31776, -31952, -32127, -32302, -32477, -32651, -31070, -31247, -31424, -31600, -31776, -31952, -32127, -32302, -32477, -32651,
-32826, -32999, -33173, -33346, -33519, -33692, -33864, -34036, -34208, -34379, -32826, -32999, -33173, -33346, -33519, -33692, -33864, -34036, -34208, -34379,
-34550, -34721, -34891, -35061, -35231, -35400, -35569, -35738, -35906, -36074, -34550, -34721, -34891, -35061, -35231, -35400, -35569, -35738, -35906, -36074,
-36242, -36409, -36576, -36743, -36909, -37075, -37241, -37406, -37571, -37736, -36242, -36409, -36576, -36743, -36909, -37075, -37241, -37406, -37571, -37736,
-37900, -38064, -38227, -38390, -38553, -38716, -38878, -39039, -39201, -39362, -37900, -38064, -38227, -38390, -38553, -38716, -38878, -39039, -39201, -39362,
-39522, -39682, -39842, -40002, -40161, -40319, -40478, -40636, -40793, -40950, -39522, -39682, -39842, -40002, -40161, -40319, -40478, -40636, -40793, -40950,
-41107, -41263, -41419, -41575, -41730, -41885, -42040, -42194, -42347, -42501, -41107, -41263, -41419, -41575, -41730, -41885, -42040, -42194, -42347, -42501,
-42653, -42806, -42958, -43110, -43261, -43412, -43562, -43712, -43862, -44011, -42653, -42806, -42958, -43110, -43261, -43412, -43562, -43712, -43862, -44011,
-44160, -44308, -44456, -44603, -44750, -44897, -45043, -45189, -45335, -45480, -44160, -44308, -44456, -44603, -44750, -44897, -45043, -45189, -45335, -45480,
-45624, -45768, -45912, -46055, -46198, -46340, -46482, -46624, -46765, -46906, -45624, -45768, -45912, -46055, -46198, -46340, -46482, -46624, -46765, -46906,
-47046, -47186, -47325, -47464, -47602, -47740, -47878, -48015, -48151, -48288, -47046, -47186, -47325, -47464, -47602, -47740, -47878, -48015, -48151, -48288,
-48423, -48558, -48693, -48828, -48961, -49095, -49228, -49360, -49492, -49624, -48423, -48558, -48693, -48828, -48961, -49095, -49228, -49360, -49492, -49624,
-49755, -49886, -50016, -50146, -50275, -50403, -50532, -50660, -50787, -50914, -49755, -49886, -50016, -50146, -50275, -50403, -50532, -50660, -50787, -50914,
-51040, -51166, -51291, -51416, -51541, -51665, -51788, -51911, -52033, -52155, -51040, -51166, -51291, -51416, -51541, -51665, -51788, -51911, -52033, -52155,
-52277, -52398, -52518, -52639, -52758, -52877, -52996, -53114, -53231, -53348, -52277, -52398, -52518, -52639, -52758, -52877, -52996, -53114, -53231, -53348,
-53465, -53581, -53696, -53811, -53926, -54040, -54153, -54266, -54379, -54491, -53465, -53581, -53696, -53811, -53926, -54040, -54153, -54266, -54379, -54491,
-54602, -54713, -54823, -54933, -55043, -55152, -55260, -55368, -55475, -55582, -54602, -54713, -54823, -54933, -55043, -55152, -55260, -55368, -55475, -55582,
-55688, -55794, -55899, -56004, -56108, -56212, -56315, -56417, -56519, -56621, -55688, -55794, -55899, -56004, -56108, -56212, -56315, -56417, -56519, -56621,
-56722, -56822, -56922, -57022, -57120, -57219, -57316, -57414, -57510, -57606, -56722, -56822, -56922, -57022, -57120, -57219, -57316, -57414, -57510, -57606,
-57702, -57797, -57892, -57986, -58079, -58172, -58264, -58356, -58447, -58538, -57702, -57797, -57892, -57986, -58079, -58172, -58264, -58356, -58447, -58538,
-58628, -58718, -58807, -58895, -58983, -59070, -59157, -59243, -59329, -59414, -58628, -58718, -58807, -58895, -58983, -59070, -59157, -59243, -59329, -59414,
-59499, -59583, -59666, -59749, -59831, -59913, -59994, -60075, -60155, -60235, -59499, -59583, -59666, -59749, -59831, -59913, -59994, -60075, -60155, -60235,
-60313, -60392, -60470, -60547, -60624, -60700, -60775, -60850, -60924, -60998, -60313, -60392, -60470, -60547, -60624, -60700, -60775, -60850, -60924, -60998,
-61071, -61144, -61216, -61288, -61359, -61429, -61499, -61568, -61637, -61705, -61071, -61144, -61216, -61288, -61359, -61429, -61499, -61568, -61637, -61705,
-61772, -61839, -61905, -61971, -62036, -62100, -62164, -62228, -62291, -62353, -61772, -61839, -61905, -61971, -62036, -62100, -62164, -62228, -62291, -62353,
-62414, -62475, -62536, -62596, -62655, -62714, -62772, -62829, -62886, -62942, -62414, -62475, -62536, -62596, -62655, -62714, -62772, -62829, -62886, -62942,
-62998, -63053, -63108, -63162, -63215, -63268, -63320, -63371, -63422, -63473, -62998, -63053, -63108, -63162, -63215, -63268, -63320, -63371, -63422, -63473,
-63522, -63571, -63620, -63668, -63715, -63762, -63808, -63854, -63899, -63943, -63522, -63571, -63620, -63668, -63715, -63762, -63808, -63854, -63899, -63943,
-63987, -64030, -64073, -64115, -64156, -64197, -64237, -64276, -64315, -64353, -63987, -64030, -64073, -64115, -64156, -64197, -64237, -64276, -64315, -64353,
-64391, -64428, -64465, -64501, -64536, -64571, -64605, -64638, -64671, -64703, -64391, -64428, -64465, -64501, -64536, -64571, -64605, -64638, -64671, -64703,
-64735, -64766, -64796, -64826, -64855, -64884, -64912, -64939, -64966, -64992, -64735, -64766, -64796, -64826, -64855, -64884, -64912, -64939, -64966, -64992,
-65018, -65043, -65067, -65091, -65114, -65136, -65158, -65179, -65200, -65220, -65018, -65043, -65067, -65091, -65114, -65136, -65158, -65179, -65200, -65220,
-65239, -65258, -65276, -65294, -65311, -65327, -65343, -65358, -65372, -65386, -65239, -65258, -65276, -65294, -65311, -65327, -65343, -65358, -65372, -65386,
-65400, -65412, -65424, -65436, -65446, -65457, -65466, -65475, -65483, -65491, -65400, -65412, -65424, -65436, -65446, -65457, -65466, -65475, -65483, -65491,
-65498, -65505, -65511, -65516, -65520, -65524, -65528, -65531, -65533, -65534, -65498, -65505, -65511, -65516, -65520, -65524, -65528, -65531, -65533, -65534,
-65535, -65536, -65535, -65534, -65533, -65531, -65528, -65524, -65520, -65516, -65535, -65536, -65535, -65534, -65533, -65531, -65528, -65524, -65520, -65516,
-65511, -65505, -65498, -65491, -65483, -65475, -65466, -65457, -65446, -65436, -65511, -65505, -65498, -65491, -65483, -65475, -65466, -65457, -65446, -65436,
-65424, -65412, -65400, -65386, -65372, -65358, -65343, -65327, -65311, -65294, -65424, -65412, -65400, -65386, -65372, -65358, -65343, -65327, -65311, -65294,
-65276, -65258, -65239, -65220, -65200, -65179, -65158, -65136, -65114, -65091, -65276, -65258, -65239, -65220, -65200, -65179, -65158, -65136, -65114, -65091,
-65067, -65043, -65018, -64992, -64966, -64939, -64912, -64884, -64855, -64826, -65067, -65043, -65018, -64992, -64966, -64939, -64912, -64884, -64855, -64826,
-64796, -64766, -64735, -64703, -64671, -64638, -64605, -64571, -64536, -64501, -64796, -64766, -64735, -64703, -64671, -64638, -64605, -64571, -64536, -64501,
-64465, -64428, -64391, -64353, -64315, -64276, -64237, -64197, -64156, -64115, -64465, -64428, -64391, -64353, -64315, -64276, -64237, -64197, -64156, -64115,
-64073, -64030, -63987, -63943, -63899, -63854, -63808, -63762, -63715, -63668, -64073, -64030, -63987, -63943, -63899, -63854, -63808, -63762, -63715, -63668,
-63620, -63571, -63522, -63473, -63422, -63371, -63320, -63268, -63215, -63162, -63620, -63571, -63522, -63473, -63422, -63371, -63320, -63268, -63215, -63162,
-63108, -63053, -62998, -62942, -62886, -62829, -62772, -62714, -62655, -62596, -63108, -63053, -62998, -62942, -62886, -62829, -62772, -62714, -62655, -62596,
-62536, -62475, -62414, -62353, -62291, -62228, -62164, -62100, -62036, -61971, -62536, -62475, -62414, -62353, -62291, -62228, -62164, -62100, -62036, -61971,
-61905, -61839, -61772, -61705, -61637, -61568, -61499, -61429, -61359, -61288, -61905, -61839, -61772, -61705, -61637, -61568, -61499, -61429, -61359, -61288,
-61216, -61144, -61071, -60998, -60924, -60850, -60775, -60700, -60624, -60547, -61216, -61144, -61071, -60998, -60924, -60850, -60775, -60700, -60624, -60547,
-60470, -60392, -60313, -60235, -60155, -60075, -59994, -59913, -59831, -59749, -60470, -60392, -60313, -60235, -60155, -60075, -59994, -59913, -59831, -59749,
-59666, -59583, -59499, -59414, -59329, -59243, -59157, -59070, -58983, -58895, -59666, -59583, -59499, -59414, -59329, -59243, -59157, -59070, -58983, -58895,
-58807, -58718, -58628, -58538, -58447, -58356, -58264, -58172, -58079, -57986, -58807, -58718, -58628, -58538, -58447, -58356, -58264, -58172, -58079, -57986,
-57892, -57797, -57702, -57606, -57510, -57414, -57316, -57219, -57120, -57022, -57892, -57797, -57702, -57606, -57510, -57414, -57316, -57219, -57120, -57022,
-56922, -56822, -56722, -56621, -56519, -56417, -56315, -56212, -56108, -56004, -56922, -56822, -56722, -56621, -56519, -56417, -56315, -56212, -56108, -56004,
-55899, -55794, -55688, -55582, -55475, -55368, -55260, -55152, -55043, -54933, -55899, -55794, -55688, -55582, -55475, -55368, -55260, -55152, -55043, -54933,
-54823, -54713, -54602, -54491, -54379, -54266, -54153, -54040, -53926, -53811, -54823, -54713, -54602, -54491, -54379, -54266, -54153, -54040, -53926, -53811,
-53696, -53581, -53465, -53348, -53231, -53114, -52996, -52877, -52758, -52639, -53696, -53581, -53465, -53348, -53231, -53114, -52996, -52877, -52758, -52639,
-52518, -52398, -52277, -52155, -52033, -51911, -51788, -51665, -51541, -51416, -52518, -52398, -52277, -52155, -52033, -51911, -51788, -51665, -51541, -51416,
-51291, -51166, -51040, -50914, -50787, -50660, -50532, -50403, -50275, -50146, -51291, -51166, -51040, -50914, -50787, -50660, -50532, -50403, -50275, -50146,
-50016, -49886, -49755, -49624, -49492, -49360, -49228, -49095, -48961, -48828, -50016, -49886, -49755, -49624, -49492, -49360, -49228, -49095, -48961, -48828,
-48693, -48558, -48423, -48288, -48151, -48015, -47878, -47740, -47602, -47464, -48693, -48558, -48423, -48288, -48151, -48015, -47878, -47740, -47602, -47464,
-47325, -47186, -47046, -46906, -46765, -46624, -46482, -46340, -46198, -46055, -47325, -47186, -47046, -46906, -46765, -46624, -46482, -46340, -46198, -46055,
-45912, -45768, -45624, -45480, -45335, -45189, -45043, -44897, -44750, -44603, -45912, -45768, -45624, -45480, -45335, -45189, -45043, -44897, -44750, -44603,
-44456, -44308, -44160, -44011, -43862, -43712, -43562, -43412, -43261, -43110, -44456, -44308, -44160, -44011, -43862, -43712, -43562, -43412, -43261, -43110,
-42958, -42806, -42653, -42501, -42347, -42194, -42040, -41885, -41730, -41575, -42958, -42806, -42653, -42501, -42347, -42194, -42040, -41885, -41730, -41575,
-41419, -41263, -41107, -40950, -40793, -40636, -40478, -40319, -40161, -40002, -41419, -41263, -41107, -40950, -40793, -40636, -40478, -40319, -40161, -40002,
-39842, -39682, -39522, -39362, -39201, -39039, -38878, -38716, -38553, -38390, -39842, -39682, -39522, -39362, -39201, -39039, -38878, -38716, -38553, -38390,
-38227, -38064, -37900, -37736, -37571, -37406, -37241, -37075, -36909, -36743, -38227, -38064, -37900, -37736, -37571, -37406, -37241, -37075, -36909, -36743,
-36576, -36409, -36242, -36074, -35906, -35738, -35569, -35400, -35231, -35061, -36576, -36409, -36242, -36074, -35906, -35738, -35569, -35400, -35231, -35061,
-34891, -34721, -34550, -34379, -34208, -34036, -33864, -33692, -33519, -33346, -34891, -34721, -34550, -34379, -34208, -34036, -33864, -33692, -33519, -33346,
-33173, -32999, -32826, -32651, -32477, -32302, -32127, -31952, -31776, -31600, -33173, -32999, -32826, -32651, -32477, -32302, -32127, -31952, -31776, -31600,
-31424, -31247, -31070, -30893, -30715, -30538, -30360, -30181, -30003, -29824, -31424, -31247, -31070, -30893, -30715, -30538, -30360, -30181, -30003, -29824,
-29645, -29465, -29285, -29105, -28925, -28745, -28564, -28383, -28201, -28020, -29645, -29465, -29285, -29105, -28925, -28745, -28564, -28383, -28201, -28020,
-27838, -27656, -27473, -27291, -27108, -26925, -26741, -26557, -26373, -26189, -27838, -27656, -27473, -27291, -27108, -26925, -26741, -26557, -26373, -26189,
-26005, -25820, -25635, -25450, -25265, -25079, -24893, -24707, -24521, -24334, -26005, -25820, -25635, -25450, -25265, -25079, -24893, -24707, -24521, -24334,
-24147, -23960, -23773, -23586, -23398, -23210, -23022, -22833, -22645, -22456, -24147, -23960, -23773, -23586, -23398, -23210, -23022, -22833, -22645, -22456,
-22267, -22078, -21889, -21699, -21509, -21319, -21129, -20938, -20748, -20557, -22267, -22078, -21889, -21699, -21509, -21319, -21129, -20938, -20748, -20557,
-20366, -20175, -19983, -19792, -19600, -19408, -19216, -19024, -18831, -18638, -20366, -20175, -19983, -19792, -19600, -19408, -19216, -19024, -18831, -18638,
-18446, -18253, -18059, -17866, -17672, -17479, -17285, -17091, -16897, -16702, -18446, -18253, -18059, -17866, -17672, -17479, -17285, -17091, -16897, -16702,
-16508, -16313, -16118, -15923, -15728, -15533, -15338, -15142, -14946, -14751, -16508, -16313, -16118, -15923, -15728, -15533, -15338, -15142, -14946, -14751,
-14555, -14359, -14162, -13966, -13769, -13573, -13376, -13179, -12982, -12785, -14555, -14359, -14162, -13966, -13769, -13573, -13376, -13179, -12982, -12785,
-12588, -12390, -12193, -11995, -11797, -11600, -11402, -11204, -11006, -10807, -12588, -12390, -12193, -11995, -11797, -11600, -11402, -11204, -11006, -10807,
-10609, -10410, -10212, -10013, -9814, -9616, -9417, -9218, -9019, -8819, -8620, -10609, -10410, -10212, -10013, -9814, -9616, -9417, -9218, -9019, -8819, -8620,
-8421, -8221, -8022, -7822, -7623, -7423, -7223, -7023, -6823, -6623, -6423, -8421, -8221, -8022, -7822, -7623, -7423, -7223, -7023, -6823, -6623, -6423,
-6223, -6023, -5823, -5622, -5422, -5222, -5021, -4821, -4620, -4420, -4219, -6223, -6023, -5823, -5622, -5422, -5222, -5021, -4821, -4620, -4420, -4219,
-4018, -3818, -3617, -3416, -3215, -3014, -2814, -2613, -2412, -2211, -2010, -4018, -3818, -3617, -3416, -3215, -3014, -2814, -2613, -2412, -2211, -2010,
-1809, -1608, -1407, -1206, -1005, -804, -603, -402, -201 -1809, -1608, -1407, -1206, -1005, -804, -603, -402, -201
}; };
int FCosTab[2048] = int FCosTab[2048] =
{ {
65536, 65535, 65534, 65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, 65536, 65535, 65534, 65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505,
65498, 65491, 65483, 65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, 65498, 65491, 65483, 65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400,
65386, 65372, 65358, 65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, 65386, 65372, 65358, 65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220,
65200, 65179, 65158, 65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, 65200, 65179, 65158, 65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966,
64939, 64912, 64884, 64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, 64939, 64912, 64884, 64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638,
64605, 64571, 64536, 64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, 64605, 64571, 64536, 64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237,
64197, 64156, 64115, 64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, 64197, 64156, 64115, 64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762,
63715, 63668, 63620, 63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, 63715, 63668, 63620, 63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215,
63162, 63108, 63053, 62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, 63162, 63108, 63053, 62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596,
62536, 62475, 62414, 62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, 62536, 62475, 62414, 62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905,
61839, 61772, 61705, 61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, 61839, 61772, 61705, 61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144,
61071, 60998, 60924, 60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, 61071, 60998, 60924, 60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313,
60235, 60155, 60075, 59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, 60235, 60155, 60075, 59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414,
59329, 59243, 59157, 59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, 59329, 59243, 59157, 59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447,
58356, 58264, 58172, 58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, 58356, 58264, 58172, 58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414,
57316, 57219, 57120, 57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, 57316, 57219, 57120, 57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315,
56212, 56108, 56004, 55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, 56212, 56108, 56004, 55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152,
55043, 54933, 54823, 54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, 55043, 54933, 54823, 54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926,
53811, 53696, 53581, 53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, 53811, 53696, 53581, 53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639,
52518, 52398, 52277, 52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, 52518, 52398, 52277, 52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291,
51166, 51040, 50914, 50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, 51166, 51040, 50914, 50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886,
49755, 49624, 49492, 49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, 49755, 49624, 49492, 49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423,
48288, 48151, 48015, 47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, 48288, 48151, 48015, 47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906,
46765, 46624, 46482, 46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, 46765, 46624, 46482, 46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335,
45189, 45043, 44897, 44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, 45189, 45043, 44897, 44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712,
43562, 43412, 43261, 43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, 43562, 43412, 43261, 43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040,
41885, 41730, 41575, 41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, 41885, 41730, 41575, 41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319,
40161, 40002, 39842, 39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, 40161, 40002, 39842, 39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553,
38390, 38227, 38064, 37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, 38390, 38227, 38064, 37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743,
36576, 36409, 36242, 36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, 36576, 36409, 36242, 36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891,
34721, 34550, 34379, 34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, 34721, 34550, 34379, 34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999,
32826, 32651, 32477, 32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, 32826, 32651, 32477, 32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070,
30893, 30715, 30538, 30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, 30893, 30715, 30538, 30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105,
28925, 28745, 28564, 28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, 28925, 28745, 28564, 28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108,
26925, 26741, 26557, 26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, 26925, 26741, 26557, 26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079,
24893, 24707, 24521, 24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, 24893, 24707, 24521, 24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022,
22833, 22645, 22456, 22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, 22833, 22645, 22456, 22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938,
20748, 20557, 20366, 20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, 20748, 20557, 20366, 20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831,
18638, 18446, 18253, 18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, 18638, 18446, 18253, 18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702,
16508, 16313, 16118, 15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, 16508, 16313, 16118, 15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555,
14359, 14162, 13966, 13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, 14359, 14162, 13966, 13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390,
12193, 11995, 11797, 11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, 12193, 11995, 11797, 11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212,
10013, 9814, 9616, 9417, 9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, 10013, 9814, 9616, 9417, 9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623,
7423, 7223, 7023, 6823, 6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, 7423, 7223, 7023, 6823, 6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021,
4821, 4620, 4420, 4219, 4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, 4821, 4620, 4420, 4219, 4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412,
2211, 2010, 1809, 1608, 1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, 2211, 2010, 1809, 1608, 1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402,
-603, -804, -1005, -1206, -1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, -603, -804, -1005, -1206, -1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814,
-3014, -3215, -3416, -3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, -3014, -3215, -3416, -3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021,
-5222, -5422, -5622, -5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, -5222, -5422, -5622, -5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223,
-7423, -7623, -7822, -8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, -7423, -7623, -7822, -8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417,
-9616, -9814, -10013, -10212, -10410, -10609, -10807, -11006, -11204, -11402, -9616, -9814, -10013, -10212, -10410, -10609, -10807, -11006, -11204, -11402,
-11600, -11797, -11995, -12193, -12390, -12588, -12785, -12982, -13179, -13376, -11600, -11797, -11995, -12193, -12390, -12588, -12785, -12982, -13179, -13376,
-13573, -13769, -13966, -14162, -14359, -14555, -14751, -14946, -15142, -15338, -13573, -13769, -13966, -14162, -14359, -14555, -14751, -14946, -15142, -15338,
-15533, -15728, -15923, -16118, -16313, -16508, -16702, -16897, -17091, -17285, -15533, -15728, -15923, -16118, -16313, -16508, -16702, -16897, -17091, -17285,
-17479, -17672, -17866, -18059, -18253, -18446, -18638, -18831, -19024, -19216, -17479, -17672, -17866, -18059, -18253, -18446, -18638, -18831, -19024, -19216,
-19408, -19600, -19792, -19983, -20175, -20366, -20557, -20748, -20938, -21129, -19408, -19600, -19792, -19983, -20175, -20366, -20557, -20748, -20938, -21129,
-21319, -21509, -21699, -21889, -22078, -22267, -22456, -22645, -22833, -23022, -21319, -21509, -21699, -21889, -22078, -22267, -22456, -22645, -22833, -23022,
-23210, -23398, -23586, -23773, -23960, -24147, -24334, -24521, -24707, -24893, -23210, -23398, -23586, -23773, -23960, -24147, -24334, -24521, -24707, -24893,
-25079, -25265, -25450, -25635, -25820, -26005, -26189, -26373, -26557, -26741, -25079, -25265, -25450, -25635, -25820, -26005, -26189, -26373, -26557, -26741,
-26925, -27108, -27291, -27473, -27656, -27838, -28020, -28201, -28383, -28564, -26925, -27108, -27291, -27473, -27656, -27838, -28020, -28201, -28383, -28564,
-28745, -28925, -29105, -29285, -29465, -29645, -29824, -30003, -30181, -30360, -28745, -28925, -29105, -29285, -29465, -29645, -29824, -30003, -30181, -30360,
-30538, -30715, -30893, -31070, -31247, -31424, -31600, -31776, -31952, -32127, -30538, -30715, -30893, -31070, -31247, -31424, -31600, -31776, -31952, -32127,
-32302, -32477, -32651, -32826, -32999, -33173, -33346, -33519, -33692, -33864, -32302, -32477, -32651, -32826, -32999, -33173, -33346, -33519, -33692, -33864,
-34036, -34208, -34379, -34550, -34721, -34891, -35061, -35231, -35400, -35569, -34036, -34208, -34379, -34550, -34721, -34891, -35061, -35231, -35400, -35569,
-35738, -35906, -36074, -36242, -36409, -36576, -36743, -36909, -37075, -37241, -35738, -35906, -36074, -36242, -36409, -36576, -36743, -36909, -37075, -37241,
-37406, -37571, -37736, -37900, -38064, -38227, -38390, -38553, -38716, -38878, -37406, -37571, -37736, -37900, -38064, -38227, -38390, -38553, -38716, -38878,
-39039, -39201, -39362, -39522, -39682, -39842, -40002, -40161, -40319, -40478, -39039, -39201, -39362, -39522, -39682, -39842, -40002, -40161, -40319, -40478,
-40636, -40793, -40950, -41107, -41263, -41419, -41575, -41730, -41885, -42040, -40636, -40793, -40950, -41107, -41263, -41419, -41575, -41730, -41885, -42040,
-42194, -42347, -42501, -42653, -42806, -42958, -43110, -43261, -43412, -43562, -42194, -42347, -42501, -42653, -42806, -42958, -43110, -43261, -43412, -43562,
-43712, -43862, -44011, -44160, -44308, -44456, -44603, -44750, -44897, -45043, -43712, -43862, -44011, -44160, -44308, -44456, -44603, -44750, -44897, -45043,
-45189, -45335, -45480, -45624, -45768, -45912, -46055, -46198, -46340, -46482, -45189, -45335, -45480, -45624, -45768, -45912, -46055, -46198, -46340, -46482,
-46624, -46765, -46906, -47046, -47186, -47325, -47464, -47602, -47740, -47878, -46624, -46765, -46906, -47046, -47186, -47325, -47464, -47602, -47740, -47878,
-48015, -48151, -48288, -48423, -48558, -48693, -48828, -48961, -49095, -49228, -48015, -48151, -48288, -48423, -48558, -48693, -48828, -48961, -49095, -49228,
-49360, -49492, -49624, -49755, -49886, -50016, -50146, -50275, -50403, -50532, -49360, -49492, -49624, -49755, -49886, -50016, -50146, -50275, -50403, -50532,
-50660, -50787, -50914, -51040, -51166, -51291, -51416, -51541, -51665, -51788, -50660, -50787, -50914, -51040, -51166, -51291, -51416, -51541, -51665, -51788,
-51911, -52033, -52155, -52277, -52398, -52518, -52639, -52758, -52877, -52996, -51911, -52033, -52155, -52277, -52398, -52518, -52639, -52758, -52877, -52996,
-53114, -53231, -53348, -53465, -53581, -53696, -53811, -53926, -54040, -54153, -53114, -53231, -53348, -53465, -53581, -53696, -53811, -53926, -54040, -54153,
-54266, -54379, -54491, -54602, -54713, -54823, -54933, -55043, -55152, -55260, -54266, -54379, -54491, -54602, -54713, -54823, -54933, -55043, -55152, -55260,
-55368, -55475, -55582, -55688, -55794, -55899, -56004, -56108, -56212, -56315, -55368, -55475, -55582, -55688, -55794, -55899, -56004, -56108, -56212, -56315,
-56417, -56519, -56621, -56722, -56822, -56922, -57022, -57120, -57219, -57316, -56417, -56519, -56621, -56722, -56822, -56922, -57022, -57120, -57219, -57316,
-57414, -57510, -57606, -57702, -57797, -57892, -57986, -58079, -58172, -58264, -57414, -57510, -57606, -57702, -57797, -57892, -57986, -58079, -58172, -58264,
-58356, -58447, -58538, -58628, -58718, -58807, -58895, -58983, -59070, -59157, -58356, -58447, -58538, -58628, -58718, -58807, -58895, -58983, -59070, -59157,
-59243, -59329, -59414, -59499, -59583, -59666, -59749, -59831, -59913, -59994, -59243, -59329, -59414, -59499, -59583, -59666, -59749, -59831, -59913, -59994,
-60075, -60155, -60235, -60313, -60392, -60470, -60547, -60624, -60700, -60775, -60075, -60155, -60235, -60313, -60392, -60470, -60547, -60624, -60700, -60775,
-60850, -60924, -60998, -61071, -61144, -61216, -61288, -61359, -61429, -61499, -60850, -60924, -60998, -61071, -61144, -61216, -61288, -61359, -61429, -61499,
-61568, -61637, -61705, -61772, -61839, -61905, -61971, -62036, -62100, -62164, -61568, -61637, -61705, -61772, -61839, -61905, -61971, -62036, -62100, -62164,
-62228, -62291, -62353, -62414, -62475, -62536, -62596, -62655, -62714, -62772, -62228, -62291, -62353, -62414, -62475, -62536, -62596, -62655, -62714, -62772,
-62829, -62886, -62942, -62998, -63053, -63108, -63162, -63215, -63268, -63320, -62829, -62886, -62942, -62998, -63053, -63108, -63162, -63215, -63268, -63320,
-63371, -63422, -63473, -63522, -63571, -63620, -63668, -63715, -63762, -63808, -63371, -63422, -63473, -63522, -63571, -63620, -63668, -63715, -63762, -63808,
-63854, -63899, -63943, -63987, -64030, -64073, -64115, -64156, -64197, -64237, -63854, -63899, -63943, -63987, -64030, -64073, -64115, -64156, -64197, -64237,
-64276, -64315, -64353, -64391, -64428, -64465, -64501, -64536, -64571, -64605, -64276, -64315, -64353, -64391, -64428, -64465, -64501, -64536, -64571, -64605,
-64638, -64671, -64703, -64735, -64766, -64796, -64826, -64855, -64884, -64912, -64638, -64671, -64703, -64735, -64766, -64796, -64826, -64855, -64884, -64912,
-64939, -64966, -64992, -65018, -65043, -65067, -65091, -65114, -65136, -65158, -64939, -64966, -64992, -65018, -65043, -65067, -65091, -65114, -65136, -65158,
-65179, -65200, -65220, -65239, -65258, -65276, -65294, -65311, -65327, -65343, -65179, -65200, -65220, -65239, -65258, -65276, -65294, -65311, -65327, -65343,
-65358, -65372, -65386, -65400, -65412, -65424, -65436, -65446, -65457, -65466, -65358, -65372, -65386, -65400, -65412, -65424, -65436, -65446, -65457, -65466,
-65475, -65483, -65491, -65498, -65505, -65511, -65516, -65520, -65524, -65528, -65475, -65483, -65491, -65498, -65505, -65511, -65516, -65520, -65524, -65528,
-65531, -65533, -65534, -65535, -65536, -65535, -65534, -65533, -65531, -65528, -65531, -65533, -65534, -65535, -65536, -65535, -65534, -65533, -65531, -65528,
-65524, -65520, -65516, -65511, -65505, -65498, -65491, -65483, -65475, -65466, -65524, -65520, -65516, -65511, -65505, -65498, -65491, -65483, -65475, -65466,
-65457, -65446, -65436, -65424, -65412, -65400, -65386, -65372, -65358, -65343, -65457, -65446, -65436, -65424, -65412, -65400, -65386, -65372, -65358, -65343,
-65327, -65311, -65294, -65276, -65258, -65239, -65220, -65200, -65179, -65158, -65327, -65311, -65294, -65276, -65258, -65239, -65220, -65200, -65179, -65158,
-65136, -65114, -65091, -65067, -65043, -65018, -64992, -64966, -64939, -64912, -65136, -65114, -65091, -65067, -65043, -65018, -64992, -64966, -64939, -64912,
-64884, -64855, -64826, -64796, -64766, -64735, -64703, -64671, -64638, -64605, -64884, -64855, -64826, -64796, -64766, -64735, -64703, -64671, -64638, -64605,
-64571, -64536, -64501, -64465, -64428, -64391, -64353, -64315, -64276, -64237, -64571, -64536, -64501, -64465, -64428, -64391, -64353, -64315, -64276, -64237,
-64197, -64156, -64115, -64073, -64030, -63987, -63943, -63899, -63854, -63808, -64197, -64156, -64115, -64073, -64030, -63987, -63943, -63899, -63854, -63808,
-63762, -63715, -63668, -63620, -63571, -63522, -63473, -63422, -63371, -63320, -63762, -63715, -63668, -63620, -63571, -63522, -63473, -63422, -63371, -63320,
-63268, -63215, -63162, -63108, -63053, -62998, -62942, -62886, -62829, -62772, -63268, -63215, -63162, -63108, -63053, -62998, -62942, -62886, -62829, -62772,
-62714, -62655, -62596, -62536, -62475, -62414, -62353, -62291, -62228, -62164, -62714, -62655, -62596, -62536, -62475, -62414, -62353, -62291, -62228, -62164,
-62100, -62036, -61971, -61905, -61839, -61772, -61705, -61637, -61568, -61499, -62100, -62036, -61971, -61905, -61839, -61772, -61705, -61637, -61568, -61499,
-61429, -61359, -61288, -61216, -61144, -61071, -60998, -60924, -60850, -60775, -61429, -61359, -61288, -61216, -61144, -61071, -60998, -60924, -60850, -60775,
-60700, -60624, -60547, -60470, -60392, -60313, -60235, -60155, -60075, -59994, -60700, -60624, -60547, -60470, -60392, -60313, -60235, -60155, -60075, -59994,
-59913, -59831, -59749, -59666, -59583, -59499, -59414, -59329, -59243, -59157, -59913, -59831, -59749, -59666, -59583, -59499, -59414, -59329, -59243, -59157,
-59070, -58983, -58895, -58807, -58718, -58628, -58538, -58447, -58356, -58264, -59070, -58983, -58895, -58807, -58718, -58628, -58538, -58447, -58356, -58264,
-58172, -58079, -57986, -57892, -57797, -57702, -57606, -57510, -57414, -57316, -58172, -58079, -57986, -57892, -57797, -57702, -57606, -57510, -57414, -57316,
-57219, -57120, -57022, -56922, -56822, -56722, -56621, -56519, -56417, -56315, -57219, -57120, -57022, -56922, -56822, -56722, -56621, -56519, -56417, -56315,
-56212, -56108, -56004, -55899, -55794, -55688, -55582, -55475, -55368, -55260, -56212, -56108, -56004, -55899, -55794, -55688, -55582, -55475, -55368, -55260,
-55152, -55043, -54933, -54823, -54713, -54602, -54491, -54379, -54266, -54153, -55152, -55043, -54933, -54823, -54713, -54602, -54491, -54379, -54266, -54153,
-54040, -53926, -53811, -53696, -53581, -53465, -53348, -53231, -53114, -52996, -54040, -53926, -53811, -53696, -53581, -53465, -53348, -53231, -53114, -52996,
-52877, -52758, -52639, -52518, -52398, -52277, -52155, -52033, -51911, -51788, -52877, -52758, -52639, -52518, -52398, -52277, -52155, -52033, -51911, -51788,
-51665, -51541, -51416, -51291, -51166, -51040, -50914, -50787, -50660, -50532, -51665, -51541, -51416, -51291, -51166, -51040, -50914, -50787, -50660, -50532,
-50403, -50275, -50146, -50016, -49886, -49755, -49624, -49492, -49360, -49228, -50403, -50275, -50146, -50016, -49886, -49755, -49624, -49492, -49360, -49228,
-49095, -48961, -48828, -48693, -48558, -48423, -48288, -48151, -48015, -47878, -49095, -48961, -48828, -48693, -48558, -48423, -48288, -48151, -48015, -47878,
-47740, -47602, -47464, -47325, -47186, -47046, -46906, -46765, -46624, -46482, -47740, -47602, -47464, -47325, -47186, -47046, -46906, -46765, -46624, -46482,
-46340, -46198, -46055, -45912, -45768, -45624, -45480, -45335, -45189, -45043, -46340, -46198, -46055, -45912, -45768, -45624, -45480, -45335, -45189, -45043,
-44897, -44750, -44603, -44456, -44308, -44160, -44011, -43862, -43712, -43562, -44897, -44750, -44603, -44456, -44308, -44160, -44011, -43862, -43712, -43562,
-43412, -43261, -43110, -42958, -42806, -42653, -42501, -42347, -42194, -42040, -43412, -43261, -43110, -42958, -42806, -42653, -42501, -42347, -42194, -42040,
-41885, -41730, -41575, -41419, -41263, -41107, -40950, -40793, -40636, -40478, -41885, -41730, -41575, -41419, -41263, -41107, -40950, -40793, -40636, -40478,
-40319, -40161, -40002, -39842, -39682, -39522, -39362, -39201, -39039, -38878, -40319, -40161, -40002, -39842, -39682, -39522, -39362, -39201, -39039, -38878,
-38716, -38553, -38390, -38227, -38064, -37900, -37736, -37571, -37406, -37241, -38716, -38553, -38390, -38227, -38064, -37900, -37736, -37571, -37406, -37241,
-37075, -36909, -36743, -36576, -36409, -36242, -36074, -35906, -35738, -35569, -37075, -36909, -36743, -36576, -36409, -36242, -36074, -35906, -35738, -35569,
-35400, -35231, -35061, -34891, -34721, -34550, -34379, -34208, -34036, -33864, -35400, -35231, -35061, -34891, -34721, -34550, -34379, -34208, -34036, -33864,
-33692, -33519, -33346, -33173, -32999, -32826, -32651, -32477, -32302, -32127, -33692, -33519, -33346, -33173, -32999, -32826, -32651, -32477, -32302, -32127,
-31952, -31776, -31600, -31424, -31247, -31070, -30893, -30715, -30538, -30360, -31952, -31776, -31600, -31424, -31247, -31070, -30893, -30715, -30538, -30360,
-30181, -30003, -29824, -29645, -29465, -29285, -29105, -28925, -28745, -28564, -30181, -30003, -29824, -29645, -29465, -29285, -29105, -28925, -28745, -28564,
-28383, -28201, -28020, -27838, -27656, -27473, -27291, -27108, -26925, -26741, -28383, -28201, -28020, -27838, -27656, -27473, -27291, -27108, -26925, -26741,
-26557, -26373, -26189, -26005, -25820, -25635, -25450, -25265, -25079, -24893, -26557, -26373, -26189, -26005, -25820, -25635, -25450, -25265, -25079, -24893,
-24707, -24521, -24334, -24147, -23960, -23773, -23586, -23398, -23210, -23022, -24707, -24521, -24334, -24147, -23960, -23773, -23586, -23398, -23210, -23022,
-22833, -22645, -22456, -22267, -22078, -21889, -21699, -21509, -21319, -21129, -22833, -22645, -22456, -22267, -22078, -21889, -21699, -21509, -21319, -21129,
-20938, -20748, -20557, -20366, -20175, -19983, -19792, -19600, -19408, -19216, -20938, -20748, -20557, -20366, -20175, -19983, -19792, -19600, -19408, -19216,
-19024, -18831, -18638, -18446, -18253, -18059, -17866, -17672, -17479, -17285, -19024, -18831, -18638, -18446, -18253, -18059, -17866, -17672, -17479, -17285,
-17091, -16897, -16702, -16508, -16313, -16118, -15923, -15728, -15533, -15338, -17091, -16897, -16702, -16508, -16313, -16118, -15923, -15728, -15533, -15338,
-15142, -14946, -14751, -14555, -14359, -14162, -13966, -13769, -13573, -13376, -15142, -14946, -14751, -14555, -14359, -14162, -13966, -13769, -13573, -13376,
-13179, -12982, -12785, -12588, -12390, -12193, -11995, -11797, -11600, -11402, -13179, -12982, -12785, -12588, -12390, -12193, -11995, -11797, -11600, -11402,
-11204, -11006, -10807, -10609, -10410, -10212, -10013, -9814, -9616, -9417, -11204, -11006, -10807, -10609, -10410, -10212, -10013, -9814, -9616, -9417,
-9218, -9019, -8819, -8620, -8421, -8221, -8022, -7822, -7623, -7423, -7223, -9218, -9019, -8819, -8620, -8421, -8221, -8022, -7822, -7623, -7423, -7223,
-7023, -6823, -6623, -6423, -6223, -6023, -5823, -5622, -5422, -5222, -5021, -7023, -6823, -6623, -6423, -6223, -6023, -5823, -5622, -5422, -5222, -5021,
-4821, -4620, -4420, -4219, -4018, -3818, -3617, -3416, -3215, -3014, -2814, -4821, -4620, -4420, -4219, -4018, -3818, -3617, -3416, -3215, -3014, -2814,
-2613, -2412, -2211, -2010, -1809, -1608, -1407, -1206, -1005, -804, -603, -402, -2613, -2412, -2211, -2010, -1809, -1608, -1407, -1206, -1005, -804, -603, -402,
-201, 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, -201, 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412,
2613, 2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, 2613, 2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021,
5222, 5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, 5222, 5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623,
7822, 8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, 7822, 8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212,
10410, 10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, 10410, 10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390,
12588, 12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, 12588, 12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555,
14751, 14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, 14751, 14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702,
16897, 17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, 16897, 17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831,
19024, 19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, 19024, 19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938,
21129, 21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, 21129, 21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022,
23210, 23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, 23210, 23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079,
25265, 25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, 25265, 25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108,
27291, 27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, 27291, 27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105,
29285, 29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, 29285, 29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070,
31247, 31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, 31247, 31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999,
33173, 33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, 33173, 33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891,
35061, 35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, 35061, 35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743,
36909, 37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, 36909, 37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553,
38716, 38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, 38716, 38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319,
40478, 40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, 40478, 40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040,
42194, 42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, 42194, 42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712,
43862, 44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, 43862, 44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335,
45480, 45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, 45480, 45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906,
47046, 47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, 47046, 47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423,
48558, 48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, 48558, 48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886,
50016, 50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, 50016, 50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291,
51416, 51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, 51416, 51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639,
52758, 52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, 52758, 52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926,
54040, 54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, 54040, 54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152,
55260, 55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, 55260, 55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315,
56417, 56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, 56417, 56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414,
57510, 57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, 57510, 57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447,
58538, 58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, 58538, 58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414,
59499, 59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, 59499, 59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313,
60392, 60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, 60392, 60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144,
61216, 61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, 61216, 61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905,
61971, 62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, 61971, 62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596,
62655, 62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, 62655, 62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215,
63268, 63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, 63268, 63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762,
63808, 63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, 63808, 63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237,
64276, 64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, 64276, 64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638,
64671, 64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, 64671, 64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966,
64992, 65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, 64992, 65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220,
65239, 65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, 65239, 65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400,
65412, 65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, 65412, 65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505,
65511, 65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535 65511, 65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535
}; };

View File

@@ -110,7 +110,7 @@ static void init_fire (void)
for (x = 0; x < SCRW; x ++) for (x = 0; x < SCRW; x ++)
{ {
pixel = fire_buffer [((y + 1) * SCRW) + x]; pixel = fire_buffer [((y + 1) * SCRW) + x];
if (pixel > 0) if (pixel > 0)
{ {

View File

@@ -67,7 +67,7 @@ void DrawWater(void)
{ {
// tslast=tscurrent; // tslast=tscurrent;
// tscurrent=time(NULL); // tscurrent=time(NULL);
/* /*
if (NetPlayNoMore == 1) if (NetPlayNoMore == 1)
{ {
@@ -95,23 +95,23 @@ void DrawWater(void)
y=rand()%(SCRH-2)+1; y=rand()%(SCRH-2)+1;
Height[Hpage][y*SCRW+x]=rand()%(pheight<<2); Height[Hpage][y*SCRW+x]=rand()%(pheight<<2);
} }
/* the surfer */ /* the surfer */
if(mode&1) if(mode&1)
{ {
int x,y; int x,y;
x = (SCRW/2) x = (SCRW/2)
+ ((((FSin( (xang* 65) >>8) >>8) + ((((FSin( (xang* 65) >>8) >>8)
* (FSin( (xang*349) >>8) >>8)) * (FSin( (xang*349) >>8) >>8))
* ((SCRW-8)/2)) >> 16); * ((SCRW-8)/2)) >> 16);
y = (SCRH/2) y = (SCRH/2)
+ ((((FSin( (yang*377) >>8) >>8) + ((((FSin( (yang*377) >>8) >>8)
*(FSin( (yang* 84) >>8) >>8)) *(FSin( (yang* 84) >>8) >>8))
* ((SCRH-8)/2)) >> 16); * ((SCRH-8)/2)) >> 16);
xang += 13; xang += 13;
yang += 12; yang += 12;
if(mode & 0x4000) if(mode & 0x4000)
{ {
offset = (oy+y)/2*SCRW + (ox+x)/2; offset = (oy+y)/2*SCRW + (ox+x)/2;
@@ -136,10 +136,10 @@ void DrawWater(void)
} }
ox = x; ox = x;
oy = y; oy = y;
} }
if(mode&4) if(mode&4)
{ {
int x,y; int x,y;
@@ -150,14 +150,14 @@ void DrawWater(void)
if(mode & 0x4000) if(mode & 0x4000)
// HeightBlob(-1, -1, radius/2, pheight, Hpage); // HeightBlob(-1, -1, radius/2, pheight, Hpage);
else else
*/ */
x=rand()%(SCRW-2)+1; x=rand()%(SCRW-2)+1;
y=rand()%(SCRH-2)+1; y=rand()%(SCRH-2)+1;
SineBlob(x, y, radius, -pheight*6, Hpage); SineBlob(x, y, radius, -pheight*6, Hpage);
} }
} }
CalcWater(Height[Hpage^1], Height[Hpage], density); CalcWater(Height[Hpage^1], Height[Hpage], density);
Hpage ^= 1; /* flip flop */ Hpage ^= 1; /* flip flop */
} }
@@ -169,13 +169,13 @@ void DrawWaterNoLight(int *ptr)
int x,y; int x,y;
int c; int c;
int p; int p;
int offset = SCRW+1; int offset = SCRW+1;
if(ptr == NULL) if(ptr == NULL)
{ {
return; return;
} }
for(y=((SCRH-1)*SCRW); offset < y; offset+=2) for(y=((SCRH-1)*SCRW); offset < y; offset+=2)
{ {
for(x = offset+SCRW-2;offset<x;offset++) for(x = offset+SCRW-2;offset<x;offset++)
@@ -237,10 +237,10 @@ void DrawWaterNoLight(int *ptr)
vscr[offset]=c; vscr[offset]=c;
} }
} }
memcpy( vidbuffer,vscr,SCRW*SCRH); memcpy( vidbuffer,vscr,SCRW*SCRH);
// frames++; // frames++;
} }
#endif #endif
@@ -250,7 +250,7 @@ void DrawWaterWithLight(int *ptr,int light)
int x,y; int x,y;
int c; int c;
int p; int p;
int offset = SCRW+1; int offset = SCRW+1;
if(ptr == NULL) if(ptr == NULL)
{ {
@@ -304,14 +304,14 @@ void DrawWaterWithLight(int *ptr,int light)
} }
*/ */
c=vidbuffer[p]; c=vidbuffer[p];
c-=(dx>>light); c-=(dx>>light);
(c<1) ? c=1 : (c > 31) ? c=31 : 0; (c<1) ? c=1 : (c > 31) ? c=31 : 0;
vscr[offset]=c; vscr[offset]=c;
} }
} }
memcpy( vidbuffer,vscr,SCRW*SCRH); memcpy( vidbuffer,vscr,SCRW*SCRH);
// memcpy( VGLDisplay->Bitmap,vscr,SCRW*SCRH); // memcpy( VGLDisplay->Bitmap,vscr,SCRW*SCRH);
// frames++; // frames++;
@@ -323,7 +323,7 @@ void CalcWater(int *nptr,int *optr,int density)
int newh; int newh;
int count = SCRW+1; int count = SCRW+1;
int x,y; int x,y;
for(y = (SCRH-1) * SCRW;count<y;count+=2) for(y = (SCRH-1) * SCRW;count<y;count+=2)
{ {
for(x = count+SCRW-2;count<x;count++) for(x = count+SCRW-2;count<x;count++)
@@ -338,11 +338,11 @@ void CalcWater(int *nptr,int *optr,int density)
+optr[count+SCRW+1] +optr[count+SCRW+1]
) >> 2) ) >> 2)
- nptr[count]; - nptr[count];
nptr[count] = newh - (newh >> density); nptr[count] = newh - (newh >> density);
} }
} }
} }
void SineBlob(int x, int y, int radius, int height, int page) void SineBlob(int x, int y, int radius, int height, int page)

View File

@@ -32,39 +32,39 @@ SECTION .bss
NEWSYM wramdataa, resb 65536 NEWSYM wramdataa, resb 65536
NEWSYM ram7fa, resb 65536 NEWSYM ram7fa, resb 65536
NEWSYM Inbetweendat, resd 4 NEWSYM Inbetweendat, resd 4
NEWSYM opcjmptab, resd 256 NEWSYM opcjmptab, resd 256
NEWSYM Bank0datr8 , resd 256 NEWSYM Bank0datr8 , resd 256
NEWSYM Bank0datr16, resd 256 NEWSYM Bank0datr16, resd 256
NEWSYM Bank0datw8 , resd 256 NEWSYM Bank0datw8 , resd 256
NEWSYM Bank0datw16, resd 256 NEWSYM Bank0datw16, resd 256
NEWSYM tableA, resd 256 NEWSYM tableA, resd 256
NEWSYM tableB, resd 256 NEWSYM tableB, resd 256
NEWSYM tableC, resd 256 NEWSYM tableC, resd 256
NEWSYM tableD, resd 256 NEWSYM tableD, resd 256
NEWSYM tableE, resd 256 NEWSYM tableE, resd 256
NEWSYM tableF, resd 256 NEWSYM tableF, resd 256
NEWSYM tableG, resd 256 NEWSYM tableG, resd 256
NEWSYM tableH, resd 256 NEWSYM tableH, resd 256
NEWSYM tableAb, resd 256 NEWSYM tableAb, resd 256
NEWSYM tableBb, resd 256 NEWSYM tableBb, resd 256
NEWSYM tableCb, resd 256 NEWSYM tableCb, resd 256
NEWSYM tableDb, resd 256 NEWSYM tableDb, resd 256
NEWSYM tableEb, resd 256 NEWSYM tableEb, resd 256
NEWSYM tableFb, resd 256 NEWSYM tableFb, resd 256
NEWSYM tableGb, resd 256 NEWSYM tableGb, resd 256
NEWSYM tableHb, resd 256 NEWSYM tableHb, resd 256
NEWSYM tableAc, resd 256 NEWSYM tableAc, resd 256
NEWSYM tableBc, resd 256 NEWSYM tableBc, resd 256
NEWSYM tableCc, resd 256 NEWSYM tableCc, resd 256
NEWSYM tableDc, resd 256 NEWSYM tableDc, resd 256
NEWSYM tableEc, resd 256 NEWSYM tableEc, resd 256
NEWSYM tableFc, resd 256 NEWSYM tableFc, resd 256
NEWSYM tableGc, resd 256 NEWSYM tableGc, resd 256
NEWSYM tableHc, resd 256 NEWSYM tableHc, resd 256
NEWSYM SA1tableA, resd 256 NEWSYM SA1tableA, resd 256
@@ -85,9 +85,9 @@ NEWSYM memtabler8, resd 256
NEWSYM memtablew8, resd 256 NEWSYM memtablew8, resd 256
NEWSYM memtabler16, resd 256 NEWSYM memtabler16, resd 256
NEWSYM memtablew16, resd 256 NEWSYM memtablew16, resd 256
NEWSYM vidmemch2, resb 4096 NEWSYM vidmemch2, resb 4096
NEWSYM vidmemch4, resb 4096 NEWSYM vidmemch4, resb 4096
NEWSYM vidmemch8, resb 4096 NEWSYM vidmemch8, resb 4096
NEWSYM snesmmap, resd 256 NEWSYM snesmmap, resd 256
NEWSYM snesmap2, resd 256 NEWSYM snesmap2, resd 256
NEWSYM cachebg1, resb 64 NEWSYM cachebg1, resb 64
@@ -100,8 +100,8 @@ NEWSYM sprleftpr1, resb 256
NEWSYM sprleftpr2, resb 256 NEWSYM sprleftpr2, resb 256
NEWSYM sprleftpr3, resb 256 NEWSYM sprleftpr3, resb 256
NEWSYM sprpriodata, resb 288 NEWSYM sprpriodata, resb 288
NEWSYM sprprtabc, resb 64 NEWSYM sprprtabc, resb 64
NEWSYM sprprtabu, resb 64 NEWSYM sprprtabu, resb 64
NEWSYM prevpal, resw 256 ; previous palette buffer NEWSYM prevpal, resw 256 ; previous palette buffer
NEWSYM winbgdata, resb 288 ; window buffer for backgrounds NEWSYM winbgdata, resb 288 ; window buffer for backgrounds
NEWSYM winspdata, resb 288 ; window buffer for sprites NEWSYM winspdata, resb 288 ; window buffer for sprites
@@ -127,15 +127,15 @@ NEWSYM fxbit01, resd 256
NEWSYM fxbit23, resd 256 NEWSYM fxbit23, resd 256
NEWSYM fxbit45, resd 256 NEWSYM fxbit45, resd 256
NEWSYM fxbit67, resd 256 NEWSYM fxbit67, resd 256
NEWSYM PLOTJmpa, resd 64 NEWSYM PLOTJmpa, resd 64
NEWSYM PLOTJmpb, resd 64 NEWSYM PLOTJmpb, resd 64
NEWSYM pal16b, resd 256 NEWSYM pal16b, resd 256
NEWSYM pal16bcl, resd 256 NEWSYM pal16bcl, resd 256
NEWSYM pal16bclha, resd 256 NEWSYM pal16bclha, resd 256
NEWSYM pal16bxcl, resd 256 NEWSYM pal16bxcl, resd 256
NEWSYM xtravbuf, resb 576 NEWSYM xtravbuf, resb 576
NEWSYM BG1SXl, resw 256 NEWSYM BG1SXl, resw 256
NEWSYM BG2SXl, resw 256 NEWSYM BG2SXl, resw 256
NEWSYM BG3SXl, resw 256 NEWSYM BG3SXl, resw 256
NEWSYM BG4SXl, resw 256 NEWSYM BG4SXl, resw 256
@@ -143,9 +143,9 @@ NEWSYM BG1SYl, resw 256
NEWSYM BG2SYl, resw 256 NEWSYM BG2SYl, resw 256
NEWSYM BG3SYl, resw 256 NEWSYM BG3SYl, resw 256
NEWSYM BG4SYl, resw 256 NEWSYM BG4SYl, resw 256
NEWSYM BGMA, resb 256 NEWSYM BGMA, resb 256
NEWSYM BGFB, resb 256 NEWSYM BGFB, resb 256
NEWSYM BG3PRI, resb 256 NEWSYM BG3PRI, resb 256
NEWSYM BGOPT1, resw 256 NEWSYM BGOPT1, resw 256
NEWSYM BGOPT2, resw 256 NEWSYM BGOPT2, resw 256
NEWSYM BGOPT3, resw 256 NEWSYM BGOPT3, resw 256
@@ -162,25 +162,25 @@ NEWSYM BGPT1Y, resw 256
NEWSYM BGPT2Y, resw 256 NEWSYM BGPT2Y, resw 256
NEWSYM BGPT3Y, resw 256 NEWSYM BGPT3Y, resw 256
NEWSYM BGPT4Y, resw 256 NEWSYM BGPT4Y, resw 256
NEWSYM BGMS1, resw 1024 NEWSYM BGMS1, resw 1024
NEWSYM prdata, resb 256 NEWSYM prdata, resb 256
NEWSYM prdatb, resb 256 NEWSYM prdatb, resb 256
NEWSYM prdatc, resb 256 NEWSYM prdatc, resb 256
NEWSYM ngpalcon2b, resd 20h NEWSYM ngpalcon2b, resd 20h
NEWSYM ngpalcon4b, resd 20h NEWSYM ngpalcon4b, resd 20h
NEWSYM ngpalcon8b, resd 20h NEWSYM ngpalcon8b, resd 20h
NEWSYM tltype2b, resb 4096 NEWSYM tltype2b, resb 4096
NEWSYM tltype4b, resb 2048 NEWSYM tltype4b, resb 2048
NEWSYM tltype8b, resb 1024 NEWSYM tltype8b, resb 1024
NEWSYM ngptrdat, resd 1024 NEWSYM ngptrdat, resd 1024
NEWSYM ngceax, resd 1024 NEWSYM ngceax, resd 1024
NEWSYM ngcedi, resd 1024 NEWSYM ngcedi, resd 1024
NEWSYM bgtxad, resw 1024 NEWSYM bgtxad, resw 1024
NEWSYM sprtbng, resd 256 NEWSYM sprtbng, resd 256
NEWSYM sprtlng, resb 256 NEWSYM sprtlng, resb 256
NEWSYM mosszng, resb 256 NEWSYM mosszng, resb 256
NEWSYM mosenng, resb 256 NEWSYM mosenng, resb 256
SECTION .data SECTION .data
ALIGN32 ALIGN32
@@ -194,47 +194,47 @@ SECTION .bss
NEWSYM mode7ab, resd 256 NEWSYM mode7ab, resd 256
NEWSYM mode7cd, resd 256 NEWSYM mode7cd, resd 256
NEWSYM mode7xy, resd 256 NEWSYM mode7xy, resd 256
NEWSYM mode7st, resb 256 NEWSYM mode7st, resb 256
NEWSYM t16x161, resb 256 NEWSYM t16x161, resb 256
NEWSYM t16x162, resb 256 NEWSYM t16x162, resb 256
NEWSYM t16x163, resb 256 NEWSYM t16x163, resb 256
NEWSYM t16x164, resb 256 NEWSYM t16x164, resb 256
NEWSYM intrlng, resb 256 NEWSYM intrlng, resb 256
NEWSYM mode7hr, resb 256 NEWSYM mode7hr, resb 256
NEWSYM scadsng, resb 256 NEWSYM scadsng, resb 256
NEWSYM scadtng, resb 256 NEWSYM scadtng, resb 256
NEWSYM scbcong, resw 256 NEWSYM scbcong, resw 256
NEWSYM cpalval, resd 256 NEWSYM cpalval, resd 256
NEWSYM cgfxmod, resb 256 NEWSYM cgfxmod, resb 256
NEWSYM winboundary, resd 256 NEWSYM winboundary, resd 256
NEWSYM winbg1enval, resb 256 NEWSYM winbg1enval, resb 256
NEWSYM winbg2enval, resb 256 NEWSYM winbg2enval, resb 256
NEWSYM winbg3enval, resb 256 NEWSYM winbg3enval, resb 256
NEWSYM winbg4enval, resb 256 NEWSYM winbg4enval, resb 256
NEWSYM winbgobjenval, resb 256 NEWSYM winbgobjenval, resb 256
NEWSYM winbgbackenval, resb 256 NEWSYM winbgbackenval, resb 256
NEWSYM winlogicaval, resw 256 NEWSYM winlogicaval, resw 256
NEWSYM winbg1envals, resb 256 NEWSYM winbg1envals, resb 256
NEWSYM winbg2envals, resb 256 NEWSYM winbg2envals, resb 256
NEWSYM winbg3envals, resb 256 NEWSYM winbg3envals, resb 256
NEWSYM winbg4envals, resb 256 NEWSYM winbg4envals, resb 256
NEWSYM winbgobjenvals, resb 256 NEWSYM winbgobjenvals, resb 256
NEWSYM winbgbackenvals, resb 256 NEWSYM winbgbackenvals, resb 256
NEWSYM winbg1envalm, resb 256 NEWSYM winbg1envalm, resb 256
NEWSYM winbg2envalm, resb 256 NEWSYM winbg2envalm, resb 256
NEWSYM winbg3envalm, resb 256 NEWSYM winbg3envalm, resb 256
NEWSYM winbg4envalm, resb 256 NEWSYM winbg4envalm, resb 256
NEWSYM winbgobjenvalm, resb 256 NEWSYM winbgobjenvalm, resb 256
NEWSYM winbgbackenvalm, resb 256 NEWSYM winbgbackenvalm, resb 256
NEWSYM FillSubScr, resb 256 NEWSYM FillSubScr, resb 256
NEWSYM objclineptr, resd 256 ; l1,r1,l2,r2,en,log,ptr NEWSYM objclineptr, resd 256 ; l1,r1,l2,r2,en,log,ptr
@@ -249,11 +249,11 @@ SECTION .bss
NEWSYM SpecialLine, resb 256 NEWSYM SpecialLine, resb 256
NEWSYM bgallchange, resb 256 NEWSYM bgallchange, resb 256
NEWSYM bg1change, resb 256 NEWSYM bg1change, resb 256
NEWSYM bg2change, resb 256 NEWSYM bg2change, resb 256
NEWSYM bg3change, resb 256 NEWSYM bg3change, resb 256
NEWSYM bg4change, resb 256 NEWSYM bg4change, resb 256
NEWSYM bgwinchange, resb 256 NEWSYM bgwinchange, resb 256
NEWSYM PrevPicture, resb 64*56*2 NEWSYM PrevPicture, resb 64*56*2

View File

@@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "fcntl.h" #include "fcntl.h"
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "config.h" #include "config.h"
// General time.h checking // General time.h checking
@@ -65,9 +65,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#endif #endif
// more standard stuff // more standard stuff
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
// unistd.h stuff // unistd.h stuff
@@ -92,7 +92,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
however it's a static value that we can just define */ however it's a static value that we can just define */
#define getpagesize() 4096 #define getpagesize() 4096
#endif #endif
#ifdef __LINUX__ #ifdef __LINUX__
#include "SDL.h" #include "SDL.h"
#include <limits.h> #include <limits.h>

View File

@@ -820,16 +820,16 @@ GUISaveKeys:
GUIKeyCheckbox PauseLoad,'P' GUIKeyCheckbox PauseLoad,'P'
GUIKeyCheckbox PauseRewind,'R' GUIKeyCheckbox PauseRewind,'R'
ret ret
GUISpeedKeys: GUISpeedKeys:
cmp dh,'a' ; Setup cmp dh,'a' ; Setup
jb .nocap jb .nocap
cmp dh,'z' cmp dh,'z'
ja .nocap ja .nocap
sub dh,'z'-'Z' sub dh,'z'-'Z'
.nocap .nocap
GUIKeyCheckbox FastFwdToggle,'T' ; Checkbox GUIKeyCheckbox FastFwdToggle,'T' ; Checkbox
cmp dh,'A' ; Framerate Checkboxes cmp dh,'A' ; Framerate Checkboxes
jne .noautofr jne .noautofr
mov byte[FPSOn],0 mov byte[FPSOn],0
@@ -886,7 +886,7 @@ GUIGUIOptnsKeys:
GUIKeyCheckbox GUIClick,'C' GUIKeyCheckbox GUIClick,'C'
GUIKeyCheckbox JoyPad1Move,'U' GUIKeyCheckbox JoyPad1Move,'U'
GUIKeyCheckbox GUIEnableTransp,'T' GUIKeyCheckbox GUIEnableTransp,'T'
cmp dh,'F' cmp dh,'F'
jne .guioptn8 jne .guioptn8
xor byte[FilteredGUI],1 xor byte[FilteredGUI],1
@@ -1527,7 +1527,7 @@ GUIMovieKeys:
ja .nocap ja .nocap
sub dh,'z'-'Z' sub dh,'z'-'Z'
.nocap .nocap
GUIKeyButtonHole CMovieExt,'v','0' ; Select Radio Buttons GUIKeyButtonHole CMovieExt,'v','0' ; Select Radio Buttons
GUIKeyButtonHole CMovieExt,'1','1' GUIKeyButtonHole CMovieExt,'1','1'
GUIKeyButtonHole CMovieExt,'2','2' GUIKeyButtonHole CMovieExt,'2','2'
@@ -1582,7 +1582,7 @@ GUIComboKeys:
ret ret
GUICheatKeys: GUICheatKeys:
cmp dword[GUIcurrentcheatwin],1 cmp dword[GUIcurrentcheatwin],1
je near .textboxa je near .textboxa
cmp dword[GUIcurrentcheatwin],2 cmp dword[GUIcurrentcheatwin],2
je near .textboxb je near .textboxb
@@ -1763,7 +1763,7 @@ GUICheatKeys:
;Enter Code Input Box ;Enter Code Input Box
.textboxa .textboxa
cmp byte[GUICheatPosA],0 cmp byte[GUICheatPosA],0
je near .nobacksp je near .nobacksp
cmp dh,9 cmp dh,9
@@ -2039,7 +2039,7 @@ GUICheatSearchKeys:
CompareKeyMacro 'H',CheatSrcByteBase,1 CompareKeyMacro 'H',CheatSrcByteBase,1
CompareKeyMacro 'E',CheatSrcSearchType,0 CompareKeyMacro 'E',CheatSrcSearchType,0
CompareKeyMacro 'C',CheatSrcSearchType,1 CompareKeyMacro 'C',CheatSrcSearchType,1
cmp dh,13 ; Start Button cmp dh,13 ; Start Button
je .start je .start
cmp dh,'S' cmp dh,'S'
@@ -2049,7 +2049,7 @@ GUICheatSearchKeys:
ret ret
.notstart .notstart
ret ret
.search ; Shortcuts for Select Comparison .search ; Shortcuts for Select Comparison
cmp byte[CheatSrcSearchType],1 cmp byte[CheatSrcSearchType],1
je .compare je .compare
@@ -2082,7 +2082,7 @@ GUICheatSearchKeys:
mov byte[CheatCompareValue],3 mov byte[CheatCompareValue],3
.notnotequalthan .notnotequalthan
%ifdef __LINUX__ ; Select with Arrow Keys %ifdef __LINUX__ ; Select with Arrow Keys
cmp al,90 cmp al,90
je .yesmoveup je .yesmoveup
cmp dword[numlockptr],1 cmp dword[numlockptr],1
@@ -2113,8 +2113,8 @@ GUICheatSearchKeys:
cmp byte[CheatCompareValue],3 cmp byte[CheatCompareValue],3
je .nomovedown je .nomovedown
inc byte[CheatCompareValue] inc byte[CheatCompareValue]
.nomovedown ; Restart/View/Search Buttons .nomovedown ; Restart/View/Search Buttons
cmp dh,'R' cmp dh,'R'
jne .notrestart jne .notrestart
@@ -2135,7 +2135,7 @@ GUICheatSearchKeys:
call CheatCodeSearchProcess call CheatCodeSearchProcess
.nosearchprocess .nosearchprocess
ret ret
.view ; View .view ; View
cmp dword[NumCheatSrc],0 ; Return Hotkey cmp dword[NumCheatSrc],0 ; Return Hotkey
jne .nozero jne .nozero
@@ -2349,7 +2349,7 @@ GUICheatSearchKeys:
; Allows you to use the arrow keys to select a state number, and Enter to pick ; Allows you to use the arrow keys to select a state number, and Enter to pick
GUIStateSelKeys: GUIStateSelKeys:
cmp al,13 cmp al,13
jne .noenter jne .noenter
xor eax,eax xor eax,eax
mov al,[GUIwinptr] mov al,[GUIwinptr]
@@ -2519,7 +2519,7 @@ GUIResetKeys:
mov [GUIcmenupos],al mov [GUIcmenupos],al
.notnoreset .notnoreset
ret ret
; Allows you to select boxes with the arrow keys, Enter to choose ; Allows you to select boxes with the arrow keys, Enter to choose
GUIStateKeys: GUIStateKeys:
%ifdef __LINUX__ %ifdef __LINUX__

View File

@@ -2200,13 +2200,13 @@ DisplayGUIInputClick:
.skipscrol .skipscrol
;x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# ;x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick#
GUIWinControl 5,36,107,34+5*8,GUIBlankVar,GUIcurrentinputviewloc,GUINumValue,35,8,GUIcurrentinputcursloc,4,3,0 GUIWinControl 5,36,107,34+5*8,GUIBlankVar,GUIcurrentinputviewloc,GUINumValue,35,8,GUIcurrentinputcursloc,4,3,0
GUIPHoldbutton 125,34,155,45,14 ; Buttons GUIPHoldbutton 125,34,155,45,14 ; Buttons
%ifdef __MSDOS__ %ifdef __MSDOS__
GUIPHoldbutton 125,50,185,61,15 GUIPHoldbutton 125,50,185,61,15
%endif %endif
GUIPHoldbutton 125,66,185,77,40 GUIPHoldbutton 125,66,185,77,40
mov edi,pl1selk mov edi,pl1selk
mov dword[keycontrolval],pl1contrl mov dword[keycontrolval],pl1contrl
cmp byte[cplayernum],1 cmp byte[cplayernum],1
@@ -2815,7 +2815,7 @@ DisplayGUIOptnsClick:
GUIClickCButton 12,63,byte[GUIClick] GUIClickCButton 12,63,byte[GUIClick]
GUIClickCButton 12,73,byte[JoyPad1Move] GUIClickCButton 12,73,byte[JoyPad1Move]
GUIClickCButton 124,23,byte[GUIEnableTransp] GUIClickCButton 124,23,byte[GUIEnableTransp]
GUIClickCButtonI 124,33,byte[FilteredGUI] GUIClickCButtonI 124,33,byte[FilteredGUI]
GUIClickCButton6 124,43,byte[GUIEffect],1 GUIClickCButton6 124,43,byte[GUIEffect],1
GUIClickCButton6 124,53,byte[GUIEffect],2 GUIClickCButton6 124,53,byte[GUIEffect],2
GUIClickCButton6 124,63,byte[GUIEffect],3 GUIClickCButton6 124,63,byte[GUIEffect],3
@@ -3115,7 +3115,7 @@ DisplayGUICheatSearchClick:
je near .view je near .view
cmp byte[CheatWinMode],3 cmp byte[CheatWinMode],3
je near .add je near .add
GUIPHoldbutton 95,140,140,152,50 ; Main Menu GUIPHoldbutton 95,140,140,152,50 ; Main Menu
GUIPButtonHole 11,28,byte[CheatSrcByteSize],0 GUIPButtonHole 11,28,byte[CheatSrcByteSize],0
GUIPButtonHole 11,38,byte[CheatSrcByteSize],1 GUIPButtonHole 11,38,byte[CheatSrcByteSize],1
@@ -3126,18 +3126,18 @@ DisplayGUICheatSearchClick:
GUIPButtonHole 11,113,byte[CheatSrcSearchType],0 GUIPButtonHole 11,113,byte[CheatSrcSearchType],0
GUIPButtonHole 11,123,byte[CheatSrcSearchType],1 GUIPButtonHole 11,123,byte[CheatSrcSearchType],1
ret ret
.incheatmode ; Exact Value .incheatmode ; Exact Value
GUIPHoldbutton 30,140,80,152,51 GUIPHoldbutton 30,140,80,152,51
cmp byte[CheatSearchStatus],1 cmp byte[CheatSearchStatus],1
jne near .cheatsearching jne near .cheatsearching
jmp .nosearch jmp .nosearch
.cheatsearching ; Return and Re-Search .cheatsearching ; Return and Re-Search
cmp byte[CheatSrcSearchType],1 cmp byte[CheatSrcSearchType],1
je near .cheatsearchingcomp je near .cheatsearchingcomp
jmp .searched jmp .searched
.cheatsearchingcomp ; Select Comparison .cheatsearchingcomp ; Select Comparison
GUIPButtonHole 11,33,byte[CheatCompareValue],0 GUIPButtonHole 11,33,byte[CheatCompareValue],0
GUIPButtonHole 11,43,byte[CheatCompareValue],1 GUIPButtonHole 11,43,byte[CheatCompareValue],1
@@ -3162,11 +3162,11 @@ DisplayGUICheatSearchClick:
.skipscrol .skipscrol
; x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# ; x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick#
GUIWinControl 5,23,171,21+12*7,GUIBlankVar,GUIcurrentchtsrcviewloc,NumCheatSrc,22,7,GUIcurrentchtsrccursloc,5,13,30 GUIWinControl 5,23,171,21+12*7,GUIBlankVar,GUIcurrentchtsrcviewloc,NumCheatSrc,22,7,GUIcurrentchtsrccursloc,5,13,30
GUIPHoldbutton 70,140,130,152,54 ; Return/Add Buttons GUIPHoldbutton 70,140,130,152,54 ; Return/Add Buttons
GUIPHoldbutton 140,140,180,152,55 GUIPHoldbutton 140,140,180,152,55
ret ret
; DrawSlideBarWin 13,173,28,[GUIcurrentchtsrcviewloc],[NumCheatSrc],12,73,GUICSStA ; DrawSlideBarWin 13,173,28,[GUIcurrentchtsrcviewloc],[NumCheatSrc],12,73,GUICSStA
; DrawGUIWinBox 13,5,20,171,108,167 ; DrawGUIWinBox 13,5,20,171,108,167

View File

@@ -85,7 +85,7 @@ NEWSYM autoloadstate, db 0 ; auto load state slot number
NEWSYM autoloadmovie, db 0 NEWSYM autoloadmovie, db 0
NEWSYM ZMVRawDump, db 0 NEWSYM ZMVRawDump, db 0
NEWSYM EndMessage NEWSYM EndMessage
db ' ',13,10,0 db ' ',13,10,0
SECTION .text SECTION .text
@@ -254,9 +254,9 @@ NEWSYM init
jne .norawdump jne .norawdump
call MovieDumpRaw call MovieDumpRaw
jmp .aftermovieplay jmp .aftermovieplay
.norawdump .norawdump
call MoviePlay call MoviePlay
.aftermovieplay .aftermovieplay
popad popad
.noautloadmovie .noautloadmovie

View File

@@ -1062,7 +1062,7 @@ void loadROM()
{ {
bool isCompressed = false, isZip = false; bool isCompressed = false, isZip = false;
EMUPause = false; EMUPause = false;
curromspace = 0; curromspace = 0;
maxromspace = 4194304; maxromspace = 4194304;

View File

@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
typedef NCompression::NArithmetic::CRangeDecoder CMyRangeDecoder; typedef NCompression::NArithmetic::CRangeDecoder CMyRangeDecoder;
template <int aNumMoveBits> class CMyBitDecoder: template <int aNumMoveBits> class CMyBitDecoder:
public NCompression::NArithmetic::CBitDecoder<aNumMoveBits> {}; public NCompression::NArithmetic::CBitDecoder<aNumMoveBits> {};
#endif #endif

View File

@@ -67,7 +67,7 @@ namespace CRC32lib
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d };
//CRC32 for char arrays //CRC32 for char arrays
unsigned int CRC32(const unsigned char *array, size_t size, register unsigned int crc32) unsigned int CRC32(const unsigned char *array, size_t size, register unsigned int crc32)
{ {

View File

@@ -27,7 +27,7 @@ HRESULT ISequentialInStream_Array::Read(void *aData, UINT32 aSize, UINT32 *aProc
if (aSize > size) if (aSize > size)
{ {
aSize = size; aSize = size;
} }
*aProcessedSize = aSize; *aProcessedSize = aSize;
memcpy(aData, data, aSize); memcpy(aData, data, aSize);
@@ -57,7 +57,7 @@ HRESULT ISequentialInStream_String::Read(void *aData, UINT32 aSize, UINT32 *aPro
if (aSize > data.size()) if (aSize > data.size())
{ {
aSize = data.size(); aSize = data.size();
} }
*aProcessedSize = aSize; *aProcessedSize = aSize;
memcpy(aData, data.c_str(), aSize); memcpy(aData, data.c_str(), aSize);

View File

@@ -40,7 +40,7 @@ class ISequentialInStream_Array : public ISequentialInStream
unsigned int size; unsigned int size;
public: public:
ISequentialInStream_Array(const char *Adata, unsigned Asize) : data(Adata), size(Asize) { } ISequentialInStream_Array(const char *Adata, unsigned Asize) : data(Adata), size(Asize) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -49,7 +49,7 @@ class ISequentialInStream_String : public ISequentialInStream
std::string& data; std::string& data;
public: public:
ISequentialInStream_String(std::string& Adata) : data(Adata) { } ISequentialInStream_String(std::string& Adata) : data(Adata) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -58,7 +58,7 @@ class ISequentialInStream_Istream : public ISequentialInStream
std::istream& data; std::istream& data;
public: public:
ISequentialInStream_Istream(std::istream& Adata) : data(Adata) { } ISequentialInStream_Istream(std::istream& Adata) : data(Adata) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -73,7 +73,7 @@ public:
virtual HRESULT Write(const void *, UINT32, UINT32 *) = 0; virtual HRESULT Write(const void *, UINT32, UINT32 *) = 0;
}; };
class ISequentialOutStream_Array : public ISequentialOutStream class ISequentialOutStream_Array : public ISequentialOutStream
{ {
char *data; char *data;
@@ -120,7 +120,7 @@ public:
class ISequentialStreamCRC32 class ISequentialStreamCRC32
{ {
protected: protected:
unsigned int crc32; unsigned int crc32;
public: public:
ISequentialStreamCRC32() : crc32(0) {} ISequentialStreamCRC32() : crc32(0) {}
@@ -130,17 +130,17 @@ public:
class ISequentialInStreamCRC32_Array : public ISequentialInStream_Array, public ISequentialStreamCRC32 class ISequentialInStreamCRC32_Array : public ISequentialInStream_Array, public ISequentialStreamCRC32
{ {
public: public:
ISequentialInStreamCRC32_Array(const char *Adata, unsigned Asize) : ISequentialInStream_Array(Adata, Asize) { } ISequentialInStreamCRC32_Array(const char *Adata, unsigned Asize) : ISequentialInStream_Array(Adata, Asize) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
class ISequentialInStreamCRC32_String : public ISequentialInStream_String, public ISequentialStreamCRC32 class ISequentialInStreamCRC32_String : public ISequentialInStream_String, public ISequentialStreamCRC32
{ {
public: public:
ISequentialInStreamCRC32_String(std::string& Adata) : ISequentialInStream_String(Adata) { } ISequentialInStreamCRC32_String(std::string& Adata) : ISequentialInStream_String(Adata) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -148,16 +148,16 @@ class ISequentialInStreamCRC32_Istream : public ISequentialInStream_Istream, pub
{ {
public: public:
ISequentialInStreamCRC32_Istream(std::istream& Adata) : ISequentialInStream_Istream(Adata) { } ISequentialInStreamCRC32_Istream(std::istream& Adata) : ISequentialInStream_Istream(Adata) { }
HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
class ISequentialOutStreamCRC32_Array : public ISequentialOutStream_Array, public ISequentialStreamCRC32 class ISequentialOutStreamCRC32_Array : public ISequentialOutStream_Array, public ISequentialStreamCRC32
{ {
public: public:
ISequentialOutStreamCRC32_Array(char *Adata, unsigned Asize) : ISequentialOutStream_Array(Adata, Asize) { } ISequentialOutStreamCRC32_Array(char *Adata, unsigned Asize) : ISequentialOutStream_Array(Adata, Asize) { }
HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -165,7 +165,7 @@ class ISequentialOutStreamCRC32_String : public ISequentialOutStream_String, pub
{ {
public: public:
ISequentialOutStreamCRC32_String(std::string& Adata) : ISequentialOutStream_String(Adata) { } ISequentialOutStreamCRC32_String(std::string& Adata) : ISequentialOutStream_String(Adata) { }
HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };
@@ -174,7 +174,7 @@ class ISequentialOutStreamCRC32_Ostream : public ISequentialOutStream_Ostream, p
{ {
public: public:
ISequentialOutStreamCRC32_Ostream(std::ostream& Adata) : ISequentialOutStream_Ostream(Adata) { } ISequentialOutStreamCRC32_Ostream(std::ostream& Adata) : ISequentialOutStream_Ostream(Adata) { }
HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize);
}; };

View File

@@ -39,7 +39,7 @@ class CInByte
public: public:
CInByte(UINT32 aBufferSize = 0x100000); CInByte(UINT32 aBufferSize = 0x100000);
~CInByte(); ~CInByte();
void Init(ISequentialInStream *aStream); void Init(ISequentialInStream *aStream);
bool ReadByte(BYTE &aByte) bool ReadByte(BYTE &aByte)

View File

@@ -28,80 +28,80 @@ using namespace std;
namespace JMA namespace JMA
{ {
const char jma_magic[] = { 'J', 'M', 'A', 0, 'N' }; const char jma_magic[] = { 'J', 'M', 'A', 0, 'N' };
const unsigned int jma_header_length = 5; const unsigned int jma_header_length = 5;
const unsigned char jma_version = 1; const unsigned char jma_version = 1;
const unsigned int jma_version_length = 1; const unsigned int jma_version_length = 1;
const unsigned int jma_total_header_length = jma_header_length + jma_version_length + UINT_SIZE; const unsigned int jma_total_header_length = jma_header_length + jma_version_length + UINT_SIZE;
//Convert DOS/zip/JMA integer time to to time_t //Convert DOS/zip/JMA integer time to to time_t
time_t uint_to_time(unsigned short date, unsigned short time) time_t uint_to_time(unsigned short date, unsigned short time)
{ {
tm formatted_time; tm formatted_time;
formatted_time.tm_mday = date & 0x1F; formatted_time.tm_mday = date & 0x1F;
formatted_time.tm_mon = ((date >> 5) & 0xF) - 1; formatted_time.tm_mon = ((date >> 5) & 0xF) - 1;
formatted_time.tm_year = ((date >> 9) & 0x7f) + 80; formatted_time.tm_year = ((date >> 9) & 0x7f) + 80;
formatted_time.tm_sec = (time & 0x1F) * 2; formatted_time.tm_sec = (time & 0x1F) * 2;
formatted_time.tm_min = (time >> 5) & 0x3F; formatted_time.tm_min = (time >> 5) & 0x3F;
formatted_time.tm_hour = (time >> 11) & 0x1F; formatted_time.tm_hour = (time >> 11) & 0x1F;
return(mktime(&formatted_time)); return(mktime(&formatted_time));
} }
//Retreive the file block, what else? //Retreive the file block, what else?
void jma_open::retrieve_file_block() throw(jma_errors) void jma_open::retrieve_file_block() throw(jma_errors)
{ {
unsigned char uint_buffer[UINT_SIZE]; unsigned char uint_buffer[UINT_SIZE];
unsigned char ushort_buffer[USHORT_SIZE]; unsigned char ushort_buffer[USHORT_SIZE];
//File block size is the last UINT in the file //File block size is the last UINT in the file
stream.seekg(-UINT_SIZE,ios::end); stream.seekg(-UINT_SIZE,ios::end);
stream.read((char *)uint_buffer, UINT_SIZE); stream.read((char *)uint_buffer, UINT_SIZE);
size_t file_block_size = charp_to_uint(uint_buffer); size_t file_block_size = charp_to_uint(uint_buffer);
//Currently at the end of the file, so that's the file size //Currently at the end of the file, so that's the file size
size_t jma_file_size = stream.tellg(); size_t jma_file_size = stream.tellg();
//The file block can't be larger than the JMA file without it's header. //The file block can't be larger than the JMA file without it's header.
//This if can probably be improved //This if can probably be improved
if (file_block_size >= jma_file_size-jma_total_header_length) if (file_block_size >= jma_file_size-jma_total_header_length)
{ {
throw(JMA_BAD_FILE); throw(JMA_BAD_FILE);
} }
//Seek to before file block so we can read the file block //Seek to before file block so we can read the file block
stream.seekg(-((int)file_block_size+UINT_SIZE),ios::end); stream.seekg(-((int)file_block_size+UINT_SIZE),ios::end);
//This is needed if the file block is compressed //This is needed if the file block is compressed
stringstream decompressed_file_block; stringstream decompressed_file_block;
//Pointer to where to read file block from (file or decompressed buffer) //Pointer to where to read file block from (file or decompressed buffer)
istream *file_block_stream; istream *file_block_stream;
//Setup file info buffer and byte to read with //Setup file info buffer and byte to read with
jma_file_info file_info; jma_file_info file_info;
char byte; char byte;
stream.get(byte); stream.get(byte);
if (!byte) //If file block is compressed if (!byte) //If file block is compressed
{ {
//Compressed size isn't counting the byte we just read or the UINT for compressed size //Compressed size isn't counting the byte we just read or the UINT for compressed size
size_t compressed_size = file_block_size - (1+UINT_SIZE); size_t compressed_size = file_block_size - (1+UINT_SIZE);
//Read decompressed size / true file block size //Read decompressed size / true file block size
stream.read((char *)uint_buffer, UINT_SIZE); stream.read((char *)uint_buffer, UINT_SIZE);
file_block_size = charp_to_uint(uint_buffer); file_block_size = charp_to_uint(uint_buffer);
//Setup access methods for decompression //Setup access methods for decompression
ISequentialInStream_Istream compressed_data(stream); ISequentialInStream_Istream compressed_data(stream);
ISequentialOutStream_Ostream decompressed_data(decompressed_file_block); ISequentialOutStream_Ostream decompressed_data(decompressed_file_block);
//Decompress the data //Decompress the data
if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, file_block_size)) if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, file_block_size))
{ {
throw(JMA_DECOMPRESS_FAILED); throw(JMA_DECOMPRESS_FAILED);
} }
//Go to beginning, setup pointer to buffer //Go to beginning, setup pointer to buffer
decompressed_file_block.seekg(0, ios::beg); decompressed_file_block.seekg(0, ios::beg);
file_block_stream = &decompressed_file_block; file_block_stream = &decompressed_file_block;
@@ -111,8 +111,8 @@ namespace JMA
stream.putback(byte); //Putback byte, byte is part of filename, not compressed indicator stream.putback(byte); //Putback byte, byte is part of filename, not compressed indicator
file_block_stream = &stream; file_block_stream = &stream;
} }
//Minimum file name length is 2 bytes, a char and a null //Minimum file name length is 2 bytes, a char and a null
//Minimum comment length is 1 byte, a null //Minimum comment length is 1 byte, a null
//There are currently 2 UINTs and 2 USHORTs per file //There are currently 2 UINTs and 2 USHORTs per file
@@ -120,7 +120,7 @@ namespace JMA
{ {
//First stored in the file block is the file name null terminated //First stored in the file block is the file name null terminated
file_info.name = ""; file_info.name = "";
file_block_stream->get(byte); file_block_stream->get(byte);
while (byte) while (byte)
{ {
@@ -132,8 +132,8 @@ namespace JMA
if (!file_info.name.length()) if (!file_info.name.length())
{ {
throw(JMA_BAD_FILE); throw(JMA_BAD_FILE);
} }
//Same trick as above for the comment //Same trick as above for the comment
file_info.comment = ""; file_info.comment = "";
@@ -143,38 +143,38 @@ namespace JMA
file_info.comment += byte; file_info.comment += byte;
file_block_stream->get(byte); file_block_stream->get(byte);
} }
//Next is a UINT representing the file's size //Next is a UINT representing the file's size
file_block_stream->read((char *)uint_buffer, UINT_SIZE); file_block_stream->read((char *)uint_buffer, UINT_SIZE);
file_info.size = charp_to_uint(uint_buffer); file_info.size = charp_to_uint(uint_buffer);
//Followed by CRC32 //Followed by CRC32
file_block_stream->read((char *)uint_buffer, UINT_SIZE); file_block_stream->read((char *)uint_buffer, UINT_SIZE);
file_info.crc32 = charp_to_uint(uint_buffer); file_info.crc32 = charp_to_uint(uint_buffer);
//Special USHORT representation of file's date //Special USHORT representation of file's date
file_block_stream->read((char *)ushort_buffer, USHORT_SIZE); file_block_stream->read((char *)ushort_buffer, USHORT_SIZE);
file_info.date = charp_to_ushort(ushort_buffer); file_info.date = charp_to_ushort(ushort_buffer);
//Special USHORT representation of file's time //Special USHORT representation of file's time
file_block_stream->read((char *)ushort_buffer, USHORT_SIZE); file_block_stream->read((char *)ushort_buffer, USHORT_SIZE);
file_info.time = charp_to_ushort(ushort_buffer); file_info.time = charp_to_ushort(ushort_buffer);
file_info.buffer = 0; //Pointing to null till we decompress files file_info.buffer = 0; //Pointing to null till we decompress files
files.push_back(file_info); //Put file info into our structure files.push_back(file_info); //Put file info into our structure
//Subtract size of the file info we just read //Subtract size of the file info we just read
file_block_size -= file_info.name.length()+file_info.comment.length()+2+UINT_SIZE*2+USHORT_SIZE*2; file_block_size -= file_info.name.length()+file_info.comment.length()+2+UINT_SIZE*2+USHORT_SIZE*2;
} }
} }
//Constructor for opening JMA files for reading //Constructor for opening JMA files for reading
jma_open::jma_open(const char *compressed_file_name) throw (jma_errors) jma_open::jma_open(const char *compressed_file_name) throw (jma_errors)
{ {
decompressed_buffer = 0; decompressed_buffer = 0;
compressed_buffer = 0; compressed_buffer = 0;
stream.open(compressed_file_name, ios::in | ios::binary); stream.open(compressed_file_name, ios::in | ios::binary);
if (!stream.is_open()) if (!stream.is_open())
{ {
@@ -188,7 +188,7 @@ namespace JMA
{ {
throw(JMA_BAD_FILE); throw(JMA_BAD_FILE);
} }
//Not the cleanest code but logical //Not the cleanest code but logical
stream.read((char *)header, 5); stream.read((char *)header, 5);
if (*header <= jma_version) if (*header <= jma_version)
@@ -216,7 +216,7 @@ namespace JMA
{ {
vector<jma_public_file_info> file_info_vector; vector<jma_public_file_info> file_info_vector;
jma_public_file_info file_info; jma_public_file_info file_info;
for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++) for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++)
{ {
file_info.name = i->name; file_info.name = i->name;
@@ -226,10 +226,10 @@ namespace JMA
file_info.crc32 = i->crc32; file_info.crc32 = i->crc32;
file_info_vector.push_back(file_info); file_info_vector.push_back(file_info);
} }
return(file_info_vector); return(file_info_vector);
} }
//Skip forward a given number of chunks //Skip forward a given number of chunks
void jma_open::chunk_seek(unsigned int chunk_num) throw(jma_errors) void jma_open::chunk_seek(unsigned int chunk_num) throw(jma_errors)
{ {
@@ -238,25 +238,25 @@ namespace JMA
{ {
throw(JMA_NO_OPEN); throw(JMA_NO_OPEN);
} }
//Clear possible errors so the seek will work //Clear possible errors so the seek will work
stream.clear(); stream.clear();
//Move forward over header //Move forward over header
stream.seekg(jma_total_header_length, ios::beg); stream.seekg(jma_total_header_length, ios::beg);
unsigned char int4_buffer[UINT_SIZE]; unsigned char int4_buffer[UINT_SIZE];
while (chunk_num--) while (chunk_num--)
{ {
//Read in size of chunk //Read in size of chunk
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
//Skip chunk plus it's CRC32 //Skip chunk plus it's CRC32
stream.seekg(charp_to_uint(int4_buffer)+UINT_SIZE, ios::cur); stream.seekg(charp_to_uint(int4_buffer)+UINT_SIZE, ios::cur);
} }
} }
//Return a vector of pointers to each file in the JMA, the buffer to hold all the files //Return a vector of pointers to each file in the JMA, the buffer to hold all the files
//must be initilized outside. //must be initilized outside.
vector<unsigned char *> jma_open::get_all_files(unsigned char *buffer) throw(jma_errors) vector<unsigned char *> jma_open::get_all_files(unsigned char *buffer) throw(jma_errors)
@@ -266,19 +266,19 @@ namespace JMA
{ {
throw(JMA_NO_OPEN); throw(JMA_NO_OPEN);
} }
//Seek to the first chunk //Seek to the first chunk
chunk_seek(0); chunk_seek(0);
//Set the buffer that decompressed data goes to //Set the buffer that decompressed data goes to
decompressed_buffer = buffer; decompressed_buffer = buffer;
//If the JMA is not solid //If the JMA is not solid
if (chunk_size) if (chunk_size)
{ {
unsigned char int4_buffer[UINT_SIZE]; unsigned char int4_buffer[UINT_SIZE];
size_t size = get_total_size(files); size_t size = get_total_size(files);
//For each chunk in the file... //For each chunk in the file...
for (size_t remaining_size = size; remaining_size; remaining_size -= chunk_size) for (size_t remaining_size = size; remaining_size; remaining_size -= chunk_size)
{ {
@@ -299,7 +299,7 @@ namespace JMA
//Read all the compressed data in //Read all the compressed data in
stream.read((char *)compressed_buffer, compressed_size); stream.read((char *)compressed_buffer, compressed_size);
//Read the expected CRC of compressed data from the file //Read the expected CRC of compressed data from the file
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
@@ -309,17 +309,17 @@ namespace JMA
delete[] compressed_buffer; delete[] compressed_buffer;
throw(JMA_BAD_FILE); throw(JMA_BAD_FILE);
} }
//Decompress the data, cleanup memory on failure //Decompress the data, cleanup memory on failure
if (!decompress_lzma_7z(compressed_buffer, compressed_size, if (!decompress_lzma_7z(compressed_buffer, compressed_size,
decompressed_buffer+size-remaining_size, decompressed_buffer+size-remaining_size,
(remaining_size > chunk_size) ? chunk_size : remaining_size)) (remaining_size > chunk_size) ? chunk_size : remaining_size))
{ {
delete[] compressed_buffer; delete[] compressed_buffer;
throw(JMA_DECOMPRESS_FAILED); throw(JMA_DECOMPRESS_FAILED);
} }
delete[] compressed_buffer; delete[] compressed_buffer;
if (remaining_size <= chunk_size) //If we just decompressed the remainder if (remaining_size <= chunk_size) //If we just decompressed the remainder
{ {
break; break;
@@ -328,25 +328,25 @@ namespace JMA
} }
else //Solidly compressed JMA else //Solidly compressed JMA
{ {
unsigned char int4_buffer[UINT_SIZE]; unsigned char int4_buffer[UINT_SIZE];
//Read the size of the compressed data //Read the size of the compressed data
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
size_t compressed_size = charp_to_uint(int4_buffer); size_t compressed_size = charp_to_uint(int4_buffer);
//Get decompressed size //Get decompressed size
size_t size = get_total_size(files); size_t size = get_total_size(files);
//Setup access methods for decompression //Setup access methods for decompression
ISequentialInStream_Istream compressed_data(stream); ISequentialInStream_Istream compressed_data(stream);
ISequentialOutStream_Array decompressed_data(reinterpret_cast<char*>(decompressed_buffer), size); ISequentialOutStream_Array decompressed_data(reinterpret_cast<char*>(decompressed_buffer), size);
//Decompress the data //Decompress the data
if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, size)) if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, size))
{ {
throw(JMA_DECOMPRESS_FAILED); throw(JMA_DECOMPRESS_FAILED);
} }
/* /*
//Allocate memory of the right size to hold the compressed data in the JMA //Allocate memory of the right size to hold the compressed data in the JMA
try try
@@ -357,14 +357,14 @@ namespace JMA
{ {
throw(JMA_NO_MEM_ALLOC); throw(JMA_NO_MEM_ALLOC);
} }
//Copy the compressed data into memory //Copy the compressed data into memory
stream.read((char *)compressed_buffer, compressed_size); stream.read((char *)compressed_buffer, compressed_size);
size_t size = get_total_size(files); size_t size = get_total_size(files);
//Read the CRC of the compressed data //Read the CRC of the compressed data
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
//If it doesn't match, complain //If it doesn't match, complain
if (CRC32lib::CRC32(compressed_buffer, compressed_size) != charp_to_uint(int4_buffer)) if (CRC32lib::CRC32(compressed_buffer, compressed_size) != charp_to_uint(int4_buffer))
{ {
@@ -381,10 +381,10 @@ namespace JMA
delete[] compressed_buffer; delete[] compressed_buffer;
*/ */
} }
vector<unsigned char *> file_pointers; vector<unsigned char *> file_pointers;
size_t size = 0; size_t size = 0;
//For each file, add it's pointer to the vector, size is pointer offset in the buffer //For each file, add it's pointer to the vector, size is pointer offset in the buffer
for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++) for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++)
{ {
@@ -394,7 +394,7 @@ namespace JMA
} }
//Return the vector of pointers //Return the vector of pointers
return(file_pointers); return(file_pointers);
} }
//Extracts the file with a given name found in the archive to the given buffer //Extracts the file with a given name found in the archive to the given buffer
@@ -404,10 +404,10 @@ namespace JMA
{ {
throw(JMA_NO_OPEN); throw(JMA_NO_OPEN);
} }
size_t size_to_skip = 0; size_t size_to_skip = 0;
size_t our_file_size = 0; size_t our_file_size = 0;
//Search through the vector of file information //Search through the vector of file information
for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++) for (vector<jma_file_info>::iterator i = files.begin(); i != files.end(); i++)
{ {
@@ -417,11 +417,11 @@ namespace JMA
our_file_size = i->size; our_file_size = i->size;
break; break;
} }
//Keep a running total of size //Keep a running total of size
size_to_skip += i->size; size_to_skip += i->size;
} }
if (!our_file_size) //File with the specified name was not found in the archive if (!our_file_size) //File with the specified name was not found in the archive
{ {
throw(JMA_FILE_NOT_FOUND); throw(JMA_FILE_NOT_FOUND);
@@ -433,14 +433,14 @@ namespace JMA
get_all_files(buffer); get_all_files(buffer);
return; return;
} }
if (chunk_size) //we are using non-solid archive.. if (chunk_size) //we are using non-solid archive..
{ {
unsigned int chunks_to_skip = size_to_skip / chunk_size; unsigned int chunks_to_skip = size_to_skip / chunk_size;
//skip over requisite number of chunks //skip over requisite number of chunks
chunk_seek(chunks_to_skip); chunk_seek(chunks_to_skip);
//Allocate memory for compressed and decompressed data //Allocate memory for compressed and decompressed data
unsigned char *comp_buffer = 0, *decomp_buffer = 0; unsigned char *comp_buffer = 0, *decomp_buffer = 0;
try try
@@ -454,7 +454,7 @@ namespace JMA
{ {
throw(JMA_NO_MEM_ALLOC); throw(JMA_NO_MEM_ALLOC);
} }
size_t first_chunk_offset = size_to_skip % chunk_size; size_t first_chunk_offset = size_to_skip % chunk_size;
unsigned char int4_buffer[UINT_SIZE]; unsigned char int4_buffer[UINT_SIZE];
for (size_t i = 0; i < our_file_size;) for (size_t i = 0; i < our_file_size;)
@@ -462,29 +462,29 @@ namespace JMA
//Get size //Get size
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
size_t compressed_size = charp_to_uint(int4_buffer); size_t compressed_size = charp_to_uint(int4_buffer);
//Read all the compressed data in //Read all the compressed data in
stream.read((char *)comp_buffer, compressed_size); stream.read((char *)comp_buffer, compressed_size);
//Read the CRC of the compressed data //Read the CRC of the compressed data
stream.read((char *)int4_buffer, UINT_SIZE); stream.read((char *)int4_buffer, UINT_SIZE);
//If it doesn't match, complain //If it doesn't match, complain
if (CRC32lib::CRC32(comp_buffer, compressed_size) != charp_to_uint(int4_buffer)) if (CRC32lib::CRC32(comp_buffer, compressed_size) != charp_to_uint(int4_buffer))
{ {
delete[] comp_buffer; delete[] comp_buffer;
throw(JMA_BAD_FILE); throw(JMA_BAD_FILE);
} }
//Decompress chunk //Decompress chunk
if (!decompress_lzma_7z(comp_buffer, compressed_size, decomp_buffer, chunk_size)) if (!decompress_lzma_7z(comp_buffer, compressed_size, decomp_buffer, chunk_size))
{ {
delete[] comp_buffer; delete[] comp_buffer;
throw(JMA_DECOMPRESS_FAILED); throw(JMA_DECOMPRESS_FAILED);
} }
size_t copy_amount = our_file_size-i > chunk_size-first_chunk_offset ? chunk_size-first_chunk_offset : our_file_size-i; size_t copy_amount = our_file_size-i > chunk_size-first_chunk_offset ? chunk_size-first_chunk_offset : our_file_size-i;
memcpy(buffer+i, decomp_buffer+first_chunk_offset, copy_amount); memcpy(buffer+i, decomp_buffer+first_chunk_offset, copy_amount);
first_chunk_offset = 0; //Set to zero since this is only for the first iteration first_chunk_offset = 0; //Set to zero since this is only for the first iteration
i += copy_amount; i += copy_amount;
@@ -502,11 +502,11 @@ namespace JMA
{ {
throw(JMA_NO_MEM_ALLOC); throw(JMA_NO_MEM_ALLOC);
} }
get_all_files(decomp_buffer); get_all_files(decomp_buffer);
memcpy(buffer, decomp_buffer+size_to_skip, our_file_size); memcpy(buffer, decomp_buffer+size_to_skip, our_file_size);
delete[] decomp_buffer; delete[] decomp_buffer;
} }
} }
@@ -515,32 +515,32 @@ namespace JMA
{ {
return(chunk_size ? false : true); return(chunk_size ? false : true);
} }
const char *jma_error_text(jma_errors error) const char *jma_error_text(jma_errors error)
{ {
switch (error) switch (error)
{ {
case JMA_NO_CREATE: case JMA_NO_CREATE:
return("JMA could not be created"); return("JMA could not be created");
case JMA_NO_MEM_ALLOC: case JMA_NO_MEM_ALLOC:
return("Memory for JMA could be allocated"); return("Memory for JMA could be allocated");
case JMA_NO_OPEN: case JMA_NO_OPEN:
return("JMA could not be opened"); return("JMA could not be opened");
case JMA_BAD_FILE: case JMA_BAD_FILE:
return("Invalid/Corrupt JMA"); return("Invalid/Corrupt JMA");
case JMA_UNSUPPORTED_VERSION: case JMA_UNSUPPORTED_VERSION:
return("JMA version not supported"); return("JMA version not supported");
case JMA_COMPRESS_FAILED: case JMA_COMPRESS_FAILED:
return("JMA compression failed"); return("JMA compression failed");
case JMA_DECOMPRESS_FAILED: case JMA_DECOMPRESS_FAILED:
return("JMA decompression failed"); return("JMA decompression failed");
case JMA_FILE_NOT_FOUND: case JMA_FILE_NOT_FOUND:
return("File not found in JMA"); return("File not found in JMA");
} }

View File

@@ -27,10 +27,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace JMA namespace JMA
{ {
enum jma_errors { JMA_NO_CREATE, JMA_NO_MEM_ALLOC, JMA_NO_OPEN, JMA_BAD_FILE, enum jma_errors { JMA_NO_CREATE, JMA_NO_MEM_ALLOC, JMA_NO_OPEN, JMA_BAD_FILE,
JMA_UNSUPPORTED_VERSION, JMA_COMPRESS_FAILED, JMA_DECOMPRESS_FAILED, JMA_UNSUPPORTED_VERSION, JMA_COMPRESS_FAILED, JMA_DECOMPRESS_FAILED,
JMA_FILE_NOT_FOUND }; JMA_FILE_NOT_FOUND };
struct jma_file_info_base struct jma_file_info_base
{ {
std::string name; std::string name;
@@ -38,12 +38,12 @@ namespace JMA
size_t size; size_t size;
unsigned int crc32; unsigned int crc32;
}; };
struct jma_public_file_info : jma_file_info_base struct jma_public_file_info : jma_file_info_base
{ {
time_t datetime; time_t datetime;
}; };
struct jma_file_info : jma_file_info_base struct jma_file_info : jma_file_info_base
{ {
unsigned short date; unsigned short date;
@@ -59,7 +59,7 @@ namespace JMA
{ {
size += i->size; //We do have a problem if this wraps around size += i->size; //We do have a problem if this wraps around
} }
return(size); return(size);
} }
@@ -68,23 +68,23 @@ namespace JMA
public: public:
jma_open(const char *) throw(jma_errors); jma_open(const char *) throw(jma_errors);
~jma_open(); ~jma_open();
std::vector<jma_public_file_info> get_files_info(); std::vector<jma_public_file_info> get_files_info();
std::vector<unsigned char *> get_all_files(unsigned char *) throw(jma_errors); std::vector<unsigned char *> get_all_files(unsigned char *) throw(jma_errors);
void extract_file(std::string& name, unsigned char *) throw(jma_errors); void extract_file(std::string& name, unsigned char *) throw(jma_errors);
bool is_solid(); bool is_solid();
private: private:
std::ifstream stream; std::ifstream stream;
std::vector<jma_file_info> files; std::vector<jma_file_info> files;
size_t chunk_size; size_t chunk_size;
unsigned char *decompressed_buffer; unsigned char *decompressed_buffer;
unsigned char *compressed_buffer; unsigned char *compressed_buffer;
void chunk_seek(unsigned int) throw(jma_errors); void chunk_seek(unsigned int) throw(jma_errors);
void retrieve_file_block() throw(jma_errors); void retrieve_file_block() throw(jma_errors);
}; };
const char *jma_error_text(jma_errors); const char *jma_error_text(jma_errors);
} }
#endif #endif

View File

@@ -52,7 +52,7 @@ class CDecoder
CBitTreeDecoder<kNumMoveBits, kNumLenBits> m_LowCoder[kNumPosStatesMax]; CBitTreeDecoder<kNumMoveBits, kNumLenBits> m_LowCoder[kNumPosStatesMax];
CMyBitDecoder<kNumMoveBits> m_Choice2; CMyBitDecoder<kNumMoveBits> m_Choice2;
CBitTreeDecoder<kNumMoveBits, kNumMidBits> m_MidCoder[kNumPosStatesMax]; CBitTreeDecoder<kNumMoveBits, kNumMidBits> m_MidCoder[kNumPosStatesMax];
CBitTreeDecoder<kNumMoveBits, kNumHighBits> m_HighCoder; CBitTreeDecoder<kNumMoveBits, kNumHighBits> m_HighCoder;
UINT32 m_NumPosStates; UINT32 m_NumPosStates;
public: public:
void Create(UINT32 aNumPosStates) void Create(UINT32 aNumPosStates)

View File

@@ -63,7 +63,7 @@ public:
// UINT32 aBit = m_Decoders[1 + aMatchBit][aSymbol].Decode(aRangeDecoder); // UINT32 aBit = m_Decoders[1 + aMatchBit][aSymbol].Decode(aRangeDecoder);
// aSymbol = (aSymbol << 1) | aBit; // aSymbol = (aSymbol << 1) | aBit;
UINT32 aBit; UINT32 aBit;
RC_GETBIT2(kNumMoveBits, m_Decoders[1 + aMatchBit][aSymbol].m_Probability, aSymbol, RC_GETBIT2(kNumMoveBits, m_Decoders[1 + aMatchBit][aSymbol].m_Probability, aSymbol,
aBit = 0, aBit = 1) aBit = 0, aBit = 1)
if (aMatchBit != aBit) if (aMatchBit != aBit)
{ {
@@ -91,7 +91,7 @@ public:
CDecoder(): m_Coders(0) {} CDecoder(): m_Coders(0) {}
~CDecoder() { Free(); } ~CDecoder() { Free(); }
void Free() void Free()
{ {
delete []m_Coders; delete []m_Coders;
m_Coders = 0; m_Coders = 0;
} }

View File

@@ -68,16 +68,16 @@ protected:
} }
}; };
const int kNumPosSlotBits = 6; const int kNumPosSlotBits = 6;
const int kDicLogSizeMax = 28; const int kDicLogSizeMax = 28;
const int kDistTableSizeMax = kDicLogSizeMax * 2; const int kDistTableSizeMax = kDicLogSizeMax * 2;
extern UINT32 kDistStart[kDistTableSizeMax]; extern UINT32 kDistStart[kDistTableSizeMax];
const BYTE kDistDirectBits[kDistTableSizeMax] = const BYTE kDistDirectBits[kDistTableSizeMax] =
{ {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19,
20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26
}; };
const UINT32 kNumLenToPosStates = 4; const UINT32 kNumLenToPosStates = 4;

View File

@@ -30,7 +30,7 @@ HRESULT CDecoder::SetDictionarySize(UINT32 aDictionarySize)
{ {
if (aDictionarySize > (1 << kDicLogSizeMax)) if (aDictionarySize > (1 << kDicLogSizeMax))
return E_INVALIDARG; return E_INVALIDARG;
UINT32 aWindowReservSize = MyMax(aDictionarySize, UINT32(1 << 21)); UINT32 aWindowReservSize = MyMax(aDictionarySize, UINT32(1 << 21));
if (m_DictionarySize != aDictionarySize) if (m_DictionarySize != aDictionarySize)
@@ -100,9 +100,9 @@ HRESULT CDecoder::Init(ISequentialInStream *anInStream,
m_MatchRep1ChoiceDecoders[i].Init(); m_MatchRep1ChoiceDecoders[i].Init();
m_MatchRep2ChoiceDecoders[i].Init(); m_MatchRep2ChoiceDecoders[i].Init();
} }
m_LiteralDecoder.Init(); m_LiteralDecoder.Init();
// m_RepMatchLenDecoder.Init(); // m_RepMatchLenDecoder.Init();
for (i = 0; (UINT32) i < kNumLenToPosStates; i++) for (i = 0; (UINT32) i < kNumLenToPosStates; i++)
@@ -110,7 +110,7 @@ HRESULT CDecoder::Init(ISequentialInStream *anInStream,
for(i = 0; i < kNumPosModels; i++) for(i = 0; i < kNumPosModels; i++)
m_PosDecoders[i].Init(); m_PosDecoders[i].Init();
m_LenDecoder.Init(); m_LenDecoder.Init();
m_RepMatchLenDecoder.Init(); m_RepMatchLenDecoder.Init();
@@ -120,7 +120,7 @@ HRESULT CDecoder::Init(ISequentialInStream *anInStream,
} }
HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream, HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream,
ISequentialOutStream *anOutStream, ISequentialOutStream *anOutStream,
const UINT64 *anInSize, const UINT64 *anOutSize) const UINT64 *anInSize, const UINT64 *anOutSize)
{ {
if (anOutSize == NULL) if (anOutSize == NULL)
@@ -151,21 +151,21 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream,
if(aPeviousIsMatch) if(aPeviousIsMatch)
{ {
BYTE aMatchByte = m_OutWindowStream.GetOneByte(0 - aRepDistances[0] - 1); BYTE aMatchByte = m_OutWindowStream.GetOneByte(0 - aRepDistances[0] - 1);
aPreviousByte = m_LiteralDecoder.DecodeWithMatchByte(&m_RangeDecoder, aPreviousByte = m_LiteralDecoder.DecodeWithMatchByte(&m_RangeDecoder,
UINT32(aNowPos64), aPreviousByte, aMatchByte); UINT32(aNowPos64), aPreviousByte, aMatchByte);
aPeviousIsMatch = false; aPeviousIsMatch = false;
} }
else else
aPreviousByte = m_LiteralDecoder.DecodeNormal(&m_RangeDecoder, aPreviousByte = m_LiteralDecoder.DecodeNormal(&m_RangeDecoder,
UINT32(aNowPos64), aPreviousByte); UINT32(aNowPos64), aPreviousByte);
m_OutWindowStream.PutOneByte(aPreviousByte); m_OutWindowStream.PutOneByte(aPreviousByte);
aNowPos64++; aNowPos64++;
} }
else else
{ {
aPeviousIsMatch = true; aPeviousIsMatch = true;
UINT32 aDistance, aLen; UINT32 aDistance, aLen;
if(m_MatchChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == if(m_MatchChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) ==
(UINT32) kMatchChoiceRepetitionIndex) (UINT32) kMatchChoiceRepetitionIndex)
{ {
if(m_MatchRepChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0) if(m_MatchRepChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0)
@@ -190,7 +190,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream,
aRepDistances[1] = aRepDistances[0]; aRepDistances[1] = aRepDistances[0];
// aCounts[3 + 1]++; // aCounts[3 + 1]++;
} }
else else
{ {
if (m_MatchRep2ChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0) if (m_MatchRep2ChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0)
{ {
@@ -225,7 +225,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream,
aDistance += m_PosDecoders[aPosSlot - kStartPosModelIndex].Decode(&m_RangeDecoder); aDistance += m_PosDecoders[aPosSlot - kStartPosModelIndex].Decode(&m_RangeDecoder);
else else
{ {
aDistance += (m_RangeDecoder.DecodeDirectBits(kDistDirectBits[aPosSlot] - aDistance += (m_RangeDecoder.DecodeDirectBits(kDistDirectBits[aPosSlot] -
kNumAlignBits) << kNumAlignBits); kNumAlignBits) << kNumAlignBits);
aDistance += m_PosAlignDecoder.Decode(&m_RangeDecoder); aDistance += m_PosAlignDecoder.Decode(&m_RangeDecoder);
} }
@@ -233,11 +233,11 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream,
else else
aDistance = aPosSlot; aDistance = aPosSlot;
aRepDistances[3] = aRepDistances[2]; aRepDistances[3] = aRepDistances[2];
aRepDistances[2] = aRepDistances[1]; aRepDistances[2] = aRepDistances[1];
aRepDistances[1] = aRepDistances[0]; aRepDistances[1] = aRepDistances[0];
aRepDistances[0] = aDistance; aRepDistances[0] = aDistance;
// UpdateStat(aLen, aPosSlot); // UpdateStat(aLen, aPosSlot);
} }
@@ -285,7 +285,7 @@ HRESULT CDecoder::ReadCoderProperties(ISequentialInStream *anInStream)
UINT8 uint_buffer[UINT_SIZE]; UINT8 uint_buffer[UINT_SIZE];
RETURN_IF_NOT_S_OK(anInStream->Read(uint_buffer, sizeof(aDictionarySize), &aProcessesedSize)); RETURN_IF_NOT_S_OK(anInStream->Read(uint_buffer, sizeof(aDictionarySize), &aProcessesedSize));
aDictionarySize = charp_to_uint(uint_buffer); aDictionarySize = charp_to_uint(uint_buffer);
if (aProcessesedSize != sizeof(aDictionarySize)) if (aProcessesedSize != sizeof(aDictionarySize))
return E_INVALIDARG; return E_INVALIDARG;

View File

@@ -48,14 +48,14 @@ class CDecoder
CReverseBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder; CReverseBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;
// CBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels]; // CBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels];
// CBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder; // CBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;
NLength::CDecoder m_LenDecoder; NLength::CDecoder m_LenDecoder;
NLength::CDecoder m_RepMatchLenDecoder; NLength::CDecoder m_RepMatchLenDecoder;
NLiteral::CDecoder m_LiteralDecoder; NLiteral::CDecoder m_LiteralDecoder;
UINT32 m_DictionarySize; UINT32 m_DictionarySize;
UINT32 m_PosStateMask; UINT32 m_PosStateMask;
HRESULT Create(); HRESULT Create();
@@ -69,7 +69,7 @@ class CDecoder
public: public:
CDecoder(); CDecoder();
HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize); HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize);
HRESULT ReadCoderProperties(ISequentialInStream *anInStream); HRESULT ReadCoderProperties(ISequentialInStream *anInStream);

View File

@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define RC_INIT_VAR \ #define RC_INIT_VAR \
UINT32 aRange = aRangeDecoder->m_Range; \ UINT32 aRange = aRangeDecoder->m_Range; \
UINT32 aCode = aRangeDecoder->m_Code; UINT32 aCode = aRangeDecoder->m_Code;
#define RC_FLUSH_VAR \ #define RC_FLUSH_VAR \
aRangeDecoder->m_Range = aRange; \ aRangeDecoder->m_Range = aRange; \
@@ -56,6 +56,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}} \ }} \
RC_NORMALIZE RC_NORMALIZE
#define RC_GETBIT(aNumMoveBits, aProb, aModelIndex) RC_GETBIT2(aNumMoveBits, aProb, aModelIndex, ; , ;) #define RC_GETBIT(aNumMoveBits, aProb, aModelIndex) RC_GETBIT2(aNumMoveBits, aProb, aModelIndex, ; , ;)
#endif #endif

View File

@@ -43,7 +43,7 @@ public:
m_Range <<= 8; m_Range <<= 8;
} }
} }
void Init(ISequentialInStream *aStream) void Init(ISequentialInStream *aStream)
{ {
m_Stream.Init(aStream); m_Stream.Init(aStream);
@@ -71,7 +71,7 @@ public:
m_Range >>= aNumTotalBits; m_Range >>= aNumTotalBits;
UINT32 aThreshold = m_Code / m_Range; UINT32 aThreshold = m_Code / m_Range;
m_Code -= aThreshold * m_Range; m_Code -= aThreshold * m_Range;
Normalize(); Normalize();
return aThreshold; return aThreshold;
} }
@@ -88,7 +88,7 @@ public:
UINT32 DecodeDirectBits(UINT32 aNumTotalBits) UINT32 DecodeDirectBits(UINT32 aNumTotalBits)
{ {
UINT32 aRange = m_Range; UINT32 aRange = m_Range;
UINT32 aCode = m_Code; UINT32 aCode = m_Code;
UINT32 aResult = 0; UINT32 aResult = 0;
for (UINT32 i = aNumTotalBits; i > 0; i--) for (UINT32 i = aNumTotalBits; i > 0; i--)
{ {
@@ -109,7 +109,7 @@ public:
if (aRange < kTopValue) if (aRange < kTopValue)
{ {
aCode = (aCode << 8) | m_Stream.ReadByte(); aCode = (aCode << 8) | m_Stream.ReadByte();
aRange <<= 8; aRange <<= 8;
} }
} }
m_Range = aRange; m_Range = aRange;

View File

@@ -27,7 +27,7 @@ namespace NWindow {
// m_KeepSizeBefore: how mach BYTEs must be in buffer before m_Pos; // m_KeepSizeBefore: how mach BYTEs must be in buffer before m_Pos;
// m_KeepSizeAfter: how mach BYTEs must be in buffer after m_Pos; // m_KeepSizeAfter: how mach BYTEs must be in buffer after m_Pos;
// m_KeepSizeReserv: how mach BYTEs must be in buffer for Moving Reserv; // m_KeepSizeReserv: how mach BYTEs must be in buffer for Moving Reserv;
// must be >= aKeepSizeAfter; // test it // must be >= aKeepSizeAfter; // test it
class COut class COut
@@ -55,14 +55,14 @@ public:
void Init(ISequentialOutStream *aStream, bool aSolid = false); void Init(ISequentialOutStream *aStream, bool aSolid = false);
HRESULT Flush(); HRESULT Flush();
UINT32 GetCurPos() const { return m_Pos; } UINT32 GetCurPos() const { return m_Pos; }
const BYTE *GetPointerToCurrentPos() const { return m_Buffer + m_Pos;}; const BYTE *GetPointerToCurrentPos() const { return m_Buffer + m_Pos;};
void CopyBackBlock(UINT32 aDistance, UINT32 aLen) void CopyBackBlock(UINT32 aDistance, UINT32 aLen)
{ {
if (m_Pos >= m_PosLimit) if (m_Pos >= m_PosLimit)
MoveBlockBackward(); MoveBlockBackward();
BYTE *p = m_Buffer + m_Pos; BYTE *p = m_Buffer + m_Pos;
aDistance++; aDistance++;
for(UINT32 i = 0; i < aLen; i++) for(UINT32 i = 0; i < aLen; i++)
@@ -73,7 +73,7 @@ public:
void PutOneByte(BYTE aByte) void PutOneByte(BYTE aByte)
{ {
if (m_Pos >= m_PosLimit) if (m_Pos >= m_PosLimit)
MoveBlockBackward(); MoveBlockBackward();
m_Buffer[m_Pos++] = aByte; m_Buffer[m_Pos++] = aByte;
} }

View File

@@ -1,66 +1,66 @@
/* /*
Copyright (C) 2004 NSRT Team ( http://nsrt.edgeemu.com ) Copyright (C) 2004 NSRT Team ( http://nsrt.edgeemu.com )
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 as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version 2 of the License, or (at your option) any later
version. 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. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. 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., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <vector> #include <vector>
using namespace std; using namespace std;
#include "zsnesjma.h" #include "zsnesjma.h"
#include "jma.h" #include "jma.h"
extern "C" { extern "C" {
extern unsigned char *romdata; extern unsigned char *romdata;
extern unsigned int curromspace; extern unsigned int curromspace;
extern unsigned int maxromspace; extern unsigned int maxromspace;
} }
void load_jma_file(const char *filename) void load_jma_file(const char *filename)
{ {
try try
{ {
JMA::jma_open JMAFile(filename); JMA::jma_open JMAFile(filename);
vector<JMA::jma_public_file_info> file_info = JMAFile.get_files_info(); vector<JMA::jma_public_file_info> file_info = JMAFile.get_files_info();
string our_file_name; string our_file_name;
size_t our_file_size = 0; size_t our_file_size = 0;
for (vector<JMA::jma_public_file_info>::iterator i = file_info.begin(); i != file_info.end(); i++) for (vector<JMA::jma_public_file_info>::iterator i = file_info.begin(); i != file_info.end(); i++)
{ {
//Check for valid ROM based on size //Check for valid ROM based on size
if ((i->size <= maxromspace+512) && (i->size > our_file_size)) if ((i->size <= maxromspace+512) && (i->size > our_file_size))
{ {
our_file_name = i->name; our_file_name = i->name;
our_file_size = i->size; our_file_size = i->size;
} }
} }
if (!our_file_size) if (!our_file_size)
{ {
return; return;
} }
JMAFile.extract_file(our_file_name, romdata); JMAFile.extract_file(our_file_name, romdata);
curromspace = our_file_size; curromspace = our_file_size;
} }
catch (JMA::jma_errors jma_error) catch (JMA::jma_errors jma_error)
{ {
//No need to do anything //No need to do anything
} }
} }

View File

@@ -960,7 +960,7 @@ void UpdateSound(void *userdata, Uint8 * stream, int len)
{ {
return; return;
} }
if (left <= len) if (left <= len)
{ {
memcpy(stream, &Buffer[Buffer_head], left); memcpy(stream, &Buffer[Buffer_head], left);
@@ -970,7 +970,7 @@ void UpdateSound(void *userdata, Uint8 * stream, int len)
Buffer_fill -= left; Buffer_fill -= left;
} }
if (len) if (len)
{ {
memcpy(stream, &Buffer[Buffer_head], len); memcpy(stream, &Buffer[Buffer_head], len);
Buffer_head += len; Buffer_head += len;
@@ -1262,28 +1262,28 @@ void spc_sanitize_files() {
pid_t spc_fork() { pid_t spc_fork() {
pid_t childpid; pid_t childpid;
if ((childpid = fork()) == -1) return -1; if ((childpid = fork()) == -1) return -1;
//If this us the parent proccess nothing more to do //If this us the parent proccess nothing more to do
if (childpid != 0) return childpid; if (childpid != 0) return childpid;
//This is the child proccess //This is the child proccess
spc_sanitize_files(); spc_sanitize_files();
/* /*
There actually is a bug here which I submitted to the authors of the book -Nach There actually is a bug here which I submitted to the authors of the book -Nach
The bug is as follows: The bug is as follows:
The parent returns the child proccess ID in event of success. The parent returns the child proccess ID in event of success.
The child returns 0 on success if and only if it's spc_drop_privileges() call is successful. The child returns 0 on success if and only if it's spc_drop_privileges() call is successful.
It is possible that the parent will return with a pid > 0, while the child never returns It is possible that the parent will return with a pid > 0, while the child never returns
from spc_fork thus causing a programming error. from spc_fork thus causing a programming error.
The function should be rewritten that the parent doesn't return till it knows if the The function should be rewritten that the parent doesn't return till it knows if the
child is able to return or not. And then return -1 or the child pid. child is able to return or not. And then return -1 or the child pid.
For out purposes in ZSNES to launch a browser, this bug does not effect us. But For out purposes in ZSNES to launch a browser, this bug does not effect us. But
be careful if you copy this code to use somewhere else. be careful if you copy this code to use somewhere else.
*/ */
@@ -1291,7 +1291,7 @@ pid_t spc_fork() {
{ {
exit(0); exit(0);
} }
return 0; return 0;
} }
@@ -1304,21 +1304,21 @@ void LaunchBrowser(char *browser)
void ZsnesPage() void ZsnesPage()
{ {
if (spc_fork()) //If fork failed, or we are the parent if (spc_fork()) //If fork failed, or we are the parent
{ {
MouseX = 0; MouseX = 0;
MouseY = 0; MouseY = 0;
return; return;
} }
//We are now the child proccess //We are now the child proccess
//If any of these LaunchBrowser() calls return that means it failed and we should try the next one //If any of these LaunchBrowser() calls return that means it failed and we should try the next one
LaunchBrowser("mozilla"); LaunchBrowser("mozilla");
LaunchBrowser("mozilla-firefox"); LaunchBrowser("mozilla-firefox");
LaunchBrowser("konqueror"); LaunchBrowser("konqueror");
LaunchBrowser("lynx"); LaunchBrowser("lynx");
LaunchBrowser("links"); LaunchBrowser("links");
exit(0); //All browser launches failed, oh well exit(0); //All browser launches failed, oh well
} }

View File

@@ -48,17 +48,17 @@ BOOL sw_start(int width, int height, int req_depth, int FullScreen)
//int i; //int i;
Uint32 flags = SDL_DOUBLEBUF | SDL_SWSURFACE; Uint32 flags = SDL_DOUBLEBUF | SDL_SWSURFACE;
DWORD GBitMask; DWORD GBitMask;
flags |= (FullScreen ? SDL_FULLSCREEN : 0); flags |= (FullScreen ? SDL_FULLSCREEN : 0);
SurfaceX = width; SurfaceY = height; SurfaceX = width; SurfaceY = height;
surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags); surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags);
if (surface == NULL) { if (surface == NULL) {
fprintf (stderr, "Could not set %dx%d video mode: %s\n", SurfaceX, SurfaceY, SDL_GetError ()); fprintf (stderr, "Could not set %dx%d video mode: %s\n", SurfaceX, SurfaceY, SDL_GetError ());
return FALSE; return FALSE;
} }
SurfaceLocking = SDL_MUSTLOCK(surface); SurfaceLocking = SDL_MUSTLOCK(surface);
SDL_WarpMouse(SurfaceX/4,SurfaceY/4); SDL_WarpMouse(SurfaceX/4,SurfaceY/4);
@@ -173,7 +173,7 @@ void sw_drawwin()
break; break;
default: default:
break; break;
} }
} else { } else {
copy640x480x16bwin(); copy640x480x16bwin();
} }
@@ -195,7 +195,7 @@ void sw_drawwin()
break; break;
default: default:
break; break;
} }
} else { } else {
copy640x480x16bwin(); copy640x480x16bwin();
} }

View File

@@ -127,7 +127,7 @@ DWORD ZOpenFile()
{ {
if(ZOpenMode==0) if(ZOpenMode==0)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
@@ -140,11 +140,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==1) if(ZOpenMode==1)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -153,11 +153,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==2) if(ZOpenMode==2)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
else else
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -184,7 +184,7 @@ DWORD ZFileSeek()
mode = SEEK_SET; mode = SEEK_SET;
else if (ZFileSeekMode==1) { else if (ZFileSeekMode==1) {
mode = SEEK_END; mode = SEEK_END;
if (TextFile==0) if (TextFile==0)
printf("Warning : gzseek(SEEK_END) not supported"); printf("Warning : gzseek(SEEK_END) not supported");
} else return (0xFFFFFFFF); } else return (0xFFFFFFFF);
@@ -206,8 +206,8 @@ DWORD ZFileRead()
ZFileReadSize, ZFileReadSize,
FILEHANDLE[ZFileReadHandle])); FILEHANDLE[ZFileReadHandle]));
else else
return(gzread(FILEHANDLE[ZFileReadHandle], return(gzread(FILEHANDLE[ZFileReadHandle],
ZFileReadBlock, ZFileReadBlock,
ZFileReadSize)); ZFileReadSize));
} }
@@ -221,11 +221,11 @@ DWORD ZFileWrite()
ZFileWriteSize, ZFileWriteSize,
FILEHANDLE[ZFileWriteHandle]); FILEHANDLE[ZFileWriteHandle]);
else else
res = gzwrite(FILEHANDLE[ZFileWriteHandle], res = gzwrite(FILEHANDLE[ZFileWriteHandle],
ZFileWriteBlock, ZFileWriteBlock,
ZFileWriteSize); ZFileWriteSize);
if (res!=ZFileWriteSize) if (res!=ZFileWriteSize)
return(0xFFFFFFFF); return(0xFFFFFFFF);
return(0); return(0);
@@ -262,7 +262,7 @@ DWORD ZFileMKDir()
{ {
#ifdef __LINUX__ #ifdef __LINUX__
return(mkdir(MKPath, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))); return(mkdir(MKPath, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
#else #else
return(mkdir(MKPath)); return(mkdir(MKPath));
#endif #endif
} }
@@ -315,30 +315,30 @@ DWORD ZFileFindNext()
if (globcur == -1) if (globcur == -1)
return -1; return -1;
globcur++; globcur++;
if (globcur > globbuf.gl_pathc) /* >= */ if (globcur > globbuf.gl_pathc) /* >= */
return -1; return -1;
if (globcur == globbuf.gl_pathc) { if (globcur == globbuf.gl_pathc) {
/* this is the end, so just add it ourselves */ /* this is the end, so just add it ourselves */
*(char *)(DTALocPos + 0x15) = 0x10; *(char *)(DTALocPos + 0x15) = 0x10;
strcpy((char *)DTALocPos + 0x1E, ".."); strcpy((char *)DTALocPos + 0x1E, "..");
return 0; return 0;
} }
*(char *)(DTALocPos + 0x15) = 0; *(char *)(DTALocPos + 0x15) = 0;
stat ( globbuf.gl_pathv[globcur], &filetype ); stat ( globbuf.gl_pathv[globcur], &filetype );
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if ( S_ISDIR ( filetype.st_mode )) if ( S_ISDIR ( filetype.st_mode ))
*(char *)(DTALocPos + 0x15) = 0x10; *(char *)(DTALocPos + 0x15) = 0x10;
strcpy((char *)DTALocPos + 0x1E, globbuf.gl_pathv[globcur]); strcpy((char *)DTALocPos + 0x1E, globbuf.gl_pathv[globcur]);
#else #else
TempFind=_findnext(FindFirstHandle,&FindDataStruct); TempFind=_findnext(FindFirstHandle,&FindDataStruct);
if(TempFind==-1) return(-1); if(TempFind==-1) return(-1);
@@ -365,7 +365,7 @@ DWORD ZFileFindFirst()
globfree(&globbuf); globfree(&globbuf);
globcur = -1; globcur = -1;
} }
if (glob(ZFileFindPATH, 0, NULL, &globbuf)) if (glob(ZFileFindPATH, 0, NULL, &globbuf))
return -1; return -1;
globcur = 0; globcur = 0;
@@ -378,10 +378,10 @@ DWORD ZFileFindFirst()
#endif #endif
stat ( globbuf.gl_pathv[globcur], &filetype ); stat ( globbuf.gl_pathv[globcur], &filetype );
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if ( S_ISDIR ( filetype.st_mode )) if ( S_ISDIR ( filetype.st_mode ))
*(char *)(DTALocPos + 0x15) = 0x10; *(char *)(DTALocPos + 0x15) = 0x10;
@@ -482,12 +482,12 @@ void obtaindir()
} }
strcat(zcfgdir, ZCFG_DIR); strcat(zcfgdir, ZCFG_DIR);
tmp = opendir(zcfgdir); tmp = opendir(zcfgdir);
if (tmp == NULL) if (tmp == NULL)
{ {
MKPath = zcfgdir; MKPath = zcfgdir;
ZFileMKDir(); ZFileMKDir();
} }
else else
{ {
closedir(tmp); closedir(tmp);
} }
@@ -495,7 +495,7 @@ void obtaindir()
{ {
strcpy(SRAMDir, zcfgdir); strcpy(SRAMDir, zcfgdir);
} }
if (*LoadDir == 0) if (*LoadDir == 0)
{ {
getcwd(LoadDir, 512); getcwd(LoadDir, 512);
} }
@@ -515,7 +515,7 @@ void GetFilename()
strcpy(&fnamest, tmp); strcpy(&fnamest, tmp);
fnamest = size; fnamest = size;
statefileloc-=(tmp-&fnamest); statefileloc-=(tmp-&fnamest);
tmp = &fnames; tmp = &fnames;
*tmp = '/'; *tmp = '/';
while (*tmp!=0) tmp++; while (*tmp!=0) tmp++;
@@ -532,7 +532,7 @@ void pushdir()
{ {
olddir = (char *)malloc(128); olddir = (char *)malloc(128);
getcwd(olddir, 128); getcwd(olddir, 128);
} }
void popdir() void popdir()
{ {

View File

@@ -76,14 +76,14 @@ section .text
; macro more or less similar to STUB_FUNCTION ; macro more or less similar to STUB_FUNCTION
; you can call it without argument, ; you can call it without argument,
; or with a string arg which will be displayed ; or with a string arg which will be displayed
%macro STUB_ASM 0-1 "STUB_ASM" %macro STUB_ASM 0-1 "STUB_ASM"
%ifndef __PRINTF__ %ifndef __PRINTF__
%define __PRINTF__ %define __PRINTF__
EXTSYM printf EXTSYM printf
%endif %endif
[section .data] [section .data]
%%string: db %1, 0 %%string: db %1, 0
%%strformat: db '%s in %s line %u',13, 10,0 %%strformat: db '%s in %s line %u',13, 10,0
%%filename: db __FILE__, 0 %%filename: db __FILE__, 0
@@ -111,7 +111,7 @@ popad
%define __PRINTF__ %define __PRINTF__
EXTSYM printf EXTSYM printf
%endif %endif
[section .data] [section .data]
%%strformat: db '%s in %s line %u',13, 10,0 %%strformat: db '%s in %s line %u',13, 10,0
%%filename: db __FILE__, 0 %%filename: db __FILE__, 0
__SECT__ __SECT__
@@ -126,7 +126,7 @@ push eax
mov eax, %%strformat mov eax, %%strformat
push eax push eax
call printf call printf
add esp, 16 add esp, 16
popad popad
%endmacro %endmacro
@@ -136,7 +136,7 @@ popad
%define __PRINTF__ %define __PRINTF__
EXTSYM printf EXTSYM printf
%endif %endif
[section .data] [section .data]
%%strformat: db '%x in %s line %u',13, 10,0 %%strformat: db '%x in %s line %u',13, 10,0
%%filename: db __FILE__, 0 %%filename: db __FILE__, 0
__SECT__ __SECT__

View File

@@ -50,7 +50,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// that packet will be re-sent and reset the timer value back to 60. // that packet will be re-sent and reset the timer value back to 60.
// If the local side receives the reply packet, it will set the timer // If the local side receives the reply packet, it will set the timer
// counter to -1. // counter to -1.
// //
// Gameplay Packets: // Gameplay Packets:
// Note: Gameplay counter is separate from normal packet counter. // Note: Gameplay counter is separate from normal packet counter.
// Note2: When referring to TCP/IP, it refers to the Normal Packets above. // Note2: When referring to TCP/IP, it refers to the Normal Packets above.
@@ -264,7 +264,7 @@ void GetUDPStatus() {
int isipval(char *name){ int isipval(char *name){
int i=0; int i=0;
while(name[i]!=0){ while(name[i]!=0){
if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9')))) if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9'))))
return(0); return(0);
@@ -388,7 +388,7 @@ int ConnectServer(char *servername, unsigned int port)
// MessageBox(NULL,blah, // MessageBox(NULL,blah,
// "Error", // "Error",
// MB_SYSTEMMODAL|MB_OK); // MB_SYSTEMMODAL|MB_OK);
return(0); return(0);
// retval = send(gamesocket,blah,1,0); // retval = send(gamesocket,blah,1,0);
@@ -653,7 +653,7 @@ int ServerCheckNewClient()
return(1); return(1);
} }
return(0); return(0);
} }
if(serversocket == INVALID_SOCKET) if(serversocket == INVALID_SOCKET)
{ {
@@ -1056,7 +1056,7 @@ char SendBufferSize[256];*/
return(-1); return(-1);
} }
} }
return(0); return(0);
} }
/* send data with the socket */ /* send data with the socket */
@@ -1146,7 +1146,7 @@ int GetData(int dsize,unsigned char *dptr)
retval = packetreceivesize[i]; retval = packetreceivesize[i];
packetreceived[(i+128) & 0xFF]=0; packetreceived[(i+128) & 0xFF]=0;
packetrecvhead=(packetrecvhead+1) & 0xFF; packetrecvhead=(packetrecvhead+1) & 0xFF;
return(retval); return(retval);
} }
i=RecvPtr; i=RecvPtr;

View File

@@ -1,129 +1,129 @@
/* /*
Copyright (c) 1998-2005 Charles Bilyue'. Copyright (c) 1998-2005 Charles Bilyue'.
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 as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version 2 of the License, or (at your option) any later
version. 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. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. 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., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
int open_error(const char *filename, const char *mode) int open_error(const char *filename, const char *mode)
{ {
printf("Failure opening %s for %s\n"); printf("Failure opening %s for %s\n");
return 1; return 1;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int c; int c;
int section_count; int section_count;
FILE *in, *out; FILE *in, *out;
unsigned char section_header[40]; unsigned char section_header[40];
if (argc < 2 || argc > 3) if (argc < 2 || argc > 3)
{ {
printf("Fixes MS Win32 object files to be compatible with the incorrect\n"); printf("Fixes MS Win32 object files to be compatible with the incorrect\n");
printf(" implementation in MinGW32.\n"); printf(" implementation in MinGW32.\n");
printf("Usage: objfix infile [outfile]\n"); printf("Usage: objfix infile [outfile]\n");
return 1; return 1;
} }
in = fopen(argv[1], (argc == 2 ? "rb+" : "rb")); in = fopen(argv[1], (argc == 2 ? "rb+" : "rb"));
if (!in) return open_error(argv[1], (argc == 2 ? "read" : "update")); if (!in) return open_error(argv[1], (argc == 2 ? "read" : "update"));
if (argc == 3) if (argc == 3)
{ {
out = fopen(argv[2], "wb"); out = fopen(argv[2], "wb");
if (!out) return open_error(argv[1], (argc == 2 ? "read" : "update")); if (!out) return open_error(argv[1], (argc == 2 ? "read" : "update"));
} }
else else
{ {
out = NULL; out = NULL;
} }
if (out) if (out)
{ {
fputc(fgetc(in), out); fputc(fgetc(in), out);
fputc(fgetc(in), out); fputc(fgetc(in), out);
fputc(section_count = fgetc(in), out); fputc(section_count = fgetc(in), out);
fputc(c = fgetc(in), out); fputc(c = fgetc(in), out);
section_count += c << 8; section_count += c << 8;
for (c = 4; c < 0x14; c++) for (c = 4; c < 0x14; c++)
{ {
fputc(fgetc(in), out); fputc(fgetc(in), out);
} }
for (c = 0; c < section_count; c++) for (c = 0; c < section_count; c++)
{ {
fread(section_header, 1, 40, in); fread(section_header, 1, 40, in);
if (!strncmp(section_header, ".bss", 8)) if (!strncmp(section_header, ".bss", 8))
{ {
memcpy(section_header + 8, section_header + 16, 4); memcpy(section_header + 8, section_header + 16, 4);
memset(section_header + 16, 0, 4); memset(section_header + 16, 0, 4);
} }
else else
{ {
memset(section_header + 8, 0, 4); memset(section_header + 8, 0, 4);
} }
fwrite(section_header, 1, 40, out); fwrite(section_header, 1, 40, out);
} }
while ((c = fgetc(in)) != EOF) while ((c = fgetc(in)) != EOF)
{ {
fputc(c, out); fputc(c, out);
} }
} }
else else
{ {
fgetc(in); fgetc(in);
fgetc(in); fgetc(in);
section_count = fgetc(in); section_count = fgetc(in);
section_count += fgetc(in) << 8; section_count += fgetc(in) << 8;
fseek(in, 0x14, SEEK_SET); fseek(in, 0x14, SEEK_SET);
for (c = 0; c < section_count; c++) for (c = 0; c < section_count; c++)
{ {
fread(section_header, 1, 40, in); fread(section_header, 1, 40, in);
fseek(in, -40, SEEK_CUR); fseek(in, -40, SEEK_CUR);
if (!strncmp(section_header, ".bss", 8)) if (!strncmp(section_header, ".bss", 8))
{ {
memcpy(section_header + 8, section_header + 16, 4); memcpy(section_header + 8, section_header + 16, 4);
memset(section_header + 16, 0, 4); memset(section_header + 16, 0, 4);
} }
else else
{ {
memset(section_header + 8, 0, 4); memset(section_header + 8, 0, 4);
} }
fwrite(section_header, 1, 40, in); fwrite(section_header, 1, 40, in);
fseek(in, 0, SEEK_CUR); fseek(in, 0, SEEK_CUR);
} }
} }
fclose(in); fclose(in);
if (out) fclose(out); if (out) fclose(out);
return 0; return 0;
} }

View File

@@ -106,7 +106,7 @@ char *find_next_match(char *str, char match_char)
if (str[1]) if (str[1])
{ {
str++; str++;
} }
else else
{ {
break; break;
@@ -115,8 +115,8 @@ char *find_next_match(char *str, char match_char)
str++; str++;
} }
return(pos); return(pos);
} }
//This is like strtok(), except this understands quoted characters and updates error locations //This is like strtok(), except this understands quoted characters and updates error locations
char *get_token(char *str, char *delim) char *get_token(char *str, char *delim)
{ {
@@ -127,14 +127,14 @@ char *get_token(char *str, char *delim)
{ {
pos = str; pos = str;
} }
if (pos) if (pos)
{ {
//Skip delimiters //Skip delimiters
while (*pos && strchr(delim, *pos)) while (*pos && strchr(delim, *pos))
{ {
pos++; pos++;
} }
if (*pos) if (*pos)
{ {
token = pos; token = pos;
@@ -152,7 +152,7 @@ char *get_token(char *str, char *delim)
} }
} }
pos++; pos++;
} }
if (*pos) if (*pos)
{ {
*pos++ = '\0'; *pos++ = '\0';
@@ -187,7 +187,7 @@ char *find_chr(char *str, char match_char)
} }
str++; str++;
} }
return(pos); return(pos);
} }
@@ -204,7 +204,7 @@ string hex_convert(string str)
{ {
str.erase(0, 1); str.erase(0, 1);
} }
size_t h_pos; size_t h_pos;
while ((h_pos = str.find_first_of("hH")) != string::npos) while ((h_pos = str.find_first_of("hH")) != string::npos)
{ {
@@ -230,7 +230,7 @@ ssize_t enhanced_atoi(const char *str)
{ {
cerr << "Error: Can not get accurate value information (eatio.res)." << endl; cerr << "Error: Can not get accurate value information (eatio.res)." << endl;
} }
//Biggest cheat of all time //Biggest cheat of all time
ofstream out_stream("eatio.c"); ofstream out_stream("eatio.c");
if (out_stream) if (out_stream)
@@ -248,12 +248,12 @@ ssize_t enhanced_atoi(const char *str)
<< "}\n\n"; << "}\n\n";
out_stream.close(); out_stream.close();
#ifdef MSC_VER #ifdef MSC_VER
system("cl /Foeatio.exe eatio.c"); system("cl /Foeatio.exe eatio.c");
#else #else
system("gcc -o eatio.exe eatio.c -s"); system("gcc -o eatio.exe eatio.c -s");
#endif #endif
system("."SLASH_STR"eatio.exe"); system("."SLASH_STR"eatio.exe");
remove("eatio.c"); remove("eatio.c");
@@ -269,10 +269,10 @@ ssize_t enhanced_atoi(const char *str)
{ {
cerr << "Error: Can not get accurate value information (eatio.res)." << endl; cerr << "Error: Can not get accurate value information (eatio.res)." << endl;
} }
remove("eatio.res"); remove("eatio.res");
} }
return(num); return(num);
} }
@@ -317,7 +317,7 @@ char *get_comment()
} }
void output_comment(ostream& c_stream, const char *comment) void output_comment(ostream& c_stream, const char *comment)
{ {
if (comment) if (comment)
{ {
c_stream << " //" << comment; c_stream << " //" << comment;
@@ -328,7 +328,7 @@ void output_comment(ostream& c_stream, const char *comment)
bool all_spaces(const char *str) bool all_spaces(const char *str)
{ {
while (*str) while (*str)
{ {
if (!isspace(*str)) { return(false); } if (!isspace(*str)) { return(false); }
str++; str++;
} }
@@ -360,7 +360,7 @@ char *convert_asm_type(const char *str, bool unsigned_var = true)
{ {
var_type += strlen("unsigned "); var_type += strlen("unsigned ");
} }
return(var_type); return(var_type);
} }
@@ -379,7 +379,7 @@ void output_parser_start(ostream& c_stream)
<< "#define LINE_LENGTH " << LINE_LENGTH << "\n" << "#define LINE_LENGTH " << LINE_LENGTH << "\n"
<< "static char line[LINE_LENGTH];\n" << "static char line[LINE_LENGTH];\n"
<< "\n" << "\n"
<< "\n" << "\n"
<< "static char *encode_string(const char *str)\n" << "static char *encode_string(const char *str)\n"
<< "{\n" << "{\n"
<< " size_t i = 0;\n" << " size_t i = 0;\n"
@@ -515,7 +515,7 @@ void output_write_var(ostream& c_stream)
output_array_write(c_stream, "char"); output_array_write(c_stream, "char");
output_array_write(c_stream, "short"); output_array_write(c_stream, "short");
output_array_write(c_stream, "int"); output_array_write(c_stream, "int");
c_stream << "\n" c_stream << "\n"
<< "unsigned char write_cfg_vars(const char *file)\n" << "unsigned char write_cfg_vars(const char *file)\n"
<< "{\n" << "{\n"
@@ -533,7 +533,7 @@ void output_write_var(ostream& c_stream)
<< "_array(fp, \"" << i->name << "\", " << i->name << ", " << i->size << ");\n"; << "_array(fp, \"" << i->name << "\", " << i->name << ", " << i->size << ");\n";
} }
else else
{ {
c_stream << " fprintf(fp, \"" << i->name << "="; c_stream << " fprintf(fp, \"" << i->name << "=";
if (i->type == single_value) if (i->type == single_value)
{ {
@@ -702,7 +702,7 @@ void handle_directive(char *instruction, char *label)
else if (!strcasecmp(instruction, "elifdef") || !strcasecmp(instruction, "elseifdef")) else if (!strcasecmp(instruction, "elifdef") || !strcasecmp(instruction, "elseifdef"))
{ {
if (label) if (label)
{ {
if (ifs.top()) if (ifs.top())
{ {
ifs.pop(); ifs.pop();
@@ -711,14 +711,14 @@ void handle_directive(char *instruction, char *label)
else if (defines.find(label) != defines.end()) else if (defines.find(label) != defines.end())
{ {
ifs.pop(); ifs.pop();
ifs.push(true); ifs.push(true);
} }
} }
else else
{ {
show_error_loc("Could not get elseifdef label"); show_error_loc("Could not get elseifdef label");
} }
} }
else if (!strcasecmp(instruction, "endif")) else if (!strcasecmp(instruction, "endif"))
{ {
@@ -737,7 +737,7 @@ void handle_directive(char *instruction, char *label)
ifs.pop(); ifs.pop();
} }
} }
} }
else else
{ {
show_error_loc("Unknown processor directive"); show_error_loc("Unknown processor directive");
@@ -745,14 +745,14 @@ void handle_directive(char *instruction, char *label)
} }
void parser_generate(istream& psr_stream, ostream& c_stream) void parser_generate(istream& psr_stream, ostream& c_stream)
{ {
output_parser_start(c_stream); output_parser_start(c_stream);
while (!psr_stream.eof()) while (!psr_stream.eof())
{ {
char *token; char *token;
char *comment; char *comment;
psr_stream.getline(line, LINE_LENGTH); psr_stream.getline(line, LINE_LENGTH);
current_line_number++; current_line_number++;
@@ -763,7 +763,7 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
output_comment(c_stream, comment); output_comment(c_stream, comment);
continue; continue;
} }
if ((token = get_token(line, " ")) && if ((token = get_token(line, " ")) &&
(strcasecmp(token, "NEWSYM") || (token = get_token(0, " ,")))) (strcasecmp(token, "NEWSYM") || (token = get_token(0, " ,"))))
{ {
@@ -777,7 +777,7 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
{ {
continue; continue;
} }
string varname = token; string varname = token;
if ((token = get_token(0, " ,"))) if ((token = get_token(0, " ,")))
@@ -788,23 +788,23 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
{ {
char *asm_type = token; char *asm_type = token;
char *var_type = convert_asm_type(asm_type); char *var_type = convert_asm_type(asm_type);
if (var_type) if (var_type)
{ {
string initial_value = get_token(0, " ,\n"); string initial_value = get_token(0, " ,\n");
if (((initial_value[0] == '\"') && (initial_value[initial_value.length()-1] == '\"')) || if (((initial_value[0] == '\"') && (initial_value[initial_value.length()-1] == '\"')) ||
((initial_value[0] == '\'') && (initial_value[initial_value.length()-1] == '\''))) ((initial_value[0] == '\'') && (initial_value[initial_value.length()-1] == '\'')))
{ {
//Make sure it's double quoted //Make sure it's double quoted
initial_value[0] = '\"'; initial_value[0] = '\"';
initial_value[initial_value.length()-1] = '\"'; initial_value[initial_value.length()-1] = '\"';
if (!array) if (!array)
{ {
array = initial_value.length()-1; //Size minus quotes plus null array = initial_value.length()-1; //Size minus quotes plus null
} }
c_stream << "char " << varname << "[" << array << "];"; c_stream << "char " << varname << "[" << array << "];";
ostringstream memset_line; ostringstream memset_line;
@@ -819,13 +819,13 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
<< varname << "[" << array << "] = 0;"; << varname << "[" << array << "] = 0;";
} }
memsets.push_back(memset_line.str()); memsets.push_back(memset_line.str());
add_config_var(varname, asm_type, quoted_value, 0); add_config_var(varname, asm_type, quoted_value, 0);
} }
else else
{ {
ssize_t init_value_num = safe_atoi(initial_value); ssize_t init_value_num = safe_atoi(initial_value);
if (init_value_num < 0) if (init_value_num < 0)
{ {
var_type += strlen("unsigned "); var_type += strlen("unsigned ");
@@ -840,7 +840,7 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
ostringstream memset_line; ostringstream memset_line;
memset_line << "memset(" << varname << ", " << init_value_num << ", " << array; memset_line << "memset(" << varname << ", " << init_value_num << ", " << array;
if (var_type_is_short(var_type)) if (var_type_is_short(var_type))
{ {
memset_line << short_scale; memset_line << short_scale;
@@ -891,11 +891,11 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
} }
} }
//Else already handled //Else already handled
} }
else else
{ {
show_error_loc("Could not get array size"); show_error_loc("Could not get array size");
} }
} }
else else
{ {
@@ -906,14 +906,14 @@ void parser_generate(istream& psr_stream, ostream& c_stream)
{ {
show_error_loc("Could not get variable name"); show_error_loc("Could not get variable name");
} }
output_comment(c_stream, comment); output_comment(c_stream, comment);
} }
output_init_var(c_stream); output_init_var(c_stream);
output_write_var(c_stream); output_write_var(c_stream);
output_read_var(c_stream); output_read_var(c_stream);
c_stream << "\n"; c_stream << "\n";
if (!ifs.empty()) if (!ifs.empty())
@@ -934,7 +934,7 @@ int main(size_t argc, const char **argv)
else else
{ {
break; break;
} }
} }
if ((argc-param_pos) != 2) if ((argc-param_pos) != 2)
@@ -947,10 +947,10 @@ int main(size_t argc, const char **argv)
<< " -Ddefine Define a processor director. Example: -D__LINUX__\n" << " -Ddefine Define a processor director. Example: -D__LINUX__\n"
<< " Can specify multiple defines.\n" << " Can specify multiple defines.\n"
<< endl; << endl;
return(1); return(1);
} }
const char *psr_file = argv[param_pos+1], *c_file = argv[param_pos]; const char *psr_file = argv[param_pos+1], *c_file = argv[param_pos];
int ret_val = 0; int ret_val = 0;
@@ -961,7 +961,7 @@ int main(size_t argc, const char **argv)
if (c_stream) if (c_stream)
{ {
parser_generate(psr_stream, c_stream); parser_generate(psr_stream, c_stream);
c_stream.close(); c_stream.close();
} }
else else
@@ -969,7 +969,7 @@ int main(size_t argc, const char **argv)
cerr << "Error opening " << c_file << " for writing." << endl; cerr << "Error opening " << c_file << " for writing." << endl;
ret_val |= 2; ret_val |= 2;
} }
psr_stream.close(); psr_stream.close();
} }
else else
@@ -977,7 +977,7 @@ int main(size_t argc, const char **argv)
cerr << "Error opening " << psr_file << " for reading." << endl; cerr << "Error opening " << psr_file << " for reading." << endl;
ret_val |= 4; ret_val |= 4;
} }
return(0); return(0);
} }

View File

@@ -73,7 +73,7 @@ bool reloadBuffer()
if (IPSPatch.proccessed == IPSPatch.file_size) { return(false); } if (IPSPatch.proccessed == IPSPatch.file_size) { return(false); }
IPSPatch.buffer_total = IPSPatch.fp ? IPSPatch.buffer_total = IPSPatch.fp ?
/* Regular Files */ fread(IPSPatch.data, 1, BUFFER_SIZE, IPSPatch.fp) : /* Regular Files */ fread(IPSPatch.data, 1, BUFFER_SIZE, IPSPatch.fp) :
/* Zip Files */ unzReadCurrentFile(IPSPatch.zipfile, IPSPatch.data, BUFFER_SIZE); /* Zip Files */ unzReadCurrentFile(IPSPatch.zipfile, IPSPatch.data, BUFFER_SIZE);
IPSPatch.current = IPSPatch.data; IPSPatch.current = IPSPatch.data;
@@ -113,20 +113,20 @@ bool initPatch()
IPSPatch.fp = 0; IPSPatch.fp = 0;
IPSPatch.fp = fopen(patchfile, "rb"); IPSPatch.fp = fopen(patchfile, "rb");
if (!IPSPatch.fp) { return(false); } if (!IPSPatch.fp) { return(false); }
return(reloadBuffer()); return(reloadBuffer());
} }
void deinitPatch() void deinitPatch()
{ {
if (IPSPatch.data) if (IPSPatch.data)
{ {
free(IPSPatch.data); free(IPSPatch.data);
IPSPatch.data = 0; IPSPatch.data = 0;
} }
if (IPSPatch.fp) if (IPSPatch.fp)
{ {
fclose(IPSPatch.fp); fclose(IPSPatch.fp);
IPSPatch.fp = 0; IPSPatch.fp = 0;
} }
@@ -145,7 +145,7 @@ void PatchUsingIPS()
unsigned char *ROM = (unsigned char *)romdata; unsigned char *ROM = (unsigned char *)romdata;
int location = 0, length = 0, last = 0; int location = 0, length = 0, last = 0;
int sub = Header512 ? 512 : 0; int sub = Header512 ? 512 : 0;
IPSPatched = false; IPSPatched = false;
if (!AutoPatch) if (!AutoPatch)
@@ -153,11 +153,11 @@ void PatchUsingIPS()
deinitPatch(); //Needed if the call to this function was done from findZipIPS() deinitPatch(); //Needed if the call to this function was done from findZipIPS()
return; return;
} }
if (patchfile) //Regular file, not Zip if (patchfile) //Regular file, not Zip
{ {
if (!initPatch()) if (!initPatch())
{ {
deinitPatch(); //Needed because if it didn't fully init, some things could have deinitPatch(); //Needed because if it didn't fully init, some things could have
return; return;
} }
@@ -177,7 +177,7 @@ void PatchUsingIPS()
int inloc = (IPSget() << 16) | (IPSget() << 8) | IPSget(); int inloc = (IPSget() << 16) | (IPSget() << 8) | IPSget();
if (inloc == 0x454f46) //EOF if (inloc == 0x454f46) //EOF
{ {
break; break;
} }
@@ -187,7 +187,7 @@ void PatchUsingIPS()
//Length is a 2 byte value (max 64KB) //Length is a 2 byte value (max 64KB)
length = (IPSget() << 8) | IPSget(); length = (IPSget() << 8) | IPSget();
if (length) // Not RLE if (length) // Not RLE
{ {
int i; int i;
for (i = 0; i < length; i++, location++) for (i = 0; i < length; i++, location++)
@@ -208,7 +208,7 @@ void PatchUsingIPS()
{ {
int i; int i;
unsigned char newVal; unsigned char newVal;
length = (IPSget() << 8) | IPSget(); length = (IPSget() << 8) | IPSget();
newVal = (unsigned char)IPSget(); newVal = (unsigned char)IPSget();
for (i = 0; i < length; i++, location++) for (i = 0; i < length; i++, location++)
{ {
@@ -221,16 +221,16 @@ void PatchUsingIPS()
} }
} }
} }
//We use gotos to break out of the nested loops, //We use gotos to break out of the nested loops,
//as well as a simple way to check for 'PATCH' in //as well as a simple way to check for 'PATCH' in
//some cases like this one, goto is the way to go. //some cases like this one, goto is the way to go.
IPSDone: IPSDone:
deinitPatch(); deinitPatch();
IPSPatched = true; IPSPatched = true;
//Adjust size values if the ROM was expanded //Adjust size values if the ROM was expanded
if (last > curromspace) if (last > curromspace)
{ {
@@ -268,10 +268,10 @@ void findZipIPS(char *compressedfile)
//Gets info on current file, and places it in cFileInfo //Gets info on current file, and places it in cFileInfo
unzGetCurrentFileInfo(IPSPatch.zipfile, &cFileInfo, cFileName, 256, NULL, 0, NULL, 0); unzGetCurrentFileInfo(IPSPatch.zipfile, &cFileInfo, cFileName, 256, NULL, 0, NULL, 0);
//Find IPS file //Find IPS file
if (strlen(cFileName) >= 5) //Char + ".IPS" if (strlen(cFileName) >= 5) //Char + ".IPS"
{ {
char *ext = cFileName+strlen(cFileName)-4; char *ext = cFileName+strlen(cFileName)-4;
if (!strncasecmp(ext, ".IPS", 4)) if (!strncasecmp(ext, ".IPS", 4))
{ {
FoundIPS = true; FoundIPS = true;
@@ -279,12 +279,12 @@ void findZipIPS(char *compressedfile)
} }
} }
//Go to next file in zip file //Go to next file in zip file
cFile = unzGoToNextFile(IPSPatch.zipfile); cFile = unzGoToNextFile(IPSPatch.zipfile);
} }
if (!FoundIPS) if (!FoundIPS)
{ {
unzClose(IPSPatch.zipfile); unzClose(IPSPatch.zipfile);
IPSPatch.zipfile = 0; IPSPatch.zipfile = 0;
return; return;

View File

@@ -244,7 +244,7 @@ void zstart ()
asm_call(setnoise); asm_call(setnoise);
asm_call(InitSPC); asm_call(InitSPC);
#endif #endif
asm_call(allocmem); asm_call(allocmem);
if (!soundon && (SPCDisable != 1)) if (!soundon && (SPCDisable != 1))

View File

@@ -27,16 +27,16 @@ char *VERSION_STR;
//Place compilation date at the end of VERSION_STR //Place compilation date at the end of VERSION_STR
void placedate() void placedate()
{ {
strcpy(VERSION_STR + strcpy(VERSION_STR +
strlen(VERSION_STR) - strlen(VERSION_STR) -
strlen(__DATE__), __DATE__); strlen(__DATE__), __DATE__);
} }
//Place compilation time at the end of VERSION_STR //Place compilation time at the end of VERSION_STR
void placetime() void placetime()
{ {
strcpy(VERSION_STR + strcpy(VERSION_STR +
strlen(VERSION_STR) - strlen(VERSION_STR) -
strlen(__TIME__), __TIME__); strlen(__TIME__), __TIME__);
} }

View File

@@ -117,7 +117,7 @@ NEWSYM _2xSaISuper2xSaILine
mov ebx, [ebp+srcPitch] ;ebx contains the source pitch mov ebx, [ebp+srcPitch] ;ebx contains the source pitch
mov ecx, [ebp+width] ;ecx contains the number of pixels to process mov ecx, [ebp+width] ;ecx contains the number of pixels to process
; eax now points to colorB1 ; eax now points to colorB1
sub eax, ebx ;eax points to B1 which is the base sub eax, ebx ;eax points to B1 which is the base
; Main Loop ; Main Loop
.Loop: push ecx .Loop: push ecx
@@ -168,7 +168,7 @@ NEWSYM _2xSaISuper2xSaILine
packsswb mm7, mm7 packsswb mm7, mm7
movd ecx, mm7 movd ecx, mm7
test ecx, ecx test ecx, ecx
jz near .SKIP_PROCESS ;no, so we can skip jz near .SKIP_PROCESS ;no, so we can skip
;End Delta ;End Delta
@@ -455,7 +455,7 @@ NEWSYM _2xSaISuper2xSaILine
;Start the ASSEMBLY !!! eh... compose all the results together to form the final image... ;Start the ASSEMBLY !!! eh... compose all the results together to form the final image...
movq mm0, [eax+ebx+color5] movq mm0, [eax+ebx+color5]
movq mm1, [eax+ebx+ebx+color2] movq mm1, [eax+ebx+ebx+color2]
movq mm2, mm0 movq mm2, mm0
@@ -531,7 +531,7 @@ NEWSYM _2xSaISuper2xSaILine
pand mm6, mm2 pand mm6, mm2
por mm7, mm6 por mm7, mm6
movq mm6, mm7 movq mm6, mm7
pcmpeqw mm6, mm5 pcmpeqw mm6, mm5
pand mm7, mm0 pand mm7, mm0
@@ -542,8 +542,8 @@ NEWSYM _2xSaISuper2xSaILine
movq [final1a], mm7 ;finished 1a movq [final1a], mm7 ;finished 1a
;-------------------------------- ;--------------------------------
movq mm7, [Mask35] movq mm7, [Mask35]
push eax push eax
@@ -583,7 +583,7 @@ NEWSYM _2xSaISuper2xSaILine
pand mm6, mm2 pand mm6, mm2
por mm7, mm6 por mm7, mm6
movq mm6, mm7 movq mm6, mm7
pcmpeqw mm6, mm5 pcmpeqw mm6, mm5
pand mm7, mm0 pand mm7, mm0
@@ -595,7 +595,7 @@ NEWSYM _2xSaISuper2xSaILine
;-------------------------------------------- ;--------------------------------------------
%ifdef dfhsdfhsdahdsfhdsfh %ifdef dfhsdfhsdahdsfhdsfh
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
@@ -675,7 +675,7 @@ NEWSYM _2xSaISuper2xSaILine
movq [final2b], mm0 movq [final2b], mm0
;----------------------------------- ;-----------------------------------
pxor mm7, mm7 pxor mm7, mm7
movq mm0, [eax+colorB0] movq mm0, [eax+colorB0]
@@ -732,7 +732,7 @@ NEWSYM _2xSaISuper2xSaILine
por mm0, mm3 por mm0, mm3
por mm0, mm2 por mm0, mm2
movq [final1b], mm0 movq [final1b], mm0
;--------- ;---------
movq mm0, [final1a] movq mm0, [final1a]
@@ -2023,7 +2023,7 @@ Bits565:
mov [eax+4], edx mov [eax+4], edx
mov eax, 0 mov eax, 0
jmp end1 jmp end1
end1: end1:
pop edx pop edx
mov esp, ebp mov esp, ebp
pop ebp pop ebp

View File

@@ -95,7 +95,7 @@ NEWSYM _2xSaISuper2xSaILineW
mov ebx, [ebp+srcPitch] ;ebx contains the source pitch mov ebx, [ebp+srcPitch] ;ebx contains the source pitch
mov ecx, [ebp+width] ;ecx contains the number of pixels to process mov ecx, [ebp+width] ;ecx contains the number of pixels to process
; eax now points to colorB1 ; eax now points to colorB1
sub eax, ebx ;eax points to B1 which is the base sub eax, ebx ;eax points to B1 which is the base
; Main Loop ; Main Loop
.Loop: push ecx .Loop: push ecx
@@ -146,7 +146,7 @@ NEWSYM _2xSaISuper2xSaILineW
packsswb mm7, mm7 packsswb mm7, mm7
movd ecx, mm7 movd ecx, mm7
test ecx, ecx test ecx, ecx
jz near .SKIP_PROCESS ;no, so we can skip jz near .SKIP_PROCESS ;no, so we can skip
;End Delta ;End Delta
@@ -432,7 +432,7 @@ NEWSYM _2xSaISuper2xSaILineW
;Start the ASSEMBLY !!! eh... compose all the results together to form the final image... ;Start the ASSEMBLY !!! eh... compose all the results together to form the final image...
movq mm0, [eax+ebx+color5] movq mm0, [eax+ebx+color5]
movq mm1, [eax+ebx+ebx+color2] movq mm1, [eax+ebx+ebx+color2]
movq mm2, mm0 movq mm2, mm0
@@ -507,7 +507,7 @@ NEWSYM _2xSaISuper2xSaILineW
pand mm6, mm2 pand mm6, mm2
por mm7, mm6 por mm7, mm6
movq mm6, mm7 movq mm6, mm7
pcmpeqw mm6, mm5 pcmpeqw mm6, mm5
pand mm7, mm0 pand mm7, mm0
@@ -518,8 +518,8 @@ NEWSYM _2xSaISuper2xSaILineW
movq [final1a], mm7 ;finished 1a movq [final1a], mm7 ;finished 1a
;-------------------------------- ;--------------------------------
movq mm7, [Mask35] movq mm7, [Mask35]
push eax push eax
@@ -559,7 +559,7 @@ NEWSYM _2xSaISuper2xSaILineW
pand mm6, mm2 pand mm6, mm2
por mm7, mm6 por mm7, mm6
movq mm6, mm7 movq mm6, mm7
pcmpeqw mm6, mm5 pcmpeqw mm6, mm5
pand mm7, mm0 pand mm7, mm0
@@ -571,7 +571,7 @@ NEWSYM _2xSaISuper2xSaILineW
;-------------------------------------------- ;--------------------------------------------
%ifdef dfhsdfhsdahdsfhdsfh %ifdef dfhsdfhsdahdsfhdsfh
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
@@ -637,7 +637,7 @@ NEWSYM _2xSaISuper2xSaILineW
movq mm4, [Mask35] movq mm4, [Mask35]
movq mm3, [Mask26] movq mm3, [Mask26]
movq mm6, mm4 movq mm6, mm4
pand mm6, mm7 pand mm6, mm7
pxor mm4, mm6 pxor mm4, mm6
@@ -669,7 +669,7 @@ NEWSYM _2xSaISuper2xSaILineW
movq [final2b], mm0 movq [final2b], mm0
;----------------------------------- ;-----------------------------------
pxor mm7, mm7 pxor mm7, mm7
movq mm0, [eax+colorB0] movq mm0, [eax+colorB0]
@@ -711,7 +711,7 @@ NEWSYM _2xSaISuper2xSaILineW
movq mm4, [Mask35] movq mm4, [Mask35]
movq mm3, [Mask26] movq mm3, [Mask26]
movq mm6, mm4 movq mm6, mm4
pand mm6, mm7 pand mm6, mm7
pxor mm4, mm6 pxor mm4, mm6
@@ -741,7 +741,7 @@ NEWSYM _2xSaISuper2xSaILineW
por mm0, mm3 por mm0, mm3
por mm0, mm2 por mm0, mm2
movq [final1b], mm0 movq [final1b], mm0
;--------- ;---------
movq mm0, [final1a] movq mm0, [final1a]
@@ -2032,7 +2032,7 @@ Bits565:
mov [eax+4], edx mov [eax+4], edx
mov eax, 0 mov eax, 0
jmp end1 jmp end1
end1: end1:
pop edx pop edx
mov esp, ebp mov esp, ebp
pop ebp pop ebp

View File

@@ -341,7 +341,7 @@ PreTripleBuffer:
.failed .failed
mov byte[Triplebufen],0 mov byte[Triplebufen],0
ret ret
%endif %endif
SECTION .data SECTION .data
; Please don't break this again. :) ; Please don't break this again. :)
@@ -405,7 +405,7 @@ ScreenShow:
je near copyvesa2320x480x8b je near copyvesa2320x480x8b
cmp byte[cvidmode],10 cmp byte[cvidmode],10
je near copyvesa2320x480x16b je near copyvesa2320x480x16b
cmp byte[cvidmode],11 cmp byte[cvidmode],11
je near copyvesa2512x384x8b je near copyvesa2512x384x8b
cmp byte[cvidmode],12 cmp byte[cvidmode],12
je near copyvesa2512x384x16b je near copyvesa2512x384x16b
@@ -1015,7 +1015,7 @@ NEWSYM copyvesa2320x480x8b
ret ret
;copyvesa2320x480x8ng: ;copyvesa2320x480x8ng:
; jmp .mode7hires ; jmp .mode7hires
; mov ebx,1 ; mov ebx,1
;.loopa ;.loopa
@@ -1289,7 +1289,7 @@ NEWSYM copyvesa2800x600x16b
add edi,144*2+800*2+144*2 add edi,144*2+800*2+144*2
dec dl dec dl
jnz near .interpolate jnz near .interpolate
.done .done
pop es pop es
ret ret

View File

@@ -34,8 +34,8 @@ EXTSYM ScrDispl
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonega jz .nonega
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7X0],1110000000000000b or word[mode7X0],1110000000000000b
.nonega .nonega
mov [.cxloc],bx mov [.cxloc],bx
mov bx,dx mov bx,dx
@@ -58,7 +58,7 @@ EXTSYM ScrDispl
test bx,0001000000000000b test bx,0001000000000000b
jz .nonegd jz .nonegd
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7Y0],1110000000000000b or word[mode7Y0],1110000000000000b
.nonegd .nonegd
sub word[.cyloc],bx sub word[.cyloc],bx
@@ -117,8 +117,8 @@ EXTSYM ScrDispl
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonega jz .nonega
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7X0],1110000000000000b or word[mode7X0],1110000000000000b
.nonega .nonega
mov [.cxloc],bx mov [.cxloc],bx
mov bx,dx mov bx,dx
@@ -141,7 +141,7 @@ EXTSYM ScrDispl
test bx,0001000000000000b test bx,0001000000000000b
jz .nonegd jz .nonegd
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7Y0],1110000000000000b or word[mode7Y0],1110000000000000b
.nonegd .nonegd
add bx,bx add bx,bx
sub word[.cyloc],bx sub word[.cyloc],bx

View File

@@ -108,8 +108,8 @@ EXTSYM pesimpng,ScrDispl
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonega jz .nonega
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7X0],1110000000000000b or word[mode7X0],1110000000000000b
.nonega .nonega
mov [mcxloc],bx mov [mcxloc],bx
mov bx,dx mov bx,dx
@@ -132,7 +132,7 @@ EXTSYM pesimpng,ScrDispl
test bx,0001000000000000b test bx,0001000000000000b
jz .nonegd jz .nonegd
or bx,1110000000000000b or bx,1110000000000000b
or word[mode7Y0],1110000000000000b or word[mode7Y0],1110000000000000b
.nonegd .nonegd
sub word[mcyloc],bx sub word[mcyloc],bx
@@ -191,8 +191,8 @@ EXTSYM pesimpng,ScrDispl
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonegacb jz .nonegacb
or word[mode7X0],1110000000000000b or word[mode7X0],1110000000000000b
or bx,1110000000000000b or bx,1110000000000000b
.nonegacb .nonegacb
mov [mcxloc],bx mov [mcxloc],bx
mov bx,dx mov bx,dx
@@ -213,7 +213,7 @@ EXTSYM pesimpng,ScrDispl
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonegdcb jz .nonegdcb
or word[mode7Y0],1110000000000000b or word[mode7Y0],1110000000000000b
or bx,1110000000000000b or bx,1110000000000000b
.nonegdcb .nonegdcb
add bx,bx add bx,bx

View File

@@ -35,7 +35,7 @@
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonega jz .nonega
or bx,1110000000000000b or bx,1110000000000000b
.nonega .nonega
mov [.cxloc],bx mov [.cxloc],bx
mov bx,dx mov bx,dx

View File

@@ -51,7 +51,7 @@ NEWSYM drawmode7extbg
and bx,0001111111111111b ; 13 -> 16 bit signed value and bx,0001111111111111b ; 13 -> 16 bit signed value
test bx,0001000000000000b test bx,0001000000000000b
jz .nonega jz .nonega
or bx,1110000000000000b or bx,1110000000000000b
.nonega .nonega
mov [.cxloc],bx mov [.cxloc],bx
mov bx,dx mov bx,dx

View File

@@ -15,7 +15,7 @@
#define IDC_EDITPASS 1084 #define IDC_EDITPASS 1084
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 121 #define _APS_NEXT_RESOURCE_VALUE 121

View File

@@ -473,7 +473,7 @@ BOOL InputRead(void)
HRESULT hr; HRESULT hr;
aquireagain:; aquireagain:;
hr=MouseInput->GetDeviceState(sizeof(DIMOUSESTATE),&dims); hr=MouseInput->GetDeviceState(sizeof(DIMOUSESTATE),&dims);
if (hr==DIERR_INPUTLOST) if (hr==DIERR_INPUTLOST)
{ {
hr=MouseInput->Acquire(); hr=MouseInput->Acquire();
@@ -860,7 +860,7 @@ BOOL InitSound()
return FALSE; return FALSE;
} }
} }
SoundEnabled=1; SoundEnabled=1;
FirstSound=0; FirstSound=0;
return TRUE; return TRUE;
@@ -989,7 +989,7 @@ BOOL ReInitSound()
return FALSE; return FALSE;
} }
} }
SoundEnabled=1; SoundEnabled=1;
FirstSound=0; FirstSound=0;
return TRUE; return TRUE;
@@ -1285,7 +1285,7 @@ bool InitInput()
hr=KeyboardInput->SetDataFormat(&c_dfDIKeyboard); hr=KeyboardInput->SetDataFormat(&c_dfDIKeyboard);
if (FAILED(hr)) {DInputError();return FALSE;} if (FAILED(hr)) {DInputError();return FALSE;}
hr=KeyboardInput->SetCooperativeLevel(hMainWindow,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ); hr=KeyboardInput->SetCooperativeLevel(hMainWindow,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND );
hr=DInput->CreateDevice(GUID_SysMouse, &MouseInput,NULL); hr=DInput->CreateDevice(GUID_SysMouse, &MouseInput,NULL);
@@ -1293,7 +1293,7 @@ bool InitInput()
hr=MouseInput->SetDataFormat(&c_dfDIMouse); hr=MouseInput->SetDataFormat(&c_dfDIMouse);
if (FAILED(hr)) {DInputError();return FALSE;} if (FAILED(hr)) {DInputError();return FALSE;}
hr=MouseInput->SetCooperativeLevel(hMainWindow,DISCL_EXCLUSIVE|DISCL_FOREGROUND); hr=MouseInput->SetCooperativeLevel(hMainWindow,DISCL_EXCLUSIVE|DISCL_FOREGROUND);
if (FAILED(hr)) {DInputError();return FALSE;} if (FAILED(hr)) {DInputError();return FALSE;}
@@ -1614,7 +1614,7 @@ int InitDirectDraw()
MessageBox(NULL, "IDirectDrawSurface7::GetPixelFormat failed.", "DirectDraw Error", MB_ICONERROR); MessageBox(NULL, "IDirectDrawSurface7::GetPixelFormat failed.", "DirectDraw Error", MB_ICONERROR);
return FALSE; return FALSE;
} }
BitDepth=format.dwRGBBitCount; BitDepth=format.dwRGBBitCount;
GBitMask=format.dwGBitMask; // 0x07E0 or not GBitMask=format.dwGBitMask; // 0x07E0 or not
@@ -2514,7 +2514,7 @@ void drawscreenwin(void)
break; break;
} }
case 32: case 32:
{ {
DrawWin256x224x32(); DrawWin256x224x32();
break; break;
} }

View File

@@ -54,7 +54,7 @@ void ZLog_Message (char *Message, ...)
va_start(ap,Message); va_start(ap,Message);
vsprintf(Msg,Message,ap ); vsprintf(Msg,Message,ap );
va_end(ap); va_end(ap);
strcat(Msg,"\r\n\0"); strcat(Msg,"\r\n\0");
fwrite(Msg,strlen(Msg),1,ZFILELog); fwrite(Msg,strlen(Msg),1,ZFILELog);
fflush(ZFILELog); fflush(ZFILELog);
@@ -67,7 +67,7 @@ void ZStart_Log (void)
// [4/15/2001] char *p; // [4/15/2001] char *p;
strcpy(LogFileName,"zfile.log\0"); strcpy(LogFileName,"zfile.log\0");
ZFILELog = fopen(LogFileName,"wb"); ZFILELog = fopen(LogFileName,"wb");
} }
@@ -179,7 +179,7 @@ int InitTCPFile()
/* Verify version number and exit on wrong version */ /* Verify version number and exit on wrong version */
if (wsadata.wVersion != versionneeded) if (wsadata.wVersion != versionneeded)
{ {
return(-1); return(-1);
} }
gameServerSocket=INVALID_SOCKET; gameServerSocket=INVALID_SOCKET;
@@ -320,7 +320,7 @@ LPTHREAD_START_ROUTINE MonitorThreadProc(SOCKET s)
hwndNCD = CreateDialog(hModule, MAKEINTRESOURCE hwndNCD = CreateDialog(hModule, MAKEINTRESOURCE
(IDD_NO_CONNECT), NULL, NULL); (IDD_NO_CONNECT), NULL, NULL);
while(destruct > 0) while(destruct > 0)
{ {
if (destruct == 10) if (destruct == 10)
clockstart = timeGetTime(); clockstart = timeGetTime();
@@ -399,15 +399,15 @@ OpenConnection(char *User, char *Password, char *FileName)
if(!strstr(temp,"ok")) if(!strstr(temp,"ok"))
{ {
ZLog_Message("Sending user name"); ZLog_Message("Sending user name");
sprintf(temp,"%s",User); sprintf(temp,"%s",User);
sendCommand(temp,strlen(temp)); sendCommand(temp,strlen(temp));
receiveData(temp,512); receiveData(temp,512);
if(!strstr(temp,"ok")) return 0; if(!strstr(temp,"ok")) return 0;
ZLog_Message("Sending password"); ZLog_Message("Sending password");
sprintf(temp,"%s",Password); sprintf(temp,"%s",Password);
sendCommand(temp,strlen(temp)); sendCommand(temp,strlen(temp));
receiveData(temp,512); receiveData(temp,512);
@@ -518,7 +518,7 @@ LRESULT CALLBACK UPDialogMain(HWND hDlg, UINT message, WPARAM wParam,
DWORD ZFileSystemInit() DWORD ZFileSystemInit()
{ {
ZStart_Log(); ZStart_Log();
#ifdef __GZIP__ #ifdef __GZIP__
TextFile = 0; TextFile = 0;
#else #else
@@ -552,7 +552,7 @@ DWORD ZOpenFile()
UPDialogDone=0; UPDialogDone=0;
hwndNCD = DialogBox(hModule, MAKEINTRESOURCE hwndNCD = DialogBox(hModule, MAKEINTRESOURCE
(IDD_USERPASS), NULL, UPDialogMain); (IDD_USERPASS), NULL, UPDialogMain);
while(!UPDialogDone) while(!UPDialogDone)
{ {
Sleep(1000); Sleep(1000);
@@ -560,7 +560,7 @@ DWORD ZOpenFile()
DestroyWindow(hwndNCD); DestroyWindow(hwndNCD);
ZLog_Message("User : %s Pass : %s",user,pass); ZLog_Message("User : %s Pass : %s",user,pass);
} }
else else
{ {
@@ -569,14 +569,14 @@ DWORD ZOpenFile()
for(i=0;i<endstr-startstr;i++) for(i=0;i<endstr-startstr;i++)
user[i]=startstr[i]; user[i]=startstr[i];
user[endstr-startstr]=0; user[endstr-startstr]=0;
startstr=endstr+1; startstr=endstr+1;
if((endstr=strstr(startstr,"@"))==NULL) return 0xFFFFFFFF; if((endstr=strstr(startstr,"@"))==NULL) return 0xFFFFFFFF;
if((endstr-startstr)>512) return 0xFFFFFFFF; if((endstr-startstr)>512) return 0xFFFFFFFF;
for(i=0;i<endstr-startstr;i++) for(i=0;i<endstr-startstr;i++)
pass[i]=startstr[i]; pass[i]=startstr[i];
pass[endstr-startstr]=0; pass[endstr-startstr]=0;
ZLog_Message("User : %s Pass : %s",user,pass); ZLog_Message("User : %s Pass : %s",user,pass);
startstr=endstr+1; startstr=endstr+1;
} }
@@ -620,7 +620,7 @@ DWORD ZOpenFile()
#endif #endif
if(ZOpenMode==0) if(ZOpenMode==0)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
@@ -633,11 +633,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==1) if(ZOpenMode==1)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -646,11 +646,11 @@ DWORD ZOpenFile()
} }
if(ZOpenMode==2) if(ZOpenMode==2)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
else else
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
@@ -695,7 +695,7 @@ DWORD ZFileSeek()
} }
else else
{ {
#endif #endif
int res = 0; int res = 0;
int mode = 0; int mode = 0;
@@ -703,10 +703,10 @@ DWORD ZFileSeek()
mode = SEEK_SET; mode = SEEK_SET;
else if (ZFileSeekMode==1) { else if (ZFileSeekMode==1) {
mode = SEEK_END; mode = SEEK_END;
if (TextFile==0) if (TextFile==0)
printf("Warning : gzseek(SEEK_END) not supported"); printf("Warning : gzseek(SEEK_END) not supported");
} else return (0xFFFFFFFF); } else return (0xFFFFFFFF);
if (TextFile) { if (TextFile) {
fseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode); fseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode);
return 0; return 0;
@@ -742,7 +742,7 @@ DWORD ZFileRead()
return ZFileReadSize; return ZFileReadSize;
} }
else else
{ {
#endif #endif
if (TextFile) if (TextFile)
return(fread(ZFileReadBlock, return(fread(ZFileReadBlock,
@@ -750,8 +750,8 @@ DWORD ZFileRead()
ZFileReadSize, ZFileReadSize,
FILEHANDLE[ZFileReadHandle])); FILEHANDLE[ZFileReadHandle]));
else else
return(gzread(FILEHANDLE[ZFileReadHandle], return(gzread(FILEHANDLE[ZFileReadHandle],
ZFileReadBlock, ZFileReadBlock,
ZFileReadSize)); ZFileReadSize));
#ifdef CCBETA #ifdef CCBETA
} }
@@ -768,7 +768,7 @@ DWORD ZFileWrite()
} }
else else
{ {
#endif #endif
//MK: this will fail if we write 2GB files //MK: this will fail if we write 2GB files
@@ -780,11 +780,11 @@ DWORD ZFileWrite()
ZFileWriteSize, ZFileWriteSize,
FILEHANDLE[ZFileWriteHandle]); FILEHANDLE[ZFileWriteHandle]);
else else
res = gzwrite(FILEHANDLE[ZFileWriteHandle], res = gzwrite(FILEHANDLE[ZFileWriteHandle],
ZFileWriteBlock, ZFileWriteBlock,
ZFileWriteSize); ZFileWriteSize);
if (res!=(int)ZFileWriteSize) if (res!=(int)ZFileWriteSize)
return(0xFFFFFFFF); return(0xFFFFFFFF);
#ifdef CCBETA #ifdef CCBETA
} }

View File

@@ -1,4 +1,4 @@
/* unzip.c -- IO on .zip files using zlib /* unzip.c -- IO on .zip files using zlib
Version 0.15 beta, Mar 19th, 1998, Version 0.15 beta, Mar 19th, 1998,
Read unzip.h for more info Read unzip.h for more info
@@ -150,7 +150,7 @@ local int unzlocal_getByte(fin,pi)
} }
else else
{ {
if (ferror(fin)) if (ferror(fin))
return UNZ_ERRNO; return UNZ_ERRNO;
else else
return UNZ_EOF; return UNZ_EOF;
@@ -159,7 +159,7 @@ local int unzlocal_getByte(fin,pi)
/* =========================================================================== /* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets Reads a long in LSB order from the given gz_stream. Sets
*/ */
local int unzlocal_getShort (fin,pX) local int unzlocal_getShort (fin,pX)
FILE* fin; FILE* fin;
@@ -171,11 +171,11 @@ local int unzlocal_getShort (fin,pX)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x = (uLong)i; x = (uLong)i;
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8; x += ((uLong)i)<<8;
if (err==UNZ_OK) if (err==UNZ_OK)
*pX = x; *pX = x;
else else
@@ -193,7 +193,7 @@ local int unzlocal_getLong (fin,pX)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x = (uLong)i; x = (uLong)i;
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8; x += ((uLong)i)<<8;
@@ -205,7 +205,7 @@ local int unzlocal_getLong (fin,pX)
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<24; x += ((uLong)i)<<24;
if (err==UNZ_OK) if (err==UNZ_OK)
*pX = x; *pX = x;
else else
@@ -249,7 +249,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif #endif
/* /*
Compare two filename (fileName1,fileName2). Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
@@ -270,7 +270,7 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit
return strcmp(fileName1,fileName2); return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
} }
#define BUFREADCOMMENT (0x400) #define BUFREADCOMMENT (0x400)
@@ -286,13 +286,13 @@ local uLong unzlocal_SearchCentralDir(fin)
uLong uBackRead; uLong uBackRead;
uLong uMaxBack=0xffff; /* maximum size of global comment */ uLong uMaxBack=0xffff; /* maximum size of global comment */
uLong uPosFound=0; uLong uPosFound=0;
if (fseek(fin,0,SEEK_END) != 0) if (fseek(fin,0,SEEK_END) != 0)
return 0; return 0;
uSizeFile = ftell( fin ); uSizeFile = ftell( fin );
if (uMaxBack>uSizeFile) if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile; uMaxBack = uSizeFile;
@@ -305,13 +305,13 @@ local uLong unzlocal_SearchCentralDir(fin)
{ {
uLong uReadSize,uReadPos ; uLong uReadSize,uReadPos ;
int i; int i;
if (uBackRead+BUFREADCOMMENT>uMaxBack) if (uBackRead+BUFREADCOMMENT>uMaxBack)
uBackRead = uMaxBack; uBackRead = uMaxBack;
else else
uBackRead+=BUFREADCOMMENT; uBackRead+=BUFREADCOMMENT;
uReadPos = uSizeFile-uBackRead ; uReadPos = uSizeFile-uBackRead ;
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos); (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
if (fseek(fin,uReadPos,SEEK_SET)!=0) if (fseek(fin,uReadPos,SEEK_SET)!=0)
break; break;
@@ -320,7 +320,7 @@ local uLong unzlocal_SearchCentralDir(fin)
break; break;
for (i=(int)uReadSize-3; (i--)>0;) for (i=(int)uReadSize-3; (i--)>0;)
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{ {
uPosFound = uReadPos+i; uPosFound = uReadPos+i;
@@ -351,12 +351,12 @@ extern unzFile ZEXPORT unzOpen (path)
uLong central_pos,uL; uLong central_pos,uL;
FILE * fin ; FILE * fin ;
uLong number_disk; /* number of the current dist, used for uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/ spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/ for spaning ZIP, unsupported, always 0*/
uLong number_entry_CD; /* total number of entries in uLong number_entry_CD; /* total number of entries in
the central dir the central dir
(same than number_entry on nospan) */ (same than number_entry on nospan) */
int err=UNZ_OK; int err=UNZ_OK;
@@ -404,7 +404,7 @@ extern unzFile ZEXPORT unzOpen (path)
if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
/* offset of start of central directory with respect to the /* offset of start of central directory with respect to the
starting disk number */ starting disk number */
if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@@ -413,7 +413,7 @@ extern unzFile ZEXPORT unzOpen (path)
if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
if ((central_pos<us.offset_central_dir+us.size_central_dir) && if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
(err==UNZ_OK)) (err==UNZ_OK))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@@ -428,12 +428,12 @@ extern unzFile ZEXPORT unzOpen (path)
(us.offset_central_dir+us.size_central_dir); (us.offset_central_dir+us.size_central_dir);
us.central_pos = central_pos; us.central_pos = central_pos;
us.pfile_in_zip_read = NULL; us.pfile_in_zip_read = NULL;
s=(unz_s*)ALLOC(sizeof(unz_s)); s=(unz_s*)ALLOC(sizeof(unz_s));
*s=us; *s=us;
unzGoToFirstFile((unzFile)s); unzGoToFirstFile((unzFile)s);
return (unzFile)s; return (unzFile)s;
} }
@@ -499,7 +499,7 @@ local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
*/ */
local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
unz_file_info *pfile_info, unz_file_info *pfile_info,
unz_file_info_internal unz_file_info_internal
*pfile_info_internal, *pfile_info_internal,
char *szFileName, char *szFileName,
uLong fileNameBufferSize, uLong fileNameBufferSize,
@@ -612,7 +612,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
lSeek -= uSizeRead; lSeek -= uSizeRead;
} }
if ((err==UNZ_OK) && (extraField!=NULL)) if ((err==UNZ_OK) && (extraField!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@@ -634,9 +634,9 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
lSeek += file_info.size_file_extra - uSizeRead; lSeek += file_info.size_file_extra - uSizeRead;
} }
else else
lSeek+=file_info.size_file_extra; lSeek+=file_info.size_file_extra;
if ((err==UNZ_OK) && (szComment!=NULL)) if ((err==UNZ_OK) && (szComment!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@@ -729,7 +729,7 @@ extern int ZEXPORT unzGoToFirstFile (file)
extern int ZEXPORT unzGoToNextFile (file) extern int ZEXPORT unzGoToNextFile (file)
unzFile file; unzFile file;
{ {
unz_s* s; unz_s* s;
int err; int err;
if (file==NULL) if (file==NULL)
@@ -764,10 +764,10 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
const char *szFileName; const char *szFileName;
int iCaseSensitivity; int iCaseSensitivity;
{ {
unz_s* s; unz_s* s;
int err; int err;
uLong num_fileSaved; uLong num_fileSaved;
uLong pos_in_central_dirSaved; uLong pos_in_central_dirSaved;
@@ -877,7 +877,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
((uFlags & 8)==0)) ((uFlags & 8)==0))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@@ -899,7 +899,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
return err; return err;
} }
/* /*
Open for reading data the current file in the zipfile. Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK. If there is no error and the file is opened, the return value is UNZ_OK.
@@ -945,7 +945,7 @@ extern int ZEXPORT unzOpenCurrentFile (file)
} }
pfile_in_zip_read_info->stream_initialised=0; pfile_in_zip_read_info->stream_initialised=0;
if ((s->cur_file_info.compression_method!=0) && if ((s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@@ -964,29 +964,29 @@ extern int ZEXPORT unzOpenCurrentFile (file)
{ {
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0; pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0; pfile_in_zip_read_info->stream.opaque = (voidpf)0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
if (err == Z_OK) if (err == Z_OK)
pfile_in_zip_read_info->stream_initialised=1; pfile_in_zip_read_info->stream_initialised=1;
/* windowBits is passed < 0 to tell that there is no zlib header. /* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte * Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and * after the compressed stream in order to complete decompression and
* return Z_STREAM_END. * return Z_STREAM_END.
* In unzip, i don't wait absolutely Z_STREAM_END because I known the * In unzip, i don't wait absolutely Z_STREAM_END because I known the
* size of both compressed and uncompressed data * size of both compressed and uncompressed data
*/ */
} }
pfile_in_zip_read_info->rest_read_compressed = pfile_in_zip_read_info->rest_read_compressed =
s->cur_file_info.compressed_size ; s->cur_file_info.compressed_size ;
pfile_in_zip_read_info->rest_read_uncompressed = pfile_in_zip_read_info->rest_read_uncompressed =
s->cur_file_info.uncompressed_size ; s->cur_file_info.uncompressed_size ;
pfile_in_zip_read_info->pos_in_zipfile = pfile_in_zip_read_info->pos_in_zipfile =
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
iSizeVar; iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0; pfile_in_zip_read_info->stream.avail_in = (uInt)0;
@@ -1031,9 +1031,9 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len; pfile_in_zip_read_info->stream.avail_out = (uInt)len;
if (len>pfile_in_zip_read_info->rest_read_uncompressed) if (len>pfile_in_zip_read_info->rest_read_uncompressed)
pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->stream.avail_out =
(uInt)pfile_in_zip_read_info->rest_read_uncompressed; (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
while (pfile_in_zip_read_info->stream.avail_out>0) while (pfile_in_zip_read_info->stream.avail_out>0)
@@ -1047,7 +1047,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
if (uReadThis == 0) if (uReadThis == 0)
return UNZ_EOF; return UNZ_EOF;
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;
if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
@@ -1056,8 +1056,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
pfile_in_zip_read_info->rest_read_compressed-=uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
pfile_in_zip_read_info->stream.next_in = pfile_in_zip_read_info->stream.next_in =
(Bytef*)pfile_in_zip_read_info->read_buffer; (Bytef*)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
} }
@@ -1065,16 +1065,16 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
if (pfile_in_zip_read_info->compression_method==0) if (pfile_in_zip_read_info->compression_method==0)
{ {
uInt uDoCopy,i ; uInt uDoCopy,i ;
if (pfile_in_zip_read_info->stream.avail_out < if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in) pfile_in_zip_read_info->stream.avail_in)
uDoCopy = pfile_in_zip_read_info->stream.avail_out ; uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
else else
uDoCopy = pfile_in_zip_read_info->stream.avail_in ; uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
for (i=0;i<uDoCopy;i++) for (i=0;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.next_out+i) = *(pfile_in_zip_read_info->stream.next_out+i) =
*(pfile_in_zip_read_info->stream.next_in+i); *(pfile_in_zip_read_info->stream.next_in+i);
pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
pfile_in_zip_read_info->stream.next_out, pfile_in_zip_read_info->stream.next_out,
uDoCopy); uDoCopy);
@@ -1106,8 +1106,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
uOutThis = uTotalOutAfter-uTotalOutBefore; uOutThis = uTotalOutAfter-uTotalOutBefore;
pfile_in_zip_read_info->crc32 = pfile_in_zip_read_info->crc32 =
crc32(pfile_in_zip_read_info->crc32,bufBefore, crc32(pfile_in_zip_read_info->crc32,bufBefore,
(uInt)(uOutThis)); (uInt)(uOutThis));
@@ -1115,10 +1115,10 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
uOutThis; uOutThis;
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
if (err==Z_STREAM_END) if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead; return (iRead==0) ? UNZ_EOF : iRead;
if (err!=Z_OK) if (err!=Z_OK)
break; break;
} }
} }
@@ -1150,7 +1150,7 @@ extern z_off_t ZEXPORT unztell (file)
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int ZEXPORT unzeof (file) extern int ZEXPORT unzeof (file)
unzFile file; unzFile file;
@@ -1164,7 +1164,7 @@ extern int ZEXPORT unzeof (file)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (pfile_in_zip_read_info->rest_read_uncompressed == 0) if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
return 1; return 1;
else else
@@ -1182,7 +1182,7 @@ extern int ZEXPORT unzeof (file)
if buf!=NULL, len is the size of the buffer, the extra header is copied in if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf. buf.
the return value is the number of bytes copied in buf, or (if <0) the return value is the number of bytes copied in buf, or (if <0)
the error code the error code
*/ */
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
@@ -1203,12 +1203,12 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
size_to_read = (pfile_in_zip_read_info->size_local_extrafield - size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
pfile_in_zip_read_info->pos_local_extrafield); pfile_in_zip_read_info->pos_local_extrafield);
if (buf==NULL) if (buf==NULL)
return (int)size_to_read; return (int)size_to_read;
if (len>size_to_read) if (len>size_to_read)
read_now = (uInt)size_to_read; read_now = (uInt)size_to_read;
else else
@@ -1216,9 +1216,9 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
if (read_now==0) if (read_now==0)
return 0; return 0;
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;

View File

@@ -5,7 +5,7 @@
#ifdef __WIN32__ #ifdef __WIN32__
#include <windows.h> #include <windows.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef __WIN32DBG__ #ifdef __WIN32DBG__
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
@@ -42,7 +42,7 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
{ {
return (-1); return (-1);
} }
fake_pal.red = 0; fake_pal.red = 0;
fake_pal.green = 0; fake_pal.green = 0;
fake_pal.blue = 0; fake_pal.blue = 0;
@@ -52,14 +52,14 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
user_error_fn*/NULL, NULL/*user_warning_fn*/); user_error_fn*/NULL, NULL/*user_warning_fn*/);
if (!png_ptr) if (!png_ptr)
return (-1); return (-1);
/*set png I/O source.*/ /*set png I/O source.*/
png_init_io(png_ptr, fp); png_init_io(png_ptr, fp);
/* set the zlib compression level */ /* set the zlib compression level */
png_set_compression_level(png_ptr, png_set_compression_level(png_ptr,
Z_BEST_COMPRESSION); Z_BEST_COMPRESSION);
/* set other zlib parameters */ /* set other zlib parameters */
png_set_compression_mem_level(png_ptr, 8); png_set_compression_mem_level(png_ptr, 8);
png_set_compression_strategy(png_ptr, png_set_compression_strategy(png_ptr,
@@ -77,12 +77,12 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
return (-1); return (-1);
} }
/*set a lot of image info (code adapted from libpng documentation!)*/ /*set a lot of image info (code adapted from libpng documentation!)*/
png_set_IHDR(png_ptr, info_ptr, width, height, png_set_IHDR(png_ptr, info_ptr, width, height,
8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
info_ptr->color_type=PNG_COLOR_TYPE_RGB_ALPHA; info_ptr->color_type=PNG_COLOR_TYPE_RGB_ALPHA;
/*Allocate an array of scanline pointers*/ /*Allocate an array of scanline pointers*/
@@ -107,10 +107,10 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
/*close file*/ /*close file*/
fclose(fp); fclose(fp);
/*Destroy PNG structs*/ /*Destroy PNG structs*/
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
/*clean up dynamically allocated RAM.*/ /*clean up dynamically allocated RAM.*/
free(row_pointers); free(row_pointers);

View File

@@ -1,4 +1,4 @@
/* unzip.h -- IO for uncompress .zip files using zlib /* unzip.h -- IO for uncompress .zip files using zlib
Version 0.15 beta, Mar 19th, 1998, Version 0.15 beta, Mar 19th, 1998,
Copyright (C) 1998 Gilles Vollant Copyright (C) 1998 Gilles Vollant
@@ -33,7 +33,7 @@
*/ */
/* for more info about .ZIP format, see /* for more info about .ZIP format, see
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at : PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */ ftp://ftp.pkware.com/probdesc.zip */
@@ -50,7 +50,7 @@ extern "C" {
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted /* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */ from (void*) without cast */
typedef struct TagunzFile__ { int unused; } unzFile__; typedef struct TagunzFile__ { int unused; } unzFile__;
typedef unzFile__ *unzFile; typedef unzFile__ *unzFile;
#else #else
typedef voidp unzFile; typedef voidp unzFile;
@@ -67,7 +67,7 @@ typedef voidp unzFile;
#define UNZ_CRCERROR (-105) #define UNZ_CRCERROR (-105)
/* tm_unz contain date/time info */ /* tm_unz contain date/time info */
typedef struct tm_unz_s typedef struct tm_unz_s
{ {
uInt tm_sec; /* seconds after the minute - [0,59] */ uInt tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */ uInt tm_min; /* minutes after the hour - [0,59] */
@@ -96,8 +96,8 @@ typedef struct unz_file_info_s
uLong compression_method; /* compression method 2 bytes */ uLong compression_method; /* compression method 2 bytes */
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
uLong crc; /* crc-32 4 bytes */ uLong crc; /* crc-32 4 bytes */
uLong compressed_size; /* compressed size 4 bytes */ uLong compressed_size; /* compressed size 4 bytes */
uLong uncompressed_size; /* uncompressed size 4 bytes */ uLong uncompressed_size; /* uncompressed size 4 bytes */
uLong size_filename; /* filename length 2 bytes */ uLong size_filename; /* filename length 2 bytes */
uLong size_file_extra; /* extra field length 2 bytes */ uLong size_file_extra; /* extra field length 2 bytes */
uLong size_file_comment; /* file comment length 2 bytes */ uLong size_file_comment; /* file comment length 2 bytes */
@@ -174,7 +174,7 @@ extern int ZEXPORT unzGoToNextFile OF((unzFile file));
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/ */
extern int ZEXPORT unzLocateFile OF((unzFile file, extern int ZEXPORT unzLocateFile OF((unzFile file,
const char *szFileName, const char *szFileName,
int iCaseSensitivity)); int iCaseSensitivity));
/* /*
@@ -225,8 +225,8 @@ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
Return UNZ_CRCERROR if all the file was read but the CRC is not good Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/ */
extern int ZEXPORT unzReadCurrentFile OF((unzFile file, extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
voidp buf, voidp buf,
unsigned len)); unsigned len));
/* /*
@@ -247,7 +247,7 @@ extern z_off_t ZEXPORT unztell OF((unzFile file));
extern int ZEXPORT unzeof OF((unzFile file)); extern int ZEXPORT unzeof OF((unzFile file));
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
@@ -262,7 +262,7 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
if buf!=NULL, len is the size of the buffer, the extra header is copied in if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf. buf.
the return value is the number of bytes copied in buf, or (if <0) the return value is the number of bytes copied in buf, or (if <0)
the error code the error code
*/ */

View File

@@ -195,13 +195,13 @@ static void display_help()
put_line(" C = C (Chat first), L (load game first)"); put_line(" C = C (Chat first), L (load game first)");
put_line(" D = N (Stay in ZSNES after disconnect), Q (Quit after disconnect)"); put_line(" D = N (Stay in ZSNES after disconnect), Q (Quit after disconnect)");
put_line(" E = # of connections (Keep it 2 for now)"); put_line(" E = # of connections (Keep it 2 for now)");
#ifdef __WIN32__ #ifdef __WIN32__
put_line(" eg: ZSNESW /UCCN2 nickname d:\\snesroms 202.36.124.28"); put_line(" eg: ZSNESW /UCCN2 nickname d:\\snesroms 202.36.124.28");
#else #else
put_line(" eg: zsnes /UCCN2 nickname /home/zuser/snesroms 202.36.124.28"); put_line(" eg: zsnes /UCCN2 nickname /home/zuser/snesroms 202.36.124.28");
#endif #endif
#endif #endif
exit(1); exit(1);
} }
@@ -488,7 +488,7 @@ static void handle_params(int argc, char *argv[])
{ {
ZMVRawDump = 1; ZMVRawDump = 1;
} }
else if (tolower(argv[i][1]) == 'o' && tolower(argv[i][2]) == 'm') //Enable MMX support else if (tolower(argv[i][1]) == 'o' && tolower(argv[i][2]) == 'm') //Enable MMX support
{ {
MMXSupport = 1; MMXSupport = 1;
@@ -533,7 +533,7 @@ static void handle_params(int argc, char *argv[])
exit(1); exit(1);
} }
} }
else else
{ {
display_help(); display_help();

View File

@@ -649,7 +649,7 @@ static size_t pad_bit_encoder(unsigned char pad, unsigned char *buffer, size_t s
case 1: case 1:
last_state = zmv_vars.last_joy_state.A; last_state = zmv_vars.last_joy_state.A;
break; break;
case 2: case 2:
last_state = zmv_vars.last_joy_state.B; last_state = zmv_vars.last_joy_state.B;
break; break;
@@ -664,7 +664,7 @@ static size_t pad_bit_encoder(unsigned char pad, unsigned char *buffer, size_t s
case 5: case 5:
last_state = zmv_vars.last_joy_state.E; last_state = zmv_vars.last_joy_state.E;
break; break;
} }
switch (pad) switch (pad)
@@ -674,15 +674,15 @@ static size_t pad_bit_encoder(unsigned char pad, unsigned char *buffer, size_t s
{ {
unsigned int xdata = (zmv_vars.last_joy_state.latchx - 40) & 0xFF; unsigned int xdata = (zmv_vars.last_joy_state.latchx - 40) & 0xFF;
unsigned int ydata = zmv_vars.last_joy_state.latchy & 0xFF; unsigned int ydata = zmv_vars.last_joy_state.latchy & 0xFF;
skip_bits = bit_encoder(last_state, SCOPE_MASK, buffer, skip_bits); skip_bits = bit_encoder(last_state, SCOPE_MASK, buffer, skip_bits);
skip_bits = bit_encoder(xdata, 0x000000FF, buffer, skip_bits); skip_bits = bit_encoder(xdata, 0x000000FF, buffer, skip_bits);
skip_bits = bit_encoder(ydata, 0x000000FF, buffer, skip_bits); skip_bits = bit_encoder(ydata, 0x000000FF, buffer, skip_bits);
break; break;
} }
case 1: case 1:
if ((zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9)))) //Mouse ? if ((zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9)))) //Mouse ?
{ {
skip_bits = bit_encoder(last_state, MOUSE_MASK, buffer, skip_bits); skip_bits = bit_encoder(last_state, MOUSE_MASK, buffer, skip_bits);
@@ -715,7 +715,7 @@ static size_t pad_bit_decoder(unsigned char pad, unsigned char *buffer, size_t s
last_state = &zmv_vars.last_joy_state.A; last_state = &zmv_vars.last_joy_state.A;
input_enable_mask = BIT(0xF); input_enable_mask = BIT(0xF);
break; break;
case 2: case 2:
last_state = &zmv_vars.last_joy_state.B; last_state = &zmv_vars.last_joy_state.B;
input_enable_mask = BIT(0xE); input_enable_mask = BIT(0xE);
@@ -734,7 +734,7 @@ static size_t pad_bit_decoder(unsigned char pad, unsigned char *buffer, size_t s
case 5: case 5:
last_state = &zmv_vars.last_joy_state.E; last_state = &zmv_vars.last_joy_state.E;
input_enable_mask = BIT(0xB); input_enable_mask = BIT(0xB);
break; break;
} }
switch (pad) switch (pad)
@@ -743,7 +743,7 @@ static size_t pad_bit_decoder(unsigned char pad, unsigned char *buffer, size_t s
if ((zmv_vars.inputs_enabled & BIT(0x8))) //Super Scope if ((zmv_vars.inputs_enabled & BIT(0x8))) //Super Scope
{ {
unsigned int xdata, ydata; unsigned int xdata, ydata;
skip_bits = bit_decoder(last_state, SCOPE_MASK, buffer, skip_bits); skip_bits = bit_decoder(last_state, SCOPE_MASK, buffer, skip_bits);
skip_bits = bit_decoder(&xdata, 0x000000FF, buffer, skip_bits); skip_bits = bit_decoder(&xdata, 0x000000FF, buffer, skip_bits);
skip_bits = bit_decoder(&ydata, 0x000000FF, buffer, skip_bits); skip_bits = bit_decoder(&ydata, 0x000000FF, buffer, skip_bits);
@@ -752,10 +752,10 @@ static size_t pad_bit_decoder(unsigned char pad, unsigned char *buffer, size_t s
zmv_vars.last_joy_state.latchx = (unsigned short)(xdata + 40); zmv_vars.last_joy_state.latchx = (unsigned short)(xdata + 40);
zmv_vars.last_joy_state.latchy = (unsigned short)ydata; zmv_vars.last_joy_state.latchy = (unsigned short)ydata;
break; break;
} }
case 1: case 1:
if (zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9))) //Mouse ? if (zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9))) //Mouse ?
{ {
skip_bits = bit_decoder(last_state, MOUSE_MASK, buffer, skip_bits); skip_bits = bit_decoder(last_state, MOUSE_MASK, buffer, skip_bits);
@@ -971,7 +971,7 @@ static void record_pad(unsigned char pad, unsigned char *flag, unsigned char *bu
current_state = JoyAOrig; current_state = JoyAOrig;
bit_mask = BIT(7); bit_mask = BIT(7);
break; break;
case 2: case 2:
last_state = &zmv_vars.last_joy_state.B; last_state = &zmv_vars.last_joy_state.B;
current_state = JoyBOrig; current_state = JoyBOrig;
@@ -994,16 +994,16 @@ static void record_pad(unsigned char pad, unsigned char *flag, unsigned char *bu
last_state = &zmv_vars.last_joy_state.E; last_state = &zmv_vars.last_joy_state.E;
current_state = JoyEOrig; current_state = JoyEOrig;
bit_mask = BIT(3); bit_mask = BIT(3);
break; break;
} }
if ((current_state != *last_state) || if ((current_state != *last_state) ||
((zmv_vars.inputs_enabled & BIT(0x8)) && ((zmv_vars.inputs_enabled & BIT(0x8)) &&
((zmv_vars.last_joy_state.latchx != latchx) || (zmv_vars.last_joy_state.latchy != latchy)))) ((zmv_vars.last_joy_state.latchx != latchx) || (zmv_vars.last_joy_state.latchy != latchy))))
{ {
zmv_vars.last_joy_state.latchx = latchx; zmv_vars.last_joy_state.latchx = latchx;
zmv_vars.last_joy_state.latchy = latchy; zmv_vars.last_joy_state.latchy = latchy;
*last_state = current_state; *last_state = current_state;
*flag |= bit_mask; *flag |= bit_mask;
*skip_bits = pad_bit_encoder(pad, buffer, *skip_bits); *skip_bits = pad_bit_encoder(pad, buffer, *skip_bits);
@@ -1024,13 +1024,13 @@ static void zmv_record(bool pause, unsigned char combos_used, unsigned char slow
zmv_vars.header.key_combos += combos_used; zmv_vars.header.key_combos += combos_used;
debug_input; debug_input;
record_pad(1, &flag, press_buf, &skip_bits); record_pad(1, &flag, press_buf, &skip_bits);
record_pad(2, &flag, press_buf, &skip_bits); record_pad(2, &flag, press_buf, &skip_bits);
record_pad(3, &flag, press_buf, &skip_bits); record_pad(3, &flag, press_buf, &skip_bits);
record_pad(4, &flag, press_buf, &skip_bits); record_pad(4, &flag, press_buf, &skip_bits);
record_pad(5, &flag, press_buf, &skip_bits); record_pad(5, &flag, press_buf, &skip_bits);
if (flag) if (flag)
{ {
unsigned char buffer_used = skip_bits/8 + ((skip_bits&7) ? 1 : 0); unsigned char buffer_used = skip_bits/8 + ((skip_bits&7) ? 1 : 0);
@@ -1225,7 +1225,7 @@ static void replay_pad(unsigned char pad, unsigned char flag, unsigned char *buf
current_state = &JoyAOrig; current_state = &JoyAOrig;
bit_mask = BIT(7); bit_mask = BIT(7);
break; break;
case 2: case 2:
last_state = &zmv_vars.last_joy_state.B; last_state = &zmv_vars.last_joy_state.B;
current_state = &JoyBOrig; current_state = &JoyBOrig;
@@ -1248,7 +1248,7 @@ static void replay_pad(unsigned char pad, unsigned char flag, unsigned char *buf
last_state = &zmv_vars.last_joy_state.E; last_state = &zmv_vars.last_joy_state.E;
current_state = &JoyEOrig; current_state = &JoyEOrig;
bit_mask = BIT(3); bit_mask = BIT(3);
break; break;
} }
if (flag & bit_mask) if (flag & bit_mask)
@@ -1256,7 +1256,7 @@ static void replay_pad(unsigned char pad, unsigned char flag, unsigned char *buf
size_t bits_needed = pad_bit_decoder(pad, buffer, 0); size_t bits_needed = pad_bit_decoder(pad, buffer, 0);
size_t leftover_bits = (8 - (*skip_bits&7)) & 7; size_t leftover_bits = (8 - (*skip_bits&7)) & 7;
bits_needed -= leftover_bits; bits_needed -= leftover_bits;
fread(buffer + (*skip_bits>>3), 1, (bits_needed>>3) + ((bits_needed&7) ? 1 : 0), zmv_vars.fp); fread(buffer + (*skip_bits>>3), 1, (bits_needed>>3) + ((bits_needed&7) ? 1 : 0), zmv_vars.fp);
*skip_bits = pad_bit_decoder(pad, buffer, *skip_bits); *skip_bits = pad_bit_decoder(pad, buffer, *skip_bits);
} }

View File

@@ -299,13 +299,13 @@ void RestoreCVFrame()
if (PauseRewind || EMUPause) if (PauseRewind || EMUPause)
{ {
PauseFrameMode = EMUPause = true; PauseFrameMode = EMUPause = true;
} }
} }
copy_state_data(RewindBufferPos, memcpyrinc, csm_load_rewind); copy_state_data(RewindBufferPos, memcpyrinc, csm_load_rewind);
ClearCacheCheck(); ClearCacheCheck();
RewindTimer = ActualRewindFrames; RewindTimer = ActualRewindFrames;
} }
@@ -601,7 +601,7 @@ void statesaver()
INSERT_POSITION_NUMBER(txtsavemsg, txtsavenum); INSERT_POSITION_NUMBER(txtsavemsg, txtsavenum);
INSERT_POSITION_NUMBER(txtrrsvmsg, txtrrsvnum); INSERT_POSITION_NUMBER(txtrrsvmsg, txtrrsvnum);
//Save State code //Save State code
#ifdef __LINUX__ #ifdef __LINUX__
SRAMChdir(); SRAMChdir();
@@ -856,14 +856,14 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
static unsigned char *txtconvnum = 0; static unsigned char *txtconvnum = 0;
static unsigned char *txtnfndnum = 0; static unsigned char *txtnfndnum = 0;
static unsigned char *txtrrldnum = 0; static unsigned char *txtrrldnum = 0;
//Get the state number //Get the state number
INSERT_POSITION_NUMBER(txtloadmsg, txtloadnum); INSERT_POSITION_NUMBER(txtloadmsg, txtloadnum);
INSERT_POSITION_NUMBER(txtconvmsg, txtconvnum); INSERT_POSITION_NUMBER(txtconvmsg, txtconvnum);
INSERT_POSITION_NUMBER(txtnfndmsg, txtnfndnum); INSERT_POSITION_NUMBER(txtnfndmsg, txtnfndnum);
INSERT_POSITION_NUMBER(txtrrldmsg, txtrrldnum); INSERT_POSITION_NUMBER(txtrrldmsg, txtrrldnum);
#ifdef __LINUX__ #ifdef __LINUX__
SRAMChdir(); SRAMChdir();
#endif #endif
@@ -895,20 +895,20 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
case 2: case 2:
if (mzt_load(statename, false)) if (mzt_load(statename, false))
{ {
Msgptr = txtrrldmsg; Msgptr = txtrrldmsg;
MessageOn = MsgCount; MessageOn = MsgCount;
if (PauseLoad || EMUPause) if (PauseLoad || EMUPause)
{ {
PauseFrameMode = EMUPause = true; PauseFrameMode = EMUPause = true;
} }
} }
else else
{ {
Msgptr = txtnfndmsg; Msgptr = txtnfndmsg;
} }
MessageOn = MsgCount; MessageOn = MsgCount;
return; return;
} }
@@ -922,7 +922,7 @@ void stateloader (unsigned char *statename, unsigned char keycheck, unsigned cha
if (zst_load(fhandle, 0)) if (zst_load(fhandle, 0))
{ {
Msgptr = txtloadmsg; // 'STATE X LOADED.' Msgptr = txtloadmsg; // 'STATE X LOADED.'
if (PauseLoad || EMUPause) if (PauseLoad || EMUPause)
{ {
PauseFrameMode = EMUPause = true; PauseFrameMode = EMUPause = true;