A C++ library to attach to the NieR:Automata process and read/write memory.
NieRHook Demo
Using NieRHook
CMake Projects
Dinamyc Library (.dll)
Static Library
Build NieRHook
Memory Reference
NieRHook Reference
#include <Windows.h>
#include <TlHelp32.h>
#include <iostream>
#include <thread>
#include "NierHook.hpp"
using namespace std;
//Function used to exit the program
void ENDPressed(NieRHook* hook) {
while (true) {
if (GetKeyState(VK_END) & 0x8000) //END button pressed
{
//Disable cheats before exiting
hook->InfiniteDoubleJump(false);
hook->IgnoreUpgradeMaterials(false);
//Stop hook
hook->stop();
return;//exit function
}
}
}
/*This is a showcase program of the hook
* As NieR:Automata is a x64 program, you must compile this solution in x64.
*/
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);//Look for memory leaks
NieRHook hook;
cout << "Hooking..." << endl;
//Hook to process
while (!hook.isHooked()) {
hook.start();
}
cout << "Hooked" << endl;
//Enable some cheats
hook.InfiniteDoubleJump(true);
hook.IgnoreUpgradeMaterials(true);
//Add some items
//For ID reference please visit github.com/Asiern/NieRHook Readme
hook.addItem(510, 80); //Beast Hide ID => 510
hook.addItem(0, 10); //Small Recovery => ID 0
hook.addItem(721, 1); //Data chip B => ID 721
hook.addItem(400, 99); //E-Drug => ID 400
//Add some weapons
hook.addWeapon(0x4D8, 1); //Type-40 Blade => ID 0x4D8
hook.addWeapon(0x41A, 1); //Type-40 Sword => ID 0x41A
//Create a thread to exit when the 'END' button is pressed
std::thread exitThread(ENDPressed, &hook);
//Print some values
while (hook.isHooked()) {
hook.update();//update hook internal values (Position, Health, Level...)
std::cout << "X: " << hook.getXPosition() << " Y: " << hook.getYPosition() << " Z: " << hook.getYPosition() << std::endl;
std::cout << "Health: " << hook.getHealth() << std::endl;
std::cout << "Press END to exit..." << std::endl;
Sleep(500);
system("cls");
}
//Join thread and exit
exitThread.join();
return (0);
}
Clone NieRHook
git clone https://github.com/Asiern/NieRHook/
Edit your CMakeLists.txt
add_subdirectory(lib/NieRHook)
target_link_libraries(${PROJECT_NAME} NieRHook)
target_include_directories(${PROJECT_NAME} PUBLIC /lib/NieRHook/include)
If you make use of winsock2.h, you need to add the following definition into your CMakeLists.txt
add_definitions(-DUSING_WINSOCK2)
|--- Project/
| include/
| lib/
| |--- NieRHook/
| | | include/
| | | src/
| | | CMakeLists.txt
| src/
| CMakeLists.txt
Requirements:
- CMake
- Microsoft
Desktop development with C++
toolkit
set "cmake.configureArgs": [ "-DNIERHOOK_STATIC_LIB=ON" ],
at .vscode/setting.json
set "cmake.configureArgs": [ "-DNIERHOOK_STATIC_LIB=OFF" ],
at .vscode/setting.json
You can find all the used IDs and offsets here
Start
- attach the hook toNieRAutomata.exe
processStop
- detach the hook from processisHooked
- return true if hookedisSaveLoaded
- returns true if a savefile is loaded, otherwise falsehookStatus
- ensures the status of the hook, if processID changes stops the hookgetProcessID
- returns process IDupdate
- refresh hook & attributes
Items
addItem
- Adds a specific quantity of items to the inventory (See item IDs at Memory Reference)removeItem
-Removes item from memory (See item IDs at Memory Reference)readInventory
- Read all items from memory and returns a vector (See item IDs at Memory Reference)addWeapon
- Adds a weapon to the inventory (See weapon IDs at Memory Reference)removeWeapon
- Removes a weapon from the inventory (See weapon IDs at Memory Reference)readWeapons
- Read all weapons from memory and returns a vector (See item IDs at Memory Reference)
Cheats
NoClip
- enables or disables No ClipNoCooldown
- enables or disables No CooldownInfiniteDoubleJump
- enables or disables Infinite Double JumpInfiniteAirDash
- enables or disables Infinite Air DashIgnoreUpgradeMaterials
- enables or disables Ignore Upgrade MaterialsFreeCamera
- enables or disables free camera movementSetA2Dash
- Set A2 type dashSet2BDash
- Set 2B type dashInfiniteBuffDuration
- enables or diables Infinite Buff DurationSaveAnywhere
- enables or disables Save AnywhereInfiniteConsumableItems
- enables or disables Infinite Consumable Items
Getters
isSavefileLoaded
- returns true if savefile is loadedgetVersion
- retuns game versiongetLevel
- returns player's levelgetHealth
- returns player's healthgetMaxHealth
- returns player's max healthgetFunds
- returns player's Funds(G)getEXP
- returns player's EXPgetXPosition
- returns player's X positiongetYPosition
- returns player's Y positiongetZPosition
- returns player's Z positiongetMusicVolume
- returns music volumegetSoundEffectVolume
- returns sound effect volumegetVoiceVolume
- returns voice volumegetAudioOutput
- returns audio outputgetVoiceChanger
- returns voice changergetBrightness
- returns brightnessgetDistance
- returns distancegetCombatDistance
- returns combat distancegetVerticalRotationSpeed
- returns vertical rotation speedgetHorizontalRotationSpeed
- returns horizontal rotation speedgetHorizontalAutoAdjust
- returns horizontal auto adjustgetVerticalAutoAdjust
- returns vertical auto adjustgetFreeEnemyTracking
- returns free enemy trackinggetZoomSpeed
- returns zoom speedgetPursuitSpeed
- returns pursuit speedgetLockedEnemyTracking
- returns locked enemy trackinggetHUDOpacity
- return HUD opacity
Setters
setPosition
- sets the position of the playersetHealth
- sets player healthsetGameSpeed
- sets game speedsetHUDOpacity
- sets the opacity of the HUDsetColor
- sets RGBColor combinationsetMusicVolume
- sets music volumesetSoundEffectVolume
- sets sound effect volumesetVoiceVolume
- sets voice volumesetAudioOutput
- sets audio outputsetVoiceChanger
- sets voice changersetBrightness
- sets brightnesssetDistance
- sets distancesetCombatDistance
- sets combat distancesetVerticalRotationSpeed
- sets vertical rotation speedsetHorizontalRotationSpeed
- sets horizontal rotation speedsetHorizontalAutoAdjust
- sets horizontal auto adjustsetVerticalAutoAdjust
- sets vertical auto adjustsetFreeEnemyTracking
- sets free enemy trackingsetZoomSpeed
- sets zoom speedsetPursuitSpeed
- sets pursuit speedsetLockedEnemyTracking
- sets locked enemy trackingsetColor
- sets color