mirror of
https://git.triforceproject.com/triforce/source
synced 2026-12-01 05:18:50 -04:00
Triforce v0.9.0
Character tab, faster renderer defaults, HD rumble shipped, and the 11-30 bug pass: ending softlock below 60 fps, adult first-night lock, Intel Arc robust buffers, adult map, randomizer load order.
This commit is contained in:
36
launcher/Core/GameFiles/OverlaySource.cs
Normal file
36
launcher/Core/GameFiles/OverlaySource.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
// (Triforce, 11-29) A mod's romfs over the game's, as the game sees them both (host/mods.c: a mod's file wins over the game's):
|
||||
// the Character page reads Linkle (a mod: Model/, Tex/, Pack/ ...) this way, so her models and textures come from the mod and
|
||||
// everything she shares with the game from the game. Read-only, like every source.
|
||||
namespace Triforce.Core.GameFiles;
|
||||
|
||||
public sealed class OverlaySource : IGameSource
|
||||
{
|
||||
readonly IGameSource top, bottom;
|
||||
readonly bool ownsTop;
|
||||
|
||||
/// <param name="top">The mod's romfs (its files win).</param>
|
||||
/// <param name="bottom">The game's romfs.</param>
|
||||
/// <param name="ownsTop">Dispose top with this source (bottom is the caller's).</param>
|
||||
public OverlaySource(IGameSource top, IGameSource bottom, bool ownsTop = true)
|
||||
{
|
||||
this.top = top; this.bottom = bottom; this.ownsTop = ownsTop;
|
||||
}
|
||||
|
||||
public string Describe => top.Describe + " over " + bottom.Describe;
|
||||
|
||||
/// <summary>Whether the mod (not the game) has this file.</summary>
|
||||
public bool InTop(string romfsPath) => top.Exists(romfsPath);
|
||||
|
||||
public bool Exists(string romfsPath) => top.Exists(romfsPath) || bottom.Exists(romfsPath);
|
||||
|
||||
public byte[] Read(string romfsPath) => top.Exists(romfsPath) ? top.Read(romfsPath) : bottom.Read(romfsPath);
|
||||
|
||||
public IEnumerable<string> List(string dir) => top.List(dir).Union(bottom.List(dir), StringComparer.Ordinal);
|
||||
|
||||
public string? Stamp(string romfsPath) => top.Exists(romfsPath) ? "mod:" + top.Stamp(romfsPath) : bottom.Stamp(romfsPath);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (ownsTop) top.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user