Skip to content

Commit

Permalink
prepare for second release
Browse files Browse the repository at this point in the history
Signed-off-by: cppimmo <[email protected]>
  • Loading branch information
cppimmo committed Jun 22, 2022
1 parent 2e1e35e commit 81f97fa
Show file tree
Hide file tree
Showing 5 changed files with 344 additions and 111 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Changelog

<!-- https://keepachangelog.com -->

## Version 1.0.0 - 21 Mar 2022

### Added
- Initial release.

### Fixed

### Changed

### Known Issues

## Version 1.0.1 - 22 Mar 2022

### Added
- Add more error handling.
- Add basic configuration structure with defaults.
- Implement configuration structure as argument to `FmGui::StartupHook().`
- Add comments.
- Add implementation for OnResize. Not used yet.

### Fixed
- Fixed crashes due to derefrencing ImGuiContext on mission restart.

### Changed
- Updated instructions in *README.md*.
- Inform users that static linking is prefered.
- Updated *Examples/Fm.cpp*.

### Known Issues
- Crashes on second mission quit when ImGui IniFileName is not null pointer.
53 changes: 34 additions & 19 deletions Examples/Fm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

// The user's ImGuiRoutine function:
void
FMImGuiRoutine(void)
FmGuiRoutine(void)
{
/*
* Set up your ImGui widgets here. Refer to the ImGui documentation and
* examples for creating widgets.
*/
/*
* Set up your ImGui widgets here. Refer to the ImGui documentation and
* examples for creating widgets.
*/
ImGui::ShowDemoWindow();
// ImGui::ShowAboutWindow();
// ImGui::ShowUserGuide();
Expand All @@ -25,12 +25,14 @@ FMImGuiRoutine(void)

// The user's ImGuiInputRoutine function:
void
FMImGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
FmGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
/*
* Handle input. See the links below for Win32 input handling.
*
*/
/*
* Handle input. See the links below for Win32 input handling.
* https://docs.microsoft.com/en-us/windows/win32/inputdev/keyboard-input
* https://docs.microsoft.com/en-us/windows/win32/learnwin32/keyboard-input
* https://docs.microsoft.com/en-us/windows/win32/inputdev/using-keyboard-input
*/
if (uMsg == WM_KEYDOWN) {
if (wParam == 'W') {
std::printf("W key pressed!\n");
Expand All @@ -44,17 +46,30 @@ FMImGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
void
ed_fm_set_plugin_data_install_path(const char *path)
{
// Start the FmGui and associated hook.
if (!FmGui::StartupHook()) {
/*
* Optional configuration. For more information and default values see the
* FmGuiConfig struct in FmGui.hpp.
*/
FmGuiConfig fmGuiConfig;
/*
* This following line is known to cause crashes on the second mission's
* quit:
* fmGuiConfig.imGuiIniFileName = std::string(path) + "/bin/imgui.ini";
*/
fmGuiConfig.imGuiStyle = FmGuiStyle::CLASSIC; // FmGuiStyle::DARK

// Start the FmGui and associated hook.
// You can ommit the fmGuiConfig arugment entirely: FmGui::StartupHook() is valid.
if (!FmGui::StartupHook(fmGuiConfig)) {
std::fprintf(stderr, "FmGui::StartupHook failed!\n");
}
else {
// Print the addresses of the D3D11 context.
std::printf("%s", FmGui::AddressDump().c_str());
// Set the pointers to your ImGui and ImGui Input routines.
FmGui::SetImGuiRoutinePtr(FMImGuiRoutine);
FmGui::SetImGuiInputRoutinePtr(FMImGuiInputRoutine);
// Set the widget visibility to ON.
// Print the addresses of the D3D11 context.
std::printf("%s\n", FmGui::AddressDump().c_str());
// Set the pointers to your ImGui and ImGui Input routines.
FmGui::SetImGuiRoutinePtr(FmGuiRoutine);
FmGui::SetImGuiInputRoutinePtr(FmGuiInputRoutine);
// Set the widget visibility to ON.
FmGui::SetWidgetVisibility(true);
}
}
Expand All @@ -64,7 +79,7 @@ ed_fm_set_plugin_data_install_path(const char *path)
void
ed_fm_release(void)
{
// Finally close the FmGui and associated hook.
// Finally close the FmGui and associated hook.
if (!FmGui::ShutdownHook()) {
std::fprintf(stderr, "FmGui::ShutdownHook failed...\n");
}
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,47 @@ below.
- FmGui.hpp
- FmGui.cpp
- .vcxproj in this directory.
- .sln in this directory.

In Visual Studio select your project in the Solution Explorer and then add the
following entry to *Configuration Properties -> C/C++ -> General -> Additional
Include Directories*: $(ProjectDir)..\lib\imgui-1.87\

As for the MinHook v1.3.3 binary release, assume the same project directory
As for the MinHook v1.3.3 release, assume the same project directory
structure.

- EFM
- lib
- MinHook_133_bin
- bin
- MinHook.x64.lib
- MinHook_133 (directory has been renamed)
- lib
- libMinHook-v\<Platform Toolset\>-\<Run-time Type\>.x64.lib
- include
- MY_EFM_PROJECT
- FmGui.hpp
- FmGui.cpp
- .vcxproj in this directory.
- .sln in this directory.

To add the include directory and link statically for MinHook you can use the
following instructions:
I personally recommended downloading the the
[static library release](https://github.com/TsudaKageyu/minhook/releases/download/v1.3.3/MinHook_133_lib.zip)
for MinHook or building it from source. That way you don't have to worry about
having multiple dynamic link libraries in your aircraft mod's bin folder.

To add the include directory and link statically for the MinHook static library
release you can use the following instructions:

In Visual Studio select your project in the Solution Explorer and then add the
following entry to *Configuration Properties -> C/C++ -> General -> Additional
Include Directories*: $(ProjectDir)..\lib\MinHook_133_bin\include\
Include Directories*: $(ProjectDir)..\lib\MinHook_133\include\

Select *Configuration Properties -> Linker -> General -> Additional Libraries
Directories* and add $(ProjectDir)/../lib/MinHook_133_bin/bin/
Directories* and add $(ProjectDir)/../lib/MinHook_133/lib/

Select *Configuration Properties -> Linker -> Input -> Additional Dependencies*
and add MinHook.x64.lib
In the MinHook_133/lib/ directory, you will see several different static
libraries. You will most likely want to link against libMinHook-x64-v141-mt.lib
for your release builds and libMinHook-x64-v141-mtd.lib for your debug builds.
Add these for you different configurations in *Configuration Properties ->
Linker -> Input -> Additional Dependencies*.

Phew, I think that's everything.

Expand All @@ -119,6 +129,8 @@ These source files were built and tested using Visual Studio Community 2022,
Windows 10 SDK Version 10.0.19041.0, the C++20 Standard, the MinHook library
v1.3.3, the DirectX SDK Version _____, and the ImGui library version 1.87.

The minimum C++ ISO Standard requirement for these files is C++11.

## 5. License: <a name="license"></a>

This project is licensed under the permissive BSD 2-Clause License. For more
Expand Down
Loading

0 comments on commit 81f97fa

Please sign in to comment.