-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFixAllOcean3.0.cpp
69 lines (53 loc) · 1.38 KB
/
FixAllOcean3.0.cpp
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
69
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define DESCRIPTION "Deletes all MCLQ chunks."
#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 );
int depth = 1;
unsigned int *TInt;
unsigned char *TChar;
unsigned short *TShort;
if( argc == 3 )
depth = atoi(argv[2]);
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 MCLQ
TInt = (unsigned int *)( File + Positions[i].Offset + 0x08 );
*TInt = *TInt & ~(28); // b11100 = x1C = 28
}
Input = fopen( argv[1], "wb" );
fwrite( File, 1, FileSize, Input );
fclose( Input );
delete File;
}