Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions KSPCommunityFixes/Performance/GameDatabasePerf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected override void ApplyPatches()
AddPatch(PatchType.Override, typeof(GameDatabase), nameof(GameDatabase.GetModel));
AddPatch(PatchType.Override, typeof(GameDatabase), nameof(GameDatabase.GetModelIn));
AddPatch(PatchType.Override, typeof(GameDatabase), nameof(GameDatabase.GetModelFile), new[] { typeof(GameObject) });
AddPatch(PatchType.Override, typeof(GameDatabase), nameof(GameDatabase.ExistsModel));
// we don't patch the GetModelFile(string) variant as it would require an additional dictionary,
// is unused in stock and very unlikely to ever be used by anyone.

Expand Down Expand Up @@ -122,6 +123,11 @@ static UrlFile GameDatabase_GetModelFile_Override(GameDatabase gdb, GameObject m
return result;
}

static bool GameDatabase_ExistsModel_Override(GameDatabase gdb, string url)
{
return GameDatabase_GetModelPrefab_Override(gdb, url).IsNotNullRef();
}

internal static int txcallCount;
internal static int txMissCount;

Expand Down