(NpaOpener): added LookupGame call to encryption query.

This commit is contained in:
morkt 2016-10-14 12:32:43 +04:00
parent 21652280df
commit c6b37ed763

View File

@ -34,6 +34,7 @@ using System.Runtime.InteropServices;
using GameRes.Compression; using GameRes.Compression;
using GameRes.Formats.Strings; using GameRes.Formats.Strings;
using GameRes.Formats.Properties; using GameRes.Formats.Properties;
using GameRes.Strings;
namespace GameRes.Formats.NitroPlus namespace GameRes.Formats.NitroPlus
{ {
@ -88,6 +89,7 @@ namespace GameRes.Formats.NitroPlus
CHAOSHEAD, CHAOSHEADTR1, CHAOSHEADTR2, MURAMASATR, MURAMASA, SUMAGA, DJANGO, DJANGOTR, CHAOSHEAD, CHAOSHEADTR1, CHAOSHEADTR2, MURAMASATR, MURAMASA, SUMAGA, DJANGO, DJANGOTR,
LAMENTO, SWEETPOOL, SUMAGASP, DEMONBANE, MURAMASAAD, AXANAEL, KIKOKUGAI, SONICOMITR2, LAMENTO, SWEETPOOL, SUMAGASP, DEMONBANE, MURAMASAAD, AXANAEL, KIKOKUGAI, SONICOMITR2,
SUMAGA3P, SONICOMI, LOSTX, LOSTXTRAILER, DRAMATICALMURDER, TOTONO, PHENOMENO, NEKODA, SUMAGA3P, SONICOMI, LOSTX, LOSTXTRAILER, DRAMATICALMURDER, TOTONO, PHENOMENO, NEKODA,
HANACHIRASU
} }
public class NpaOptions : ResourceOptions public class NpaOptions : ResourceOptions
@ -137,7 +139,9 @@ namespace GameRes.Formats.NitroPlus
var game_id = NpaTitleId.NotEncrypted; var game_id = NpaTitleId.NotEncrypted;
if (encrypted) if (encrypted)
{ {
enc = QueryGameEncryption(); enc = QueryGameEncryption (file.Name);
if (null == enc)
throw new OperationCanceledException (garStrings.MsgUnknownEncryption);
game_id = enc.TitleId; game_id = enc.TitleId;
} }
@ -395,10 +399,18 @@ namespace GameRes.Formats.NitroPlus
return new GUI.CreateNPAWidget(); return new GUI.CreateNPAWidget();
} }
EncryptionScheme QueryGameEncryption () EncryptionScheme QueryGameEncryption (string arc_name)
{
EncryptionScheme scheme = null;
var title = FormatCatalog.Instance.LookupGame (arc_name);
if (!string.IsNullOrEmpty (title))
scheme = GetScheme (title);
if (null == scheme)
{ {
var options = Query<NpaOptions> (arcStrings.ArcEncryptedNotice); var options = Query<NpaOptions> (arcStrings.ArcEncryptedNotice);
return options.Scheme; scheme = options.Scheme;
}
return scheme;
} }
public static NpaTitleId GetTitleId (string title) public static NpaTitleId GetTitleId (string title)