Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* WARNING: Type propagation algorithm not settling */
- /* DWARF original prototype: void Update(Channel * this) */
- void __thiscall Channel::Update(Channel *this)
- {
- uint32_t uVar1;
- uint32_t uVar2;
- SharpInterpolator *pSVar3;
- SWAV *pSVar4;
- undefined2 uVar5;
- undefined2 uVar6;
- byte bVar7;
- uint32_t uVar8;
- uint32_t uVar9;
- uint16_t uVar10;
- ushort uVar11;
- uint uVar12;
- uint uVar13;
- int iVar14;
- ulong uVar15;
- byte bVar16;
- uint uVar17;
- ulong uVar18;
- int iVar19;
- _WordT _Var20;
- byte bVar21;
- byte bVar22;
- byte bVar23;
- byte bVar24;
- int iVar25;
- int iVar26;
- uint uVar27;
- char cVar28;
- uint8_t uVar29;
- bool bVar30;
- double dVar31;
- char cVar32;
- /* WARNING (jumptable): Read-only address (ram,0x0013a944) is written */
- /* WARNING (jumptable): Read-only address (ram,0x0013a954) is written */
- bVar24 = this->state;
- if (bVar24 < 2) {
- bVar22 = bVar24 & 1;
- if (this->sweepPitch == 0) {
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- uVar29 = this->modDepth;
- bVar30 = false;
- }
- else {
- uVar12 = this->sweepLen;
- if (uVar12 != 0) {
- LAB_0010d231:
- bVar30 = this->sweepCnt <= uVar12;
- goto LAB_0010ce15;
- }
- uVar29 = this->modDepth;
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- bVar30 = false;
- }
- LAB_0010ceee:
- if ((_Var20 & 2) == 0) {
- bVar21 = bVar22;
- bVar23 = 0;
- if (bVar22 == 0) goto LAB_0010cf02;
- LAB_0010d243:
- uVar8 = (this->tempReg).REPEAT_POINT;
- uVar9 = (this->tempReg).LENGTH;
- pSVar3 = (this->sharp)._M_t.
- super___uniq_ptr_impl<SharpInterpolator,_std::default_delete<SharpInterpolator>_>.
- _M_t.
- super__Tuple_impl<0,_SharpInterpolator*,_std::default_delete<SharpInterpolator>_>.
- super__Head_base<0,_SharpInterpolator*,_false>._M_head_impl;
- (this->reg).volumeMul = '\0';
- (this->reg).volumeDiv = '\0';
- (this->reg).panning = '\0';
- (this->reg).waveDuty = '\0';
- (this->reg).repeatMode = '\0';
- (this->reg).format = '\0';
- pSVar4 = (this->tempReg).SOURCE;
- (this->reg).enable = false;
- (this->reg).source = pSVar4;
- uVar1 = (this->tempReg).LENGTH;
- uVar2 = (this->tempReg).REPEAT_POINT;
- (this->reg).loopStart = uVar8;
- (this->reg).length = uVar9;
- (this->reg).totalLength = uVar1 + uVar2;
- this->ampl = -0x16980;
- (this->sharp)._M_t.
- super___uniq_ptr_impl<SharpInterpolator,_std::default_delete<SharpInterpolator>_>._M_t.
- super__Tuple_impl<0,_SharpInterpolator*,_std::default_delete<SharpInterpolator>_>.
- super__Head_base<0,_SharpInterpolator*,_false>._M_head_impl = (SharpInterpolator *)0x0;
- if (pSVar3 == (SharpInterpolator *)0x0) {
- iVar25 = -0x2d3;
- iVar19 = -0x16980;
- }
- else {
- operator.delete(pSVar3,0x18);
- iVar19 = this->ampl;
- iVar25 = iVar19 >> 7;
- }
- this->state = '\x02';
- LAB_0010d2b1:
- do {
- iVar19 = iVar19 * (uint)this->attackLvl;
- iVar14 = iVar19 + 0xff;
- if (-1 < iVar19) {
- iVar14 = iVar19;
- }
- iVar19 = iVar14 >> 8;
- } while (iVar14 >> 0xf == iVar25);
- this->ampl = iVar19;
- if (iVar19 == 0) {
- this->state = '\x03';
- if (uVar29 != '\0') {
- LAB_0010d440:
- bVar24 = 1;
- bVar23 = 1;
- goto LAB_0010cf77;
- }
- if (bVar22 == 0) {
- uVar12 = (this->tempReg).CR;
- goto LAB_0010d703;
- }
- }
- else {
- if (uVar29 != '\0') goto LAB_0010d440;
- if (bVar22 == 0) {
- uVar12 = (this->tempReg).CR;
- iVar19 = 0;
- iVar25 = (iVar14 >> 0xf) + (int)this->extAmpl + (int)this->velocity;
- goto LAB_0010d470;
- }
- }
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- bVar24 = bVar22;
- bVar23 = bVar22;
- LAB_0010ce62:
- bVar22 = 0;
- iVar19 = 0;
- iVar25 = this->extTune;
- goto LAB_0010cfa3;
- }
- bVar23 = 1;
- LAB_0010cf02:
- bVar21 = bVar23;
- bVar22 = (byte)(_Var20 >> 2) & 1 | bVar22 | bVar30;
- switch(bVar24) {
- case 0:
- goto switchD_0010cf24_caseD_0;
- case 1:
- goto LAB_0010d243;
- case 2:
- iVar19 = this->ampl;
- iVar25 = iVar19 >> 7;
- goto LAB_0010d2b1;
- case 3:
- iVar19 = this->ampl - (uint)this->decayRate;
- iVar25 = 0;
- this->ampl = iVar19;
- if (-1 < (char)this->sustainLvl) {
- iVar25 = (int)*(short *)(Cnv_Sust(int)::lut + (ulong)this->sustainLvl * 2) << 7;
- }
- if (iVar19 <= iVar25) {
- this->ampl = iVar25;
- this->state = '\x04';
- }
- break;
- case 5:
- iVar19 = this->ampl - (uint)this->releaseRate;
- this->ampl = iVar19;
- if (iVar19 < -0x1697f) {
- LAB_0010ce90:
- this->prio = '\0';
- this->state = '\0';
- this->trackId = -1;
- (this->reg).repeatMode = '\0';
- (this->reg).format = '\0';
- (this->reg).volumeMul = '\0';
- (this->reg).volumeDiv = '\0';
- (this->reg).panning = '\0';
- (this->reg).waveDuty = '\0';
- (this->reg).enable = false;
- this->vol = 0;
- this->noteLength = -1;
- return;
- }
- }
- if (uVar29 == '\0') {
- if (bVar22 != 0) {
- bVar24 = 1;
- bVar23 = 1;
- goto LAB_0010ce62;
- }
- uVar12 = (this->tempReg).CR;
- LAB_0010d703:
- iVar19 = 0;
- bVar22 = 0;
- iVar25 = (this->ampl >> 7) + (int)this->extAmpl + (int)this->velocity;
- LAB_0010d470:
- iVar14 = iVar25 + 0x2d3;
- uVar17 = uVar12 & 0xfffffc80;
- if (0x2d3 < iVar14) {
- iVar14 = 0x2d3;
- }
- if (iVar14 < 0) {
- iVar14 = 0;
- }
- bVar24 = ""[iVar14];
- uVar12 = bVar24 | uVar17;
- uVar5 = (undefined2)(uVar17 >> 0x10);
- uVar6 = (undefined2)uVar12;
- if (iVar25 < -0xf0) {
- uVar12 = CONCAT22(uVar5,uVar6) | 0x300;
- uVar11 = bVar24 & 0x7f;
- }
- else if (iVar25 < -0x78) {
- uVar12 = CONCAT22(uVar5,uVar6) | 0x200;
- uVar11 = (short)uVar12 * 4 & 0x1fc;
- }
- else if (iVar25 < -0x3c) {
- uVar12 = CONCAT22(uVar5,uVar6) | 0x100;
- uVar11 = (short)uVar12 * 8 & 0x3f8;
- }
- else {
- uVar11 = (ushort)((bVar24 & 0x7f) << 4);
- }
- (this->flags).super__Base_bitset<1>._M_w =
- (this->flags).super__Base_bitset<1>._M_w & 0xfffffffffffffffe;
- this->vol = uVar11;
- }
- else {
- bVar24 = 1;
- bVar23 = 1;
- LAB_0010cf77:
- if (this->modDelayCnt < this->modDelay) {
- iVar19 = 0;
- this->modDelayCnt = this->modDelayCnt + 1;
- if (bVar22 != 0) {
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- bVar22 = 0;
- iVar19 = 0;
- iVar25 = this->extTune;
- LAB_0010cfa3:
- if (bVar30 != false) {
- uVar1 = this->sweepCnt;
- if (this->manualSweep == false) {
- this->sweepCnt = uVar1 + 1;
- }
- iVar25 = iVar25 + (int)(((long)(int)(this->sweepLen - uVar1) * (long)this->sweepPitch) /
- (long)(int)this->sweepLen);
- }
- uVar11 = (this->tempReg).TIMER;
- uVar15 = (ulong)uVar11;
- if (iVar25 == 0) {
- LAB_0010d100:
- uVar10 = (uint16_t)-(int)uVar15;
- dVar31 = (double)(0x10000 - (-(int)uVar15 & 0xffffU));
- }
- else {
- uVar12 = -iVar25;
- if (iVar25 < 1) {
- if (iVar25 < -0x2ff) {
- uVar17 = (-iVar25 - 0x300U) / 0x300 + 1;
- if (-iVar25 - 0x300U < 0xc00) {
- uVar13 = 0;
- LAB_0010d5fc:
- iVar26 = uVar12 - 0x300;
- uVar27 = uVar13;
- uVar17 = uVar13 + 1;
- if (0x2ff < iVar26) {
- iVar26 = uVar12 - 0x600;
- uVar27 = uVar13 + 1;
- uVar17 = uVar13 + 2;
- if (0x2ff < iVar26) {
- iVar26 = uVar12 - 0x900;
- uVar17 = uVar13 + 3;
- uVar27 = uVar13 + 2;
- if (0x2ff < iVar26) {
- iVar26 = uVar12 - 0xc00;
- uVar27 = uVar17;
- uVar17 = uVar13 + 4;
- }
- }
- }
- }
- else {
- uVar13 = 0;
- iVar14 = uVar12 - 0x900;
- uVar12 = 3;
- do {
- uVar27 = uVar12;
- iVar26 = iVar14;
- uVar13 = uVar13 + 1;
- iVar14 = iVar26 + -0xc00;
- uVar12 = uVar27 + 4;
- } while (uVar13 != uVar17 >> 2);
- uVar13 = uVar17 & 0xfffffffc;
- uVar12 = uVar13 * -0x300 - iVar25;
- if ((uVar17 & 3) != 0) goto LAB_0010d5fc;
- iVar26 = iVar26 + -0x300;
- uVar17 = uVar27 + 1;
- }
- cVar28 = (char)uVar17;
- iVar25 = uVar27 - 0xf;
- uVar15 = ((ulong)getpitchtbl[iVar26] + 0x10000) * (ulong)uVar11;
- if (iVar25 < 1) goto LAB_0010d8a0;
- if ((iVar25 < 0x20) && ((-1L << (0x20 - (byte)iVar25 & 0x3f) & uVar15) == 0)) {
- uVar15 = uVar15 << ((byte)iVar25 & 0x3f);
- goto LAB_0010d68f;
- }
- }
- else {
- cVar28 = '\0';
- uVar15 = ((ulong)getpitchtbl[(int)uVar12] + 0x10000) * (ulong)uVar11;
- LAB_0010d8a0:
- uVar15 = uVar15 >> (0x10U - cVar28 & 0x3f);
- LAB_0010d68f:
- if (uVar15 < 0x10) goto LAB_0010d7ac;
- if (uVar15 < 0x10000) goto LAB_0010d100;
- }
- dVar31 = 65535.0;
- uVar10 = 1;
- }
- else {
- uVar17 = (iVar25 - 1U) / 0x300 + 1;
- if (uVar12 < 0xfffff400) {
- uVar13 = 0;
- iVar14 = uVar12 + 0x900;
- cVar28 = -3;
- do {
- cVar32 = cVar28;
- iVar26 = iVar14;
- uVar13 = uVar13 + 1;
- iVar14 = iVar26 + 0xc00;
- cVar28 = cVar32 + -4;
- } while (uVar13 != uVar17 >> 2);
- if ((uVar17 & 3) == 0) {
- iVar26 = iVar26 + 0x300;
- bVar16 = cVar32 - 1;
- }
- else {
- bVar7 = (byte)(uVar17 & 0xfffffffc);
- bVar16 = ~bVar7;
- cVar28 = -bVar7;
- uVar12 = (uVar17 & 0xfffffffc) * 0x300 - iVar25;
- iVar26 = uVar12 + 0x300;
- if (iVar26 < 0) goto LAB_0010d0a8;
- }
- uVar15 = ((ulong)getpitchtbl[iVar26] + 0x10000) * uVar15 >> (0x10 - bVar16 & 0x3f) ;
- joined_r0x0010d0ef:
- if (0xf < uVar15) goto LAB_0010d100;
- }
- else {
- cVar28 = '\0';
- if (0x300 - iVar25 < 0) {
- LAB_0010d0a8:
- if ((int)(uVar12 + 0x600) < 0) {
- if ((int)(uVar12 + 0x900) < 0) {
- uVar15 = ((ulong)getpitchtbl[(int)(uVar12 + 0xc00)] + 0x10000) * uVar15 >>
- (0x14U - cVar28 & 0x3f);
- }
- else {
- uVar15 = ((ulong)getpitchtbl[(int)(uVar12 + 0x900)] + 0x10000) * uVar15 >>
- (0x13U - cVar28 & 0x3f);
- }
- }
- else {
- uVar15 = ((ulong)getpitchtbl[(int)(uVar12 + 0x600)] + 0x10000) * uVar15 >>
- (0x12U - cVar28 & 0x3f);
- }
- goto joined_r0x0010d0ef;
- }
- uVar18 = ((ulong)getpitchtbl[0x300 - iVar25] + 0x10000) * (ulong)uVar11;
- uVar15 = uVar18 >> 0x11;
- if (0x1fffff < uVar18) goto LAB_0010d100;
- }
- LAB_0010d7ac:
- dVar31 = 16.0;
- uVar10 = 0xfff0;
- }
- }
- (this->reg).timer = uVar10;
- uVar1 = this->ply->sampleRate;
- (this->flags).super__Base_bitset<1>._M_w = _Var20 & 0xfffffffffffffffb;
- (this->reg).sampleIncrease = (33513982.0 / (double)(ulong)(uVar1 * 2)) / dVar31;
- }
- }
- else {
- uVar29 = this->modType;
- if (uVar29 == '\x01') {
- bVar24 = 1;
- bVar23 = 1;
- }
- else if (uVar29 == '\x02') {
- bVar24 = 1;
- bVar21 = 1;
- }
- else {
- bVar22 = bVar22 | uVar29 == '\0';
- }
- uVar11 = this->modCounter;
- uVar12 = (uint)(uVar11 >> 8);
- if (uVar11 < 0x2000) {
- iVar19 = (int)(char)Cnv_Sine(int)::lut[(int)uVar12];
- }
- else if (uVar11 >> 8 < 0x40) {
- iVar19 = (int)(char)Cnv_Sine(int)::lut[(int)(0x40 - uVar12)];
- }
- else if (uVar11 >> 8 < 0x60) {
- iVar19 = (int)(char)-Cnv_Sine(int)::lut[(int)(uVar12 - 0x40)];
- }
- else {
- iVar19 = (int)(char)-Cnv_Sine(int)::lut[(int)(0x80 - uVar12)];
- }
- iVar25 = (uint)this->modRange * iVar19 * (uint)this->modDepth;
- iVar19 = iVar25 >> 8;
- if (uVar29 == '\x01') {
- iVar19 = iVar25 * 0x3c >> 0xe;
- }
- uVar12 = (uint)this->modSpeed * 0x40 + (uint)uVar11 >> 8;
- if (0x7f < uVar12) {
- uVar12 = uVar12 & 0x7f;
- }
- this->modCounter = (ushort)(uVar12 << 8) | (ushort)this->modSpeed * 0x40 + uVar11 & 0xff;
- if (bVar22 != 0) {
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- iVar25 = this->extTune;
- if (uVar29 == '\0') {
- iVar25 = this->extTune + iVar19;
- }
- goto LAB_0010cfa3;
- }
- bVar22 = 1;
- }
- if (bVar24 == 0) {
- switchD_0010cf24_caseD_0:
- return;
- }
- uVar12 = (this->tempReg).CR;
- if (bVar23 != 0) {
- iVar25 = (this->ampl >> 7) + (int)this->extAmpl + (int)this->velocity;
- if ((bVar22 != 0) && (this->modType == '\x01')) {
- iVar25 = iVar25 + iVar19;
- }
- goto LAB_0010d470;
- }
- }
- if (bVar21 == 0) goto LAB_0010d1b4;
- iVar25 = (int)this->pan + (int)this->extPan;
- if ((bVar22 != 0) && (this->modType == '\x02')) {
- iVar25 = iVar25 + iVar19;
- }
- }
- else {
- if ((this->reg).enable == false) goto LAB_0010ce90;
- if (this->sweepPitch == 0) {
- bVar22 = 0;
- bVar30 = false;
- }
- else {
- uVar12 = this->sweepLen;
- bVar22 = 0;
- bVar30 = false;
- if (uVar12 != 0) goto LAB_0010d231;
- }
- LAB_0010ce15:
- _Var20 = (this->flags).super__Base_bitset<1>._M_w;
- uVar29 = this->modDepth;
- if ((bVar24 != 4 | (byte)_Var20 & 1) != 0) goto LAB_0010ceee;
- bVar21 = (byte)(_Var20 >> 2) & 1 | bVar30;
- bVar23 = 0;
- bVar22 = bVar21;
- if ((_Var20 & 2) == 0) {
- if (uVar29 != '\0') {
- bVar24 = 0;
- bVar21 = 0;
- goto LAB_0010cf77;
- }
- if (bVar21 == 0) {
- return;
- }
- bVar21 = 0;
- bVar24 = bVar23;
- goto LAB_0010ce62;
- }
- if (uVar29 != '\0') {
- bVar24 = 1;
- bVar21 = 1;
- goto LAB_0010cf77;
- }
- bVar24 = bVar21;
- if (bVar21 != 0) goto LAB_0010ce62;
- uVar12 = (this->tempReg).CR;
- iVar25 = (int)this->extPan + (int)this->pan;
- }
- iVar25 = iVar25 + 0x40;
- if (0x7f < iVar25) {
- iVar25 = 0x7f;
- }
- if (iVar25 < 0) {
- iVar25 = 0;
- }
- (this->flags).super__Base_bitset<1>._M_w =
- (this->flags).super__Base_bitset<1>._M_w & 0xfffffffffffffffd;
- uVar12 = uVar12 & 0xff80ffff | iVar25 << 0x10;
- LAB_0010d1b4:
- (this->tempReg).CR = uVar12;
- uVar17 = uVar12 & 0x77f037f;
- (this->reg).volumeMul = (char)uVar17;
- (this->reg).volumeDiv = (char)(uVar17 >> 8);
- (this->reg).panning = (char)(uVar17 >> 0x10);
- (this->reg).waveDuty = (char)(uVar17 >> 0x18);
- bVar24 = (byte)(uVar12 >> 0x18);
- (this->reg).repeatMode = bVar24 >> 3 & 3;
- (this->reg).enable = (bool)(bVar24 >> 7);
- (this->reg).format = bVar24 >> 5 & 3;
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement