Advertisement
Guest User

CRID (Shift_JIS)

a guest
Jan 27th, 2021
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.08 KB | None | 0 0
  1. diff -upr org/Source.cpp new/Source.cpp
  2. --- org/Source.cpp  2015-07-28 03:05:22.000000000 +0900
  3. +++ new/Source.cpp  2021-01-28 00:00:00.000000000 +0900
  4. @@ -82,6 +82,8 @@ int main(int argc,char *argv[]){
  5.     // コマンドライン解析
  6.     unsigned int count=0;
  7.     char *filenameOut=NULL;
  8. +   bool maskEnabled=true;
  9. +   bool adxDecodeEnabled=true;
  10.     unsigned int ciphKey1=0x207DFFFF;
  11.     unsigned int ciphKey2=0x00B8F21B;
  12.     for(int i=1;i<argc;i++){
  13. @@ -90,6 +92,8 @@ int main(int argc,char *argv[]){
  14.             case 'o':if(i+1<argc){filenameOut=argv[++i];}break;
  15.             case 'a':if(i+1<argc){ciphKey1=atoi16(argv[++i]);}break;
  16.             case 'b':if(i+1<argc){ciphKey2=atoi16(argv[++i]);}break;
  17. +           case 'd':if(i+1<argc){maskEnabled=false;}break;
  18. +           case 'x':if(i+1<argc){adxDecodeEnabled=false;}break;
  19.             }
  20.         }else if(*argv[i]){
  21.             argv[count++]=argv[i];
  22. @@ -122,8 +126,8 @@ int main(int argc,char *argv[]){
  23.  
  24.         printf("%s を分離中...\n",argv[i]);
  25.         DirectoryCreate(filenameOut);
  26. -       clCRID crid(ciphKey1,ciphKey2);
  27. -       if(!crid.Demux(argv[i],filenameOut,true)){
  28. +       clCRID crid(maskEnabled,ciphKey1,ciphKey2);
  29. +       if(!crid.Demux(argv[i],filenameOut,adxDecodeEnabled)){
  30.             printf("Error: 分離に失敗しました。\n");
  31.         }
  32.  
  33. diff -upr org/clCRID.cpp new/clCRID.cpp
  34. --- org/clCRID.cpp  2015-08-02 01:15:54.000000000 +0900
  35. +++ new/clCRID.cpp  2021-01-28 00:00:00.000000000 +0900
  36. @@ -61,8 +61,10 @@ char *FixFilename(char *fix_filename,int
  37.  //--------------------------------------------------
  38.  // コンストラクタ
  39.  //--------------------------------------------------
  40. -clCRID::clCRID(unsigned int ciphKey1,unsigned int ciphKey2):_utf(){
  41. -   InitMask(ciphKey1,ciphKey2);
  42. +clCRID::clCRID(bool maskEnabled,unsigned int ciphKey1,unsigned int ciphKey2):_utf(),_maskEnabled(maskEnabled){
  43. +   if(maskEnabled){
  44. +       InitMask(ciphKey1,ciphKey2);
  45. +   }
  46.  }
  47.  
  48.  //--------------------------------------------------
  49. @@ -197,7 +199,8 @@ bool clCRID::Demux(const char *filename,
  50.                                 char ext[4];
  51.                                 FixFilename(fix_filename,_countof(fix_filename),_utf.GetElement(i,"filename")->GetValueString());
  52.                                 sprintf_s(filename,_countof(filename),"%s\\%s",directory,fix_filename);
  53. -                               if(strcmp(GetExtension(ext,_countof(ext),filename),"wav")!=0)strcat_s(filename,_countof(filename),".wav");
  54. +                               const char *desiredExt=adxDecode?".wav":".adx";
  55. +                               if(strcmp(GetExtension(ext,_countof(ext),filename),desiredExt+1)!=0)strcat_s(filename,_countof(filename),desiredExt);
  56.                                 fopen_s(&fpAudio,filename,"wb");
  57.                             }
  58.                             break;
  59. @@ -214,7 +217,9 @@ bool clCRID::Demux(const char *filename,
  60.         case 0x40534656://@SFV
  61.             {
  62.                 if(info.dataType==0){
  63. -                   MaskVideo(data,size);
  64. +                   if(_maskEnabled){
  65. +                       MaskVideo(data,size);
  66. +                   }
  67.                     if(fpVideo)fwrite(data,size,1,fpVideo);
  68.                 }else if(info.dataType==1||info.dataType==3){
  69.                     clUTF utf;
  70. @@ -228,8 +233,16 @@ bool clCRID::Demux(const char *filename,
  71.         case 0x40534641://@SFA
  72.             {
  73.                 if(info.dataType==0){
  74. -                   MaskAudio(data,size);
  75. -                   if(fpAudio)adx.Decode(fpAudio,data,size,sfaAddress);
  76. +                   if(_maskEnabled){
  77. +                       MaskAudio(data,size);
  78. +                   }
  79. +                   if(fpAudio){
  80. +                       if(adxDecode){
  81. +                           adx.Decode(fpAudio,data,size,sfaAddress);
  82. +                       }else{
  83. +                           fwrite(data,size,1,fpAudio);
  84. +                       }
  85. +                   }
  86.                     sfaAddress+=size;
  87.                 }else if(info.dataType==1||info.dataType==3){
  88.                     clUTF utf;
  89. diff -upr org/clCRID.h new/clCRID.h
  90. --- org/clCRID.h    2015-07-28 02:43:12.000000000 +0900
  91. +++ new/clCRID.h    2021-01-28 00:00:00.000000000 +0900
  92. @@ -10,7 +10,7 @@
  93.  //--------------------------------------------------
  94.  class clCRID{
  95.  public:
  96. -   clCRID(unsigned int ciphKey1=0x207DFFFF,unsigned int ciphKey2=0x00B8F21B);
  97. +   clCRID(bool maskEnabled,unsigned int ciphKey1=0x207DFFFF,unsigned int ciphKey2=0x00B8F21B);
  98.  
  99.     // ロード/開放
  100.     static bool CheckFile(void *data,unsigned int size);
  101. @@ -43,6 +43,7 @@ private:
  102.         unsigned int r1C;            // 不明(0)
  103.     };
  104.     clUTF _utf;
  105. +   bool _maskEnabled;
  106.     unsigned char _videoMask1[0x20];
  107.     unsigned char _videoMask2[0x20];
  108.     unsigned char _audioMask[0x20];
  109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement