mirror of
https://github.com/SabreTools/psxt001z.git
synced 2026-02-04 05:35:55 +00:00
Split into library and executable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
namespace psxt001z
|
||||
{
|
||||
/// <see href="https://github.com/Dremora/psxt001z/blob/master/main.cpp"/>
|
||||
internal class CRC32
|
||||
public class CRC32
|
||||
{
|
||||
private const uint CRC_POLY = 0xEDB88320;
|
||||
|
||||
@@ -7,28 +7,28 @@ namespace psxt001z
|
||||
{
|
||||
internal const int ZERO = 0;
|
||||
|
||||
internal const string VERSION = "v0.21 beta 1";
|
||||
public const string VERSION = "v0.21 beta 1";
|
||||
|
||||
/// <summary>
|
||||
/// BCD to Byte
|
||||
/// </summary>
|
||||
internal static byte BinaryToInteger(byte b) => (byte)(b / 16 * 10 + b % 16);
|
||||
public static byte BinaryToInteger(byte b) => (byte)(b / 16 * 10 + b % 16);
|
||||
|
||||
/// <summary>
|
||||
/// Byte to BCD
|
||||
/// </summary>
|
||||
internal static byte IntegerToBinary(byte i) => (byte)(i / 10 * 16 + i % 10);
|
||||
public static byte IntegerToBinary(byte i) => (byte)(i / 10 * 16 + i % 10);
|
||||
|
||||
/// <summary>
|
||||
/// Get a santized hex string from an input byte array
|
||||
/// </summary>
|
||||
internal static string GetHexString(byte[] bytes) =>
|
||||
public static string GetHexString(byte[] bytes) =>
|
||||
BitConverter.ToString(bytes).Replace("-", string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Get a santized hex string from an input byte array
|
||||
/// </summary>
|
||||
internal static string GetHexString(byte[] bytes, int startIndex, int length) =>
|
||||
public static string GetHexString(byte[] bytes, int startIndex, int length) =>
|
||||
BitConverter.ToString(bytes, startIndex, length).Replace("-", string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
namespace psxt001z
|
||||
{
|
||||
/// <see href="https://github.com/Dremora/psxt001z/blob/master/main.cpp"/>
|
||||
internal class FileTools(Stream file)
|
||||
public class FileTools(Stream file)
|
||||
{
|
||||
private readonly Stream _file = file;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace psxt001z
|
||||
/// <see href="https://github.com/Dremora/psxt001z/blob/master/functions.cpp"/>
|
||||
public partial class LibCrypt
|
||||
{
|
||||
internal static int CalculateEDC(in byte[] src, int srcPtr, int size, int[] edc_lut)
|
||||
public static int CalculateEDC(in byte[] src, int srcPtr, int size, int[] edc_lut)
|
||||
{
|
||||
int edc = 0;
|
||||
while (size-- > 0)
|
||||
@@ -45,7 +45,7 @@ namespace psxt001z
|
||||
buffer[bufferOffset + 2] = IntegerToBinary(frame);
|
||||
}
|
||||
|
||||
internal static bool GetEDC(Stream file)
|
||||
public static bool GetEDC(Stream file)
|
||||
{
|
||||
long currentposition = file.Position;
|
||||
file.Seek(30572, SeekOrigin.Begin);
|
||||
@@ -10,27 +10,27 @@ namespace psxt001z
|
||||
public partial class LibCrypt
|
||||
{
|
||||
// TODO: Implement
|
||||
internal static byte DetectLibCryptDrive(string[] args)
|
||||
public static byte DetectLibCryptDrive(string[] args)
|
||||
{
|
||||
Console.WriteLine("Not implemented, requires direct drive access");
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
internal static byte DetectLibCryptDriveFast(string[] args)
|
||||
public static byte DetectLibCryptDriveFast(string[] args)
|
||||
{
|
||||
Console.WriteLine("Not implemented, requires direct drive access");
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
internal static void ReadSub(byte[] buffer, uint sector, Stream f, byte offset, IntPtr hDevice, ScsiPassThroughDirect SRB)
|
||||
public static void ReadSub(byte[] buffer, uint sector, Stream f, byte offset, IntPtr hDevice, ScsiPassThroughDirect SRB)
|
||||
{
|
||||
Console.WriteLine("Not implemented, requires direct drive access");
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
internal static void ClearCache(byte[] buffer, Stream f, byte offset, IntPtr hDevice, ScsiPassThroughDirect SRB)
|
||||
public static void ClearCache(byte[] buffer, Stream f, byte offset, IntPtr hDevice, ScsiPassThroughDirect SRB)
|
||||
{
|
||||
Console.WriteLine("Not implemented, requires direct drive access");
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace psxt001z
|
||||
{
|
||||
/// <see href="https://github.com/Dremora/psxt001z/blob/master/libcrypt.h"/>
|
||||
internal class ScsiPassThroughDirect
|
||||
public class ScsiPassThroughDirect
|
||||
{
|
||||
public ushort Length { get; set; }
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.IO;
|
||||
namespace psxt001z
|
||||
{
|
||||
/// <see href="https://github.com/Dremora/psxt001z/blob/master/main.cpp"/>
|
||||
internal class Track
|
||||
public class Track
|
||||
{
|
||||
private readonly Stream _file;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Version>0.21-beta2</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Kirill Korolyov , Matt Nadareski</Authors>
|
||||
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
|
||||
<Description>C# port of psxt001z as a library</Description>
|
||||
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2023 Matt Nadareski</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
@@ -22,7 +22,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="" />
|
||||
<None Include="../README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
19
psxt001z.sln
19
psxt001z.sln
@@ -3,20 +3,31 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "psxt001z", "psxt001z.csproj", "{1F3CFA21-FE9A-41C0-9919-712C612DC160}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "psxt001z.Library", "psxt001z.Library\psxt001z.Library.csproj", "{1F3CFA21-FE9A-41C0-9919-712C612DC160}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "psxt001z", "psxt001z\psxt001z.csproj", "{4A7C6E6E-4447-4198-9C97-9F5C4952DB47}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5D42A768-A040-4E6E-BEC9-61CBC81D3582}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.MD = README.MD
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1F3CFA21-FE9A-41C0-9919-712C612DC160}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F3CFA21-FE9A-41C0-9919-712C612DC160}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F3CFA21-FE9A-41C0-9919-712C612DC160}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F3CFA21-FE9A-41C0-9919-712C612DC160}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A7C6E6E-4447-4198-9C97-9F5C4952DB47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A7C6E6E-4447-4198-9C97-9F5C4952DB47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A7C6E6E-4447-4198-9C97-9F5C4952DB47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A7C6E6E-4447-4198-9C97-9F5C4952DB47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
27
psxt001z/psxt001z.csproj
Normal file
27
psxt001z/psxt001z.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>0.21-beta2</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
|
||||
<Description>C# port of psxt001z</Description>
|
||||
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2023 Matt Nadareski</Copyright>
|
||||
<RepositoryUrl>https://github.com/SabreTools/psxt001z</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\psxt001z.Library\psxt001z.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user