nitro-patcher 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,15 +10,17 @@
10
10
 
11
11
  ```sh
12
12
  pnpm add nitro-patcher
13
- npx nitro-patcher original.nds patch.zip patched.nds
13
+ npx nitro-patcher --input original.nds --patch patch.xzp --output patched.nds
14
14
  ```
15
15
 
16
16
  也可以直接运行:
17
17
 
18
18
  ```sh
19
- npx nitro-patcher --json original.nds patch.zip patched.nds
19
+ npx nitro-patcher --json --input original.nds --patch patch.xzp --output patched.nds
20
20
  ```
21
21
 
22
+ 完整说明见 [Wiki](https://github.com/Xzonn/nitro-patcher/wiki)。
23
+
22
24
  ## License
23
25
 
24
26
  GPL v3,见 [LICENSE](LICENSE)。
package/dist/browser.js CHANGED
@@ -16160,9 +16160,15 @@ var createPatch = async (original, modified, options = {}) => {
16160
16160
  if (sourceFiles.has(path) && before.equals(after)) continue;
16161
16161
  if (!sourceFiles.has(path) && !/^(data|overlay)\//.test(path) && !/^overarm[97]\.bin$/.test(path))
16162
16162
  warnings.push(`\u65B0\u589E\u7CFB\u7EDF\u6587\u4EF6\uFF1A${file.path}`);
16163
+ changedFiles++;
16164
+ if (!sourceFiles.has(path) || after.length < 128 * 1024) {
16165
+ entries[file.path] = after;
16166
+ continue;
16167
+ }
16163
16168
  try {
16164
16169
  const delta = await createDelta(before, after);
16165
- if (decodeXdelta(before, delta, options).equals(after)) entries[`xdelta/${file.path}`] = delta;
16170
+ if (delta.length > after.length * 0.8) entries[file.path] = after;
16171
+ else if (decodeXdelta(before, delta, options).equals(after)) entries[`xdelta/${file.path}`] = delta;
16166
16172
  else {
16167
16173
  warnings.push(`\u6587\u4EF6\u5DEE\u5206\u89E3\u7801\u5185\u5BB9\u4E0D\u540C\uFF0C\u5DF2\u4FDD\u5B58\u5B8C\u6574\u66FF\u6362\u5185\u5BB9\uFF1A${file.path}`);
16168
16174
  entries[file.path] = after;
@@ -16171,7 +16177,6 @@ var createPatch = async (original, modified, options = {}) => {
16171
16177
  warnings.push(`\u6587\u4EF6\u5DEE\u5206\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u5DF2\u4FDD\u5B58\u5B8C\u6574\u66FF\u6362\u5185\u5BB9\uFF1A${file.path}\uFF1A${errorMessage(reason)}`);
16172
16178
  entries[file.path] = after;
16173
16179
  }
16174
- changedFiles++;
16175
16180
  }
16176
16181
  const metadata = { ...options.metadata, formatVersion: 2 };
16177
16182
  const inputMd5 = hashDigest("md5", input).toString("hex");