Skip to content

[PCKPacker] Add method to add files from buffer. - #108830

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
bruvzg:pck_buf
Jan 26, 2026
Merged

[PCKPacker] Add method to add files from buffer.#108830
Repiteo merged 1 commit into
godotengine:masterfrom
bruvzg:pck_buf

Conversation

@bruvzg

@bruvzg bruvzg commented Jul 21, 2025

Copy link
Copy Markdown
Member

Fixes godotengine/godot-proposals#12806
Also fixes off by one file index in the verbose flush print.

It was problematic before 4.4, since it was storing all files at once at flush, but in 4.5 files are saved immediately, so it makes sense to allow writing from buffer.

@bruvzg bruvzg added this to the 4.6 milestone Jul 21, 2025
@bruvzg
bruvzg requested review from a team as code owners July 21, 2025 13:26

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

Code looks good to me.

This unit test can be added after tests/test_pck_packer.h:102:

CHECK_MESSAGE(
			pck_packer.add_file_from_buffer("buffer/new.txt", String("Hello world!").to_utf8_buffer()) == OK,
			"Adding a file from a buffer to the PCK in a new subdirectory should return an OK error code.");

@bruvzg
bruvzg requested a review from a team as a code owner July 21, 2025 16:51
@bruvzg

bruvzg commented Jul 21, 2025

Copy link
Copy Markdown
Member Author

This unit test can be added after tests/test_pck_packer.h:102

Done.

@sinni800

sinni800 commented Jul 22, 2025

Copy link
Copy Markdown

Many thanks!

EDIT: I'm currently using this productively with great success. Will this still make it into 4.5? Otherwise I'll just keep adding this as a patch onto my own build,

EDIT: I've overlooked that it is 4.6, woops.

@sinni800

Copy link
Copy Markdown

Can this be merged? It's a very low risk change that doesn't really impact anything negatively, anyway.

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to approve this after the unit test was added, and it's here now.

@sinni800

Copy link
Copy Markdown

thank you :)

@akien-mga akien-mga modified the milestones: 4.6, 4.7 Dec 19, 2025
@Repiteo
Repiteo merged commit 105ec00 into godotengine:master Jan 26, 2026
20 checks passed
@Repiteo

Repiteo commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Thanks!

rivie13 pushed a commit to rivie13/Phoenix-Agentic-Engine that referenced this pull request Feb 16, 2026
[PCKPacker] Add method to add files from buffer.
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
[PCKPacker] Add method to add files from buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PCKPacker: Add function to add file using PackedByteArray instead of source filename

5 participants