forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchfile.I
More file actions
126 lines (116 loc) · 4.52 KB
/
patchfile.I
File metadata and controls
126 lines (116 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Filename: patchfile.I
// Created by: darren, mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
//#include "config_downloader.h"
////////////////////////////////////////////////////////////////////
// Function: Patchfile::get_progress
// Access: Published
// Description: Returns a value in the range 0..1, representing the
// amount of progress through the patchfile, during a
// session.
////////////////////////////////////////////////////////////////////
INLINE PN_stdfloat Patchfile::
get_progress() const {
if (!_initiated) {
express_cat.warning()
<< "Patchfile::get_progress() - Patch has not been initiated" << endl;
return 0.0f;
}
nassertr(_total_bytes_to_process > 0, 0.0f);
return ((PN_stdfloat)_total_bytes_processed / (PN_stdfloat)_total_bytes_to_process);
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::set_allow_multifile
// Access: Published
// Description: 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.
////////////////////////////////////////////////////////////////////
INLINE void Patchfile::
set_allow_multifile(bool allow_multifile) {
_allow_multifile = allow_multifile;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::get_allow_multifile
// Access: Published
// Description: See set_allow_multifile().
////////////////////////////////////////////////////////////////////
INLINE bool Patchfile::
get_allow_multifile() {
return _allow_multifile;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::set_footprint_length
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE void Patchfile::
set_footprint_length(int length) {
nassertv(length > 0);
_footprint_length = length;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::get_footprint_length
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE int Patchfile::
get_footprint_length() {
return _footprint_length;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::reset_footprint_length
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE void Patchfile::
reset_footprint_length() {
_footprint_length = _DEFAULT_FOOTPRINT_LENGTH;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::has_source_hash
// Access: Published
// Description: Returns true if the MD5 hash for the source file is
// known. (Some early versions of the patch file did
// not store this information.)
////////////////////////////////////////////////////////////////////
INLINE bool Patchfile::
has_source_hash() const {
return (_version_number >= 1);
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::get_source_hash
// Access: Published
// Description: Returns the MD5 hash for the source file.
////////////////////////////////////////////////////////////////////
INLINE const HashVal &Patchfile::
get_source_hash() const {
nassertr(has_source_hash(), _MD5_ofSource);
return _MD5_ofSource;
}
////////////////////////////////////////////////////////////////////
// Function: Patchfile::get_result_hash
// Access: Published
// Description: Returns the MD5 hash for the file after the patch has
// been applied.
////////////////////////////////////////////////////////////////////
INLINE const HashVal &Patchfile::
get_result_hash() const {
return _MD5_ofResult;
}