Compare commits

...

34 Commits
5.40 ... 5.43

Author SHA1 Message Date
icex2
f63c759ab2 Update changelog for 5.43 release 2022-10-19 00:49:46 +02:00
icex2
edd0bda3bb Update distribution files and naming to indicate support of iidx 29
No significant changes on the game's side. Tooling that works for
27 and 28 also works fine for 29
2022-10-19 00:46:47 +02:00
icex2
c49fc61f89 doc bugfix: Fix incorrect COM port ID
Must be 1 and not 0 for iidx. See also the api.md docs.
2022-10-19 00:44:07 +02:00
icex2
885bffd9eb doc: Update api doc regarding eamuse readers and usage 2022-10-19 00:43:43 +02:00
icex2
c310a41752 Add missing AVS module doc for DDR A20+ 64-bit 2022-09-19 20:05:28 +02:00
Will Xyen
2a7738dac8 ezusb-iidx-16seg-emu: add to makefile 2022-06-24 14:49:53 -07:00
Will Xyen
b4bf1f481d iidxhook: split off node-16seg to remove eamio dependency from iidxhook-cn
(so iidxhook-cn doesn't need to link against ezusb-iidx-emu)
2022-06-24 00:57:26 -07:00
Will Xyen
dc931faf86 ezusb: decouple some nodes from ezusb-iidx-emu
This fixes a build failure in newer gcc for popnhook.
Since node-16seg has a dependency on iidxio
2022-06-23 23:54:30 -07:00
Will Xyen
523c0ad3f2 iidxhook: fix builds in cn versions 2022-06-23 23:42:05 -07:00
icex2
3cba8db787 Add docs for ddr unicorntail 2022-06-19 12:51:49 +02:00
icex2
2139fce2ae Add docs for ddr A20+ data setup and folder structure 2022-06-19 12:51:33 +02:00
icex2
bb86aa65e5 Add download links key software dependencies 2022-06-18 19:09:34 +02:00
aa05679ca91b93e4ecbac7804aff38033811559a
f0dfc61128 Change reference of jubeat in popnhook documentation 2022-06-16 12:51:58 -04:00
icex2
61a343d59a Bump version to 5.43 for next development cycle 2022-06-16 00:20:56 +02:00
icex2
119272b5d2 Update changelog for 5.42 release 2022-06-16 00:19:59 +02:00
icex2
0cd85083f6 Fix compiler warning about conversion type in snprintf 2022-06-16 00:10:50 +02:00
icex2
485c4d0ad7 Documentation clarification 2022-06-16 00:02:49 +02:00
2d9f8a0741a7573b189035dcb819847ecb5d981d
4bd0ee5ef6 iidxhook: Fix diagonal tearing on textures on iidx18 and 19
Affects all games based on version 18 and 19 which includes
the chinese versions

This code is based on the toastertools implementation.
Credits to the original authors.
2022-06-16 00:02:47 +02:00
2d9f8a0741a7573b189035dcb819847ecb5d981d
8081793a5f iidxhook4-cn: Add support for IIDX Resort Anthem CN
* Exe based game
* No network functionality
* No card readers checked/used
2022-06-15 23:34:50 +02:00
2d9f8a0741a7573b189035dcb819847ecb5d981d
badd616add iidxhook 4, 5, 5-cn: enable nvidia fix
Was absent but actually fixes crashing on nvidia cards
on these versions as well.
2022-06-15 21:30:43 +00:00
2d9f8a0741a7573b189035dcb819847ecb5d981d
926e976c36 iidxhook5-cn: Fix log messages, Delete unnecessary code
The game doesn't have network nor uses card readers
2022-06-15 21:29:15 +00:00
95c6cd771e00602e3ec82fccba1b3741fdb7f7ca
5d2b46376d popn: add config.bat 2022-06-13 04:28:33 +09:00
icex2
8d5ef0bfb3 Bump version to 5.42 for next development cycle 2022-06-12 20:09:10 +02:00
icex2
db12f21fd2 Update changelog for 5.41 release 2022-06-12 19:47:44 +02:00
icex2
d009502c9f Add basic documentation for tricoro CN 2022-06-12 19:47:27 +02:00
2d9f8a0741a7573b189035dcb819847ecb5d981d
aa147022c6 Add iidxhook5-cn, support IIDX tricoro CN
alternative name: (狂热节拍 IIDX 2)
2022-06-10 22:54:13 +00:00
icex2
8bcadcfa8f doc/game-errorcodes: Add the well known IIDX network error on boot 2022-06-11 00:45:54 +02:00
icex2
993e6718b3 doc/game-error-codes: Extend USB IO errors 2022-06-11 00:45:54 +02:00
icex2
2939106841 doc: Add links to game error code documentation 2022-06-11 00:45:52 +02:00
icex2
91bb3b4278 doc/game-error-codes: Add information about backup data error 2022-06-11 00:45:07 +02:00
icex2
9c49839e57 Add document with game error codes
Reasoning given in document why this should be part of btools
2022-06-11 00:45:07 +02:00
icex2
52d907e0c6 doc/iidxhook: Improve faq item video codec background video
Add some more information making it easier to identify the entry
2022-06-11 00:45:07 +02:00
QCDLZCLW3K
f8a09580ea Support pop'n music 15-18
* popnhook1 for pop'n 15 - 18 has been added
* popnio has been added
* inject.exe has new syntax for loading hook DLLs, `real.dll=hook.dll`. This will trigger an early IAT hook where it will load the EXE suspended without resolving imports, replace the reference to real.dll in the import table with hook.dll, and then resolve everything before launching. This allows for ezusb.dll to be hooked properly.
* launcher.exe also has a new early IAT hook feature now. Use `-I real.dll=hook.dll`. The idea is the same as described above for inject.exe.
* Updated ezusb constant namings based on what is visible in ezusb.dll's debug statements.

The launcher.exe implementation of early IAT hooking means that someone can implement popnhook2.dll for 19 and above. I have tried pop'n music Sunny Park using a modified version of popnhook1 and it seems to work to some degree: the I/O check and security check returns OK which means the ezusb hooking used in popnhook1 is also working for the later games using `launcher.exe -I ezusb.dll=ezusb2-popn-shim.dll ...`. The process is rather invasive (manually resolving all imports means more chances to fail) so it has been implemented in such a way that the launcher will work the same as it has before as long as `-I` isn't specified.

One questionable thing I am not confident about is the `texture_usage_fix` hack flag I added in the conf. As the comment says, pop'n music 16 will work in Windows XP without the flag being set, but the game will immediately crash on later OSes without the flag being set in my experience. No other games had this issue in my experience. Enabling it in other games doesn't seem to have any negative effects.
2022-06-10 22:46:59 +00:00
icex2
6e06685551 Bump version to 5.41 for next development cycle 2022-06-07 20:20:30 +02:00
164 changed files with 6599 additions and 329 deletions

View File

@@ -2,6 +2,23 @@
Note for CI/CD: Ensure the version formatting in the sections is kept identical to the versions Note for CI/CD: Ensure the version formatting in the sections is kept identical to the versions
given in tags. The pipeline will pick this up and cuts out the relevant section for release notes. given in tags. The pipeline will pick this up and cuts out the relevant section for release notes.
## 5.43
* iidx29: (Officially) support IIDX CASTHOUR
* Code structure maintenance
* Various documentation improvements
## 5.42
* Bugfix: Fix diagonal texture tearing on IIDX 18 and 19 based games
* Feature: Add support for IIDX Resort Anthem CN using iidxhook4-cn
* Feature/bugfix: Enable "nvidia fix" for iidxhook4, 5 and 5-cn. Should fix crashing on some/all
nvidia cards
* Various minor fixes
## 5.41
* Feature: Support pop'n music 15-18 using popnhook1
* Feature: Support IIDX tricoro CN using iidxhook5-cn
* Various documentation improvements
## 5.40 ## 5.40
* Feature: Support DDR X and X2 US/EU using ddrhook1 including memory card emulation * Feature: Support DDR X and X2 US/EU using ddrhook1 including memory card emulation
* Fix: sdvxhook2 crashing on some OS versions * Fix: sdvxhook2 crashing on some OS versions

View File

@@ -29,4 +29,4 @@ COPY src src
COPY .git .git COPY .git .git
# Building # Building
RUN make RUN make

View File

@@ -21,12 +21,19 @@
# #
# 4: Patch 2: beatmania IIDX 14 GOLD # 4: Patch 2: beatmania IIDX 14 GOLD
# #
# 4: Patch 3: pop'n music 15 ADVENTURE
#
# 6: Patch 5: beatmania IIDX 15 DJ Troopers # 6: Patch 5: beatmania IIDX 15 DJ Troopers
# #
# 7: Patch 1: pop'n music 16 PARTY
#
# 8: Patch 3: beatmania IIDX 16 Empress # 8: Patch 3: beatmania IIDX 16 Empress
# jubeat # jubeat
# #
# 10: Patch 2: jubeat Knit # 9: Patch 0: pop'n music 17 THE MOVIE
#
# 10: Patch 1: pop'n music 18 Sengoku Retsuden
# Patch 2: jubeat Knit
# Patch 4: DanceDanceRevolution X2 # Patch 4: DanceDanceRevolution X2
# #
# 11: Patch 1: beatmania IIDX 18 Resort Anthem # 11: Patch 1: beatmania IIDX 18 Resort Anthem
@@ -50,6 +57,7 @@
# beatmania IIDX 22 PENDUAL # beatmania IIDX 22 PENDUAL
# beatmania IIDX 23 copula # beatmania IIDX 23 copula
# beatmania IIDX 24 SINOBUZ # beatmania IIDX 24 SINOBUZ
# Patch 3: DanceDanceRevoluion A20+ (64-bit)
# "Patch" 3: Silent Scope Bone Eater (compatible with p7) # "Patch" 3: Silent Scope Bone Eater (compatible with p7)
# "Patch" 7: Steel Chronicle VicTroopers (not a Bemani, w/e) # "Patch" 7: Steel Chronicle VicTroopers (not a Bemani, w/e)
# #
@@ -103,6 +111,7 @@ include src/main/eamio-icca/Module.mk
include src/main/eamio/Module.mk include src/main/eamio/Module.mk
include src/main/eamiotest/Module.mk include src/main/eamiotest/Module.mk
include src/main/ezusb-emu/Module.mk include src/main/ezusb-emu/Module.mk
include src/main/ezusb-iidx-16seg-emu/Module.mk
include src/main/ezusb-iidx-emu/Module.mk include src/main/ezusb-iidx-emu/Module.mk
include src/main/ezusb-iidx-fpga-flash/Module.mk include src/main/ezusb-iidx-fpga-flash/Module.mk
include src/main/ezusb-iidx-sram-flash/Module.mk include src/main/ezusb-iidx-sram-flash/Module.mk
@@ -113,6 +122,8 @@ include src/main/ezusb2-dbg-hook/Module.mk
include src/main/ezusb2-emu/Module.mk include src/main/ezusb2-emu/Module.mk
include src/main/ezusb2-iidx-emu/Module.mk include src/main/ezusb2-iidx-emu/Module.mk
include src/main/ezusb2-iidx/Module.mk include src/main/ezusb2-iidx/Module.mk
include src/main/ezusb2-popn-emu/Module.mk
include src/main/ezusb2-popn-shim/Module.mk
include src/main/ezusb2-tool/Module.mk include src/main/ezusb2-tool/Module.mk
include src/main/ezusb2/Module.mk include src/main/ezusb2/Module.mk
include src/main/geninput/Module.mk include src/main/geninput/Module.mk
@@ -127,7 +138,9 @@ include src/main/iidxhook1/Module.mk
include src/main/iidxhook2/Module.mk include src/main/iidxhook2/Module.mk
include src/main/iidxhook3/Module.mk include src/main/iidxhook3/Module.mk
include src/main/iidxhook4/Module.mk include src/main/iidxhook4/Module.mk
include src/main/iidxhook4-cn/Module.mk
include src/main/iidxhook5/Module.mk include src/main/iidxhook5/Module.mk
include src/main/iidxhook5-cn/Module.mk
include src/main/iidxhook6/Module.mk include src/main/iidxhook6/Module.mk
include src/main/iidxhook7/Module.mk include src/main/iidxhook7/Module.mk
include src/main/iidxhook8/Module.mk include src/main/iidxhook8/Module.mk
@@ -154,6 +167,9 @@ include src/main/p3io/Module.mk
include src/main/p3ioemu/Module.mk include src/main/p3ioemu/Module.mk
include src/main/p4iodrv/Module.mk include src/main/p4iodrv/Module.mk
include src/main/p4ioemu/Module.mk include src/main/p4ioemu/Module.mk
include src/main/popnhook-util/Module.mk
include src/main/popnhook1/Module.mk
include src/main/popnio/Module.mk
include src/main/pcbidgen/Module.mk include src/main/pcbidgen/Module.mk
include src/main/sdvxhook/Module.mk include src/main/sdvxhook/Module.mk
include src/main/sdvxhook2-cn/Module.mk include src/main/sdvxhook2-cn/Module.mk
@@ -299,6 +315,21 @@ $(zipdir)/iidx-18.zip: \
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -j $@ $^ $(V)zip -j $@ $^
$(zipdir)/iidx-18-cn.zip: \
build/bin/avs2_1101-32/iidxhook4-cn.dll \
build/bin/indep-32/config.exe \
build/bin/indep-32/geninput.dll \
build/bin/indep-32/iidxio.dll \
build/bin/indep-32/vefxio.dll \
build/bin/indep-32/inject.exe \
dist/iidx/config.bat \
dist/iidx/gamestart-18-cn.bat \
dist/iidx/iidxhook-18-cn.conf \
dist/iidx/vefx.txt \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
$(zipdir)/iidx-19.zip: \ $(zipdir)/iidx-19.zip: \
build/bin/avs2_1304-32/iidxhook5.dll \ build/bin/avs2_1304-32/iidxhook5.dll \
build/bin/avs2_1304-32/launcher.exe \ build/bin/avs2_1304-32/launcher.exe \
@@ -331,6 +362,21 @@ $(zipdir)/iidx-20.zip: \
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -j $@ $^ $(V)zip -j $@ $^
$(zipdir)/iidx-20-cn.zip: \
build/bin/avs2_1304-32/iidxhook5-cn.dll \
build/bin/indep-32/config.exe \
build/bin/indep-32/geninput.dll \
build/bin/indep-32/iidxio.dll \
build/bin/indep-32/vefxio.dll \
build/bin/indep-32/inject.exe \
dist/iidx/config.bat \
dist/iidx/gamestart-20-cn.bat \
dist/iidx/iidxhook-20-cn.conf \
dist/iidx/vefx.txt \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
$(zipdir)/iidx-21-to-24.zip: \ $(zipdir)/iidx-21-to-24.zip: \
build/bin/avs2_1601-32/iidxhook7.dll \ build/bin/avs2_1601-32/iidxhook7.dll \
build/bin/avs2_1601-32/launcher.exe \ build/bin/avs2_1601-32/launcher.exe \
@@ -371,7 +417,7 @@ $(zipdir)/iidx-25-to-26.zip: \
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -j $@ $^ $(V)zip -j $@ $^
$(zipdir)/iidx-27-to-28.zip: \ $(zipdir)/iidx-27-to-29.zip: \
build/bin/avs2_1700-64/iidxhook9.dll \ build/bin/avs2_1700-64/iidxhook9.dll \
build/bin/avs2_1700-64/launcher.exe \ build/bin/avs2_1700-64/launcher.exe \
build/bin/indep-64/config.exe \ build/bin/indep-64/config.exe \
@@ -382,8 +428,10 @@ $(zipdir)/iidx-27-to-28.zip: \
dist/iidx/config.bat \ dist/iidx/config.bat \
dist/iidx/gamestart-27.bat \ dist/iidx/gamestart-27.bat \
dist/iidx/gamestart-28.bat \ dist/iidx/gamestart-28.bat \
dist/iidx/gamestart-29.bat \
dist/iidx/iidxhook-27.conf \ dist/iidx/iidxhook-27.conf \
dist/iidx/iidxhook-28.conf \ dist/iidx/iidxhook-28.conf \
dist/iidx/iidxhook-29.conf \
dist/iidx/vefx.txt \ dist/iidx/vefx.txt \
| $(zipdir)/ | $(zipdir)/
$(V)echo ... $@ $(V)echo ... $@
@@ -685,6 +733,27 @@ $(zipdir)/bst.zip: \
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -j $@ $^ $(V)zip -j $@ $^
$(zipdir)/popn-15-to-18.zip: \
build/bin/avs2_803-32/popnhook1.dll \
build/bin/indep-32/config.exe \
build/bin/indep-32/inject.exe \
build/bin/indep-32/geninput.dll \
build/bin/indep-32/eamio.dll \
build/bin/indep-32/popnio.dll \
build/bin/indep-32/ezusb2-popn-shim.dll \
dist/popn/config.bat \
dist/popn/gamestart-15.bat \
dist/popn/gamestart-16.bat \
dist/popn/gamestart-17.bat \
dist/popn/gamestart-18.bat \
dist/popn/popnhook-15.conf \
dist/popn/popnhook-16.conf \
dist/popn/popnhook-17.conf \
dist/popn/popnhook-18.conf \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
$(zipdir)/doc.zip: \ $(zipdir)/doc.zip: \
doc/ \ doc/ \
| $(zipdir)/ | $(zipdir)/
@@ -730,11 +799,13 @@ $(BUILDDIR)/bemanitools.zip: \
$(zipdir)/iidx-13.zip \ $(zipdir)/iidx-13.zip \
$(zipdir)/iidx-14-to-17.zip \ $(zipdir)/iidx-14-to-17.zip \
$(zipdir)/iidx-18.zip \ $(zipdir)/iidx-18.zip \
$(zipdir)/iidx-18-cn.zip \
$(zipdir)/iidx-19.zip \ $(zipdir)/iidx-19.zip \
$(zipdir)/iidx-20.zip \ $(zipdir)/iidx-20.zip \
$(zipdir)/iidx-20-cn.zip \
$(zipdir)/iidx-21-to-24.zip \ $(zipdir)/iidx-21-to-24.zip \
$(zipdir)/iidx-25-to-26.zip \ $(zipdir)/iidx-25-to-26.zip \
$(zipdir)/iidx-27-to-28.zip \ $(zipdir)/iidx-27-to-29.zip \
$(zipdir)/iidx-hwio-x86.zip \ $(zipdir)/iidx-hwio-x86.zip \
$(zipdir)/iidx-hwio-x64.zip \ $(zipdir)/iidx-hwio-x64.zip \
$(zipdir)/jb-01.zip \ $(zipdir)/jb-01.zip \
@@ -744,6 +815,7 @@ $(BUILDDIR)/bemanitools.zip: \
$(zipdir)/jb-05-to-07.zip \ $(zipdir)/jb-05-to-07.zip \
$(zipdir)/jb-08.zip \ $(zipdir)/jb-08.zip \
$(zipdir)/jb-hwio.zip \ $(zipdir)/jb-hwio.zip \
$(zipdir)/popn-15-to-18.zip \
$(zipdir)/sdvx-01-to-04.zip \ $(zipdir)/sdvx-01-to-04.zip \
$(zipdir)/sdvx-05-to-06.zip \ $(zipdir)/sdvx-05-to-06.zip \
$(zipdir)/sdvx-05-cn.zip \ $(zipdir)/sdvx-05-cn.zip \

View File

@@ -1,7 +1,7 @@
# Bemanitools 5 # Bemanitools 5
[![pipeline status](https://dev.s-ul.net/djhackers/bemanitools/badges/master/pipeline.svg)](https://dev.s-ul.net/djhackers/bemanitools/commits/master) [![pipeline status](https://dev.s-ul.net/djhackers/bemanitools/badges/master/pipeline.svg)](https://dev.s-ul.net/djhackers/bemanitools/commits/master)
Version: 5.40 Version: 5.43
[Release history](CHANGELOG.md) [Release history](CHANGELOG.md)
@@ -51,6 +51,7 @@ The following games are supported with their corresponding hook-libraries.
* Beatmania IIDX 17 SIRIUS (`iidx-14-to-17.zip`): [iidxhook3](doc/iidxhook/iidxhook3.md) * Beatmania IIDX 17 SIRIUS (`iidx-14-to-17.zip`): [iidxhook3](doc/iidxhook/iidxhook3.md)
* Beatmania IIDX 18 Resort Anthem (`iidx-18.zip`): [iidxhook4](doc/iidxhook/iidxhook4.md) * Beatmania IIDX 18 Resort Anthem (`iidx-18.zip`): [iidxhook4](doc/iidxhook/iidxhook4.md)
* Beatmania IIDX 19 Lincle (`iidx-19.zip`): [iidxhook5](doc/iidxhook/iidxhook5.md) * Beatmania IIDX 19 Lincle (`iidx-19.zip`): [iidxhook5](doc/iidxhook/iidxhook5.md)
* Beatmania IIDX tricoro CN (狂热节拍 IIDX 2) (`iidx-20-cn.zip`): [iidxhook5-cn](doc/iidxhook/iidxhook5-cn.md)
* Beatmania IIDX 20 Tricoro (`iidx-20.zip`): [iidxhook6](doc/iidxhook/iidxhook6.md) * Beatmania IIDX 20 Tricoro (`iidx-20.zip`): [iidxhook6](doc/iidxhook/iidxhook6.md)
* Beatmania IIDX 21 SPADA (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md) * Beatmania IIDX 21 SPADA (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md)
* Beatmania IIDX 22 PENDUAL (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md) * Beatmania IIDX 22 PENDUAL (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md)
@@ -58,8 +59,9 @@ The following games are supported with their corresponding hook-libraries.
* Beatmania IIDX 24 SINOBUZ (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md) * Beatmania IIDX 24 SINOBUZ (`iidx-21-to-24.zip`): [iidxhook7](doc/iidxhook/iidxhook7.md)
* Beatmania IIDX 25 CANNON BALLERS (`iidx-25-to-26.zip`): [iidxhook8](doc/iidxhook/iidxhook8.md) * Beatmania IIDX 25 CANNON BALLERS (`iidx-25-to-26.zip`): [iidxhook8](doc/iidxhook/iidxhook8.md)
* Beatmania IIDX 26 Rootage (`iidx-25-to-26.zip`): [iidxhook8](doc/iidxhook/iidxhook8.md) * Beatmania IIDX 26 Rootage (`iidx-25-to-26.zip`): [iidxhook8](doc/iidxhook/iidxhook8.md)
* Beatmania IIDX 27 Heroic Verse (`iidx-27-to-28.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md) * Beatmania IIDX 27 Heroic Verse (`iidx-27-to-29.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
* Beatmania IIDX 28 BISTROVER (`iidx-27-to-28.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md) * Beatmania IIDX 28 BISTROVER (`iidx-27-to-29.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
* Beatmania IIDX 29 CASTHOUR (`iidx-27-to-29.zip`): [iidxhook9](doc/iidxhook/iidxhook9.md)
* [jubeat](doc/jbhook/README.md) * [jubeat](doc/jbhook/README.md)
* jubeat (`jb-01.zip`): [jbhook1](doc/jbhook/jbhook1.md) * jubeat (`jb-01.zip`): [jbhook1](doc/jbhook/jbhook1.md)
* jubeat ripples (`jb-02.zip`): [jbhook1](doc/jbhook/jbhook1.md) * jubeat ripples (`jb-02.zip`): [jbhook1](doc/jbhook/jbhook1.md)
@@ -70,6 +72,11 @@ The following games are supported with their corresponding hook-libraries.
* jubeat qubell (`jb-05-to-07.zip`): [jbhook3](doc/jbhook/jbhook3.md) * jubeat qubell (`jb-05-to-07.zip`): [jbhook3](doc/jbhook/jbhook3.md)
* jubeat clan (`jb-08.zip`): [jbhook3](doc/jbhook/jbhook3.md) * jubeat clan (`jb-08.zip`): [jbhook3](doc/jbhook/jbhook3.md)
* jubeat festo (`jb-08.zip`): [jbhook3](doc/jbhook/jbhook3.md) * jubeat festo (`jb-08.zip`): [jbhook3](doc/jbhook/jbhook3.md)
* [pop'n music](doc/popnhook/README.md)
* pop'n music 15 ADVENTURE (`popn-15-to-18.zip`) using [popnhook1](doc/popnhook/popnhook1.md)
* pop'n music 16 PARTY♪ (`popn-15-to-18.zip`) using [popnhook1](doc/popnhook/popnhook1.md)
* pop'n music 17 THE MOVIE (`popn-15-to-18.zip`) using [popnhook1](doc/popnhook/popnhook1.md)
* pop'n music 18 せんごく列伝 (`popn-15-to-18.zip`) using [popnhook1](doc/popnhook/popnhook1.md)
* SOUND VOLTEX * SOUND VOLTEX
* SOUND VOLTEX BOOTH (`sdvx-01-to-04.zip`): sdvxhook * SOUND VOLTEX BOOTH (`sdvx-01-to-04.zip`): sdvxhook
* SOUND VOLTEX II -infinite infection- (`sdvx-01-to-04.zip`): sdvxhook * SOUND VOLTEX II -infinite infection- (`sdvx-01-to-04.zip`): sdvxhook
@@ -91,7 +98,7 @@ change in the future. Many games also run on very recent Windows 10 builds but b
with Windows updates breaking legacy software. with Windows updates breaking legacy software.
## Distribution contents ## Distribution contents
Check the [list of supported games](#list-of-supported-games) to grab the right files for your game. BT5 also includes Check the [list of supported games](#supported-games) to grab the right files for your game. BT5 also includes
a *tools* subpackage (tools.zip) as well as the full source code (src.zip). a *tools* subpackage (tools.zip) as well as the full source code (src.zip).
You will find *.md files in various sub-packages that give you further instructions for setup, usage, error information You will find *.md files in various sub-packages that give you further instructions for setup, usage, error information
@@ -104,9 +111,16 @@ consumer version of Windows XP. Newer versions of Windows, e.g. Windows 7, 8 and
as well. Some hooks also include fixes required to run the games on a more recent version. 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: 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 * The 32-bit (x86) version of
should cover most if not all of the games so far [Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package MFC Security Update](https://www.microsoft.com/en-sg/download/details.aspx?id=26999)
* The 32-bit (x86) and 64-bit (x64) versions of
[Microsoft Visual C++ Redistributable Packages for Visual Studio 2013](https://www.microsoft.com/en-sg/download/details.aspx?id=40784)
* The [DirectX 9 End-User Runtimes (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=8109)
See also
[bemanitools-supplements](https://dev.s-ul.net/djhackers/bemanitools-supplement/-/blob/master/misc/win-runtime/README.md)
for files.
## Development ## Development
### Building ### Building

14
dist/iidx/gamestart-18-cn.bat vendored Normal file
View File

@@ -0,0 +1,14 @@
@echo off
cd /d %~dp0
if not exist d mkdir d
if not exist e mkdir e
if not exist f mkdir f
if not exist e\avs_conf mkdir e\avs_conf
if not exist e\avs_conf\CONF mkdir e\avs_conf\CONF
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
inject iidxhook4-cn.dll bm2dx.exe -D --config iidxhook-18-cn.conf %*

14
dist/iidx/gamestart-20-cn.bat vendored Normal file
View File

@@ -0,0 +1,14 @@
@echo off
cd /d %~dp0
if not exist d mkdir d
if not exist e mkdir e
if not exist f mkdir f
if not exist e\avs_conf mkdir e\avs_conf
if not exist e\avs_conf\CONF mkdir e\avs_conf\CONF
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
inject iidxhook5-cn.dll bm2dx.exe -D --config iidxhook-20-cn.conf %*

16
dist/iidx/gamestart-29.bat vendored Normal file
View File

@@ -0,0 +1,16 @@
@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\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 134217728 -B iidxhook9.dll bm2dx.dll --config iidxhook-29.conf %*

50
dist/iidx/iidxhook-18-cn.conf vendored Normal file
View File

@@ -0,0 +1,50 @@
# PCBID
eamuse.pcbid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on Red and newer
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
# Fix diagonal tearing with video cards other than Radeon X1300 and HD3450
gfx.diagonal_tearing_fix=false
# Disable ezusb IO emulation and enable usage of real ezusb1/2 IO hardware
io.disable_io_emu=false
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GKJDZCAA

View File

@@ -37,6 +37,9 @@ gfx.forced_refresh_rate=-1
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter # D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
gfx.device_adapter=-1 gfx.device_adapter=-1
# Fix diagonal tearing with video cards other than Radeon X1300 and HD3450
gfx.diagonal_tearing_fix=false
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted/wavepass readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted/wavepass readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false

View File

@@ -34,6 +34,9 @@ gfx.forced_refresh_rate=-1
# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter # D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
gfx.device_adapter=-1 gfx.device_adapter=-1
# Fix diagonal tearing with video cards other than Radeon X1300 and HD3450
gfx.diagonal_tearing_fix=false
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted/wavepass readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted/wavepass readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false

47
dist/iidx/iidxhook-20-cn.conf vendored Normal file
View File

@@ -0,0 +1,47 @@
# PCBID
eamuse.pcbid=0101020304050607086F
# Fix stretched BG videos on newer GPUs. Might appear on Red and newer
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
# 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
# Fix diagonal tearing with video cards other than Radeon X1300 and HD3450
gfx.diagonal_tearing_fix=false
# Disable ezusb IO emulation and enable usage of real ezusb1/2 IO hardware
io.disable_io_emu=false
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GKJDZCAA

View File

@@ -43,7 +43,7 @@ cam.device_id1=
# Override camera device ID 2 detection (copy from device manager, do not escape) # Override camera device ID 2 detection (copy from device manager, do not escape)
cam.device_id2= cam.device_id2=
# Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware # Disable BIO2 emulation and enable usage of real BIO2 hardware

View File

@@ -43,7 +43,7 @@ cam.device_id1=
# Override camera device ID 2 detection (copy from device manager, do not escape) # Override camera device ID 2 detection (copy from device manager, do not escape)
cam.device_id2= cam.device_id2=
# Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware # Disable BIO2 emulation and enable usage of real BIO2 hardware

View File

@@ -1,4 +1,4 @@
# Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware # Disable BIO2 emulation and enable usage of real BIO2 hardware

View File

@@ -1,4 +1,4 @@
# Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers) # Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware # Disable BIO2 emulation and enable usage of real BIO2 hardware

78
dist/iidx/iidxhook-29.conf vendored Normal file
View File

@@ -0,0 +1,78 @@
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
io.disable_card_reader_emu=false
# Disable BIO2 emulation and enable usage of real BIO2 hardware
io.disable_bio2_emu=false
# Disables the poll limiter, warning very high CPU usage may arise
io.disable_poll_limiter=false
# Lightning cab mode (requires additional IO emulation)
io.lightning_mode=false
# Disable camera connection
io.disable_cams=true
# Disables the built in file hooks, requiring manual file creation
io.disable_file_hooks=false
# Turntable sensitivity multiplier (1.0 is default)
io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id1=
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id2=
# Run the game in a framed window (requires windowed option)
gfx.framed=true
# Run the game windowed
gfx.windowed=false
# Confine mouse cursor to window
gfx.confined=false
# Windowed width, -1 for default size
gfx.window_width=-1
# Windowed height, -1 for default size
gfx.window_height=-1
# Windowed X, -1 for default X position
gfx.window_x=-1
# Windowed Y, -1 for default Y position
gfx.window_y=-1
# 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
# Force a screen resolution (width), -1 to disable. Use this if the game does not auto detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.
gfx.force_screen_res.width=-1
# Force a screen resolution (height), -1 to disable. Use this if the game does not auto detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.
gfx.force_screen_res.height=-1
# IP of adapter to force override with
adapter.override_ip=
# Force ASIO audio mode/device (if applicable / TDJ default)
asio.force_asio=false
# Force WASAPI audio mode (if applicable / LDJ default)
asio.force_wasapi=true
# The ASIO device name to use
asio.device_name=XONAR SOUND CARD(64)

1
dist/popn/config.bat vendored Normal file
View File

@@ -0,0 +1 @@
@start config.exe pnm

16
dist/popn/gamestart-15.bat vendored Normal file
View File

@@ -0,0 +1,16 @@
@echo off
cd /d %~dp0
if not exist e\bookkeeping mkdir e\bookkeeping
if not exist e\CONF\NVRAM mkdir e\CONF\NVRAM
if not exist e\CONF\NVRAM\0 mkdir e\CONF\NVRAM\0
if not exist e\CONF\NVRAM\1 mkdir e\CONF\NVRAM\1
if not exist e\CONF\NVRAM\2 mkdir e\CONF\NVRAM\2
if not exist e\CONF\NVRAM\3 mkdir e\CONF\NVRAM\3
if not exist e\CONF\RAW mkdir e\CONF\RAW
if not exist e\settings mkdir e\settings
if not exist e\UP mkdir e\UP
inject popnhook1.dll ezusb.dll=ezusb2-popn-shim.dll popn15.exe --config popnhook-15.conf %*

16
dist/popn/gamestart-16.bat vendored Normal file
View File

@@ -0,0 +1,16 @@
@echo off
cd /d %~dp0
if not exist e\bookkeeping mkdir e\bookkeeping
if not exist e\CONF\NVRAM mkdir e\CONF\NVRAM
if not exist e\CONF\NVRAM\0 mkdir e\CONF\NVRAM\0
if not exist e\CONF\NVRAM\1 mkdir e\CONF\NVRAM\1
if not exist e\CONF\NVRAM\2 mkdir e\CONF\NVRAM\2
if not exist e\CONF\NVRAM\3 mkdir e\CONF\NVRAM\3
if not exist e\CONF\RAW mkdir e\CONF\RAW
if not exist e\settings mkdir e\settings
if not exist e\UP mkdir e\UP
inject popnhook1.dll ezusb.dll=ezusb2-popn-shim.dll popn16.exe --config popnhook-16.conf %*

16
dist/popn/gamestart-17.bat vendored Normal file
View File

@@ -0,0 +1,16 @@
@echo off
cd /d %~dp0
if not exist e\bookkeeping mkdir e\bookkeeping
if not exist e\CONF\NVRAM mkdir e\CONF\NVRAM
if not exist e\CONF\NVRAM\0 mkdir e\CONF\NVRAM\0
if not exist e\CONF\NVRAM\1 mkdir e\CONF\NVRAM\1
if not exist e\CONF\NVRAM\2 mkdir e\CONF\NVRAM\2
if not exist e\CONF\NVRAM\3 mkdir e\CONF\NVRAM\3
if not exist e\CONF\RAW mkdir e\CONF\RAW
if not exist e\settings mkdir e\settings
if not exist e\UP mkdir e\UP
inject popnhook1.dll ezusb.dll=ezusb2-popn-shim.dll popn17.exe --config popnhook-17.conf %*

16
dist/popn/gamestart-18.bat vendored Normal file
View File

@@ -0,0 +1,16 @@
@echo off
cd /d %~dp0
if not exist e\bookkeeping mkdir e\bookkeeping
if not exist e\CONF\NVRAM mkdir e\CONF\NVRAM
if not exist e\CONF\NVRAM\0 mkdir e\CONF\NVRAM\0
if not exist e\CONF\NVRAM\1 mkdir e\CONF\NVRAM\1
if not exist e\CONF\NVRAM\2 mkdir e\CONF\NVRAM\2
if not exist e\CONF\NVRAM\3 mkdir e\CONF\NVRAM\3
if not exist e\CONF\RAW mkdir e\CONF\RAW
if not exist e\settings mkdir e\settings
if not exist e\UP mkdir e\UP
inject popnhook1.dll ezusb.dll=ezusb2-popn-shim.dll popn18.exe --config popnhook-18.conf %*

23
dist/popn/popnhook-15.conf vendored Normal file
View File

@@ -0,0 +1,23 @@
# 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
# Run the game windowed
gfx.windowed=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQG15JAA

23
dist/popn/popnhook-16.conf vendored Normal file
View File

@@ -0,0 +1,23 @@
# 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
# Run the game windowed
gfx.windowed=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQH16JAA

23
dist/popn/popnhook-17.conf vendored Normal file
View File

@@ -0,0 +1,23 @@
# 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
# Run the game windowed
gfx.windowed=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GQI17JAA

23
dist/popn/popnhook-18.conf vendored Normal file
View File

@@ -0,0 +1,23 @@
# 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
# Run the game windowed
gfx.windowed=false
# Run the game in a framed window (requires windowed option)
gfx.framed=false
# Windowed width, 0 for default size
gfx.window_width=0
# Windowed height, 0 for default size
gfx.window_height=0
# Security black plug mcode id string (e.g. GQC02JAA).
sec.black_plug_mcode=GCJ39JAA

View File

@@ -4,6 +4,9 @@ This folder contains various types of documentation.
Table of contents: Table of contents:
* Game
* [Error codes](game-error-codes.md): List of bemani game specific error codes that you might
encounter during boot or gameplay with troubleshooting information
* Key tools * Key tools
* [Inject](inject.md): Readme for one of BT5's key applications, `inject.exe` * [Inject](inject.md): Readme for one of BT5's key applications, `inject.exe`
* [Launcher](launcher.md): Readme for another one of BT5's key applications, `launcher.exe` * [Launcher](launcher.md): Readme for another one of BT5's key applications, `launcher.exe`
@@ -12,6 +15,7 @@ Table of contents:
* [ddrhook](ddrhook/README.md): Documentation relevant to `ddrhook` implementations * [ddrhook](ddrhook/README.md): Documentation relevant to `ddrhook` implementations
* [iidxhook](iidxhook/README.md): Documentation relevant to `iidxhook` implementations * [iidxhook](iidxhook/README.md): Documentation relevant to `iidxhook` implementations
* [jbhook](jbhook/README.md): Documentation relevant to `jbhook` implementations * [jbhook](jbhook/README.md): Documentation relevant to `jbhook` implementations
* [popnhook](popnhook/README.md): Documentation relevant to `popnhook` implementations
* [sdvxhook](sdvxhook/README.md): Documentation relevant to `sdvxhook` implementations * [sdvxhook](sdvxhook/README.md): Documentation relevant to `sdvxhook` implementations
* Development * Development
* [API](api.md): Available APIs for BT5 and instructions how to use them * [API](api.md): Available APIs for BT5 and instructions how to use them

View File

@@ -1,4 +1,5 @@
# Bemanitools API # Bemanitools API
Bemanitools introduces interfaces abstracting the IO hardware of many games. This is used to implement support for Bemanitools introduces interfaces abstracting the IO hardware of many games. This is used to implement support for
non-intended IO devices from simple keyboard support, standard gamecontrollers to custom IO boards or using real non-intended IO devices from simple keyboard support, standard gamecontrollers to custom IO boards or using real
hardware with the games (e.g. support for real legacy hardware). hardware with the games (e.g. support for real legacy hardware).
@@ -12,7 +13,10 @@ If you want to write an implementation for your own custom piece of hardware, ch
sub-folder) in the source code (src.zip). sub-folder) in the source code (src.zip).
## Implementations ## Implementations
The following implementations are already shipped with BT5.
### IO boards
The following implementations are already shipped with BT5.
* BeatStream * BeatStream
* bstio.dll (default): Keyboard, joystick and mouse input * bstio.dll (default): Keyboard, joystick and mouse input
@@ -27,15 +31,40 @@ The following implementations are already shipped with BT5.
* [iidxio-ezusb2.dll](iidxhook/iidxio-ezusb2.md): Ezusb FX2 (IO2) driver * [iidxio-ezusb2.dll](iidxhook/iidxio-ezusb2.md): Ezusb FX2 (IO2) driver
* jubeat * jubeat
* jbio.dll (default): Keyboard, joystick and mouse input * jbio.dll (default): Keyboard, joystick and mouse input
* pop'n music
* popnio.dll (default): Keyboard, joystick and mouse input
* SOUND VOLTEX * SOUND VOLTEX
* sdvxio.dll (default): Keyboard, joystick and mouse input * sdvxio.dll (default): Keyboard, joystick and mouse input
* [sdvxio-bio2.dll](sdvxhook/sdvxio-bio2.md): BIO2 driver * [sdvxio-bio2.dll](sdvxhook/sdvxio-bio2.md): BIO2 driver
* [sdvxio-kfca.dll](sdvxhook/sdvxio-kfca.md): KFCA IO board driver * [sdvxio-kfca.dll](sdvxhook/sdvxio-kfca.md): KFCA IO board driver
### Eamuse readers
Eamuse hardware support is implemented separately: Eamuse hardware support is implemented separately:
* eamio.dll (default): Keyboard and joystick input
* eamio.dll (default): Keyboard and joystick input
* eamio-icca.dll: Slotted/wave pass readers, required for old games with magnetic stripe cards
#### ICCA readers for IIDX and port config in device manager
The COM port for the card readers needs to be configured correctly in device manager. Otherwise,
communication with the readers will fail if the settings do not align with how the game or
bemanitools wants to operate them.
Use built-in ports on your mainboard if available but an external USB to serial port dongle also
works.
* Assign `COM1` to the COM port the card readers are connected to.
* Ensure that the following settings for the COM port you are going to use are
set
* BAUD rate 57600
* Data bits 8
* Parity None
* Stop bits 1
* Flow control None.
## Development notes ## Development notes
A DEF file for geninput.dll is included. To convert the DEF into an import library suitable for use with Visual C++, run A DEF file for geninput.dll is included. To convert the DEF into an import library suitable for use with Visual C++, run
``` ```
lib /machine:i386 /def:geninput.def lib /machine:i386 /def:geninput.def

View File

@@ -51,7 +51,7 @@ Modules that make use of this:
* ezusb2-emu/device * ezusb2-emu/device
* acioemu/emu * acioemu/emu
## Bemanitools's hook libraries, let's glue everything together ## Bemanitools's hook libraries, let's glue everything together
Bemanitools dlls to be injected into target game processes are refered to as "hook dlls" and come in different flavours Bemanitools dlls to be injected into target game processes are refered to as "hook dlls" and come in different flavours
targetting different games and often different versions of the same game (series), for example: targetting different games and often different versions of the same game (series), for example:
* ddrhook: Hook dll for Dance Dance Revolution games * ddrhook: Hook dll for Dance Dance Revolution games
@@ -69,13 +69,13 @@ TODO
### iidxhook ### iidxhook
IIDX went through so many hard- and software iterations, it's actually amazing that the development team(s) refactored IIDX went through so many hard- and software iterations, it's actually amazing that the development team(s) refactored
and improved parts of the game and hardware with each iteration. However, when facing emulation and supporting and improved parts of the game and hardware with each iteration. However, when facing emulation and supporting
compatibility to legacy OS platforms, it can't get any worse. On the bright side, IIDX helped shaping Bemanitools a lot compatibility to legacy OS platforms, it can't get any worse. On the bright side, IIDX helped shaping Bemanitools a lot
and created a solid foundation other games can build on. and created a solid foundation other games can build on.
Because of that, we have 8 iidxhook implementations supporting sometimes different software features/fixes and Because of that, we have 8 iidxhook implementations supporting sometimes different software features/fixes and
hardware. The following sub-sub-sections list the most relevant aspects and modules to point out common and different hardware. The following sub-sub-sections list the most relevant aspects and modules to point out common and different
higher level features. higher level features.
Essentially, the main module file of each iidxhook implementation just glues the APIs of the modules it requires Essentially, the main module file of each iidxhook implementation just glues the APIs of the modules it requires
together. An additional configuration layer allows users to tweak some of the features. together. An additional configuration layer allows users to tweak some of the features.
@@ -88,7 +88,7 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
* Setupapi emulation * Setupapi emulation
* Full security emulation with SRAM and round plugs * Full security emulation with SRAM and round plugs
* Full serial emulation for magstripe card readers * Full serial emulation for magstripe card readers
* Full game essential I/O emulation * Full game essential I/O emulation
* d3d8 patching and extended features (superseded by d3d9 hook module + d3d8to9 wrapper) * d3d8 patching and extended features (superseded by d3d9 hook module + d3d8to9 wrapper)
* clock patching * clock patching
* Font patching for Japanese chars * Font patching for Japanese chars
@@ -99,7 +99,7 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
* Ezusb C02 I/O emulation * Ezusb C02 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full security emulation with SRAM and round plugs * Full security emulation with SRAM and round plugs
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, slotted readers * ACIO ICCA card reader emulation, slotted readers
* d3d8 patching and extended features (superseded by d3d9 hook module + d3d8to9 wrapper) * d3d8 patching and extended features (superseded by d3d9 hook module + d3d8to9 wrapper)
* clock patching * clock patching
@@ -111,7 +111,7 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
* Ezusb IO2 I/O emulation * Ezusb IO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full security emulation with SRAM and round plugs * Full security emulation with SRAM and round plugs
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, slotted readers * ACIO ICCA card reader emulation, slotted readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
@@ -121,25 +121,43 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
#### iidxhook4 (18) #### iidxhook4 (18)
* Ezusb IO2 I/O emulation * Ezusb IO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, slotted readers * ACIO ICCA card reader emulation, slotted readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
* Filesystem patches to detour E and F backup drives for settings * Filesystem patches to detour E and F backup drives for settings
#### iidxhook4-cn (18 CN)
* Ezusb IO2 I/O emulation
* Setupapi emulation
* Full security emulation with SRAM and round plugs
* Full game essential I/O emulation
* d3d9 patching and extended features
* Font patching for Japanese chars
* Filesystem patches to detour E and F backup drives for settings
#### iidxhook5 (19) #### iidxhook5 (19)
* Ezusb IO2 I/O emulation * Ezusb IO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, wave pass readers * ACIO ICCA card reader emulation, wave pass readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
* Filesystem patches to detour E and F backup drives for settings * Filesystem patches to detour E and F backup drives for settings
#### iidxhook5-cn (20 CN)
* Ezusb IO2 I/O emulation
* Setupapi emulation
* Full security emulation with SRAM and round plugs
* Full game essential I/O emulation
* d3d9 patching and extended features
* Font patching for Japanese chars
* Filesystem patches to detour E and F backup drives for settings
#### iidxhook6 (20) #### iidxhook6 (20)
* Ezusb IO2 I/O emulation * Ezusb IO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, wave pass readers * ACIO ICCA card reader emulation, wave pass readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
@@ -147,7 +165,7 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
#### iidxhook7 (21-24) #### iidxhook7 (21-24)
* Ezusb IO2 I/O emulation * Ezusb IO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, wave pass readers * ACIO ICCA card reader emulation, wave pass readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
@@ -155,7 +173,7 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
#### iidxhook8 (25-26) #### iidxhook8 (25-26)
* ACIO BIO2 I/O emulation * ACIO BIO2 I/O emulation
* Setupapi emulation * Setupapi emulation
* Full game essential I/O emulation * Full game essential I/O emulation
* ACIO ICCA card reader emulation, wave pass readers * ACIO ICCA card reader emulation, wave pass readers
* d3d9 patching and extended features * d3d9 patching and extended features
* Font patching for Japanese chars * Font patching for Japanese chars
@@ -163,6 +181,9 @@ TODO go into some more detail about some differences in the hook modules, e.g. 1
### jbhook ### jbhook
TODO TODO
### popnhook
TODO
### sdvxhook ### sdvxhook
TODO TODO

View File

@@ -47,3 +47,7 @@ IO hardware you want to use:
game controllers game controllers
* ddrio-mm: Support Minimaid custom interface * ddrio-mm: Support Minimaid custom interface
* [ddrio-smx](ddrhook/ddrio-smx.md): Support for StepManiaX dance platforms * [ddrio-smx](ddrhook/ddrio-smx.md): Support for StepManiaX dance platforms
## Unicorntail
[Instructions how to run on Chimera PCBs](unicorntail.md).

View File

@@ -17,6 +17,73 @@ different versions. See different distribution packages, e.g. `ddr-12.zip`,
Depending on the game version, earlier versions are bootstrapped using Depending on the game version, earlier versions are bootstrapped using
[inject](../inject.md) while later versions require [launcher](../launcher.md). [inject](../inject.md) while later versions require [launcher](../launcher.md).
## Setup A20+
### Data and folder structure
The following assumes you are using vanilla and unpacked/decrypted data. Copy/unpack the data
to a destination of your choice. Expect to have the following root folder structure:
```
arkdata
com
data
dev
modules
prop
```
* Copy the contents of `modules` to the root folder that the dll-files are next to the folders
`arkdata`, `com`, etc.
* Unpack the contents of `ddr-14-to-16.zip` to the root folder. `luncher.exe` should be located
next to `arkdata`, `com` and all the dll-files
#### Configuring eamuse settings
You need to create a `prop/ea3-config.xml` configuration file which provides properties for
connecting to a network of your choice (and allows the game to boot).
Take the `prop/eamuse.xml` as a base and make a copy of it called `prop/ea3-config.xml`.
Add the software identifier as a child to the `<ea3>` parent node:
```xml
<soft>
<model __type="str">MDX</model>
<dest __type="str">J</dest>
<spec __type="str">A</spec>
<rev __type="str">A</rev>
<ext __type="str">2022020200</ext>
</soft>
```
Replace the identifiers according to the version you are using.
Add your PCBID as a child to the `<ea3>` parent node:
```xml
<id>
<pcbid __type="str">00010203040506070809</pcbid>
<hardid __type="str">00010203040506070809</hardid>
</id>
```
Replace the values accordingly with your actual PCBID registered with your target network.
Add network settings (note this might already exist, replace existing or delete old one) as a child
to the `<ea3>` parent node:
```xml
<network>
<sz_xrpc_buf __type="u32">102400</sz_xrpc_buf>
<ssl __type="bool">0</ssl>
<services>http://eamuse.konami.fun/service/services/services/</services>
</network>
```
Replace the properties accordingly with the settings provided by your network provider, e.g. the
URL, further settings like ssl etc.
## Running ## Running
Run `gamestart-XX.bat`, where `XX` corresponds to the version of the game you Run `gamestart-XX.bat`, where `XX` corresponds to the version of the game you
@@ -70,6 +137,9 @@ Run the following commands either from a command line (`cmd.exe`) or from
* Register `regsvr32 D:\MDX\contents\k-clvsd.dll` * Register `regsvr32 D:\MDX\contents\k-clvsd.dll`
* Register `regsvr32 D:\MDX\contents\xactengine2_10.dll` * Register `regsvr32 D:\MDX\contents\xactengine2_10.dll`
The `gamestart-XX.bat` scripts should already take care of this by executing the listed commands
when launched.
Note: The one that comes with IIDX will hang DDR at startup. The opposite is not true: Note: The one that comes with IIDX will hang DDR at startup. The opposite is not true:
IIDX works just fine with this CLVSD. IIDX works just fine with this CLVSD.

View File

@@ -0,0 +1,45 @@
# Unicorntail
Unicorntail is a hook library to run the DDR games on a hybrid type of hardware referred to as a
"Chimera" or "Unicorn". Compared to a "Dragon", which refers to the official stock hardware by
Konami, a Chimera mixes the P3IO board from a PCB used with GF&DM V4-V8, Jubeat, Jubeat Ripples or
Jubeat Knit with the motherboard from a GF&DM XG, XG2 or XG3 PCB, or a Reflec Beat PCB.
Actual build instructions for such hardware are out of scope here.
## Context
Dragon PCBs are hard to come by compared to finding the parts for a Chimera PCB.
A Chimera PCB however is different in many aspects to the Dragon PCB and requires the use of the
`unicorntail.dll` hook library.
The Dragon's P3IO has two serial ports that the regular P3IOs do not, and one of these serial ports
is used to communicate with the card readers. Note that these are actual serial ports driven
directly by the P3IO microcontroller, these are NOT just passed through to the motherboard like the
proprietary COM1 and COM2 connectors. Unicorn Tail intercepts serial port IO commands being sent to
the P3IO and redirects them to COM2 instead, since COM2 is unused on SD cabinets (on HD cabinets it
connects to a second ACIO bus which drives the extra lighting glitz like the light spikes and maybe
the LED strip).
## Drivers
You need the P3IO driver installed on your target system. These can be acquired from an actual stock
HDD or grabbed from
[bemanitools-supplements](https://dev.s-ul.net/djhackers/bemanitools-supplement/-/blob/master/gfdm/p3io/README.md).
## Setup and run
Edit the `gamestart.bat` file that you are using and append `unicorntail.dll` to the list of hooks,
e.g.:
```shell
launcher.exe -H 33554432 -K unicorntail.dll arkmdxp3.dll %*
```
If you want to use any ddrhook library in addition, you have to have the hooks in the right order
to make everything work correctly, e.g.:
```shell
launcher.exe -H 33554432 -K unicorntail.dll -K ddrhook2.dll arkmdxp3.dll %*
```

781
doc/game-error-codes.md Normal file
View File

@@ -0,0 +1,781 @@
# Bemani Game Error Codes
This document collects the various error codes that are know across the many games including some
information what can be done.
This information is not part of bemanitools but useful to many users using it to run the games. We
saw users encountering these errors not knowing what they mean. Therefore, we include these errors
in the repository to provide an accessible source of information regarding them.
Important: The error codes are not consistent throughout the many years of game series and versions.
It is adviced to read the error information carefully (use Google Translate App with your phone's
camera) and check the following sections. It would be great to get feedback if you see information
missing or specific games and versions not matching to increase the value of the list.
## 5-0000 series errors
### 5-0000-0000
#### Description
A generic critical error.
#### Known occurances
N/A
#### How to fix
* Make sure your data is not set to read only, especially the dev folder.
* Disable all network adapters other than the one used to connect to the Internet.
* Check for hidden network adapters in Device Manager.
## 5-1500 series errors
### 5-1500-0000
#### Description
IO ERROR
#### Known occurances
* Pop'n Music 15
#### How to fix
No information available.
### 5-1500-0002
#### Description
SOUND DATA CREATE ERROR
#### Known occurances
N/A
#### How to fix
* Check the integrity of the data you have, i.e. some files might be corrupted
* Check your physical drive. Is it failing?
## 5-1501 series errors
### 5-1501-0000
#### Description
IO BOARD ERROR
#### Known occurances
N/A
#### How to fix
* Recopy Bemanitools.
* For Reflec Beat, make sure you are not missing device.dll. (This seems to apply to some older
version of bemanitools)
## 5-1502 series errors
### 5-1502-0000
#### Description
BACKUP CHECK ERROR
#### Known occurances
* Pop'n'Music 21 Sunny Park
#### How to fix
* Give access to gamestart.bat and launcher.exe from Windows Firewall if enabled.
* Make sure no antivirus software firewall is blocking access to those files.
* Start gamestart.bat as Administrator.
### 5-1502-0000
#### Description
HDD READ ERROR
#### Known occurances
N/A
#### How to fix
* Make sure `/dev/` isn't read-only.
### 5-1502-0002
#### Description
HDD READ ERROR
#### Known occurances
* GFDM V4
#### How to fix
Unknown
## 5-1503 series errors
### 5-1503-0000
#### Description
USB I/O ERROR
##### FPGA WRITE ERROR
Writing the FPGA firmware fails. Can have various causes depending on your setup.
##### FW TRNS-OUT
This typically happens if it takes too long to upload the base firmware to the USB IO. A potential
root-cause can be bad timing since the game uses a bad combination of software sleeps and fixed
timeouts making this code prone to fail.
#### Known occurances
* IIDX
#### How to fix
#### FPGA WRITE ERROR
* Restart the game
* Re-copy bemanitools
#### FW TRNS-OUT
* Restart the game
* Re-copy bemanitools
* Running the process on high priority and with admin rights
* If you attached a debugger, that might have messed with the timing and caused this. Try a
different debugger or attach it later in the boot process
### 5-1503-0001
#### Description
DATA ERROR
"Could not read the file normally. There is a likelihood the file is damaged."
This error occurs when a file is either missing or corrupt.
#### Known occurances
N/A
#### How to fix
* Check the integrity of the data you have, i.e. some files might be corrupted
* If the data came in an archive format, try extracting it again with another application.
* Make sure your game is up to date with the current data available.
* Check your physical drive. Is it failing?
### 5-1503-0004
#### Description
USBIO ERROR (NO ANSWER...)
This error occurs when the game does not receive a heartbeat from the IO board. On legitimate
hardware, this error is usually caused by the IO board resetting during play. The issue is rarely
fixed by simply restarting the game and will require a full power cycle.
#### Known occurances
N/A
#### How do I fix it?
Real hardware:
* Check the USB cable between the PC and the IO board is okay.
* Make sure the IO board is getting enough of a clean supply of power.
Bemanitools:
* Don't attempt to put your computer to sleep while playing rhythm games.
* Change launcher.exe process priority to High when starting the game.
### 5-1503-0006
#### Description
CARD DEVICE ERROR
#### Known occurances
N/A
#### How do I fix it?
* Recopy Bemanitools.
### 5-1503-0007
#### Description
USBIO ERROR (FM DL-ERR)
#### Known occurances
N/A
#### How do I fix it?
* Run the game using gamestart.bat, don't just drag and drop the game dll onto launcher.exe
### 5-1503-0008
#### Description
FPGA Write error
#### Known occurances
* IIDX Tricoro
Seen in Tricoro Omnimix RC1.
#### How do I fix it?
Unknown
### 5-1503-9000
### Description
PCB ERROR (PCB is unusual.)
#### Known occurances
N/A
#### How do I fix it?
* Make sure your AC(real)IO board is on the correct COM port.
## 5-1504 series errors
### 5-1504-0000
#### Description
IC CARD READER ERROR
Something is wrong with your e-amusement card readers (usually a timeout due to them not existing).
#### Known occurances
N/A
#### How do I fix it?
Real hardware:
* Make sure your readers are connected and powered on.
* Check your serial cables are good.
### 5-1504-0003
### Description
N/A
#### Known occurances
N/A
#### How do I fix it?
N/A
### 5-1504-0004
### Description
SDLOAD TIMEOUT or SOUND LOAD TIMEOUT
#### Known occurances
N/A
#### How do I fix it?
N/A
## 5-1505 series errors
### 5-1505-0000
#### Description
HDD Data Error(BPM Notes)
For Jubeat Ripples, getting this error the first time you boot is normal. After getting this error,
the game may take 1-3 minutes longer to boot as it regenerates backup data.
#### Known occurances
* Jubeat Ripples
#### How do I fix it?
* Check the integrity of the data you have, i.e. some files might be corrupted
* If the data came in an archive format, try extracting it again with another application.
* Check your physical drive. Is it failing?
### 5-1505-0001
#### Description
HDD Data Error(Music Data)
#### Known occurances
N/A
#### How do I fix it?
* Check the integrity of the data you have, i.e. some files might be corrupted
* If the data came in an archive format, try extracting it again with another application.
* Check your physical drive. Is it failing?
### 5-1505-0002
#### Description
Coin Error
This error occurs when the coin line (the input triggered when a coin is inserted) is held closed
for too long.
#### Known occurances
N/A
#### How do I fix it?
##### Real hardware
* There may be a coin stuck, check.
* The coin mechanism may be stuck, check.
* Don't hold down the coin line so long.
### 5-1505-0006
#### Description
HDD DATA ERROR(MOUNT IMAGEFS)
#### Known occurances
N/A
#### How do I fix it?
* Check the integrity of the data you have, i.e. some files might be corrupted
* If the data came in an archive format, try extracting it again with another application.
* Check your physical drive. Is it failing?
### 5-1505-0025
#### Description
N/A
#### Known occurances
* Jubeat Saucer Fullfill
#### How do I fix it?
* Disable excess network adapters
## 5-1506 series errors
### 5-1506-0000
#### Description
##### ACIO ERROR (ERR_INIT_LINE)
##### BACKUP DATA ERROR
The backup data is corrupted. Press the test button to re-initialize it.
#### Known occurances
* IIDX 15 (BACKUP DATA ERROR)
#### How do I fix it?
##### ACIO ERROR
If you're using ACrealIO, cut the reset trace on your Arduino.
##### BACKUP DATA ERROR
Follow the instructions of the error message. You will have to re-set certain settings like clock
settings in the operator menu to complete initialization.
### 5-1506-0001
#### Description
SHOP NAME ERROR
This error may happen before the monitor check on IIDX.
#### Known occurances
* IIDX (version?)
#### How do I fix it?
Press the service button and set the shop name in "NETWORK OPTIONS".
### 5-1506-1001
#### Description
CLOCK ERROR
#### Known occurances
N/A
#### How do I fix it?
* "Set" and save the clock date and time in the test menu
* Recopy Bemanitools
## 5-1507 series errors
### 5-1507-0000
#### Description
SECURITY ERROR
#### Known occurances
N/A
#### How do I fix it?
Make sure your ea3-config.xml file contains valid values on the following lines:
```xml
<dest __type="str">...</dest>
```
Should almost always be `J`. Certain games will support `K` (Korea) or `A` (Asia) but there is
rarely a reason to use it. DDR 2014 and forward will support `U`. DanEvo will support (I believe)
`C`.
```xml
<spec __type="str">...</spec>
```
Should almost always be `A`. DDR will support `B` for non-HD monitors.
```xml
<rev __type="str">...</rev>
```
Should always be `A`.
## 5-1508 series errors
### 5-1508-0000
#### Description
LAMP CHECK ERROR
#### Known occurances
* Pop'n Music 20 Fantasia
#### How do I fix it?
N/A
## 5-1509 series errors
### 5-1509-0000
#### Description
REBOOT THE MACHINE
The original message in Japanese: 電源を再投入して下さい
#### Known occurances
* Pop'n Music 22 Lapistoria
#### How do I fix it?
Restart entire machine if on cabinet, or close the game (ALT+F4/ALT+TAB and then close through
taskbar) and re-run the launcher/gamestart file
## 5-2000 series errors (Network errors)
### 5-2000-0000
#### Description
Router error.
Something's not okay with the connection between the game and your router. This can either be a
(W)LAN error, or something within your computer settings (firewall, network adapter, etc.)
#### Known occurances
N/A
#### How do I fix it?
* Restart your game.
* Check if your computer is connected to the Internet at all.
* Make sure the services URL is correct.
* Disable all network adapters other than the one used to connect to the Internet. Alternatively,
setting that adapter to have the highest affinity also works.
* If none of the above work, reinstall a newer or older version of your network drivers.
### 5-2002-0000
#### Description
speculation: general malformed ea3-config.xml file or server communication error
#### Known occurances
N/A
#### How do I fix it?
* Make sure you're editing the right file for network configuration settings.
### 5-2002-0916
#### Description
Cannot communicate with the server.
#### Known occurances
N/A
#### How do I fix it?
N/A
### 5-2002-1013
#### Description
NETWORK ERROR
Cannot communicate with server.
Ensure that your internet connection is working and that your router is turned on.
Ensure that your machine is connected to your router.
Press the service button to start the game.
#### Known occurances
* IIDX, probably all known versions
#### How do I fix it?
The original message is already telling you what is going on:
* Check if your machine/pc has an internet connection
* Check your firewall settings
* Check that the server address is configured and correct in `iidxhook.conf` (old games) or
`ea3-config.xml`
* You can disable the network in the operator menu to just boot the game first. Note that this is
not possible on any versions starting IIDX 20 (tricoro).
### 5-2002-2301
#### Description
Cannot communicate with the server.
#### Known occurances
N/A
#### How do I fix it?
Your ea3 services URL is probably incorrect.
### 5-2000-2402
#### Description
No PCBID. You have no PCBID.
#### Known occurances
N/A
#### How do I fix it?
Add a valid PCBID to `ea3-config.xml`.
### 5-2002-0910
#### Description
Server Error. The game cannot communicate with the server.
#### Known occurances
N/A
#### How do I fix it?
Make sure the services URL is correct.
### 5-2002-2403
#### Description
Unauthorized. The server is rejecting your PCBID.
#### Known occurances
N/A
#### How do I fix it?
* Check that there is a valid PCBID in ea3-config.xml.
### 5-2002-2400
#### Description
Bad Request. Syntax was entered improperly and the server does not understand it.
#### Known occurances
N/A
#### How do I fix it?
Check your services URL and make sure it is entered correctly (e.g. "http:" instead of "https:")
### 5-2002-2404
#### Description
Not found. The server can't find the URL that the game has requested, this is usually because the
game is attempting to connect to an incorrect endpoint.
#### Known occurances
N/A
#### How do I fix it?
* Check your services URL in `ea3-config.xml`. Make sure to remove any slash at the end of the URL
and check for https/http.
* If you are running Spada, ensure to use a service URL that supports that older game (check with
your private server provider)
* If you are running Tune Street, ensure to use a service URL that supports that older game (check
with your private server provider)
### 5-2003-2404
#### Description
Malformed `<network>` section. The `<network>` section in your `ea3-config.xml` file is malformed
in some way.
#### Known occurances
N/A
#### How do I fix it?
Ensure your `<network>` section follows the following format:
```xml
<network>
<timeout __type="u32">10000</timeout>
<sz_xrpc_buf __type="u32">102400</sz_xrpc_buf>
<ssl __type="bool">0</ssl>
<services></services>
<url_slash __type="bool">1</url_slash>
</network>
```
Note: Delete the line `<url_slash __type="bool">1</url_slash>` if you're connecting to Arcana
### 5-2002-2500
#### Description
??? (Logs say http status 500)
#### Known occurances
N/A
#### How do I fix it?
If you are playing Lincle, use the `/core/services` URL from Tricoro, not xrpc.
### 5-2003-2502
#### Description
Server Error. The game cannot communicate with the server.
#### Known occurances
N/A
#### How do I fix it?
Check if your `hosts` file has any DNS redirects to other private servers that might interfere
with this
### 5-2016-0000
#### Description
"apsmanager" is a special eAM Participation system for Korean machines(XXX:K). This system
is maybe not supported by private servers.
#### Known occurances
N/A
#### How do I fix it?
Make sure your `ea3-config.xml` has this line set to 0:
```xml
<apsmanager __type="u8">0</apsmanager>
```

View File

@@ -17,7 +17,9 @@ games:
* [iidxhook2](iidxhook2.md): DistorteD * [iidxhook2](iidxhook2.md): DistorteD
* [iidxhook3](iidxhook3.md): GOLD, DJ TROOPERS, EMPRESS, SIRIUS * [iidxhook3](iidxhook3.md): GOLD, DJ TROOPERS, EMPRESS, SIRIUS
* [iidxhook4](iidxhook4.md): Resort Anthem * [iidxhook4](iidxhook4.md): Resort Anthem
* [iidxhook4-cn](iidxhook4-cn.md): Resort Anthem CN (狂热节拍 IIDX)
* [iidxhook5](iidxhook5.md): Lincle * [iidxhook5](iidxhook5.md): Lincle
* [iidxhook5-cn](iidxhook5-cn.md): tricoro CN (狂热节拍 IIDX 2)
* [iidxhook6](iidxhook6.md): Tricoro * [iidxhook6](iidxhook6.md): Tricoro
* [iidxhook7](iidxhook7.md): SPADA, PENDUAL, copula, SINOBUZ * [iidxhook7](iidxhook7.md): SPADA, PENDUAL, copula, SINOBUZ
* [iidxhook8](iidxhook8.md): CANNON BALLERS, Rootage * [iidxhook8](iidxhook8.md): CANNON BALLERS, Rootage

View File

@@ -198,6 +198,13 @@ can't be refreshed very often to make it feel unresponsive. Solution:
hit your 10key/numpad slower than normal hit your 10key/numpad slower than normal
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears (RED, HAPPY SKY) ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears (RED, HAPPY SKY)
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax
@@ -234,4 +241,4 @@ If one or multiple of these issues apply, use the built in scaling options by se
*gfx.scale_back_buffer_width* and *gfx.scale_back_buffer_height* to a target resolution *gfx.scale_back_buffer_width* and *gfx.scale_back_buffer_height* to a target resolution
to scale to. Usually, you want to set this to the monitor's native resolution, e.g. to scale to. Usually, you want to set this to the monitor's native resolution, e.g.
1920x1080 for full HD. You can play around with a few different filters using 1920x1080 for full HD. You can play around with a few different filters using
*gfx.scale_back_buffer_filter* which impacts image quality/blurriness on upscaling. *gfx.scale_back_buffer_filter* which impacts image quality/blurriness on upscaling.

View File

@@ -154,6 +154,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -165,6 +165,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -0,0 +1,13 @@
# Game list
The following games are compatible with this version of iidxhook:
* Resort Anthem CN (狂热节拍 IIDX)
The games must be bootstrapped using [inject.exe](../inject.md).
# Remarks
Resort Anthem CN (狂热节拍 IIDX):
* Does not have NETWORK function
* Game doesn't used card readers

View File

@@ -175,6 +175,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -0,0 +1,15 @@
# Game list
The following games are compatible with this version of iidxhook:
* tricoro CN (狂热节拍 IIDX 2)
The games must be bootstrapped using [inject.exe](../inject.md).
# Remarks
tricoro CN (狂热节拍 IIDX 2):
* Game uses Lincle engine
* Identifier being JDZ
* Does not have NETWORK function
* Game doesn't used card readers

View File

@@ -171,6 +171,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -177,6 +177,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -182,6 +182,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -185,6 +185,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

View File

@@ -3,6 +3,7 @@
The following games are compatible with this version of iidxhook: The following games are compatible with this version of iidxhook:
* Heroic Verse * Heroic Verse
* BISTROVER * BISTROVER
* CASTHOUR
The games must be bootstrapped using [launcher](../launcher.md). The games must be bootstrapped using [launcher](../launcher.md).
@@ -221,6 +222,13 @@ iidxhook can limit the frame rate for you (refer to help/config file)
Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only" Use dxwnd and set settings like "Acquire admin caps" and "Fullscreen only"
## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears ## Background videos aren't working. When starting a song, windows is playing the error sound and a message box appears
If you are running in window mode, you can see an error pop-up window with the title
`DirectShow Texture3D Sample` and error message
`Could not create source filter to graph! hr=<some number>`.
When running fullscreen, you only hear a windows error sound and the game appears to be frozen
when trying to play a background video.
You are missing a codec to decode and play the videos. There are different You are missing a codec to decode and play the videos. There are different
methods available to get background videos working. Probably, the easiest methods available to get background videos working. Probably, the easiest
solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax solution: grab the CLVSD.ax file and go to Start -> Run -> regsvr32 clvsd.ax

48
doc/popnhook/README.md Normal file
View File

@@ -0,0 +1,48 @@
# popnhook
popnhook is a collection of hook libraries for pop'n music providing
emulation and various patches to run these games on non BemaniPC hardware and
newer Windows versions.
The hook libraries must be bootstrapped either using [inject](../inject.md) or
[launcher](../launcher.md) depending on the version you want to run. Further
instructions are given in dedicated readme files for each popnhook version
(see below).
# Versions
popnhook comes in a few different flavors. The game and its engine changed over
the years. Some game versions might require patches/parameters enabled which
others don't need or have different AVS versions. Here is the list of supported
games:
* [popnhook1](popnhook1.md): 15 ADVENTURE, 16 PARTY♪, 17 THE MOVIE, 18 せんごく列伝
When building bemanitools, independent packages are created for each set of games
which are ready to be dropped on top of vanilla AC data dumps. We recommend
using pristine dumps to avoid any conflicts with other hardcoded hacks or
binary patches.
# How to run
To run your game with popnhook, you have to use the inject tool to inject the
DLL to the game process. `dist/popn` contains bat scripts with all the
important parameters configured. Further parameters can be added but might not
be required to run the game with default settings.
Further information on how to setup the data for each specific version are
elaborated in their dedicated readme files.
# Eamuse network setup
Running pop'n music 15 through 18? Modify the appropriate popnhook-15.conf, popnhook-16.conf,
popnhook-17.conf, or popnhook-18.conf.
Running anything newer?
* Open the `prop/ea3-config.xml`
* Replace the `ea3/network/services` URL with network service URL of your
choice (for example http://my.eamuse.com)
* Edit the `ea3/id/pcbid`
# Command line options
Add the argument *-h* when running inject with popnhook to print help/usage
information with a list of parameters you can apply to tweak various things.

45
doc/popnhook/popnhook1.md Normal file
View File

@@ -0,0 +1,45 @@
# Game list
The following games are compatible with this version of popnhook:
* pop'n music 15 ADVENTURE
* pop'n music 16 PARTY♪
* pop'n music 17 THE MOVIE
* pop'n music 18 せんごく列伝
The games must be bootstrapped using [inject](../inject.md).
# Data setup and running the game
Unpack the package containing popnhook1 into the revision folder of your choice.
Most likely, you want to target the latest revision you have to run the latest
binary of the game with any bugfixes by developers.
The DLLs in this package should be in the same location as the game DLLs and
executable - i.e. all these files should be in the same folder:
- `inject.exe`
- `popn15.exe` or `popn16.exe` or `popn17.exe` or `popn18.exe`
- `popnhook-15.conf` or `popnhook-16.conf` or `popnhook-17.conf` or `popnhook-18.conf`
- `eamio.dll`
- `popnio.dll`
- `libavs-win32.dll`
- etc
Run the `gamestart-15.bat` or `gamestart-16.bat` or `gamestart-17.bat` or `gamestart-18.bat` file as admin.
# Eamuse network setup
If you want to run the games online, you have to set a valid PCBID in the
configuration file. You also have to set the url of the eamuse server you want
to connect to.
# Eamuse network setup
If you want to run the games online, you have to set a valid PCBID and EAMID
(use the PCBID as the EAMID) in the configuration file or as a command line
argument. You also have to set the url of the eamuse server you want to
connect to.
Additional note regarding EAMID: This is provided as the identifier of the
"eamuse license" to the server. Depending on the implementation of the server,
this can lead to authentication failure resulting in a network error on boot or
warning during gameplay.

View File

@@ -18,6 +18,7 @@ EXPORTS
property_destroy @247 NONAME property_destroy @247 NONAME
property_insert_read @255 NONAME property_insert_read @255 NONAME
property_node_create @266 NONAME property_node_create @266 NONAME
property_node_datasize @267 NONAME
property_node_refer @278 NONAME property_node_refer @278 NONAME
property_node_remove @279 NONAME property_node_remove @279 NONAME
property_psmap_import @288 NONAME property_psmap_import @288 NONAME

View File

@@ -17,6 +17,7 @@ EXPORTS
property_destroy @264 NONAME property_destroy @264 NONAME
property_insert_read @23 NONAME property_insert_read @23 NONAME
property_node_create @316 NONAME property_node_create @316 NONAME
property_node_datasize @249 NONAME
property_node_refer @268 NONAME property_node_refer @268 NONAME
property_node_remove @129 NONAME property_node_remove @129 NONAME
property_psmap_import @102 NONAME property_psmap_import @102 NONAME

View File

@@ -0,0 +1,108 @@
#ifndef BEMANITOOLS_POPNIO_H
#define BEMANITOOLS_POPNIO_H
/* IO emulation provider for pop'n music. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* Bit mapping for the "buttons" word */
enum popn_io_sys_bit {
POPN_IO_SYS_SERVICE = 0x06,
POPN_IO_SYS_TEST = 0x07,
};
enum popn_io_button_bit {
POPN_IO_BUTTON_1 = 0x08,
POPN_IO_BUTTON_2 = 0x09,
POPN_IO_BUTTON_3 = 0x0a,
POPN_IO_BUTTON_4 = 0x0b,
POPN_IO_BUTTON_5 = 0x0c,
POPN_IO_BUTTON_6 = 0x0d,
POPN_IO_BUTTON_7 = 0x0e,
POPN_IO_BUTTON_8 = 0x0f,
POPN_IO_BUTTON_9 = 0x10,
};
enum popn_io_light_top_lamp_bit {
POPN_LIGHT_HI_LAMP1 = 0x00,
POPN_LIGHT_HI_LAMP2 = 0x01,
POPN_LIGHT_HI_LAMP3 = 0x02,
POPN_LIGHT_HI_LAMP4 = 0x03,
POPN_LIGHT_HI_LAMP5 = 0x04,
};
enum popn_io_light_side_lamp_bit {
POPN_LIGHT_LEFT_LAMP1 = 0x00,
POPN_LIGHT_LEFT_LAMP2 = 0x01,
POPN_LIGHT_RIGHT_LAMP1 = 0x02,
POPN_LIGHT_RIGHT_LAMP2 = 0x03,
};
enum popn_io_light_switch_lamp_bit {
POPN_LIGHT_SW_LAMP1 = 0x00, // Is actually 4 bits wide
POPN_LIGHT_SW_LAMP2 = 0x04,
POPN_LIGHT_SW_LAMP3 = 0x05,
POPN_LIGHT_SW_LAMP4 = 0x06,
POPN_LIGHT_SW_LAMP5 = 0x07,
POPN_LIGHT_SW_LAMP6 = 0x08,
POPN_LIGHT_SW_LAMP7 = 0x09,
POPN_LIGHT_SW_LAMP8 = 0x0a,
POPN_LIGHT_SW_LAMP9 = 0x0b,
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void popn_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your pop'n music IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool popn_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your pop'n music IO emulation DLL */
void popn_io_fini(void);
/* Get the state of the buttons. See enums above. */
uint32_t popn_io_get_buttons(void);
/* Set the top light state. See enum popn_io_light_top_lamp_bit above. */
void popn_io_set_top_lights(uint32_t lights);
/* Set the side light state. See enum popn_io_light_side_lamp_bit above. */
void popn_io_set_side_lights(uint32_t lights);
/* Set the button light state. See enum popn_io_light_switch_lamp_bit above. */
void popn_io_set_button_lights(uint32_t lights);
/* Set the coin blocker light state. */
void popn_io_set_coin_blocker_light(bool enabled);
/* Set the coin counter light state. */
void popn_io_set_coin_counter_light(bool enabled);
#endif

View File

@@ -193,7 +193,7 @@ static HRESULT usbmem_write(struct irp *irp)
usbmem_response[2] = ~usbmem_response[1]; usbmem_response[2] = ~usbmem_response[1];
if (usbmem_state[target_device_id].buffer_frame == 0) { if (usbmem_state[target_device_id].buffer_frame == 0) {
snprintf(usbmem_response + 4, sizeof(usbmem_response) - 5, "%d ", usbmem_state[target_device_id].buffer_len); snprintf(usbmem_response + 4, sizeof(usbmem_response) - 5, "%Iu ", usbmem_state[target_device_id].buffer_len);
} else { } else {
size_t len = sizeof(usbmem_response) - 5; size_t len = sizeof(usbmem_response) - 5;

View File

@@ -6,4 +6,12 @@ libs_ezusb-emu := \
src_ezusb-emu := \ src_ezusb-emu := \
desc.c \ desc.c \
device.c \ device.c \
util.c util.c \
node-coin.c \
node-eeprom.c \
node-none.c \
node-security-mem.c \
node-security-plug.c \
node-sram.c \
node-wdt.c \
nodes.c

View File

@@ -1,6 +1,6 @@
#define LOG_MODULE "ezusb-iidx-emu-node-coin" #define LOG_MODULE "ezusb-emu-node-coin"
#include "ezusb-iidx-emu/node-coin.h" #include "ezusb-emu/node-coin.h"
#include "ezusb-iidx/coin-cmd.h" #include "ezusb-iidx/coin-cmd.h"

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_COIN_H #ifndef EZUSB_IIDX_EMU_NODE_COIN_H
#define EZUSB_IIDX_EMU_NODE_COIN_H #define EZUSB_IIDX_EMU_NODE_COIN_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
uint8_t ezusb_iidx_emu_node_coin_process_cmd( uint8_t ezusb_iidx_emu_node_coin_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2); uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2);

View File

@@ -1,8 +1,8 @@
#define LOG_MODULE "ezusb-iidx-emu-node-eeprom" #define LOG_MODULE "ezusb-emu-node-eeprom"
#include <string.h> #include <string.h>
#include "ezusb-iidx-emu/node-eeprom.h" #include "ezusb-emu/node-eeprom.h"
#include "ezusb-iidx/eeprom-cmd.h" #include "ezusb-iidx/eeprom-cmd.h"

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_EEPROM_H #ifndef EZUSB_IIDX_EMU_NODE_EEPROM_H
#define EZUSB_IIDX_EMU_NODE_EEPROM_H #define EZUSB_IIDX_EMU_NODE_EEPROM_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
void ezusb_iidx_emu_node_eeprom_init(void); void ezusb_iidx_emu_node_eeprom_init(void);
/* Used on 9th to DistorteD */ /* Used on 9th to DistorteD */

View File

@@ -1,4 +1,4 @@
#include "ezusb-iidx-emu/node-none.h" #include "ezusb-emu/node-none.h"
uint8_t ezusb_iidx_emu_node_none_process_cmd( uint8_t ezusb_iidx_emu_node_none_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2) uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2)

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_NONE_H #ifndef EZUSB_IIDX_EMU_NODE_NONE_H
#define EZUSB_IIDX_EMU_NODE_NONE_H #define EZUSB_IIDX_EMU_NODE_NONE_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
uint8_t ezusb_iidx_emu_node_none_process_cmd( uint8_t ezusb_iidx_emu_node_none_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2); uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2);

View File

@@ -1,8 +1,8 @@
#define LOG_MODULE "ezusb-iidx-emu-node-sec-mem" #define LOG_MODULE "ezusb-emu-node-sec-mem"
#include <string.h> #include <string.h>
#include "ezusb-iidx-emu/node-security-mem.h" #include "ezusb-emu/node-security-mem.h"
#include "ezusb-iidx/secmem-cmd.h" #include "ezusb-iidx/secmem-cmd.h"
#include "util/log.h" #include "util/log.h"
@@ -54,9 +54,9 @@ uint8_t ezusb_iidx_emu_node_security_mem_v1_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2) uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2)
{ {
switch (cmd_id) { switch (cmd_id) {
case EZUSB_IIDX_SECMEM_CMD_WRITE: case EZUSB_IIDX_SECMEM_CMD_INIT:
log_misc("EZUSB_SECURITY_MEM_V1_CMD_WRITE"); log_misc("EZUSB_SECURITY_MEM_V1_CMD_INIT");
return EZUSB_IIDX_SECMEM_CMD_STATUS_V1_WRITE_OK; return EZUSB_IIDX_SECMEM_CMD_STATUS_V1_INIT_OK;
default: default:
log_warning( log_warning(
@@ -69,9 +69,9 @@ uint8_t ezusb_iidx_emu_node_security_mem_v2_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2) uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2)
{ {
switch (cmd_id) { switch (cmd_id) {
case EZUSB_IIDX_SECMEM_CMD_WRITE: case EZUSB_IIDX_SECMEM_CMD_INIT:
log_misc("EZUSB_SECURITY_MEM_V2_CMD_WRITE"); log_misc("EZUSB_SECURITY_MEM_V2_CMD_INIT");
return EZUSB_IIDX_SECMEM_CMD_STATUS_V2_WRITE_OK; return EZUSB_IIDX_SECMEM_CMD_STATUS_V2_INIT_OK;
default: default:
log_warning( log_warning(

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_SECURITY_MEM_H #ifndef EZUSB_IIDX_EMU_NODE_SECURITY_MEM_H
#define EZUSB_IIDX_EMU_NODE_SECURITY_MEM_H #define EZUSB_IIDX_EMU_NODE_SECURITY_MEM_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
void ezusb_iidx_emu_node_security_mem_init(void); void ezusb_iidx_emu_node_security_mem_init(void);

View File

@@ -1,10 +1,10 @@
#define LOG_MODULE "ezusb-iidx-emu-node-sec-plug" #define LOG_MODULE "ezusb-emu-node-sec-plug"
#include <string.h> #include <string.h>
#include "ezusb-iidx-emu/node-eeprom.h" #include "ezusb-emu/node-eeprom.h"
#include "ezusb-iidx-emu/node-security-mem.h" #include "ezusb-emu/node-security-mem.h"
#include "ezusb-iidx-emu/node-security-plug.h" #include "ezusb-emu/node-security-plug.h"
#include "ezusb-iidx/secplug-cmd.h" #include "ezusb-iidx/secplug-cmd.h"
#include "security/rp.h" #include "security/rp.h"
@@ -174,8 +174,8 @@ uint8_t ezusb_iidx_emu_node_security_plug_process_cmd_v1(
EZUSB_IIDX_SECPLUG_DONGLE_MEM_DATA; EZUSB_IIDX_SECPLUG_DONGLE_MEM_DATA;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V1_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V1_OK;
case EZUSB_IIDX_SECPLUG_CMD_V1_SECURITY_CONVERSION: case EZUSB_IIDX_SECPLUG_CMD_V1_WRITE_DATA:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V1_SECURITY_CONVERSION"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V1_WRITE_DATA");
/* TODO ? */ /* TODO ? */
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V1_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V1_OK;
@@ -201,40 +201,57 @@ uint8_t ezusb_iidx_emu_node_security_plug_process_cmd_v2(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2) uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2)
{ {
switch (cmd_id) { switch (cmd_id) {
case EZUSB_IIDX_SECPLUG_CMD_V2_INIT: case EZUSB_IIDX_SECPLUG_CMD_V2_SEARCH:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_INIT"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SEARCH");
ezusb_iidx_emu_node_security_plug_active_dongle_mem = ezusb_iidx_emu_node_security_plug_active_dongle_mem =
EZUSB_IIDX_SECPLUG_DONGLE_MEM_ROM; EZUSB_IIDX_SECPLUG_DONGLE_MEM_ROM;
ezusb_iidx_emu_node_security_plug_enc_rom_data_seed = cmd_data; ezusb_iidx_emu_node_security_plug_enc_rom_data_seed = cmd_data;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SEARCH_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA: case EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA");
ezusb_iidx_emu_node_security_plug_active_dongle_mem = ezusb_iidx_emu_node_security_plug_active_dongle_mem =
EZUSB_IIDX_SECPLUG_DONGLE_MEM_DATA; EZUSB_IIDX_SECPLUG_DONGLE_MEM_DATA;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_DATA_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_READ_DATA_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM: case EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM");
ezusb_iidx_emu_node_security_plug_active_dongle_mem = ezusb_iidx_emu_node_security_plug_active_dongle_mem =
EZUSB_IIDX_SECPLUG_DONGLE_MEM_ROM; EZUSB_IIDX_SECPLUG_DONGLE_MEM_ROM;
ezusb_iidx_emu_node_security_plug_enc_rom_data_seed = cmd_data; ezusb_iidx_emu_node_security_plug_enc_rom_data_seed = cmd_data;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_ROM_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_READ_ROM_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE_2: // pop'n music only ever uses slot 2 (white) and slot 4 (black).
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE_2"); // If the configuration does not match then it will error out.
// IIDX uses slots 2 and 3 and detects what is plugged into each slot so ordering isn't important.
// IIDX also reads slot 1's data section but doesn't care what dongle it is?
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_1:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_1");
ezusb_iidx_emu_node_security_plug_active_dongle_slot = ezusb_iidx_emu_node_security_plug_active_dongle_slot =
EZUSB_IIDX_SECPLUG_DONGLE_SLOT_WHITE; EZUSB_IIDX_SECPLUG_DONGLE_SLOT_WHITE;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_BLACK_DONGLE: case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_2:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_BLACK_DONGLE"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_2");
ezusb_iidx_emu_node_security_plug_active_dongle_slot =
EZUSB_IIDX_SECPLUG_DONGLE_SLOT_WHITE;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_3:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_3");
ezusb_iidx_emu_node_security_plug_active_dongle_slot = ezusb_iidx_emu_node_security_plug_active_dongle_slot =
EZUSB_IIDX_SECPLUG_DONGLE_SLOT_BLACK; EZUSB_IIDX_SECPLUG_DONGLE_SLOT_BLACK;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE: case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_4:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE"); log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_4");
ezusb_iidx_emu_node_security_plug_active_dongle_slot =
EZUSB_IIDX_SECPLUG_DONGLE_SLOT_BLACK;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK;
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_5:
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_5");
// Unknown, not encountered during testing
ezusb_iidx_emu_node_security_plug_active_dongle_slot = ezusb_iidx_emu_node_security_plug_active_dongle_slot =
EZUSB_IIDX_SECPLUG_DONGLE_SLOT_WHITE; EZUSB_IIDX_SECPLUG_DONGLE_SLOT_WHITE;
return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK; return EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK;

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_SECURITY_PLUG_H #ifndef EZUSB_IIDX_EMU_NODE_SECURITY_PLUG_H
#define EZUSB_IIDX_EMU_NODE_SECURITY_PLUG_H #define EZUSB_IIDX_EMU_NODE_SECURITY_PLUG_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
#include "security/id.h" #include "security/id.h"
#include "security/mcode.h" #include "security/mcode.h"

View File

@@ -1,9 +1,9 @@
#define LOG_MODULE "ezusb-iidx-emu-node-sram" #define LOG_MODULE "ezusb-emu-node-sram"
#include <string.h> #include <string.h>
#include "ezusb-iidx-emu/conf.h" #include "ezusb-emu/conf.h"
#include "ezusb-iidx-emu/node-sram.h" #include "ezusb-emu/node-sram.h"
#include "ezusb-iidx/sram-cmd.h" #include "ezusb-iidx/sram-cmd.h"
#include "util/fs.h" #include "util/fs.h"

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_SRAM_H #ifndef EZUSB_IIDX_EMU_NODE_SRAM_H
#define EZUSB_IIDX_EMU_NODE_SRAM_H #define EZUSB_IIDX_EMU_NODE_SRAM_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
uint8_t ezusb_iidx_emu_node_sram_process_cmd( uint8_t ezusb_iidx_emu_node_sram_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2); uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2);

View File

@@ -1,6 +1,6 @@
#define LOG_MODULE "ezusb-iidx-emu-node-wdt" #define LOG_MODULE "ezusb-emu-node-wdt"
#include "ezusb-iidx-emu/node-wdt.h" #include "ezusb-emu/node-wdt.h"
#include "ezusb-iidx/wdt-cmd.h" #include "ezusb-iidx/wdt-cmd.h"
#include "util/log.h" #include "util/log.h"

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_WDT_H #ifndef EZUSB_IIDX_EMU_NODE_WDT_H
#define EZUSB_IIDX_EMU_NODE_WDT_H #define EZUSB_IIDX_EMU_NODE_WDT_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
uint8_t ezusb_iidx_emu_node_wdt_process_cmd( uint8_t ezusb_iidx_emu_node_wdt_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2); uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2);

View File

@@ -0,0 +1,96 @@
/*
* This file contains the ezusb nodes that appeared on
* all IIDX games so far.
*/
#include "ezusb-iidx/msg.h"
#include "ezusb-emu/node-coin.h"
#include "ezusb-emu/node-eeprom.h"
#include "ezusb-emu/node-none.h"
#include "ezusb-emu/node-security-mem.h"
#include "ezusb-emu/node-security-plug.h"
#include "ezusb-emu/node-sram.h"
#include "ezusb-emu/node-wdt.h"
#include "ezusb-emu/nodes.h"
#include "ezusb-emu/node.h"
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_coin = {
.node_id = EZUSB_IIDX_MSG_NODE_COIN,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_coin_process_cmd,
.read_packet = ezusb_iidx_emu_node_coin_read_packet,
.write_packet = ezusb_iidx_emu_node_coin_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_EEPROM,
.init_node = ezusb_iidx_emu_node_eeprom_init,
.process_cmd = ezusb_iidx_emu_node_eeprom_process_cmd_v1,
.read_packet = ezusb_iidx_emu_node_eeprom_read_packet,
.write_packet = ezusb_iidx_emu_node_eeprom_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_EEPROM,
.init_node = ezusb_iidx_emu_node_eeprom_init,
.process_cmd = ezusb_iidx_emu_node_eeprom_process_cmd_v2,
.read_packet = ezusb_iidx_emu_node_eeprom_read_packet,
.write_packet = ezusb_iidx_emu_node_eeprom_write_packet};
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_none = {
.node_id = EZUSB_IIDX_MSG_NODE_NONE,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_none_process_cmd,
.read_packet = ezusb_iidx_emu_node_none_read_packet,
.write_packet = ezusb_iidx_emu_node_none_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_MEM,
.init_node = ezusb_iidx_emu_node_security_mem_init,
.process_cmd = ezusb_iidx_emu_node_security_mem_v1_process_cmd,
.read_packet = ezusb_iidx_emu_node_security_mem_read_packet,
.write_packet = ezusb_iidx_emu_node_security_mem_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_MEM,
.init_node = ezusb_iidx_emu_node_security_mem_init,
.process_cmd = ezusb_iidx_emu_node_security_mem_v2_process_cmd,
.read_packet = ezusb_iidx_emu_node_security_mem_read_packet,
.write_packet = ezusb_iidx_emu_node_security_mem_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_PLUG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_security_plug_process_cmd_v1,
.read_packet = ezusb_iidx_emu_node_security_plug_read_packet_v1,
.write_packet = ezusb_iidx_emu_node_security_plug_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_PLUG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_security_plug_process_cmd_v2,
.read_packet = ezusb_iidx_emu_node_security_plug_read_packet_v2,
.write_packet = ezusb_iidx_emu_node_security_plug_write_packet};
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_sram = {
.node_id = EZUSB_IIDX_MSG_NODE_SRAM,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_sram_process_cmd,
.read_packet = ezusb_iidx_emu_node_sram_read_packet,
.write_packet = ezusb_iidx_emu_node_sram_write_packet};
/* Used on 9th to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_wdt = {
.node_id = EZUSB_IIDX_MSG_NODE_WDT,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_wdt_process_cmd,
.read_packet = ezusb_iidx_emu_node_wdt_read_packet,
.write_packet = ezusb_iidx_emu_node_wdt_write_packet};

View File

@@ -0,0 +1,17 @@
#ifndef EZUSBEMU_NODES_H
#define EZUSBEMU_NODES_H
#include "ezusb-emu/node.h"
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_coin;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_none;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_sram;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_wdt;
#endif

View File

@@ -0,0 +1,5 @@
libs += ezusb-iidx-16seg-emu
src_ezusb-iidx-16seg-emu := \
node-16seg.c \
nodes.c \

View File

@@ -1,6 +1,6 @@
#define LOG_MODULE "ezusb-iidx-emu-node-16seg" #define LOG_MODULE "ezusb-iidx-emu-node-16seg"
#include "ezusb-iidx-emu/node-16seg.h" #include "ezusb-iidx-16seg-emu/node-16seg.h"
#include <string.h> #include <string.h>

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_16SEG_H #ifndef EZUSB_IIDX_EMU_NODE_16SEG_H
#define EZUSB_IIDX_EMU_NODE_16SEG_H #define EZUSB_IIDX_EMU_NODE_16SEG_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
uint8_t ezusb_iidx_emu_node_16seg_process_cmd( uint8_t ezusb_iidx_emu_node_16seg_process_cmd(
uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2); uint8_t cmd_id, uint8_t cmd_data, uint8_t cmd_data2);

View File

@@ -0,0 +1,16 @@
/*
* This file contains the ezusb nodes that appeared on
* all IIDX games so far.
*/
#include "ezusb-iidx/msg.h"
#include "ezusb-iidx-16seg-emu/node-16seg.h"
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_16seg = {
.node_id = EZUSB_IIDX_MSG_NODE_16SEG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_16seg_process_cmd,
.read_packet = ezusb_iidx_emu_node_16seg_read_packet,
.write_packet = ezusb_iidx_emu_node_16seg_write_packet};

View File

@@ -0,0 +1,8 @@
#ifndef EZUSBEMU_NODES_16SEG_IIDX_H
#define EZUSBEMU_NODES_16SEG_IIDX_H
#include "ezusb-emu/node.h"
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_16seg;
#endif

View File

@@ -1,19 +1,12 @@
libs += ezusb-iidx-emu libs += ezusb-iidx-emu
libs_ezusb-iidx-emu := \ libs_ezusb-iidx-emu := \
ezusbemu \ ezusb-emu \
ezusb-iidx-16seg-emu \
src_ezusb-iidx-emu := \ src_ezusb-iidx-emu := \
card-mag.c \ card-mag.c \
msg.c \ msg.c \
node-16seg.c \
node-coin.c \
node-eeprom.c \
node-fpga.c \ node-fpga.c \
node-none.c \
node-security-mem.c \
node-security-plug.c \
node-serial.c \ node-serial.c \
node-sram.c \
node-wdt.c \
nodes.c \ nodes.c \

View File

@@ -9,14 +9,17 @@
#include "hook/iohook.h" #include "hook/iohook.h"
#include "ezusb-emu/msg.h" #include "ezusb-emu/msg.h"
#include "ezusb-emu/nodes.h"
#include "ezusb-emu/node-coin.h"
#include "ezusb-iidx/msg.h" #include "ezusb-iidx/msg.h"
#include "ezusb-iidx-emu/msg.h" #include "ezusb-iidx-emu/msg.h"
#include "ezusb-iidx-emu/node-coin.h"
#include "ezusb-iidx-emu/node-serial.h" #include "ezusb-iidx-emu/node-serial.h"
#include "ezusb-iidx-emu/nodes.h" #include "ezusb-iidx-emu/nodes.h"
#include "ezusb-iidx-16seg-emu/nodes.h"
#include "util/hex.h" #include "util/hex.h"
#include "util/log.h" #include "util/log.h"

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_FPGA_H #ifndef EZUSB_IIDX_EMU_NODE_FPGA_H
#define EZUSB_IIDX_EMU_NODE_FPGA_H #define EZUSB_IIDX_EMU_NODE_FPGA_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
/* Used on 9th to DistorteD */ /* Used on 9th to DistorteD */
uint8_t ezusb_iidx_emu_node_fpga_v1_process_cmd( uint8_t ezusb_iidx_emu_node_fpga_v1_process_cmd(

View File

@@ -1,7 +1,7 @@
#ifndef EZUSB_IIDX_EMU_NODE_SERIAL_H #ifndef EZUSB_IIDX_EMU_NODE_SERIAL_H
#define EZUSB_IIDX_EMU_NODE_SERIAL_H #define EZUSB_IIDX_EMU_NODE_SERIAL_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
void ezusb_iidx_emu_node_serial_init(void); void ezusb_iidx_emu_node_serial_init(void);

View File

@@ -5,51 +5,10 @@
#include "ezusb-iidx/msg.h" #include "ezusb-iidx/msg.h"
#include "ezusb-iidx-emu/node-16seg.h"
#include "ezusb-iidx-emu/node-coin.h"
#include "ezusb-iidx-emu/node-eeprom.h"
#include "ezusb-iidx-emu/node-fpga.h" #include "ezusb-iidx-emu/node-fpga.h"
#include "ezusb-iidx-emu/node-none.h"
#include "ezusb-iidx-emu/node-security-mem.h"
#include "ezusb-iidx-emu/node-security-plug.h"
#include "ezusb-iidx-emu/node-serial.h" #include "ezusb-iidx-emu/node-serial.h"
#include "ezusb-iidx-emu/node-sram.h"
#include "ezusb-iidx-emu/node-wdt.h"
#include "ezusb-iidx-emu/node.h"
#include "ezusb-iidx-emu/nodes.h" #include "ezusb-iidx-emu/nodes.h"
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_16seg = {
.node_id = EZUSB_IIDX_MSG_NODE_16SEG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_16seg_process_cmd,
.read_packet = ezusb_iidx_emu_node_16seg_read_packet,
.write_packet = ezusb_iidx_emu_node_16seg_write_packet};
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_coin = {
.node_id = EZUSB_IIDX_MSG_NODE_COIN,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_coin_process_cmd,
.read_packet = ezusb_iidx_emu_node_coin_read_packet,
.write_packet = ezusb_iidx_emu_node_coin_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_EEPROM,
.init_node = ezusb_iidx_emu_node_eeprom_init,
.process_cmd = ezusb_iidx_emu_node_eeprom_process_cmd_v1,
.read_packet = ezusb_iidx_emu_node_eeprom_read_packet,
.write_packet = ezusb_iidx_emu_node_eeprom_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_EEPROM,
.init_node = ezusb_iidx_emu_node_eeprom_init,
.process_cmd = ezusb_iidx_emu_node_eeprom_process_cmd_v2,
.read_packet = ezusb_iidx_emu_node_eeprom_read_packet,
.write_packet = ezusb_iidx_emu_node_eeprom_write_packet};
/* Used on 9th to DistorteD */ /* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v1 = { const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_FPGA_V1, .node_id = EZUSB_IIDX_MSG_NODE_FPGA_V1,
@@ -66,46 +25,6 @@ const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v2 = {
.read_packet = ezusb_iidx_emu_node_fpga_read_packet, .read_packet = ezusb_iidx_emu_node_fpga_read_packet,
.write_packet = ezusb_iidx_emu_node_fpga_write_packet}; .write_packet = ezusb_iidx_emu_node_fpga_write_packet};
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_none = {
.node_id = EZUSB_IIDX_MSG_NODE_NONE,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_none_process_cmd,
.read_packet = ezusb_iidx_emu_node_none_read_packet,
.write_packet = ezusb_iidx_emu_node_none_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_MEM,
.init_node = ezusb_iidx_emu_node_security_mem_init,
.process_cmd = ezusb_iidx_emu_node_security_mem_v1_process_cmd,
.read_packet = ezusb_iidx_emu_node_security_mem_read_packet,
.write_packet = ezusb_iidx_emu_node_security_mem_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_MEM,
.init_node = ezusb_iidx_emu_node_security_mem_init,
.process_cmd = ezusb_iidx_emu_node_security_mem_v2_process_cmd,
.read_packet = ezusb_iidx_emu_node_security_mem_read_packet,
.write_packet = ezusb_iidx_emu_node_security_mem_write_packet};
/* Used on 9th to DistorteD */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v1 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_PLUG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_security_plug_process_cmd_v1,
.read_packet = ezusb_iidx_emu_node_security_plug_read_packet_v1,
.write_packet = ezusb_iidx_emu_node_security_plug_write_packet};
/* Used on Gold to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v2 = {
.node_id = EZUSB_IIDX_MSG_NODE_SECURITY_PLUG,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_security_plug_process_cmd_v2,
.read_packet = ezusb_iidx_emu_node_security_plug_read_packet_v2,
.write_packet = ezusb_iidx_emu_node_security_plug_write_packet};
/* Used on 9th to HappySky for magnetic readers */ /* Used on 9th to HappySky for magnetic readers */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_serial = { const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_serial = {
.node_id = EZUSB_IIDX_MSG_NODE_SERIAL, .node_id = EZUSB_IIDX_MSG_NODE_SERIAL,
@@ -113,19 +32,3 @@ const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_serial = {
.process_cmd = ezusb_iidx_emu_node_serial_process_cmd, .process_cmd = ezusb_iidx_emu_node_serial_process_cmd,
.read_packet = ezusb_iidx_emu_node_serial_read_packet, .read_packet = ezusb_iidx_emu_node_serial_read_packet,
.write_packet = ezusb_iidx_emu_node_serial_write_packet}; .write_packet = ezusb_iidx_emu_node_serial_write_packet};
/* All IIDX games */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_sram = {
.node_id = EZUSB_IIDX_MSG_NODE_SRAM,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_sram_process_cmd,
.read_packet = ezusb_iidx_emu_node_sram_read_packet,
.write_packet = ezusb_iidx_emu_node_sram_write_packet};
/* Used on 9th to Sirius */
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_wdt = {
.node_id = EZUSB_IIDX_MSG_NODE_WDT,
.init_node = NULL,
.process_cmd = ezusb_iidx_emu_node_wdt_process_cmd,
.read_packet = ezusb_iidx_emu_node_wdt_read_packet,
.write_packet = ezusb_iidx_emu_node_wdt_write_packet};

View File

@@ -1,21 +1,10 @@
#ifndef EZUSBEMU_NODES_IIDX_H #ifndef EZUSBEMU_NODES_IIDX_H
#define EZUSBEMU_NODES_IIDX_H #define EZUSBEMU_NODES_IIDX_H
#include "ezusb-iidx-emu/node.h" #include "ezusb-emu/node.h"
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_16seg;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_coin;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_eeprom_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v1; extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v2; extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_fpga_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_none;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_mem_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v1;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_security_plug_v2;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_serial; extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_serial;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_sram;
extern const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_wdt;
#endif #endif

View File

@@ -2,16 +2,16 @@
#define EZUSB_IIDX_SECMEM_CMD_H #define EZUSB_IIDX_SECMEM_CMD_H
enum ezusb_iidx_secmem_command { enum ezusb_iidx_secmem_command {
EZUSB_IIDX_SECMEM_CMD_WRITE = 0x00, EZUSB_IIDX_SECMEM_CMD_INIT = 0x00,
}; };
enum ezusb_iidx_secmem_command_status_v1 { enum ezusb_iidx_secmem_command_status_v1 {
EZUSB_IIDX_SECMEM_CMD_STATUS_V1_WRITE_OK = 0x60, EZUSB_IIDX_SECMEM_CMD_STATUS_V1_INIT_OK = 0x60,
EZUSB_IIDX_SECMEM_CMD_STATUS_V1_FAULT = 0xFE, EZUSB_IIDX_SECMEM_CMD_STATUS_V1_FAULT = 0xFE,
}; };
enum ezusb_iidx_secmem_command_status_v2 { enum ezusb_iidx_secmem_command_status_v2 {
EZUSB_IIDX_SECMEM_CMD_STATUS_V2_WRITE_OK = 0x11, EZUSB_IIDX_SECMEM_CMD_STATUS_V2_INIT_OK = 0x11,
EZUSB_IIDX_SECMEM_CMD_STATUS_V2_FAULT = 0xFE, EZUSB_IIDX_SECMEM_CMD_STATUS_V2_FAULT = 0xFE,
}; };

View File

@@ -14,7 +14,7 @@ enum ezusb_iidx_secplug_dongle_memory {
enum ezusb_iidx_secplug_command_v1 { enum ezusb_iidx_secplug_command_v1 {
EZUSB_IIDX_SECPLUG_CMD_V1_READ_ROM = 0x01, EZUSB_IIDX_SECPLUG_CMD_V1_READ_ROM = 0x01,
EZUSB_IIDX_SECPLUG_CMD_V1_READ_DATA = 0x02, EZUSB_IIDX_SECPLUG_CMD_V1_READ_DATA = 0x02,
EZUSB_IIDX_SECPLUG_CMD_V1_SECURITY_CONVERSION = 0x03, EZUSB_IIDX_SECPLUG_CMD_V1_WRITE_DATA = 0x03,
EZUSB_IIDX_SECPLUG_CMD_V1_SELECT_BLACK_DONGLE = 0x04, EZUSB_IIDX_SECPLUG_CMD_V1_SELECT_BLACK_DONGLE = 0x04,
EZUSB_IIDX_SECPLUG_CMD_V1_SELECT_WHITE_DONGLE = 0x05 EZUSB_IIDX_SECPLUG_CMD_V1_SELECT_WHITE_DONGLE = 0x05
}; };
@@ -25,18 +25,22 @@ enum ezusb_iidx_secplug_command_status_v1 {
}; };
enum ezusb_iidx_secplug_command_v2 { enum ezusb_iidx_secplug_command_v2 {
EZUSB_IIDX_SECPLUG_CMD_V2_INIT = 0x01, EZUSB_IIDX_SECPLUG_CMD_V2_SEARCH = 0x01,
EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA = 0x02, EZUSB_IIDX_SECPLUG_CMD_V2_READ_DATA = 0x02,
EZUSB_IIDX_SECPLUG_CMD_V2_WRITE_DATA = 0x03,
EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM = 0x06, EZUSB_IIDX_SECPLUG_CMD_V2_READ_ROM = 0x06,
EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE_2 = 0x07, EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_1 = 0x07,
EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_BLACK_DONGLE = 0x08, EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_2 = 0x08,
EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_WHITE_DONGLE = 0x09 EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_3 = 0x09,
EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_4 = 0x0a,
EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_5 = 0x0b,
}; };
enum ezusb_iidx_secplug_command_status_v2 { enum ezusb_iidx_secplug_command_status_v2 {
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_OK = 0x12, EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SEARCH_OK = 0x12,
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_DATA_OK = 0x13, EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_READ_DATA_OK = 0x13,
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_ROM_OK = 0x15, EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_WRITE_DATA_OK = 0x14,
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_READ_ROM_OK = 0x15,
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK = 0x16, EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_SECURITY_SEL_OK = 0x16,
EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_FAIL = 0xFE EZUSB_IIDX_SECPLUG_CMD_STATUS_V2_FAIL = 0xFE
}; };

View File

@@ -2,8 +2,8 @@
#define EZUSB_IIDX_SRAM_CMD_H #define EZUSB_IIDX_SRAM_CMD_H
enum ezusb_iidx_sram_command { enum ezusb_iidx_sram_command {
EZUSB_IIDX_SRAM_CMD_WRITE = 0x03,
EZUSB_IIDX_SRAM_CMD_READ = 0x02, EZUSB_IIDX_SRAM_CMD_READ = 0x02,
EZUSB_IIDX_SRAM_CMD_WRITE = 0x03,
EZUSB_IIDX_SRAM_CMD_DONE = 0x04 EZUSB_IIDX_SRAM_CMD_DONE = 0x04
}; };

View File

@@ -2,6 +2,7 @@ libs += ezusb2-iidx-emu
libs_ezusb2-iidx-emu := \ libs_ezusb2-iidx-emu := \
ezusb-emu \ ezusb-emu \
ezusb-iidx-16seg-emu \
src_ezusb2-iidx-emu := \ src_ezusb2-iidx-emu := \
msg.c \ msg.c \

View File

@@ -9,9 +9,8 @@
#include "hook/iohook.h" #include "hook/iohook.h"
#include "ezusb-emu/msg.h" #include "ezusb-emu/msg.h"
#include "ezusb-emu/nodes.h"
#include "ezusb-iidx-emu/msg.h" #include "ezusb-iidx-16seg-emu/nodes.h"
#include "ezusb-iidx-emu/nodes.h"
#include "ezusb2-iidx/msg.h" #include "ezusb2-iidx/msg.h"

View File

@@ -0,0 +1,9 @@
libs += ezusb2-popn-emu
libs_ezusb2-popn-emu := \
ezusb-emu \
ezusb-iidx \
ezusb2-iidx-emu \
src_ezusb2-popn-emu := \
msg.c \

View File

@@ -0,0 +1,193 @@
#define LOG_MODULE "ezusb2-popn-emu-msg"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "bemanitools/popnio.h"
#include "hook/iohook.h"
#include "ezusb-emu/msg.h"
#include "ezusb-emu/nodes.h"
#include "ezusb-emu/node-none.h"
#include "ezusb-emu/node-coin.h"
#include "ezusb-emu/node-security-mem.h"
#include "ezusb-emu/node-security-plug.h"
#include "ezusb2-popn/msg.h"
#include "util/hex.h"
#include "util/log.h"
/* ------------------------------------------------------------------------ */
static HRESULT ezusb2_popn_emu_msg_interrupt_read(struct iobuf *read);
static HRESULT ezusb2_popn_emu_msg_interrupt_write(struct const_iobuf *write);
static HRESULT ezusb2_popn_emu_msg_bulk_read(struct iobuf *read);
static HRESULT ezusb2_popn_emu_msg_bulk_write(struct const_iobuf *write);
/* ------------------------------------------------------------------------ */
static struct ezusb_emu_msg_hook ezusb2_popn_emu_msg_hook = {
.interrupt_read = ezusb2_popn_emu_msg_interrupt_read,
.interrupt_write = ezusb2_popn_emu_msg_interrupt_write,
.bulk_read = ezusb2_popn_emu_msg_bulk_read,
.bulk_write = ezusb2_popn_emu_msg_bulk_write};
/* ------------------------------------------------------------------------ */
static const struct ezusb_iidx_emu_node *ezusb2_popn_emu_msg_nodes[256] = {
[EZUSB_IIDX_MSG_NODE_COIN] = &ezusb_iidx_emu_node_coin,
[EZUSB_IIDX_MSG_NODE_NONE] = &ezusb_iidx_emu_node_none,
[EZUSB_IIDX_MSG_NODE_EEPROM] = &ezusb_iidx_emu_node_eeprom_v2,
[EZUSB_IIDX_MSG_NODE_SECURITY_MEM] = &ezusb_iidx_emu_node_security_mem_v2,
[EZUSB_IIDX_MSG_NODE_SECURITY_PLUG] = &ezusb_iidx_emu_node_security_plug_v2,
[EZUSB_IIDX_MSG_NODE_SRAM] = &ezusb_iidx_emu_node_sram,
[EZUSB_IIDX_MSG_NODE_WDT] = &ezusb_iidx_emu_node_wdt,
};
static uint8_t ezusb2_popn_emu_msg_status = 0;
static uint8_t ezusb2_popn_emu_msg_seq_no = 0;
static uint8_t ezusb2_popn_emu_msg_read_cur_node = 0;
static uint16_t ezusb2_popn_emu_msg_history[10];
/* ------------------------------------------------------------------------ */
struct ezusb_emu_msg_hook *ezusb2_popn_emu_msg_init(void)
{
/* Init all nodes */
for (uint32_t i = 0; i < 256; i++) {
/* "Constructor" optional */
if (ezusb2_popn_emu_msg_nodes[i] &&
ezusb2_popn_emu_msg_nodes[i]->init_node) {
ezusb2_popn_emu_msg_nodes[i]->init_node();
}
}
memset(&ezusb2_popn_emu_msg_history[0], 0xff, sizeof(ezusb2_popn_emu_msg_history));
return &ezusb2_popn_emu_msg_hook;
}
static HRESULT ezusb2_popn_emu_msg_interrupt_read(struct iobuf *read)
{
struct ezusb2_popn_msg_interrupt_read_packet *msg_resp =
(struct ezusb2_popn_msg_interrupt_read_packet *) read->bytes;
memset(msg_resp, 0, sizeof(*msg_resp));
msg_resp->unk0 = 0x03;
msg_resp->unk1 = 0x1d;
msg_resp->unk2 = 0x85;
msg_resp->seq_no = ezusb2_popn_emu_msg_seq_no++;
msg_resp->status = ezusb2_popn_emu_msg_status;
msg_resp->unk3 = 0x00;
msg_resp->coin_count = 0;
msg_resp->unk4 = 0xfd;
msg_resp->io.inverted_pad = ~popn_io_get_buttons();
msg_resp->unk5 = 0x00;
msg_resp->unk6 = 0x7d;
msg_resp->unk7 = 0xdf;
msg_resp->unk8 = ezusb2_popn_emu_msg_seq_no;
memcpy(&msg_resp->button_history[0], &ezusb2_popn_emu_msg_history[0], sizeof(uint16_t) * 10);
read->pos = sizeof(*msg_resp);
memmove(&ezusb2_popn_emu_msg_history[1], &ezusb2_popn_emu_msg_history[0], sizeof(uint16_t) * 9);
ezusb2_popn_emu_msg_history[0] = msg_resp->io.button;
return S_OK;
}
static HRESULT ezusb2_popn_emu_msg_interrupt_write(struct const_iobuf *write)
{
const struct ezusb2_popn_msg_interrupt_write_packet *msg_req =
(const struct ezusb2_popn_msg_interrupt_write_packet *) write->bytes;
if (write->nbytes < sizeof(*msg_req)) {
log_warning("Interrupt write message too small");
return E_INVALIDARG;
}
if (!ezusb2_popn_emu_msg_nodes[msg_req->node]) {
ezusb2_popn_emu_msg_read_cur_node = 0;
log_warning(
"Unrecognised node in interrupt message: %02x", msg_req->node);
return E_INVALIDARG;
}
popn_io_set_top_lights(msg_req->lamp & 0x1f);
popn_io_set_side_lights((msg_req->lamp >> 8) & 0xf);
popn_io_set_button_lights((msg_req->lamp >> 20) & 0xfff);
popn_io_set_coin_counter_light(((msg_req->lamp >> 12) & 0xf) == 0); // Active low
popn_io_set_coin_blocker_light(((msg_req->lamp >> 16) & 0xf) == 0xf);
/* Remember node for next bulk read */
ezusb2_popn_emu_msg_read_cur_node = msg_req->node;
ezusb2_popn_emu_msg_status =
ezusb2_popn_emu_msg_nodes[msg_req->node]->process_cmd(
msg_req->cmd, msg_req->cmd_detail[0], msg_req->cmd_detail[1]);
return S_OK;
}
static HRESULT ezusb2_popn_emu_msg_bulk_read(struct iobuf *read)
{
struct ezusb_iidx_msg_bulk_packet *pkt =
(struct ezusb_iidx_msg_bulk_packet *) read->bytes;
if (read->nbytes < sizeof(*pkt)) {
log_warning("Bulk read buffer too small");
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
}
if (!ezusb2_popn_emu_msg_nodes[ezusb2_popn_emu_msg_read_cur_node]) {
log_warning(
"Bulk read unsupported on cur_node = %d",
ezusb2_popn_emu_msg_read_cur_node);
return E_NOTIMPL;
}
if (!ezusb2_popn_emu_msg_nodes[ezusb2_popn_emu_msg_read_cur_node]
->read_packet(pkt)) {
return E_FAIL;
}
read->pos = sizeof(*pkt);
return S_OK;
}
static HRESULT ezusb2_popn_emu_msg_bulk_write(struct const_iobuf *write)
{
const struct ezusb_iidx_msg_bulk_packet *pkt =
(const struct ezusb_iidx_msg_bulk_packet *) write->bytes;
if (write->nbytes < sizeof(*pkt)) {
log_warning("Bulk write packet too small");
return E_INVALIDARG;
}
if (!ezusb2_popn_emu_msg_nodes[pkt->node]) {
log_warning("Bulk write not supported on pkt->node = %02x", pkt->node);
return E_NOTIMPL;
}
if (!ezusb2_popn_emu_msg_nodes[pkt->node]->write_packet(pkt)) {
return E_FAIL;
}
return S_OK;
}

View File

@@ -0,0 +1,19 @@
#ifndef EZUSB2_POPN_EMU_MSG_H
#define EZUSB2_POPN_EMU_MSG_H
#include <stddef.h>
#include <stdint.h>
#include "hook/iohook.h"
#include "ezusb-emu/msg.h"
/**
* Init the fully emulated pop'n msg backend for a EZUSB FX2 (IO2) board
*
* @return ezusb_emu_msg_hook structure with hook calls for ezusb msg
* dispatching
*/
struct ezusb_emu_msg_hook *ezusb2_popn_emu_msg_init(void);
#endif

View File

@@ -0,0 +1,14 @@
dlls += ezusb2-popn-shim
ldflags_ezusb2-popn-shim := \
-lsetupapi \
libs_ezusb2-popn-shim := \
ezusb2-emu \
hook \
hooklib \
util \
src_ezusb2-popn-shim := \
dllmain.c \
proxy.c \

View File

@@ -0,0 +1,40 @@
#include <windows.h>
#include <stdint.h>
#include <stdbool.h>
#include <setupapi.h>
#include "ezusb2-emu/desc.h"
#include "ezusb2-emu/device.h"
#include "hook/pe.h"
#include "hooklib/setupapi.h"
#include "ezusb2-popn-shim/proxy.h"
#include "util/log.h"
#define EZUSB_REAL_DLL_FILENAME "ezusb.dll"
static DWORD(STDCALL *real_entrypoint)(HMODULE self, DWORD reason, void *ctx);
static HMODULE real_pe = NULL;
BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH && real_pe == NULL)
{
pe_hijack_entrypoint(EZUSB_REAL_DLL_FILENAME, &real_entrypoint);
real_pe = GetModuleHandleA(EZUSB_REAL_DLL_FILENAME);
ezusb2_proxy_initialize(real_pe);
hook_setupapi_init(&ezusb2_emu_desc_device.setupapi);
}
if (real_pe != NULL)
return real_entrypoint(real_pe, reason, ctx);
return true;
}

View File

@@ -0,0 +1,63 @@
LIBRARY ezusb2-popn-shim
EXPORTS
DllMain@12 @1 NONAME
?usbBootSecurity@@YAHPAEHHH@Z=proxy_usb_boot_security
?usbBootSecurityAll@@YAHPAEHHH@Z=proxy_usb_boot_security_all
?usbBootSecurityAllR@@YAHPAEHHH@Z=proxy_usb_boot_security_all_r
?usbCheckAlive@@YAHXZ=proxy_usb_check_alive
?usbCheckSecurity@@YAHPAEHHH@Z=proxy_usb_check_security
?usbCheckSecurityEep@@YAHH@Z=proxy_usb_check_security_eep
?usbCheckSecurityNew@@YAHH@Z=proxy_usb_check_security_new
?usbCoinBlocker@@YAHH@Z=proxy_usb_coin_blocker
?usbCoinGet2@@YAHPAUCoinParam@@@Z=proxy_usb_coin_get2
?usbCoinGet@@YAHH@Z=proxy_usb_coin_get
?usbCoinMeterDown@@YAHH@Z=proxy_usb_coin_meter_down
?usbCoinMeterUp@@YAHH@Z=proxy_usb_coin_meter_up
?usbCoinMode@@YAHH@Z=proxy_usb_coin_mode
?usbCoinUp@@YAHH@Z=proxy_usb_coin_up
?usbEepRead@@YAHXZ=proxy_usb_eep_read
?usbEepReadDone@@YAHPAE@Z=proxy_usb_eep_read_done
?usbEepTest@@YAHXZ=proxy_usb_eep_test
?usbEepWrite@@YAHPAE@Z=proxy_usb_eep_write
?usbEepWriteDone@@YAHXZ=proxy_usb_eep_write_done
?usbEnd@@YAHXZ=proxy_usb_end
?usbFactoryModeInit@@YAHPAE@Z=proxy_usb_factory_mode_init
?usbFirmResult@@YAHXZ=proxy_usb_firm_result
?usbGetError@@YAHPAD@Z=proxy_usb_get_error
?usbGetKEYID@@YAHPAEH@Z=proxy_usb_get_keyid
?usbGetMute@@YAHXZ=proxy_usb_get_mute
?usbGetPCBID@@YAHPAE@Z=proxy_usb_get_pcbid
?usbGetSecurity@@YAHHPAE@Z=proxy_usb_get_security
?usbIsHiSpeed@@YAHXZ=proxy_usb_is_hi_speed
?usbLamp@@YAHH@Z=proxy_usb_lamp
?usbMute@@YAHH@Z=proxy_usb_mute
?usbPadRead@@YAHPAK@Z=proxy_usb_pad_read
?usbPadReadLast@@YAHPAE@Z=proxy_usb_pad_read_last
?usbReadEepHistory@@YAHPAUEEP_HISTORY@@@Z=proxy_usb_read_eep_history
?usbSecurityGetId@@YAHXZ=proxy_usb_security_get_id
?usbSecurityGetIdDone@@YAHPAE@Z=proxy_usb_security_get_id_done
?usbSecurityInit@@YAHXZ=proxy_usb_security_init
?usbSecurityInitDone@@YAHXZ=proxy_usb_security_init_done
?usbSecurityRead@@YAHXZ=proxy_usb_security_read
?usbSecurityReadDone@@YAHPAE@Z=proxy_usb_security_read_done
?usbSecuritySearch@@YAHXZ=proxy_usb_security_search
?usbSecuritySearchDone@@YAHXZ=proxy_usb_security_search_done
?usbSecuritySelect@@YAHH@Z=proxy_usb_security_select
?usbSecuritySelectDone@@YAHXZ=proxy_usb_security_select_done
?usbSecurityTest@@YAHH@Z=proxy_usb_security_test
?usbSecurityWrite@@YAHPAE@Z=proxy_usb_security_write
?usbSecurityWriteDone@@YAHXZ=proxy_usb_security_write_done
?usbSetExtIo@@YAHH@Z=proxy_usb_set_ext_io
?usbSetupEeprom@@YAHPAEHHH@Z=proxy_usb_setup_eeprom
?usbSetupEepromNew@@YAHHPAEHHH@Z=proxy_usb_setup_eeprom_new
?usbSetupSecurity@@YAHPAEHHH@Z=proxy_usb_setup_security
?usbSetupSecurityComplete@@YAHPAEHHH@Z=proxy_usb_setup_security_complete
?usbSetupSecurityCompleteNew@@YAHHPAEHHH@Z=proxy_usb_setup_security_complete_new
?usbSetupSecurityNew@@YAHHPAEHHH@Z=proxy_usb_setup_security_new
?usbStart@@YAHH@Z=proxy_usb_start
?usbStartWithFile@@YAHPAD@Z=proxy_usb_start_with_file
?usbWdtReset@@YAHXZ=proxy_usb_wdt_reset
?usbWdtStart@@YAHH@Z=proxy_usb_wdt_start
?usbWdtStartDone@@YAHXZ=proxy_usb_wdt_start_done
?usbWdtStop@@YAHXZ=proxy_usb_wdt_stop

View File

@@ -0,0 +1,612 @@
#include <windows.h>
#include <stdint.h>
#include <stdbool.h>
#include "util/log.h"
struct CoinParam;
struct EEP_HISTORY;
typedef int32_t (*usb_boot_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_boot_security_all_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_boot_security_all_r_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_check_alive_t)();
typedef int32_t (*usb_check_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_check_security_eep_t)(int32_t param1);
typedef int32_t (*usb_check_security_new_t)(int32_t param1);
typedef int32_t (*usb_coin_blocker_t)(int32_t param1);
typedef int32_t (*usb_coin_get2_t)(struct CoinParam *param1);
typedef int32_t (*usb_coin_get_t)(int32_t param1);
typedef int32_t (*usb_coin_meter_down_t)(int32_t param1);
typedef int32_t (*usb_coin_meter_up_t)(int32_t param1);
typedef int32_t (*usb_coin_mode_t)(int32_t param1);
typedef int32_t (*usb_coin_up_t)(int32_t param1);
typedef int32_t (*usb_eep_read_t)();
typedef int32_t (*usb_eep_read_done_t)(uint8_t *param1);
typedef int32_t (*usb_eep_test_t)();
typedef int32_t (*usb_eep_write_t)(uint8_t *param1);
typedef int32_t (*usb_eep_write_done_t)();
typedef int32_t (*usb_end_t)();
typedef int32_t (*usb_factory_mode_init_t)(uint8_t *param1);
typedef int32_t (*usb_firm_result_t)();
typedef int32_t (*usb_get_error_t)(char *param1);
typedef int32_t (*usb_get_keyid_t)(uint8_t *param1, int32_t param2);
typedef int32_t (*usb_get_mute_t)();
typedef int32_t (*usb_get_pcbid_t)(uint8_t *param1);
typedef int32_t (*usb_get_security_t)(int32_t param1, uint8_t *param2);
typedef int32_t (*usb_is_hi_speed_t)();
typedef int32_t (*usb_lamp_t)(int32_t param1);
typedef int32_t (*usb_mute_t)(int32_t param1);
typedef int32_t (*usb_pad_read_t)(uint32_t *param1);
typedef int32_t (*usb_pad_read_last_t)(uint8_t *param1);
typedef int32_t (*usb_read_eep_history_t)(struct EEP_HISTORY *param1);
typedef int32_t (*usb_security_get_id_t)();
typedef int32_t (*usb_security_get_id_done_t)(uint8_t *param1);
typedef int32_t (*usb_security_init_t)();
typedef int32_t (*usb_security_init_done_t)();
typedef int32_t (*usb_security_read_t)();
typedef int32_t (*usb_security_read_done_t)(uint8_t *param1);
typedef int32_t (*usb_security_search_t)();
typedef int32_t (*usb_security_search_done_t)();
typedef int32_t (*usb_security_select_t)(int32_t param1);
typedef int32_t (*usb_security_select_done_t)();
typedef int32_t (*usb_security_test_t)(int32_t param1);
typedef int32_t (*usb_security_write_t)(uint8_t *param1);
typedef int32_t (*usb_security_write_done_t)();
typedef int32_t (*usb_set_ext_io_t)(int32_t param1);
typedef int32_t (*usb_setup_eeprom_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_setup_eeprom_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
typedef int32_t (*usb_setup_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_setup_security_complete_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
typedef int32_t (*usb_setup_security_complete_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
typedef int32_t (*usb_setup_security_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
typedef int32_t (*usb_start_t)(int32_t param1);
typedef int32_t (*usb_start_with_file_t)(char *param1);
typedef int32_t (*usb_wdt_reset_t)();
typedef int32_t (*usb_wdt_start_t)(int32_t param1);
typedef int32_t (*usb_wdt_start_done_t)();
typedef int32_t (*usb_wdt_stop_t)();
static usb_boot_security_t real_usb_boot_security;
static usb_boot_security_all_t real_usb_boot_security_all;
static usb_boot_security_all_r_t real_usb_boot_security_all_r;
static usb_check_alive_t real_usb_check_alive;
static usb_check_security_t real_usb_check_security;
static usb_check_security_eep_t real_usb_check_security_eep;
static usb_check_security_new_t real_usb_check_security_new;
static usb_coin_blocker_t real_usb_coin_blocker;
static usb_coin_get2_t real_usb_coin_get2;
static usb_coin_get_t real_usb_coin_get;
static usb_coin_meter_down_t real_usb_coin_meter_down;
static usb_coin_meter_up_t real_usb_coin_meter_up;
static usb_coin_mode_t real_usb_coin_mode;
static usb_coin_up_t real_usb_coin_up;
static usb_eep_read_t real_usb_eep_read;
static usb_eep_read_done_t real_usb_eep_read_done;
static usb_eep_test_t real_usb_eep_test;
static usb_eep_write_t real_usb_eep_write;
static usb_eep_write_done_t real_usb_eep_write_done;
static usb_end_t real_usb_end;
static usb_factory_mode_init_t real_usb_factory_mode_init;
static usb_firm_result_t real_usb_firm_result;
static usb_get_error_t real_usb_get_error;
static usb_get_keyid_t real_usb_get_keyid;
static usb_get_mute_t real_usb_get_mute;
static usb_get_pcbid_t real_usb_get_pcbid;
static usb_get_security_t real_usb_get_security;
static usb_is_hi_speed_t real_usb_is_hi_speed;
static usb_lamp_t real_usb_lamp;
static usb_mute_t real_usb_mute;
static usb_pad_read_t real_usb_pad_read;
static usb_pad_read_last_t real_usb_pad_read_last;
static usb_read_eep_history_t real_usb_read_eep_history;
static usb_security_get_id_t real_usb_security_get_id;
static usb_security_get_id_done_t real_usb_security_get_id_done;
static usb_security_init_t real_usb_security_init;
static usb_security_init_done_t real_usb_security_init_done;
static usb_security_read_t real_usb_security_read;
static usb_security_read_done_t real_usb_security_read_done;
static usb_security_search_t real_usb_security_search;
static usb_security_search_done_t real_usb_security_search_done;
static usb_security_select_t real_usb_security_select;
static usb_security_select_done_t real_usb_security_select_done;
static usb_security_test_t real_usb_security_test;
static usb_security_write_t real_usb_security_write;
static usb_security_write_done_t real_usb_security_write_done;
static usb_set_ext_io_t real_usb_set_ext_io;
static usb_setup_eeprom_t real_usb_setup_eeprom;
static usb_setup_eeprom_new_t real_usb_setup_eeprom_new;
static usb_setup_security_t real_usb_setup_security;
static usb_setup_security_complete_t real_usb_setup_security_complete;
static usb_setup_security_complete_new_t real_usb_setup_security_complete_new;
static usb_setup_security_new_t real_usb_setup_security_new;
static usb_start_t real_usb_start;
static usb_start_with_file_t real_usb_start_with_file;
static usb_wdt_reset_t real_usb_wdt_reset;
static usb_wdt_start_t real_usb_wdt_start;
static usb_wdt_start_done_t real_usb_wdt_start_done;
static usb_wdt_stop_t real_usb_wdt_stop;
static bool proxy_is_initialized = false;
void ezusb2_proxy_initialize(HMODULE pe)
{
if (proxy_is_initialized)
return;
log_assert(pe != NULL);
proxy_is_initialized = true;
real_usb_boot_security = (usb_boot_security_t)GetProcAddress(pe, "?usbBootSecurity@@YAHPAEHHH@Z");
log_assert(real_usb_boot_security);
real_usb_boot_security_all = (usb_boot_security_all_t)GetProcAddress(pe, "?usbBootSecurityAll@@YAHPAEHHH@Z");
log_assert(real_usb_boot_security_all);
real_usb_boot_security_all_r = (usb_boot_security_all_r_t)GetProcAddress(pe, "?usbBootSecurityAllR@@YAHPAEHHH@Z");
log_assert(real_usb_boot_security_all_r);
real_usb_check_alive = (usb_check_alive_t)GetProcAddress(pe, "?usbCheckAlive@@YAHXZ");
log_assert(real_usb_check_alive);
real_usb_check_security = (usb_check_security_t)GetProcAddress(pe, "?usbCheckSecurity@@YAHPAEHHH@Z");
log_assert(real_usb_check_security);
real_usb_check_security_eep = (usb_check_security_eep_t)GetProcAddress(pe, "?usbCheckSecurityEep@@YAHH@Z");
log_assert(real_usb_check_security_eep);
real_usb_check_security_new = (usb_check_security_new_t)GetProcAddress(pe, "?usbCheckSecurityNew@@YAHH@Z");
log_assert(real_usb_check_security_new);
real_usb_coin_blocker = (usb_coin_blocker_t)GetProcAddress(pe, "?usbCoinBlocker@@YAHH@Z");
log_assert(real_usb_coin_blocker);
real_usb_coin_get2 = (usb_coin_get2_t)GetProcAddress(pe, "?usbCoinGet2@@YAHPAUCoinParam@@@Z");
log_assert(real_usb_coin_get2);
real_usb_coin_get = (usb_coin_get_t)GetProcAddress(pe, "?usbCoinGet@@YAHH@Z");
log_assert(real_usb_coin_get);
real_usb_coin_meter_down = (usb_coin_meter_down_t)GetProcAddress(pe, "?usbCoinMeterDown@@YAHH@Z");
log_assert(real_usb_coin_meter_down);
real_usb_coin_meter_up = (usb_coin_meter_up_t)GetProcAddress(pe, "?usbCoinMeterUp@@YAHH@Z");
log_assert(real_usb_coin_meter_up);
real_usb_coin_mode = (usb_coin_mode_t)GetProcAddress(pe, "?usbCoinMode@@YAHH@Z");
log_assert(real_usb_coin_mode);
real_usb_coin_up = (usb_coin_up_t)GetProcAddress(pe, "?usbCoinUp@@YAHH@Z");
log_assert(real_usb_coin_up);
real_usb_eep_read = (usb_eep_read_t)GetProcAddress(pe, "?usbEepRead@@YAHXZ");
log_assert(real_usb_eep_read);
real_usb_eep_read_done = (usb_eep_read_done_t)GetProcAddress(pe, "?usbEepReadDone@@YAHPAE@Z");
log_assert(real_usb_eep_read_done);
real_usb_eep_test = (usb_eep_test_t)GetProcAddress(pe, "?usbEepTest@@YAHXZ");
log_assert(real_usb_eep_test);
real_usb_eep_write = (usb_eep_write_t)GetProcAddress(pe, "?usbEepWrite@@YAHPAE@Z");
log_assert(real_usb_eep_write);
real_usb_eep_write_done = (usb_eep_write_done_t)GetProcAddress(pe, "?usbEepWriteDone@@YAHXZ");
log_assert(real_usb_eep_write_done);
real_usb_end = (usb_end_t)GetProcAddress(pe, "?usbEnd@@YAHXZ");
log_assert(real_usb_end);
real_usb_factory_mode_init = (usb_factory_mode_init_t)GetProcAddress(pe, "?usbFactoryModeInit@@YAHPAE@Z");
log_assert(real_usb_factory_mode_init);
real_usb_firm_result = (usb_firm_result_t)GetProcAddress(pe, "?usbFirmResult@@YAHXZ");
log_assert(real_usb_firm_result);
real_usb_get_error = (usb_get_error_t)GetProcAddress(pe, "?usbGetError@@YAHPAD@Z");
log_assert(real_usb_get_error);
real_usb_get_keyid = (usb_get_keyid_t)GetProcAddress(pe, "?usbGetKEYID@@YAHPAEH@Z");
log_assert(real_usb_get_keyid);
real_usb_get_mute = (usb_get_mute_t)GetProcAddress(pe, "?usbGetMute@@YAHXZ");
log_assert(real_usb_get_mute);
real_usb_get_pcbid = (usb_get_pcbid_t)GetProcAddress(pe, "?usbGetPCBID@@YAHPAE@Z");
log_assert(real_usb_get_pcbid);
real_usb_get_security = (usb_get_security_t)GetProcAddress(pe, "?usbGetSecurity@@YAHHPAE@Z");
log_assert(real_usb_get_security);
real_usb_is_hi_speed = (usb_is_hi_speed_t)GetProcAddress(pe, "?usbIsHiSpeed@@YAHXZ");
log_assert(real_usb_is_hi_speed);
real_usb_lamp = (usb_lamp_t)GetProcAddress(pe, "?usbLamp@@YAHH@Z");
log_assert(real_usb_lamp);
real_usb_mute = (usb_mute_t)GetProcAddress(pe, "?usbMute@@YAHH@Z");
log_assert(real_usb_mute);
real_usb_pad_read = (usb_pad_read_t)GetProcAddress(pe, "?usbPadRead@@YAHPAK@Z");
log_assert(real_usb_pad_read);
real_usb_pad_read_last = (usb_pad_read_last_t)GetProcAddress(pe, "?usbPadReadLast@@YAHPAE@Z");
log_assert(real_usb_pad_read_last);
real_usb_read_eep_history = (usb_read_eep_history_t)GetProcAddress(pe, "?usbReadEepHistory@@YAHPAUEEP_HISTORY@@@Z");
log_assert(real_usb_read_eep_history);
real_usb_security_get_id = (usb_security_get_id_t)GetProcAddress(pe, "?usbSecurityGetId@@YAHXZ");
log_assert(real_usb_security_get_id);
real_usb_security_get_id_done = (usb_security_get_id_done_t)GetProcAddress(pe, "?usbSecurityGetIdDone@@YAHPAE@Z");
log_assert(real_usb_security_get_id_done);
real_usb_security_init = (usb_security_init_t)GetProcAddress(pe, "?usbSecurityInit@@YAHXZ");
log_assert(real_usb_security_init);
real_usb_security_init_done = (usb_security_init_done_t)GetProcAddress(pe, "?usbSecurityInitDone@@YAHXZ");
log_assert(real_usb_security_init_done);
real_usb_security_read = (usb_security_read_t)GetProcAddress(pe, "?usbSecurityRead@@YAHXZ");
log_assert(real_usb_security_read);
real_usb_security_read_done = (usb_security_read_done_t)GetProcAddress(pe, "?usbSecurityReadDone@@YAHPAE@Z");
log_assert(real_usb_security_read_done);
real_usb_security_search = (usb_security_search_t)GetProcAddress(pe, "?usbSecuritySearch@@YAHXZ");
log_assert(real_usb_security_search);
real_usb_security_search_done = (usb_security_search_done_t)GetProcAddress(pe, "?usbSecuritySearchDone@@YAHXZ");
log_assert(real_usb_security_search_done);
real_usb_security_select = (usb_security_select_t)GetProcAddress(pe, "?usbSecuritySelect@@YAHH@Z");
log_assert(real_usb_security_select);
real_usb_security_select_done = (usb_security_select_done_t)GetProcAddress(pe, "?usbSecuritySelectDone@@YAHXZ");
log_assert(real_usb_security_select_done);
real_usb_security_test = (usb_security_test_t)GetProcAddress(pe, "?usbSecurityTest@@YAHH@Z");
log_assert(real_usb_security_test);
real_usb_security_write = (usb_security_write_t)GetProcAddress(pe, "?usbSecurityWrite@@YAHPAE@Z");
log_assert(real_usb_security_write);
real_usb_security_write_done = (usb_security_write_done_t)GetProcAddress(pe, "?usbSecurityWriteDone@@YAHXZ");
log_assert(real_usb_security_write_done);
real_usb_set_ext_io = (usb_set_ext_io_t)GetProcAddress(pe, "?usbSetExtIo@@YAHH@Z");
log_assert(real_usb_set_ext_io);
real_usb_setup_eeprom = (usb_setup_eeprom_t)GetProcAddress(pe, "?usbSetupEeprom@@YAHPAEHHH@Z");
log_assert(real_usb_setup_eeprom);
real_usb_setup_eeprom_new = (usb_setup_eeprom_new_t)GetProcAddress(pe, "?usbSetupEepromNew@@YAHHPAEHHH@Z");
log_assert(real_usb_setup_eeprom_new);
real_usb_setup_security = (usb_setup_security_t)GetProcAddress(pe, "?usbSetupSecurity@@YAHPAEHHH@Z");
log_assert(real_usb_setup_security);
real_usb_setup_security_complete = (usb_setup_security_complete_t)GetProcAddress(pe, "?usbSetupSecurityComplete@@YAHPAEHHH@Z");
log_assert(real_usb_setup_security_complete);
real_usb_setup_security_complete_new = (usb_setup_security_complete_new_t)GetProcAddress(pe, "?usbSetupSecurityCompleteNew@@YAHHPAEHHH@Z");
log_assert(real_usb_setup_security_complete_new);
real_usb_setup_security_new = (usb_setup_security_new_t)GetProcAddress(pe, "?usbSetupSecurityNew@@YAHHPAEHHH@Z");
log_assert(real_usb_setup_security_new);
real_usb_start = (usb_start_t)GetProcAddress(pe, "?usbStart@@YAHH@Z");
log_assert(real_usb_start);
real_usb_start_with_file = (usb_start_with_file_t)GetProcAddress(pe, "?usbStartWithFile@@YAHPAD@Z");
log_assert(real_usb_start_with_file);
real_usb_wdt_reset = (usb_wdt_reset_t)GetProcAddress(pe, "?usbWdtReset@@YAHXZ");
log_assert(real_usb_wdt_reset);
real_usb_wdt_start = (usb_wdt_start_t)GetProcAddress(pe, "?usbWdtStart@@YAHH@Z");
log_assert(real_usb_wdt_start);
real_usb_wdt_start_done = (usb_wdt_start_done_t)GetProcAddress(pe, "?usbWdtStartDone@@YAHXZ");
log_assert(real_usb_wdt_start_done);
real_usb_wdt_stop = (usb_wdt_stop_t)GetProcAddress(pe, "?usbWdtStop@@YAHXZ");
log_assert(real_usb_wdt_stop);
}
int32_t proxy_usb_boot_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_boot_security(param1, param2, param3, param4);
}
int32_t proxy_usb_boot_security_all(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_boot_security_all(param1, param2, param3, param4);
}
int32_t proxy_usb_boot_security_all_r(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_boot_security_all_r(param1, param2, param3, param4);
}
int32_t proxy_usb_check_alive()
{
return real_usb_check_alive();
}
int32_t proxy_usb_check_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_check_security(param1, param2, param3, param4);
}
int32_t proxy_usb_check_security_eep(int32_t param1)
{
return real_usb_check_security_eep(param1);
}
int32_t proxy_usb_check_security_new(int32_t param1)
{
return real_usb_check_security_new(param1);
}
int32_t proxy_usb_coin_blocker(int32_t param1)
{
return real_usb_coin_blocker(param1);
}
int32_t proxy_usb_coin_get2(struct CoinParam *param1)
{
return real_usb_coin_get2(param1);
}
int32_t proxy_usb_coin_get(int32_t param1)
{
return real_usb_coin_get(param1);
}
int32_t proxy_usb_coin_meter_down(int32_t param1)
{
return real_usb_coin_meter_down(param1);
}
int32_t proxy_usb_coin_meter_up(int32_t param1)
{
return real_usb_coin_meter_up(param1);
}
int32_t proxy_usb_coin_mode(int32_t param1)
{
return real_usb_coin_mode(param1);
}
int32_t proxy_usb_coin_up(int32_t param1)
{
return real_usb_coin_up(param1);
}
int32_t proxy_usb_eep_read()
{
return real_usb_eep_read();
}
int32_t proxy_usb_eep_read_done(uint8_t *param1)
{
return real_usb_eep_read_done(param1);
}
int32_t proxy_usb_eep_test()
{
return real_usb_eep_test();
}
int32_t proxy_usb_eep_write(uint8_t *param1)
{
return real_usb_eep_write(param1);
}
int32_t proxy_usb_eep_write_done()
{
return real_usb_eep_write_done();
}
int32_t proxy_usb_end()
{
return real_usb_end();
}
int32_t proxy_usb_factory_mode_init(uint8_t *param1)
{
return real_usb_factory_mode_init(param1);
}
int32_t proxy_usb_firm_result()
{
return real_usb_firm_result();
}
int32_t proxy_usb_get_error(char *param1)
{
return real_usb_get_error(param1);
}
int32_t proxy_usb_get_keyid(uint8_t *param1, int32_t param2)
{
return real_usb_get_keyid(param1, param2);
}
int32_t proxy_usb_get_mute()
{
return real_usb_get_mute();
}
int32_t proxy_usb_get_pcbid(uint8_t *param1)
{
return real_usb_get_pcbid(param1);
}
int32_t proxy_usb_get_security(int32_t param1, uint8_t *param2)
{
return real_usb_get_security(param1, param2);
}
int32_t proxy_usb_is_hi_speed()
{
return real_usb_is_hi_speed();
}
int32_t proxy_usb_lamp(int32_t param1)
{
return real_usb_lamp(param1);
}
int32_t proxy_usb_mute(int32_t param1)
{
return real_usb_mute(param1);
}
int32_t proxy_usb_pad_read(uint32_t *param1)
{
return real_usb_pad_read(param1);
}
int32_t proxy_usb_pad_read_last(uint8_t *param1)
{
return real_usb_pad_read_last(param1);
}
int32_t proxy_usb_read_eep_history(struct EEP_HISTORY *param1)
{
return real_usb_read_eep_history(param1);
}
int32_t proxy_usb_security_get_id()
{
return real_usb_security_get_id();
}
int32_t proxy_usb_security_get_id_done(uint8_t *param1)
{
return real_usb_security_get_id_done(param1);
}
int32_t proxy_usb_security_init()
{
return real_usb_security_init();
}
int32_t proxy_usb_security_init_done()
{
return real_usb_security_init_done();
}
int32_t proxy_usb_security_read()
{
return real_usb_security_read();
}
int32_t proxy_usb_security_read_done(uint8_t *param1)
{
return real_usb_security_read_done(param1);
}
int32_t proxy_usb_security_search()
{
return real_usb_security_search();
}
int32_t proxy_usb_security_search_done()
{
return real_usb_security_search_done();
}
int32_t proxy_usb_security_select(int32_t param1)
{
return real_usb_security_select(param1);
}
int32_t proxy_usb_security_select_done()
{
return real_usb_security_select_done();
}
int32_t proxy_usb_security_test(int32_t param1)
{
return real_usb_security_test(param1);
}
int32_t proxy_usb_security_write(uint8_t *param1)
{
return real_usb_security_write(param1);
}
int32_t proxy_usb_security_write_done()
{
return real_usb_security_write_done();
}
int32_t proxy_usb_set_ext_io(int32_t param1)
{
return real_usb_set_ext_io(param1);
}
int32_t proxy_usb_setup_eeprom(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_setup_eeprom(param1, param2, param3, param4);
}
int32_t proxy_usb_setup_eeprom_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
{
return real_usb_setup_eeprom_new(param1, param2, param3, param4, param5);
}
int32_t proxy_usb_setup_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_setup_security(param1, param2, param3, param4);
}
int32_t proxy_usb_setup_security_complete(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
{
return real_usb_setup_security_complete(param1, param2, param3, param4);
}
int32_t proxy_usb_setup_security_complete_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
{
return real_usb_setup_security_complete_new(param1, param2, param3, param4, param5);
}
int32_t proxy_usb_setup_security_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
{
return real_usb_setup_security_new(param1, param2, param3, param4, param5);
}
int32_t proxy_usb_start(int32_t param1)
{
return real_usb_start(param1);
}
int32_t proxy_usb_start_with_file(char *param1)
{
return real_usb_start_with_file(param1);
}
int32_t proxy_usb_wdt_reset()
{
return real_usb_wdt_reset();
}
int32_t proxy_usb_wdt_start(int32_t param1)
{
return real_usb_wdt_start(param1);
}
int32_t proxy_usb_wdt_start_done()
{
return real_usb_wdt_start_done();
}
int32_t proxy_usb_wdt_stop()
{
return real_usb_wdt_stop();
}

View File

@@ -0,0 +1,6 @@
#ifndef EZUSB2_POPN_SHIM_PROXY_H
#define EZUSB2_POPN_SHIM_PROXY_H
void ezusb2_proxy_initialize(HMODULE pe);
#endif

View File

@@ -0,0 +1,87 @@
#ifndef EZUSB2_POPN_MSG_H
#define EZUSB2_POPN_MSG_H
#include <stddef.h>
#include <stdint.h>
#pragma pack(push, 1)
struct ezusb2_popn_msg_interrupt_write_packet {
uint8_t unk0;
uint8_t unk1;
uint8_t node;
uint8_t cmd;
uint8_t cmd_detail[2];
uint8_t unknown[2];
uint32_t lamp;
/* Pad to 64 byte total size because the endpoint expects this buffer size.
Requests are hanging on ioctl calls otherwise. */
uint8_t unknown2[52];
};
#pragma pack(pop)
#pragma pack(push, 1)
struct ezusb2_popn_msg_interrupt_read_packet {
/*
Pad mappings:
0: unknown/not used
1: unknown/not used
2: unknown/not used
3: unknown/not used
4: unknown/not used
5: unknown/not used
6: service
7: test
8: button 1
9: button 2
10: button 3
11: button 4
12: button 5
13: button 6
14: button 7
15: button 8
16: button 9
17: unknown/not used
18: unknown/not used
19: unknown/not used
20: unknown/not used
21: unknown/not used
22: coin
23: unknown/not used
24: dipsw 1
25: dipsw 2
26: dipsw 3
27: dipsw 4
28: unknown/not used
29: unknown/not used
30: unknown/not used
31: unknown/not used
*/
uint8_t unk0; /* 0x03 */
uint8_t unk1; /* 0x1d */
uint8_t unk2; /* 0x85 */
uint8_t seq_no;
uint8_t status;
uint8_t unk3; /* 0x00 */
uint8_t coin_count;
uint8_t unk4; /* 0xfd */
union {
uint32_t inverted_pad;
struct {
uint8_t sys; /* test/service bitfield */
uint16_t button; /* button bitfield */
uint8_t dipsw; /* dip switches */
};
} io;
uint8_t unk5; /* 0x00 */
uint8_t unk6; /* 0x7d */
uint8_t unk7; /* 0xdf */
uint8_t unk8; /* seq no 2? */
uint16_t button_history[10];
uint8_t padding[28];
};
#pragma pack(pop)
#endif

View File

@@ -75,6 +75,12 @@ static HRESULT(STDCALL *real_Reset)(
IDirect3DDevice9 *self, IDirect3DDevice9 *self,
D3DPRESENT_PARAMETERS *pp); D3DPRESENT_PARAMETERS *pp);
static HRESULT (STDCALL *real_SetViewport)(
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
static HRESULT (STDCALL *real_SetVertexShader)(
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */
@@ -144,6 +150,12 @@ static HRESULT STDCALL my_Reset(
IDirect3DDevice9 *self, IDirect3DDevice9 *self,
D3DPRESENT_PARAMETERS *pp); D3DPRESENT_PARAMETERS *pp);
static HRESULT STDCALL my_SetViewport(
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
static HRESULT STDCALL my_SetVertexShader(
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */
@@ -205,6 +217,12 @@ hook_d3d9_irp_handler_real_dev_draw_primitive_up(struct hook_d3d9_irp *irp);
static HRESULT static HRESULT
hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp); hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp);
static HRESULT
hook_d3d9_irp_handler_real_dev_set_viewport(struct hook_d3d9_irp *irp);
static HRESULT
hook_d3d9_irp_handler_real_dev_set_vertex_shader(struct hook_d3d9_irp *irp);
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */
@@ -231,6 +249,10 @@ static const hook_d3d9_irp_handler_t hook_d3d9_irp_real_handlers[] = {
hook_d3d9_irp_handler_real_dev_draw_primitive_up, hook_d3d9_irp_handler_real_dev_draw_primitive_up,
[HOOK_D3D9_IRP_OP_DEV_RESET] = [HOOK_D3D9_IRP_OP_DEV_RESET] =
hook_d3d9_irp_handler_real_dev_reset, hook_d3d9_irp_handler_real_dev_reset,
[HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT] =
hook_d3d9_irp_handler_real_dev_set_viewport,
[HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER] =
hook_d3d9_irp_handler_real_dev_set_vertex_shader,
}; };
static const hook_d3d9_irp_handler_t *hook_d3d9_handlers; static const hook_d3d9_irp_handler_t *hook_d3d9_handlers;
@@ -501,6 +523,40 @@ static HRESULT STDCALL my_DrawPrimitiveUP(
return hr; return hr;
} }
static HRESULT STDCALL my_SetViewport(
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport)
{
struct hook_d3d9_irp irp;
HRESULT hr;
memset(&irp, 0, sizeof(irp));
irp.op = HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT;
irp.args.dev_set_viewport.self = self;
irp.args.dev_set_viewport.pViewport = pViewport;
hr = hook_d3d9_irp_invoke_next(&irp);
return hr;
}
static HRESULT STDCALL my_SetVertexShader(
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader)
{
struct hook_d3d9_irp irp;
HRESULT hr;
memset(&irp, 0, sizeof(irp));
irp.op = HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER;
irp.args.dev_set_vertex_shader.self = self;
irp.args.dev_set_vertex_shader.pShader = pShader;
hr = hook_d3d9_irp_invoke_next(&irp);
return hr;
}
static HRESULT STDCALL my_Reset( static HRESULT STDCALL my_Reset(
IDirect3DDevice9 *self, IDirect3DDevice9 *self,
D3DPRESENT_PARAMETERS *pp) D3DPRESENT_PARAMETERS *pp)
@@ -691,6 +747,12 @@ hook_d3d9_irp_handler_real_dev_create_device(struct hook_d3d9_irp *irp)
real_Reset = api_vtbl->Reset; real_Reset = api_vtbl->Reset;
api_vtbl->Reset = my_Reset; api_vtbl->Reset = my_Reset;
real_SetViewport = api_vtbl->SetViewport;
api_vtbl->SetViewport = my_SetViewport;
real_SetVertexShader = api_vtbl->SetVertexShader;
api_vtbl->SetVertexShader = my_SetVertexShader;
*irp->args.ctx_create_device.pdev = (IDirect3DDevice9 *) api_proxy; *irp->args.ctx_create_device.pdev = (IDirect3DDevice9 *) api_proxy;
return hr; return hr;
@@ -775,6 +837,26 @@ hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp)
irp->args.dev_reset.pp); irp->args.dev_reset.pp);
} }
static HRESULT
hook_d3d9_irp_handler_real_dev_set_viewport(struct hook_d3d9_irp *irp)
{
log_assert(irp);
return real_SetViewport(
irp->args.dev_set_viewport.self,
irp->args.dev_set_viewport.pViewport);
}
static HRESULT
hook_d3d9_irp_handler_real_dev_set_vertex_shader(struct hook_d3d9_irp *irp)
{
log_assert(irp);
return real_SetVertexShader(
irp->args.dev_set_vertex_shader.self,
irp->args.dev_set_vertex_shader.pShader);
}
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */

View File

@@ -34,6 +34,8 @@ enum hook_d3d9_irp_op {
HOOK_D3D9_IRP_OP_DEV_SET_RENDER_STATE = 10, HOOK_D3D9_IRP_OP_DEV_SET_RENDER_STATE = 10,
HOOK_D3D9_IRP_OP_DEV_DRAW_PRIMITIVE_UP = 11, HOOK_D3D9_IRP_OP_DEV_DRAW_PRIMITIVE_UP = 11,
HOOK_D3D9_IRP_OP_DEV_RESET = 12, HOOK_D3D9_IRP_OP_DEV_RESET = 12,
HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT = 13,
HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER = 14,
}; };
/** /**
@@ -170,6 +172,22 @@ struct hook_d3d9_irp {
IDirect3DDevice9 *self; IDirect3DDevice9 *self;
D3DPRESENT_PARAMETERS *pp; D3DPRESENT_PARAMETERS *pp;
} dev_reset; } dev_reset;
/**
* Params of IDIrect3DDevice9_SetViewport
*/
struct {
IDirect3DDevice9 *self;
const D3DVIEWPORT9 *pViewport;
} dev_set_viewport;
/**
* Params of IDIrect3DDevice9_SetVertexShader
*/
struct {
IDirect3DDevice9 *self;
IDirect3DVertexShader9 *pShader;
} dev_set_vertex_shader;
} args; } args;
size_t next_handler; size_t next_handler;

View File

@@ -220,3 +220,96 @@ HRESULT pe_patch(void *dest, const void *src, size_t nbytes)
return S_OK; return S_OK;
} }
const pe_thunk_t *pe_thunk_get_first(HMODULE pe, const pe_iid_t *iid)
{
pe_thunk_t *thunk;
assert(pe != NULL);
assert(iid != NULL);
thunk = pe_offset(pe, iid->FirstThunk);
if (thunk == NULL || thunk->u1.AddressOfData == 0) {
return NULL;
}
return thunk;
}
const pe_thunk_t *pe_thunk_get_next(const pe_thunk_t *thunk)
{
const IMAGE_THUNK_DATA *thunk_next;
assert(thunk != NULL);
thunk_next = thunk + 1;
if (thunk_next == NULL || thunk_next->u1.AddressOfData == 0) {
return NULL;
}
return thunk_next;
}
void *pe_thunk_get_resolved_function(HMODULE target_pe, HMODULE import_pe, const pe_thunk_t *thunk)
{
void *addr;
assert(target_pe != NULL);
assert(import_pe != NULL);
assert(thunk != NULL);
if (thunk->u1.AddressOfData != 0) {
if (IMAGE_SNAP_BY_ORDINAL(thunk->u1.Ordinal)) {
LPCSTR functionOrdinal = (LPCSTR)IMAGE_ORDINAL(thunk->u1.Ordinal);
addr = (void *)GetProcAddress(import_pe, functionOrdinal);
} else {
PIMAGE_IMPORT_BY_NAME functionName = pe_offset(target_pe, thunk->u1.AddressOfData);
addr = (void *)GetProcAddress(import_pe, functionName->Name);
}
} else {
addr = NULL;
}
return addr;
}
void pe_resolve_imports(HMODULE target_pe)
{
for (const pe_iid_t *iid = pe_iid_get_first(target_pe); iid != NULL; iid = pe_iid_get_next(target_pe, iid)) {
const char *iid_name;
HMODULE imported_pe;
iid_name = pe_iid_get_name(target_pe, iid);
imported_pe = LoadLibraryA(iid_name);
assert(imported_pe != NULL);
for (const pe_thunk_t *thunk = pe_thunk_get_first(target_pe, iid); thunk != NULL; thunk = pe_thunk_get_next(thunk)) {
void *addr;
addr = pe_thunk_get_resolved_function(target_pe, imported_pe, thunk);
if (addr != NULL) {
pe_patch((void*)&thunk->u1.Function, &addr, sizeof(PDWORD));
}
}
}
}
HRESULT pe_hijack_entrypoint(const char *filename, dll_entry_t *orig_entry)
{
HMODULE pe;
pe = LoadLibraryExA(filename, NULL, DONT_RESOLVE_DLL_REFERENCES);
if (!pe) {
return HRESULT_FROM_WIN32(GetLastError());
}
pe_resolve_imports(pe);
*orig_entry = pe_get_entry_point(pe);
return S_OK;
}

View File

@@ -7,6 +7,9 @@
#include <stdint.h> #include <stdint.h>
typedef IMAGE_IMPORT_DESCRIPTOR pe_iid_t; typedef IMAGE_IMPORT_DESCRIPTOR pe_iid_t;
typedef IMAGE_THUNK_DATA pe_thunk_t;
typedef DWORD (CALLBACK *dll_entry_t)(HMODULE self, DWORD reason, void *ctx);
struct pe_iat_entry { struct pe_iat_entry {
const char *name; const char *name;
@@ -25,3 +28,6 @@ HRESULT pe_iid_get_iat_entry(
void *pe_get_export(HMODULE pe, const char *name, uint16_t ord); void *pe_get_export(HMODULE pe, const char *name, uint16_t ord);
void *pe_get_entry_point(HMODULE pe); void *pe_get_entry_point(HMODULE pe);
HRESULT pe_patch(void *dest, const void *src, size_t nbytes); HRESULT pe_patch(void *dest, const void *src, size_t nbytes);
HRESULT pe_hijack_entrypoint(const char *filename, dll_entry_t *orig_entry);
void pe_resolve_imports(HMODULE target_pe);

View File

@@ -22,6 +22,7 @@
"gfx.scale_back_buffer_filter" "gfx.scale_back_buffer_filter"
#define IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY "gfx.forced_refresh_rate" #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_DEVICE_ADAPTER_KEY "gfx.device_adapter"
#define IIDXHOOK_CONFIG_GFX_DIAGONAL_TEARING_FIX_KEY "gfx.diagonal_tearing_fix"
#define IIDXHOOK_CONFIG_GFX_DEFAULT_BGVIDEO_UV_FIX_VALUE false #define IIDXHOOK_CONFIG_GFX_DEFAULT_BGVIDEO_UV_FIX_VALUE false
#define IIDXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false #define IIDXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
@@ -36,6 +37,7 @@
#define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_FILTER_VALUE "none" #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_FORCED_RR_VALUE -1
#define IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1 #define IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
#define IIDXHOOK_CONFIG_GFX_DEFAULT_DIAGONAL_TEARING_FIX_VALUE false
void iidxhook_config_gfx_init(struct cconfig *config) void iidxhook_config_gfx_init(struct cconfig *config)
{ {
@@ -159,6 +161,13 @@ void iidxhook_config_gfx_init(struct cconfig *config)
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE, IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
"D3D9 device adapter (monitor), -1 to use default, " "D3D9 device adapter (monitor), -1 to use default, "
"0, 1, 2 etc. to use specified adapter"); "0, 1, 2 etc. to use specified adapter");
cconfig_util_set_bool(
config,
IIDXHOOK_CONFIG_GFX_DIAGONAL_TEARING_FIX_KEY,
IIDXHOOK_CONFIG_GFX_DEFAULT_DIAGONAL_TEARING_FIX_VALUE,
"Fix diagonal tearing with video cards "
"other than Radeon X1300 and HD3450");
} }
void iidxhook_config_gfx_get( void iidxhook_config_gfx_get(
@@ -367,4 +376,16 @@ void iidxhook_config_gfx_get(
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY, IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE); IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
} }
if (!cconfig_util_get_bool(
config,
IIDXHOOK_CONFIG_GFX_DIAGONAL_TEARING_FIX_KEY,
&config_gfx->diagonal_tearing_fix,
IIDXHOOK_CONFIG_GFX_DEFAULT_DIAGONAL_TEARING_FIX_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
IIDXHOOK_CONFIG_GFX_DIAGONAL_TEARING_FIX_KEY,
IIDXHOOK_CONFIG_GFX_DEFAULT_DIAGONAL_TEARING_FIX_VALUE);
}
} }

View File

@@ -21,6 +21,7 @@ struct iidxhook_config_gfx {
enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter; enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter;
int32_t forced_refresh_rate; int32_t forced_refresh_rate;
int32_t device_adapter; int32_t device_adapter;
bool diagonal_tearing_fix;
}; };
void iidxhook_config_gfx_init(struct cconfig *config); void iidxhook_config_gfx_init(struct cconfig *config);

View File

@@ -13,6 +13,7 @@
#include "hook/table.h" #include "hook/table.h"
#include "iidxhook-util/d3d9.h" #include "iidxhook-util/d3d9.h"
#include "iidxhook-util/vertex-shader.h"
#include "util/defs.h" #include "util/defs.h"
#include "util/log.h" #include "util/log.h"
@@ -64,6 +65,8 @@ static struct {
D3DTEXTUREFILTERTYPE filter; D3DTEXTUREFILTERTYPE filter;
} iidxhook_util_d3d9_back_buffer_scaling; } iidxhook_util_d3d9_back_buffer_scaling;
static IDirect3DVertexShader9* vertex_shader;
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */
@@ -901,6 +904,45 @@ iidxhook_util_d3d9_scale_render_target_to_back_buffer(struct hook_d3d9_irp *irp)
} }
} }
static void
iidxhook_util_d3d9_iidx18_and_19_fix_diagonal_tearing(struct hook_d3d9_irp *irp)
{
HRESULT hr;
log_assert(irp);
log_assert(irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT || irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER);
if (!iidxhook_util_d3d9_config.iidx18_and_19_diagonal_tearing_fix)
{
return;
}
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT)
{
const D3DVIEWPORT9 *pViewport = irp->args.dev_set_viewport.pViewport;
const float fix_offset[2] = {-1.0F / (float)pViewport->Width, -1.0F / (float)pViewport->Height};
hr = IDirect3DDevice9_SetVertexShaderConstantF(irp->args.dev_set_viewport.self, 63, fix_offset, lengthof(fix_offset));
if (hr != S_OK) {
log_warning("SetVertexShaderConstantF failed: %lX", hr);
}
}
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER)
{
if (!vertex_shader) {
hr = IDirect3DDevice9_CreateVertexShader(irp->args.dev_set_vertex_shader.self, (const DWORD*) g_vs11_vs_main, &vertex_shader);
if (hr != S_OK) {
log_fatal("CreateVertexShader failed: %lX", hr);
}
}
if (irp->args.dev_set_vertex_shader.pShader != NULL) {
irp->args.dev_set_vertex_shader.pShader = vertex_shader;
}
}
}
/* ------------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------------
*/ */
@@ -921,6 +963,7 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config)
"iidx12_fix_song_select_bg: %d\n" "iidx12_fix_song_select_bg: %d\n"
"iidx13_fix_song_select_bg: %d\n" "iidx13_fix_song_select_bg: %d\n"
"iidx14_to_19_nvidia_fix: %d\n" "iidx14_to_19_nvidia_fix: %d\n"
"iidx18_and_19_diagonal_tearing_fix: %d\n"
"scale_back_buffer_width: %d\n" "scale_back_buffer_width: %d\n"
"scale_back_buffer_height: %d\n" "scale_back_buffer_height: %d\n"
"scale_back_buffer_filter: %d\n" "scale_back_buffer_filter: %d\n"
@@ -938,6 +981,7 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config)
config->iidx12_fix_song_select_bg, config->iidx12_fix_song_select_bg,
config->iidx13_fix_song_select_bg, config->iidx13_fix_song_select_bg,
config->iidx14_to_19_nvidia_fix, config->iidx14_to_19_nvidia_fix,
config->iidx18_and_19_diagonal_tearing_fix,
config->scale_back_buffer_width, config->scale_back_buffer_width,
config->scale_back_buffer_height, config->scale_back_buffer_height,
config->scale_back_buffer_filter, config->scale_back_buffer_filter,
@@ -1002,6 +1046,7 @@ void iidxhook_util_d3d9_init_config(struct iidxhook_util_d3d9_config *config)
config->iidx12_fix_song_select_bg = false; config->iidx12_fix_song_select_bg = false;
config->iidx13_fix_song_select_bg = false; config->iidx13_fix_song_select_bg = false;
config->iidx14_to_19_nvidia_fix = false; config->iidx14_to_19_nvidia_fix = false;
config->iidx18_and_19_diagonal_tearing_fix = false;
config->scale_back_buffer_width = 0; config->scale_back_buffer_width = 0;
config->scale_back_buffer_height = 0; config->scale_back_buffer_height = 0;
config->scale_back_buffer_filter = config->scale_back_buffer_filter =
@@ -1112,6 +1157,12 @@ iidxhook_util_d3d9_irp_handler(struct hook_d3d9_irp *irp)
return hook_d3d9_irp_invoke_next(irp); return hook_d3d9_irp_invoke_next(irp);
case HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT:
case HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER:
iidxhook_util_d3d9_iidx18_and_19_fix_diagonal_tearing(irp);
return hook_d3d9_irp_invoke_next(irp);
default: default:
return hook_d3d9_irp_invoke_next(irp); return hook_d3d9_irp_invoke_next(irp);
} }

Some files were not shown because too many files have changed in this diff Show More