diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-12-17 23:21:54 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-12-17 23:22:47 +0100 |
commit | b6d686305596b2c26a89f58237c2b8f162d5ae2b (patch) | |
tree | 6dcafe24ac75151e4088c30094297c3641eaa689 /misc/scripts | |
parent | 7d34d1a85f95edd1b29b8eb24cda49b355db2c3d (diff) |
Remove unused scripts from the `misc/scripts` directory
This also makes `make_icons.sh` executable directly.
Diffstat (limited to 'misc/scripts')
-rwxr-xr-x | misc/scripts/file-hex-array.py | 56 | ||||
-rwxr-xr-x | misc/scripts/fix_style.sh | 2 | ||||
-rw-r--r-- | misc/scripts/make_bmfhdr.py | 67 | ||||
-rw-r--r-- | misc/scripts/make_glwrapper.py | 181 | ||||
-rwxr-xr-x[-rw-r--r--] | misc/scripts/make_icons.sh | 2 | ||||
-rw-r--r-- | misc/scripts/makeargs.py | 82 | ||||
-rw-r--r-- | misc/scripts/memsort.py | 35 |
7 files changed, 3 insertions, 422 deletions
diff --git a/misc/scripts/file-hex-array.py b/misc/scripts/file-hex-array.py deleted file mode 100755 index a6cdfe541f..0000000000 --- a/misc/scripts/file-hex-array.py +++ /dev/null @@ -1,56 +0,0 @@ -import binascii -import os.path -import sys - - -def tof(filepath): - with open(filepath, 'r') as f: - content = f.read() - content = content.replace("0x", "") - content = content.split(',') - for i in range(len(content)): - if len(content[i]) == 1: - content[i] = "0" + content[i] - content = "".join(content) - with open(filepath + ".file", 'wb') as f: - content = f.write(content.decode("hex")) - print(os.path.basename(filepath) + ".file created.") - exit(0) - - -def toa(filepath): - with open(filepath, 'rb') as f: - content = f.read() - content = binascii.hexlify(content) - content = [content[i:i + 2] for i in range(0, len(content), 2)] - content = ",0x".join(content) - content = "0x" + content - content = content.replace("0x00", "0x0") - with open(filepath + ".array", 'w') as f: - content = f.write(content) - print(os.path.basename(filepath) + ".array created.") - exit(0) - - -def usage(): - print("========================================================\n\ -#\n\ -# Usage: python file-hex-array.py [action] [option]\n\ -#\n\ -# Arguments:\n\ -# action ==> toa # convert file to array [option is file path]\n\ -# tof # convert array to file [option is array file path]\n\ -#\n\ -# Example : python file-hex-array.py toa 1.png\n\ -#\n\ -========================================================") - exit(1) - -if len(sys.argv) != 3: - usage() -if sys.argv[1] == "toa" and os.path.isfile(sys.argv[2]): - toa(sys.argv[2]) -elif sys.argv[1] == "tof" and os.path.isfile(sys.argv[2]): - tof(sys.argv[2]) -else: - usage() diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh index 19ca781535..b33cb0a7b4 100755 --- a/misc/scripts/fix_style.sh +++ b/misc/scripts/fix_style.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Command line arguments run_clang_format=false diff --git a/misc/scripts/make_bmfhdr.py b/misc/scripts/make_bmfhdr.py deleted file mode 100644 index 1d3c40f9c6..0000000000 --- a/misc/scripts/make_bmfhdr.py +++ /dev/null @@ -1,67 +0,0 @@ - - -import sys - -if (len(sys.argv) != 2): - print("Pass me a .fnt argument!") - -f = open(sys.argv[1], "rb") - -name = sys.argv[1].lower().replace(".fnt", "") - -l = f.readline() - -font_height = 0 -font_ascent = 0 -font_charcount = 0 -font_chars = [] -font_cc = 0 - -while(l != ""): - - fs = l.strip().find(" ") - if (fs == -1): - l = f.readline() - continue - t = l[0:fs] - - dv = l[fs + 1:].split(" ") - d = {} - for x in dv: - if (x.find("=") == -1): - continue - s = x.split("=") - d[s[0]] = s[1] - - if (t == "common"): - font_height = d["lineHeight"] - font_ascent = d["base"] - - if (t == "char"): - font_chars.append(d["id"]) - font_chars.append(d["x"]) - font_chars.append(d["y"]) - font_chars.append(d["width"]) - font_chars.append(d["height"]) - font_chars.append(d["xoffset"]) - font_chars.append(d["yoffset"]) - font_chars.append(d["xadvance"]) - font_cc += 1 - - l = f.readline() - - -print("static const int _bi_font_" + name + "_height=" + str(font_height) + ";") -print("static const int _bi_font_" + name + "_ascent=" + str(font_ascent) + ";") -print("static const int _bi_font_" + name + "_charcount=" + str(font_cc) + ";") -cstr = "static const int _bi_font_" + name + "_characters={" -for i in range(len(font_chars)): - - c = font_chars[i] - if (i > 0): - cstr += ", " - cstr += c - -cstr += ("};") - -print(cstr) diff --git a/misc/scripts/make_glwrapper.py b/misc/scripts/make_glwrapper.py deleted file mode 100644 index 15b66a950b..0000000000 --- a/misc/scripts/make_glwrapper.py +++ /dev/null @@ -1,181 +0,0 @@ -#! /usr/bin/env python -import sys - -if (len(sys.argv) < 2): - print("usage: make_glwrapper.py <headers>") - sys.exit(255) - - -functions = [] -types = [] -constants = [] - -READ_FUNCTIONS = 0 -READ_TYPES = 1 -READ_CONSTANTS = 2 - -read_what = READ_TYPES - -def read_file(f): - while(True): - - line = f.readline() - if (line == ""): - break - - line = line.replace("\n", "").strip() - """ - if (line.find("[types]")!=-1): - read_what=READ_TYPES - continue - elif (line.find("[constants]")!=-1): - read=READ_TYPES - continue - elif (line.find("[functions]")!=-1): - read_what=READ_FUNCTIONS - continue - """ - - if (line.find("#define") != -1): - if (line.find("0x") == -1 and line.find("GL_VERSION") == -1): - continue - constants.append(line) - elif (line.find("typedef") != -1): - if (line.find("(") != -1 or line.find(")") != -1 or line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("GL") == -1): - continue - types.append(line) - elif (line.find("APIENTRY") != -1 and line.find("GLAPI") != -1): - - if (line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("NV") != -1): - continue - - line = line.replace("APIENTRY", "") - line = line.replace("GLAPI", "") - - glpos = line.find(" gl") - if (glpos == -1): - - glpos = line.find("\tgl") - if (glpos == -1): - continue - - ret = line[:glpos].strip() - - line = line[glpos:].strip() - namepos = line.find("(") - - if (namepos == -1): - continue - - name = line[:namepos].strip() - line = line[namepos:] - - argpos = line.rfind(")") - if (argpos == -1): - continue - - args = line[1:argpos] - - funcdata = {} - funcdata["ret"] = ret - funcdata["name"] = name - funcdata["args"] = args - - functions.append(funcdata) - print(funcdata) - -for path in sys.argv[1:]: - with open(path, "r") as f: - read_file(f) - -# print(types) -# print(constants) -# print(functions) - - -f = open("glwrapper.h", "w") - -f.write("#ifndef GL_WRAPPER\n") -f.write("#define GL_WRAPPER\n\n\n") - -header_code = """\ -#if defined(__gl_h_) || defined(__GL_H__) -#error gl.h included before glwrapper.h -#endif -#if defined(__glext_h_) || defined(__GLEXT_H_) -#error glext.h included before glwrapper.h -#endif -#if defined(__gl_ATI_h_) -#error glATI.h included before glwrapper.h -#endif - -#define __gl_h_ -#define __GL_H__ -#define __glext_h_ -#define __GLEXT_H_ -#define __gl_ATI_h_ - -#define GL_TRUE 1 -#define GL_FALSE 0 - -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_NONE 0 -#define GL_NO_ERROR 0 - -\n\n -""" - -f.write("#include <stddef.h>\n\n\n") - -f.write(header_code) - -f.write("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n") -f.write("#if defined(_WIN32) && !defined(__CYGWIN__)\n") -f.write("#define GLWRP_APIENTRY __stdcall\n") -f.write("#else\n") -f.write("#define GLWRP_APIENTRY \n") -f.write("#endif\n\n") -for x in types: - f.write(x + "\n") - -f.write("\n\n") - -for x in constants: - f.write(x + "\n") - -f.write("\n\n") - -for x in functions: - f.write("extern " + x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ");\n") - f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n") - -f.write("\n\n") -f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n") -f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") - -f.write("#ifdef __cplusplus\n}\n#endif\n") - -f.write("#endif\n\n") -f.close() - -f = open("glwrapper.c", "w") - -f.write("\n\n") -f.write("#include \"glwrapper.h\"\n") -f.write("\n\n") - -for x in functions: - f.write(x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ")=NULL;\n") - -f.write("\n\n") -f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") -f.write("\n") - -for x in functions: - f.write("\t__wrapper_" + x["name"] + "=(" + x["ret"] + " GLWRP_APIENTRY (*)(" + x["args"] + "))wrapperFunc(\"" + x["name"] + "\");\n") - -f.write("\n\n") -f.write("}\n") -f.write("\n\n") -f.close() diff --git a/misc/scripts/make_icons.sh b/misc/scripts/make_icons.sh index 5f3ea40d6a..b590f03d38 100644..100755 --- a/misc/scripts/make_icons.sh +++ b/misc/scripts/make_icons.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Generate .ico, .icns and .zip set of icons for Steam # Make icons with transparent backgrounds and all sizes diff --git a/misc/scripts/makeargs.py b/misc/scripts/makeargs.py deleted file mode 100644 index 26d9cc5a00..0000000000 --- a/misc/scripts/makeargs.py +++ /dev/null @@ -1,82 +0,0 @@ - -text = """ -#define FUNC$numR(m_r,m_func,$argt)\\ - virtual m_r m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - m_r ret;\\ - command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ - return ret;\\ - } else {\\ - return visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numRC(m_r,m_func,$argt)\\ - virtual m_r m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - m_r ret;\\ - command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ - return ret;\\ - } else {\\ - return visual_server->m_func($argp);\\ - }\\ - } - - -#define FUNC$numS(m_func,$argt)\\ - virtual void m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numSC(m_func,$argt)\\ - virtual void m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - - -#define FUNC$num(m_func,$argt)\\ - virtual void m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numC(m_func,$argt)\\ - virtual void m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - - -""" - - -for i in range(1, 8): - - tp = "" - p = "" - t = "" - for j in range(i): - if (j > 0): - tp += ", " - p += ", " - t += ", " - tp += ("m_arg" + str(j + 1) + " p" + str(j + 1)) - p += ("p" + str(j + 1)) - t += ("m_arg" + str(j + 1)) - - t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i)) - print(t) diff --git a/misc/scripts/memsort.py b/misc/scripts/memsort.py deleted file mode 100644 index fb636b0f78..0000000000 --- a/misc/scripts/memsort.py +++ /dev/null @@ -1,35 +0,0 @@ - -import sys - -arg = "memdump.txt" - -if (len(sys.argv) > 1): - arg = sys.argv[1] - -f = open(arg, "rb") - - -l = f.readline() - - -sum = {} -cnt = {} - - -while(l != ""): - - s = l.split("-") - amount = int(s[1]) - what = s[2] - if (what in sum): - sum[what] += amount - cnt[what] += 1 - else: - sum[what] = amount - cnt[what] = 1 - - l = f.readline() - - -for x in sum: - print(x.strip() + "(" + str(cnt[x]) + "):\n: " + str(sum[x])) |