# panda3d.core.Patchfile¶

from panda3d.core import Patchfile

class Patchfile

Inheritance diagram

__init__() → None

Create a patch file and initializes internal data

__init__(buffer: Buffer) → None

Create patch file with buffer to patch

build(file_orig: Filename, file_new: Filename, patch_name: Filename) → bool

This implementation uses the “greedy differencing algorithm” described in the masters thesis “Differential Compression: A Generalized Solution for Binary Files” by Randal C. Burns (p.13). For an original file of size M and a new file of size N, this algorithm is O(M) in space and O(M*N) (worst- case) in time. return false on error

readHeader(patch_file: Filename) → int

Opens the patch file for reading, and gets the header information from the file but does not begin to do any real work. This can be used to query the data stored in the patch.

initiate(patch_file: Filename, file: Filename) → int

Set up to apply the patch to the file (original file and patch are destroyed in the process).

initiate(patch_file: Filename, orig_file: Filename, target_file: Filename) → int

Set up to apply the patch to the file. In this form, neither the original file nor the patch file are destroyed.

run() → int

Perform one buffer’s worth of patching Returns EU_ok while patching Returns EU_success when done If error happens will return one of: EU_error_abort : Patching has not been initiated EU_error_file_invalid : file is corrupted EU_error_invalid_checksum : incompatible patch file EU_error_write_file_rename : could not rename file

apply(patch_file: Filename, file: Filename) → bool

Patches the entire file in one call returns true on success and false on error

This version will delete the patch file and overwrite the original file.

apply(patch_file: Filename, orig_file: Filename, target_file: Filename) → bool

Patches the entire file in one call returns true on success and false on error

This version will not delete any files.

getProgress() → float

Returns a value in the range 0..1, representing the amount of progress through the patchfile, during a session.

setAllowMultifile(allow_multifile: bool) → None

If this flag is set true, the Patchfile will make a special case for patching Panda Multifiles, if detected, and attempt to patch them on a subfile-by-subfile basis. If this flag is false, the Patchfile will always patch the file on a full-file basis.

This has effect only when building patches; it is not used for applying patches.

getAllowMultifile() → bool
setFootprintLength(length: int) → None
getFootprintLength() → int
resetFootprintLength() → None
hasSourceHash() → bool

Returns true if the MD5 hash for the source file is known. (Some early versions of the patch file did not store this information.)

getSourceHash() → HashVal

Returns the MD5 hash for the source file.

Return type

HashVal

getResultHash() → HashVal

Returns the MD5 hash for the file after the patch has been applied.

Return type

HashVal

property progress

Returns a value in the range 0..1, representing the amount of progress through the patchfile, during a session.

Return type

float

property allow_multifile
Getter
Setter

If this flag is set true, the Patchfile will make a special case for patching Panda Multifiles, if detected, and attempt to patch them on a subfile-by-subfile basis. If this flag is false, the Patchfile will always patch the file on a full-file basis.

This has effect only when building patches; it is not used for applying patches.

Return type

bool

property footprint_length

Getter Setter

Return type

int

property source_hash

Returns the MD5 hash for the source file.

Return type

HashVal

property result_hash

Returns the MD5 hash for the file after the patch has been applied.

Return type

HashVal