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:
parent
57b2b275b4
commit
40f4d3cf0f
9 changed files with 329 additions and 26 deletions
|
|
@ -343,17 +343,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
return err;
|
||||
}
|
||||
|
||||
// Attempt with exec_name.pck
|
||||
// (This is the usual case when distributing a Godot game.)
|
||||
|
||||
// Based on the OS, it can be the exec path + '.pck' (Linux w/o extension, macOS in .app bundle)
|
||||
// or the exec path's basename + '.pck' (Windows).
|
||||
// We need to test both possibilities as extensions for Linux binaries are optional
|
||||
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
|
||||
|
||||
String exec_path = OS::get_singleton()->get_executable_path();
|
||||
|
||||
if (exec_path != "") {
|
||||
// Attempt with exec_name.pck
|
||||
// (This is the usual case when distributing a Godot game.)
|
||||
|
||||
// Based on the OS, it can be the exec path + '.pck' (Linux w/o extension, macOS in .app bundle)
|
||||
// or the exec path's basename + '.pck' (Windows).
|
||||
// We need to test both possibilities as extensions for Linux binaries are optional
|
||||
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
|
||||
|
||||
bool found = false;
|
||||
|
||||
String exec_dir = exec_path.get_base_dir();
|
||||
|
|
@ -375,6 +375,14 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
}
|
||||
}
|
||||
|
||||
// Attempt with PCK bundled into executable
|
||||
|
||||
if (!found) {
|
||||
if (_load_resource_pack(exec_path)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we opened our package, try and load our project
|
||||
if (found) {
|
||||
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue