diff --git a/VERSION b/VERSION index c043eea..b1b25a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.1 +2.2.2 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5018b78..5682ed8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +**2.2.2** +* Add More Missing Sound Events +* Make Missing Sound Event Cause Warning Rather Than Crash + **2.2.1** * Prevent `random.burp` Sound From Crashing Game * Always Cleanup Media Layer, Even On Crash diff --git a/images/start.png b/images/start.png index d3e926e..ff3aa47 100644 Binary files a/images/start.png and b/images/start.png differ diff --git a/media-layer/core/src/audio/file.cpp b/media-layer/core/src/audio/file.cpp index f3bad10..1dab96c 100644 --- a/media-layer/core/src/audio/file.cpp +++ b/media-layer/core/src/audio/file.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/mods/src/sound/repository.cpp b/mods/src/sound/repository.cpp index fdc0cf5..5d7a6de 100644 --- a/mods/src/sound/repository.cpp +++ b/mods/src/sound/repository.cpp @@ -321,6 +321,30 @@ static std::unordered_map> repository = { { "PCM_burp" } + }, + { + "random.fizz", + { + "PCM_fizz" + } + }, + { + "random.drink", + { + "PCM_drink" + } + }, + { + "random.chestopen", + { + "PCM_chestopen" + } + }, + { + "random.chestclosed", + { + "PCM_chestclosed" + } } } }; @@ -337,7 +361,8 @@ std::string _sound_pick(std::string sound) { return options[rand() % options.size()]; } else { // Invalid Sound - ERR("Invalid Sound: %s", sound.c_str()); + WARN("Invalid Sound Event: %s", sound.c_str()); + return ""; } } diff --git a/mods/src/sound/sound.cpp b/mods/src/sound/sound.cpp index a438d2d..1f63122 100644 --- a/mods/src/sound/sound.cpp +++ b/mods/src/sound/sound.cpp @@ -62,17 +62,18 @@ std::string _sound_get_source_file() { // Play Sound // The pitch value is unsued because it causes glitchy sounds, it is seemingly unused in MCPE as well. -static void SoundEngine_playUI_injection(__attribute__((unused)) unsigned char *sound_engine, std::string const& name, __attribute__((unused)) float pitch, float volume) { +static void play(std::string name, float x, float y, float z, float volume, bool is_ui) { std::string source = _sound_get_source_file(); - if (source.size() > 0) { - media_audio_play(source.c_str(), _sound_pick(name).c_str(), 0.0f, 0.0f, 0.0f, 1.0f, volume, 1); + std::string resolved_name = _sound_pick(name); + if (source.size() > 0 && resolved_name.size() > 0) { + media_audio_play(source.c_str(), resolved_name.c_str(), x, y, z, 1.0f, volume, is_ui); } } +static void SoundEngine_playUI_injection(__attribute__((unused)) unsigned char *sound_engine, std::string const& name, __attribute__((unused)) float pitch, float volume) { + play(name, 0, 0, 0, volume, true); +} static void SoundEngine_play_injection(__attribute__((unused)) unsigned char *sound_engine, std::string const& name, float x, float y, float z, __attribute__((unused)) float pitch, float volume) { - std::string source = _sound_get_source_file(); - if (source.size() > 0) { - media_audio_play(source.c_str(), _sound_pick(name).c_str(), x, y, z, 1.0f, volume, 0); - } + play(name, x, y, z, volume, false); } // Refresh Data diff --git a/symbols/include/symbols/minecraft.h b/symbols/include/symbols/minecraft.h index 97ec0ae..8ce53c8 100644 --- a/symbols/include/symbols/minecraft.h +++ b/symbols/include/symbols/minecraft.h @@ -164,6 +164,14 @@ static void *LoginPacket_read_vtable_addr = (void *) 0x108dcc; static uint32_t LoginPacket_username_property_offset = 0xc; // RakString +// StartGamePacket + +typedef void (*StartGamePacket_read_t)(unsigned char *packet, unsigned char *bit_stream); +static StartGamePacket_read_t StartGamePacket_read = (StartGamePacket_read_t) 0x72c58; +static void *StartGamePacket_read_vtable_addr = (void *) 0x109264; + +static uint32_t StartGamePacket_game_mode_property_offset = 0x14; // int32_t + // ChatPacket static uint32_t ChatPacket_message_property_offset = 0xc; // char * @@ -206,17 +214,6 @@ typedef ItemInstance *(*ItemInstance_constructor_extra_t)(ItemInstance *item_ins static ItemInstance_constructor_extra_t ItemInstance_constructor_tile_extra = (ItemInstance_constructor_extra_t) 0x99918; static ItemInstance_constructor_extra_t ItemInstance_constructor_item_extra = (ItemInstance_constructor_extra_t) 0x99960; -// Player - -typedef int (*Player_isUsingItem_t)(unsigned char *player); -static Player_isUsingItem_t Player_isUsingItem = (Player_isUsingItem_t) 0x8f15c; - -typedef void (*Player_drop_t)(unsigned char *player, ItemInstance *item_instance, bool is_death); -static uint32_t Player_drop_vtable_offset = 0x208; - -static uint32_t Player_username_property_offset = 0xbf4; // char * -static uint32_t Player_inventory_property_offset = 0xbe0; // Inventory * - // Entity typedef void (*Entity_die_t)(unsigned char *entity, unsigned char *cause); @@ -237,8 +234,23 @@ typedef void (*Mob_actuallyHurt_t)(unsigned char *entity, int32_t damage); static Mob_actuallyHurt_t Mob_actuallyHurt = (Mob_actuallyHurt_t) 0x7f11c; static uint32_t Mob_actuallyHurt_vtable_offset = 0x16c; +typedef float (*Mob_getWalkingSpeedModifier_t)(unsigned char *entity); + static uint32_t Mob_health_property_offset = 0xec; // int32_t +// Player + +typedef int (*Player_isUsingItem_t)(unsigned char *player); +static Player_isUsingItem_t Player_isUsingItem = (Player_isUsingItem_t) 0x8f15c; + +typedef void (*Player_drop_t)(unsigned char *player, ItemInstance *item_instance, bool is_death); +static uint32_t Player_drop_vtable_offset = 0x208; + +static Mob_getWalkingSpeedModifier_t Player_getWalkingSpeed = (Mob_getWalkingSpeedModifier_t) 0x8ea0c; + +static uint32_t Player_username_property_offset = 0xbf4; // char * +static uint32_t Player_inventory_property_offset = 0xbe0; // Inventory * + // LocalPlayer static Mob_actuallyHurt_t LocalPlayer_actuallyHurt = (Mob_actuallyHurt_t) 0x44010;