summaryrefslogtreecommitdiff
path: root/core/io/file_access_pack.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-15 02:01:39 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-15 02:02:41 -0300
commit9afdb3e0ad5bfbdafe307212f5d4ebcc7c3ac852 (patch)
treed25ef63dfe50d59987b4a611c1d1773185a3e35d /core/io/file_access_pack.cpp
parentb0870e487c6cc68bb0a2cef7174f3f5697667a2e (diff)
-fixed bug in Button now exporting font property
-made GUI Theme editor usable -editor does not allow to export or create .pck in the same path as a project -changed .pck format (lacked support for versioning so couldn't change it), previous was causing crashes and is now incompatible, just re-export. -will not look for .pck files recursively, was causing unexpected behaviors -fixed execution of Godot in paths with non unicode characters in Windows, OSX and Linux.
Diffstat (limited to 'core/io/file_access_pack.cpp')
-rw-r--r--core/io/file_access_pack.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 4ae60947fa..edecbb6a3e 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -31,6 +31,8 @@
#include <stdio.h>
+#define PACK_VERSION 0
+
Error PackedData::add_pack(const String& p_path) {
for (int i=0; i<sources.size(); i++) {
@@ -113,12 +115,12 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
uint32_t magic= f->get_32();
- if (magic != 0x4b435047) {
+ if (magic != 0x43504447) {
//maybe at he end.... self contained exe
f->seek_end();
f->seek( f->get_pos() -4 );
magic = f->get_32();
- if (magic != 0x4b435047) {
+ if (magic != 0x43504447) {
memdelete(f);
return false;
@@ -130,7 +132,7 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
f->seek( f->get_pos() -ds-8 );
magic = f->get_32();
- if (magic != 0x4b435047) {
+ if (magic != 0x43504447) {
memdelete(f);
return false;
@@ -138,10 +140,13 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
}
+ uint32_t version = f->get_32();
uint32_t ver_major = f->get_32();
uint32_t ver_minor = f->get_32();
uint32_t ver_rev = f->get_32();
+ ERR_EXPLAIN("Pack version newer than supported by engine: "+itos(version));
+ ERR_FAIL_COND_V( version > PACK_VERSION, ERR_INVALID_DATA);
ERR_EXPLAIN("Pack created with a newer version of the engine: "+itos(ver_major)+"."+itos(ver_minor)+"."+itos(ver_rev));
ERR_FAIL_COND_V( ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), ERR_INVALID_DATA);