Advertisement
Kurausukun

MSVC

Aug 1st, 2024
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.63 KB | None | 0 0
  1.  
  2. void __thiscall Channel::Update(Channel *this)
  3.  
  4. {
  5.   uchar uVar1;
  6.   Player *pPVar2;
  7.   bool bVar3;
  8.   bool bVar4;
  9.   char cVar5;
  10.   byte bVar6;
  11.   uint uVar7;
  12.   sbyte sVar8;
  13.   ushort uVar9;
  14.   int iVar10;
  15.   undefined4 extraout_EDX;
  16.   uint extraout_EDX_00;
  17.   int unaff_EBX;
  18.   int unaff_ESI;
  19.   int iVar11;
  20.   uint uVar12;
  21.   undefined4 unaff_EDI;
  22.   int iVar13;
  23.   uint uVar14;
  24.   bool bVar15;
  25.   ulonglong in_stack_ffffffd0;
  26.   undefined2 uVar16;
  27.   char cVar17;
  28.  
  29.   uVar16 = (undefined2)(in_stack_ffffffd0 >> 0x30);
  30.   cVar17 = (char)((uint)unaff_EDI >> 8);
  31.   bVar6 = this->state;
  32.   if ((1 < bVar6) && ((this->reg).enable == false)) {
  33.     this->state = '\0';
  34.     this->trackId = -1;
  35.     this->prio = '\0';
  36.     (this->reg).panning = '\0';
  37.     (this->reg).waveDuty = '\0';
  38.     (this->reg).repeatMode = '\0';
  39.     (this->reg).format = '\0';
  40.     (this->reg).volumeMul = '\0';
  41.     (this->reg).volumeDiv = '\0';
  42. LAB_100143b2:
  43.     (this->reg).enable = false;
  44.     this->vol = 0;
  45.     this->sampleHistoryPtr = 0;
  46.     this->noteLength = -1;
  47.     _memset(this->sampleHistory,0,0x80);
  48.     return;
  49.   }
  50.   if (((this->sweepPitch == 0) || (this->sweepLen == 0)) || (this->sweepLen < this->sweepCnt)) {
  51.     bVar3 = false;
  52.   }
  53.   else {
  54.     bVar3 = true;
  55.   }
  56.   uVar1 = this->modDepth;
  57.   bVar15 = uVar1 != '\0';
  58.   if (((((this->flags)._Array[0] & 4) != 0) || (bVar6 == 1)) || (bVar4 = false, bVar3)) {
  59.     bVar4 = true;
  60.   }
  61.   switch(bVar6) {
  62.   case 0:
  63.     goto switchD_10014464_caseD_0;
  64.   case 1:
  65.     uVar12 = (this->tempReg).REPEAT_POINT;
  66.     (this->reg).source = (this->tempReg).SOURCE;
  67.     uVar14 = (this->tempReg).LENGTH;
  68.     (this->reg).length = uVar14;
  69.     (this->reg).panning = '\0';
  70.     (this->reg).waveDuty = '\0';
  71.     (this->reg).repeatMode = '\0';
  72.     (this->reg).format = '\0';
  73.     (this->reg).volumeMul = '\0';
  74.     (this->reg).volumeDiv = '\0';
  75.     (this->reg).enable = false;
  76.     (this->reg).loopStart = uVar12;
  77.     (this->reg).totalLength = uVar14 + uVar12;
  78.     this->ampl = -0x16980;
  79.     this->state = '\x02';
  80.   case 2:
  81.     iVar13 = this->ampl;
  82.     iVar11 = iVar13 >> 7;
  83.     do {
  84.       iVar13 = (uint)this->attackLvl * iVar13;
  85.       iVar10 = (iVar13 >> 0x1f & 0xffU) + iVar13;
  86.       iVar13 = iVar10 >> 8;
  87.     } while (iVar10 >> 0xf == iVar11);
  88.     this->ampl = iVar13;
  89.     if (iVar13 == 0) {
  90.       this->state = '\x03';
  91.     }
  92.     break;
  93.   case 3:
  94.     iVar13 = this->ampl - (uint)this->decayRate;
  95.     this->ampl = iVar13;
  96.     uVar12 = (uint)this->sustainLvl;
  97.     if ((this->sustainLvl & 0x80) != 0) {
  98.       uVar12 = 0x7f;
  99.     }
  100.     iVar11 = *(short *)((int)&`int___cdecl_Cnv_Sust(int)'::`2'::lut + uVar12 * 2) * 0x80;
  101.     if (iVar13 <= iVar11) {
  102.       this->ampl = iVar11;
  103.       this->state = '\x04';
  104.     }
  105.     break;
  106.   case 5:
  107.     this->ampl = this->ampl - (uint)this->releaseRate;
  108.     if (this->ampl < -0x1697f) {
  109.       this->state = '\0';
  110.       this->trackId = -1;
  111.       this->prio = '\0';
  112.       (this->reg).panning = '\0';
  113.       (this->reg).waveDuty = '\0';
  114.       (this->reg).repeatMode = '\0';
  115.       (this->reg).format = '\0';
  116.       (this->reg).volumeMul = '\0';
  117.       (this->reg).volumeDiv = '\0';
  118.       goto LAB_100143b2;
  119.     }
  120.   }
  121.   iVar13 = 0;
  122.   if (uVar1 != '\0') {
  123.     if (this->modDelayCnt < this->modDelay) {
  124.       this->modDelayCnt = this->modDelayCnt + 1;
  125.       bVar15 = false;
  126.     }
  127.     else {
  128.       if (this->modType == '\0') {
  129.         bVar4 = true;
  130.       }
  131.       uVar12 = (uint)(this->modCounter >> 8);
  132.       if (uVar12 < 0x20) {
  133.         cVar5 = *(char *)((int)&`int___cdecl_Cnv_Sine(int)'::`2'::lut + uVar12);
  134.       }
  135.       else if (uVar12 < 0x40) {
  136.         cVar5 = "Application cannot be run in Win32 mode."[0x10 - uVar12];
  137.       }
  138.       else {
  139.         if (uVar12 < 0x60) {
  140.           cVar5 = (&DAT_10028bf8)[uVar12];
  141.         }
  142.         else {
  143.           cVar5 = "Invalid code segment."[0x10 - uVar12];
  144.         }
  145.         cVar5 = -cVar5;
  146.       }
  147.       iVar13 = (uint)this->modRange * (int)cVar5 * (uint)this->modDepth;
  148.       if (this->modType == '\x01') {
  149.         iVar13 = iVar13 * 0x3c >> 0xe;
  150.       }
  151.       else {
  152.         iVar13 = iVar13 >> 8;
  153.       }
  154.       uVar12 = (uint)this->modSpeed * 0x40 + (uint)this->modCounter;
  155.       uVar14 = uVar12 >> 8;
  156.       if (0x7f < uVar14) {
  157.         uVar12 = uVar12 >> 0xf;
  158.         do {
  159.           uVar14 = uVar14 - 0x80;
  160.           uVar12 = uVar12 - 1;
  161.         } while (uVar12 != 0);
  162.       }
  163.       this->modCounter = this->modCounter + (ushort)this->modSpeed * 0x40;
  164.       *(undefined *)((int)&this->modCounter + 1) = 0;
  165.       this->modCounter = this->modCounter | (ushort)(uVar14 << 8);
  166.     }
  167.   }
  168.   if (bVar4) {
  169.     iVar11 = this->extTune;
  170.     if ((bVar15) && (this->modType == '\0')) {
  171.       iVar11 = iVar11 + iVar13;
  172.     }
  173.     if (bVar3) {
  174.       uVar12 = this->sweepLen;
  175.       in_stack_ffffffd0 = (ulonglong)(int)uVar12;
  176.       _alldiv();
  177.       iVar11 = unaff_EBX + uVar12;
  178.       if (this->manualSweep == false) {
  179.         this->sweepCnt = this->sweepCnt + 1;
  180.       }
  181.     }
  182.     uVar9 = (this->tempReg).TIMER;
  183.     if (iVar11 == 0) goto LAB_10014769;
  184.     iVar13 = 0;
  185.     uVar12 = -iVar11;
  186.     if (0 < iVar11) {
  187.       iVar11 = ~uVar12 / 0x300 + 1;
  188.       iVar13 = -iVar11;
  189.       uVar12 = uVar12 + iVar11 * 0x300;
  190.     }
  191.     if (0x2ff < (int)uVar12) {
  192.       iVar13 = iVar13 + uVar12 / 0x300;
  193.     }
  194.     uVar12 = (uint)(this->tempReg).TIMER;
  195.     _allmul();
  196.     uVar14 = iVar13 - 0x10;
  197.     in_stack_ffffffd0 = CONCAT44(extraout_EDX,uVar12);
  198.     if ((int)uVar14 < 1) {
  199.       in_stack_ffffffd0 = in_stack_ffffffd0 >> (ulonglong)-uVar14;
  200. LAB_10014736:
  201.       if ((int)(in_stack_ffffffd0 >> 0x20) != 0) goto LAB_10014764;
  202.       if ((uint)in_stack_ffffffd0 < 0x10) {
  203.         uVar9 = 0x10;
  204.       }
  205.       else {
  206.         uVar9 = (ushort)in_stack_ffffffd0;
  207.         if (0xffff < (uint)in_stack_ffffffd0) goto LAB_10014764;
  208.       }
  209.     }
  210.     else {
  211.       if ((int)uVar14 < 0x20) {
  212.         uVar7 = 0xffffffff;
  213.         _allshl();
  214.         if ((uVar7 & uVar12 | extraout_EDX_00 & (uint)(in_stack_ffffffd0 >> 0x20)) == 0) {
  215.           in_stack_ffffffd0 = in_stack_ffffffd0 << (ulonglong)uVar14;
  216.           goto LAB_10014736;
  217.         }
  218.       }
  219. LAB_10014764:
  220.       uVar9 = 0xffff;
  221.     }
  222. LAB_10014769:
  223.     uVar16 = (undefined2)(in_stack_ffffffd0 >> 0x30);
  224.     pPVar2 = this->ply;
  225.     (this->reg).timer = -uVar9;
  226.     iVar13 = pPVar2->sampleRate * 2;
  227.     (this->reg).sampleIncrease =
  228.          33513982.0 /
  229.          (((double)iVar13 +
  230.           *(double *)(&__xmm@41f00000000000000000000000000000 + (iVar13 >> 0x1f) * -8)) *
  231.          (double)(0x10000 - (uint)(ushort)-uVar9));
  232.     (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffb;
  233.   }
  234.   cVar5 = (char)((ushort)uVar16 >> 8);
  235.   if ((cVar17 != '\0') || (cVar5 != '\0')) {
  236.     uVar12 = (this->tempReg).CR;
  237.     if (cVar17 != '\0') {
  238.       iVar13 = (this->ampl >> 7) + (int)this->velocity + (int)this->extAmpl;
  239.       if (((char)uVar16 != '\0') && (this->modType == '\x01')) {
  240.         iVar13 = iVar13 + unaff_ESI;
  241.       }
  242.       iVar11 = iVar13 + 0x2d3;
  243.       if (iVar11 < 0) {
  244.         uVar12 = uVar12 & 0xfffffc80 | 0x300;
  245.       }
  246.       else if (iVar11 < 0x2d4) {
  247.         uVar12 = uVar12 & 0xfffffc80 | (uint)""[iVar13 + 0x2d3];
  248.         if (iVar11 < 0x1e3) {
  249.           uVar12 = uVar12 | 0x300;
  250.         }
  251.         else if (iVar11 < 0x25b) {
  252.           uVar12 = uVar12 | 0x200;
  253.         }
  254.         else if (iVar11 < 0x297) {
  255.           uVar12 = uVar12 | 0x100;
  256.         }
  257.       }
  258.       else {
  259.         uVar12 = uVar12 & 0xfffffc80 | 0x7f;
  260.       }
  261.       uVar14 = uVar12 >> 8 & 3;
  262.       sVar8 = 4;
  263.       if (uVar14 < 3) {
  264.         sVar8 = (sbyte)uVar14;
  265.       }
  266.       this->vol = (ushort)(((uVar12 & 0x7f) << 4) >> sVar8);
  267.       (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffe;
  268.     }
  269.     if (cVar5 != '\0') {
  270.       iVar13 = (int)this->extPan + (int)this->pan;
  271.       if (((char)uVar16 != '\0') && (this->modType == '\x02')) {
  272.         iVar13 = iVar13 + unaff_ESI;
  273.       }
  274.       iVar13 = iVar13 + 0x40;
  275.       if (iVar13 < 0) {
  276.         iVar13 = 0;
  277.       }
  278.       else if (0x7f < iVar13) {
  279.         iVar13 = 0x7f;
  280.       }
  281.       uVar12 = uVar12 & 0xff80ffff | iVar13 << 0x10;
  282.       (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffd;
  283.     }
  284.     (this->tempReg).CR = uVar12;
  285.     (this->reg).volumeMul = (byte)uVar12 & 0x7f;
  286.     (this->reg).volumeDiv = (byte)(uVar12 >> 8) & 3;
  287.     (this->reg).panning = (byte)(uVar12 >> 0x10) & 0x7f;
  288.     bVar6 = (byte)(uVar12 >> 0x18);
  289.     (this->reg).waveDuty = bVar6 & 7;
  290.     (this->reg).repeatMode = bVar6 >> 3 & 3;
  291.     (this->reg).format = bVar6 >> 5 & 3;
  292.     (this->reg).enable = (bool)(bVar6 >> 7);
  293.   }
  294. switchD_10014464_caseD_0:
  295.   return;
  296. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement