-
Notifications
You must be signed in to change notification settings - Fork 2
/
wadcode
executable file
·42 lines (37 loc) · 2.15 KB
/
wadcode
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
#!/usr/bin/python3
# wadcode - WAD compiler/decompiler for WAD resource files
# Copyright (C) 2019-2019 Johannes Bauer
#
# This file is part of wadcode.
#
# wadcode is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; this program is ONLY licensed under
# version 3 of the License, later versions are explicitly excluded.
#
# wadcode is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Johannes Bauer <JohannesBauer@gmx.de>
import sys
from CommandCompile import CommandCompile
from CommandDecompile import CommandDecompile
from MultiCommand import MultiCommand
mc = MultiCommand()
def genparser(parser):
parser.add_argument("--verbose", action = "count", default = 0, help = "Increase verbosity. Can be specified multiple times.")
parser.add_argument("indir", metavar = "directory", type = str, help = "Input directory that should be compiled to a WAD.")
parser.add_argument("outfile", metavar = "wadfile", type = str, help = "Output WAD file that is created after compilation.")
mc.register("compile", "Compile a WAD file from resources", genparser, action = CommandCompile)
def genparser(parser):
parser.add_argument("--no-unpack", action = "store_true", help = "Do not unpack any inner blobs (e.g., convert images to PNG files), extract everything as stored internally.")
parser.add_argument("--verbose", action = "count", default = 0, help = "Increase verbosity. Can be specified multiple times.")
parser.add_argument("infile", metavar = "wadfile", type = str, help = "Input WAD file that is decompiled.")
parser.add_argument("outdir", metavar = "directory", type = str, help = "Input directory in which WAD resources are written.")
mc.register("decompile", "Decompile a WAD file into its resources", genparser, action = CommandDecompile)
mc.run(sys.argv[1:])