From f4b4df755134120996d657401d7205ed463447a7 Mon Sep 17 00:00:00 2001 From: ThatzOkay Date: Mon, 26 Aug 2024 13:46:05 +0200 Subject: [PATCH] Working build again --- Package.mk | 532 ++++++++--------- apm3io/apm3io.h | 2 +- board/config.c | 190 +++--- board/meson.build | 108 ++-- board/sg-nfc-cmd.h | 236 ++++---- board/sg-nfc.c | 954 +++++++++++++++--------------- board/vfd-cmd.h | 246 ++++---- board/vfd-frame.c | 176 +++--- board/vfd-frame.h | 40 +- board/vfd.c | 796 ++++++++++++------------- board/vfd.h | 26 +- dist/apm3/start.bat | 3 +- dist/chusan/segatools.ini | 412 ++++++------- dist/cm/segatools.ini | 222 +++---- dist/fgo/segatools.ini | 320 +++++----- dist/mai2/segatools.ini | 272 ++++----- dist/mercury/segatools.ini | 248 ++++---- dist/mu3/segatools.ini | 394 ++++++------- dist/swdc/segatools.ini | 372 ++++++------ doc/config/common.md | 1134 ++++++++++++++++++------------------ meson.build | 260 ++++----- multihook/dllmain.c | 0 multihook/meson.build | 31 + multihook/multihook.def | 17 + 24 files changed, 3519 insertions(+), 3472 deletions(-) create mode 100644 multihook/dllmain.c create mode 100644 multihook/meson.build create mode 100644 multihook/multihook.def diff --git a/Package.mk b/Package.mk index 7176499..ee0dea9 100644 --- a/Package.mk +++ b/Package.mk @@ -1,266 +1,266 @@ -$(BUILD_DIR_ZIP)/chuni.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni - $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni/DEVICE - $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_32)/chunihook/chunihook.dll \ - $(DIST_DIR)/chuni/segatools.ini \ - $(DIST_DIR)/chuni/start.bat \ - $(BUILD_DIR_ZIP)/chuni - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/chuni/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/chuni/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/chuni ; zip -r ../chuni.zip * - -$(BUILD_DIR_ZIP)/cxb.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb - $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb/DEVICE - $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_32)/cxbhook/cxbhook.dll \ - $(DIST_DIR)/cxb/segatools.ini \ - $(DIST_DIR)/cxb/start.bat \ - $(BUILD_DIR_ZIP)/cxb - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/cxb/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/cxb/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/cxb ; zip -r ../cxb.zip * - -$(BUILD_DIR_ZIP)/diva.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/diva - $(V)mkdir -p $(BUILD_DIR_ZIP)/diva/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/divahook/divahook.dll \ - $(DIST_DIR)/diva/segatools.ini \ - $(DIST_DIR)/diva/start.bat \ - $(BUILD_DIR_ZIP)/diva - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/diva/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/diva/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/diva ; zip -r ../diva.zip * - -$(BUILD_DIR_ZIP)/carol.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/carol - $(V)mkdir -p $(BUILD_DIR_ZIP)/carol/DEVICE - $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_32)/carolhook/carolhook.dll \ - $(DIST_DIR)/carol/segatools.ini \ - $(DIST_DIR)/carol/start.bat \ - $(BUILD_DIR_ZIP)/carol - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/carol/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/carol/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/carol ; zip -r ../carol.zip * - -$(BUILD_DIR_ZIP)/idz.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/idz - $(V)mkdir -p $(BUILD_DIR_ZIP)/idz/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/idzhook/idzhook.dll \ - $(DIST_DIR)/idz/segatools.ini \ - $(DIST_DIR)/idz/start.bat \ - $(BUILD_DIR_ZIP)/idz - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/idz/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/idz/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/idz ; zip -r ../idz.zip * - -$(BUILD_DIR_ZIP)/fgo.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo - $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/fgohook/fgohook.dll \ - $(DIST_DIR)/fgo/segatools.ini \ - $(DIST_DIR)/fgo/start.bat \ - $(BUILD_DIR_ZIP)/fgo - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/fgo/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/fgo/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/fgo ; zip -r ../fgo.zip * - -$(BUILD_DIR_ZIP)/idac.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/idac - $(V)mkdir -p $(BUILD_DIR_ZIP)/idac/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/idachook/idachook.dll \ - $(DIST_DIR)/idac/segatools.ini \ - $(DIST_DIR)/idac/config_hook.json \ - $(DIST_DIR)/idac/start.bat \ - $(BUILD_DIR_ZIP)/idac - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/idac/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/idac/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/idac ; zip -r ../idac.zip * - -$(BUILD_DIR_ZIP)/swdc.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc - $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/swdchook/swdchook.dll \ - $(DIST_DIR)/swdc/segatools.ini \ - $(DIST_DIR)/swdc/config_hook.json \ - $(DIST_DIR)/swdc/start.bat \ - $(BUILD_DIR_ZIP)/swdc - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/swdc/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/swdc/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/swdc ; zip -r ../swdc.zip * - -$(BUILD_DIR_ZIP)/mercury.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury - $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/mercuryhook/mercuryhook.dll \ - $(DIST_DIR)/mercury/segatools.ini \ - $(DIST_DIR)/mercury/start.bat \ - $(BUILD_DIR_ZIP)/mercury - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/mercury/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/mercury/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/mercury ; zip -r ../mercury.zip * - -$(BUILD_DIR_ZIP)/chusan.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan - $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan/DEVICE - $(V)cp $(DIST_DIR)/chusan/segatools.ini \ - $(DIST_DIR)/chusan/config_hook.json \ - $(DIST_DIR)/chusan/start.bat \ - $(BUILD_DIR_ZIP)/chusan - $(V)cp $(BUILD_DIR_32)/chusanhook/chusanhook.dll \ - $(BUILD_DIR_ZIP)/chusan/chusanhook_x86.dll - $(V)cp $(BUILD_DIR_64)/chusanhook/chusanhook.dll \ - $(BUILD_DIR_ZIP)/chusan/chusanhook_x64.dll - $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_ZIP)/chusan/inject_x86.exe - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_ZIP)/chusan/inject_x64.exe - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/chusan/DEVICE - for x in exe dll; do strip $(BUILD_DIR_ZIP)/chusan/*.$$x; done - $(V)cd $(BUILD_DIR_ZIP)/chusan ; zip -r ../chusan.zip * - -$(BUILD_DIR_ZIP)/mu3.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3 - $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/mu3hook/mu3hook.dll \ - $(DIST_DIR)/mu3/segatools.ini \ - $(DIST_DIR)/mu3/start.bat \ - $(BUILD_DIR_ZIP)/mu3 - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/mu3/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/mu3/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/mu3 ; zip -r ../mu3.zip * - -$(BUILD_DIR_ZIP)/mai2.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2 - $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/mai2hook/mai2hook.dll \ - $(DIST_DIR)/mai2/segatools.ini \ - $(DIST_DIR)/mai2/start.bat \ - $(BUILD_DIR_ZIP)/mai2 - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/mai2/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/mai2/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/mai2 ; zip -r ../mai2.zip * - -$(BUILD_DIR_ZIP)/cm.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/cm - $(V)mkdir -p $(BUILD_DIR_ZIP)/cm/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/cmhook/cmhook.dll \ - $(DIST_DIR)/cm/config_hook.json \ - $(DIST_DIR)/cm/segatools.ini \ - $(DIST_DIR)/cm/start.bat \ - $(BUILD_DIR_ZIP)/cm - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/cm/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/cm/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/cm ; zip -r ../cm.zip * - -$(BUILD_DIR_ZIP)/apm3.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3 - $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/apm3hook/apm3hook.dll \ - $(DIST_DIR)/apm3/segatools.ini \ - $(DIST_DIR)/apm3/start.bat \ - $(BUILD_DIR_ZIP)/apm3 - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/apm3/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/apm3/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/apm3 ; zip -r ../apm3.zip * - -$(BUILD_DIR_ZIP)/tokyo.zip: - $(V)echo ... $@ - $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo - $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo/DEVICE - $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ - $(BUILD_DIR_64)/tokyohook/tokyohook.dll \ - $(DIST_DIR)/tokyo/config_hook.json \ - $(DIST_DIR)/tokyo/segatools.ini \ - $(DIST_DIR)/tokyo/start.bat \ - $(BUILD_DIR_ZIP)/tokyo - $(V)cp pki/billing.pub \ - pki/ca.crt \ - $(BUILD_DIR_ZIP)/tokyo/DEVICE - $(V)strip $(BUILD_DIR_ZIP)/tokyo/*.{exe,dll} - $(V)cd $(BUILD_DIR_ZIP)/tokyo ; zip -r ../tokyo.zip * - -$(BUILD_DIR_ZIP)/doc.zip: \ - $(DOC_DIR)/config \ - $(DOC_DIR)/chunihook.md \ - $(DOC_DIR)/idzhook.md \ - | $(zipdir)/ - $(V)echo ... $@ - $(V)zip -r $@ $^ - -$(BUILD_DIR_ZIP)/segatools.zip: \ - $(BUILD_DIR_ZIP)/chuni.zip \ - $(BUILD_DIR_ZIP)/cxb.zip \ - $(BUILD_DIR_ZIP)/carol.zip \ - $(BUILD_DIR_ZIP)/diva.zip \ - $(BUILD_DIR_ZIP)/doc.zip \ - $(BUILD_DIR_ZIP)/idz.zip \ - $(BUILD_DIR_ZIP)/idac.zip \ - $(BUILD_DIR_ZIP)/swdc.zip \ - $(BUILD_DIR_ZIP)/mercury.zip \ - $(BUILD_DIR_ZIP)/chusan.zip \ - $(BUILD_DIR_ZIP)/mu3.zip \ - $(BUILD_DIR_ZIP)/mai2.zip \ - $(BUILD_DIR_ZIP)/cm.zip \ - $(BUILD_DIR_ZIP)/apm3.zip \ - $(BUILD_DIR_ZIP)/tokyo.zip \ - $(BUILD_DIR_ZIP)/fgo.zip \ - CHANGELOG.md \ - README.md \ - - $(V)echo ... $@ - $(V)zip -j $@ $^ +$(BUILD_DIR_ZIP)/chuni.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni + $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni/DEVICE + $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_32)/chunihook/chunihook.dll \ + $(DIST_DIR)/chuni/segatools.ini \ + $(DIST_DIR)/chuni/start.bat \ + $(BUILD_DIR_ZIP)/chuni + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/chuni/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/chuni/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/chuni ; zip -r ../chuni.zip * + +$(BUILD_DIR_ZIP)/cxb.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb + $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb/DEVICE + $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_32)/cxbhook/cxbhook.dll \ + $(DIST_DIR)/cxb/segatools.ini \ + $(DIST_DIR)/cxb/start.bat \ + $(BUILD_DIR_ZIP)/cxb + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/cxb/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/cxb/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/cxb ; zip -r ../cxb.zip * + +$(BUILD_DIR_ZIP)/diva.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/diva + $(V)mkdir -p $(BUILD_DIR_ZIP)/diva/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/divahook/divahook.dll \ + $(DIST_DIR)/diva/segatools.ini \ + $(DIST_DIR)/diva/start.bat \ + $(BUILD_DIR_ZIP)/diva + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/diva/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/diva/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/diva ; zip -r ../diva.zip * + +$(BUILD_DIR_ZIP)/carol.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/carol + $(V)mkdir -p $(BUILD_DIR_ZIP)/carol/DEVICE + $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_32)/carolhook/carolhook.dll \ + $(DIST_DIR)/carol/segatools.ini \ + $(DIST_DIR)/carol/start.bat \ + $(BUILD_DIR_ZIP)/carol + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/carol/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/carol/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/carol ; zip -r ../carol.zip * + +$(BUILD_DIR_ZIP)/idz.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/idz + $(V)mkdir -p $(BUILD_DIR_ZIP)/idz/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/idzhook/idzhook.dll \ + $(DIST_DIR)/idz/segatools.ini \ + $(DIST_DIR)/idz/start.bat \ + $(BUILD_DIR_ZIP)/idz + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/idz/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/idz/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/idz ; zip -r ../idz.zip * + +$(BUILD_DIR_ZIP)/fgo.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo + $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/fgohook/fgohook.dll \ + $(DIST_DIR)/fgo/segatools.ini \ + $(DIST_DIR)/fgo/start.bat \ + $(BUILD_DIR_ZIP)/fgo + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/fgo/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/fgo/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/fgo ; zip -r ../fgo.zip * + +$(BUILD_DIR_ZIP)/idac.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/idac + $(V)mkdir -p $(BUILD_DIR_ZIP)/idac/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/idachook/idachook.dll \ + $(DIST_DIR)/idac/segatools.ini \ + $(DIST_DIR)/idac/config_hook.json \ + $(DIST_DIR)/idac/start.bat \ + $(BUILD_DIR_ZIP)/idac + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/idac/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/idac/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/idac ; zip -r ../idac.zip * + +$(BUILD_DIR_ZIP)/swdc.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc + $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/swdchook/swdchook.dll \ + $(DIST_DIR)/swdc/segatools.ini \ + $(DIST_DIR)/swdc/config_hook.json \ + $(DIST_DIR)/swdc/start.bat \ + $(BUILD_DIR_ZIP)/swdc + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/swdc/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/swdc/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/swdc ; zip -r ../swdc.zip * + +$(BUILD_DIR_ZIP)/mercury.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury + $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/mercuryhook/mercuryhook.dll \ + $(DIST_DIR)/mercury/segatools.ini \ + $(DIST_DIR)/mercury/start.bat \ + $(BUILD_DIR_ZIP)/mercury + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/mercury/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/mercury/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/mercury ; zip -r ../mercury.zip * + +$(BUILD_DIR_ZIP)/chusan.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan + $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan/DEVICE + $(V)cp $(DIST_DIR)/chusan/segatools.ini \ + $(DIST_DIR)/chusan/config_hook.json \ + $(DIST_DIR)/chusan/start.bat \ + $(BUILD_DIR_ZIP)/chusan + $(V)cp $(BUILD_DIR_32)/chusanhook/chusanhook.dll \ + $(BUILD_DIR_ZIP)/chusan/chusanhook_x86.dll + $(V)cp $(BUILD_DIR_64)/chusanhook/chusanhook.dll \ + $(BUILD_DIR_ZIP)/chusan/chusanhook_x64.dll + $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_ZIP)/chusan/inject_x86.exe + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_ZIP)/chusan/inject_x64.exe + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/chusan/DEVICE + for x in exe dll; do strip $(BUILD_DIR_ZIP)/chusan/*.$$x; done + $(V)cd $(BUILD_DIR_ZIP)/chusan ; zip -r ../chusan.zip * + +$(BUILD_DIR_ZIP)/mu3.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3 + $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/mu3hook/mu3hook.dll \ + $(DIST_DIR)/mu3/segatools.ini \ + $(DIST_DIR)/mu3/start.bat \ + $(BUILD_DIR_ZIP)/mu3 + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/mu3/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/mu3/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/mu3 ; zip -r ../mu3.zip * + +$(BUILD_DIR_ZIP)/mai2.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2 + $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/mai2hook/mai2hook.dll \ + $(DIST_DIR)/mai2/segatools.ini \ + $(DIST_DIR)/mai2/start.bat \ + $(BUILD_DIR_ZIP)/mai2 + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/mai2/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/mai2/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/mai2 ; zip -r ../mai2.zip * + +$(BUILD_DIR_ZIP)/cm.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/cm + $(V)mkdir -p $(BUILD_DIR_ZIP)/cm/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/cmhook/cmhook.dll \ + $(DIST_DIR)/cm/config_hook.json \ + $(DIST_DIR)/cm/segatools.ini \ + $(DIST_DIR)/cm/start.bat \ + $(BUILD_DIR_ZIP)/cm + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/cm/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/cm/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/cm ; zip -r ../cm.zip * + +$(BUILD_DIR_ZIP)/apm3.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3 + $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/apm3hook/apm3hook.dll \ + $(DIST_DIR)/apm3/segatools.ini \ + $(DIST_DIR)/apm3/start.bat \ + $(BUILD_DIR_ZIP)/apm3 + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/apm3/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/apm3/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/apm3 ; zip -r ../apm3.zip * + +$(BUILD_DIR_ZIP)/tokyo.zip: + $(V)echo ... $@ + $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo + $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo/DEVICE + $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ + $(BUILD_DIR_64)/tokyohook/tokyohook.dll \ + $(DIST_DIR)/tokyo/config_hook.json \ + $(DIST_DIR)/tokyo/segatools.ini \ + $(DIST_DIR)/tokyo/start.bat \ + $(BUILD_DIR_ZIP)/tokyo + $(V)cp pki/billing.pub \ + pki/ca.crt \ + $(BUILD_DIR_ZIP)/tokyo/DEVICE + $(V)strip $(BUILD_DIR_ZIP)/tokyo/*.{exe,dll} + $(V)cd $(BUILD_DIR_ZIP)/tokyo ; zip -r ../tokyo.zip * + +$(BUILD_DIR_ZIP)/doc.zip: \ + $(DOC_DIR)/config \ + $(DOC_DIR)/chunihook.md \ + $(DOC_DIR)/idzhook.md \ + | $(zipdir)/ + $(V)echo ... $@ + $(V)zip -r $@ $^ + +$(BUILD_DIR_ZIP)/segatools.zip: \ + $(BUILD_DIR_ZIP)/chuni.zip \ + $(BUILD_DIR_ZIP)/cxb.zip \ + $(BUILD_DIR_ZIP)/carol.zip \ + $(BUILD_DIR_ZIP)/diva.zip \ + $(BUILD_DIR_ZIP)/doc.zip \ + $(BUILD_DIR_ZIP)/idz.zip \ + $(BUILD_DIR_ZIP)/idac.zip \ + $(BUILD_DIR_ZIP)/swdc.zip \ + $(BUILD_DIR_ZIP)/mercury.zip \ + $(BUILD_DIR_ZIP)/chusan.zip \ + $(BUILD_DIR_ZIP)/mu3.zip \ + $(BUILD_DIR_ZIP)/mai2.zip \ + $(BUILD_DIR_ZIP)/cm.zip \ + $(BUILD_DIR_ZIP)/apm3.zip \ + $(BUILD_DIR_ZIP)/tokyo.zip \ + $(BUILD_DIR_ZIP)/fgo.zip \ + CHANGELOG.md \ + README.md \ + + $(V)echo ... $@ + $(V)zip -j $@ $^ diff --git a/apm3io/apm3io.h b/apm3io/apm3io.h index d7f49d8..2de0690 100644 --- a/apm3io/apm3io.h +++ b/apm3io/apm3io.h @@ -12,7 +12,7 @@ enum { enum { apm3_IO_GAMEBTN_1 = 0x01, -} +}; /* Get the version of the AllS.Net PRAS Multi IO API that this DLL supports. This function should return a positive 16-bit integer, where the high byte is diff --git a/board/config.c b/board/config.c index 0b07d6f..c1cd713 100644 --- a/board/config.c +++ b/board/config.c @@ -1,95 +1,95 @@ -#include - -#include -#include -#include -#include - -#include "board/aime-dll.h" -#include "board/config.h" -#include "board/sg-reader.h" -#include "board/vfd.h" - -#include "util/dprintf.h" - -// Check windows -#if _WIN32 || _WIN64 - #if _WIN64 - #define ENV64BIT - #else - #define ENV32BIT - #endif -#endif - -// Check GCC -#if __GNUC__ - #if __x86_64__ || __ppc64__ - #define ENV64BIT - #else - #define ENV32BIT - #endif -#endif - -static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - // Workaround for x64/x86 external IO dlls - // path32 for 32bit, path64 for 64bit - // for else.. is that possible? idk - - if (cfg->path64) { - #if defined(ENV32BIT) - // Always empty, due to amdaemon being 64 bit in 32 bit mode - memset(cfg->path, 0, sizeof(cfg->path)); - #elif defined(ENV64BIT) - GetPrivateProfileStringW( - L"aimeio", - L"path", - L"", - cfg->path, - _countof(cfg->path), - filename); - #else - #error "Unknown environment" - #endif - } else { - GetPrivateProfileStringW( - L"aimeio", - L"path", - L"", - cfg->path, - _countof(cfg->path), - filename); - } -} - -void aime_config_load(struct aime_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - aime_dll_config_load(&cfg->dll, filename); - cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename); - cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename); - cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename); -} - -void io4_config_load(struct io4_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename); -} - -void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename); - cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename); - cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename); -} +#include + +#include +#include +#include +#include + +#include "board/aime-dll.h" +#include "board/config.h" +#include "board/sg-reader.h" +#include "board/vfd.h" + +#include "util/dprintf.h" + +// Check windows +#if _WIN32 || _WIN64 + #if _WIN64 + #define ENV64BIT + #else + #define ENV32BIT + #endif +#endif + +// Check GCC +#if __GNUC__ + #if __x86_64__ || __ppc64__ + #define ENV64BIT + #else + #define ENV32BIT + #endif +#endif + +static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + // Workaround for x64/x86 external IO dlls + // path32 for 32bit, path64 for 64bit + // for else.. is that possible? idk + + if (cfg->path64) { + #if defined(ENV32BIT) + // Always empty, due to amdaemon being 64 bit in 32 bit mode + memset(cfg->path, 0, sizeof(cfg->path)); + #elif defined(ENV64BIT) + GetPrivateProfileStringW( + L"aimeio", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); + #else + #error "Unknown environment" + #endif + } else { + GetPrivateProfileStringW( + L"aimeio", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); + } +} + +void aime_config_load(struct aime_config *cfg, const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + aime_dll_config_load(&cfg->dll, filename); + cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename); + cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename); + cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename); +} + +void io4_config_load(struct io4_config *cfg, const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename); +} + +void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename); + cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename); + cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename); +} diff --git a/board/meson.build b/board/meson.build index 32042e3..b26851f 100644 --- a/board/meson.build +++ b/board/meson.build @@ -1,54 +1,54 @@ -board_lib = static_library( - 'board', - include_directories : inc, - implicit_include_directories : false, - c_pch : '../precompiled.h', - dependencies : [ - capnhook.get_variable('hook_dep'), - ], - link_with : [ - iccard_lib, - ], - sources : [ - 'aime-dll.c', - 'aime-dll.h', - 'config.c', - 'config.h', - 'guid.c', - 'guid.h', - 'io3.c', - 'io3.h', - 'io4.c', - 'io4.h', - 'led15093-cmd.h', - 'led15093-frame.c', - 'led15093-frame.h', - 'led15093.c', - 'led15093.h', - 'led15070-cmd.h', - 'led15070-frame.c', - 'led15070-frame.h', - 'led15070.c', - 'led15070.h', - 'sg-cmd.c', - 'sg-cmd.h', - 'sg-frame.c', - 'sg-frame.h', - 'sg-led.c', - 'sg-led.h', - 'sg-led-cmd.h', - 'sg-nfc.c', - 'sg-nfc.h', - 'sg-nfc-cmd.h', - 'sg-reader.c', - 'sg-reader.h', - 'slider-cmd.h', - 'slider-frame.c', - 'slider-frame.h', - 'vfd.c', - 'vfd.h', - 'vfd-cmd.h', - 'vfd-frame.c', - 'vfd-frame.h', - ], -) +board_lib = static_library( + 'board', + include_directories : inc, + implicit_include_directories : false, + c_pch : '../precompiled.h', + dependencies : [ + capnhook.get_variable('hook_dep'), + ], + link_with : [ + iccard_lib, + ], + sources : [ + 'aime-dll.c', + 'aime-dll.h', + 'config.c', + 'config.h', + 'guid.c', + 'guid.h', + 'io3.c', + 'io3.h', + 'io4.c', + 'io4.h', + 'led15093-cmd.h', + 'led15093-frame.c', + 'led15093-frame.h', + 'led15093.c', + 'led15093.h', + 'led15070-cmd.h', + 'led15070-frame.c', + 'led15070-frame.h', + 'led15070.c', + 'led15070.h', + 'sg-cmd.c', + 'sg-cmd.h', + 'sg-frame.c', + 'sg-frame.h', + 'sg-led.c', + 'sg-led.h', + 'sg-led-cmd.h', + 'sg-nfc.c', + 'sg-nfc.h', + 'sg-nfc-cmd.h', + 'sg-reader.c', + 'sg-reader.h', + 'slider-cmd.h', + 'slider-frame.c', + 'slider-frame.h', + 'vfd.c', + 'vfd.h', + 'vfd-cmd.h', + 'vfd-frame.c', + 'vfd-frame.h', + ], +) diff --git a/board/sg-nfc-cmd.h b/board/sg-nfc-cmd.h index ae7737b..604783b 100644 --- a/board/sg-nfc-cmd.h +++ b/board/sg-nfc-cmd.h @@ -1,118 +1,118 @@ -#pragma once - -#include - -#pragma pack(push, 1) - -enum { - SG_NFC_CMD_GET_FW_VERSION = 0x30, - SG_NFC_CMD_GET_HW_VERSION = 0x32, - SG_NFC_CMD_RADIO_ON = 0x40, - SG_NFC_CMD_RADIO_OFF = 0x41, - SG_NFC_CMD_POLL = 0x42, - SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43, - SG_NFC_CMD_MIFARE_SET_KEY_A = 0x50, - SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51, - SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52, - SG_NFC_CMD_MIFARE_SET_KEY_B = 0x54, - SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55, - SG_NFC_CMD_TO_UPDATE_MODE = 0x60, - SG_NFC_CMD_SEND_HEX_DATA = 0x61, - SG_NFC_CMD_RESET = 0x62, - SG_NFC_CMD_FELICA_ENCAP = 0x71, -}; - -struct sg_nfc_res_get_fw_version { - struct sg_res_header res; - char version[23]; -}; - -struct sg_nfc_res_get_hw_version { - struct sg_res_header res; - char version[23]; -}; - -struct sg_nfc_req_mifare_set_key { - struct sg_req_header req; - uint8_t key[6]; -}; - -struct sg_nfc_req_mifare_50 { - struct sg_req_header req; - uint8_t payload[6]; -}; - -struct sg_nfc_req_poll_40 { - struct sg_req_header req; - uint8_t payload; -}; - -struct sg_nfc_poll_mifare { - uint8_t type; - uint8_t id_len; - uint32_t uid; -}; - -struct sg_nfc_poll_felica { - uint8_t type; - uint8_t id_len; - uint64_t IDm; - uint64_t PMm; -}; - -struct sg_nfc_res_poll { - struct sg_res_header res; - uint8_t count; - uint8_t payload[250]; -}; - -struct sg_nfc_req_mifare_select_tag { - struct sg_res_header res; - uint32_t uid; -}; - -struct sg_nfc_req_mifare_read_block { - struct sg_req_header req; - struct { - uint32_t uid; - uint8_t block_no; - } payload; -}; - -struct sg_nfc_res_mifare_read_block { - struct sg_res_header res; - uint8_t block[16]; -}; - -struct sg_nfc_req_felica_encap { - struct sg_req_header req; - uint64_t IDm; - uint8_t payload[243]; -}; - -struct sg_nfc_res_felica_encap { - struct sg_res_header res; - uint8_t payload[250]; -}; - -union sg_nfc_req_any { - uint8_t bytes[256]; - struct sg_req_header simple; - struct sg_nfc_req_mifare_set_key mifare_set_key; - struct sg_nfc_req_mifare_read_block mifare_read_block; - struct sg_nfc_req_mifare_50 mifare_50; - struct sg_nfc_req_poll_40 poll_40; - struct sg_nfc_req_felica_encap felica_encap; -}; - -union sg_nfc_res_any { - uint8_t bytes[256]; - struct sg_res_header simple; - struct sg_nfc_res_get_fw_version get_fw_version; - struct sg_nfc_res_get_hw_version get_hw_version; - struct sg_nfc_res_poll poll; - struct sg_nfc_res_mifare_read_block mifare_read_block; - struct sg_nfc_res_felica_encap felica_encap; -}; - -#pragma pack(pop) +#pragma once + +#include + +#pragma pack(push, 1) + +enum { + SG_NFC_CMD_GET_FW_VERSION = 0x30, + SG_NFC_CMD_GET_HW_VERSION = 0x32, + SG_NFC_CMD_RADIO_ON = 0x40, + SG_NFC_CMD_RADIO_OFF = 0x41, + SG_NFC_CMD_POLL = 0x42, + SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43, + SG_NFC_CMD_MIFARE_SET_KEY_A = 0x50, + SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51, + SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52, + SG_NFC_CMD_MIFARE_SET_KEY_B = 0x54, + SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55, + SG_NFC_CMD_TO_UPDATE_MODE = 0x60, + SG_NFC_CMD_SEND_HEX_DATA = 0x61, + SG_NFC_CMD_RESET = 0x62, + SG_NFC_CMD_FELICA_ENCAP = 0x71, +}; + +struct sg_nfc_res_get_fw_version { + struct sg_res_header res; + char version[23]; +}; + +struct sg_nfc_res_get_hw_version { + struct sg_res_header res; + char version[23]; +}; + +struct sg_nfc_req_mifare_set_key { + struct sg_req_header req; + uint8_t key[6]; +}; + +struct sg_nfc_req_mifare_50 { + struct sg_req_header req; + uint8_t payload[6]; +}; + +struct sg_nfc_req_poll_40 { + struct sg_req_header req; + uint8_t payload; +}; + +struct sg_nfc_poll_mifare { + uint8_t type; + uint8_t id_len; + uint32_t uid; +}; + +struct sg_nfc_poll_felica { + uint8_t type; + uint8_t id_len; + uint64_t IDm; + uint64_t PMm; +}; + +struct sg_nfc_res_poll { + struct sg_res_header res; + uint8_t count; + uint8_t payload[250]; +}; + +struct sg_nfc_req_mifare_select_tag { + struct sg_res_header res; + uint32_t uid; +}; + +struct sg_nfc_req_mifare_read_block { + struct sg_req_header req; + struct { + uint32_t uid; + uint8_t block_no; + } payload; +}; + +struct sg_nfc_res_mifare_read_block { + struct sg_res_header res; + uint8_t block[16]; +}; + +struct sg_nfc_req_felica_encap { + struct sg_req_header req; + uint64_t IDm; + uint8_t payload[243]; +}; + +struct sg_nfc_res_felica_encap { + struct sg_res_header res; + uint8_t payload[250]; +}; + +union sg_nfc_req_any { + uint8_t bytes[256]; + struct sg_req_header simple; + struct sg_nfc_req_mifare_set_key mifare_set_key; + struct sg_nfc_req_mifare_read_block mifare_read_block; + struct sg_nfc_req_mifare_50 mifare_50; + struct sg_nfc_req_poll_40 poll_40; + struct sg_nfc_req_felica_encap felica_encap; +}; + +union sg_nfc_res_any { + uint8_t bytes[256]; + struct sg_res_header simple; + struct sg_nfc_res_get_fw_version get_fw_version; + struct sg_nfc_res_get_hw_version get_hw_version; + struct sg_nfc_res_poll poll; + struct sg_nfc_res_mifare_read_block mifare_read_block; + struct sg_nfc_res_felica_encap felica_encap; +}; + +#pragma pack(pop) diff --git a/board/sg-nfc.c b/board/sg-nfc.c index 9571fc1..4505038 100644 --- a/board/sg-nfc.c +++ b/board/sg-nfc.c @@ -1,477 +1,477 @@ -#include - -#include -#include -#include -#include -#include -#include - -#include "board/sg-cmd.h" -#include "board/sg-nfc.h" -#include "board/sg-nfc-cmd.h" - -#include "iccard/aime.h" -#include "iccard/felica.h" - -#include "util/dprintf.h" -#include "util/dump.h" - -static HRESULT sg_nfc_dispatch( - void *ctx, - const void *v_req, - void *v_res); - -static HRESULT sg_nfc_cmd_reset( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res); - -static HRESULT sg_nfc_cmd_get_fw_version( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_get_fw_version *res); - -static HRESULT sg_nfc_cmd_get_hw_version( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_get_hw_version *res); - -static HRESULT sg_nfc_cmd_poll( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_poll *res); - -static HRESULT sg_nfc_poll_aime( - struct sg_nfc *nfc, - struct sg_nfc_poll_mifare *mifare); - -static HRESULT sg_nfc_poll_felica( - struct sg_nfc *nfc, - struct sg_nfc_poll_felica *felica); - -static HRESULT sg_nfc_cmd_mifare_read_block( - struct sg_nfc *nfc, - const struct sg_nfc_req_mifare_read_block *req, - struct sg_nfc_res_mifare_read_block *res); - -static HRESULT sg_nfc_cmd_felica_encap( - struct sg_nfc *nfc, - const struct sg_nfc_req_felica_encap *req, - struct sg_nfc_res_felica_encap *res); - -static HRESULT sg_nfc_cmd_send_hex_data( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res); - -static HRESULT sg_nfc_cmd_dummy( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res); - -static const struct version_info hw_version[] = { - {"TN32MSEC003S H/W Ver3.0", 23}, - {"837-15286", 9}, - {"837-15396", 9} -}; - -static const struct version_info fw_version[] = { - {"TN32MSEC003S F/W Ver1.2", 23}, - {"\x94", 1}, - {"\x94", 1} -}; - -void sg_nfc_init( - struct sg_nfc *nfc, - uint8_t addr, - const struct sg_nfc_ops *ops, - unsigned int gen, - void *ops_ctx) -{ - assert(nfc != NULL); - assert(ops != NULL); - - nfc->ops = ops; - nfc->ops_ctx = ops_ctx; - nfc->addr = addr; - nfc->gen = gen; -} - -#ifdef NDEBUG -#define sg_nfc_dprintfv(nfc, fmt, ap) -#define sg_nfc_dprintf(nfc, fmt, ...) -#else -static void sg_nfc_dprintfv( - const struct sg_nfc *nfc, - const char *fmt, - va_list ap) -{ - dprintf("NFC %02x: ", nfc->addr); - dprintfv(fmt, ap); -} - -static void sg_nfc_dprintf( - const struct sg_nfc *nfc, - const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - sg_nfc_dprintfv(nfc, fmt, ap); - va_end(ap); -} -#endif - -void sg_nfc_transact( - struct sg_nfc *nfc, - struct iobuf *res_frame, - const void *req_bytes, - size_t req_nbytes) -{ - assert(nfc != NULL); - assert(res_frame != NULL); - assert(req_bytes != NULL); - - sg_req_transact(res_frame, req_bytes, req_nbytes, sg_nfc_dispatch, nfc); -} - -static HRESULT sg_nfc_dispatch( - void *ctx, - const void *v_req, - void *v_res) -{ - struct sg_nfc *nfc; - const union sg_nfc_req_any *req; - union sg_nfc_res_any *res; - - nfc = ctx; - req = v_req; - res = v_res; - - if (req->simple.hdr.addr != nfc->addr) { - /* Not addressed to us, don't send a response */ - return S_FALSE; - } - - switch (req->simple.hdr.cmd) { - case SG_NFC_CMD_RESET: - return sg_nfc_cmd_reset(nfc, &req->simple, &res->simple); - - case SG_NFC_CMD_GET_FW_VERSION: - return sg_nfc_cmd_get_fw_version( - nfc, - &req->simple, - &res->get_fw_version); - - case SG_NFC_CMD_GET_HW_VERSION: - return sg_nfc_cmd_get_hw_version( - nfc, - &req->simple, - &res->get_hw_version); - - case SG_NFC_CMD_POLL: - return sg_nfc_cmd_poll( - nfc, - &req->simple, - &res->poll); - - case SG_NFC_CMD_MIFARE_READ_BLOCK: - return sg_nfc_cmd_mifare_read_block( - nfc, - &req->mifare_read_block, - &res->mifare_read_block); - - case SG_NFC_CMD_FELICA_ENCAP: - return sg_nfc_cmd_felica_encap( - nfc, - &req->felica_encap, - &res->felica_encap); - - case SG_NFC_CMD_MIFARE_AUTHENTICATE: - case SG_NFC_CMD_SEND_HEX_DATA: - return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple); - - case SG_NFC_CMD_MIFARE_SELECT_TAG: - case SG_NFC_CMD_MIFARE_SET_KEY_AIME: - case SG_NFC_CMD_MIFARE_SET_KEY_BANA: - case SG_NFC_CMD_RADIO_ON: - case SG_NFC_CMD_RADIO_OFF: - case SG_NFC_CMD_TO_UPDATE_MODE: - return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple); - - default: - sg_nfc_dprintf(nfc, "Unimpl command %02x\n", req->simple.hdr.cmd); - - return E_NOTIMPL; - } -} - -static HRESULT sg_nfc_cmd_reset( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res) -{ - sg_nfc_dprintf(nfc, "Reset\n"); - sg_res_init(res, req, 0); - res->status = 3; - - return S_OK; -} - -static HRESULT sg_nfc_cmd_get_fw_version( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_get_fw_version *res) -{ - const struct version_info *fw = &fw_version[nfc->gen - 1]; - - /* Dest version is not NUL terminated, this is intentional */ - sg_res_init(&res->res, req, fw->length); - memcpy(res->version, fw->version, fw->length); - - return S_OK; -} - -static HRESULT sg_nfc_cmd_get_hw_version( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_get_hw_version *res) -{ - const struct version_info *hw = &hw_version[nfc->gen - 1]; - - /* Dest version is not NUL terminated, this is intentional */ - sg_res_init(&res->res, req, hw->length); - memcpy(res->version, hw->version, hw->length); - - return S_OK; -} - -static HRESULT sg_nfc_cmd_poll( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_nfc_res_poll *res) -{ - struct sg_nfc_poll_mifare mifare; - struct sg_nfc_poll_felica felica; - HRESULT hr; - - hr = nfc->ops->poll(nfc->ops_ctx); - - if (FAILED(hr)) { - return hr; - } - - hr = sg_nfc_poll_felica(nfc, &felica); - - if (SUCCEEDED(hr) && hr != S_FALSE) { - sg_res_init(&res->res, req, 1 + sizeof(felica)); - memcpy(res->payload, &felica, sizeof(felica)); - res->count = 1; - - return S_OK; - } - - hr = sg_nfc_poll_aime(nfc, &mifare); - - if (SUCCEEDED(hr) && hr != S_FALSE) { - sg_res_init(&res->res, req, 1 + sizeof(mifare)); - memcpy(res->payload, &mifare, sizeof(mifare)); - res->count = 1; - - return S_OK; - } - - sg_res_init(&res->res, req, 1); - res->count = 0; - - return S_OK; -} - -static HRESULT sg_nfc_poll_aime( - struct sg_nfc *nfc, - struct sg_nfc_poll_mifare *mifare) -{ - uint8_t luid[10]; - HRESULT hr; - - /* Call backend */ - - if (nfc->ops->get_aime_id != NULL) { - hr = nfc->ops->get_aime_id(nfc->ops_ctx, luid, sizeof(luid)); - } else { - hr = S_FALSE; - } - - if (FAILED(hr) || hr == S_FALSE) { - return hr; - } - - sg_nfc_dprintf(nfc, "AiMe card is present\n"); - - /* Construct response (use an arbitrary UID) */ - - mifare->type = 0x10; - mifare->id_len = sizeof(mifare->uid); - mifare->uid = _byteswap_ulong(0x01020304); - - /* Initialize MIFARE IC emulator */ - - hr = aime_card_populate(&nfc->mifare, luid, sizeof(luid)); - - if (FAILED(hr)) { - return hr; - } - - return S_OK; -} - -static HRESULT sg_nfc_poll_felica( - struct sg_nfc *nfc, - struct sg_nfc_poll_felica *felica) -{ - uint64_t IDm; - HRESULT hr; - - /* Call backend */ - - if (nfc->ops->get_felica_id != NULL) { - hr = nfc->ops->get_felica_id(nfc->ops_ctx, &IDm); - } else { - hr = S_FALSE; - } - - if (FAILED(hr) || hr == S_FALSE) { - return hr; - } - - sg_nfc_dprintf(nfc, "FeliCa card is present\n"); - - /* Construct poll response */ - - felica->type = 0x20; - felica->id_len = sizeof(felica->IDm) + sizeof(felica->PMm); - felica->IDm = _byteswap_uint64(IDm); - felica->PMm = _byteswap_uint64(felica_get_generic_PMm()); - - /* Initialize FeliCa IC emulator */ - - nfc->felica.IDm = IDm; - nfc->felica.PMm = felica_get_generic_PMm(); - nfc->felica.system_code = 0x0000; - - return S_OK; -} - -static HRESULT sg_nfc_cmd_mifare_read_block( - struct sg_nfc *nfc, - const struct sg_nfc_req_mifare_read_block *req, - struct sg_nfc_res_mifare_read_block *res) -{ - uint32_t uid; - - if (req->req.payload_len != sizeof(req->payload)) { - sg_nfc_dprintf(nfc, "%s: Payload size is incorrect\n", __func__); - - return E_FAIL; - } - - uid = _byteswap_ulong(req->payload.uid); - - sg_nfc_dprintf(nfc, "Read uid %08x block %i\n", uid, req->payload.block_no); - - if (req->payload.block_no > 3) { - sg_nfc_dprintf(nfc, "MIFARE block number out of range\n"); - - return E_FAIL; - } - - sg_res_init(&res->res, &req->req, sizeof(res->block)); - - memcpy( res->block, - nfc->mifare.sectors[0].blocks[req->payload.block_no].bytes, - sizeof(res->block)); - - return S_OK; -} - -static HRESULT sg_nfc_cmd_felica_encap( - struct sg_nfc *nfc, - const struct sg_nfc_req_felica_encap *req, - struct sg_nfc_res_felica_encap *res) -{ - struct const_iobuf f_req; - struct iobuf f_res; - HRESULT hr; - - /* First byte of encapsulated request and response is a length byte - (inclusive of itself). The FeliCa emulator expects its caller to handle - that length byte on its behalf (we adopt the convention that the length - byte is part of the FeliCa protocol's framing layer). */ - - if (req->req.payload_len != 8 + req->payload[0]) { - sg_nfc_dprintf( - nfc, - "FeliCa encap payload length mismatch: sg %i != felica %i + 8", - req->req.payload_len, - req->payload[0]); - - return E_FAIL; - } - - f_req.bytes = req->payload; - f_req.nbytes = req->payload[0]; - f_req.pos = 1; - - f_res.bytes = res->payload; - f_res.nbytes = sizeof(res->payload); - f_res.pos = 1; - -#if defined(LOG_NFC) - dprintf("FELICA OUTBOUND:\n"); - dump_const_iobuf(&f_req); -#endif - - hr = felica_transact(&nfc->felica, &f_req, &f_res); - - if (FAILED(hr)) { - return hr; - } - - sg_res_init(&res->res, &req->req, f_res.pos); - res->payload[0] = f_res.pos; - -#if defined(LOG_NFC) - dprintf("FELICA INBOUND:\n"); - dump_iobuf(&f_res); -#endif - - return S_OK; -} - -static HRESULT sg_nfc_cmd_send_hex_data( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res) -{ - sg_res_init(res, req, 0); - - /* Firmware checksum length? */ - if (req->payload_len == 0x2b) { - /* The firmware is identical flag? */ - res->status = 0x20; - } - - return S_OK; -} - -static HRESULT sg_nfc_cmd_dummy( - struct sg_nfc *nfc, - const struct sg_req_header *req, - struct sg_res_header *res) -{ - sg_res_init(res, req, 0); - - return S_OK; -} +#include + +#include +#include +#include +#include +#include +#include + +#include "board/sg-cmd.h" +#include "board/sg-nfc.h" +#include "board/sg-nfc-cmd.h" + +#include "iccard/aime.h" +#include "iccard/felica.h" + +#include "util/dprintf.h" +#include "util/dump.h" + +static HRESULT sg_nfc_dispatch( + void *ctx, + const void *v_req, + void *v_res); + +static HRESULT sg_nfc_cmd_reset( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res); + +static HRESULT sg_nfc_cmd_get_fw_version( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_get_fw_version *res); + +static HRESULT sg_nfc_cmd_get_hw_version( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_get_hw_version *res); + +static HRESULT sg_nfc_cmd_poll( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_poll *res); + +static HRESULT sg_nfc_poll_aime( + struct sg_nfc *nfc, + struct sg_nfc_poll_mifare *mifare); + +static HRESULT sg_nfc_poll_felica( + struct sg_nfc *nfc, + struct sg_nfc_poll_felica *felica); + +static HRESULT sg_nfc_cmd_mifare_read_block( + struct sg_nfc *nfc, + const struct sg_nfc_req_mifare_read_block *req, + struct sg_nfc_res_mifare_read_block *res); + +static HRESULT sg_nfc_cmd_felica_encap( + struct sg_nfc *nfc, + const struct sg_nfc_req_felica_encap *req, + struct sg_nfc_res_felica_encap *res); + +static HRESULT sg_nfc_cmd_send_hex_data( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res); + +static HRESULT sg_nfc_cmd_dummy( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res); + +static const struct version_info hw_version[] = { + {"TN32MSEC003S H/W Ver3.0", 23}, + {"837-15286", 9}, + {"837-15396", 9} +}; + +static const struct version_info fw_version[] = { + {"TN32MSEC003S F/W Ver1.2", 23}, + {"\x94", 1}, + {"\x94", 1} +}; + +void sg_nfc_init( + struct sg_nfc *nfc, + uint8_t addr, + const struct sg_nfc_ops *ops, + unsigned int gen, + void *ops_ctx) +{ + assert(nfc != NULL); + assert(ops != NULL); + + nfc->ops = ops; + nfc->ops_ctx = ops_ctx; + nfc->addr = addr; + nfc->gen = gen; +} + +#ifdef NDEBUG +#define sg_nfc_dprintfv(nfc, fmt, ap) +#define sg_nfc_dprintf(nfc, fmt, ...) +#else +static void sg_nfc_dprintfv( + const struct sg_nfc *nfc, + const char *fmt, + va_list ap) +{ + dprintf("NFC %02x: ", nfc->addr); + dprintfv(fmt, ap); +} + +static void sg_nfc_dprintf( + const struct sg_nfc *nfc, + const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + sg_nfc_dprintfv(nfc, fmt, ap); + va_end(ap); +} +#endif + +void sg_nfc_transact( + struct sg_nfc *nfc, + struct iobuf *res_frame, + const void *req_bytes, + size_t req_nbytes) +{ + assert(nfc != NULL); + assert(res_frame != NULL); + assert(req_bytes != NULL); + + sg_req_transact(res_frame, req_bytes, req_nbytes, sg_nfc_dispatch, nfc); +} + +static HRESULT sg_nfc_dispatch( + void *ctx, + const void *v_req, + void *v_res) +{ + struct sg_nfc *nfc; + const union sg_nfc_req_any *req; + union sg_nfc_res_any *res; + + nfc = ctx; + req = v_req; + res = v_res; + + if (req->simple.hdr.addr != nfc->addr) { + /* Not addressed to us, don't send a response */ + return S_FALSE; + } + + switch (req->simple.hdr.cmd) { + case SG_NFC_CMD_RESET: + return sg_nfc_cmd_reset(nfc, &req->simple, &res->simple); + + case SG_NFC_CMD_GET_FW_VERSION: + return sg_nfc_cmd_get_fw_version( + nfc, + &req->simple, + &res->get_fw_version); + + case SG_NFC_CMD_GET_HW_VERSION: + return sg_nfc_cmd_get_hw_version( + nfc, + &req->simple, + &res->get_hw_version); + + case SG_NFC_CMD_POLL: + return sg_nfc_cmd_poll( + nfc, + &req->simple, + &res->poll); + + case SG_NFC_CMD_MIFARE_READ_BLOCK: + return sg_nfc_cmd_mifare_read_block( + nfc, + &req->mifare_read_block, + &res->mifare_read_block); + + case SG_NFC_CMD_FELICA_ENCAP: + return sg_nfc_cmd_felica_encap( + nfc, + &req->felica_encap, + &res->felica_encap); + + case SG_NFC_CMD_MIFARE_AUTHENTICATE_A: + case SG_NFC_CMD_SEND_HEX_DATA: + return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple); + + case SG_NFC_CMD_MIFARE_SELECT_TAG: + case SG_NFC_CMD_MIFARE_SET_KEY_A: + case SG_NFC_CMD_MIFARE_SET_KEY_B: + case SG_NFC_CMD_RADIO_ON: + case SG_NFC_CMD_RADIO_OFF: + case SG_NFC_CMD_TO_UPDATE_MODE: + return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple); + + default: + sg_nfc_dprintf(nfc, "Unimpl command %02x\n", req->simple.hdr.cmd); + + return E_NOTIMPL; + } +} + +static HRESULT sg_nfc_cmd_reset( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res) +{ + sg_nfc_dprintf(nfc, "Reset\n"); + sg_res_init(res, req, 0); + res->status = 3; + + return S_OK; +} + +static HRESULT sg_nfc_cmd_get_fw_version( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_get_fw_version *res) +{ + const struct version_info *fw = &fw_version[nfc->gen - 1]; + + /* Dest version is not NUL terminated, this is intentional */ + sg_res_init(&res->res, req, fw->length); + memcpy(res->version, fw->version, fw->length); + + return S_OK; +} + +static HRESULT sg_nfc_cmd_get_hw_version( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_get_hw_version *res) +{ + const struct version_info *hw = &hw_version[nfc->gen - 1]; + + /* Dest version is not NUL terminated, this is intentional */ + sg_res_init(&res->res, req, hw->length); + memcpy(res->version, hw->version, hw->length); + + return S_OK; +} + +static HRESULT sg_nfc_cmd_poll( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_nfc_res_poll *res) +{ + struct sg_nfc_poll_mifare mifare; + struct sg_nfc_poll_felica felica; + HRESULT hr; + + hr = nfc->ops->poll(nfc->ops_ctx); + + if (FAILED(hr)) { + return hr; + } + + hr = sg_nfc_poll_felica(nfc, &felica); + + if (SUCCEEDED(hr) && hr != S_FALSE) { + sg_res_init(&res->res, req, 1 + sizeof(felica)); + memcpy(res->payload, &felica, sizeof(felica)); + res->count = 1; + + return S_OK; + } + + hr = sg_nfc_poll_aime(nfc, &mifare); + + if (SUCCEEDED(hr) && hr != S_FALSE) { + sg_res_init(&res->res, req, 1 + sizeof(mifare)); + memcpy(res->payload, &mifare, sizeof(mifare)); + res->count = 1; + + return S_OK; + } + + sg_res_init(&res->res, req, 1); + res->count = 0; + + return S_OK; +} + +static HRESULT sg_nfc_poll_aime( + struct sg_nfc *nfc, + struct sg_nfc_poll_mifare *mifare) +{ + uint8_t luid[10]; + HRESULT hr; + + /* Call backend */ + + if (nfc->ops->get_aime_id != NULL) { + hr = nfc->ops->get_aime_id(nfc->ops_ctx, luid, sizeof(luid)); + } else { + hr = S_FALSE; + } + + if (FAILED(hr) || hr == S_FALSE) { + return hr; + } + + sg_nfc_dprintf(nfc, "AiMe card is present\n"); + + /* Construct response (use an arbitrary UID) */ + + mifare->type = 0x10; + mifare->id_len = sizeof(mifare->uid); + mifare->uid = _byteswap_ulong(0x01020304); + + /* Initialize MIFARE IC emulator */ + + hr = aime_card_populate(&nfc->mifare, luid, sizeof(luid)); + + if (FAILED(hr)) { + return hr; + } + + return S_OK; +} + +static HRESULT sg_nfc_poll_felica( + struct sg_nfc *nfc, + struct sg_nfc_poll_felica *felica) +{ + uint64_t IDm; + HRESULT hr; + + /* Call backend */ + + if (nfc->ops->get_felica_id != NULL) { + hr = nfc->ops->get_felica_id(nfc->ops_ctx, &IDm); + } else { + hr = S_FALSE; + } + + if (FAILED(hr) || hr == S_FALSE) { + return hr; + } + + sg_nfc_dprintf(nfc, "FeliCa card is present\n"); + + /* Construct poll response */ + + felica->type = 0x20; + felica->id_len = sizeof(felica->IDm) + sizeof(felica->PMm); + felica->IDm = _byteswap_uint64(IDm); + felica->PMm = _byteswap_uint64(felica_get_generic_PMm()); + + /* Initialize FeliCa IC emulator */ + + nfc->felica.IDm = IDm; + nfc->felica.PMm = felica_get_generic_PMm(); + nfc->felica.system_code = 0x0000; + + return S_OK; +} + +static HRESULT sg_nfc_cmd_mifare_read_block( + struct sg_nfc *nfc, + const struct sg_nfc_req_mifare_read_block *req, + struct sg_nfc_res_mifare_read_block *res) +{ + uint32_t uid; + + if (req->req.payload_len != sizeof(req->payload)) { + sg_nfc_dprintf(nfc, "%s: Payload size is incorrect\n", __func__); + + return E_FAIL; + } + + uid = _byteswap_ulong(req->payload.uid); + + sg_nfc_dprintf(nfc, "Read uid %08x block %i\n", uid, req->payload.block_no); + + if (req->payload.block_no > 3) { + sg_nfc_dprintf(nfc, "MIFARE block number out of range\n"); + + return E_FAIL; + } + + sg_res_init(&res->res, &req->req, sizeof(res->block)); + + memcpy( res->block, + nfc->mifare.sectors[0].blocks[req->payload.block_no].bytes, + sizeof(res->block)); + + return S_OK; +} + +static HRESULT sg_nfc_cmd_felica_encap( + struct sg_nfc *nfc, + const struct sg_nfc_req_felica_encap *req, + struct sg_nfc_res_felica_encap *res) +{ + struct const_iobuf f_req; + struct iobuf f_res; + HRESULT hr; + + /* First byte of encapsulated request and response is a length byte + (inclusive of itself). The FeliCa emulator expects its caller to handle + that length byte on its behalf (we adopt the convention that the length + byte is part of the FeliCa protocol's framing layer). */ + + if (req->req.payload_len != 8 + req->payload[0]) { + sg_nfc_dprintf( + nfc, + "FeliCa encap payload length mismatch: sg %i != felica %i + 8", + req->req.payload_len, + req->payload[0]); + + return E_FAIL; + } + + f_req.bytes = req->payload; + f_req.nbytes = req->payload[0]; + f_req.pos = 1; + + f_res.bytes = res->payload; + f_res.nbytes = sizeof(res->payload); + f_res.pos = 1; + +#if defined(LOG_NFC) + dprintf("FELICA OUTBOUND:\n"); + dump_const_iobuf(&f_req); +#endif + + hr = felica_transact(&nfc->felica, &f_req, &f_res); + + if (FAILED(hr)) { + return hr; + } + + sg_res_init(&res->res, &req->req, f_res.pos); + res->payload[0] = f_res.pos; + +#if defined(LOG_NFC) + dprintf("FELICA INBOUND:\n"); + dump_iobuf(&f_res); +#endif + + return S_OK; +} + +static HRESULT sg_nfc_cmd_send_hex_data( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res) +{ + sg_res_init(res, req, 0); + + /* Firmware checksum length? */ + if (req->payload_len == 0x2b) { + /* The firmware is identical flag? */ + res->status = 0x20; + } + + return S_OK; +} + +static HRESULT sg_nfc_cmd_dummy( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res) +{ + sg_res_init(res, req, 0); + + return S_OK; +} diff --git a/board/vfd-cmd.h b/board/vfd-cmd.h index 8ac63c0..28bcb16 100644 --- a/board/vfd-cmd.h +++ b/board/vfd-cmd.h @@ -1,123 +1,123 @@ -#pragma once - -#include "board/vfd-frame.h" - -enum { - VFD_CMD_GET_VERSION = 0x5B, - VFD_CMD_RESET = 0x0B, - VFD_CMD_CLEAR_SCREEN = 0x0C, - VFD_CMD_SET_BRIGHTNESS = 0x20, - VFD_CMD_SET_SCREEN_ON = 0x21, - VFD_CMD_SET_H_SCROLL = 0x22, - VFD_CMD_DRAW_IMAGE = 0x2E, - VFD_CMD_SET_CURSOR = 0x30, - VFD_CMD_SET_ENCODING = 0x32, - VFD_CMD_SET_TEXT_WND = 0x40, - VFD_CMD_SET_TEXT_SPEED = 0x41, - VFD_CMD_WRITE_TEXT = 0x50, - VFD_CMD_ENABLE_SCROLL = 0x51, - VFD_CMD_DISABLE_SCROLL = 0x52, - VFD_CMD_ROTATE = 0x5D, - VFD_CMD_CREATE_CHAR = 0xA3, - VFD_CMD_CREATE_CHAR2 = 0xA4, -}; - -enum { - VFD_ENC_GB2312 = 0, - VFD_ENC_BIG5 = 1, - VFD_ENC_SHIFT_JIS = 2, - VFD_ENC_KSC5601 = 3, - VFD_ENC_MAX = 3, -}; - -struct vfd_req_hdr { - uint8_t sync; - uint8_t cmd; -}; - -struct vfd_req_any { - struct vfd_req_hdr hdr; - uint8_t payload[2054]; -}; - -struct vfd_req_board_info { - struct vfd_req_hdr hdr; - uint8_t unk1; -}; - -struct vfd_resp_board_info { // \x0201.20\x03 - uint8_t unk1; - char version[5]; - uint8_t unk2; -}; - -struct vfd_req_reset { - struct vfd_req_hdr hdr; -}; - -struct vfd_req_cls { - struct vfd_req_hdr hdr; -}; - -struct vfd_req_brightness { - struct vfd_req_hdr hdr; - uint8_t brightness; -}; - -struct vfd_req_power { - struct vfd_req_hdr hdr; - uint8_t power_state; -}; - -struct vfd_req_hscroll { - struct vfd_req_hdr hdr; - uint8_t x_pos; -}; - -struct vfd_req_draw { - struct vfd_req_hdr hdr; - uint16_t x0; - uint8_t y0; - uint16_t x1; - uint8_t y1; - uint8_t image[2048]; -}; - -struct vfd_req_cursor { - struct vfd_req_hdr hdr; - uint16_t x; - uint8_t y; -}; - -struct vfd_req_encoding { - struct vfd_req_hdr hdr; - uint8_t encoding; -}; - -struct vfd_req_wnd { - struct vfd_req_hdr hdr; - uint16_t x0; - uint8_t y0; - uint16_t x1; - uint8_t y1; -}; - -struct vfd_req_speed { - struct vfd_req_hdr hdr; - uint8_t encoding; -}; - -struct vfd_req_scroll { - struct vfd_req_hdr hdr; -}; - -struct vfd_req_rotate { - struct vfd_req_hdr hdr; - uint8_t unk1; -}; - -struct vfd_req_create_char { - struct vfd_req_hdr hdr; - uint8_t type; - uint8_t pixels[32]; -}; +#pragma once + +#include "board/vfd-frame.h" + +enum { + VFD_CMD_GET_VERSION = 0x5B, + VFD_CMD_RESET = 0x0B, + VFD_CMD_CLEAR_SCREEN = 0x0C, + VFD_CMD_SET_BRIGHTNESS = 0x20, + VFD_CMD_SET_SCREEN_ON = 0x21, + VFD_CMD_SET_H_SCROLL = 0x22, + VFD_CMD_DRAW_IMAGE = 0x2E, + VFD_CMD_SET_CURSOR = 0x30, + VFD_CMD_SET_ENCODING = 0x32, + VFD_CMD_SET_TEXT_WND = 0x40, + VFD_CMD_SET_TEXT_SPEED = 0x41, + VFD_CMD_WRITE_TEXT = 0x50, + VFD_CMD_ENABLE_SCROLL = 0x51, + VFD_CMD_DISABLE_SCROLL = 0x52, + VFD_CMD_ROTATE = 0x5D, + VFD_CMD_CREATE_CHAR = 0xA3, + VFD_CMD_CREATE_CHAR2 = 0xA4, +}; + +enum { + VFD_ENC_GB2312 = 0, + VFD_ENC_BIG5 = 1, + VFD_ENC_SHIFT_JIS = 2, + VFD_ENC_KSC5601 = 3, + VFD_ENC_MAX = 3, +}; + +struct vfd_req_hdr { + uint8_t sync; + uint8_t cmd; +}; + +struct vfd_req_any { + struct vfd_req_hdr hdr; + uint8_t payload[2054]; +}; + +struct vfd_req_board_info { + struct vfd_req_hdr hdr; + uint8_t unk1; +}; + +struct vfd_resp_board_info { // \x0201.20\x03 + uint8_t unk1; + char version[5]; + uint8_t unk2; +}; + +struct vfd_req_reset { + struct vfd_req_hdr hdr; +}; + +struct vfd_req_cls { + struct vfd_req_hdr hdr; +}; + +struct vfd_req_brightness { + struct vfd_req_hdr hdr; + uint8_t brightness; +}; + +struct vfd_req_power { + struct vfd_req_hdr hdr; + uint8_t power_state; +}; + +struct vfd_req_hscroll { + struct vfd_req_hdr hdr; + uint8_t x_pos; +}; + +struct vfd_req_draw { + struct vfd_req_hdr hdr; + uint16_t x0; + uint8_t y0; + uint16_t x1; + uint8_t y1; + uint8_t image[2048]; +}; + +struct vfd_req_cursor { + struct vfd_req_hdr hdr; + uint16_t x; + uint8_t y; +}; + +struct vfd_req_encoding { + struct vfd_req_hdr hdr; + uint8_t encoding; +}; + +struct vfd_req_wnd { + struct vfd_req_hdr hdr; + uint16_t x0; + uint8_t y0; + uint16_t x1; + uint8_t y1; +}; + +struct vfd_req_speed { + struct vfd_req_hdr hdr; + uint8_t encoding; +}; + +struct vfd_req_scroll { + struct vfd_req_hdr hdr; +}; + +struct vfd_req_rotate { + struct vfd_req_hdr hdr; + uint8_t unk1; +}; + +struct vfd_req_create_char { + struct vfd_req_hdr hdr; + uint8_t type; + uint8_t pixels[32]; +}; diff --git a/board/vfd-frame.c b/board/vfd-frame.c index 0d61ef6..05fe302 100644 --- a/board/vfd-frame.c +++ b/board/vfd-frame.c @@ -1,88 +1,88 @@ -#include - -#include -#include -#include -#include - -#define SUPER_VERBOSE 1 - -#include "board/vfd-frame.h" - -#include "hook/iobuf.h" - -#include "util/dprintf.h" - -static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte); - -/* Frame structure: - - REQUEST: - [0] Sync byte (0x1A or 0x1B) - [1] Packet ID - [2...n-1] Data/payload - - --- OR --- - - if no sync byte is given, plain static text in the currently configured encoding is expected. - - RESPONSE: - This thing never responds, unless it's VFD_CMD_GET_VERSION - */ - -bool vfd_frame_sync(struct const_iobuf *src) { - return src->bytes[src->pos] == VFD_SYNC_BYTE || src->bytes[src->pos] == VFD_SYNC_BYTE2; -} - -HRESULT vfd_frame_encode( - struct iobuf *dest, - const void *ptr, - size_t nbytes) { - const uint8_t *src; - uint8_t byte; - size_t i; - HRESULT hr; - - assert(dest != NULL); - assert(dest->bytes != NULL || dest->nbytes == 0); - assert(dest->pos <= dest->nbytes); - assert(ptr != NULL); - - src = ptr; - - if (dest->pos >= dest->nbytes) { - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - -#if SUPER_VERBOSE - dprintf("VFD: RX Buffer:\n"); -#endif - - for (i = 1; i < nbytes; i++) { - byte = src[i]; -#if SUPER_VERBOSE - dprintf("%02x ", byte); -#endif - - hr = vfd_frame_encode_byte(dest, byte); - - if (FAILED(hr)) { - return hr; - } - } -#if SUPER_VERBOSE - dprintf("\n"); -#endif - - return hr; -} - -static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte) { - if (dest->pos + 1 > dest->nbytes) { - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - - dest->bytes[dest->pos++] = byte; - - return S_OK; -} +#include + +#include +#include +#include +#include + +#define SUPER_VERBOSE 1 + +#include "board/vfd-frame.h" + +#include "hook/iobuf.h" + +#include "util/dprintf.h" + +static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte); + +/* Frame structure: + + REQUEST: + [0] Sync byte (0x1A or 0x1B) + [1] Packet ID + [2...n-1] Data/payload + + --- OR --- + + if no sync byte is given, plain static text in the currently configured encoding is expected. + + RESPONSE: + This thing never responds, unless it's VFD_CMD_GET_VERSION + */ + +bool vfd_frame_sync(struct const_iobuf *src) { + return src->bytes[src->pos] == VFD_SYNC_BYTE || src->bytes[src->pos] == VFD_SYNC_BYTE2; +} + +HRESULT vfd_frame_encode( + struct iobuf *dest, + const void *ptr, + size_t nbytes) { + const uint8_t *src; + uint8_t byte; + size_t i; + HRESULT hr; + + assert(dest != NULL); + assert(dest->bytes != NULL || dest->nbytes == 0); + assert(dest->pos <= dest->nbytes); + assert(ptr != NULL); + + src = ptr; + + if (dest->pos >= dest->nbytes) { + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + } + +#if SUPER_VERBOSE + dprintf("VFD: RX Buffer:\n"); +#endif + + for (i = 1; i < nbytes; i++) { + byte = src[i]; +#if SUPER_VERBOSE + dprintf("%02x ", byte); +#endif + + hr = vfd_frame_encode_byte(dest, byte); + + if (FAILED(hr)) { + return hr; + } + } +#if SUPER_VERBOSE + dprintf("\n"); +#endif + + return hr; +} + +static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte) { + if (dest->pos + 1 > dest->nbytes) { + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + } + + dest->bytes[dest->pos++] = byte; + + return S_OK; +} diff --git a/board/vfd-frame.h b/board/vfd-frame.h index 4aab162..7055f5b 100644 --- a/board/vfd-frame.h +++ b/board/vfd-frame.h @@ -1,20 +1,20 @@ -#pragma once - -#include - -#include -#include - -#include "hook/iobuf.h" - -enum { - VFD_SYNC_BYTE = 0x1B, - VFD_SYNC_BYTE2 = 0x1A, -}; - -bool vfd_frame_sync(struct const_iobuf *src); - -HRESULT vfd_frame_encode( - struct iobuf *dest, - const void *ptr, - size_t nbytes); +#pragma once + +#include + +#include +#include + +#include "hook/iobuf.h" + +enum { + VFD_SYNC_BYTE = 0x1B, + VFD_SYNC_BYTE2 = 0x1A, +}; + +bool vfd_frame_sync(struct const_iobuf *src); + +HRESULT vfd_frame_encode( + struct iobuf *dest, + const void *ptr, + size_t nbytes); diff --git a/board/vfd.c b/board/vfd.c index 0eecc68..abc487a 100644 --- a/board/vfd.c +++ b/board/vfd.c @@ -1,398 +1,398 @@ -/* This is some sort of LCD display found on various cabinets. It is driven - directly by amdaemon, and it has something to do with displaying the status - of electronic payments. - - Part number in schematics is "VFD GP1232A02A FUTABA". */ - -#include - -#include -#include - -#include "board/config.h" -#include "board/vfd.h" -#include "board/vfd-cmd.h" - -#include "hook/iohook.h" - -#include "hooklib/uart.h" - -#include "util/dprintf.h" -#include "util/dump.h" - -#define SUPER_VERBOSE 0 - -static HRESULT vfd_handle_irp(struct irp *irp); - -static struct uart vfd_uart; -static uint8_t vfd_written[4096]; -static uint8_t vfd_readable[4096]; - -static int encoding = VFD_ENC_SHIFT_JIS; - -HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); -HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); - -static bool utf_enabled; - -HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port) -{ - if (!cfg->enable){ - return S_FALSE; - } - - utf_enabled = cfg->utf_conversion; - - int port = cfg->port; - if (port == 0){ - port = default_port; - } - - dprintf("VFD: enabling (port=%d)\n", port); - uart_init(&vfd_uart, port); - vfd_uart.written.bytes = vfd_written; - vfd_uart.written.nbytes = sizeof(vfd_written); - vfd_uart.readable.bytes = vfd_readable; - vfd_uart.readable.nbytes = sizeof(vfd_readable); - - return iohook_push_handler(vfd_handle_irp); -} - - -const char* get_encoding_name(int b){ - switch (b){ - case 0: return "gb2312"; - case 1: return "big5"; - case 2: return "shift-jis"; - case 3: return "ks_c_5601-1987"; - default: return "unknown"; - } -} - -void print_vfd_text(const char* str, int len){ - - if (utf_enabled){ - - wchar_t encoded[1024]; - memset(encoded, 0, 1024 * sizeof(wchar_t)); - - int codepage = 0; - if (encoding == VFD_ENC_GB2312){ - codepage = 936; - } else if (encoding == VFD_ENC_BIG5){ - codepage = 950; - } else if (encoding == VFD_ENC_SHIFT_JIS){ - codepage = 932; - } else if (encoding == VFD_ENC_KSC5601) { - codepage = 949; - } - - if (!MultiByteToWideChar(codepage, MB_USEGLYPHCHARS, str, len, encoded, 1024)){ - dprintf("VFD: Text conversion failed: %ld", GetLastError()); - return; - } - - dprintf("VFD: Text: %ls\n", encoded); - } else { - - dprintf("VFD: Text: %s\n", str); - - } -} - -static HRESULT vfd_handle_irp(struct irp *irp) -{ - HRESULT hr; - - assert(irp != NULL); - - if (!uart_match_irp(&vfd_uart, irp)) { - return iohook_invoke_next(irp); - } - - if (irp->op == IRP_OP_OPEN){ - dprintf("VFD: Open\n"); - } else if (irp->op == IRP_OP_CLOSE){ - dprintf("VFD: Close\n"); - } - - hr = uart_handle_irp(&vfd_uart, irp); - - if (FAILED(hr) || irp->op != IRP_OP_WRITE) { - return hr; - } - -#if SUPER_VERBOSE - dprintf("VFD TX:\n"); - dump_iobuf(&vfd_uart.written); -#endif - - struct const_iobuf reader; - iobuf_flip(&reader, &vfd_uart.written); - - struct iobuf* writer = &vfd_uart.readable; - for (; reader.pos < reader.nbytes ; ){ - - if (vfd_frame_sync(&reader)) { - - reader.pos++; // get the sync byte out of the way - - uint8_t cmd; - iobuf_read_8(&reader, &cmd); - - if (cmd == VFD_CMD_GET_VERSION) { - hr = vfd_handle_get_version(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_RESET) { - hr = vfd_handle_reset(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_CLEAR_SCREEN) { - hr = vfd_handle_clear_screen(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_BRIGHTNESS) { - hr = vfd_handle_set_brightness(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_SCREEN_ON) { - hr = vfd_handle_set_screen_on(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_H_SCROLL) { - hr = vfd_handle_set_h_scroll(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_DRAW_IMAGE) { - hr = vfd_handle_draw_image(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_CURSOR) { - hr = vfd_handle_set_cursor(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_ENCODING) { - hr = vfd_handle_set_encoding(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_TEXT_WND) { - hr = vfd_handle_set_text_wnd(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_SET_TEXT_SPEED) { - hr = vfd_handle_set_text_speed(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_WRITE_TEXT) { - hr = vfd_handle_write_text(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_ENABLE_SCROLL) { - hr = vfd_handle_enable_scroll(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_DISABLE_SCROLL) { - hr = vfd_handle_disable_scroll(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_ROTATE) { - hr = vfd_handle_rotate(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_CREATE_CHAR) { - hr = vfd_handle_create_char(&reader, writer, &vfd_uart); - } else if (cmd == VFD_CMD_CREATE_CHAR2) { - hr = vfd_handle_create_char2(&reader, writer, &vfd_uart); - } else { - dprintf("VFD: Unknown command 0x%x\n", cmd); - dump_const_iobuf(&reader); - hr = S_FALSE; - } - } else { - - // if no sync byte is sent, we are just getting plain text... - - if (reader.pos < reader.nbytes){ - int len = 0; - - // read chars until we hit a new sync byte or the data ends - while (reader.pos + len + 1 < reader.nbytes && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE2){ - len++; - } - - char* str = malloc(len); - memset(str, 0, len); - iobuf_read(&reader, str, len); - print_vfd_text(str, len); - free(str); - - reader.pos += len; - } - - } - - if (!SUCCEEDED(hr)){ - return hr; - } - - } - - vfd_uart.written.pos = 0; - - return hr; -} - -HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - dprintf("VFD: Get Version\n"); - - struct vfd_resp_board_info resp; - - memset(&resp, 0, sizeof(resp)); - resp.unk1 = 2; - strcpy(resp.version, "01.20"); - resp.unk2 = 1; - - return vfd_frame_encode(writer, &resp, sizeof(resp)); -} -HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - dprintf("VFD: Reset\n"); - - encoding = VFD_ENC_SHIFT_JIS; - - return S_FALSE; -} -HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - dprintf("VFD: Clear Screen\n"); - - return S_FALSE; -} -HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - - if (b > 4){ - dprintf("VFD: Brightness, invalid argument\n"); - return E_FAIL; - } - - dprintf("VFD: Brightness, %d\n", b); - - return S_FALSE; -} -HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - - if (b > 1){ - dprintf("VFD: Screen Power, invalid argument\n"); - return E_FAIL; - } - - dprintf("VFD: Screen Power, %d\n", b); - return S_FALSE; -} -HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t x; - iobuf_read_8(reader, &x); - - dprintf("VFD: Horizontal Scroll, X=%d\n", x); - return S_FALSE; -} -HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - int w, h; - uint16_t x0, x1; - uint8_t y0, y1; - uint8_t image[2048]; - - iobuf_read_be16(reader, &x0); - iobuf_read_8(reader, &y0); - iobuf_read_be16(reader, &x1); - iobuf_read_8(reader, &y1); - w = x1 - x0; - h = y1 - y0; - iobuf_read(reader, image, w*h); - - dprintf("VFD: Draw image, %dx%d\n", w, h); - return S_FALSE; -} - -HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint16_t x; - uint8_t y; - - iobuf_read_be16(reader, &x); - iobuf_read_8(reader, &y); - - dprintf("VFD: Set Cursor, x=%d,y=%d\n", x, y); - - return S_FALSE; -} - -HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - - dprintf("VFD: Set Encoding, %d (%s)\n", b, get_encoding_name(b)); - - if (b < 0 || b > VFD_ENC_MAX){ - dprintf("Invalid encoding specified\n"); - return E_FAIL; - } - - encoding = b; - - return S_FALSE; -} -HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint16_t x0, x1; - uint8_t y0, y1; - - iobuf_read_be16(reader, &x0); - iobuf_read_8(reader, &y0); - iobuf_read_be16(reader, &x1); - iobuf_read_8(reader, &y1); - - dprintf("VFD: Set Text Window, p0:%d,%d, p1:%d,%d\n", x0, y0, x1, y1); - return S_FALSE; -} -HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - - dprintf("VFD: Set Text Speed, %d\n", b); - return S_FALSE; -} -HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t len; - iobuf_read_8(reader, &len); - - char* str = malloc(len); - iobuf_read(reader, str, len); - - print_vfd_text(str, len); - free(str); - - return S_FALSE; -} -HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - dprintf("VFD: Enable Scrolling\n"); - return S_FALSE; -} -HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - dprintf("VFD: Disable Scrolling\n"); - return S_FALSE; -} -HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - - dprintf("VFD: Rotate, %d\n", b); - return S_FALSE; -} -HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b; - iobuf_read_8(reader, &b); - char buf[32]; - - iobuf_read(reader, buf, 32); - - dprintf("VFD: Create character, %d\n", b); - return S_FALSE; -} -HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ - uint8_t b, b2; - iobuf_read_8(reader, &b); - iobuf_read_8(reader, &b2); - char buf[16]; - - iobuf_read(reader, buf, 16); - - dprintf("VFD: Create character, %d, %d\n", b, b2); - return S_FALSE; -} +/* This is some sort of LCD display found on various cabinets. It is driven + directly by amdaemon, and it has something to do with displaying the status + of electronic payments. + + Part number in schematics is "VFD GP1232A02A FUTABA". */ + +#include + +#include +#include + +#include "board/config.h" +#include "board/vfd.h" +#include "board/vfd-cmd.h" + +#include "hook/iohook.h" + +#include "hooklib/uart.h" + +#include "util/dprintf.h" +#include "util/dump.h" + +#define SUPER_VERBOSE 0 + +static HRESULT vfd_handle_irp(struct irp *irp); + +static struct uart vfd_uart; +static uint8_t vfd_written[4096]; +static uint8_t vfd_readable[4096]; + +static int encoding = VFD_ENC_SHIFT_JIS; + +HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); +HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart); + +static bool utf_enabled; + +HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port) +{ + if (!cfg->enable){ + return S_FALSE; + } + + utf_enabled = cfg->utf_conversion; + + int port = cfg->port; + if (port == 0){ + port = default_port; + } + + dprintf("VFD: enabling (port=%d)\n", port); + uart_init(&vfd_uart, port); + vfd_uart.written.bytes = vfd_written; + vfd_uart.written.nbytes = sizeof(vfd_written); + vfd_uart.readable.bytes = vfd_readable; + vfd_uart.readable.nbytes = sizeof(vfd_readable); + + return iohook_push_handler(vfd_handle_irp); +} + + +const char* get_encoding_name(int b){ + switch (b){ + case 0: return "gb2312"; + case 1: return "big5"; + case 2: return "shift-jis"; + case 3: return "ks_c_5601-1987"; + default: return "unknown"; + } +} + +void print_vfd_text(const char* str, int len){ + + if (utf_enabled){ + + wchar_t encoded[1024]; + memset(encoded, 0, 1024 * sizeof(wchar_t)); + + int codepage = 0; + if (encoding == VFD_ENC_GB2312){ + codepage = 936; + } else if (encoding == VFD_ENC_BIG5){ + codepage = 950; + } else if (encoding == VFD_ENC_SHIFT_JIS){ + codepage = 932; + } else if (encoding == VFD_ENC_KSC5601) { + codepage = 949; + } + + if (!MultiByteToWideChar(codepage, MB_USEGLYPHCHARS, str, len, encoded, 1024)){ + dprintf("VFD: Text conversion failed: %ld", GetLastError()); + return; + } + + dprintf("VFD: Text: %ls\n", encoded); + } else { + + dprintf("VFD: Text: %s\n", str); + + } +} + +static HRESULT vfd_handle_irp(struct irp *irp) +{ + HRESULT hr; + + assert(irp != NULL); + + if (!uart_match_irp(&vfd_uart, irp)) { + return iohook_invoke_next(irp); + } + + if (irp->op == IRP_OP_OPEN){ + dprintf("VFD: Open\n"); + } else if (irp->op == IRP_OP_CLOSE){ + dprintf("VFD: Close\n"); + } + + hr = uart_handle_irp(&vfd_uart, irp); + + if (FAILED(hr) || irp->op != IRP_OP_WRITE) { + return hr; + } + +#if SUPER_VERBOSE + dprintf("VFD TX:\n"); + dump_iobuf(&vfd_uart.written); +#endif + + struct const_iobuf reader; + iobuf_flip(&reader, &vfd_uart.written); + + struct iobuf* writer = &vfd_uart.readable; + for (; reader.pos < reader.nbytes ; ){ + + if (vfd_frame_sync(&reader)) { + + reader.pos++; // get the sync byte out of the way + + uint8_t cmd; + iobuf_read_8(&reader, &cmd); + + if (cmd == VFD_CMD_GET_VERSION) { + hr = vfd_handle_get_version(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_RESET) { + hr = vfd_handle_reset(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_CLEAR_SCREEN) { + hr = vfd_handle_clear_screen(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_BRIGHTNESS) { + hr = vfd_handle_set_brightness(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_SCREEN_ON) { + hr = vfd_handle_set_screen_on(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_H_SCROLL) { + hr = vfd_handle_set_h_scroll(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_DRAW_IMAGE) { + hr = vfd_handle_draw_image(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_CURSOR) { + hr = vfd_handle_set_cursor(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_ENCODING) { + hr = vfd_handle_set_encoding(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_TEXT_WND) { + hr = vfd_handle_set_text_wnd(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_SET_TEXT_SPEED) { + hr = vfd_handle_set_text_speed(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_WRITE_TEXT) { + hr = vfd_handle_write_text(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_ENABLE_SCROLL) { + hr = vfd_handle_enable_scroll(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_DISABLE_SCROLL) { + hr = vfd_handle_disable_scroll(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_ROTATE) { + hr = vfd_handle_rotate(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_CREATE_CHAR) { + hr = vfd_handle_create_char(&reader, writer, &vfd_uart); + } else if (cmd == VFD_CMD_CREATE_CHAR2) { + hr = vfd_handle_create_char2(&reader, writer, &vfd_uart); + } else { + dprintf("VFD: Unknown command 0x%x\n", cmd); + dump_const_iobuf(&reader); + hr = S_FALSE; + } + } else { + + // if no sync byte is sent, we are just getting plain text... + + if (reader.pos < reader.nbytes){ + int len = 0; + + // read chars until we hit a new sync byte or the data ends + while (reader.pos + len + 1 < reader.nbytes && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE2){ + len++; + } + + char* str = malloc(len); + memset(str, 0, len); + iobuf_read(&reader, str, len); + print_vfd_text(str, len); + free(str); + + reader.pos += len; + } + + } + + if (!SUCCEEDED(hr)){ + return hr; + } + + } + + vfd_uart.written.pos = 0; + + return hr; +} + +HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + dprintf("VFD: Get Version\n"); + + struct vfd_resp_board_info resp; + + memset(&resp, 0, sizeof(resp)); + resp.unk1 = 2; + strcpy(resp.version, "01.20"); + resp.unk2 = 1; + + return vfd_frame_encode(writer, &resp, sizeof(resp)); +} +HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + dprintf("VFD: Reset\n"); + + encoding = VFD_ENC_SHIFT_JIS; + + return S_FALSE; +} +HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + dprintf("VFD: Clear Screen\n"); + + return S_FALSE; +} +HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + + if (b > 4){ + dprintf("VFD: Brightness, invalid argument\n"); + return E_FAIL; + } + + dprintf("VFD: Brightness, %d\n", b); + + return S_FALSE; +} +HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + + if (b > 1){ + dprintf("VFD: Screen Power, invalid argument\n"); + return E_FAIL; + } + + dprintf("VFD: Screen Power, %d\n", b); + return S_FALSE; +} +HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t x; + iobuf_read_8(reader, &x); + + dprintf("VFD: Horizontal Scroll, X=%d\n", x); + return S_FALSE; +} +HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + int w, h; + uint16_t x0, x1; + uint8_t y0, y1; + uint8_t image[2048]; + + iobuf_read_be16(reader, &x0); + iobuf_read_8(reader, &y0); + iobuf_read_be16(reader, &x1); + iobuf_read_8(reader, &y1); + w = x1 - x0; + h = y1 - y0; + iobuf_read(reader, image, w*h); + + dprintf("VFD: Draw image, %dx%d\n", w, h); + return S_FALSE; +} + +HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint16_t x; + uint8_t y; + + iobuf_read_be16(reader, &x); + iobuf_read_8(reader, &y); + + dprintf("VFD: Set Cursor, x=%d,y=%d\n", x, y); + + return S_FALSE; +} + +HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + + dprintf("VFD: Set Encoding, %d (%s)\n", b, get_encoding_name(b)); + + if (b < 0 || b > VFD_ENC_MAX){ + dprintf("Invalid encoding specified\n"); + return E_FAIL; + } + + encoding = b; + + return S_FALSE; +} +HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint16_t x0, x1; + uint8_t y0, y1; + + iobuf_read_be16(reader, &x0); + iobuf_read_8(reader, &y0); + iobuf_read_be16(reader, &x1); + iobuf_read_8(reader, &y1); + + dprintf("VFD: Set Text Window, p0:%d,%d, p1:%d,%d\n", x0, y0, x1, y1); + return S_FALSE; +} +HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + + dprintf("VFD: Set Text Speed, %d\n", b); + return S_FALSE; +} +HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t len; + iobuf_read_8(reader, &len); + + char* str = malloc(len); + iobuf_read(reader, str, len); + + print_vfd_text(str, len); + free(str); + + return S_FALSE; +} +HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + dprintf("VFD: Enable Scrolling\n"); + return S_FALSE; +} +HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + dprintf("VFD: Disable Scrolling\n"); + return S_FALSE; +} +HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + + dprintf("VFD: Rotate, %d\n", b); + return S_FALSE; +} +HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b; + iobuf_read_8(reader, &b); + char buf[32]; + + iobuf_read(reader, buf, 32); + + dprintf("VFD: Create character, %d\n", b); + return S_FALSE; +} +HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ + uint8_t b, b2; + iobuf_read_8(reader, &b); + iobuf_read_8(reader, &b2); + char buf[16]; + + iobuf_read(reader, buf, 16); + + dprintf("VFD: Create character, %d, %d\n", b, b2); + return S_FALSE; +} diff --git a/board/vfd.h b/board/vfd.h index fdfa7e1..3e67061 100644 --- a/board/vfd.h +++ b/board/vfd.h @@ -1,13 +1,13 @@ -#pragma once - -#include - -struct vfd_config { - bool enable; - int port; - bool utf_conversion; -}; - - -HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port); - +#pragma once + +#include + +struct vfd_config { + bool enable; + int port; + bool utf_conversion; +}; + + +HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port); + diff --git a/dist/apm3/start.bat b/dist/apm3/start.bat index 0ddfa0c..f7672d8 100644 --- a/dist/apm3/start.bat +++ b/dist/apm3/start.bat @@ -8,5 +8,4 @@ inject -d -k apm3hook.dll Apmv3System.exe -screen-fullscreen 0 -popupwindow -scr taskkill /f /im amdaemonD.exe > nul 2>&1 echo. -echo Game processes have terminated -pause \ No newline at end of file +echo Game processes have terminated \ No newline at end of file diff --git a/dist/chusan/segatools.ini b/dist/chusan/segatools.ini index 84d0119..ee3af18 100644 --- a/dist/chusan/segatools.ini +++ b/dist/chusan/segatools.ini @@ -1,206 +1,206 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt -; Enable high baud rate. -;highBaud=1 - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; Chunithm is extremely picky about its LAN environment, so leaving this -; setting enabled is strongly recommended. -enable=1 - -; The final octet of the local host's IP address on the virtualized subnet (so, -; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -; local host's virtualized LAN IP is `192.168.32.11`). -addrSuffix=11 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.139.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; LAN Install: If multiple machines are present on the same LAN then set -; this to 1 on exactly one machine and set this to 0 on all others. -dipsw1=1 -; Monitor type: 0 = 120FPS, 1 = 60FPS -dipsw2=1 -; Cab type: 0 = SP, 1 = CVT. SP will enable VFD and eMoney. This setting will switch -; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well. -dipsw3=1 - -; ----------------------------------------------------------------------------- -; Misc. hooks settings -; ----------------------------------------------------------------------------- - -[gfx] -; Force the game to run windowed. -windowed=1 -; Add a frame to the game window if running windowed. -framed=0 -; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen) -monitor=0 - -; ----------------------------------------------------------------------------- -; LED settings -; ----------------------------------------------------------------------------- - -[led15093] -; Enable emulation of the 15093-06 controlled lights, which handle the air tower -; RGBs and the rear LED panel (billboard) on the cabinet. -enable=1 - -[led] -; Output billboard LED strip data to a named pipe called "\\.\pipe\chuni_led" -cabLedOutputPipe=1 -; Output billboard LED strip data to serial -cabLedOutputSerial=0 - -; Output slider LED data to the named pipe -controllerLedOutputPipe=1 -; Output slider LED data to the serial port -controllerLedOutputSerial=0 -; Use the OpeNITHM protocol for serial LED output -controllerLedOutputOpeNITHM=0 - -; Serial port to send data to if using serial output. Default is COM5. -;serialPort=COM5 -; Baud rate for serial data (set to 115200 if using OpeNITHM) -;serialBaud=921600 - -; Data output a sequence of bytes, with JVS-like framing. -; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, -; 0xD0 is used as an escape character -- if you receive D0 in the output, ignore -; it and use the next sent byte plus one instead. -; -; After the sync is one byte for the board number that was updated, followed by -; the red, green and blue values for each LED. -; -; Board 0 has 53 LEDs: -; [0]-[49]: snakes through left half of billboard (first column starts at top) -; [50]-[52]: left side partition LEDs -; -; Board 1 has 63 LEDs: -; [0]-[59]: right half of billboard (first column starts at bottom) -; [60]-[62]: right side partition LEDs -; -; Board 2 is the slider and has 31 LEDs: -; [0]-[31]: slider LEDs right to left BRG, alternating between keys and dividers - - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL (x64) enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[chuniio] -; Uncomment this if you have custom chuniio implementation comprised of a single 32bit DLL. -; (will use chu2to3 engine internally) -;path= - -; Uncomment both of these if you have custom chuniio implementation comprised of two DLLs. -; x86 chuniio to path32, x64 to path64. Both are necessary. -;path32= -;path64= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io3] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 -; Set to 0 for enable separate ir control. Deafult is space key. -ir=0x20 - -[ir] -; Uncomment and complete the following sequence of settings to configure a -; custom ir-cappable controller if you have one. -;ir6=0x53 -; ... etc ... -;ir1=0x53 - -[slider] -; Enable slider emulation. If you have real AC slider, set this to 0. -; Slider serial port must be COM1. -;enable=1 - -; Key bindings for each of the 32 touch cells. The default key map, depicted -; in left-to-right order, is as follows: -; -; SSSSDDDDFFFFGGGGHHHHJJJJKKKKLLLL -; -; Touch cells are numbered FROM RIGHT TO LEFT! starting from 1. This is in -; order to match the numbering used in the operator menu and service manual. -; -; Uncomment and complete the following sequence of settings to configure a -; custom high-precision touch strip controller if you have one. -;cell1=0x53 -;cell2=0x53 -; ... etc ... -;cell31=0x53 -;cell32=0x53 +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt +; Enable high baud rate. +;highBaud=1 + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; Chunithm is extremely picky about its LAN environment, so leaving this +; setting enabled is strongly recommended. +enable=1 + +; The final octet of the local host's IP address on the virtualized subnet (so, +; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +; local host's virtualized LAN IP is `192.168.32.11`). +addrSuffix=11 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.139.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; LAN Install: If multiple machines are present on the same LAN then set +; this to 1 on exactly one machine and set this to 0 on all others. +dipsw1=1 +; Monitor type: 0 = 120FPS, 1 = 60FPS +dipsw2=1 +; Cab type: 0 = SP, 1 = CVT. SP will enable VFD and eMoney. This setting will switch +; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well. +dipsw3=1 + +; ----------------------------------------------------------------------------- +; Misc. hooks settings +; ----------------------------------------------------------------------------- + +[gfx] +; Force the game to run windowed. +windowed=1 +; Add a frame to the game window if running windowed. +framed=0 +; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen) +monitor=0 + +; ----------------------------------------------------------------------------- +; LED settings +; ----------------------------------------------------------------------------- + +[led15093] +; Enable emulation of the 15093-06 controlled lights, which handle the air tower +; RGBs and the rear LED panel (billboard) on the cabinet. +enable=1 + +[led] +; Output billboard LED strip data to a named pipe called "\\.\pipe\chuni_led" +cabLedOutputPipe=1 +; Output billboard LED strip data to serial +cabLedOutputSerial=0 + +; Output slider LED data to the named pipe +controllerLedOutputPipe=1 +; Output slider LED data to the serial port +controllerLedOutputSerial=0 +; Use the OpeNITHM protocol for serial LED output +controllerLedOutputOpeNITHM=0 + +; Serial port to send data to if using serial output. Default is COM5. +;serialPort=COM5 +; Baud rate for serial data (set to 115200 if using OpeNITHM) +;serialBaud=921600 + +; Data output a sequence of bytes, with JVS-like framing. +; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, +; 0xD0 is used as an escape character -- if you receive D0 in the output, ignore +; it and use the next sent byte plus one instead. +; +; After the sync is one byte for the board number that was updated, followed by +; the red, green and blue values for each LED. +; +; Board 0 has 53 LEDs: +; [0]-[49]: snakes through left half of billboard (first column starts at top) +; [50]-[52]: left side partition LEDs +; +; Board 1 has 63 LEDs: +; [0]-[59]: right half of billboard (first column starts at bottom) +; [60]-[62]: right side partition LEDs +; +; Board 2 is the slider and has 31 LEDs: +; [0]-[31]: slider LEDs right to left BRG, alternating between keys and dividers + + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL (x64) enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[chuniio] +; Uncomment this if you have custom chuniio implementation comprised of a single 32bit DLL. +; (will use chu2to3 engine internally) +;path= + +; Uncomment both of these if you have custom chuniio implementation comprised of two DLLs. +; x86 chuniio to path32, x64 to path64. Both are necessary. +;path32= +;path64= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io3] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 +; Set to 0 for enable separate ir control. Deafult is space key. +ir=0x20 + +[ir] +; Uncomment and complete the following sequence of settings to configure a +; custom ir-cappable controller if you have one. +;ir6=0x53 +; ... etc ... +;ir1=0x53 + +[slider] +; Enable slider emulation. If you have real AC slider, set this to 0. +; Slider serial port must be COM1. +;enable=1 + +; Key bindings for each of the 32 touch cells. The default key map, depicted +; in left-to-right order, is as follows: +; +; SSSSDDDDFFFFGGGGHHHHJJJJKKKKLLLL +; +; Touch cells are numbered FROM RIGHT TO LEFT! starting from 1. This is in +; order to match the numbering used in the operator menu and service manual. +; +; Uncomment and complete the following sequence of settings to configure a +; custom high-precision touch strip controller if you have one. +;cell1=0x53 +;cell2=0x53 +; ... etc ... +;cell31=0x53 +;cell32=0x53 diff --git a/dist/cm/segatools.ini b/dist/cm/segatools.ini index 94ea2aa..cd42cd6 100644 --- a/dist/cm/segatools.ini +++ b/dist/cm/segatools.ini @@ -1,111 +1,111 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about their LAN environment, so leaving this -; setting enabled is recommended. -enable=1 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.165.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; LAN Install: If multiple machines are present on the same LAN then set -; this to 0 on exactly one machine and set this to 1 on all others. -dipsw1=0 - -; ----------------------------------------------------------------------------- -; Misc. hooks settings -; ----------------------------------------------------------------------------- - -[touch] -; Enable/Disable WinTouch emulation -enable=0 - -[unity] -; Path to a .NET DLL that should run before the game. Useful for loading -; modding frameworks such as BepInEx. -targetAssembly= - -[printer] -; Sinfonia CHC-C330 printer emulation setting. -enable=1 -; Change the printer serial number here. -serial_no="5A-A123" -; Insert the path to the image output directory here. -printerOutPath="DEVICE\print" - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about their LAN environment, so leaving this +; setting enabled is recommended. +enable=1 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.165.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; LAN Install: If multiple machines are present on the same LAN then set +; this to 0 on exactly one machine and set this to 1 on all others. +dipsw1=0 + +; ----------------------------------------------------------------------------- +; Misc. hooks settings +; ----------------------------------------------------------------------------- + +[touch] +; Enable/Disable WinTouch emulation +enable=0 + +[unity] +; Path to a .NET DLL that should run before the game. Useful for loading +; modding frameworks such as BepInEx. +targetAssembly= + +[printer] +; Sinfonia CHC-C330 printer emulation setting. +enable=1 +; Change the printer serial number here. +serial_no="5A-A123" +; Insert the path to the image output directory here. +printerOutPath="DEVICE\print" + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 diff --git a/dist/fgo/segatools.ini b/dist/fgo/segatools.ini index 4b555ca..790de88 100644 --- a/dist/fgo/segatools.ini +++ b/dist/fgo/segatools.ini @@ -1,160 +1,160 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -[deckReader] -; 837-15345 RFID deck reader emulation setting. -enable=1 - -[ftdi] -; FTDI serial to usb adapter emulation for CABINET LED. -enable=1 -; COM port number where the LED board is connected to. -portNo=17 - -[led15093] -; 837-15093-06 LED board emulation setting. -enable=1 -; COM port number for the LED board. Has to be the same as the FTDI port. -portNo=17 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about their LAN environment, so leaving this -; setting enabled is recommended. -enable=1 -; The final octet of the local host's IP address on the virtualized subnet (so, -; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -; local host's virtualized LAN IP is `192.168.32.11`). -addrSuffix=11 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.167.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; ----------------------------------------------------------------------------- -; Misc. hook settings -; ----------------------------------------------------------------------------- - -[touch] -; WinTouch emulation setting. -enable=1 -remap=1 -cursor=1 - -[printer] -; Sinfonia CHC-C330 printer emulation setting. -enable=1 -; Change the printer serial number here. -serial_no="5A-A123" -; Insert the path to the image output directory here. -printerOutPath="DEVICE\print" -; Rotate all printed images by 180 degrees. -rotate180=1 - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[fgoio] -; To use a custom Fate/Grand Order Arcade IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in gamepad input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 - -; .·:'''''''''''''''''''''''''''''''''''''''''''''':·. -; : : ______ / \ [] : : -; : : | | _____ \ / Coin : : -; : : |______| { (0) } /--\ Attack. : : -; : : DECK \ / / \ : : -; : : | | > < : : -; : : | | \ / ___ : : -; : : | | \--/ | | : : -; : : JOY Noble. | | : : -; : : |___| : : -; : : AIME. : : -; '·:..............................................:·' -; -; Only XInput is currently supported. - -; XInput bindings -; -; Left Stick Joystick -; Left Stick Click Reset Camera -; Left Trigger Dash -; Left Shoulder Switch Target -; A/B Attack -; X/Y Noble Phantasm +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +[deckReader] +; 837-15345 RFID deck reader emulation setting. +enable=1 + +[ftdi] +; FTDI serial to usb adapter emulation for CABINET LED. +enable=1 +; COM port number where the LED board is connected to. +portNo=17 + +[led15093] +; 837-15093-06 LED board emulation setting. +enable=1 +; COM port number for the LED board. Has to be the same as the FTDI port. +portNo=17 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about their LAN environment, so leaving this +; setting enabled is recommended. +enable=1 +; The final octet of the local host's IP address on the virtualized subnet (so, +; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +; local host's virtualized LAN IP is `192.168.32.11`). +addrSuffix=11 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.167.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; ----------------------------------------------------------------------------- +; Misc. hook settings +; ----------------------------------------------------------------------------- + +[touch] +; WinTouch emulation setting. +enable=1 +remap=1 +cursor=1 + +[printer] +; Sinfonia CHC-C330 printer emulation setting. +enable=1 +; Change the printer serial number here. +serial_no="5A-A123" +; Insert the path to the image output directory here. +printerOutPath="DEVICE\print" +; Rotate all printed images by 180 degrees. +rotate180=1 + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[fgoio] +; To use a custom Fate/Grand Order Arcade IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in gamepad input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 + +; .·:'''''''''''''''''''''''''''''''''''''''''''''':·. +; : : ______ / \ [] : : +; : : | | _____ \ / Coin : : +; : : |______| { (0) } /--\ Attack. : : +; : : DECK \ / / \ : : +; : : | | > < : : +; : : | | \ / ___ : : +; : : | | \--/ | | : : +; : : JOY Noble. | | : : +; : : |___| : : +; : : AIME. : : +; '·:..............................................:·' +; +; Only XInput is currently supported. + +; XInput bindings +; +; Left Stick Joystick +; Left Stick Click Reset Camera +; Left Trigger Dash +; Left Shoulder Switch Target +; A/B Attack +; X/Y Noble Phantasm diff --git a/dist/mai2/segatools.ini b/dist/mai2/segatools.ini index 066b901..c253334 100644 --- a/dist/mai2/segatools.ini +++ b/dist/mai2/segatools.ini @@ -1,136 +1,136 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about its LAN environment, so leaving this -; setting enabled is recommended. -enable=1 -; The final octet of the local host's IP address on the virtualized subnet (so, -; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -; local host's virtualized LAN IP is `192.168.32.11`). -addrSuffix=11 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.172.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; LAN Install: If multiple machines are present on the same LAN then set -; this to 1 on exactly one machine and set this to 0 on all others. -dipsw1=1 - -; ----------------------------------------------------------------------------- -; Misc. hook settings -; ----------------------------------------------------------------------------- - -[unity] -; Enable Unity hook. This will allow you to run custom .NET code before the game -enable=1 - -; Path to a .NET DLL that should run before the game. Useful for loading -; modding frameworks such as BepInEx. -targetAssembly= - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[mai2io] -; To use a custom maimai DX IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 - -; Key bindings for buttons around screen. The default key map, depicted -; in clockwise order, is as follows: -; -; Player 1 Ring buttons: WEDCXZAQ, Select button: 3 -; Player 2 Ring buttons: (Numpad) 89632147, Select button: (Numpad) * -; -; Select buttons are considered as button 9. -; -; Uncomment and complete the following sequence of settings to configure a -; custom keybinding. -[button] -;1p_btn1=0x53 -;1p_btn2=0x53 -;1p_btn3=0x53 -; ... etc ... -;2p_btn1=0x53 -;2p_btn2=0x53 -;2p_btn3=0x53 -; ... etc ... +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about its LAN environment, so leaving this +; setting enabled is recommended. +enable=1 +; The final octet of the local host's IP address on the virtualized subnet (so, +; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +; local host's virtualized LAN IP is `192.168.32.11`). +addrSuffix=11 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.172.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; LAN Install: If multiple machines are present on the same LAN then set +; this to 1 on exactly one machine and set this to 0 on all others. +dipsw1=1 + +; ----------------------------------------------------------------------------- +; Misc. hook settings +; ----------------------------------------------------------------------------- + +[unity] +; Enable Unity hook. This will allow you to run custom .NET code before the game +enable=1 + +; Path to a .NET DLL that should run before the game. Useful for loading +; modding frameworks such as BepInEx. +targetAssembly= + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[mai2io] +; To use a custom maimai DX IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 + +; Key bindings for buttons around screen. The default key map, depicted +; in clockwise order, is as follows: +; +; Player 1 Ring buttons: WEDCXZAQ, Select button: 3 +; Player 2 Ring buttons: (Numpad) 89632147, Select button: (Numpad) * +; +; Select buttons are considered as button 9. +; +; Uncomment and complete the following sequence of settings to configure a +; custom keybinding. +[button] +;1p_btn1=0x53 +;1p_btn2=0x53 +;1p_btn3=0x53 +; ... etc ... +;2p_btn1=0x53 +;2p_btn2=0x53 +;2p_btn3=0x53 +; ... etc ... diff --git a/dist/mercury/segatools.ini b/dist/mercury/segatools.ini index 501df4e..0755bac 100644 --- a/dist/mercury/segatools.ini +++ b/dist/mercury/segatools.ini @@ -1,124 +1,124 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about their LAN environment, so leaving this -; setting enabled is recommended. -enable=1 -; The final octet of the local host's IP address on the virtualized subnet (so, -; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -; local host's virtualized LAN IP is `192.168.32.11`). -addrSuffix=11 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.174.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; LAN Install: If multiple machines are present on the same LAN then set -; this to 1 on exactly one machine and set this to 0 on all others. -dipsw1=1 - -; ----------------------------------------------------------------------------- -; Misc. hook settings -; ----------------------------------------------------------------------------- - -[gfx] -enable=1 - -; Hooks related to the touch boards -[touch] -enable=1 - -; Hooks related to the LED board (codenamed Elisabeth) -[elisabeth] -enable=1 - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[mercuryio] -; To use a custom WACCA IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 - -; Volume up virtual-key code. Default is the "UP" key. -volup=0x26 -; Volume down virtual-key code. Default is the "DOWN" key. -voldown=0x28 +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about their LAN environment, so leaving this +; setting enabled is recommended. +enable=1 +; The final octet of the local host's IP address on the virtualized subnet (so, +; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +; local host's virtualized LAN IP is `192.168.32.11`). +addrSuffix=11 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.174.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; LAN Install: If multiple machines are present on the same LAN then set +; this to 1 on exactly one machine and set this to 0 on all others. +dipsw1=1 + +; ----------------------------------------------------------------------------- +; Misc. hook settings +; ----------------------------------------------------------------------------- + +[gfx] +enable=1 + +; Hooks related to the touch boards +[touch] +enable=1 + +; Hooks related to the LED board (codenamed Elisabeth) +[elisabeth] +enable=1 + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[mercuryio] +; To use a custom WACCA IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 + +; Volume up virtual-key code. Default is the "UP" key. +volup=0x26 +; Volume down virtual-key code. Default is the "DOWN" key. +voldown=0x28 diff --git a/dist/mu3/segatools.ini b/dist/mu3/segatools.ini index 90cd4c4..59ec0d2 100644 --- a/dist/mu3/segatools.ini +++ b/dist/mu3/segatools.ini @@ -1,197 +1,197 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata= - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about their LAN environment, so leaving this -; setting enabled is recommended. -enable=1 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; If you disable netenv then you must set this to your LAN's IP subnet, and -; that subnet must start with 192.168. -subnet=192.168.162.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; LAN Install: If multiple machines are present on the same LAN then set -; this to 1 on exactly one machine and set this to 0 on all others. -dipsw1=1 - -; ----------------------------------------------------------------------------- -; Misc. hook settings -; ----------------------------------------------------------------------------- - -[gfx] -enable=1 - -[unity] -; Enable Unity hook. This will allow you to run custom .NET code before the game -enable=1 - -; Path to a .NET DLL that should run before the game. Useful for loading -; modding frameworks such as BepInEx. -targetAssembly= - -; ----------------------------------------------------------------------------- -; LED settings -; ----------------------------------------------------------------------------- - -[led15093] -; Enable emulation of the 15093-06 controlled lights, which handle the air tower -; RGBs and the rear LED panel (billboard) on the cabinet. -enable=1 - -[led] -; Output billboard LED strip data to a named pipe called "\\.\pipe\ongeki_led" -cabLedOutputPipe=1 -; Output billboard LED strip data to serial -cabLedOutputSerial=0 - -; Output slider LED data to the named pipe -controllerLedOutputPipe=1 -; Output slider LED data to the serial port -controllerLedOutputSerial=0 - -; Serial port to send data to if using serial output. Default is COM5. -;serialPort=COM5 -; Baud rate for serial data -;serialBaud=921600 - -; Data output a sequence of bytes, with JVS-like framing. -; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, -; 0xD0 is used as an escape character -- if you receive D0 in the output, ignore -; it and use the next sent byte plus one instead. -; -; After the sync is one byte for the board number that was updated, followed by -; the red, green and blue values for each LED. -; -; Board 0 has 61 LEDs: -; [0]-[1]: left side button -; [2]-[8]: left pillar lower LEDs -; [9]-[17]: left pillar center LEDs -; [18]-[24]: left pillar upper LEDs -; [25]-[35]: billboard LEDs -; [36]-[42]: right pillar upper LEDs -; [43]-[51]: right pillar center LEDs -; [52]-[58]: right pillar lower LEDs -; [59]-[60]: right side button -; -; Board 1 has 6 LEDs: -; [0]-[5]: 3 left and 3 right controller buttons -; - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[mu3io] -; To use a custom O.N.G.E.K.I. IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard/gamepad input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 - -; Set "1" to enable mouse lever emulation, "0" to use XInput -mouse=1 - -; XInput input bindings -; -; Left Stick Lever -; Left Trigger Lever (move to the left) -; Right Trigger Lever (move to the right) -; Left Left red button -; Up Left green button -; Right Left blue button -; Left Shoulder Left side button -; Right Shoulder Right side button -; X Right red button -; Y Right green button -; A Right blue button -; Back Left menu button -; Start Right menu button - -; Keyboard input bindings -left1=0x41 ; A -left2=0x53 ; S -left3=0x44 ; D - -leftSide=0x01 ; Mouse Left -rightSide=0x02 ; Mouse Right - -right1=0x4A ; J -right2=0x4B ; K -right3=0x4C ; L - -leftMenu=0x55 ; U -rightMenu=0x4F ; O +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata= + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about their LAN environment, so leaving this +; setting enabled is recommended. +enable=1 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; If you disable netenv then you must set this to your LAN's IP subnet, and +; that subnet must start with 192.168. +subnet=192.168.162.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; LAN Install: If multiple machines are present on the same LAN then set +; this to 1 on exactly one machine and set this to 0 on all others. +dipsw1=1 + +; ----------------------------------------------------------------------------- +; Misc. hook settings +; ----------------------------------------------------------------------------- + +[gfx] +enable=1 + +[unity] +; Enable Unity hook. This will allow you to run custom .NET code before the game +enable=1 + +; Path to a .NET DLL that should run before the game. Useful for loading +; modding frameworks such as BepInEx. +targetAssembly= + +; ----------------------------------------------------------------------------- +; LED settings +; ----------------------------------------------------------------------------- + +[led15093] +; Enable emulation of the 15093-06 controlled lights, which handle the air tower +; RGBs and the rear LED panel (billboard) on the cabinet. +enable=1 + +[led] +; Output billboard LED strip data to a named pipe called "\\.\pipe\ongeki_led" +cabLedOutputPipe=1 +; Output billboard LED strip data to serial +cabLedOutputSerial=0 + +; Output slider LED data to the named pipe +controllerLedOutputPipe=1 +; Output slider LED data to the serial port +controllerLedOutputSerial=0 + +; Serial port to send data to if using serial output. Default is COM5. +;serialPort=COM5 +; Baud rate for serial data +;serialBaud=921600 + +; Data output a sequence of bytes, with JVS-like framing. +; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, +; 0xD0 is used as an escape character -- if you receive D0 in the output, ignore +; it and use the next sent byte plus one instead. +; +; After the sync is one byte for the board number that was updated, followed by +; the red, green and blue values for each LED. +; +; Board 0 has 61 LEDs: +; [0]-[1]: left side button +; [2]-[8]: left pillar lower LEDs +; [9]-[17]: left pillar center LEDs +; [18]-[24]: left pillar upper LEDs +; [25]-[35]: billboard LEDs +; [36]-[42]: right pillar upper LEDs +; [43]-[51]: right pillar center LEDs +; [52]-[58]: right pillar lower LEDs +; [59]-[60]: right side button +; +; Board 1 has 6 LEDs: +; [0]-[5]: 3 left and 3 right controller buttons +; + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[mu3io] +; To use a custom O.N.G.E.K.I. IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard/gamepad input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 + +; Set "1" to enable mouse lever emulation, "0" to use XInput +mouse=1 + +; XInput input bindings +; +; Left Stick Lever +; Left Trigger Lever (move to the left) +; Right Trigger Lever (move to the right) +; Left Left red button +; Up Left green button +; Right Left blue button +; Left Shoulder Left side button +; Right Shoulder Right side button +; X Right red button +; Y Right green button +; A Right blue button +; Back Left menu button +; Start Right menu button + +; Keyboard input bindings +left1=0x41 ; A +left2=0x53 ; S +left3=0x44 ; D + +leftSide=0x01 ; Mouse Left +rightSide=0x02 ; Mouse Right + +right1=0x4A ; J +right2=0x4B ; K +right3=0x4C ; L + +leftMenu=0x55 ; U +rightMenu=0x4F ; O diff --git a/dist/swdc/segatools.ini b/dist/swdc/segatools.ini index b05dd02..72ea69d 100644 --- a/dist/swdc/segatools.ini +++ b/dist/swdc/segatools.ini @@ -1,186 +1,186 @@ -; ----------------------------------------------------------------------------- -; Path settings -; ----------------------------------------------------------------------------- - -[vfs] -; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) -amfs= -; Insert the path to the game Option directory here (contains Axxx directories) -option= -; Create an empty directory somewhere and insert the path here. -; This directory may be shared between multiple SEGA games. -; NOTE: This has nothing to do with Windows %APPDATA%. -appdata=appdata - -; ----------------------------------------------------------------------------- -; Device settings -; ----------------------------------------------------------------------------- - -[aime] -; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -; reader. -enable=1 -aimePath=DEVICE\aime.txt - -[vfd] -; Enable VFD emulation. Disable to use a real VFD -; GP1232A02A FUTABA assembly. -enable=1 - -; ----------------------------------------------------------------------------- -; Network settings -; ----------------------------------------------------------------------------- - -[dns] -; Insert the hostname or IP address of the server you wish to use here. -; Note that 127.0.0.1, localhost etc are specifically rejected. -default=127.0.0.1 - -[netenv] -; Simulate an ideal LAN environment. This may interfere with head-to-head play. -; SEGA games are somewhat picky about their LAN environment, so leaving this -; setting enabled is recommended. -enable=1 -; The final octet of the local host's IP address on the virtualized subnet (so, -; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -; local host's virtualized LAN IP is `192.168.32.11`). -addrSuffix=11 - -; ----------------------------------------------------------------------------- -; Board settings -; ----------------------------------------------------------------------------- - -[keychip] -; The /24 LAN subnet that the emulated keychip will tell the game to expect. -; You must set this to your LAN's IP subnet, and that subnet must start with 192.168, -; in order to find the MAIN cabinet. -subnet=192.168.160.0 - -[system] -; Enable ALLS system settings. -enable=1 - -; Enable freeplay mode. This will disable the coin slot and set the game to -; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not -; allow you to start a game in freeplay mode. -freeplay=0 - -; ----------------------------------------------------------------------------- -; Custom IO settings -; ----------------------------------------------------------------------------- - -[aimeio] -; To use a custom card reader IO DLL enter its path here. -; Leave empty if you want to use Segatools built-in keyboard input. -path= - -[swdcio] -; To use a custom SEGA World Drivers Championship DLL enter its path here. -; Leave empty if you want to use Segatools built-in gamepad/wheel input. -path= - -; ----------------------------------------------------------------------------- -; Input settings -; ----------------------------------------------------------------------------- - -; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal -; (not prefixed with 0x) virtual-key codes, a list of which can be found here: -; -; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -; -; This is, admittedly, not the most user-friendly configuration method in the -; world. An improved solution will be provided later. - -[io4] -; Test button virtual-key code. Default is the F1 key. -test=0x70 -; Service button virtual-key code. Default is the F2 key. -service=0x71 -; Keyboard button to increment coin counter. Default is the F3 key. -coin=0x72 - -; Input API selection for IO4 input emulator. -; Set "xinput" to use a gamepad and "dinput" to use a steering wheel. -mode=xinput -; Adjust scaling for steering wheel input. -; -; This setting scales the steering wheel input so that the maximum positive -; and minimum negative steering inputs reported in the operator menu's input -; test screen do not exceed the value below. The maximum possible value is 128, -; and the value that matches the input range of a real cabinet is 128. -; -; NOTE: This is not the same thing as DirectInput steering wheel movement -; range! Segatools cannot control the maximum angle of your physical steering -; wheel controller, this setting is vendor-specific and can only be adjusted -; in the Control Panel. -restrict=128 - -[xinput] -; XInput bindings -; -; Left Stick Steering -; Right Stick (Steering) when "singleStickSteering" is disabled -; Left Trigger Brake -; Right Trigger Accelerator -; Left Shoulder Left Paddle -; Right Shoulder Right Paddle -; Start Start -; Back View Change -; A Green (Wheel) -; B Red (Wheel) -; X Blue (Wheel) -; Y Yellow (Wheel) -; D-Pad D-Pad - -; Use the left thumbstick for steering instead of both on XInput Controllers. -; Not recommended as it will not give you the precision needed for this game. -singleStickSteering=1 -; Use linear steering instead of the default non-linear cubing steering. -linearSteering=1 -; Configure deadzones for the left and right thumbsticks. -; The default value for the left stick is 7849, max value is 32767. -leftStickDeadzone=7849 -; The default value for the right stick is 8689, max value is 32767. -rightStickDeadzone=8689 - -[dinput] -; Name of the DirectInput wheel to use (or any text that occurs in its name) -; Example: G29 -; -; If this is left blank then the first DirectInput device will be used. -deviceName= -; Name of the DirectInput pedals to use (or any subset thereof). -; Leave blank if you do not have separate pedals; aka the pedals are part of -; the wheel. -; -; The pedals will be mapped to the accelAxis and brakeAxis. -pedalsName= -; Pedal mappings. Valid axis names are: -; -; X, Y, Z, RX, RY, RZ, U, V -; -; (U and V are old names for Slider 1 and Slider 2). -; The examples below are valid for a Logitech G29. -brakeAxis=RZ -accelAxis=Y -; DirectInput button numbers to map to menu inputs. Note that buttons are -; numbered from 1; some software numbers buttons from 0. -start=1 -viewChg=2 -; Button mappings for the steering wheel paddles. -paddleLeft=6 -paddleRight=5 -; Button mappings for the steering wheel buttons. -wheelRed=7 -wheelBlue=8 -wheelYellow=9 -wheelGreen=10 -; Invert the accelerator and or brake axis -; (Needed when using DirectInput for the Dualshock 4 for example) -reverseAccelAxis=0 -reverseBrakeAxis=0 - -; Force feedback settings. -; Strength of the force feedback spring effect in percent. Possible values -; are 0-100. -centerSpringStrength=30 +; ----------------------------------------------------------------------------- +; Path settings +; ----------------------------------------------------------------------------- + +[vfs] +; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) +amfs= +; Insert the path to the game Option directory here (contains Axxx directories) +option= +; Create an empty directory somewhere and insert the path here. +; This directory may be shared between multiple SEGA games. +; NOTE: This has nothing to do with Windows %APPDATA%. +appdata=appdata + +; ----------------------------------------------------------------------------- +; Device settings +; ----------------------------------------------------------------------------- + +[aime] +; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +; reader. +enable=1 +aimePath=DEVICE\aime.txt + +[vfd] +; Enable VFD emulation. Disable to use a real VFD +; GP1232A02A FUTABA assembly. +enable=1 + +; ----------------------------------------------------------------------------- +; Network settings +; ----------------------------------------------------------------------------- + +[dns] +; Insert the hostname or IP address of the server you wish to use here. +; Note that 127.0.0.1, localhost etc are specifically rejected. +default=127.0.0.1 + +[netenv] +; Simulate an ideal LAN environment. This may interfere with head-to-head play. +; SEGA games are somewhat picky about their LAN environment, so leaving this +; setting enabled is recommended. +enable=1 +; The final octet of the local host's IP address on the virtualized subnet (so, +; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +; local host's virtualized LAN IP is `192.168.32.11`). +addrSuffix=11 + +; ----------------------------------------------------------------------------- +; Board settings +; ----------------------------------------------------------------------------- + +[keychip] +; The /24 LAN subnet that the emulated keychip will tell the game to expect. +; You must set this to your LAN's IP subnet, and that subnet must start with 192.168, +; in order to find the MAIN cabinet. +subnet=192.168.160.0 + +[system] +; Enable ALLS system settings. +enable=1 + +; Enable freeplay mode. This will disable the coin slot and set the game to +; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not +; allow you to start a game in freeplay mode. +freeplay=0 + +; ----------------------------------------------------------------------------- +; Custom IO settings +; ----------------------------------------------------------------------------- + +[aimeio] +; To use a custom card reader IO DLL enter its path here. +; Leave empty if you want to use Segatools built-in keyboard input. +path= + +[swdcio] +; To use a custom SEGA World Drivers Championship DLL enter its path here. +; Leave empty if you want to use Segatools built-in gamepad/wheel input. +path= + +; ----------------------------------------------------------------------------- +; Input settings +; ----------------------------------------------------------------------------- + +; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal +; (not prefixed with 0x) virtual-key codes, a list of which can be found here: +; +; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +; +; This is, admittedly, not the most user-friendly configuration method in the +; world. An improved solution will be provided later. + +[io4] +; Test button virtual-key code. Default is the F1 key. +test=0x70 +; Service button virtual-key code. Default is the F2 key. +service=0x71 +; Keyboard button to increment coin counter. Default is the F3 key. +coin=0x72 + +; Input API selection for IO4 input emulator. +; Set "xinput" to use a gamepad and "dinput" to use a steering wheel. +mode=xinput +; Adjust scaling for steering wheel input. +; +; This setting scales the steering wheel input so that the maximum positive +; and minimum negative steering inputs reported in the operator menu's input +; test screen do not exceed the value below. The maximum possible value is 128, +; and the value that matches the input range of a real cabinet is 128. +; +; NOTE: This is not the same thing as DirectInput steering wheel movement +; range! Segatools cannot control the maximum angle of your physical steering +; wheel controller, this setting is vendor-specific and can only be adjusted +; in the Control Panel. +restrict=128 + +[xinput] +; XInput bindings +; +; Left Stick Steering +; Right Stick (Steering) when "singleStickSteering" is disabled +; Left Trigger Brake +; Right Trigger Accelerator +; Left Shoulder Left Paddle +; Right Shoulder Right Paddle +; Start Start +; Back View Change +; A Green (Wheel) +; B Red (Wheel) +; X Blue (Wheel) +; Y Yellow (Wheel) +; D-Pad D-Pad + +; Use the left thumbstick for steering instead of both on XInput Controllers. +; Not recommended as it will not give you the precision needed for this game. +singleStickSteering=1 +; Use linear steering instead of the default non-linear cubing steering. +linearSteering=1 +; Configure deadzones for the left and right thumbsticks. +; The default value for the left stick is 7849, max value is 32767. +leftStickDeadzone=7849 +; The default value for the right stick is 8689, max value is 32767. +rightStickDeadzone=8689 + +[dinput] +; Name of the DirectInput wheel to use (or any text that occurs in its name) +; Example: G29 +; +; If this is left blank then the first DirectInput device will be used. +deviceName= +; Name of the DirectInput pedals to use (or any subset thereof). +; Leave blank if you do not have separate pedals; aka the pedals are part of +; the wheel. +; +; The pedals will be mapped to the accelAxis and brakeAxis. +pedalsName= +; Pedal mappings. Valid axis names are: +; +; X, Y, Z, RX, RY, RZ, U, V +; +; (U and V are old names for Slider 1 and Slider 2). +; The examples below are valid for a Logitech G29. +brakeAxis=RZ +accelAxis=Y +; DirectInput button numbers to map to menu inputs. Note that buttons are +; numbered from 1; some software numbers buttons from 0. +start=1 +viewChg=2 +; Button mappings for the steering wheel paddles. +paddleLeft=6 +paddleRight=5 +; Button mappings for the steering wheel buttons. +wheelRed=7 +wheelBlue=8 +wheelYellow=9 +wheelGreen=10 +; Invert the accelerator and or brake axis +; (Needed when using DirectInput for the Dualshock 4 for example) +reverseAccelAxis=0 +reverseBrakeAxis=0 + +; Force feedback settings. +; Strength of the force feedback spring effect in percent. Possible values +; are 0-100. +centerSpringStrength=30 diff --git a/doc/config/common.md b/doc/config/common.md index 6cc73e2..e778a8a 100644 --- a/doc/config/common.md +++ b/doc/config/common.md @@ -1,567 +1,567 @@ -# Segatools common configuration settings - -This file describes configuration settings for Segatools that are common to -all games. - -Keyboard binding settings use -[Virtual-Key Codes](https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes). - -## `[aimeio]` - -Controls the card reader driver. - -### `path` - -Specify a path for a third-party card reader driver DLL. Default is empty -(use built-in emulation based on text files and keyboard input). - -In previous versions of Segatools this was accomplished by replacing the -AIMEIO.DLL file that came with Segatools. Segatools no longer ships with a -separate AIMEIO.DLL file (its functionality is now built into the various hook -DLLs). - -## `[aime]` - -Controls emulation of the Aime card reader assembly. - -### `enable` - -Default: `1` - -Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime -reader (COM port number varies by game). - -### `highBaud` - -Default: `1` - -Enables the high baudrate of the Aime card reader to be 115200 (instead of 38400). -This is required for some games (e.g. Chunithm) but not others (e.g. WACCA). - -### `gen` - -Default: `1` - -Changes the Aime card reader generation, this will also change the LED info -provided for the game. - -- `1`: TN32MSEC003S H/W Ver3.0 / TN32MSEC003S F/W Ver1.2 -- `2`: 837-15286 / 94 -- `3`: 837-15396 / 94 - -### `aimePath` - -Default: `DEVICE\aime.txt` - -Path to a text file containing a classic Aime IC card ID. - -### `aimeGen` - -Default: `1` - -Whether to generate a random AiMe ID if the file at `aimePath` does not -exist. - -### `felicaPath` - -Default: `DEVICE\felica.txt` - -Path to a text file containing a FeliCa e-cash card IDm serial number. - -### `felicaGen` - -Default: `0` - -Whether to generate a random FeliCa ID if the file at `felicaPath` does not -exist. - -### `scan` - -Default: `0x0D` (`VK_RETURN`) - -Virtual-key code. If this button is **held** then the emulated IC card reader -emulates an IC card in its proximity. A variety of different IC cards can be -emulated; the exact choice of card that is emulated depends on the presence or -absence of the configured card ID files. - -## `[vfd]` - -Controls emulation of the VFD GP1232A02A FUTABA assembly. - -### `enable` - -Default: `1` - -Enable VFD emulation. Disable to use a real VFD -GP1232A02A FUTABA assembly (COM port number varies by game). - -### `portNo` - -Default: (game specific) - -Sets the COM port to use for the VFD. - -### `utfConversion` - -Default: `0` - -Converts the strings from the VFD from their respective encoding to UTF, so console output will display as it should on non-Japanese locales. - -## `[amvideo]` - -Controls the `amvideo.dll` stub built into Segatools. This is a DLL that is -normally present on the SEGA operating system image which is responsible for -changing screen resolution and orientation. - -### `enable` - -Default: `1` - -Enable stub `amvideo.dll`. Disable to use a real `amvideo.dll` build. Note that -you must have the correct registry settings installed and you must use the -version of `amvideo.dll` that matches your GPU vendor (since these DLLs make -use of vendor-specific APIs). - -## `[clock]` - -Controls hooks for Windows time-of-day APIs. - -### `timezone` - -Default: `1` - -Make the system time zone appear to be JST. SEGA games malfunction in strange -ways if the system time zone is not JST. There should not be any reason to -disable this hook other than possible implementation bugs, but the option is -provided if you need it. - -### `timewarp` - -Default: `0` - -Experimental time-of-day warping hook that skips over the hardcoded server -maintenance period. Causes an incorrect in-game time-of-day to be reported. -Better solutions for this problem exist and this feature will probably be -removed soon. - -### `writeable` - -Default: `0` - -Allow game to adjust system clock and time zone settings. This should normally -be left at `0`, but the option is provided if you need it. - -## `[dns]` - -Controls redirection of network server hostname lookups - -### `default` - -Default: `localhost` - -Controls hostname of all of the common network services servers, unless -overriden by a specific setting below. Most users will only need to change this -setting. Also, loopback addresses are specifically checked for and rejected by -the games themselves; this needs to be a LAN or WAN IP (or a hostname that -resolves to one). - -### `title` - -Default: `title` - -Leave it as `title` to use the title server returned by ALL.Net. Rewrites -the title server hostname for certain games, such as crossbeats REV. - -### `router` - -Default: Empty string (i.e. use value from `default` setting) - -Overrides the target of the `tenporouter.loc` and `bbrouter.loc` hostname -lookups. - -### `startup` - -Default: Empty string (i.e. use value from `default` setting) - -Overrides the target of the `naominet.jp` host lookup. - -### `billing` - -Default: Empty string (i.e. use value from `default` setting) - -Overrides the target of the `ib.naominet.jp` host lookup. - -### `aimedb` - -Default: Empty string (i.e. use value from `default` setting) - -Overrides the target of the `aime.naominet.jp` host lookup. - -## `[ds]` - -Controls emulation of the "DS (Dallas Semiconductor) EEPROM" chip on the AMEX -PCIe board. This is a small (32 byte) EEPROM that contains serial number and -region code information. It is not normally written to outside of inital -factory provisioning of a Sega Nu. - -### `enable` - -Default: `1` - -Enable DS EEPROM emulation. Disable to use the DS EEPROM chip on a real AMEX. - -### `region` - -Default: `1` - -AMEX Board region code. This appears to be a bit mask? - -- `1`: Japan -- `2`: USA? (Dead code, not used) -- `4`: Export -- `8`: China - -### `serialNo` - -Default `AAVE-01A99999999` - -"MAIN ID" serial number. First three characters are hardware series: - -- `AAV`: Nu-series -- `AAW`: NuSX-series -- `ACA`: ALLS-series - -## `[eeprom]` - -Controls emulation of the bulk EEPROM on the AMEX PCIe board. This chip stores -status and configuration information. - -### `enable` - -Default: `1` - -Enable bulk EEPROM emulation. Disable to use the bulk EEPROM chip on a real -AMEX. - -### `path` - -Default: `DEVICE\eeprom.bin` - -Path to the storage file for EEPROM emulation. This file is automatically -created and initialized with a suitable number of zero bytes if it does not -already exist. - -## `[gpio]` - -Configure emulation of the AMEX PCIe GPIO (General Purpose Input Output) -controller. - -### `enable` - -Default: `1` - -Enable GPIO emulation. Disable to use the GPIO controller on a real AMEX. - -### `sw1` - -Default `0x70` (`VK_F1`) - -Keyboard binding for Nu chassis SW1 button (alternative Test) - -### `sw2` - -Default `0x71` (`VK_F2`) - -Keyboard binding for Nu chassis SW2 button (alternative Service) - -### `dipsw1` .. `dipsw8` - -Defaults: `1`, `0`, `0`, `0`, `0`, `0`, `0`, `0` - -Nu chassis DIP switch settings: - -- Switch 1: Game-specific, but usually controls the "distribution server" - setting. Exactly one arcade machine on a cabinet router must be set to the - Server setting. - - `0`: Client - - `1`: Server -- Switch 2,3: Game-specific. - - Used by Mario&Sonic to configure cabinet ID, possibly other games. -- Switch 4: Screen orientation. Only used by the Nu system startup program. - - `0`: YOKO/Horizontal - - `1`: TATE/Vertical -- Switch 5,6,7: Screen resolution. Only used by the Nu system startup program. - - `000`: No change - - `100`: 640x480 - - `010`: 1024x600 - - `110`: 1024x768 - - `001`: 1280x720 - - `101`: 1280x1024 - - `110`: 1360x768 - - `111`: 1920x1080 -- Switch 8: Game-specific. Not used in any shipping game. - -## `[hwmon]` - -Configure stub implementation of the platform hardware monitor driver. The -real implementation of this driver monitors CPU temperatures by reading from -Intel Model Specific Registers, which is an action that is only permitted from -kernel mode. - -### `enable` - -Default `1` - -Enable hwmon emulation. Disable to use the real hwmon driver. - -## `[jvs]` - -Configure emulation of the AMEX PCIe JVS *controller* (not IO board!) - -### `enable` - -Default `1` - -Enable JVS port emulation. Disable to use the JVS port on a real AMEX. - -## `[io4]` - -Configure emulation of the IO4 board. Same settings also apply to `[io3]`. - -### `enable` - -Default `1` - -Enable IO4 port emulation. Disable to use the IO4 port on a real ALLS. - -### `test` -Default `0x31` - -Test button virtual-key code. Default is the 1 key. - -### `service` - -Default `0x32` - -Service button virtual-key code. Default is the 2 key. - -### `coin` - -Default `0x33` - -Keyboard button to increment coin counter. Default is the 3 key. - -## `[keychip]` - -Configure keychip emulation. - -### `enable` - -Enable keychip emulation. Disable to use a real keychip. - -### `id` - -Default: `A69E-01A88888888` - -Keychip serial number. Keychip serials observed in the wild follow this -pattern: `A\d{2}(E|X)-(01|20)[ABCDU]\d{8}`. - -### `gameId` - -Default: (Varies depending on game) - -Override the game's four-character model code. Changing this from the game's -expected value will probably just cause a system error. - -### `platformId` - -Default: (Varies depending on game) - -Override the game's four-character platform code (e.g. `AAV2` for Nu 2). This -is actually supposed to be a separate three-character `platformId` and -integer `modelType` setting, but they are combined here for convenience. Valid -values include: - -- `AAV0`: Nu 1 (Project DIVA) -- `AAV1`: Nu 1.1 (Chunithm) -- `AAV2`: Nu 2 (Initial D Zero) -- `AAW0`: NuSX 1 -- `AAW1`: NuSX 1.1 -- `ACA0`: ALLS UX -- `ACA1`: ALLS HX -- `ACA2`: ALLS UX (without dedicated GPU) -- `ACA4`: ALLS MX - -### `region` - -Default: `1` - -Override the keychip's region code. Most games seem to pay attention to the -DS EEPROM region code and not the keychip region code, and this seems to be -a bit mask that controls which Nu PCB region codes this keychip is authorized -for. So it probably only affects the system software and not the game software. -Bit values are: - -- 1: JPN: Japan -- 2: USA (unused) -- 3: EXP: Export (for Asian markets) -- 4: CHS: China (Simplified Chinese?) - -### `billingCa` - -Default: `DEVICE\\ca.crt` - -Set the billing certificate path. This has to match the one used for the -SSL billing server. The DER certificate must fit in 1024 bytes so it must be -small. - -### `billingPub` - -Default: `DEVICE\\billing.pub` - -Set the actual keychip RSA public key path. This public key has to match the -private key `billing.key` of the billing server in order to decrypt/encrypt -the billing transactions. - -### `billingType` - -Default: `1` - -Set the billing "type" for the keychip. The type determins what kind of revenue share, -if any, the game maker has with SEGA. Some games may be picky and require types other -then 1 (ex. crossbeats REV. requires billing type 2), so this option is provided if this -is an issue. Billing types are: - -- 0: No billing? -- 1: Billing type A -- 2: Billing type B1 -- 3: Billing type B2 - -### `systemFlag` - -Default: `0x64` - -An 8-bit bitfield of unclear meaning. The least significant bit indicates a -developer dongle. Changing this doesn't seem to have any effect on -anything other than SEGA AM2 games. - -Other values observed in the wild: - -- `0x04`: SDCH, SDCA -- `0x20`: SDCA - -### `subnet` - -Default `192.168.100.0` - -The LAN IP range that the game will expect. The prefix length is hardcoded into -the game program: for some games this is `/24`, for others it is `/20`. - -## `[netenv]` - -Configure network environment virtualization. This module helps bypass various -restrictions placed upon the game's LAN environment. - -### `enable` - -Default `1` - -Enable network environment virtualization. You may need to disable this if -you want to do any head-to-head play on your LAN. - -Note: The virtualized LAN IP range is taken from the emulated keychip's -`subnet` setting. - -### `addrSuffix` - -Default: `11` - -The final octet of the local host's IP address on the virtualized subnet (so, -if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the -local host's virtualized LAN IP is `192.168.32.11`). - -### `routerSuffix` - -Default: `1` - -The final octet of the default gateway's IP address on the virtualized subnet. - -### `macAddr` - -Default: `01:02:03:04:05:06` - -The MAC address of the virtualized Ethernet adapter. The exact value shouldn't -ever matter. - -## `[pcbid]` - -Configure Windows host name virtualization. The ALLS-series platform no longer -has an AMEX board, so the MAIN ID serial number is stored in the Windows -hostname. - -### `enable` - -Default: `1` - -Enable Windows host name virtualization. This is only needed for ALLS-platform -games (since the ALLS lacks an AMEX and therefore has no DS EEPROM, so it needs -another way to store the PCB serial), but it does no harm on games that run on -earlier hardware. - -### `serialNo` - -Default: `ACAE01A99999999` - -Set the Windows host name. This should be an ALLS MAIN ID, without the -hyphen (which is not a valid character in a Windows host name). - -## `[sram]` - -Configure emulation of the AMEX PCIe battery-backed SRAM. This stores -bookkeeping state and settings. This file is automatically created and -initialized with a suitable number of zero bytes if it does not already exist. - -### `enable` - -Default `1` - -Enable SRAM emulation. Disable to use the SRAM on a real AMEX. - -### `path` - -Default `DEVICE\sram.bin` - -Path to the storage file for SRAM emulation. - -## `[vfs]` - -Configure Windows path redirection hooks. - -### `enable` - -Default: `1` - -Enable path redirection. - -### `amfs` - -Default: Empty string (causes a startup error) - -Configure the location of the SEGA AMFS volume. Stored on the `E` partition on -real hardware. - -### `appdata` - -Default: Empty string (causes a startup error) - -Configure the location of the SEGA "APPDATA" volume (nothing to do with the -Windows user's `%APPDATA%` directory). Stored on the `Y` partition on real -hardware. - -### `option` - -Default: Empty string - -Configure the location of the "Option" data mount point. This mount point is -optional (hence the name, probably) and contains directories which contain -minor over-the-air content updates. +# Segatools common configuration settings + +This file describes configuration settings for Segatools that are common to +all games. + +Keyboard binding settings use +[Virtual-Key Codes](https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes). + +## `[aimeio]` + +Controls the card reader driver. + +### `path` + +Specify a path for a third-party card reader driver DLL. Default is empty +(use built-in emulation based on text files and keyboard input). + +In previous versions of Segatools this was accomplished by replacing the +AIMEIO.DLL file that came with Segatools. Segatools no longer ships with a +separate AIMEIO.DLL file (its functionality is now built into the various hook +DLLs). + +## `[aime]` + +Controls emulation of the Aime card reader assembly. + +### `enable` + +Default: `1` + +Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime +reader (COM port number varies by game). + +### `highBaud` + +Default: `1` + +Enables the high baudrate of the Aime card reader to be 115200 (instead of 38400). +This is required for some games (e.g. Chunithm) but not others (e.g. WACCA). + +### `gen` + +Default: `1` + +Changes the Aime card reader generation, this will also change the LED info +provided for the game. + +- `1`: TN32MSEC003S H/W Ver3.0 / TN32MSEC003S F/W Ver1.2 +- `2`: 837-15286 / 94 +- `3`: 837-15396 / 94 + +### `aimePath` + +Default: `DEVICE\aime.txt` + +Path to a text file containing a classic Aime IC card ID. + +### `aimeGen` + +Default: `1` + +Whether to generate a random AiMe ID if the file at `aimePath` does not +exist. + +### `felicaPath` + +Default: `DEVICE\felica.txt` + +Path to a text file containing a FeliCa e-cash card IDm serial number. + +### `felicaGen` + +Default: `0` + +Whether to generate a random FeliCa ID if the file at `felicaPath` does not +exist. + +### `scan` + +Default: `0x0D` (`VK_RETURN`) + +Virtual-key code. If this button is **held** then the emulated IC card reader +emulates an IC card in its proximity. A variety of different IC cards can be +emulated; the exact choice of card that is emulated depends on the presence or +absence of the configured card ID files. + +## `[vfd]` + +Controls emulation of the VFD GP1232A02A FUTABA assembly. + +### `enable` + +Default: `1` + +Enable VFD emulation. Disable to use a real VFD +GP1232A02A FUTABA assembly (COM port number varies by game). + +### `portNo` + +Default: (game specific) + +Sets the COM port to use for the VFD. + +### `utfConversion` + +Default: `0` + +Converts the strings from the VFD from their respective encoding to UTF, so console output will display as it should on non-Japanese locales. + +## `[amvideo]` + +Controls the `amvideo.dll` stub built into Segatools. This is a DLL that is +normally present on the SEGA operating system image which is responsible for +changing screen resolution and orientation. + +### `enable` + +Default: `1` + +Enable stub `amvideo.dll`. Disable to use a real `amvideo.dll` build. Note that +you must have the correct registry settings installed and you must use the +version of `amvideo.dll` that matches your GPU vendor (since these DLLs make +use of vendor-specific APIs). + +## `[clock]` + +Controls hooks for Windows time-of-day APIs. + +### `timezone` + +Default: `1` + +Make the system time zone appear to be JST. SEGA games malfunction in strange +ways if the system time zone is not JST. There should not be any reason to +disable this hook other than possible implementation bugs, but the option is +provided if you need it. + +### `timewarp` + +Default: `0` + +Experimental time-of-day warping hook that skips over the hardcoded server +maintenance period. Causes an incorrect in-game time-of-day to be reported. +Better solutions for this problem exist and this feature will probably be +removed soon. + +### `writeable` + +Default: `0` + +Allow game to adjust system clock and time zone settings. This should normally +be left at `0`, but the option is provided if you need it. + +## `[dns]` + +Controls redirection of network server hostname lookups + +### `default` + +Default: `localhost` + +Controls hostname of all of the common network services servers, unless +overriden by a specific setting below. Most users will only need to change this +setting. Also, loopback addresses are specifically checked for and rejected by +the games themselves; this needs to be a LAN or WAN IP (or a hostname that +resolves to one). + +### `title` + +Default: `title` + +Leave it as `title` to use the title server returned by ALL.Net. Rewrites +the title server hostname for certain games, such as crossbeats REV. + +### `router` + +Default: Empty string (i.e. use value from `default` setting) + +Overrides the target of the `tenporouter.loc` and `bbrouter.loc` hostname +lookups. + +### `startup` + +Default: Empty string (i.e. use value from `default` setting) + +Overrides the target of the `naominet.jp` host lookup. + +### `billing` + +Default: Empty string (i.e. use value from `default` setting) + +Overrides the target of the `ib.naominet.jp` host lookup. + +### `aimedb` + +Default: Empty string (i.e. use value from `default` setting) + +Overrides the target of the `aime.naominet.jp` host lookup. + +## `[ds]` + +Controls emulation of the "DS (Dallas Semiconductor) EEPROM" chip on the AMEX +PCIe board. This is a small (32 byte) EEPROM that contains serial number and +region code information. It is not normally written to outside of inital +factory provisioning of a Sega Nu. + +### `enable` + +Default: `1` + +Enable DS EEPROM emulation. Disable to use the DS EEPROM chip on a real AMEX. + +### `region` + +Default: `1` + +AMEX Board region code. This appears to be a bit mask? + +- `1`: Japan +- `2`: USA? (Dead code, not used) +- `4`: Export +- `8`: China + +### `serialNo` + +Default `AAVE-01A99999999` + +"MAIN ID" serial number. First three characters are hardware series: + +- `AAV`: Nu-series +- `AAW`: NuSX-series +- `ACA`: ALLS-series + +## `[eeprom]` + +Controls emulation of the bulk EEPROM on the AMEX PCIe board. This chip stores +status and configuration information. + +### `enable` + +Default: `1` + +Enable bulk EEPROM emulation. Disable to use the bulk EEPROM chip on a real +AMEX. + +### `path` + +Default: `DEVICE\eeprom.bin` + +Path to the storage file for EEPROM emulation. This file is automatically +created and initialized with a suitable number of zero bytes if it does not +already exist. + +## `[gpio]` + +Configure emulation of the AMEX PCIe GPIO (General Purpose Input Output) +controller. + +### `enable` + +Default: `1` + +Enable GPIO emulation. Disable to use the GPIO controller on a real AMEX. + +### `sw1` + +Default `0x70` (`VK_F1`) + +Keyboard binding for Nu chassis SW1 button (alternative Test) + +### `sw2` + +Default `0x71` (`VK_F2`) + +Keyboard binding for Nu chassis SW2 button (alternative Service) + +### `dipsw1` .. `dipsw8` + +Defaults: `1`, `0`, `0`, `0`, `0`, `0`, `0`, `0` + +Nu chassis DIP switch settings: + +- Switch 1: Game-specific, but usually controls the "distribution server" + setting. Exactly one arcade machine on a cabinet router must be set to the + Server setting. + - `0`: Client + - `1`: Server +- Switch 2,3: Game-specific. + - Used by Mario&Sonic to configure cabinet ID, possibly other games. +- Switch 4: Screen orientation. Only used by the Nu system startup program. + - `0`: YOKO/Horizontal + - `1`: TATE/Vertical +- Switch 5,6,7: Screen resolution. Only used by the Nu system startup program. + - `000`: No change + - `100`: 640x480 + - `010`: 1024x600 + - `110`: 1024x768 + - `001`: 1280x720 + - `101`: 1280x1024 + - `110`: 1360x768 + - `111`: 1920x1080 +- Switch 8: Game-specific. Not used in any shipping game. + +## `[hwmon]` + +Configure stub implementation of the platform hardware monitor driver. The +real implementation of this driver monitors CPU temperatures by reading from +Intel Model Specific Registers, which is an action that is only permitted from +kernel mode. + +### `enable` + +Default `1` + +Enable hwmon emulation. Disable to use the real hwmon driver. + +## `[jvs]` + +Configure emulation of the AMEX PCIe JVS *controller* (not IO board!) + +### `enable` + +Default `1` + +Enable JVS port emulation. Disable to use the JVS port on a real AMEX. + +## `[io4]` + +Configure emulation of the IO4 board. Same settings also apply to `[io3]`. + +### `enable` + +Default `1` + +Enable IO4 port emulation. Disable to use the IO4 port on a real ALLS. + +### `test` +Default `0x31` + +Test button virtual-key code. Default is the 1 key. + +### `service` + +Default `0x32` + +Service button virtual-key code. Default is the 2 key. + +### `coin` + +Default `0x33` + +Keyboard button to increment coin counter. Default is the 3 key. + +## `[keychip]` + +Configure keychip emulation. + +### `enable` + +Enable keychip emulation. Disable to use a real keychip. + +### `id` + +Default: `A69E-01A88888888` + +Keychip serial number. Keychip serials observed in the wild follow this +pattern: `A\d{2}(E|X)-(01|20)[ABCDU]\d{8}`. + +### `gameId` + +Default: (Varies depending on game) + +Override the game's four-character model code. Changing this from the game's +expected value will probably just cause a system error. + +### `platformId` + +Default: (Varies depending on game) + +Override the game's four-character platform code (e.g. `AAV2` for Nu 2). This +is actually supposed to be a separate three-character `platformId` and +integer `modelType` setting, but they are combined here for convenience. Valid +values include: + +- `AAV0`: Nu 1 (Project DIVA) +- `AAV1`: Nu 1.1 (Chunithm) +- `AAV2`: Nu 2 (Initial D Zero) +- `AAW0`: NuSX 1 +- `AAW1`: NuSX 1.1 +- `ACA0`: ALLS UX +- `ACA1`: ALLS HX +- `ACA2`: ALLS UX (without dedicated GPU) +- `ACA4`: ALLS MX + +### `region` + +Default: `1` + +Override the keychip's region code. Most games seem to pay attention to the +DS EEPROM region code and not the keychip region code, and this seems to be +a bit mask that controls which Nu PCB region codes this keychip is authorized +for. So it probably only affects the system software and not the game software. +Bit values are: + +- 1: JPN: Japan +- 2: USA (unused) +- 3: EXP: Export (for Asian markets) +- 4: CHS: China (Simplified Chinese?) + +### `billingCa` + +Default: `DEVICE\\ca.crt` + +Set the billing certificate path. This has to match the one used for the +SSL billing server. The DER certificate must fit in 1024 bytes so it must be +small. + +### `billingPub` + +Default: `DEVICE\\billing.pub` + +Set the actual keychip RSA public key path. This public key has to match the +private key `billing.key` of the billing server in order to decrypt/encrypt +the billing transactions. + +### `billingType` + +Default: `1` + +Set the billing "type" for the keychip. The type determins what kind of revenue share, +if any, the game maker has with SEGA. Some games may be picky and require types other +then 1 (ex. crossbeats REV. requires billing type 2), so this option is provided if this +is an issue. Billing types are: + +- 0: No billing? +- 1: Billing type A +- 2: Billing type B1 +- 3: Billing type B2 + +### `systemFlag` + +Default: `0x64` + +An 8-bit bitfield of unclear meaning. The least significant bit indicates a +developer dongle. Changing this doesn't seem to have any effect on +anything other than SEGA AM2 games. + +Other values observed in the wild: + +- `0x04`: SDCH, SDCA +- `0x20`: SDCA + +### `subnet` + +Default `192.168.100.0` + +The LAN IP range that the game will expect. The prefix length is hardcoded into +the game program: for some games this is `/24`, for others it is `/20`. + +## `[netenv]` + +Configure network environment virtualization. This module helps bypass various +restrictions placed upon the game's LAN environment. + +### `enable` + +Default `1` + +Enable network environment virtualization. You may need to disable this if +you want to do any head-to-head play on your LAN. + +Note: The virtualized LAN IP range is taken from the emulated keychip's +`subnet` setting. + +### `addrSuffix` + +Default: `11` + +The final octet of the local host's IP address on the virtualized subnet (so, +if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the +local host's virtualized LAN IP is `192.168.32.11`). + +### `routerSuffix` + +Default: `1` + +The final octet of the default gateway's IP address on the virtualized subnet. + +### `macAddr` + +Default: `01:02:03:04:05:06` + +The MAC address of the virtualized Ethernet adapter. The exact value shouldn't +ever matter. + +## `[pcbid]` + +Configure Windows host name virtualization. The ALLS-series platform no longer +has an AMEX board, so the MAIN ID serial number is stored in the Windows +hostname. + +### `enable` + +Default: `1` + +Enable Windows host name virtualization. This is only needed for ALLS-platform +games (since the ALLS lacks an AMEX and therefore has no DS EEPROM, so it needs +another way to store the PCB serial), but it does no harm on games that run on +earlier hardware. + +### `serialNo` + +Default: `ACAE01A99999999` + +Set the Windows host name. This should be an ALLS MAIN ID, without the +hyphen (which is not a valid character in a Windows host name). + +## `[sram]` + +Configure emulation of the AMEX PCIe battery-backed SRAM. This stores +bookkeeping state and settings. This file is automatically created and +initialized with a suitable number of zero bytes if it does not already exist. + +### `enable` + +Default `1` + +Enable SRAM emulation. Disable to use the SRAM on a real AMEX. + +### `path` + +Default `DEVICE\sram.bin` + +Path to the storage file for SRAM emulation. + +## `[vfs]` + +Configure Windows path redirection hooks. + +### `enable` + +Default: `1` + +Enable path redirection. + +### `amfs` + +Default: Empty string (causes a startup error) + +Configure the location of the SEGA AMFS volume. Stored on the `E` partition on +real hardware. + +### `appdata` + +Default: Empty string (causes a startup error) + +Configure the location of the SEGA "APPDATA" volume (nothing to do with the +Windows user's `%APPDATA%` directory). Stored on the `Y` partition on real +hardware. + +### `option` + +Default: Empty string + +Configure the location of the "Option" data mount point. This mount point is +optional (hence the name, probably) and contains directories which contain +minor over-the-air content updates. diff --git a/meson.build b/meson.build index 23e88d3..ca5bc66 100644 --- a/meson.build +++ b/meson.build @@ -1,130 +1,130 @@ -project( - 'segatools', - 'c', - version: '0.1.0', - default_options: [ - 'werror=true', - ], -) - -add_project_arguments( - '-DCOBJMACROS', - '-DDIRECTINPUT_VERSION=0x0800', - '-DWIN32_LEAN_AND_MEAN', - '-D_WIN32_WINNT=_WIN32_WINNT_WIN7', - '-DMINGW_HAS_SECURE_API=1', - '-Wno-unused', - # '-ggdb', # Add debug information - language: 'c', -) - -cc = meson.get_compiler('c') - -if cc.get_id() != 'msvc' - add_project_arguments( - '-ffunction-sections', - '-fdata-sections', - language: 'c', - ) - - add_project_link_arguments( - '-Wl,--enable-stdcall-fixup', - '-Wl,--exclude-all-symbols', - '-Wl,--gc-sections', - '-static-libgcc', - # '-ggdb', # Add debug information - '-lcrypt32', # Bcrypt needed for prashook - # '-Wl,-s', # Strip debug symbols - language: 'c', - ) -endif - -if get_option('log_all') or get_option('log_jvs') - add_project_arguments('-DLOG_JVS', language: 'c') -endif -if get_option('log_all') or get_option('log_io3') - add_project_arguments('-DLOG_IO3', language: 'c') -endif -if get_option('log_all') or get_option('log_led15093') - add_project_arguments('-DLOG_LED15093', language: 'c') -endif -if get_option('log_all') or get_option('log_nfc') - add_project_arguments('-DLOG_NFC', language: 'c') -endif -if get_option('log_all') or get_option('log_carol_control_bd') - add_project_arguments('-DLOG_CAROL_CONTROL_BD', language: 'c') -endif -if get_option('log_all') or get_option('log_carol_led_bd') - add_project_arguments('-DLOG_CAROL_LED_BD', language: 'c') -endif -if get_option('log_all') or get_option('log_carol_touch') - add_project_arguments('-DLOG_CAROL_TOUCH', language: 'c') -endif -if get_option('log_all') or get_option('log_chuni_slider') - add_project_arguments('-DLOG_CHUNI_SLIDER', language: 'c') -endif -if get_option('log_all') or get_option('log_chusan_slider') - add_project_arguments('-DLOG_CHUSAN_SLIDER', language: 'c') -endif -if get_option('log_all') or get_option('log_diva_slider') - add_project_arguments('-DLOG_DIVA_SLIDER', language: 'c') -endif -if get_option('log_all') or get_option('log_mercury_slider') - add_project_arguments('-DLOG_MERCURY_SLIDER', language: 'c') -endif -if get_option('log_all') or get_option('log_clock') - add_project_arguments('-DLOG_CLOCK', language: 'c') -endif - -shlwapi_lib = cc.find_library('shlwapi') -dinput8_lib = cc.find_library('dinput8') -dxguid_lib = cc.find_library('dxguid') -xinput_lib = cc.find_library('xinput') -pathcch_lib = cc.find_library('pathcch') - -inc = include_directories('.') -capnhook = subproject('capnhook') - -subdir('amex') -subdir('iccard') -subdir('board') -subdir('hooklib') -subdir('jvs') -subdir('platform') -subdir('util') - -subdir('gfxhook') -subdir('unityhook') - -subdir('aimeio') -subdir('chuniio') -subdir('divaio') -subdir('carolio') -subdir('idzio') -subdir('idacio') -subdir('swdcio') -subdir('mu3io') -subdir('mai2io') -subdir('cmio') -subdir('apm3io') -subdir('mercuryio') -subdir('cxbio') -subdir('tokyoio') -subdir('fgoio') - -subdir('chunihook') -subdir('divahook') -subdir('carolhook') -subdir('idzhook') -subdir('idachook') -subdir('swdchook') -subdir('minihook') -subdir('chusanhook') -subdir('mu3hook') -subdir('mai2hook') -subdir('cmhook') -subdir('apm3hook') -subdir('mercuryhook') -subdir('cxbhook') -subdir('tokyohook') -subdir('fgohook') +project( + 'segatools', + 'c', + version: '0.1.0', + default_options: [ + 'werror=true', + ], +) + +add_project_arguments( + '-DCOBJMACROS', + '-DDIRECTINPUT_VERSION=0x0800', + '-DWIN32_LEAN_AND_MEAN', + '-D_WIN32_WINNT=_WIN32_WINNT_WIN7', + '-DMINGW_HAS_SECURE_API=1', + '-Wno-unused', + # '-ggdb', # Add debug information + language: 'c', +) + +cc = meson.get_compiler('c') + +if cc.get_id() != 'msvc' + add_project_arguments( + '-ffunction-sections', + '-fdata-sections', + language: 'c', + ) + + add_project_link_arguments( + '-Wl,--enable-stdcall-fixup', + '-Wl,--exclude-all-symbols', + '-Wl,--gc-sections', + '-static-libgcc', + # '-ggdb', # Add debug information + '-lcrypt32', # Bcrypt needed for prashook + # '-Wl,-s', # Strip debug symbols + language: 'c', + ) +endif + +if get_option('log_all') or get_option('log_jvs') + add_project_arguments('-DLOG_JVS', language: 'c') +endif +if get_option('log_all') or get_option('log_io3') + add_project_arguments('-DLOG_IO3', language: 'c') +endif +if get_option('log_all') or get_option('log_led15093') + add_project_arguments('-DLOG_LED15093', language: 'c') +endif +if get_option('log_all') or get_option('log_nfc') + add_project_arguments('-DLOG_NFC', language: 'c') +endif +if get_option('log_all') or get_option('log_carol_control_bd') + add_project_arguments('-DLOG_CAROL_CONTROL_BD', language: 'c') +endif +if get_option('log_all') or get_option('log_carol_led_bd') + add_project_arguments('-DLOG_CAROL_LED_BD', language: 'c') +endif +if get_option('log_all') or get_option('log_carol_touch') + add_project_arguments('-DLOG_CAROL_TOUCH', language: 'c') +endif +if get_option('log_all') or get_option('log_chuni_slider') + add_project_arguments('-DLOG_CHUNI_SLIDER', language: 'c') +endif +if get_option('log_all') or get_option('log_chusan_slider') + add_project_arguments('-DLOG_CHUSAN_SLIDER', language: 'c') +endif +if get_option('log_all') or get_option('log_diva_slider') + add_project_arguments('-DLOG_DIVA_SLIDER', language: 'c') +endif +if get_option('log_all') or get_option('log_mercury_slider') + add_project_arguments('-DLOG_MERCURY_SLIDER', language: 'c') +endif +if get_option('log_all') or get_option('log_clock') + add_project_arguments('-DLOG_CLOCK', language: 'c') +endif + +shlwapi_lib = cc.find_library('shlwapi') +dinput8_lib = cc.find_library('dinput8') +dxguid_lib = cc.find_library('dxguid') +xinput_lib = cc.find_library('xinput') +pathcch_lib = cc.find_library('pathcch') + +inc = include_directories('.') +capnhook = subproject('capnhook') + +subdir('amex') +subdir('iccard') +subdir('board') +subdir('hooklib') +subdir('jvs') +subdir('platform') +subdir('util') + +subdir('gfxhook') +subdir('unityhook') + +subdir('aimeio') +subdir('chuniio') +subdir('divaio') +subdir('carolio') +subdir('idzio') +subdir('idacio') +subdir('swdcio') +subdir('mu3io') +subdir('mai2io') +subdir('cmio') +subdir('apm3io') +subdir('mercuryio') +subdir('cxbio') +subdir('tokyoio') +subdir('fgoio') + +subdir('chunihook') +subdir('divahook') +subdir('carolhook') +subdir('idzhook') +subdir('idachook') +subdir('swdchook') +subdir('minihook') +subdir('chusanhook') +subdir('mu3hook') +subdir('mai2hook') +subdir('cmhook') +subdir('apm3hook') +subdir('mercuryhook') +subdir('cxbhook') +subdir('tokyohook') +subdir('fgohook') diff --git a/multihook/dllmain.c b/multihook/dllmain.c new file mode 100644 index 0000000..e69de29 diff --git a/multihook/meson.build b/multihook/meson.build new file mode 100644 index 0000000..d7410f2 --- /dev/null +++ b/multihook/meson.build @@ -0,0 +1,31 @@ +shared_library( + 'multihook', + name_prefix : '', + include_directories : inc, + implicit_include_directories : false, + vs_module_defs : 'multihook.def', + c_pch : '../precompiled.h', + dependencies : [ + capnhook.get_variable('hook_dep'), + capnhook.get_variable('hooklib_dep'), + xinput_lib, + ], + link_with : [ + aimeio_lib, + board_lib, + hooklib_lib, + multiio_lib, + platform_lib, + unityhook_lib, + util_lib, + ], + sources : [ + 'config.c', + 'config.h', + 'dllmain.c', + 'io4.c', + 'io4.h', + 'multi-dll.c', + 'multi-dll.h', + ], +) diff --git a/multihook/multihook.def b/multihook/multihook.def new file mode 100644 index 0000000..85bd7db --- /dev/null +++ b/multihook/multihook.def @@ -0,0 +1,17 @@ +LIBRARY multihook + +EXPORTS + aime_io_get_api_version + aime_io_init + aime_io_led_set_color + aime_io_nfc_get_aime_id + aime_io_nfc_get_felica_id + aime_io_nfc_poll + amDllVideoClose @2 + amDllVideoGetVBiosVersion @4 + amDllVideoOpen @1 + amDllVideoSetResolution @3 + multi_io_get_api_version + multi_io_get_opbtns + multi_io_init + multi_io_poll