Fix stuff
This commit is contained in:
parent
fc5e6835ed
commit
9e00f65cb9
|
@ -180,11 +180,11 @@ namespace ChovySign_CLI
|
|||
if (drmInfo is null) return Error("no versionkey was found, exiting", 6);
|
||||
if (pbpMode is null) return Error("no pbp mode was set, exiting", 7);
|
||||
|
||||
if (pbpMode == PbpMode.PSP && drmInfo.KeyType != 2)
|
||||
return Error("KeyType is "+drmInfo.KeyType+", but PBP mode is PSP, you cant do that .. please use a type 1 versionkey.", 8);
|
||||
if (pbpMode == PbpMode.PSP && drmInfo.KeyIndex != 2)
|
||||
return Error("KeyType is "+drmInfo.KeyIndex+", but PBP mode is PSP, you cant do that .. please use a type 1 versionkey.", 8);
|
||||
|
||||
if (pbpMode == PbpMode.POPS && drmInfo.KeyType != 1)
|
||||
return Error("KeyType is " + drmInfo.KeyType + ", but PBP mode is POPS, you cant do that .. please use a type 1 versionkey.", 8);
|
||||
if (pbpMode == PbpMode.POPS && drmInfo.KeyIndex != 1)
|
||||
return Error("KeyType is " + drmInfo.KeyIndex + ", but PBP mode is POPS, you cant do that .. please use a type 1 versionkey.", 8);
|
||||
|
||||
if (pbpMode == PbpMode.POPS && (popsDiscName is null || popsIcon0File is null)) return Error("pbp mode is POPS, but you have not specified a disc title or icon file using --pops-info.", 9);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-04-16T20:22:02.0531219Z;</History>
|
||||
<History>True|2023-04-16T20:27:16.5281469Z;True|2023-04-17T08:22:02.0531219+12:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -76,7 +76,7 @@ namespace GameBuilder.Pops
|
|||
int headerSize = DNASHelper.CalculateSize(isoHdr.Length, 0x400);
|
||||
byte[] headerEnc = new byte[headerSize];
|
||||
|
||||
int sz = DNASHelper.Encrypt(headerEnc, isoHdr, srcImg.DrmInfo.VersionKey, isoHdr.Length, srcImg.DrmInfo.KeyType, 1, blockSize: 0x400);
|
||||
int sz = DNASHelper.Encrypt(headerEnc, isoHdr, srcImg.DrmInfo.VersionKey, isoHdr.Length, srcImg.DrmInfo.KeyIndex, 1, blockSize: 0x400);
|
||||
byte[] isoHdrPgd = headerEnc.ToArray();
|
||||
Array.Resize(ref isoHdrPgd, sz);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace GameBuilder.Pops
|
|||
byte[] simpleEnc = new byte[simpleSz];
|
||||
|
||||
// get pgd
|
||||
int sz = DNASHelper.Encrypt(simpleEnc, simpleData, DrmInfo.VersionKey, simpleData.Length, DrmInfo.KeyType, 1, blockSize: 0x400);
|
||||
int sz = DNASHelper.Encrypt(simpleEnc, simpleData, DrmInfo.VersionKey, simpleData.Length, DrmInfo.KeyIndex, 1, blockSize: 0x400);
|
||||
byte[] pgd = simpleEnc.ToArray();
|
||||
Array.Resize(ref pgd, sz);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace GameBuilder.Pops
|
|||
int encryptedSz = DNASHelper.CalculateSize(isoMapBuf.Length, 1024);
|
||||
var isoMapEnc = new byte[encryptedSz];
|
||||
|
||||
DNASHelper.Encrypt(isoMapEnc, isoMapBuf, DrmInfo.VersionKey, isoMapBuf.Length, DrmInfo.KeyType, 1);
|
||||
DNASHelper.Encrypt(isoMapEnc, isoMapBuf, DrmInfo.VersionKey, isoMapBuf.Length, DrmInfo.KeyIndex, 1);
|
||||
|
||||
return isoMapEnc;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@ namespace GameBuilder.Psp
|
|||
{
|
||||
public string ContentId;
|
||||
public byte[] VersionKey;
|
||||
public int KeyType;
|
||||
public int KeyIndex;
|
||||
|
||||
public NpDrmInfo(byte[] versionKey, string contentId, int keyType)
|
||||
{
|
||||
this.VersionKey = versionKey;
|
||||
this.KeyType = keyType;
|
||||
this.KeyIndex = keyType;
|
||||
this.ContentId = contentId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace GameBuilder.Psp
|
|||
private void createNpHdr()
|
||||
{
|
||||
npHdrUtil.WriteStr("NPUMDIMG");
|
||||
npHdrUtil.WriteInt32(DrmInfo.KeyType);
|
||||
npHdrUtil.WriteInt32(DrmInfo.KeyIndex);
|
||||
npHdrUtil.WriteInt32(BLOCK_BASIS);
|
||||
npHdrUtil.WriteStrWithPadding(DrmInfo.ContentId, 0x00, 0x30);
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace GameBuilder.Psp
|
|||
dataPspUtil.WriteBytes(signature);
|
||||
dataPspUtil.WritePadding(0x00, 0x530);
|
||||
dataPspUtil.WriteStrWithPadding(DrmInfo.ContentId, 0x00, 0x30);
|
||||
dataPspUtil.WriteInt32BE(DrmInfo.KeyType);
|
||||
dataPspUtil.WriteInt32BE(DrmInfo.KeyIndex);
|
||||
dataPspUtil.WriteInt32(0);
|
||||
dataPspUtil.WriteInt32(0);
|
||||
dataPspUtil.WriteInt32(0);
|
||||
|
@ -198,7 +198,7 @@ namespace GameBuilder.Psp
|
|||
private byte[] encryptBlock(byte[] blockData, int offset)
|
||||
{
|
||||
AMCTRL.CIPHER_KEY ckey = new AMCTRL.CIPHER_KEY();
|
||||
AMCTRL.sceDrmBBCipherInit(out ckey, 1, DrmInfo.KeyType, headerKey, DrmInfo.VersionKey, offset >> 4);
|
||||
AMCTRL.sceDrmBBCipherInit(out ckey, 1, DrmInfo.KeyIndex, headerKey, DrmInfo.VersionKey, offset >> 4);
|
||||
AMCTRL.sceDrmBBCipherUpdate(ref ckey, blockData, blockData.Length);
|
||||
AMCTRL.sceDrmBBCipherFinal(ref ckey);
|
||||
return blockData;
|
||||
|
@ -262,7 +262,7 @@ namespace GameBuilder.Psp
|
|||
private byte[] encryptHeader(byte[] headerBytes)
|
||||
{
|
||||
AMCTRL.CIPHER_KEY ckey = new AMCTRL.CIPHER_KEY();
|
||||
AMCTRL.sceDrmBBCipherInit(out ckey, 1, DrmInfo.KeyType, headerKey, DrmInfo.VersionKey, 0);
|
||||
AMCTRL.sceDrmBBCipherInit(out ckey, 1, DrmInfo.KeyIndex, headerKey, DrmInfo.VersionKey, 0);
|
||||
AMCTRL.sceDrmBBCipherUpdate(ref ckey, headerBytes, headerBytes.Length);
|
||||
AMCTRL.sceDrmBBCipherFinal(ref ckey);
|
||||
return headerBytes;
|
||||
|
|
Loading…
Reference in New Issue