mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-09-15 11:55:10 -05:00
Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0cfc8c948 | ||
|
|
93cfb591b7 | ||
|
|
3396c09fbf | ||
|
|
bd8dc18b30 | ||
|
|
8e9abf9906 | ||
|
|
62bb717582 | ||
|
|
4816fb809d | ||
|
|
2a2c77f255 | ||
|
|
55513bac41 | ||
|
|
9c37ef71ba | ||
|
|
a0a1dea397 | ||
|
|
3c26a3f315 | ||
|
|
b408cd9687 | ||
|
|
be4df516fd | ||
|
|
d1080905e5 | ||
|
|
f87a51bbe4 | ||
|
|
2a4d3e2865 | ||
|
|
6697ff7df1 | ||
|
|
682fe8aa1b | ||
|
|
7d533f60cb | ||
|
|
e5331fbc7c | ||
|
|
77527e346b | ||
|
|
1d0a96fa20 | ||
|
|
63e19aaaf6 | ||
|
|
4c59f16d46 | ||
|
|
7157fdedb7 | ||
|
|
13d29cb62e | ||
|
|
bf48715466 | ||
|
|
24b490e36b | ||
|
|
ff2a4b9a2c | ||
|
|
10bddd4905 | ||
|
|
ad5fbc1f5b | ||
|
|
25413bcba8 | ||
|
|
937290f93d | ||
|
|
d04598a570 | ||
|
|
bd382e5509 | ||
|
|
0d3fa54316 | ||
|
|
e8943edff6 | ||
|
|
61f3eb44d2 | ||
|
|
5aa1e27a31 | ||
|
|
596b962cfe | ||
|
|
5969573dc9 | ||
|
|
5da6997805 | ||
|
|
dc98103419 | ||
|
|
2d07bd6f5a | ||
|
|
a21e37c894 | ||
|
|
fbb7731681 | ||
|
|
3659494c18 | ||
|
|
6d638ff1ae | ||
|
|
214a31b24d | ||
|
|
66d1131664 | ||
|
|
3450686cf5 | ||
|
|
3b8f6ac1d9 | ||
|
|
8ae06f6f4b | ||
|
|
b1fd175318 | ||
|
|
b1329d10bf | ||
|
|
bf3d543893 | ||
|
|
f1f26dece3 | ||
|
|
fe0996ec3b | ||
|
|
d551930ea0 | ||
|
|
daad6a09c5 | ||
|
|
27fdabe17a |
@@ -1,17 +1,25 @@
|
||||
image: debian
|
||||
image: docker:stable
|
||||
|
||||
variables:
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
|
||||
services:
|
||||
- docker:19.03.8-dind
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- release
|
||||
- create-release-package
|
||||
- releasetag
|
||||
|
||||
build:
|
||||
stage: build
|
||||
before_script:
|
||||
- apt-get update && apt-get -qq install clang mingw-w64 git make zip > /dev/null
|
||||
- apk update && apk add make > /dev/null
|
||||
script:
|
||||
- make
|
||||
- make build-docker
|
||||
artifacts:
|
||||
name: "$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
|
||||
paths:
|
||||
@@ -20,31 +28,17 @@ build:
|
||||
refs:
|
||||
- master
|
||||
|
||||
test:
|
||||
allow_failure: true
|
||||
stage: test
|
||||
dependencies:
|
||||
- build
|
||||
before_script:
|
||||
- apt-get update && apt-get -qq install make wine unzip > /dev/null
|
||||
- dpkg --add-architecture i386 && apt-get update && apt-get -qq install wine32 > /dev/null
|
||||
script:
|
||||
- ls
|
||||
- make run-tests
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
|
||||
release:
|
||||
stage: release
|
||||
create-release-package:
|
||||
stage: create-release-package
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
dependencies:
|
||||
- build
|
||||
before_script:
|
||||
- apt-get update && apt-get -qq install zip > /dev/null
|
||||
- apk update && apk add zip > /dev/null
|
||||
script:
|
||||
- mv build/bemanitools.zip ./bemanitools.zip
|
||||
- mv build/docker/bemanitools.zip ./bemanitools.zip
|
||||
- rm -r build
|
||||
- find . -mindepth 1 ! -regex '^./bemanitools.zip' -delete
|
||||
- unzip bemanitools.zip
|
||||
- rm bemanitools.zip
|
||||
@@ -55,12 +49,12 @@ release:
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
|
||||
|
||||
releasetag:
|
||||
stage: releasetag
|
||||
dependencies: []
|
||||
before_script:
|
||||
- apt-get update && apt-get -qq install curl > /dev/null
|
||||
- apk update && apk add curl > /dev/null
|
||||
script:
|
||||
- |
|
||||
curl --silent --show-error \
|
||||
|
||||
@@ -13,4 +13,15 @@
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Checklist
|
||||
<!-- Make sure you covered all items, which apply, of the checklist below. -->
|
||||
<!-- Strikethrough items that do not apply and provide a brief description why. -->
|
||||
* [ ] Implemented (unit) test(s) which prove that the introduced changes are working as expected.
|
||||
* Tested with the following games:
|
||||
* [ ] ... <!-- insert game name 1-->
|
||||
* [ ] ... <!-- insert game name 2--->
|
||||
* [ ] Followed the developer (style) guidelines.
|
||||
* [ ] Updated existing doc of or add new doc to README file(s).
|
||||
* [ ] Updated development documentation.
|
||||
@@ -13,4 +13,15 @@
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Checklist
|
||||
<!-- Make sure you covered all items, which apply, of the checklist below. -->
|
||||
<!-- Strikethrough items that do not apply and provide a brief description why. -->
|
||||
* [ ] Implemented (unit) test(s) which prove that the introduced changes are working as expected.
|
||||
* Tested with the following games:
|
||||
* [ ] ... <!-- insert game name 1-->
|
||||
* [ ] ... <!-- insert game name 2--->
|
||||
* [ ] Followed the developer (style) guidelines.
|
||||
* [ ] Updated existing doc of or add new doc to README file(s).
|
||||
* [ ] Updated development documentation.
|
||||
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,4 +1,26 @@
|
||||
# Release history
|
||||
## 5.32
|
||||
* Various bugfixes
|
||||
|
||||
## 5.31
|
||||
* DDR: Fix p3io and extio lights not working / being swapped when using geninput
|
||||
* DDR: Add HDXS light support
|
||||
* DDR: Add 64 bit support
|
||||
* DDR: Add option to use COM4 as the p3io rs232 port instead of emulating (for use with acrealio etc.)
|
||||
* Jubeat: Add network adapter hook
|
||||
* Misc: Fix aciodrv sometimes hanging on boot (eamio-icca and sdvxio-kfca)
|
||||
|
||||
## 5.30
|
||||
* SDVX: sdvxhook2 headphone force and cursor confining config options
|
||||
* DDR: Add light support for SMX gen 4 pads
|
||||
|
||||
## 5.29
|
||||
* SDVX: Add option for monitor rotation
|
||||
* SDVX: Add option to allow overriding network adapter IP
|
||||
* IIDX: Add force display adapter and refresh rate configuration
|
||||
* SDVX: Allow specifying display adapter to open for d3d9ex hook
|
||||
* IIDX/SDVX camerahooks bugfix: Camera sometimes not detected on some older machines
|
||||
|
||||
## 5.28
|
||||
* Improve documentation in various places
|
||||
* Automatic code formatting in build pipeline
|
||||
|
||||
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
FROM fedora:31
|
||||
|
||||
LABEL description="Build environment for bemanitools"
|
||||
|
||||
RUN yum -y install \
|
||||
git \
|
||||
make \
|
||||
zip \
|
||||
clang \
|
||||
mingw64-gcc.x86_64 \
|
||||
mingw32-gcc.x86_64 \
|
||||
wine.x86_64
|
||||
|
||||
RUN mkdir /bemanitools
|
||||
WORKDIR /bemanitools
|
||||
|
||||
# Order optimized for docker layer caching
|
||||
COPY run-tests-wine.sh run-tests-wine.sh
|
||||
COPY CHANGELOG.md CHANGELOG.md
|
||||
COPY CONTRIBUTING.md CONTRIBUTING.md
|
||||
COPY LICENSE LICENSE
|
||||
COPY GNUmakefile GNUmakefile
|
||||
COPY Module.mk Module.mk
|
||||
COPY README.md README.md
|
||||
COPY doc doc
|
||||
COPY dist dist
|
||||
COPY src src
|
||||
# .git folder required or building fails when version is generated
|
||||
COPY .git .git
|
||||
|
||||
# Building
|
||||
RUN make
|
||||
38
GNUmakefile
38
GNUmakefile
@@ -11,19 +11,24 @@ BUILDDIR ?= build
|
||||
# Internal variables
|
||||
#
|
||||
|
||||
depdir := $(BUILDDIR)/dep
|
||||
objdir := $(BUILDDIR)/obj
|
||||
bindir := $(BUILDDIR)/bin
|
||||
builddir_docker := $(BUILDDIR)/docker
|
||||
|
||||
toolchain_32 := i686-w64-mingw32-
|
||||
toolchain_64 := x86_64-w64-mingw32-
|
||||
docker_container_name := "bemanitools-build"
|
||||
docker_image_name := "bemanitools:build"
|
||||
|
||||
gitrev := $(shell git rev-parse HEAD)
|
||||
cppflags := -I src -I src/main -I src/test -DGITREV=$(gitrev)
|
||||
cflags := -O2 -pipe -ffunction-sections -fdata-sections \
|
||||
-Wall -std=c99
|
||||
cflags_release := -Werror
|
||||
ldflags := -Wl,--gc-sections -static-libgcc
|
||||
depdir := $(BUILDDIR)/dep
|
||||
objdir := $(BUILDDIR)/obj
|
||||
bindir := $(BUILDDIR)/bin
|
||||
|
||||
toolchain_32 := i686-w64-mingw32-
|
||||
toolchain_64 := x86_64-w64-mingw32-
|
||||
|
||||
gitrev := $(shell git rev-parse HEAD)
|
||||
cppflags := -I src -I src/main -I src/test -DGITREV=$(gitrev)
|
||||
cflags := -O2 -pipe -ffunction-sections -fdata-sections \
|
||||
-Wall -std=c99
|
||||
cflags_release := -Werror
|
||||
ldflags := -Wl,--gc-sections -static-libgcc
|
||||
|
||||
#
|
||||
# The first target that GNU Make encounters becomes the default target.
|
||||
@@ -33,6 +38,7 @@ ldflags := -Wl,--gc-sections -static-libgcc
|
||||
all: build
|
||||
|
||||
.PHONY: \
|
||||
build-docker \
|
||||
clean \
|
||||
code-format \
|
||||
print-building \
|
||||
@@ -74,6 +80,16 @@ run-tests:
|
||||
version:
|
||||
@echo "$(gitrev)" > version
|
||||
|
||||
build-docker:
|
||||
$(V)docker rm -f $(docker_container_name) 2> /dev/null || true
|
||||
$(V)docker build -t $(docker_image_name) -f Dockerfile .
|
||||
$(V)docker create --name $(docker_container_name) $(docker_image_name)
|
||||
$(V)rm -rf $(builddir_docker)
|
||||
$(V)mkdir -p $(builddir_docker)
|
||||
$(V)docker cp $(docker_container_name):/bemanitools/build $(builddir_docker)
|
||||
$(V)mv $(builddir_docker)/build/* $(builddir_docker)
|
||||
$(V)rm -r $(builddir_docker)/build
|
||||
|
||||
#
|
||||
# Pull in module definitions
|
||||
#
|
||||
|
||||
49
Module.mk
49
Module.mk
@@ -77,6 +77,7 @@ imps += avs avs-ea3
|
||||
include src/main/aciodrv/Module.mk
|
||||
include src/main/acioemu/Module.mk
|
||||
include src/main/aciotest/Module.mk
|
||||
include src/main/asio/Module.mk
|
||||
include src/main/bio2emu/Module.mk
|
||||
include src/main/bsthook/Module.mk
|
||||
include src/main/bstio/Module.mk
|
||||
@@ -88,6 +89,7 @@ include src/main/ddrhook/Module.mk
|
||||
include src/main/ddrio/Module.mk
|
||||
include src/main/ddrio-smx/Module.mk
|
||||
include src/main/ddrio-mm/Module.mk
|
||||
include src/main/dinput/Module.mk
|
||||
include src/main/eamio/Module.mk
|
||||
include src/main/eamio-icca/Module.mk
|
||||
include src/main/eamiotest/Module.mk
|
||||
@@ -136,6 +138,7 @@ include src/main/p4ioemu/Module.mk
|
||||
include src/main/pcbidgen/Module.mk
|
||||
include src/main/sdvxhook/Module.mk
|
||||
include src/main/sdvxhook2/Module.mk
|
||||
include src/main/sdvxhook2-cn/Module.mk
|
||||
include src/main/sdvxio/Module.mk
|
||||
include src/main/sdvxio-kfca/Module.mk
|
||||
include src/main/security/Module.mk
|
||||
@@ -180,6 +183,7 @@ $(zipdir)/tools.zip: \
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/tools-x64.zip: \
|
||||
build/bin/indep-64/aciotest.exe \
|
||||
build/bin/indep-64/eamiotest.exe \
|
||||
build/bin/indep-64/iidxiotest.exe \
|
||||
build/bin/indep-64/iidx-ezusb-exit-hook.dll \
|
||||
@@ -188,10 +192,6 @@ $(zipdir)/tools-x64.zip: \
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/src.zip: .git/HEAD $(zipdir)/
|
||||
$(V)echo ... $@
|
||||
$(V)git archive -o $@ HEAD
|
||||
|
||||
$(zipdir)/iidx-09-to-12.zip: \
|
||||
build/bin/indep-32/iidxhook1.dll \
|
||||
build/bin/indep-32/config.exe \
|
||||
@@ -407,7 +407,7 @@ $(zipdir)/jb-08.zip: \
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/sdvx.zip: \
|
||||
$(zipdir)/sdvx-01-to-04.zip: \
|
||||
build/bin/avs2_1508-32/launcher.exe \
|
||||
build/bin/avs2_1508-32/sdvxhook.dll \
|
||||
build/bin/indep-32/config.exe \
|
||||
@@ -421,7 +421,7 @@ $(zipdir)/sdvx.zip: \
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/sdvx5.zip: \
|
||||
$(zipdir)/sdvx-05.zip: \
|
||||
build/bin/avs2_1700-64/launcher.exe \
|
||||
build/bin/avs2_1700-64/sdvxhook2.dll \
|
||||
build/bin/indep-64/config.exe \
|
||||
@@ -436,6 +436,20 @@ $(zipdir)/sdvx5.zip: \
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/sdvx-05-cn.zip: \
|
||||
build/bin/avs2_1700-64/launcher.exe \
|
||||
build/bin/avs2_1700-64/sdvxhook2-cn.dll \
|
||||
build/bin/indep-64/config.exe \
|
||||
build/bin/indep-64/eamio.dll \
|
||||
build/bin/indep-64/geninput.dll \
|
||||
build/bin/indep-64/sdvxio.dll \
|
||||
dist/sdvx5/config.bat \
|
||||
dist/sdvx5/gamestart-cn.bat \
|
||||
dist/sdvx5/sdvxhook2-cn.conf \
|
||||
| $(zipdir)/
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/ddr-12-to-16.zip: \
|
||||
build/bin/avs2_1508-32/launcher.exe \
|
||||
build/bin/avs2_1508-32/ddrhook.dll \
|
||||
@@ -456,6 +470,22 @@ $(zipdir)/ddr-12-to-16.zip: \
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/ddr-16-x64.zip: \
|
||||
build/bin/avs2_1603-64/launcher.exe \
|
||||
build/bin/avs2_1603-64/ddrhook.dll \
|
||||
build/bin/avs2_1603-64/unicorntail.dll \
|
||||
build/bin/indep-64/config.exe \
|
||||
build/bin/indep-64/ddrio.dll \
|
||||
build/bin/indep-64/ddrio-mm.dll \
|
||||
build/bin/indep-64/ddrio-smx.dll \
|
||||
build/bin/indep-64/eamio.dll \
|
||||
build/bin/indep-64/geninput.dll \
|
||||
dist/ddr/config.bat \
|
||||
dist/ddr/gamestart-16.bat \
|
||||
| $(zipdir)/
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
||||
$(zipdir)/bst.zip: \
|
||||
build/bin/avs2_1603-64/bsthook.dll \
|
||||
build/bin/avs2_1603-64/launcher.exe \
|
||||
@@ -508,6 +538,7 @@ $(BUILDDIR)/tests.zip: \
|
||||
$(BUILDDIR)/bemanitools.zip: \
|
||||
$(zipdir)/bst.zip \
|
||||
$(zipdir)/ddr-12-to-16.zip \
|
||||
$(zipdir)/ddr-16-x64.zip \
|
||||
$(zipdir)/doc.zip \
|
||||
$(zipdir)/iidx-09-to-12.zip \
|
||||
$(zipdir)/iidx-13.zip \
|
||||
@@ -520,9 +551,9 @@ $(BUILDDIR)/bemanitools.zip: \
|
||||
$(zipdir)/jb-01.zip \
|
||||
$(zipdir)/jb-05-to-07.zip \
|
||||
$(zipdir)/jb-08.zip \
|
||||
$(zipdir)/src.zip \
|
||||
$(zipdir)/sdvx.zip \
|
||||
$(zipdir)/sdvx5.zip \
|
||||
$(zipdir)/sdvx-01-to-04.zip \
|
||||
$(zipdir)/sdvx-05.zip \
|
||||
$(zipdir)/sdvx-05-cn.zip \
|
||||
$(zipdir)/tools.zip \
|
||||
$(zipdir)/tools-x64.zip \
|
||||
CHANGELOG.md \
|
||||
|
||||
29
README.md
29
README.md
@@ -1,7 +1,7 @@
|
||||
# Bemanitools 5
|
||||
[](https://dev.s-ul.eu/djhackers/bemanitools/commits/master)
|
||||
|
||||
Version: 5.28</br>
|
||||
Version: 5.32</br>
|
||||
[Release history](CHANGELOG.md)
|
||||
|
||||
A collection of tools to run [various Bemani arcade games](#list-of-supported-games).
|
||||
@@ -47,11 +47,11 @@ authentic gameplay experience, and easier support for a broader range of release
|
||||
* jubeat Qubell (jb-05-to-07.zip) using jbhook
|
||||
* jubeat clan (jb-08.zip) using jbhook
|
||||
* SOUND VOLTEX
|
||||
* SOUND VOLTEX BOOTH (sdvx.zip) using sdvxhook
|
||||
* SOUND VOLTEX II -infinite infection- (sdvx.zip) using sdvxhook
|
||||
* SOUND VOLTEX III GRAVITY WARS (sdvx.zip) using sdvxhook
|
||||
* SOUND VOLTEX IV HEAVENLY HAVEN (sdvx.zip) using sdvxhook
|
||||
* SOUND VOLTEX Vivid Wave (sdvx2.zip) using sdvxhook2
|
||||
* SOUND VOLTEX BOOTH (sdvx-01-to-04.zip) using sdvxhook
|
||||
* SOUND VOLTEX II -infinite infection- (sdvx-01-to-04.zip) using sdvxhook
|
||||
* SOUND VOLTEX III GRAVITY WARS (sdvx-01-to-04.zip) using sdvxhook
|
||||
* SOUND VOLTEX IV HEAVENLY HAVEN (sdvx-01-to-04.zip) using sdvxhook
|
||||
* SOUND VOLTEX Vivid Wave (sdvx-05.zip) using sdvxhook2
|
||||
|
||||
# Supported platforms
|
||||
Our main platforms are currently Windows XP and Windows 7 which are also the target platforms on the original hardware
|
||||
@@ -67,10 +67,23 @@ You will find *.md files in various sub-packages that give you further instructi
|
||||
or FAQ. We advice you to read them as your questions and concerns might already be answered by them. If not, let us
|
||||
know if there is any information that you consider helpful or important to know and should be added.
|
||||
|
||||
# Setup and dependencies
|
||||
Most (older generation) games were developed for Windows XP Embedded but should run fine on any
|
||||
consumer version of Windows XP. Newer versions of Windows, e.g. Windows 7, 8 and 10, should be fine
|
||||
as well. Some hooks also include fixes required to run the games on a more recent version.
|
||||
|
||||
Depending on the game, you also need the following dependencies installed:
|
||||
* DirectX 9 runtime
|
||||
* Microsoft Visual C++ Redistributables 2010 **and** 2013: Depends on the game and age but both
|
||||
should cover most if not all of the games so far
|
||||
|
||||
# Contributions
|
||||
Please refer to the [dedicated documentation](CONTRIBUTING.md).
|
||||
|
||||
# Development
|
||||
## Building
|
||||
See the [development document](doc/development).
|
||||
|
||||
## Architecture
|
||||
A dedicate [architecture document](doc/architecture.md) outlines the architecture of Bemanitools and points out the most
|
||||
important aspects you should know before you get started with development.
|
||||
@@ -78,10 +91,6 @@ important aspects you should know before you get started with development.
|
||||
## API
|
||||
Please refer to the [API documentation](doc/api.md).
|
||||
|
||||
## Source Code
|
||||
The source code is included with this distribution package (src.zip). Please refer to the
|
||||
[development document](doc/development.md) for further details.
|
||||
|
||||
# License
|
||||
Source code license is the Unlicense; you are permitted to do with this as thou wilt. For details, please refer to the
|
||||
[LICENSE file](LICENSE) included with the source code.
|
||||
|
||||
6
dist/iidx/iidxhook-09.conf
vendored
6
dist/iidx/iidxhook-09.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-10.conf
vendored
6
dist/iidx/iidxhook-10.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-11.conf
vendored
6
dist/iidx/iidxhook-11.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-12.conf
vendored
6
dist/iidx/iidxhook-12.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Fix broken 3D background on Happy Sky's music select (if appearing completely white)
|
||||
misc.happy_sky_ms_bg_fix=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-13.conf
vendored
6
dist/iidx/iidxhook-13.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Fix broken 3D background on DistorteD's music select (if appearing completely black)
|
||||
misc.distorted_ms_bg_fix=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-14.conf
vendored
6
dist/iidx/iidxhook-14.conf
vendored
@@ -37,6 +37,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-15.conf
vendored
6
dist/iidx/iidxhook-15.conf
vendored
@@ -37,6 +37,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-16.conf
vendored
6
dist/iidx/iidxhook-16.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-17.conf
vendored
6
dist/iidx/iidxhook-17.conf
vendored
@@ -40,6 +40,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disable operator clock setting system clock time
|
||||
misc.disable_clock_set=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-18.conf
vendored
6
dist/iidx/iidxhook-18.conf
vendored
@@ -30,3 +30,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-19.conf
vendored
6
dist/iidx/iidxhook-19.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-20.conf
vendored
6
dist/iidx/iidxhook-20.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-21.conf
vendored
6
dist/iidx/iidxhook-21.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-22.conf
vendored
6
dist/iidx/iidxhook-22.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-23.conf
vendored
6
dist/iidx/iidxhook-23.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-24.conf
vendored
6
dist/iidx/iidxhook-24.conf
vendored
@@ -27,3 +27,9 @@ gfx.scale_back_buffer_height=0
|
||||
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
6
dist/iidx/iidxhook-25.conf
vendored
6
dist/iidx/iidxhook-25.conf
vendored
@@ -28,6 +28,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disables the camera emulation
|
||||
cam.disable_emu=false
|
||||
|
||||
|
||||
6
dist/iidx/iidxhook-26.conf
vendored
6
dist/iidx/iidxhook-26.conf
vendored
@@ -28,6 +28,12 @@ gfx.scale_back_buffer_height=0
|
||||
# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
|
||||
gfx.scale_back_buffer_filter=none
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Disables the camera emulation
|
||||
cam.disable_emu=false
|
||||
|
||||
|
||||
17
dist/sdvx5/gamestart-cn.bat
vendored
Normal file
17
dist/sdvx5/gamestart-cn.bat
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@echo off
|
||||
cd /d %~dp0
|
||||
|
||||
if not exist dev mkdir dev
|
||||
if not exist dev\e mkdir dev\e
|
||||
if not exist dev\g mkdir dev\g
|
||||
if not exist dev\nvram mkdir dev\nvram
|
||||
if not exist dev\raw mkdir dev\raw
|
||||
if not exist dev\raw\c.dest echo $null >> dev\raw\c.dest
|
||||
if not exist dev\raw\log mkdir dev\raw\log
|
||||
if not exist dev\raw\fscache mkdir dev\raw\fscache
|
||||
|
||||
for /R prop\defaults %%D in (*.*) do (
|
||||
if not exist dev\nvram\%%~nxD copy /y prop\defaults\%%~nxD dev\nvram
|
||||
)
|
||||
|
||||
launcher -H 268435456 -K sdvxhook2-cn.dll soundvoltex.dll --config sdvxhook2-cn.conf %*
|
||||
2
dist/sdvx5/gamestart.bat
vendored
2
dist/sdvx5/gamestart.bat
vendored
@@ -13,4 +13,4 @@ for /R prop\defaults %%D in (*.*) do (
|
||||
if not exist dev\nvram\%%~nxD copy /y prop\defaults\%%~nxD dev\nvram
|
||||
)
|
||||
|
||||
launcher -H 268435456 -K sdvxhook2.dll soundvoltex.dll --options sdvxhook2.conf %*
|
||||
launcher -H 268435456 -K sdvxhook2.dll soundvoltex.dll --config sdvxhook2.conf %*
|
||||
|
||||
24
dist/sdvx5/sdvxhook2-cn.conf
vendored
Normal file
24
dist/sdvx5/sdvxhook2-cn.conf
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Disable IO emulation and enable usage of real KFCA hardware
|
||||
io.disable_io_emu=false
|
||||
|
||||
# Path to unis version file under the prop.s folder
|
||||
cn.unis_path=prop/unis.xml
|
||||
|
||||
# Run the game in a framed window (requires windowed option)
|
||||
gfx.framed=true
|
||||
|
||||
# Run the game windowed
|
||||
gfx.windowed=false
|
||||
|
||||
# Windowed width, -1 for default size
|
||||
gfx.window_width=720
|
||||
|
||||
# Windowed height, -1 for default size
|
||||
gfx.window_height=1280
|
||||
|
||||
# Disables the camera emulation
|
||||
cam.disable_emu=false
|
||||
|
||||
# Override camera device ID detection (copy from device manager, do not escape)
|
||||
cam.device_id1=
|
||||
|
||||
22
dist/sdvx5/sdvxhook2.conf
vendored
22
dist/sdvx5/sdvxhook2.conf
vendored
@@ -7,17 +7,32 @@ io.disable_bio2_emu=false
|
||||
# Disables the poll limiter, warning very high CPU usage may arise
|
||||
io.disable_poll_limiter=false
|
||||
|
||||
# Forces game to think headphones are attached
|
||||
io.force_headphones=false
|
||||
|
||||
# Run the game in a framed window (requires windowed option)
|
||||
gfx.framed=true
|
||||
|
||||
# Run the game windowed
|
||||
gfx.windowed=false
|
||||
|
||||
# Confine mouse coursor to window
|
||||
gfx.confined=false
|
||||
|
||||
# Windowed width, -1 for default size
|
||||
gfx.window_width=720
|
||||
gfx.window_width=1080
|
||||
|
||||
# Windowed height, -1 for default size
|
||||
gfx.window_height=1280
|
||||
gfx.window_height=1920
|
||||
|
||||
# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
||||
gfx.forced_refresh_rate=-1
|
||||
|
||||
# D3D9ex device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
|
||||
gfx.device_adapter=-1
|
||||
|
||||
# Orientation to force monitor into, -1 to use default, 0, 1, 2, 3 to do 0, 90, 180, 270 degrees
|
||||
gfx.force_orientation=-1
|
||||
|
||||
# Disables the camera emulation
|
||||
cam.disable_emu=false
|
||||
@@ -25,3 +40,6 @@ cam.disable_emu=false
|
||||
# Override camera device ID detection (copy from device manager, do not escape)
|
||||
cam.device_id1=
|
||||
|
||||
# IP of adapter to force override with
|
||||
adapter.override_ip=
|
||||
|
||||
|
||||
14
doc/ddrhook/ddrio-smx.md
Normal file
14
doc/ddrhook/ddrio-smx.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Using SMX pads with BemaniTools (DDR Ace and higher)
|
||||
If you are looking to use StepManiaX pads with DDR, these are supported **natively** for Gen 1 through Gen 5.(And theoretically beyond!) Steps and info below
|
||||
|
||||
## Step-by-Step
|
||||
1. Ensure that you have the latest `SMX.dll` copied to your contents folder. The easiest way to get this is to download and install the latest SMX Config program on [StepManiaX.com](https://data.stepmaniax.com/docs/SMXConfigInstaller-2020-04-03-01.exe). `SMX.dll`'s default install location is `C:\Program Files (x86)\SMXConfig`
|
||||
2. After bemanitools has been copied to your contents folder, rename the regular `ddrio.dll` to something like `ddrio-orig.dll`.
|
||||
3. Rename `ddrio-smx.dll` to `ddrio.dll`.
|
||||
4. Use the config tool to set up the usual stuff.(cards, network, etc.) Be sure to map menu, test, service, and start buttons to your keyboard or other controllers. You **cannot** map SMX panels as joystick inputs.
|
||||
5. Start the game. If everything works properly, the game will boot and your panels will light up when stepped on during gameplay and song selection.
|
||||
|
||||
## Important Things
|
||||
* Pad panel inputs (UDLR on P1 and P2) are mapped automatically. If you've purchased a single pad from StepManiaX, this jumper is installed and will set your pad to P2 by default. If you want to change to P1, you'll need to open up your pads and remove this jumper in the [MCU box](https://data.stepmaniax.com/docs/Stage%20-%20Gen%205%20Manual%20Rev1.pdf).
|
||||
* Panel colors set in the SMX config tool are not used. Colors are set internally by Bemanitools.
|
||||
* If you get a warning about setlights2 when starting the game, your `SMX.dll` is likely out of date. Make sure you've downloaded the latest version of the StepManiaX config tool from stepmaniax.com and have copied the `SMX.dll` to your contents folder.
|
||||
@@ -36,6 +36,13 @@ development environment which we run on a Linux distribution of our choice:
|
||||
* C++ Intellisense
|
||||
* Clang-Format
|
||||
|
||||
### Further tools for testing and debugging
|
||||
* Debugger: Can be part of your reverse engineering IDE of your choice or stand-along like
|
||||
[OllyDbg](http://www.ollydbg.de/).
|
||||
* [apitrace](https://apitrace.github.io/): Trace render calls to graphics APIs like D3D and OpenGL.
|
||||
This tool allows you to record and re-play render calls of an application with frame-by-frame
|
||||
debugging. Very useful to analyze the render pipeline or debug graphicial glitches.
|
||||
|
||||
## Building
|
||||
Simply run make in the root folder:
|
||||
```
|
||||
@@ -51,6 +58,51 @@ command:
|
||||
make release
|
||||
```
|
||||
|
||||
## Building with docker
|
||||
You can also build bemanitools using docker which avoids having to setup a full development
|
||||
environment if you are just interested in building binaries for the latest changes. Naturally, this
|
||||
requires you to have the docker daemon installed. Then, run the following command from the root
|
||||
folder of the project:
|
||||
|
||||
```bash
|
||||
make build-docker
|
||||
```
|
||||
|
||||
Once completed successfully, the build output is located in the `build/docker` sub-folder.
|
||||
|
||||
## Creating releases
|
||||
For developers to create official releases with major and minor versioning:
|
||||
1. Ensure that all everything you want to have for this release is merged into master.
|
||||
1. Create a [changelog](CHANGELOG.md) based on aggregating and summerizing commit messages of
|
||||
whatever got added starting from the tag of the current version to the current head of master.
|
||||
Commit that changelog and push to master.
|
||||
1. Create a tag with the next version number, e.g. for 5.28:
|
||||
```bash
|
||||
git tag v5.28
|
||||
```
|
||||
1. Push the tag upstream:
|
||||
```bash
|
||||
git push origin v5.28
|
||||
```
|
||||
1. Wait for the CI pipeline to finish building the release and check if everything's ok.
|
||||
1. On GitLab, go to "Tags" in the repository, click on the commit ID below the tag in the list you
|
||||
just created.
|
||||
1. Click on the "Pipelines" tab and click on the download button on the right and on "Download
|
||||
release artifacts".
|
||||
1. Rename the downloaded zip to "bemanitools-v5.28.zip" and the replace v5.28 with the version
|
||||
you want to release.
|
||||
1. Upload the release.
|
||||
1. For publishing the release, create a post with the following contents:
|
||||
```
|
||||
v5.28
|
||||
<insert link to uploaded zip here>
|
||||
|
||||
<additional comments or things to point out for this release>
|
||||
|
||||
Changelog copy-paste:
|
||||
<insert copy-pasted changelog you created previously here>
|
||||
```
|
||||
|
||||
## Code formatting
|
||||
To apply our code style using clang-format, simply run the following command:
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This library drives a "legacy" ezusb IO board, also known as C02 IO, and
|
||||
This library drives a "legacy" ezusb IO board, also known as C02/D01 IO, and
|
||||
implements the iidxio API of BT5. Thus, it allows you to use this IO board with
|
||||
*any* version of IIDX that is supported by BT5.
|
||||
|
||||
@@ -24,5 +24,7 @@ the status LEDs on the side of the board should show a blinking pattern.
|
||||
dump to the FPGA.
|
||||
* There is a script called ezusb-boot.bat which combines the two steps above
|
||||
and can be integrated into the startup process of a dedicated setup.
|
||||
* If you are using a D01 IO board, use the `fpga-d01.bin` file instead of the
|
||||
`fpga.bin` file.
|
||||
* If you ignore these steps, you will either run into errors or parts of the
|
||||
IO board won't work (e.g. lights).
|
||||
@@ -14,12 +14,12 @@ it to the list of libraries to inject:
|
||||
|
||||
Example when using *inject.exe*:
|
||||
```
|
||||
inject iidxhook3.dll mempatch-hook.dll bm2dx.exe --options iidxhook-16.conf --mempatch myPatch.mph %*
|
||||
inject iidxhook3.dll mempatch-hook.dll bm2dx.exe --config iidxhook-16.conf --mempatch myPatch.mph %*
|
||||
```
|
||||
|
||||
When using *launcher.exe*:
|
||||
```
|
||||
launcher -K iidxhook4.dll -K mempatch-hook.dll bm2dx.dll --options iidxhook.conf --mempatch myPatch.mph %*
|
||||
launcher -K iidxhook4.dll -K mempatch-hook.dll bm2dx.dll --config iidxhook.conf --mempatch myPatch.mph %*
|
||||
```
|
||||
|
||||
To load a patch script, add the *--mempatch <path to patch script>* argument (as
|
||||
|
||||
@@ -61,14 +61,24 @@ SMX_EXTERN_C SMX_API void SMX_GetInfo(int pad, struct SMXInfo *info);
|
||||
// Get a mask of the currently pressed panels.
|
||||
SMX_EXTERN_C SMX_API uint16_t SMX_GetInputState(int pad);
|
||||
|
||||
// Update the lights. Both pads are always updated together. lightsData is a
|
||||
// list of 8-bit RGB colors, one for each LED. Each panel has lights in the
|
||||
// following order:
|
||||
// (deprecated) Equivalent to SMX_SetLights2(lightsData, 864).
|
||||
SMX_API void SMX_SetLights(const char lightData[864]);
|
||||
|
||||
// Update the lights. Both pads are always updated together. lightData is a list of 8-bit RGB
|
||||
// colors, one for each LED.
|
||||
//
|
||||
// 0123
|
||||
// 4567
|
||||
// 89AB
|
||||
// CDEF
|
||||
// lightDataSize is the number of bytes in lightsData. This should be 1350 (2 pads * 9 panels *
|
||||
// 25 lights * 3 RGB colors). For backwards-compatibility, this can also be 864.
|
||||
//
|
||||
// Each panel has lights in the following order:
|
||||
//
|
||||
// 00 01 02 03
|
||||
// 16 17 18
|
||||
// 04 05 06 07
|
||||
// 19 20 21
|
||||
// 08 09 10 11
|
||||
// 22 23 24
|
||||
// 12 13 14 15
|
||||
//
|
||||
// Panels are in the following order:
|
||||
//
|
||||
@@ -76,17 +86,17 @@ SMX_EXTERN_C SMX_API uint16_t SMX_GetInputState(int pad);
|
||||
// 345 CDE
|
||||
// 678 F01
|
||||
//
|
||||
// With 18 panels, 16 LEDs per panel and 3 bytes per LED, each light update has
|
||||
// 864 bytes of data.
|
||||
// With 18 panels, 25 LEDs per panel and 3 bytes per LED, each light update has 1350 bytes of data.
|
||||
//
|
||||
// Lights will update at up to 30 FPS. If lights data is sent more quickly, a
|
||||
// best effort will be made to send the most recent lights data available, but
|
||||
// the panels won't update more quickly.
|
||||
// Lights will update at up to 30 FPS. If lights data is sent more quickly, a best effort will be
|
||||
// made to send the most recent lights data available, but the panels won't update more quickly.
|
||||
//
|
||||
// The panels will return to automatic lighting if no lights are received for a
|
||||
// while, so applications controlling lights should send light updates
|
||||
// continually, even if the lights aren't changing.
|
||||
SMX_EXTERN_C SMX_API void SMX_SetLights(const char lightsData[864]);
|
||||
// The panels will return to automatic lighting if no lights are received for a while, so applications
|
||||
// controlling lights should send light updates continually, even if the lights aren't changing.
|
||||
//
|
||||
// For backwards compatibility, if lightDataSize is 864, the old 4x4-only order is used,
|
||||
// which simply omits lights 16-24.
|
||||
SMX_API void SMX_SetLights2(const char *lightData, int lightDataSize);
|
||||
|
||||
// By default, the panels light automatically when stepped on. If a lights
|
||||
// command is sent by the application, this stops happening to allow the
|
||||
|
||||
@@ -7,6 +7,7 @@ EXPORTS
|
||||
SMX_GetInfo
|
||||
SMX_GetInputState
|
||||
SMX_SetLights
|
||||
SMX_SetLights2
|
||||
SMX_ReenableAutoLights
|
||||
SMX_GetConfig
|
||||
SMX_SetConfig
|
||||
|
||||
18
src/imports/import_64_indep_SMX.def
Normal file
18
src/imports/import_64_indep_SMX.def
Normal file
@@ -0,0 +1,18 @@
|
||||
LIBRARY SMX
|
||||
|
||||
EXPORTS
|
||||
SMX_Start
|
||||
SMX_Stop
|
||||
SMX_SetLogCallback
|
||||
SMX_GetInfo
|
||||
SMX_GetInputState
|
||||
SMX_SetLights
|
||||
SMX_SetLights2
|
||||
SMX_ReenableAutoLights
|
||||
SMX_GetConfig
|
||||
SMX_SetConfig
|
||||
SMX_FactoryReset
|
||||
SMX_ForceRecalibration
|
||||
SMX_SetTestMode
|
||||
SMX_GetTestData
|
||||
SMX_Version
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "acio/hdxs.h"
|
||||
#include "acio/icca.h"
|
||||
#include "acio/kfca.h"
|
||||
|
||||
@@ -71,6 +72,8 @@ struct ac_io_message {
|
||||
|
||||
struct ac_io_kfca_poll_in kfca_poll_in;
|
||||
struct ac_io_kfca_poll_out kfca_poll_out;
|
||||
|
||||
struct ac_io_hdxs_output hdxs_output;
|
||||
};
|
||||
} cmd;
|
||||
|
||||
|
||||
48
src/main/acio/hdxs.h
Normal file
48
src/main/acio/hdxs.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef ACIO_HDXS_H
|
||||
#define ACIO_HDXS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum ac_io_hdxs_cmd {
|
||||
AC_IO_HDXS_CMD_SET_OUTPUTS = 0x0112,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct ac_io_hdxs_light {
|
||||
uint8_t analog : 7; // rgb component
|
||||
uint8_t bit : 1; // buttons
|
||||
};
|
||||
|
||||
struct ac_io_hdxs_output {
|
||||
uint8_t empty;
|
||||
struct ac_io_hdxs_light lights[12];
|
||||
};
|
||||
|
||||
enum ac_io_hdxs_front_panel_lights {
|
||||
AC_IO_HDXS_OUT_P1_START = 0,
|
||||
AC_IO_HDXS_OUT_P1_UP_DOWN = 1,
|
||||
AC_IO_HDXS_OUT_P1_LEFT_RIGHT = 2,
|
||||
AC_IO_HDXS_OUT_P2_START = 3,
|
||||
AC_IO_HDXS_OUT_P2_UP_DOWN = 4,
|
||||
AC_IO_HDXS_OUT_P2_LEFT_RIGHT = 5,
|
||||
};
|
||||
|
||||
enum ac_io_hdxs_grb_layout {
|
||||
AC_IO_HDXS_GREEN = 0,
|
||||
AC_IO_HDXS_RED = 1,
|
||||
AC_IO_HDXS_BLUE = 2,
|
||||
};
|
||||
|
||||
enum ac_io_hdxs_speaker_lights {
|
||||
AC_IO_HDXS_OUT_P1_SPEAKER_F = 0,
|
||||
AC_IO_HDXS_OUT_P2_SPEAKER_F = 1,
|
||||
AC_IO_HDXS_OUT_P1_SPEAKER_W = 2,
|
||||
AC_IO_HDXS_OUT_P2_SPEAKER_W = 3,
|
||||
};
|
||||
|
||||
_Static_assert(
|
||||
sizeof(struct ac_io_hdxs_output) == 13,
|
||||
"ac_io_hdxs_output is the wrong size");
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
@@ -12,6 +12,8 @@ enum ac_io_icca_cmd {
|
||||
AC_IO_ICCA_CMD_SET_SLOT_STATE = 0x0135,
|
||||
AC_IO_ICCA_CMD_BEGIN_KEYPAD = 0x013A,
|
||||
AC_IO_ICCA_CMD_POLL_FELICA = 0x0161,
|
||||
AC_IO_ICCA_CMD_KEY_EXCHANGE = 0x0160,
|
||||
AC_IO_ICCA_CMD_POLL_ENCRYPTED = 0x0164,
|
||||
};
|
||||
|
||||
enum ac_io_icca_slot_state {
|
||||
|
||||
@@ -19,6 +19,7 @@ static char aviodrv_device_node_products[16][4];
|
||||
static bool aciodrv_device_init(void)
|
||||
{
|
||||
uint8_t init_seq[1] = {AC_IO_SOF};
|
||||
uint8_t read_buff[1] = {0x00};
|
||||
|
||||
/* init/reset the device by sending 0xAA until 0xAA is returned */
|
||||
int read = 0;
|
||||
@@ -27,17 +28,20 @@ static bool aciodrv_device_init(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
read = aciodrv_port_read(init_seq, sizeof(init_seq));
|
||||
} while (read == 0);
|
||||
read = aciodrv_port_read(read_buff, sizeof(read_buff));
|
||||
} while ((read <= 0) || (read_buff[0] != init_seq[0]));
|
||||
|
||||
if (read > 0) {
|
||||
log_warning("Obtained SOF, clearing out buffer now");
|
||||
/* empty buffer by reading all data */
|
||||
while (read > 0) {
|
||||
read = aciodrv_port_read(init_seq, sizeof(init_seq));
|
||||
}
|
||||
log_warning("Cleared buffer, init done");
|
||||
|
||||
return read == 0;
|
||||
} else {
|
||||
log_warning("Read failure when trying to clear device state");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -314,15 +318,20 @@ bool aciodrv_device_get_node_product_ident(uint8_t node_id, char product[4])
|
||||
bool aciodrv_send_and_recv(struct ac_io_message *msg, int resp_size)
|
||||
{
|
||||
msg->cmd.seq_no = aciodrv_device_msg_counter++;
|
||||
int send_size = offsetof(struct ac_io_message, cmd.raw) + msg->cmd.nbytes;
|
||||
|
||||
if (aciodrv_device_send(
|
||||
(uint8_t *) msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + msg->cmd.nbytes) <= 0) {
|
||||
#ifdef AC_IO_MSG_LOG
|
||||
log_info("Beginning send on %d: %04x (%d b)", msg->addr, msg->cmd.code, send_size);
|
||||
#endif
|
||||
if (aciodrv_device_send((uint8_t *) msg, send_size) <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t req_code = msg->cmd.code;
|
||||
|
||||
#ifdef AC_IO_MSG_LOG
|
||||
log_info("Beginning recv: (%d b)", resp_size);
|
||||
#endif
|
||||
if (aciodrv_device_receive((uint8_t *) msg, resp_size) <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define LOG_MODULE "acioemu-hdxs"
|
||||
|
||||
#include "acio/hdxs.h"
|
||||
#include "acio/acio.h"
|
||||
|
||||
#include "acioemu/emu.h"
|
||||
@@ -18,12 +19,20 @@ static void ac_io_emu_hdxs_send_status(
|
||||
const struct ac_io_message *req,
|
||||
uint8_t status);
|
||||
|
||||
void ac_io_emu_hdxs_init(struct ac_io_emu_hdxs *hdxs, struct ac_io_emu *emu)
|
||||
void ac_io_emu_hdxs_init(
|
||||
struct ac_io_emu_hdxs *hdxs,
|
||||
struct ac_io_emu *emu,
|
||||
acio_hdxs_dispatcher lights_dispatcher)
|
||||
{
|
||||
log_assert(hdxs != NULL);
|
||||
log_assert(emu != NULL);
|
||||
|
||||
if (lights_dispatcher == NULL) {
|
||||
log_warning("NULL lights_dispatcher, HDXS light output won't work");
|
||||
}
|
||||
|
||||
hdxs->emu = emu;
|
||||
hdxs->lights_dispatcher = lights_dispatcher;
|
||||
}
|
||||
|
||||
void ac_io_emu_hdxs_dispatch_request(
|
||||
@@ -51,9 +60,19 @@ void ac_io_emu_hdxs_dispatch_request(
|
||||
|
||||
case AC_IO_CMD_CLEAR:
|
||||
log_misc("AC_IO_CMD_CLEAR(%d)", req->addr);
|
||||
ac_io_emu_hdxs_send_status(hdxs, req, 0x00);
|
||||
|
||||
break;
|
||||
|
||||
case AC_IO_HDXS_CMD_SET_OUTPUTS:
|
||||
if (hdxs->lights_dispatcher != NULL) {
|
||||
hdxs->lights_dispatcher(hdxs, req);
|
||||
}
|
||||
ac_io_emu_hdxs_send_status(hdxs, req, 0x00);
|
||||
|
||||
break;
|
||||
|
||||
case 0x110:
|
||||
case 0x112:
|
||||
case 0x128:
|
||||
ac_io_emu_hdxs_send_status(hdxs, req, 0x00);
|
||||
|
||||
@@ -86,11 +105,11 @@ static void ac_io_emu_hdxs_cmd_send_version(
|
||||
resp.cmd.version.type = ac_io_u32(AC_IO_NODE_TYPE_LED_STRIP);
|
||||
resp.cmd.version.flag = 0x00;
|
||||
resp.cmd.version.major = 0x01;
|
||||
resp.cmd.version.minor = 0x06;
|
||||
resp.cmd.version.revision = 0x00;
|
||||
resp.cmd.version.minor = 0x00;
|
||||
resp.cmd.version.revision = 0x01;
|
||||
memcpy(
|
||||
resp.cmd.version.product_code,
|
||||
"HDXS",
|
||||
"HDXB",
|
||||
sizeof(resp.cmd.version.product_code));
|
||||
strncpy(resp.cmd.version.date, __DATE__, sizeof(resp.cmd.version.date));
|
||||
strncpy(resp.cmd.version.time, __TIME__, sizeof(resp.cmd.version.time));
|
||||
|
||||
@@ -5,12 +5,21 @@
|
||||
|
||||
#include "acioemu/emu.h"
|
||||
|
||||
struct ac_io_emu_hdxs;
|
||||
struct ac_io_message;
|
||||
|
||||
typedef void (*acio_hdxs_dispatcher)(
|
||||
struct ac_io_emu_hdxs *emu, const struct ac_io_message *req);
|
||||
|
||||
struct ac_io_emu_hdxs {
|
||||
struct ac_io_emu *emu;
|
||||
// TODO ops vtbl
|
||||
acio_hdxs_dispatcher lights_dispatcher;
|
||||
};
|
||||
|
||||
void ac_io_emu_hdxs_init(struct ac_io_emu_hdxs *hdxs, struct ac_io_emu *emu);
|
||||
void ac_io_emu_hdxs_init(
|
||||
struct ac_io_emu_hdxs *hdxs,
|
||||
struct ac_io_emu *emu,
|
||||
acio_hdxs_dispatcher lights_dispatcher);
|
||||
|
||||
void ac_io_emu_hdxs_dispatch_request(
|
||||
struct ac_io_emu_hdxs *hdxs, const struct ac_io_message *req);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
|
||||
#include "util/crc.h"
|
||||
#include "util/time.h"
|
||||
|
||||
enum ac_io_icca_subcmd {
|
||||
@@ -41,7 +42,8 @@ static void ac_io_emu_icca_cmd_send_version(
|
||||
static void ac_io_emu_icca_send_state(
|
||||
struct ac_io_emu_icca *icca,
|
||||
const struct ac_io_message *req,
|
||||
uint64_t delay_us);
|
||||
uint64_t delay_us,
|
||||
bool encrypted);
|
||||
|
||||
static void ac_io_emu_icca_send_empty(
|
||||
struct ac_io_emu_icca *icca, const struct ac_io_message *req);
|
||||
@@ -51,6 +53,12 @@ static void ac_io_emu_icca_send_status(
|
||||
const struct ac_io_message *req,
|
||||
uint8_t status);
|
||||
|
||||
static void ac_io_emu_icca_cipher(
|
||||
struct ac_io_emu_icca *icca, uint8_t *data, size_t length);
|
||||
|
||||
static void ac_io_emu_icca_cipher_set_key(
|
||||
struct ac_io_emu_icca *icca, const struct ac_io_message *req);
|
||||
|
||||
void ac_io_emu_icca_init(
|
||||
struct ac_io_emu_icca *icca, struct ac_io_emu *emu, uint8_t unit_no)
|
||||
{
|
||||
@@ -59,6 +67,15 @@ void ac_io_emu_icca_init(
|
||||
icca->unit_no = unit_no;
|
||||
// queue must be started
|
||||
icca->fault = true;
|
||||
|
||||
// default to 1.6.0
|
||||
icca->version = v160;
|
||||
}
|
||||
|
||||
void ac_io_emu_icca_set_version(
|
||||
struct ac_io_emu_icca *icca, enum ac_io_emu_icca_version version)
|
||||
{
|
||||
icca->version = version;
|
||||
}
|
||||
|
||||
void ac_io_emu_icca_dispatch_request(
|
||||
@@ -123,7 +140,7 @@ void ac_io_emu_icca_dispatch_request(
|
||||
break;
|
||||
|
||||
case AC_IO_ICCA_CMD_ENGAGE:
|
||||
ac_io_emu_icca_send_state(icca, req, 0);
|
||||
ac_io_emu_icca_send_state(icca, req, 0, false);
|
||||
|
||||
break;
|
||||
|
||||
@@ -174,6 +191,7 @@ void ac_io_emu_icca_dispatch_request(
|
||||
break;
|
||||
}
|
||||
|
||||
case AC_IO_ICCA_CMD_POLL_ENCRYPTED:
|
||||
case AC_IO_ICCA_CMD_POLL:
|
||||
delay_us = time_get_elapsed_us(
|
||||
time_get_counter() - icca->time_counter_last_poll);
|
||||
@@ -185,13 +203,26 @@ void ac_io_emu_icca_dispatch_request(
|
||||
}
|
||||
|
||||
icca->time_counter_last_poll = time_get_counter();
|
||||
ac_io_emu_icca_send_state(icca, req, delay_us);
|
||||
bool encrypted = cmd_code == AC_IO_ICCA_CMD_POLL_ENCRYPTED;
|
||||
ac_io_emu_icca_send_state(icca, req, delay_us, encrypted);
|
||||
|
||||
break;
|
||||
|
||||
case AC_IO_ICCA_CMD_POLL_FELICA:
|
||||
icca->detected_new_reader = true;
|
||||
ac_io_emu_icca_send_status(icca, req, 0x01);
|
||||
|
||||
if (icca->version == v170) {
|
||||
ac_io_emu_icca_send_empty(icca, req);
|
||||
} else {
|
||||
ac_io_emu_icca_send_status(icca, req, 0x01);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AC_IO_ICCA_CMD_KEY_EXCHANGE:
|
||||
icca->detected_new_reader = true;
|
||||
log_misc("AC_IO_ICCA_CMD_KEY_EXCHANGE(%d)", req->addr);
|
||||
ac_io_emu_icca_cipher_set_key(icca, req);
|
||||
|
||||
break;
|
||||
|
||||
@@ -215,10 +246,27 @@ static void ac_io_emu_icca_cmd_send_version(
|
||||
resp.cmd.seq_no = req->cmd.seq_no;
|
||||
resp.cmd.nbytes = sizeof(resp.cmd.version);
|
||||
resp.cmd.version.type = ac_io_u32(AC_IO_NODE_TYPE_ICCA);
|
||||
|
||||
resp.cmd.version.flag = 0x00;
|
||||
resp.cmd.version.major = 0x01;
|
||||
resp.cmd.version.minor = 0x06;
|
||||
|
||||
if (icca->version == v150) {
|
||||
log_warning(
|
||||
"ICCA v1.5.0 emulation requested, please remove this log once implemented");
|
||||
resp.cmd.version.minor = 0x05;
|
||||
} else if (icca->version == v160) {
|
||||
resp.cmd.version.minor = 0x06;
|
||||
} else if (icca->version == v170) {
|
||||
resp.cmd.version.minor = 0x07;
|
||||
} else {
|
||||
// probably log invalid version here
|
||||
log_warning(
|
||||
"Unknown ICCA version: %d emulation requested",
|
||||
icca->version);
|
||||
}
|
||||
|
||||
resp.cmd.version.revision = 0x00;
|
||||
|
||||
memcpy(
|
||||
resp.cmd.version.product_code,
|
||||
"ICCA",
|
||||
@@ -261,7 +309,8 @@ static void ac_io_emu_icca_send_status(
|
||||
static void ac_io_emu_icca_send_state(
|
||||
struct ac_io_emu_icca *icca,
|
||||
const struct ac_io_message *req,
|
||||
uint64_t delay_us)
|
||||
uint64_t delay_us,
|
||||
bool encrypted)
|
||||
{
|
||||
struct ac_io_message resp;
|
||||
struct ac_io_icca_state *body;
|
||||
@@ -319,7 +368,10 @@ static void ac_io_emu_icca_send_state(
|
||||
} else if (card_full_insert) {
|
||||
body->status_code = AC_IO_ICCA_STATUS_GOT_UID;
|
||||
} else {
|
||||
if (icca->detected_new_reader) {
|
||||
if (icca->detected_new_reader && icca->version == v170) {
|
||||
// else we get a power failure?
|
||||
body->status_code = 0;
|
||||
} else if (icca->detected_new_reader) {
|
||||
body->status_code = AC_IO_ICCA_STATUS_IDLE_NEW;
|
||||
} else {
|
||||
body->status_code = AC_IO_ICCA_STATUS_IDLE;
|
||||
@@ -384,5 +436,88 @@ static void ac_io_emu_icca_send_state(
|
||||
body->status_code = AC_IO_ICCA_STATUS_FAULT;
|
||||
}
|
||||
|
||||
if (encrypted) {
|
||||
size_t base_state_sz = sizeof(struct ac_io_icca_state);
|
||||
resp.cmd.nbytes = base_state_sz + 2;
|
||||
|
||||
if (!icca->cipher_started) {
|
||||
log_warning("No crypto keys set for unit %d", icca->unit_no);
|
||||
} else {
|
||||
uint16_t crc = crc16_msb(resp.cmd.raw, base_state_sz, 0);
|
||||
|
||||
resp.cmd.raw[base_state_sz + 0] = (crc >> 8) & 0xFF;
|
||||
resp.cmd.raw[base_state_sz + 1] = crc & 0xFF;
|
||||
|
||||
ac_io_emu_icca_cipher(icca, resp.cmd.raw, 18);
|
||||
}
|
||||
}
|
||||
|
||||
ac_io_emu_response_push(icca->emu, &resp, delay_us);
|
||||
}
|
||||
|
||||
static void ac_io_emu_icca_cipher_shift_keys(struct ac_io_emu_icca *icca)
|
||||
{
|
||||
uint32_t key4_old = icca->cipher_keys[3];
|
||||
uint32_t key_new = (key4_old << 11) ^ key4_old;
|
||||
uint32_t key1_old = icca->cipher_keys[0];
|
||||
|
||||
// shift keys up
|
||||
icca->cipher_keys[3] = icca->cipher_keys[2];
|
||||
icca->cipher_keys[2] = icca->cipher_keys[1];
|
||||
icca->cipher_keys[1] = icca->cipher_keys[0];
|
||||
icca->cipher_keys[0] =
|
||||
((((key1_old >> 11) ^ key_new) >> 8) ^ key_new ^ key1_old);
|
||||
}
|
||||
|
||||
static void
|
||||
ac_io_emu_icca_cipher(struct ac_io_emu_icca *icca, uint8_t *data, size_t length)
|
||||
{
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint8_t count4 = i % 4;
|
||||
// shift keys every 4 bytes
|
||||
if (count4 == 0) {
|
||||
ac_io_emu_icca_cipher_shift_keys(icca);
|
||||
}
|
||||
|
||||
// process data
|
||||
data[i] =
|
||||
(uint8_t)(icca->cipher_keys[0] >> (((3 - count4) << 3)) ^ data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void ac_io_emu_icca_cipher_set_key(
|
||||
struct ac_io_emu_icca *icca, const struct ac_io_message *req)
|
||||
{
|
||||
struct ac_io_message resp;
|
||||
|
||||
resp.addr = req->addr | AC_IO_RESPONSE_FLAG;
|
||||
resp.cmd.code = req->cmd.code;
|
||||
resp.cmd.seq_no = req->cmd.seq_no;
|
||||
resp.cmd.nbytes = 4; // 4 bytes, uint32_t
|
||||
|
||||
uint32_t host_key = 0x00000000;
|
||||
host_key |= req->cmd.raw[0] << 24;
|
||||
host_key |= req->cmd.raw[1] << 16;
|
||||
host_key |= req->cmd.raw[2] << 8;
|
||||
host_key |= req->cmd.raw[3];
|
||||
|
||||
// TODO: should probably RNG this
|
||||
uint32_t reader_key = 0x14243444;
|
||||
resp.cmd.raw[0] = (reader_key >> 24) & 0xFF;
|
||||
resp.cmd.raw[1] = (reader_key >> 16) & 0xFF;
|
||||
resp.cmd.raw[2] = (reader_key >> 8) & 0xFF;
|
||||
resp.cmd.raw[3] = (reader_key) & 0xFF;
|
||||
|
||||
// so I looked these constants up, this isn't actually a secure key
|
||||
// generator it's actually Marsaglia's "KISS" algorithm with different
|
||||
// initial states
|
||||
icca->cipher_keys[0] = reader_key ^ 0x5491333;
|
||||
icca->cipher_keys[1] = host_key ^ 0x1F123BB5;
|
||||
icca->cipher_keys[2] = reader_key ^ 0x159A55E5;
|
||||
icca->cipher_keys[3] = host_key ^ 0x75BCD15;
|
||||
|
||||
log_misc("keys set to: H: %08x R: %08x", host_key, reader_key);
|
||||
|
||||
ac_io_emu_response_push(icca->emu, &resp, 0);
|
||||
icca->cipher_started = true;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
|
||||
#include "acioemu/emu.h"
|
||||
|
||||
enum ac_io_emu_icca_version {
|
||||
v150 = 0x5,
|
||||
v160 = 0x6,
|
||||
v170 = 0x7,
|
||||
};
|
||||
|
||||
struct ac_io_emu_icca {
|
||||
struct ac_io_emu *emu;
|
||||
uint8_t unit_no;
|
||||
@@ -20,11 +26,19 @@ struct ac_io_emu_icca {
|
||||
bool keypad_started;
|
||||
bool polling_started;
|
||||
uint64_t time_counter_last_poll;
|
||||
|
||||
enum ac_io_emu_icca_version version;
|
||||
bool cipher_started;
|
||||
uint32_t cipher_keys[4];
|
||||
};
|
||||
|
||||
void ac_io_emu_icca_init(
|
||||
struct ac_io_emu_icca *icca, struct ac_io_emu *emu, uint8_t unit_no);
|
||||
|
||||
// optional, call after init to override default version
|
||||
void ac_io_emu_icca_set_version(
|
||||
struct ac_io_emu_icca *icca, enum ac_io_emu_icca_version version);
|
||||
|
||||
void ac_io_emu_icca_dispatch_request(
|
||||
struct ac_io_emu_icca *icca, const struct ac_io_message *req);
|
||||
|
||||
|
||||
10
src/main/asio/Module.mk
Normal file
10
src/main/asio/Module.mk
Normal file
@@ -0,0 +1,10 @@
|
||||
libs += asio
|
||||
|
||||
libs_asio := \
|
||||
hook \
|
||||
hooklib \
|
||||
util \
|
||||
|
||||
src_asio := \
|
||||
asio-reghook.c \
|
||||
config-asio.c \
|
||||
199
src/main/asio/asio-reghook.c
Normal file
199
src/main/asio/asio-reghook.c
Normal file
@@ -0,0 +1,199 @@
|
||||
#define LOG_MODULE "asio-reghook"
|
||||
|
||||
// clang-format off
|
||||
// Don't format because the order is important here
|
||||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
// clang-format on
|
||||
|
||||
#include <winreg.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "asio/asio-reghook.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
#include "util/time.h"
|
||||
|
||||
// MAXDRVNAMELEN
|
||||
#define ASIO_NAME_STRING_SIZE 128
|
||||
|
||||
static char asio_expected_name[ASIO_NAME_STRING_SIZE] = "XONAR SOUND CARD(64)";
|
||||
static char asio_target_name[ASIO_NAME_STRING_SIZE] = "XONAR SOUND CARD(64)";
|
||||
static HKEY asio_root_key;
|
||||
static HKEY asio_sub_key;
|
||||
|
||||
LSTATUS my_RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);
|
||||
|
||||
LSTATUS my_RegEnumKeyA(HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cchName);
|
||||
|
||||
LSTATUS my_RegOpenKeyExA(
|
||||
HKEY hKey,
|
||||
LPCSTR lpSubKey,
|
||||
DWORD ulOptions,
|
||||
REGSAM samDesired,
|
||||
PHKEY phkResult);
|
||||
|
||||
LSTATUS my_RegQueryValueExA(
|
||||
HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData);
|
||||
|
||||
LSTATUS my_RegCloseKey(HKEY hKey);
|
||||
|
||||
LSTATUS (*real_RegOpenKeyA)(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);
|
||||
|
||||
LSTATUS (*real_RegEnumKeyA)
|
||||
(HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cchName);
|
||||
|
||||
LSTATUS (*real_RegOpenKeyExA)
|
||||
(HKEY hKey,
|
||||
LPCSTR lpSubKey,
|
||||
DWORD ulOptions,
|
||||
REGSAM samDesired,
|
||||
PHKEY phkResult);
|
||||
|
||||
LSTATUS (*real_RegQueryValueExA)
|
||||
(HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData);
|
||||
|
||||
LSTATUS (*real_RegCloseKey)(HKEY hKey);
|
||||
|
||||
static const struct hook_symbol asio_reghook_advapi32_syms[] = {
|
||||
{.name = "RegOpenKeyA",
|
||||
.patch = my_RegOpenKeyA,
|
||||
.link = (void **) &real_RegOpenKeyA},
|
||||
{.name = "RegEnumKeyA",
|
||||
.patch = my_RegEnumKeyA,
|
||||
.link = (void **) &real_RegEnumKeyA},
|
||||
{.name = "RegOpenKeyExA",
|
||||
.patch = my_RegOpenKeyExA,
|
||||
.link = (void **) &real_RegOpenKeyExA},
|
||||
{.name = "RegQueryValueExA",
|
||||
.patch = my_RegQueryValueExA,
|
||||
.link = (void **) &real_RegQueryValueExA},
|
||||
{.name = "RegCloseKey",
|
||||
.patch = my_RegCloseKey,
|
||||
.link = (void **) &real_RegCloseKey},
|
||||
};
|
||||
|
||||
LSTATUS my_RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
|
||||
{
|
||||
LSTATUS result = real_RegOpenKeyA(hKey, lpSubKey, phkResult);
|
||||
|
||||
if (!strcmp("software\\asio", lpSubKey)) {
|
||||
log_info("ASIO root key found");
|
||||
asio_root_key = *phkResult;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
LSTATUS my_RegEnumKeyA(HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cchName)
|
||||
{
|
||||
LSTATUS result = real_RegEnumKeyA(hKey, dwIndex, lpName, cchName);
|
||||
|
||||
if (hKey == asio_root_key) {
|
||||
if (!strcmp(asio_target_name, lpName)) {
|
||||
log_info(
|
||||
"Replacing key [%s] with [%s]",
|
||||
asio_target_name,
|
||||
asio_expected_name);
|
||||
strncpy(lpName, asio_expected_name, cchName);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
LSTATUS my_RegOpenKeyExA(
|
||||
HKEY hKey,
|
||||
LPCSTR lpSubKey,
|
||||
DWORD ulOptions,
|
||||
REGSAM samDesired,
|
||||
PHKEY phkResult)
|
||||
{
|
||||
if (hKey == asio_root_key) {
|
||||
if (!strcmp(asio_expected_name, lpSubKey)) {
|
||||
// swap to the real one so the call succeeds
|
||||
LSTATUS result = real_RegOpenKeyExA(
|
||||
hKey, asio_target_name, ulOptions, samDesired, phkResult);
|
||||
|
||||
asio_sub_key = *phkResult;
|
||||
log_info("ASIO device key found");
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return real_RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult);
|
||||
}
|
||||
|
||||
LSTATUS my_RegQueryValueExA(
|
||||
HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData)
|
||||
{
|
||||
DWORD lpcbData_orig = *lpcbData;
|
||||
LSTATUS result = real_RegQueryValueExA(
|
||||
hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
|
||||
if (result == ERROR_SUCCESS) {
|
||||
if (hKey == asio_sub_key) {
|
||||
if (!strcmp("description", lpValueName)) {
|
||||
log_info(
|
||||
"Replacing description [%s] with [%s]",
|
||||
lpData,
|
||||
asio_expected_name);
|
||||
strncpy((char *) lpData, asio_expected_name, lpcbData_orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
LSTATUS my_RegCloseKey(HKEY hKey)
|
||||
{
|
||||
if (hKey == asio_root_key) {
|
||||
asio_root_key = NULL;
|
||||
}
|
||||
|
||||
if (hKey == asio_sub_key) {
|
||||
asio_sub_key = NULL;
|
||||
}
|
||||
|
||||
return real_RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
void asio_reghook_init(const char *expected_name, const char *target_name)
|
||||
{
|
||||
strncpy(asio_expected_name, expected_name, ASIO_NAME_STRING_SIZE - 1);
|
||||
strncpy(asio_target_name, target_name, ASIO_NAME_STRING_SIZE - 1);
|
||||
|
||||
asio_expected_name[ASIO_NAME_STRING_SIZE - 1] = '\0';
|
||||
asio_target_name[ASIO_NAME_STRING_SIZE - 1] = '\0';
|
||||
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"Advapi32.dll",
|
||||
asio_reghook_advapi32_syms,
|
||||
lengthof(asio_reghook_advapi32_syms));
|
||||
|
||||
log_info("Inserted reg hooks for ASIO override");
|
||||
}
|
||||
6
src/main/asio/asio-reghook.h
Normal file
6
src/main/asio/asio-reghook.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef IASIO_REG_HOOK_H
|
||||
#define IASIO_REG_HOOK_H
|
||||
|
||||
void asio_reghook_init(const char *expected_name, const char *target_name);
|
||||
|
||||
#endif
|
||||
56
src/main/asio/config-asio.c
Normal file
56
src/main/asio/config-asio.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "asio/config-asio.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
#define ASIOHOOK_CONFIG_IO_FORCE_ASIO_KEY "asio.force_asio"
|
||||
#define ASIOHOOK_CONFIG_IO_ASIO_DEVICE_NAME_KEY "asio.device_name"
|
||||
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_ASIO_VALUE false
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE \
|
||||
"XONAR SOUND CARD(64)"
|
||||
|
||||
void asiohook_config_init(struct cconfig *config)
|
||||
{
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
ASIOHOOK_CONFIG_IO_FORCE_ASIO_KEY,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_ASIO_VALUE,
|
||||
"Force ASIO audio mode/device");
|
||||
|
||||
cconfig_util_set_str(
|
||||
config,
|
||||
ASIOHOOK_CONFIG_IO_ASIO_DEVICE_NAME_KEY,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE,
|
||||
"The ASIO device name to use");
|
||||
}
|
||||
|
||||
void asiohook_config_asio_get(
|
||||
struct asiohook_config_asio *config_asio, struct cconfig *config)
|
||||
{
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
ASIOHOOK_CONFIG_IO_FORCE_ASIO_KEY,
|
||||
&config_asio->force_asio,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_ASIO_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
ASIOHOOK_CONFIG_IO_FORCE_ASIO_KEY,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_ASIO_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_str(
|
||||
config,
|
||||
ASIOHOOK_CONFIG_IO_ASIO_DEVICE_NAME_KEY,
|
||||
config_asio->replacement_name,
|
||||
sizeof(config_asio->replacement_name) - 1,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%s'",
|
||||
ASIOHOOK_CONFIG_IO_ASIO_DEVICE_NAME_KEY,
|
||||
ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE);
|
||||
}
|
||||
}
|
||||
18
src/main/asio/config-asio.h
Normal file
18
src/main/asio/config-asio.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef ASIOHOOK_CONFIG_IO_H
|
||||
#define ASIOHOOK_CONFIG_IO_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
struct asiohook_config_asio {
|
||||
bool force_asio;
|
||||
char replacement_name[128];
|
||||
};
|
||||
|
||||
void asiohook_config_init(struct cconfig *config);
|
||||
|
||||
void asiohook_config_asio_get(
|
||||
struct asiohook_config_asio *config_asio, struct cconfig *config);
|
||||
|
||||
#endif
|
||||
@@ -32,8 +32,7 @@ enum ddr_pad_bit {
|
||||
DDR_P1_MENU_DOWN = 0x01,
|
||||
};
|
||||
|
||||
/* p3io controls menu btn and marquee lights
|
||||
extio controls neons and stage lights. */
|
||||
// see the functions below for more information
|
||||
|
||||
enum p3io_light_bit {
|
||||
LIGHT_P1_MENU = 0x00,
|
||||
@@ -41,7 +40,32 @@ enum p3io_light_bit {
|
||||
LIGHT_P2_LOWER_LAMP = 0x04,
|
||||
LIGHT_P2_UPPER_LAMP = 0x05,
|
||||
LIGHT_P1_LOWER_LAMP = 0x06,
|
||||
LIGHT_P1_UPPER_LAMP = 0x07
|
||||
LIGHT_P1_UPPER_LAMP = 0x07,
|
||||
};
|
||||
|
||||
enum hdxs_light_bit {
|
||||
LIGHT_HD_P1_START = 0x08,
|
||||
LIGHT_HD_P1_UP_DOWN = 0x09,
|
||||
LIGHT_HD_P1_LEFT_RIGHT = 0x0A,
|
||||
LIGHT_HD_P2_START = 0x0B,
|
||||
LIGHT_HD_P2_UP_DOWN = 0x0C,
|
||||
LIGHT_HD_P2_LEFT_RIGHT = 0x0D,
|
||||
};
|
||||
|
||||
// the indexing starts from 0x20 if you're looking in geninput
|
||||
enum hdxs_rgb_light_idx {
|
||||
LIGHT_HD_P1_SPEAKER_F_R = 0x00,
|
||||
LIGHT_HD_P1_SPEAKER_F_G = 0x01,
|
||||
LIGHT_HD_P1_SPEAKER_F_B = 0x02,
|
||||
LIGHT_HD_P2_SPEAKER_F_R = 0x03,
|
||||
LIGHT_HD_P2_SPEAKER_F_G = 0x04,
|
||||
LIGHT_HD_P2_SPEAKER_F_B = 0x05,
|
||||
LIGHT_HD_P1_SPEAKER_W_R = 0x06,
|
||||
LIGHT_HD_P1_SPEAKER_W_G = 0x07,
|
||||
LIGHT_HD_P1_SPEAKER_W_B = 0x08,
|
||||
LIGHT_HD_P2_SPEAKER_W_R = 0x09,
|
||||
LIGHT_HD_P2_SPEAKER_W_G = 0x0A,
|
||||
LIGHT_HD_P2_SPEAKER_W_B = 0x0B,
|
||||
};
|
||||
|
||||
enum extio_light_bit {
|
||||
@@ -81,9 +105,26 @@ bool ddr_io_init(
|
||||
thread_join_t thread_join,
|
||||
thread_destroy_t thread_destroy);
|
||||
|
||||
|
||||
/* used to poll the IO for input, note that this is also where lights are
|
||||
flushed to the device for geninput */
|
||||
uint32_t ddr_io_read_pad(void);
|
||||
|
||||
/* The following are optional to implement, and allow lights to be set and
|
||||
emulated as needed */
|
||||
|
||||
/* used to set pad lights, as well as the bass neon on SD cabs */
|
||||
void ddr_io_set_lights_extio(uint32_t extio_lights);
|
||||
|
||||
/* used to set SD panel lights, and HD spot lights */
|
||||
void ddr_io_set_lights_p3io(uint32_t p3io_lights);
|
||||
|
||||
/* used to set HD cab front panel lights */
|
||||
void ddr_io_set_lights_hdxs_panel(uint32_t hdxs_lights);
|
||||
|
||||
/* used to set HD cab speaker RGB lights */
|
||||
void ddr_io_set_lights_hdxs_rgb(uint8_t idx, uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
void ddr_io_fini(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -206,6 +206,7 @@ my_CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
|
||||
|
||||
char builtString[CAMERA_DATA_STRING_SIZE] = {0};
|
||||
if (pdnDevInst) {
|
||||
log_info("seeking: %s", pDeviceID);
|
||||
for (size_t i = 0; i < CAMHOOK_CONFIG_CAM_MAX; ++i) {
|
||||
if (camData[i].setup) {
|
||||
snprintf(
|
||||
@@ -213,6 +214,7 @@ my_CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
|
||||
CAMERA_DATA_STRING_SIZE,
|
||||
"USB\\VID_288C&PID_0002&MI_00\\%s",
|
||||
camData[i].extra_upper);
|
||||
log_info("built: %s", builtString);
|
||||
if (strcmp(pDeviceID, builtString) == 0) {
|
||||
if (!camData[i].fake_located) {
|
||||
camData[i].fake_located_node = num_located_cams;
|
||||
@@ -280,7 +282,9 @@ HRESULT my_GetAllocatedString(
|
||||
|
||||
// should probably check GUID, oh well
|
||||
ret = real_GetAllocatedString(self, guidKey, ppwszValue, pcchLength);
|
||||
log_info("Obtained: %ls", *ppwszValue);
|
||||
char *pMBBuffer = (char *) malloc(0x100);
|
||||
wcstombs(pMBBuffer, *ppwszValue, 0x100);
|
||||
log_info("Obtained: %s", pMBBuffer);
|
||||
|
||||
wchar_t *pwc = NULL;
|
||||
|
||||
@@ -308,8 +312,11 @@ HRESULT my_GetAllocatedString(
|
||||
|
||||
pwc[29] = L'0';
|
||||
pwc[30] = L'0';
|
||||
log_info("Replaced: %ls", *ppwszValue);
|
||||
|
||||
wcstombs(pMBBuffer, *ppwszValue, 0x100);
|
||||
log_info("Replaced: %s", pMBBuffer);
|
||||
}
|
||||
free(pMBBuffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -787,6 +794,8 @@ void fill_cam_struct(struct CameraData *data, const char *devid)
|
||||
|
||||
void camhook_init(struct camhook_config_cam *config_cam)
|
||||
{
|
||||
MFStartup(0x20070u, 0);
|
||||
|
||||
// fill before applying hooks
|
||||
for (size_t i = 0; i < config_cam->num_devices; ++i) {
|
||||
fill_cam_struct(&camData[i], config_cam->device_id[i]);
|
||||
@@ -814,3 +823,8 @@ void camhook_init(struct camhook_config_cam *config_cam)
|
||||
log_info("No cams detected, not hooking");
|
||||
}
|
||||
}
|
||||
|
||||
void camhook_fini(void)
|
||||
{
|
||||
MFShutdown();
|
||||
}
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
|
||||
void camhook_init(struct camhook_config_cam *config_cam);
|
||||
|
||||
void camhook_fini(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,5 +9,6 @@ bool cconfig_hook_config_init(
|
||||
const char *usage_header,
|
||||
enum cconfig_cmd_usage_out cmd_usage_out)
|
||||
{
|
||||
return cconfig_main_config_init(config, "--config", NULL, "--help", "-h", usage_header, cmd_usage_out);
|
||||
return cconfig_main_config_init(
|
||||
config, "--config", NULL, "--help", "-h", usage_header, cmd_usage_out);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/**
|
||||
* Init function for cconfig for hooks
|
||||
*
|
||||
*
|
||||
* calls cconfig_main_config_init with some defaults for hook dlls
|
||||
* see: cconfig_main_config_init for more details
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,8 @@ bool cconfig_main_config_init(
|
||||
args_recover(&argc, &argv);
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (!strcmp(argv[i], help_parameter_short_name) || !strcmp(argv[i], help_parameter_name)) {
|
||||
if (!strcmp(argv[i], help_parameter_short_name) ||
|
||||
!strcmp(argv[i], help_parameter_name)) {
|
||||
goto failure_usage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/**
|
||||
* Init function for cconfig after all cconfig_util_set's have been called
|
||||
*
|
||||
*
|
||||
* will parse a config file first (if specified)
|
||||
* then uses override config parameters from cmd
|
||||
*/
|
||||
|
||||
@@ -256,13 +256,33 @@ STRINGTABLE
|
||||
IDS_DDR_P2_DOWN "P2 Down"
|
||||
IDS_DDR_P2_LEFT "P2 Left"
|
||||
IDS_DDR_P2_RIGHT "P2 Right"
|
||||
IDS_DDR_P1_MENU_LIGHT "P1 Menu Lights"
|
||||
IDS_DDR_P1_MENU_LIGHT "P1 Menu Lights / HD Spot Red Satellite"
|
||||
IDS_DDR_P1_TOP_LIGHT "P1 Marquee Top Light"
|
||||
IDS_DDR_P1_BOTTOM_LIGHT "P1 Marquee Bottom Light"
|
||||
IDS_DDR_P2_MENU_LIGHT "P2 Menu Lights"
|
||||
IDS_DDR_P2_MENU_LIGHT "P2 Menu Lights / HD Spot Blue Satellite"
|
||||
IDS_DDR_P2_TOP_LIGHT "P2 Marquee Top Light"
|
||||
IDS_DDR_P2_BOTTOM_LIGHT "P2 Marquee Bottom Light"
|
||||
IDS_DDR_BASS_LIGHT "Bass Neons"
|
||||
IDS_DDR_HD_P1_START "P1 HD Start"
|
||||
IDS_DDR_HD_P1_UP_DOWN "P1 HD Up/Down"
|
||||
IDS_DDR_HD_P1_LEFT_RIGHT "P1 HD Left/Right"
|
||||
IDS_DDR_HD_P2_START "P2 HD Start"
|
||||
IDS_DDR_HD_P2_UP_DOWN "P2 HD Up/Down"
|
||||
IDS_DDR_HD_P2_LEFT_RIGHT "P2 HD Left/Right"
|
||||
IDS_DDR_HD_P1_SPEAKER_F_R "P1 HD Speaker F R"
|
||||
IDS_DDR_HD_P1_SPEAKER_F_G "P1 HD Speaker F G"
|
||||
IDS_DDR_HD_P1_SPEAKER_F_B "P1 HD Speaker F B"
|
||||
IDS_DDR_HD_P2_SPEAKER_F_R "P2 HD Speaker F R"
|
||||
IDS_DDR_HD_P2_SPEAKER_F_G "P2 HD Speaker F G"
|
||||
IDS_DDR_HD_P2_SPEAKER_F_B "P2 HD Speaker F B"
|
||||
IDS_DDR_HD_P1_SPEAKER_W_R "P1 HD Speaker W R"
|
||||
IDS_DDR_HD_P1_SPEAKER_W_G "P1 HD Speaker W G"
|
||||
IDS_DDR_HD_P1_SPEAKER_W_B "P1 HD Speaker W B"
|
||||
IDS_DDR_HD_P2_SPEAKER_W_R "P2 HD Speaker W R"
|
||||
IDS_DDR_HD_P2_SPEAKER_W_G "P2 HD Speaker W G"
|
||||
IDS_DDR_HD_P2_SPEAKER_W_B "P2 HD Speaker W B"
|
||||
IDS_DDR_HD_SPOT_RED_TOP "HD Spot Red Top"
|
||||
IDS_DDR_HD_SPOT_BLUE_TOP "HD Spot Blue Top"
|
||||
IDS_PNM_SCHEMA "pop'n music"
|
||||
IDS_PNM_BTN1 "Button 1"
|
||||
IDS_PNM_BTN2 "Button 2"
|
||||
@@ -273,6 +293,15 @@ STRINGTABLE
|
||||
IDS_PNM_BTN7 "Button 7"
|
||||
IDS_PNM_BTN8 "Button 8"
|
||||
IDS_PNM_BTN9 "Button 9"
|
||||
IDS_PNM_TOP1 "Top neon 1 (topmost red)"
|
||||
IDS_PNM_TOP2 "Top neon 2 (orange)"
|
||||
IDS_PNM_TOP3 "Top neon 3 (green)"
|
||||
IDS_PNM_TOP4 "Top neon 4 (green)"
|
||||
IDS_PNM_TOP5 "Top neon 5 (bottom green)"
|
||||
IDS_PNM_LB "Left lamp (blue)"
|
||||
IDS_PNM_LR "Left lamp (red)"
|
||||
IDS_PNM_RB "Right lamp (blue)"
|
||||
IDS_PNM_RR "Right lamp (red)"
|
||||
IDS_JB_SCHEMA "Jubeat"
|
||||
IDS_JB_PANEL1 "Panel 1"
|
||||
IDS_JB_PANEL2 "Panel 2"
|
||||
|
||||
@@ -105,19 +105,32 @@ int main(int argc, char **argv)
|
||||
eam_io_init(crt_thread_create, crt_thread_join, crt_thread_destroy);
|
||||
eam_io_config_api = eam_io_get_config_api();
|
||||
|
||||
// calculate these and check against the loaded config
|
||||
max_light = -1;
|
||||
|
||||
for (i = 0; i < schema->nlights; i++) {
|
||||
if (max_light < schema->lights[i].bit) {
|
||||
max_light = schema->lights[i].bit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mapper_config_load(schema->name)) {
|
||||
log_info("Initializing empty config for %s", schema->name);
|
||||
|
||||
max_light = -1;
|
||||
|
||||
for (i = 0; i < schema->nlights; i++) {
|
||||
if (max_light < schema->lights[i].bit) {
|
||||
max_light = schema->lights[i].bit;
|
||||
}
|
||||
}
|
||||
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
mapper_set_nanalogs((uint8_t) schema->nanalogs);
|
||||
} else {
|
||||
// make sure that these are right
|
||||
|
||||
if (mapper_get_nlights() != (max_light + 1)) {
|
||||
log_info("Updating nlights for %s", schema->name);
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
}
|
||||
|
||||
if (mapper_get_nanalogs() != schema->nanalogs) {
|
||||
log_info("Updating nanalogs for %s", schema->name);
|
||||
mapper_set_nanalogs((uint8_t) schema->nanalogs);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
|
||||
@@ -243,3 +243,32 @@
|
||||
#define IDS_IIDX_PANEL_S3 40200
|
||||
#define IDS_IIDX_PANEL_S4 40201
|
||||
#define IDS_IIDX_PANEL_S5 40202
|
||||
#define IDS_PNM_TOP1 40203
|
||||
#define IDS_PNM_TOP2 40204
|
||||
#define IDS_PNM_TOP3 40205
|
||||
#define IDS_PNM_TOP4 40206
|
||||
#define IDS_PNM_TOP5 40207
|
||||
#define IDS_PNM_LB 40208
|
||||
#define IDS_PNM_LR 40209
|
||||
#define IDS_PNM_RB 40210
|
||||
#define IDS_PNM_RR 40211
|
||||
#define IDS_DDR_HD_P1_START 40212
|
||||
#define IDS_DDR_HD_P1_UP_DOWN 40213
|
||||
#define IDS_DDR_HD_P1_LEFT_RIGHT 40214
|
||||
#define IDS_DDR_HD_P2_START 40215
|
||||
#define IDS_DDR_HD_P2_UP_DOWN 40216
|
||||
#define IDS_DDR_HD_P2_LEFT_RIGHT 40217
|
||||
#define IDS_DDR_HD_P1_SPEAKER_F_R 40218
|
||||
#define IDS_DDR_HD_P1_SPEAKER_F_G 40219
|
||||
#define IDS_DDR_HD_P1_SPEAKER_F_B 40220
|
||||
#define IDS_DDR_HD_P2_SPEAKER_F_R 40221
|
||||
#define IDS_DDR_HD_P2_SPEAKER_F_G 40222
|
||||
#define IDS_DDR_HD_P2_SPEAKER_F_B 40223
|
||||
#define IDS_DDR_HD_P1_SPEAKER_W_R 40224
|
||||
#define IDS_DDR_HD_P1_SPEAKER_W_G 40225
|
||||
#define IDS_DDR_HD_P1_SPEAKER_W_B 40226
|
||||
#define IDS_DDR_HD_P2_SPEAKER_W_R 40227
|
||||
#define IDS_DDR_HD_P2_SPEAKER_W_G 40228
|
||||
#define IDS_DDR_HD_P2_SPEAKER_W_B 40229
|
||||
#define IDS_DDR_HD_SPOT_RED_TOP 40230
|
||||
#define IDS_DDR_HD_SPOT_BLUE_TOP 40231
|
||||
|
||||
@@ -3,30 +3,32 @@
|
||||
|
||||
#include "util/defs.h"
|
||||
|
||||
static const struct action_def dm_actions[] = {{0x01, IDS_GENERIC_TEST},
|
||||
{0x00, IDS_GENERIC_SERVICE},
|
||||
static const struct action_def dm_actions[] = {
|
||||
{0x01, IDS_GENERIC_TEST},
|
||||
{0x00, IDS_GENERIC_SERVICE},
|
||||
|
||||
{0x08, IDS_DM_START},
|
||||
{0x0F, IDS_DM_MENU_LEFT},
|
||||
{0x11, IDS_DM_MENU_RIGHT},
|
||||
{0x08, IDS_DM_START},
|
||||
{0x0F, IDS_DM_MENU_LEFT},
|
||||
{0x11, IDS_DM_MENU_RIGHT},
|
||||
|
||||
{0x0A, IDS_DM_HI_HAT},
|
||||
{0x0C, IDS_DM_SNARE},
|
||||
{0x0E, IDS_DM_HIGH_TOM},
|
||||
{0x10, IDS_DM_LOW_TOM},
|
||||
{0x12, IDS_DM_CYMBAL},
|
||||
{0x16, IDS_DM_BASS}};
|
||||
{0x0A, IDS_DM_HI_HAT},
|
||||
{0x0C, IDS_DM_SNARE},
|
||||
{0x0E, IDS_DM_HIGH_TOM},
|
||||
{0x10, IDS_DM_LOW_TOM},
|
||||
{0x12, IDS_DM_CYMBAL},
|
||||
{0x16, IDS_DM_BASS}};
|
||||
|
||||
static const struct light_def dm_lights[] = {{0x00, IDS_DM_HI_HAT},
|
||||
{0x01, IDS_DM_SNARE},
|
||||
{0x02, IDS_DM_HIGH_TOM},
|
||||
{0x03, IDS_DM_LOW_TOM},
|
||||
{0x04, IDS_DM_CYMBAL},
|
||||
{0x09, IDS_DM_BASS},
|
||||
{0x0A, IDS_DM_SPEAKER_LIGHT},
|
||||
{0x08, IDS_DM_SPOT_LIGHT},
|
||||
{0x06, IDS_DM_START_LIGHT},
|
||||
{0x07, IDS_DM_MENU_LIGHT}};
|
||||
static const struct light_def dm_lights[] = {
|
||||
{0x00, IDS_DM_HI_HAT},
|
||||
{0x01, IDS_DM_SNARE},
|
||||
{0x02, IDS_DM_HIGH_TOM},
|
||||
{0x03, IDS_DM_LOW_TOM},
|
||||
{0x04, IDS_DM_CYMBAL},
|
||||
{0x09, IDS_DM_BASS},
|
||||
{0x0A, IDS_DM_SPEAKER_LIGHT},
|
||||
{0x08, IDS_DM_SPOT_LIGHT},
|
||||
{0x06, IDS_DM_START_LIGHT},
|
||||
{0x07, IDS_DM_MENU_LIGHT}};
|
||||
|
||||
static const struct action_def gf_actions[] = {
|
||||
{0x01, IDS_GENERIC_TEST}, {0x00, IDS_GENERIC_SERVICE},
|
||||
@@ -43,10 +45,11 @@ static const struct action_def gf_actions[] = {
|
||||
{0x13, IDS_GF_P2_RED}, {0x15, IDS_GF_P2_GREEN},
|
||||
{0x17, IDS_GF_P2_BLUE}};
|
||||
|
||||
static const struct light_def gf_lights[] = {{0x08, IDS_GF_P1_SPOT_LIGHT},
|
||||
{0x09, IDS_GF_P2_SPOT_LIGHT},
|
||||
{0x0A, IDS_GF_P1_START},
|
||||
{0x0B, IDS_GF_P2_START}};
|
||||
static const struct light_def gf_lights[] = {
|
||||
{0x08, IDS_GF_P1_SPOT_LIGHT},
|
||||
{0x09, IDS_GF_P2_SPOT_LIGHT},
|
||||
{0x0A, IDS_GF_P1_START},
|
||||
{0x0B, IDS_GF_P2_START}};
|
||||
|
||||
static const struct action_def iidx_actions[] = {
|
||||
{0x1C, IDS_GENERIC_TEST}, {0x1D, IDS_GENERIC_SERVICE},
|
||||
@@ -101,8 +104,8 @@ static const struct light_def iidx_lights[] = {
|
||||
|
||||
{0x1F, IDS_IIDX_NEON_LIGHT}};
|
||||
|
||||
static const struct analog_def iidx_analogs[] = {{0, IDS_IIDX_P1_TT},
|
||||
{1, IDS_IIDX_P2_TT}};
|
||||
static const struct analog_def iidx_analogs[] = {
|
||||
{0, IDS_IIDX_P1_TT}, {1, IDS_IIDX_P2_TT}};
|
||||
|
||||
static const struct action_def ddr_actions[] = {
|
||||
{0x04, IDS_GENERIC_TEST}, {0x06, IDS_GENERIC_SERVICE},
|
||||
@@ -122,19 +125,48 @@ static const struct action_def ddr_actions[] = {
|
||||
static const struct light_def ddr_lights[] = {
|
||||
/* These are split between non-overlapping P3IO and EXTIO state words */
|
||||
|
||||
// P3IO: SD
|
||||
{0x00, IDS_DDR_P1_MENU_LIGHT},
|
||||
{0x07, IDS_DDR_P1_TOP_LIGHT},
|
||||
{0x07, IDS_DDR_P1_BOTTOM_LIGHT},
|
||||
|
||||
{0x1E, IDS_DDR_P1_UP},
|
||||
{0x1D, IDS_DDR_P1_DOWN},
|
||||
{0x1C, IDS_DDR_P1_LEFT},
|
||||
{0x1B, IDS_DDR_P1_RIGHT},
|
||||
{0x06, IDS_DDR_P1_BOTTOM_LIGHT},
|
||||
|
||||
{0x01, IDS_DDR_P2_MENU_LIGHT},
|
||||
{0x05, IDS_DDR_P2_TOP_LIGHT},
|
||||
{0x04, IDS_DDR_P2_BOTTOM_LIGHT},
|
||||
|
||||
// P3IO: HD
|
||||
{0x02, IDS_DDR_HD_SPOT_RED_TOP},
|
||||
{0x03, IDS_DDR_HD_SPOT_BLUE_TOP},
|
||||
|
||||
// P3IO: HDXS
|
||||
{0x08, IDS_DDR_HD_P1_START},
|
||||
{0x09, IDS_DDR_HD_P1_UP_DOWN},
|
||||
{0x0A, IDS_DDR_HD_P1_LEFT_RIGHT},
|
||||
|
||||
{0x0B, IDS_DDR_HD_P2_START},
|
||||
{0x0C, IDS_DDR_HD_P2_UP_DOWN},
|
||||
{0x0D, IDS_DDR_HD_P2_LEFT_RIGHT},
|
||||
|
||||
{0x20, IDS_DDR_HD_P1_SPEAKER_F_R},
|
||||
{0x21, IDS_DDR_HD_P1_SPEAKER_F_G},
|
||||
{0x22, IDS_DDR_HD_P1_SPEAKER_F_B},
|
||||
{0x23, IDS_DDR_HD_P2_SPEAKER_F_R},
|
||||
{0x24, IDS_DDR_HD_P2_SPEAKER_F_G},
|
||||
{0x25, IDS_DDR_HD_P2_SPEAKER_F_B},
|
||||
{0x26, IDS_DDR_HD_P1_SPEAKER_W_R},
|
||||
{0x27, IDS_DDR_HD_P1_SPEAKER_W_G},
|
||||
{0x28, IDS_DDR_HD_P1_SPEAKER_W_B},
|
||||
{0x29, IDS_DDR_HD_P2_SPEAKER_W_R},
|
||||
{0x2A, IDS_DDR_HD_P2_SPEAKER_W_G},
|
||||
{0x2B, IDS_DDR_HD_P2_SPEAKER_W_B},
|
||||
|
||||
|
||||
// EXTIO
|
||||
{0x1E, IDS_DDR_P1_UP},
|
||||
{0x1D, IDS_DDR_P1_DOWN},
|
||||
{0x1C, IDS_DDR_P1_LEFT},
|
||||
{0x1B, IDS_DDR_P1_RIGHT},
|
||||
|
||||
{0x16, IDS_DDR_P2_UP},
|
||||
{0x15, IDS_DDR_P2_DOWN},
|
||||
{0x14, IDS_DDR_P2_LEFT},
|
||||
@@ -142,18 +174,19 @@ static const struct light_def ddr_lights[] = {
|
||||
|
||||
{0x0E, IDS_DDR_BASS_LIGHT}};
|
||||
|
||||
static const struct action_def pnm_actions[] = {{0x07, IDS_GENERIC_TEST},
|
||||
{0x06, IDS_GENERIC_SERVICE},
|
||||
static const struct action_def pnm_actions[] = {
|
||||
{0x07, IDS_GENERIC_TEST},
|
||||
{0x06, IDS_GENERIC_SERVICE},
|
||||
|
||||
{0x08, IDS_PNM_BTN1},
|
||||
{0x09, IDS_PNM_BTN2},
|
||||
{0x0A, IDS_PNM_BTN3},
|
||||
{0x0B, IDS_PNM_BTN4},
|
||||
{0x0C, IDS_PNM_BTN5},
|
||||
{0x0D, IDS_PNM_BTN6},
|
||||
{0x0E, IDS_PNM_BTN7},
|
||||
{0x0F, IDS_PNM_BTN8},
|
||||
{0x10, IDS_PNM_BTN9}};
|
||||
{0x08, IDS_PNM_BTN1},
|
||||
{0x09, IDS_PNM_BTN2},
|
||||
{0x0A, IDS_PNM_BTN3},
|
||||
{0x0B, IDS_PNM_BTN4},
|
||||
{0x0C, IDS_PNM_BTN5},
|
||||
{0x0D, IDS_PNM_BTN6},
|
||||
{0x0E, IDS_PNM_BTN7},
|
||||
{0x0F, IDS_PNM_BTN8},
|
||||
{0x10, IDS_PNM_BTN9}};
|
||||
|
||||
static const struct light_def pnm_lights[] = {
|
||||
{0x17, IDS_PNM_BTN1},
|
||||
@@ -165,27 +198,37 @@ static const struct light_def pnm_lights[] = {
|
||||
{0x1D, IDS_PNM_BTN7},
|
||||
{0x1E, IDS_PNM_BTN8},
|
||||
{0x1F, IDS_PNM_BTN9},
|
||||
{0x20, IDS_PNM_TOP1},
|
||||
{0x21, IDS_PNM_TOP2},
|
||||
{0x22, IDS_PNM_TOP3},
|
||||
{0x23, IDS_PNM_TOP4},
|
||||
{0x24, IDS_PNM_TOP5},
|
||||
{0x25, IDS_PNM_LB},
|
||||
{0x26, IDS_PNM_LR},
|
||||
{0x27, IDS_PNM_RB},
|
||||
{0x28, IDS_PNM_RR},
|
||||
};
|
||||
|
||||
static const struct action_def jb_actions[] = {{0x10, IDS_GENERIC_TEST},
|
||||
{0x11, IDS_GENERIC_SERVICE},
|
||||
static const struct action_def jb_actions[] = {
|
||||
{0x10, IDS_GENERIC_TEST},
|
||||
{0x11, IDS_GENERIC_SERVICE},
|
||||
|
||||
{0x00, IDS_JB_PANEL1},
|
||||
{0x01, IDS_JB_PANEL2},
|
||||
{0x02, IDS_JB_PANEL3},
|
||||
{0x03, IDS_JB_PANEL4},
|
||||
{0x04, IDS_JB_PANEL5},
|
||||
{0x05, IDS_JB_PANEL6},
|
||||
{0x06, IDS_JB_PANEL7},
|
||||
{0x07, IDS_JB_PANEL8},
|
||||
{0x08, IDS_JB_PANEL9},
|
||||
{0x09, IDS_JB_PANEL10},
|
||||
{0x0A, IDS_JB_PANEL11},
|
||||
{0x0B, IDS_JB_PANEL12},
|
||||
{0x0C, IDS_JB_PANEL13},
|
||||
{0x0D, IDS_JB_PANEL14},
|
||||
{0x0E, IDS_JB_PANEL15},
|
||||
{0x0F, IDS_JB_PANEL16}};
|
||||
{0x00, IDS_JB_PANEL1},
|
||||
{0x01, IDS_JB_PANEL2},
|
||||
{0x02, IDS_JB_PANEL3},
|
||||
{0x03, IDS_JB_PANEL4},
|
||||
{0x04, IDS_JB_PANEL5},
|
||||
{0x05, IDS_JB_PANEL6},
|
||||
{0x06, IDS_JB_PANEL7},
|
||||
{0x07, IDS_JB_PANEL8},
|
||||
{0x08, IDS_JB_PANEL9},
|
||||
{0x09, IDS_JB_PANEL10},
|
||||
{0x0A, IDS_JB_PANEL11},
|
||||
{0x0B, IDS_JB_PANEL12},
|
||||
{0x0C, IDS_JB_PANEL13},
|
||||
{0x0D, IDS_JB_PANEL14},
|
||||
{0x0E, IDS_JB_PANEL15},
|
||||
{0x0F, IDS_JB_PANEL16}};
|
||||
|
||||
static const struct light_def jb_lights[] = {
|
||||
{0x00, IDS_JB_RGB_FRONT_R},
|
||||
@@ -208,15 +251,16 @@ static const struct light_def jb_lights[] = {
|
||||
{0x11, IDS_JB_RGB_WOOFER_B},
|
||||
};
|
||||
|
||||
static const struct action_def sdvx_actions[] = {{0x05, IDS_GENERIC_TEST},
|
||||
{0x04, IDS_GENERIC_SERVICE},
|
||||
{0x0B, IDS_SDVX_START},
|
||||
{0x0A, IDS_SDVX_BTN_A},
|
||||
{0x09, IDS_SDVX_BTN_B},
|
||||
{0x08, IDS_SDVX_BTN_C},
|
||||
{0x15, IDS_SDVX_BTN_D},
|
||||
{0x14, IDS_SDVX_FX_L},
|
||||
{0x13, IDS_SDVX_FX_R}};
|
||||
static const struct action_def sdvx_actions[] = {
|
||||
{0x05, IDS_GENERIC_TEST},
|
||||
{0x04, IDS_GENERIC_SERVICE},
|
||||
{0x0B, IDS_SDVX_START},
|
||||
{0x0A, IDS_SDVX_BTN_A},
|
||||
{0x09, IDS_SDVX_BTN_B},
|
||||
{0x08, IDS_SDVX_BTN_C},
|
||||
{0x15, IDS_SDVX_BTN_D},
|
||||
{0x14, IDS_SDVX_FX_L},
|
||||
{0x13, IDS_SDVX_FX_R}};
|
||||
|
||||
static const struct light_def sdvx_lights[] = {
|
||||
{0x0D, IDS_SDVX_BTN_A}, {0x0E, IDS_SDVX_BTN_B}, {0x0F, IDS_SDVX_BTN_C},
|
||||
@@ -229,19 +273,19 @@ static const struct light_def sdvx_lights[] = {
|
||||
{0x1E, IDS_SDVX_RGB5_B}, {0x1F, IDS_SDVX_RGB6_R}, {0x20, IDS_SDVX_RGB6_G},
|
||||
{0x21, IDS_SDVX_RGB6_B}};
|
||||
|
||||
static const struct analog_def sdvx_analogs[] = {{0, IDS_SDVX_VOL_L},
|
||||
{1, IDS_SDVX_VOL_R}};
|
||||
static const struct analog_def sdvx_analogs[] = {
|
||||
{0, IDS_SDVX_VOL_L}, {1, IDS_SDVX_VOL_R}};
|
||||
|
||||
static const struct action_def rb_actions[] = {{0x00, IDS_GENERIC_TEST},
|
||||
{0x01, IDS_GENERIC_SERVICE}};
|
||||
static const struct action_def rb_actions[] = {
|
||||
{0x00, IDS_GENERIC_TEST}, {0x01, IDS_GENERIC_SERVICE}};
|
||||
|
||||
static const struct action_def bst_actions[] = {
|
||||
{0x05, IDS_GENERIC_TEST},
|
||||
{0x04, IDS_GENERIC_SERVICE},
|
||||
};
|
||||
|
||||
static const struct eam_unit_def schema_eam_unit_defs[] = {{IDS_READER_P1, 0},
|
||||
{IDS_READER_P2, 1}};
|
||||
static const struct eam_unit_def schema_eam_unit_defs[] = {
|
||||
{IDS_READER_P1, 0}, {IDS_READER_P2, 1}};
|
||||
|
||||
const struct schema schemas[] = {
|
||||
{"iidx",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <d3d9.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cconfig/cconfig-util.h"
|
||||
@@ -8,15 +10,21 @@
|
||||
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FRAMED_KEY "gfx.framed"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY "gfx.windowed"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY "gfx.confined"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY "gfx.forced_refresh_rate"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY "gfx.forced_refresh_rate"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY "gfx.device_adapter"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY "gfx.force_orientation"
|
||||
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE -1
|
||||
|
||||
void d3d9exhook_config_gfx_init(struct cconfig *config)
|
||||
{
|
||||
@@ -32,6 +40,12 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE,
|
||||
"Run the game windowed");
|
||||
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE,
|
||||
"Confine mouse coursor to window");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
@@ -46,9 +60,24 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE,
|
||||
"Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)");
|
||||
"Forced refresh rate, -1 to not force any (try 59 or 60 if monitor "
|
||||
"check fails to lock on high refresh rate monitors)");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
|
||||
"D3D9ex device adapter (monitor), -1 to use default, "
|
||||
"0, 1, 2 etc. to use specified adapter");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE,
|
||||
"Orientation to force monitor into, -1 to use default, "
|
||||
"0, 1, 2, 3 to do 0, 90, 180, 270 degrees");
|
||||
}
|
||||
|
||||
void d3d9exhook_config_gfx_get(
|
||||
@@ -78,6 +107,18 @@ void d3d9exhook_config_gfx_get(
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY,
|
||||
&config_gfx->confined,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
@@ -104,13 +145,37 @@ void d3d9exhook_config_gfx_get(
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
&config_gfx->forced_refresh_rate,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
&config_gfx->device_adapter,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY,
|
||||
&config_gfx->force_orientation,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,19 @@
|
||||
|
||||
/**
|
||||
* Config struct for d3d9exhook
|
||||
*
|
||||
*
|
||||
* Note: forced_refresh_rate sets the monitor's refresh rate
|
||||
* (it does not limit FPS or anything)
|
||||
*/
|
||||
struct d3d9exhook_config_gfx {
|
||||
bool framed;
|
||||
bool windowed;
|
||||
bool confined;
|
||||
int32_t window_width;
|
||||
int32_t window_height;
|
||||
int32_t forced_refresh_rate;
|
||||
int32_t device_adapter;
|
||||
int32_t force_orientation;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,6 +47,8 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
|
||||
static HRESULT STDCALL my_Direct3DCreate9Ex(UINT sdk_ver, IDirect3D9Ex **api);
|
||||
|
||||
static WNDPROC real_WndProc;
|
||||
|
||||
static BOOL STDCALL my_EnumDisplayDevicesA(
|
||||
const char *dev_name, DWORD dev_num, DISPLAY_DEVICEA *info, DWORD flags);
|
||||
|
||||
@@ -82,10 +84,13 @@ static BOOL(STDCALL *real_MoveWindow)(
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static bool d3d9ex_windowed;
|
||||
static bool d3d9ex_confined;
|
||||
static int32_t d3d9ex_force_refresh_rate = -1;
|
||||
static int32_t d3d9ex_window_width = -1;
|
||||
static int32_t d3d9ex_window_height = -1;
|
||||
static bool d3d9ex_window_framed;
|
||||
static int32_t d3d9ex_device_adapter = -1;
|
||||
static int32_t d3d9ex_force_orientation = -1;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -181,6 +186,52 @@ my_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
|
||||
return result;
|
||||
}
|
||||
|
||||
static LRESULT gfx_confine(HWND hwnd)
|
||||
{
|
||||
POINT p;
|
||||
RECT r;
|
||||
|
||||
log_misc("Confining mouse (ALT-TAB to release)");
|
||||
|
||||
p.x = 0;
|
||||
p.y = 0;
|
||||
|
||||
ClientToScreen(hwnd, &p);
|
||||
|
||||
r.left = p.x;
|
||||
r.top = p.y;
|
||||
r.right = p.x + 100;
|
||||
r.bottom = p.y + 100;
|
||||
|
||||
ClipCursor(&r);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static LRESULT gfx_unconfine(HWND hwnd)
|
||||
{
|
||||
log_misc("Un-confining mouse");
|
||||
|
||||
ClipCursor(NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
my_WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_SETFOCUS:
|
||||
return gfx_confine(hwnd);
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
return gfx_unconfine(hwnd);
|
||||
|
||||
default:
|
||||
return CallWindowProc(real_WndProc, hwnd, msg, wparam, lparam);
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_CreateDeviceEx(
|
||||
IDirect3D9Ex *self,
|
||||
UINT adapter,
|
||||
@@ -194,24 +245,83 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
IDirect3D9Ex *real = COM_PROXY_UNWRAP(self);
|
||||
HRESULT hr;
|
||||
|
||||
if (d3d9ex_device_adapter >= 0) {
|
||||
log_info("Forcing adapter %d -> %d", adapter, d3d9ex_device_adapter);
|
||||
adapter = d3d9ex_device_adapter;
|
||||
}
|
||||
|
||||
if (d3d9ex_windowed) {
|
||||
fdm = NULL;
|
||||
pp->Windowed = TRUE;
|
||||
pp->FullScreen_RefreshRateInHz = 0;
|
||||
} else {
|
||||
if (d3d9ex_force_refresh_rate != -1) {
|
||||
log_info("Forcing refresh rate %d -> %d", pp->FullScreen_RefreshRateInHz, d3d9ex_force_refresh_rate);
|
||||
if (d3d9ex_force_refresh_rate > 0) {
|
||||
log_info(
|
||||
"Forcing refresh rate %d -> %d",
|
||||
pp->FullScreen_RefreshRateInHz,
|
||||
d3d9ex_force_refresh_rate);
|
||||
pp->FullScreen_RefreshRateInHz = d3d9ex_force_refresh_rate;
|
||||
if (fdm) {
|
||||
fdm->RefreshRate = pp->FullScreen_RefreshRateInHz;
|
||||
}
|
||||
}
|
||||
|
||||
if (d3d9ex_force_orientation >= DMDO_DEFAULT &&
|
||||
d3d9ex_force_orientation <= DMDO_270) {
|
||||
D3DADAPTER_IDENTIFIER9 adapter_ident;
|
||||
if (IDirect3D9Ex_GetAdapterIdentifier(
|
||||
real, adapter, 0, &adapter_ident) == D3D_OK) {
|
||||
// straight outta MSDN
|
||||
DEVMODE dm;
|
||||
// initialize the DEVMODE structure
|
||||
ZeroMemory(&dm, sizeof(dm));
|
||||
dm.dmSize = sizeof(dm);
|
||||
|
||||
if (EnumDisplaySettings(
|
||||
adapter_ident.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) {
|
||||
|
||||
int32_t delta =
|
||||
d3d9ex_force_orientation - dm.dmDisplayOrientation;
|
||||
|
||||
if (delta % 2 != 0) {
|
||||
// swap height and width
|
||||
DWORD dwTemp = dm.dmPelsHeight;
|
||||
dm.dmPelsHeight = dm.dmPelsWidth;
|
||||
dm.dmPelsWidth = dwTemp;
|
||||
}
|
||||
|
||||
dm.dmDisplayOrientation = d3d9ex_force_orientation;
|
||||
|
||||
long cd_ret = ChangeDisplaySettingsEx(
|
||||
adapter_ident.DeviceName,
|
||||
&dm,
|
||||
NULL,
|
||||
CDS_FULLSCREEN,
|
||||
NULL);
|
||||
|
||||
if (cd_ret == DISP_CHANGE_SUCCESSFUL) {
|
||||
log_info(
|
||||
"Overriding rotation suceeded: %s",
|
||||
adapter_ident.DeviceName);
|
||||
} else {
|
||||
log_info(
|
||||
"Overriding rotation failed %s %ld",
|
||||
adapter_ident.DeviceName,
|
||||
cd_ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = IDirect3D9Ex_CreateDeviceEx(
|
||||
real, adapter, type, hwnd, flags, pp, fdm, pdev);
|
||||
|
||||
// TODO stuff
|
||||
if (SUCCEEDED(hr) && d3d9ex_confined) {
|
||||
real_WndProc = (void *) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
||||
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (uintptr_t) my_WndProc);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -261,14 +371,17 @@ void d3d9ex_hook_init(void)
|
||||
log_info("Inserted graphics hooks");
|
||||
}
|
||||
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config)
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config)
|
||||
{
|
||||
d3d9ex_windowed = gfx_config->windowed;
|
||||
d3d9ex_confined = gfx_config->confined;
|
||||
d3d9ex_window_framed = gfx_config->framed;
|
||||
d3d9ex_window_width = gfx_config->window_width;
|
||||
d3d9ex_window_height = gfx_config->window_height;
|
||||
|
||||
d3d9ex_force_refresh_rate = gfx_config->forced_refresh_rate;
|
||||
d3d9ex_device_adapter = gfx_config->device_adapter;
|
||||
d3d9ex_force_orientation = gfx_config->force_orientation;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -16,6 +16,6 @@ void d3d9ex_hook_init(void);
|
||||
*
|
||||
* @param gfx_config Config to apply.
|
||||
*/
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config);
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,6 @@ libs_ddrhook := \
|
||||
p3io \
|
||||
hook \
|
||||
hooklib \
|
||||
security \
|
||||
util \
|
||||
eamio \
|
||||
ddrio \
|
||||
|
||||
@@ -11,10 +11,14 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "acio/hdxs.h"
|
||||
|
||||
#include "acioemu/addr.h"
|
||||
#include "acioemu/hdxs.h"
|
||||
#include "acioemu/icca.h"
|
||||
|
||||
#include "bemanitools/ddrio.h"
|
||||
|
||||
#include "ddrhook/_com4.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
@@ -29,16 +33,60 @@ static struct ac_io_emu com4_ac_io_emu;
|
||||
static struct ac_io_emu_hdxs com4_hdxs;
|
||||
static struct ac_io_emu_icca com4_icca[2];
|
||||
|
||||
static uint32_t check_panel_light(
|
||||
const struct ac_io_hdxs_output *output,
|
||||
uint8_t panel_idx,
|
||||
uint8_t out_idx)
|
||||
{
|
||||
if (output->lights[panel_idx].bit) {
|
||||
return 1 << out_idx;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t upscale_light(uint8_t in_7bit) {
|
||||
if (in_7bit < 0x10) {
|
||||
return in_7bit * 2;
|
||||
} else {
|
||||
// so we can actually reach 0xFF
|
||||
return (in_7bit * 2) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void lights_dispatcher(
|
||||
struct ac_io_emu_hdxs *emu, const struct ac_io_message *req)
|
||||
{
|
||||
const struct ac_io_hdxs_output *output = &req->cmd.hdxs_output;
|
||||
|
||||
uint32_t lights = 0;
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_START, LIGHT_HD_P1_START);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_UP_DOWN, LIGHT_HD_P1_UP_DOWN);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_LEFT_RIGHT, LIGHT_HD_P1_LEFT_RIGHT);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_START, LIGHT_HD_P2_START);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_UP_DOWN, LIGHT_HD_P2_UP_DOWN);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_LEFT_RIGHT, LIGHT_HD_P2_LEFT_RIGHT);
|
||||
|
||||
ddr_io_set_lights_hdxs_panel(lights);
|
||||
|
||||
for (uint8_t i = 0; i < 4; ++i) {
|
||||
size_t light_idx = i * 3;
|
||||
|
||||
// these are 7 bit, upscale them to 8 bit
|
||||
uint8_t r = upscale_light(output->lights[light_idx + AC_IO_HDXS_RED].analog);
|
||||
uint8_t g = upscale_light(output->lights[light_idx + AC_IO_HDXS_GREEN].analog);
|
||||
uint8_t b = upscale_light(output->lights[light_idx + AC_IO_HDXS_BLUE].analog);
|
||||
|
||||
ddr_io_set_lights_hdxs_rgb(i, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
void com4_init(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/* This isn't a real COM port, we configure the core P3IO emulator code to
|
||||
generate IRPs addressed to COM4 and then we intercept them. */
|
||||
|
||||
p3io_uart_set_path(0, L"COM4");
|
||||
ac_io_emu_init(&com4_ac_io_emu, L"COM4");
|
||||
ac_io_emu_hdxs_init(&com4_hdxs, &com4_ac_io_emu);
|
||||
ac_io_emu_hdxs_init(&com4_hdxs, &com4_ac_io_emu, lights_dispatcher);
|
||||
|
||||
for (i = 0; i < lengthof(com4_icca); i++) {
|
||||
ac_io_emu_icca_init(&com4_icca[i], &com4_ac_io_emu, i);
|
||||
|
||||
@@ -32,7 +32,7 @@ static bool my_dll_entry_main(void);
|
||||
bool standard_def;
|
||||
bool _15khz;
|
||||
|
||||
static const irp_handler_t ddrhook_handlers[] = {
|
||||
static const irp_handler_t ddrhook_com4_handlers[] = {
|
||||
p3io_emu_dispatch_irp,
|
||||
extio_dispatch_irp,
|
||||
spike_dispatch_irp,
|
||||
@@ -40,15 +40,27 @@ static const irp_handler_t ddrhook_handlers[] = {
|
||||
com4_dispatch_irp,
|
||||
};
|
||||
|
||||
static const irp_handler_t ddrhook_handlers[] = {
|
||||
/* Same as above, but without COM4 emulation.
|
||||
See ddrhook/p3io.c for details. */
|
||||
|
||||
p3io_emu_dispatch_irp,
|
||||
extio_dispatch_irp,
|
||||
spike_dispatch_irp,
|
||||
usbmem_dispatch_irp,
|
||||
};
|
||||
|
||||
static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
bool com4;
|
||||
bool ok;
|
||||
int i;
|
||||
|
||||
log_info("--- Begin ddrhook dll_entry_init ---");
|
||||
|
||||
com4 = true;
|
||||
args_recover(&argc, &argv);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@@ -65,13 +77,25 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
case 'w':
|
||||
gfx_set_windowed();
|
||||
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
/* Don't emulate P3IO COM4 and its downstream devices, use the
|
||||
Windows COM4 port instead. */
|
||||
com4 = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
args_free(argc, argv);
|
||||
|
||||
iohook_init(ddrhook_handlers, lengthof(ddrhook_handlers));
|
||||
if (com4) {
|
||||
iohook_init(ddrhook_com4_handlers, lengthof(ddrhook_com4_handlers));
|
||||
} else {
|
||||
iohook_init(ddrhook_handlers, lengthof(ddrhook_handlers));
|
||||
}
|
||||
|
||||
rs232_hook_init();
|
||||
|
||||
master_insert_hooks(NULL);
|
||||
@@ -92,15 +116,17 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("Initializing card reader backend");
|
||||
if (com4) {
|
||||
log_info("Initializing card reader backend");
|
||||
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
|
||||
if (!ok) {
|
||||
return false;
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
log_info("--- End ddrhook dll_entry_init ---");
|
||||
|
||||
@@ -29,6 +29,12 @@ static const struct p3io_ops p3io_ddr_ops = {
|
||||
|
||||
void p3io_ddr_init(void)
|
||||
{
|
||||
/* COM4 isn't a real COM port, we configure the core P3IO emulator code to
|
||||
generate IRPs addressed to COM4 and then we possibly intercept them in
|
||||
_com4.c (or possibly don't, in which case the communications will be
|
||||
sent to the real COM4 on your system) */
|
||||
|
||||
p3io_uart_set_path(0, L"COM4");
|
||||
p3io_emu_init(&p3io_ddr_ops, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,3 +7,5 @@ EXPORTS
|
||||
ddr_io_read_pad
|
||||
ddr_io_set_lights_extio
|
||||
ddr_io_set_lights_p3io
|
||||
ddr_io_set_lights_hdxs_panel
|
||||
ddr_io_set_lights_hdxs_rgb
|
||||
|
||||
@@ -207,6 +207,21 @@ void ddr_io_set_lights_p3io(uint32_t p3io_lights)
|
||||
atomic_fetch_and(&out.lights, ~clr);
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_panel(uint32_t lights)
|
||||
{
|
||||
(void) lights;
|
||||
// stubbed
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_rgb(uint8_t idx, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
(void) idx;
|
||||
(void) r;
|
||||
(void) g;
|
||||
(void) b;
|
||||
// stubbed
|
||||
}
|
||||
|
||||
void ddr_io_fini(void)
|
||||
{
|
||||
if (initted) {
|
||||
|
||||
@@ -7,3 +7,5 @@ EXPORTS
|
||||
ddr_io_read_pad
|
||||
ddr_io_set_lights_extio
|
||||
ddr_io_set_lights_p3io
|
||||
ddr_io_set_lights_hdxs_panel
|
||||
ddr_io_set_lights_hdxs_rgb
|
||||
|
||||
@@ -41,24 +41,28 @@ static const struct ddr_io_smx_pad_map ddr_io_smx_pad_map[] = {
|
||||
{1, 1 << 7, 1 << DDR_P2_DOWN},
|
||||
};
|
||||
|
||||
#define DDR_IO_SMX_LIGHT_VALUES_PER_PANEL 75
|
||||
#define DDR_IO_SMX_NUMBER_OF_PANELS 18
|
||||
#define DDR_IO_SMX_TOTAL_LIGHT_VALUES DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * DDR_IO_SMX_NUMBER_OF_PANELS
|
||||
|
||||
static const struct ddr_io_smx_light_map ddr_io_smx_light_map[] = {
|
||||
/* Light L/R blue and U/D red to match DDR pad color scheme */
|
||||
|
||||
{1 << LIGHT_P1_UP, 48 * 1, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P1_LEFT, 48 * 3, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_RIGHT, 48 * 5, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_DOWN, 48 * 7, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P1_UP, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 1, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P1_LEFT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 3, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_RIGHT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 5, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_DOWN, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 7, 0xFF, 0x00, 0x00},
|
||||
|
||||
{1 << LIGHT_P2_UP, 48 * 10, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P2_LEFT, 48 * 12, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_RIGHT, 48 * 14, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_DOWN, 48 * 16, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P2_UP, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 10, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P2_LEFT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 12, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_RIGHT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 14, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_DOWN, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 16, 0xFF, 0x00, 0x00},
|
||||
};
|
||||
|
||||
static _Atomic uint32_t ddr_io_smx_pad_state[2];
|
||||
static CRITICAL_SECTION ddr_io_smx_lights_lock;
|
||||
static uint8_t ddr_io_smx_lights_counter;
|
||||
static char ddr_io_smx_lights[864];
|
||||
static char ddr_io_smx_lights[DDR_IO_SMX_TOTAL_LIGHT_VALUES];
|
||||
|
||||
void ddr_io_set_loggers(
|
||||
log_formatter_t misc,
|
||||
@@ -109,7 +113,7 @@ uint32_t ddr_io_read_pad(void)
|
||||
EnterCriticalSection(&ddr_io_smx_lights_lock);
|
||||
|
||||
if (ddr_io_smx_lights_counter == 0) {
|
||||
SMX_SetLights(ddr_io_smx_lights);
|
||||
SMX_SetLights2(ddr_io_smx_lights, lengthof(ddr_io_smx_lights));
|
||||
}
|
||||
|
||||
ddr_io_smx_lights_counter++;
|
||||
@@ -149,7 +153,7 @@ void ddr_io_set_lights_extio(uint32_t lights)
|
||||
if (lights & map->extio_bit) {
|
||||
offset = map->smx_light_offset;
|
||||
|
||||
for (j = 0; j < 48; j += 3) {
|
||||
for (j = 0; j < DDR_IO_SMX_LIGHT_VALUES_PER_PANEL; j += 3) {
|
||||
ddr_io_smx_lights[offset + j] = map->r;
|
||||
ddr_io_smx_lights[offset + j + 1] = map->g;
|
||||
ddr_io_smx_lights[offset + j + 2] = map->b;
|
||||
@@ -164,11 +168,30 @@ void ddr_io_set_lights_p3io(uint32_t lights)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0x0E; i <= 0x1E; i++) {
|
||||
for (i = 0x00; i <= 0x07; i++) {
|
||||
mapper_write_light(i, lights & (1 << i) ? 255 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_panel(uint32_t lights)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0x08; i <= 0x0D; i++) {
|
||||
mapper_write_light(i, lights & (1 << i) ? 255 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_rgb(uint8_t idx, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
if (idx < 4) {
|
||||
uint8_t base = 0x20 + idx * 3;
|
||||
mapper_write_light(base + 0, r);
|
||||
mapper_write_light(base + 1, g);
|
||||
mapper_write_light(base + 2, b);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_fini(void)
|
||||
{
|
||||
log_info("Stopping SMX.DLL");
|
||||
|
||||
@@ -43,7 +43,7 @@ void ddr_io_set_lights_extio(uint32_t lights)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0x00; i <= 0x07; i++) {
|
||||
for (i = 0x0E; i <= 0x1E; i++) {
|
||||
mapper_write_light(i, lights & (1 << i) ? 255 : 0);
|
||||
}
|
||||
}
|
||||
@@ -52,11 +52,30 @@ void ddr_io_set_lights_p3io(uint32_t lights)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0x0E; i <= 0x1E; i++) {
|
||||
for (i = 0x00; i <= 0x07; i++) {
|
||||
mapper_write_light(i, lights & (1 << i) ? 255 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_panel(uint32_t lights)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0x08; i <= 0x0D; i++) {
|
||||
mapper_write_light(i, lights & (1 << i) ? 255 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_set_lights_hdxs_rgb(uint8_t idx, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
if (idx < 4) {
|
||||
uint8_t base = 0x20 + idx * 3;
|
||||
mapper_write_light(base + 0, r);
|
||||
mapper_write_light(base + 1, g);
|
||||
mapper_write_light(base + 2, b);
|
||||
}
|
||||
}
|
||||
|
||||
void ddr_io_fini(void)
|
||||
{
|
||||
input_fini();
|
||||
|
||||
@@ -7,3 +7,5 @@ EXPORTS
|
||||
ddr_io_read_pad
|
||||
ddr_io_set_lights_extio
|
||||
ddr_io_set_lights_p3io
|
||||
ddr_io_set_lights_hdxs_panel
|
||||
ddr_io_set_lights_hdxs_rgb
|
||||
|
||||
10
src/main/dinput/Module.mk
Normal file
10
src/main/dinput/Module.mk
Normal file
@@ -0,0 +1,10 @@
|
||||
libs += dinput
|
||||
|
||||
libs_dinput := \
|
||||
hook \
|
||||
hooklib \
|
||||
util \
|
||||
|
||||
src_dinput := \
|
||||
dinput.c \
|
||||
device_dinput8.c \
|
||||
307
src/main/dinput/device_dinput8.c
Normal file
307
src/main/dinput/device_dinput8.c
Normal file
@@ -0,0 +1,307 @@
|
||||
#include "dinput/device_dinput8.h"
|
||||
|
||||
static ULONG REF_COUNT = 0;
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_QueryInterface(
|
||||
IDirectInputDevice8W FAR *This, REFIID riid, void **ppvObj)
|
||||
{
|
||||
if (ppvObj == NULL) {
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDeviceA) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDeviceW) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice2A) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice2W) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice7A) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice7W) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice8A) ||
|
||||
IsEqualGUID(riid, &IID_IDirectInputDevice8W)) {
|
||||
This->lpVtbl->AddRef(This);
|
||||
*ppvObj = This;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_AddRef(IDirectInputDevice8W FAR *This)
|
||||
{
|
||||
return ++REF_COUNT;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_Release(IDirectInputDevice8W FAR *This)
|
||||
{
|
||||
return --REF_COUNT;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetCapabilities(
|
||||
IDirectInputDevice8W FAR *This, LPDIDEVCAPS lpDIDevCaps)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_EnumObjects(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
|
||||
LPVOID pvRef,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetProperty(
|
||||
IDirectInputDevice8W FAR *This, REFGUID rguidProp, LPDIPROPHEADER pdiph)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SetProperty(
|
||||
IDirectInputDevice8W FAR *This, REFGUID rguidProp, LPCDIPROPHEADER pdiph)
|
||||
{
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_Acquire(IDirectInputDevice8W FAR *This)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_Unacquire(IDirectInputDevice8W FAR *This)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetDeviceState(
|
||||
IDirectInputDevice8W FAR *This, DWORD cbData, LPVOID lpvData)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetDeviceData(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
DWORD cbObjectData,
|
||||
LPDIDEVICEOBJECTDATA rgdod,
|
||||
LPDWORD pdwInOut,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SetDataFormat(
|
||||
IDirectInputDevice8W FAR *This, LPCDIDATAFORMAT lpdf)
|
||||
{
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SetEventNotification(
|
||||
IDirectInputDevice8W FAR *This, HANDLE hEvent)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SetCooperativeLevel(
|
||||
IDirectInputDevice8W FAR *This, HWND hWnd, DWORD dwFlags)
|
||||
{
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetObjectInfo(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIDEVICEOBJECTINSTANCEW pdidoi,
|
||||
DWORD dwObj,
|
||||
DWORD dwHow)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetDeviceInfo(
|
||||
IDirectInputDevice8W FAR *This, LPDIDEVICEINSTANCEW pdidi)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_RunControlPanel(
|
||||
IDirectInputDevice8W FAR *This, HWND hwndOwner, DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_Initialize(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
HINSTANCE hinst,
|
||||
DWORD dwVersion,
|
||||
REFGUID rguid)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_CreateEffect(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
REFGUID rguid,
|
||||
LPCDIEFFECT lpeff,
|
||||
LPDIRECTINPUTEFFECT *ppdeff,
|
||||
LPUNKNOWN punkOuter)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_EnumEffects(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIENUMEFFECTSCALLBACKW lpCallback,
|
||||
LPVOID pvRef,
|
||||
DWORD dwEffType)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetEffectInfo(
|
||||
IDirectInputDevice8W FAR *This, LPDIEFFECTINFOW pdei, REFGUID rguid)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetForceFeedbackState(
|
||||
IDirectInputDevice8W FAR *This, LPDWORD pdwOut)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SendForceFeedbackCommand(
|
||||
IDirectInputDevice8W FAR *This, DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_EnumCreatedEffectObjects(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
|
||||
LPVOID pvRef,
|
||||
DWORD fl)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_Escape(IDirectInputDevice8W FAR *This, LPDIEFFESCAPE pesc)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
IDirectInputDevice8W_Poll(IDirectInputDevice8W FAR *This)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SendDeviceData(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
DWORD cbObjectData,
|
||||
LPCDIDEVICEOBJECTDATA rgdod,
|
||||
LPDWORD pdwInOut,
|
||||
DWORD fl)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_EnumEffectsInFile(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPCWSTR lpszFileName,
|
||||
LPDIENUMEFFECTSINFILECALLBACK pec,
|
||||
LPVOID pvRef,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_WriteEffectToFile(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPCWSTR lpszFileName,
|
||||
DWORD dwEntries,
|
||||
LPDIFILEEFFECT rgDiFileEft,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_BuildActionMap(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIACTIONFORMATW lpdiaf,
|
||||
LPCWSTR lpszUserName,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_SetActionMap(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIACTIONFORMATW lpdiaf,
|
||||
LPCWSTR lpszUserName,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IDirectInputDevice8W_GetImageInfo(
|
||||
IDirectInputDevice8W FAR *This,
|
||||
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
|
||||
{
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
static IDirectInputDevice8WVtbl stub_device_vtbl = {
|
||||
|
||||
// IUnknown
|
||||
.QueryInterface = IDirectInputDevice8W_QueryInterface,
|
||||
.AddRef = IDirectInputDevice8W_AddRef,
|
||||
.Release = IDirectInputDevice8W_Release,
|
||||
|
||||
// IDirectInputDeviceW
|
||||
.GetCapabilities = IDirectInputDevice8W_GetCapabilities,
|
||||
.EnumObjects = IDirectInputDevice8W_EnumObjects,
|
||||
.GetProperty = IDirectInputDevice8W_GetProperty,
|
||||
.SetProperty = IDirectInputDevice8W_SetProperty,
|
||||
.Acquire = IDirectInputDevice8W_Acquire,
|
||||
.Unacquire = IDirectInputDevice8W_Unacquire,
|
||||
.GetDeviceState = IDirectInputDevice8W_GetDeviceState,
|
||||
.GetDeviceData = IDirectInputDevice8W_GetDeviceData,
|
||||
.SetDataFormat = IDirectInputDevice8W_SetDataFormat,
|
||||
.SetEventNotification = IDirectInputDevice8W_SetEventNotification,
|
||||
.SetCooperativeLevel = IDirectInputDevice8W_SetCooperativeLevel,
|
||||
.GetObjectInfo = IDirectInputDevice8W_GetObjectInfo,
|
||||
.GetDeviceInfo = IDirectInputDevice8W_GetDeviceInfo,
|
||||
.RunControlPanel = IDirectInputDevice8W_RunControlPanel,
|
||||
.Initialize = IDirectInputDevice8W_Initialize,
|
||||
|
||||
// IDirectInputDevice2W
|
||||
.CreateEffect = IDirectInputDevice8W_CreateEffect,
|
||||
.EnumEffects = IDirectInputDevice8W_EnumEffects,
|
||||
.GetEffectInfo = IDirectInputDevice8W_GetEffectInfo,
|
||||
.GetForceFeedbackState = IDirectInputDevice8W_GetForceFeedbackState,
|
||||
.SendForceFeedbackCommand = IDirectInputDevice8W_SendForceFeedbackCommand,
|
||||
.EnumCreatedEffectObjects = IDirectInputDevice8W_EnumCreatedEffectObjects,
|
||||
.Escape = IDirectInputDevice8W_Escape,
|
||||
.Poll = IDirectInputDevice8W_Poll,
|
||||
.SendDeviceData = IDirectInputDevice8W_SendDeviceData,
|
||||
|
||||
// IDirectInputDevice7W
|
||||
.EnumEffectsInFile = IDirectInputDevice8W_EnumEffectsInFile,
|
||||
.WriteEffectToFile = IDirectInputDevice8W_WriteEffectToFile,
|
||||
|
||||
// IDirectInputDevice8W
|
||||
.BuildActionMap = IDirectInputDevice8W_BuildActionMap,
|
||||
.SetActionMap = IDirectInputDevice8W_SetActionMap,
|
||||
.GetImageInfo = IDirectInputDevice8W_GetImageInfo,
|
||||
};
|
||||
|
||||
static IDirectInputDevice8W stub_device_object = {
|
||||
.lpVtbl = &stub_device_vtbl,
|
||||
};
|
||||
|
||||
IDirectInputDevice8W *di8_stub_device = &stub_device_object;
|
||||
10
src/main/dinput/device_dinput8.h
Normal file
10
src/main/dinput/device_dinput8.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef DINPUTHOOK_DEVICES_DINPUT8_H
|
||||
#define DINPUTHOOK_DEVICES_DINPUT8_H
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
extern IDirectInputDevice8W *di8_stub_device;
|
||||
|
||||
#endif
|
||||
114
src/main/dinput/dinput.c
Normal file
114
src/main/dinput/dinput.c
Normal file
@@ -0,0 +1,114 @@
|
||||
#include <windows.h>
|
||||
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
|
||||
#include "dinput/device_dinput8.h"
|
||||
#include "dinput/dinput.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/pe.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
|
||||
static HRESULT STDCALL my_DirectInput8Create(
|
||||
HINSTANCE hinst,
|
||||
DWORD dwVersion,
|
||||
REFIID riidltf,
|
||||
LPVOID *ppvOut,
|
||||
LPVOID punkOuter);
|
||||
|
||||
static HRESULT(STDCALL *real_DirectInput8Create)(
|
||||
HINSTANCE hinst,
|
||||
DWORD dwVersion,
|
||||
REFIID riidltf,
|
||||
LPVOID *ppvOut,
|
||||
LPVOID punkOuter);
|
||||
|
||||
static const struct hook_symbol dinput_syms[] = {
|
||||
{
|
||||
.name = "DirectInput8Create",
|
||||
.patch = my_DirectInput8Create,
|
||||
.link = (void **) &real_DirectInput8Create,
|
||||
},
|
||||
};
|
||||
|
||||
static HRESULT STDCALL my_CreateDevice(
|
||||
IDirectInput8W *self,
|
||||
REFGUID rguid,
|
||||
LPDIRECTINPUTDEVICE8W *lplpDirectInputDevice,
|
||||
LPUNKNOWN pUnkOuter)
|
||||
{
|
||||
log_misc("IDirectInput8::CreateDevice hook hit");
|
||||
|
||||
if (lplpDirectInputDevice == NULL) {
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(rguid, &GUID_SysKeyboard) ||
|
||||
IsEqualGUID(rguid, &GUID_SysMouse)) {
|
||||
log_misc("Returning stub device");
|
||||
|
||||
*lplpDirectInputDevice = di8_stub_device;
|
||||
di8_stub_device->lpVtbl->AddRef(di8_stub_device);
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
return DIERR_NOINTERFACE;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_EnumDevices(
|
||||
IDirectInput8W *self,
|
||||
DWORD dwDevType,
|
||||
LPDIENUMDEVICESCALLBACKW lpCallback,
|
||||
LPVOID pvRef,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
log_misc("IDirectInput8::EnumDevices hook hit");
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_DirectInput8Create(
|
||||
HINSTANCE hinst,
|
||||
DWORD dwVersion,
|
||||
REFIID riidltf,
|
||||
LPVOID *ppvOut,
|
||||
LPVOID punkOuter)
|
||||
{
|
||||
IDirectInput8W *api;
|
||||
IDirectInput8WVtbl *api_vtbl;
|
||||
struct com_proxy *api_proxy;
|
||||
HRESULT res;
|
||||
|
||||
log_info("DirectInput8Create hook hit");
|
||||
|
||||
res = real_DirectInput8Create(
|
||||
hinst, dwVersion, riidltf, (LPVOID *) &api, punkOuter);
|
||||
|
||||
if (res != DI_OK) {
|
||||
return res;
|
||||
}
|
||||
|
||||
api_proxy = com_proxy_wrap(api, sizeof(*api->lpVtbl));
|
||||
api_vtbl = api_proxy->vptr;
|
||||
|
||||
api_vtbl->EnumDevices = my_EnumDevices;
|
||||
api_vtbl->CreateDevice = my_CreateDevice;
|
||||
|
||||
*(IDirectInput8W **) ppvOut = (IDirectInput8W *) api_proxy;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void dinput_init(void)
|
||||
{
|
||||
hook_table_apply(NULL, "dinput8.dll", dinput_syms, lengthof(dinput_syms));
|
||||
|
||||
log_info("Inserted dinput hooks");
|
||||
}
|
||||
10
src/main/dinput/dinput.h
Normal file
10
src/main/dinput/dinput.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef DINPUTHOOK_DINPUT_H
|
||||
#define DINPUTHOOK_DINPUT_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// This is to stub out the dinput device
|
||||
// Such that rawinput can still poll keyboards
|
||||
void dinput_init(void);
|
||||
|
||||
#endif
|
||||
@@ -160,6 +160,10 @@ static HRESULT ezusb_iidx_emu_msg_interrupt_read(struct iobuf *read)
|
||||
otherwise the game's fpga check will fail */
|
||||
msg_resp->fpga2_check_flag_unkn = 2;
|
||||
|
||||
#ifdef EZUSB_IIDX_EMU_D01_BOARD
|
||||
msg_resp->inverted_pad &= ~(1 << 4);
|
||||
#endif
|
||||
|
||||
read->pos = sizeof(*msg_resp);
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -59,7 +59,9 @@ struct ezusb_iidx_msg_interrupt_read_packet {
|
||||
1: Not used
|
||||
2: Not used
|
||||
3: Not used
|
||||
4: Not used
|
||||
4: C02/D01 board identifier, 1 = C02, 0 = D01 (on active low). This defines how the game has
|
||||
to flash the FPGA board since D01 needs a different firmware (see result of FPGA CHECK on
|
||||
game bootup)
|
||||
5: Not used
|
||||
6: usb mute?
|
||||
7: Not used
|
||||
|
||||
@@ -36,6 +36,8 @@ EXPORTS
|
||||
mapper_get_analog_map
|
||||
mapper_get_analog_sensitivity
|
||||
mapper_get_npages
|
||||
mapper_get_nanalogs
|
||||
mapper_get_nlights
|
||||
mapper_is_analog_absolute
|
||||
mapper_iterate_lights
|
||||
mapper_iterate_actions
|
||||
|
||||
@@ -16,6 +16,7 @@ bool mapper_get_action_map(
|
||||
bool mapper_get_analog_map(uint8_t analog, struct mapped_analog *ma);
|
||||
int32_t mapper_get_analog_sensitivity(uint8_t analog);
|
||||
uint8_t mapper_get_nanalogs(void);
|
||||
uint8_t mapper_get_nlights(void);
|
||||
uint8_t mapper_get_npages(void);
|
||||
bool mapper_is_analog_absolute(uint8_t analog);
|
||||
action_iter_t mapper_iterate_actions(void);
|
||||
|
||||
@@ -149,6 +149,11 @@ uint8_t mapper_get_nanalogs(void)
|
||||
return mapper_impl_get_nanalogs(mapper_inst);
|
||||
}
|
||||
|
||||
uint8_t mapper_get_nlights(void)
|
||||
{
|
||||
return mapper_impl_get_nlights(mapper_inst);
|
||||
}
|
||||
|
||||
uint8_t mapper_get_npages(void)
|
||||
{
|
||||
return mapper_impl_get_npages(mapper_inst);
|
||||
|
||||
@@ -4,6 +4,7 @@ src_hooklib := \
|
||||
acp.c \
|
||||
app.c \
|
||||
adapter.c \
|
||||
config-adapter.c \
|
||||
rs232.c \
|
||||
setupapi.c \
|
||||
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "hooklib/adapter.h"
|
||||
|
||||
#include "util/codepage.h"
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
|
||||
static DWORD WINAPI
|
||||
my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len);
|
||||
@@ -16,6 +20,9 @@ my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len);
|
||||
static DWORD(WINAPI *real_GetAdaptersInfo)(
|
||||
PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len);
|
||||
|
||||
static IP_ADDRESS_STRING override_address;
|
||||
static bool use_address_override;
|
||||
|
||||
static const struct hook_symbol adapter_hook_syms[] = {
|
||||
{.name = "GetAdaptersInfo",
|
||||
.patch = my_GetAdaptersInfo,
|
||||
@@ -37,6 +44,34 @@ my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
info = adapter_info;
|
||||
|
||||
if (use_address_override) {
|
||||
while (info) {
|
||||
// this is well defined to be at most sizeof(IP_ADDRESS_STRING)
|
||||
// and NULL filled if shorter (hence the memset in
|
||||
// adapter_hook_override)
|
||||
if (!memcmp(
|
||||
info->IpAddressList.IpAddress.String,
|
||||
override_address.String,
|
||||
sizeof(IP_ADDRESS_STRING))) {
|
||||
log_info(
|
||||
"%s: using [override] adapter: %s, %s, %s, %s",
|
||||
__FUNCTION__,
|
||||
info->AdapterName,
|
||||
info->Description,
|
||||
info->IpAddressList.IpAddress.String,
|
||||
info->IpAddressList.IpMask.String);
|
||||
|
||||
// copy only this adapter over
|
||||
memcpy(adapter_info, info, sizeof(*info));
|
||||
adapter_info->Next = 0;
|
||||
return ret;
|
||||
}
|
||||
info = info->Next;
|
||||
}
|
||||
}
|
||||
|
||||
ip_fwd_table = (MIB_IPFORWARDTABLE *) malloc(sizeof(MIB_IPFORWARDTABLE));
|
||||
table_size = 0;
|
||||
|
||||
@@ -58,6 +93,15 @@ my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len)
|
||||
|
||||
while (info) {
|
||||
if (info->Index == best_adapter) {
|
||||
log_info(
|
||||
"%s: using [best] adapter: %s, %s, %s, %s",
|
||||
__FUNCTION__,
|
||||
info->AdapterName,
|
||||
info->Description,
|
||||
info->IpAddressList.IpAddress.String,
|
||||
info->IpAddressList.IpMask.String);
|
||||
|
||||
// copy only this adapter over
|
||||
memcpy(adapter_info, info, sizeof(*info));
|
||||
adapter_info->Next = 0;
|
||||
return ret;
|
||||
@@ -73,3 +117,26 @@ void adapter_hook_init(void)
|
||||
hook_table_apply(
|
||||
NULL, "iphlpapi.dll", adapter_hook_syms, lengthof(adapter_hook_syms));
|
||||
}
|
||||
|
||||
void adapter_hook_override(const char *adapter_address)
|
||||
{
|
||||
// starts off false anyways due to static
|
||||
// but in case it gets called multiple times, set it anyways
|
||||
use_address_override = false;
|
||||
|
||||
if (adapter_address == NULL || *adapter_address == '\0') {
|
||||
// empty, do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(adapter_address) > sizeof(IP_ADDRESS_STRING)) {
|
||||
log_warning(
|
||||
"%s: %s is not an ipv4 address", __FUNCTION__, adapter_address);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(override_address.String, 0, sizeof(IP_ADDRESS_STRING));
|
||||
memcpy(override_address.String, adapter_address, sizeof(IP_ADDRESS_STRING));
|
||||
|
||||
use_address_override = true;
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
#ifndef HOOKLIB_ADAPTER_H
|
||||
#define HOOKLIB_ADAPTER_H
|
||||
|
||||
/**
|
||||
* Hooks GetAdaptersInfo to attempt only returning 1 adapter.
|
||||
*
|
||||
*/
|
||||
void adapter_hook_init(void);
|
||||
|
||||
/**
|
||||
* Uses the provided address to try and match a network adapter.
|
||||
* This adapter is then returned as the only adapter.
|
||||
*
|
||||
* @param network ip to match
|
||||
*/
|
||||
void adapter_hook_override(const char *adapter_address);
|
||||
|
||||
#endif
|
||||
|
||||
35
src/main/hooklib/config-adapter.c
Normal file
35
src/main/hooklib/config-adapter.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "hooklib/config-adapter.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
#define HOOKLIB_CONFIG_ADAPTER_OVERRIDE_IP_KEY "adapter.override_ip"
|
||||
|
||||
#define HOOKLIB_CONFIG_ADAPTER_DEFAULT_OVERRIDE_IP_VALUE ""
|
||||
|
||||
void hooklib_config_adapter_init(struct cconfig *config)
|
||||
{
|
||||
cconfig_util_set_str(
|
||||
config,
|
||||
HOOKLIB_CONFIG_ADAPTER_OVERRIDE_IP_KEY,
|
||||
HOOKLIB_CONFIG_ADAPTER_DEFAULT_OVERRIDE_IP_VALUE,
|
||||
"IP of adapter to force override with");
|
||||
}
|
||||
|
||||
void hooklib_config_adapter_get(
|
||||
struct hooklib_config_adapter *config_adapter, struct cconfig *config)
|
||||
{
|
||||
if (!cconfig_util_get_str(
|
||||
config,
|
||||
HOOKLIB_CONFIG_ADAPTER_OVERRIDE_IP_KEY,
|
||||
config_adapter->override_ip,
|
||||
sizeof(config_adapter->override_ip),
|
||||
HOOKLIB_CONFIG_ADAPTER_DEFAULT_OVERRIDE_IP_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%s'",
|
||||
HOOKLIB_CONFIG_ADAPTER_OVERRIDE_IP_KEY,
|
||||
HOOKLIB_CONFIG_ADAPTER_DEFAULT_OVERRIDE_IP_VALUE);
|
||||
}
|
||||
}
|
||||
18
src/main/hooklib/config-adapter.h
Normal file
18
src/main/hooklib/config-adapter.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef HOOKLIB_CONFIG_ADAPTER_H
|
||||
#define HOOKLIB_CONFIG_ADAPTER_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
struct hooklib_config_adapter {
|
||||
// this is larger on purpose, in case ppl enter the wrong stuff here
|
||||
char override_ip[32];
|
||||
};
|
||||
|
||||
void hooklib_config_adapter_init(struct cconfig *config);
|
||||
|
||||
void hooklib_config_adapter_get(
|
||||
struct hooklib_config_adapter *config_adapter, struct cconfig *config);
|
||||
|
||||
#endif
|
||||
@@ -20,6 +20,8 @@
|
||||
"gfx.scale_back_buffer_height"
|
||||
#define IIDXHOOK_CONFIG_GFX_SCALE_BACK_BUFFER_FILTER_KEY \
|
||||
"gfx.scale_back_buffer_filter"
|
||||
#define IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY "gfx.forced_refresh_rate"
|
||||
#define IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY "gfx.device_adapter"
|
||||
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_BGVIDEO_UV_FIX_VALUE false
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
|
||||
@@ -32,6 +34,8 @@
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_WIDTH_VALUE 0
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_HEIGHT_VALUE 0
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_FILTER_VALUE "none"
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1
|
||||
#define IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
|
||||
|
||||
void iidxhook_config_gfx_init(struct cconfig *config)
|
||||
{
|
||||
@@ -141,6 +145,20 @@ void iidxhook_config_gfx_init(struct cconfig *config)
|
||||
"linear, point (refer to "
|
||||
"D3DTEXTUREFILTERTYPE "
|
||||
" for explanation).");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE,
|
||||
"Forced refresh rate, -1 to not force any (try 59 or 60 if monitor "
|
||||
"check fails to lock on high refresh rate monitors)");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
|
||||
"D3D9 device adapter (monitor), -1 to use default, "
|
||||
"0, 1, 2 etc. to use specified adapter");
|
||||
}
|
||||
|
||||
void iidxhook_config_gfx_get(
|
||||
@@ -325,4 +343,28 @@ void iidxhook_config_gfx_get(
|
||||
IIDXHOOK_CONFIG_GFX_SCALE_BACK_BUFFER_FILTER_KEY,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_FILTER_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
&config_gfx->forced_refresh_rate,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
&config_gfx->device_adapter,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
|
||||
// see struct iidxhook_util_d3d9_config for more info
|
||||
struct iidxhook_config_gfx {
|
||||
bool bgvideo_uv_fix;
|
||||
bool framed;
|
||||
@@ -18,6 +19,8 @@ struct iidxhook_config_gfx {
|
||||
uint16_t scale_back_buffer_width;
|
||||
uint16_t scale_back_buffer_height;
|
||||
enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter;
|
||||
int32_t forced_refresh_rate;
|
||||
int32_t device_adapter;
|
||||
};
|
||||
|
||||
void iidxhook_config_gfx_init(struct cconfig *config);
|
||||
|
||||
@@ -262,10 +262,29 @@ static void iidxhook_util_d3d9_fix_create_device_apply_window_mode(
|
||||
{
|
||||
log_assert(irp);
|
||||
log_assert(irp->op == HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE);
|
||||
D3DPRESENT_PARAMETERS *pp = irp->args.ctx_create_device.pp;
|
||||
|
||||
if (iidxhook_util_d3d9_config.windowed) {
|
||||
irp->args.ctx_create_device.pp->Windowed = TRUE;
|
||||
irp->args.ctx_create_device.pp->FullScreen_RefreshRateInHz = 0;
|
||||
pp->Windowed = TRUE;
|
||||
pp->FullScreen_RefreshRateInHz = 0;
|
||||
} else {
|
||||
if (iidxhook_util_d3d9_config.forced_refresh_rate > 0) {
|
||||
log_info(
|
||||
"Forcing refresh rate %d -> %d",
|
||||
pp->FullScreen_RefreshRateInHz,
|
||||
iidxhook_util_d3d9_config.forced_refresh_rate);
|
||||
pp->FullScreen_RefreshRateInHz =
|
||||
iidxhook_util_d3d9_config.forced_refresh_rate;
|
||||
}
|
||||
}
|
||||
|
||||
if (iidxhook_util_d3d9_config.device_adapter >= 0) {
|
||||
log_info(
|
||||
"Forcing adapter %d -> %d",
|
||||
irp->args.ctx_create_device.adapter,
|
||||
iidxhook_util_d3d9_config.device_adapter);
|
||||
irp->args.ctx_create_device.adapter =
|
||||
iidxhook_util_d3d9_config.device_adapter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,7 +923,9 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config)
|
||||
"iidx14_to_19_nvidia_fix: %d\n"
|
||||
"scale_back_buffer_width: %d\n"
|
||||
"scale_back_buffer_height: %d\n"
|
||||
"scale_back_buffer_filter: %d",
|
||||
"scale_back_buffer_filter: %d\n"
|
||||
"forced_refresh_rate: %d\n"
|
||||
"device_adapter: %d",
|
||||
config->windowed,
|
||||
config->framed,
|
||||
config->override_window_width,
|
||||
@@ -919,7 +940,9 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config)
|
||||
config->iidx14_to_19_nvidia_fix,
|
||||
config->scale_back_buffer_width,
|
||||
config->scale_back_buffer_height,
|
||||
config->scale_back_buffer_filter);
|
||||
config->scale_back_buffer_filter,
|
||||
config->forced_refresh_rate,
|
||||
config->device_adapter);
|
||||
}
|
||||
|
||||
static void iidxhook_util_d3d9_validate_config(
|
||||
@@ -983,6 +1006,8 @@ void iidxhook_util_d3d9_init_config(struct iidxhook_util_d3d9_config *config)
|
||||
config->scale_back_buffer_height = 0;
|
||||
config->scale_back_buffer_filter =
|
||||
IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_NONE;
|
||||
config->forced_refresh_rate = -1;
|
||||
config->device_adapter = -1;
|
||||
}
|
||||
|
||||
void iidxhook_util_d3d9_configure(
|
||||
@@ -1046,9 +1071,10 @@ iidxhook_util_d3d9_irp_handler(struct hook_d3d9_irp *irp)
|
||||
hr = hook_d3d9_irp_invoke_next(irp);
|
||||
|
||||
if (hr == S_OK) {
|
||||
iidxhook_util_d3d9_log_result_create_device(hr);
|
||||
iidxhook_util_d3d9_setup_back_buffer_scaling_post(irp);
|
||||
iidxhook_util_d3d9_execute_monitor_check(irp);
|
||||
} else {
|
||||
iidxhook_util_d3d9_log_result_create_device(hr);
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
||||
@@ -159,6 +159,20 @@ struct iidxhook_util_d3d9_config {
|
||||
* for full doc.
|
||||
*/
|
||||
enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter;
|
||||
|
||||
/**
|
||||
* Forced refresh rate
|
||||
* -1 to not force any (try 59 or 60 if monitor check fails to lock on high
|
||||
* refresh rate monitors)
|
||||
*/
|
||||
int32_t forced_refresh_rate;
|
||||
|
||||
/**
|
||||
* override device adapter (monitor)
|
||||
* -1 to use default (whatever the game sends)
|
||||
* 0, 1, 2 etc. to use specified adapter
|
||||
*/
|
||||
int32_t device_adapter;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,6 +95,8 @@ static void iidxhook1_setup_d3d9_hooks(
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
@@ -94,6 +94,8 @@ static void iidxhook2_setup_d3d9_hooks(
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
@@ -91,6 +91,8 @@ iidxhook3_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
@@ -72,6 +72,8 @@ iidxhook4_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
@@ -70,6 +70,8 @@ iidxhook5_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ iidxhook6_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user