Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to AmethystRuntime 1.4.1 #9

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ cmake_minimum_required(VERSION 3.12)

# Mod Options
project(VidereLonge CXX ASM_NASM)
set(MOD_VERSION "1.3.0")
set(MOD_VERSION "1.3.1")
set(MOD_AUTHOR "ATXL")

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /await")

# Amethyst Minecraft Folder
set(AmethystFolder "$ENV{localappdata}/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/amethyst/")

Expand Down
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,68 @@ Currently stable on Minecraft Bedrock Edition 1.21.0.3 with Amethyst Runtime 1.3
## How do I run this?
1. Ensure you have developer mode enabled on Windows, if you don't know how see [this tutorial](https://consumer.huawei.com/en/support/content/en-us15594140/#:~:text=Click%20the%20Windows%20icon%20and,Mode%20in%20certain%20system%20versions).

2. Use a Minecraft version manager, for example [Bedrock Launcher](https://bedrocklauncher.github.io/) or [MCLauncher](https://github.com/MCMrARM/mc-w10-version-launcher) (most require your PC user account to have administrator level premissions).
2. Download, play, and close Minecraft Bedrock 1.21.0.3

3. Download, play, and close Minecraft Bedrock 1.21.0.3
3. Find and install the latest Amethyst [Launcher](https://github.com/FrederoxDev/Amethyst-Launcher/releases/latest) and [Runtime](https://github.com/FrederoxDev/Amethyst/releases/latest) release Amethyst's releases page.

4. Find and install the latest Amethyst Launcher and Runtime release in [Amethyst's releases page](https://github.com/FrederoxDev/Amethyst/releases/latest).
4. Go to the mod manager menu and click the `Open Mods Folder` button.

5. Open the mods folder.
<img src="assets/openModsFolder.png" width=400 />

<img src="assets/modFolderHover.png" width="200"/>
5. Download the latest [ViderēLongē release](https://github.com/ATXLtheAxolotl/VidereLonge/releases/latest).

6. Download the latest [ViderēLongē release](https://github.com/ATXLtheAxolotl/VidereLonge/releases/latest).
6. Bring the AmethystRuntime and ViderēLongē zip files to your mods folder like this:

7. Bring the AmethystRuntime and ViderēLongē zip files to your mods folder like this:
<img src="assets/modZipped.png" width=400 />

<img src="assets/modZipped.png" width="400"/>
7. Extract both zip files, the structure should look like the following.

9. Extract both zip files, the structure should look like the following.
<img src="assets/movedFolders.png" width=400 />

<img src="assets/movedFolders.png" width="400"/>
8. Go back to Amethyst Launcher, reload the page with `Ctrl + R`, then go to the profile editor page.

10. Relaunch AmethystLauncher, select `[email protected]` under `Runtime Mod`, and click `[email protected]` under `Inactive Mods` to activate it. The end result should look like this.
9. Create or use your existing mod profile.

<img src="assets/profileEditor.png" width=400 />

10. Select the latest runtime that you downloaded, and click ViderēLongē from the `Inactive Mods` list to bring it over to the active mods. After that, press `Save Profile`.

<img src="assets/selectedMods.png" width=400 />

11. Launch the game, and have fun!

<img src="assets/launchGame.png" width=400 />

11. Click `Launch Game`, and enjoy VidēreLongē.

## My game is crashing when I launch? What do I do?

Join the [Amethyst modding Discord guild](https://discord.gg/DcCksKssfD), we'll be happy to help (just don't ping me ;) )!
Join the [Amethyst modding Discord guild](https://discord.gg/DcCksKssfD), we'll be happy to help (just don't spam ping us ;) )!

## How do I change the zoom keybind?
1. Go to your settings

<img src="assets/titleScreen.png" width="300"/>
<img src="assets/titleScreen.png" width=400 />

2. Click `Keyboard & Mouse`

<img src="assets/hoverKeyboardMouse.png" width="300"/>
<img src="assets/hoverKeyboardMouse.png" width=400 />

3. Scroll until you find `key.zoom`, then bind it to the desired key.

<img src="assets/keybindHover.png" width="300"/>
<img src="assets/keybindHover.png" width=400 />

## How do I change the config?
1. Open the mods folder.

<img src="assets/modFolderHover.png" width="200"/>
<img src="assets/openModsFolder.png" width=400 />

2. Find the VidēreLongē folder.

<img src="assets/movedFolders.png" width="400"/>
<img src="assets/movedFolders.png" width=400 />

3. Open `config.json` and change it to whatever you please.

<img src="assets/modConfig.png" width="400"/>
<img src="assets/modConfig.png" width=400 />

> **Note**
> A default config.json should be made automatically once you start the game however you can still manually make it if you like.
Expand All @@ -106,3 +115,7 @@ Join the [Amethyst modding Discord guild](https://discord.gg/DcCksKssfD), we'll
* This was made with Blender using two assets from Sketchfab.
* [Construction Steve](https://sketchfab.com/3d-models/construction-steve-41f6a232772c4b069eab765ef96a0ec1) by [Ghost99](https://sketchfab.com/Ghost99) using the [CC By 4.0 Deed License](https://creativecommons.org/licenses/by/4.0/). This work was modified.
* [Spyglass](https://sketchfab.com/3d-models/spyglass-d1c88de81f594dc79786f16d497fd908) by [Azumiru](https://sketchfab.com/Azumiru) using the [CC By 4.0 Deed License](https://creativecommons.org/licenses/by/4.0/).

## Contributions

* Thanks to @KingRocco21 for updating the mod to [email protected] #9
Binary file added assets/launchGame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/modFolderHover.png
Binary file not shown.
Binary file added assets/openModsFolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/profileEditor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/selectedMods.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/ZoomManager.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "ZoomManager.hpp"

static ZoomManager* mInstance;
ZoomManager::ZoomManager(AmethystContext* context, ConfigManager* config) {
ZoomManager::ZoomManager(AmethystContext& context, ConfigManager* config) {
mConfig = config;

context->mHookManager.CreateHook<&BaseOptions::getSensitivity>(ZoomManager::mGetSensitivity, ZoomManager::sensitivityHook);
context->mHookManager.CreateHook<&LevelRendererPlayer::getFov>(ZoomManager::mGetFov, ZoomManager::fovHook);
context.mHookManager->CreateHook<&BaseOptions::getSensitivity>(ZoomManager::mGetSensitivity, ZoomManager::sensitivityHook);
context.mHookManager->CreateHook<&LevelRendererPlayer::getFov>(ZoomManager::mGetFov, ZoomManager::fovHook);

mInstance = this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ZoomManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#include "minecraft/src-client/common/client/renderer/game/LevelRendererPlayer.hpp"
#include "minecraft/src-client/common/client/options/BaseOptions.hpp"

#include "amethyst/runtime/AmethystContext.hpp"
#include "amethyst/runtime/ModContext.hpp"
#include "amethyst/runtime/HookManager.hpp"

#include "ConfigManager.hpp"
#include <chrono>

class ZoomManager {
public:
ZoomManager(AmethystContext*, ConfigManager*);
ZoomManager(AmethystContext&, ConfigManager*);
static ZoomManager* getInstance();
void setEnabled(bool);

Expand Down
37 changes: 21 additions & 16 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include "minecraft/src-client/common/client/renderer/game/LevelRendererPlayer.hpp"
#include "minecraft/src-client/common/client/options/BaseOptions.hpp"

#include "amethyst/runtime/events/EventManager.hpp"
#include "amethyst/runtime/AmethystContext.hpp"
#include "amethyst/runtime/events/InputEvents.hpp"
#include "amethyst/runtime/events/GameEvents.hpp"
#include "amethyst/runtime/events/ModEvents.hpp"
#include "amethyst/runtime/HookManager.hpp"
#include "amethyst/runtime/ModContext.hpp"
#include "amethyst/Log.hpp"

#include "ConfigManager.hpp"
Expand All @@ -16,20 +18,20 @@
ConfigManager* configManager;
ZoomManager* zoomManager;

AmethystContext* context;
void RegisterInputs(RegisterInputsEvent& event) { event.inputManager.RegisterNewInput("zoom", { 0x43 }); }
void OnStartJoinGame(OnStartJoinGameEvent& event) {
auto& inputs = *Amethyst::GetContext().mInputManager;

void RegisterInputs(Amethyst::InputManager* input) { input->RegisterNewInput("zoom", { 0x43 }); }
void OnStartJoinGame(ClientInstance* ci) {
context->mInputManager.AddButtonDownHandler("zoom", [](FocusImpact focus, ClientInstance& client) {
inputs.AddButtonDownHandler("zoom", [](FocusImpact focus, ClientInstance& client) {
zoomManager->setEnabled(true);
}, false);

context->mInputManager.AddButtonUpHandler("zoom", [](FocusImpact focus, ClientInstance& client) {
inputs.AddButtonUpHandler("zoom", [](FocusImpact focus, ClientInstance& client) {
zoomManager->setEnabled(false);
}, false);
}

void BeforeModShutdown() {
void BeforeModShutdown(BeforeModShutdownEvent& event) {
if(zoomManager != nullptr) {
delete zoomManager;
zoomManager = nullptr;
Expand All @@ -41,18 +43,21 @@ void BeforeModShutdown() {
}
}

extern "C" __declspec(dllexport) void Initialize(AmethystContext* ctx) {
context = ctx;
extern "C" __declspec(dllexport) void Initialize(AmethystContext& ctx) {
Amethyst::InitializeAmethystMod(ctx);

context->mHookManager.RegisterFunction<&LevelRendererPlayer::getFov>("48 8B C4 48 89 58 ? 48 89 70 ? 57 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 44 0F 29 48 ? 48 8B 05");
context->mHookManager.RegisterFunction<&BaseOptions::getSensitivity>("40 53 48 83 EC ? 80 B9 ? ? ? ? ? 8B DA");
Amethyst::GetContext().mFeatures->enableInputSystem = true;

ctx.mHookManager->RegisterFunction<&LevelRendererPlayer::getFov>("48 8B C4 48 89 58 ? 48 89 70 ? 57 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 44 0F 29 48 ? 48 8B 05");
ctx.mHookManager->RegisterFunction<&BaseOptions::getSensitivity>("40 53 48 83 EC ? 80 B9 ? ? ? ? ? 8B DA");

configManager = new ConfigManager();
zoomManager = new ZoomManager(context, configManager);
zoomManager = new ZoomManager(ctx, configManager);

context->mEventManager.beforeModShutdown.AddListener(BeforeModShutdown);
context->mEventManager.onStartJoinGame.AddListener(OnStartJoinGame);
context->mEventManager.registerInputs.AddListener(RegisterInputs);
auto& events = Amethyst::GetEventBus();
events.AddListener<BeforeModShutdownEvent>(BeforeModShutdown);
events.AddListener<OnStartJoinGameEvent>(OnStartJoinGame);
events.AddListener<RegisterInputsEvent>(RegisterInputs);

Log::Info("[VidereLonge] Mod successfully initialized!");
}
Expand Down