Add embedded PCK option to PC platforms

The basic point is as in 2.1 (appending the PCK into the executable), but this implementation also patches a dedicated section in the ELF/PE executable so that it matches the appended data perfectly.

The usage of integer types is simplified in existing code; namely, using plain `int` for small quantities.
This commit is contained in:
Pedro J. Estébanez
2019-03-25 20:56:33 +01:00
parent 57b2b275b4
commit 40f4d3cf0f
9 changed files with 329 additions and 26 deletions

View File

@ -240,7 +240,7 @@ public:
Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = NULL);
Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL);
Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL, bool p_embed = false, int64_t *r_embedded_start = NULL, int64_t *r_embedded_size = NULL);
Error save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path);
virtual bool poll_devices() { return false; }
@ -391,6 +391,10 @@ class EditorExportPlatformPC : public EditorExportPlatform {
GDCLASS(EditorExportPlatformPC, EditorExportPlatform);
public:
typedef Error (*FixUpEmbeddedPckFunc)(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size);
private:
Ref<ImageTexture> logo;
String name;
String os_name;
@ -405,6 +409,8 @@ class EditorExportPlatformPC : public EditorExportPlatform {
int chmod_flags;
FixUpEmbeddedPckFunc fixup_embedded_pck_func;
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features);
@ -436,6 +442,9 @@ public:
int get_chmod_flags() const;
void set_chmod_flags(int p_flags);
FixUpEmbeddedPckFunc get_fixup_embedded_pck_func() const;
void set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func);
EditorExportPlatformPC();
};