Skip to content

Commit

Permalink
support for embedded bmd in msg.tbl
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanstuck committed Dec 2, 2023
1 parent 9b4e587 commit 86df80d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions p5rpc.modloader/Merging/BmdMerger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,16 @@ await Task.Run(async () =>

private ReadOnlyMemory<byte>? ExtractBmd(byte[] pak, string bmdPathInPak)
{
//TODO: replace msgtbl.bmd in p3p/p4g
int index = 0;
if (bmdPathInPak.Equals(@"battle\friend.bmd", StringComparison.OrdinalIgnoreCase))
index = _game == Game.P4G ? 9 : 16; //idk what index this needs to be

if(index == 0)
if (!bmdPathInPak.Equals(@"battle\msgtbl.bmd", StringComparison.OrdinalIgnoreCase))
return _pakEmulator.GetEntry(new MemoryStream(pak), bmdPathInPak);

var msgTbl = _pakEmulator.GetEntry(new MemoryStream(pak), "battle/MSG.TBL");
if (msgTbl == null)
return null;

return _game == Game.P4G ?
P4GTblPatcher.GetSegment(msgTbl.Value.ToArray(), Persona.Merger.Patching.Tbl.FieldResolvers.P4G.TblType.Message, index) :
P3PTblPatcher.GetSegment(msgTbl.Value.ToArray(), Persona.Merger.Patching.Tbl.FieldResolvers.P3P.TblType.Message, index);
P4GTblPatcher.GetSegment(msgTbl.Value.ToArray(), Persona.Merger.Patching.Tbl.FieldResolvers.P4G.TblType.Message, 4) :
P3PTblPatcher.GetSegment(msgTbl.Value.ToArray(), Persona.Merger.Patching.Tbl.FieldResolvers.P3P.TblType.Message, 4);
}

private async ValueTask CacheBmd(Dictionary<string, List<ICriFsRedirectorApi.BindFileInfo>> pathToFileMap, string route, string[] cpks, List<string> msgPaths, string bindDirectory)
Expand Down

0 comments on commit 86df80d

Please sign in to comment.