A game update used to fail a patch whenever any byte it compared moved, even when only an address in the instruction changed. Patch definitions now say what a change needs and read the rest from the code: - patch.jsonc holds a list of variants, each written for one game build (written_for) with its own locate block and edit; locate.jsonc is merged into it. Exactly one variant must apply, otherwise the patch is left out. GUI script patches use the same variants rule. - expect_original and the bytes to write use the signature syntax, so addresses that differ between builds can be wildcards. - A locate block can capture values at the site (rel32 targets, immediates, displacements); a rel32 fixup fills a hole in the written bytes from a capture. allow-local-host-bot-spawns now jumps to the target of the conditional jump it replaces instead of a stored distance, which makes it apply to 2.61.0.43 as well. - verified_on is gone from the definitions. patches/versions/<version>.jsonc records, per checked game build, which variant of every patch applies and where; scripts/record-game-version.ts writes it and the launcher reads the recorded versions from there. The Python tools (check-patches, patch-exe, check-gui) read the same format; check-patches assembles a variant whose assembly names captures at the site it was located at. Checked: root and launcher type checks; check-patches and check-gui on 2.61.0.37 and 2.61.0.43 (12 exe and 35 GUI patches each); check-patches and check-gui report a deliberately broken patch with a non-zero exit; build-game-copy from 2.61.0.43 into a temporary folder. The computed bytes of allow-local-host-bot-spawns on 2.61.0.37 equal the bytes it stored before. BREAKING CHANGE: Each patch needs a variants list. Move executable locators into patch.jsonc and regenerate game version records with record-game-version.ts.
41 lines
2.1 KiB
TypeScript
41 lines
2.1 KiB
TypeScript
/**
|
|
* The patcher: builds the game copy by pointing the client at the local server
|
|
* and patching the executable. Used by the development script scripts/build-game-copy.ts and by
|
|
* the launcher. The patch definitions, the network hook library and the store pack ids are given
|
|
* by the caller.
|
|
*/
|
|
export {
|
|
buildGameCopy,
|
|
readStockGameFiles,
|
|
type GameCopyBuild,
|
|
type GameCopyFile,
|
|
type GameCopyInputs,
|
|
type StockGameFiles,
|
|
} from './build-game-copy.ts';
|
|
export { NETWORK_CONFIG_PATH, rebuildCharPack, type CharPackResult } from './char-pack.ts';
|
|
export { copyPlayerDecalCache, playerDecalCacheProblem } from './decals/player-decal-cache.ts';
|
|
export { blockingFailures, ESSENTIAL_FEATURES } from './essential-features.ts';
|
|
export { patchExecutable, type ExecutableResult } from './executable.ts';
|
|
export { assertWritableCopy, GAME_FILES, isInSteamLibrary, type WritableCopyOptions } from './game-copy.ts';
|
|
export { executableVersion } from './game-version.ts';
|
|
export { rebuildGuiPack, type AppliedGuiPatch, type GuiPackResult } from './gui-pack.ts';
|
|
export { loadGuiPatches, type GuiScriptEdit, type GuiScriptPatch, type GuiScriptVariant } from './gui-patch-definition.ts';
|
|
export { ENGINE_SETTINGS_PATH, EXTRA_STORE_BUNDLE_GUID_MAP, EXTRA_STORE_BUNDLE_GUIDS, rebuildMainPack, type MainPackResult } from './main-pack.ts';
|
|
export { redirectAddresses, type AddressChange } from './network/address-rewrite.ts';
|
|
export { hostPort, localEndpoint, localUrl, type LocalEndpoint } from './network/local-endpoint.ts';
|
|
export { NETWORK_HOOK_LIBRARY, networkHookSettings } from './network/network-hook.ts';
|
|
export { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts';
|
|
export { patchFeatures, type PatchFeature } from './patch-features.ts';
|
|
export { offlinePackBundleGuids } from './store/offline-bundles.ts';
|
|
export {
|
|
checkGameBuild,
|
|
compareVersions,
|
|
formatVersionRecord,
|
|
loadVersionRecords,
|
|
recordedGameVersions,
|
|
recordFileName,
|
|
type RecordInputs,
|
|
type VersionRecord,
|
|
} from './version-record.ts';
|
|
export { writeGameCopy } from './write-game-copy.ts';
|