-
Notifications
You must be signed in to change notification settings - Fork 3
/
input_config.c
133 lines (115 loc) · 4.43 KB
/
input_config.c
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-License-Identifier: GPL-3.0-or-later
/* gliden64_cache_extract, GLideN64 TexCache Extraction tool for debugging
*
* SPDX-FileCopyrightText: Sven Eckelmann <sven@narfation.org>
*/
#include "gliden64_cache_extract.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
int parse_config(uint32_t config)
{
uint32_t remaining_bits;
const uint32_t highres_bits = HIRESTEXTURES_MASK|TILE_HIRESTEX|FORCE16BPP_HIRESTEX|GZ_HIRESTEXCACHE|LET_TEXARTISTS_FLY|FILE_CACHE_MASK;
const uint32_t tex_bits = FILTER_MASK|ENHANCEMENT_MASK|FORCE16BPP_TEX|GZ_TEXCACHE|FILE_CACHE_MASK;
uint32_t testbits;
switch (globals.type) {
default:
case INPUT_UNKNOWN:
testbits = highres_bits | tex_bits;
break;
case INPUT_HIRES:
testbits = highres_bits;
break;
case INPUT_TEX:
testbits = tex_bits;
break;
};
if (globals.verbose >= VERBOSITY_GLOBAL_HEADER) {
const char *conf_str;
fprintf(stderr, "Config Header:\n");
if ((testbits & HIRESTEXTURES_MASK) == HIRESTEXTURES_MASK) {
if ((config & HIRESTEXTURES_MASK) == NO_HIRESTEXTURES)
conf_str = "0";
else if ((config & HIRESTEXTURES_MASK) == RICE_HIRESTEXTURES)
conf_str = "1";
else
conf_str = "set to an unsupported format";
fprintf(stderr, "\ttxHiresEnable: %s\n", conf_str);
}
if ((testbits & TILE_HIRESTEX) == TILE_HIRESTEX)
fprintf(stderr, "\tghq_hirs_tile: %s\n", (config & TILE_HIRESTEX) ? "True" : "False");
if ((testbits & FORCE16BPP_HIRESTEX) == FORCE16BPP_HIRESTEX)
fprintf(stderr, "\ttxForce16bpp: %s\n", (config & FORCE16BPP_HIRESTEX) ? "True" : "False");
if ((testbits & GZ_HIRESTEXCACHE) == GZ_HIRESTEXCACHE)
fprintf(stderr, "\ttxCacheCompression: %s\n", (config & GZ_HIRESTEXCACHE) ? "True" : "False");
if ((testbits & LET_TEXARTISTS_FLY) == LET_TEXARTISTS_FLY)
fprintf(stderr, "\ttxHiresFullAlphaChannel: %s\n", (config & LET_TEXARTISTS_FLY) ? "True" : "False");
if ((testbits & FILTER_MASK) == FILTER_MASK) {
if ((config & FILTER_MASK) == NO_FILTER)
conf_str = "0";
else if ((config & FILTER_MASK) == SMOOTH_FILTER_1)
conf_str = "1";
else if ((config & FILTER_MASK) == SMOOTH_FILTER_2)
conf_str = "2";
else if ((config & FILTER_MASK) == SMOOTH_FILTER_3)
conf_str = "3";
else if ((config & FILTER_MASK) == SMOOTH_FILTER_4)
conf_str = "4";
else if ((config & FILTER_MASK) == SHARP_FILTER_1)
conf_str = "5";
else if ((config & FILTER_MASK) == SHARP_FILTER_2)
conf_str = "6";
else
conf_str = "set to an unsupported format";
fprintf(stderr, "\ttxFilterMode: %s\n", conf_str);
}
if ((testbits & ENHANCEMENT_MASK) == ENHANCEMENT_MASK) {
if ((config & ENHANCEMENT_MASK) == NO_ENHANCEMENT)
conf_str = "0";
else if ((config & ENHANCEMENT_MASK) == X2_ENHANCEMENT)
conf_str = "2";
else if ((config & ENHANCEMENT_MASK) == X2SAI_ENHANCEMENT)
conf_str = "3";
else if ((config & ENHANCEMENT_MASK) == HQ2X_ENHANCEMENT)
conf_str = "4";
else if ((config & ENHANCEMENT_MASK) == HQ2XS_ENHANCEMENT)
conf_str = "5";
else if ((config & ENHANCEMENT_MASK) == LQ2X_ENHANCEMENT)
conf_str = "6";
else if ((config & ENHANCEMENT_MASK) == LQ2XS_ENHANCEMENT)
conf_str = "7";
else if ((config & ENHANCEMENT_MASK) == HQ4X_ENHANCEMENT)
conf_str = "8";
else if ((config & ENHANCEMENT_MASK) == BRZ2X_ENHANCEMENT)
conf_str = "9";
else if ((config & ENHANCEMENT_MASK) == BRZ3X_ENHANCEMENT)
conf_str = "10";
else if ((config & ENHANCEMENT_MASK) == BRZ4X_ENHANCEMENT)
conf_str = "11";
else if ((config & ENHANCEMENT_MASK) == BRZ5X_ENHANCEMENT)
conf_str = "12";
else
conf_str = "set to an unsupported format";
fprintf(stderr, "\ttxEnhancementMode: %s\n", conf_str);
}
if ((testbits & FORCE16BPP_TEX) == FORCE16BPP_TEX)
fprintf(stderr, "\ttxForce16bpp: %s\n", (config & FORCE16BPP_TEX) ? "True" : "False");
if ((testbits & GZ_TEXCACHE) == GZ_TEXCACHE)
fprintf(stderr, "\ttxCacheCompression: %s\n", (config & GZ_TEXCACHE) ? "True" : "False");
if ((testbits & FILE_CACHE_MASK) == FILE_CACHE_MASK) {
if ((config & FILE_CACHE_MASK) == FILE_TEXCACHE)
conf_str = "texstream";
else if ((config & FILE_CACHE_MASK) == FILE_HIRESTEXCACHE)
conf_str = "hirestexstream";
else
conf_str = "memory cache";
fprintf(stderr, "\tFileCache: %s\n", conf_str);
}
fprintf(stderr, "\n");
}
remaining_bits = config & ~(testbits);
if (remaining_bits)
fprintf(stderr, "Warning: Unknown bits %#"PRIx32" set in config field\n", remaining_bits);
return 0;
}