mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
Compare commits
158 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5641e06a19 | |||
| 88ec6dbcee | |||
| 1b614c94a7 | |||
| 37c5913f69 | |||
| 2eca668593 | |||
| aec1da9d16 | |||
| 548b441f1f | |||
| 98bc285d98 | |||
| 553c180bee | |||
| 537252440e | |||
| 13a0877d38 | |||
| 50691b79f1 | |||
| ad229dabdb | |||
| bdff33a420 | |||
| 4b21821aa4 | |||
| 6b47b5db50 | |||
| a10ca5236b | |||
| be2dab9a1a | |||
| 02711cdee1 | |||
| c6b10402f4 | |||
| 58ea6ce17e | |||
| 8cc00c371a | |||
| 8e2985d8d0 | |||
| 8d3b15641f | |||
| 033e9f926a | |||
| da58503b47 | |||
| cffee2b7f8 | |||
| 32801319fa | |||
| afbe013811 | |||
| 862e4717f6 | |||
| d3fa27ae4a | |||
| b487cf2bcf | |||
| 0fc3aa5818 | |||
| 276874f882 | |||
| 1fdd270480 | |||
| 07cb6048a0 | |||
| 61d79f76b2 | |||
| 7335d07e30 | |||
| 9f99b71112 | |||
| 5c3921a99c | |||
| 9fc397b8bc | |||
| ddc8061268 | |||
| c0698a3872 | |||
| 1ed3521091 | |||
| 0dda920448 | |||
| 5f7580b69e | |||
| 3ef1b3ecaa | |||
| 931811da14 | |||
| 7624ded512 | |||
| a5252939dd | |||
| 808ac0c557 | |||
| 4e138b244e | |||
| 3fcd1bdbc9 | |||
| f857e63d5d | |||
| b462c838f6 | |||
| 4d658bf273 | |||
| 67721c416b | |||
| 0b5f7787be | |||
| a554c8f923 | |||
| 6592191624 | |||
| 164592b16d | |||
| 81f879e7ff | |||
| 1af8b3de61 | |||
| c33fef606f | |||
| a9fc6ef1b2 | |||
| d530bfcd65 | |||
| c96f4330d2 | |||
| 26a2a0f481 | |||
| 11b9790e6c | |||
| 1dfcf8c087 | |||
| 5c7ad0d51e | |||
| 587ae86341 | |||
| 926f2ef2a0 | |||
| d262e02f8c | |||
| f6b63473a0 | |||
| 1ad45edd6e | |||
| e79de3b117 | |||
| f783a5a1cd | |||
| 7848d5c237 | |||
| cec735a81b | |||
| 753702e32e | |||
| 7bd7503951 | |||
| d0c38956bf | |||
| 77bca2baee | |||
| 46e8c8a5a5 | |||
| 4d58e5d080 | |||
| 168084d672 | |||
| 740ed90d95 | |||
| 61c17f15b4 | |||
| 99035f312f | |||
| aafc916bb6 | |||
| c5eb1e999b | |||
| 7c15452c1e | |||
| 4bc849ccdb | |||
| 58481a035b | |||
| 66b3de8e5c | |||
| 257afe0cd3 | |||
| aafea3b1c1 | |||
| 346a159157 | |||
| 54028d8cbb | |||
| 621b702ed4 | |||
| 26ea8a1b92 | |||
| 6e7bf99af8 | |||
| df9d9d8673 | |||
| b3cee1dfcc | |||
| f40c382903 | |||
| e4cfb808bf | |||
| 61d14a16e8 | |||
| 521e87ea41 | |||
| 2b735ffd55 | |||
| 4f72b0a98b | |||
| 474f5f5203 | |||
| 205cf29aff | |||
| bf9074a76e | |||
| 44e1edb50c | |||
| 41d0dce6e9 | |||
| 598422b701 | |||
| b58a1ccfcc | |||
| 60efd643d1 | |||
| 0596eeb6fe | |||
| 3d5c64feb7 | |||
| 610984f40e | |||
| 1e271b7352 | |||
| 07c78caf01 | |||
| d153209d8a | |||
| 48186245fe | |||
| f7c274591a | |||
| d1a20e58b6 | |||
| 1e02c31524 | |||
| 66fab48a5b | |||
| ae06652148 | |||
| bd6c8d3f3c | |||
| e88abec2a6 | |||
| 6de8b529d2 | |||
| 7301cdaa6c | |||
| 6969dfcdd1 | |||
| edaf5a386f | |||
| 302f08dd57 | |||
| 68f5a614ef | |||
| 5db43031f2 | |||
| 873ade757a | |||
| 3c8dc9de32 | |||
| 4694b59cec | |||
| 4f1ada7a2f | |||
| 104a9cbffd | |||
| 45a52cff90 | |||
| bf79b5d2aa | |||
| e74c60f61d | |||
| 89921e5ec2 | |||
| 1b7ebd6fc2 | |||
| 165cc6028f | |||
| 8dc835bf52 | |||
| 8241641502 | |||
| 6de122c9f8 | |||
| b267ad09ac | |||
| e0dd371d61 | |||
| f8f45a0cbd | |||
| bf8ba050ce |
@@ -0,0 +1,32 @@
|
|||||||
|
on: [push, pull_request]
|
||||||
|
name: Continuous Integration
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
fw-ci:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./src/spice2x
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set ccache environment variables
|
||||||
|
run: |
|
||||||
|
echo "CCACHE_DIR=${{ github.workspace }}/src/spice2x/.ccache" >> $GITHUB_ENV
|
||||||
|
- name: Install ccache
|
||||||
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
|
- name: Calculate commit SHA
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||||
|
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
|
||||||
|
- name: Compile
|
||||||
|
run: ./build_docker.sh
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: spice2x-ci-${{ env.COMMIT_SHORT_SHA }}
|
||||||
|
path: src/spice2x/bin
|
||||||
|
if-no-files-found: error
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
.vscode/*
|
||||||
|
|
||||||
|
# JetBrains IDEs
|
||||||
|
.idea
|
||||||
|
.idea_modules
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build*
|
||||||
|
|
||||||
|
# user config
|
||||||
|
build_all.local.sh
|
||||||
|
build_docker.local.sh
|
||||||
+8
-4
@@ -30,12 +30,11 @@ Do not change the names of options, buttons binds, analogs, etc - since they are
|
|||||||
* All currently supported games / versions must continue to work.
|
* All currently supported games / versions must continue to work.
|
||||||
* Backwards compatibility must be preserved, unless there is a really good reason to break it. This includes (but not limited to): global/local config files, command line parameters, game patches, device interop (e.g., card readers), and SpiceAPI / Companion interop.
|
* Backwards compatibility must be preserved, unless there is a really good reason to break it. This includes (but not limited to): global/local config files, command line parameters, game patches, device interop (e.g., card readers), and SpiceAPI / Companion interop.
|
||||||
* Reasonable level of compatibility with the last release of original spicetools is expected. The stated goal of spice2x is to be a drop-in replacement for spicetools.
|
* Reasonable level of compatibility with the last release of original spicetools is expected. The stated goal of spice2x is to be a drop-in replacement for spicetools.
|
||||||
* Simply put, if someone has an existing install of spicetools/spice2x, copying over new version of spice2x should not result in different behavior or loss of functionality.
|
* Simply put, if someone has an existing install of spicetools/spice2x, copying over new version of spice2x should not result in vastly different behavior or major loss of functionality.
|
||||||
* Make sure you compile with the included Docker script and ensure you do not introduce **any** new compiler warnings or build breaks. The Docker script is the standard build environment, your custom Linux build environment or MSVC can be used during development, but you must validate the final build using Docker.
|
* Make sure you compile with the included Docker script and ensure you do not introduce **any** new compiler warnings or build breaks. The Docker script is the standard build environment, your custom Linux build environment or MSVC can be used during development, but you must validate the final build using Docker.
|
||||||
* Do not submit snippets of code as a "patch". Exceptions can be made for trivial changes (correct a typo, fix a single line of code...), but otherwise, a successfully compiled & fully tested patch file is required when submitting for review.
|
|
||||||
* Do not make code changes in unrelated areas; i.e., do not run code linters and auto-formatters for parts of the code that you didn't modify.
|
* Do not make code changes in unrelated areas; i.e., do not run code linters and auto-formatters for parts of the code that you didn't modify.
|
||||||
* Try to submit smaller chunks of code, instead one gigantic patch. For example, don't submit a patch for "Improve feature XYZ"; instead, submit "Change how A works to prepare for feature XYZ" "Refactor B for feature XYZ" "Add feature B to enable feature XYZ".
|
* Try to submit smaller chunks of code, instead one gigantic patch. For example, don't submit a patch for "Improve feature XYZ"; instead, submit "Change how A works to prepare for feature XYZ" "Refactor B for feature XYZ" "Add feature B to enable feature XYZ".
|
||||||
* Write to the log for anything useful - it helps immensely with debugging post-mortem. At the same time though, avoid spamming the log for something trivial.
|
* Write to the log for anything useful - it helps immensely with troubleshooting and debugging. At the same time though, avoid spamming the log for something trivial.
|
||||||
|
|
||||||
### UI text
|
### UI text
|
||||||
spice2x has a global audience; majority of the user base do not speak English as their first language.
|
spice2x has a global audience; majority of the user base do not speak English as their first language.
|
||||||
@@ -44,7 +43,7 @@ Use simple English, avoid colloquialism, and use concise language, even if it's
|
|||||||
|
|
||||||
### Using OS APIs
|
### Using OS APIs
|
||||||
|
|
||||||
Avoid making permanent changes to user's OS configuration. For example, spice should not make a call to set power profile to Maximum Performance, or switch default audio device. Making the reverse call to restore settings on game shutdown is **not** good enough; there is no guarantee that spice will gracefully shutdown, since games (or spice) can crash. This is to avoid inadvertently putting user's PC into a bad state, which can be seen as malware-like behavior.
|
Avoid making permanent changes to user's OS configuration. For example, spice must not make a call to set power profile to Maximum Performance, or switch default audio device. Making the reverse call to restore settings on game shutdown is **not** good enough; there is no guarantee that spice will gracefully shutdown, since games (or spice) can crash. This is to avoid inadvertently putting user's PC into a bad state, which can be seen as malware-like behavior.
|
||||||
|
|
||||||
Watch out for legacy OS compatibility. Currently, the minimum support floor is Windows 7. If you use any Windows API, make sure it's supported in Windows 7. If you need to use API that is not present in Windows 7, you must not directly link against it, otherwise spice will fail to launch on older OSes. Take a look at Windows 8 touch code (win8.cpp) for examples on how to discover OS APIs via pointers.
|
Watch out for legacy OS compatibility. Currently, the minimum support floor is Windows 7. If you use any Windows API, make sure it's supported in Windows 7. If you need to use API that is not present in Windows 7, you must not directly link against it, otherwise spice will fail to launch on older OSes. Take a look at Windows 8 touch code (win8.cpp) for examples on how to discover OS APIs via pointers.
|
||||||
|
|
||||||
@@ -87,4 +86,9 @@ if (conditional)
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* Please give [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) a read. A few things to point out in spice codebase:
|
||||||
|
* We don't use GSL.
|
||||||
|
* Don't throw exceptions.
|
||||||
|
* Stick to smart pointers. For interfacing with C Win32 API and raw buffers, use `unique_plain_ptr`.
|
||||||
|
* Writing in C is also completely acceptable.
|
||||||
* Other than that, there are no strict rules for code formatting, but please attempt to emulate the style around the code you are modifying.
|
* Other than that, there are no strict rules for code formatting, but please attempt to emulate the style around the code you are modifying.
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ please do not ask for these, as it will never happen here.
|
|||||||
|
|
||||||
Rules for filing a new issue or adding comments to existing issues in the tracker:
|
Rules for filing a new issue or adding comments to existing issues in the tracker:
|
||||||
|
|
||||||
|
* Low effort submissions will be simply deleted, and repeated attempts will get you banned.
|
||||||
* Check the [known issues](https://github.com/spice2x/spice2x.github.io/wiki/Known-issues) page first before reporting a new issue. If you have some new information or workarounds for a known issue, you can file a documentation bug as well.
|
* Check the [known issues](https://github.com/spice2x/spice2x.github.io/wiki/Known-issues) page first before reporting a new issue. If you have some new information or workarounds for a known issue, you can file a documentation bug as well.
|
||||||
* Use the search function and see if there is an existing issue.
|
* Use the search function and see if there is an existing issue.
|
||||||
* This is not the place to obtain a guide or receive basic troubleshooting.
|
* This is not the place to obtain a guide or receive basic troubleshooting.
|
||||||
@@ -55,3 +56,6 @@ We explicitly do **NOT** have a Discord server for dicussions - we try to do eve
|
|||||||
|
|
||||||
Please see [CONTRIBUTING page](https://github.com/spice2x/spice2x.github.io/blob/main/CONTRIBUTING.md) for a full list of guidelines when submitting code.
|
Please see [CONTRIBUTING page](https://github.com/spice2x/spice2x.github.io/blob/main/CONTRIBUTING.md) for a full list of guidelines when submitting code.
|
||||||
|
|
||||||
|
## Additional information
|
||||||
|
|
||||||
|
Please read [README.md](https://github.com/spice2x/spice2x.github.io/blob/main/src/spice2x/README.md) inside `src/spice2x`.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
> * Please do note that this is a GPL v3.0 open source project.
|
> * Please do note that this is a GPL v3.0 open source project.
|
||||||
> * Please read the [CONTRIBUTING](https://github.com/spice2x/spice2x.github.io/blob/main/CONTRIBUTING.md) guide.
|
> * Please read the [CONTRIBUTING](https://github.com/spice2x/spice2x.github.io/blob/main/CONTRIBUTING.md) guide.
|
||||||
> * Maintainers reserve the right to reject or modify your submission without reason.
|
> * Maintainers reserve the right to reject or modify your submission without reason.
|
||||||
|
> * No new compiler warnings must be introduced. Check the CI build results.
|
||||||
>
|
>
|
||||||
> Feel free to remove this section after you have read it.
|
> Feel free to remove this section after you have read it.
|
||||||
|
|
||||||
@@ -12,8 +13,5 @@
|
|||||||
## Description of change
|
## Description of change
|
||||||
*what does this code do?*
|
*what does this code do?*
|
||||||
|
|
||||||
## Compiling
|
|
||||||
*you must be able to compile with the included Docker script with zero compiler warnings*
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
*how was the code tested?*
|
*how was the code tested?*
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ bin/**
|
|||||||
dist/**
|
dist/**
|
||||||
docker/**
|
docker/**
|
||||||
cmake-build*
|
cmake-build*
|
||||||
|
.ccache/**
|
||||||
@@ -16,4 +16,11 @@ build_docker.local.sh
|
|||||||
bin/*
|
bin/*
|
||||||
dist/*
|
dist/*
|
||||||
|
|
||||||
external/cv2pdb/*
|
external/cv2pdb/*
|
||||||
|
|
||||||
|
.ccache/*
|
||||||
|
|
||||||
|
# Visual Studio
|
||||||
|
.vs
|
||||||
|
out
|
||||||
|
CMakeSettings.json
|
||||||
|
|||||||
+125
-18
@@ -80,6 +80,25 @@ if(MSVC)
|
|||||||
|
|
||||||
# enable COMDAT folding for even smaller release builds
|
# enable COMDAT folding for even smaller release builds
|
||||||
add_link_options("$<$<CONFIG:RELEASE,MINSIZEREL>:/OPT:ICF>")
|
add_link_options("$<$<CONFIG:RELEASE,MINSIZEREL>:/OPT:ICF>")
|
||||||
|
|
||||||
|
# always use UTF-8 (fix 4819)
|
||||||
|
add_compile_options("/utf-8")
|
||||||
|
|
||||||
|
# spectre mitigation warning
|
||||||
|
add_compile_options("/wd5045")
|
||||||
|
|
||||||
|
# implicit type convert warnings
|
||||||
|
add_compile_options("/wd4244")
|
||||||
|
add_compile_options("/wd4267")
|
||||||
|
add_compile_options("/wd4305")
|
||||||
|
|
||||||
|
# unreferenced local variable
|
||||||
|
add_compile_options("/wd4101")
|
||||||
|
|
||||||
|
# warning in winbase.h??
|
||||||
|
add_compile_options("/wd5039")
|
||||||
|
|
||||||
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
# disable warnings about using non _s variants like strncpy
|
# disable warnings about using non _s variants like strncpy
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
@@ -124,8 +143,8 @@ else()
|
|||||||
# https://github.com/msys2/MINGW-packages/pull/6880
|
# https://github.com/msys2/MINGW-packages/pull/6880
|
||||||
# some games crash if some DLLS load above 4GB VA, so manually set base address to standard 32-bit VA,
|
# some games crash if some DLLS load above 4GB VA, so manually set base address to standard 32-bit VA,
|
||||||
# and might as well double make sure ASLR is disabled here
|
# and might as well double make sure ASLR is disabled here
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
|
|
||||||
# set visibility to hidden
|
# set visibility to hidden
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
|
||||||
@@ -160,8 +179,8 @@ else()
|
|||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-fno-ident -ffunction-sections -fdata-sections")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-fno-ident -ffunction-sections -fdata-sections")
|
||||||
|
|
||||||
# linker fix to load below 4GB
|
# linker fix to load below 4GB
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
|
|
||||||
# set visibility to hidden
|
# set visibility to hidden
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fvisibility=hidden")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fvisibility=hidden")
|
||||||
@@ -184,8 +203,8 @@ else()
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "-gdwarf")
|
set(CMAKE_CXX_FLAGS_DEBUG "-gdwarf")
|
||||||
|
|
||||||
# linker fix to load below 4GB
|
# linker fix to load below 4GB
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--disable-dynamicbase,--image-base=0x400000")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--disable-dynamicbase,--image-base=0x400000,--enable-stdcall-fixup")
|
||||||
|
|
||||||
# enable debug symbols on level 3 and keep frame pointers
|
# enable debug symbols on level 3 and keep frame pointers
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g3 -fno-omit-frame-pointer")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g3 -fno-omit-frame-pointer")
|
||||||
@@ -211,14 +230,12 @@ add_compile_definitions(
|
|||||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DACIOEMU_LOG")
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DACIOEMU_LOG")
|
||||||
|
|
||||||
# add project directory to include path so we can comfortably import
|
# add project directory to include path so we can comfortably import
|
||||||
include_directories(${spicetools_SOURCE_DIR})
|
include_directories(${spicetools_SOURCE_DIR} ${spicetools_SOURCE_DIR}/external/imgui)
|
||||||
|
|
||||||
# add external libraries
|
# add external libraries
|
||||||
add_subdirectory(external/fmt EXCLUDE_FROM_ALL)
|
add_subdirectory(external/fmt EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(external/discord-rpc EXCLUDE_FROM_ALL)
|
add_subdirectory(external/discord-rpc EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(external/hash-library EXCLUDE_FROM_ALL)
|
add_subdirectory(external/hash-library EXCLUDE_FROM_ALL)
|
||||||
add_compile_definitions(IMGUI_DISABLE_DEMO_WINDOWS)
|
|
||||||
add_compile_definitions(IMGUI_DISABLE_DEBUG_TOOLS)
|
|
||||||
add_subdirectory(external/imgui EXCLUDE_FROM_ALL)
|
add_subdirectory(external/imgui EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(external/minhook EXCLUDE_FROM_ALL)
|
add_subdirectory(external/minhook EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(external/cpu_features EXCLUDE_FROM_ALL)
|
add_subdirectory(external/cpu_features EXCLUDE_FROM_ALL)
|
||||||
@@ -302,6 +319,7 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
api/modules/drs.cpp
|
api/modules/drs.cpp
|
||||||
api/modules/lcd.cpp
|
api/modules/lcd.cpp
|
||||||
api/modules/ddr.cpp
|
api/modules/ddr.cpp
|
||||||
|
api/modules/resize.cpp
|
||||||
|
|
||||||
# avs
|
# avs
|
||||||
avs/core.cpp
|
avs/core.cpp
|
||||||
@@ -339,12 +357,12 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
external/cardio/cardio_runner.cpp
|
external/cardio/cardio_runner.cpp
|
||||||
|
|
||||||
# external misc
|
# external misc
|
||||||
external/scard/scard.cpp
|
|
||||||
external/stackwalker/stackwalker.cpp
|
external/stackwalker/stackwalker.cpp
|
||||||
external/tinyxml2/tinyxml2.cpp
|
external/tinyxml2/tinyxml2.cpp
|
||||||
external/http-parser/http_parser.c
|
external/http-parser/http_parser.c
|
||||||
external/usbhidusage/usb-hid-usage.c
|
external/usbhidusage/usb-hid-usage.c
|
||||||
external/toojpeg/toojpeg.cpp
|
external/toojpeg/toojpeg.cpp
|
||||||
|
external/scard/scard.cpp
|
||||||
|
|
||||||
# games
|
# games
|
||||||
games/game.cpp
|
games/game.cpp
|
||||||
@@ -441,6 +459,12 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
games/qks/qks.cpp
|
games/qks/qks.cpp
|
||||||
games/qks/io.cpp
|
games/qks/io.cpp
|
||||||
games/qks/bi2x_hook.cpp
|
games/qks/bi2x_hook.cpp
|
||||||
|
games/mfg/mfg.cpp
|
||||||
|
games/mfg/io.cpp
|
||||||
|
games/mfg/bi2a_hook.cpp
|
||||||
|
games/pc/pc.cpp
|
||||||
|
games/pc/io.cpp
|
||||||
|
games/pc/bi2x_hook.cpp
|
||||||
|
|
||||||
# hooks
|
# hooks
|
||||||
hooks/audio/audio.cpp
|
hooks/audio/audio.cpp
|
||||||
@@ -512,7 +536,6 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
overlay/overlay.cpp
|
overlay/overlay.cpp
|
||||||
overlay/window.cpp
|
overlay/window.cpp
|
||||||
overlay/imgui/extensions.cpp
|
overlay/imgui/extensions.cpp
|
||||||
overlay/imgui/impl_dx9.cpp
|
|
||||||
overlay/imgui/impl_spice.cpp
|
overlay/imgui/impl_spice.cpp
|
||||||
overlay/imgui/impl_sw.cpp
|
overlay/imgui/impl_sw.cpp
|
||||||
overlay/windows/acio_status_buffers.cpp
|
overlay/windows/acio_status_buffers.cpp
|
||||||
@@ -586,6 +609,9 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
util/sysutils.cpp
|
util/sysutils.cpp
|
||||||
util/lz77.cpp
|
util/lz77.cpp
|
||||||
util/tapeled.cpp
|
util/tapeled.cpp
|
||||||
|
util/execexe.cpp
|
||||||
|
util/dependencies.cpp
|
||||||
|
util/deferlog.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES})
|
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES})
|
||||||
@@ -596,8 +622,9 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOUR
|
|||||||
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
||||||
add_executable(spicetools_spice ${SOURCE_FILES} ${RESOURCE_FILES})
|
add_executable(spicetools_spice ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
target_link_libraries(spicetools_spice
|
target_link_libraries(spicetools_spice
|
||||||
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
target_link_libraries(spicetools_spice PUBLIC winscard)
|
||||||
set_target_properties(spicetools_spice PROPERTIES PREFIX "")
|
set_target_properties(spicetools_spice PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_spice PROPERTIES OUTPUT_NAME "spice")
|
set_target_properties(spicetools_spice PROPERTIES OUTPUT_NAME "spice")
|
||||||
|
|
||||||
@@ -605,6 +632,39 @@ IF(NOT MSVC)
|
|||||||
set_target_properties(spicetools_spice PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
set_target_properties(spicetools_spice PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# spice_laa.exe
|
||||||
|
###########
|
||||||
|
|
||||||
|
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
||||||
|
add_executable(spicetools_spice_laa ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
|
target_link_libraries(spicetools_spice_laa
|
||||||
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp
|
||||||
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
target_link_libraries(spicetools_spice_laa PUBLIC winscard)
|
||||||
|
set_target_properties(spicetools_spice_laa PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(spicetools_spice_laa PROPERTIES OUTPUT_NAME "spice_laa")
|
||||||
|
target_compile_definitions(spicetools_spice_laa PRIVATE SPICE32_LARGE_ADDRESS_AWARE=1)
|
||||||
|
|
||||||
|
IF(NOT MSVC)
|
||||||
|
set_target_properties(spicetools_spice_laa PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32 -Wl,--large-address-aware")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# spice_linux.exe
|
||||||
|
###########
|
||||||
|
|
||||||
|
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
||||||
|
add_executable(spicetools_spice_linux ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
|
target_link_libraries(spicetools_spice_linux
|
||||||
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp
|
||||||
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
set_target_properties(spicetools_spice_linux PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(spicetools_spice_linux PROPERTIES OUTPUT_NAME "spice_linux")
|
||||||
|
target_compile_definitions(spicetools_spice_linux PRIVATE NO_SCARD=1 PRIVATE SPICE_LINUX=1)
|
||||||
|
|
||||||
|
IF(NOT MSVC)
|
||||||
|
set_target_properties(spicetools_spice_linux PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||||
|
endif()
|
||||||
|
|
||||||
# spice64.exe
|
# spice64.exe
|
||||||
#############
|
#############
|
||||||
|
|
||||||
@@ -613,9 +673,9 @@ add_executable(spicetools_spice64 ${SOURCE_FILES} ${RESOURCE_FILES})
|
|||||||
|
|
||||||
# do NOT link against: mf, mfplat, mfreadwrite; otherwise unity games will break
|
# do NOT link against: mf, mfplat, mfreadwrite; otherwise unity games will break
|
||||||
target_link_libraries(spicetools_spice64
|
target_link_libraries(spicetools_spice64
|
||||||
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp mfuuid strmiids dxva2
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp mfuuid strmiids dxva2
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
target_link_libraries(spicetools_spice64 PUBLIC winscard)
|
||||||
set_target_properties(spicetools_spice64 PROPERTIES PREFIX "")
|
set_target_properties(spicetools_spice64 PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_spice64 PROPERTIES OUTPUT_NAME "spice64")
|
set_target_properties(spicetools_spice64 PROPERTIES OUTPUT_NAME "spice64")
|
||||||
target_compile_definitions(spicetools_spice64 PRIVATE SPICE64=1)
|
target_compile_definitions(spicetools_spice64 PRIVATE SPICE64=1)
|
||||||
@@ -624,6 +684,24 @@ IF(NOT MSVC)
|
|||||||
set_target_properties(spicetools_spice64 PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
|
set_target_properties(spicetools_spice64 PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# spice64_linux.exe
|
||||||
|
#############
|
||||||
|
|
||||||
|
set(RESOURCE_FILES build/manifest.manifest build/manifest64.rc build/icon.rc cfg/Win32D.rc)
|
||||||
|
add_executable(spicetools_spice64_linux ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
|
|
||||||
|
# do NOT link against: mf, mfplat, mfreadwrite; otherwise unity games will break
|
||||||
|
target_link_libraries(spicetools_spice64_linux
|
||||||
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp mfuuid strmiids dxva2
|
||||||
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
set_target_properties(spicetools_spice64_linux PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(spicetools_spice64_linux PROPERTIES OUTPUT_NAME "spice64_linux")
|
||||||
|
target_compile_definitions(spicetools_spice64_linux PRIVATE SPICE64=1)
|
||||||
|
target_compile_definitions(spicetools_spice64_linux PRIVATE NO_SCARD=1 PRIVATE SPICE_LINUX=1)
|
||||||
|
|
||||||
|
IF(NOT MSVC)
|
||||||
|
set_target_properties(spicetools_spice64_linux PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
|
||||||
|
endif()
|
||||||
|
|
||||||
# spicecfg.exe
|
# spicecfg.exe
|
||||||
##############
|
##############
|
||||||
@@ -632,8 +710,9 @@ set(SOURCE_FILES ${SOURCE_FILES} launcher/options.h launcher/options.cpp)
|
|||||||
set(RESOURCE_FILES cfg/manifest.manifest cfg/manifest.rc cfg/icon.rc cfg/Win32D.rc)
|
set(RESOURCE_FILES cfg/manifest.manifest cfg/manifest.rc cfg/icon.rc cfg/Win32D.rc)
|
||||||
add_executable(spicetools_cfg WIN32 ${SOURCE_FILES} ${RESOURCE_FILES})
|
add_executable(spicetools_cfg WIN32 ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
target_link_libraries(spicetools_cfg
|
target_link_libraries(spicetools_cfg
|
||||||
PUBLIC ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp strmiids
|
PUBLIC ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp strmiids
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
target_link_libraries(spicetools_cfg PUBLIC winscard)
|
||||||
set_target_properties(spicetools_cfg PROPERTIES PREFIX "")
|
set_target_properties(spicetools_cfg PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_cfg PROPERTIES OUTPUT_NAME "spicecfg")
|
set_target_properties(spicetools_cfg PROPERTIES OUTPUT_NAME "spicecfg")
|
||||||
target_compile_definitions(spicetools_cfg PRIVATE SPICETOOLS_SPICECFG_STANDALONE=1)
|
target_compile_definitions(spicetools_cfg PRIVATE SPICETOOLS_SPICECFG_STANDALONE=1)
|
||||||
@@ -642,6 +721,24 @@ if(NOT MSVC)
|
|||||||
set_target_properties(spicetools_cfg PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
set_target_properties(spicetools_cfg PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# spicecfg_linux.exe
|
||||||
|
##############
|
||||||
|
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} launcher/options.h launcher/options.cpp)
|
||||||
|
set(RESOURCE_FILES cfg/manifest.manifest cfg/manifest.rc cfg/icon.rc cfg/Win32D.rc)
|
||||||
|
add_executable(spicetools_cfg_linux WIN32 ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
|
target_link_libraries(spicetools_cfg_linux
|
||||||
|
PUBLIC ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp strmiids
|
||||||
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
set_target_properties(spicetools_cfg_linux PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(spicetools_cfg_linux PROPERTIES OUTPUT_NAME "spicecfg_linux")
|
||||||
|
target_compile_definitions(spicetools_cfg_linux PRIVATE SPICETOOLS_SPICECFG_STANDALONE=1)
|
||||||
|
target_compile_definitions(spicetools_cfg_linux PRIVATE NO_SCARD=1 PRIVATE SPICE_LINUX=1)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(spicetools_cfg_linux PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||||
|
endif()
|
||||||
|
|
||||||
# stubs
|
# stubs
|
||||||
#######
|
#######
|
||||||
|
|
||||||
@@ -721,23 +818,33 @@ if(NOT MSVC)
|
|||||||
set_target_properties(spicetools_stubs_nvEncodeAPI64 PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
|
set_target_properties(spicetools_stubs_nvEncodeAPI64 PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# cpusbxpkm.dll (32 bit)
|
||||||
|
set(SOURCE_FILES stubs/cpusbxpkm.cpp)
|
||||||
|
add_library(spicetools_stubs_cpusbxpkm SHARED ${SOURCE_FILES} stubs/cpusbxpkm.def)
|
||||||
|
set_target_properties(spicetools_stubs_cpusbxpkm PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(spicetools_stubs_cpusbxpkm PROPERTIES OUTPUT_NAME "cpusbxpkm")
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(spicetools_stubs_cpusbxpkm PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||||
|
endif()
|
||||||
|
|
||||||
# output directories
|
# output directories
|
||||||
####################
|
####################
|
||||||
|
|
||||||
# output config
|
# output config
|
||||||
set_target_properties(spicetools_cfg
|
set_target_properties(spicetools_cfg spicetools_cfg_linux
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools")
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools")
|
||||||
|
|
||||||
# output 32bit
|
# output 32bit
|
||||||
set_target_properties(spicetools_spice spicetools_stubs_kbt spicetools_stubs_kld
|
set_target_properties(spicetools_spice spicetools_spice_laa spicetools_spice_linux spicetools_stubs_kbt spicetools_stubs_kld spicetools_stubs_cpusbxpkm
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/archive32"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/archive32"
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/32"
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/32"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/32")
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/32")
|
||||||
|
|
||||||
# output 64bit
|
# output 64bit
|
||||||
set_target_properties(spicetools_spice64 spicetools_stubs_kbt64 spicetools_stubs_kld64 spicetools_stubs_nvcuda spicetools_stubs_nvcuvid spicetools_stubs_nvEncodeAPI64
|
set_target_properties(spicetools_spice64 spicetools_spice64_linux spicetools_stubs_kbt64 spicetools_stubs_kld64 spicetools_stubs_nvcuda spicetools_stubs_nvcuvid spicetools_stubs_nvEncodeAPI64
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/archive64"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/archive64"
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/64"
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/spicetools/64"
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
FROM spicetools/deps
|
FROM spicetools/deps
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN chown user:user /src
|
|
||||||
USER user
|
COPY --from=gitroot . /src/.git
|
||||||
COPY --chown=user:user --from=gitroot . /src/.git
|
COPY . /src/src/spice2x
|
||||||
COPY --chown=user:user . /src/src/spice2x
|
|
||||||
WORKDIR /src/src/spice2x
|
WORKDIR /src/src/spice2x
|
||||||
CMD ["./build_all.sh"]
|
ENTRYPOINT ["./build_all.sh"]
|
||||||
|
|||||||
@@ -181,6 +181,12 @@ All of those three modules have equally named methods for you to call.
|
|||||||
- removes the override value from the objects specified by name
|
- removes the override value from the objects specified by name
|
||||||
- if no names were passed, all overrides will be removed
|
- if no names were passed, all overrides will be removed
|
||||||
|
|
||||||
|
##### Additional API for lights
|
||||||
|
- read(name: string, ...)
|
||||||
|
- same as read(), but you can specify light names
|
||||||
|
- write_reset(name: str, ...)
|
||||||
|
- same as write_reset(), but it accepts a flat list of strings
|
||||||
|
|
||||||
#### Touch
|
#### Touch
|
||||||
- read()
|
- read()
|
||||||
- returns an array of state objects containing id, x and y
|
- returns an array of state objects containing id, x and y
|
||||||
@@ -241,11 +247,42 @@ which also means that your hex edits are applicable directly.
|
|||||||
- sets the contents of the 16 segment display and disables writes from game
|
- sets the contents of the 16 segment display and disables writes from game
|
||||||
- ticker_reset()
|
- ticker_reset()
|
||||||
- re-enables writes from game
|
- re-enables writes from game
|
||||||
|
- tapeled_get(name: str, ...)
|
||||||
|
- returns a list containing a dict of the current tape LED states. The dict keys are:
|
||||||
|
- `Stage Left`
|
||||||
|
- `Stage Right`
|
||||||
|
- `Cabinet Left`
|
||||||
|
- `Cabinet Right`
|
||||||
|
- `Control Panel Under`
|
||||||
|
- `Ceiling Left`
|
||||||
|
- `Title Left`
|
||||||
|
- `Title Right`
|
||||||
|
- `Ceiling Right`
|
||||||
|
- `Touch Panel Left`
|
||||||
|
- `Touch Panel Right`
|
||||||
|
- `Side Panel Left Inner`
|
||||||
|
- `Side Panel Left Outer`
|
||||||
|
- `Side Panel Left`
|
||||||
|
- `Side Panel Right Outer`
|
||||||
|
- `Side Panel Right Inner`
|
||||||
|
- `Side Panel Right`
|
||||||
|
|
||||||
#### LCD
|
#### LCD
|
||||||
- info()
|
- info()
|
||||||
- returns information about the serial LCD controller some games use
|
- returns information about the serial LCD controller some games use
|
||||||
|
|
||||||
|
#### Resize
|
||||||
|
- image_resize_enable(enable: bool)
|
||||||
|
- enables or disables image resize state
|
||||||
|
- image_resize_set_scene(scene: int)
|
||||||
|
- sets the active scene for image resize state; set to 0 to disable resize
|
||||||
|
|
||||||
|
## Native wrapper libraries
|
||||||
|
Spicetools provides wrapper libraries in: Arduino, C++, Dart, and Python.
|
||||||
|
Python is the only one that is fully spec compliant.
|
||||||
|
Other libraries may be missing features and contain bugs; please feel free to
|
||||||
|
contribute code to fill the gaps if you work on a project using these libraries.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Unless otherwise noted, all files are licensed under the GPLv3.
|
Unless otherwise noted, all files are licensed under the GPLv3.
|
||||||
See the LICENSE file for the full license text.
|
See the LICENSE file for the full license text.
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
namespace acio {
|
namespace acio {
|
||||||
HINSTANCE DLL_INSTANCE = nullptr;
|
HINSTANCE DLL_INSTANCE = nullptr;
|
||||||
std::vector<acio::ACIOModule *> MODULES;
|
std::vector<acio::ACIOModule *> MODULES;
|
||||||
|
std::atomic<bool> IO_INIT_IN_PROGRESS = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -58,6 +59,7 @@ static inline acio::HookMode get_hookmode() {
|
|||||||
|
|
||||||
void acio::attach() {
|
void acio::attach() {
|
||||||
log_info("acio", "SpiceTools ACIO");
|
log_info("acio", "SpiceTools ACIO");
|
||||||
|
IO_INIT_IN_PROGRESS = true;
|
||||||
|
|
||||||
// load settings and instance
|
// load settings and instance
|
||||||
acio::DLL_INSTANCE = LoadLibraryA("libacio.dll");
|
acio::DLL_INSTANCE = LoadLibraryA("libacio.dll");
|
||||||
@@ -111,6 +113,8 @@ void acio::attach() {
|
|||||||
for (auto &module : MODULES) {
|
for (auto &module : MODULES) {
|
||||||
module->attach();
|
module->attach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IO_INIT_IN_PROGRESS = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void acio::attach_icca() {
|
void acio::attach_icca() {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -11,6 +12,7 @@ namespace acio {
|
|||||||
// globals
|
// globals
|
||||||
extern HINSTANCE DLL_INSTANCE;
|
extern HINSTANCE DLL_INSTANCE;
|
||||||
extern std::vector<acio::ACIOModule *> MODULES;
|
extern std::vector<acio::ACIOModule *> MODULES;
|
||||||
|
extern std::atomic<bool> IO_INIT_IN_PROGRESS;
|
||||||
|
|
||||||
void attach();
|
void attach();
|
||||||
void attach_icca();
|
void attach_icca();
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ static int __cdecl ac_io_bmpu_control_1p_start_led_off() {
|
|||||||
if (avs::game::is_model("KDM")) {
|
if (avs::game::is_model("KDM")) {
|
||||||
auto &lights = games::dea::get_lights();
|
auto &lights = games::dea::get_lights();
|
||||||
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P1Start), 0.f);
|
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P1Start), 0.f);
|
||||||
|
|
||||||
|
// MUSECA
|
||||||
|
} else if (avs::game::is_model("PIX")) {
|
||||||
|
auto &lights = games::museca::get_lights();
|
||||||
|
Lights::writeLight(RI_MGR, lights.at(games::museca::Lights::Start), 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -44,6 +49,11 @@ static int __cdecl ac_io_bmpu_control_1p_start_led_on() {
|
|||||||
if (avs::game::is_model("KDM")) {
|
if (avs::game::is_model("KDM")) {
|
||||||
auto &lights = games::dea::get_lights();
|
auto &lights = games::dea::get_lights();
|
||||||
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P1Start), 1.f);
|
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P1Start), 1.f);
|
||||||
|
|
||||||
|
// MUSECA
|
||||||
|
} else if (avs::game::is_model("PIX")) {
|
||||||
|
auto &lights = games::museca::get_lights();
|
||||||
|
Lights::writeLight(RI_MGR, lights.at(games::museca::Lights::Start), 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -55,6 +65,11 @@ static int __cdecl ac_io_bmpu_control_2p_start_led_off() {
|
|||||||
if (avs::game::is_model("KDM")) {
|
if (avs::game::is_model("KDM")) {
|
||||||
auto &lights = games::dea::get_lights();
|
auto &lights = games::dea::get_lights();
|
||||||
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P2Start), 0.f);
|
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P2Start), 0.f);
|
||||||
|
|
||||||
|
// MUSECA
|
||||||
|
} else if (avs::game::is_model("PIX")) {
|
||||||
|
auto &lights = games::museca::get_lights();
|
||||||
|
Lights::writeLight(RI_MGR, lights.at(games::museca::Lights::Keypad), 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -66,6 +81,11 @@ static int __cdecl ac_io_bmpu_control_2p_start_led_on() {
|
|||||||
if (avs::game::is_model("KDM")) {
|
if (avs::game::is_model("KDM")) {
|
||||||
auto &lights = games::dea::get_lights();
|
auto &lights = games::dea::get_lights();
|
||||||
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P2Start), 1.f);
|
Lights::writeLight(RI_MGR, lights.at(games::dea::Lights::P2Start), 1.f);
|
||||||
|
|
||||||
|
// MUSECA
|
||||||
|
} else if (avs::game::is_model("PIX")) {
|
||||||
|
auto &lights = games::museca::get_lights();
|
||||||
|
Lights::writeLight(RI_MGR, lights.at(games::museca::Lights::Keypad), 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace acio2emu {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IOBHandle::IOBHandle(std::wstring device) : device_(device) {
|
IOBHandle::IOBHandle(LPCWSTR device) : device_(device) {
|
||||||
nodes_[0] = std::make_unique<MasterNode>(this);
|
nodes_[0] = std::make_unique<MasterNode>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace acio2emu {
|
|||||||
void forward_packet_(const Packet &packet);
|
void forward_packet_(const Packet &packet);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IOBHandle(std::wstring device);
|
IOBHandle(LPCWSTR device);
|
||||||
|
|
||||||
bool register_node(std::unique_ptr<Node> node);
|
bool register_node(std::unique_ptr<Node> node);
|
||||||
int number_of_nodes() const;
|
int number_of_nodes() const;
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
#include "rawinput/rawinput.h"
|
#include "rawinput/rawinput.h"
|
||||||
#include "util/utils.h"
|
#include "util/utils.h"
|
||||||
|
|
||||||
acioemu::ACIOHandle::ACIOHandle(LPCWSTR lpCOMPort) {
|
acioemu::ACIOHandle::ACIOHandle(LPCWSTR lpCOMPort, uint8_t iccaNodeCount) {
|
||||||
this->com_port = lpCOMPort;
|
this->com_port = lpCOMPort;
|
||||||
|
this->icca_node_count = iccaNodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool acioemu::ACIOHandle::open(LPCWSTR lpFileName) {
|
bool acioemu::ACIOHandle::open(LPCWSTR lpFileName) {
|
||||||
@@ -16,7 +17,7 @@ bool acioemu::ACIOHandle::open(LPCWSTR lpFileName) {
|
|||||||
log_info("acioemu", "Opened {} (ACIO)", ws2s(com_port));
|
log_info("acioemu", "Opened {} (ACIO)", ws2s(com_port));
|
||||||
|
|
||||||
// ACIO device
|
// ACIO device
|
||||||
acio_emu.add_device(new acioemu::ICCADevice(false, true, 2));
|
acio_emu.add_device(new acioemu::ICCADevice(false, true, icca_node_count));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ namespace acioemu {
|
|||||||
private:
|
private:
|
||||||
LPCWSTR com_port;
|
LPCWSTR com_port;
|
||||||
|
|
||||||
|
uint8_t icca_node_count;
|
||||||
|
|
||||||
acioemu::ACIOEmu acio_emu;
|
acioemu::ACIOEmu acio_emu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ACIOHandle(LPCWSTR lpCOMPort);
|
ACIOHandle(LPCWSTR lpCOMPort, uint8_t iccaNodeCount = 2);
|
||||||
|
|
||||||
bool open(LPCWSTR lpFileName) override;
|
bool open(LPCWSTR lpFileName) override;
|
||||||
|
|
||||||
|
|||||||
@@ -102,11 +102,13 @@ bool ICCADevice::parse_msg(MessageData *msg_in,
|
|||||||
// send version data
|
// send version data
|
||||||
auto msg = this->create_msg(msg_in, MSG_VERSION_SIZE);
|
auto msg = this->create_msg(msg_in, MSG_VERSION_SIZE);
|
||||||
if (
|
if (
|
||||||
avs::game::is_model({"LDJ", "TBS", "UJK"}) ||
|
avs::game::is_model({"LDJ", "TBS", "UJK", "XIF"}) ||
|
||||||
// SDVX Valkyrie cabinet mode
|
// SDVX Valkyrie cabinet mode
|
||||||
(avs::game::is_model("KFC") && (avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'))
|
(avs::game::is_model("KFC") && (avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'))
|
||||||
) {
|
) {
|
||||||
this->set_version(msg, 0x3, 0, 1, 7, 0, "ICCA");
|
this->set_version(msg, 0x3, 0, 1, 7, 0, "ICCA");
|
||||||
|
} else if (avs::game::is_model({"VFG"})) {
|
||||||
|
this->set_version(msg, 0x3, 0, 1, 7, 0, "ICCB");
|
||||||
} else {
|
} else {
|
||||||
this->set_version(msg, 0x3, 0, 1, 6, 0, "ICCA");
|
this->set_version(msg, 0x3, 0, 1, 6, 0, "ICCA");
|
||||||
}
|
}
|
||||||
@@ -333,6 +335,7 @@ bool ICCADevice::parse_msg(MessageData *msg_in,
|
|||||||
case ACIO_CMD_CLEAR:
|
case ACIO_CMD_CLEAR:
|
||||||
case 0x30: // GetBoardProductNumber
|
case 0x30: // GetBoardProductNumber
|
||||||
case 0x31: // GetMicomInfo
|
case 0x31: // GetMicomInfo
|
||||||
|
case 0x3A: // ???
|
||||||
case 0x0116: // ???
|
case 0x0116: // ???
|
||||||
case 0x0120: // ???
|
case 0x0120: // ???
|
||||||
case 0xFF: // BROADCAST
|
case 0xFF: // BROADCAST
|
||||||
@@ -370,7 +373,7 @@ void ICCADevice::update_card(int unit) {
|
|||||||
bool kb_insert_press = false;
|
bool kb_insert_press = false;
|
||||||
|
|
||||||
// eamio keypress
|
// eamio keypress
|
||||||
kb_insert_press |= eamuse_get_keypad_state((size_t) unit) & (1 << EAM_IO_INSERT);
|
kb_insert_press |= static_cast<bool>(eamuse_get_keypad_state((size_t) unit) & (1 << EAM_IO_INSERT));
|
||||||
|
|
||||||
// check for card
|
// check for card
|
||||||
if (this->cards[unit] == nullptr && (eamuse_card_insert_consume(this->node_count, unit) || kb_insert_press)) {
|
if (this->cards[unit] == nullptr && (eamuse_card_insert_consume(this->node_count, unit) || kb_insert_press)) {
|
||||||
@@ -518,7 +521,7 @@ void ICCADevice::update_status(int unit) {
|
|||||||
buffer[10] = felica ? 0x01 : 0x00;
|
buffer[10] = felica ? 0x01 : 0x00;
|
||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
avs::game::is_model({"LDJ", "TBS"}) ||
|
avs::game::is_model({"LDJ", "TBS", "XIF"}) ||
|
||||||
// SDVX Valkyrie cabinet mode
|
// SDVX Valkyrie cabinet mode
|
||||||
(avs::game::is_model("KFC") && (avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'))) {
|
(avs::game::is_model("KFC") && (avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'))) {
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "modules/lights.h"
|
#include "modules/lights.h"
|
||||||
#include "modules/memory.h"
|
#include "modules/memory.h"
|
||||||
#include "modules/touch.h"
|
#include "modules/touch.h"
|
||||||
|
#include "modules/resize.h"
|
||||||
#include "request.h"
|
#include "request.h"
|
||||||
#include "response.h"
|
#include "response.h"
|
||||||
|
|
||||||
@@ -403,6 +404,7 @@ void Controller::init_state(api::ClientState *state) {
|
|||||||
state->modules.push_back(new modules::Lights());
|
state->modules.push_back(new modules::Lights());
|
||||||
state->modules.push_back(new modules::Memory());
|
state->modules.push_back(new modules::Memory());
|
||||||
state->modules.push_back(new modules::Touch());
|
state->modules.push_back(new modules::Touch());
|
||||||
|
state->modules.push_back(new modules::Resize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::free_state(api::ClientState *state) {
|
void Controller::free_state(api::ClientState *state) {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ using namespace rapidjson;
|
|||||||
|
|
||||||
namespace api::modules {
|
namespace api::modules {
|
||||||
|
|
||||||
|
std::optional<uint32_t> CAPTURE_QUALITY;
|
||||||
|
std::optional<uint32_t> CAPTURE_DIVIDE;
|
||||||
|
|
||||||
static thread_local std::vector<uint8_t> CAPTURE_BUFFER;
|
static thread_local std::vector<uint8_t> CAPTURE_BUFFER;
|
||||||
|
|
||||||
Capture::Capture() : Module("capture") {
|
Capture::Capture() : Module("capture") {
|
||||||
@@ -44,12 +47,21 @@ namespace api::modules {
|
|||||||
int screen = 0;
|
int screen = 0;
|
||||||
int quality = 70;
|
int quality = 70;
|
||||||
int divide = 1;
|
int divide = 1;
|
||||||
if (req.params.Size() > 0 && req.params[0].IsUint())
|
if (req.params.Size() > 0 && req.params[0].IsUint()) {
|
||||||
screen = req.params[0].GetUint();
|
screen = req.params[0].GetUint();
|
||||||
if (req.params.Size() > 1 && req.params[1].IsUint())
|
}
|
||||||
|
|
||||||
|
if (CAPTURE_QUALITY.has_value()) {
|
||||||
|
quality = CAPTURE_QUALITY.value();
|
||||||
|
} else if (req.params.Size() > 1 && req.params[1].IsUint()) {
|
||||||
quality = req.params[1].GetUint();
|
quality = req.params[1].GetUint();
|
||||||
if (req.params.Size() > 2 && req.params[2].IsUint())
|
}
|
||||||
|
|
||||||
|
if (CAPTURE_DIVIDE.has_value()) {
|
||||||
|
divide = CAPTURE_DIVIDE.value();
|
||||||
|
} else if (req.params.Size() > 2 && req.params[2].IsUint()) {
|
||||||
divide = req.params[2].GetUint();
|
divide = req.params[2].GetUint();
|
||||||
|
}
|
||||||
|
|
||||||
// receive JPEG data
|
// receive JPEG data
|
||||||
uint64_t timestamp = 0;
|
uint64_t timestamp = 0;
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "api/module.h"
|
#include "api/module.h"
|
||||||
#include "api/request.h"
|
#include "api/request.h"
|
||||||
|
|
||||||
namespace api::modules {
|
namespace api::modules {
|
||||||
|
|
||||||
|
extern std::optional<uint32_t> CAPTURE_QUALITY;
|
||||||
|
extern std::optional<uint32_t> CAPTURE_DIVIDE;
|
||||||
|
|
||||||
class Capture : public Module {
|
class Capture : public Module {
|
||||||
public:
|
public:
|
||||||
Capture();
|
Capture();
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
#include "iidx.h"
|
#include "iidx.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
|
||||||
#include "games/iidx/iidx.h"
|
|
||||||
#include "external/rapidjson/document.h"
|
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
|
||||||
namespace api::modules {
|
namespace api::modules {
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
@@ -17,6 +13,11 @@ namespace api::modules {
|
|||||||
functions["ticker_get"] = std::bind(&IIDX::ticker_get, this, _1, _2);
|
functions["ticker_get"] = std::bind(&IIDX::ticker_get, this, _1, _2);
|
||||||
functions["ticker_set"] = std::bind(&IIDX::ticker_set, this, _1, _2);
|
functions["ticker_set"] = std::bind(&IIDX::ticker_set, this, _1, _2);
|
||||||
functions["ticker_reset"] = std::bind(&IIDX::ticker_reset, this, _1, _2);
|
functions["ticker_reset"] = std::bind(&IIDX::ticker_reset, this, _1, _2);
|
||||||
|
functions["tapeled_get"] = std::bind(&IIDX::tapeled_get, this, _1, _2);
|
||||||
|
|
||||||
|
for (auto &light : games::iidx::TAPELED_MAPPING) {
|
||||||
|
this->lights_by_names.emplace(light.lightName, light);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,4 +70,51 @@ namespace api::modules {
|
|||||||
// disable read only
|
// disable read only
|
||||||
games::iidx::IIDXIO_LED_TICKER_READONLY = false;
|
games::iidx::IIDXIO_LED_TICKER_READONLY = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tapeled_get()
|
||||||
|
* tapeled_get(name: str, ...)
|
||||||
|
*/
|
||||||
|
void IIDX::tapeled_get(Request &req, Response &res) {
|
||||||
|
Value response_object(kObjectType);
|
||||||
|
|
||||||
|
// all tape leds
|
||||||
|
if (req.params.Size() == 0) {
|
||||||
|
// Iterate through each device and dump its lights data into the response
|
||||||
|
for (const auto &mapping : games::iidx::TAPELED_MAPPING) {
|
||||||
|
copy_tapeled_data(res, response_object, mapping);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// specified light names
|
||||||
|
for (Value ¶m : req.params.GetArray()) {
|
||||||
|
// check params
|
||||||
|
if (!param.IsString()) {
|
||||||
|
error_type(res, "name", "string");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto name = param.GetString();
|
||||||
|
if (const auto &it = lights_by_names.find(name); it != lights_by_names.end()) {
|
||||||
|
const auto mapping = it->second.get();
|
||||||
|
copy_tapeled_data(res, response_object, mapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res.add_data(response_object);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IIDX::copy_tapeled_data(Response &res, Value &response_object, const tapeledutils::tape_led &mapping) {
|
||||||
|
// Create an array for the light state
|
||||||
|
Value light_state(kArrayType);
|
||||||
|
light_state.Reserve(mapping.data.capacity() * 3, res.doc()->GetAllocator());
|
||||||
|
for (const auto [r, g, b] : mapping.data) {
|
||||||
|
light_state.PushBack(r, res.doc()->GetAllocator());
|
||||||
|
light_state.PushBack(g, res.doc()->GetAllocator());
|
||||||
|
light_state.PushBack(b, res.doc()->GetAllocator());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't use StringRef here, turns some strings partially into null bytes for some reason
|
||||||
|
Value light_name(mapping.lightName.c_str(), res.doc()->GetAllocator());
|
||||||
|
response_object.AddMember(light_name, light_state, res.doc()->GetAllocator());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "api/module.h"
|
#include "api/module.h"
|
||||||
#include "api/request.h"
|
#include "api/request.h"
|
||||||
|
#include "games/iidx/iidx.h"
|
||||||
|
|
||||||
namespace api::modules {
|
namespace api::modules {
|
||||||
|
|
||||||
@@ -10,10 +11,16 @@ namespace api::modules {
|
|||||||
IIDX();
|
IIDX();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// state
|
||||||
|
robin_hood::unordered_map<std::string, std::reference_wrapper<tapeledutils::tape_led>> lights_by_names;
|
||||||
|
|
||||||
// function definitions
|
// function definitions
|
||||||
void ticker_get(Request &req, Response &res);
|
void ticker_get(Request &req, Response &res);
|
||||||
void ticker_set(Request &req, Response &res);
|
void ticker_set(Request &req, Response &res);
|
||||||
void ticker_reset(Request &req, Response &res);
|
void ticker_reset(Request &req, Response &res);
|
||||||
|
void tapeled_get(Request &req, Response &res);
|
||||||
|
|
||||||
|
// helper
|
||||||
|
void copy_tapeled_data(Response &res, rapidjson::Value &response_object, const tapeledutils::tape_led &mapping);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,16 @@ namespace api::modules {
|
|||||||
functions["read"] = std::bind(&Lights::read, this, _1, _2);
|
functions["read"] = std::bind(&Lights::read, this, _1, _2);
|
||||||
functions["write"] = std::bind(&Lights::write, this, _1, _2);
|
functions["write"] = std::bind(&Lights::write, this, _1, _2);
|
||||||
functions["write_reset"] = std::bind(&Lights::write_reset, this, _1, _2);
|
functions["write_reset"] = std::bind(&Lights::write_reset, this, _1, _2);
|
||||||
lights = games::get_lights(eamuse_get_game());
|
|
||||||
|
this->lights = games::get_lights(eamuse_get_game());
|
||||||
|
for (auto &light : *this->lights) {
|
||||||
|
this->lights_by_names.emplace(light.getName(), light);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read()
|
* read()
|
||||||
|
* read(name: str, ...)
|
||||||
*/
|
*/
|
||||||
void Lights::read(api::Request &req, Response &res) {
|
void Lights::read(api::Request &req, Response &res) {
|
||||||
|
|
||||||
@@ -32,17 +37,39 @@ namespace api::modules {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add state for each light
|
// all lights for this game
|
||||||
for (auto &light : *this->lights) {
|
if (req.params.Size() == 0) {
|
||||||
Value state(kArrayType);
|
// add state for each light
|
||||||
Value light_name(light.getName().c_str(), res.doc()->GetAllocator());
|
for (auto &light : *this->lights) {
|
||||||
Value light_state(GameAPI::Lights::readLight(RI_MGR, light));
|
get_light(light, res);
|
||||||
Value light_enabled(light.override_enabled);
|
}
|
||||||
state.PushBack(light_name, res.doc()->GetAllocator());
|
|
||||||
state.PushBack(light_state, res.doc()->GetAllocator());
|
return;
|
||||||
state.PushBack(light_enabled, res.doc()->GetAllocator());
|
|
||||||
res.add_data(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// specified light names
|
||||||
|
for (Value ¶m : req.params.GetArray()) {
|
||||||
|
// check params
|
||||||
|
if (!param.IsString()) {
|
||||||
|
error_type(res, "name", "string");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto name = param.GetString();
|
||||||
|
if (this->lights_by_names.contains(name)) {
|
||||||
|
get_light(this->lights_by_names.at(name).get(), res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lights::get_light(Light &light, Response &res) {
|
||||||
|
Value state(kArrayType);
|
||||||
|
Value light_name(light.getName().c_str(), res.doc()->GetAllocator());
|
||||||
|
Value light_state(GameAPI::Lights::readLight(RI_MGR, light));
|
||||||
|
Value light_enabled(light.override_enabled);
|
||||||
|
state.PushBack(light_name, res.doc()->GetAllocator());
|
||||||
|
state.PushBack(light_state, res.doc()->GetAllocator());
|
||||||
|
state.PushBack(light_enabled, res.doc()->GetAllocator());
|
||||||
|
res.add_data(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,6 +117,7 @@ namespace api::modules {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* write_reset()
|
* write_reset()
|
||||||
|
* write_reset(name: str, ...)
|
||||||
* write_reset([name: str], ...)
|
* write_reset([name: str], ...)
|
||||||
*/
|
*/
|
||||||
void Lights::write_reset(Request &req, Response &res) {
|
void Lights::write_reset(Request &req, Response &res) {
|
||||||
@@ -119,26 +147,28 @@ namespace api::modules {
|
|||||||
|
|
||||||
// loop parameters
|
// loop parameters
|
||||||
for (Value ¶m : req.params.GetArray()) {
|
for (Value ¶m : req.params.GetArray()) {
|
||||||
|
const char* light_name = nullptr;
|
||||||
|
|
||||||
// check params
|
// check params
|
||||||
if (!param.IsArray()) {
|
if (param.IsArray()) {
|
||||||
error(res, "parameters must be arrays");
|
if (param.Size() < 1) {
|
||||||
return;
|
error_params_insufficient(res);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!param[0].IsString()) {
|
||||||
|
error_type(res, "name", "string");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// get params
|
||||||
|
light_name = param[0].GetString();
|
||||||
|
} else if (param.IsString()) {
|
||||||
|
light_name = param.GetString();
|
||||||
|
} else {
|
||||||
|
error(res, "parameters must be arrays or strings");
|
||||||
}
|
}
|
||||||
if (param.Size() < 1) {
|
|
||||||
error_params_insufficient(res);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!param[0].IsString()) {
|
|
||||||
error_type(res, "name", "string");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get params
|
|
||||||
auto light_name = param[0].GetString();
|
|
||||||
|
|
||||||
// write analog state
|
// write analog state
|
||||||
if (!this->write_light_reset(light_name)) {
|
if (light_name && !this->write_light_reset(light_name)) {
|
||||||
error_unknown(res, "analog", light_name);
|
error_unknown(res, "analog", light_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -153,21 +183,20 @@ namespace api::modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find light
|
// find light
|
||||||
for (auto &light : *this->lights) {
|
if (this->lights_by_names.contains(name)) {
|
||||||
if (light.getName() == name) {
|
auto &light = this->lights_by_names.at(name).get();
|
||||||
light.override_state = CLAMP(state, 0.f, 1.f);
|
light.override_state = CLAMP(state, 0.f, 1.f);
|
||||||
light.override_enabled = true;
|
light.override_enabled = true;
|
||||||
|
|
||||||
if (cfg::CONFIGURATOR_STANDALONE) {
|
if (cfg::CONFIGURATOR_STANDALONE) {
|
||||||
GameAPI::Lights::writeLight(RI_MGR, light, state);
|
GameAPI::Lights::writeLight(RI_MGR, light, state);
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// unknown light
|
return true;
|
||||||
return false;
|
} else {
|
||||||
|
// unknown light
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lights::write_light_reset(std::string name) {
|
bool Lights::write_light_reset(std::string name) {
|
||||||
@@ -178,14 +207,13 @@ namespace api::modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find light
|
// find light
|
||||||
for (auto &light : *this->lights) {
|
if (this->lights_by_names.contains(name)) {
|
||||||
if (light.getName() == name) {
|
auto &light = this->lights_by_names.at(name).get();
|
||||||
light.override_enabled = false;
|
light.override_enabled = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
// unknown light
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unknown light
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <external/robin_hood.h>
|
||||||
|
|
||||||
#include "api/module.h"
|
#include "api/module.h"
|
||||||
#include "api/request.h"
|
#include "api/request.h"
|
||||||
#include "cfg/api.h"
|
#include "cfg/api.h"
|
||||||
@@ -15,6 +17,7 @@ namespace api::modules {
|
|||||||
|
|
||||||
// state
|
// state
|
||||||
std::vector<Light> *lights;
|
std::vector<Light> *lights;
|
||||||
|
robin_hood::unordered_map<std::string, std::reference_wrapper<Light>> lights_by_names;
|
||||||
|
|
||||||
// function definitions
|
// function definitions
|
||||||
void read(Request &req, Response &res);
|
void read(Request &req, Response &res);
|
||||||
@@ -22,6 +25,7 @@ namespace api::modules {
|
|||||||
void write_reset(Request &req, Response &res);
|
void write_reset(Request &req, Response &res);
|
||||||
|
|
||||||
// helper
|
// helper
|
||||||
|
void get_light(Light &light, Response &res);
|
||||||
bool write_light(std::string name, float state);
|
bool write_light(std::string name, float state);
|
||||||
bool write_light_reset(std::string name);
|
bool write_light_reset(std::string name);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#include "resize.h"
|
||||||
|
#include "external/rapidjson/document.h"
|
||||||
|
#include "cfg/screen_resize.h"
|
||||||
|
|
||||||
|
using namespace std::placeholders;
|
||||||
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
namespace api::modules {
|
||||||
|
|
||||||
|
static thread_local std::vector<uint8_t> CAPTURE_BUFFER;
|
||||||
|
|
||||||
|
Resize::Resize() : Module("resize") {
|
||||||
|
functions["image_resize_enable"] = std::bind(&Resize::image_resize_enable, this, _1, _2);
|
||||||
|
functions["image_resize_set_scene"] = std::bind(&Resize::image_resize_set_scene, this, _1, _2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* image_resize_enable(enable: bool)
|
||||||
|
*/
|
||||||
|
void Resize::image_resize_enable(Request &req, Response &res) {
|
||||||
|
if (req.params.Size() < 1) {
|
||||||
|
return error_params_insufficient(res);
|
||||||
|
}
|
||||||
|
if (!req.params[0].IsBool()) {
|
||||||
|
return error_type(res, "enable", "bool");
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg::SCREENRESIZE->enable_screen_resize = req.params[0].GetBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* image_resize_set_scene(scene: int)
|
||||||
|
*/
|
||||||
|
void Resize::image_resize_set_scene(Request &req, Response &res) {
|
||||||
|
if (req.params.Size() < 1) {
|
||||||
|
return error_params_insufficient(res);
|
||||||
|
}
|
||||||
|
if (!req.params[0].IsInt()) {
|
||||||
|
return error_type(res, "scene", "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto scene = req.params[0].GetInt();
|
||||||
|
if (scene < 0 || (int)std::size(cfg::SCREENRESIZE->scene_settings) < scene) {
|
||||||
|
return error(res, "invalid scene number");
|
||||||
|
}
|
||||||
|
if (scene == 0) {
|
||||||
|
cfg::SCREENRESIZE->enable_screen_resize = false;
|
||||||
|
} else {
|
||||||
|
cfg::SCREENRESIZE->enable_screen_resize = true;
|
||||||
|
cfg::SCREENRESIZE->screen_resize_current_scene = scene - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "api/module.h"
|
||||||
|
#include "api/request.h"
|
||||||
|
|
||||||
|
namespace api::modules {
|
||||||
|
|
||||||
|
class Resize : public Module {
|
||||||
|
public:
|
||||||
|
Resize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// function definitions
|
||||||
|
void image_resize_enable(Request &req, Response &res);
|
||||||
|
void image_resize_set_scene(Request &req, Response &res);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -12,3 +12,4 @@ from .keypads import *
|
|||||||
from .lights import *
|
from .lights import *
|
||||||
from .memory import *
|
from .memory import *
|
||||||
from .touch import *
|
from .touch import *
|
||||||
|
from .resize import *
|
||||||
@@ -16,3 +16,13 @@ def iidx_ticker_set(con: Connection, text: str):
|
|||||||
def iidx_ticker_reset(con: Connection):
|
def iidx_ticker_reset(con: Connection):
|
||||||
req = Request("iidx", "ticker_reset")
|
req = Request("iidx", "ticker_reset")
|
||||||
con.request(req)
|
con.request(req)
|
||||||
|
|
||||||
|
|
||||||
|
def iidx_tapeled_get(con: Connection, *light_names):
|
||||||
|
req = Request("iidx", "tapeled_get")
|
||||||
|
|
||||||
|
for light_name in light_names:
|
||||||
|
req.add_param(light_name)
|
||||||
|
|
||||||
|
res = con.request(req)
|
||||||
|
return res.get_data()
|
||||||
|
|||||||
@@ -2,8 +2,14 @@ from .connection import Connection
|
|||||||
from .request import Request
|
from .request import Request
|
||||||
|
|
||||||
|
|
||||||
def lights_read(con: Connection):
|
def lights_read(con: Connection, light_names=None):
|
||||||
res = con.request(Request("lights", "read"))
|
req = Request("lights", "read")
|
||||||
|
|
||||||
|
if light_names:
|
||||||
|
for light_name in light_names:
|
||||||
|
req.add_param(light_name)
|
||||||
|
|
||||||
|
res = con.request(req)
|
||||||
return res.get_data()
|
return res.get_data()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from .connection import Connection
|
||||||
|
from .request import Request
|
||||||
|
|
||||||
|
def image_resize_enable(con: Connection, enable: bool):
|
||||||
|
req = Request("resize", "image_resize_enable")
|
||||||
|
req.add_param(enable)
|
||||||
|
con.request(req)
|
||||||
|
|
||||||
|
def image_resize_set_scene(con: Connection, scene: int):
|
||||||
|
req = Request("resize", "image_resize_set_scene")
|
||||||
|
req.add_param(scene)
|
||||||
|
con.request(req)
|
||||||
@@ -397,6 +397,65 @@ class LightsTab(ttk.Frame):
|
|||||||
# set text
|
# set text
|
||||||
self.txt_lights.set_text(txt)
|
self.txt_lights.set_text(txt)
|
||||||
|
|
||||||
|
class ResizeTab(ttk.Frame):
|
||||||
|
"""Resize tab."""
|
||||||
|
|
||||||
|
def __init__(self, app, parent, **kwargs):
|
||||||
|
|
||||||
|
# init frame
|
||||||
|
ttk.Frame.__init__(self, parent, **kwargs)
|
||||||
|
self.app = app
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
|
# scale grid
|
||||||
|
self.columnconfigure(0, weight=1)
|
||||||
|
|
||||||
|
# image resize
|
||||||
|
self.resize = ttk.Frame(self, padding=(8, 8, 8, 8))
|
||||||
|
self.resize.grid(row=0, column=0, sticky=tk.E+tk.W)
|
||||||
|
self.resize.columnconfigure(0, weight=1)
|
||||||
|
self.resize.columnconfigure(1, weight=1)
|
||||||
|
self.resize_lbl = ttk.Label(self.resize, text="Image Resize")
|
||||||
|
self.resize_lbl.grid(row=0, columnspan=2)
|
||||||
|
|
||||||
|
self.resize_off = ttk.Button(self.resize, text="Disable", command=self.action_resize_false)
|
||||||
|
self.resize_off.grid(row=2, column=0, sticky=NSEW, padx=2, pady=2)
|
||||||
|
|
||||||
|
self.resize_on = ttk.Button(self.resize, text="Enable", command=self.action_resize_on)
|
||||||
|
self.resize_on.grid(row=2, column=1, sticky=NSEW, padx=2, pady=2)
|
||||||
|
|
||||||
|
self.resize_scene_1 = ttk.Button(self.resize, text="Scene 1", command=self.action_resize_scene_1)
|
||||||
|
self.resize_scene_1.grid(row=3, column=0, sticky=NSEW, padx=2, pady=2)
|
||||||
|
self.resize_scene_2 = ttk.Button(self.resize, text="Scene 2", command=self.action_resize_scene_2)
|
||||||
|
self.resize_scene_2.grid(row=3, column=1, sticky=NSEW, padx=2, pady=2)
|
||||||
|
self.resize_scene_3 = ttk.Button(self.resize, text="Scene 3", command=self.action_resize_scene_3)
|
||||||
|
self.resize_scene_3.grid(row=4, column=0, sticky=NSEW, padx=2, pady=2)
|
||||||
|
self.resize_scene_4 = ttk.Button(self.resize, text="Scene 4", command=self.action_resize_scene_4)
|
||||||
|
self.resize_scene_4.grid(row=4, column=1, sticky=NSEW, padx=2, pady=2)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_on(self):
|
||||||
|
spiceapi.image_resize_enable(self.app.connection, True)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_false(self):
|
||||||
|
spiceapi.image_resize_enable(self.app.connection, False)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_scene_1(self):
|
||||||
|
spiceapi.image_resize_set_scene(self.app.connection, 1)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_scene_2(self):
|
||||||
|
spiceapi.image_resize_set_scene(self.app.connection, 2)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_scene_3(self):
|
||||||
|
spiceapi.image_resize_set_scene(self.app.connection, 3)
|
||||||
|
|
||||||
|
@api_action
|
||||||
|
def action_resize_scene_4(self):
|
||||||
|
spiceapi.image_resize_set_scene(self.app.connection, 4)
|
||||||
|
|
||||||
class MainApp(ttk.Frame):
|
class MainApp(ttk.Frame):
|
||||||
"""The main application frame."""
|
"""The main application frame."""
|
||||||
@@ -419,6 +478,8 @@ class MainApp(ttk.Frame):
|
|||||||
self.tabs.add(self.tab_analogs, text="Analogs")
|
self.tabs.add(self.tab_analogs, text="Analogs")
|
||||||
self.tab_lights = LightsTab(self, self.tabs)
|
self.tab_lights = LightsTab(self, self.tabs)
|
||||||
self.tabs.add(self.tab_lights, text="Lights")
|
self.tabs.add(self.tab_lights, text="Lights")
|
||||||
|
self.tab_resize = ResizeTab(self, self.tabs)
|
||||||
|
self.tabs.add(self.tab_resize, text="Resize")
|
||||||
self.tab_manual = ManualTab(self, self.tabs)
|
self.tab_manual = ManualTab(self, self.tabs)
|
||||||
self.tabs.add(self.tab_manual, text="Manual")
|
self.tabs.add(self.tab_manual, text="Manual")
|
||||||
self.tabs.pack(expand=True, fill=tk.BOTH)
|
self.tabs.pack(expand=True, fill=tk.BOTH)
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "external/robin_hood.h"
|
#include "external/robin_hood.h"
|
||||||
#include "launcher/logger.h"
|
#include "launcher/logger.h"
|
||||||
|
#include "launcher/signal.h"
|
||||||
|
#include "util/deferlog.h"
|
||||||
#include "util/detour.h"
|
#include "util/detour.h"
|
||||||
#include "util/fileutils.h"
|
#include "util/fileutils.h"
|
||||||
#include "util/libutils.h"
|
#include "util/libutils.h"
|
||||||
@@ -1501,7 +1503,8 @@ namespace avs {
|
|||||||
" * Do NOT copy over random DLLs from another game installation; DLL must match game version\n"
|
" * Do NOT copy over random DLLs from another game installation; DLL must match game version\n"
|
||||||
"\n"
|
"\n"
|
||||||
, DLL_NAME, MODULE_PATH.string()) };
|
, DLL_NAME, MODULE_PATH.string()) };
|
||||||
log_fatal("avs-ea3", "{}", info_str);
|
log_warning("avs-ea3", "{}", info_str);
|
||||||
|
log_fatal("avs-ea3", "Failed to find critical avs DLL on disk (avs2-core.dll OR {})", DLL_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1736,7 +1739,17 @@ namespace avs {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_dir(
|
static void avs_dir_err(const std::filesystem::path &src_path)
|
||||||
|
{
|
||||||
|
deferredlogs::defer_error_messages({
|
||||||
|
"AVS filesystem initialization failure was previously detected during boot!",
|
||||||
|
fmt::format(" ERROR: directory could not be created: {}", src_path.string().c_str()),
|
||||||
|
fmt::format(" if you see a crash, it may have been caused by bad <mounttable> contents in {}", avs::core::CFG_PATH.c_str()),
|
||||||
|
" fix the XML file and try again"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static void create_avs_dir(
|
||||||
const std::string_view &avs_path,
|
const std::string_view &avs_path,
|
||||||
const std::string_view &src_path)
|
const std::string_view &src_path)
|
||||||
{
|
{
|
||||||
@@ -1745,6 +1758,7 @@ namespace avs {
|
|||||||
auto real_path = std::filesystem::absolute(src_path, err);
|
auto real_path = std::filesystem::absolute(src_path, err);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
avs_dir_err(real_path);
|
||||||
log_warning("avs-core", "failed to resolve '{}' path: {}", avs_path, err.message());
|
log_warning("avs-core", "failed to resolve '{}' path: {}", avs_path, err.message());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1754,7 +1768,9 @@ namespace avs {
|
|||||||
if (created) {
|
if (created) {
|
||||||
log_info("avs-core", "created '{}' at '{}'", avs_path, real_path.string());
|
log_info("avs-core", "created '{}' at '{}'", avs_path, real_path.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
avs_dir_err(real_path);
|
||||||
log_warning("avs-core", "failed to create '{}' folder at '{}': {}",
|
log_warning("avs-core", "failed to create '{}' folder at '{}': {}",
|
||||||
avs_path,
|
avs_path,
|
||||||
real_path.string(),
|
real_path.string(),
|
||||||
@@ -1815,7 +1831,7 @@ namespace avs {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_dir(avs_path, device_path);
|
create_avs_dir(avs_path, device_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_avs_config_fs_table(
|
static void create_avs_config_fs_table(
|
||||||
@@ -1870,7 +1886,7 @@ namespace avs {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_dir(dst_path, src_path);
|
create_avs_dir(dst_path, src_path);
|
||||||
} while ((vfs_node = property_node_traversal(vfs_node, TRAVERSE_NEXT_SEARCH_RESULT)));
|
} while ((vfs_node = property_node_traversal(vfs_node, TRAVERSE_NEXT_SEARCH_RESULT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1924,6 +1940,7 @@ namespace avs {
|
|||||||
static const char *LOG_LEVELS[] = { "disable", "fatal", "warning", "info", "misc", "all" };
|
static const char *LOG_LEVELS[] = { "disable", "fatal", "warning", "info", "misc", "all" };
|
||||||
char current_log_level_buffer[32] { 0 };
|
char current_log_level_buffer[32] { 0 };
|
||||||
uint32_t current_log_level = 0;
|
uint32_t current_log_level = 0;
|
||||||
|
std::string log_level_as_str;
|
||||||
|
|
||||||
if (VERSION == AVSLEGACY || VERSION == AVS21360) {
|
if (VERSION == AVSLEGACY || VERSION == AVS21360) {
|
||||||
auto level_node = property_search(config, config_node, "/log/level");
|
auto level_node = property_search(config, config_node, "/log/level");
|
||||||
@@ -1939,6 +1956,7 @@ namespace avs {
|
|||||||
{
|
{
|
||||||
if (current_log_level < std::size(LOG_LEVELS)) {
|
if (current_log_level < std::size(LOG_LEVELS)) {
|
||||||
log_info("avs-core", "log level: {}", LOG_LEVELS[current_log_level]);
|
log_info("avs-core", "log level: {}", LOG_LEVELS[current_log_level]);
|
||||||
|
log_level_as_str = LOG_LEVELS[current_log_level];
|
||||||
} else {
|
} else {
|
||||||
log_fatal("avs-core", "log level ({}) is invalid!", current_log_level);
|
log_fatal("avs-core", "log level ({}) is invalid!", current_log_level);
|
||||||
}
|
}
|
||||||
@@ -1958,7 +1976,7 @@ namespace avs {
|
|||||||
level_node = property_node_create(config, config_node, NODE_TYPE_str, "/log/level",
|
level_node = property_node_create(config, config_node, NODE_TYPE_str, "/log/level",
|
||||||
LOG_LEVELS[current_log_level]);
|
LOG_LEVELS[current_log_level]);
|
||||||
} else {
|
} else {
|
||||||
log_fatal("avs-core", "log level ({}) is invalid!", current_log_level);
|
log_fatal("avs-core", "log level ({}) is invalid! *", current_log_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1971,12 +1989,27 @@ namespace avs {
|
|||||||
if (property_node_refer(config, config_node, "/log/level",
|
if (property_node_refer(config, config_node, "/log/level",
|
||||||
NODE_TYPE_str, current_log_level_buffer, sizeof(current_log_level_buffer)) > 0)
|
NODE_TYPE_str, current_log_level_buffer, sizeof(current_log_level_buffer)) > 0)
|
||||||
{
|
{
|
||||||
log_info("avs-core", "log level: {}", current_log_level_buffer);
|
log_info("avs-core", "log level: {} *", current_log_level_buffer);
|
||||||
|
log_level_as_str = current_log_level_buffer;
|
||||||
} else {
|
} else {
|
||||||
log_warning("avs-core", "log level: unknown");
|
log_warning("avs-core", "log level: unknown *");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log_level_as_str == "disable" ||
|
||||||
|
log_level_as_str == "fatal" ||
|
||||||
|
log_level_as_str == "warning" ||
|
||||||
|
log_level_as_str == "info") {
|
||||||
|
|
||||||
|
deferredlogs::defer_error_messages({
|
||||||
|
fmt::format(
|
||||||
|
"log level is set to `{}` (either in avs-config.xml or using -loglevel)", log_level_as_str),
|
||||||
|
" this log file may have omitted important error messages from the game",
|
||||||
|
" if you are troubleshooting crashes or failures, it is recommended that you",
|
||||||
|
" set AVS Log Level (-loglevel) option to `all`",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// fix time offset
|
// fix time offset
|
||||||
auto t_now = std::time(nullptr);
|
auto t_now = std::time(nullptr);
|
||||||
auto tm_now = *std::gmtime(&t_now);
|
auto tm_now = *std::gmtime(&t_now);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
namespace avs {
|
namespace avs {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|||||||
+16
-2
@@ -41,6 +41,7 @@ namespace avs {
|
|||||||
int HTTP11 = -1;
|
int HTTP11 = -1;
|
||||||
int URL_SLASH = -1;
|
int URL_SLASH = -1;
|
||||||
int PCB_TYPE = -1;
|
int PCB_TYPE = -1;
|
||||||
|
bool EA3_DEBUG_VERBOSE = false;
|
||||||
|
|
||||||
// handle
|
// handle
|
||||||
std::string VERSION_STR = "unknown";
|
std::string VERSION_STR = "unknown";
|
||||||
@@ -149,7 +150,9 @@ namespace avs {
|
|||||||
" * Do NOT copy over random DLLs from another game installation; DLL must match game version\n"
|
" * Do NOT copy over random DLLs from another game installation; DLL must match game version\n"
|
||||||
"\n"
|
"\n"
|
||||||
, DLL_NAME, MODULE_PATH.string()) };
|
, DLL_NAME, MODULE_PATH.string()) };
|
||||||
log_fatal("avs-ea3", "{}", info_str);
|
|
||||||
|
log_warning("avs-ea3", "{}", info_str);
|
||||||
|
log_fatal("avs-ea3", "Failed to find critical ea3 DLL on disk (avs2-ea3.dll OR {})", DLL_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,6 +359,12 @@ namespace avs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fall back to default PCBID if node is not found
|
||||||
|
if (!EA3_PCBID[0] && PCBID_CUSTOM.empty()) {
|
||||||
|
log_warning("avs-ea3", "no PCBID set, falling back to default PCBID value (04040000000000000000)");
|
||||||
|
PCBID_CUSTOM = "04040000000000000000";
|
||||||
|
}
|
||||||
|
|
||||||
// custom PCBID
|
// custom PCBID
|
||||||
if (!PCBID_CUSTOM.empty()) {
|
if (!PCBID_CUSTOM.empty()) {
|
||||||
|
|
||||||
@@ -399,13 +408,18 @@ namespace avs {
|
|||||||
avs::core::NODE_TYPE_str, "/ea3/id/accountid", &EA3_ACCOUNTID);
|
avs::core::NODE_TYPE_str, "/ea3/id/accountid", &EA3_ACCOUNTID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if PCBID is defined
|
// check if PCBID is defined - should never hit, left for sanity check only
|
||||||
if (avs::core::property_search(ea3_config, nullptr, "/ea3/id/pcbid") == nullptr) {
|
if (avs::core::property_search(ea3_config, nullptr, "/ea3/id/pcbid") == nullptr) {
|
||||||
log_fatal("avs-ea3", "node not found: /ea3/id/pcbid (try using -p to specify PCBID)");
|
log_fatal("avs-ea3", "node not found: /ea3/id/pcbid (try using -p to specify PCBID)");
|
||||||
} else if (strlen(EA3_PCBID) == 0) {
|
} else if (strlen(EA3_PCBID) == 0) {
|
||||||
log_fatal("avs-ea3", "no PCBID set (try using -p to specify PCBID)");
|
log_fatal("avs-ea3", "no PCBID set (try using -p to specify PCBID)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove <debug> since it can expose pcbid in logged requests
|
||||||
|
if (!EA3_DEBUG_VERBOSE) {
|
||||||
|
avs::core::property_search_remove_safe(ea3_config, nullptr, "/ea3/debug/verbose");
|
||||||
|
}
|
||||||
|
|
||||||
// remember IDs
|
// remember IDs
|
||||||
char pcbid_buffer[256] { 0 };
|
char pcbid_buffer[256] { 0 };
|
||||||
char accountid_buffer[256] { 0 };
|
char accountid_buffer[256] { 0 };
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace avs {
|
|||||||
extern int HTTP11;
|
extern int HTTP11;
|
||||||
extern int URL_SLASH;
|
extern int URL_SLASH;
|
||||||
extern int PCB_TYPE;
|
extern int PCB_TYPE;
|
||||||
|
extern bool EA3_DEBUG_VERBOSE;
|
||||||
|
|
||||||
// handle
|
// handle
|
||||||
extern std::string VERSION_STR;
|
extern std::string VERSION_STR;
|
||||||
|
|||||||
@@ -76,24 +76,46 @@ namespace avs {
|
|||||||
const auto dll_path_s = dll_path.string();
|
const auto dll_path_s = dll_path.string();
|
||||||
log_info("avs-game", "DLL path: {}", dll_path_s.c_str());
|
log_info("avs-game", "DLL path: {}", dll_path_s.c_str());
|
||||||
|
|
||||||
if (MAX_PATH <= (dll_path_s.length() + 64)) {
|
// MAX_PATH is 260
|
||||||
|
if (130 <= dll_path_s.length()) {
|
||||||
log_warning(
|
log_warning(
|
||||||
"avs-game",
|
"avs-game",
|
||||||
"PATH TOO LONG WARNING\n\n\n"
|
"PATH TOO LONG WARNING\n\n"
|
||||||
"-------------------------------------------------------------------\n"
|
"-------------------------------------------------------------------\n"
|
||||||
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||||
|
"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n"
|
||||||
|
" PATH TOO LONG \n"
|
||||||
"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n"
|
"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n"
|
||||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||||
"'{}' has a length of {}\n"
|
"The path '{}'\n"
|
||||||
"Most of these games will behave unexpectedly when the path is too long,\n"
|
" has a length of {}\n"
|
||||||
"often resulting in random crashes. Move the game contents to a directory\n"
|
"Most of these games may behave unexpectedly when the path is too\n"
|
||||||
"with shorter path.\n"
|
"long, often resulting in random crashes. Move the game contents to\n"
|
||||||
"-------------------------------------------------------------------\n\n\n",
|
"a directory with shorter path.\n"
|
||||||
|
"-------------------------------------------------------------------\n\n",
|
||||||
dll_path_s, dll_path_s.length());
|
dll_path_s, dll_path_s.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ddr gamemdx.dll user error
|
||||||
|
if (avs::game::is_model("MDX") && DLL_NAME == "gamemdx.dll") {
|
||||||
|
log_warning(
|
||||||
|
"ddr",
|
||||||
|
"BAD GAME DLL ERROR\n\n"
|
||||||
|
"!!! !!!\n"
|
||||||
|
"!!! -exec gamemdx.dll was specified !!!\n"
|
||||||
|
"!!! this is the wrong DLL; the game will not load !!!\n"
|
||||||
|
"!!! remove -exec argument and try again. !!!\n"
|
||||||
|
"!!! !!!\n"
|
||||||
|
);
|
||||||
|
log_fatal("ddr", "BAD GAME DLL ERROR (don't use -exec gamemdx.dll, that's the wrong DLL)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// file not found on disk
|
||||||
if (!fileutils::file_exists(dll_path)) {
|
if (!fileutils::file_exists(dll_path)) {
|
||||||
log_warning("avs-game", "game DLL could not be found on disk: {}", dll_path.string().c_str());
|
log_warning("avs-game", "game DLL could not be found on disk: {}", dll_path.string().c_str());
|
||||||
log_warning("avs-game", "double check -exec and -modules parameters; unless you know what you're doing, leave them blank");
|
log_warning("avs-game", "double check -exec and -modules parameters; unless you know what you're doing, leave them blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileutils::verify_header_pe(dll_path)) {
|
if (fileutils::verify_header_pe(dll_path)) {
|
||||||
DLL_INSTANCE = libutils::load_library(dll_path);
|
DLL_INSTANCE = libutils::load_library(dll_path);
|
||||||
}
|
}
|
||||||
@@ -101,7 +123,7 @@ namespace avs {
|
|||||||
// load entry points
|
// load entry points
|
||||||
dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
|
dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
|
||||||
dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
|
dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
|
||||||
log_info("avs-game", "loaded successfully ({})", fmt::ptr(DLL_INSTANCE));
|
log_info("avs-game", "loaded {} successfully ({})", DLL_NAME, fmt::ptr(DLL_INSTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool entry_init(char *sid_code, void *app_param) {
|
bool entry_init(char *sid_code, void *app_param) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
#define IDD_DIALOG1 129
|
#define IDD_DIALOG1 129
|
||||||
#define IDR_CHANGELOG 130
|
|
||||||
#define IDR_LICENSES 131
|
#define IDR_LICENSES 131
|
||||||
#define IDR_PATCHES 132
|
#define IDR_PATCHES 132
|
||||||
#define IDR_README 133
|
#define IDR_README 133
|
||||||
|
|||||||
Regular → Executable
+79
-32
@@ -19,6 +19,25 @@ function trap_error_exit {
|
|||||||
trap trap_error_dbg DEBUG
|
trap trap_error_dbg DEBUG
|
||||||
trap trap_error_exit EXIT
|
trap trap_error_exit EXIT
|
||||||
|
|
||||||
|
IGNORE_CACHE=0
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
while getopts "ih" opt; do
|
||||||
|
case $opt in
|
||||||
|
i) IGNORE_CACHE=1 ;;
|
||||||
|
h)
|
||||||
|
echo "Usage: $0 [-i]"
|
||||||
|
echo " -i: Ignore build cache"
|
||||||
|
echo " -h: Show this help"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "none")
|
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "none")
|
||||||
GIT_HEAD=$(git rev-parse HEAD || echo "none")
|
GIT_HEAD=$(git rev-parse HEAD || echo "none")
|
||||||
@@ -30,6 +49,7 @@ BUILDDIR_64_RELEASE="./cmake-build-release-64"
|
|||||||
BUILDDIR_64_DEBUG="./cmake-build-debug-64"
|
BUILDDIR_64_DEBUG="./cmake-build-debug-64"
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
OUTDIR="./bin/spice2x"
|
OUTDIR="./bin/spice2x"
|
||||||
|
OUTDIR_EXTRAS="./bin/spice2x/extras"
|
||||||
|
|
||||||
# disabled UPX since it tends to falsely trigger malware detection
|
# disabled UPX since it tends to falsely trigger malware detection
|
||||||
UPX_ENABLE=0
|
UPX_ENABLE=0
|
||||||
@@ -40,9 +60,10 @@ INCLUDE_SRC=1
|
|||||||
DIST_ENABLE=1
|
DIST_ENABLE=1
|
||||||
DIST_FOLDER="./dist"
|
DIST_FOLDER="./dist"
|
||||||
DIST_NAME="spice2x-$(date +%y)-$(date +%m)-$(date +%d).zip"
|
DIST_NAME="spice2x-$(date +%y)-$(date +%m)-$(date +%d).zip"
|
||||||
|
DIST_NAME_EXTRAS="spice2x-$(date +%y)-$(date +%m)-$(date +%d)-full.zip"
|
||||||
DIST_COMMENT=${DIST_NAME}$'\n'"$GIT_BRANCH - $GIT_HEAD"$'\nThank you for playing.'
|
DIST_COMMENT=${DIST_NAME}$'\n'"$GIT_BRANCH - $GIT_HEAD"$'\nThank you for playing.'
|
||||||
TARGETS_32="spicetools_stubs_kbt spicetools_stubs_kld spicetools_cfg spicetools_spice"
|
TARGETS_32="spicetools_stubs_kbt spicetools_stubs_kld spicetools_cfg spicetools_cfg_linux spicetools_spice spicetools_spice_laa spicetools_spice_linux spicetools_stubs_cpusbxpkm"
|
||||||
TARGETS_64="spicetools_stubs_kbt64 spicetools_stubs_kld64 spicetools_stubs_nvEncodeAPI64 spicetools_stubs_nvcuvid spicetools_stubs_nvcuda spicetools_spice64"
|
TARGETS_64="spicetools_stubs_kbt64 spicetools_stubs_kld64 spicetools_stubs_nvEncodeAPI64 spicetools_stubs_nvcuvid spicetools_stubs_nvcuda spicetools_spice64 spicetools_spice64_linux"
|
||||||
|
|
||||||
# determine build type
|
# determine build type
|
||||||
BUILD_TYPE="Release"
|
BUILD_TYPE="Release"
|
||||||
@@ -57,7 +78,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# determine number of cores
|
# determine number of cores
|
||||||
CORES=$(awk '/^processor\t/ {cores[$NF]++} END {print length(cores)}' /proc/cpuinfo)
|
CORES=$(nproc)
|
||||||
|
|
||||||
# print information
|
# print information
|
||||||
echo ""
|
echo ""
|
||||||
@@ -74,34 +95,45 @@ echo "Build Type: $BUILD_TYPE"
|
|||||||
echo "Cores: $CORES"
|
echo "Cores: $CORES"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 32 bit
|
if ((IGNORE_CACHE > 0))
|
||||||
echo "Building 32bit targets..."
|
|
||||||
echo "========================="
|
|
||||||
if ((CLEAN_BUILD > 0))
|
|
||||||
then
|
then
|
||||||
rm -rf ${BUILDDIR_32}
|
echo "Ignoring build cache..."
|
||||||
|
else
|
||||||
|
export CCACHE_DIR="$(pwd)/.ccache"
|
||||||
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
|
export CMAKE_C_COMPILER_LAUNCHER=ccache
|
||||||
fi
|
fi
|
||||||
mkdir -p ${BUILDDIR_32}
|
|
||||||
pushd ${BUILDDIR_32} > /dev/null
|
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_32} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} $OLDPWD && make -j ${CORES} ${TARGETS_32}
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
# 64 bit
|
time (
|
||||||
echo ""
|
# 32 bit
|
||||||
echo "Building 64bit targets..."
|
echo "Building 32bit targets..."
|
||||||
echo "========================="
|
echo "========================="
|
||||||
if ((CLEAN_BUILD > 0))
|
if ((CLEAN_BUILD > 0))
|
||||||
then
|
then
|
||||||
rm -rf ${BUILDDIR_64}
|
rm -rf ${BUILDDIR_32}
|
||||||
fi
|
fi
|
||||||
mkdir -p ${BUILDDIR_64}
|
mkdir -p ${BUILDDIR_32}
|
||||||
pushd ${BUILDDIR_64} > /dev/null
|
pushd ${BUILDDIR_32} > /dev/null
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_64} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} $OLDPWD && make -j ${CORES} ${TARGETS_64}
|
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_32} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} $OLDPWD && ninja ${TARGETS_32}
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
echo ""
|
# 64 bit
|
||||||
echo "Compilation process done :)"
|
echo ""
|
||||||
echo "==========================="
|
echo "Building 64bit targets..."
|
||||||
|
echo "========================="
|
||||||
|
if ((CLEAN_BUILD > 0))
|
||||||
|
then
|
||||||
|
rm -rf ${BUILDDIR_64}
|
||||||
|
fi
|
||||||
|
mkdir -p ${BUILDDIR_64}
|
||||||
|
pushd ${BUILDDIR_64} > /dev/null
|
||||||
|
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_64} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} $OLDPWD && ninja ${TARGETS_64}
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Compilation process done :)"
|
||||||
|
echo "==========================="
|
||||||
|
)
|
||||||
|
|
||||||
# generate PDBs
|
# generate PDBs
|
||||||
if false # ((DEBUG > 0))
|
if false # ((DEBUG > 0))
|
||||||
@@ -149,10 +181,17 @@ fi
|
|||||||
|
|
||||||
# copy to output directory
|
# copy to output directory
|
||||||
echo "Copy files to output directory..."
|
echo "Copy files to output directory..."
|
||||||
|
|
||||||
rm -rf ${OUTDIR}
|
rm -rf ${OUTDIR}
|
||||||
mkdir -p ${OUTDIR}
|
mkdir -p ${OUTDIR}
|
||||||
#mkdir -p ${OUTDIR}/stubs/32
|
mkdir -p ${OUTDIR}/stubs/32
|
||||||
mkdir -p ${OUTDIR}/stubs/64
|
mkdir -p ${OUTDIR}/stubs/64
|
||||||
|
|
||||||
|
rm -rf ${OUTDIR_EXTRAS}
|
||||||
|
mkdir -p ${OUTDIR_EXTRAS}
|
||||||
|
mkdir -p ${OUTDIR_EXTRAS}/largeaddressaware
|
||||||
|
mkdir -p ${OUTDIR_EXTRAS}/linux
|
||||||
|
|
||||||
if false # ((DEBUG > 0))
|
if false # ((DEBUG > 0))
|
||||||
then
|
then
|
||||||
# debug files
|
# debug files
|
||||||
@@ -169,18 +208,24 @@ then
|
|||||||
#cp ${BUILDDIR_64}/spicetools/64/nvEncodeAPI64.dll ${OUTDIR}/stubs/64 2>/dev/null
|
#cp ${BUILDDIR_64}/spicetools/64/nvEncodeAPI64.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
#cp ${BUILDDIR_64}/spicetools/64/nvcuda.dll ${OUTDIR}/stubs/64 2>/dev/null
|
#cp ${BUILDDIR_64}/spicetools/64/nvcuda.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
#cp ${BUILDDIR_64}/spicetools/64/nvcuvid.dll ${OUTDIR}/stubs/64 2>/dev/null
|
#cp ${BUILDDIR_64}/spicetools/64/nvcuvid.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
|
#cp ${BUILDDIR_32}/spicetools/32/cpusbxpkm.dll ${OUTDIR}/stubs/32 2>/dev/null
|
||||||
else
|
else
|
||||||
# release files
|
# release files
|
||||||
cp ${BUILDDIR_32}/spicetools/spicecfg.exe ${OUTDIR} 2>/dev/null
|
cp ${BUILDDIR_32}/spicetools/spicecfg.exe ${OUTDIR} 2>/dev/null
|
||||||
|
cp ${BUILDDIR_32}/spicetools/spicecfg_linux.exe ${OUTDIR_EXTRAS}/linux/spicecfg.exe 2>/dev/null
|
||||||
cp ${BUILDDIR_32}/spicetools/32/spice.exe ${OUTDIR} 2>/dev/null
|
cp ${BUILDDIR_32}/spicetools/32/spice.exe ${OUTDIR} 2>/dev/null
|
||||||
|
cp ${BUILDDIR_32}/spicetools/32/spice_laa.exe ${OUTDIR_EXTRAS}/largeaddressaware/spice.exe 2>/dev/null
|
||||||
|
cp ${BUILDDIR_32}/spicetools/32/spice_linux.exe ${OUTDIR_EXTRAS}/linux/spice.exe 2>/dev/null
|
||||||
#cp ${BUILDDIR_32}/spicetools/32/kbt.dll ${OUTDIR}/stubs/32 2>/dev/null
|
#cp ${BUILDDIR_32}/spicetools/32/kbt.dll ${OUTDIR}/stubs/32 2>/dev/null
|
||||||
#cp ${BUILDDIR_32}/spicetools/32/kld.dll ${OUTDIR}/stubs/32 2>/dev/null
|
#cp ${BUILDDIR_32}/spicetools/32/kld.dll ${OUTDIR}/stubs/32 2>/dev/null
|
||||||
cp ${BUILDDIR_64}/spicetools/64/spice64.exe ${OUTDIR} 2>/dev/null
|
cp ${BUILDDIR_64}/spicetools/64/spice64.exe ${OUTDIR} 2>/dev/null
|
||||||
|
cp ${BUILDDIR_64}/spicetools/64/spice64_linux.exe ${OUTDIR_EXTRAS}/linux/spice64.exe 2>/dev/null
|
||||||
#cp ${BUILDDIR_64}/spicetools/64/kbt.dll ${OUTDIR}/stubs/64 2>/dev/null
|
#cp ${BUILDDIR_64}/spicetools/64/kbt.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
#cp ${BUILDDIR_64}/spicetools/64/kld.dll ${OUTDIR}/stubs/64 2>/dev/null
|
#cp ${BUILDDIR_64}/spicetools/64/kld.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
cp ${BUILDDIR_64}/spicetools/64/nvEncodeAPI64.dll ${OUTDIR}/stubs/64 2>/dev/null
|
cp ${BUILDDIR_64}/spicetools/64/nvEncodeAPI64.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
cp ${BUILDDIR_64}/spicetools/64/nvcuda.dll ${OUTDIR}/stubs/64 2>/dev/null
|
cp ${BUILDDIR_64}/spicetools/64/nvcuda.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
cp ${BUILDDIR_64}/spicetools/64/nvcuvid.dll ${OUTDIR}/stubs/64 2>/dev/null
|
cp ${BUILDDIR_64}/spicetools/64/nvcuvid.dll ${OUTDIR}/stubs/64 2>/dev/null
|
||||||
|
cp ${BUILDDIR_32}/spicetools/32/cpusbxpkm.dll ${OUTDIR}/stubs/32 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pack source files to output directory
|
# pack source files to output directory
|
||||||
@@ -194,10 +239,10 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# copy resources
|
# copy resources
|
||||||
rm -rf ${OUTDIR}/api
|
rm -rf ${OUTDIR_EXTRAS}/api
|
||||||
mkdir ${OUTDIR}/api
|
mkdir ${OUTDIR_EXTRAS}/api
|
||||||
find ./api/resources/python -name "__pycache__" -exec rm -rf {} +
|
find ./api/resources/python -name "__pycache__" -exec rm -rf {} +
|
||||||
cp -r ./api/resources/* ${OUTDIR}/api
|
cp -r ./api/resources/* ${OUTDIR_EXTRAS}/api
|
||||||
|
|
||||||
# build distribution archive
|
# build distribution archive
|
||||||
if ((DIST_ENABLE > 0))
|
if ((DIST_ENABLE > 0))
|
||||||
@@ -206,7 +251,9 @@ then
|
|||||||
mkdir -p ${DIST_FOLDER}
|
mkdir -p ${DIST_FOLDER}
|
||||||
rm -rf ${DIST_FOLDER}/${DIST_NAME}
|
rm -rf ${DIST_FOLDER}/${DIST_NAME}
|
||||||
pushd ${OUTDIR}/.. > /dev/null
|
pushd ${OUTDIR}/.. > /dev/null
|
||||||
zip -qrXT9 $OLDPWD/${DIST_FOLDER}/${DIST_NAME} . -z <<< "$DIST_COMMENT"
|
zip -qrXT9 $OLDPWD/${DIST_FOLDER}/${DIST_NAME} spice2x -x "spice2x/extras/*" -z <<< "$DIST_COMMENT"
|
||||||
|
echo "Building extras..."
|
||||||
|
zip -qrXT9 $OLDPWD/${DIST_FOLDER}/${DIST_NAME_EXTRAS} spice2x -z <<< "$DIST_COMMENT"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
docker build --pull external/docker -t spicetools/deps
|
docker build --pull external/docker -t spicetools/deps
|
||||||
docker build --build-context gitroot=%cd%/../../.git . -t spicetools/spice --no-cache
|
docker build --build-context gitroot=%cd%/../../.git . -t spicetools/spice
|
||||||
docker run --rm -it -v %cd%/dist:/src/src/spice2x/dist -v %cd%/bin:/src/src/spice2x/bin spicetools/spice
|
docker run --rm -it -v %cd%/dist:/src/src/spice2x/dist -v %cd%/bin:/src/src/spice2x/bin -v %cd%/.ccache:/src/src/spice2x/.ccache spicetools/spice %*
|
||||||
@REM to generate PDBs, set DEBUG to 1 in build_all.sh, place cv2pdb in external\cv2pdb, and run below
|
@REM to generate PDBs, set DEBUG to 1 in build_all.sh, place cv2pdb in external\cv2pdb, and run below
|
||||||
@REM external\cv2pdb\cv2pdb.exe bin\spice2x\spicecfg.exe bin\spice2x\spicecfg-pdb.exe bin\spice2x\spicecfg-pdb.pdb
|
@REM external\cv2pdb\cv2pdb.exe bin\spice2x\spicecfg.exe bin\spice2x\spicecfg-pdb.exe bin\spice2x\spicecfg-pdb.pdb
|
||||||
@REM external\cv2pdb\cv2pdb.exe bin\spice2x\spice.exe bin\spice2x\spice-pdb.exe bin\spice2x\spice-pdb.pdb
|
@REM external\cv2pdb\cv2pdb.exe bin\spice2x\spice.exe bin\spice2x\spice-pdb.exe bin\spice2x\spice-pdb.pdb
|
||||||
|
|||||||
Regular → Executable
+2
-4
@@ -1,6 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export DOCKER_BUILDKIT=0
|
|
||||||
|
|
||||||
docker build --pull $PWD/external/docker -t spicetools/deps --platform linux/x86_64
|
docker build --pull $PWD/external/docker -t spicetools/deps --platform linux/x86_64
|
||||||
docker build --build-context gitroot=$PWD/../../.git . -t spicetools/spice:latest --no-cache
|
docker build --build-context gitroot=$PWD/../../.git . -t spicetools/spice:latest
|
||||||
docker run --rm -it -v $PWD/dist:/src/src/spice2x/dist -v $PWD/bin:/src/src/spice2x/bin spicetools/spice
|
docker run --rm -v $PWD/dist:/src/src/spice2x/dist -v $PWD/bin:/src/src/spice2x/bin -v $PWD/.ccache:/src/src/spice2x/.ccache spicetools/spice "$@"
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
del /s /q .ccache
|
||||||
|
del /s /q dist
|
||||||
|
call build_docker.bat
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
IDR_CHANGELOG RCDATA "../changelog.txt"
|
|
||||||
IDR_LICENSES RCDATA "../licenses.txt"
|
IDR_LICENSES RCDATA "../licenses.txt"
|
||||||
IDR_PATCHES RCDATA "../build/patches.json"
|
IDR_PATCHES RCDATA "../build/patches.json"
|
||||||
IDR_README RCDATA "../readme.txt"
|
IDR_README RCDATA "../readme.txt"
|
||||||
|
|||||||
+34
-4
@@ -1,5 +1,8 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
#include "launcher/superexit.h"
|
||||||
#include "rawinput/rawinput.h"
|
#include "rawinput/rawinput.h"
|
||||||
#include "rawinput/piuio.h"
|
#include "rawinput/piuio.h"
|
||||||
#include "util/time.h"
|
#include "util/time.h"
|
||||||
@@ -64,18 +67,29 @@ GameAPI::Buttons::State GameAPI::Buttons::getState(rawinput::RawInputManager *ma
|
|||||||
auto current_button = &_button;
|
auto current_button = &_button;
|
||||||
auto alternatives = check_alts ? ¤t_button->getAlternatives() : nullptr;
|
auto alternatives = check_alts ? ¤t_button->getAlternatives() : nullptr;
|
||||||
unsigned int button_count = 0;
|
unsigned int button_count = 0;
|
||||||
|
std::optional<bool> window_has_focus;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
// naive behavior
|
// naive behavior
|
||||||
if (current_button->isNaive()) {
|
if (current_button->isNaive()) {
|
||||||
|
GameAPI::Buttons::State state;
|
||||||
|
auto vkey = current_button->getVKey();
|
||||||
|
|
||||||
|
// check for focus
|
||||||
|
if (vkey != INVALID_VKEY && rawinput::NAIVE_REQUIRE_FOCUS) {
|
||||||
|
if (!window_has_focus.has_value()) {
|
||||||
|
window_has_focus = superexit::has_focus();
|
||||||
|
}
|
||||||
|
if (!window_has_focus.value()) {
|
||||||
|
vkey = INVALID_VKEY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// read
|
// read
|
||||||
auto vkey = current_button->getVKey();
|
if (vkey == INVALID_VKEY) {
|
||||||
GameAPI::Buttons::State state;
|
|
||||||
if (vkey == 0xFF) {
|
|
||||||
state = BUTTON_NOT_PRESSED;
|
state = BUTTON_NOT_PRESSED;
|
||||||
} else {
|
} else {
|
||||||
state = (GetAsyncKeyState(current_button->getVKey()) & 0x8000) ? BUTTON_PRESSED : BUTTON_NOT_PRESSED;
|
state = (GetAsyncKeyState(vkey) & 0x8000) ? BUTTON_PRESSED : BUTTON_NOT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// invert
|
// invert
|
||||||
@@ -106,6 +120,16 @@ GameAPI::Buttons::State GameAPI::Buttons::getState(rawinput::RawInputManager *ma
|
|||||||
auto &devid = current_button->getDeviceIdentifier();
|
auto &devid = current_button->getDeviceIdentifier();
|
||||||
auto device = manager->devices_get(devid, false); // TODO: fix to update only
|
auto device = manager->devices_get(devid, false); // TODO: fix to update only
|
||||||
|
|
||||||
|
// check for focus
|
||||||
|
if (device && rawinput::RAWINPUT_REQUIRE_FOCUS) {
|
||||||
|
if (!window_has_focus.has_value()) {
|
||||||
|
window_has_focus = superexit::has_focus();
|
||||||
|
}
|
||||||
|
if (!window_has_focus.value()) {
|
||||||
|
device = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get state if device was marked as updated
|
// get state if device was marked as updated
|
||||||
GameAPI::Buttons::State state = current_button->getLastState();
|
GameAPI::Buttons::State state = current_button->getLastState();
|
||||||
double *last_up = nullptr;
|
double *last_up = nullptr;
|
||||||
@@ -571,6 +595,12 @@ float GameAPI::Analogs::getState(rawinput::Device *device, Analog &analog) {
|
|||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case rawinput::MOUSE: {
|
case rawinput::MOUSE: {
|
||||||
|
|
||||||
|
// check for focus
|
||||||
|
if (rawinput::NAIVE_REQUIRE_FOCUS && !superexit::has_focus()) {
|
||||||
|
value = analog.getLastState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// get mouse position
|
// get mouse position
|
||||||
auto mouse = device->mouseInfo;
|
auto mouse = device->mouseInfo;
|
||||||
long pos;
|
long pos;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ std::string Button::getDisplayString(rawinput::RawInputManager* manager) {
|
|||||||
std::string vKeyString = fmt::format("{:#x}", vKey);
|
std::string vKeyString = fmt::format("{:#x}", vKey);
|
||||||
|
|
||||||
// device must be existing
|
// device must be existing
|
||||||
if (this->device_identifier.empty() && vKey == 0xFF) {
|
if (this->device_identifier.empty() && vKey == INVALID_VKEY) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ enum ButtonAnalogType {
|
|||||||
|
|
||||||
extern const char *ButtonAnalogTypeStr[];
|
extern const char *ButtonAnalogTypeStr[];
|
||||||
|
|
||||||
|
constexpr unsigned short INVALID_VKEY = UINT16_C(0xFF);
|
||||||
|
|
||||||
class Button {
|
class Button {
|
||||||
private:
|
private:
|
||||||
std::vector<Button> alternatives;
|
std::vector<Button> alternatives;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string device_identifier = "";
|
std::string device_identifier = "";
|
||||||
unsigned short vKey = 0xFF;
|
unsigned short vKey = INVALID_VKEY;
|
||||||
ButtonAnalogType analog_type = BAT_NONE;
|
ButtonAnalogType analog_type = BAT_NONE;
|
||||||
double debounce_up = 0.0;
|
double debounce_up = 0.0;
|
||||||
double debounce_down = 0.0;
|
double debounce_down = 0.0;
|
||||||
@@ -68,12 +70,12 @@ public:
|
|||||||
if (this->override_enabled) {
|
if (this->override_enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this->vKey != 0xFF) {
|
if (this->vKey != INVALID_VKEY) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &alternative : this->alternatives) {
|
for (auto &alternative : this->alternatives) {
|
||||||
if (alternative.vKey != 0xFF) {
|
if (alternative.vKey != INVALID_VKEY) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void clearBindings() {
|
inline void clearBindings() {
|
||||||
vKey = 0xFF;
|
vKey = INVALID_VKEY;
|
||||||
alternatives.clear();
|
alternatives.clear();
|
||||||
device_identifier = "";
|
device_identifier = "";
|
||||||
analog_type = BAT_NONE;
|
analog_type = BAT_NONE;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
std::string value;
|
std::string value;
|
||||||
std::vector<Option> alternatives;
|
std::vector<Option> alternatives;
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
|
bool conflicting = false;
|
||||||
|
|
||||||
explicit Option(OptionDefinition definition, std::string value = "") :
|
explicit Option(OptionDefinition definition, std::string value = "") :
|
||||||
definition(std::move(definition)), value(std::move(value)) {
|
definition(std::move(definition)), value(std::move(value)) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define IDR_CHANGELOG 130
|
|
||||||
#define IDR_LICENSES 131
|
#define IDR_LICENSES 131
|
||||||
#define IDR_PATCHES 132
|
#define IDR_PATCHES 132
|
||||||
#define IDR_README 133
|
#define IDR_README 133
|
||||||
|
|||||||
@@ -15,12 +15,18 @@ namespace cfg {
|
|||||||
std::optional<std::string> SCREEN_RESIZE_CFG_PATH_OVERRIDE;
|
std::optional<std::string> SCREEN_RESIZE_CFG_PATH_OVERRIDE;
|
||||||
|
|
||||||
ScreenResize::ScreenResize() {
|
ScreenResize::ScreenResize() {
|
||||||
|
bool file_exists = false;
|
||||||
if (SCREEN_RESIZE_CFG_PATH_OVERRIDE.has_value()) {
|
if (SCREEN_RESIZE_CFG_PATH_OVERRIDE.has_value()) {
|
||||||
this->config_path = SCREEN_RESIZE_CFG_PATH_OVERRIDE.value();
|
this->config_path = SCREEN_RESIZE_CFG_PATH_OVERRIDE.value();
|
||||||
|
if (fileutils::file_exists(this->config_path)) {
|
||||||
|
log_info("ScreenResize", "loading config from: {}", this->config_path.string());
|
||||||
|
file_exists = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this->config_path = std::filesystem::path(_wgetenv(L"APPDATA")) / L"spicetools_screen_resize.json";
|
this->config_path =
|
||||||
|
fileutils::get_config_file_path("ScreenResize", "spicetools_screen_resize.json", &file_exists);
|
||||||
}
|
}
|
||||||
if (fileutils::file_exists(this->config_path)) {
|
if (file_exists) {
|
||||||
this->config_load();
|
this->config_load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,12 +35,6 @@ namespace cfg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenResize::config_load() {
|
void ScreenResize::config_load() {
|
||||||
if (SCREEN_RESIZE_CFG_PATH_OVERRIDE.has_value()) {
|
|
||||||
log_info("ScreenResize", "loading custom config: {}", this->config_path.string());
|
|
||||||
} else {
|
|
||||||
log_info("ScreenResize", "loading global config from APPDATA");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string config = fileutils::text_read(this->config_path);
|
std::string config = fileutils::text_read(this->config_path);
|
||||||
if (config.empty()) {
|
if (config.empty()) {
|
||||||
log_info("ScreenResize", "config is empty");
|
log_info("ScreenResize", "config is empty");
|
||||||
@@ -76,14 +76,22 @@ namespace cfg {
|
|||||||
eamuse_get_game(),
|
eamuse_get_game(),
|
||||||
use_game_setting,
|
use_game_setting,
|
||||||
root);
|
root);
|
||||||
load_int_value(doc, root + "offset_x", this->offset_x);
|
|
||||||
load_int_value(doc, root + "offset_y", this->offset_y);
|
|
||||||
load_float_value(doc, root + "scale_x", this->scale_x);
|
|
||||||
load_float_value(doc, root + "scale_y", this->scale_y);
|
|
||||||
load_bool_value(doc, root + "enable_screen_resize", this->enable_screen_resize);
|
load_bool_value(doc, root + "enable_screen_resize", this->enable_screen_resize);
|
||||||
load_bool_value(doc, root + "enable_linear_filter", this->enable_linear_filter);
|
load_bool_value(doc, root + "enable_linear_filter", this->enable_linear_filter);
|
||||||
load_bool_value(doc, root + "keep_aspect_ratio", this->keep_aspect_ratio);
|
for (size_t i = 0; i < std::size(this->scene_settings); i++) {
|
||||||
load_bool_value(doc, root + "centered", this->centered);
|
auto& scene = this->scene_settings[i];
|
||||||
|
const std::string prefix = fmt::format("scenes/{}/", i);
|
||||||
|
load_int_value(doc, root + prefix + "offset_x", scene.offset_x);
|
||||||
|
load_int_value(doc, root + prefix + "offset_y", scene.offset_y);
|
||||||
|
load_float_value(doc, root + prefix + "scale_x", scene.scale_x);
|
||||||
|
load_float_value(doc, root + prefix + "scale_y", scene.scale_y);
|
||||||
|
load_bool_value(doc, root + prefix + "keep_aspect_ratio", scene.keep_aspect_ratio);
|
||||||
|
|
||||||
|
int duplicate = 0;
|
||||||
|
load_int_value(doc, root + prefix + "duplicate", duplicate);
|
||||||
|
scene.duplicate = static_cast<cfg::ScreenDuplicateMode>(duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
// windowed settings are always under game settings
|
// windowed settings are always under game settings
|
||||||
root = "/sp2x_games/" + eamuse_get_game() + "/";
|
root = "/sp2x_games/" + eamuse_get_game() + "/";
|
||||||
@@ -166,8 +174,6 @@ namespace cfg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenResize::config_save() {
|
void ScreenResize::config_save() {
|
||||||
log_info("ScreenResize", "saving config: {}", this->config_path.string());
|
|
||||||
|
|
||||||
rapidjson::Document doc;
|
rapidjson::Document doc;
|
||||||
std::string config = fileutils::text_read(this->config_path);
|
std::string config = fileutils::text_read(this->config_path);
|
||||||
if (!config.empty()) {
|
if (!config.empty()) {
|
||||||
@@ -189,14 +195,18 @@ namespace cfg {
|
|||||||
root);
|
root);
|
||||||
|
|
||||||
// full screen image settings
|
// full screen image settings
|
||||||
rapidjson::Pointer(root + "offset_x").Set(doc, this->offset_x);
|
|
||||||
rapidjson::Pointer(root + "offset_y").Set(doc, this->offset_y);
|
|
||||||
rapidjson::Pointer(root + "scale_x").Set(doc, this->scale_x);
|
|
||||||
rapidjson::Pointer(root + "scale_y").Set(doc, this->scale_y);
|
|
||||||
rapidjson::Pointer(root + "enable_screen_resize").Set(doc, this->enable_screen_resize);
|
rapidjson::Pointer(root + "enable_screen_resize").Set(doc, this->enable_screen_resize);
|
||||||
rapidjson::Pointer(root + "enable_linear_filter").Set(doc, this->enable_linear_filter);
|
rapidjson::Pointer(root + "enable_linear_filter").Set(doc, this->enable_linear_filter);
|
||||||
rapidjson::Pointer(root + "keep_aspect_ratio").Set(doc, this->keep_aspect_ratio);
|
for (size_t i = 0; i < std::size(this->scene_settings); i++) {
|
||||||
rapidjson::Pointer(root + "centered").Set(doc, this->centered);
|
auto& scene = this->scene_settings[i];
|
||||||
|
const std::string prefix = fmt::format("scenes/{}/", i);
|
||||||
|
rapidjson::Pointer(root + prefix + "offset_x").Set(doc, scene.offset_x);
|
||||||
|
rapidjson::Pointer(root + prefix + "offset_y").Set(doc, scene.offset_y);
|
||||||
|
rapidjson::Pointer(root + prefix + "scale_x").Set(doc, scene.scale_x);
|
||||||
|
rapidjson::Pointer(root + prefix + "scale_y").Set(doc, scene.scale_y);
|
||||||
|
rapidjson::Pointer(root + prefix + "keep_aspect_ratio").Set(doc, scene.keep_aspect_ratio);
|
||||||
|
rapidjson::Pointer(root + prefix + "duplicate").Set(doc, scene.duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
// windowed mode settings
|
// windowed mode settings
|
||||||
rapidjson::Pointer(root + "w_always_on_top").Set(doc, this->window_always_on_top);
|
rapidjson::Pointer(root + "w_always_on_top").Set(doc, this->window_always_on_top);
|
||||||
@@ -214,10 +224,10 @@ namespace cfg {
|
|||||||
doc.Accept(writer);
|
doc.Accept(writer);
|
||||||
|
|
||||||
// save to file
|
// save to file
|
||||||
if (fileutils::text_write(this->config_path, buffer.GetString())) {
|
if (fileutils::write_config_file("ScreenResize", this->config_path, buffer.GetString())) {
|
||||||
// this->config_dirty = false;
|
// this->config_dirty = false;
|
||||||
} else {
|
} else {
|
||||||
log_warning("ScreenResize", "unable to save config file to {}", this->config_path.string());
|
log_warning("ScreenResize", "unable to save config file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,21 @@ namespace cfg {
|
|||||||
ResizableFrame = 2
|
ResizableFrame = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ScreenDuplicateMode {
|
||||||
|
None = 0,
|
||||||
|
CopyLeft = 1,
|
||||||
|
CopyRight = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fullscreen_setting {
|
||||||
|
int offset_x = 0;
|
||||||
|
int offset_y = 0;
|
||||||
|
float scale_x = 1.0;
|
||||||
|
float scale_y = 1.0;
|
||||||
|
bool keep_aspect_ratio = true;
|
||||||
|
ScreenDuplicateMode duplicate = ScreenDuplicateMode::None;
|
||||||
|
};
|
||||||
|
|
||||||
extern std::optional<std::string> SCREEN_RESIZE_CFG_PATH_OVERRIDE;
|
extern std::optional<std::string> SCREEN_RESIZE_CFG_PATH_OVERRIDE;
|
||||||
|
|
||||||
class ScreenResize {
|
class ScreenResize {
|
||||||
@@ -31,14 +46,10 @@ namespace cfg {
|
|||||||
~ScreenResize();
|
~ScreenResize();
|
||||||
|
|
||||||
// full screen (directx) image settings
|
// full screen (directx) image settings
|
||||||
int offset_x = 0;
|
|
||||||
int offset_y = 0;
|
|
||||||
float scale_x = 1.0;
|
|
||||||
float scale_y = 1.0;
|
|
||||||
bool enable_screen_resize = false;
|
bool enable_screen_resize = false;
|
||||||
|
int8_t screen_resize_current_scene = 0;
|
||||||
bool enable_linear_filter = true;
|
bool enable_linear_filter = true;
|
||||||
bool keep_aspect_ratio = true;
|
fullscreen_setting scene_settings[4];
|
||||||
bool centered = true;
|
|
||||||
|
|
||||||
// windowed mode sizing
|
// windowed mode sizing
|
||||||
// Windows terminology:
|
// Windows terminology:
|
||||||
|
|||||||
@@ -1,681 +0,0 @@
|
|||||||
03/16/2025 [spice2x]
|
|
||||||
Fix clipboard copy function truncating last character of string
|
|
||||||
|
|
||||||
03/03/2025 [spice2x]
|
|
||||||
IIDX: add workaround for REVERB EX filter missing in Windows 11 update
|
|
||||||
|
|
||||||
02/25/2025 [spice2x]
|
|
||||||
Add -vsyncbuffer option for forcing double/triple buffering
|
|
||||||
|
|
||||||
02/22/2025 [spice2x]
|
|
||||||
Add -windowscale option for resizing DX9 backbuffer dimensions
|
|
||||||
|
|
||||||
01/26/2025 [spice2x]
|
|
||||||
Expanded main menu in overlay (default bind: esc key)
|
|
||||||
Nostalgia: touch and swipe gestures (-nostpoke)
|
|
||||||
Jubeat: detect root directory boot failure
|
|
||||||
Add "Any Direction" analog type for button binding
|
|
||||||
|
|
||||||
01/16/2025 [spice2x]
|
|
||||||
More MIDI improvements:
|
|
||||||
use v2_drum algorithm instead of v2 by default for drummania & FTT
|
|
||||||
threshold setting for CC when mapped as a button (hi-hat pedals)
|
|
||||||
sustain duration applied to CC OnOff controls (sustain pedals)
|
|
||||||
Nostalgia, Beatstream: fix EA card insertion issue
|
|
||||||
CCJ, QKS: translate some windowed mode settings to Unity engine
|
|
||||||
Fix DEBUG build
|
|
||||||
|
|
||||||
01/08/2025 [spice2x]
|
|
||||||
Better MIDI support; significant improvements for drums
|
|
||||||
Fix various UI bugs in Buttons / Analog tabs
|
|
||||||
Nostalgia: fix velocity handling for MIDI input
|
|
||||||
Show camera names in camera control overlay
|
|
||||||
Game exit dialog (default: Escape key)
|
|
||||||
Button layout help text in Buttons tab
|
|
||||||
|
|
||||||
12/31/2024 [spice2x]
|
|
||||||
Fix videos not playing in Unity-based games
|
|
||||||
Dump audio device info in wrapped WASAPI handler
|
|
||||||
Update DLL load failure message
|
|
||||||
|
|
||||||
12/30/2024 [spice2x]
|
|
||||||
Busou Shinki: Show Cursor option now properly shows cursor in game
|
|
||||||
IIDX: add IIDX NVENC Quality option (-iidxreccqp)
|
|
||||||
IIDX: always enable NVENC hook, not just when -iidx is set
|
|
||||||
IIDX: add help text to keypad overlay in TDJ mode
|
|
||||||
Busou Shinki, QKS, CCJ: Only show cursor by default if no touchscreen detected
|
|
||||||
Ignore invalid HID devices with bad device path
|
|
||||||
|
|
||||||
12/13/2024 [spice2x]
|
|
||||||
Improve error messages for DLL load failures
|
|
||||||
Load cardio module in spicecfg
|
|
||||||
|
|
||||||
12/06/2024 [spice2x]
|
|
||||||
Clean up seldom used features (VR, Lua scripting, layeredfs, KFControl)
|
|
||||||
New card scanner section in Cards tab
|
|
||||||
Add -scardfix option for converting NFC cards into E00401 format
|
|
||||||
Add system information logging, controlled by -sysdump option
|
|
||||||
|
|
||||||
11/20/2024 [spice2x]
|
|
||||||
DRS: add subscreen overlay window (dance floor tape LED display)
|
|
||||||
IIDX: TDJ cam selection options for users with 3+ cameras
|
|
||||||
(-iidxtdjcamhooktop /-iidxtdjcamhookfront)
|
|
||||||
IIDX/SDVX: move some options to Advanced tab
|
|
||||||
Update -nvprofile to set V-Sync settings as Application Controlled
|
|
||||||
|
|
||||||
10/29/2024 [spice2x]
|
|
||||||
(IIDX31+) apply signature patch to force WASAPI by default; use -iidxsounddevice to override
|
|
||||||
Fix SDVX EG song search when using Japanese touch keyboard (when OS is not ja-JP)
|
|
||||||
Nostalgia I/O improvements
|
|
||||||
Expose DDR Gold cabinet tape LEDs via Spice API
|
|
||||||
|
|
||||||
10/14/2024 [spice2x]
|
|
||||||
Apply patches earlier, on DLL load notification
|
|
||||||
SMX dedicab lights improvements
|
|
||||||
|
|
||||||
10/12/2024 [spice2x]
|
|
||||||
SMX dedicab lights support (requires forked SMX.dll - see Issue #228)
|
|
||||||
Option to show FPS overlay on top left (-fpsflip)
|
|
||||||
Allow TDJ camhook to load without -iidx (for cabs)
|
|
||||||
|
|
||||||
09/21/2024 [spice2x]
|
|
||||||
Add Inject Early DLL Hooks option (-z)
|
|
||||||
|
|
||||||
09/14/2024 [spice2x]
|
|
||||||
Add Patch Manager Config Path (-patchcfgpath) option
|
|
||||||
Vertical/horizontal flip for TDJ cam hook
|
|
||||||
Fix mouse button behavior when left/right buttons are swapped
|
|
||||||
|
|
||||||
08/24/2024 [spice2x]
|
|
||||||
Fix Patch Manager failing to import patches when modules path is Unicode
|
|
||||||
|
|
||||||
08/22/2024 [spice2x]
|
|
||||||
UI update for Card Manager in overlay
|
|
||||||
|
|
||||||
08/12/2024 [spice2x]
|
|
||||||
IIDX TDJ camera - bug fixes
|
|
||||||
Prevent users from accidentally enabling -cfg and -kfcontrol in spicecfg
|
|
||||||
|
|
||||||
08/07/2024 [spice2x]
|
|
||||||
IIDX TDJ camera improvements - draw modes (stretch/crop), bug fixes
|
|
||||||
|
|
||||||
08/06/2024 [spice2x]
|
|
||||||
IIDX TDJ camera improvements
|
|
||||||
Automatic cropping for 16:9 resolutions
|
|
||||||
Toggle to keep or override camera parameters
|
|
||||||
Fix Unicode path handling for config files
|
|
||||||
|
|
||||||
08/03/2024 [spice2x]
|
|
||||||
IIDX TDJ camera improvements
|
|
||||||
Camera control overlay (check Overlay tab)
|
|
||||||
Hardware acceleration for camera rendering
|
|
||||||
IIDX TDJ play record improvements
|
|
||||||
NVENC hooks have been added to fix crash on song start; -nod3d9devhook
|
|
||||||
is no longer required
|
|
||||||
|
|
||||||
07/29/2024 [spice2x]
|
|
||||||
Fix IIDX TDJ not launching in fullscreen with two monitors
|
|
||||||
|
|
||||||
07/28/2024 [spice2x]
|
|
||||||
Add more DLL support for -iidxtdjcamhook
|
|
||||||
Add -iidxtdjcamhookratio and -iidxtdjcamhookoffset
|
|
||||||
|
|
||||||
07/25/2024 [spice2x]
|
|
||||||
Add -iidxtdjcamhook option for webcam support in TDJ
|
|
||||||
|
|
||||||
07/17/2024 [spice2x]
|
|
||||||
Disable touch feedback indicators
|
|
||||||
Bug fixes
|
|
||||||
|
|
||||||
07/15/2024 [spice2x]
|
|
||||||
Fix touch and touch emulation in wintouch-based games (Nostalgia, BeatStream...)
|
|
||||||
Fix misaligned SpiceCompanion touches on windowed TDJ subscreen
|
|
||||||
Improvements to TDJ poke feature
|
|
||||||
|
|
||||||
07/13/2024 [spice2x]
|
|
||||||
Fix windowed TDJ subscreen not accepting mouse clicks after card in
|
|
||||||
Allow windowed TDJ/UFC subscreen to minimize, but not close
|
|
||||||
|
|
||||||
07/10/2024 [spice2x]
|
|
||||||
Better gfdm XG2 and XG3 support
|
|
||||||
IIDX TDJ windowed mode rendering improvements
|
|
||||||
IIDX TDJ subscreen poke feature
|
|
||||||
CardIO NumLock toggle option
|
|
||||||
Patch manager UI tweaks
|
|
||||||
|
|
||||||
07/06/2024 [spice2x]
|
|
||||||
Reliability improvements for config file saving
|
|
||||||
Experimental and incomplete support for gfdm XG3
|
|
||||||
Option to specify path for screen resize config
|
|
||||||
Reflec Beat: fix being unable to type into overlay
|
|
||||||
|
|
||||||
07/03/2024 [spice2x]
|
|
||||||
Fix SMX stage compatibility
|
|
||||||
Patch manager: log header in patches JSON, better error handling
|
|
||||||
|
|
||||||
06/26/2024 [spice2x]
|
|
||||||
Fix MDX-003 not retrieving patches from online source
|
|
||||||
|
|
||||||
06/22/2024 [spice2x]
|
|
||||||
Reliability & performance improvements for auto-card-insert
|
|
||||||
Update -sdvxnosub to prevent creation of subscreen in windowed mode
|
|
||||||
Bug fixes
|
|
||||||
|
|
||||||
06/20/2024 [spice2x]
|
|
||||||
Improve experience for windowed SDVX UFC (always launch subscreen window)
|
|
||||||
Add Delay option in analog binds
|
|
||||||
Fix pop'n soft-lock with auto card insert
|
|
||||||
Fix -graphics-single-adapter not working in Beatstream/Nostalgia
|
|
||||||
|
|
||||||
06/14/2024 [spice2x]
|
|
||||||
Improve experience for touch-enabled games in windowed mode (SpiceTouch)
|
|
||||||
|
|
||||||
06/08/2024 [spice2x]
|
|
||||||
Patch manager bug fixes
|
|
||||||
|
|
||||||
06/03/2024 [spice2x]
|
|
||||||
Fix patch status not being saved properly
|
|
||||||
Search tab for finding options
|
|
||||||
|
|
||||||
06/02/2024 [spice2x]
|
|
||||||
Fix BBC and Museca hang on boot when COM ports are present
|
|
||||||
Deprecate -iidxtdjw (use -iidxtdj and -w together instead)
|
|
||||||
|
|
||||||
05/31/2024 [spice2x]
|
|
||||||
Redesign patches tab
|
|
||||||
Bug fixes for patches.json parsing
|
|
||||||
|
|
||||||
05/29/2024 [spice2x]
|
|
||||||
Add support for "number" patch type
|
|
||||||
History for remote patch URLs
|
|
||||||
|
|
||||||
05/28/2024 [spice2x]
|
|
||||||
Update -iidxtdjw to hide useless second window
|
|
||||||
|
|
||||||
05/27/2024 [spice2x]
|
|
||||||
Fix -apiserial crashing when -apiserialbaud is not provided
|
|
||||||
Suppress "failed to acquire subscreen" error when not relevant
|
|
||||||
|
|
||||||
05/22/2024 [spice2x]
|
|
||||||
Add caution string to patches.json format
|
|
||||||
Paste from clipboard button for URL patches import
|
|
||||||
|
|
||||||
05/12/2024 [spice2x]
|
|
||||||
Disable URL patch importing in-game
|
|
||||||
UI tweaks for importing patches
|
|
||||||
|
|
||||||
05/05/2024 [spice2x]
|
|
||||||
UI tweaks for importing patches
|
|
||||||
Add aliases for arguments with -sp2x prefix
|
|
||||||
|
|
||||||
05/04/2024 [spice2x]
|
|
||||||
New patch JSON format, importing patches from URL
|
|
||||||
Add Process Efficiency Class option for hetero CPUs
|
|
||||||
|
|
||||||
04/29/2024 [spice2x]
|
|
||||||
Move -vr to be DANCERUSH only option
|
|
||||||
Fix being unable to type into overlay when -nolegacy is on
|
|
||||||
|
|
||||||
04/08/2024 [spice2x]
|
|
||||||
Fix Discord rich presence app IDs
|
|
||||||
|
|
||||||
03/31/2024 [spice2x]
|
|
||||||
Fix IC CARD UNIT ERROR in UFC when COM ports are present
|
|
||||||
|
|
||||||
03/24/2024 [spice2x]
|
|
||||||
Fix Ongaku Paradise crash on boot due to VFS redirection
|
|
||||||
Address all compiler warnings
|
|
||||||
|
|
||||||
03/17/2024 [spice2x]
|
|
||||||
SMX pad lights output
|
|
||||||
Fix DDR pad input for P4IO / BIO2
|
|
||||||
Option aliases for IIDX/SDVX subscreen disable
|
|
||||||
|
|
||||||
03/16/2024 [spice2x]
|
|
||||||
I/O for DDR white cabinet type (P4IO)
|
|
||||||
Remove background animation from configurator
|
|
||||||
Compiler updates
|
|
||||||
|
|
||||||
03/06/2024 [spice2x]
|
|
||||||
Lights output for DDR gold cabinet type
|
|
||||||
|
|
||||||
02/13/2024 [spice2x]
|
|
||||||
Fix lights not updating over API in configurator
|
|
||||||
CCJ mouse trackball improvements
|
|
||||||
Make IIDX/SDVX native touch the default when -sp2x-nod3d9devhook is on
|
|
||||||
Remove log spam in IIDX
|
|
||||||
|
|
||||||
02/02/2024 [spice2x]
|
|
||||||
Add missing NVCUDA stubs for cuStreamCreate and cuStreamDestroy_v2
|
|
||||||
|
|
||||||
02/01/2024 [spice2x]
|
|
||||||
QuizKnock STADIUM support
|
|
||||||
Busou Shinki analog joystick support
|
|
||||||
|
|
||||||
01/30/2024 [spice2x]
|
|
||||||
Add woofer lights to popn HD mode
|
|
||||||
Prevent crash when both -graphics-force-single-adapter and
|
|
||||||
-sp2x-nod3d9devhook are enabled
|
|
||||||
|
|
||||||
01/27/2024 [spice2x]
|
|
||||||
Add Disable D3D9 Device Hook option (-sp2x-nod3d9devhook)
|
|
||||||
|
|
||||||
01/20/2024 [spice2x]
|
|
||||||
Force Exit overlay hotkey
|
|
||||||
Improve Low Latency Audio to work with more games
|
|
||||||
Charge Machine I/O fixes
|
|
||||||
UI tweaks (API tab, Development tab)
|
|
||||||
|
|
||||||
01/07/2024 [spice2x]
|
|
||||||
Chase Chase Jokers improvements (trackball and vsync fix)
|
|
||||||
|
|
||||||
01/06/2024 [spice2x]
|
|
||||||
Chase Chase Jokers improvements (cmd line args, trackball sensitivity)
|
|
||||||
|
|
||||||
01/05/2024 [spice2x]
|
|
||||||
Chase Chase Jokers support
|
|
||||||
|
|
||||||
01/01/2024 [spice2x]
|
|
||||||
UI tweaks - menu bar in configurator window
|
|
||||||
IIDX: scan for SOUND_OUTPUT_DEVICE in binary and log message
|
|
||||||
Switch from -Ofast to -O2
|
|
||||||
Remove ImGui demo and debug files from release (reduced binary size)
|
|
||||||
|
|
||||||
12/30/2023 [spice2x]
|
|
||||||
Add NVAPI Block option (-sp2x-nonvapi)
|
|
||||||
SDVX: Auto Card Insert disables itself after a timeout to prevent soft lock
|
|
||||||
|
|
||||||
12/27/2023 [spice2x]
|
|
||||||
Prevent SDVX from dumping PATH variable to log
|
|
||||||
Stubs for NVIDIA DLLs (nvcuda.dll, nvcuvid.dll, nvEncodeAPI64.dll)
|
|
||||||
UI tweaks
|
|
||||||
|
|
||||||
12/25/2023 [spice2x]
|
|
||||||
Fix Lock Cursor option not updating capture area in windowed mode
|
|
||||||
Update TDJ rom file hooks
|
|
||||||
|
|
||||||
12/23/2023 [spice2x]
|
|
||||||
Remove the need for hex edits to fix note scroll speed in SDVX VM on NVIDIA
|
|
||||||
Improvements to -graphics-force-refresh
|
|
||||||
|
|
||||||
12/22/2023 [spice2x]
|
|
||||||
HID analog relative axis mode
|
|
||||||
Automatic process affinity fix for Gitadora
|
|
||||||
Fix -cfgpath option not working
|
|
||||||
Buttons tab UI fix for Bind Many
|
|
||||||
|
|
||||||
12/18/2023 [spice2x]
|
|
||||||
Fix Road Fighters 3D I/O error on boot
|
|
||||||
|
|
||||||
12/17/2023 [spice2x]
|
|
||||||
Integer multiplier / divisor for HID analog
|
|
||||||
(alternative to existing sensitivity option)
|
|
||||||
|
|
||||||
12/15/2023 [spice2x]
|
|
||||||
Add hooks to prevent display scaling changes when SDVX launches
|
|
||||||
|
|
||||||
12/12/2023 [spice2x]
|
|
||||||
Add support for keypad in SDVX UFC/VM mode
|
|
||||||
New DX9on12 flag with more options (-sp2x-dx9on12, replaces -9on12)
|
|
||||||
|
|
||||||
12/11/2023 [spice2x]
|
|
||||||
Fix crash at launch on AMD/Intel GPUs when nvapi DLL is present
|
|
||||||
|
|
||||||
12/09/2023 [spice2x]
|
|
||||||
Lights output for Gitadora
|
|
||||||
Lights output for DRS
|
|
||||||
Tape LED averaging algorithm option (-sp2x-tapeledalgo)
|
|
||||||
Fix occasional crash on shutdown
|
|
||||||
|
|
||||||
11/23/2023 [spice2x]
|
|
||||||
Low latency shared audio option (-sp2x-lowlatencysharedaudio)
|
|
||||||
Automatic dev/raw/* folder creation for popn19-21
|
|
||||||
Move overlay bindings to Overlay tab
|
|
||||||
|
|
||||||
11/17/2023 [spice2x]
|
|
||||||
Use E00401 prefix for card number generation
|
|
||||||
Volume API hooks to prevent audio volume change (enabled by default)
|
|
||||||
Small UI tweaks
|
|
||||||
|
|
||||||
11/15/2023 [spice2x]
|
|
||||||
Automatic card insert option (-sp2x-autocard)
|
|
||||||
Dump CPU features to log on startup
|
|
||||||
|
|
||||||
11/12/2023 [spice2x]
|
|
||||||
Fix crash in some games caused by linker changes in 2022
|
|
||||||
(Gitadora Exchain and older, Bone Eater, etc)
|
|
||||||
Add IIDX native touch option (-sp2x-iidxnativetouch)
|
|
||||||
Fix V-Sync issues with auto-screen-orientation
|
|
||||||
|
|
||||||
11/04/2023 [spice2x]
|
|
||||||
Option for NVIDIA GPU optimization (-sp2x-nvprofile)
|
|
||||||
SmartCard fixes (for -scardflip and -scardtoggle)
|
|
||||||
Small reorganization of options in configurator
|
|
||||||
|
|
||||||
10/30/2023 [spice2x]
|
|
||||||
Add touch input support for DRS
|
|
||||||
Add TDJ Windowed mode for IIDX (-sp2x-iidxtdjw)
|
|
||||||
Fix -iidxasio not working in some versions of IIDX
|
|
||||||
|
|
||||||
10/22/2023 [spice2x]
|
|
||||||
Add E-spec I/O emulation for IIDX 30+
|
|
||||||
Fix IIDX TDJ launching at 60Hz for some users
|
|
||||||
Add workaround for buggy ASIO drivers that lock up on close
|
|
||||||
Hide Insert Card overlay by default, add option to show it again
|
|
||||||
|
|
||||||
09/29/2023 [spice2x]
|
|
||||||
Fix subscreen not updating in certain versions of EG.
|
|
||||||
Detect long paths and log a warning message.
|
|
||||||
|
|
||||||
06/08/2023 [spice2x]
|
|
||||||
Improved touch support for Jubeat and Reflec Beat.
|
|
||||||
|
|
||||||
04/23/2023 [spice2x]
|
|
||||||
Update -iidxsounddevice to automatically pick a value (wasapi in most cases)
|
|
||||||
|
|
||||||
04/21/2023 [spice2x]
|
|
||||||
Fix spicecfg not launching in some specific cases
|
|
||||||
|
|
||||||
04/20/2023 [spice2x]
|
|
||||||
Update font for IIDX segment display
|
|
||||||
New option: auto show FPS window
|
|
||||||
|
|
||||||
04/16/2023 [spice2x]
|
|
||||||
New feature: window resize. Added new options to change window size and
|
|
||||||
position on launch. Screen Resize window (F11) also updated with new
|
|
||||||
controls
|
|
||||||
Screen Resize settings are now per-game
|
|
||||||
Misc bug fixes
|
|
||||||
|
|
||||||
04/09/2023 [spice2x]
|
|
||||||
Add IIDX LED ticker (segment display) as subscreen overlay for LDJ
|
|
||||||
Add I/O panel window for all games, special support for IIDX, DDR, GFDM
|
|
||||||
Add options to automatically show certain windows on game launch
|
|
||||||
|
|
||||||
04/03/2023 [spice2x]
|
|
||||||
Move/resize for IIDX/SDVX subscreen overlay window
|
|
||||||
New options to control subscreen overlay window
|
|
||||||
Turn common config mistakes into fatal error messages
|
|
||||||
Various bug fixes for touch handling
|
|
||||||
Revert "pop'n launching at desktop refresh rate" hack from 03/30/2023
|
|
||||||
|
|
||||||
03/30/2023 [spice2x]
|
|
||||||
New option: IIDX Force Definition Type HD (720p)
|
|
||||||
New option: process priority
|
|
||||||
Fix pop'n launching at desktop refresh rate
|
|
||||||
Lower logger thread priority to reduce stutters
|
|
||||||
Misc bug fixes
|
|
||||||
|
|
||||||
03/25/2023 [spice2x]
|
|
||||||
Screen Resize UI update (F11)
|
|
||||||
FPS UI update (F12)
|
|
||||||
New option: processor affinity
|
|
||||||
Misc bug fixes
|
|
||||||
|
|
||||||
03/20/2023 [spice2x]
|
|
||||||
ASIO device override for SDVX (experimental)
|
|
||||||
Fix subscreen overlay for SDVX in Valkyrie mode using BI2X I/O
|
|
||||||
Update text for touch and audio config options
|
|
||||||
UI tweaks and minor bug fixes
|
|
||||||
|
|
||||||
03/17/2023 [spice2x]
|
|
||||||
Disable UPX (file sizes will be larger)
|
|
||||||
Fix regression from 2022 that prevented early patches
|
|
||||||
from being loaded properly (such as audio hex edits)
|
|
||||||
New option: HID lighting brightness
|
|
||||||
New option: display auto-rotate direction
|
|
||||||
New option: custom sleep duration
|
|
||||||
|
|
||||||
03/15/2023 [spice2x]
|
|
||||||
Improve IIDX TT+/- handling (allow alternate key bind)
|
|
||||||
Fix SpiceCompanion touch targets for TDJ FHD
|
|
||||||
Config UI tweaks
|
|
||||||
|
|
||||||
03/13/2023 [spice2x]
|
|
||||||
Fix TDJ FHD launching at wrong refresh rate
|
|
||||||
New IIDX/SDVX options for TT/knob sensitivity when using digital input
|
|
||||||
|
|
||||||
03/12/2023 [spice2x]
|
|
||||||
Fix mouse input for SDVX EG subscreen overlay
|
|
||||||
New unified layout for Options tab
|
|
||||||
Allow multiple DLLs in Inject Hook field
|
|
||||||
|
|
||||||
03/11/2023 [spice2x]
|
|
||||||
Beginning of spice2x fork, based on another fork
|
|
||||||
Ensure TDJ mode runs at 1080p@120Hz for newer games
|
|
||||||
Fix IIDX subscreen overlay in FHD mode
|
|
||||||
Gracefully deal with bad ea3-config.xml
|
|
||||||
|
|
||||||
04/02/2022 - Add lua scripting
|
|
||||||
Add button edit dialog
|
|
||||||
Add button debounce/invert settings
|
|
||||||
Add bind many function
|
|
||||||
Misc bug fixes
|
|
||||||
12/28/2021 - Add DirectX 9On12 wrapper option
|
|
||||||
Add analog deadzone settings
|
|
||||||
Fix SSL handshaking failed issue
|
|
||||||
Misc bug fixes
|
|
||||||
12/19/2021 - Force single graphics adapter option
|
|
||||||
Performance improvements
|
|
||||||
Misc bug fixes
|
|
||||||
10/12/2021 - Ongaku Paradise support
|
|
||||||
Fixed memory leak in Windows 8+ touch handler
|
|
||||||
Fix Gitadora two channel fix for Nextage
|
|
||||||
Fix Charge Machine touch window position
|
|
||||||
IIDX 19 support
|
|
||||||
04/02/2021 - Charge Machine support
|
|
||||||
Fix "unsupported fs type" endless loop
|
|
||||||
Misc bug fixes
|
|
||||||
03/01/2021 - Add DDR HD speaker lights
|
|
||||||
Automatic /dev/nvram and /dev/raw creation for AVS 2.17 and later
|
|
||||||
Fix FlexASIO crash introduced in previous release
|
|
||||||
Fix overlay crash from ImGui navigation button handling
|
|
||||||
Fix AVS configuration reading with binary files
|
|
||||||
Add AVS VFS drive remapping for E: and F:
|
|
||||||
Improve XP compatibility
|
|
||||||
Force dummy audio when using ASIO backend
|
|
||||||
Misc bug fixes
|
|
||||||
12/30/2020 - Metal Gear Arcade lights and fixes
|
|
||||||
Misc bug fixes
|
|
||||||
12/11/2020 - Fix patch manager crashing on invalid address
|
|
||||||
Automatic /dev/nvram and /dev/raw creation for AVS 2.16 and prior
|
|
||||||
Analog sensitivity improvements
|
|
||||||
Locale improvements
|
|
||||||
Misc bug fixes
|
|
||||||
10/27/2020 - Screen Capture support
|
|
||||||
IIDX TDJ support
|
|
||||||
Updated patches
|
|
||||||
Misc bug fixes
|
|
||||||
10/13/2020 - Configurator patches tab
|
|
||||||
KFControl fix cursor wrap
|
|
||||||
Screen resize window
|
|
||||||
Misc bug fixes
|
|
||||||
10/03/2020 - Add KFControl
|
|
||||||
Misc bug fixes
|
|
||||||
09/27/2020 - Reflec limelight & colette (LBR) support
|
|
||||||
LovePlus lights support
|
|
||||||
Fix module loading when spice(64).exe is outside contents
|
|
||||||
Ignore touchpad HID devices in touchscreen detection
|
|
||||||
Keypad bindings
|
|
||||||
SSL support
|
|
||||||
Analog knob preview
|
|
||||||
06/15/2020 - QMA physical keyboard support
|
|
||||||
Misc bug fixes
|
|
||||||
05/19/2020 - Alternate audio backends for exclusive-mode applications
|
|
||||||
Fix screenshot handler crash in KMA and LMA
|
|
||||||
MessageBox hooks (stops fullscreen windows from losing focus)
|
|
||||||
04/25/2020 - pop'n music 19 & 20 support
|
|
||||||
DDR X2 support
|
|
||||||
pop'n & HPM HDMI fix
|
|
||||||
Misc additions, fixes
|
|
||||||
03/13/2020 - Misc bug fixes and improvements
|
|
||||||
03/10/2020 - Winning Eleven support
|
|
||||||
03/04/2020 - Tenkaichi Shogikai support
|
|
||||||
Otoca D'or support
|
|
||||||
Misc bug fixes
|
|
||||||
02/29/2020 - MIDI hotplugging / overlay
|
|
||||||
Misc bug fixes
|
|
||||||
02/04/2020 - Configurator options tab
|
|
||||||
Overlay button bindings
|
|
||||||
Card generator
|
|
||||||
Misc bug fixes
|
|
||||||
01/22/2020 - Audio improvements
|
|
||||||
SDVX print overwrite option
|
|
||||||
PNM HD/SD options
|
|
||||||
Window icons
|
|
||||||
Misc improvements
|
|
||||||
01/11/2020 - New Config Utility (F4)
|
|
||||||
Audio Hooks
|
|
||||||
Misc bug fixes
|
|
||||||
01/03/2020 - DANCERUSH STARDOM support
|
|
||||||
Chinese SDVX support
|
|
||||||
Nostalgia OP2 support
|
|
||||||
LayeredFS now complete
|
|
||||||
Misc bug fixes
|
|
||||||
11/26/2019 - LayeredFS integration
|
|
||||||
Misc bug fixes
|
|
||||||
11/17/2019 - Screenshots (PrtScr Key)
|
|
||||||
DLL Architecture detection
|
|
||||||
SCard Felica support
|
|
||||||
Improve MIDI performance
|
|
||||||
Fix bt5api error handling
|
|
||||||
Fix XP support
|
|
||||||
11/05/2019 - Gitadora XG3 support
|
|
||||||
Guitar motor support
|
|
||||||
Gitadora cabinet setting
|
|
||||||
DDR HD->SD light support
|
|
||||||
ESP8266/NodeMCU API support
|
|
||||||
Misc bug fixes
|
|
||||||
10/13/2019 - Serial API support
|
|
||||||
Fullscreen monitor setting
|
|
||||||
Misc bug fixes
|
|
||||||
09/30/2019 - Fixed verbose D3D9 logging
|
|
||||||
MiniMaid support
|
|
||||||
EA-Dev functions
|
|
||||||
Metal Gear bug fixes
|
|
||||||
09/26/2019 - Steel Chronicle support
|
|
||||||
ACIO buffer view/editor
|
|
||||||
Misc bug fixes
|
|
||||||
09/21/2019 - IIDX Effector View
|
|
||||||
Performance improvements
|
|
||||||
PCBID now hidden in log file
|
|
||||||
Misc bug fixes
|
|
||||||
09/16/2019 - Introducing SpiceOverlay
|
|
||||||
- Virtual Keypads/Cards
|
|
||||||
- Patch Manager
|
|
||||||
- FPS/Log/Control Windows
|
|
||||||
Pop'n Music fancy window mode
|
|
||||||
Optional app-config.xml
|
|
||||||
Misc improvements
|
|
||||||
Misc bug fixes
|
|
||||||
09/09/2019 - DDR BIO2 support
|
|
||||||
NVIDIA Optimus support
|
|
||||||
Reflec Beat faster loading
|
|
||||||
Performance improvements
|
|
||||||
Misc bug fixes
|
|
||||||
08/24/2019 - Automatic G-Sync disable
|
|
||||||
Fixed Scotto inverted keypad
|
|
||||||
Fixed SDVX Gen1 input drops
|
|
||||||
Performance improvements
|
|
||||||
08/19/2019 - Scotto support
|
|
||||||
Mahjong Fight Club support
|
|
||||||
FutureTomTom Kinect fix
|
|
||||||
Fixed AVS heap size defaults
|
|
||||||
Fixed signal hook crash
|
|
||||||
Fixed early boot logging
|
|
||||||
08/14/2019 - HELLO! Pop'n Music lights
|
|
||||||
Improve performance
|
|
||||||
08/13/2019 - Add -cfgpath option
|
|
||||||
Misc additions/fixes
|
|
||||||
08/10/2019 - HELLO! Pop'n Music support
|
|
||||||
LovePlus support
|
|
||||||
Discord Rich Presence support
|
|
||||||
API shutdown/reboot
|
|
||||||
Add -nolegacy option
|
|
||||||
Colored logging
|
|
||||||
07/31/2019 - QMA windowed mode fix
|
|
||||||
QMA network check fix
|
|
||||||
Logging improvements
|
|
||||||
07/22/2019 - DDR SD mode reader fix
|
|
||||||
Misc bugs fixed with ACIO
|
|
||||||
Beatstream lights/mouse
|
|
||||||
Beatstream -ea support
|
|
||||||
07/19/2019 - FutureTomTom support
|
|
||||||
Reflec Beat lights
|
|
||||||
Dance Evolution lights
|
|
||||||
Nostalgia lights
|
|
||||||
SuperExit on ALT-F4
|
|
||||||
07/16/2019 - Hook DLLs load earlier
|
|
||||||
Heap size argument alias
|
|
||||||
API restart function
|
|
||||||
SmartEA cmd line option
|
|
||||||
Reader keypad support
|
|
||||||
Initial MFC support
|
|
||||||
Misc bug fixes
|
|
||||||
06/22/2019 - Touchpad button binding fix
|
|
||||||
MIDI buttons/analogs support
|
|
||||||
Misc bug fixes
|
|
||||||
05/18/2019 - API WebSocket support
|
|
||||||
05/16/2019 - Device Hotplugging
|
|
||||||
USB-Stick card inserts
|
|
||||||
Cursor capture fix
|
|
||||||
EA server fix for old AVS
|
|
||||||
05/07/2019 - Reflec 1 support
|
|
||||||
Gitadora custom PCBID
|
|
||||||
Touchscreen improvements
|
|
||||||
Touchscreen support on XP
|
|
||||||
Higher RB input polling rate
|
|
||||||
L/R-Shift/Control support
|
|
||||||
04/13/2019 - DDR SD Mode lights
|
|
||||||
Sextet (LIT Board) support
|
|
||||||
PIUIO hardware support
|
|
||||||
Windowed mode improvements
|
|
||||||
03/14/2019 - IIDX API module
|
|
||||||
EA server maintenance toggle
|
|
||||||
SDVX BI2A support
|
|
||||||
02/19/2019 - Network API server
|
|
||||||
Run outside of modules dir
|
|
||||||
Misc bug fixes
|
|
||||||
01/27/2019 - Jubeat Knit support
|
|
||||||
Quiz Magic Academy support
|
|
||||||
Museca/Jubeat lights
|
|
||||||
Smartcard NumLock toggle
|
|
||||||
01/11/2019 - Open Source!
|
|
||||||
Jubeat Copious support
|
|
||||||
Bishi Bashi Channel support
|
|
||||||
PacDrive/PocketVoltex support
|
|
||||||
KBT/KLD now are optional
|
|
||||||
Stacktraces, quiet crash
|
|
||||||
Huge code refactoring
|
|
||||||
Stability improvements/fixes
|
|
||||||
11/03/2018 - IIDX 25 (io, cams, light)
|
|
||||||
IIDX effector bindings
|
|
||||||
HID lighting output support
|
|
||||||
Button Multibinding
|
|
||||||
HID readers e.g. zyp's cardio
|
|
||||||
Bug fixes as usual
|
|
||||||
08/17/2018 - DDR X3, Nostalgia, Network
|
|
||||||
06/25/2018 - HID smartcard readers
|
|
||||||
06/10/2018 - DDR support
|
|
||||||
06/07/2018 - Gitadora/HID/EA bug fixes
|
|
||||||
05/18/2018 - Gitadora and MIDI devices
|
|
||||||
05/07/2018 - Support for hat switches
|
|
||||||
04/21/2018 - Card path configuration
|
|
||||||
04/09/2018 - HID/Analog/RawInput support
|
|
||||||
03/13/2018 - SDVX printer, felica, BT5API
|
|
||||||
01/23/2018 - MUSECA analog slowdown, fixes
|
|
||||||
01/21/2018 - Many fixed bugs/crashes
|
|
||||||
11/15/2017 - Fixed the MUSECA sound issue
|
|
||||||
11/14/2017 - Added MUSECA, Pop'n Music
|
|
||||||
Wavepass reader support
|
|
||||||
09/11/2017 - Added Road Fighters 3D
|
|
||||||
08/29/2017 - Custom modules path,
|
|
||||||
UAC admin manifest, netfix
|
|
||||||
08/28/2017 - Bug fixes
|
|
||||||
08/21/2017 - 64bit builds, beatstream
|
|
||||||
More command line options
|
|
||||||
07/28/2017 - Fixed I/O for IIDX and SDVX
|
|
||||||
07/26/2017 - Configuration Tool, Jubeat
|
|
||||||
Touch module, more options
|
|
||||||
06/01/2017 - Added DEA support
|
|
||||||
05/31/2017 - Public release
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required (VERSION 3.2.0)
|
cmake_minimum_required (VERSION 3.12)
|
||||||
project (DiscordRPC)
|
project (DiscordRPC)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|||||||
+6
-14
@@ -1,25 +1,17 @@
|
|||||||
FROM archlinux:base
|
FROM ghcr.io/archlinux/archlinux:base-devel
|
||||||
|
|
||||||
RUN pacman --noconfirm -Syu gettext \
|
RUN pacman --noconfirm -Syu git \
|
||||||
base-devel \
|
|
||||||
git \
|
|
||||||
bash \
|
bash \
|
||||||
zip \
|
zip \
|
||||||
upx \
|
upx \
|
||||||
sudo \
|
ninja \
|
||||||
binutils \
|
|
||||||
file \
|
|
||||||
make \
|
|
||||||
gcc \
|
|
||||||
fakeroot \
|
|
||||||
diffutils \
|
|
||||||
cmake \
|
cmake \
|
||||||
awk \
|
|
||||||
unzip \
|
unzip \
|
||||||
mingw-w64-crt \
|
mingw-w64-crt \
|
||||||
mingw-w64-winpthreads \
|
mingw-w64-winpthreads \
|
||||||
mingw-w64-gcc \
|
mingw-w64-gcc \
|
||||||
mingw-w64-headers \
|
mingw-w64-headers \
|
||||||
mingw-w64-binutils
|
mingw-w64-binutils \
|
||||||
|
ccache
|
||||||
RUN useradd user -m && echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
RUN useradd user -m && echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
RUN su user -c "cd /tmp/ && git clone https://aur.archlinux.org/yay.git --depth=1 && cd yay && makepkg --noconfirm -si && yay --noconfirm -S mingw-w64-cmake"
|
RUN su user -c "cd /tmp/ && git clone https://aur.archlinux.org/yay-bin.git --depth=1 && cd yay-bin && makepkg --noconfirm -si && yay --noconfirm -S mingw-w64-cmake"
|
||||||
|
|||||||
+4
@@ -1527,8 +1527,10 @@ FMT_CONSTEXPR auto make_arg(const T& value) -> basic_format_arg<Context> {
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdangling-reference"
|
#pragma GCC diagnostic ignored "-Wdangling-reference"
|
||||||
|
#endif
|
||||||
|
|
||||||
// The type template parameter is there to avoid an ODR violation when using
|
// The type template parameter is there to avoid an ODR violation when using
|
||||||
// a fallback formatter in one translation unit and an implicit conversion in
|
// a fallback formatter in one translation unit and an implicit conversion in
|
||||||
@@ -1544,7 +1546,9 @@ FMT_CONSTEXPR FMT_INLINE auto make_arg(const T& val) -> value<Context> {
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
template <bool IS_PACKED, typename Context, type, typename T,
|
template <bool IS_PACKED, typename Context, type, typename T,
|
||||||
FMT_ENABLE_IF(!IS_PACKED)>
|
FMT_ENABLE_IF(!IS_PACKED)>
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
project(imgui CXX)
|
project(imgui CXX)
|
||||||
|
|
||||||
set(HASH_LIBRARY_HEADERS
|
set(HASH_LIBRARY_HEADERS
|
||||||
|
|||||||
+5
-3
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
project(imgui CXX)
|
project(imgui CXX)
|
||||||
|
|
||||||
# dear imgui uses the C++ virtual interfaces for DirectX
|
# dear imgui uses the C++ virtual interfaces for DirectX
|
||||||
@@ -8,7 +8,8 @@ set(IMGUI_HEADERS
|
|||||||
imconfig.h
|
imconfig.h
|
||||||
imgui.h
|
imgui.h
|
||||||
imgui_internal.h
|
imgui_internal.h
|
||||||
imgui_stdlib.h
|
backends/imgui_impl_dx9.h
|
||||||
|
misc/cpp/imgui_stdlib.h
|
||||||
)
|
)
|
||||||
set(IMGUI_SOURCES
|
set(IMGUI_SOURCES
|
||||||
imgui.cpp
|
imgui.cpp
|
||||||
@@ -16,7 +17,8 @@ set(IMGUI_SOURCES
|
|||||||
imgui_tables.cpp
|
imgui_tables.cpp
|
||||||
imgui_widgets.cpp
|
imgui_widgets.cpp
|
||||||
imgui_demo.cpp
|
imgui_demo.cpp
|
||||||
imgui_stdlib.cpp
|
backends/imgui_impl_dx9.cpp
|
||||||
|
misc/cpp/imgui_stdlib.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(imgui STATIC ${IMGUI_HEADERS} ${IMGUI_SOURCES})
|
add_library(imgui STATIC ${IMGUI_HEADERS} ${IMGUI_SOURCES})
|
||||||
|
|||||||
Vendored
+3
-3
@@ -22,14 +22,14 @@
|
|||||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself.
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||||
|
|
||||||
#include "impl_dx9.h"
|
#include "imgui_impl_dx9.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// DirectX
|
// DirectX
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
|
||||||
#include "external/imgui/imgui.h"
|
#include "imgui.h"
|
||||||
|
|
||||||
// allow std::min use
|
// allow std::min use
|
||||||
#ifdef min
|
#ifdef min
|
||||||
@@ -327,7 +327,7 @@ void ImGui_ImplDX9_InvalidateDeviceObjects() {
|
|||||||
if (g_FontTexture) {
|
if (g_FontTexture) {
|
||||||
g_FontTexture->Release();
|
g_FontTexture->Release();
|
||||||
g_FontTexture = NULL;
|
g_FontTexture = NULL;
|
||||||
ImGui::GetIO().Fonts->TexID = NULL;
|
ImGui::GetIO().Fonts->TexID = 0;
|
||||||
} // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
} // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||||
}
|
}
|
||||||
|
|
||||||
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "external/imgui/imgui.h"
|
#include "imgui.h"
|
||||||
|
|
||||||
struct IDirect3DDevice9;
|
struct IDirect3DDevice9;
|
||||||
|
|
||||||
+33
-16
@@ -1,5 +1,5 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
|
// DEAR IMGUI COMPILE-TIME OPTIONS
|
||||||
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
||||||
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
|
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
|
||||||
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
|
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
|
||||||
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
||||||
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
// Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -21,27 +21,29 @@
|
|||||||
|
|
||||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
||||||
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
||||||
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
// - Windows DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
||||||
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
||||||
//#define IMGUI_API __declspec( dllexport )
|
//#define IMGUI_API __declspec(dllexport) // MSVC Windows: DLL export
|
||||||
//#define IMGUI_API __declspec( dllimport )
|
//#define IMGUI_API __declspec(dllimport) // MSVC Windows: DLL import
|
||||||
|
//#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden
|
||||||
|
|
||||||
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
|
||||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
|
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87+ disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This is automatically done by IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
|
||||||
|
|
||||||
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
|
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
|
||||||
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
||||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
||||||
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88).
|
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
|
||||||
|
|
||||||
//---- Don't implement some functions to reduce linkage requirements.
|
//---- Don't implement some functions to reduce linkage requirements.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||||
#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
|
#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
|
||||||
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
|
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
|
||||||
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
|
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
|
||||||
|
//#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS // Don't implement default platform_io.Platform_OpenInShellFn() handler (Win32: ShellExecute(), require shell32.lib/.a, Mac/Linux: use system("")).
|
||||||
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
|
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
|
||||||
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
|
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
|
||||||
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
|
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
|
||||||
@@ -49,8 +51,13 @@
|
|||||||
#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
||||||
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
|
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
|
||||||
|
|
||||||
|
//---- Enable Test Engine / Automation features.
|
||||||
|
//#define IMGUI_ENABLE_TEST_ENGINE // Enable imgui_test_engine hooks. Generally set automatically by include "imgui_te_config.h", see Test Engine for details.
|
||||||
|
|
||||||
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
||||||
|
// May be convenient for some users to only explicitly include vanilla imgui.h and have extra stuff included.
|
||||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||||
|
//#define IMGUI_USER_H_FILENAME "my_folder/my_imgui_user.h"
|
||||||
|
|
||||||
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
|
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
|
||||||
#define IMGUI_USE_BGRA_PACKED_COLOR
|
#define IMGUI_USE_BGRA_PACKED_COLOR
|
||||||
@@ -58,16 +65,17 @@
|
|||||||
//---- Performance optimization for DX9
|
//---- Performance optimization for DX9
|
||||||
#define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
|
#define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
|
||||||
|
|
||||||
//---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
//---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
||||||
//#define IMGUI_USE_WCHAR32
|
//#define IMGUI_USE_WCHAR32
|
||||||
|
|
||||||
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||||
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
|
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
|
||||||
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||||
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||||
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled
|
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
|
||||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||||
|
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.
|
||||||
|
|
||||||
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
|
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
|
||||||
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
|
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
|
||||||
@@ -78,6 +86,15 @@
|
|||||||
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
|
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
|
||||||
//#define IMGUI_ENABLE_FREETYPE
|
//#define IMGUI_ENABLE_FREETYPE
|
||||||
|
|
||||||
|
//---- Use FreeType + plutosvg or lunasvg to render OpenType SVG fonts (SVGinOT)
|
||||||
|
// Only works in combination with IMGUI_ENABLE_FREETYPE.
|
||||||
|
// - lunasvg is currently easier to acquire/install, as e.g. it is part of vcpkg.
|
||||||
|
// - plutosvg will support more fonts and may load them faster. It currently requires to be built manually but it is fairly easy. See misc/freetype/README for instructions.
|
||||||
|
// - Both require headers to be available in the include path + program to be linked with the library code (not provided).
|
||||||
|
// - (note: lunasvg implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
|
||||||
|
//#define IMGUI_ENABLE_FREETYPE_PLUTOSVG
|
||||||
|
//#define IMGUI_ENABLE_FREETYPE_LUNASVG
|
||||||
|
|
||||||
//---- Use stb_truetype to build and rasterize the font atlas (default)
|
//---- Use stb_truetype to build and rasterize the font atlas (default)
|
||||||
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
|
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
|
||||||
//#define IMGUI_ENABLE_STB_TRUETYPE
|
//#define IMGUI_ENABLE_STB_TRUETYPE
|
||||||
@@ -108,7 +125,7 @@
|
|||||||
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
||||||
//#define ImDrawCallback MyImDrawCallback
|
//#define ImDrawCallback MyImDrawCallback
|
||||||
|
|
||||||
//---- Debug Tools: Macro to break in Debugger
|
//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
|
||||||
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
|
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
|
||||||
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
||||||
//#define IM_DEBUG_BREAK __debugbreak()
|
//#define IM_DEBUG_BREAK __debugbreak()
|
||||||
@@ -116,10 +133,10 @@
|
|||||||
//---- Debug Tools: Enable slower asserts
|
//---- Debug Tools: Enable slower asserts
|
||||||
//#define IMGUI_DEBUG_PARANOID
|
//#define IMGUI_DEBUG_PARANOID
|
||||||
|
|
||||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
|
||||||
/*
|
/*
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
void MyFunction(const char* name, const MyMatrix44& v);
|
void MyFunction(const char* name, MyMatrix44* mtx);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+4651
-2301
File diff suppressed because it is too large
Load Diff
Vendored
+1497
-902
File diff suppressed because it is too large
Load Diff
+3015
-663
File diff suppressed because it is too large
Load Diff
+621
-129
File diff suppressed because it is too large
Load Diff
+938
-658
File diff suppressed because it is too large
Load Diff
+584
-235
File diff suppressed because it is too large
Load Diff
+2536
-870
File diff suppressed because it is too large
Load Diff
+139
-107
@@ -2,8 +2,11 @@
|
|||||||
// This is a slightly modified version of stb_textedit.h 1.14.
|
// This is a slightly modified version of stb_textedit.h 1.14.
|
||||||
// Those changes would need to be pushed into nothings/stb:
|
// Those changes would need to be pushed into nothings/stb:
|
||||||
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
|
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
|
||||||
// - Fix in stb_textedit_find_charpos to handle last line (see https://github.com/ocornut/imgui/issues/6000)
|
// - Fix in stb_textedit_find_charpos to handle last line (see https://github.com/ocornut/imgui/issues/6000 + #6783)
|
||||||
|
// - Added name to struct or it may be forward declared in our code.
|
||||||
|
// - Added UTF-8 support (see https://github.com/nothings/stb/issues/188 + https://github.com/ocornut/imgui/pull/7925)
|
||||||
// Grep for [DEAR IMGUI] to find the changes.
|
// Grep for [DEAR IMGUI] to find the changes.
|
||||||
|
// - Also renamed macros used or defined outside of IMSTB_TEXTEDIT_IMPLEMENTATION block from STB_TEXTEDIT_* to IMSTB_TEXTEDIT_*
|
||||||
|
|
||||||
// stb_textedit.h - v1.14 - public domain - Sean Barrett
|
// stb_textedit.h - v1.14 - public domain - Sean Barrett
|
||||||
// Development of this library was sponsored by RAD Game Tools
|
// Development of this library was sponsored by RAD Game Tools
|
||||||
@@ -30,7 +33,7 @@
|
|||||||
// DEPENDENCIES
|
// DEPENDENCIES
|
||||||
//
|
//
|
||||||
// Uses the C runtime function 'memmove', which you can override
|
// Uses the C runtime function 'memmove', which you can override
|
||||||
// by defining STB_TEXTEDIT_memmove before the implementation.
|
// by defining IMSTB_TEXTEDIT_memmove before the implementation.
|
||||||
// Uses no other functions. Performs no runtime allocations.
|
// Uses no other functions. Performs no runtime allocations.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -40,7 +43,7 @@
|
|||||||
// 1.13 (2019-02-07) fix bug in undo size management
|
// 1.13 (2019-02-07) fix bug in undo size management
|
||||||
// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash
|
// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash
|
||||||
// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield
|
// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield
|
||||||
// 1.10 (2016-10-25) supress warnings about casting away const with -Wcast-qual
|
// 1.10 (2016-10-25) suppress warnings about casting away const with -Wcast-qual
|
||||||
// 1.9 (2016-08-27) customizable move-by-word
|
// 1.9 (2016-08-27) customizable move-by-word
|
||||||
// 1.8 (2016-04-02) better keyboard handling when mouse button is down
|
// 1.8 (2016-04-02) better keyboard handling when mouse button is down
|
||||||
// 1.7 (2015-09-13) change y range handling in case baseline is non-0
|
// 1.7 (2015-09-13) change y range handling in case baseline is non-0
|
||||||
@@ -208,6 +211,7 @@
|
|||||||
// int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
// int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
// int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)
|
// int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)
|
||||||
// void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXEDIT_KEYTYPE key)
|
// void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXEDIT_KEYTYPE key)
|
||||||
|
// void stb_textedit_text(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int text_len)
|
||||||
//
|
//
|
||||||
// Each of these functions potentially updates the string and updates the
|
// Each of these functions potentially updates the string and updates the
|
||||||
// state.
|
// state.
|
||||||
@@ -242,7 +246,12 @@
|
|||||||
// various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit
|
// various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit
|
||||||
// set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is
|
// set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is
|
||||||
// clear. STB_TEXTEDIT_KEYTYPE defaults to int, but you can #define it to
|
// clear. STB_TEXTEDIT_KEYTYPE defaults to int, but you can #define it to
|
||||||
// anything other type you wante before including.
|
// anything other type you want before including.
|
||||||
|
// if the STB_TEXTEDIT_KEYTOTEXT function is defined, selected keys are
|
||||||
|
// transformed into text and stb_textedit_text() is automatically called.
|
||||||
|
//
|
||||||
|
// text: [DEAR IMGUI] added 2024-09
|
||||||
|
// call this to text inputs sent to the textfield.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// When rendering, you can read the cursor position and selection state from
|
// When rendering, you can read the cursor position and selection state from
|
||||||
@@ -274,8 +283,8 @@
|
|||||||
////
|
////
|
||||||
////
|
////
|
||||||
|
|
||||||
#ifndef INCLUDE_STB_TEXTEDIT_H
|
#ifndef INCLUDE_IMSTB_TEXTEDIT_H
|
||||||
#define INCLUDE_STB_TEXTEDIT_H
|
#define INCLUDE_IMSTB_TEXTEDIT_H
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -286,38 +295,38 @@
|
|||||||
// and undo state.
|
// and undo state.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef STB_TEXTEDIT_UNDOSTATECOUNT
|
#ifndef IMSTB_TEXTEDIT_UNDOSTATECOUNT
|
||||||
#define STB_TEXTEDIT_UNDOSTATECOUNT 99
|
#define IMSTB_TEXTEDIT_UNDOSTATECOUNT 99
|
||||||
#endif
|
#endif
|
||||||
#ifndef STB_TEXTEDIT_UNDOCHARCOUNT
|
#ifndef IMSTB_TEXTEDIT_UNDOCHARCOUNT
|
||||||
#define STB_TEXTEDIT_UNDOCHARCOUNT 999
|
#define IMSTB_TEXTEDIT_UNDOCHARCOUNT 999
|
||||||
#endif
|
#endif
|
||||||
#ifndef STB_TEXTEDIT_CHARTYPE
|
#ifndef IMSTB_TEXTEDIT_CHARTYPE
|
||||||
#define STB_TEXTEDIT_CHARTYPE int
|
#define IMSTB_TEXTEDIT_CHARTYPE int
|
||||||
#endif
|
#endif
|
||||||
#ifndef STB_TEXTEDIT_POSITIONTYPE
|
#ifndef IMSTB_TEXTEDIT_POSITIONTYPE
|
||||||
#define STB_TEXTEDIT_POSITIONTYPE int
|
#define IMSTB_TEXTEDIT_POSITIONTYPE int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// private data
|
// private data
|
||||||
STB_TEXTEDIT_POSITIONTYPE where;
|
IMSTB_TEXTEDIT_POSITIONTYPE where;
|
||||||
STB_TEXTEDIT_POSITIONTYPE insert_length;
|
IMSTB_TEXTEDIT_POSITIONTYPE insert_length;
|
||||||
STB_TEXTEDIT_POSITIONTYPE delete_length;
|
IMSTB_TEXTEDIT_POSITIONTYPE delete_length;
|
||||||
int char_storage;
|
int char_storage;
|
||||||
} StbUndoRecord;
|
} StbUndoRecord;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// private data
|
// private data
|
||||||
StbUndoRecord undo_rec [STB_TEXTEDIT_UNDOSTATECOUNT];
|
StbUndoRecord undo_rec [IMSTB_TEXTEDIT_UNDOSTATECOUNT];
|
||||||
STB_TEXTEDIT_CHARTYPE undo_char[STB_TEXTEDIT_UNDOCHARCOUNT];
|
IMSTB_TEXTEDIT_CHARTYPE undo_char[IMSTB_TEXTEDIT_UNDOCHARCOUNT];
|
||||||
short undo_point, redo_point;
|
short undo_point, redo_point;
|
||||||
int undo_char_point, redo_char_point;
|
int undo_char_point, redo_char_point;
|
||||||
} StbUndoState;
|
} StbUndoState;
|
||||||
|
|
||||||
typedef struct
|
typedef struct STB_TexteditState
|
||||||
{
|
{
|
||||||
/////////////////////
|
/////////////////////
|
||||||
//
|
//
|
||||||
@@ -371,7 +380,7 @@ typedef struct
|
|||||||
float ymin,ymax; // height of row above and below baseline
|
float ymin,ymax; // height of row above and below baseline
|
||||||
int num_chars;
|
int num_chars;
|
||||||
} StbTexteditRow;
|
} StbTexteditRow;
|
||||||
#endif //INCLUDE_STB_TEXTEDIT_H
|
#endif //INCLUDE_IMSTB_TEXTEDIT_H
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -384,11 +393,11 @@ typedef struct
|
|||||||
|
|
||||||
// implementation isn't include-guarded, since it might have indirectly
|
// implementation isn't include-guarded, since it might have indirectly
|
||||||
// included just the "header" portion
|
// included just the "header" portion
|
||||||
#ifdef STB_TEXTEDIT_IMPLEMENTATION
|
#ifdef IMSTB_TEXTEDIT_IMPLEMENTATION
|
||||||
|
|
||||||
#ifndef STB_TEXTEDIT_memmove
|
#ifndef IMSTB_TEXTEDIT_memmove
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define STB_TEXTEDIT_memmove memmove
|
#define IMSTB_TEXTEDIT_memmove memmove
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -398,7 +407,7 @@ typedef struct
|
|||||||
//
|
//
|
||||||
|
|
||||||
// traverse the layout to locate the nearest character to a display position
|
// traverse the layout to locate the nearest character to a display position
|
||||||
static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)
|
static int stb_text_locate_coord(IMSTB_TEXTEDIT_STRING *str, float x, float y)
|
||||||
{
|
{
|
||||||
StbTexteditRow r;
|
StbTexteditRow r;
|
||||||
int n = STB_TEXTEDIT_STRINGLEN(str);
|
int n = STB_TEXTEDIT_STRINGLEN(str);
|
||||||
@@ -437,13 +446,13 @@ static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)
|
|||||||
if (x < r.x1) {
|
if (x < r.x1) {
|
||||||
// search characters in row for one that straddles 'x'
|
// search characters in row for one that straddles 'x'
|
||||||
prev_x = r.x0;
|
prev_x = r.x0;
|
||||||
for (k=0; k < r.num_chars; ++k) {
|
for (k=0; k < r.num_chars; k = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, i + k) - i) {
|
||||||
float w = STB_TEXTEDIT_GETWIDTH(str, i, k);
|
float w = STB_TEXTEDIT_GETWIDTH(str, i, k);
|
||||||
if (x < prev_x+w) {
|
if (x < prev_x+w) {
|
||||||
if (x < prev_x+w/2)
|
if (x < prev_x+w/2)
|
||||||
return k+i;
|
return k+i;
|
||||||
else
|
else
|
||||||
return k+i+1;
|
return IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, i + k);
|
||||||
}
|
}
|
||||||
prev_x += w;
|
prev_x += w;
|
||||||
}
|
}
|
||||||
@@ -458,7 +467,7 @@ static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API click: on mouse down, move the cursor to the clicked location, and reset the selection
|
// API click: on mouse down, move the cursor to the clicked location, and reset the selection
|
||||||
static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
|
static void stb_textedit_click(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
|
||||||
{
|
{
|
||||||
// In single-line mode, just always make y = 0. This lets the drag keep working if the mouse
|
// In single-line mode, just always make y = 0. This lets the drag keep working if the mouse
|
||||||
// goes off the top or bottom of the text
|
// goes off the top or bottom of the text
|
||||||
@@ -476,7 +485,7 @@ static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API drag: on mouse drag, move the cursor and selection endpoint to the clicked location
|
// API drag: on mouse drag, move the cursor and selection endpoint to the clicked location
|
||||||
static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
|
static void stb_textedit_drag(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
|
|
||||||
@@ -502,11 +511,11 @@ static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state
|
|||||||
//
|
//
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);
|
static void stb_text_undo(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state);
|
||||||
static void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);
|
static void stb_text_redo(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state);
|
||||||
static void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length);
|
static void stb_text_makeundo_delete(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length);
|
||||||
static void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length);
|
static void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length);
|
||||||
static void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length);
|
static void stb_text_makeundo_replace(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -518,7 +527,7 @@ typedef struct
|
|||||||
|
|
||||||
// find the x/y location of a character, and remember info about the previous row in
|
// find the x/y location of a character, and remember info about the previous row in
|
||||||
// case we get a move-up event (for page up, we'll have to rescan)
|
// case we get a move-up event (for page up, we'll have to rescan)
|
||||||
static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *str, int n, int single_line)
|
static void stb_textedit_find_charpos(StbFindState *find, IMSTB_TEXTEDIT_STRING *str, int n, int single_line)
|
||||||
{
|
{
|
||||||
StbTexteditRow r;
|
StbTexteditRow r;
|
||||||
int prev_start = 0;
|
int prev_start = 0;
|
||||||
@@ -549,7 +558,10 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s
|
|||||||
i += r.num_chars;
|
i += r.num_chars;
|
||||||
find->y += r.baseline_y_delta;
|
find->y += r.baseline_y_delta;
|
||||||
if (i == z) // [DEAR IMGUI]
|
if (i == z) // [DEAR IMGUI]
|
||||||
|
{
|
||||||
|
r.num_chars = 0; // [DEAR IMGUI]
|
||||||
break; // [DEAR IMGUI]
|
break; // [DEAR IMGUI]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
find->first_char = first = i;
|
find->first_char = first = i;
|
||||||
@@ -559,14 +571,14 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s
|
|||||||
|
|
||||||
// now scan to find xpos
|
// now scan to find xpos
|
||||||
find->x = r.x0;
|
find->x = r.x0;
|
||||||
for (i=0; first+i < n; ++i)
|
for (i=0; first+i < n; i = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, first + i) - first)
|
||||||
find->x += STB_TEXTEDIT_GETWIDTH(str, first, i);
|
find->x += STB_TEXTEDIT_GETWIDTH(str, first, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STB_TEXT_HAS_SELECTION(s) ((s)->select_start != (s)->select_end)
|
#define STB_TEXT_HAS_SELECTION(s) ((s)->select_start != (s)->select_end)
|
||||||
|
|
||||||
// make the selection/cursor state valid if client altered the string
|
// make the selection/cursor state valid if client altered the string
|
||||||
static void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static void stb_textedit_clamp(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
int n = STB_TEXTEDIT_STRINGLEN(str);
|
int n = STB_TEXTEDIT_STRINGLEN(str);
|
||||||
if (STB_TEXT_HAS_SELECTION(state)) {
|
if (STB_TEXT_HAS_SELECTION(state)) {
|
||||||
@@ -580,7 +592,7 @@ static void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete characters while updating undo
|
// delete characters while updating undo
|
||||||
static void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int len)
|
static void stb_textedit_delete(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int len)
|
||||||
{
|
{
|
||||||
stb_text_makeundo_delete(str, state, where, len);
|
stb_text_makeundo_delete(str, state, where, len);
|
||||||
STB_TEXTEDIT_DELETECHARS(str, where, len);
|
STB_TEXTEDIT_DELETECHARS(str, where, len);
|
||||||
@@ -588,7 +600,7 @@ static void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete the section
|
// delete the section
|
||||||
static void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static void stb_textedit_delete_selection(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
if (STB_TEXT_HAS_SELECTION(state)) {
|
if (STB_TEXT_HAS_SELECTION(state)) {
|
||||||
@@ -625,7 +637,7 @@ static void stb_textedit_move_to_first(STB_TexteditState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// move cursor to last character of selection
|
// move cursor to last character of selection
|
||||||
static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static void stb_textedit_move_to_last(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
if (STB_TEXT_HAS_SELECTION(state)) {
|
if (STB_TEXT_HAS_SELECTION(state)) {
|
||||||
stb_textedit_sortselection(state);
|
stb_textedit_sortselection(state);
|
||||||
@@ -636,14 +648,25 @@ static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditStat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [DEAR IMGUI]
|
||||||
|
// Functions must be implemented for UTF8 support
|
||||||
|
// Code in this file that uses those functions is modified for [DEAR IMGUI] and deviates from the original stb_textedit.
|
||||||
|
// There is not necessarily a '[DEAR IMGUI]' at the usage sites.
|
||||||
|
#ifndef IMSTB_TEXTEDIT_GETPREVCHARINDEX
|
||||||
|
#define IMSTB_TEXTEDIT_GETPREVCHARINDEX(obj, idx) (idx - 1)
|
||||||
|
#endif
|
||||||
|
#ifndef IMSTB_TEXTEDIT_GETNEXTCHARINDEX
|
||||||
|
#define IMSTB_TEXTEDIT_GETNEXTCHARINDEX(obj, idx) (idx + 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STB_TEXTEDIT_IS_SPACE
|
#ifdef STB_TEXTEDIT_IS_SPACE
|
||||||
static int is_word_boundary( STB_TEXTEDIT_STRING *str, int idx )
|
static int is_word_boundary( IMSTB_TEXTEDIT_STRING *str, int idx )
|
||||||
{
|
{
|
||||||
return idx > 0 ? (STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str,idx-1) ) && !STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str, idx) ) ) : 1;
|
return idx > 0 ? (STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str,idx-1) ) && !STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str, idx) ) ) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STB_TEXTEDIT_MOVEWORDLEFT
|
#ifndef STB_TEXTEDIT_MOVEWORDLEFT
|
||||||
static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *str, int c )
|
static int stb_textedit_move_to_word_previous( IMSTB_TEXTEDIT_STRING *str, int c )
|
||||||
{
|
{
|
||||||
--c; // always move at least one character
|
--c; // always move at least one character
|
||||||
while( c >= 0 && !is_word_boundary( str, c ) )
|
while( c >= 0 && !is_word_boundary( str, c ) )
|
||||||
@@ -658,7 +681,7 @@ static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *str, int c )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STB_TEXTEDIT_MOVEWORDRIGHT
|
#ifndef STB_TEXTEDIT_MOVEWORDRIGHT
|
||||||
static int stb_textedit_move_to_word_next( STB_TEXTEDIT_STRING *str, int c )
|
static int stb_textedit_move_to_word_next( IMSTB_TEXTEDIT_STRING *str, int c )
|
||||||
{
|
{
|
||||||
const int len = STB_TEXTEDIT_STRINGLEN(str);
|
const int len = STB_TEXTEDIT_STRINGLEN(str);
|
||||||
++c; // always move at least one character
|
++c; // always move at least one character
|
||||||
@@ -685,7 +708,7 @@ static void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API cut: delete selection
|
// API cut: delete selection
|
||||||
static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static int stb_textedit_cut(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
if (STB_TEXT_HAS_SELECTION(state)) {
|
if (STB_TEXT_HAS_SELECTION(state)) {
|
||||||
stb_textedit_delete_selection(str,state); // implicitly clamps
|
stb_textedit_delete_selection(str,state); // implicitly clamps
|
||||||
@@ -696,7 +719,7 @@ static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API paste: replace existing selection with passed-in text
|
// API paste: replace existing selection with passed-in text
|
||||||
static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)
|
static int stb_textedit_paste_internal(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, IMSTB_TEXTEDIT_CHARTYPE *text, int len)
|
||||||
{
|
{
|
||||||
// if there's a selection, the paste should delete it
|
// if there's a selection, the paste should delete it
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
@@ -716,36 +739,44 @@ static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditSta
|
|||||||
#define STB_TEXTEDIT_KEYTYPE int
|
#define STB_TEXTEDIT_KEYTYPE int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// [DEAR IMGUI] Added stb_textedit_text(), extracted out and called by stb_textedit_key() for backward compatibility.
|
||||||
|
static void stb_textedit_text(IMSTB_TEXTEDIT_STRING* str, STB_TexteditState* state, const IMSTB_TEXTEDIT_CHARTYPE* text, int text_len)
|
||||||
|
{
|
||||||
|
// can't add newline in single-line mode
|
||||||
|
if (text[0] == '\n' && state->single_line)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (state->insert_mode && !STB_TEXT_HAS_SELECTION(state) && state->cursor < STB_TEXTEDIT_STRINGLEN(str)) {
|
||||||
|
stb_text_makeundo_replace(str, state, state->cursor, 1, 1);
|
||||||
|
STB_TEXTEDIT_DELETECHARS(str, state->cursor, 1);
|
||||||
|
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, text, text_len)) {
|
||||||
|
state->cursor += text_len;
|
||||||
|
state->has_preferred_x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stb_textedit_delete_selection(str, state); // implicitly clamps
|
||||||
|
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, text, text_len)) {
|
||||||
|
stb_text_makeundo_insert(state, state->cursor, text_len);
|
||||||
|
state->cursor += text_len;
|
||||||
|
state->has_preferred_x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// API key: process a keyboard input
|
// API key: process a keyboard input
|
||||||
static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_KEYTYPE key)
|
static void stb_textedit_key(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_KEYTYPE key)
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
switch (key) {
|
switch (key) {
|
||||||
default: {
|
default: {
|
||||||
|
#ifdef STB_TEXTEDIT_KEYTOTEXT
|
||||||
int c = STB_TEXTEDIT_KEYTOTEXT(key);
|
int c = STB_TEXTEDIT_KEYTOTEXT(key);
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
STB_TEXTEDIT_CHARTYPE ch = (STB_TEXTEDIT_CHARTYPE) c;
|
IMSTB_TEXTEDIT_CHARTYPE ch = (IMSTB_TEXTEDIT_CHARTYPE)c;
|
||||||
|
stb_textedit_text(str, state, &ch, 1);
|
||||||
// can't add newline in single-line mode
|
|
||||||
if (c == '\n' && state->single_line)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (state->insert_mode && !STB_TEXT_HAS_SELECTION(state) && state->cursor < STB_TEXTEDIT_STRINGLEN(str)) {
|
|
||||||
stb_text_makeundo_replace(str, state, state->cursor, 1, 1);
|
|
||||||
STB_TEXTEDIT_DELETECHARS(str, state->cursor, 1);
|
|
||||||
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
|
|
||||||
++state->cursor;
|
|
||||||
state->has_preferred_x = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
stb_textedit_delete_selection(str,state); // implicitly clamps
|
|
||||||
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
|
|
||||||
stb_text_makeundo_insert(state, state->cursor, 1);
|
|
||||||
++state->cursor;
|
|
||||||
state->has_preferred_x = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,7 +802,7 @@ retry:
|
|||||||
stb_textedit_move_to_first(state);
|
stb_textedit_move_to_first(state);
|
||||||
else
|
else
|
||||||
if (state->cursor > 0)
|
if (state->cursor > 0)
|
||||||
--state->cursor;
|
state->cursor = IMSTB_TEXTEDIT_GETPREVCHARINDEX(str, state->cursor);
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -780,7 +811,7 @@ retry:
|
|||||||
if (STB_TEXT_HAS_SELECTION(state))
|
if (STB_TEXT_HAS_SELECTION(state))
|
||||||
stb_textedit_move_to_last(str, state);
|
stb_textedit_move_to_last(str, state);
|
||||||
else
|
else
|
||||||
++state->cursor;
|
state->cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor);
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
break;
|
break;
|
||||||
@@ -790,7 +821,7 @@ retry:
|
|||||||
stb_textedit_prep_selection_at_cursor(state);
|
stb_textedit_prep_selection_at_cursor(state);
|
||||||
// move selection left
|
// move selection left
|
||||||
if (state->select_end > 0)
|
if (state->select_end > 0)
|
||||||
--state->select_end;
|
state->select_end = IMSTB_TEXTEDIT_GETPREVCHARINDEX(str, state->select_end);
|
||||||
state->cursor = state->select_end;
|
state->cursor = state->select_end;
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
break;
|
break;
|
||||||
@@ -840,7 +871,7 @@ retry:
|
|||||||
case STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_SHIFT:
|
case STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_SHIFT:
|
||||||
stb_textedit_prep_selection_at_cursor(state);
|
stb_textedit_prep_selection_at_cursor(state);
|
||||||
// move selection right
|
// move selection right
|
||||||
++state->select_end;
|
state->select_end = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->select_end);
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
state->cursor = state->select_end;
|
state->cursor = state->select_end;
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
@@ -889,14 +920,14 @@ retry:
|
|||||||
x = row.x0;
|
x = row.x0;
|
||||||
for (i=0; i < row.num_chars; ++i) {
|
for (i=0; i < row.num_chars; ++i) {
|
||||||
float dx = STB_TEXTEDIT_GETWIDTH(str, start, i);
|
float dx = STB_TEXTEDIT_GETWIDTH(str, start, i);
|
||||||
#ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE
|
#ifdef IMSTB_TEXTEDIT_GETWIDTH_NEWLINE
|
||||||
if (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)
|
if (dx == IMSTB_TEXTEDIT_GETWIDTH_NEWLINE)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
x += dx;
|
x += dx;
|
||||||
if (x > goal_x)
|
if (x > goal_x)
|
||||||
break;
|
break;
|
||||||
++state->cursor;
|
state->cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor);
|
||||||
}
|
}
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
|
|
||||||
@@ -951,14 +982,14 @@ retry:
|
|||||||
x = row.x0;
|
x = row.x0;
|
||||||
for (i=0; i < row.num_chars; ++i) {
|
for (i=0; i < row.num_chars; ++i) {
|
||||||
float dx = STB_TEXTEDIT_GETWIDTH(str, find.prev_first, i);
|
float dx = STB_TEXTEDIT_GETWIDTH(str, find.prev_first, i);
|
||||||
#ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE
|
#ifdef IMSTB_TEXTEDIT_GETWIDTH_NEWLINE
|
||||||
if (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)
|
if (dx == IMSTB_TEXTEDIT_GETWIDTH_NEWLINE)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
x += dx;
|
x += dx;
|
||||||
if (x > goal_x)
|
if (x > goal_x)
|
||||||
break;
|
break;
|
||||||
++state->cursor;
|
state->cursor = IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor);
|
||||||
}
|
}
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
|
|
||||||
@@ -986,7 +1017,7 @@ retry:
|
|||||||
else {
|
else {
|
||||||
int n = STB_TEXTEDIT_STRINGLEN(str);
|
int n = STB_TEXTEDIT_STRINGLEN(str);
|
||||||
if (state->cursor < n)
|
if (state->cursor < n)
|
||||||
stb_textedit_delete(str, state, state->cursor, 1);
|
stb_textedit_delete(str, state, state->cursor, IMSTB_TEXTEDIT_GETNEXTCHARINDEX(str, state->cursor) - state->cursor);
|
||||||
}
|
}
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
break;
|
break;
|
||||||
@@ -998,8 +1029,9 @@ retry:
|
|||||||
else {
|
else {
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
if (state->cursor > 0) {
|
if (state->cursor > 0) {
|
||||||
stb_textedit_delete(str, state, state->cursor-1, 1);
|
int prev = IMSTB_TEXTEDIT_GETPREVCHARINDEX(str, state->cursor);
|
||||||
--state->cursor;
|
stb_textedit_delete(str, state, prev, state->cursor - prev);
|
||||||
|
state->cursor = prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
@@ -1109,8 +1141,8 @@ retry:
|
|||||||
|
|
||||||
static void stb_textedit_flush_redo(StbUndoState *state)
|
static void stb_textedit_flush_redo(StbUndoState *state)
|
||||||
{
|
{
|
||||||
state->redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;
|
state->redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT;
|
||||||
state->redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;
|
state->redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// discard the oldest entry in the undo list
|
// discard the oldest entry in the undo list
|
||||||
@@ -1122,13 +1154,13 @@ static void stb_textedit_discard_undo(StbUndoState *state)
|
|||||||
int n = state->undo_rec[0].insert_length, i;
|
int n = state->undo_rec[0].insert_length, i;
|
||||||
// delete n characters from all other records
|
// delete n characters from all other records
|
||||||
state->undo_char_point -= n;
|
state->undo_char_point -= n;
|
||||||
STB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) (state->undo_char_point*sizeof(STB_TEXTEDIT_CHARTYPE)));
|
IMSTB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) (state->undo_char_point*sizeof(IMSTB_TEXTEDIT_CHARTYPE)));
|
||||||
for (i=0; i < state->undo_point; ++i)
|
for (i=0; i < state->undo_point; ++i)
|
||||||
if (state->undo_rec[i].char_storage >= 0)
|
if (state->undo_rec[i].char_storage >= 0)
|
||||||
state->undo_rec[i].char_storage -= n; // @OPTIMIZE: get rid of char_storage and infer it
|
state->undo_rec[i].char_storage -= n; // @OPTIMIZE: get rid of char_storage and infer it
|
||||||
}
|
}
|
||||||
--state->undo_point;
|
--state->undo_point;
|
||||||
STB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) (state->undo_point*sizeof(state->undo_rec[0])));
|
IMSTB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) (state->undo_point*sizeof(state->undo_rec[0])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1138,7 +1170,7 @@ static void stb_textedit_discard_undo(StbUndoState *state)
|
|||||||
// fill up even though the undo buffer didn't
|
// fill up even though the undo buffer didn't
|
||||||
static void stb_textedit_discard_redo(StbUndoState *state)
|
static void stb_textedit_discard_redo(StbUndoState *state)
|
||||||
{
|
{
|
||||||
int k = STB_TEXTEDIT_UNDOSTATECOUNT-1;
|
int k = IMSTB_TEXTEDIT_UNDOSTATECOUNT-1;
|
||||||
|
|
||||||
if (state->redo_point <= k) {
|
if (state->redo_point <= k) {
|
||||||
// if the k'th undo state has characters, clean those up
|
// if the k'th undo state has characters, clean those up
|
||||||
@@ -1146,7 +1178,7 @@ static void stb_textedit_discard_redo(StbUndoState *state)
|
|||||||
int n = state->undo_rec[k].insert_length, i;
|
int n = state->undo_rec[k].insert_length, i;
|
||||||
// move the remaining redo character data to the end of the buffer
|
// move the remaining redo character data to the end of the buffer
|
||||||
state->redo_char_point += n;
|
state->redo_char_point += n;
|
||||||
STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE)));
|
IMSTB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((IMSTB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(IMSTB_TEXTEDIT_CHARTYPE)));
|
||||||
// adjust the position of all the other records to account for above memmove
|
// adjust the position of all the other records to account for above memmove
|
||||||
for (i=state->redo_point; i < k; ++i)
|
for (i=state->redo_point; i < k; ++i)
|
||||||
if (state->undo_rec[i].char_storage >= 0)
|
if (state->undo_rec[i].char_storage >= 0)
|
||||||
@@ -1154,12 +1186,12 @@ static void stb_textedit_discard_redo(StbUndoState *state)
|
|||||||
}
|
}
|
||||||
// now move all the redo records towards the end of the buffer; the first one is at 'redo_point'
|
// now move all the redo records towards the end of the buffer; the first one is at 'redo_point'
|
||||||
// [DEAR IMGUI]
|
// [DEAR IMGUI]
|
||||||
size_t move_size = (size_t)((STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point - 1) * sizeof(state->undo_rec[0]));
|
size_t move_size = (size_t)((IMSTB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point - 1) * sizeof(state->undo_rec[0]));
|
||||||
const char* buf_begin = (char*)state->undo_rec; (void)buf_begin;
|
const char* buf_begin = (char*)state->undo_rec; (void)buf_begin;
|
||||||
const char* buf_end = (char*)state->undo_rec + sizeof(state->undo_rec); (void)buf_end;
|
const char* buf_end = (char*)state->undo_rec + sizeof(state->undo_rec); (void)buf_end;
|
||||||
IM_ASSERT(((char*)(state->undo_rec + state->redo_point)) >= buf_begin);
|
IM_ASSERT(((char*)(state->undo_rec + state->redo_point)) >= buf_begin);
|
||||||
IM_ASSERT(((char*)(state->undo_rec + state->redo_point + 1) + move_size) <= buf_end);
|
IM_ASSERT(((char*)(state->undo_rec + state->redo_point + 1) + move_size) <= buf_end);
|
||||||
STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, move_size);
|
IMSTB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, move_size);
|
||||||
|
|
||||||
// now move redo_point to point to the new one
|
// now move redo_point to point to the new one
|
||||||
++state->redo_point;
|
++state->redo_point;
|
||||||
@@ -1173,32 +1205,32 @@ static StbUndoRecord *stb_text_create_undo_record(StbUndoState *state, int numch
|
|||||||
|
|
||||||
// if we have no free records, we have to make room, by sliding the
|
// if we have no free records, we have to make room, by sliding the
|
||||||
// existing records down
|
// existing records down
|
||||||
if (state->undo_point == STB_TEXTEDIT_UNDOSTATECOUNT)
|
if (state->undo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT)
|
||||||
stb_textedit_discard_undo(state);
|
stb_textedit_discard_undo(state);
|
||||||
|
|
||||||
// if the characters to store won't possibly fit in the buffer, we can't undo
|
// if the characters to store won't possibly fit in the buffer, we can't undo
|
||||||
if (numchars > STB_TEXTEDIT_UNDOCHARCOUNT) {
|
if (numchars > IMSTB_TEXTEDIT_UNDOCHARCOUNT) {
|
||||||
state->undo_point = 0;
|
state->undo_point = 0;
|
||||||
state->undo_char_point = 0;
|
state->undo_char_point = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we don't have enough free characters in the buffer, we have to make room
|
// if we don't have enough free characters in the buffer, we have to make room
|
||||||
while (state->undo_char_point + numchars > STB_TEXTEDIT_UNDOCHARCOUNT)
|
while (state->undo_char_point + numchars > IMSTB_TEXTEDIT_UNDOCHARCOUNT)
|
||||||
stb_textedit_discard_undo(state);
|
stb_textedit_discard_undo(state);
|
||||||
|
|
||||||
return &state->undo_rec[state->undo_point++];
|
return &state->undo_rec[state->undo_point++];
|
||||||
}
|
}
|
||||||
|
|
||||||
static STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)
|
static IMSTB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)
|
||||||
{
|
{
|
||||||
StbUndoRecord *r = stb_text_create_undo_record(state, insert_len);
|
StbUndoRecord *r = stb_text_create_undo_record(state, insert_len);
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r->where = pos;
|
r->where = pos;
|
||||||
r->insert_length = (STB_TEXTEDIT_POSITIONTYPE) insert_len;
|
r->insert_length = (IMSTB_TEXTEDIT_POSITIONTYPE) insert_len;
|
||||||
r->delete_length = (STB_TEXTEDIT_POSITIONTYPE) delete_len;
|
r->delete_length = (IMSTB_TEXTEDIT_POSITIONTYPE) delete_len;
|
||||||
|
|
||||||
if (insert_len == 0) {
|
if (insert_len == 0) {
|
||||||
r->char_storage = -1;
|
r->char_storage = -1;
|
||||||
@@ -1210,7 +1242,7 @@ static STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static void stb_text_undo(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
StbUndoState *s = &state->undostate;
|
StbUndoState *s = &state->undostate;
|
||||||
StbUndoRecord u, *r;
|
StbUndoRecord u, *r;
|
||||||
@@ -1237,7 +1269,7 @@ static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
|||||||
// characters stored for *undoing* don't leave room for redo
|
// characters stored for *undoing* don't leave room for redo
|
||||||
// if the last is true, we have to bail
|
// if the last is true, we have to bail
|
||||||
|
|
||||||
if (s->undo_char_point + u.delete_length >= STB_TEXTEDIT_UNDOCHARCOUNT) {
|
if (s->undo_char_point + u.delete_length >= IMSTB_TEXTEDIT_UNDOCHARCOUNT) {
|
||||||
// the undo records take up too much character space; there's no space to store the redo characters
|
// the undo records take up too much character space; there's no space to store the redo characters
|
||||||
r->insert_length = 0;
|
r->insert_length = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -1246,7 +1278,7 @@ static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
|||||||
// there's definitely room to store the characters eventually
|
// there's definitely room to store the characters eventually
|
||||||
while (s->undo_char_point + u.delete_length > s->redo_char_point) {
|
while (s->undo_char_point + u.delete_length > s->redo_char_point) {
|
||||||
// should never happen:
|
// should never happen:
|
||||||
if (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)
|
if (s->redo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT)
|
||||||
return;
|
return;
|
||||||
// there's currently not enough room, so discard a redo record
|
// there's currently not enough room, so discard a redo record
|
||||||
stb_textedit_discard_redo(s);
|
stb_textedit_discard_redo(s);
|
||||||
@@ -1278,11 +1310,11 @@ static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
|||||||
s->redo_point--;
|
s->redo_point--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
static void stb_text_redo(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||||
{
|
{
|
||||||
StbUndoState *s = &state->undostate;
|
StbUndoState *s = &state->undostate;
|
||||||
StbUndoRecord *u, r;
|
StbUndoRecord *u, r;
|
||||||
if (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)
|
if (s->redo_point == IMSTB_TEXTEDIT_UNDOSTATECOUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// we need to do two things: apply the redo record, and create an undo record
|
// we need to do two things: apply the redo record, and create an undo record
|
||||||
@@ -1334,20 +1366,20 @@ static void stb_text_makeundo_insert(STB_TexteditState *state, int where, int le
|
|||||||
stb_text_createundo(&state->undostate, where, 0, length);
|
stb_text_createundo(&state->undostate, where, 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)
|
static void stb_text_makeundo_delete(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, length, 0);
|
IMSTB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, length, 0);
|
||||||
if (p) {
|
if (p) {
|
||||||
for (i=0; i < length; ++i)
|
for (i=0; i < length; ++i)
|
||||||
p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
|
p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)
|
static void stb_text_makeundo_replace(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, old_length, new_length);
|
IMSTB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, old_length, new_length);
|
||||||
if (p) {
|
if (p) {
|
||||||
for (i=0; i < old_length; ++i)
|
for (i=0; i < old_length; ++i)
|
||||||
p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
|
p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
|
||||||
@@ -1359,8 +1391,8 @@ static void stb_textedit_clear_state(STB_TexteditState *state, int is_single_lin
|
|||||||
{
|
{
|
||||||
state->undostate.undo_point = 0;
|
state->undostate.undo_point = 0;
|
||||||
state->undostate.undo_char_point = 0;
|
state->undostate.undo_char_point = 0;
|
||||||
state->undostate.redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;
|
state->undostate.redo_point = IMSTB_TEXTEDIT_UNDOSTATECOUNT;
|
||||||
state->undostate.redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;
|
state->undostate.redo_char_point = IMSTB_TEXTEDIT_UNDOCHARCOUNT;
|
||||||
state->select_end = state->select_start = 0;
|
state->select_end = state->select_start = 0;
|
||||||
state->cursor = 0;
|
state->cursor = 0;
|
||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
@@ -1383,16 +1415,16 @@ static void stb_textedit_initialize_state(STB_TexteditState *state, int is_singl
|
|||||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)
|
static int stb_textedit_paste(IMSTB_TEXTEDIT_STRING *str, STB_TexteditState *state, IMSTB_TEXTEDIT_CHARTYPE const *ctext, int len)
|
||||||
{
|
{
|
||||||
return stb_textedit_paste_internal(str, state, (STB_TEXTEDIT_CHARTYPE *) ctext, len);
|
return stb_textedit_paste_internal(str, state, (IMSTB_TEXTEDIT_CHARTYPE *) ctext, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//STB_TEXTEDIT_IMPLEMENTATION
|
#endif//IMSTB_TEXTEDIT_IMPLEMENTATION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|||||||
+1
-1
@@ -656,7 +656,7 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
|
|||||||
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);
|
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);
|
||||||
// If skip != 0, this tells stb_truetype to skip any codepoints for which
|
// If skip != 0, this tells stb_truetype to skip any codepoints for which
|
||||||
// there is no corresponding glyph. If skip=0, which is the default, then
|
// there is no corresponding glyph. If skip=0, which is the default, then
|
||||||
// codepoints without a glyph recived the font's "missing character" glyph,
|
// codepoints without a glyph received the font's "missing character" glyph,
|
||||||
// typically an empty box by convention.
|
// typically an empty box by convention.
|
||||||
|
|
||||||
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
|
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
|
||||||
|
|||||||
Vendored
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
cmake_policy(SET CMP0069 NEW)
|
cmake_policy(SET CMP0069 NEW)
|
||||||
project(minhook)
|
project(minhook)
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
@@ -23,6 +23,7 @@
|
|||||||
* Modified version.
|
* Modified version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef NO_SCARD
|
||||||
|
|
||||||
#include "scard.h"
|
#include "scard.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -409,3 +410,5 @@ void scard_threadstart() {
|
|||||||
void scard_fini() {
|
void scard_fini() {
|
||||||
should_exit = true;
|
should_exit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace games::ccj {
|
|||||||
bool MOUSE_TRACKBALL_USE_TOGGLE = false;
|
bool MOUSE_TRACKBALL_USE_TOGGLE = false;
|
||||||
uint8_t TRACKBALL_SENSITIVITY = 10;
|
uint8_t TRACKBALL_SENSITIVITY = 10;
|
||||||
|
|
||||||
static HANDLE fakeHandle = (HANDLE)0xDEADBEEF;
|
static HANDLE fakeHandle = (HANDLE)0xDEADBEEFull;
|
||||||
static HWND hWnd = nullptr;
|
static HWND hWnd = nullptr;
|
||||||
static WNDPROC wndProc = nullptr;
|
static WNDPROC wndProc = nullptr;
|
||||||
static std::thread *tbThread = nullptr;
|
static std::thread *tbThread = nullptr;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace games::ddr {
|
|||||||
|
|
||||||
// settings
|
// settings
|
||||||
bool SDMODE = false;
|
bool SDMODE = false;
|
||||||
|
bool NO_CODEC_REGISTRATION = false;
|
||||||
|
|
||||||
uint8_t DDR_TAPELEDS[TAPELED_DEVICE_COUNT][50][3] {};
|
uint8_t DDR_TAPELEDS[TAPELED_DEVICE_COUNT][50][3] {};
|
||||||
|
|
||||||
@@ -49,12 +50,82 @@ namespace games::ddr {
|
|||||||
return SendMessage_real(hWnd, Msg, wParam, lParam);
|
return SendMessage_real(hWnd, Msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool contains_only_ascii(const std::string& str) {
|
||||||
|
for (auto c: str) {
|
||||||
|
if (static_cast<unsigned char>(c) > 127) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
DDRGame::DDRGame() : Game("Dance Dance Revolution") {
|
DDRGame::DDRGame() : Game("Dance Dance Revolution") {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DDRGame::register_codecs() {
|
||||||
|
// find where spice.exe / spice64.exe is located
|
||||||
|
const auto &spice_bin_path = libutils::module_file_name(nullptr).parent_path();
|
||||||
|
|
||||||
|
// find the com directory
|
||||||
|
std::filesystem::path dir = "";
|
||||||
|
if (MODULE_PATH == spice_bin_path) {
|
||||||
|
// try: \com
|
||||||
|
dir = spice_bin_path / "com";
|
||||||
|
} else {
|
||||||
|
// try: modules\..\com
|
||||||
|
dir = MODULE_PATH / ".." / "com";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileutils::dir_exists(dir)) {
|
||||||
|
log_info("ddr", "looking for codecs in this directory: {}", dir.string());
|
||||||
|
} else {
|
||||||
|
log_info("ddr", "codecs directory not found: {}", dir.string());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &file : std::filesystem::directory_iterator(dir)) {
|
||||||
|
const auto &filename = file.path().filename();
|
||||||
|
const auto extension = strtolower(filename.extension().string());
|
||||||
|
|
||||||
|
if (extension != ".dll") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info("ddr", "found DLL: {}, size: {} bytes", filename.string(), file.file_size());
|
||||||
|
if (filename == "k-clvsd.dll" || filename.string().find("xactengine") == 0) {
|
||||||
|
const std::wstring wcmd = L"regsvr32.exe /s \"" + file.path().wstring() + L"\"";
|
||||||
|
const std::string cmd = "regsvr32.exe /s \"" + file.path().string() + "\"";
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
std::thread t([wcmd, &result]() {
|
||||||
|
result = _wsystem(wcmd.c_str());
|
||||||
|
});
|
||||||
|
t.join();
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
log_info("ddr", "`{}` returned {}", cmd, result);
|
||||||
|
} else {
|
||||||
|
log_warning("ddr", "`{}` failed, returned {}", cmd, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!contains_only_ascii(file.path().string())) {
|
||||||
|
log_warning(
|
||||||
|
"ddr",
|
||||||
|
"BAD PATH ERROR\n\n\n"
|
||||||
|
"!!! !!!\n"
|
||||||
|
"!!! filesystem path to codec contains non-ASCII characters! !!!\n"
|
||||||
|
"!!! this may cause the game to crash! !!!\n"
|
||||||
|
"!!! !!!\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DDRGame::pre_attach() {
|
void DDRGame::pre_attach() {
|
||||||
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::is_model("TDX")) {
|
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::is_model("TDX")) {
|
||||||
log_fatal(
|
log_warning(
|
||||||
"ddr",
|
"ddr",
|
||||||
"BAD MODEL NAME ERROR\n\n\n"
|
"BAD MODEL NAME ERROR\n\n\n"
|
||||||
"!!! model name set to TDX, this is WRONG and will break your game !!!\n"
|
"!!! model name set to TDX, this is WRONG and will break your game !!!\n"
|
||||||
@@ -65,6 +136,8 @@ namespace games::ddr {
|
|||||||
"!!! !!!\n"
|
"!!! !!!\n"
|
||||||
"!!! model name set to TDX, this is WRONG and will break your game !!!\n\n\n"
|
"!!! model name set to TDX, this is WRONG and will break your game !!!\n\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log_fatal("ddr", "BAD MODEL NAME ERROR - TDX specified, should be MDX instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::DEST[0] == 'U') {
|
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::DEST[0] == 'U') {
|
||||||
@@ -87,6 +160,17 @@ namespace games::ddr {
|
|||||||
"!!! !!!\n\n\n"
|
"!!! !!!\n\n\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cfg::CONFIGURATOR_STANDALONE) {
|
||||||
|
if (!NO_CODEC_REGISTRATION) {
|
||||||
|
this->register_codecs();
|
||||||
|
} else {
|
||||||
|
log_warning(
|
||||||
|
"ddr",
|
||||||
|
"skipping codec registration (-ddrnocodec), "
|
||||||
|
"game may crash if you didn't register codecs before launching the game");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DDRGame::attach() {
|
void DDRGame::attach() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace games::ddr {
|
|||||||
|
|
||||||
// settings
|
// settings
|
||||||
extern bool SDMODE;
|
extern bool SDMODE;
|
||||||
|
extern bool NO_CODEC_REGISTRATION;
|
||||||
|
|
||||||
// Buffers to store RGB data for tape LEDs on gold cabinets
|
// Buffers to store RGB data for tape LEDs on gold cabinets
|
||||||
const size_t TAPELED_DEVICE_COUNT = 11;
|
const size_t TAPELED_DEVICE_COUNT = 11;
|
||||||
@@ -18,5 +19,8 @@ namespace games::ddr {
|
|||||||
virtual void pre_attach() override;
|
virtual void pre_attach() override;
|
||||||
virtual void attach() override;
|
virtual void attach() override;
|
||||||
virtual void detach() override;
|
virtual void detach() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void register_codecs();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,50 +409,27 @@ namespace games::iidx {
|
|||||||
* 16 - side panel right - 183 bytes - 61 colors
|
* 16 - side panel right - 183 bytes - 61 colors
|
||||||
*
|
*
|
||||||
* data is stored in RGB order, 3 bytes per color
|
* data is stored in RGB order, 3 bytes per color
|
||||||
*
|
|
||||||
* TODO: expose this data via API
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// data mapping
|
|
||||||
static struct TapeLedMapping {
|
|
||||||
size_t data_size;
|
|
||||||
int index_r, index_g, index_b;
|
|
||||||
|
|
||||||
TapeLedMapping(size_t data_size, int index_r, int index_g, int index_b)
|
|
||||||
: data_size(data_size), index_r(index_r), index_g(index_g), index_b(index_b) {}
|
|
||||||
|
|
||||||
} mapping[] = {
|
|
||||||
{ 19, Lights::StageLeftAvgR, Lights::StageLeftAvgG, Lights::StageLeftAvgB },
|
|
||||||
{ 19, Lights::StageRightAvgR, Lights::StageRightAvgG, Lights::StageRightAvgB },
|
|
||||||
{ 45, Lights::CabinetLeftAvgR, Lights::CabinetLeftAvgG, Lights::CabinetLeftAvgB },
|
|
||||||
{ 45, Lights::CabinetRightAvgR, Lights::CabinetRightAvgG, Lights::CabinetRightAvgB },
|
|
||||||
{ 21, Lights::ControlPanelUnderAvgR, Lights::ControlPanelUnderAvgG, Lights::ControlPanelUnderAvgB },
|
|
||||||
{ 54, Lights::CeilingLeftAvgR, Lights::CeilingLeftAvgG, Lights::CeilingLeftAvgB },
|
|
||||||
{ 11, Lights::TitleLeftAvgR, Lights::TitleLeftAvgG, Lights::TitleLeftAvgB },
|
|
||||||
{ 11, Lights::TitleRightAvgR, Lights::TitleRightAvgG, Lights::TitleRightAvgB },
|
|
||||||
{ 54, Lights::CeilingRightAvgR, Lights::CeilingRightAvgG, Lights::CeilingRightAvgB },
|
|
||||||
{ 17, Lights::TouchPanelLeftAvgR, Lights::TouchPanelLeftAvgG, Lights::TouchPanelLeftAvgB },
|
|
||||||
{ 17, Lights::TouchPanelRightAvgR, Lights::TouchPanelRightAvgG, Lights::TouchPanelRightAvgB },
|
|
||||||
{ 68, Lights::SidePanelLeftInnerAvgR, Lights::SidePanelLeftInnerAvgG, Lights::SidePanelLeftInnerAvgB },
|
|
||||||
{ 68, Lights::SidePanelLeftOuterAvgR, Lights::SidePanelLeftOuterAvgG, Lights::SidePanelLeftOuterAvgB },
|
|
||||||
{ 61, Lights::SidePanelLeftAvgR, Lights::SidePanelLeftAvgG, Lights::SidePanelLeftAvgB },
|
|
||||||
{ 68, Lights::SidePanelRightOuterAvgR, Lights::SidePanelRightOuterAvgG, Lights::SidePanelRightOuterAvgB },
|
|
||||||
{ 68, Lights::SidePanelRightInnerAvgR, Lights::SidePanelRightInnerAvgG, Lights::SidePanelRightInnerAvgB },
|
|
||||||
{ 61, Lights::SidePanelRightAvgR, Lights::SidePanelRightAvgG, Lights::SidePanelRightAvgB },
|
|
||||||
};
|
|
||||||
|
|
||||||
// check index bounds
|
// check index bounds
|
||||||
if (tapeledutils::is_enabled() && index < std::size(mapping)) {
|
if (tapeledutils::is_enabled() && index < std::size(TAPELED_MAPPING)) {
|
||||||
auto &map = mapping[index];
|
auto &map = TAPELED_MAPPING[index];
|
||||||
|
const auto data_size = map.data.capacity();
|
||||||
|
|
||||||
// pick a color to use
|
// pick a color to use
|
||||||
const auto rgb = tapeledutils::pick_color_from_led_tape(data, map.data_size);
|
const auto rgb = tapeledutils::pick_color_from_led_tape(data, data_size);
|
||||||
|
|
||||||
// program the lights into API
|
// program the lights into API
|
||||||
auto &lights = get_lights();
|
auto &lights = get_lights();
|
||||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_r], rgb.r);
|
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_r], rgb.r);
|
||||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_g], rgb.g);
|
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_g], rgb.g);
|
||||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_b], rgb.b);
|
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_b], rgb.b);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < data_size; ++i) {
|
||||||
|
map.data[i].r = data[i * 3];
|
||||||
|
map.data[i].g = data[i * 3 + 1];
|
||||||
|
map.data[i].b = data[i * 3 + 2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This != custom_node) {
|
if (This != custom_node) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace games::iidx {
|
|||||||
static IIDXLocalCamera *front_camera = nullptr; // camera id #1
|
static IIDXLocalCamera *front_camera = nullptr; // camera id #1
|
||||||
std::vector<IIDXLocalCamera*> LOCAL_CAMERA_LIST = {};
|
std::vector<IIDXLocalCamera*> LOCAL_CAMERA_LIST = {};
|
||||||
static IDirect3DDeviceManager9 *s_pD3DManager = nullptr;
|
static IDirect3DDeviceManager9 *s_pD3DManager = nullptr;
|
||||||
std::filesystem::path CAMERA_CONFIG_PATH = std::filesystem::path(_wgetenv(L"APPDATA")) / L"spicetools_camera_control.json";
|
std::filesystem::path CAMERA_CONFIG_PATH;
|
||||||
bool CAMERA_READY = false;
|
bool CAMERA_READY = false;
|
||||||
|
|
||||||
bool parse_cmd_params() {
|
bool parse_cmd_params() {
|
||||||
@@ -493,7 +493,8 @@ namespace games::iidx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool camera_config_load() {
|
bool camera_config_load() {
|
||||||
log_info("iidx:camhook", "loading config");
|
CAMERA_CONFIG_PATH =
|
||||||
|
fileutils::get_config_file_path("iidx::camhook", "spicetools_camera_control.json");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// read config file
|
// read config file
|
||||||
@@ -651,9 +652,9 @@ namespace games::iidx {
|
|||||||
doc.Accept(writer);
|
doc.Accept(writer);
|
||||||
|
|
||||||
// save to file
|
// save to file
|
||||||
if (fileutils::text_write(CAMERA_CONFIG_PATH, buffer.GetString())) {
|
if (fileutils::write_config_file("iidx::camhook", CAMERA_CONFIG_PATH, buffer.GetString())) {
|
||||||
} else {
|
} else {
|
||||||
log_warning("iidx:camhook", "unable to save config file to {}", CAMERA_CONFIG_PATH.string());
|
log_warning("iidx:camhook", "unable to save config file");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "games/iidx/legacy_camera.h"
|
#include "games/iidx/legacy_camera.h"
|
||||||
|
|
||||||
|
#include "hooks/audio/audio.h"
|
||||||
#include "hooks/avshook.h"
|
#include "hooks/avshook.h"
|
||||||
#include "hooks/cfgmgr32hook.h"
|
#include "hooks/cfgmgr32hook.h"
|
||||||
#include "hooks/devicehook.h"
|
#include "hooks/devicehook.h"
|
||||||
@@ -22,11 +23,15 @@
|
|||||||
#include "misc/wintouchemu.h"
|
#include "misc/wintouchemu.h"
|
||||||
#include "misc/eamuse.h"
|
#include "misc/eamuse.h"
|
||||||
#include "util/detour.h"
|
#include "util/detour.h"
|
||||||
|
#include "util/deferlog.h"
|
||||||
#include "util/fileutils.h"
|
#include "util/fileutils.h"
|
||||||
#include "util/libutils.h"
|
#include "util/libutils.h"
|
||||||
#include "util/memutils.h"
|
#include "util/memutils.h"
|
||||||
#include "util/sigscan.h"
|
#include "util/sigscan.h"
|
||||||
#include "util/utils.h"
|
#include "util/utils.h"
|
||||||
|
#include "launcher/signal.h"
|
||||||
|
|
||||||
|
#include "external/robin_hood.h"
|
||||||
|
|
||||||
#include "bi2a.h"
|
#include "bi2a.h"
|
||||||
#include "bi2x_hook.h"
|
#include "bi2x_hook.h"
|
||||||
@@ -74,6 +79,26 @@ namespace games::iidx {
|
|||||||
bool IIDXIO_LED_TICKER_READONLY = false;
|
bool IIDXIO_LED_TICKER_READONLY = false;
|
||||||
std::mutex IIDX_LED_TICKER_LOCK;
|
std::mutex IIDX_LED_TICKER_LOCK;
|
||||||
|
|
||||||
|
tapeledutils::tape_led TAPELED_MAPPING[IIDX_TAPELED_TOTAL] = {
|
||||||
|
{ 19, Lights::StageLeftAvgR, Lights::StageLeftAvgG, Lights::StageLeftAvgB, "Stage Left" },
|
||||||
|
{ 19, Lights::StageRightAvgR, Lights::StageRightAvgG, Lights::StageRightAvgB, "Stage Right" },
|
||||||
|
{ 45, Lights::CabinetLeftAvgR, Lights::CabinetLeftAvgG, Lights::CabinetLeftAvgB, "Cabinet Left" },
|
||||||
|
{ 45, Lights::CabinetRightAvgR, Lights::CabinetRightAvgG, Lights::CabinetRightAvgB, "Cabinet Right" },
|
||||||
|
{ 21, Lights::ControlPanelUnderAvgR, Lights::ControlPanelUnderAvgG, Lights::ControlPanelUnderAvgB, "Control Panel Under" },
|
||||||
|
{ 54, Lights::CeilingLeftAvgR, Lights::CeilingLeftAvgG, Lights::CeilingLeftAvgB, "Ceiling Left" },
|
||||||
|
{ 11, Lights::TitleLeftAvgR, Lights::TitleLeftAvgG, Lights::TitleLeftAvgB, "Title Left" },
|
||||||
|
{ 11, Lights::TitleRightAvgR, Lights::TitleRightAvgG, Lights::TitleRightAvgB, "Title Right" },
|
||||||
|
{ 54, Lights::CeilingRightAvgR, Lights::CeilingRightAvgG, Lights::CeilingRightAvgB, "Ceiling Right" },
|
||||||
|
{ 17, Lights::TouchPanelLeftAvgR, Lights::TouchPanelLeftAvgG, Lights::TouchPanelLeftAvgB, "Touch Panel Left" },
|
||||||
|
{ 17, Lights::TouchPanelRightAvgR, Lights::TouchPanelRightAvgG, Lights::TouchPanelRightAvgB, "Touch Panel Right" },
|
||||||
|
{ 68, Lights::SidePanelLeftInnerAvgR, Lights::SidePanelLeftInnerAvgG, Lights::SidePanelLeftInnerAvgB, "Side Panel Left Inner" },
|
||||||
|
{ 68, Lights::SidePanelLeftOuterAvgR, Lights::SidePanelLeftOuterAvgG, Lights::SidePanelLeftOuterAvgB, "Side Panel Left Outer" },
|
||||||
|
{ 61, Lights::SidePanelLeftAvgR, Lights::SidePanelLeftAvgG, Lights::SidePanelLeftAvgB, "Side Panel Left" },
|
||||||
|
{ 68, Lights::SidePanelRightOuterAvgR, Lights::SidePanelRightOuterAvgG, Lights::SidePanelRightOuterAvgB, "Side Panel Right Outer" },
|
||||||
|
{ 68, Lights::SidePanelRightInnerAvgR, Lights::SidePanelRightInnerAvgG, Lights::SidePanelRightInnerAvgB, "Side Panel Right Inner" },
|
||||||
|
{ 61, Lights::SidePanelRightAvgR, Lights::SidePanelRightAvgG, Lights::SidePanelRightAvgB, "Side Panel Right" },
|
||||||
|
};
|
||||||
|
|
||||||
static LONG WINAPI RegOpenKeyA_hook(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult) {
|
static LONG WINAPI RegOpenKeyA_hook(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult) {
|
||||||
if (lpSubKey != nullptr && phkResult != nullptr) {
|
if (lpSubKey != nullptr && phkResult != nullptr) {
|
||||||
if (hKey == HKEY_LOCAL_MACHINE &&
|
if (hKey == HKEY_LOCAL_MACHINE &&
|
||||||
@@ -100,9 +125,25 @@ namespace games::iidx {
|
|||||||
*phkResult = DEVICE_ASIO_REG_HANDLE;
|
*phkResult = DEVICE_ASIO_REG_HANDLE;
|
||||||
|
|
||||||
log_info("iidx::asio", "replacing '{}' with '{}'", lpSubKey, ASIO_DRIVER.value());
|
log_info("iidx::asio", "replacing '{}' with '{}'", lpSubKey, ASIO_DRIVER.value());
|
||||||
|
const auto result = RegOpenKeyExA_orig(
|
||||||
return RegOpenKeyExA_orig(real_asio_reg_handle, ASIO_DRIVER.value().c_str(), ulOptions, samDesired,
|
real_asio_reg_handle,
|
||||||
|
ASIO_DRIVER.value().c_str(),
|
||||||
|
ulOptions,
|
||||||
|
samDesired,
|
||||||
&real_asio_device_reg_handle);
|
&real_asio_device_reg_handle);
|
||||||
|
|
||||||
|
if (result != ERROR_SUCCESS) {
|
||||||
|
log_warning(
|
||||||
|
"iidx::asio",
|
||||||
|
"failed to open registry subkey '{}', error=0x{:x}",
|
||||||
|
ASIO_DRIVER.value().c_str(), result);
|
||||||
|
log_warning(
|
||||||
|
"iidx::asio",
|
||||||
|
"due to improper ASIO setting, game will likely fail to launch; double check -iidxasio and the registry",
|
||||||
|
ASIO_DRIVER.value().c_str(), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +235,9 @@ namespace games::iidx {
|
|||||||
} else if (data.find(" W:touch: missing trigger:") != std::string::npos) {
|
} else if (data.find(" W:touch: missing trigger:") != std::string::npos) {
|
||||||
out.clear();
|
out.clear();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (data.find("SuperstepSound: Audio device is not available") != std::string::npos) {
|
||||||
|
deferredlogs::defer_error_messages(deferredlogs::SUPERSTEP_SOUND_ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -334,7 +378,11 @@ namespace games::iidx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_audio_hacks();
|
if (hooks::audio::ENABLED) {
|
||||||
|
apply_audio_hacks();
|
||||||
|
} else {
|
||||||
|
log_warning("iidx", "skipping audio hooks; disabled by user");
|
||||||
|
}
|
||||||
|
|
||||||
// ASIO device hook
|
// ASIO device hook
|
||||||
RegCloseKey_orig = detour::iat_try(
|
RegCloseKey_orig = detour::iat_try(
|
||||||
@@ -364,10 +412,6 @@ namespace games::iidx {
|
|||||||
|
|
||||||
// environment variables must be set before the DLL is loaded as the VC++ runtime copies all
|
// environment variables must be set before the DLL is loaded as the VC++ runtime copies all
|
||||||
// environment variables at startup
|
// environment variables at startup
|
||||||
if (DISABLE_CAMS) {
|
|
||||||
SetEnvironmentVariable("CONNECT_CAMERA", "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SCREEN_MODE.has_value()) {
|
if (SCREEN_MODE.has_value()) {
|
||||||
SetEnvironmentVariable("SCREEN_MODE", SCREEN_MODE.value().c_str());
|
SetEnvironmentVariable("SCREEN_MODE", SCREEN_MODE.value().c_str());
|
||||||
}
|
}
|
||||||
@@ -384,7 +428,7 @@ namespace games::iidx {
|
|||||||
|
|
||||||
// check bad model name
|
// check bad model name
|
||||||
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::is_model("TDJ")) {
|
if (!cfg::CONFIGURATOR_STANDALONE && avs::game::is_model("TDJ")) {
|
||||||
log_fatal(
|
log_warning(
|
||||||
"iidx",
|
"iidx",
|
||||||
"BAD MODEL NAME ERROR\n\n\n"
|
"BAD MODEL NAME ERROR\n\n\n"
|
||||||
"!!! model name set to TDJ, this is WRONG and will break your game !!!\n"
|
"!!! model name set to TDJ, this is WRONG and will break your game !!!\n"
|
||||||
@@ -402,6 +446,8 @@ namespace games::iidx {
|
|||||||
"!!! !!!\n"
|
"!!! !!!\n"
|
||||||
"!!! model name set to TDJ, this is WRONG and will break your game !!!\n\n\n"
|
"!!! model name set to TDJ, this is WRONG and will break your game !!!\n\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log_fatal("iidx", "BAD MODEL NAME ERROR - TDJ specified, must be LDJ instead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,26 +770,30 @@ namespace games::iidx {
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
// attempt to detect ASIO support
|
// attempt to detect ASIO support
|
||||||
|
// <=24 : 32-bit only
|
||||||
// 25-26: has neither (no patch needed - WASAPI Exclusive by default)
|
// 25-26: has neither (no patch needed - WASAPI Exclusive by default)
|
||||||
// 27-30: has both (envvar will be respected, ASIO or WASAPI)
|
// 27-30: has both (envvar will be respected, ASIO or WASAPI)
|
||||||
// 31+: only has XONAR (ASIO by default, signature patch can be used to force WASAPI - for now)
|
// 31+: only has XONAR (ASIO by default, signature patch can be used to force WASAPI - for now)
|
||||||
|
|
||||||
if (!has_SOUND_OUTPUT_DEVICE && !has_XONAR_SOUND_CARD) {
|
if (!has_SOUND_OUTPUT_DEVICE && !has_XONAR_SOUND_CARD) {
|
||||||
|
// iidx 25-26
|
||||||
log_info("iidx", "This game only uses WASAPI audio engine");
|
log_info("iidx", "This game only uses WASAPI audio engine");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_SOUND_OUTPUT_DEVICE && has_XONAR_SOUND_CARD) {
|
if (has_SOUND_OUTPUT_DEVICE && has_XONAR_SOUND_CARD) {
|
||||||
|
// iidx 27-30
|
||||||
log_info("iidx", "This game accepts SOUND_OUTPUT_DEVICE environment variable");
|
log_info("iidx", "This game accepts SOUND_OUTPUT_DEVICE environment variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("iidx", "This game supports ASIO but does not accept SOUND_OUTPUT_DEVICE environment variable");
|
log_info("iidx", "This game supports ASIO but does not accept SOUND_OUTPUT_DEVICE environment variable");
|
||||||
|
|
||||||
|
// patch game to force wasapi
|
||||||
if (SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi") {
|
if (SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi") {
|
||||||
intptr_t result = replace_pattern(
|
intptr_t result = replace_pattern(
|
||||||
avs::game::DLL_INSTANCE,
|
avs::game::DLL_INSTANCE,
|
||||||
"FF5008E8????ECFF83780803740D",
|
"FF5008E8??????FF83780803740D",
|
||||||
"??????BB00000000EB169090????",
|
"??????BB00000000EB169090????",
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
@@ -758,6 +808,41 @@ namespace games::iidx {
|
|||||||
"Successfully forced WASAPI as audio engine using signature matching @ 0x{:x}.",
|
"Successfully forced WASAPI as audio engine using signature matching @ 0x{:x}.",
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_info("iidx", "Not applying force wasapi patch; game will use ASIO");
|
||||||
|
}
|
||||||
|
|
||||||
|
// patch iidx32+ for asio compatibility
|
||||||
|
// only do this if NOT wasapi (as opposed to checking if it's asio)
|
||||||
|
// the patch is only really needed for (some) non-XONAR devices but since people sometimes disguise
|
||||||
|
// other devices as a XONAR, don't check for the exact string (common ASIO workaround for INF)
|
||||||
|
if (avs::game::is_ext(2024090100, MAXINT) &&
|
||||||
|
!(SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi")) {
|
||||||
|
|
||||||
|
// in iidx32 final:
|
||||||
|
// ff 50 08 call QWORD PTR [rax+0x8] ; ASIO instance AddRef
|
||||||
|
// 48 8b 4b 08 mov rcx,QWORD PTR [rbx+0x8]
|
||||||
|
// 48 8b 01 mov rax,QWORD PTR [rcx]
|
||||||
|
// ff 50 08 call QWORD PTR [rax+0x8] ; ASIO instance AddRef
|
||||||
|
|
||||||
|
intptr_t result = replace_pattern(
|
||||||
|
avs::game::DLL_INSTANCE,
|
||||||
|
"FF50????????????????FF50??4533C94533C0418D51",
|
||||||
|
"????????????????????909090??????????????????",
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
log_warning(
|
||||||
|
"iidx",
|
||||||
|
"Failed to apply ASIO compatibility fix for iidx32+. "
|
||||||
|
"Unless patches are applied, your ASIO device ({}) may hang or fail to work",
|
||||||
|
ASIO_DRIVER->c_str());
|
||||||
|
} else {
|
||||||
|
log_info(
|
||||||
|
"iidx",
|
||||||
|
"Successfully applied ASIO compatibility fix for iidx32+ using signature matching @ 0x{:x}.",
|
||||||
|
result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,9 +2,13 @@
|
|||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "games/game.h"
|
#include "games/game.h"
|
||||||
|
|
||||||
|
#include "external/robin_hood.h"
|
||||||
|
#include "util/tapeled.h"
|
||||||
|
|
||||||
namespace games::iidx {
|
namespace games::iidx {
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
@@ -30,6 +34,10 @@ namespace games::iidx {
|
|||||||
extern bool IIDXIO_LED_TICKER_READONLY;
|
extern bool IIDXIO_LED_TICKER_READONLY;
|
||||||
extern std::mutex IIDX_LED_TICKER_LOCK;
|
extern std::mutex IIDX_LED_TICKER_LOCK;
|
||||||
|
|
||||||
|
constexpr int IIDX_TAPELED_TOTAL = 17;
|
||||||
|
// data mapping
|
||||||
|
extern tapeledutils::tape_led TAPELED_MAPPING[IIDX_TAPELED_TOTAL];
|
||||||
|
|
||||||
class IIDXGame : public games::Game {
|
class IIDXGame : public games::Game {
|
||||||
public:
|
public:
|
||||||
IIDXGame();
|
IIDXGame();
|
||||||
|
|||||||
@@ -85,12 +85,19 @@ namespace games::iidx {
|
|||||||
&m_pwszSymbolicLink,
|
&m_pwszSymbolicLink,
|
||||||
&m_cchSymbolicLink
|
&m_cchSymbolicLink
|
||||||
);
|
);
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] GetAllocatedString failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
log_misc("iidx:camhook", "[{}] Symlink: {}", m_name, GetSymLink());
|
log_misc("iidx:camhook", "[{}] Symlink: {}", m_name, GetSymLink());
|
||||||
|
|
||||||
// Create the media source object.
|
// Create the media source object.
|
||||||
hr = pActivate->ActivateObject(IID_PPV_ARGS(&m_pSource));
|
hr = pActivate->ActivateObject(IID_PPV_ARGS(&m_pSource));
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] ActivateObject failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
// Retain reference to the camera
|
// Retain reference to the camera
|
||||||
m_pSource->AddRef();
|
m_pSource->AddRef();
|
||||||
@@ -98,13 +105,22 @@ namespace games::iidx {
|
|||||||
|
|
||||||
// Create an attribute store to hold initialization settings.
|
// Create an attribute store to hold initialization settings.
|
||||||
hr = WrappedMFCreateAttributes(&pAttributes, 2);
|
hr = WrappedMFCreateAttributes(&pAttributes, 2);
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] MFCreateAttributes failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
hr = pAttributes->SetUnknown(MF_SOURCE_READER_D3D_MANAGER, pD3DManager);
|
hr = pAttributes->SetUnknown(MF_SOURCE_READER_D3D_MANAGER, pD3DManager);
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] SetUnknown(MF_SOURCE_READER_D3D_MANAGER) failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
hr = pAttributes->SetUINT32(MF_SOURCE_READER_DISABLE_DXVA, FALSE);
|
hr = pAttributes->SetUINT32(MF_SOURCE_READER_DISABLE_DXVA, FALSE);
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] SetUINT32(MF_SOURCE_READER_DISABLE_DXVA) failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Color space conversion
|
// TODO: Color space conversion
|
||||||
// if (SUCCEEDED(hr)) {
|
// if (SUCCEEDED(hr)) {
|
||||||
@@ -120,11 +136,18 @@ namespace games::iidx {
|
|||||||
pAttributes,
|
pAttributes,
|
||||||
&m_pSourceReader
|
&m_pSourceReader
|
||||||
);
|
);
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] MFCreateSourceReaderFromMediaSource failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
log_misc("iidx:camhook", "[{}] Created source reader", m_name);
|
log_misc("iidx:camhook", "[{}] Created source reader", m_name);
|
||||||
|
|
||||||
hr = InitTargetTexture();
|
hr = InitTargetTexture();
|
||||||
if (FAILED(hr)) { goto done; }
|
if (FAILED(hr)) {
|
||||||
|
log_warning("iidx:camhook", "[{}] InitTargetTexture failed with {:#x}", m_name, (ULONG)hr);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
// Camera should be still usable even if camera control is not supported
|
// Camera should be still usable even if camera control is not supported
|
||||||
InitCameraControl();
|
InitCameraControl();
|
||||||
@@ -134,7 +157,7 @@ namespace games::iidx {
|
|||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
log_misc("iidx:camhook", "[{}] Initialized", m_name);
|
log_misc("iidx:camhook", "[{}] Initialized", m_name);
|
||||||
} else {
|
} else {
|
||||||
log_warning("iidx:camhook", "[{}] Failed to create camera: {}", m_name, hr);
|
log_warning("iidx:camhook", "[{}] Failed to create camera: {:#x}", m_name, (ULONG)hr);
|
||||||
}
|
}
|
||||||
SafeRelease(&pAttributes);
|
SafeRelease(&pAttributes);
|
||||||
LeaveCriticalSection(&m_critsec);
|
LeaveCriticalSection(&m_critsec);
|
||||||
@@ -165,7 +188,7 @@ namespace games::iidx {
|
|||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
if (hr != MF_E_NO_MORE_TYPES) {
|
if (hr != MF_E_NO_MORE_TYPES) {
|
||||||
log_warning("iidx:camhook", "[{}] Cannot get media type {} {}", m_name, i, hr);
|
log_warning("iidx:camhook", "[{}] Cannot get media type {} {:#x}", m_name, i, (ULONG)hr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -584,7 +607,7 @@ namespace games::iidx {
|
|||||||
* Return values:
|
* Return values:
|
||||||
* S_OK: this is a "better" media type than the existing one
|
* S_OK: this is a "better" media type than the existing one
|
||||||
* S_FALSE: valid media type, but not "better"
|
* S_FALSE: valid media type, but not "better"
|
||||||
* E_*: invalid meia type
|
* E_*: invalid media type
|
||||||
*/
|
*/
|
||||||
HRESULT IIDXLocalCamera::TryMediaType(IMFMediaType *pType, UINT32 *pBestWidth, double *pBestFrameRate) {
|
HRESULT IIDXLocalCamera::TryMediaType(IMFMediaType *pType, UINT32 *pBestWidth, double *pBestFrameRate) {
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
@@ -595,13 +618,13 @@ namespace games::iidx {
|
|||||||
hr = pType->GetGUID(MF_MT_SUBTYPE, &subtype);
|
hr = pType->GetGUID(MF_MT_SUBTYPE, &subtype);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
log_warning("iidx:camhook", "[{}] Failed to get subtype: {}", m_name, hr);
|
log_warning("iidx:camhook", "[{}] Failed to get subtype: {:#x}", m_name, (ULONG)hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = MFGetAttributeSize(pType, MF_MT_FRAME_SIZE, &width, &height);
|
hr = MFGetAttributeSize(pType, MF_MT_FRAME_SIZE, &width, &height);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
log_warning("iidx:camhook", "[{}] Failed to get frame size: {}", m_name, hr);
|
log_warning("iidx:camhook", "[{}] Failed to get frame size: {:#x}", m_name, (ULONG)hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,7 +642,7 @@ namespace games::iidx {
|
|||||||
(UINT32*)&frameRate.Denominator
|
(UINT32*)&frameRate.Denominator
|
||||||
);
|
);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
log_warning("iidx:camhook", "[{}] Failed to get frame rate: {}", m_name, hr);
|
log_warning("iidx:camhook", "[{}] Failed to get frame rate: {:#x}", m_name, (ULONG)hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
double frameRateValue = frameRate.Numerator / frameRate.Denominator;
|
double frameRateValue = frameRate.Numerator / frameRate.Denominator;
|
||||||
@@ -696,7 +719,7 @@ namespace games::iidx {
|
|||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
log_misc("iidx:camhook", "[{}] Created texture", m_name);
|
log_misc("iidx:camhook", "[{}] Created texture", m_name);
|
||||||
} else {
|
} else {
|
||||||
log_warning("iidx:camhook", "[{}] Failed to create texture: {}", m_name, hr);
|
log_warning("iidx:camhook", "[{}] Failed to create texture: {:#x}", m_name, (ULONG)hr);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
@@ -785,7 +808,7 @@ namespace games::iidx {
|
|||||||
FlushDrawCommands();
|
FlushDrawCommands();
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
log_warning("iidx:camhook", "Error in DrawSample {}", hr);
|
log_warning("iidx:camhook", "Error in DrawSample {:#x}", (ULONG)hr);
|
||||||
}
|
}
|
||||||
SafeRelease(&pCameraSurf);
|
SafeRelease(&pCameraSurf);
|
||||||
LeaveCriticalSection(&m_critsec);
|
LeaveCriticalSection(&m_critsec);
|
||||||
|
|||||||
@@ -266,8 +266,8 @@ namespace games::iidx::poke {
|
|||||||
y *= rawinput::TOUCHSCREEN_RANGE_Y;
|
y *= rawinput::TOUCHSCREEN_RANGE_Y;
|
||||||
} else if (GRAPHICS_IIDX_WSUB) {
|
} else if (GRAPHICS_IIDX_WSUB) {
|
||||||
// Scale to windowed subscreen
|
// Scale to windowed subscreen
|
||||||
x *= GRAPHICS_IIDX_WSUB_WIDTH;
|
x *= GRAPHICS_WSUB_WIDTH;
|
||||||
y *= GRAPHICS_IIDX_WSUB_HEIGHT;
|
y *= GRAPHICS_WSUB_HEIGHT;
|
||||||
} else if (GENERIC_SUB_WINDOW_FULLSIZE || !overlay::OVERLAY->get_active()) {
|
} else if (GENERIC_SUB_WINDOW_FULLSIZE || !overlay::OVERLAY->get_active()) {
|
||||||
// Overlay is not present, scale to main screen
|
// Overlay is not present, scale to main screen
|
||||||
if (GRAPHICS_WINDOWED) {
|
if (GRAPHICS_WINDOWED) {
|
||||||
|
|||||||
+30
-12
@@ -35,6 +35,8 @@
|
|||||||
#include "bc/io.h"
|
#include "bc/io.h"
|
||||||
#include "ccj/io.h"
|
#include "ccj/io.h"
|
||||||
#include "qks/io.h"
|
#include "qks/io.h"
|
||||||
|
#include "mfg/io.h"
|
||||||
|
#include "pc/io.h"
|
||||||
|
|
||||||
namespace games {
|
namespace games {
|
||||||
|
|
||||||
@@ -305,6 +307,22 @@ namespace games {
|
|||||||
buttons.insert({ qks, qks::get_buttons() });
|
buttons.insert({ qks, qks::get_buttons() });
|
||||||
buttons_help.insert({ qks, qks::get_buttons_help() });
|
buttons_help.insert({ qks, qks::get_buttons_help() });
|
||||||
file_hints[qks].emplace_back("game/uks.exe");
|
file_hints[qks].emplace_back("game/uks.exe");
|
||||||
|
|
||||||
|
// Mahjong Fight Girl
|
||||||
|
const std::string mfg("Mahjong Fight Girl");
|
||||||
|
games.push_back(mfg);
|
||||||
|
buttons.insert({ mfg, mfg::get_buttons() });
|
||||||
|
buttons_help.insert({ mfg, mfg::get_buttons_help() });
|
||||||
|
file_hints[mfg].emplace_back("game/MFGClient_Data");
|
||||||
|
|
||||||
|
// Polaris Chord
|
||||||
|
const std::string pc("Polaris Chord");
|
||||||
|
games.push_back(pc);
|
||||||
|
buttons.insert({ pc, pc::get_buttons() });
|
||||||
|
buttons_help.insert({ pc, pc::get_buttons_help() });
|
||||||
|
analogs.insert({ pc, pc::get_analogs() });
|
||||||
|
lights.insert({ pc, pc::get_lights() });
|
||||||
|
file_hints[pc].emplace_back("game/svm_Data");
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> &get_games() {
|
const std::vector<std::string> &get_games() {
|
||||||
@@ -437,22 +455,22 @@ namespace games {
|
|||||||
vkey_defaults.push_back(VK_F12);
|
vkey_defaults.push_back(VK_F12);
|
||||||
names.emplace_back("Toggle Camera Control");
|
names.emplace_back("Toggle Camera Control");
|
||||||
vkey_defaults.push_back(0xFF);
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Player 1 PIN Macro");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Player 2 PIN Macro");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
names.emplace_back("Screen Resize");
|
names.emplace_back("Screen Resize");
|
||||||
vkey_defaults.push_back(0xFF);
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Screen Resize Scene 1");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Screen Resize Scene 2");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Screen Resize Scene 3");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
|
names.emplace_back("Screen Resize Scene 4");
|
||||||
|
vkey_defaults.push_back(0xFF);
|
||||||
names.emplace_back("Force Exit Game");
|
names.emplace_back("Force Exit Game");
|
||||||
vkey_defaults.push_back(0xFF);
|
vkey_defaults.push_back(0xFF);
|
||||||
names.emplace_back("Navigator Activate");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Navigator Cancel");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Navigator Up");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Navigator Down");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Navigator Left");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Navigator Right");
|
|
||||||
vkey_defaults.push_back(0xFF);
|
|
||||||
names.emplace_back("Hotkey Enable 1");
|
names.emplace_back("Hotkey Enable 1");
|
||||||
vkey_defaults.push_back(0xFF);
|
vkey_defaults.push_back(0xFF);
|
||||||
names.emplace_back("Hotkey Enable 2");
|
names.emplace_back("Hotkey Enable 2");
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ namespace games {
|
|||||||
ToggleScreenResize,
|
ToggleScreenResize,
|
||||||
ToggleOverlay,
|
ToggleOverlay,
|
||||||
ToggleCameraControl,
|
ToggleCameraControl,
|
||||||
|
TriggerPinMacroP1,
|
||||||
|
TriggerPinMacroP2,
|
||||||
ScreenResize,
|
ScreenResize,
|
||||||
|
ScreenResizeScene1,
|
||||||
|
ScreenResizeScene2,
|
||||||
|
ScreenResizeScene3,
|
||||||
|
ScreenResizeScene4,
|
||||||
SuperExit,
|
SuperExit,
|
||||||
NavigatorActivate,
|
|
||||||
NavigatorCancel,
|
|
||||||
NavigatorUp,
|
|
||||||
NavigatorDown,
|
|
||||||
NavigatorLeft,
|
|
||||||
NavigatorRight,
|
|
||||||
HotkeyEnable1,
|
HotkeyEnable1,
|
||||||
HotkeyEnable2,
|
HotkeyEnable2,
|
||||||
HotkeyToggle,
|
HotkeyToggle,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace games::jb {
|
|||||||
const auto current_path = std::filesystem::current_path();
|
const auto current_path = std::filesystem::current_path();
|
||||||
log_misc("jubeat", "current working directory: {}", current_path.string());
|
log_misc("jubeat", "current working directory: {}", current_path.string());
|
||||||
if (current_path.parent_path() == current_path.root_path()) {
|
if (current_path.parent_path() == current_path.root_path()) {
|
||||||
log_fatal(
|
log_warning(
|
||||||
"jubeat",
|
"jubeat",
|
||||||
"\n\nInvalid path error; jubeat cannot run from a directory in the drive root\n"
|
"\n\nInvalid path error; jubeat cannot run from a directory in the drive root\n"
|
||||||
"The game will overflow the stack and silently fail to boot\n\n"
|
"The game will overflow the stack and silently fail to boot\n\n"
|
||||||
@@ -179,6 +179,10 @@ namespace games::jb {
|
|||||||
"To fix this, create a new directory and move ALL game files there.\n\n"
|
"To fix this, create a new directory and move ALL game files there.\n\n"
|
||||||
"Your current working directory: {}\n",
|
"Your current working directory: {}\n",
|
||||||
current_path.string());
|
current_path.string());
|
||||||
|
|
||||||
|
log_fatal(
|
||||||
|
"jubeat",
|
||||||
|
"Invalid path error; jubeat cannot run from a directory in the drive root");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,14 @@
|
|||||||
|
|
||||||
namespace games::loveplus {
|
namespace games::loveplus {
|
||||||
|
|
||||||
|
bool CAMERA_ENABLE = false;
|
||||||
|
|
||||||
// touch stuff
|
// touch stuff
|
||||||
static bool TOUCH_ENABLE = false;
|
static bool TOUCH_ENABLE = false;
|
||||||
static bool TOUCH_ATTACHED = false;
|
static bool TOUCH_ATTACHED = false;
|
||||||
|
|
||||||
|
static std::string lp_args = "-noWatchDog -noIOError -noIrda -notarget";
|
||||||
|
|
||||||
void touch_update() {
|
void touch_update() {
|
||||||
|
|
||||||
// check if touch enabled
|
// check if touch enabled
|
||||||
@@ -28,16 +32,15 @@ namespace games::loveplus {
|
|||||||
if (!TOUCH_ATTACHED) {
|
if (!TOUCH_ATTACHED) {
|
||||||
|
|
||||||
// Find the game window.
|
// Find the game window.
|
||||||
// We check the foreground window first, then fall back to searching for the window title
|
HWND wnd = FindProcessWindowBeginsWith("LovePlusAC");
|
||||||
// All game versions seem to have their model first in the window title
|
|
||||||
HWND wnd = GetForegroundWindow();
|
|
||||||
if (!string_begins_with(GetActiveWindowTitle(), "LovePlus")) {
|
|
||||||
wnd = FindWindowBeginsWith(avs::game::MODEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// attach touch hook
|
// attach touch hook
|
||||||
if (wnd) {
|
if (wnd) {
|
||||||
log_info("loveplus", "using window handle for touch: {}", fmt::ptr(wnd));
|
log_info(
|
||||||
|
"loveplus",
|
||||||
|
"using window handle for touch: {} ({})",
|
||||||
|
fmt::ptr(wnd),
|
||||||
|
get_window_title(wnd));
|
||||||
touch_create_wnd(wnd);
|
touch_create_wnd(wnd);
|
||||||
} else {
|
} else {
|
||||||
log_info("loveplus", "falling back to the DirectX window handle for touch");
|
log_info("loveplus", "falling back to the DirectX window handle for touch");
|
||||||
@@ -117,12 +120,26 @@ namespace games::loveplus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LPSTR __stdcall GetCommandLineA_hook() {
|
static LPSTR __stdcall GetCommandLineA_hook() {
|
||||||
static std::string lp_args = "-win -noCamera -noWatchDog -noIOError -noIrda -notarget";
|
|
||||||
|
|
||||||
return lp_args.data();
|
return lp_args.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool lp_spam_remover(void *user, const std::string &data, logger::Style style, std::string &out) {
|
||||||
|
if (data.empty() || data[0] != '[') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (data.find("> [INFO] err_code: 0, err_title: , err_str:") != std::string::npos) {
|
||||||
|
out = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LovePlusGame::LovePlusGame() : Game("LovePlus") {
|
LovePlusGame::LovePlusGame() : Game("LovePlus") {
|
||||||
|
logger::hook_add(lp_spam_remover, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
LovePlusGame::~LovePlusGame() {
|
||||||
|
logger::hook_remove(lp_spam_remover, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LovePlusGame::attach() {
|
void LovePlusGame::attach() {
|
||||||
@@ -157,9 +174,17 @@ namespace games::loveplus {
|
|||||||
HMODULE seteq = libutils::try_library("ad_hd_seteq_dll.dll");
|
HMODULE seteq = libutils::try_library("ad_hd_seteq_dll.dll");
|
||||||
detour::inline_hook((void *) SetEqualizer, libutils::try_proc(seteq, "SetEqualizer"));
|
detour::inline_hook((void *) SetEqualizer, libutils::try_proc(seteq, "SetEqualizer"));
|
||||||
|
|
||||||
|
// set up command line args
|
||||||
|
if (!CAMERA_ENABLE) {
|
||||||
|
lp_args += " -noCamera";
|
||||||
|
}
|
||||||
|
if (GRAPHICS_WINDOWED) {
|
||||||
|
lp_args += " -win";
|
||||||
|
}
|
||||||
// get command line hook
|
// get command line hook
|
||||||
HMODULE lpac = libutils::try_library("lpac.dll");
|
HMODULE lpac = libutils::try_library("lpac.dll");
|
||||||
detour::iat("GetCommandLineA", GetCommandLineA_hook, lpac);
|
detour::iat("GetCommandLineA", GetCommandLineA_hook, lpac);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LovePlusGame::detach() {
|
void LovePlusGame::detach() {
|
||||||
|
|||||||
@@ -4,12 +4,15 @@
|
|||||||
|
|
||||||
namespace games::loveplus {
|
namespace games::loveplus {
|
||||||
|
|
||||||
|
extern bool CAMERA_ENABLE;
|
||||||
|
|
||||||
// touch stuff
|
// touch stuff
|
||||||
void touch_update();
|
void touch_update();
|
||||||
|
|
||||||
class LovePlusGame : public games::Game {
|
class LovePlusGame : public games::Game {
|
||||||
public:
|
public:
|
||||||
LovePlusGame();
|
LovePlusGame();
|
||||||
|
virtual ~LovePlusGame() override;
|
||||||
virtual void attach() override;
|
virtual void attach() override;
|
||||||
virtual void detach() override;
|
virtual void detach() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -288,6 +288,21 @@ namespace games::mfc {
|
|||||||
MFCGame::MFCGame() : Game("Mahjong Fight Club") {
|
MFCGame::MFCGame() : Game("Mahjong Fight Club") {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool spam_remover(void *user, const std::string &data, logger::Style style, std::string &out) {
|
||||||
|
if (data.empty() || data[0] != '[') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (data.find("W:mutex: lock: mid 00000000 != AVS_DTYPE_MUTEX") != std::string::npos) {
|
||||||
|
out = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (data.find("W:mutex: unlock: mid 00000000 != AVS_DTYPE_MUTEX") != std::string::npos) {
|
||||||
|
out = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MFCGame::attach() {
|
void MFCGame::attach() {
|
||||||
Game::attach();
|
Game::attach();
|
||||||
|
|
||||||
@@ -308,6 +323,13 @@ namespace games::mfc {
|
|||||||
auto allinone_module = libutils::try_module("allinone.dll");
|
auto allinone_module = libutils::try_module("allinone.dll");
|
||||||
auto system_module = libutils::try_module("system.dll");
|
auto system_module = libutils::try_module("system.dll");
|
||||||
|
|
||||||
|
// Mahjong Fight Club - 2025?
|
||||||
|
// they removed allinone.dll and moved i/o into system.dll
|
||||||
|
if (allinone_module == nullptr) {
|
||||||
|
log_misc("mfc", "using system.dll instead of allinone.dll for i/o hooks");
|
||||||
|
allinone_module = system_module;
|
||||||
|
}
|
||||||
|
|
||||||
// network fix
|
// network fix
|
||||||
detour::iat_try("?nic_dhcp_maybe_exist@@YAEXZ", nic_dhcp_maybe_exist, system_module);
|
detour::iat_try("?nic_dhcp_maybe_exist@@YAEXZ", nic_dhcp_maybe_exist, system_module);
|
||||||
|
|
||||||
@@ -378,5 +400,7 @@ namespace games::mfc {
|
|||||||
detour::inline_hook((void *) mouse_utl_step, libutils::try_proc(
|
detour::inline_hook((void *) mouse_utl_step, libutils::try_proc(
|
||||||
allinone_module, "?mouse_utl_step@@YAXXZ"));
|
allinone_module, "?mouse_utl_step@@YAXXZ"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger::hook_add(spam_remover, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,385 @@
|
|||||||
|
#include "bi2a_hook.h"
|
||||||
|
|
||||||
|
#include "util/execexe.h"
|
||||||
|
#include "util/logging.h"
|
||||||
|
#include "rawinput/rawinput.h"
|
||||||
|
#include "misc/eamuse.h"
|
||||||
|
#include "games/io.h"
|
||||||
|
#include "io.h"
|
||||||
|
#include "util/tapeled.h"
|
||||||
|
|
||||||
|
namespace games::mfg {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* class definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct AIO_SCI_COMM {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_NMGR_IOB {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB_BI2A_VFG {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB_BI2A_VFG__INPUTDATA {
|
||||||
|
uint8_t data[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB_BI2A_VFG__OUTPUTDATA {
|
||||||
|
uint8_t data[40];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB_BI2A_VFG__INPUT
|
||||||
|
{
|
||||||
|
uint8_t bPcPowerCheck;
|
||||||
|
uint8_t CoinCount;
|
||||||
|
uint8_t bTest;
|
||||||
|
uint8_t bService;
|
||||||
|
uint8_t bCoinSw;
|
||||||
|
uint8_t bCoinJam;
|
||||||
|
uint8_t bCabinet;
|
||||||
|
uint8_t bHPDetect;
|
||||||
|
uint8_t bRecDetect;
|
||||||
|
uint8_t bStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB_BI2A_VFG__DEVSTATUS
|
||||||
|
{
|
||||||
|
uint8_t MechType;
|
||||||
|
uint8_t bIsBi2a;
|
||||||
|
uint8_t IoCounter;
|
||||||
|
AIO_IOB_BI2A_VFG__INPUT Input;
|
||||||
|
AIO_IOB_BI2A_VFG__INPUTDATA InputData;
|
||||||
|
AIO_IOB_BI2A_VFG__OUTPUTDATA OutputData;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* typedefs
|
||||||
|
*/
|
||||||
|
|
||||||
|
// libaio-iob_video.dll
|
||||||
|
typedef AIO_SCI_COMM* (__fastcall *aioIobBi2a_OpenSciUsbCdc_t)(uint32_t i_SerialNumber);
|
||||||
|
typedef AIO_IOB_BI2A_VFG* (__fastcall *aioIobBi2aVFG_Create_t)(AIO_NMGR_IOB *i_pNodeMgr, uint32_t i_DevId);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetMechType_t)(AIO_IOB_BI2A_VFG *i_pNodeCtl, uint32_t i_MechType);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_GetDeviceStatus_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl,
|
||||||
|
AIO_IOB_BI2A_VFG__DEVSTATUS *o_pDevStatus,
|
||||||
|
uint32_t i_cbDevStatus);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetWatchDogTimer_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint16_t i_Count);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_ControlCoinBlocker_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Slot,
|
||||||
|
bool i_bOpen);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_AddCounter_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Counter,
|
||||||
|
uint32_t i_Count);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetAmpVolume_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Amp,
|
||||||
|
uint32_t i_Volume);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_EnableUsbCharger_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, bool i_bEnable);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetLamp_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Lamp, uint8_t i_Bright);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetIccrLed_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_RGB);
|
||||||
|
typedef void (__fastcall *aioIobBi2aVFG_SetLedData_t)(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint8_t *i_pData,
|
||||||
|
uint32_t i_cbData);
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
typedef AIO_NMGR_IOB* (__fastcall *aioNMgrIob_Create_t)(AIO_SCI_COMM* i_pSci, uint32_t i_bfMode);
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
typedef void (__fastcall *aioNodeMgr_Destroy_t)(AIO_NMGR_IOB *i_pNodeMgr);
|
||||||
|
typedef int32_t (__fastcall *aioNodeMgr_GetState_t)(AIO_NMGR_IOB *i_pNodeMgr);
|
||||||
|
typedef bool (__fastcall *aioNodeMgr_IsReady_t)(AIO_NMGR_IOB *i_pNodeMgr, int32_t i_State);
|
||||||
|
typedef bool (__fastcall *aioNodeMgr_IsError_t)(AIO_NMGR_IOB *i_pNodeMgr, int32_t i_State);
|
||||||
|
typedef void (__fastcall *aioNodeCtl_Destroy_t)(AIO_IOB_BI2A_VFG *i_pNodeCtl);
|
||||||
|
typedef int32_t (__fastcall *aioNodeCtl_GetState_t)(AIO_IOB_BI2A_VFG *i_pNodeCtl);
|
||||||
|
typedef bool (__fastcall *aioNodeCtl_IsReady_t)(AIO_IOB_BI2A_VFG *i_pNodeCtl, int32_t i_State);
|
||||||
|
typedef bool (__fastcall *aioNodeCtl_IsError_t)(AIO_IOB_BI2A_VFG *i_pNodeCtl, int32_t i_State);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function pointers
|
||||||
|
*/
|
||||||
|
|
||||||
|
// libaio-iob_video.dll
|
||||||
|
static aioIobBi2a_OpenSciUsbCdc_t aioIobBi2a_OpenSciUsbCdc_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_Create_t aioIobBi2aVFG_Create_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetMechType_t aioIobBi2aVFG_SetMechType_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_GetDeviceStatus_t aioIobBi2aVFG_GetDeviceStatus_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetWatchDogTimer_t aioIobBi2aVFG_SetWatchDogTimer_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_ControlCoinBlocker_t aioIobBi2aVFG_ControlCoinBlocker_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_AddCounter_t aioIobBi2aVFG_AddCounter_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetAmpVolume_t aioIobBi2aVFG_SetAmpVolume_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_EnableUsbCharger_t aioIobBi2aVFG_EnableUsbCharger_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetLamp_t aioIobBi2aVFG_SetLamp_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetIccrLed_t aioIobBi2aVFG_SetIccrLed_orig = nullptr;
|
||||||
|
static aioIobBi2aVFG_SetLedData_t aioIobBi2aVFG_SetLedData_orig = nullptr;
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
static aioNMgrIob_Create_t aioNMgrIob_Create_orig = nullptr;
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
static aioNodeMgr_Destroy_t aioNodeMgr_Destroy_orig = nullptr;
|
||||||
|
static aioNodeMgr_GetState_t aioNodeMgr_GetState_orig = nullptr;
|
||||||
|
static aioNodeMgr_IsReady_t aioNodeMgr_IsReady_orig = nullptr;
|
||||||
|
static aioNodeMgr_IsError_t aioNodeMgr_IsError_orig = nullptr;
|
||||||
|
static aioNodeCtl_Destroy_t aioNodeCtl_Destroy_orig = nullptr;
|
||||||
|
static aioNodeCtl_GetState_t aioNodeCtl_GetState_orig = nullptr;
|
||||||
|
static aioNodeCtl_IsReady_t aioNodeCtl_IsReady_orig = nullptr;
|
||||||
|
static aioNodeCtl_IsError_t aioNodeCtl_IsError_orig = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
static AIO_SCI_COMM *aioSciComm;
|
||||||
|
static AIO_NMGR_IOB *aioNmgrIob;
|
||||||
|
static AIO_IOB_BI2A_VFG *aioIobBi2aVfg;
|
||||||
|
static uint8_t mechType = 0;
|
||||||
|
static uint8_t count = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* implementations
|
||||||
|
*/
|
||||||
|
|
||||||
|
static AIO_SCI_COMM* __fastcall aioIob2Bi2a_OpenSciUsbCdc(uint32_t i_SerialNumber) {
|
||||||
|
log_info("bi2a_hook", "aioIob2Bi2a_OpenSciUsbCdc hook hit");
|
||||||
|
aioSciComm = new AIO_SCI_COMM;
|
||||||
|
return aioSciComm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIO_IOB_BI2A_VFG* __fastcall aioIobBi2aVFG_Create(AIO_NMGR_IOB *i_pNodeMgr, uint32_t i_DevId) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob) {
|
||||||
|
log_info("bi2a_hook", "node created");
|
||||||
|
aioIobBi2aVfg = new AIO_IOB_BI2A_VFG;
|
||||||
|
return aioIobBi2aVfg;
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_Create_orig(i_pNodeMgr, i_DevId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetMechType(AIO_IOB_BI2A_VFG *i_pNodeCtl, uint32_t i_MechType) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
mechType = i_MechType;
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetMechType_orig(i_pNodeCtl, i_MechType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_GetDeviceStatus(AIO_IOB_BI2A_VFG* i_pNodeCtl,
|
||||||
|
AIO_IOB_BI2A_VFG__DEVSTATUS *o_pDevStatus,
|
||||||
|
uint32_t i_cbDevStatus) {
|
||||||
|
|
||||||
|
RI_MGR->devices_flush_output();
|
||||||
|
|
||||||
|
if (i_pNodeCtl != aioIobBi2aVfg) {
|
||||||
|
return aioIobBi2aVFG_GetDeviceStatus_orig(i_pNodeCtl, o_pDevStatus, i_cbDevStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(o_pDevStatus, 0x00, sizeof(AIO_IOB_BI2A_VFG__DEVSTATUS));
|
||||||
|
|
||||||
|
o_pDevStatus->MechType = mechType;
|
||||||
|
o_pDevStatus->bIsBi2a = 1;
|
||||||
|
o_pDevStatus->IoCounter = count++;
|
||||||
|
|
||||||
|
auto &buttons = get_buttons();
|
||||||
|
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Test]))
|
||||||
|
o_pDevStatus->Input.bTest = 1;
|
||||||
|
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Service]))
|
||||||
|
o_pDevStatus->Input.bService = 1;
|
||||||
|
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::CoinMech]))
|
||||||
|
o_pDevStatus->Input.bCoinSw = 1;
|
||||||
|
|
||||||
|
o_pDevStatus->Input.CoinCount = eamuse_coin_get_stock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetWatchDogTimer(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint16_t i_Count) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetWatchDogTimer_orig(i_pNodeCtl, i_Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_ControlCoinBlocker(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Slot, bool i_bOpen) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_ControlCoinBlocker_orig(i_pNodeCtl, i_Slot, i_bOpen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_AddCounter(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Counter, uint32_t i_Count) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_AddCounter_orig(i_pNodeCtl, i_Counter, i_Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetAmpVolume(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Amp, uint32_t i_Volume) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetAmpVolume_orig(i_pNodeCtl, i_Amp, i_Volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_EnableUsbCharger(AIO_IOB_BI2A_VFG* i_pNodeCtl, bool i_bEnable) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_EnableUsbCharger_orig(i_pNodeCtl, i_bEnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetLamp(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_Lamp, uint8_t i_Bright) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetLamp_orig(i_pNodeCtl, i_Lamp, i_Bright);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetIccrLed(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint32_t i_RGB) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetIccrLed_orig(i_pNodeCtl, i_RGB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIobBi2aVFG_SetLedData(AIO_IOB_BI2A_VFG* i_pNodeCtl, uint8_t *i_pData, uint32_t i_cbData) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
} else {
|
||||||
|
return aioIobBi2aVFG_SetLedData_orig(i_pNodeCtl, i_pData, i_cbData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIO_NMGR_IOB* __fastcall aioNMgrIob_Create(AIO_SCI_COMM *i_pSci, uint32_t i_bfMode) {
|
||||||
|
if (i_pSci == aioSciComm) {
|
||||||
|
aioNmgrIob = new AIO_NMGR_IOB;
|
||||||
|
return aioNmgrIob;
|
||||||
|
} else {
|
||||||
|
return aioNMgrIob_Create_orig(i_pSci, i_bfMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioNodeMgr_Destroy(AIO_NMGR_IOB *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob) {
|
||||||
|
delete aioNmgrIob;
|
||||||
|
aioNmgrIob = nullptr;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_Destroy_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t __fastcall aioNodeMgr_GetState(AIO_NMGR_IOB *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_GetState_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeMgr_IsReady(AIO_NMGR_IOB *i_pNodeMgr, int32_t i_State) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_IsReady_orig(i_pNodeMgr, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeMgr_IsError(AIO_NMGR_IOB *i_pNodeMgr, int32_t i_State) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_IsError_orig(i_pNodeMgr, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioNodeCtl_Destroy(AIO_IOB_BI2A_VFG *i_pNodeCtl) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
delete aioIobBi2aVfg;
|
||||||
|
aioIobBi2aVfg = nullptr;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_Destroy_orig(i_pNodeCtl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t __fastcall aioNodeCtl_GetState(AIO_IOB_BI2A_VFG *i_pNodeCtl) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_GetState_orig(i_pNodeCtl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeCtl_IsReady(AIO_IOB_BI2A_VFG *i_pNodeCtl, int32_t i_State) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_IsReady_orig(i_pNodeCtl, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeCtl_IsError(AIO_IOB_BI2A_VFG *i_pNodeCtl, int32_t i_State) {
|
||||||
|
if (i_pNodeCtl == aioIobBi2aVfg) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_IsError_orig(i_pNodeCtl, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bi2a_hook_init() {
|
||||||
|
// avoid double init
|
||||||
|
static bool initialized = false;
|
||||||
|
if (initialized) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// announce
|
||||||
|
log_info("bi2a_hook", "init");
|
||||||
|
|
||||||
|
// libaio-iob_video.dll
|
||||||
|
const auto libaioIobVideoDll = "libaio-iob_video.dll";
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2a_OpenSciUsbCdc",
|
||||||
|
aioIob2Bi2a_OpenSciUsbCdc, &aioIobBi2a_OpenSciUsbCdc_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_Create",
|
||||||
|
aioIobBi2aVFG_Create, &aioIobBi2aVFG_Create_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetMechType",
|
||||||
|
aioIobBi2aVFG_SetMechType, &aioIobBi2aVFG_SetMechType_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_GetDeviceStatus",
|
||||||
|
aioIobBi2aVFG_GetDeviceStatus, &aioIobBi2aVFG_GetDeviceStatus_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetWatchDogTimer",
|
||||||
|
aioIobBi2aVFG_SetWatchDogTimer, &aioIobBi2aVFG_SetWatchDogTimer_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_ControlCoinBlocker",
|
||||||
|
aioIobBi2aVFG_ControlCoinBlocker, &aioIobBi2aVFG_ControlCoinBlocker_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_AddCounter",
|
||||||
|
aioIobBi2aVFG_AddCounter, &aioIobBi2aVFG_AddCounter_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetAmpVolume",
|
||||||
|
aioIobBi2aVFG_SetAmpVolume, &aioIobBi2aVFG_SetAmpVolume_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_EnableUsbCharger",
|
||||||
|
aioIobBi2aVFG_EnableUsbCharger, &aioIobBi2aVFG_EnableUsbCharger_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetLamp",
|
||||||
|
aioIobBi2aVFG_SetLamp, &aioIobBi2aVFG_SetLamp_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetIccrLed",
|
||||||
|
aioIobBi2aVFG_SetIccrLed, &aioIobBi2aVFG_SetIccrLed_orig);
|
||||||
|
execexe::trampoline_try(libaioIobVideoDll, "aioIobBi2aVFG_SetLedData",
|
||||||
|
aioIobBi2aVFG_SetLedData, &aioIobBi2aVFG_SetLedData_orig);
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
const auto libaioIobDll = "libaio-iob.dll";
|
||||||
|
execexe::trampoline_try(libaioIobDll, "aioNMgrIob_Create",
|
||||||
|
aioNMgrIob_Create, &aioNMgrIob_Create_orig);
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
const auto libaioDll = "libaio.dll";
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_Destroy",
|
||||||
|
aioNodeMgr_Destroy, &aioNodeMgr_Destroy_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_GetState",
|
||||||
|
aioNodeMgr_GetState, &aioNodeMgr_GetState_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_IsReady",
|
||||||
|
aioNodeMgr_IsReady, &aioNodeMgr_IsReady_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_IsError",
|
||||||
|
aioNodeMgr_IsError, &aioNodeMgr_IsError_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_Destroy",
|
||||||
|
aioNodeCtl_Destroy, &aioNodeCtl_Destroy_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_GetState",
|
||||||
|
aioNodeCtl_GetState, &aioNodeCtl_GetState_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_IsReady",
|
||||||
|
aioNodeCtl_IsReady, &aioNodeCtl_IsReady_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_IsError",
|
||||||
|
aioNodeCtl_IsError, &aioNodeCtl_IsError_orig);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace games::mfg {
|
||||||
|
void bi2a_hook_init();
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "io.h"
|
||||||
|
|
||||||
|
std::vector<Button> &games::mfg::get_buttons() {
|
||||||
|
static std::vector<Button> buttons;
|
||||||
|
|
||||||
|
if (buttons.empty()) {
|
||||||
|
buttons = GameAPI::Buttons::getButtons("Mahjong Fight Girl");
|
||||||
|
|
||||||
|
GameAPI::Buttons::sortButtons(
|
||||||
|
&buttons,
|
||||||
|
"Service",
|
||||||
|
"Test",
|
||||||
|
"Coin Mech"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string games::mfg::get_buttons_help() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "cfg/api.h"
|
||||||
|
|
||||||
|
namespace games::mfg {
|
||||||
|
namespace Buttons {
|
||||||
|
enum {
|
||||||
|
Service,
|
||||||
|
Test,
|
||||||
|
CoinMech
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// getters
|
||||||
|
std::vector<Button> &get_buttons();
|
||||||
|
std::string get_buttons_help();
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#include "mfg.h"
|
||||||
|
|
||||||
|
#include <format>
|
||||||
|
#include "util/fileutils.h"
|
||||||
|
#include "util/unity_player.h"
|
||||||
|
#include "util/utils.h"
|
||||||
|
#include "util/execexe.h"
|
||||||
|
#include "acioemu/handle.h"
|
||||||
|
#include "misc/wintouchemu.h"
|
||||||
|
#include "hooks/graphics/graphics.h"
|
||||||
|
#include "bi2a_hook.h"
|
||||||
|
|
||||||
|
namespace games::mfg {
|
||||||
|
std::string MFG_INJECT_ARGS = "";
|
||||||
|
std::string MFG_CABINET_TYPE = "HG";
|
||||||
|
bool MFG_NO_IO = false;
|
||||||
|
|
||||||
|
static acioemu::ACIOHandle *acioHandle = nullptr;
|
||||||
|
static std::wstring portName;
|
||||||
|
|
||||||
|
void MFGGame::attach() {
|
||||||
|
Game::attach();
|
||||||
|
|
||||||
|
// create required files
|
||||||
|
fileutils::dir_create_recursive("dev/raw/log");
|
||||||
|
fileutils::bin_write("dev/raw/log/output_log.txt", nullptr, 0);
|
||||||
|
|
||||||
|
SetEnvironmentVariableA("VFG_CABINET_TYPE", MFG_CABINET_TYPE.c_str());
|
||||||
|
|
||||||
|
// add card reader
|
||||||
|
portName = (MFG_CABINET_TYPE == "UKS") ? std::wstring(L"\\\\.\\COM1") : std::wstring(L"\\\\.\\COM3");
|
||||||
|
acioHandle = new acioemu::ACIOHandle(portName.c_str(), 1);
|
||||||
|
devicehook_init_trampoline();
|
||||||
|
devicehook_add(acioHandle);
|
||||||
|
|
||||||
|
execexe::init();
|
||||||
|
execexe::init_port_hook(portName, acioHandle);
|
||||||
|
|
||||||
|
if (GRAPHICS_SHOW_CURSOR) {
|
||||||
|
unity_utils::force_show_cursor(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unity_utils::set_args(
|
||||||
|
std::format("{} {}{}",
|
||||||
|
GetCommandLineA(),
|
||||||
|
MFG_INJECT_ARGS,
|
||||||
|
unity_utils::get_unity_player_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MFGGame::post_attach() {
|
||||||
|
Game::post_attach();
|
||||||
|
|
||||||
|
execexe::load_library("libaio.dll");
|
||||||
|
execexe::load_library("libaio-iob.dll");
|
||||||
|
execexe::load_library("libaio-iob_video.dll");
|
||||||
|
execexe::load_library("libaio-iob2_video.dll");
|
||||||
|
execexe::load_library("win10actlog.dll");
|
||||||
|
|
||||||
|
if (!MFG_NO_IO) {
|
||||||
|
// insert BI2* hooks
|
||||||
|
if (MFG_CABINET_TYPE == "UKS") {
|
||||||
|
log_fatal("mfg", "UKS io is not supported");
|
||||||
|
} else {
|
||||||
|
bi2a_hook_init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MFGGame::detach() {
|
||||||
|
Game::detach();
|
||||||
|
|
||||||
|
devicehook_dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "games/game.h"
|
||||||
|
|
||||||
|
namespace games::mfg {
|
||||||
|
extern std::string MFG_INJECT_ARGS;
|
||||||
|
extern std::string MFG_CABINET_TYPE;
|
||||||
|
extern bool MFG_NO_IO;
|
||||||
|
|
||||||
|
class MFGGame : public games::Game {
|
||||||
|
public:
|
||||||
|
MFGGame() : Game("Mahjong Fight Girl") {}
|
||||||
|
|
||||||
|
virtual void attach() override;
|
||||||
|
virtual void post_attach() override;
|
||||||
|
virtual void detach() override;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -71,6 +71,8 @@ std::vector<Light> &games::museca::get_lights() {
|
|||||||
|
|
||||||
GameAPI::Lights::sortLights(
|
GameAPI::Lights::sortLights(
|
||||||
&lights,
|
&lights,
|
||||||
|
"Start",
|
||||||
|
"Keypad",
|
||||||
"Title R",
|
"Title R",
|
||||||
"Title G",
|
"Title G",
|
||||||
"Title B",
|
"Title B",
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ namespace games::museca {
|
|||||||
// all lights in correct order
|
// all lights in correct order
|
||||||
namespace Lights {
|
namespace Lights {
|
||||||
enum {
|
enum {
|
||||||
|
Start,
|
||||||
|
Keypad,
|
||||||
TitleR,
|
TitleR,
|
||||||
TitleG,
|
TitleG,
|
||||||
TitleB,
|
TitleB,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace games::otoca {
|
|||||||
bool kb_insert_press = false;
|
bool kb_insert_press = false;
|
||||||
|
|
||||||
// eamio keypress
|
// eamio keypress
|
||||||
kb_insert_press |= eamuse_get_keypad_state(0) & (1 << EAM_IO_INSERT);
|
kb_insert_press |= static_cast<bool>(eamuse_get_keypad_state(0) & (1 << EAM_IO_INSERT));
|
||||||
|
|
||||||
// check for card
|
// check for card
|
||||||
if (CARD_DATA == nullptr && (eamuse_card_insert_consume(1, 0) || kb_insert_press)) {
|
if (CARD_DATA == nullptr && (eamuse_card_insert_consume(1, 0) || kb_insert_press)) {
|
||||||
|
|||||||
@@ -0,0 +1,739 @@
|
|||||||
|
#include "bi2x_hook.h"
|
||||||
|
|
||||||
|
#include "util/execexe.h"
|
||||||
|
#include "util/logging.h"
|
||||||
|
#include "rawinput/rawinput.h"
|
||||||
|
#include "misc/eamuse.h"
|
||||||
|
#include "games/io.h"
|
||||||
|
#include "io.h"
|
||||||
|
#include "util/tapeled.h"
|
||||||
|
#include "pc.h"
|
||||||
|
#include "util/utils.h"
|
||||||
|
|
||||||
|
namespace games::pc {
|
||||||
|
bool PC_KNOB_MODE = false;
|
||||||
|
|
||||||
|
constexpr float RELATIVE_DECAY = 0.02f;
|
||||||
|
struct FADER_RELATIVE {
|
||||||
|
// ranges from 0.f to 1.f
|
||||||
|
float previous_raw = 0.5f;
|
||||||
|
|
||||||
|
// ranges from -1.f to +1.f
|
||||||
|
float effective_value = 0.f;
|
||||||
|
};
|
||||||
|
|
||||||
|
FADER_RELATIVE fader_l_relative;
|
||||||
|
FADER_RELATIVE fader_r_relative;
|
||||||
|
|
||||||
|
float calculate_analog_raw_delta(float old_value, float new_value) {
|
||||||
|
// assumed that values are between 0.f and 1.f
|
||||||
|
|
||||||
|
float delta = 0.f;
|
||||||
|
if ((old_value < 0.25f) && (0.75f < new_value)) {
|
||||||
|
// wrapped around: going left
|
||||||
|
delta = -((1.f - new_value) + old_value);
|
||||||
|
|
||||||
|
} else if ((new_value < 0.25f) && (0.75f < old_value)) {
|
||||||
|
// wrapped around: going right
|
||||||
|
delta = (1.f - old_value) + new_value;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
delta = new_value - old_value;
|
||||||
|
}
|
||||||
|
return delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
float apply_decay(float val) {
|
||||||
|
// return to center over time
|
||||||
|
if (RELATIVE_DECAY < val) {
|
||||||
|
return val - RELATIVE_DECAY;
|
||||||
|
} else if (val < -RELATIVE_DECAY) {
|
||||||
|
return val + RELATIVE_DECAY;
|
||||||
|
} else {
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_fader_knob_mode_value(float raw_analog, FADER_RELATIVE &fader) {
|
||||||
|
// add new value...
|
||||||
|
const float delta = calculate_analog_raw_delta(fader.previous_raw, raw_analog);
|
||||||
|
fader.effective_value += (delta * 20.f);
|
||||||
|
fader.previous_raw = raw_analog;
|
||||||
|
|
||||||
|
// capture the result after adding new input value
|
||||||
|
fader.effective_value = CLAMP(fader.effective_value, -1.f, 1.f);
|
||||||
|
const float result = fader.effective_value;
|
||||||
|
|
||||||
|
// post-process for next iteration: apply decay (return to center over time)
|
||||||
|
fader.effective_value = apply_decay(fader.effective_value);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* class definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct AIO_SCI_COMM {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_NMGR_IOB2 {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1 {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__SETTING {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_WRFIRM {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__INPUT
|
||||||
|
{
|
||||||
|
uint8_t DevIoCounter;
|
||||||
|
uint8_t bExIoAErr;
|
||||||
|
uint8_t bExIoBErr;
|
||||||
|
uint8_t bPcPowerOn;
|
||||||
|
uint8_t bPcPowerCheck;
|
||||||
|
uint8_t bCoin1Jam;
|
||||||
|
uint8_t bCoin2Jam;
|
||||||
|
uint8_t bCoin3Jam;
|
||||||
|
uint8_t bCoin4Jam;
|
||||||
|
uint8_t Coin1Count;
|
||||||
|
uint8_t Coin2Count;
|
||||||
|
uint8_t Coin3Count;
|
||||||
|
uint8_t Coin4Count;
|
||||||
|
uint16_t AnalogCh1;
|
||||||
|
uint16_t AnalogCh2;
|
||||||
|
uint16_t AnalogCh3;
|
||||||
|
uint16_t AnalogCh4;
|
||||||
|
uint8_t CN8_8;
|
||||||
|
uint8_t CN8_9;
|
||||||
|
uint8_t CN8_10;
|
||||||
|
uint8_t CN9_8;
|
||||||
|
uint8_t CN9_9;
|
||||||
|
uint8_t CN9_10;
|
||||||
|
uint8_t CN11_11;
|
||||||
|
uint8_t CN11_12;
|
||||||
|
uint8_t CN11_13;
|
||||||
|
uint8_t CN11_14;
|
||||||
|
uint8_t CN11_15;
|
||||||
|
uint8_t CN11_16;
|
||||||
|
uint8_t CN11_17;
|
||||||
|
uint8_t CN11_18;
|
||||||
|
uint8_t CN11_19;
|
||||||
|
uint8_t CN11_20;
|
||||||
|
uint8_t CN12_11;
|
||||||
|
uint8_t CN12_12;
|
||||||
|
uint8_t CN12_13;
|
||||||
|
uint8_t CN12_14;
|
||||||
|
uint8_t CN12_15;
|
||||||
|
uint8_t CN12_16;
|
||||||
|
uint8_t CN12_17;
|
||||||
|
uint8_t CN12_18;
|
||||||
|
uint8_t CN12_19;
|
||||||
|
uint8_t CN12_20;
|
||||||
|
uint8_t CN12_21;
|
||||||
|
uint8_t CN12_22;
|
||||||
|
uint8_t CN12_23;
|
||||||
|
uint8_t CN12_24;
|
||||||
|
uint8_t CN15_3;
|
||||||
|
uint8_t CN15_4;
|
||||||
|
uint8_t CN15_5;
|
||||||
|
uint8_t CN15_6;
|
||||||
|
uint8_t CN15_7;
|
||||||
|
uint8_t CN15_8;
|
||||||
|
uint8_t CN15_9;
|
||||||
|
uint8_t CN15_10;
|
||||||
|
uint8_t CN15_11;
|
||||||
|
uint8_t CN15_12;
|
||||||
|
uint8_t CN15_13;
|
||||||
|
uint8_t CN15_14;
|
||||||
|
uint8_t CN15_15;
|
||||||
|
uint8_t CN15_16;
|
||||||
|
uint8_t CN15_17;
|
||||||
|
uint8_t CN15_18;
|
||||||
|
uint8_t CN15_19;
|
||||||
|
uint8_t CN15_20;
|
||||||
|
uint8_t CN19_8;
|
||||||
|
uint8_t CN19_9;
|
||||||
|
uint8_t CN19_10;
|
||||||
|
uint8_t CN19_11;
|
||||||
|
uint8_t CN19_12;
|
||||||
|
uint8_t CN19_13;
|
||||||
|
uint8_t CN19_14;
|
||||||
|
uint8_t CN19_15;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__INPUTDATA {
|
||||||
|
uint8_t data[247];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__OUTPUTDATA {
|
||||||
|
uint8_t data[48];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__ICNPIN {
|
||||||
|
uint16_t Ain[4];
|
||||||
|
uint64_t CnPin;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AIO_IOB2_BI2X_AC1__DEVSTATUS {
|
||||||
|
uint8_t InputCounter;
|
||||||
|
uint8_t OutputCounter;
|
||||||
|
uint8_t IoResetCounter;
|
||||||
|
uint8_t TapeLedCounter;
|
||||||
|
uint8_t TapeLedRate[8];
|
||||||
|
AIO_IOB2_BI2X_AC1__INPUT Input;
|
||||||
|
AIO_IOB2_BI2X_AC1__INPUTDATA InputData;
|
||||||
|
AIO_IOB2_BI2X_AC1__OUTPUTDATA OutputData;
|
||||||
|
AIO_IOB2_BI2X_AC1__ICNPIN ICnPinHist[20];
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* typedefs
|
||||||
|
*/
|
||||||
|
|
||||||
|
// libaio-iob2_video.dll
|
||||||
|
typedef AIO_IOB2_BI2X_AC1* (__fastcall *aioIob2Bi2xAC1_Create_t)(AIO_NMGR_IOB2 *i_pNodeMgr, uint32_t i_DevId,
|
||||||
|
AIO_IOB2_BI2X_AC1__SETTING *i_Setting);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2xAC1_GetDeviceStatus_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl,
|
||||||
|
AIO_IOB2_BI2X_AC1__DEVSTATUS *o_DevStatus);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2xAC1_SetWatchDogTimer_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint8_t i_Count);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2xAC1_AddCounter_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_Counter,
|
||||||
|
uint32_t i_Count);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2xAC1_SetOutputData_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_CnPin,
|
||||||
|
uint8_t i_Data);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2xAC1_SetTapeLedDataPart_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_TapeLedCh,
|
||||||
|
uint32_t i_Offset, uint8_t *i_pData,
|
||||||
|
uint32_t i_cntTapeLed, bool i_bReverse);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2x_SetTapeLedDataGroup_t)(AIO_IOB2_BI2X_AC1* i_pNodeCtl, uint32_t i_bfGroup);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2x_SetTapeLedDataLimit_t)(AIO_IOB2_BI2X_AC1* i_pNodeCtl, uint32_t i_Channel,
|
||||||
|
uint8_t i_Scale, uint8_t i_Limit);
|
||||||
|
typedef AIO_IOB2_BI2X_WRFIRM *(__fastcall *aioIob2Bi2x_CreateWriteFirmContext_t)(uint32_t i_SerialNumber,
|
||||||
|
uint32_t i_bfIob);
|
||||||
|
typedef AIO_SCI_COMM* (__fastcall *aioIob2Bi2x_OpenSciUsbCdc_t)(uint32_t i_SerialNumber);
|
||||||
|
typedef void (__fastcall *aioIob2Bi2x_DestroyWriteFirmContext_t)(AIO_IOB2_BI2X_WRFIRM *i_pWrFirm);
|
||||||
|
typedef int32_t (__fastcall *aioIob2Bi2x_WriteFirmGetState_t)(AIO_IOB2_BI2X_WRFIRM *i_pWrFirm);
|
||||||
|
typedef bool (__fastcall *aioIob2Bi2x_WriteFirmIsCompleted_t)(int32_t i_State);
|
||||||
|
typedef bool (__fastcall *aioIob2Bi2x_WriteFirmIsError_t)(int32_t i_State);
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
typedef AIO_NMGR_IOB2 *(__fastcall *aioNMgrIob2_Create_t)(AIO_SCI_COMM *i_pSci, uint32_t i_bfMode);
|
||||||
|
typedef void (__fastcall *aioNMgrIob_BeginManage_t)(AIO_NMGR_IOB2 *i_pNodeMgr);
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
typedef void (__fastcall *aioSci_Destroy_t)(AIO_SCI_COMM *i_pNodeMgr);
|
||||||
|
typedef void (__fastcall *aioNodeMgr_Destroy_t)(AIO_NMGR_IOB2 *i_pNodeMgr);
|
||||||
|
typedef int32_t (__fastcall *aioNodeMgr_GetState_t)(AIO_NMGR_IOB2 *i_pNodeMgr);
|
||||||
|
typedef bool (__fastcall *aioNodeMgr_IsReady_t)(AIO_NMGR_IOB2 *i_pNodeMgr, int32_t i_State);
|
||||||
|
typedef bool (__fastcall *aioNodeMgr_IsError_t)(AIO_NMGR_IOB2 *i_pNodeMgr, int32_t i_State);
|
||||||
|
typedef void (__fastcall *aioNodeCtl_Destroy_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl);
|
||||||
|
typedef int32_t (__fastcall *aioNodeCtl_GetState_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl);
|
||||||
|
typedef bool (__fastcall *aioNodeCtl_IsReady_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, int32_t i_State);
|
||||||
|
typedef bool (__fastcall *aioNodeCtl_IsError_t)(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, int32_t i_State);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function pointers
|
||||||
|
*/
|
||||||
|
|
||||||
|
// libaio-iob2_video.dll
|
||||||
|
static aioIob2Bi2xAC1_Create_t aioIob2Bi2xAC1_Create_orig = nullptr;
|
||||||
|
static aioIob2Bi2xAC1_GetDeviceStatus_t aioIob2Bi2xAC1_GetDeviceStatus_orig = nullptr;
|
||||||
|
static aioIob2Bi2xAC1_SetWatchDogTimer_t aioIob2Bi2xAC1_SetWatchDogTimer_orig = nullptr;
|
||||||
|
static aioIob2Bi2xAC1_AddCounter_t aioIob2Bi2xAC1_AddCounter_orig = nullptr;
|
||||||
|
static aioIob2Bi2xAC1_SetOutputData_t aioIob2Bi2xAC1_SetOutputData_orig = nullptr;
|
||||||
|
static aioIob2Bi2xAC1_SetTapeLedDataPart_t aioIob2Bi2xAC1_SetTapeLedDataPart_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_SetTapeLedDataGroup_t aioIob2Bi2x_SetTapeLedDataGroup_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_SetTapeLedDataLimit_t aioIob2Bi2x_SetTapeLedDataLimit_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_OpenSciUsbCdc_t aioIob2Bi2x_OpenSciUsbCdc_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_CreateWriteFirmContext_t aioIob2Bi2x_CreateWriteFirmContext_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_DestroyWriteFirmContext_t aioIob2Bi2x_DestroyWriteFirmContext_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_WriteFirmGetState_t aioIob2Bi2x_WriteFirmGetState_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_WriteFirmIsCompleted_t aioIob2Bi2x_WriteFirmIsCompleted_orig = nullptr;
|
||||||
|
static aioIob2Bi2x_WriteFirmIsError_t aioIob2Bi2x_WriteFirmIsError_orig = nullptr;
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
static aioNMgrIob2_Create_t aioNMgrIob2_Create_orig = nullptr;
|
||||||
|
static aioNMgrIob_BeginManage_t aioNMgrIob_BeginManage_orig = nullptr;
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
static aioSci_Destroy_t aioSci_Destroy_orig = nullptr;
|
||||||
|
static aioNodeMgr_Destroy_t aioNodeMgr_Destroy_orig = nullptr;
|
||||||
|
static aioNodeMgr_GetState_t aioNodeMgr_GetState_orig = nullptr;
|
||||||
|
static aioNodeMgr_IsReady_t aioNodeMgr_IsReady_orig = nullptr;
|
||||||
|
static aioNodeMgr_IsError_t aioNodeMgr_IsError_orig = nullptr;
|
||||||
|
static aioNodeCtl_Destroy_t aioNodeCtl_Destroy_orig = nullptr;
|
||||||
|
static aioNodeCtl_GetState_t aioNodeCtl_GetState_orig = nullptr;
|
||||||
|
static aioNodeCtl_IsReady_t aioNodeCtl_IsReady_orig = nullptr;
|
||||||
|
static aioNodeCtl_IsError_t aioNodeCtl_IsError_orig = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
static AIO_IOB2_BI2X_AC1 *aioIob2Bi2xAc1;
|
||||||
|
static AIO_SCI_COMM *aioSciComm;
|
||||||
|
static AIO_NMGR_IOB2 *aioNmgrIob2;
|
||||||
|
static AIO_IOB2_BI2X_WRFIRM *aioIob2Bi2xWrfirm;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* implementations
|
||||||
|
*/
|
||||||
|
|
||||||
|
// libaio-iob2_video.dll
|
||||||
|
|
||||||
|
static AIO_IOB2_BI2X_AC1* __fastcall aioIob2Bi2xAC1_Create(AIO_NMGR_IOB2 *i_pNodeMgr, uint32_t i_DevId,
|
||||||
|
AIO_IOB2_BI2X_AC1__SETTING *i_Setting) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob2) {
|
||||||
|
log_info("bi2x_hook", "aioIob2Bi2xAC1_Create hook hit");
|
||||||
|
aioIob2Bi2xAc1 = new AIO_IOB2_BI2X_AC1;
|
||||||
|
return aioIob2Bi2xAc1;
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2xAC1_Create_orig(i_pNodeMgr, i_DevId, i_Setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2xAC1_GetDeviceStatus(AIO_IOB2_BI2X_AC1 *i_pNodeCtl,
|
||||||
|
AIO_IOB2_BI2X_AC1__DEVSTATUS *o_DevStatus) {
|
||||||
|
RI_MGR->devices_flush_output();
|
||||||
|
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2xAC1_GetDeviceStatus_orig(i_pNodeCtl, o_DevStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(o_DevStatus, 0x00, sizeof(AIO_IOB2_BI2X_AC1__DEVSTATUS));
|
||||||
|
|
||||||
|
auto &buttons = get_buttons();
|
||||||
|
o_DevStatus->Input.CN8_8 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Test]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN8_9 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Service]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN8_10 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::CoinMech]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN15_10 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Headphone]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN15_12 = 0xFF; // Recorder off; present in I/O test menu but unused in game
|
||||||
|
|
||||||
|
o_DevStatus->Input.CN12_11 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button1]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_12 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button2]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_13 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button3]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_14 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button4]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_15 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button5]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_16 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button6]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_17 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button7]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_18 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button8]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_19 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button9]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_20 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button10]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_21 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button11]) ? 0 : 0xFF;
|
||||||
|
o_DevStatus->Input.CN12_22 = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Button12]) ? 0 : 0xFF;
|
||||||
|
|
||||||
|
auto &analogs = get_analogs();
|
||||||
|
|
||||||
|
// FADER-L
|
||||||
|
float val = 0.f;
|
||||||
|
if (analogs[Analogs::FaderL].isSet()) {
|
||||||
|
if (PC_KNOB_MODE) {
|
||||||
|
val = get_fader_knob_mode_value(
|
||||||
|
GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::FaderL]),
|
||||||
|
fader_l_relative);
|
||||||
|
} else {
|
||||||
|
val = (GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::FaderL]) - 0.5f) * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderL_Left]) &&
|
||||||
|
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderL_Right])) {
|
||||||
|
val = 0.f;
|
||||||
|
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderL_Left])) {
|
||||||
|
val = -1.0f;
|
||||||
|
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderL_Right])) {
|
||||||
|
val = +1.0f;
|
||||||
|
}
|
||||||
|
o_DevStatus->Input.CN15_7 = (val < 0.2f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN15_6 = (val > -0.85f && val < 0.35f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN15_5 = (val > -0.6f && val < 0.6f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN15_4 = (val > -0.35f && val < 0.85f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN15_3 = (val > -0.2f) ? 0xFF : 0;
|
||||||
|
|
||||||
|
// FADER-R
|
||||||
|
val = 0.f;
|
||||||
|
if (analogs[Analogs::FaderR].isSet()) {
|
||||||
|
if (PC_KNOB_MODE) {
|
||||||
|
val = get_fader_knob_mode_value(
|
||||||
|
GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::FaderR]),
|
||||||
|
fader_r_relative);
|
||||||
|
} else {
|
||||||
|
val = (GameAPI::Analogs::getState(RI_MGR, analogs[Analogs::FaderR]) - 0.5f) * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderR_Left]) &&
|
||||||
|
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderR_Right])) {
|
||||||
|
val = 0.f;
|
||||||
|
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderR_Left])) {
|
||||||
|
val = -1.0f;
|
||||||
|
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::FaderR_Right])) {
|
||||||
|
val = +1.0f;
|
||||||
|
}
|
||||||
|
o_DevStatus->Input.CN11_20 = (val < 0.2f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN11_19 = (val > -0.85f && val < 0.35f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN9_10 = (val > -0.6f && val < 0.6f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN9_9 = (val > -0.35f && val < 0.85f) ? 0xFF : 0;
|
||||||
|
o_DevStatus->Input.CN9_8 = (val > -0.2f) ? 0xFF : 0;
|
||||||
|
|
||||||
|
// coin
|
||||||
|
o_DevStatus->Input.Coin1Count = eamuse_coin_get_stock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2xAC1_SetWatchDogTimer(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint8_t i_Count) {
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2xAC1_SetWatchDogTimer_orig(i_pNodeCtl, i_Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2xAC1_AddCounter(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_Counter, uint32_t i_Count) {
|
||||||
|
if (i_pNodeCtl == aioIob2Bi2xAc1 && i_Count == 0) {
|
||||||
|
eamuse_coin_set_stock((uint16_t) i_Count);
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2xAC1_AddCounter_orig(i_pNodeCtl, i_Counter, i_Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2xAC1_SetOutputData(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_CnPin, uint8_t i_Data) {
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2xAC1_SetOutputData_orig(i_pNodeCtl, i_CnPin, i_Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i_CnPin == 0x1) {
|
||||||
|
eamuse_coin_set_block(i_Data == 0xFF);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto &lights = get_lights();
|
||||||
|
if (i_CnPin == 0x11) {
|
||||||
|
GameAPI::Lights::writeLight(RI_MGR, lights.at(Lights::IC_READER_R), i_Data / 255.0f);
|
||||||
|
} else if (i_CnPin == 0x12) {
|
||||||
|
GameAPI::Lights::writeLight(RI_MGR, lights.at(Lights::IC_READER_G), i_Data / 255.0f);
|
||||||
|
} else if (i_CnPin == 0x13) {
|
||||||
|
GameAPI::Lights::writeLight(RI_MGR, lights.at(Lights::IC_READER_B), i_Data / 255.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PolarisChordLight {
|
||||||
|
int data_index;
|
||||||
|
games::pc::Lights::pc_lights_t light;
|
||||||
|
PolarisChordLight(
|
||||||
|
int data_index, games::pc::Lights::pc_lights_t light) :
|
||||||
|
data_index(data_index), light(light) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void set_led_value(games::pc::Lights::pc_lights_t light, uint8_t value) {
|
||||||
|
auto &lights = games::pc::get_lights();
|
||||||
|
GameAPI::Lights::writeLight(RI_MGR, lights.at(light), value / 255.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2xAC1_SetTapeLedDataPart(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, uint32_t i_TapeLedCh,
|
||||||
|
uint32_t i_Offset, uint8_t *i_pData,
|
||||||
|
uint32_t i_cntTapeLed, bool i_bReverse) {
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2xAC1_SetTapeLedDataPart_orig(i_pNodeCtl, i_TapeLedCh, i_Offset, i_pData, i_cntTapeLed, i_bReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
// log_info(
|
||||||
|
// "pc",
|
||||||
|
// "lamp [{}] [{}] = {},{},{}, cnt={}",
|
||||||
|
// i_TapeLedCh,
|
||||||
|
// i_Offset,
|
||||||
|
// i_pData[0], i_pData[1], i_pData[2],
|
||||||
|
// i_cntTapeLed);
|
||||||
|
|
||||||
|
// [channel 0]
|
||||||
|
// these are button lamps; there are 12 buttons (columns) with this layout:
|
||||||
|
//
|
||||||
|
// 0 5 8 11 14 16 | 18 20 22 25 28 31
|
||||||
|
// 1 6 9 12 15 17 | 19 21 23 26 29 32
|
||||||
|
// 2 7 10 13 | 24 27 30 33
|
||||||
|
// 3 | 34
|
||||||
|
// 4 | 35
|
||||||
|
//
|
||||||
|
// 36 RGB lamps * 3 = 108 LEDs
|
||||||
|
// each value ranges from [0, 255]
|
||||||
|
// (we only care about the top row)
|
||||||
|
|
||||||
|
static PolarisChordLight button_lights_mapping[] = {
|
||||||
|
{(0 * 3) + 0, games::pc::Lights::pc_lights_t::Button1_R},
|
||||||
|
{(0 * 3) + 1, games::pc::Lights::pc_lights_t::Button1_G},
|
||||||
|
{(0 * 3) + 2, games::pc::Lights::pc_lights_t::Button1_B},
|
||||||
|
|
||||||
|
{(5 * 3) + 0, games::pc::Lights::pc_lights_t::Button2_R},
|
||||||
|
{(5 * 3) + 1, games::pc::Lights::pc_lights_t::Button2_G},
|
||||||
|
{(5 * 3) + 2, games::pc::Lights::pc_lights_t::Button2_B},
|
||||||
|
|
||||||
|
{(8 * 3) + 0, games::pc::Lights::pc_lights_t::Button3_R},
|
||||||
|
{(8 * 3) + 1, games::pc::Lights::pc_lights_t::Button3_G},
|
||||||
|
{(8 * 3) + 2, games::pc::Lights::pc_lights_t::Button3_B},
|
||||||
|
|
||||||
|
{(11 * 3) + 0, games::pc::Lights::pc_lights_t::Button4_R},
|
||||||
|
{(11 * 3) + 1, games::pc::Lights::pc_lights_t::Button4_G},
|
||||||
|
{(11 * 3) + 2, games::pc::Lights::pc_lights_t::Button4_B},
|
||||||
|
|
||||||
|
{(14 * 3) + 0, games::pc::Lights::pc_lights_t::Button5_R},
|
||||||
|
{(14 * 3) + 1, games::pc::Lights::pc_lights_t::Button5_G},
|
||||||
|
{(14 * 3) + 2, games::pc::Lights::pc_lights_t::Button5_B},
|
||||||
|
|
||||||
|
{(16 * 3) + 0, games::pc::Lights::pc_lights_t::Button6_R},
|
||||||
|
{(16 * 3) + 1, games::pc::Lights::pc_lights_t::Button6_G},
|
||||||
|
{(16 * 3) + 2, games::pc::Lights::pc_lights_t::Button6_B},
|
||||||
|
|
||||||
|
{(18 * 3) + 0, games::pc::Lights::pc_lights_t::Button7_R},
|
||||||
|
{(18 * 3) + 1, games::pc::Lights::pc_lights_t::Button7_G},
|
||||||
|
{(18 * 3) + 2, games::pc::Lights::pc_lights_t::Button7_B},
|
||||||
|
|
||||||
|
{(20 * 3) + 0, games::pc::Lights::pc_lights_t::Button8_R},
|
||||||
|
{(20 * 3) + 1, games::pc::Lights::pc_lights_t::Button8_G},
|
||||||
|
{(20 * 3) + 2, games::pc::Lights::pc_lights_t::Button8_B},
|
||||||
|
|
||||||
|
{(22 * 3) + 0, games::pc::Lights::pc_lights_t::Button9_R},
|
||||||
|
{(22 * 3) + 1, games::pc::Lights::pc_lights_t::Button9_G},
|
||||||
|
{(22 * 3) + 2, games::pc::Lights::pc_lights_t::Button9_B},
|
||||||
|
|
||||||
|
{(25 * 3) + 0, games::pc::Lights::pc_lights_t::Button10_R},
|
||||||
|
{(25 * 3) + 1, games::pc::Lights::pc_lights_t::Button10_G},
|
||||||
|
{(25 * 3) + 2, games::pc::Lights::pc_lights_t::Button10_B},
|
||||||
|
|
||||||
|
{(28 * 3) + 0, games::pc::Lights::pc_lights_t::Button11_R},
|
||||||
|
{(28 * 3) + 1, games::pc::Lights::pc_lights_t::Button11_G},
|
||||||
|
{(28 * 3) + 2, games::pc::Lights::pc_lights_t::Button11_B},
|
||||||
|
|
||||||
|
{(31 * 3) + 0, games::pc::Lights::pc_lights_t::Button12_R},
|
||||||
|
{(31 * 3) + 1, games::pc::Lights::pc_lights_t::Button12_G},
|
||||||
|
{(31 * 3) + 2, games::pc::Lights::pc_lights_t::Button12_B},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (i_TapeLedCh == 0 && i_Offset == 0 && i_cntTapeLed == 108) {
|
||||||
|
for (const auto &map : button_lights_mapping) {
|
||||||
|
set_led_value(map.light, i_pData[map.data_index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2x_SetTapeLedDataGroup(AIO_IOB2_BI2X_AC1* i_pNodeCtl, uint32_t i_bfGroup) {
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2x_SetTapeLedDataGroup_orig(i_pNodeCtl, i_bfGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall aioIob2Bi2x_SetTapeLedDataLimit(AIO_IOB2_BI2X_AC1* i_pNodeCtl, uint32_t i_Channel,
|
||||||
|
uint8_t i_Scale, uint8_t i_Limit) {
|
||||||
|
if (i_pNodeCtl != aioIob2Bi2xAc1) {
|
||||||
|
return aioIob2Bi2x_SetTapeLedDataLimit_orig(i_pNodeCtl, i_Channel, i_Scale, i_Limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIO_SCI_COMM *__fastcall aioIob2Bi2x_OpenSciUsbCdc(uint32_t i_SerialNumber) {
|
||||||
|
aioSciComm = new AIO_SCI_COMM;
|
||||||
|
return aioSciComm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIO_IOB2_BI2X_WRFIRM *__fastcall aioIob2Bi2x_CreateWriteFirmContext(
|
||||||
|
uint32_t i_SerialNumber, uint32_t i_bfIob) {
|
||||||
|
|
||||||
|
aioIob2Bi2xWrfirm = new AIO_IOB2_BI2X_WRFIRM;
|
||||||
|
return aioIob2Bi2xWrfirm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioIob2Bi2x_DestroyWriteFirmContext(AIO_IOB2_BI2X_WRFIRM *i_pWrFirm) {
|
||||||
|
if (i_pWrFirm == aioIob2Bi2xWrfirm) {
|
||||||
|
delete aioIob2Bi2xWrfirm;
|
||||||
|
aioIob2Bi2xWrfirm = nullptr;
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2x_DestroyWriteFirmContext_orig(i_pWrFirm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t __fastcall aioIob2Bi2x_WriteFirmGetState(AIO_IOB2_BI2X_WRFIRM *i_pWrFirm) {
|
||||||
|
if (i_pWrFirm == aioIob2Bi2xWrfirm) {
|
||||||
|
return 8;
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2x_WriteFirmGetState_orig(i_pWrFirm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioIob2Bi2x_WriteFirmIsCompleted(int32_t i_State) {
|
||||||
|
if (aioIob2Bi2xWrfirm != nullptr) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2x_WriteFirmIsCompleted_orig(i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioIob2Bi2x_WriteFirmIsError(int32_t i_State) {
|
||||||
|
if (aioIob2Bi2xWrfirm != nullptr) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return aioIob2Bi2x_WriteFirmIsError_orig(i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
|
||||||
|
static AIO_NMGR_IOB2 *__fastcall aioNMgrIob2_Create(AIO_SCI_COMM *i_pSci, uint32_t i_bfMode) {
|
||||||
|
if (i_pSci == aioSciComm) {
|
||||||
|
aioNmgrIob2 = new AIO_NMGR_IOB2;
|
||||||
|
return aioNmgrIob2;
|
||||||
|
} else {
|
||||||
|
return aioNMgrIob2_Create_orig(i_pSci, i_bfMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioNMgrIob_BeginManage(AIO_NMGR_IOB2 *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr != aioNmgrIob2) {
|
||||||
|
return aioNMgrIob_BeginManage_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
|
||||||
|
static void __fastcall aioSci_Destroy(AIO_SCI_COMM *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr == aioSciComm) {
|
||||||
|
delete aioSciComm;
|
||||||
|
} else {
|
||||||
|
return aioSci_Destroy_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioNodeMgr_Destroy(AIO_NMGR_IOB2 *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob2) {
|
||||||
|
delete aioNmgrIob2;
|
||||||
|
aioNmgrIob2 = nullptr;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_Destroy_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t __fastcall aioNodeMgr_GetState(AIO_NMGR_IOB2 *i_pNodeMgr) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob2) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_GetState_orig(i_pNodeMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeMgr_IsReady(AIO_NMGR_IOB2 *i_pNodeMgr, int32_t i_State) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob2) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_IsReady_orig(i_pNodeMgr, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeMgr_IsError(AIO_NMGR_IOB2 *i_pNodeMgr, int32_t i_State) {
|
||||||
|
if (i_pNodeMgr == aioNmgrIob2) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return aioNodeMgr_IsError_orig(i_pNodeMgr, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __fastcall aioNodeCtl_Destroy(AIO_IOB2_BI2X_AC1 *i_pNodeCtl) {
|
||||||
|
if (i_pNodeCtl == aioIob2Bi2xAc1) {
|
||||||
|
delete aioIob2Bi2xAc1;
|
||||||
|
aioIob2Bi2xAc1 = nullptr;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_Destroy_orig(i_pNodeCtl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t __fastcall aioNodeCtl_GetState(AIO_IOB2_BI2X_AC1 *i_pNodeCtl) {
|
||||||
|
if (i_pNodeCtl == aioIob2Bi2xAc1) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_GetState_orig(i_pNodeCtl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeCtl_IsReady(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, int32_t i_State) {
|
||||||
|
if (i_pNodeCtl == aioIob2Bi2xAc1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_IsReady_orig(i_pNodeCtl, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool __fastcall aioNodeCtl_IsError(AIO_IOB2_BI2X_AC1 *i_pNodeCtl, int32_t i_State) {
|
||||||
|
if (i_pNodeCtl == aioIob2Bi2xAc1) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return aioNodeCtl_IsError_orig(i_pNodeCtl, i_State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bi2x_hook_init() {
|
||||||
|
// avoid double init
|
||||||
|
static bool initialized = false;
|
||||||
|
if (initialized) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// announce
|
||||||
|
log_info("bi2x_hook", "init");
|
||||||
|
|
||||||
|
// libaio-iob2_video.dll
|
||||||
|
const auto libaioIob2VideoDll = "libaio-iob2_video.dll";
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_Create",
|
||||||
|
aioIob2Bi2xAC1_Create, &aioIob2Bi2xAC1_Create_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_GetDeviceStatus",
|
||||||
|
aioIob2Bi2xAC1_GetDeviceStatus, &aioIob2Bi2xAC1_GetDeviceStatus_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_SetWatchDogTimer",
|
||||||
|
aioIob2Bi2xAC1_SetWatchDogTimer, &aioIob2Bi2xAC1_SetWatchDogTimer_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_AddCounter",
|
||||||
|
aioIob2Bi2xAC1_AddCounter, &aioIob2Bi2xAC1_AddCounter_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_SetOutputData",
|
||||||
|
aioIob2Bi2xAC1_SetOutputData, &aioIob2Bi2xAC1_SetOutputData_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2xAC1_SetTapeLedDataPart",
|
||||||
|
aioIob2Bi2xAC1_SetTapeLedDataPart, &aioIob2Bi2xAC1_SetTapeLedDataPart_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_SetTapeLedDataGroup",
|
||||||
|
aioIob2Bi2x_SetTapeLedDataGroup, &aioIob2Bi2x_SetTapeLedDataGroup_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_SetTapeLedDataLimit",
|
||||||
|
aioIob2Bi2x_SetTapeLedDataLimit, &aioIob2Bi2x_SetTapeLedDataLimit_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_OpenSciUsbCdc",
|
||||||
|
aioIob2Bi2x_OpenSciUsbCdc, &aioIob2Bi2x_OpenSciUsbCdc_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_CreateWriteFirmContext",
|
||||||
|
aioIob2Bi2x_CreateWriteFirmContext, &aioIob2Bi2x_CreateWriteFirmContext_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_DestroyWriteFirmContext",
|
||||||
|
aioIob2Bi2x_DestroyWriteFirmContext, &aioIob2Bi2x_DestroyWriteFirmContext_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_WriteFirmGetState",
|
||||||
|
aioIob2Bi2x_WriteFirmGetState, &aioIob2Bi2x_WriteFirmGetState_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_WriteFirmIsCompleted",
|
||||||
|
aioIob2Bi2x_WriteFirmIsCompleted, &aioIob2Bi2x_WriteFirmIsCompleted_orig);
|
||||||
|
execexe::trampoline_try(libaioIob2VideoDll, "aioIob2Bi2x_WriteFirmIsError",
|
||||||
|
aioIob2Bi2x_WriteFirmIsError, &aioIob2Bi2x_WriteFirmIsError_orig);
|
||||||
|
|
||||||
|
// libaio-iob.dll
|
||||||
|
const auto libaioIobDll = "libaio-iob.dll";
|
||||||
|
execexe::trampoline_try(libaioIobDll, "aioNMgrIob2_Create",
|
||||||
|
aioNMgrIob2_Create, &aioNMgrIob2_Create_orig);
|
||||||
|
execexe::trampoline_try(libaioIobDll, "aioNMgrIob_BeginManage",
|
||||||
|
aioNMgrIob_BeginManage, &aioNMgrIob_BeginManage_orig);
|
||||||
|
|
||||||
|
// libaio.dll
|
||||||
|
const auto libaioDll = "libaio.dll";
|
||||||
|
execexe::trampoline_try(libaioDll, "aioSci_Destroy",
|
||||||
|
aioSci_Destroy, &aioSci_Destroy_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_Destroy",
|
||||||
|
aioNodeMgr_Destroy, &aioNodeMgr_Destroy_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_GetState",
|
||||||
|
aioNodeMgr_GetState, &aioNodeMgr_GetState_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_IsReady",
|
||||||
|
aioNodeMgr_IsReady, &aioNodeMgr_IsReady_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeMgr_IsError",
|
||||||
|
aioNodeMgr_IsError, &aioNodeMgr_IsError_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_Destroy",
|
||||||
|
aioNodeCtl_Destroy, &aioNodeCtl_Destroy_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_GetState",
|
||||||
|
aioNodeCtl_GetState, &aioNodeCtl_GetState_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_IsReady",
|
||||||
|
aioNodeCtl_IsReady, &aioNodeCtl_IsReady_orig);
|
||||||
|
execexe::trampoline_try(libaioDll, "aioNodeCtl_IsError",
|
||||||
|
aioNodeCtl_IsError, &aioNodeCtl_IsError_orig);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace games::pc {
|
||||||
|
void bi2x_hook_init();
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#include "io.h"
|
||||||
|
|
||||||
|
std::vector<Button> &games::pc::get_buttons() {
|
||||||
|
static std::vector<Button> buttons;
|
||||||
|
|
||||||
|
if (buttons.empty()) {
|
||||||
|
buttons = GameAPI::Buttons::getButtons("Polaris Chord");
|
||||||
|
|
||||||
|
GameAPI::Buttons::sortButtons(
|
||||||
|
&buttons,
|
||||||
|
"Service",
|
||||||
|
"Test",
|
||||||
|
"Coin Mech",
|
||||||
|
"Button 1",
|
||||||
|
"Button 2",
|
||||||
|
"Button 3",
|
||||||
|
"Button 4",
|
||||||
|
"Button 5",
|
||||||
|
"Button 6",
|
||||||
|
"Button 7",
|
||||||
|
"Button 8",
|
||||||
|
"Button 9",
|
||||||
|
"Button 10",
|
||||||
|
"Button 11",
|
||||||
|
"Button 12",
|
||||||
|
"Fader-L Left",
|
||||||
|
"Fader-L Right",
|
||||||
|
"Fader-R Left",
|
||||||
|
"Fader-R Right",
|
||||||
|
"Headphone"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string games::pc::get_buttons_help() {
|
||||||
|
// keep to max 100 characters wide
|
||||||
|
return
|
||||||
|
" FADER-L FADER-R \n"
|
||||||
|
"\n"
|
||||||
|
" B1 B2 B3 ... B11 B12\n"
|
||||||
|
"\n"
|
||||||
|
" Most menu interactions are on the touch screen; you can use your mouse.\n"
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Analog> &games::pc::get_analogs() {
|
||||||
|
static std::vector<Analog> analogs;
|
||||||
|
|
||||||
|
if (analogs.empty()) {
|
||||||
|
analogs = GameAPI::Analogs::getAnalogs("Polaris Chord");
|
||||||
|
|
||||||
|
GameAPI::Analogs::sortAnalogs(
|
||||||
|
&analogs,
|
||||||
|
"Fader-L",
|
||||||
|
"Fader-R"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return analogs;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Light> &games::pc::get_lights() {
|
||||||
|
static std::vector<Light> lights;
|
||||||
|
|
||||||
|
if (lights.empty()) {
|
||||||
|
lights = GameAPI::Lights::getLights("Polaris Chord");
|
||||||
|
|
||||||
|
GameAPI::Lights::sortLights(
|
||||||
|
&lights,
|
||||||
|
"IC Reader R",
|
||||||
|
"IC Reader G",
|
||||||
|
"IC Reader B",
|
||||||
|
|
||||||
|
"Button 1 R",
|
||||||
|
"Button 1 G",
|
||||||
|
"Button 1 B",
|
||||||
|
|
||||||
|
"Button 2 R",
|
||||||
|
"Button 2 G",
|
||||||
|
"Button 2 B",
|
||||||
|
|
||||||
|
"Button 3 R",
|
||||||
|
"Button 3 G",
|
||||||
|
"Button 3 B",
|
||||||
|
|
||||||
|
"Button 4 R",
|
||||||
|
"Button 4 G",
|
||||||
|
"Button 4 B",
|
||||||
|
|
||||||
|
"Button 5 R",
|
||||||
|
"Button 5 G",
|
||||||
|
"Button 5 B",
|
||||||
|
|
||||||
|
"Button 6 R",
|
||||||
|
"Button 6 G",
|
||||||
|
"Button 6 B",
|
||||||
|
|
||||||
|
"Button 7 R",
|
||||||
|
"Button 7 G",
|
||||||
|
"Button 7 B",
|
||||||
|
|
||||||
|
"Button 8 R",
|
||||||
|
"Button 8 G",
|
||||||
|
"Button 8 B",
|
||||||
|
|
||||||
|
"Button 9 R",
|
||||||
|
"Button 9 G",
|
||||||
|
"Button 9 B",
|
||||||
|
|
||||||
|
"Button 10 R",
|
||||||
|
"Button 10 G",
|
||||||
|
"Button 10 B",
|
||||||
|
|
||||||
|
"Button 11 R",
|
||||||
|
"Button 11 G",
|
||||||
|
"Button 11 B",
|
||||||
|
|
||||||
|
"Button 12 R",
|
||||||
|
"Button 12 G",
|
||||||
|
"Button 12 B"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lights;
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "cfg/api.h"
|
||||||
|
|
||||||
|
namespace games::pc {
|
||||||
|
namespace Buttons {
|
||||||
|
enum {
|
||||||
|
Service,
|
||||||
|
Test,
|
||||||
|
CoinMech,
|
||||||
|
Button1,
|
||||||
|
Button2,
|
||||||
|
Button3,
|
||||||
|
Button4,
|
||||||
|
Button5,
|
||||||
|
Button6,
|
||||||
|
Button7,
|
||||||
|
Button8,
|
||||||
|
Button9,
|
||||||
|
Button10,
|
||||||
|
Button11,
|
||||||
|
Button12,
|
||||||
|
FaderL_Left,
|
||||||
|
FaderL_Right,
|
||||||
|
FaderR_Left,
|
||||||
|
FaderR_Right,
|
||||||
|
Headphone
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Analogs {
|
||||||
|
enum {
|
||||||
|
FaderL,
|
||||||
|
FaderR,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Lights {
|
||||||
|
typedef enum {
|
||||||
|
IC_READER_R,
|
||||||
|
IC_READER_G,
|
||||||
|
IC_READER_B,
|
||||||
|
|
||||||
|
Button1_R,
|
||||||
|
Button1_G,
|
||||||
|
Button1_B,
|
||||||
|
|
||||||
|
Button2_R,
|
||||||
|
Button2_G,
|
||||||
|
Button2_B,
|
||||||
|
|
||||||
|
Button3_R,
|
||||||
|
Button3_G,
|
||||||
|
Button3_B,
|
||||||
|
|
||||||
|
Button4_R,
|
||||||
|
Button4_G,
|
||||||
|
Button4_B,
|
||||||
|
|
||||||
|
Button5_R,
|
||||||
|
Button5_G,
|
||||||
|
Button5_B,
|
||||||
|
|
||||||
|
Button6_R,
|
||||||
|
Button6_G,
|
||||||
|
Button6_B,
|
||||||
|
|
||||||
|
Button7_R,
|
||||||
|
Button7_G,
|
||||||
|
Button7_B,
|
||||||
|
|
||||||
|
Button8_R,
|
||||||
|
Button8_G,
|
||||||
|
Button8_B,
|
||||||
|
|
||||||
|
Button9_R,
|
||||||
|
Button9_G,
|
||||||
|
Button9_B,
|
||||||
|
|
||||||
|
Button10_R,
|
||||||
|
Button10_G,
|
||||||
|
Button10_B,
|
||||||
|
|
||||||
|
Button11_R,
|
||||||
|
Button11_G,
|
||||||
|
Button11_B,
|
||||||
|
|
||||||
|
Button12_R,
|
||||||
|
Button12_G,
|
||||||
|
Button12_B
|
||||||
|
|
||||||
|
} pc_lights_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// getters
|
||||||
|
std::vector<Button> &get_buttons();
|
||||||
|
std::string get_buttons_help();
|
||||||
|
std::vector<Analog> &get_analogs();
|
||||||
|
std::vector<Light> &get_lights();
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user