Commit Graph

84 Commits

Author SHA1 Message Date
0cc88f34da Add support for delta encoding to patch PCKs 2025-11-26 13:52:19 +01:00
42733a2a5c Implement sparse bundle PCK support. 2025-06-26 00:47:25 +02:00
8cb2817976 [PCK] Move directory to the end of file, write exported/saved PCK in place. 2025-06-02 12:54:09 +03:00
5af4bef46f Inline static variables (part 1) 2025-04-29 18:10:44 +02:00
2d0ae77719 add GDSOFTCLASS to FileAccess and DirAccess derived classes 2025-04-09 11:52:50 -07:00
85d3be8070 [FileAccess] Implement get_size and get_access_time methods. 2025-03-09 16:07:00 +02:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Rie
d17ce4c37e Fix "res://" being replaced by resource packs in the editor and on Android 2025-01-15 11:20:46 +01:00
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
a4b17e7852 [FileAccess] Return error codes from store_* methods. 2024-11-29 23:22:31 +02:00
93a21c3efc Fix PackedData::has_path() using wrong path format. 2024-11-13 09:50:10 +02:00
2ac562cdf8 Add ability for PCK patches to remove files
Co-authored-by: Mikael Hermansson <mikael@hermansson.io>
2024-11-11 16:34:37 +01:00
d3be030ea6 Add ability to export patch packs
Co-authored-by: Poq Xert <poqxert@poqxert.ru>
2024-09-25 17:07:28 +02:00
205a10e0ae Reduce code duplication in FileAccess 2024-09-01 12:39:32 +02:00
88b3e68f93 [FileAccess] Implement resize method. 2024-04-12 19:20:49 +03:00
bf8ec7b81b [Export] Use relative file base offset for embedded PCK. 2024-03-06 14:02:01 +02:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
8aa6f29b56 [FileAccess] Add methods to get/set "hidden" and "read-only" attributes on macOS/BSD and Windows. 2023-08-08 21:51:32 +03:00
0fb307720c PCK file path improvements
Fixes godotengine#77317 (Inconsistent PCK file path behaviour).
Simplifies all PCK file paths so that paths with extra '/' symbols in them
still match to the same path.
Fixes various FileAccess methods that didn't work when using PCK paths that
contain extra '/' symbols.
2023-05-22 15:03:05 -03:00
bc95b0b171 Restore FileAccess.close method. 2023-02-16 15:34:20 +02:00
d95794ec8a One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
9f2dc68279 Replace File/Directory with FileAccess/DirAccess 2022-09-19 11:03:31 +02:00
c06025fa13 Add override keywords to DirAccess derived classes 2022-08-02 16:39:44 +01:00
cafb19e608 Add override keywords to FileAccess derived classes 2022-08-02 16:35:15 +01:00
141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
de4c97758a Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
d2ebac3a30 Remove or make private FileAccess close() methods. 2022-04-12 14:50:14 +03:00
9381acb6a4 Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
f851c4aa33 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
9e328bb5b7 Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
7ab34e1a96 Merge pull request #48889 from Calinou/file-rename-endian-swap
Rename File's `endian_swap` to `big_endian`
2021-06-03 15:19:07 +02:00
da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
139a9d6370 Add symlink API to the DirAccess (on macOS and Linux). 2021-05-22 17:33:34 +03:00
12462d9055 Rename File's endian_swap to big_endian
This new name is more consistent with ResourceSaver and StreamPeer.
2021-05-20 14:58:03 +02:00
469fa47e06 Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
1eaaf2f9a2 Separate set.h from map.h 2021-04-14 11:43:45 +02:00
5d8025ec66 Merge pull request #38844 from hbina/patch-5
Avoid copying vector in constructor of PathMD5
2021-02-25 17:49:47 +01:00
b5334d14f7 Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
32464e569f Merge pull request #40748 from RandomShaper/improve_packed_fs_api
Improve/fix packed data API
2020-11-10 10:59:34 +01:00
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
f043eabdd8 Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
2020-09-05 14:53:39 +03:00
c524d50444 added load resource pack with offset feature
updated variables to use size_t

removed line break to make code style more consistent

added conditional check to return an error if offset field is used when loading a ZIP package

fixed typo

formatted file

added commit regarding self contained exe files

handled error loging for load zip file with offset

spelling tweak

updated conditional statement for magic check

udpated error message when load Zip file with offset is called

fix CI

Trying to fix CI

fix CI done

Added error message for loading self-contained exe with offset.

Updated documentation.

Fix indent

final fix indent

Updated documentation.

fix indents

Updated doc based on suggestion

Final fix

fixed format
2020-09-02 17:57:01 -05:00
f38949a44d Improve/fix packed data API
- Enhance directory API
- Fix `FileAccess::exists()` not checking for PackedData being disabled
- Fix moving to the parent directory (`..`)
- Allow absolute paths in existence checks
2020-07-27 12:06:40 +02:00
85220fec01 Style: Remove unnecessary semicolons from core
Semicolons are not necessary after function definitions or control flow
blocks, and having some code use them makes things inconsistent (and
occasionally can mess up `clang-format`'s formatting).

Removing them is tedious work though, I had to do this manually (regex
+ manual review) as I couldn't find a tool for that. All other code
folders would need to get the same treatment.
2020-05-19 15:57:56 +02:00
0fa9ea7095 Avoid copying vector in constructor of PathMD5
Copying the vector is unnecessary here.
2020-05-18 18:52:04 -04:00
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00