-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement collision_resolver for the flat_path_table
- Loading branch information
Showing
6 changed files
with
234 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
LittleEndian(); | ||
|
||
typedef struct { | ||
local int64 pos = FTell(); | ||
uint inode; | ||
uint type; | ||
uint namelen; | ||
uint entsize; | ||
char name[namelen]; | ||
char pad[entsize - (FTell() - pos)]; | ||
} Entry; | ||
|
||
while (!FEof()) | ||
{ | ||
Entry e; | ||
if(ReadInt() == 0) | ||
{ | ||
while(!FEof()){ | ||
FSeek(FTell() + 4); | ||
if(ReadInt() != 0) | ||
{ | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using LibOrbisPkg.GP4; | ||
using LibOrbisPkg.PKG; | ||
using LibOrbisPkg.PFS; | ||
using LibOrbisPkg.SFO; | ||
using LibOrbisPkg.Util; | ||
using System.IO; | ||
using System.IO.MemoryMappedFiles; | ||
|
||
namespace LibOrbisPkgTests | ||
{ | ||
/// <summary> | ||
/// Tests functionality of building PKGs | ||
/// </summary> | ||
[TestClass] | ||
public class PfsTests | ||
{ | ||
[TestMethod] | ||
public void TestFptHasCollision() | ||
{ | ||
var root = TestHelper.MakeRoot(); | ||
root.Files.Add(new FSFile(s => s.Position = s.Position, "AO", 0) { Parent = root }); | ||
root.Files.Add(new FSFile(s => s.Position = s.Position, "B0", 0) { Parent = root }); | ||
Assert.IsTrue(FlatPathTable.HasCollision(root.GetAllChildren())); | ||
} | ||
|
||
[TestMethod] | ||
public void TestFptNoCollision() | ||
{ | ||
var root = TestHelper.MakeRoot(); | ||
root.Files.Add(new FSFile(s => s.Position = s.Position, "AO", 0) { Parent = root }); | ||
root.Files.Add(new FSFile(s => s.Position = s.Position, "B1", 0) { Parent = root }); | ||
Assert.IsFalse(FlatPathTable.HasCollision(root.GetAllChildren())); | ||
} | ||
} | ||
} |
Oops, something went wrong.