<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://fileformats.archiveteam.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://fileformats.archiveteam.org/index.php?action=history&amp;feed=atom&amp;title=UPS_%28binary_patch_format%29</id>
		<title>UPS (binary patch format) - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://fileformats.archiveteam.org/index.php?action=history&amp;feed=atom&amp;title=UPS_%28binary_patch_format%29"/>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;action=history"/>
		<updated>2026-04-22T06:57:38Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=28116&amp;oldid=prev</id>
		<title>Jsummers at 22:03, 4 June 2017</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=28116&amp;oldid=prev"/>
				<updated>2017-06-04T22:03:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:03, 4 June 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 8:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 8:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A UPS patch file starts with the magic number {{magic|&amp;quot;UPS1&amp;quot;}}, followed by the size of the source file and the size of the destination file, both stored as variable-width integers (see below).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A UPS patch file starts with the magic number {{magic|&amp;quot;UPS1&amp;quot;}}, followed by the size of the source file and the size of the destination file, both stored as variable-width integers (see below).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After that, a series of hunks follows. Each hunk consists of a variable-width integer indicating the number of bytes which should be skipped (copied verbatim from the source file), followed by a block of bytes which should be XORed with the source file to obtain a corresponding block of bytes in the destination file. The XOR block is terminated with a zero byte; the zero byte also counts against the file pointer. If the source and destination file sizes differ, the source file is treated as if it had an infinite number of zero bytes after its actual last byte.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After that, a series of hunks follows. Each hunk consists of a variable-width integer indicating the number of bytes which should be skipped (copied verbatim from the source file), followed by a block of bytes which should be &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Exclusive Or|&lt;/ins&gt;XORed&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] &lt;/ins&gt;with the source file to obtain a corresponding block of bytes in the destination file. The XOR block is terminated with a zero byte; the zero byte also counts against the file pointer. If the source and destination file sizes differ, the source file is treated as if it had an infinite number of zero bytes after its actual last byte.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;At the end of the file, there are three [[CRC-32|CRC32]] checksums: of the source file, of the destination file, and of the patch (i.e. everything in the patch before this final checksum itself). Each checksum is stored as a little-endian 32-bit integer.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;At the end of the file, there are three [[CRC-32|CRC32]] checksums: of the source file, of the destination file, and of the patch (i.e. everything in the patch before this final checksum itself). Each checksum is stored as a little-endian 32-bit integer.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jsummers</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22921&amp;oldid=prev</id>
		<title>Jsummers at 21:33, 24 June 2015</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22921&amp;oldid=prev"/>
				<updated>2015-06-24T21:33:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:33, 24 June 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After that, a series of hunks follows. Each hunk consists of a variable-width integer indicating the number of bytes which should be skipped (copied verbatim from the source file), followed by a block of bytes which should be XORed with the source file to obtain a corresponding block of bytes in the destination file. The XOR block is terminated with a zero byte; the zero byte also counts against the file pointer. If the source and destination file sizes differ, the source file is treated as if it had an infinite number of zero bytes after its actual last byte.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After that, a series of hunks follows. Each hunk consists of a variable-width integer indicating the number of bytes which should be skipped (copied verbatim from the source file), followed by a block of bytes which should be XORed with the source file to obtain a corresponding block of bytes in the destination file. The XOR block is terminated with a zero byte; the zero byte also counts against the file pointer. If the source and destination file sizes differ, the source file is treated as if it had an infinite number of zero bytes after its actual last byte.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;At the end of the file, there are three CRC32 checksums: of the source file, of the destination file, and of the patch (i.e. everything in the patch before this final checksum itself). Each checksum is stored as a little-endian 32-bit integer.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;At the end of the file, there are three &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[CRC-32|&lt;/ins&gt;CRC32&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] &lt;/ins&gt;checksums: of the source file, of the destination file, and of the patch (i.e. everything in the patch before this final checksum itself). Each checksum is stored as a little-endian 32-bit integer.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Variable-width integers ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Variable-width integers ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jsummers</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22866&amp;oldid=prev</id>
		<title>Felix: I guess this is not applicable after all. This is a complete description.</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22866&amp;oldid=prev"/>
				<updated>2015-06-22T18:50:32Z</updated>
		
		<summary type="html">&lt;p&gt;I guess this is not applicable after all. This is a complete description.&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 18:50, 22 June 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Structure ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Structure ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The following description is based on the source code of VBA-M; it may be incomplete.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A UPS patch file starts with the magic number {{magic|&amp;quot;UPS1&amp;quot;}}, followed by the size of the source file and the size of the destination file, both stored as variable-width integers (see below).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A UPS patch file starts with the magic number {{magic|&amp;quot;UPS1&amp;quot;}}, followed by the size of the source file and the size of the destination file, both stored as variable-width integers (see below).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Felix</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22850&amp;oldid=prev</id>
		<title>Felix: huh. only noticed it now.</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22850&amp;oldid=prev"/>
				<updated>2015-06-19T19:01:05Z</updated>
		
		<summary type="html">&lt;p&gt;huh. only noticed it now.&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 19:01, 19 June 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== External links ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== External links ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://sourceforge.net/p/vbam/code/HEAD/tree/trunk/src/common/Patch.cpp?format=raw Patch.cpp in the VBA-M repository] (contains UPS and IPS patchers)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://sourceforge.net/p/vbam/code/HEAD/tree/trunk/src/common/Patch.cpp?format=raw Patch.cpp in the VBA-M repository] (contains UPS and IPS patchers)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;* [http://www.romhacking.net/documents/392/ Specification at romhacking.net]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Felix</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22849&amp;oldid=prev</id>
		<title>Dan Tobias at 11:43, 19 June 2015</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22849&amp;oldid=prev"/>
				<updated>2015-06-19T11:43:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:43, 19 June 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{FormatInfo&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{FormatInfo&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; | subcat = Archiving&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; | extensions = {{ext|ups}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; | extensions = {{ext|ups}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dan Tobias</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22846&amp;oldid=prev</id>
		<title>Felix: I wasn't sure how to name this. I don't want any clashes with other potential formats named UPS.</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/index.php?title=UPS_(binary_patch_format)&amp;diff=22846&amp;oldid=prev"/>
				<updated>2015-06-19T11:13:05Z</updated>
		
		<summary type="html">&lt;p&gt;I wasn&amp;#039;t sure how to name this. I don&amp;#039;t want any clashes with other potential formats named UPS.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{FormatInfo&lt;br /&gt;
 | extensions = {{ext|ups}}&lt;br /&gt;
}}&lt;br /&gt;
'''UPS''' is a binary patch format. It was designed as a replacement for [[IPS (binary patch format)|IPS]].&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
The following description is based on the source code of VBA-M; it may be incomplete.&lt;br /&gt;
&lt;br /&gt;
A UPS patch file starts with the magic number {{magic|&amp;quot;UPS1&amp;quot;}}, followed by the size of the source file and the size of the destination file, both stored as variable-width integers (see below).&lt;br /&gt;
&lt;br /&gt;
After that, a series of hunks follows. Each hunk consists of a variable-width integer indicating the number of bytes which should be skipped (copied verbatim from the source file), followed by a block of bytes which should be XORed with the source file to obtain a corresponding block of bytes in the destination file. The XOR block is terminated with a zero byte; the zero byte also counts against the file pointer. If the source and destination file sizes differ, the source file is treated as if it had an infinite number of zero bytes after its actual last byte.&lt;br /&gt;
&lt;br /&gt;
At the end of the file, there are three CRC32 checksums: of the source file, of the destination file, and of the patch (i.e. everything in the patch before this final checksum itself). Each checksum is stored as a little-endian 32-bit integer.&lt;br /&gt;
&lt;br /&gt;
=== Variable-width integers ===&lt;br /&gt;
The following C function will read a single variable-width integer in UPS format. (Note lack of error checking; this is just a sample.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static uintmax_t read_vuint(void) {&lt;br /&gt;
	uintmax_t result = 0, shift = 0;&lt;br /&gt;
&lt;br /&gt;
	for (;;) {&lt;br /&gt;
		uint8_t octet = getchar();&lt;br /&gt;
		if (octet &amp;amp; 0x80) {&lt;br /&gt;
			result += (octet &amp;amp; 0x7f) &amp;lt;&amp;lt; shift;&lt;br /&gt;
			break;&lt;br /&gt;
		}&lt;br /&gt;
		result += (octet | 0x80) &amp;lt;&amp;lt; shift;&lt;br /&gt;
		shift += 7;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return result;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://sourceforge.net/p/vbam/code/HEAD/tree/trunk/src/common/Patch.cpp?format=raw Patch.cpp in the VBA-M repository] (contains UPS and IPS patchers)&lt;/div&gt;</summary>
		<author><name>Felix</name></author>	</entry>

	</feed>