REDRIVER2/src_rebuild/GAME/ASM/ASMTEST.MIP
Ilya Shurumov c40d40bd22 - added sources rebuilt with TDR and partially decompiled intro sequence
- moved necessary data to new sources
- running intro with TOMB5 HLE emulator
2020-03-28 03:25:35 +06:00

765 lines
17 KiB
Plaintext

// WARNING: This file's extension ('.MIP') indicates that it may not have been a C or C++ file.
// It should contain Ghidra's best effort at decompiling the machine language to C,
// but TDR does not currently attempt to handle assembly language or other non-C/C++ code differently,
// so any decompiled code below may not reflect the original project source code for this file.
// If the source file is from a library, you should replace it with the original library version of the file.
// Otherwise, manual reconstruction of the code may be required,
// Especially if the original source code was assembly language which used hardware features inaccessible to C.
#include "THISDUST.H"
#include "ASMTEST.H"
// decompiled code
// original method signature:
// void SetCameraVector() /* SetCameraVector method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
// line 1, offset 0x0001bcd4
/* begin block 1 */
// Start line: 3
/* end block 1 */
// End Line: 4
/* begin block 2 */
// Start line: 4
/* end block 2 */
// End Line: 5
/* begin block 3 */
// Start line: 5
/* end block 3 */
// End Line: 6
/* begin block 4 */
// Start line: 6
/* end block 4 */
// End Line: 7
/* begin block 5 */
// Start line: 7
/* end block 5 */
// End Line: 8
/* begin block 6 */
// Start line: 8
/* end block 6 */
// End Line: 9
/* begin block 7 */
// Start line: 9
/* end block 7 */
// End Line: 10
/* begin block 8 */
// Start line: 10
/* end block 8 */
// End Line: 11
/* begin block 9 */
// Start line: 11
/* end block 9 */
// End Line: 12
/* begin block 10 */
// Start line: 12
/* end block 10 */
// End Line: 13
/* begin block 11 */
// Start line: 13
/* end block 11 */
// End Line: 14
/* begin block 12 */
// Start line: 14
/* end block 12 */
// End Line: 15
/* begin block 13 */
// Start line: 15
/* end block 13 */
// End Line: 16
/* begin block 14 */
// Start line: 16
/* end block 14 */
// End Line: 17
/* begin block 15 */
// Start line: 17
/* end block 15 */
// End Line: 18
/* begin block 16 */
// Start line: 18
/* end block 16 */
// End Line: 19
/* begin block 17 */
// Start line: 37
/* end block 17 */
// End Line: 38
/* begin block 18 */
// Start line: 43
/* end block 18 */
// End Line: 44
/* begin block 19 */
// Start line: 44
/* end block 19 */
// End Line: 45
/* begin block 20 */
// Start line: 45
/* end block 20 */
// End Line: 46
/* begin block 21 */
// Start line: 46
/* end block 21 */
// End Line: 47
/* begin block 22 */
// Start line: 47
/* end block 22 */
// End Line: 48
/* begin block 23 */
// Start line: 48
/* end block 23 */
// End Line: 49
/* begin block 24 */
// Start line: 49
/* end block 24 */
// End Line: 50
/* begin block 25 */
// Start line: 50
/* end block 25 */
// End Line: 51
/* begin block 26 */
// Start line: 51
/* end block 26 */
// End Line: 52
/* begin block 27 */
// Start line: 52
/* end block 27 */
// End Line: 53
/* begin block 28 */
// Start line: 53
/* end block 28 */
// End Line: 54
/* begin block 29 */
// Start line: 54
/* end block 29 */
// End Line: 55
/* begin block 30 */
// Start line: 55
/* end block 30 */
// End Line: 56
/* begin block 31 */
// Start line: 56
/* end block 31 */
// End Line: 57
/* begin block 32 */
// Start line: 57
/* end block 32 */
// End Line: 58
/* begin block 33 */
// Start line: 58
/* end block 33 */
// End Line: 59
/* begin block 34 */
// Start line: 59
/* end block 34 */
// End Line: 60
/* begin block 35 */
// Start line: 60
/* end block 35 */
// End Line: 61
/* begin block 36 */
// Start line: 61
/* end block 36 */
// End Line: 62
/* begin block 37 */
// Start line: 62
/* end block 37 */
// End Line: 63
/* begin block 38 */
// Start line: 63
/* end block 38 */
// End Line: 64
/* begin block 39 */
// Start line: 64
/* end block 39 */
// End Line: 65
/* begin block 40 */
// Start line: 65
/* end block 40 */
// End Line: 66
/* begin block 41 */
// Start line: 66
/* end block 41 */
// End Line: 67
/* begin block 42 */
// Start line: 67
/* end block 42 */
// End Line: 68
void SetCameraVector(void)
{
setCopControlWord(2,0xa800,camera_position.vx);
setCopControlWord(2,0xb000,camera_position.vy);
setCopControlWord(2,0xb800,camera_position.vz);
return;
}
// autogenerated function stub:
// void date_date() /* date_date method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
void date_date()
{ // line 18, offset 0x0009bb6c
/* begin block 1 */
// Start line: 37
/* end block 1 */
// End Line: 38
/* begin block 2 */
// Start line: 38
/* end block 2 */
// End Line: 39
/* begin block 3 */
// Start line: 39
/* end block 3 */
// End Line: 40
/* begin block 4 */
// Start line: 40
/* end block 4 */
// End Line: 41
/* begin block 5 */
// Start line: 41
/* end block 5 */
// End Line: 42
/* begin block 6 */
// Start line: 42
/* end block 6 */
// End Line: 43
return null;
}
// autogenerated function stub:
// void date_time() /* date_time method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
void date_time()
{ // line 25, offset 0x0009bb70
/* begin block 1 */
// Start line: 51
/* end block 1 */
// End Line: 52
return null;
}
// autogenerated function stub:
// void cd_icon() /* cd_icon method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
void cd_icon()
{ // line 27, offset 0x0009bb74
/* begin block 1 */
// Start line: 55
/* end block 1 */
// End Line: 56
/* begin block 2 */
// Start line: 56
/* end block 2 */
// End Line: 57
/* begin block 3 */
// Start line: 57
/* end block 3 */
// End Line: 58
/* begin block 4 */
// Start line: 58
/* end block 4 */
// End Line: 59
/* begin block 5 */
// Start line: 59
/* end block 5 */
// End Line: 60
/* begin block 6 */
// Start line: 60
/* end block 6 */
// End Line: 61
/* begin block 7 */
// Start line: 61
/* end block 7 */
// End Line: 62
/* begin block 8 */
// Start line: 62
/* end block 8 */
// End Line: 63
return null;
}
// decompiled code
// original method signature:
// void Apply_Inv_CameraMatrix() /* Apply_Inv_CameraMatrix method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
// line 74, offset 0x0001bcfc
/* begin block 1 */
// Start line: 149
/* end block 1 */
// End Line: 150
/* begin block 2 */
// Start line: 150
/* end block 2 */
// End Line: 151
/* begin block 3 */
// Start line: 151
/* end block 3 */
// End Line: 152
void Apply_Inv_CameraMatrix(undefined4 *param_1)
{
undefined4 uVar1;
undefined4 in_t1;
undefined4 in_t2;
undefined4 in_t3;
setCopReg(2,in_t1,*param_1);
setCopReg(2,in_t2,param_1[1]);
setCopReg(2,in_t3,param_1[2]);
copFunction(2,0x4de012);
uVar1 = getCopReg(2,9);
*param_1 = uVar1;
uVar1 = getCopReg(2,10);
param_1[1] = uVar1;
uVar1 = getCopReg(2,0xb);
param_1[2] = uVar1;
return;
}
// decompiled code
// original method signature:
// void FrustrumCheck16() /* FrustrumCheck16 method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
// line 117, offset 0x0001bd30
/* begin block 1 */
// Start line: 235
/* end block 1 */
// End Line: 236
/* begin block 2 */
// Start line: 236
/* end block 2 */
// End Line: 237
/* begin block 3 */
// Start line: 237
/* end block 3 */
// End Line: 238
/* begin block 4 */
// Start line: 238
/* end block 4 */
// End Line: 239
/* begin block 5 */
// Start line: 239
/* end block 5 */
// End Line: 240
/* begin block 6 */
// Start line: 240
/* end block 6 */
// End Line: 241
/* begin block 7 */
// Start line: 241
/* end block 7 */
// End Line: 242
/* begin block 8 */
// Start line: 242
/* end block 8 */
// End Line: 243
/* begin block 9 */
// Start line: 243
/* end block 9 */
// End Line: 244
/* begin block 10 */
// Start line: 244
/* end block 10 */
// End Line: 245
/* begin block 11 */
// Start line: 245
/* end block 11 */
// End Line: 246
undefined4 FrustrumCheck16(short *param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
setCopReg(2,0x4800,(*param_1 - camera_position.vx) * 0x10000 >> 0x11);
setCopReg(2,0x5000,(param_1[1] - camera_position.vy) * 0x10000 >> 0x11);
setCopReg(2,0x5800,(param_1[2] - camera_position.vz) * 0x10000 >> 0x11);
copFunction(2,0x4be012);
iVar1 = getCopReg(2,0xc800);
iVar3 = getCopReg(2,0xd000);
iVar2 = frustrum_matrix.t[0] - (param_2 >> 1);
if (((iVar2 <= iVar1) && (iVar1 = getCopReg(2,0xd800), iVar2 <= iVar3)) && (iVar2 <= iVar1)) {
return 0;
}
return 0xffffffff;
}
// decompiled code
// original method signature:
// void FrustrumCheck() /* FrustrumCheck method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
// line 198, offset 0x0001bdec
/* begin block 1 */
// Start line: 397
/* end block 1 */
// End Line: 398
/* begin block 2 */
// Start line: 398
/* end block 2 */
// End Line: 399
/* begin block 3 */
// Start line: 399
/* end block 3 */
// End Line: 400
/* begin block 4 */
// Start line: 400
/* end block 4 */
// End Line: 401
/* begin block 5 */
// Start line: 401
/* end block 5 */
// End Line: 402
/* begin block 6 */
// Start line: 402
/* end block 6 */
// End Line: 403
/* begin block 7 */
// Start line: 403
/* end block 7 */
// End Line: 404
/* begin block 8 */
// Start line: 404
/* end block 8 */
// End Line: 405
/* begin block 9 */
// Start line: 405
/* end block 9 */
// End Line: 406
/* begin block 10 */
// Start line: 406
/* end block 10 */
// End Line: 407
undefined4 FrustrumCheck(int *param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
setCopReg(2,0x4800,*param_1 - camera_position.vx >> 1);
setCopReg(2,0x5000,param_1[1] - camera_position.vy >> 1);
setCopReg(2,0x5800,param_1[2] - camera_position.vz >> 1);
copFunction(2,0x4be012);
iVar1 = getCopReg(2,0xc800);
iVar3 = getCopReg(2,0xd000);
iVar2 = frustrum_matrix.t[0] - (param_2 >> 1);
if (((iVar2 <= iVar1) && (iVar1 = getCopReg(2,0xd800), iVar2 <= iVar3)) && (iVar2 <= iVar1)) {
return 0;
}
return 0xffffffff;
}
// decompiled code
// original method signature:
// void Asm_PlotSprite() /* Asm_PlotSprite method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
// line 308, offset 0x0001bee4
/* begin block 1 */
// Start line: 617
/* end block 1 */
// End Line: 618
/* begin block 2 */
// Start line: 618
/* end block 2 */
// End Line: 619
/* begin block 3 */
// Start line: 619
/* end block 3 */
// End Line: 620
/* begin block 4 */
// Start line: 620
/* end block 4 */
// End Line: 621
/* begin block 5 */
// Start line: 621
/* end block 5 */
// End Line: 622
/* begin block 6 */
// Start line: 622
/* end block 6 */
// End Line: 623
/* begin block 7 */
// Start line: 623
/* end block 7 */
// End Line: 624
/* begin block 8 */
// Start line: 624
/* end block 8 */
// End Line: 625
/* begin block 9 */
// Start line: 625
/* end block 9 */
// End Line: 626
/* begin block 10 */
// Start line: 626
/* end block 10 */
// End Line: 627
/* begin block 11 */
// Start line: 627
/* end block 11 */
// End Line: 628
/* begin block 12 */
// Start line: 628
/* end block 12 */
// End Line: 629
/* begin block 13 */
// Start line: 629
/* end block 13 */
// End Line: 630
/* begin block 14 */
// Start line: 630
/* end block 14 */
// End Line: 631
/* begin block 15 */
// Start line: 631
/* end block 15 */
// End Line: 632
/* begin block 16 */
// Start line: 632
/* end block 16 */
// End Line: 633
/* begin block 17 */
// Start line: 633
/* end block 17 */
// End Line: 634
undefined8 Asm_PlotSprite(int param_1,uint *param_2,int param_3,int *param_4)
{
undefined4 in_zero;
undefined *puVar1;
uint uVar2;
undefined4 *puVar3;
int iVar4;
undefined4 extraout_v1;
uint *puVar5;
int iVar6;
undefined4 uVar7;
uint uVar8;
uint uVar9;
undefined4 uVar10;
uint uVar11;
uint uVar12;
undefined4 uVar13;
uint uVar14;
uint uVar15;
uint uVar16;
undefined4 unaff_s0;
undefined4 unaff_s1;
uint uVar17;
undefined4 unaff_s2;
uint uVar18;
uint uVar19;
undefined4 unaff_retaddr;
undefined8 uVar20;
setCopReg(2,0x4800,*param_4 - camera_position.vx);
setCopReg(2,0x5000,param_4[1] - camera_position.vy);
setCopReg(2,0x5800,param_4[2] - camera_position.vz);
uVar12 = 0xff000000;
copFunction(2,0x4de012);
setCopReg(2,0xb800,unaff_retaddr);
uVar7 = DAT_1f8000c0;
if (*(char *)((int)param_4 + 0xd) == '?') {
uVar7 = 0x2c808080;
}
uVar13 = getCopReg(2,0x4800);
uVar10 = getCopReg(2,0x5000);
setCopControlWord(2,0x2800,uVar13);
uVar14 = getCopReg(2,0x5800);
setCopControlWord(2,0x3000,uVar10);
if ((int)(uVar14 - 0xc) < 1) {
setCopControlWord(2,0x3800,uVar14);
return CONCAT44(param_2,*(undefined4 *)(param_1 + 0x10));
}
setCopControlWord(2,0x3800,uVar14);
uVar20 = FUN_0001be9c();
puVar3 = (undefined4 *)((ulonglong)uVar20 >> 0x20);
iVar4 = (int)uVar20;
puVar1 = (undefined *)(uVar14 >> 1);
copFunction(2,0x280030);
setCopReg(2,0xa800,uVar7);
if (*(char *)((int)param_4 + 0xd) == '0') {
puVar1 = &DAT_00003e68;
}
puVar5 = (uint *)(param_3 + ((uint)puVar1 & 0xfffc));
uVar2 = *puVar5;
iVar6 = *(int *)(param_1 + 0x14);
uVar14 = 0;
uVar19 = ~uVar12 & uVar2;
uVar16 = uVar19 | 0x9000000;
if ((*(uint *)(param_1 + 0xc) & 4) == 0) {
uVar8 = getCopReg(2,0x6000);
uVar9 = getCopReg(2,0x6800);
uVar11 = getCopReg(2,0x7000);
setCopReg(2,in_zero,*(undefined4 *)(iVar4 + 0x20));
setCopReg(2,uVar2,*(undefined4 *)(iVar4 + 0x24));
setCopReg(2,puVar3,*(undefined4 *)(iVar4 + 0x28));
setCopReg(2,iVar4,*(undefined4 *)(iVar4 + 0x2c));
setCopReg(2,param_1,*(undefined4 *)(iVar4 + 0x30));
setCopReg(2,param_2,*(undefined4 *)(iVar4 + 0x34));
*puVar3 = unaff_s0;
puVar3[1] = unaff_s1;
copFunction(2,0x280030);
puVar3[3] = uVar12 & uVar2;
puVar3[2] = unaff_s2;
uVar20 = FUN_0001beb8();
iVar4 = (int)uVar20;
uVar15 = getCopReg(2,0x6000);
uVar17 = getCopReg(2,0x6800);
uVar18 = getCopReg(2,0x7000);
setCopReg(2,param_1,*(undefined4 *)(iVar4 + 0x18));
setCopReg(2,param_2,*(undefined4 *)(iVar4 + 0x1c));
setCopReg(2,in_zero,*(undefined4 *)(iVar4 + 0x38));
setCopReg(2,uVar2,*(undefined4 *)(iVar4 + 0x3c));
copFunction(2,0x280030);
uVar2 = *(uint *)(iVar6 + 0x20);
uVar19 = uVar19 << 0x10 | *(uint *)(iVar6 + 0x1c) >> 0x10;
uVar14 = uVar14 << 0x10 | *(uint *)(iVar6 + 0x1c) & 0xffff;
*param_2 = uVar16;
uVar12 = getCopReg(2,0x15);
param_2[1] = uVar12;
param_2[4] = uVar15;
param_2[3] = uVar19;
param_2[2] = uVar17;
param_2[5] = uVar14;
uVar12 = getCopReg(2,0xc);
param_2[8] = uVar12;
param_2[7] = uVar2;
param_2[6] = uVar18;
param_2[9] = uVar2 >> 0x10;
uVar16 = (uint)param_2 & 0xffffff | 0x9000000;
param_2 = param_2 + 10;
*puVar5 = (uint)param_2 & 0xffffff | *(uint *)((int)((ulonglong)uVar20 >> 0x20) + 0xc);
}
else {
uVar8 = getCopReg(2,0x6000);
uVar9 = getCopReg(2,0x6800);
uVar11 = getCopReg(2,0x7000);
setCopReg(2,in_zero,*(undefined4 *)(iVar4 + 0x18));
setCopReg(2,uVar2,*(undefined4 *)(iVar4 + 0x1c));
copFunction(2,0x180001);
*puVar5 = uVar12 & uVar2 | ~uVar12 & (uint)param_2;
}
uVar2 = *(uint *)(iVar6 + 8);
FUN_0001beb8();
uVar15 = *(uint *)(iVar6 + 0xc);
*param_2 = uVar16;
uVar12 = getCopReg(2,0x15);
param_2[1] = uVar12;
param_2[6] = uVar8;
param_2[3] = uVar19 << 0x10 | uVar15 >> 0x10;
param_2[8] = uVar9;
param_2[5] = uVar14 << 0x10 | uVar15 & 0xffff;
uVar12 = getCopReg(2,0xe);
param_2[2] = uVar12;
param_2[7] = uVar2;
param_2[4] = uVar11;
param_2[9] = uVar2 >> 0x10;
getCopReg(2,0xb800);
return CONCAT44(param_2 + 10,extraout_v1);
}