diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/methods.py b/methods.py index 5af6c6aed0..4d3d5ae343 100644 --- a/methods.py +++ b/methods.py @@ -29,7 +29,7 @@ def build_shader_header(target, source, env): name = name.replace(".", "_") fs = open(str(x), "r") - fd = open(str(x) + ".h", "w") + fd = open(str(x) + ".gen.h", "w") fd.write("/* this file has been generated by SCons, do not edit! */\n") fd.write("static const char *" + name + "=\n") line = fs.readline() @@ -192,7 +192,7 @@ def build_glsl_header(filename): fs.close() - out_file = filename + ".h" + out_file = filename + ".gen.h" fd = open(out_file, "w") fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n") @@ -486,7 +486,7 @@ def build_hlsl_dx9_header(filename): fs.close() - out_file = filename + ".h" + out_file = filename + ".gen.h" fd = open(out_file, "w") fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n") @@ -843,7 +843,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): header_data = LegacyGLHeaderStruct() include_file_in_legacygl_header(filename, header_data, 0) - out_file = filename + ".h" + out_file = filename + ".gen.h" fd = open(out_file, "w") enum_constants = [] @@ -858,7 +858,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n") fd.write("#define " + out_file_ifdef + class_suffix + "_120\n") - out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix + out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix fd.write("\n\n") fd.write("#include \"" + include + "\"\n\n\n") fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n") @@ -1165,7 +1165,7 @@ def update_version(): print("Using custom revision: " + rev) import version - f = open("core/version_generated.h", "wb") + f = open("core/version_generated.gen.h", "wb") f.write("#define VERSION_SHORT_NAME " + str(version.short_name) + "\n") f.write("#define VERSION_NAME " + str(version.name) + "\n") f.write("#define VERSION_MAJOR " + str(version.major) + "\n") @@ -1224,7 +1224,7 @@ def build_cg_shader(sname): parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals) - fd = open("shader_" + sname + ".cg.h", "w") + fd = open("shader_" + sname + ".cg.gen.h", "w") fd.write('\n#include "shader_cell.h"\n') fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n") @@ -1299,7 +1299,7 @@ void unregister_module_types() { """ - f = open("modules/register_module_types.cpp", "wb") + f = open("modules/register_module_types.gen.cpp", "wb") f.write(modules_cpp) return module_list @@ -1513,23 +1513,26 @@ def split_lib(self, libname): def save_active_platforms(apnames, ap): for x in ap: - pth = x + "/logo.png" -# print("open path: "+pth) - pngf = open(pth, "rb") - b = pngf.read(1) - str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" - str += " static const unsigned char _" + x[9:] + "_logo[]={" - while(len(b) == 1): - str += hex(ord(b)) - b = pngf.read(1) - if (len(b) == 1): - str += "," - - str += "};\n" + names = ['logo'] + if os.path.isfile(x + "/run_icon.png"): + names.append('run_icon') - wf = x + "/logo.h" - logow = open(wf, "wb") - logow.write(str) + for name in names: + pngf = open(x + "/" + name + ".png", "rb") + b = pngf.read(1) + str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" + str += " static const unsigned char _" + x[9:] + "_" + name + "[]={" + while(len(b) == 1): + str += hex(ord(b)) + b = pngf.read(1) + if (len(b) == 1): + str += "," + + str += "};\n" + + wf = x + "/" + name + ".gen.h" + pngw = open(wf, "wb") + pngw.write(str) def no_verbose(sys, env): |