refact(iidxhook3): Use sdk-hook and support new config api

Summary:

Test Plan:
Summary:

Test Plan:
This commit is contained in:
icex2 2024-08-15 13:26:39 +02:00
parent 95e167c01c
commit f3deaddba1
18 changed files with 705 additions and 528 deletions

View File

@ -321,10 +321,10 @@ $(zipdir)/iidx-14-to-17.zip: \
dist/iidx/gamestart-15.bat \
dist/iidx/gamestart-16.bat \
dist/iidx/gamestart-17.bat \
dist/iidx/iidxhook-14.conf \
dist/iidx/iidxhook-15.conf \
dist/iidx/iidxhook-16.conf \
dist/iidx/iidxhook-17.conf \
dist/iidx/inject-14.xml \
dist/iidx/inject-15.xml \
dist/iidx/inject-16.xml \
dist/iidx/inject-17.xml \
dist/iidx/vefx.txt \
| $(zipdir)/
$(V)echo ... $@

View File

@ -54,8 +54,5 @@ if not exist e\avs_conf\CONF\NVRAM mkdir e\avs_conf\CONF\NVRAM
if not exist e\avs_conf\CONF\RAW mkdir e\avs_conf\CONF\RAW
%BEMANITOOLS_DIR%\inject.exe^
%BEMANITOOLS_DIR%\iidxhook3.dll^
%REVISION_DIR%\bm2dx.exe^
-D^
--config %BEMANITOOLS_DIR%\iidxhook-14.conf^
%*
%BEMANITOOLS_DIR%\inject-14.xml^
%*

View File

@ -54,8 +54,5 @@ if not exist e\avs_conf\CONF\NVRAM mkdir e\avs_conf\CONF\NVRAM
if not exist e\avs_conf\CONF\RAW mkdir e\avs_conf\CONF\RAW
%BEMANITOOLS_DIR%\inject.exe^
%BEMANITOOLS_DIR%\iidxhook3.dll^
%REVISION_DIR%\bm2dx.exe^
-D^
--config %BEMANITOOLS_DIR%\iidxhook-15.conf^
%*
%BEMANITOOLS_DIR%\inject-15.xml^
%*

View File

@ -54,8 +54,5 @@ if not exist e\avs_conf\CONF\NVRAM mkdir e\avs_conf\CONF\NVRAM
if not exist e\avs_conf\CONF\RAW mkdir e\avs_conf\CONF\RAW
%BEMANITOOLS_DIR%\inject.exe^
%BEMANITOOLS_DIR%\iidxhook3.dll^
%REVISION_DIR%\bm2dx.exe^
-D^
--config %BEMANITOOLS_DIR%\iidxhook-16.conf^
%*
%BEMANITOOLS_DIR%\inject-16.xml^
%*

View File

@ -54,8 +54,5 @@ if not exist e\avs_conf\CONF\NVRAM mkdir e\avs_conf\CONF\NVRAM
if not exist e\avs_conf\CONF\RAW mkdir e\avs_conf\CONF\RAW
%BEMANITOOLS_DIR%\inject.exe^
%BEMANITOOLS_DIR%\iidxhook3.dll^
%REVISION_DIR%\bm2dx.exe^
-D^
--config %BEMANITOOLS_DIR%\iidxhook-17.conf^
%*
%BEMANITOOLS_DIR%\inject-17.xml^
%*

View File

@ -1,53 +0,0 @@
# URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80.
eamuse.server=localhost:80
# PCBID
eamuse.pcbid=0101020304050607086F
# EAMID
eamuse.eamid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style)
gfx.bgvideo_uv_fix=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
gfx.frame_rate_limit=0.0
# Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!!
gfx.monitor_check=-1.000000
# Run the game windowed
gfx.windowed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
gfx.scale_back_buffer_width=0
# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
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
# Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data
misc.settings_path=.\
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQGLDJAA

View File

@ -1,53 +0,0 @@
# URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80.
eamuse.server=localhost:80
# PCBID
eamuse.pcbid=0101020304050607086F
# EAMID
eamuse.eamid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style)
gfx.bgvideo_uv_fix=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
gfx.frame_rate_limit=0.0
# Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!!
gfx.monitor_check=-1.000000
# Run the game windowed
gfx.windowed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
gfx.scale_back_buffer_width=0
# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
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
# Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data
misc.settings_path=.\
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQHDDJAA

View File

@ -1,56 +0,0 @@
# URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80.
eamuse.server=localhost:80
# PCBID
eamuse.pcbid=0101020304050607086F
# EAMID
eamuse.eamid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style)
gfx.bgvideo_uv_fix=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
gfx.frame_rate_limit=0.0
# Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!!
gfx.monitor_check=-1.000000
# Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450)
gfx.pci_id=1002:7146
# Run the game windowed
gfx.windowed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
gfx.scale_back_buffer_width=0
# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
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
# Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data
misc.settings_path=.\
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQI00JAA

View File

@ -1,56 +0,0 @@
# URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80.
eamuse.server=localhost:80
# PCBID
eamuse.pcbid=0101020304050607086F
# EAMID
eamuse.eamid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style)
gfx.bgvideo_uv_fix=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
gfx.frame_rate_limit=0.0
# Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!!
gfx.monitor_check=-1.000000
# Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450)
gfx.pci_id=1002:7146
# Run the game windowed
gfx.windowed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
gfx.scale_back_buffer_width=0
# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
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
# Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data
misc.settings_path=.\
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GCJDJJAA

94
dist/iidx/inject-14.xml vendored Normal file
View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="Shift-JIS"?>
<inject>
<version __type="u32">1</version>
<debugger>
<app>
<path __type="str">bm2dx.exe</path>
<args __type="str"></args>
</app>
<attach_type __type="str">inject</attach_type>
</debugger>
<hooks>
<hook>
<enable __type="bool">1</enable>
<path __type="str">iidxhook3.dll</path>
<config kind="inline">
<hook>
<eamuse>
<!-- URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. -->
<server __type="str">localhost:80</server>
<pcbid __type="bin">0101020304050607086F</pcbid>
<eamid __type="bin">0101020304050607086F</eamid>
</eamuse>
<gfx>
<device>
<!-- D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter -->
<adapter __type="s8">-1</adapter>
<!-- 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 __type="s16">-1</forced_refresh_rate>
<!-- Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit) -->
<frame_rate_limit __type="float">0.0</frame_rate_limit>
</device>
<window>
<windowed __type="bool">1</windowed>
<framed __type="bool">1</framed>
<!-- Windowed height, 0 for default size -->
<width __type="u16">0</width>
<height __type="u16">0</height>
</window>
<back_buffer_scale>
<!-- Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter. -->
<width __type="u16">0</width>
<height __type="u16">0</height>
<!-- 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). -->
<filter __type="str">none</filter>
</back_buffer_scale>
<game>
<!-- Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!! -->
<monitor_check __type="float">-1.000000</monitor_check>
<!-- Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style) -->
<bgvideo_uv_fix __type="bool">1</bgvideo_uv_fix>
</game>
</gfx>
<ezusb>
<security>
<plug_black_mcode __type="str">GQGLDJAA</plug_black_mcode>
</security>
</ezusb>
<misc>
<!-- Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data -->
<settings_path __type="str">.\</settings_path>
<disable_clock_set __type="bool">1</disable_clock_set>
</misc>
</hook>
</config>
</hook>
</hooks>
<logger>
<enable __type="bool">1</enable>
<level __type="str">misc</level>
<msg_buffer_size_bytes __type="u32">8192</msg_buffer_size_bytes>
<sinks>
<async>
<enable __type="bool">0</enable>
<queue_length __type="u8">64</queue_length>
<overflow_policy __type="str">discard_new</overflow_policy>
</async>
<console>
<enable __type="bool">1</enable>
<color __type="bool">1</color>
</console>
<file>
<enable __type="bool">1</enable>
<path __type="str">inject.log</path>
<append __type="bool">0</append>
<rotate __type="bool">0</rotate>
<max_rotations __type="u8">1</max_rotations>
</file>
</sinks>
</logger>
<debug>
<property_configs_log __type="bool">1</property_configs_log>
<property_api_trace_log __type="bool">0</property_api_trace_log>
</debug>
</inject>

94
dist/iidx/inject-15.xml vendored Normal file
View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="Shift-JIS"?>
<inject>
<version __type="u32">1</version>
<debugger>
<app>
<path __type="str">bm2dx.exe</path>
<args __type="str"></args>
</app>
<attach_type __type="str">inject</attach_type>
</debugger>
<hooks>
<hook>
<enable __type="bool">1</enable>
<path __type="str">iidxhook3.dll</path>
<config kind="inline">
<hook>
<eamuse>
<!-- URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. -->
<server __type="str">localhost:80</server>
<pcbid __type="bin">0101020304050607086F</pcbid>
<eamid __type="bin">0101020304050607086F</eamid>
</eamuse>
<gfx>
<device>
<!-- D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter -->
<adapter __type="s8">-1</adapter>
<!-- 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 __type="s16">-1</forced_refresh_rate>
<!-- Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit) -->
<frame_rate_limit __type="float">0.0</frame_rate_limit>
</device>
<window>
<windowed __type="bool">1</windowed>
<framed __type="bool">1</framed>
<!-- Windowed height, 0 for default size -->
<width __type="u16">0</width>
<height __type="u16">0</height>
</window>
<back_buffer_scale>
<!-- Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter. -->
<width __type="u16">0</width>
<height __type="u16">0</height>
<!-- 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). -->
<filter __type="str">none</filter>
</back_buffer_scale>
<game>
<!-- Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!! -->
<monitor_check __type="float">-1.000000</monitor_check>
<!-- Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style) -->
<bgvideo_uv_fix __type="bool">1</bgvideo_uv_fix>
</game>
</gfx>
<ezusb>
<security>
<plug_black_mcode __type="str">GQHDDJAA</plug_black_mcode>
</security>
</ezusb>
<misc>
<!-- Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data -->
<settings_path __type="str">.\</settings_path>
<disable_clock_set __type="bool">1</disable_clock_set>
</misc>
</hook>
</config>
</hook>
</hooks>
<logger>
<enable __type="bool">1</enable>
<level __type="str">misc</level>
<msg_buffer_size_bytes __type="u32">8192</msg_buffer_size_bytes>
<sinks>
<async>
<enable __type="bool">0</enable>
<queue_length __type="u8">64</queue_length>
<overflow_policy __type="str">discard_new</overflow_policy>
</async>
<console>
<enable __type="bool">1</enable>
<color __type="bool">1</color>
</console>
<file>
<enable __type="bool">1</enable>
<path __type="str">inject.log</path>
<append __type="bool">0</append>
<rotate __type="bool">0</rotate>
<max_rotations __type="u8">1</max_rotations>
</file>
</sinks>
</logger>
<debug>
<property_configs_log __type="bool">1</property_configs_log>
<property_api_trace_log __type="bool">0</property_api_trace_log>
</debug>
</inject>

97
dist/iidx/inject-16.xml vendored Normal file
View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="Shift-JIS"?>
<inject>
<version __type="u32">1</version>
<debugger>
<app>
<path __type="str">bm2dx.exe</path>
<args __type="str"></args>
</app>
<attach_type __type="str">inject</attach_type>
</debugger>
<hooks>
<hook>
<enable __type="bool">1</enable>
<path __type="str">iidxhook3.dll</path>
<config kind="inline">
<hook>
<eamuse>
<!-- URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. -->
<server __type="str">localhost:80</server>
<pcbid __type="bin">0101020304050607086F</pcbid>
<eamid __type="bin">0101020304050607086F</eamid>
</eamuse>
<gfx>
<device>
<!-- D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter -->
<adapter __type="s8">-1</adapter>
<!-- 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 __type="s16">-1</forced_refresh_rate>
<!-- Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit) -->
<frame_rate_limit __type="float">0.0</frame_rate_limit>
<!-- Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450) -->
<pci_id_vid __type="str">1002</pci_id_vid>
<pci_id_pid __type="str">7146</pci_id_pid>
</device>
<window>
<windowed __type="bool">1</windowed>
<framed __type="bool">1</framed>
<!-- Windowed height, 0 for default size -->
<width __type="u16">0</width>
<height __type="u16">0</height>
</window>
<back_buffer_scale>
<!-- Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter. -->
<width __type="u16">0</width>
<height __type="u16">0</height>
<!-- 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). -->
<filter __type="str">none</filter>
</back_buffer_scale>
<game>
<!-- Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!! -->
<monitor_check __type="float">-1.000000</monitor_check>
<!-- Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style) -->
<bgvideo_uv_fix __type="bool">1</bgvideo_uv_fix>
</game>
</gfx>
<ezusb>
<security>
<plug_black_mcode __type="str">GQI00JAA</plug_black_mcode>
</security>
</ezusb>
<misc>
<!-- Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data -->
<settings_path __type="str">.\</settings_path>
<disable_clock_set __type="bool">1</disable_clock_set>
</misc>
</hook>
</config>
</hook>
</hooks>
<logger>
<enable __type="bool">1</enable>
<level __type="str">misc</level>
<msg_buffer_size_bytes __type="u32">8192</msg_buffer_size_bytes>
<sinks>
<async>
<enable __type="bool">0</enable>
<queue_length __type="u8">64</queue_length>
<overflow_policy __type="str">discard_new</overflow_policy>
</async>
<console>
<enable __type="bool">1</enable>
<color __type="bool">1</color>
</console>
<file>
<enable __type="bool">1</enable>
<path __type="str">inject.log</path>
<append __type="bool">0</append>
<rotate __type="bool">0</rotate>
<max_rotations __type="u8">1</max_rotations>
</file>
</sinks>
</logger>
<debug>
<property_configs_log __type="bool">1</property_configs_log>
<property_api_trace_log __type="bool">0</property_api_trace_log>
</debug>
</inject>

97
dist/iidx/inject-17.xml vendored Normal file
View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="Shift-JIS"?>
<inject>
<version __type="u32">1</version>
<debugger>
<app>
<path __type="str">bm2dx.exe</path>
<args __type="str"></args>
</app>
<attach_type __type="str">inject</attach_type>
</debugger>
<hooks>
<hook>
<enable __type="bool">1</enable>
<path __type="str">iidxhook3.dll</path>
<config kind="inline">
<hook>
<eamuse>
<!-- URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. -->
<server __type="str">localhost:80</server>
<pcbid __type="bin">0101020304050607086F</pcbid>
<eamid __type="bin">0101020304050607086F</eamid>
</eamuse>
<gfx>
<device>
<!-- D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter -->
<adapter __type="s8">-1</adapter>
<!-- 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 __type="s16">-1</forced_refresh_rate>
<!-- Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit) -->
<frame_rate_limit __type="float">0.0</frame_rate_limit>
<!-- Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450) -->
<pci_id_vid __type="str">1002</pci_id_vid>
<pci_id_pid __type="str">7146</pci_id_pid>
</device>
<window>
<windowed __type="bool">1</windowed>
<framed __type="bool">1</framed>
<!-- Windowed height, 0 for default size -->
<width __type="u16">0</width>
<height __type="u16">0</height>
</window>
<back_buffer_scale>
<!-- Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter. -->
<width __type="u16">0</width>
<height __type="u16">0</height>
<!-- 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). -->
<filter __type="str">none</filter>
</back_buffer_scale>
<game>
<!-- Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!! -->
<monitor_check __type="float">-1.000000</monitor_check>
<!-- Fix stretched BG videos on newer GPUs. Might appear on SIRIUS and older. On 9th and 10th style this issue may only affect older BGAs (from 1st-3rd style) -->
<bgvideo_uv_fix __type="bool">1</bgvideo_uv_fix>
</game>
</gfx>
<ezusb>
<security>
<plug_black_mcode __type="str">GCJDJJAA</plug_black_mcode>
</security>
</ezusb>
<misc>
<!-- Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data -->
<settings_path __type="str">.\</settings_path>
<disable_clock_set __type="bool">1</disable_clock_set>
</misc>
</hook>
</config>
</hook>
</hooks>
<logger>
<enable __type="bool">1</enable>
<level __type="str">misc</level>
<msg_buffer_size_bytes __type="u32">8192</msg_buffer_size_bytes>
<sinks>
<async>
<enable __type="bool">0</enable>
<queue_length __type="u8">64</queue_length>
<overflow_policy __type="str">discard_new</overflow_policy>
</async>
<console>
<enable __type="bool">1</enable>
<color __type="bool">1</color>
</console>
<file>
<enable __type="bool">1</enable>
<path __type="str">inject.log</path>
<append __type="bool">0</append>
<rotate __type="bool">0</rotate>
<max_rotations __type="u8">1</max_rotations>
</file>
</sinks>
</logger>
<debug>
<property_configs_log __type="bool">1</property_configs_log>
<property_api_trace_log __type="bool">0</property_api_trace_log>
</debug>
</inject>

View File

@ -3,6 +3,7 @@ avsdlls += iidxhook3
ldflags_iidxhook3 := \
-lws2_32 \
-liphlpapi \
-lshlwapi \
deplibs_iidxhook3 := \
avs \
@ -27,7 +28,9 @@ libs_iidxhook3 := \
module \
util \
mxml \
sdk-hook \
src_iidxhook3 := \
avs-boot.c \
dllmain.c \
iidxhook3.c \

View File

@ -1,311 +1,70 @@
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "cconfig/cconfig-hook.h"
#include "core/boot.h"
#include "core/log-bt-ext.h"
#include "core/log-bt.h"
#include "core/log-sink-debug.h"
#include "core/thread-crt.h"
#include "ezusb-emu/node-security-plug.h"
#include "ezusb-iidx-emu/node-serial.h"
#include "ezusb-iidx-emu/nodes.h"
#include "ezusb2-emu/desc.h"
#include "ezusb2-emu/device.h"
#include "ezusb2-iidx-emu/msg.h"
#include "hook/d3d9.h"
#include "hook/iohook.h"
#include "hook/table.h"
#include "hooklib/acp.h"
#include "hooklib/adapter.h"
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iidxhook3/iidxhook3.h"
#include "iface-core/log.h"
#include "iface-core/thread.h"
#include "main/sdk-hook/dllentry.h"
#include "iface-io/eam.h"
#include "iface-io/iidx.h"
#include "util/defs.h"
#include "iidxhook3/avs-boot.h"
static HANDLE STDCALL _iidxhook3_dllmain_my_OpenProcess(DWORD, BOOL, DWORD);
static HANDLE(STDCALL *_iidxhook3_dllmain_real_OpenProcess)(DWORD, BOOL, DWORD);
#include "iidxhook-util/acio.h"
#include "iidxhook-util/chart-patch.h"
#include "iidxhook-util/clock.h"
#include "iidxhook-util/config-eamuse.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-misc.h"
#include "iidxhook-util/config-sec.h"
#include "iidxhook-util/d3d9.h"
#include "iidxhook-util/settings.h"
static bool _iidxhook3_dllmain_openprocess_call_check;
#include "module/io-ext.h"
#include "module/io.h"
#include "security/rp-sign-key.h"
#include "util/str.h"
#define IIDXHOOK3_INFO_HEADER \
"iidxhook for Gold, DJTroopers, Empress and Sirius" \
", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV)
#define IIDXHOOK3_CMD_USAGE \
"Usage: inject.exe iidxhook3.dll <bm2dx.exe> [options...]"
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
iidxhook_util_d3d9_irp_handler,
static const struct hook_symbol _iidxhook3_dllmain_hook_syms[] = {
{
.name = "OpenProcess",
.patch = _iidxhook3_dllmain_my_OpenProcess,
.link = (void **) &_iidxhook3_dllmain_real_OpenProcess,
},
};
static HANDLE STDCALL my_OpenProcess(DWORD, BOOL, DWORD);
static HANDLE(STDCALL *real_OpenProcess)(DWORD, BOOL, DWORD);
static bool iidxhook_init_check;
static module_io_t *iidxhook_module_io_iidx;
static module_io_t *iidxhook_module_io_eam;
static const struct hook_symbol init_hook_syms[] = {
{.name = "OpenProcess",
.patch = my_OpenProcess,
.link = (void **) &real_OpenProcess},
};
static void _iidxhook3_log_init()
static HANDLE STDCALL
_iidxhook3_dllmain_my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)
{
core_log_bt_ext_init_with_debug();
// TODO change log level support
core_log_bt_level_set(CORE_LOG_BT_LOG_LEVEL_MISC);
if (_iidxhook3_dllmain_openprocess_call_check) {
return _iidxhook3_dllmain_real_OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId);
}
_iidxhook3_dllmain_openprocess_call_check = true;
bt_hook_dllentry_main_init();
return _iidxhook3_dllmain_real_OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId);
}
static void _iidxhook3_io_iidx_init(module_io_t **module)
{
bt_io_iidx_api_t api;
// TODO find another call right before main exits to hook cleanup and stuff with
// bt_hook_dllentry_main_fini()
module_io_ext_load_and_init(
"iidxio.dll", "bt_module_io_iidx_api_get", module);
module_io_api_get(*module, &api);
bt_io_iidx_api_set(&api);
}
static void _iidxhook3_io_eam_init(module_io_t **module)
{
bt_io_eam_api_t api;
module_io_ext_load_and_init(
"eamio.dll", "bt_module_io_eam_api_get", module);
module_io_api_get(*module, &api);
bt_io_eam_api_set(&api);
}
static void
iidxhook3_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
{
struct iidxhook_util_d3d9_config d3d9_config;
iidxhook_util_d3d9_init_config(&d3d9_config);
d3d9_config.windowed = config_gfx->windowed;
d3d9_config.framed = config_gfx->framed;
d3d9_config.override_window_width = config_gfx->window_width;
d3d9_config.override_window_height = config_gfx->window_height;
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.pci_vid = config_gfx->pci_id_vid;
d3d9_config.pci_pid = config_gfx->pci_id_pid;
/* Required for GOLD (and newer?) to not crash with NVIDIA cards */
d3d9_config.iidx09_to_17_fix_uvs_bg_videos = true;
d3d9_config.iidx14_to_19_nvidia_fix = true;
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");
d3d9_config.iidx09_to_19_monitor_check_cb =
iidxhook_util_chart_patch_set_refresh_rate;
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
} else if (config_gfx->monitor_check > 0) {
log_info(
"Manual monitor check, resulting refresh rate: %f",
config_gfx->monitor_check);
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
}
iidxhook_util_d3d9_configure(&d3d9_config);
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
}
/**
* This seems to be a good entry point to intercept
* before the game calls anything important
*/
HANDLE STDCALL
my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)
{
struct cconfig *config;
struct iidxhook_util_config_eamuse config_eamuse;
struct iidxhook_config_gfx config_gfx;
struct iidxhook_config_misc config_misc;
struct iidxhook_config_sec config_sec;
if (iidxhook_init_check) {
goto skip;
}
iidxhook_init_check = true;
log_info("-------------------------------------------------------------");
log_info("--------------- Begin iidxhook my_OpenProcess ---------------");
log_info("-------------------------------------------------------------");
config = cconfig_init();
iidxhook_util_config_eamuse_init(config);
iidxhook_config_gfx_init(config);
iidxhook_config_misc_init(config);
iidxhook_config_sec_init(config);
if (!cconfig_hook_config_init(
config,
IIDXHOOK3_INFO_HEADER "\n" IIDXHOOK3_CMD_USAGE,
CCONFIG_CMD_USAGE_OUT_DBG)) {
cconfig_finit(config);
exit(EXIT_FAILURE);
}
iidxhook_util_config_eamuse_get(&config_eamuse, config);
iidxhook_config_gfx_get(&config_gfx, config);
iidxhook_config_misc_get(&config_misc, config);
iidxhook_config_sec_get(&config_sec, config);
cconfig_finit(config);
log_info(IIDXHOOK3_INFO_HEADER);
log_info("Initializing iidxhook...");
/* Round plug security */
ezusb_iidx_emu_node_security_plug_set_boot_version(
&config_sec.boot_version);
ezusb_iidx_emu_node_security_plug_set_boot_seeds(config_sec.boot_seeds);
ezusb_iidx_emu_node_security_plug_set_plug_black_sign_key(
&security_rp_sign_key_black_iidx);
ezusb_iidx_emu_node_security_plug_set_plug_white_sign_key(
&security_rp_sign_key_white_eamuse);
ezusb_iidx_emu_node_security_plug_set_plug_black_mcode(
&config_sec.black_plug_mcode);
ezusb_iidx_emu_node_security_plug_set_plug_white_mcode(
&security_mcode_eamuse);
ezusb_iidx_emu_node_security_plug_set_pcbid(&config_eamuse.pcbid);
ezusb_iidx_emu_node_security_plug_set_eamid(&config_eamuse.eamid);
iidxhook3_avs_boot_init();
iidxhook3_avs_boot_set_eamuse_addr(&config_eamuse.server);
/* Settings paths */
if (strlen(config_misc.settings_path) > 0) {
settings_hook_set_path(config_misc.settings_path);
}
/* Direct3D and USER32 hooks */
iidxhook3_setup_d3d9_hooks(&config_gfx);
/* Disable operator menu clock setting system clock time */
if (config_misc.disable_clock_set) {
iidxhook_util_clock_hook_init();
}
/* Start up IIDXIO.DLL */
log_info("Starting IIDX IO backend");
_iidxhook3_io_iidx_init(&iidxhook_module_io_iidx);
if (!bt_io_iidx_init()) {
log_fatal("Initializing IIDX IO backend failed");
}
/* Start up EAMIO.DLL */
log_misc("Initializing card reader backend");
_iidxhook3_io_eam_init(&iidxhook_module_io_eam);
if (!bt_io_eam_init()) {
log_fatal("Initializing card reader backend failed");
}
/* Set up IO emulation hooks _after_ IO API setup to allow
API implementations with real IO devices */
iohook_push_handler(ezusb2_emu_device_dispatch_irp);
iohook_push_handler(iidxhook_util_acio_dispatch_irp);
iohook_push_handler(iidxhook_util_chart_patch_dispatch_irp);
iohook_push_handler(settings_hook_dispatch_irp);
hook_setupapi_init(&ezusb2_emu_desc_device.setupapi);
ezusb2_emu_device_hook_init(ezusb2_iidx_emu_msg_init());
/* Card reader emulation, same issue with hooking as IO emulation */
rs232_hook_init();
iidxhook_util_acio_init(true);
log_info("-------------------------------------------------------------");
log_info("---------------- End iidxhook my_OpenProcess ----------------");
log_info("-------------------------------------------------------------");
skip:
return real_OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId);
}
/**
* Hook library for Gold to Sirius
*/
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH) {
core_boot_dll("iidxhook3");
bt_hook_dllentry_init(
mod,
"iidxhook3",
bt_module_core_config_api_set,
bt_module_core_log_api_set,
bt_module_core_thread_api_set,
bt_module_hook_api_get);
// Use bemanitools core APIs
core_log_bt_core_api_set();
core_thread_crt_core_api_set();
_iidxhook3_log_init();
/* Bootstrap hook for further init tasks (see above) */
_iidxhook3_dllmain_openprocess_call_check = false;
hook_table_apply(
NULL, "kernel32.dll", init_hook_syms, lengthof(init_hook_syms));
NULL, "kernel32.dll", _iidxhook3_dllmain_hook_syms, lengthof(_iidxhook3_dllmain_hook_syms));
/* Actual hooks for game specific stuff */
/* Some hooks are setting dependent and can only be applied later in
the bootstrap hook */
} else if (reason == DLL_PROCESS_DETACH) {
// https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain#remarks
if (ctx == NULL) {
hook_table_revert(NULL, "kernel32.dll", _iidxhook3_dllmain_hook_syms, lengthof(_iidxhook3_dllmain_hook_syms));
acp_hook_init();
adapter_hook_init();
settings_hook_init();
// Hacky to have this here, should be close/right after application main exits, see TODO above
bt_hook_dllentry_main_fini();
bt_hook_dllentry_fini();
}
}
return TRUE;
}
}

View File

@ -0,0 +1,249 @@
#define LOG_MODULE "iidxhook3"
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "ezusb-emu/node-security-plug.h"
#include "ezusb-iidx-emu/nodes.h"
#include "ezusb2-emu/desc.h"
#include "ezusb2-emu/device.h"
#include "ezusb2-iidx-emu/msg.h"
#include "hook/d3d9.h"
#include "hook/iohook.h"
#include "hooklib/acp.h"
#include "hooklib/adapter.h"
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iface-core/config.h"
#include "iface-core/log.h"
#include "iface-core/thread.h"
#include "iface-io/eam.h"
#include "iface-io/iidx.h"
#include "iidxhook3/avs-boot.h"
#include "iidxhook-util/acio.h"
#include "iidxhook-util/chart-patch.h"
#include "iidxhook-util/clock.h"
#include "iidxhook-util/config-eamuse.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-misc.h"
#include "iidxhook-util/config-sec.h"
#include "iidxhook-util/d3d9.h"
#include "iidxhook-util/settings.h"
#include "module/io-ext.h"
#include "module/io.h"
#include "sdk/module/core/config.h"
#include "sdk/module/core/log.h"
#include "sdk/module/core/thread.h"
#include "sdk/module/hook.h"
#include "security/rp-sign-key.h"
#include "util/str.h"
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
iidxhook_util_d3d9_irp_handler,
};
static module_io_t *_iidxhook3_module_io_iidx;
static module_io_t *_iidxhook3_module_io_eam;
static void _iidxhook3_io_iidx_init(module_io_t **module)
{
bt_io_iidx_api_t api;
module_io_ext_load_and_init(
"iidxio.dll", "bt_module_io_iidx_api_get", module);
module_io_api_get(*module, &api);
bt_io_iidx_api_set(&api);
}
static void _iidxhook3_io_eam_init(module_io_t **module)
{
bt_io_eam_api_t api;
module_io_ext_load_and_init(
"eamio.dll", "bt_module_io_eam_api_get", module);
module_io_api_get(*module, &api);
bt_io_eam_api_set(&api);
}
static void iidxhook3_setup_d3d9_hooks(
const struct iidxhook_config_gfx *config_gfx)
{
struct iidxhook_util_d3d9_config d3d9_config;
iidxhook_util_d3d9_init_config(&d3d9_config);
d3d9_config.windowed = config_gfx->windowed;
d3d9_config.framed = config_gfx->framed;
d3d9_config.override_window_width = config_gfx->window_width;
d3d9_config.override_window_height = config_gfx->window_height;
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.pci_vid = config_gfx->pci_id_vid;
d3d9_config.pci_pid = config_gfx->pci_id_pid;
/* Required for GOLD (and newer?) to not crash with NVIDIA cards */
d3d9_config.iidx09_to_17_fix_uvs_bg_videos = true;
d3d9_config.iidx14_to_19_nvidia_fix = true;
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");
d3d9_config.iidx09_to_19_monitor_check_cb =
iidxhook_util_chart_patch_set_refresh_rate;
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
} else if (config_gfx->monitor_check > 0) {
log_info(
"Manual monitor check, resulting refresh rate: %f",
config_gfx->monitor_check);
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
}
iidxhook_util_d3d9_configure(&d3d9_config);
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
}
static bool
_iidxhook3_main_init(HMODULE game_module, const bt_core_config_t *config)
{
iidxhook_util_config_eamuse_t config_eamuse;
iidxhook_config_gfx_t config_gfx;
iidxhook_config_misc_t config_misc;
iidxhook_config_sec_t config_sec;
log_info("iidxhook for Gold, DJTroopers, Empress and Sirius");
log_info("build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV));
iidxhook_util_config_eamuse_get2(config, &config_eamuse);
iidxhook_util_config_gfx_get2(config, &config_gfx);
iidxhook_util_config_misc_get2(config, &config_misc);
iidxhook_util_config_sec_get2(config, &config_sec);
acp_hook_init();
adapter_hook_init();
settings_hook_init();
/* Round plug security */
ezusb_iidx_emu_node_security_plug_set_boot_version(
&config_sec.boot_version);
ezusb_iidx_emu_node_security_plug_set_boot_seeds(config_sec.boot_seeds);
ezusb_iidx_emu_node_security_plug_set_plug_black_sign_key(
&security_rp_sign_key_black_iidx);
ezusb_iidx_emu_node_security_plug_set_plug_white_sign_key(
&security_rp_sign_key_white_eamuse);
ezusb_iidx_emu_node_security_plug_set_plug_black_mcode(
&config_sec.black_plug_mcode);
ezusb_iidx_emu_node_security_plug_set_plug_white_mcode(
&security_mcode_eamuse);
ezusb_iidx_emu_node_security_plug_set_pcbid(&config_eamuse.pcbid);
ezusb_iidx_emu_node_security_plug_set_eamid(&config_eamuse.eamid);
iidxhook3_avs_boot_init();
iidxhook3_avs_boot_set_eamuse_addr(&config_eamuse.server);
/* Settings paths */
if (strlen(config_misc.settings_path) > 0) {
settings_hook_set_path(config_misc.settings_path);
}
/* Direct3D and USER32 hooks */
iidxhook3_setup_d3d9_hooks(&config_gfx);
/* Disable operator menu clock setting system clock time */
if (config_misc.disable_clock_set) {
iidxhook_util_clock_hook_init();
}
/* Start up IIDXIO.DLL */
log_info("Starting IIDX IO backend");
_iidxhook3_io_iidx_init(&_iidxhook3_module_io_iidx);
if (!bt_io_iidx_init()) {
log_fatal("Initializing IIDX IO backend failed");
}
/* Start up EAMIO.DLL */
log_misc("Initializing card reader backend");
_iidxhook3_io_eam_init(&_iidxhook3_module_io_eam);
if (!bt_io_eam_init()) {
log_fatal("Initializing card reader backend failed");
}
/* Set up IO emulation hooks _after_ IO API setup to allow
API implementations with real IO devices */
iohook_push_handler(ezusb2_emu_device_dispatch_irp);
iohook_push_handler(iidxhook_util_acio_dispatch_irp);
iohook_push_handler(iidxhook_util_chart_patch_dispatch_irp);
iohook_push_handler(settings_hook_dispatch_irp);
hook_setupapi_init(&ezusb2_emu_desc_device.setupapi);
ezusb2_emu_device_hook_init(ezusb2_iidx_emu_msg_init());
/* Card reader emulation, same issue with hooking as IO emulation */
rs232_hook_init();
iidxhook_util_acio_init(true);
return true;
}
static void _iidxhook3_main_fini()
{
// TODO cleanup
}
void bt_module_core_config_api_set(const bt_core_config_api_t *api)
{
bt_core_config_api_set(api);
}
void bt_module_core_log_api_set(const bt_core_log_api_t *api)
{
bt_core_log_api_set(api);
}
void bt_module_core_thread_api_set(const bt_core_thread_api_t *api)
{
bt_core_thread_api_set(api);
}
void bt_module_hook_api_get(bt_hook_api_t *api)
{
api->version = 1;
api->v1.main_init = _iidxhook3_main_init;
api->v1.main_fini = _iidxhook3_main_fini;
}

View File

@ -2,4 +2,9 @@ LIBRARY iidxhook3
EXPORTS
DllMain@12 @1 NONAME
; Bemanitools 6 API
bt_module_core_config_api_set
bt_module_core_log_api_set
bt_module_core_thread_api_set
bt_module_hook_api_get

View File

@ -0,0 +1,9 @@
#ifndef IIDXHOOK3_H
#define IIDXHOOK3_H
#include "sdk/module/core/config.h"
#include "sdk/module/core/log.h"
#include "sdk/module/core/thread.h"
#include "sdk/module/hook.h"
#endif