77using System . Text . RegularExpressions ;
88using MPF . Processors . OutputFiles ;
99using SabreTools . Data . Models . Logiqx ;
10+ using SabreTools . Hashing ;
1011using SabreTools . RedumpLib . Data ;
1112#if NET462_OR_GREATER || NETCOREAPP
1213using SharpCompress . Archives ;
@@ -345,7 +346,8 @@ public override void GenerateSubmissionInfo(SubmissionInfo info, MediaType? medi
345346 {
346347 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . DMIHash ] = xgd1DMIHash ?? string . Empty ;
347348 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . PFIHash ] = xgd1PFIHash ?? string . Empty ;
348- info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd1SSHash ?? string . Empty ;
349+ // Don't put raw SS hash from _suppl.dat / _disc.txt in submission info
350+ //info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
349351 }
350352
351353 if ( GetXGDAuxInfo ( $ "{ basePath } _disc.txt", out _ , out _ , out _ , out var xgd1SS ) )
@@ -359,11 +361,33 @@ public override void GenerateSubmissionInfo(SubmissionInfo info, MediaType? medi
359361 {
360362 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . DMIHash ] = xgd1DMIHash ?? string . Empty ;
361363 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . PFIHash ] = xgd1PFIHash ?? string . Empty ;
362- info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd1SSHash ?? string . Empty ;
364+ // Don't put raw SS hash from _suppl.dat / _disc.txt in submission info
365+ //info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
363366 info . Extras . SecuritySectorRanges = xgd1SS ?? string . Empty ;
364367 }
365368 }
366369
370+ string xgd1SSPath = $ "{ basePath } _SS.bin";
371+ string xgd1RawSSPath = $ "{ basePath } _RawSS.bin";
372+ if ( File . Exists ( xgd1SSPath ) && ProcessingTool . IsValidSS ( xgd1SSPath ) )
373+ {
374+ // Save untouched SS
375+ try
376+ {
377+ if ( ! File . Exists ( xgd1RawSSPath ) )
378+ File . Copy ( xgd1SSPath , xgd1RawSSPath ) ;
379+ }
380+ catch { }
381+
382+ // Repair, clean, and validate SS before adding hash to submission info
383+ if ( ProcessingTool . FixSS ( xgd1SSPath , xgd1SSPath ) )
384+ {
385+ string ? xgd1SSCrc = HashTool . GetFileHash ( xgd1SSPath , HashType . CRC32 ) ;
386+ if ( xgd1SSCrc is not null )
387+ info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd1SSCrc . ToUpperInvariant ( ) ;
388+ }
389+ }
390+
367391 break ;
368392
369393 case RedumpSystem . MicrosoftXbox360 :
@@ -387,7 +411,8 @@ public override void GenerateSubmissionInfo(SubmissionInfo info, MediaType? medi
387411 {
388412 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . DMIHash ] = xgd23DMIHash ?? string . Empty ;
389413 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . PFIHash ] = xgd23PFIHash ?? string . Empty ;
390- info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd23SSHash ?? string . Empty ;
414+ // Don't put raw SS hash from _suppl.dat / _disc.txt in submission info
415+ //info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
391416 }
392417
393418 if ( GetXGDAuxInfo ( $ "{ basePath } _disc.txt", out _ , out _ , out _ , out var xgd23SS ) )
@@ -401,11 +426,33 @@ public override void GenerateSubmissionInfo(SubmissionInfo info, MediaType? medi
401426 {
402427 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . DMIHash ] = xgd23DMIHash ?? string . Empty ;
403428 info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . PFIHash ] = xgd23PFIHash ?? string . Empty ;
404- info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd23SSHash ?? string . Empty ;
429+ // Don't put raw SS hash from _suppl.dat / _disc.txt in submission info
430+ //info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
405431 info . Extras . SecuritySectorRanges = xgd23SS ?? string . Empty ;
406432 }
407433 }
408434
435+ string xgd2SSPath = $ "{ basePath } _SS.bin";
436+ string xgd2RawSSPath = $ "{ basePath } _RawSS.bin";
437+ if ( File . Exists ( xgd2SSPath ) && ProcessingTool . IsValidSS ( xgd2SSPath ) )
438+ {
439+ // Save untouched SS
440+ try
441+ {
442+ if ( ! File . Exists ( xgd2RawSSPath ) )
443+ File . Copy ( xgd2SSPath , xgd2RawSSPath ) ;
444+ }
445+ catch { }
446+
447+ // Repair, clean, and validate SS before adding hash to submission info
448+ if ( ProcessingTool . FixSS ( xgd2SSPath , xgd2SSPath ) )
449+ {
450+ string ? xgd2SSCrc = HashTool . GetFileHash ( xgd2SSPath , HashType . CRC32 ) ;
451+ if ( xgd2SSCrc is not null )
452+ info . CommonDiscInfo . CommentsSpecialFields [ SiteCode . SSHash ] = xgd2SSCrc . ToUpperInvariant ( ) ;
453+ }
454+ }
455+
409456 break ;
410457
411458 case RedumpSystem . NamcoSegaNintendoTriforce :
@@ -787,6 +834,9 @@ internal override List<OutputFile> GetOutputFiles(MediaType? mediaType, string?
787834 ? OutputFileFlags . Required | OutputFileFlags . Binary | OutputFileFlags . Zippable
788835 : OutputFileFlags . Binary | OutputFileFlags . Zippable ,
789836 "ss" ) ,
837+ new ( $ "{ outputFilename } _RawSS.bin",
838+ OutputFileFlags . Binary | OutputFileFlags . Zippable ,
839+ "raw_ss" ) ,
790840 ] ;
791841
792842 case MediaType . HDDVD :
0 commit comments