Correctly Close API Sockets + Add Some Symbols
This commit is contained in:
parent
1f12d55e22
commit
748b184760
@ -66,6 +66,7 @@
|
||||
* `Fix Crash When Spectated Entity Is Removed` (Enabled By Default)
|
||||
* `Fix Torch Placement` (Enabled By Default)
|
||||
* `Fix Eggs Spawning Abnormally Healthy Chickens` (Enabled By Default)
|
||||
* `Correctly Close API Sockets` (Enabled By Default)
|
||||
* Existing Functionality (All Enabled By Default)
|
||||
* `Fix Screen Rendering When Hiding HUD`
|
||||
* `Sanitize Usernames`
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define DEFAULT_USERNAME "StevePi"
|
||||
#define DEFAULT_RENDER_DISTANCE "Short"
|
||||
#define AUTO_GUI_SCALE 0
|
||||
#define MAX_GUI_SCALE 8
|
||||
|
||||
// State
|
||||
struct State {
|
||||
|
@ -13,10 +13,10 @@
|
||||
|
||||
// Render Distances
|
||||
static constexpr std::array render_distances = {
|
||||
"Far",
|
||||
"Normal",
|
||||
"Tiny",
|
||||
"Short",
|
||||
"Tiny"
|
||||
"Normal",
|
||||
"Far"
|
||||
};
|
||||
|
||||
// Construct
|
||||
@ -120,7 +120,7 @@ void ConfigurationUI::draw_main() const {
|
||||
ImGui::InputText(labels[0], &state.username);
|
||||
// Render Distance
|
||||
int render_distance_index = get_render_distance_index();
|
||||
if (ImGui::Combo(labels[1], &render_distance_index, render_distances.data(), int(render_distances.size()))) {
|
||||
if (ImGui::SliderInt(labels[1], &render_distance_index, 0, int(render_distances.size()) - 1, state.render_distance.c_str(), ImGuiSliderFlags_NoInput | ImGuiSliderFlags_AlwaysClamp)) {
|
||||
state.render_distance = render_distances[render_distance_index];
|
||||
}
|
||||
// UI Scale
|
||||
@ -129,7 +129,7 @@ void ConfigurationUI::draw_main() const {
|
||||
if (gui_scale_int <= AUTO_GUI_SCALE) {
|
||||
scale_format = "Automatic";
|
||||
}
|
||||
if (ImGui::SliderInt(labels[2], &gui_scale_int, 0, 8, scale_format.c_str())) {
|
||||
if (ImGui::SliderInt(labels[2], &gui_scale_int, 0, MAX_GUI_SCALE, scale_format.c_str())) {
|
||||
state.gui_scale = float(gui_scale_int);
|
||||
if (state.gui_scale < AUTO_GUI_SCALE) {
|
||||
state.gui_scale = AUTO_GUI_SCALE;
|
||||
|
@ -140,6 +140,7 @@ CATEGORY Bug Fixes
|
||||
CATEGORY API
|
||||
TRUE Fix HUD When Spectating Other Players
|
||||
TRUE Fix Crash When Spectated Entity Is Removed
|
||||
TRUE Correctly Close API Sockets
|
||||
TRUE Fix Reloading Textures On Resize
|
||||
TRUE Fix options.txt Loading/Saving
|
||||
TRUE Fix Hanging When No Valid Spawn Point Exists
|
||||
|
@ -561,6 +561,27 @@ static void LevelRenderer_entityRemoved_injection(LevelRenderer *self, Entity *e
|
||||
}
|
||||
}
|
||||
|
||||
// Close Sockets
|
||||
static void CommandServer__close_injection(CommandServer__close_t original, CommandServer *self) {
|
||||
// Close
|
||||
for (const ConnectedClient &client : self->clients) {
|
||||
close(client.sock);
|
||||
}
|
||||
self->clients.clear();
|
||||
// Call Original Method
|
||||
original(self);
|
||||
}
|
||||
static void Minecraft_leaveGame_injection(Minecraft_leaveGame_t original, Minecraft *self, const bool save_remote_level) {
|
||||
// Destroy Server
|
||||
CommandServer *&server = self->command_server;
|
||||
if (server) {
|
||||
server->destructor(0);
|
||||
server = nullptr;
|
||||
}
|
||||
// Call Original Method
|
||||
original(self, save_remote_level);
|
||||
}
|
||||
|
||||
// Init
|
||||
void init_api() {
|
||||
if (feature_has("Implement RaspberryJuice API", server_enabled)) {
|
||||
@ -579,4 +600,8 @@ void init_api() {
|
||||
if (feature_has("Fix Crash When Spectated Entity Is Removed", server_enabled)) {
|
||||
patch_vtable(LevelRenderer_entityRemoved, LevelRenderer_entityRemoved_injection);
|
||||
}
|
||||
if (feature_has("Correctly Close API Sockets", server_enabled)) {
|
||||
overwrite_calls(CommandServer__close, CommandServer__close_injection);
|
||||
overwrite_calls(Minecraft_leaveGame, Minecraft_leaveGame_injection);
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ set(SRC
|
||||
src/network/packet/ChatPacket.def
|
||||
src/network/packet/PlayerActionPacket.def
|
||||
src/network/packet/MovePlayerPacket.def
|
||||
src/network/packet/SetEntityMotionPacket.def
|
||||
src/entity/EntityFactory.def
|
||||
src/entity/PrimedTnt.def
|
||||
src/entity/CameraEntity.def
|
||||
|
@ -3,9 +3,11 @@ method void dispatchPacket(Packet &packet) = 0x6a548;
|
||||
static-method bool setSocketBlocking(int fd, bool param_1) = 0x6a2d4;
|
||||
method bool _updateClient(ConnectedClient &client) = 0x6ba6c;
|
||||
method void _close() = 0x6a314;
|
||||
method void *destructor(int unknown) = 0x6a6a0;
|
||||
|
||||
property Minecraft *minecraft = 0x18;
|
||||
property OffsetPosTranslator pos_translator = 0x1c;
|
||||
property std::vector<ConnectedClient> clients = 0x40;
|
||||
|
||||
static-property std::string Fail = 0x137dbc;
|
||||
static-property std::string Ok = 0x138a08;
|
||||
|
@ -33,9 +33,9 @@ property Level *level = 0x24;
|
||||
property float old_x = 0x7c;
|
||||
property float old_y = 0x80;
|
||||
property float old_z = 0x84;
|
||||
property float vel_x = 0x34;
|
||||
property float vel_y = 0x38;
|
||||
property float vel_z = 0x3c;
|
||||
property float velocity_x = 0x34;
|
||||
property float velocity_y = 0x38;
|
||||
property float velocity_z = 0x3c;
|
||||
property float yaw = 0x40;
|
||||
property float pitch = 0x44;
|
||||
property float old_yaw = 0x48;
|
||||
|
@ -67,3 +67,4 @@ property Dimension *dimension = 0x74;
|
||||
property bool no_update = 0x70;
|
||||
property ChunkSource *chunk_source = 0xa5c;
|
||||
property LevelData data = 0xa64;
|
||||
property RakNetInstance *rak_net_instance = 0x78;
|
||||
|
9
symbols/src/network/packet/SetEntityMotionPacket.def
Normal file
9
symbols/src/network/packet/SetEntityMotionPacket.def
Normal file
@ -0,0 +1,9 @@
|
||||
extends Packet;
|
||||
|
||||
size 0x1c;
|
||||
vtable 0x109498;
|
||||
|
||||
property int entity_id = 0xc;
|
||||
property float velocity_x = 0x10;
|
||||
property float velocity_y = 0x14;
|
||||
property float velocity_z = 0x18;
|
Loading…
x
Reference in New Issue
Block a user