static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) { String str; String strnew; str.parse_utf8((const char*)html.ptr(),html.size()); Vector<String> lines=str.split("\n"); for(int i=0;i<lines.size();i++) { if (lines[i].find("godot.js")!=-1) { strnew+="<script type=\"text/javascript\" src=\""+name+"_filesystem.js\"></script>\n"; strnew+="<script async type=\"text/javascript\" src=\""+name+".js\"></script>\n"; } else if (lines[i].find("var Module")!=-1) { strnew+=lines[i]; strnew+="TOTAL_MEMORY:"+itos(max_memory*1024*1024)+","; } else { strnew+=lines[i]+"\n"; } } CharString cs = strnew.utf8(); html.resize(cs.size()); for(int i=9;i<cs.size();i++) { html[i]=cs[i]; } }
static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) { String str; String strnew; str.parse_utf8((const char*)html.ptr(),html.size()); Vector<String> lines=str.split("\n"); for(int i=0; i<lines.size(); i++) { if (lines[i].find("$GODOTTMEM")!=-1) { strnew+=lines[i].replace("$GODOTTMEM",itos(max_memory*1024*1024))+"\n"; } else if (lines[i].find("$GODOTFS")!=-1) { strnew+=lines[i].replace("$GODOTFS",name+"fs.js")+"\n"; } else if (lines[i].find("$GODOTMEM")!=-1) { strnew+=lines[i].replace("$GODOTMEM",name+".mem")+"\n"; } else if (lines[i].find("$GODOTJS")!=-1) { strnew+=lines[i].replace("$GODOTJS",name+".js")+"\n"; } else { strnew+=lines[i]+"\n"; } } CharString cs = strnew.utf8(); html.resize(cs.size()); for(int i=9; i<cs.size(); i++) { html[i]=cs[i]; } }
static void _fix_files(Vector<uint8_t>& html,uint64_t p_data_size) { String str; String strnew; str.parse_utf8((const char*)html.ptr(),html.size()); Vector<String> lines=str.split("\n"); for(int i=0;i<lines.size();i++) { if (lines[i].find("$DPLEN")!=-1) { strnew+=lines[i].replace("$DPLEN",itos(p_data_size)); } else { strnew+=lines[i]+"\n"; } } CharString cs = strnew.utf8(); html.resize(cs.size()); for(int i=9;i<cs.size();i++) { html[i]=cs[i]; } }
void EditorExportPlatformOSX::_fix_plist(Vector<uint8_t>& plist,const String& p_binary) { String str; String strnew; str.parse_utf8((const char*)plist.ptr(),plist.size()); Vector<String> lines=str.split("\n"); for(int i=0;i<lines.size();i++) { if (lines[i].find("$binary")!=-1) { strnew+=lines[i].replace("$binary",p_binary)+"\n"; } else if (lines[i].find("$name")!=-1) { strnew+=lines[i].replace("$name",p_binary)+"\n"; } else if (lines[i].find("$info")!=-1) { strnew+=lines[i].replace("$info",info)+"\n"; } else if (lines[i].find("$identifier")!=-1) { strnew+=lines[i].replace("$identifier",identifier)+"\n"; } else if (lines[i].find("$short_version")!=-1) { strnew+=lines[i].replace("$short_version",short_version)+"\n"; } else if (lines[i].find("$version")!=-1) { strnew+=lines[i].replace("$version",version)+"\n"; } else if (lines[i].find("$signature")!=-1) { strnew+=lines[i].replace("$signature",signature)+"\n"; } else if (lines[i].find("$copyright")!=-1) { strnew+=lines[i].replace("$copyright",copyright)+"\n"; } else if (lines[i].find("$highres")!=-1) { strnew+=lines[i].replace("$highres",high_resolution?"<true/>":"<false/>")+"\n"; } else { strnew+=lines[i]+"\n"; } } CharString cs = strnew.utf8(); plist.resize(cs.size()); for(int i=9;i<cs.size();i++) { plist[i]=cs[i]; } }
void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist, const String &p_binary) { String str; String strnew; str.parse_utf8((const char *)plist.ptr(), plist.size()); Vector<String> lines = str.split("\n"); for (int i = 0; i < lines.size(); i++) { if (lines[i].find("$binary") != -1) { strnew += lines[i].replace("$binary", p_binary) + "\n"; } else if (lines[i].find("$name") != -1) { strnew += lines[i].replace("$name", p_binary) + "\n"; } else if (lines[i].find("$info") != -1) { strnew += lines[i].replace("$info", p_preset->get("application/info")) + "\n"; } else if (lines[i].find("$identifier") != -1) { strnew += lines[i].replace("$identifier", p_preset->get("application/identifier")) + "\n"; } else if (lines[i].find("$short_version") != -1) { strnew += lines[i].replace("$short_version", p_preset->get("application/short_version")) + "\n"; } else if (lines[i].find("$version") != -1) { strnew += lines[i].replace("$version", p_preset->get("application/version")) + "\n"; } else if (lines[i].find("$signature") != -1) { strnew += lines[i].replace("$signature", p_preset->get("application/signature")) + "\n"; } else if (lines[i].find("$copyright") != -1) { strnew += lines[i].replace("$copyright", p_preset->get("application/copyright")) + "\n"; } else if (lines[i].find("$highres") != -1) { strnew += lines[i].replace("$highres", p_preset->get("display/high_res") ? "<true/>" : "<false/>") + "\n"; } else { strnew += lines[i] + "\n"; } } CharString cs = strnew.utf8(); plist.resize(cs.size() - 1); for (int i = 0; i < cs.size() - 1; i++) { plist[i] = cs[i]; } }