Move RomFs

This commit is contained in:
Alex Barney 2021-12-18 19:49:31 -07:00
parent aa153980be
commit 34faf2b468
13 changed files with 31 additions and 28 deletions

View File

@ -1,7 +1,7 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.RomFs;
using LibHac.Tools.FsSystem.RomFs;
namespace LibHac.FsSrv.FsCreator;
@ -13,4 +13,4 @@ public class RomFileSystemCreator : IRomFileSystemCreator
outFileSystem.Reset(new RomFsFileSystem(ref romFsStorage));
return Result.Success;
}
}
}

View File

@ -10,8 +10,8 @@ using LibHac.Diag;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.RomFs;
using LibHac.Spl;
using LibHac.Tools.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.NcaUtils;

View File

@ -6,7 +6,7 @@
using System;
using System.Diagnostics;
namespace LibHac;
namespace LibHac.Tools.FsSystem.RomFs;
internal static class HashHelpers
{
@ -103,4 +103,4 @@ internal static class HashHelpers
return min;
}
}
}

View File

@ -2,9 +2,10 @@
using System.Runtime.InteropServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.FsSystem;
using LibHac.Util;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
/// <summary>
/// Represents the file table used by the RomFS format.
@ -384,4 +385,4 @@ public class HierarchicalRomFileTable<T> where T : unmanaged
public int NextSibling;
public T Info;
}
}
}

View File

@ -5,9 +5,10 @@ using System.Linq;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.Util;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
/// <summary>
/// Builds a RomFS from a collection of files.
@ -113,4 +114,4 @@ public class RomFsBuilder
fileLength += table.Length;
}
}
}
}

View File

@ -3,9 +3,10 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using LibHac.Fs;
using LibHac.FsSystem;
using LibHac.Util;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
internal class RomFsDictionary<T> where T : unmanaged
{
@ -296,4 +297,4 @@ internal class RomFsDictionary<T> where T : unmanaged
public int Next;
public int KeyLength;
}
}
}

View File

@ -2,9 +2,10 @@
using System.Text;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.Util;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
public class RomFsDirectory : IDirectory
{
@ -85,4 +86,4 @@ public class RomFsDirectory : IDirectory
return Result.Success;
}
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
internal ref struct RomEntryKey
{
@ -32,9 +32,7 @@ internal ref struct RomEntryKey
}
}
// todo: Change constraint to "unmanaged" after updating to
// a newer SDK https://github.com/dotnet/csharplang/issues/1937
internal ref struct RomKeyValuePair<T> where T : struct
internal ref struct RomKeyValuePair<T> where T : unmanaged
{
public RomEntryKey Key;
public int Offset;
@ -58,4 +56,4 @@ public struct FindPosition
public int NextDirectory;
/// <summary>The ID of the next file to be enumerated.</summary>
public int NextFile;
}
}

View File

@ -3,7 +3,7 @@ using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
public class RomFsFile : IFile
{
@ -67,4 +67,4 @@ public class RomFsFile : IFile
{
return RomFsFileSystem.ConvertRomFsDriverPrivateResult(result);
}
}
}

View File

@ -2,8 +2,9 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.FsSystem.RomFs;
namespace LibHac.Tools.FsSystem.RomFs;
public class RomFsFileSystem : IFileSystem
{
@ -317,4 +318,4 @@ public class RomfsHeader
FileMetaTableSize = func();
DataOffset = func();
}
}
}

View File

@ -1,7 +1,7 @@
using System.IO;
using LibHac.Fs;
using LibHac.FsSystem;
using LibHac.FsSystem.RomFs;
using LibHac.Tools.FsSystem.RomFs;
namespace hactoolnet;
@ -60,4 +60,4 @@ internal static class ProcessFsBuild
ctx.Logger.LogMessage($"Finished writing {ctx.Options.OutFile}");
}
}
}

View File

@ -1,7 +1,7 @@
using System.IO;
using LibHac.Fs;
using LibHac.FsSystem;
using LibHac.FsSystem.RomFs;
using LibHac.Tools.FsSystem.RomFs;
namespace hactoolnet;
@ -42,4 +42,4 @@ internal static class ProcessRomfs
romfs.Extract(ctx.Options.RomfsOutDir, ctx.Logger);
}
}
}
}

View File

@ -1,5 +1,5 @@
using System;
using LibHac.FsSystem.RomFs;
using LibHac.Tools.FsSystem.RomFs;
using Xunit;
namespace LibHac.Tests;
@ -200,4 +200,4 @@ public class RomFsTests
Assert.Equal(itemC2, actualItemC2);
Assert.Equal(itemC3, actualItemC3);
}
}
}