29 #ifndef FILE_ACCESS_PACK_H 30 #define FILE_ACCESS_PACK_H 32 #include "os/file_access.h" 33 #include "os/dir_access.h" 36 #include "print_string.h" 66 bool operator < (
const PathMD5& p_md5)
const {
75 bool operator == (
const PathMD5& p_md5)
const {
76 return a == p_md5.a && b == p_md5.b;
84 a = *((uint64_t*)&p_buf[0]);
85 b = *((uint64_t*)&p_buf[8]);
99 void _free_packed_dirs(PackedDir *p_dir);
104 void add_path(
const String& pkg_path,
const String& path, uint64_t ofs, uint64_t size,
const uint8_t* p_md5,
PackSource* p_src);
106 void set_disabled(
bool p_disabled) { disabled=p_disabled; }
107 _FORCE_INLINE_
bool is_disabled()
const {
return disabled; }
109 static PackedData *get_singleton() {
return singleton; }
110 Error add_pack(
const String& p_path);
113 _FORCE_INLINE_
bool has_path(
const String& p_path);
123 virtual bool try_open_pack(
const String& p_path)=0;
132 virtual bool try_open_pack(
const String &p_path);
145 virtual Error _open(
const String& p_path,
int p_mode_flags);
146 virtual uint64_t _get_modified_time(
const String& p_file) {
return 0; }
151 virtual void close();
152 virtual bool is_open()
const;
154 virtual void seek(
size_t p_position);
155 virtual void seek_end(int64_t p_position=0);
156 virtual size_t get_pos()
const;
157 virtual size_t get_len()
const;
159 virtual bool eof_reached()
const;
161 virtual uint8_t get_8()
const;
164 virtual int get_buffer(uint8_t *p_dst,
int p_length)
const;
166 virtual void set_endian_swap(
bool p_swap);
168 virtual Error get_error()
const;
170 virtual void store_8(uint8_t p_dest);
172 virtual void store_buffer(
const uint8_t *p_src,
int p_length);
174 virtual bool file_exists(
const String& p_name);
185 PathMD5 pmd5(p_path.md5_buffer());
189 if (E->get().offset==0)
192 return E->get().src->get_file(p_path, &E->get());
195 bool PackedData::has_path(
const String& p_path) {
197 return files.has(PathMD5(p_path.md5_buffer()));
204 PackedData::PackedDir *current;
212 virtual bool list_dir_begin();
213 virtual String get_next();
214 virtual bool current_is_dir()
const;
215 virtual bool current_is_hidden()
const;
216 virtual void list_dir_end();
218 virtual int get_drive_count();
219 virtual String get_drive(
int p_drive);
221 virtual Error change_dir(
String p_dir);
222 virtual String get_current_dir();
225 virtual bool file_exists(
String p_file);
226 virtual bool dir_exists(
String p_dir);
228 virtual Error make_dir(
String p_dir);
231 virtual Error
remove(
String p_name);
233 size_t get_space_left();
241 #endif // FILE_ACCESS_PACK_H Definition: file_access_pack.h:46
Definition: file_access_pack.h:119
Definition: file_access_pack.h:40
Definition: file_access_pack.h:128
Definition: file_access_pack.h:201
Definition: file_access_pack.h:137
Definition: file_access.h:40
Definition: dir_access.h:41