Skip to content

Instantly share code, notes, and snippets.

@BalintCsala
Last active July 27, 2020 23:14
Show Gist options
  • Save BalintCsala/b4de9c45a183e448e069c1012e039c41 to your computer and use it in GitHub Desktop.
Save BalintCsala/b4de9c45a183e448e069c1012e039c41 to your computer and use it in GitHub Desktop.
/* WARNING: Unknown calling convention yet parameter storage is locked */
/* OverworldGenerator::postProcess(ChunkViewSource&) */
ulong postProcess(ChunkViewSource *param_1)
{
uint uVar1;
uint uVar2;
code *pcVar3;
int iVar4;
bool bVar5;
byte bVar6;
byte bVar7;
int iVar8;
int iVar9;
Range RVar10;
int iVar11;
int *piVar12;
undefined8 uVar13;
uint *puVar14;
undefined8 uVar15;
Biome *this;
long lVar16;
undefined4 extraout_var;
undefined4 extraout_var_00;
undefined4 extraout_var_01;
BlockSource *pBVar17;
long *in_RSI;
uint uVar18;
long in_FS_OFFSET;
int iStack988;
int iStack984;
byte bStack793;
shared_ptr<LevelChunk> asStack792 [16];
ChunkPos aCStack776 [8];
unique_ptr<std--vector<short,std--allocator<short>>,std--default_delete<std--vector<short,std--allocator<short>>>>
auStack768 [8];
undefined auStack760 [16];
undefined auStack744 [16];
undefined auStack728 [16];
Range aRStack712 [2];
undefined4 auStack704 [2];
undefined8 uStack696;
Range aRStack688 [2];
undefined4 auStack680 [2];
undefined8 uStack672;
BonusChestFeature aBStack664 [24];
Random aRStack640 [16];
Range aRStack624 [2];
undefined4 auStack616 [2];
undefined8 uStack608;
LakeFeature aLStack600 [40];
Random aRStack560 [16];
LakeFeature aLStack544 [40];
Random aRStack504 [16];
BlockPos aBStack488 [16];
Tick aTStack472 [8];
Tick aTStack464 [8];
BlockTickingQueue aBStack456 [232];
vector<LevelChunkBlockActorAccessToken,std--allocator<LevelChunkBlockActorAccessToken>>
avStack224 [24];
undefined auStack200 [16];
shared_ptr<LevelChunk> asStack184 [16];
ChunkPos aCStack168 [8];
BlockTickingQueue aBStack160 [72];
BlockTickingQueue aBStack88 [72];
long lStack16;
lStack16 = *(long *)(in_FS_OFFSET + 0x28);
if (DAT_10c6beb0 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6beb0);
}
_ZN15ChunkViewSource7getAreaEv(in_RSI);
piVar12 = (int *)getBounds();
ChunkPos(aCStack168,*piVar12 + 1,piVar12[2] + 1);
(**(code **)(*in_RSI + 0x20))
((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)asStack184,
in_RSI,aCStack168);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
puVar14 = (uint *)_ZNK10LevelChunk11getPositionEv(uVar13);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_ZNK10LevelChunk12getDimensionEv(uVar13);
uVar13 = getPostProcessingManager();
_ZN21PostprocessingManager7tryLockERK8ChunkPos(auStack200,uVar13,puVar14);
bVar6 = _ZNK21PostprocessingManager4OwnscvbEv(auStack200);
if ((bVar6 & 1) == 0) {
bStack793 = 0;
}
else {
if (DAT_10c6bed8 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bed8);
}
_ZN15ChunkViewSource23enableBlockEntityAccessEv(avStack224,in_RSI);
uVar13 = _ZNK11ChunkSource8getLevelEv(in_RSI);
uVar15 = _ZNK11ChunkSource12getDimensionEv(in_RSI);
_ZN11BlockSourceC1ER5LevelR9DimensionR11ChunkSourcebb(aBStack456,uVar13,uVar15,in_RSI,0);
Tick(aTStack464,1);
BlockTickingQueue(aBStack88,(Tick)0x30,0);
Tick(aTStack472,1);
BlockTickingQueue(aBStack160,(Tick)0x28,1);
_ZN11BlockSource15setTickingQueueER17BlockTickingQueue(aBStack456,aBStack88);
_ZN11BlockSource21setRandomTickingQueueER17BlockTickingQueue(aBStack456,aBStack160);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_ZNK10LevelChunk6getMaxEv(uVar13);
this = (Biome *)_ZN11BlockSource8getBiomeERK8BlockPos(aBStack456);
lVar16 = operator->((
InstancedThreadLocal<OverworldGenerator--ThreadData,std--allocator<OverworldGenerator--ThreadData>>
*)(param_1 + 0xd8f8));
lVar16 = lVar16 + 0x41810;
uVar1 = *puVar14;
uVar2 = puVar14[1];
BlockPos(aBStack488,uVar1 * 0x10,0,uVar2 * 0x10);
_ZN5Level7getSeedEv(*(undefined8 *)(param_1 + 0x10));
uVar18 = (uint)lVar16;
setSeed(uVar18);
nextInt();
nextInt();
_ZN5Level7getSeedEv(*(undefined8 *)(param_1 + 0x10));
setSeed(uVar18);
bVar5 = false;
bVar6 = operator!=(this,_ZN13VanillaBiomes7mDesertE);
iVar4 = (int)register0x00000020;
if (((bVar6 & 1) != 0) &&
(bVar6 = operator!=(this,_ZN13VanillaBiomes12mDesertHillsE), (bVar6 & 1) != 0)) {
if (DAT_10c6bf00 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bf00);
}
iVar8 = nextInt(uVar18);
if (iVar8 == 0) {
iVar8 = nextInt(uVar18,3);
iVar9 = nextInt(uVar18);
nextInt(uVar18,3);
if ((0x3b < iVar9) || (((byte)param_1[0x48] & 1) == 0)) {
offset(iVar4 + -0x1f8,iVar4 + -0x1e8,iVar8);
LakeFeature(aLStack544,_ZN13VanillaBlocks11mStillWaterE);
place((BlockSource *)aLStack544,(BlockPos *)aBStack456,aRStack504);
bVar5 = true;
~LakeFeature(aLStack544);
}
}
}
if (((!bVar5) && (((byte)param_1[0x48] & 1) == 0)) && (iVar8 = nextInt(uVar18), iVar8 == 0)) {
if (DAT_10c6bf28 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bf28);
}
iVar8 = nextInt(uVar18,3);
nextInt(uVar18);
iVar9 = nextInt(uVar18);
nextInt(uVar18,3);
if ((0x3b < iVar9) && ((iVar9 < 0x40 || (iVar9 = nextInt(uVar18), iVar9 == 0)))) {
offset(iVar4 + -0x230,iVar4 + -0x1e8,iVar8);
LakeFeature(aLStack600,_ZN13VanillaBlocks10mStillLavaE);
place((BlockSource *)aLStack600,(BlockPos *)aBStack456,aRStack560);
~LakeFeature(aLStack600);
}
}
_ZN5Level7getSeedEv(*(undefined8 *)(param_1 + 0x10));
setSeed(uVar18);
nextInt();
nextInt();
_ZN5Level7getSeedEv(*(undefined8 *)(param_1 + 0x10));
setSeed(uVar18);
bVar6 = _ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xd958,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
if (((byte)param_1[0x48] & 1) == 0) {
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xddc0,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xdab8,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xdc60,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xdf18,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe200,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
if (DAT_10c6bf50 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bf50);
}
RVar10 = range<int,1>(8);
uStack608 = CONCAT44(extraout_var,RVar10);
auStack616[0] = begin();
aRStack624[0] = end();
while (bVar7 = operator!=((iterator *)auStack616,aRStack624), (bVar7 & 1) != 0) {
operator*((iterator *)auStack616);
iVar8 = nextInt(uVar18);
iVar9 = nextInt(uVar18);
iVar11 = nextInt(uVar18);
BlockPos((BlockPos *)aRStack640,uVar1 * 0x10 + 8 + iVar8,iVar9,uVar2 * 0x10 + 8 + iVar11);
place((BlockSource *)(param_1 + 0xdf00),(BlockPos *)aBStack456,aRStack640);
operator++((iterator *)auStack616);
}
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe368,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
uVar13 = _ZNK11ChunkSource8getLevelEv(param_1);
uVar13 = _ZN5Level12getLevelDataEv(uVar13);
_ZNK9LevelData18getBaseGameVersionEv(uVar13);
bVar7 = _ZNK15BaseGameVersion16isCompatibleWithERKS_(_ZN19VanillaGameVersions12NetherUpdateE);
if ((bVar7 & 1) != 0) {
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe4d0,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
}
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe620,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe090,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
_ZN16StructureFeature11postProcessER11BlockSourceR6Randomii
(param_1 + 0xe7b0,aBStack456,lVar16,(ulong)*puVar14,(ulong)puVar14[1]);
}
pcVar3 = *(code **)(*(long *)param_1 + 0xf0);
operator*((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)asStack184);
(*pcVar3)(param_1);
uVar13 = _ZN11BlockSource8getLevelEv(aBStack456);
uVar13 = _ZN5Level12getLevelDataEv(uVar13);
bVar7 = _ZNK9LevelData20hasBonusChestEnabledEv(uVar13);
if ((bVar7 & 1) != 0) {
uVar13 = _ZN11BlockSource8getLevelEv(aBStack456);
uVar13 = _ZN5Level12getLevelDataEv(uVar13);
bVar7 = _ZNK9LevelData20getBonusChestSpawnedEv(uVar13);
if ((bVar7 & 1) == 0) {
BonusChestFeature(aBStack664);
uVar13 = _ZN5Level12getLevelDataEv(*(undefined8 *)(param_1 + 0x10));
uVar13 = _ZNK9LevelData11getSpawnPosEv(uVar13);
_ZNK17BonusChestFeature5placeER11BlockSourceRK8BlockPosR6Random
(aBStack664,aBStack456,uVar13);
~BonusChestFeature(aBStack664);
}
}
_ZN5Level7getSeedEv(*(undefined8 *)(param_1 + 0x10));
setSeed(uVar18);
if (DAT_10c6bf78 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bf78);
}
uVar13 = operator*((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_ZN21BiomeDecorationSystem8decorateER5BiomeR10LevelChunkR11BlockSourceR6Random
(this,uVar13,aBStack456,lVar16);
if (DAT_10c6bfa0 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bfa0);
}
RVar10 = range<int,1>(0x10);
uStack672 = CONCAT44(extraout_var_00,RVar10);
auStack680[0] = begin();
aRStack688[0] = end();
while (bVar7 = operator!=((iterator *)auStack680,aRStack688), (bVar7 & 1) != 0) {
iVar8 = operator*((iterator *)auStack680);
RVar10 = range<int,1>(0x10);
uStack696 = CONCAT44(extraout_var_01,RVar10);
auStack704[0] = begin();
aRStack712[0] = end();
while (bVar7 = operator!=((iterator *)auStack704,aRStack712), (bVar7 & 1) != 0) {
operator*((iterator *)auStack704);
offset(iVar4 + -0x2d8,iVar4 + -0x1e8,iVar8);
uVar13 = _ZNK11BlockSource10getChunkAtERK8BlockPos(aBStack456,auStack728);
_ZN14WeatherHelpers18getTopRainBlockPosEP10LevelChunkRK8BlockPos
(auStack744,uVar13,auStack728);
below();
bVar7 = _ZN14WeatherHelpers12shouldFreezeER11BlockSourceRK8BlockPosb
(aBStack456,auStack760,0);
if ((bVar7 & 1) != 0) {
_ZN11BlockSource8setBlockERK8BlockPosRK5BlockiPK21ActorBlockSyncMessage
(aBStack456,auStack760,_ZN13VanillaBlocks4mIceE,2,0);
}
bVar7 = _ZN14WeatherHelpers10shouldSnowER11BlockSourceRK8BlockPos(aBStack456,auStack744);
if ((bVar7 & 1) != 0) {
_ZN11BlockSource8setBlockERK8BlockPosRK5BlockiPK21ActorBlockSyncMessage
(aBStack456,auStack744,_ZN13VanillaBlocks8mTopSnowE,2,0);
}
operator++((iterator *)auStack704);
}
operator++((iterator *)auStack680);
}
if (DAT_10c6bfc8 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bfc8);
}
pBVar17 = (BlockSource *)
operator*((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_fixWaterAlongEdges((LevelChunk *)param_1,pBVar17,aBStack456);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
bVar7 = _ZN10LevelChunk28checkSeasonsPostProcessDirtyEv(uVar13);
if ((bVar7 & 1) != 0) {
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_ZN10LevelChunk18recomputeHeightMapEb(uVar13,0);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
_ZN10LevelChunk23applySeasonsPostProcessER11BlockSource(uVar13,aBStack456);
}
if (DAT_10c6bff0 == '\0') {
/* WARNING: Subroutine does not return */
__cxa_guard_acquire(&DAT_10c6bff0);
}
_ZN17BlockTickingQueue19tickAllPendingTicksER11BlockSource(aBStack88,aBStack456);
_ZN17BlockTickingQueue19tickAllPendingTicksER11BlockSource(aBStack160,aBStack456);
uVar13 = operator->((__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false> *)
asStack184);
unique_ptr<std--default_delete<std--vector<short,std--allocator<short>>>,void>
((FuncDef10758 *)auStack768);
_ZN10LevelChunk23setPreWorldGenHeightMapESt10unique_ptrISt6vectorIsSaIsEESt14default_deleteIS3_EE
(uVar13);
~unique_ptr(auStack768);
if ((bVar6 & 1) != 0) {
iStack984 = *piVar12;
while (iStack984 < *piVar12 + 2) {
iStack988 = piVar12[2];
while (iStack988 < piVar12[2] + 2) {
ChunkPos(aCStack776,iStack984,iStack988);
(**(code **)(*in_RSI + 0x20))(asStack792,in_RSI,aCStack776,*(code **)(*in_RSI + 0x20));
uVar13 = operator->((
__shared_ptr_access<LevelChunk,(__gnu_cxx--_Lock_policy)2,false,false>
*)asStack792);
_ZN10LevelChunk10setUnsavedEv(uVar13);
~shared_ptr(asStack792);
iStack988 = iStack988 + 1;
}
iStack984 = iStack984 + 1;
}
}
bStack793 = 1;
~BlockTickingQueue(aBStack160);
~BlockTickingQueue(aBStack88);
_ZN11BlockSourceD2Ev(aBStack456);
~vector(avStack224);
}
_ZN21PostprocessingManager4OwnsD2Ev(auStack200);
~shared_ptr(asStack184);
if (*(long *)(in_FS_OFFSET + 0x28) != lStack16) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return (ulong)bStack793;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment