mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2026-10-11 10:18:00 +08:00
Update from SDK 2013
This commit is contained in:
1 parent
6d5c024820
commit
94b660e16e
7474 files changed
+2597282
-1254065
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import sys
|
||||
|
||||
def main(filename, objname):
|
||||
with open(filename, 'rb') as file:
|
||||
data = file.read()
|
||||
|
||||
output = f"static unsigned char {objname}[] = {{\n "
|
||||
|
||||
for i in range(len(data)):
|
||||
output += f"0x{data[i]:02x},"
|
||||
if i % 20 == 19:
|
||||
output += "\n "
|
||||
|
||||
output += "0x00\n};\n"
|
||||
print(output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 3:
|
||||
print("Usage: python texttoarray.py <filename> <name>")
|
||||
sys.exit(1)
|
||||
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
Reference in new issue
Block a user