Skip to content

Commit

Permalink
Migrate to using pymhf as the backend -> 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyman192 committed Jul 31, 2024
1 parent 9448209 commit c50a014
Show file tree
Hide file tree
Showing 51 changed files with 582 additions and 2,766 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ node_modules
CRITICAL_ERROR.txt

**/__pycache__/**
stuff/
extractors/**
logs/
nmspy/data/functions/
.cache/*

extractors_v2/extracted/**
.venv/
21 changes: 21 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 monkeyman192

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include nmspy/pymhf.cfg
7 changes: 0 additions & 7 deletions NMS.py.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/basic_mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Our first mod will be something simple which will demonstate a number of concept

```py
import nmspy.data.function_hooks as hooks
from nmspy.hooking import disable, main_loop, on_key_pressed, on_key_release
from pymhf.core.hooking import disable, main_loop, on_key_pressed, on_key_release
from nmspy.memutils import map_struct
import nmspy.data.structs as nms_structs
from nmspy.mod_loader import NMSMod
Expand Down
4 changes: 3 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# NMS.py
# pyMHF

*pyMHF* is a python Modding and Hooking Framework.
It is designed to make it very easy to create libraries for any game or application which can then be used to make mods.
4 changes: 2 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
1. Ensure that python 3.9+ is installed
1. Install the required dependencies. Run the following in the current directory: `python -m pip install -r requirements.txt`
1. (Optional - only if you want to be able to reload mods) Install `cyminhook` from the `_cyminhook` folder. I have precompiled wheels for both python 3.9 and 3.10. Install by running `python -m pip install ./_cyminhook/cyminhook-0.1.4-cp39-cp39-win_amd64.whl` (change `39` to `310` for python 3.10).
1. Modify `NMS.py.cfg` to have the correct binary path. Note that currently the only supported binary is the one which has the hash listed in the file. You can check the hash of your NMS binary by running `certutil -hashfile "NMS.exe" SHA1` in the directory with the NMS.exe binary.
1. Modify `pymhf.cfg` to have the correct binary path. Note that currently the only supported binary is the one which has the hash listed in the file. You can check the hash of your NMS binary by running `certutil -hashfile "NMS.exe" SHA1` in the directory with the NMS.exe binary.
1. in a terminal run `python main.py`

You should have another popup appear with the NMS.py logo at the top, and then a series of log messages.
You should have another popup appear with the pyMHF logo at the top, and then a series of log messages.
If this doesn't occur then your firewall may be blocking the port 6770, so make sure that a TCP connection is allowed on this port on your local network (ie. 127.0.0.0, or possibly 0.0.0.)

If all goes well you should see `"Serving on executor ('127.0.0.1', 6770)"`
Expand Down
21 changes: 21 additions & 0 deletions docs/writing_libraries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Writing Libraries

The primary usage of *pyMHF* is to facilitate writing python libraries which can then be used to write mods.
*pyMHF* provides all the tools required to make setting up a library easy, so that one only has to provide the definitions and all the hooking and mod complexity will be handled automatically.

Follow the next steps to get your library project set up.

## Creating the folder structure

```
LibraryName
├── functions
│ ├── __init__.py
│ ├── call_sigs.py
│ ├── hooks.py
│ ├── offsets.py
├── types
│ ├── structs.py
├── __init__.py
└── pymhf.cfg
```
9 changes: 5 additions & 4 deletions docs/writing_mods.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
## Writing a mod using NMS.py
## Writing a mod using pyMHF

NMS.py contains offsets and mappings for many functions in the game.
*pyMHF* contains offsets and mappings for many functions in the game.
It aims to make hooking the various game functions as simple as possible with an easy to understand syntax.

First, we need a mod class which will contain all the relevant hooks for your mod.

The basics look something like this:

```py
from nmspy.mod_loader import NMSMod
from pymhf import Mod

class MyMod(NMSMod):
class MyMod(Mod):
__author__ = "you!"
__description__ = "Your fantastic mod!"
__version__ = "1.0"
Expand All @@ -24,6 +24,7 @@ This is best shown with an example:

```py
import logging
from pymhf import Mod
import nmspy.data.function_hooks as hooks

class MyMod(NMSMod):
Expand Down
241 changes: 0 additions & 241 deletions injected.py

This file was deleted.

Loading

0 comments on commit c50a014

Please sign in to comment.