Skip to content

Commit

Permalink
Remove included simpleini
Browse files Browse the repository at this point in the history
  • Loading branch information
ikt32 committed Jul 3, 2021
1 parent 6d3bb02 commit d88ec66
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

56 changes: 30 additions & 26 deletions README.md
@@ -1,29 +1,29 @@
# GTA V Menu
# ScriptHookV Menu Base

This is intended as a simple menu for SHV/C++ mods that mimics the looks of the game's menus.
This is intended as a simple menu for ScriptHookV scripts,
which mimics the looks of the game's menus.

![Comparison](MenuCompare.png)

## Building

### Setting up
Requirements:

* [ScriptHookV SDK by Alexander Blade](http://www.dev-c.com/gtav/scripthookv/)
* [simpleini (included as submodule)](https://github.com/brofield/simpleini)
* Added such that `#include <inc/main.h>` can be found
* Uses `natives.h` generated from [alloc8ors Native DB](https://alloc8or.re/gta5/nativedb/)
* [simpleini](https://github.com/brofield/simpleini)
* Added such that `#include <simpleini/SimpleIni.h` can be found

Add this repository as submodule:

Add this repository as submodule and update submodules, such that simpleini is cloned with it:
```sh
git submodule add https://github.com/E66666666/GTAVMenuBase
git submodule update --init --recursive
```

Your project should have the ScriptHookV SDK root in the "additional include folders", such that this works:

```cpp
#include <inc/natives.h>
```

Feel free to take a look at how my scripts use this menu:
Example implementations

* [Ghost Replay](https://github.com/E66666666/GTAVGhostReplay)
* [Manual Transmission](https://github.com/E66666666/GTAVManualTransmission)
* [Addon Spawner](https://github.com/E66666666/GTAVAddonLoader)
* [VStancer](https://github.com/E66666666/GTAVStancer)
Expand All @@ -32,24 +32,23 @@ Full menu example:

* [GTAVMenuExample](https://github.com/E66666666/GTAVMenuExample)

The `natives.h` used in the code is from [alloc8ors Native DB](https://alloc8or.re/gta5/nativedb/) - this
differs from the natives generated by [Alexander Blades' Native DB DB](http://www.dev-c.com/nativedb/), so take caution.

## Usage

Check [GTAVMenuExample's implementation](https://github.com/E66666666/GTAVMenuExample/blob/master/GTAVMenuExample/script.cpp) to see the source code.

`update_menu()` is the main update loop. This should be called every tick.

Required methods inside `update_menu()`:

* `CheckKeys`
* accepts a `MenuControls` pointer and a void `std::function`, so a function is called
* accepts a `MenuControls` pointer and a void `std::function`, so a function is called
when the menu gets opened. The function can be `nullptr` if no functionality is desired.
* `EndMenu`
* Draws all sprites that should be drawn, like backgrounds and check boxes, and draws any
other additional information.

Required menus and items:

* Main menu
* Check the description how to do this
* Title
Expand All @@ -58,12 +57,15 @@ Required menus and items:
For a more complete example (working build), check [GTAVMenuExample](https://github.com/E66666666/GTAVMenuExample).

## Input handling
`MenuControls` does input checking, so it can distinguish between key press, key being pressed, key being released. This applies both to keyboard input (`GetAsyncKeyState`) and native inputs (`IS_DISABLED_CONTROL_PRESSED`). Conflicts/delays between these two shouldn't occur as that's handled in `CheckKeys`: if a GetAsyncKeyState is detected, native controls are temporarily
blocked. This should prevent ghosting when a menu key is assigned to the same key the game

`MenuControls` does input checking, so it can distinguish between key press, key being pressed, key being released. This applies both to keyboard input (`GetAsyncKeyState`) and native inputs (`IS_DISABLED_CONTROL_PRESSED`). Conflicts/delays between these two shouldn't occur as that's handled in `CheckKeys`: if a GetAsyncKeyState is detected, native controls are temporarily
blocked. This should prevent ghosting when a menu key is assigned to the same key the game
navigation controls are binded to.

## Details

There are two detail panes available:

* Info pane to the right
* Details pane below the menu

Expand All @@ -90,15 +92,17 @@ should be enough.
Feel free to use the issues, or post in the [thread on the GTA5-Mods forums](https://forums.gta5-mods.com/topic/12090/tool-wip-c-shv-lightweight-menu-library).

## Remarks

If you're also not using [ScriptHookVDotNet](https://github.com/crosire/scripthookvdotnet) with [NativeUI](https://github.com/Guad/NativeUI) and just want something less painful than the mess that happens in the ScriptHookV Simple Trainer example, I hope this is of some use for you.

This thing started out as something I needed for [VStancer](https://github.com/E66666666/GTAVStancer)
where Unknown Modder on GTA5-Mods linked me the SudoMod menu sources.
This thing started out as something I needed for [VStancer](https://github.com/E66666666/GTAVStancer)
where Unknown Modder on GTA5-Mods linked me the SudoMod menu sources.

Good luck modding!
Good luck modding!

## Credits
* DireDan for the [original implementation for sudomod](https://www.unknowncheats.me/forum/grand-theft-auto-v/200692-originbase-sudomod-1-37-a.html)
* Sudomod authors
* NativeUI authors
* alloc8or

* DireDan for the [original implementation for sudomod](https://www.unknowncheats.me/forum/grand-theft-auto-v/200692-originbase-sudomod-1-37-a.html)
* Sudomod authors
* NativeUI authors
* alloc8or
2 changes: 1 addition & 1 deletion menusettings.cpp
@@ -1,6 +1,6 @@
#include "menusettings.h"

#include <thirdparty/simpleini/SimpleIni.h>
#include <simpleini/SimpleIni.h>

#include "menucontrols.h"
#include "menukeyboard.h"
Expand Down
1 change: 0 additions & 1 deletion thirdparty/simpleini
Submodule simpleini deleted from 2af65f

0 comments on commit d88ec66

Please sign in to comment.