-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveSound.cpp
More file actions
68 lines (53 loc) · 1.42 KB
/
RemoveSound.cpp
File metadata and controls
68 lines (53 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define DESCRIPTION "Deletes all mapchunk soundemitters in the ADT."
#define ARGUMENTS "<map filename>"
#define USAGE( minimumArguments, argc, argv ) \
if( argc < minimumArguments + 1 ) \
{ \
printf( " %s\n", argv[0] ); \
printf( " " DESCRIPTION "\n\n" ); \
printf( " Usage: \"%s " ARGUMENTS "\"\n", argv[0] ); \
printf( " Built at: " __DATE__ "\n" ); \
return -1; \
}
struct MCIN
{
unsigned int Offset;
unsigned int Size;
unsigned int Temp1;
unsigned int Temp2;
};
MCIN *Positions;
FILE *Input;
char *File;
unsigned int FileSize;
int main(int argc, char **argv)
{
USAGE( 1, argc, argv );
unsigned int *TInt;
unsigned char *TChar;
unsigned short *TShort;
Input = fopen( argv[1], "rb+" );
fseek( Input, 0, SEEK_END );
FileSize = ftell( Input );
File = new char[ FileSize ]; // And new chunk.
fseek( Input, 0, SEEK_SET );
fread( File, 1, FileSize, Input );
fclose( Input );
Positions = (MCIN *)( File + 0x5C );
for( int i = 0; i < 256; i++ )
{
// delete MCSE
TInt = (unsigned int *)( File + Positions[i].Offset + 0x58+0x8 );
*TInt = 0;
//set nSndEmitters to 0
TInt = (unsigned int *)( File + Positions[i].Offset + 0x5C+0x8 );
*TInt = 0;
}
Input = fopen( argv[1], "wb" );
fwrite( File, 1, FileSize, Input );
fclose( Input );
delete File;
}