aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp37
-rw-r--r--platform/javascript/export/export.cpp72
2 files changed, 92 insertions, 17 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index c908f6729..40b125e39 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1513,6 +1513,13 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
//export_temp
ep.step("Exporting APK",0);
+
+ bool use_adb_over_usb = bool(EDITOR_DEF("android/use_remote_debug_over_adb",true));
+
+ if (use_adb_over_usb) {
+ p_flags|=EXPORT_REMOTE_DEBUG_LOCALHOST;
+ }
+
String export_to=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport.apk";
Error err = export_project(export_to,true,p_flags);
if (err) {
@@ -1559,6 +1566,35 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
return ERR_CANT_CREATE;
}
+ if (use_adb_over_usb) {
+
+ args.clear();
+ args.push_back("reverse");
+ args.push_back("--remove-all");
+ err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
+
+ int port = Globals::get_singleton()->get("debug/debug_port");
+ args.clear();
+ args.push_back("reverse");
+ args.push_back("tcp:"+itos(port));
+ args.push_back("tcp:"+itos(port));
+
+ err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
+ print_line("Reverse result: "+itos(rv));
+
+ int fs_port = EditorSettings::get_singleton()->get("file_server/port");
+
+ args.clear();
+ args.push_back("reverse");
+ args.push_back("tcp:"+itos(fs_port));
+ args.push_back("tcp:"+itos(fs_port));
+
+ err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
+ print_line("Reverse result2: "+itos(rv));
+
+ }
+
+
ep.step("Running on Device..",3);
args.clear();
args.push_back("-s");
@@ -1724,6 +1760,7 @@ void register_android_exporter() {
//EDITOR_DEF("android/release_username","");
//EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore"));
EDITOR_DEF("android/timestamping_authority_url","");
+ EDITOR_DEF("android/use_remote_debug_over_adb",false);
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>( memnew(EditorExportPlatformAndroid) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index c769d2082..2a92c02d3 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -50,6 +50,7 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform {
PACK_MULTIPLE_FILES
};
+ void _fix_html(Vector<uint8_t>& p_html, const String& p_name, bool p_debug);
PackMode pack_mode;
@@ -58,6 +59,12 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform {
int max_memory;
int version_code;
+ String html_title;
+ String html_head_include;
+ String html_font_family;
+ String html_style_include;
+ bool html_controls_enabled;
+
Ref<ImageTexture> logo;
protected:
@@ -101,6 +108,16 @@ bool EditorExportPlatformJavaScript::_set(const StringName& p_name, const Varian
show_run=p_value;
else if (n=="options/memory_size")
max_memory=p_value;
+ else if (n=="html/title")
+ html_title=p_value;
+ else if (n=="html/head_include")
+ html_head_include=p_value;
+ else if (n=="html/font_family")
+ html_font_family=p_value;
+ else if (n=="html/style_include")
+ html_style_include=p_value;
+ else if (n=="html/controls_enabled")
+ html_controls_enabled=p_value;
else
return false;
@@ -119,6 +136,16 @@ bool EditorExportPlatformJavaScript::_get(const StringName& p_name,Variant &r_re
r_ret=show_run;
else if (n=="options/memory_size")
r_ret=max_memory;
+ else if (n=="html/title")
+ r_ret=html_title;
+ else if (n=="html/head_include")
+ r_ret=html_head_include;
+ else if (n=="html/font_family")
+ r_ret=html_font_family;
+ else if (n=="html/style_include")
+ r_ret=html_style_include;
+ else if (n=="html/controls_enabled")
+ r_ret=html_controls_enabled;
else
return false;
@@ -130,39 +157,47 @@ void EditorExportPlatformJavaScript::_get_property_list( List<PropertyInfo> *p_l
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE,"zip"));
p_list->push_back( PropertyInfo( Variant::INT, "options/memory_size",PROPERTY_HINT_ENUM,"32mb,64mb,128mb,256mb,512mb,1024mb"));
p_list->push_back( PropertyInfo( Variant::BOOL, "browser/enable_run"));
+ p_list->push_back( PropertyInfo( Variant::STRING, "html/title"));
+ p_list->push_back( PropertyInfo( Variant::STRING, "html/head_include",PROPERTY_HINT_MULTILINE_TEXT));
+ p_list->push_back( PropertyInfo( Variant::STRING, "html/font_family"));
+ p_list->push_back( PropertyInfo( Variant::STRING, "html/style_include",PROPERTY_HINT_MULTILINE_TEXT));
+ p_list->push_back( PropertyInfo( Variant::BOOL, "html/controls_enabled"));
+
//p_list->push_back( PropertyInfo( Variant::INT, "resources/pack_mode", PROPERTY_HINT_ENUM,"Copy,Single Exec.,Pack (.pck),Bundles (Optical)"));
}
-static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) {
+void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const String& p_name, bool p_debug) {
String str;
String strnew;
- str.parse_utf8((const char*)html.ptr(),html.size());
+ str.parse_utf8((const char*)p_html.ptr(),p_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";
- }
+ String current_line = lines[i];
+ current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
+ current_line = current_line.replace("$GODOT_FS",p_name+"fs.js");
+ current_line = current_line.replace("$GODOT_MEM",p_name+".mem");
+ current_line = current_line.replace("$GODOT_JS",p_name+".js");
+ current_line = current_line.replace("$GODOT_CANVAS_WIDTH",Globals::get_singleton()->get("display/width"));
+ current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",Globals::get_singleton()->get("display/height"));
+ current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:Globals::get_singleton()->get("application/name"));
+ current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include);
+ current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family);
+ current_line = current_line.replace("$GODOT_STYLE_INCLUDE",html_style_include);
+ current_line = current_line.replace("$GODOT_CONTROLS_ENABLED",html_controls_enabled?"true":"false");
+ current_line = current_line.replace("$GODOT_DEBUG_ENABLED",p_debug?"true":"false");
+ strnew += current_line+"\n";
}
CharString cs = strnew.utf8();
- html.resize(cs.size());
+ p_html.resize(cs.size());
for(int i=9;i<cs.size();i++) {
- html[i]=cs[i];
+ p_html[i]=cs[i];
}
}
@@ -274,7 +309,7 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
if (file=="godot.html") {
- _fix_html(data,p_path.get_file().basename(),1<<(max_memory+5));
+ _fix_html(data,p_path.get_file().basename(), p_debug);
file=p_path.get_file();
}
if (file=="godotfs.js") {
@@ -335,6 +370,9 @@ EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
logo = Ref<ImageTexture>( memnew( ImageTexture ));
logo->create_from_image(img);
max_memory=3;
+ html_title="";
+ html_font_family="arial,sans-serif";
+ html_controls_enabled=true;
pack_mode=PACK_SINGLE_FILE;
}