Skip to content

Commit

Permalink
修复mspt闪退,NCUD不能用以及实体系统更新时间无法测试的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohengying committed Jul 26, 2021
1 parent 144bca3 commit 68d959a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 54 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ target_include_directories(${MOD_API_NAME}
target_link_libraries(${MOD_API_NAME} ${PROJECT_SOURCE_DIR}/api/lib/detours.lib)

####################这里是具体功能##########################
set(TRAPDOOR_VERSION 0.9.6)
set(TRAPDOOR_VERSION 0.9.6.1)
set(MCBE_VERSION 1.17.10.04)
set(BETA OFF)
set(TEST_NUMBER 3)
Expand Down
2 changes: 1 addition & 1 deletion api/Offset.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ constexpr uint64_t DIMENSION_GET_CIRCUIT_SYSTEM = 0x21;

constexpr uint64_t CIRCUIT_GET_GRAPH = 0x8;

constexpr uint64_t DIMENSION_IS_RS_TICK = 0x45;
constexpr uint64_t DIMENSION_IS_RS_TICK = 0x4B;
//! Spawner::_spawnMobCluster
constexpr uint64_t MOB_SPAWN_DATA_GET_RULE = 184;

Expand Down
42 changes: 22 additions & 20 deletions api/world/Dimension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
//

#include "Dimension.h"
#include <cstdio>
#include "tools/DirtyLogger.h"
#include "Offset.h"
#include "tools/DirtyLogger.h"
#include <cstdio>
namespace trapdoor {
//打印维度上限,目前没屌用
void Dimension::printBaseTypeLimit() {
//from Spawner::_popCapAllows
char *dim = reinterpret_cast<char *>(this);
auto *surface = (float *) (dim + 80);
auto *underground = (float *) (dim + 108);
for (int i = 0; i < 7; i++) {
printf("%.3f %.3f\n", surface[i], underground[i]);
}
void Dimension::printBaseTypeLimit() {
// from Spawner::_popCapAllows
char *dim = reinterpret_cast<char *>(this);
auto *surface = (float *)(dim + 80);
auto *underground = (float *)(dim + 108);
for (int i = 0; i < 7; i++) {
printf("%.3f %.3f\n", surface[i], underground[i]);
}
}

CircuitSceneGraph *Dimension::getGraph() {
//这种代码真的写的人瘆得慌
//!from Dimension::tickRedstone(Dimension *this)
uint64_t *circuitSystem = reinterpret_cast<uint64_t *>(this) + off::DIMENSION_GET_CIRCUIT_SYSTEM;
return reinterpret_cast<CircuitSceneGraph *> (*circuitSystem + off::CIRCUIT_GET_GRAPH);
}
CircuitSceneGraph *Dimension::getGraph() {
//这种代码真的写的人瘆得慌
//! from Dimension::tickRedstone(Dimension *this)
uint64_t *circuitSystem =
reinterpret_cast<uint64_t *>(this) + off::DIMENSION_GET_CIRCUIT_SYSTEM;
return reinterpret_cast<CircuitSceneGraph *>(*circuitSystem +
off::CIRCUIT_GET_GRAPH);
}

bool Dimension::isRedstoneTick() {
//为1是红石刻2是非红石刻
return *((uint32_t *) this + off::DIMENSION_IS_RS_TICK) == 1;
}
bool Dimension::isRedstoneTick() {
//为1是红石刻2是非红石刻
return *((uint32_t *)this + off::DIMENSION_IS_RS_TICK) == 1;
}
} // namespace trapdoor
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.17.1.01-0.9.6
2021-07-26
- 修复MSPT的概率性闪退
- 修复NCUD无法使用的问题
- 修复实体系统tick时间无法测试的问题


# 1.17.1.01-0.9.6
2021-07-14

Expand Down
3 changes: 1 addition & 2 deletions mod/TrapdoorMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ void TrapdoorMod::registerCommands() {
}))

->then(ARG("ncud", "command.func.ncud.desc", BOOL, {
FUNC_DISABLED(player)
return;
// FUNC_DISABLED(player)
this->singleFunctions.preventNCUpdate = holder->getBool();
info(player, LANG("command.func.ncud.set"), holder->getBool());
}));
Expand Down
54 changes: 24 additions & 30 deletions mod/function/SingleFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,34 @@
// Created by xhy on 2020/12/23.
//

#include "lib/mod.h"
#include "lib/SymHook.h"
#include "BDSMod.h"
#include "TrapdoorMod.h"
#include "lib/SymHook.h"
#include "lib/mod.h"

namespace mod {
using namespace SymHook;

THook(
void,
MSSYM_B1QA7explodeB1AA9ExplosionB2AAA7QEAAXXZ,
void * exp
) {
auto modInstance = trapdoor::bdsMod->asInstance<mod::TrapdoorMod>();
if (!modInstance->getSingFunction().preventExplosion)
original(exp);
}
using namespace SymHook;

/**
* SYM_CALL(
void(*)(BlockSource * self,const BlockPos *pos),
MSSYM_B1QE17updateNeighborsAtB1AE11BlockSourceB2AAE17QEAAXAEBVBlockPosB3AAAA1Z,
this, pos
);
*/
THook(void, MSSYM_B1QA7explodeB1AA9ExplosionB2AAA7QEAAXXZ, void *exp) {
auto modInstance = trapdoor::bdsMod->asInstance<mod::TrapdoorMod>();
if (!modInstance->getSingFunction().preventExplosion)
original(exp);
}

THook(
void,
/**
* SYM_CALL(
void(*)(BlockSource * self,const BlockPos *pos),
MSSYM_B1QE17updateNeighborsAtB1AE11BlockSourceB2AAE17QEAAXAEBVBlockPosB3AAAA1Z,
trapdoor::BlockSource *source,
trapdoor::BlockPos * pos
) {
auto modInstance = trapdoor::bdsMod->asInstance<mod::TrapdoorMod>();
if (!modInstance->getSingFunction().preventNCUpdate)
original(source, pos);
}
}
this, pos
);
*/

THook(
void,
MSSYM_B1QE17updateNeighborsAtB1AE11BlockSourceB2AAE17QEAAXAEBVBlockPosB3AAAA1Z,
trapdoor::BlockSource *source, trapdoor::BlockPos *pos) {
auto modInstance = trapdoor::bdsMod->asInstance<mod::TrapdoorMod>();
if (!modInstance->getSingFunction().preventNCUpdate)
original(source, pos);
}
} // namespace mod

0 comments on commit 68d959a

Please sign in to comment.