Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall Channel::Update(Channel *this)
- {
- uchar uVar1;
- Player *pPVar2;
- bool bVar3;
- bool bVar4;
- char cVar5;
- byte bVar6;
- uint uVar7;
- sbyte sVar8;
- ushort uVar9;
- int iVar10;
- undefined4 extraout_EDX;
- uint extraout_EDX_00;
- int unaff_EBX;
- int unaff_ESI;
- int iVar11;
- uint uVar12;
- undefined4 unaff_EDI;
- int iVar13;
- uint uVar14;
- bool bVar15;
- ulonglong in_stack_ffffffd0;
- undefined2 uVar16;
- char cVar17;
- uVar16 = (undefined2)(in_stack_ffffffd0 >> 0x30);
- cVar17 = (char)((uint)unaff_EDI >> 8);
- bVar6 = this->state;
- if ((1 < bVar6) && ((this->reg).enable == false)) {
- this->state = '\0';
- this->trackId = -1;
- this->prio = '\0';
- (this->reg).panning = '\0';
- (this->reg).waveDuty = '\0';
- (this->reg).repeatMode = '\0';
- (this->reg).format = '\0';
- (this->reg).volumeMul = '\0';
- (this->reg).volumeDiv = '\0';
- LAB_100143b2:
- (this->reg).enable = false;
- this->vol = 0;
- this->sampleHistoryPtr = 0;
- this->noteLength = -1;
- _memset(this->sampleHistory,0,0x80);
- return;
- }
- if (((this->sweepPitch == 0) || (this->sweepLen == 0)) || (this->sweepLen < this->sweepCnt)) {
- bVar3 = false;
- }
- else {
- bVar3 = true;
- }
- uVar1 = this->modDepth;
- bVar15 = uVar1 != '\0';
- if (((((this->flags)._Array[0] & 4) != 0) || (bVar6 == 1)) || (bVar4 = false, bVar3)) {
- bVar4 = true;
- }
- switch(bVar6) {
- case 0:
- goto switchD_10014464_caseD_0;
- case 1:
- uVar12 = (this->tempReg).REPEAT_POINT;
- (this->reg).source = (this->tempReg).SOURCE;
- uVar14 = (this->tempReg).LENGTH;
- (this->reg).length = uVar14;
- (this->reg).panning = '\0';
- (this->reg).waveDuty = '\0';
- (this->reg).repeatMode = '\0';
- (this->reg).format = '\0';
- (this->reg).volumeMul = '\0';
- (this->reg).volumeDiv = '\0';
- (this->reg).enable = false;
- (this->reg).loopStart = uVar12;
- (this->reg).totalLength = uVar14 + uVar12;
- this->ampl = -0x16980;
- this->state = '\x02';
- case 2:
- iVar13 = this->ampl;
- iVar11 = iVar13 >> 7;
- do {
- iVar13 = (uint)this->attackLvl * iVar13;
- iVar10 = (iVar13 >> 0x1f & 0xffU) + iVar13;
- iVar13 = iVar10 >> 8;
- } while (iVar10 >> 0xf == iVar11);
- this->ampl = iVar13;
- if (iVar13 == 0) {
- this->state = '\x03';
- }
- break;
- case 3:
- iVar13 = this->ampl - (uint)this->decayRate;
- this->ampl = iVar13;
- uVar12 = (uint)this->sustainLvl;
- if ((this->sustainLvl & 0x80) != 0) {
- uVar12 = 0x7f;
- }
- iVar11 = *(short *)((int)&`int___cdecl_Cnv_Sust(int)'::`2'::lut + uVar12 * 2) * 0x80;
- if (iVar13 <= iVar11) {
- this->ampl = iVar11;
- this->state = '\x04';
- }
- break;
- case 5:
- this->ampl = this->ampl - (uint)this->releaseRate;
- if (this->ampl < -0x1697f) {
- this->state = '\0';
- this->trackId = -1;
- this->prio = '\0';
- (this->reg).panning = '\0';
- (this->reg).waveDuty = '\0';
- (this->reg).repeatMode = '\0';
- (this->reg).format = '\0';
- (this->reg).volumeMul = '\0';
- (this->reg).volumeDiv = '\0';
- goto LAB_100143b2;
- }
- }
- iVar13 = 0;
- if (uVar1 != '\0') {
- if (this->modDelayCnt < this->modDelay) {
- this->modDelayCnt = this->modDelayCnt + 1;
- bVar15 = false;
- }
- else {
- if (this->modType == '\0') {
- bVar4 = true;
- }
- uVar12 = (uint)(this->modCounter >> 8);
- if (uVar12 < 0x20) {
- cVar5 = *(char *)((int)&`int___cdecl_Cnv_Sine(int)'::`2'::lut + uVar12);
- }
- else if (uVar12 < 0x40) {
- cVar5 = "Application cannot be run in Win32 mode."[0x10 - uVar12];
- }
- else {
- if (uVar12 < 0x60) {
- cVar5 = (&DAT_10028bf8)[uVar12];
- }
- else {
- cVar5 = "Invalid code segment."[0x10 - uVar12];
- }
- cVar5 = -cVar5;
- }
- iVar13 = (uint)this->modRange * (int)cVar5 * (uint)this->modDepth;
- if (this->modType == '\x01') {
- iVar13 = iVar13 * 0x3c >> 0xe;
- }
- else {
- iVar13 = iVar13 >> 8;
- }
- uVar12 = (uint)this->modSpeed * 0x40 + (uint)this->modCounter;
- uVar14 = uVar12 >> 8;
- if (0x7f < uVar14) {
- uVar12 = uVar12 >> 0xf;
- do {
- uVar14 = uVar14 - 0x80;
- uVar12 = uVar12 - 1;
- } while (uVar12 != 0);
- }
- this->modCounter = this->modCounter + (ushort)this->modSpeed * 0x40;
- *(undefined *)((int)&this->modCounter + 1) = 0;
- this->modCounter = this->modCounter | (ushort)(uVar14 << 8);
- }
- }
- if (bVar4) {
- iVar11 = this->extTune;
- if ((bVar15) && (this->modType == '\0')) {
- iVar11 = iVar11 + iVar13;
- }
- if (bVar3) {
- uVar12 = this->sweepLen;
- in_stack_ffffffd0 = (ulonglong)(int)uVar12;
- _alldiv();
- iVar11 = unaff_EBX + uVar12;
- if (this->manualSweep == false) {
- this->sweepCnt = this->sweepCnt + 1;
- }
- }
- uVar9 = (this->tempReg).TIMER;
- if (iVar11 == 0) goto LAB_10014769;
- iVar13 = 0;
- uVar12 = -iVar11;
- if (0 < iVar11) {
- iVar11 = ~uVar12 / 0x300 + 1;
- iVar13 = -iVar11;
- uVar12 = uVar12 + iVar11 * 0x300;
- }
- if (0x2ff < (int)uVar12) {
- iVar13 = iVar13 + uVar12 / 0x300;
- }
- uVar12 = (uint)(this->tempReg).TIMER;
- _allmul();
- uVar14 = iVar13 - 0x10;
- in_stack_ffffffd0 = CONCAT44(extraout_EDX,uVar12);
- if ((int)uVar14 < 1) {
- in_stack_ffffffd0 = in_stack_ffffffd0 >> (ulonglong)-uVar14;
- LAB_10014736:
- if ((int)(in_stack_ffffffd0 >> 0x20) != 0) goto LAB_10014764;
- if ((uint)in_stack_ffffffd0 < 0x10) {
- uVar9 = 0x10;
- }
- else {
- uVar9 = (ushort)in_stack_ffffffd0;
- if (0xffff < (uint)in_stack_ffffffd0) goto LAB_10014764;
- }
- }
- else {
- if ((int)uVar14 < 0x20) {
- uVar7 = 0xffffffff;
- _allshl();
- if ((uVar7 & uVar12 | extraout_EDX_00 & (uint)(in_stack_ffffffd0 >> 0x20)) == 0) {
- in_stack_ffffffd0 = in_stack_ffffffd0 << (ulonglong)uVar14;
- goto LAB_10014736;
- }
- }
- LAB_10014764:
- uVar9 = 0xffff;
- }
- LAB_10014769:
- uVar16 = (undefined2)(in_stack_ffffffd0 >> 0x30);
- pPVar2 = this->ply;
- (this->reg).timer = -uVar9;
- iVar13 = pPVar2->sampleRate * 2;
- (this->reg).sampleIncrease =
- 33513982.0 /
- (((double)iVar13 +
- *(double *)(&__xmm@41f00000000000000000000000000000 + (iVar13 >> 0x1f) * -8)) *
- (double)(0x10000 - (uint)(ushort)-uVar9));
- (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffb;
- }
- cVar5 = (char)((ushort)uVar16 >> 8);
- if ((cVar17 != '\0') || (cVar5 != '\0')) {
- uVar12 = (this->tempReg).CR;
- if (cVar17 != '\0') {
- iVar13 = (this->ampl >> 7) + (int)this->velocity + (int)this->extAmpl;
- if (((char)uVar16 != '\0') && (this->modType == '\x01')) {
- iVar13 = iVar13 + unaff_ESI;
- }
- iVar11 = iVar13 + 0x2d3;
- if (iVar11 < 0) {
- uVar12 = uVar12 & 0xfffffc80 | 0x300;
- }
- else if (iVar11 < 0x2d4) {
- uVar12 = uVar12 & 0xfffffc80 | (uint)""[iVar13 + 0x2d3];
- if (iVar11 < 0x1e3) {
- uVar12 = uVar12 | 0x300;
- }
- else if (iVar11 < 0x25b) {
- uVar12 = uVar12 | 0x200;
- }
- else if (iVar11 < 0x297) {
- uVar12 = uVar12 | 0x100;
- }
- }
- else {
- uVar12 = uVar12 & 0xfffffc80 | 0x7f;
- }
- uVar14 = uVar12 >> 8 & 3;
- sVar8 = 4;
- if (uVar14 < 3) {
- sVar8 = (sbyte)uVar14;
- }
- this->vol = (ushort)(((uVar12 & 0x7f) << 4) >> sVar8);
- (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffe;
- }
- if (cVar5 != '\0') {
- iVar13 = (int)this->extPan + (int)this->pan;
- if (((char)uVar16 != '\0') && (this->modType == '\x02')) {
- iVar13 = iVar13 + unaff_ESI;
- }
- iVar13 = iVar13 + 0x40;
- if (iVar13 < 0) {
- iVar13 = 0;
- }
- else if (0x7f < iVar13) {
- iVar13 = 0x7f;
- }
- uVar12 = uVar12 & 0xff80ffff | iVar13 << 0x10;
- (this->flags)._Array[0] = (this->flags)._Array[0] & 0xfffffffd;
- }
- (this->tempReg).CR = uVar12;
- (this->reg).volumeMul = (byte)uVar12 & 0x7f;
- (this->reg).volumeDiv = (byte)(uVar12 >> 8) & 3;
- (this->reg).panning = (byte)(uVar12 >> 0x10) & 0x7f;
- bVar6 = (byte)(uVar12 >> 0x18);
- (this->reg).waveDuty = bVar6 & 7;
- (this->reg).repeatMode = bVar6 >> 3 & 3;
- (this->reg).format = bVar6 >> 5 & 3;
- (this->reg).enable = (bool)(bVar6 >> 7);
- }
- switchD_10014464_caseD_0:
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement