mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-18 00:27:06 +02:00
With several cosmetic mods installed the game crashed as soon as an equipped custom item came into view, and so on every launch after it was equipped. Cosmetic presets (Engine/Resource/bundle_ref_table.*) - The character bundle-reference table says which bundle holds each preset, under the preset's full path and under its leaf name, one row per hash. Mods number their presets alike in different folders (cust_tops/1_ap, cust_bottoms/1_ap), so two mods can share a leaf name. Adding the second preset threw "collides with an existing lookup", the merge fell back to the highest-priority mod's copy of the table, and every other cosmetic mod's presets were unregistered. The game then built the skater with a preset it could not find and called through a bad pointer. - A preset whose leaf name is taken is now added under its full path only; the leaf name stays with the preset that had it. Only a clash of full paths still fails. MergedTable::shadowed lists each such preset with the one that holds its name. Merge log (Engine/Vfs/mod_merge_combine.cpp) - Each mod with shadowed presets gets a line naming how many and an example pair, so an item that shows the wrong preset can be traced to the mods that clash. Checked against 39 installed mods, 15 of them cosmetic: the table combines 274 presets where it used to keep one mod's, all reachable by full path and 267 by leaf name, with the game's own 6264 rows unchanged. The seven left without a leaf row are a naming clash between the mods themselves (two Carhartt packs, a Zero tee and deck); whether the game finds those by full path is not known. bundle_ref_table_tests takes an optional second mod and checks that two mods' presets are all added, in either order, and that a shared leaf name is reported with the preset that holds it.
47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
#pragma once
|
|
|
|
// A character bundle-reference table (characters/customization/configs/
|
|
// cas_main_bundlereftable and its kind): which bundle to load for each preset,
|
|
// looked up by the FNV-1a hash of the preset's full path and of its leaf name.
|
|
// A cosmetic mod registers each preset it adds with a pair of rows pointing at
|
|
// a bundle the base already lists, so two mods' tables differ from the base
|
|
// only by the presets each added and can be combined exactly.
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace dingosdk::frostbite::bundle_ref {
|
|
|
|
// Resources named *_bundlereftable.
|
|
[[nodiscard]] bool is_table(std::string_view assetName);
|
|
|
|
struct Table {
|
|
std::span<const std::byte> resource;
|
|
std::span<const std::byte> resourceMeta;
|
|
};
|
|
|
|
struct MergedTable {
|
|
std::vector<std::byte> resource;
|
|
std::vector<std::byte> resourceMeta;
|
|
std::size_t added{}; // presets taken from the edits
|
|
std::size_t conflicts{}; // presets two edits put in different bundles; the first won
|
|
// Presets added under their full path only, because another preset already
|
|
// answers to the same leaf name (cust_tops/1_ap and cust_bottoms/1_ap).
|
|
struct Shadowed {
|
|
std::size_t edit{}; // index into `edits`
|
|
std::string path; // the preset left without a leaf lookup
|
|
std::string holder; // the preset its leaf name finds instead
|
|
};
|
|
std::vector<Shadowed> shadowed;
|
|
};
|
|
|
|
// Throws when a copy is not a table of this kind, or an edit changes the base's
|
|
// bundle list or existing rows (anything beyond added presets).
|
|
[[nodiscard]] MergedTable merge(const Table& base, std::span<const Table> edits);
|
|
|
|
} // namespace dingosdk::frostbite::bundle_ref
|