diff --git a/ChovySign-CLI/Program.cs b/ChovySign-CLI/Program.cs index e766822..58f4994 100644 --- a/ChovySign-CLI/Program.cs +++ b/ChovySign-CLI/Program.cs @@ -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); diff --git a/ChovySign-CLI/Properties/PublishProfiles/FolderProfile.pubxml.user b/ChovySign-CLI/Properties/PublishProfiles/FolderProfile.pubxml.user index 675644e..2b95831 100644 --- a/ChovySign-CLI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/ChovySign-CLI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2023-04-16T20:22:02.0531219Z; + True|2023-04-16T20:27:16.5281469Z;True|2023-04-17T08:22:02.0531219+12:00; \ No newline at end of file diff --git a/PopsBuilder/Pops/DiscCompressor.cs b/PopsBuilder/Pops/DiscCompressor.cs index 061713b..0537a4b 100644 --- a/PopsBuilder/Pops/DiscCompressor.cs +++ b/PopsBuilder/Pops/DiscCompressor.cs @@ -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); diff --git a/PopsBuilder/Pops/PopsImg.cs b/PopsBuilder/Pops/PopsImg.cs index 680f84b..6d9d1b6 100644 --- a/PopsBuilder/Pops/PopsImg.cs +++ b/PopsBuilder/Pops/PopsImg.cs @@ -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); diff --git a/PopsBuilder/Pops/PsTitleImg.cs b/PopsBuilder/Pops/PsTitleImg.cs index 7327c08..0e4c3e6 100644 --- a/PopsBuilder/Pops/PsTitleImg.cs +++ b/PopsBuilder/Pops/PsTitleImg.cs @@ -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; } diff --git a/PopsBuilder/Psp/NpDrmInfo.cs b/PopsBuilder/Psp/NpDrmInfo.cs index 655464d..e411200 100644 --- a/PopsBuilder/Psp/NpDrmInfo.cs +++ b/PopsBuilder/Psp/NpDrmInfo.cs @@ -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; } } diff --git a/PopsBuilder/Psp/NpUmdImg.cs b/PopsBuilder/Psp/NpUmdImg.cs index 7cb11de..edd6de2 100644 --- a/PopsBuilder/Psp/NpUmdImg.cs +++ b/PopsBuilder/Psp/NpUmdImg.cs @@ -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;