Merge development into apm3

This commit is contained in:
2024-08-26 10:29:04 +02:00
parent fbaa8c1c42
commit 944e09f40c
36 changed files with 4378 additions and 4373 deletions

16
.vscode/settings.json vendored
View File

@ -1,8 +1,8 @@
{ {
"editor.formatOnSave": false, "editor.formatOnSave": false,
"mesonbuild.configureOnOpen": false, "mesonbuild.configureOnOpen": false,
"files.associations": { "files.associations": {
"*.embeddedhtml": "html", "*.embeddedhtml": "html",
"config.h": "c" "config.h": "c"
}, },
} }

View File

@ -1,266 +1,266 @@
$(BUILD_DIR_ZIP)/chuni.zip: $(BUILD_DIR_ZIP)/chuni.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/chuni $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni
$(V)mkdir -p $(BUILD_DIR_ZIP)/chuni/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/chuni/DEVICE
$(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_32)/chunihook/chunihook.dll \ $(BUILD_DIR_32)/chunihook/chunihook.dll \
$(DIST_DIR)/chuni/segatools.ini \ $(DIST_DIR)/chuni/segatools.ini \
$(DIST_DIR)/chuni/start.bat \ $(DIST_DIR)/chuni/start.bat \
$(BUILD_DIR_ZIP)/chuni $(BUILD_DIR_ZIP)/chuni
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/chuni/DEVICE $(BUILD_DIR_ZIP)/chuni/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/chuni/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/chuni/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/chuni ; zip -r ../chuni.zip * $(V)cd $(BUILD_DIR_ZIP)/chuni ; zip -r ../chuni.zip *
$(BUILD_DIR_ZIP)/cxb.zip: $(BUILD_DIR_ZIP)/cxb.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/cxb $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb
$(V)mkdir -p $(BUILD_DIR_ZIP)/cxb/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/cxb/DEVICE
$(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_32)/cxbhook/cxbhook.dll \ $(BUILD_DIR_32)/cxbhook/cxbhook.dll \
$(DIST_DIR)/cxb/segatools.ini \ $(DIST_DIR)/cxb/segatools.ini \
$(DIST_DIR)/cxb/start.bat \ $(DIST_DIR)/cxb/start.bat \
$(BUILD_DIR_ZIP)/cxb $(BUILD_DIR_ZIP)/cxb
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/cxb/DEVICE $(BUILD_DIR_ZIP)/cxb/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/cxb/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/cxb/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/cxb ; zip -r ../cxb.zip * $(V)cd $(BUILD_DIR_ZIP)/cxb ; zip -r ../cxb.zip *
$(BUILD_DIR_ZIP)/diva.zip: $(BUILD_DIR_ZIP)/diva.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/diva $(V)mkdir -p $(BUILD_DIR_ZIP)/diva
$(V)mkdir -p $(BUILD_DIR_ZIP)/diva/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/diva/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/divahook/divahook.dll \ $(BUILD_DIR_64)/divahook/divahook.dll \
$(DIST_DIR)/diva/segatools.ini \ $(DIST_DIR)/diva/segatools.ini \
$(DIST_DIR)/diva/start.bat \ $(DIST_DIR)/diva/start.bat \
$(BUILD_DIR_ZIP)/diva $(BUILD_DIR_ZIP)/diva
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/diva/DEVICE $(BUILD_DIR_ZIP)/diva/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/diva/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/diva/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/diva ; zip -r ../diva.zip * $(V)cd $(BUILD_DIR_ZIP)/diva ; zip -r ../diva.zip *
$(BUILD_DIR_ZIP)/carol.zip: $(BUILD_DIR_ZIP)/carol.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/carol $(V)mkdir -p $(BUILD_DIR_ZIP)/carol
$(V)mkdir -p $(BUILD_DIR_ZIP)/carol/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/carol/DEVICE
$(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_32)/carolhook/carolhook.dll \ $(BUILD_DIR_32)/carolhook/carolhook.dll \
$(DIST_DIR)/carol/segatools.ini \ $(DIST_DIR)/carol/segatools.ini \
$(DIST_DIR)/carol/start.bat \ $(DIST_DIR)/carol/start.bat \
$(BUILD_DIR_ZIP)/carol $(BUILD_DIR_ZIP)/carol
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/carol/DEVICE $(BUILD_DIR_ZIP)/carol/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/carol/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/carol/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/carol ; zip -r ../carol.zip * $(V)cd $(BUILD_DIR_ZIP)/carol ; zip -r ../carol.zip *
$(BUILD_DIR_ZIP)/idz.zip: $(BUILD_DIR_ZIP)/idz.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/idz $(V)mkdir -p $(BUILD_DIR_ZIP)/idz
$(V)mkdir -p $(BUILD_DIR_ZIP)/idz/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/idz/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/idzhook/idzhook.dll \ $(BUILD_DIR_64)/idzhook/idzhook.dll \
$(DIST_DIR)/idz/segatools.ini \ $(DIST_DIR)/idz/segatools.ini \
$(DIST_DIR)/idz/start.bat \ $(DIST_DIR)/idz/start.bat \
$(BUILD_DIR_ZIP)/idz $(BUILD_DIR_ZIP)/idz
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/idz/DEVICE $(BUILD_DIR_ZIP)/idz/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/idz/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/idz/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/idz ; zip -r ../idz.zip * $(V)cd $(BUILD_DIR_ZIP)/idz ; zip -r ../idz.zip *
$(BUILD_DIR_ZIP)/fgo.zip: $(BUILD_DIR_ZIP)/fgo.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/fgo $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo
$(V)mkdir -p $(BUILD_DIR_ZIP)/fgo/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/fgo/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/fgohook/fgohook.dll \ $(BUILD_DIR_64)/fgohook/fgohook.dll \
$(DIST_DIR)/fgo/segatools.ini \ $(DIST_DIR)/fgo/segatools.ini \
$(DIST_DIR)/fgo/start.bat \ $(DIST_DIR)/fgo/start.bat \
$(BUILD_DIR_ZIP)/fgo $(BUILD_DIR_ZIP)/fgo
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/fgo/DEVICE $(BUILD_DIR_ZIP)/fgo/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/fgo/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/fgo/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/fgo ; zip -r ../fgo.zip * $(V)cd $(BUILD_DIR_ZIP)/fgo ; zip -r ../fgo.zip *
$(BUILD_DIR_ZIP)/idac.zip: $(BUILD_DIR_ZIP)/idac.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/idac $(V)mkdir -p $(BUILD_DIR_ZIP)/idac
$(V)mkdir -p $(BUILD_DIR_ZIP)/idac/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/idac/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/idachook/idachook.dll \ $(BUILD_DIR_64)/idachook/idachook.dll \
$(DIST_DIR)/idac/segatools.ini \ $(DIST_DIR)/idac/segatools.ini \
$(DIST_DIR)/idac/config_hook.json \ $(DIST_DIR)/idac/config_hook.json \
$(DIST_DIR)/idac/start.bat \ $(DIST_DIR)/idac/start.bat \
$(BUILD_DIR_ZIP)/idac $(BUILD_DIR_ZIP)/idac
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/idac/DEVICE $(BUILD_DIR_ZIP)/idac/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/idac/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/idac/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/idac ; zip -r ../idac.zip * $(V)cd $(BUILD_DIR_ZIP)/idac ; zip -r ../idac.zip *
$(BUILD_DIR_ZIP)/swdc.zip: $(BUILD_DIR_ZIP)/swdc.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/swdc $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc
$(V)mkdir -p $(BUILD_DIR_ZIP)/swdc/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/swdc/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/swdchook/swdchook.dll \ $(BUILD_DIR_64)/swdchook/swdchook.dll \
$(DIST_DIR)/swdc/segatools.ini \ $(DIST_DIR)/swdc/segatools.ini \
$(DIST_DIR)/swdc/config_hook.json \ $(DIST_DIR)/swdc/config_hook.json \
$(DIST_DIR)/swdc/start.bat \ $(DIST_DIR)/swdc/start.bat \
$(BUILD_DIR_ZIP)/swdc $(BUILD_DIR_ZIP)/swdc
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/swdc/DEVICE $(BUILD_DIR_ZIP)/swdc/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/swdc/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/swdc/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/swdc ; zip -r ../swdc.zip * $(V)cd $(BUILD_DIR_ZIP)/swdc ; zip -r ../swdc.zip *
$(BUILD_DIR_ZIP)/mercury.zip: $(BUILD_DIR_ZIP)/mercury.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/mercury $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury
$(V)mkdir -p $(BUILD_DIR_ZIP)/mercury/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/mercury/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/mercuryhook/mercuryhook.dll \ $(BUILD_DIR_64)/mercuryhook/mercuryhook.dll \
$(DIST_DIR)/mercury/segatools.ini \ $(DIST_DIR)/mercury/segatools.ini \
$(DIST_DIR)/mercury/start.bat \ $(DIST_DIR)/mercury/start.bat \
$(BUILD_DIR_ZIP)/mercury $(BUILD_DIR_ZIP)/mercury
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/mercury/DEVICE $(BUILD_DIR_ZIP)/mercury/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/mercury/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/mercury/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/mercury ; zip -r ../mercury.zip * $(V)cd $(BUILD_DIR_ZIP)/mercury ; zip -r ../mercury.zip *
$(BUILD_DIR_ZIP)/chusan.zip: $(BUILD_DIR_ZIP)/chusan.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/chusan $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan
$(V)mkdir -p $(BUILD_DIR_ZIP)/chusan/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/chusan/DEVICE
$(V)cp $(DIST_DIR)/chusan/segatools.ini \ $(V)cp $(DIST_DIR)/chusan/segatools.ini \
$(DIST_DIR)/chusan/config_hook.json \ $(DIST_DIR)/chusan/config_hook.json \
$(DIST_DIR)/chusan/start.bat \ $(DIST_DIR)/chusan/start.bat \
$(BUILD_DIR_ZIP)/chusan $(BUILD_DIR_ZIP)/chusan
$(V)cp $(BUILD_DIR_32)/chusanhook/chusanhook.dll \ $(V)cp $(BUILD_DIR_32)/chusanhook/chusanhook.dll \
$(BUILD_DIR_ZIP)/chusan/chusanhook_x86.dll $(BUILD_DIR_ZIP)/chusan/chusanhook_x86.dll
$(V)cp $(BUILD_DIR_64)/chusanhook/chusanhook.dll \ $(V)cp $(BUILD_DIR_64)/chusanhook/chusanhook.dll \
$(BUILD_DIR_ZIP)/chusan/chusanhook_x64.dll $(BUILD_DIR_ZIP)/chusan/chusanhook_x64.dll
$(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_32)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_ZIP)/chusan/inject_x86.exe $(BUILD_DIR_ZIP)/chusan/inject_x86.exe
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_ZIP)/chusan/inject_x64.exe $(BUILD_DIR_ZIP)/chusan/inject_x64.exe
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/chusan/DEVICE $(BUILD_DIR_ZIP)/chusan/DEVICE
for x in exe dll; do strip $(BUILD_DIR_ZIP)/chusan/*.$$x; done for x in exe dll; do strip $(BUILD_DIR_ZIP)/chusan/*.$$x; done
$(V)cd $(BUILD_DIR_ZIP)/chusan ; zip -r ../chusan.zip * $(V)cd $(BUILD_DIR_ZIP)/chusan ; zip -r ../chusan.zip *
$(BUILD_DIR_ZIP)/mu3.zip: $(BUILD_DIR_ZIP)/mu3.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/mu3 $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3
$(V)mkdir -p $(BUILD_DIR_ZIP)/mu3/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/mu3/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/mu3hook/mu3hook.dll \ $(BUILD_DIR_64)/mu3hook/mu3hook.dll \
$(DIST_DIR)/mu3/segatools.ini \ $(DIST_DIR)/mu3/segatools.ini \
$(DIST_DIR)/mu3/start.bat \ $(DIST_DIR)/mu3/start.bat \
$(BUILD_DIR_ZIP)/mu3 $(BUILD_DIR_ZIP)/mu3
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/mu3/DEVICE $(BUILD_DIR_ZIP)/mu3/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/mu3/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/mu3/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/mu3 ; zip -r ../mu3.zip * $(V)cd $(BUILD_DIR_ZIP)/mu3 ; zip -r ../mu3.zip *
$(BUILD_DIR_ZIP)/mai2.zip: $(BUILD_DIR_ZIP)/mai2.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/mai2 $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2
$(V)mkdir -p $(BUILD_DIR_ZIP)/mai2/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/mai2/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/mai2hook/mai2hook.dll \ $(BUILD_DIR_64)/mai2hook/mai2hook.dll \
$(DIST_DIR)/mai2/segatools.ini \ $(DIST_DIR)/mai2/segatools.ini \
$(DIST_DIR)/mai2/start.bat \ $(DIST_DIR)/mai2/start.bat \
$(BUILD_DIR_ZIP)/mai2 $(BUILD_DIR_ZIP)/mai2
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/mai2/DEVICE $(BUILD_DIR_ZIP)/mai2/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/mai2/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/mai2/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/mai2 ; zip -r ../mai2.zip * $(V)cd $(BUILD_DIR_ZIP)/mai2 ; zip -r ../mai2.zip *
$(BUILD_DIR_ZIP)/cm.zip: $(BUILD_DIR_ZIP)/cm.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/cm $(V)mkdir -p $(BUILD_DIR_ZIP)/cm
$(V)mkdir -p $(BUILD_DIR_ZIP)/cm/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/cm/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/cmhook/cmhook.dll \ $(BUILD_DIR_64)/cmhook/cmhook.dll \
$(DIST_DIR)/cm/config_hook.json \ $(DIST_DIR)/cm/config_hook.json \
$(DIST_DIR)/cm/segatools.ini \ $(DIST_DIR)/cm/segatools.ini \
$(DIST_DIR)/cm/start.bat \ $(DIST_DIR)/cm/start.bat \
$(BUILD_DIR_ZIP)/cm $(BUILD_DIR_ZIP)/cm
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/cm/DEVICE $(BUILD_DIR_ZIP)/cm/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/cm/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/cm/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/cm ; zip -r ../cm.zip * $(V)cd $(BUILD_DIR_ZIP)/cm ; zip -r ../cm.zip *
$(BUILD_DIR_ZIP)/apm3.zip: $(BUILD_DIR_ZIP)/apm3.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/apm3 $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3
$(V)mkdir -p $(BUILD_DIR_ZIP)/apm3/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/apm3/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/apm3hook/apm3hook.dll \ $(BUILD_DIR_64)/apm3hook/apm3hook.dll \
$(DIST_DIR)/apm3/segatools.ini \ $(DIST_DIR)/apm3/segatools.ini \
$(DIST_DIR)/apm3/start.bat \ $(DIST_DIR)/apm3/start.bat \
$(BUILD_DIR_ZIP)/apm3 $(BUILD_DIR_ZIP)/apm3
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/apm3/DEVICE $(BUILD_DIR_ZIP)/apm3/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/apm3/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/apm3/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/apm3 ; zip -r ../apm3.zip * $(V)cd $(BUILD_DIR_ZIP)/apm3 ; zip -r ../apm3.zip *
$(BUILD_DIR_ZIP)/tokyo.zip: $(BUILD_DIR_ZIP)/tokyo.zip:
$(V)echo ... $@ $(V)echo ... $@
$(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo
$(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo/DEVICE $(V)mkdir -p $(BUILD_DIR_ZIP)/tokyo/DEVICE
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \ $(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/tokyohook/tokyohook.dll \ $(BUILD_DIR_64)/tokyohook/tokyohook.dll \
$(DIST_DIR)/tokyo/config_hook.json \ $(DIST_DIR)/tokyo/config_hook.json \
$(DIST_DIR)/tokyo/segatools.ini \ $(DIST_DIR)/tokyo/segatools.ini \
$(DIST_DIR)/tokyo/start.bat \ $(DIST_DIR)/tokyo/start.bat \
$(BUILD_DIR_ZIP)/tokyo $(BUILD_DIR_ZIP)/tokyo
$(V)cp pki/billing.pub \ $(V)cp pki/billing.pub \
pki/ca.crt \ pki/ca.crt \
$(BUILD_DIR_ZIP)/tokyo/DEVICE $(BUILD_DIR_ZIP)/tokyo/DEVICE
$(V)strip $(BUILD_DIR_ZIP)/tokyo/*.{exe,dll} $(V)strip $(BUILD_DIR_ZIP)/tokyo/*.{exe,dll}
$(V)cd $(BUILD_DIR_ZIP)/tokyo ; zip -r ../tokyo.zip * $(V)cd $(BUILD_DIR_ZIP)/tokyo ; zip -r ../tokyo.zip *
$(BUILD_DIR_ZIP)/doc.zip: \ $(BUILD_DIR_ZIP)/doc.zip: \
$(DOC_DIR)/config \ $(DOC_DIR)/config \
$(DOC_DIR)/chunihook.md \ $(DOC_DIR)/chunihook.md \
$(DOC_DIR)/idzhook.md \ $(DOC_DIR)/idzhook.md \
| $(zipdir)/ | $(zipdir)/
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -r $@ $^ $(V)zip -r $@ $^
$(BUILD_DIR_ZIP)/segatools.zip: \ $(BUILD_DIR_ZIP)/segatools.zip: \
$(BUILD_DIR_ZIP)/chuni.zip \ $(BUILD_DIR_ZIP)/chuni.zip \
$(BUILD_DIR_ZIP)/cxb.zip \ $(BUILD_DIR_ZIP)/cxb.zip \
$(BUILD_DIR_ZIP)/carol.zip \ $(BUILD_DIR_ZIP)/carol.zip \
$(BUILD_DIR_ZIP)/diva.zip \ $(BUILD_DIR_ZIP)/diva.zip \
$(BUILD_DIR_ZIP)/doc.zip \ $(BUILD_DIR_ZIP)/doc.zip \
$(BUILD_DIR_ZIP)/idz.zip \ $(BUILD_DIR_ZIP)/idz.zip \
$(BUILD_DIR_ZIP)/idac.zip \ $(BUILD_DIR_ZIP)/idac.zip \
$(BUILD_DIR_ZIP)/swdc.zip \ $(BUILD_DIR_ZIP)/swdc.zip \
$(BUILD_DIR_ZIP)/mercury.zip \ $(BUILD_DIR_ZIP)/mercury.zip \
$(BUILD_DIR_ZIP)/chusan.zip \ $(BUILD_DIR_ZIP)/chusan.zip \
$(BUILD_DIR_ZIP)/mu3.zip \ $(BUILD_DIR_ZIP)/mu3.zip \
$(BUILD_DIR_ZIP)/mai2.zip \ $(BUILD_DIR_ZIP)/mai2.zip \
$(BUILD_DIR_ZIP)/cm.zip \ $(BUILD_DIR_ZIP)/cm.zip \
$(BUILD_DIR_ZIP)/apm3.zip \ $(BUILD_DIR_ZIP)/apm3.zip \
$(BUILD_DIR_ZIP)/tokyo.zip \ $(BUILD_DIR_ZIP)/tokyo.zip \
$(BUILD_DIR_ZIP)/fgo.zip \ $(BUILD_DIR_ZIP)/fgo.zip \
CHANGELOG.md \ CHANGELOG.md \
README.md \ README.md \
$(V)echo ... $@ $(V)echo ... $@
$(V)zip -j $@ $^ $(V)zip -j $@ $^

View File

@ -1,112 +1,112 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "apm3hook/apm3-dll.h" #include "apm3hook/apm3-dll.h"
#include "util/dll-bind.h" #include "util/dll-bind.h"
#include "util/dprintf.h" #include "util/dprintf.h"
const struct dll_bind_sym apm3_dll_syms[] = { const struct dll_bind_sym apm3_dll_syms[] = {
{ {
.sym = "apm3_io_init", .sym = "apm3_io_init",
.off = offsetof(struct apm3_dll, init), .off = offsetof(struct apm3_dll, init),
}, { }, {
.sym = "apm3_io_poll", .sym = "apm3_io_poll",
.off = offsetof(struct apm3_dll, poll), .off = offsetof(struct apm3_dll, poll),
}, { }, {
.sym = "apm3_io_get_opbtns", .sym = "apm3_io_get_opbtns",
.off = offsetof(struct apm3_dll, get_opbtns), .off = offsetof(struct apm3_dll, get_opbtns),
}, { }, {
.sym = "apm3_io_led_init", .sym = "apm3_io_led_init",
.off = offsetof(struct apm3_dll, led_init), .off = offsetof(struct apm3_dll, led_init),
}, { }, {
.sym = "apm3_io_led_set_colors", .sym = "apm3_io_led_set_colors",
.off = offsetof(struct apm3_dll, led_set_leds), .off = offsetof(struct apm3_dll, led_set_leds),
} }
}; };
struct apm3_dll apm3_dll; struct apm3_dll apm3_dll;
// Copypasta DLL binding and diagnostic message boilerplate. // Copypasta DLL binding and diagnostic message boilerplate.
// Not much of this lends itself to being easily factored out. Also there // Not much of this lends itself to being easily factored out. Also there
// will be a lot of API-specific branching code here eventually as new API // will be a lot of API-specific branching code here eventually as new API
// versions get defined, so even though these functions all look the same // versions get defined, so even though these functions all look the same
// now this won't remain the case forever. // now this won't remain the case forever.
HRESULT apm3_dll_init(const struct apm3_dll_config *cfg, HINSTANCE self) HRESULT apm3_dll_init(const struct apm3_dll_config *cfg, HINSTANCE self)
{ {
uint16_t (*get_api_version)(void); uint16_t (*get_api_version)(void);
const struct dll_bind_sym *sym; const struct dll_bind_sym *sym;
HINSTANCE owned; HINSTANCE owned;
HINSTANCE src; HINSTANCE src;
HRESULT hr; HRESULT hr;
assert(cfg != NULL); assert(cfg != NULL);
assert(self != NULL); assert(self != NULL);
if (cfg->path[0] != L'\0') { if (cfg->path[0] != L'\0') {
owned = LoadLibraryW(cfg->path); owned = LoadLibraryW(cfg->path);
if (owned == NULL) { if (owned == NULL) {
hr = HRESULT_FROM_WIN32(GetLastError()); hr = HRESULT_FROM_WIN32(GetLastError());
dprintf("CardMaker IO: Failed to load IO DLL: %lx: %S\n", dprintf("CardMaker IO: Failed to load IO DLL: %lx: %S\n",
hr, hr,
cfg->path); cfg->path);
goto end; goto end;
} }
dprintf("CardMaker IO: Using custom IO DLL: %S\n", cfg->path); dprintf("CardMaker IO: Using custom IO DLL: %S\n", cfg->path);
src = owned; src = owned;
} else { } else {
owned = NULL; owned = NULL;
src = self; src = self;
} }
get_api_version = (void *) GetProcAddress(src, "apm3_io_get_api_version"); get_api_version = (void *) GetProcAddress(src, "apm3_io_get_api_version");
if (get_api_version != NULL) { if (get_api_version != NULL) {
apm3_dll.api_version = get_api_version(); apm3_dll.api_version = get_api_version();
} else { } else {
apm3_dll.api_version = 0x0100; apm3_dll.api_version = 0x0100;
dprintf("Custom IO DLL does not expose apm3_io_get_api_version, " dprintf("Custom IO DLL does not expose apm3_io_get_api_version, "
"assuming API version 1.0.\n" "assuming API version 1.0.\n"
"Please ask the developer to update their DLL.\n"); "Please ask the developer to update their DLL.\n");
} }
if (apm3_dll.api_version >= 0x0200) { if (apm3_dll.api_version >= 0x0200) {
hr = E_NOTIMPL; hr = E_NOTIMPL;
dprintf("CardMaker IO: Custom IO DLL implements an unsupported " dprintf("CardMaker IO: Custom IO DLL implements an unsupported "
"API version (%#04x). Please update Segatools.\n", "API version (%#04x). Please update Segatools.\n",
apm3_dll.api_version); apm3_dll.api_version);
goto end; goto end;
} }
sym = apm3_dll_syms; sym = apm3_dll_syms;
hr = dll_bind(&apm3_dll, src, &sym, _countof(apm3_dll_syms)); hr = dll_bind(&apm3_dll, src, &sym, _countof(apm3_dll_syms));
if (FAILED(hr)) { if (FAILED(hr)) {
if (src != self) { if (src != self) {
dprintf("CardMaker IO: Custom IO DLL does not provide function " dprintf("CardMaker IO: Custom IO DLL does not provide function "
"\"%s\". Please contact your IO DLL's developer for " "\"%s\". Please contact your IO DLL's developer for "
"further assistance.\n", "further assistance.\n",
sym->sym); sym->sym);
goto end; goto end;
} else { } else {
dprintf("Internal error: could not reflect \"%s\"\n", sym->sym); dprintf("Internal error: could not reflect \"%s\"\n", sym->sym);
} }
} }
owned = NULL; owned = NULL;
end: end:
if (owned != NULL) { if (owned != NULL) {
FreeLibrary(owned); FreeLibrary(owned);
} }
return hr; return hr;
} }

View File

@ -1,22 +1,22 @@
#pragma once #pragma once
#include <windows.h> #include <windows.h>
#include "apm3io/apm3io.h" #include "apm3io/apm3io.h"
struct apm3_dll { struct apm3_dll {
uint16_t api_version; uint16_t api_version;
HRESULT (*init)(void); HRESULT (*init)(void);
HRESULT (*poll)(void); HRESULT (*poll)(void);
void (*get_opbtns)(uint8_t *opbtn); void (*get_opbtns)(uint8_t *opbtn);
HRESULT (*led_init)(void); HRESULT (*led_init)(void);
void (*led_set_leds)(uint8_t board, uint8_t *rgb); void (*led_set_leds)(uint8_t board, uint8_t *rgb);
}; };
struct apm3_dll_config { struct apm3_dll_config {
wchar_t path[MAX_PATH]; wchar_t path[MAX_PATH];
}; };
extern struct apm3_dll apm3_dll; extern struct apm3_dll apm3_dll;
HRESULT apm3_dll_init(const struct apm3_dll_config *cfg, HINSTANCE self); HRESULT apm3_dll_init(const struct apm3_dll_config *cfg, HINSTANCE self);

View File

@ -1,75 +1,75 @@
LIBRARY apm3hook LIBRARY apm3hook
EXPORTS EXPORTS
aime_io_get_api_version aime_io_get_api_version
aime_io_init aime_io_init
aime_io_led_set_color aime_io_led_set_color
aime_io_nfc_get_aime_id aime_io_nfc_get_aime_id
aime_io_nfc_get_felica_id aime_io_nfc_get_felica_id
aime_io_nfc_poll aime_io_nfc_poll
amDllVideoClose @2 amDllVideoClose @2
amDllVideoGetVBiosVersion @4 amDllVideoGetVBiosVersion @4
amDllVideoOpen @1 amDllVideoOpen @1
amDllVideoSetResolution @3 amDllVideoSetResolution @3
apm3_io_get_api_version apm3_io_get_api_version
apm3_io_get_opbtns apm3_io_get_opbtns
apm3_io_init apm3_io_init
apm3_io_poll apm3_io_poll
apm3_io_led_init apm3_io_led_init
apm3_io_led_set_colors apm3_io_led_set_colors
CFW_init CFW_init
CFW_term CFW_term
CFW_open CFW_open
CFW_close CFW_close
CFW_listupPrinter CFW_listupPrinter
CFW_listupPrinterSN CFW_listupPrinterSN
CFW_selectPrinter CFW_selectPrinter
CFW_selectPrinterSN CFW_selectPrinterSN
CFW_getPrinterInfo CFW_getPrinterInfo
CFW_status CFW_status
CFW_statusAll CFW_statusAll
CFW_resetPrinter CFW_resetPrinter
CFW_updateFirmware CFW_updateFirmware
CFW_getFirmwareInfo CFW_getFirmwareInfo
CHCUSB_init CHCUSB_init
CHCUSB_term CHCUSB_term
CHCUSB_MakeThread CHCUSB_MakeThread
CHCUSB_open CHCUSB_open
CHCUSB_close CHCUSB_close
CHCUSB_ReleaseThread CHCUSB_ReleaseThread
CHCUSB_listupPrinter CHCUSB_listupPrinter
CHCUSB_listupPrinterSN CHCUSB_listupPrinterSN
CHCUSB_selectPrinter CHCUSB_selectPrinter
CHCUSB_selectPrinterSN CHCUSB_selectPrinterSN
CHCUSB_getPrinterInfo CHCUSB_getPrinterInfo
CHCUSB_imageformat CHCUSB_imageformat
CHCUSB_setmtf CHCUSB_setmtf
CHCUSB_makeGamma CHCUSB_makeGamma
CHCUSB_setIcctableProfile CHCUSB_setIcctableProfile
CHCUSB_setIcctable CHCUSB_setIcctable
CHCUSB_copies CHCUSB_copies
CHCUSB_status CHCUSB_status
CHCUSB_statusAll CHCUSB_statusAll
CHCUSB_startpage CHCUSB_startpage
CHCUSB_endpage CHCUSB_endpage
CHCUSB_write CHCUSB_write
CHCUSB_writeLaminate CHCUSB_writeLaminate
CHCUSB_writeHolo CHCUSB_writeHolo
CHCUSB_setPrinterInfo CHCUSB_setPrinterInfo
CHCUSB_setPrinterToneCurve CHCUSB_setPrinterToneCurve
CHCUSB_getGamma CHCUSB_getGamma
CHCUSB_getMtf CHCUSB_getMtf
CHCUSB_cancelCopies CHCUSB_cancelCopies
CHCUSB_getPrinterToneCurve CHCUSB_getPrinterToneCurve
CHCUSB_blinkLED CHCUSB_blinkLED
CHCUSB_resetPrinter CHCUSB_resetPrinter
CHCUSB_AttachThreadCount CHCUSB_AttachThreadCount
CHCUSB_getPrintIDStatus CHCUSB_getPrintIDStatus
CHCUSB_setPrintStandby CHCUSB_setPrintStandby
CHCUSB_testCardFeed CHCUSB_testCardFeed
CHCUSB_exitCard CHCUSB_exitCard
CHCUSB_getCardRfidTID CHCUSB_getCardRfidTID
CHCUSB_commCardRfidReader CHCUSB_commCardRfidReader
CHCUSB_updateCardRfidReader CHCUSB_updateCardRfidReader
CHCUSB_getErrorLog CHCUSB_getErrorLog
CHCUSB_getErrorStatus CHCUSB_getErrorStatus

View File

@ -1,105 +1,105 @@
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include "board/config.h" #include "board/config.h"
#include "hooklib/config.h" #include "hooklib/config.h"
#include "hooklib/dvd.h" #include "hooklib/dvd.h"
#include "apm3hook/config.h" #include "apm3hook/config.h"
#include "platform/config.h" #include "platform/config.h"
void apm3_dll_config_load( void apm3_dll_config_load(
struct apm3_dll_config *cfg, struct apm3_dll_config *cfg,
const wchar_t *filename) const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"apm3io", L"apm3io",
L"path", L"path",
L"", L"",
cfg->path, cfg->path,
_countof(cfg->path), _countof(cfg->path),
filename); filename);
} }
void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename) void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
wchar_t tmpstr[16]; wchar_t tmpstr[16];
memset(cfg->board_number, ' ', sizeof(cfg->board_number)); memset(cfg->board_number, ' ', sizeof(cfg->board_number));
memset(cfg->chip_number, ' ', sizeof(cfg->chip_number)); memset(cfg->chip_number, ' ', sizeof(cfg->chip_number));
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number)); memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename); cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 0, filename); cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename); cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename); cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename); cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"led15093", L"led15093",
L"boardNumber", L"boardNumber",
L"15093-06", L"15093-06",
tmpstr, tmpstr,
_countof(tmpstr), _countof(tmpstr),
filename); filename);
size_t n = wcstombs(cfg->board_number, tmpstr, sizeof(cfg->board_number)); size_t n = wcstombs(cfg->board_number, tmpstr, sizeof(cfg->board_number));
for (int i = n; i < sizeof(cfg->board_number); i++) for (int i = n; i < sizeof(cfg->board_number); i++)
{ {
cfg->board_number[i] = ' '; cfg->board_number[i] = ' ';
} }
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"led15093", L"led15093",
L"chipNumber", L"chipNumber",
L"6710A", L"6710A",
tmpstr, tmpstr,
_countof(tmpstr), _countof(tmpstr),
filename); filename);
n = wcstombs(cfg->chip_number, tmpstr, sizeof(cfg->chip_number)); n = wcstombs(cfg->chip_number, tmpstr, sizeof(cfg->chip_number));
for (int i = n; i < sizeof(cfg->chip_number); i++) for (int i = n; i < sizeof(cfg->chip_number); i++)
{ {
cfg->chip_number[i] = ' '; cfg->chip_number[i] = ' ';
} }
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"led15093", L"led15093",
L"bootChipNumber", L"bootChipNumber",
L"6709 ", L"6709 ",
tmpstr, tmpstr,
_countof(tmpstr), _countof(tmpstr),
filename); filename);
n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number)); n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number));
for (int i = n; i < sizeof(cfg->boot_chip_number); i++) for (int i = n; i < sizeof(cfg->boot_chip_number); i++)
{ {
cfg->boot_chip_number[i] = ' '; cfg->boot_chip_number[i] = ' ';
} }
} }
void apm3_hook_config_load( void apm3_hook_config_load(
struct apm3_hook_config *cfg, struct apm3_hook_config *cfg,
const wchar_t *filename) const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
platform_config_load(&cfg->platform, filename); platform_config_load(&cfg->platform, filename);
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename); io4_config_load(&cfg->io4, filename);
led15093_config_load(&cfg->led15093, filename); led15093_config_load(&cfg->led15093, filename);
vfd_config_load(&cfg->vfd, filename); vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename); touch_screen_config_load(&cfg->touch, filename);
apm3_dll_config_load(&cfg->dll, filename); apm3_dll_config_load(&cfg->dll, filename);
unity_config_load(&cfg->unity, filename); unity_config_load(&cfg->unity, filename);
} }

View File

@ -1,36 +1,36 @@
#pragma once #pragma once
#include <stddef.h> #include <stddef.h>
#include "board/config.h" #include "board/config.h"
#include "board/led15093.h" #include "board/led15093.h"
#include "hooklib/dvd.h" #include "hooklib/dvd.h"
#include "hooklib/touch.h" #include "hooklib/touch.h"
#include "hooklib/printer.h" #include "hooklib/printer.h"
#include "apm3hook/apm3-dll.h" #include "apm3hook/apm3-dll.h"
#include "platform/config.h" #include "platform/config.h"
#include "unityhook/config.h" #include "unityhook/config.h"
struct apm3_hook_config { struct apm3_hook_config {
struct platform_config platform; struct platform_config platform;
struct aime_config aime; struct aime_config aime;
struct dvd_config dvd; struct dvd_config dvd;
struct io4_config io4; struct io4_config io4;
struct led15093_config led15093; struct led15093_config led15093;
struct vfd_config vfd; struct vfd_config vfd;
struct apm3_dll_config dll; struct apm3_dll_config dll;
struct touch_screen_config touch; struct touch_screen_config touch;
struct unity_config unity; struct unity_config unity;
}; };
void apm3_dll_config_load( void apm3_dll_config_load(
struct apm3_dll_config *cfg, struct apm3_dll_config *cfg,
const wchar_t *filename); const wchar_t *filename);
void apm3_hook_config_load( void apm3_hook_config_load(
struct apm3_hook_config *cfg, struct apm3_hook_config *cfg,
const wchar_t *filename); const wchar_t *filename);

View File

@ -1,139 +1,139 @@
/* /*
"ALLS.NET PRAS MULTI 3" (apm3) hook "ALLS.NET PRAS MULTI 3" (apm3) hook
Devices Devices
USB: 837-15257-01 "Type 4" I/O Board USB: 837-15257-01 "Type 4" I/O Board
USB: 838-20006 "WinTouch" Controller Board USB: 838-20006 "WinTouch" Controller Board
COM1: 200-6275 VFD GP1232A02A FUTABA Board COM1: 200-6275 VFD GP1232A02A FUTABA Board
COM2: 837-15093-06 LED Controller Board COM2: 837-15093-06 LED Controller Board
COM3: 837-15396 "Gen 3" Aime Reader COM3: 837-15396 "Gen 3" Aime Reader
*/ */
#include <windows.h> #include <windows.h>
#include <stdlib.h> #include <stdlib.h>
#include "board/io4.h" #include "board/io4.h"
#include "board/sg-reader.h" #include "board/sg-reader.h"
#include "board/vfd.h" #include "board/vfd.h"
#include "hook/process.h" #include "hook/process.h"
#include "hooklib/dvd.h" #include "hooklib/dvd.h"
#include "hooklib/touch.h" #include "hooklib/touch.h"
#include "hooklib/serial.h" #include "hooklib/serial.h"
#include "hooklib/spike.h" #include "hooklib/spike.h"
#include "apm3hook/config.h" #include "apm3hook/config.h"
#include "apm3hook/io4.h" #include "apm3hook/io4.h"
#include "apm3hook/apm3-dll.h" #include "apm3hook/apm3-dll.h"
#include "platform/platform.h" #include "platform/platform.h"
#include "unityhook/hook.h" #include "unityhook/hook.h"
#include "util/dprintf.h" #include "util/dprintf.h"
static HMODULE apm3_hook_mod; static HMODULE apm3_hook_mod;
static process_entry_t apm3_startup; static process_entry_t apm3_startup;
static struct apm3_hook_config apm3_hook_cfg; static struct apm3_hook_config apm3_hook_cfg;
static DWORD CALLBACK apm3_pre_startup(void) static DWORD CALLBACK apm3_pre_startup(void)
{ {
HRESULT hr; HRESULT hr;
dprintf("--- Begin apm3_pre_startup ---\n"); dprintf("--- Begin apm3_pre_startup ---\n");
/* Load config */ /* Load config */
apm3_hook_config_load(&apm3_hook_cfg, L".\\segatools.ini"); apm3_hook_config_load(&apm3_hook_cfg, L".\\segatools.ini");
/* Hook Win32 APIs */ /* Hook Win32 APIs */
dvd_hook_init(&apm3_hook_cfg.dvd, apm3_hook_mod); dvd_hook_init(&apm3_hook_cfg.dvd, apm3_hook_mod);
touch_screen_hook_init(&apm3_hook_cfg.touch, apm3_hook_mod); touch_screen_hook_init(&apm3_hook_cfg.touch, apm3_hook_mod);
serial_hook_init(); serial_hook_init();
/* Initialize emulation hooks */ /* Initialize emulation hooks */
hr = platform_hook_init( hr = platform_hook_init(
&apm3_hook_cfg.platform, &apm3_hook_cfg.platform,
"SDEM", "SDEM",
"ACA1", "ACA1",
apm3_hook_mod); apm3_hook_mod);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;
} }
hr = apm3_dll_init(&apm3_hook_cfg.dll, apm3_hook_mod); hr = apm3_dll_init(&apm3_hook_cfg.dll, apm3_hook_mod);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;
} }
hr = led15093_hook_init(&apm3_hook_cfg.led15093, hr = led15093_hook_init(&apm3_hook_cfg.led15093,
apm3_dll.led_init, apm3_dll.led_set_leds, 2, 1, 1, 2); apm3_dll.led_init, apm3_dll.led_set_leds, 2, 1, 1, 2);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
hr = sg_reader_hook_init(&apm3_hook_cfg.aime, 3, 1, apm3_hook_mod); hr = sg_reader_hook_init(&apm3_hook_cfg.aime, 3, 1, apm3_hook_mod);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;
} }
hr = vfd_hook_init(&apm3_hook_cfg.vfd, 1); hr = vfd_hook_init(&apm3_hook_cfg.vfd, 1);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;
} }
hr = apm3_io4_hook_init(&apm3_hook_cfg.io4); hr = apm3_io4_hook_init(&apm3_hook_cfg.io4);
if (FAILED(hr)) { if (FAILED(hr)) {
goto fail; goto fail;
} }
/* Initialize Unity native plugin DLL hooks /* Initialize Unity native plugin DLL hooks
There seems to be an issue with other DLL hooks if `LoadLibraryW` is There seems to be an issue with other DLL hooks if `LoadLibraryW` is
hooked earlier in the `apm3hook` initialization. */ hooked earlier in the `apm3hook` initialization. */
unity_hook_init(&apm3_hook_cfg.unity, apm3_hook_mod); unity_hook_init(&apm3_hook_cfg.unity, apm3_hook_mod);
/* Initialize debug helpers */ /* Initialize debug helpers */
spike_hook_init(L".\\segatools.ini"); spike_hook_init(L".\\segatools.ini");
dprintf("--- End apm3_pre_startup ---\n"); dprintf("--- End apm3_pre_startup ---\n");
/* Jump to EXE start address */ /* Jump to EXE start address */
return apm3_startup(); return apm3_startup();
fail: fail:
ExitProcess(EXIT_FAILURE); ExitProcess(EXIT_FAILURE);
} }
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx) BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
{ {
HRESULT hr; HRESULT hr;
if (cause != DLL_PROCESS_ATTACH) { if (cause != DLL_PROCESS_ATTACH) {
return TRUE; return TRUE;
} }
apm3_hook_mod = mod; apm3_hook_mod = mod;
hr = process_hijack_startup(apm3_pre_startup, &apm3_startup); hr = process_hijack_startup(apm3_pre_startup, &apm3_startup);
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
dprintf("Failed to hijack process startup: %x\n", (int) hr); dprintf("Failed to hijack process startup: %x\n", (int) hr);
} }
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }

View File

@ -1,69 +1,69 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "board/io4.h" #include "board/io4.h"
#include "apm3hook/apm3-dll.h" #include "apm3hook/apm3-dll.h"
#include "util/dprintf.h" #include "util/dprintf.h"
static HRESULT apm3_io4_poll(void *ctx, struct io4_state *state); static HRESULT apm3_io4_poll(void *ctx, struct io4_state *state);
static uint16_t coins; static uint16_t coins;
static const struct io4_ops apm3_io4_ops = { static const struct io4_ops apm3_io4_ops = {
.poll = apm3_io4_poll, .poll = apm3_io4_poll,
}; };
HRESULT apm3_io4_hook_init(const struct io4_config *cfg) HRESULT apm3_io4_hook_init(const struct io4_config *cfg)
{ {
HRESULT hr; HRESULT hr;
assert(apm3_dll.init != NULL); assert(apm3_dll.init != NULL);
hr = io4_hook_init(cfg, &apm3_io4_ops, NULL); hr = io4_hook_init(cfg, &apm3_io4_ops, NULL);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
return apm3_dll.init(); return apm3_dll.init();
} }
static HRESULT apm3_io4_poll(void *ctx, struct io4_state *state) static HRESULT apm3_io4_poll(void *ctx, struct io4_state *state)
{ {
uint8_t opbtn; uint8_t opbtn;
HRESULT hr; HRESULT hr;
assert(apm3_dll.poll != NULL); assert(apm3_dll.poll != NULL);
assert(apm3_dll.get_opbtns != NULL); assert(apm3_dll.get_opbtns != NULL);
memset(state, 0, sizeof(*state)); memset(state, 0, sizeof(*state));
hr = apm3_dll.poll(); hr = apm3_dll.poll();
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
opbtn = 0; opbtn = 0;
apm3_dll.get_opbtns(&opbtn); apm3_dll.get_opbtns(&opbtn);
if (opbtn & apm3_IO_OPBTN_TEST) { if (opbtn & apm3_IO_OPBTN_TEST) {
state->buttons[0] |= IO4_BUTTON_TEST; state->buttons[0] |= IO4_BUTTON_TEST;
} }
if (opbtn & apm3_IO_OPBTN_SERVICE) { if (opbtn & apm3_IO_OPBTN_SERVICE) {
state->buttons[0] |= IO4_BUTTON_SERVICE; state->buttons[0] |= IO4_BUTTON_SERVICE;
} }
if (opbtn & apm3_IO_OPBTN_COIN) { if (opbtn & apm3_IO_OPBTN_COIN) {
coins++; coins++;
} }
state->chutes[0] = coins << 8; state->chutes[0] = coins << 8;
return S_OK; return S_OK;
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <windows.h> #include <windows.h>
#include "board/io4.h" #include "board/io4.h"
HRESULT apm3_io4_hook_init(const struct io4_config *cfg); HRESULT apm3_io4_hook_init(const struct io4_config *cfg);

View File

@ -1,31 +1,31 @@
shared_library( shared_library(
'apm3hook', 'apm3hook',
name_prefix : '', name_prefix : '',
include_directories : inc, include_directories : inc,
implicit_include_directories : false, implicit_include_directories : false,
vs_module_defs : 'apm3hook.def', vs_module_defs : 'apm3hook.def',
c_pch : '../precompiled.h', c_pch : '../precompiled.h',
dependencies : [ dependencies : [
capnhook.get_variable('hook_dep'), capnhook.get_variable('hook_dep'),
capnhook.get_variable('hooklib_dep'), capnhook.get_variable('hooklib_dep'),
xinput_lib, xinput_lib,
], ],
link_with : [ link_with : [
aimeio_lib, aimeio_lib,
board_lib, board_lib,
hooklib_lib, hooklib_lib,
apm3io_lib, apm3io_lib,
platform_lib, platform_lib,
unityhook_lib, unityhook_lib,
util_lib, util_lib,
], ],
sources : [ sources : [
'config.c', 'config.c',
'config.h', 'config.h',
'dllmain.c', 'dllmain.c',
'io4.c', 'io4.c',
'io4.h', 'io4.h',
'apm3-dll.c', 'apm3-dll.c',
'apm3-dll.h', 'apm3-dll.h',
], ],
) )

View File

@ -1,71 +1,72 @@
#include <windows.h> #include <windows.h>
#include <xinput.h> #include <xinput.h>
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>
#include "apm3io/apm3io.h" #include "apm3io/apm3io.h"
#include "apm3io/config.h" #include "apm3io/config.h"
static uint8_t apm3_opbtn; static uint8_t apm3_opbtn;
static struct apm3_io_config apm3_io_cfg; static uint8_t apm3_gamebtn;
static bool apm3_io_coin; static struct apm3_io_config apm3_io_cfg;
static bool apm3_io_coin;
uint16_t apm3_io_get_api_version(void)
{ uint16_t apm3_io_get_api_version(void)
return 0x0100; {
} return 0x0100;
}
HRESULT apm3_io_init(void)
{ HRESULT apm3_io_init(void)
apm3_io_config_load(&apm3_io_cfg, L".\\segatools.ini"); {
return S_OK; apm3_io_config_load(&apm3_io_cfg, L".\\segatools.ini");
} return S_OK;
}
HRESULT apm3_io_poll(void)
{ HRESULT apm3_io_poll(void)
apm3_opbtn = 0; {
apm3_opbtn = 0;
if (GetAsyncKeyState(apm3_io_cfg.vk_test) & 0x8000) {
apm3_opbtn |= apm3_IO_OPBTN_TEST; if (GetAsyncKeyState(apm3_io_cfg.vk_test) & 0x8000) {
} apm3_opbtn |= apm3_IO_OPBTN_TEST;
}
if (GetAsyncKeyState(apm3_io_cfg.vk_service) & 0x8000) {
apm3_opbtn |= apm3_IO_OPBTN_SERVICE; if (GetAsyncKeyState(apm3_io_cfg.vk_service) & 0x8000) {
} apm3_opbtn |= apm3_IO_OPBTN_SERVICE;
}
if (GetAsyncKeyState(apm3_io_cfg.vk_coin) & 0x8000) {
if (!apm3_io_coin) { if (GetAsyncKeyState(apm3_io_cfg.vk_coin) & 0x8000) {
apm3_io_coin = true; if (!apm3_io_coin) {
apm3_opbtn |= apm3_IO_OPBTN_COIN; apm3_io_coin = true;
} apm3_opbtn |= apm3_IO_OPBTN_COIN;
} else { }
apm3_io_coin = false; } else {
} apm3_io_coin = false;
}
return S_OK;
} return S_OK;
}
void apm3_io_get_opbtns(uint8_t *opbtn)
{ void apm3_io_get_opbtns(uint8_t *opbtn)
if (opbtn != NULL) { {
*opbtn = apm3_opbtn; if (opbtn != NULL) {
} *opbtn = apm3_opbtn;
} }
}
void apm3_io_get_gamebtns(uint8_t *btn)
{ void apm3_io_get_gamebtns(uint8_t *btn)
if (btn != NULL) { {
*btn = apm3_gamebtn; if (btn != NULL) {
} *btn = apm3_gamebtn;
} }
}
HRESULT apm3_io_led_init(void)
{ HRESULT apm3_io_led_init(void)
return S_OK; {
} return S_OK;
}
void apm3_io_led_set_colors(uint8_t board, uint8_t *rgb)
{ void apm3_io_led_set_colors(uint8_t board, uint8_t *rgb)
return; {
} return;
}

View File

@ -1,61 +1,65 @@
#pragma once #pragma once
#include <windows.h> #include <windows.h>
#include <stdint.h> #include <stdint.h>
enum { enum {
apm3_IO_OPBTN_TEST = 0x01, apm3_IO_OPBTN_TEST = 0x01,
apm3_IO_OPBTN_SERVICE = 0x02, apm3_IO_OPBTN_SERVICE = 0x02,
apm3_IO_OPBTN_COIN = 0x04, apm3_IO_OPBTN_COIN = 0x04,
}; };
/* Get the version of the AllS.Net PRAS Multi IO API that this DLL supports. This enum {
function should return a positive 16-bit integer, where the high byte is apm3_IO_GAMEBTN_1 = 0x01,
the major version and the low byte is the minor version (as defined by the }
Semantic Versioning standard).
/* Get the version of the AllS.Net PRAS Multi IO API that this DLL supports. This
The latest API version as of this writing is 0x0100. */ function should return a positive 16-bit integer, where the high byte is
the major version and the low byte is the minor version (as defined by the
uint16_t apm3_io_get_api_version(void); Semantic Versioning standard).
/* Initialize the IO DLL. This is the second function that will be called on The latest API version as of this writing is 0x0100. */
your DLL, after apm3_io_get_api_version.
uint16_t apm3_io_get_api_version(void);
All subsequent calls to this API may originate from arbitrary threads.
/* Initialize the IO DLL. This is the second function that will be called on
Minimum API version: 0x0100 */ your DLL, after apm3_io_get_api_version.
HRESULT apm3_io_init(void); All subsequent calls to this API may originate from arbitrary threads.
/* Send any queued outputs (of which there are currently none, though this may Minimum API version: 0x0100 */
change in subsequent API versions) and retrieve any new inputs.
HRESULT apm3_io_init(void);
Minimum API version: 0x0100 */
/* Send any queued outputs (of which there are currently none, though this may
HRESULT apm3_io_poll(void); change in subsequent API versions) and retrieve any new inputs.
/* Get the state of the cabinet's operator buttons as of the last poll. See Minimum API version: 0x0100 */
apm3_IO_OPBTN enum above: this contains bit mask definitions for button
states returned in *opbtn. All buttons are active-high. HRESULT apm3_io_poll(void);
Minimum API version: 0x0100 */ /* Get the state of the cabinet's operator buttons as of the last poll. See
apm3_IO_OPBTN enum above: this contains bit mask definitions for button
void apm3_io_get_opbtns(uint8_t *opbtn); states returned in *opbtn. All buttons are active-high.
/* Initialize LED emulation. This function will be called before any Minimum API version: 0x0100 */
other apm3_io_led_*() function calls.
void apm3_io_get_opbtns(uint8_t *opbtn);
All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is /* Initialize LED emulation. This function will be called before any
your responsibility. other apm3_io_led_*() function calls.
Minimum API version: 0x0101 */ All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is
HRESULT apm3_io_led_init(void); your responsibility.
/* Update the RGB LEDs. rgb is a pointer to an array of up to 61 * 3 = 183 bytes. Minimum API version: 0x0101 */
Minimum API version: 0x0101 */ HRESULT apm3_io_led_init(void);
void apm3_io_led_set_colors(uint8_t board, uint8_t *rgb); /* Update the RGB LEDs. rgb is a pointer to an array of up to 61 * 3 = 183 bytes.
Minimum API version: 0x0101 */
void apm3_io_led_set_colors(uint8_t board, uint8_t *rgb);

View File

@ -1,22 +1,22 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include "apm3io/config.h" #include "apm3io/config.h"
void apm3_io_config_load( void apm3_io_config_load(
struct apm3_io_config *cfg, struct apm3_io_config *cfg,
const wchar_t *filename) const wchar_t *filename)
{ {
wchar_t key[16]; wchar_t key[16];
int i; int i;
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename); cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename); cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename); cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
} }

View File

@ -1,16 +1,16 @@
#pragma once #pragma once
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
struct apm3_io_config { struct apm3_io_config {
uint8_t vk_test; uint8_t vk_test;
uint8_t vk_service; uint8_t vk_service;
uint8_t vk_coin; uint8_t vk_coin;
}; };
void apm3_io_config_load( void apm3_io_config_load(
struct apm3_io_config *cfg, struct apm3_io_config *cfg,
const wchar_t *filename); const wchar_t *filename);

View File

@ -1,13 +1,13 @@
apm3io_lib = static_library( apm3io_lib = static_library(
'apm3io', 'apm3io',
name_prefix : '', name_prefix : '',
include_directories : inc, include_directories : inc,
implicit_include_directories : false, implicit_include_directories : false,
c_pch : '../precompiled.h', c_pch : '../precompiled.h',
sources : [ sources : [
'apm3io.c', 'apm3io.c',
'apm3io.h', 'apm3io.h',
'config.c', 'config.c',
'config.h', 'config.h',
], ],
) )

View File

@ -1,95 +1,95 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include "board/aime-dll.h" #include "board/aime-dll.h"
#include "board/config.h" #include "board/config.h"
#include "board/sg-reader.h" #include "board/sg-reader.h"
#include "board/vfd.h" #include "board/vfd.h"
#include "util/dprintf.h" #include "util/dprintf.h"
// Check windows // Check windows
#if _WIN32 || _WIN64 #if _WIN32 || _WIN64
#if _WIN64 #if _WIN64
#define ENV64BIT #define ENV64BIT
#else #else
#define ENV32BIT #define ENV32BIT
#endif #endif
#endif #endif
// Check GCC // Check GCC
#if __GNUC__ #if __GNUC__
#if __x86_64__ || __ppc64__ #if __x86_64__ || __ppc64__
#define ENV64BIT #define ENV64BIT
#else #else
#define ENV32BIT #define ENV32BIT
#endif #endif
#endif #endif
static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename) static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
// Workaround for x64/x86 external IO dlls // Workaround for x64/x86 external IO dlls
// path32 for 32bit, path64 for 64bit // path32 for 32bit, path64 for 64bit
// for else.. is that possible? idk // for else.. is that possible? idk
if (cfg->path64) { if (cfg->path64) {
#if defined(ENV32BIT) #if defined(ENV32BIT)
// Always empty, due to amdaemon being 64 bit in 32 bit mode // Always empty, due to amdaemon being 64 bit in 32 bit mode
memset(cfg->path, 0, sizeof(cfg->path)); memset(cfg->path, 0, sizeof(cfg->path));
#elif defined(ENV64BIT) #elif defined(ENV64BIT)
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"aimeio", L"aimeio",
L"path", L"path",
L"", L"",
cfg->path, cfg->path,
_countof(cfg->path), _countof(cfg->path),
filename); filename);
#else #else
#error "Unknown environment" #error "Unknown environment"
#endif #endif
} else { } else {
GetPrivateProfileStringW( GetPrivateProfileStringW(
L"aimeio", L"aimeio",
L"path", L"path",
L"", L"",
cfg->path, cfg->path,
_countof(cfg->path), _countof(cfg->path),
filename); filename);
} }
} }
void aime_config_load(struct aime_config *cfg, const wchar_t *filename) void aime_config_load(struct aime_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
aime_dll_config_load(&cfg->dll, filename); aime_dll_config_load(&cfg->dll, filename);
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename); cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename); cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename);
cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename); cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename);
} }
void io4_config_load(struct io4_config *cfg, const wchar_t *filename) void io4_config_load(struct io4_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename); cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename);
} }
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename) void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename); cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename);
cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename); cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename);
cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename); cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename);
} }

View File

@ -1,54 +1,54 @@
board_lib = static_library( board_lib = static_library(
'board', 'board',
include_directories : inc, include_directories : inc,
implicit_include_directories : false, implicit_include_directories : false,
c_pch : '../precompiled.h', c_pch : '../precompiled.h',
dependencies : [ dependencies : [
capnhook.get_variable('hook_dep'), capnhook.get_variable('hook_dep'),
], ],
link_with : [ link_with : [
iccard_lib, iccard_lib,
], ],
sources : [ sources : [
'aime-dll.c', 'aime-dll.c',
'aime-dll.h', 'aime-dll.h',
'config.c', 'config.c',
'config.h', 'config.h',
'guid.c', 'guid.c',
'guid.h', 'guid.h',
'io3.c', 'io3.c',
'io3.h', 'io3.h',
'io4.c', 'io4.c',
'io4.h', 'io4.h',
'led15093-cmd.h', 'led15093-cmd.h',
'led15093-frame.c', 'led15093-frame.c',
'led15093-frame.h', 'led15093-frame.h',
'led15093.c', 'led15093.c',
'led15093.h', 'led15093.h',
'led15070-cmd.h', 'led15070-cmd.h',
'led15070-frame.c', 'led15070-frame.c',
'led15070-frame.h', 'led15070-frame.h',
'led15070.c', 'led15070.c',
'led15070.h', 'led15070.h',
'sg-cmd.c', 'sg-cmd.c',
'sg-cmd.h', 'sg-cmd.h',
'sg-frame.c', 'sg-frame.c',
'sg-frame.h', 'sg-frame.h',
'sg-led.c', 'sg-led.c',
'sg-led.h', 'sg-led.h',
'sg-led-cmd.h', 'sg-led-cmd.h',
'sg-nfc.c', 'sg-nfc.c',
'sg-nfc.h', 'sg-nfc.h',
'sg-nfc-cmd.h', 'sg-nfc-cmd.h',
'sg-reader.c', 'sg-reader.c',
'sg-reader.h', 'sg-reader.h',
'slider-cmd.h', 'slider-cmd.h',
'slider-frame.c', 'slider-frame.c',
'slider-frame.h', 'slider-frame.h',
'vfd.c', 'vfd.c',
'vfd.h', 'vfd.h',
'vfd-cmd.h', 'vfd-cmd.h',
'vfd-frame.c', 'vfd-frame.c',
'vfd-frame.h', 'vfd-frame.h',
], ],
) )

View File

@ -1,118 +1,118 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#pragma pack(push, 1) #pragma pack(push, 1)
enum { enum {
SG_NFC_CMD_GET_FW_VERSION = 0x30, SG_NFC_CMD_GET_FW_VERSION = 0x30,
SG_NFC_CMD_GET_HW_VERSION = 0x32, SG_NFC_CMD_GET_HW_VERSION = 0x32,
SG_NFC_CMD_RADIO_ON = 0x40, SG_NFC_CMD_RADIO_ON = 0x40,
SG_NFC_CMD_RADIO_OFF = 0x41, SG_NFC_CMD_RADIO_OFF = 0x41,
SG_NFC_CMD_POLL = 0x42, SG_NFC_CMD_POLL = 0x42,
SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43, SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43,
SG_NFC_CMD_MIFARE_SET_KEY_A = 0x50, SG_NFC_CMD_MIFARE_SET_KEY_A = 0x50,
SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51, SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51,
SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52, SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52,
SG_NFC_CMD_MIFARE_SET_KEY_B = 0x54, SG_NFC_CMD_MIFARE_SET_KEY_B = 0x54,
SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55, SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55,
SG_NFC_CMD_TO_UPDATE_MODE = 0x60, SG_NFC_CMD_TO_UPDATE_MODE = 0x60,
SG_NFC_CMD_SEND_HEX_DATA = 0x61, SG_NFC_CMD_SEND_HEX_DATA = 0x61,
SG_NFC_CMD_RESET = 0x62, SG_NFC_CMD_RESET = 0x62,
SG_NFC_CMD_FELICA_ENCAP = 0x71, SG_NFC_CMD_FELICA_ENCAP = 0x71,
}; };
struct sg_nfc_res_get_fw_version { struct sg_nfc_res_get_fw_version {
struct sg_res_header res; struct sg_res_header res;
char version[23]; char version[23];
}; };
struct sg_nfc_res_get_hw_version { struct sg_nfc_res_get_hw_version {
struct sg_res_header res; struct sg_res_header res;
char version[23]; char version[23];
}; };
struct sg_nfc_req_mifare_set_key { struct sg_nfc_req_mifare_set_key {
struct sg_req_header req; struct sg_req_header req;
uint8_t key[6]; uint8_t key[6];
}; };
struct sg_nfc_req_mifare_50 { struct sg_nfc_req_mifare_50 {
struct sg_req_header req; struct sg_req_header req;
uint8_t payload[6]; uint8_t payload[6];
}; };
struct sg_nfc_req_poll_40 { struct sg_nfc_req_poll_40 {
struct sg_req_header req; struct sg_req_header req;
uint8_t payload; uint8_t payload;
}; };
struct sg_nfc_poll_mifare { struct sg_nfc_poll_mifare {
uint8_t type; uint8_t type;
uint8_t id_len; uint8_t id_len;
uint32_t uid; uint32_t uid;
}; };
struct sg_nfc_poll_felica { struct sg_nfc_poll_felica {
uint8_t type; uint8_t type;
uint8_t id_len; uint8_t id_len;
uint64_t IDm; uint64_t IDm;
uint64_t PMm; uint64_t PMm;
}; };
struct sg_nfc_res_poll { struct sg_nfc_res_poll {
struct sg_res_header res; struct sg_res_header res;
uint8_t count; uint8_t count;
uint8_t payload[250]; uint8_t payload[250];
}; };
struct sg_nfc_req_mifare_select_tag { struct sg_nfc_req_mifare_select_tag {
struct sg_res_header res; struct sg_res_header res;
uint32_t uid; uint32_t uid;
}; };
struct sg_nfc_req_mifare_read_block { struct sg_nfc_req_mifare_read_block {
struct sg_req_header req; struct sg_req_header req;
struct { struct {
uint32_t uid; uint32_t uid;
uint8_t block_no; uint8_t block_no;
} payload; } payload;
}; };
struct sg_nfc_res_mifare_read_block { struct sg_nfc_res_mifare_read_block {
struct sg_res_header res; struct sg_res_header res;
uint8_t block[16]; uint8_t block[16];
}; };
struct sg_nfc_req_felica_encap { struct sg_nfc_req_felica_encap {
struct sg_req_header req; struct sg_req_header req;
uint64_t IDm; uint64_t IDm;
uint8_t payload[243]; uint8_t payload[243];
}; };
struct sg_nfc_res_felica_encap { struct sg_nfc_res_felica_encap {
struct sg_res_header res; struct sg_res_header res;
uint8_t payload[250]; uint8_t payload[250];
}; };
union sg_nfc_req_any { union sg_nfc_req_any {
uint8_t bytes[256]; uint8_t bytes[256];
struct sg_req_header simple; struct sg_req_header simple;
struct sg_nfc_req_mifare_set_key mifare_set_key; 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_read_block mifare_read_block;
struct sg_nfc_req_mifare_50 mifare_50; struct sg_nfc_req_mifare_50 mifare_50;
struct sg_nfc_req_poll_40 poll_40; struct sg_nfc_req_poll_40 poll_40;
struct sg_nfc_req_felica_encap felica_encap; struct sg_nfc_req_felica_encap felica_encap;
}; };
union sg_nfc_res_any { union sg_nfc_res_any {
uint8_t bytes[256]; uint8_t bytes[256];
struct sg_res_header simple; struct sg_res_header simple;
struct sg_nfc_res_get_fw_version get_fw_version; struct sg_nfc_res_get_fw_version get_fw_version;
struct sg_nfc_res_get_hw_version get_hw_version; struct sg_nfc_res_get_hw_version get_hw_version;
struct sg_nfc_res_poll poll; struct sg_nfc_res_poll poll;
struct sg_nfc_res_mifare_read_block mifare_read_block; struct sg_nfc_res_mifare_read_block mifare_read_block;
struct sg_nfc_res_felica_encap felica_encap; struct sg_nfc_res_felica_encap felica_encap;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -1,477 +1,477 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "board/sg-cmd.h" #include "board/sg-cmd.h"
#include "board/sg-nfc.h" #include "board/sg-nfc.h"
#include "board/sg-nfc-cmd.h" #include "board/sg-nfc-cmd.h"
#include "iccard/aime.h" #include "iccard/aime.h"
#include "iccard/felica.h" #include "iccard/felica.h"
#include "util/dprintf.h" #include "util/dprintf.h"
#include "util/dump.h" #include "util/dump.h"
static HRESULT sg_nfc_dispatch( static HRESULT sg_nfc_dispatch(
void *ctx, void *ctx,
const void *v_req, const void *v_req,
void *v_res); void *v_res);
static HRESULT sg_nfc_cmd_reset( static HRESULT sg_nfc_cmd_reset(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res); struct sg_res_header *res);
static HRESULT sg_nfc_cmd_get_fw_version( static HRESULT sg_nfc_cmd_get_fw_version(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_get_fw_version *res); struct sg_nfc_res_get_fw_version *res);
static HRESULT sg_nfc_cmd_get_hw_version( static HRESULT sg_nfc_cmd_get_hw_version(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_get_hw_version *res); struct sg_nfc_res_get_hw_version *res);
static HRESULT sg_nfc_cmd_poll( static HRESULT sg_nfc_cmd_poll(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_poll *res); struct sg_nfc_res_poll *res);
static HRESULT sg_nfc_poll_aime( static HRESULT sg_nfc_poll_aime(
struct sg_nfc *nfc, struct sg_nfc *nfc,
struct sg_nfc_poll_mifare *mifare); struct sg_nfc_poll_mifare *mifare);
static HRESULT sg_nfc_poll_felica( static HRESULT sg_nfc_poll_felica(
struct sg_nfc *nfc, struct sg_nfc *nfc,
struct sg_nfc_poll_felica *felica); struct sg_nfc_poll_felica *felica);
static HRESULT sg_nfc_cmd_mifare_read_block( static HRESULT sg_nfc_cmd_mifare_read_block(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_nfc_req_mifare_read_block *req, const struct sg_nfc_req_mifare_read_block *req,
struct sg_nfc_res_mifare_read_block *res); struct sg_nfc_res_mifare_read_block *res);
static HRESULT sg_nfc_cmd_felica_encap( static HRESULT sg_nfc_cmd_felica_encap(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_nfc_req_felica_encap *req, const struct sg_nfc_req_felica_encap *req,
struct sg_nfc_res_felica_encap *res); struct sg_nfc_res_felica_encap *res);
static HRESULT sg_nfc_cmd_send_hex_data( static HRESULT sg_nfc_cmd_send_hex_data(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res); struct sg_res_header *res);
static HRESULT sg_nfc_cmd_dummy( static HRESULT sg_nfc_cmd_dummy(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res); struct sg_res_header *res);
static const struct version_info hw_version[] = { static const struct version_info hw_version[] = {
{"TN32MSEC003S H/W Ver3.0", 23}, {"TN32MSEC003S H/W Ver3.0", 23},
{"837-15286", 9}, {"837-15286", 9},
{"837-15396", 9} {"837-15396", 9}
}; };
static const struct version_info fw_version[] = { static const struct version_info fw_version[] = {
{"TN32MSEC003S F/W Ver1.2", 23}, {"TN32MSEC003S F/W Ver1.2", 23},
{"\x94", 1}, {"\x94", 1},
{"\x94", 1} {"\x94", 1}
}; };
void sg_nfc_init( void sg_nfc_init(
struct sg_nfc *nfc, struct sg_nfc *nfc,
uint8_t addr, uint8_t addr,
const struct sg_nfc_ops *ops, const struct sg_nfc_ops *ops,
unsigned int gen, unsigned int gen,
void *ops_ctx) void *ops_ctx)
{ {
assert(nfc != NULL); assert(nfc != NULL);
assert(ops != NULL); assert(ops != NULL);
nfc->ops = ops; nfc->ops = ops;
nfc->ops_ctx = ops_ctx; nfc->ops_ctx = ops_ctx;
nfc->addr = addr; nfc->addr = addr;
nfc->gen = gen; nfc->gen = gen;
} }
#ifdef NDEBUG #ifdef NDEBUG
#define sg_nfc_dprintfv(nfc, fmt, ap) #define sg_nfc_dprintfv(nfc, fmt, ap)
#define sg_nfc_dprintf(nfc, fmt, ...) #define sg_nfc_dprintf(nfc, fmt, ...)
#else #else
static void sg_nfc_dprintfv( static void sg_nfc_dprintfv(
const struct sg_nfc *nfc, const struct sg_nfc *nfc,
const char *fmt, const char *fmt,
va_list ap) va_list ap)
{ {
dprintf("NFC %02x: ", nfc->addr); dprintf("NFC %02x: ", nfc->addr);
dprintfv(fmt, ap); dprintfv(fmt, ap);
} }
static void sg_nfc_dprintf( static void sg_nfc_dprintf(
const struct sg_nfc *nfc, const struct sg_nfc *nfc,
const char *fmt, const char *fmt,
...) ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
sg_nfc_dprintfv(nfc, fmt, ap); sg_nfc_dprintfv(nfc, fmt, ap);
va_end(ap); va_end(ap);
} }
#endif #endif
void sg_nfc_transact( void sg_nfc_transact(
struct sg_nfc *nfc, struct sg_nfc *nfc,
struct iobuf *res_frame, struct iobuf *res_frame,
const void *req_bytes, const void *req_bytes,
size_t req_nbytes) size_t req_nbytes)
{ {
assert(nfc != NULL); assert(nfc != NULL);
assert(res_frame != NULL); assert(res_frame != NULL);
assert(req_bytes != NULL); assert(req_bytes != NULL);
sg_req_transact(res_frame, req_bytes, req_nbytes, sg_nfc_dispatch, nfc); sg_req_transact(res_frame, req_bytes, req_nbytes, sg_nfc_dispatch, nfc);
} }
static HRESULT sg_nfc_dispatch( static HRESULT sg_nfc_dispatch(
void *ctx, void *ctx,
const void *v_req, const void *v_req,
void *v_res) void *v_res)
{ {
struct sg_nfc *nfc; struct sg_nfc *nfc;
const union sg_nfc_req_any *req; const union sg_nfc_req_any *req;
union sg_nfc_res_any *res; union sg_nfc_res_any *res;
nfc = ctx; nfc = ctx;
req = v_req; req = v_req;
res = v_res; res = v_res;
if (req->simple.hdr.addr != nfc->addr) { if (req->simple.hdr.addr != nfc->addr) {
/* Not addressed to us, don't send a response */ /* Not addressed to us, don't send a response */
return S_FALSE; return S_FALSE;
} }
switch (req->simple.hdr.cmd) { switch (req->simple.hdr.cmd) {
case SG_NFC_CMD_RESET: case SG_NFC_CMD_RESET:
return sg_nfc_cmd_reset(nfc, &req->simple, &res->simple); return sg_nfc_cmd_reset(nfc, &req->simple, &res->simple);
case SG_NFC_CMD_GET_FW_VERSION: case SG_NFC_CMD_GET_FW_VERSION:
return sg_nfc_cmd_get_fw_version( return sg_nfc_cmd_get_fw_version(
nfc, nfc,
&req->simple, &req->simple,
&res->get_fw_version); &res->get_fw_version);
case SG_NFC_CMD_GET_HW_VERSION: case SG_NFC_CMD_GET_HW_VERSION:
return sg_nfc_cmd_get_hw_version( return sg_nfc_cmd_get_hw_version(
nfc, nfc,
&req->simple, &req->simple,
&res->get_hw_version); &res->get_hw_version);
case SG_NFC_CMD_POLL: case SG_NFC_CMD_POLL:
return sg_nfc_cmd_poll( return sg_nfc_cmd_poll(
nfc, nfc,
&req->simple, &req->simple,
&res->poll); &res->poll);
case SG_NFC_CMD_MIFARE_READ_BLOCK: case SG_NFC_CMD_MIFARE_READ_BLOCK:
return sg_nfc_cmd_mifare_read_block( return sg_nfc_cmd_mifare_read_block(
nfc, nfc,
&req->mifare_read_block, &req->mifare_read_block,
&res->mifare_read_block); &res->mifare_read_block);
case SG_NFC_CMD_FELICA_ENCAP: case SG_NFC_CMD_FELICA_ENCAP:
return sg_nfc_cmd_felica_encap( return sg_nfc_cmd_felica_encap(
nfc, nfc,
&req->felica_encap, &req->felica_encap,
&res->felica_encap); &res->felica_encap);
case SG_NFC_CMD_MIFARE_AUTHENTICATE: case SG_NFC_CMD_MIFARE_AUTHENTICATE:
case SG_NFC_CMD_SEND_HEX_DATA: case SG_NFC_CMD_SEND_HEX_DATA:
return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple); return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple);
case SG_NFC_CMD_MIFARE_SELECT_TAG: case SG_NFC_CMD_MIFARE_SELECT_TAG:
case SG_NFC_CMD_MIFARE_SET_KEY_AIME: case SG_NFC_CMD_MIFARE_SET_KEY_AIME:
case SG_NFC_CMD_MIFARE_SET_KEY_BANA: case SG_NFC_CMD_MIFARE_SET_KEY_BANA:
case SG_NFC_CMD_RADIO_ON: case SG_NFC_CMD_RADIO_ON:
case SG_NFC_CMD_RADIO_OFF: case SG_NFC_CMD_RADIO_OFF:
case SG_NFC_CMD_TO_UPDATE_MODE: case SG_NFC_CMD_TO_UPDATE_MODE:
return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple); return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple);
default: default:
sg_nfc_dprintf(nfc, "Unimpl command %02x\n", req->simple.hdr.cmd); sg_nfc_dprintf(nfc, "Unimpl command %02x\n", req->simple.hdr.cmd);
return E_NOTIMPL; return E_NOTIMPL;
} }
} }
static HRESULT sg_nfc_cmd_reset( static HRESULT sg_nfc_cmd_reset(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res) struct sg_res_header *res)
{ {
sg_nfc_dprintf(nfc, "Reset\n"); sg_nfc_dprintf(nfc, "Reset\n");
sg_res_init(res, req, 0); sg_res_init(res, req, 0);
res->status = 3; res->status = 3;
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_get_fw_version( static HRESULT sg_nfc_cmd_get_fw_version(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_get_fw_version *res) struct sg_nfc_res_get_fw_version *res)
{ {
const struct version_info *fw = &fw_version[nfc->gen - 1]; const struct version_info *fw = &fw_version[nfc->gen - 1];
/* Dest version is not NUL terminated, this is intentional */ /* Dest version is not NUL terminated, this is intentional */
sg_res_init(&res->res, req, fw->length); sg_res_init(&res->res, req, fw->length);
memcpy(res->version, fw->version, fw->length); memcpy(res->version, fw->version, fw->length);
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_get_hw_version( static HRESULT sg_nfc_cmd_get_hw_version(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_get_hw_version *res) struct sg_nfc_res_get_hw_version *res)
{ {
const struct version_info *hw = &hw_version[nfc->gen - 1]; const struct version_info *hw = &hw_version[nfc->gen - 1];
/* Dest version is not NUL terminated, this is intentional */ /* Dest version is not NUL terminated, this is intentional */
sg_res_init(&res->res, req, hw->length); sg_res_init(&res->res, req, hw->length);
memcpy(res->version, hw->version, hw->length); memcpy(res->version, hw->version, hw->length);
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_poll( static HRESULT sg_nfc_cmd_poll(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_nfc_res_poll *res) struct sg_nfc_res_poll *res)
{ {
struct sg_nfc_poll_mifare mifare; struct sg_nfc_poll_mifare mifare;
struct sg_nfc_poll_felica felica; struct sg_nfc_poll_felica felica;
HRESULT hr; HRESULT hr;
hr = nfc->ops->poll(nfc->ops_ctx); hr = nfc->ops->poll(nfc->ops_ctx);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
hr = sg_nfc_poll_felica(nfc, &felica); hr = sg_nfc_poll_felica(nfc, &felica);
if (SUCCEEDED(hr) && hr != S_FALSE) { if (SUCCEEDED(hr) && hr != S_FALSE) {
sg_res_init(&res->res, req, 1 + sizeof(felica)); sg_res_init(&res->res, req, 1 + sizeof(felica));
memcpy(res->payload, &felica, sizeof(felica)); memcpy(res->payload, &felica, sizeof(felica));
res->count = 1; res->count = 1;
return S_OK; return S_OK;
} }
hr = sg_nfc_poll_aime(nfc, &mifare); hr = sg_nfc_poll_aime(nfc, &mifare);
if (SUCCEEDED(hr) && hr != S_FALSE) { if (SUCCEEDED(hr) && hr != S_FALSE) {
sg_res_init(&res->res, req, 1 + sizeof(mifare)); sg_res_init(&res->res, req, 1 + sizeof(mifare));
memcpy(res->payload, &mifare, sizeof(mifare)); memcpy(res->payload, &mifare, sizeof(mifare));
res->count = 1; res->count = 1;
return S_OK; return S_OK;
} }
sg_res_init(&res->res, req, 1); sg_res_init(&res->res, req, 1);
res->count = 0; res->count = 0;
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_poll_aime( static HRESULT sg_nfc_poll_aime(
struct sg_nfc *nfc, struct sg_nfc *nfc,
struct sg_nfc_poll_mifare *mifare) struct sg_nfc_poll_mifare *mifare)
{ {
uint8_t luid[10]; uint8_t luid[10];
HRESULT hr; HRESULT hr;
/* Call backend */ /* Call backend */
if (nfc->ops->get_aime_id != NULL) { if (nfc->ops->get_aime_id != NULL) {
hr = nfc->ops->get_aime_id(nfc->ops_ctx, luid, sizeof(luid)); hr = nfc->ops->get_aime_id(nfc->ops_ctx, luid, sizeof(luid));
} else { } else {
hr = S_FALSE; hr = S_FALSE;
} }
if (FAILED(hr) || hr == S_FALSE) { if (FAILED(hr) || hr == S_FALSE) {
return hr; return hr;
} }
sg_nfc_dprintf(nfc, "AiMe card is present\n"); sg_nfc_dprintf(nfc, "AiMe card is present\n");
/* Construct response (use an arbitrary UID) */ /* Construct response (use an arbitrary UID) */
mifare->type = 0x10; mifare->type = 0x10;
mifare->id_len = sizeof(mifare->uid); mifare->id_len = sizeof(mifare->uid);
mifare->uid = _byteswap_ulong(0x01020304); mifare->uid = _byteswap_ulong(0x01020304);
/* Initialize MIFARE IC emulator */ /* Initialize MIFARE IC emulator */
hr = aime_card_populate(&nfc->mifare, luid, sizeof(luid)); hr = aime_card_populate(&nfc->mifare, luid, sizeof(luid));
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_poll_felica( static HRESULT sg_nfc_poll_felica(
struct sg_nfc *nfc, struct sg_nfc *nfc,
struct sg_nfc_poll_felica *felica) struct sg_nfc_poll_felica *felica)
{ {
uint64_t IDm; uint64_t IDm;
HRESULT hr; HRESULT hr;
/* Call backend */ /* Call backend */
if (nfc->ops->get_felica_id != NULL) { if (nfc->ops->get_felica_id != NULL) {
hr = nfc->ops->get_felica_id(nfc->ops_ctx, &IDm); hr = nfc->ops->get_felica_id(nfc->ops_ctx, &IDm);
} else { } else {
hr = S_FALSE; hr = S_FALSE;
} }
if (FAILED(hr) || hr == S_FALSE) { if (FAILED(hr) || hr == S_FALSE) {
return hr; return hr;
} }
sg_nfc_dprintf(nfc, "FeliCa card is present\n"); sg_nfc_dprintf(nfc, "FeliCa card is present\n");
/* Construct poll response */ /* Construct poll response */
felica->type = 0x20; felica->type = 0x20;
felica->id_len = sizeof(felica->IDm) + sizeof(felica->PMm); felica->id_len = sizeof(felica->IDm) + sizeof(felica->PMm);
felica->IDm = _byteswap_uint64(IDm); felica->IDm = _byteswap_uint64(IDm);
felica->PMm = _byteswap_uint64(felica_get_generic_PMm()); felica->PMm = _byteswap_uint64(felica_get_generic_PMm());
/* Initialize FeliCa IC emulator */ /* Initialize FeliCa IC emulator */
nfc->felica.IDm = IDm; nfc->felica.IDm = IDm;
nfc->felica.PMm = felica_get_generic_PMm(); nfc->felica.PMm = felica_get_generic_PMm();
nfc->felica.system_code = 0x0000; nfc->felica.system_code = 0x0000;
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_mifare_read_block( static HRESULT sg_nfc_cmd_mifare_read_block(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_nfc_req_mifare_read_block *req, const struct sg_nfc_req_mifare_read_block *req,
struct sg_nfc_res_mifare_read_block *res) struct sg_nfc_res_mifare_read_block *res)
{ {
uint32_t uid; uint32_t uid;
if (req->req.payload_len != sizeof(req->payload)) { if (req->req.payload_len != sizeof(req->payload)) {
sg_nfc_dprintf(nfc, "%s: Payload size is incorrect\n", __func__); sg_nfc_dprintf(nfc, "%s: Payload size is incorrect\n", __func__);
return E_FAIL; return E_FAIL;
} }
uid = _byteswap_ulong(req->payload.uid); uid = _byteswap_ulong(req->payload.uid);
sg_nfc_dprintf(nfc, "Read uid %08x block %i\n", uid, req->payload.block_no); sg_nfc_dprintf(nfc, "Read uid %08x block %i\n", uid, req->payload.block_no);
if (req->payload.block_no > 3) { if (req->payload.block_no > 3) {
sg_nfc_dprintf(nfc, "MIFARE block number out of range\n"); sg_nfc_dprintf(nfc, "MIFARE block number out of range\n");
return E_FAIL; return E_FAIL;
} }
sg_res_init(&res->res, &req->req, sizeof(res->block)); sg_res_init(&res->res, &req->req, sizeof(res->block));
memcpy( res->block, memcpy( res->block,
nfc->mifare.sectors[0].blocks[req->payload.block_no].bytes, nfc->mifare.sectors[0].blocks[req->payload.block_no].bytes,
sizeof(res->block)); sizeof(res->block));
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_felica_encap( static HRESULT sg_nfc_cmd_felica_encap(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_nfc_req_felica_encap *req, const struct sg_nfc_req_felica_encap *req,
struct sg_nfc_res_felica_encap *res) struct sg_nfc_res_felica_encap *res)
{ {
struct const_iobuf f_req; struct const_iobuf f_req;
struct iobuf f_res; struct iobuf f_res;
HRESULT hr; HRESULT hr;
/* First byte of encapsulated request and response is a length byte /* First byte of encapsulated request and response is a length byte
(inclusive of itself). The FeliCa emulator expects its caller to handle (inclusive of itself). The FeliCa emulator expects its caller to handle
that length byte on its behalf (we adopt the convention that the length that length byte on its behalf (we adopt the convention that the length
byte is part of the FeliCa protocol's framing layer). */ byte is part of the FeliCa protocol's framing layer). */
if (req->req.payload_len != 8 + req->payload[0]) { if (req->req.payload_len != 8 + req->payload[0]) {
sg_nfc_dprintf( sg_nfc_dprintf(
nfc, nfc,
"FeliCa encap payload length mismatch: sg %i != felica %i + 8", "FeliCa encap payload length mismatch: sg %i != felica %i + 8",
req->req.payload_len, req->req.payload_len,
req->payload[0]); req->payload[0]);
return E_FAIL; return E_FAIL;
} }
f_req.bytes = req->payload; f_req.bytes = req->payload;
f_req.nbytes = req->payload[0]; f_req.nbytes = req->payload[0];
f_req.pos = 1; f_req.pos = 1;
f_res.bytes = res->payload; f_res.bytes = res->payload;
f_res.nbytes = sizeof(res->payload); f_res.nbytes = sizeof(res->payload);
f_res.pos = 1; f_res.pos = 1;
#if defined(LOG_NFC) #if defined(LOG_NFC)
dprintf("FELICA OUTBOUND:\n"); dprintf("FELICA OUTBOUND:\n");
dump_const_iobuf(&f_req); dump_const_iobuf(&f_req);
#endif #endif
hr = felica_transact(&nfc->felica, &f_req, &f_res); hr = felica_transact(&nfc->felica, &f_req, &f_res);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
sg_res_init(&res->res, &req->req, f_res.pos); sg_res_init(&res->res, &req->req, f_res.pos);
res->payload[0] = f_res.pos; res->payload[0] = f_res.pos;
#if defined(LOG_NFC) #if defined(LOG_NFC)
dprintf("FELICA INBOUND:\n"); dprintf("FELICA INBOUND:\n");
dump_iobuf(&f_res); dump_iobuf(&f_res);
#endif #endif
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_send_hex_data( static HRESULT sg_nfc_cmd_send_hex_data(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res) struct sg_res_header *res)
{ {
sg_res_init(res, req, 0); sg_res_init(res, req, 0);
/* Firmware checksum length? */ /* Firmware checksum length? */
if (req->payload_len == 0x2b) { if (req->payload_len == 0x2b) {
/* The firmware is identical flag? */ /* The firmware is identical flag? */
res->status = 0x20; res->status = 0x20;
} }
return S_OK; return S_OK;
} }
static HRESULT sg_nfc_cmd_dummy( static HRESULT sg_nfc_cmd_dummy(
struct sg_nfc *nfc, struct sg_nfc *nfc,
const struct sg_req_header *req, const struct sg_req_header *req,
struct sg_res_header *res) struct sg_res_header *res)
{ {
sg_res_init(res, req, 0); sg_res_init(res, req, 0);
return S_OK; return S_OK;
} }

View File

@ -1,123 +1,123 @@
#pragma once #pragma once
#include "board/vfd-frame.h" #include "board/vfd-frame.h"
enum { enum {
VFD_CMD_GET_VERSION = 0x5B, VFD_CMD_GET_VERSION = 0x5B,
VFD_CMD_RESET = 0x0B, VFD_CMD_RESET = 0x0B,
VFD_CMD_CLEAR_SCREEN = 0x0C, VFD_CMD_CLEAR_SCREEN = 0x0C,
VFD_CMD_SET_BRIGHTNESS = 0x20, VFD_CMD_SET_BRIGHTNESS = 0x20,
VFD_CMD_SET_SCREEN_ON = 0x21, VFD_CMD_SET_SCREEN_ON = 0x21,
VFD_CMD_SET_H_SCROLL = 0x22, VFD_CMD_SET_H_SCROLL = 0x22,
VFD_CMD_DRAW_IMAGE = 0x2E, VFD_CMD_DRAW_IMAGE = 0x2E,
VFD_CMD_SET_CURSOR = 0x30, VFD_CMD_SET_CURSOR = 0x30,
VFD_CMD_SET_ENCODING = 0x32, VFD_CMD_SET_ENCODING = 0x32,
VFD_CMD_SET_TEXT_WND = 0x40, VFD_CMD_SET_TEXT_WND = 0x40,
VFD_CMD_SET_TEXT_SPEED = 0x41, VFD_CMD_SET_TEXT_SPEED = 0x41,
VFD_CMD_WRITE_TEXT = 0x50, VFD_CMD_WRITE_TEXT = 0x50,
VFD_CMD_ENABLE_SCROLL = 0x51, VFD_CMD_ENABLE_SCROLL = 0x51,
VFD_CMD_DISABLE_SCROLL = 0x52, VFD_CMD_DISABLE_SCROLL = 0x52,
VFD_CMD_ROTATE = 0x5D, VFD_CMD_ROTATE = 0x5D,
VFD_CMD_CREATE_CHAR = 0xA3, VFD_CMD_CREATE_CHAR = 0xA3,
VFD_CMD_CREATE_CHAR2 = 0xA4, VFD_CMD_CREATE_CHAR2 = 0xA4,
}; };
enum { enum {
VFD_ENC_GB2312 = 0, VFD_ENC_GB2312 = 0,
VFD_ENC_BIG5 = 1, VFD_ENC_BIG5 = 1,
VFD_ENC_SHIFT_JIS = 2, VFD_ENC_SHIFT_JIS = 2,
VFD_ENC_KSC5601 = 3, VFD_ENC_KSC5601 = 3,
VFD_ENC_MAX = 3, VFD_ENC_MAX = 3,
}; };
struct vfd_req_hdr { struct vfd_req_hdr {
uint8_t sync; uint8_t sync;
uint8_t cmd; uint8_t cmd;
}; };
struct vfd_req_any { struct vfd_req_any {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t payload[2054]; uint8_t payload[2054];
}; };
struct vfd_req_board_info { struct vfd_req_board_info {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t unk1; uint8_t unk1;
}; };
struct vfd_resp_board_info { // \x0201.20\x03 struct vfd_resp_board_info { // \x0201.20\x03
uint8_t unk1; uint8_t unk1;
char version[5]; char version[5];
uint8_t unk2; uint8_t unk2;
}; };
struct vfd_req_reset { struct vfd_req_reset {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
}; };
struct vfd_req_cls { struct vfd_req_cls {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
}; };
struct vfd_req_brightness { struct vfd_req_brightness {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t brightness; uint8_t brightness;
}; };
struct vfd_req_power { struct vfd_req_power {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t power_state; uint8_t power_state;
}; };
struct vfd_req_hscroll { struct vfd_req_hscroll {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t x_pos; uint8_t x_pos;
}; };
struct vfd_req_draw { struct vfd_req_draw {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint16_t x0; uint16_t x0;
uint8_t y0; uint8_t y0;
uint16_t x1; uint16_t x1;
uint8_t y1; uint8_t y1;
uint8_t image[2048]; uint8_t image[2048];
}; };
struct vfd_req_cursor { struct vfd_req_cursor {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint16_t x; uint16_t x;
uint8_t y; uint8_t y;
}; };
struct vfd_req_encoding { struct vfd_req_encoding {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t encoding; uint8_t encoding;
}; };
struct vfd_req_wnd { struct vfd_req_wnd {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint16_t x0; uint16_t x0;
uint8_t y0; uint8_t y0;
uint16_t x1; uint16_t x1;
uint8_t y1; uint8_t y1;
}; };
struct vfd_req_speed { struct vfd_req_speed {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t encoding; uint8_t encoding;
}; };
struct vfd_req_scroll { struct vfd_req_scroll {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
}; };
struct vfd_req_rotate { struct vfd_req_rotate {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t unk1; uint8_t unk1;
}; };
struct vfd_req_create_char { struct vfd_req_create_char {
struct vfd_req_hdr hdr; struct vfd_req_hdr hdr;
uint8_t type; uint8_t type;
uint8_t pixels[32]; uint8_t pixels[32];
}; };

View File

@ -1,88 +1,88 @@
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#define SUPER_VERBOSE 1 #define SUPER_VERBOSE 1
#include "board/vfd-frame.h" #include "board/vfd-frame.h"
#include "hook/iobuf.h" #include "hook/iobuf.h"
#include "util/dprintf.h" #include "util/dprintf.h"
static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte); static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte);
/* Frame structure: /* Frame structure:
REQUEST: REQUEST:
[0] Sync byte (0x1A or 0x1B) [0] Sync byte (0x1A or 0x1B)
[1] Packet ID [1] Packet ID
[2...n-1] Data/payload [2...n-1] Data/payload
--- OR --- --- OR ---
if no sync byte is given, plain static text in the currently configured encoding is expected. if no sync byte is given, plain static text in the currently configured encoding is expected.
RESPONSE: RESPONSE:
This thing never responds, unless it's VFD_CMD_GET_VERSION This thing never responds, unless it's VFD_CMD_GET_VERSION
*/ */
bool vfd_frame_sync(struct const_iobuf *src) { bool vfd_frame_sync(struct const_iobuf *src) {
return src->bytes[src->pos] == VFD_SYNC_BYTE || src->bytes[src->pos] == VFD_SYNC_BYTE2; return src->bytes[src->pos] == VFD_SYNC_BYTE || src->bytes[src->pos] == VFD_SYNC_BYTE2;
} }
HRESULT vfd_frame_encode( HRESULT vfd_frame_encode(
struct iobuf *dest, struct iobuf *dest,
const void *ptr, const void *ptr,
size_t nbytes) { size_t nbytes) {
const uint8_t *src; const uint8_t *src;
uint8_t byte; uint8_t byte;
size_t i; size_t i;
HRESULT hr; HRESULT hr;
assert(dest != NULL); assert(dest != NULL);
assert(dest->bytes != NULL || dest->nbytes == 0); assert(dest->bytes != NULL || dest->nbytes == 0);
assert(dest->pos <= dest->nbytes); assert(dest->pos <= dest->nbytes);
assert(ptr != NULL); assert(ptr != NULL);
src = ptr; src = ptr;
if (dest->pos >= dest->nbytes) { if (dest->pos >= dest->nbytes) {
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
} }
#if SUPER_VERBOSE #if SUPER_VERBOSE
dprintf("VFD: RX Buffer:\n"); dprintf("VFD: RX Buffer:\n");
#endif #endif
for (i = 1; i < nbytes; i++) { for (i = 1; i < nbytes; i++) {
byte = src[i]; byte = src[i];
#if SUPER_VERBOSE #if SUPER_VERBOSE
dprintf("%02x ", byte); dprintf("%02x ", byte);
#endif #endif
hr = vfd_frame_encode_byte(dest, byte); hr = vfd_frame_encode_byte(dest, byte);
if (FAILED(hr)) { if (FAILED(hr)) {
return hr; return hr;
} }
} }
#if SUPER_VERBOSE #if SUPER_VERBOSE
dprintf("\n"); dprintf("\n");
#endif #endif
return hr; return hr;
} }
static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte) { static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte) {
if (dest->pos + 1 > dest->nbytes) { if (dest->pos + 1 > dest->nbytes) {
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
} }
dest->bytes[dest->pos++] = byte; dest->bytes[dest->pos++] = byte;
return S_OK; return S_OK;
} }

View File

@ -1,20 +1,20 @@
#pragma once #pragma once
#include <windows.h> #include <windows.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "hook/iobuf.h" #include "hook/iobuf.h"
enum { enum {
VFD_SYNC_BYTE = 0x1B, VFD_SYNC_BYTE = 0x1B,
VFD_SYNC_BYTE2 = 0x1A, VFD_SYNC_BYTE2 = 0x1A,
}; };
bool vfd_frame_sync(struct const_iobuf *src); bool vfd_frame_sync(struct const_iobuf *src);
HRESULT vfd_frame_encode( HRESULT vfd_frame_encode(
struct iobuf *dest, struct iobuf *dest,
const void *ptr, const void *ptr,
size_t nbytes); size_t nbytes);

View File

@ -1,398 +1,398 @@
/* This is some sort of LCD display found on various cabinets. It is driven /* 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 directly by amdaemon, and it has something to do with displaying the status
of electronic payments. of electronic payments.
Part number in schematics is "VFD GP1232A02A FUTABA". */ Part number in schematics is "VFD GP1232A02A FUTABA". */
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <stdint.h> #include <stdint.h>
#include "board/config.h" #include "board/config.h"
#include "board/vfd.h" #include "board/vfd.h"
#include "board/vfd-cmd.h" #include "board/vfd-cmd.h"
#include "hook/iohook.h" #include "hook/iohook.h"
#include "hooklib/uart.h" #include "hooklib/uart.h"
#include "util/dprintf.h" #include "util/dprintf.h"
#include "util/dump.h" #include "util/dump.h"
#define SUPER_VERBOSE 0 #define SUPER_VERBOSE 0
static HRESULT vfd_handle_irp(struct irp *irp); static HRESULT vfd_handle_irp(struct irp *irp);
static struct uart vfd_uart; static struct uart vfd_uart;
static uint8_t vfd_written[4096]; static uint8_t vfd_written[4096];
static uint8_t vfd_readable[4096]; static uint8_t vfd_readable[4096];
static int encoding = VFD_ENC_SHIFT_JIS; 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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); HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
static bool utf_enabled; static bool utf_enabled;
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port) HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port)
{ {
if (!cfg->enable){ if (!cfg->enable){
return S_FALSE; return S_FALSE;
} }
utf_enabled = cfg->utf_conversion; utf_enabled = cfg->utf_conversion;
int port = cfg->port; int port = cfg->port;
if (port == 0){ if (port == 0){
port = default_port; port = default_port;
} }
dprintf("VFD: enabling (port=%d)\n", port); dprintf("VFD: enabling (port=%d)\n", port);
uart_init(&vfd_uart, port); uart_init(&vfd_uart, port);
vfd_uart.written.bytes = vfd_written; vfd_uart.written.bytes = vfd_written;
vfd_uart.written.nbytes = sizeof(vfd_written); vfd_uart.written.nbytes = sizeof(vfd_written);
vfd_uart.readable.bytes = vfd_readable; vfd_uart.readable.bytes = vfd_readable;
vfd_uart.readable.nbytes = sizeof(vfd_readable); vfd_uart.readable.nbytes = sizeof(vfd_readable);
return iohook_push_handler(vfd_handle_irp); return iohook_push_handler(vfd_handle_irp);
} }
const char* get_encoding_name(int b){ const char* get_encoding_name(int b){
switch (b){ switch (b){
case 0: return "gb2312"; case 0: return "gb2312";
case 1: return "big5"; case 1: return "big5";
case 2: return "shift-jis"; case 2: return "shift-jis";
case 3: return "ks_c_5601-1987"; case 3: return "ks_c_5601-1987";
default: return "unknown"; default: return "unknown";
} }
} }
void print_vfd_text(const char* str, int len){ void print_vfd_text(const char* str, int len){
if (utf_enabled){ if (utf_enabled){
wchar_t encoded[1024]; wchar_t encoded[1024];
memset(encoded, 0, 1024 * sizeof(wchar_t)); memset(encoded, 0, 1024 * sizeof(wchar_t));
int codepage = 0; int codepage = 0;
if (encoding == VFD_ENC_GB2312){ if (encoding == VFD_ENC_GB2312){
codepage = 936; codepage = 936;
} else if (encoding == VFD_ENC_BIG5){ } else if (encoding == VFD_ENC_BIG5){
codepage = 950; codepage = 950;
} else if (encoding == VFD_ENC_SHIFT_JIS){ } else if (encoding == VFD_ENC_SHIFT_JIS){
codepage = 932; codepage = 932;
} else if (encoding == VFD_ENC_KSC5601) { } else if (encoding == VFD_ENC_KSC5601) {
codepage = 949; codepage = 949;
} }
if (!MultiByteToWideChar(codepage, MB_USEGLYPHCHARS, str, len, encoded, 1024)){ if (!MultiByteToWideChar(codepage, MB_USEGLYPHCHARS, str, len, encoded, 1024)){
dprintf("VFD: Text conversion failed: %ld", GetLastError()); dprintf("VFD: Text conversion failed: %ld", GetLastError());
return; return;
} }
dprintf("VFD: Text: %ls\n", encoded); dprintf("VFD: Text: %ls\n", encoded);
} else { } else {
dprintf("VFD: Text: %s\n", str); dprintf("VFD: Text: %s\n", str);
} }
} }
static HRESULT vfd_handle_irp(struct irp *irp) static HRESULT vfd_handle_irp(struct irp *irp)
{ {
HRESULT hr; HRESULT hr;
assert(irp != NULL); assert(irp != NULL);
if (!uart_match_irp(&vfd_uart, irp)) { if (!uart_match_irp(&vfd_uart, irp)) {
return iohook_invoke_next(irp); return iohook_invoke_next(irp);
} }
if (irp->op == IRP_OP_OPEN){ if (irp->op == IRP_OP_OPEN){
dprintf("VFD: Open\n"); dprintf("VFD: Open\n");
} else if (irp->op == IRP_OP_CLOSE){ } else if (irp->op == IRP_OP_CLOSE){
dprintf("VFD: Close\n"); dprintf("VFD: Close\n");
} }
hr = uart_handle_irp(&vfd_uart, irp); hr = uart_handle_irp(&vfd_uart, irp);
if (FAILED(hr) || irp->op != IRP_OP_WRITE) { if (FAILED(hr) || irp->op != IRP_OP_WRITE) {
return hr; return hr;
} }
#if SUPER_VERBOSE #if SUPER_VERBOSE
dprintf("VFD TX:\n"); dprintf("VFD TX:\n");
dump_iobuf(&vfd_uart.written); dump_iobuf(&vfd_uart.written);
#endif #endif
struct const_iobuf reader; struct const_iobuf reader;
iobuf_flip(&reader, &vfd_uart.written); iobuf_flip(&reader, &vfd_uart.written);
struct iobuf* writer = &vfd_uart.readable; struct iobuf* writer = &vfd_uart.readable;
for (; reader.pos < reader.nbytes ; ){ for (; reader.pos < reader.nbytes ; ){
if (vfd_frame_sync(&reader)) { if (vfd_frame_sync(&reader)) {
reader.pos++; // get the sync byte out of the way reader.pos++; // get the sync byte out of the way
uint8_t cmd; uint8_t cmd;
iobuf_read_8(&reader, &cmd); iobuf_read_8(&reader, &cmd);
if (cmd == VFD_CMD_GET_VERSION) { if (cmd == VFD_CMD_GET_VERSION) {
hr = vfd_handle_get_version(&reader, writer, &vfd_uart); hr = vfd_handle_get_version(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_RESET) { } else if (cmd == VFD_CMD_RESET) {
hr = vfd_handle_reset(&reader, writer, &vfd_uart); hr = vfd_handle_reset(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_CLEAR_SCREEN) { } else if (cmd == VFD_CMD_CLEAR_SCREEN) {
hr = vfd_handle_clear_screen(&reader, writer, &vfd_uart); hr = vfd_handle_clear_screen(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_BRIGHTNESS) { } else if (cmd == VFD_CMD_SET_BRIGHTNESS) {
hr = vfd_handle_set_brightness(&reader, writer, &vfd_uart); hr = vfd_handle_set_brightness(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_SCREEN_ON) { } else if (cmd == VFD_CMD_SET_SCREEN_ON) {
hr = vfd_handle_set_screen_on(&reader, writer, &vfd_uart); hr = vfd_handle_set_screen_on(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_H_SCROLL) { } else if (cmd == VFD_CMD_SET_H_SCROLL) {
hr = vfd_handle_set_h_scroll(&reader, writer, &vfd_uart); hr = vfd_handle_set_h_scroll(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_DRAW_IMAGE) { } else if (cmd == VFD_CMD_DRAW_IMAGE) {
hr = vfd_handle_draw_image(&reader, writer, &vfd_uart); hr = vfd_handle_draw_image(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_CURSOR) { } else if (cmd == VFD_CMD_SET_CURSOR) {
hr = vfd_handle_set_cursor(&reader, writer, &vfd_uart); hr = vfd_handle_set_cursor(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_ENCODING) { } else if (cmd == VFD_CMD_SET_ENCODING) {
hr = vfd_handle_set_encoding(&reader, writer, &vfd_uart); hr = vfd_handle_set_encoding(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_TEXT_WND) { } else if (cmd == VFD_CMD_SET_TEXT_WND) {
hr = vfd_handle_set_text_wnd(&reader, writer, &vfd_uart); hr = vfd_handle_set_text_wnd(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_SET_TEXT_SPEED) { } else if (cmd == VFD_CMD_SET_TEXT_SPEED) {
hr = vfd_handle_set_text_speed(&reader, writer, &vfd_uart); hr = vfd_handle_set_text_speed(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_WRITE_TEXT) { } else if (cmd == VFD_CMD_WRITE_TEXT) {
hr = vfd_handle_write_text(&reader, writer, &vfd_uart); hr = vfd_handle_write_text(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_ENABLE_SCROLL) { } else if (cmd == VFD_CMD_ENABLE_SCROLL) {
hr = vfd_handle_enable_scroll(&reader, writer, &vfd_uart); hr = vfd_handle_enable_scroll(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_DISABLE_SCROLL) { } else if (cmd == VFD_CMD_DISABLE_SCROLL) {
hr = vfd_handle_disable_scroll(&reader, writer, &vfd_uart); hr = vfd_handle_disable_scroll(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_ROTATE) { } else if (cmd == VFD_CMD_ROTATE) {
hr = vfd_handle_rotate(&reader, writer, &vfd_uart); hr = vfd_handle_rotate(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_CREATE_CHAR) { } else if (cmd == VFD_CMD_CREATE_CHAR) {
hr = vfd_handle_create_char(&reader, writer, &vfd_uart); hr = vfd_handle_create_char(&reader, writer, &vfd_uart);
} else if (cmd == VFD_CMD_CREATE_CHAR2) { } else if (cmd == VFD_CMD_CREATE_CHAR2) {
hr = vfd_handle_create_char2(&reader, writer, &vfd_uart); hr = vfd_handle_create_char2(&reader, writer, &vfd_uart);
} else { } else {
dprintf("VFD: Unknown command 0x%x\n", cmd); dprintf("VFD: Unknown command 0x%x\n", cmd);
dump_const_iobuf(&reader); dump_const_iobuf(&reader);
hr = S_FALSE; hr = S_FALSE;
} }
} else { } else {
// if no sync byte is sent, we are just getting plain text... // if no sync byte is sent, we are just getting plain text...
if (reader.pos < reader.nbytes){ if (reader.pos < reader.nbytes){
int len = 0; int len = 0;
// read chars until we hit a new sync byte or the data ends // 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){ while (reader.pos + len + 1 < reader.nbytes && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE2){
len++; len++;
} }
char* str = malloc(len); char* str = malloc(len);
memset(str, 0, len); memset(str, 0, len);
iobuf_read(&reader, str, len); iobuf_read(&reader, str, len);
print_vfd_text(str, len); print_vfd_text(str, len);
free(str); free(str);
reader.pos += len; reader.pos += len;
} }
} }
if (!SUCCEEDED(hr)){ if (!SUCCEEDED(hr)){
return hr; return hr;
} }
} }
vfd_uart.written.pos = 0; vfd_uart.written.pos = 0;
return hr; return hr;
} }
HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){ HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
dprintf("VFD: Get Version\n"); dprintf("VFD: Get Version\n");
struct vfd_resp_board_info resp; struct vfd_resp_board_info resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.unk1 = 2; resp.unk1 = 2;
strcpy(resp.version, "01.20"); strcpy(resp.version, "01.20");
resp.unk2 = 1; resp.unk2 = 1;
return vfd_frame_encode(writer, &resp, sizeof(resp)); return vfd_frame_encode(writer, &resp, sizeof(resp));
} }
HRESULT vfd_handle_reset(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){
dprintf("VFD: Reset\n"); dprintf("VFD: Reset\n");
encoding = VFD_ENC_SHIFT_JIS; encoding = VFD_ENC_SHIFT_JIS;
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_clear_screen(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){
dprintf("VFD: Clear Screen\n"); dprintf("VFD: Clear Screen\n");
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_brightness(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
if (b > 4){ if (b > 4){
dprintf("VFD: Brightness, invalid argument\n"); dprintf("VFD: Brightness, invalid argument\n");
return E_FAIL; return E_FAIL;
} }
dprintf("VFD: Brightness, %d\n", b); dprintf("VFD: Brightness, %d\n", b);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_screen_on(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
if (b > 1){ if (b > 1){
dprintf("VFD: Screen Power, invalid argument\n"); dprintf("VFD: Screen Power, invalid argument\n");
return E_FAIL; return E_FAIL;
} }
dprintf("VFD: Screen Power, %d\n", b); dprintf("VFD: Screen Power, %d\n", b);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_h_scroll(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){
uint8_t x; uint8_t x;
iobuf_read_8(reader, &x); iobuf_read_8(reader, &x);
dprintf("VFD: Horizontal Scroll, X=%d\n", x); dprintf("VFD: Horizontal Scroll, X=%d\n", x);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_draw_image(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){
int w, h; int w, h;
uint16_t x0, x1; uint16_t x0, x1;
uint8_t y0, y1; uint8_t y0, y1;
uint8_t image[2048]; uint8_t image[2048];
iobuf_read_be16(reader, &x0); iobuf_read_be16(reader, &x0);
iobuf_read_8(reader, &y0); iobuf_read_8(reader, &y0);
iobuf_read_be16(reader, &x1); iobuf_read_be16(reader, &x1);
iobuf_read_8(reader, &y1); iobuf_read_8(reader, &y1);
w = x1 - x0; w = x1 - x0;
h = y1 - y0; h = y1 - y0;
iobuf_read(reader, image, w*h); iobuf_read(reader, image, w*h);
dprintf("VFD: Draw image, %dx%d\n", w, h); dprintf("VFD: Draw image, %dx%d\n", w, h);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_cursor(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){
uint16_t x; uint16_t x;
uint8_t y; uint8_t y;
iobuf_read_be16(reader, &x); iobuf_read_be16(reader, &x);
iobuf_read_8(reader, &y); iobuf_read_8(reader, &y);
dprintf("VFD: Set Cursor, x=%d,y=%d\n", x, y); dprintf("VFD: Set Cursor, x=%d,y=%d\n", x, y);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_encoding(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
dprintf("VFD: Set Encoding, %d (%s)\n", b, get_encoding_name(b)); dprintf("VFD: Set Encoding, %d (%s)\n", b, get_encoding_name(b));
if (b < 0 || b > VFD_ENC_MAX){ if (b < 0 || b > VFD_ENC_MAX){
dprintf("Invalid encoding specified\n"); dprintf("Invalid encoding specified\n");
return E_FAIL; return E_FAIL;
} }
encoding = b; encoding = b;
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_text_wnd(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){
uint16_t x0, x1; uint16_t x0, x1;
uint8_t y0, y1; uint8_t y0, y1;
iobuf_read_be16(reader, &x0); iobuf_read_be16(reader, &x0);
iobuf_read_8(reader, &y0); iobuf_read_8(reader, &y0);
iobuf_read_be16(reader, &x1); iobuf_read_be16(reader, &x1);
iobuf_read_8(reader, &y1); iobuf_read_8(reader, &y1);
dprintf("VFD: Set Text Window, p0:%d,%d, p1:%d,%d\n", x0, y0, x1, y1); dprintf("VFD: Set Text Window, p0:%d,%d, p1:%d,%d\n", x0, y0, x1, y1);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_set_text_speed(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
dprintf("VFD: Set Text Speed, %d\n", b); dprintf("VFD: Set Text Speed, %d\n", b);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_write_text(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){
uint8_t len; uint8_t len;
iobuf_read_8(reader, &len); iobuf_read_8(reader, &len);
char* str = malloc(len); char* str = malloc(len);
iobuf_read(reader, str, len); iobuf_read(reader, str, len);
print_vfd_text(str, len); print_vfd_text(str, len);
free(str); free(str);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_enable_scroll(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){
dprintf("VFD: Enable Scrolling\n"); dprintf("VFD: Enable Scrolling\n");
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_disable_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){
dprintf("VFD: Disable Scrolling\n"); dprintf("VFD: Disable Scrolling\n");
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_rotate(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
dprintf("VFD: Rotate, %d\n", b); dprintf("VFD: Rotate, %d\n", b);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_create_char(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){
uint8_t b; uint8_t b;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
char buf[32]; char buf[32];
iobuf_read(reader, buf, 32); iobuf_read(reader, buf, 32);
dprintf("VFD: Create character, %d\n", b); dprintf("VFD: Create character, %d\n", b);
return S_FALSE; return S_FALSE;
} }
HRESULT vfd_handle_create_char2(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){
uint8_t b, b2; uint8_t b, b2;
iobuf_read_8(reader, &b); iobuf_read_8(reader, &b);
iobuf_read_8(reader, &b2); iobuf_read_8(reader, &b2);
char buf[16]; char buf[16];
iobuf_read(reader, buf, 16); iobuf_read(reader, buf, 16);
dprintf("VFD: Create character, %d, %d\n", b, b2); dprintf("VFD: Create character, %d, %d\n", b, b2);
return S_FALSE; return S_FALSE;
} }

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <windows.h> #include <windows.h>
struct vfd_config { struct vfd_config {
bool enable; bool enable;
int port; int port;
bool utf_conversion; bool utf_conversion;
}; };
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port); HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port);

View File

@ -1,108 +1,108 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation Disable to use a real VFD ; Enable VFD emulation Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.165.0 subnet=192.168.165.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 0 on exactly one machine and set this to 1 on all others.
dipsw1=0 dipsw1=0
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hooks settings ; Misc. hooks settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[touch] [touch]
; Enable/Disable WinTouch emulation ; Enable/Disable WinTouch emulation
enable=1 enable=1
[unity] [unity]
; Path to a .NET DLL that should run before the game. Useful for loading ; Path to a .NET DLL that should run before the game. Useful for loading
; modding frameworks such as BepInEx. ; modding frameworks such as BepInEx.
targetAssembly= targetAssembly=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
up=0x57 up=0x57
down=0x53 down=0x53
left=0x41 left=0x41
right=0x44 right=0x44

22
dist/apm3/start.bat vendored
View File

@ -1,12 +1,12 @@
@echo off @echo off
pushd %~dp0 pushd %~dp0
start "AM Daemon" /min inject -d -k apm3hook.dll amdaemonD.exe -c daemon_config\common.json daemon_config\standalone.json start "AM Daemon" /min inject -d -k apm3hook.dll amdaemonD.exe -c daemon_config\common.json daemon_config\standalone.json
inject -d -k apm3hook.dll Apmv3System.exe -screen-fullscreen 0 -popupwindow -screen-width 1920 -screen-height 1080 inject -d -k apm3hook.dll Apmv3System.exe -screen-fullscreen 0 -popupwindow -screen-width 1920 -screen-height 1080
taskkill /f /im amdaemonD.exe > nul 2>&1 taskkill /f /im amdaemonD.exe > nul 2>&1
echo. echo.
echo Game processes have terminated echo Game processes have terminated
pause pause

View File

@ -1,206 +1,206 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
; Enable high baud rate. ; Enable high baud rate.
;highBaud=1 ;highBaud=1
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; Simulate an ideal LAN environment. This may interfere with head-to-head play.
; Chunithm is extremely picky about its LAN environment, so leaving this ; Chunithm is extremely picky about its LAN environment, so leaving this
; setting enabled is strongly recommended. ; setting enabled is strongly recommended.
enable=1 enable=1
; The final octet of the local host's IP address on the virtualized subnet (so, ; 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 ; 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`). ; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11 addrSuffix=11
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.139.0 subnet=192.168.139.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1 dipsw1=1
; Monitor type: 0 = 120FPS, 1 = 60FPS ; Monitor type: 0 = 120FPS, 1 = 60FPS
dipsw2=1 dipsw2=1
; Cab type: 0 = SP, 1 = CVT. SP will enable VFD and eMoney. This setting will switch ; 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. ; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well.
dipsw3=1 dipsw3=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hooks settings ; Misc. hooks settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[gfx] [gfx]
; Force the game to run windowed. ; Force the game to run windowed.
windowed=1 windowed=1
; Add a frame to the game window if running windowed. ; Add a frame to the game window if running windowed.
framed=0 framed=0
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen) ; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0 monitor=0
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; LED settings ; LED settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[led15093] [led15093]
; Enable emulation of the 15093-06 controlled lights, which handle the air tower ; Enable emulation of the 15093-06 controlled lights, which handle the air tower
; RGBs and the rear LED panel (billboard) on the cabinet. ; RGBs and the rear LED panel (billboard) on the cabinet.
enable=1 enable=1
[led] [led]
; Output billboard LED strip data to a named pipe called "\\.\pipe\chuni_led" ; Output billboard LED strip data to a named pipe called "\\.\pipe\chuni_led"
cabLedOutputPipe=1 cabLedOutputPipe=1
; Output billboard LED strip data to serial ; Output billboard LED strip data to serial
cabLedOutputSerial=0 cabLedOutputSerial=0
; Output slider LED data to the named pipe ; Output slider LED data to the named pipe
controllerLedOutputPipe=1 controllerLedOutputPipe=1
; Output slider LED data to the serial port ; Output slider LED data to the serial port
controllerLedOutputSerial=0 controllerLedOutputSerial=0
; Use the OpeNITHM protocol for serial LED output ; Use the OpeNITHM protocol for serial LED output
controllerLedOutputOpeNITHM=0 controllerLedOutputOpeNITHM=0
; Serial port to send data to if using serial output. Default is COM5. ; Serial port to send data to if using serial output. Default is COM5.
;serialPort=COM5 ;serialPort=COM5
; Baud rate for serial data (set to 115200 if using OpeNITHM) ; Baud rate for serial data (set to 115200 if using OpeNITHM)
;serialBaud=921600 ;serialBaud=921600
; Data output a sequence of bytes, with JVS-like framing. ; Data output a sequence of bytes, with JVS-like framing.
; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, ; 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 ; 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. ; 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 ; After the sync is one byte for the board number that was updated, followed by
; the red, green and blue values for each LED. ; the red, green and blue values for each LED.
; ;
; Board 0 has 53 LEDs: ; Board 0 has 53 LEDs:
; [0]-[49]: snakes through left half of billboard (first column starts at top) ; [0]-[49]: snakes through left half of billboard (first column starts at top)
; [50]-[52]: left side partition LEDs ; [50]-[52]: left side partition LEDs
; ;
; Board 1 has 63 LEDs: ; Board 1 has 63 LEDs:
; [0]-[59]: right half of billboard (first column starts at bottom) ; [0]-[59]: right half of billboard (first column starts at bottom)
; [60]-[62]: right side partition LEDs ; [60]-[62]: right side partition LEDs
; ;
; Board 2 is the slider and has 31 LEDs: ; Board 2 is the slider and has 31 LEDs:
; [0]-[31]: slider LEDs right to left BRG, alternating between keys and dividers ; [0]-[31]: slider LEDs right to left BRG, alternating between keys and dividers
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL (x64) enter its path here. ; 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. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[chuniio] [chuniio]
; Uncomment this if you have custom chuniio implementation comprised of a single 32bit DLL. ; Uncomment this if you have custom chuniio implementation comprised of a single 32bit DLL.
; (will use chu2to3 engine internally) ; (will use chu2to3 engine internally)
;path= ;path=
; Uncomment both of these if you have custom chuniio implementation comprised of two DLLs. ; Uncomment both of these if you have custom chuniio implementation comprised of two DLLs.
; x86 chuniio to path32, x64 to path64. Both are necessary. ; x86 chuniio to path32, x64 to path64. Both are necessary.
;path32= ;path32=
;path64= ;path64=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io3] [io3]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; Set to 0 for enable separate ir control. Deafult is space key. ; Set to 0 for enable separate ir control. Deafult is space key.
ir=0x20 ir=0x20
[ir] [ir]
; Uncomment and complete the following sequence of settings to configure a ; Uncomment and complete the following sequence of settings to configure a
; custom ir-cappable controller if you have one. ; custom ir-cappable controller if you have one.
;ir6=0x53 ;ir6=0x53
; ... etc ... ; ... etc ...
;ir1=0x53 ;ir1=0x53
[slider] [slider]
; Enable slider emulation. If you have real AC slider, set this to 0. ; Enable slider emulation. If you have real AC slider, set this to 0.
; Slider serial port must be COM1. ; Slider serial port must be COM1.
;enable=1 ;enable=1
; Key bindings for each of the 32 touch cells. The default key map, depicted ; Key bindings for each of the 32 touch cells. The default key map, depicted
; in left-to-right order, is as follows: ; in left-to-right order, is as follows:
; ;
; SSSSDDDDFFFFGGGGHHHHJJJJKKKKLLLL ; SSSSDDDDFFFFGGGGHHHHJJJJKKKKLLLL
; ;
; Touch cells are numbered FROM RIGHT TO LEFT! starting from 1. This is in ; 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. ; order to match the numbering used in the operator menu and service manual.
; ;
; Uncomment and complete the following sequence of settings to configure a ; Uncomment and complete the following sequence of settings to configure a
; custom high-precision touch strip controller if you have one. ; custom high-precision touch strip controller if you have one.
;cell1=0x53 ;cell1=0x53
;cell2=0x53 ;cell2=0x53
; ... etc ... ; ... etc ...
;cell31=0x53 ;cell31=0x53
;cell32=0x53 ;cell32=0x53

222
dist/cm/segatools.ini vendored
View File

@ -1,111 +1,111 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.165.0 subnet=192.168.165.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 0 on exactly one machine and set this to 1 on all others.
dipsw1=0 dipsw1=0
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hooks settings ; Misc. hooks settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[touch] [touch]
; Enable/Disable WinTouch emulation ; Enable/Disable WinTouch emulation
enable=0 enable=0
[unity] [unity]
; Path to a .NET DLL that should run before the game. Useful for loading ; Path to a .NET DLL that should run before the game. Useful for loading
; modding frameworks such as BepInEx. ; modding frameworks such as BepInEx.
targetAssembly= targetAssembly=
[printer] [printer]
; Sinfonia CHC-C330 printer emulation setting. ; Sinfonia CHC-C330 printer emulation setting.
enable=1 enable=1
; Change the printer serial number here. ; Change the printer serial number here.
serial_no="5A-A123" serial_no="5A-A123"
; Insert the path to the image output directory here. ; Insert the path to the image output directory here.
printerOutPath="DEVICE\print" printerOutPath="DEVICE\print"
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72

320
dist/fgo/segatools.ini vendored
View File

@ -1,160 +1,160 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
[deckReader] [deckReader]
; 837-15345 RFID deck reader emulation setting. ; 837-15345 RFID deck reader emulation setting.
enable=1 enable=1
[ftdi] [ftdi]
; FTDI serial to usb adapter emulation for CABINET LED. ; FTDI serial to usb adapter emulation for CABINET LED.
enable=1 enable=1
; COM port number where the LED board is connected to. ; COM port number where the LED board is connected to.
portNo=17 portNo=17
[led15093] [led15093]
; 837-15093-06 LED board emulation setting. ; 837-15093-06 LED board emulation setting.
enable=1 enable=1
; COM port number for the LED board. Has to be the same as the FTDI port. ; COM port number for the LED board. Has to be the same as the FTDI port.
portNo=17 portNo=17
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; The final octet of the local host's IP address on the virtualized subnet (so, ; 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 ; 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`). ; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11 addrSuffix=11
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.167.0 subnet=192.168.167.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hook settings ; Misc. hook settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[touch] [touch]
; WinTouch emulation setting. ; WinTouch emulation setting.
enable=1 enable=1
remap=1 remap=1
cursor=1 cursor=1
[printer] [printer]
; Sinfonia CHC-C330 printer emulation setting. ; Sinfonia CHC-C330 printer emulation setting.
enable=1 enable=1
; Change the printer serial number here. ; Change the printer serial number here.
serial_no="5A-A123" serial_no="5A-A123"
; Insert the path to the image output directory here. ; Insert the path to the image output directory here.
printerOutPath="DEVICE\print" printerOutPath="DEVICE\print"
; Rotate all printed images by 180 degrees. ; Rotate all printed images by 180 degrees.
rotate180=1 rotate180=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[fgoio] [fgoio]
; To use a custom Fate/Grand Order Arcade IO DLL enter its path here. ; 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. ; Leave empty if you want to use Segatools built-in gamepad input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; .·:'''''''''''''''''''''''''''''''''''''''''''''':·. ; .·:'''''''''''''''''''''''''''''''''''''''''''''':·.
; : : ______ / \ [] : : ; : : ______ / \ [] : :
; : : | | _____ \ / Coin : : ; : : | | _____ \ / Coin : :
; : : |______| { (0) } /--\ Attack. : : ; : : |______| { (0) } /--\ Attack. : :
; : : DECK \ / / \ : : ; : : DECK \ / / \ : :
; : : | | > < : : ; : : | | > < : :
; : : | | \ / ___ : : ; : : | | \ / ___ : :
; : : | | \--/ | | : : ; : : | | \--/ | | : :
; : : JOY Noble. | | : : ; : : JOY Noble. | | : :
; : : |___| : : ; : : |___| : :
; : : AIME. : : ; : : AIME. : :
; '·:..............................................:·' ; '·:..............................................:·'
; ;
; Only XInput is currently supported. ; Only XInput is currently supported.
; XInput bindings ; XInput bindings
; ;
; Left Stick Joystick ; Left Stick Joystick
; Left Stick Click Reset Camera ; Left Stick Click Reset Camera
; Left Trigger Dash ; Left Trigger Dash
; Left Shoulder Switch Target ; Left Shoulder Switch Target
; A/B Attack ; A/B Attack
; X/Y Noble Phantasm ; X/Y Noble Phantasm

View File

@ -1,136 +1,136 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about its LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; The final octet of the local host's IP address on the virtualized subnet (so, ; 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 ; 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`). ; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11 addrSuffix=11
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.172.0 subnet=192.168.172.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1 dipsw1=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hook settings ; Misc. hook settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[unity] [unity]
; Enable Unity hook. This will allow you to run custom .NET code before the game ; Enable Unity hook. This will allow you to run custom .NET code before the game
enable=1 enable=1
; Path to a .NET DLL that should run before the game. Useful for loading ; Path to a .NET DLL that should run before the game. Useful for loading
; modding frameworks such as BepInEx. ; modding frameworks such as BepInEx.
targetAssembly= targetAssembly=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[mai2io] [mai2io]
; To use a custom maimai DX IO DLL enter its path here. ; To use a custom maimai DX IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; Key bindings for buttons around screen. The default key map, depicted ; Key bindings for buttons around screen. The default key map, depicted
; in clockwise order, is as follows: ; in clockwise order, is as follows:
; ;
; Player 1 Ring buttons: WEDCXZAQ, Select button: 3 ; Player 1 Ring buttons: WEDCXZAQ, Select button: 3
; Player 2 Ring buttons: (Numpad) 89632147, Select button: (Numpad) * ; Player 2 Ring buttons: (Numpad) 89632147, Select button: (Numpad) *
; ;
; Select buttons are considered as button 9. ; Select buttons are considered as button 9.
; ;
; Uncomment and complete the following sequence of settings to configure a ; Uncomment and complete the following sequence of settings to configure a
; custom keybinding. ; custom keybinding.
[button] [button]
;1p_btn1=0x53 ;1p_btn1=0x53
;1p_btn2=0x53 ;1p_btn2=0x53
;1p_btn3=0x53 ;1p_btn3=0x53
; ... etc ... ; ... etc ...
;2p_btn1=0x53 ;2p_btn1=0x53
;2p_btn2=0x53 ;2p_btn2=0x53
;2p_btn3=0x53 ;2p_btn3=0x53
; ... etc ... ; ... etc ...

View File

@ -1,124 +1,124 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; The final octet of the local host's IP address on the virtualized subnet (so, ; 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 ; 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`). ; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11 addrSuffix=11
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.174.0 subnet=192.168.174.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1 dipsw1=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hook settings ; Misc. hook settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[gfx] [gfx]
enable=1 enable=1
; Hooks related to the touch boards ; Hooks related to the touch boards
[touch] [touch]
enable=1 enable=1
; Hooks related to the LED board (codenamed Elisabeth) ; Hooks related to the LED board (codenamed Elisabeth)
[elisabeth] [elisabeth]
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[mercuryio] [mercuryio]
; To use a custom WACCA IO DLL enter its path here. ; To use a custom WACCA IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; Volume up virtual-key code. Default is the "UP" key. ; Volume up virtual-key code. Default is the "UP" key.
volup=0x26 volup=0x26
; Volume down virtual-key code. Default is the "DOWN" key. ; Volume down virtual-key code. Default is the "DOWN" key.
voldown=0x28 voldown=0x28

394
dist/mu3/segatools.ini vendored
View File

@ -1,197 +1,197 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata= appdata=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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 ; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168. ; that subnet must start with 192.168.
subnet=192.168.162.0 subnet=192.168.162.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1 dipsw1=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Misc. hook settings ; Misc. hook settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[gfx] [gfx]
enable=1 enable=1
[unity] [unity]
; Enable Unity hook. This will allow you to run custom .NET code before the game ; Enable Unity hook. This will allow you to run custom .NET code before the game
enable=1 enable=1
; Path to a .NET DLL that should run before the game. Useful for loading ; Path to a .NET DLL that should run before the game. Useful for loading
; modding frameworks such as BepInEx. ; modding frameworks such as BepInEx.
targetAssembly= targetAssembly=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; LED settings ; LED settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[led15093] [led15093]
; Enable emulation of the 15093-06 controlled lights, which handle the air tower ; Enable emulation of the 15093-06 controlled lights, which handle the air tower
; RGBs and the rear LED panel (billboard) on the cabinet. ; RGBs and the rear LED panel (billboard) on the cabinet.
enable=1 enable=1
[led] [led]
; Output billboard LED strip data to a named pipe called "\\.\pipe\ongeki_led" ; Output billboard LED strip data to a named pipe called "\\.\pipe\ongeki_led"
cabLedOutputPipe=1 cabLedOutputPipe=1
; Output billboard LED strip data to serial ; Output billboard LED strip data to serial
cabLedOutputSerial=0 cabLedOutputSerial=0
; Output slider LED data to the named pipe ; Output slider LED data to the named pipe
controllerLedOutputPipe=1 controllerLedOutputPipe=1
; Output slider LED data to the serial port ; Output slider LED data to the serial port
controllerLedOutputSerial=0 controllerLedOutputSerial=0
; Serial port to send data to if using serial output. Default is COM5. ; Serial port to send data to if using serial output. Default is COM5.
;serialPort=COM5 ;serialPort=COM5
; Baud rate for serial data ; Baud rate for serial data
;serialBaud=921600 ;serialBaud=921600
; Data output a sequence of bytes, with JVS-like framing. ; Data output a sequence of bytes, with JVS-like framing.
; Each "packet" starts with 0xE0 as a sync. To avoid E0 appearing elsewhere, ; 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 ; 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. ; 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 ; After the sync is one byte for the board number that was updated, followed by
; the red, green and blue values for each LED. ; the red, green and blue values for each LED.
; ;
; Board 0 has 61 LEDs: ; Board 0 has 61 LEDs:
; [0]-[1]: left side button ; [0]-[1]: left side button
; [2]-[8]: left pillar lower LEDs ; [2]-[8]: left pillar lower LEDs
; [9]-[17]: left pillar center LEDs ; [9]-[17]: left pillar center LEDs
; [18]-[24]: left pillar upper LEDs ; [18]-[24]: left pillar upper LEDs
; [25]-[35]: billboard LEDs ; [25]-[35]: billboard LEDs
; [36]-[42]: right pillar upper LEDs ; [36]-[42]: right pillar upper LEDs
; [43]-[51]: right pillar center LEDs ; [43]-[51]: right pillar center LEDs
; [52]-[58]: right pillar lower LEDs ; [52]-[58]: right pillar lower LEDs
; [59]-[60]: right side button ; [59]-[60]: right side button
; ;
; Board 1 has 6 LEDs: ; Board 1 has 6 LEDs:
; [0]-[5]: 3 left and 3 right controller buttons ; [0]-[5]: 3 left and 3 right controller buttons
; ;
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[mu3io] [mu3io]
; To use a custom O.N.G.E.K.I. IO DLL enter its path here. ; 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. ; Leave empty if you want to use Segatools built-in keyboard/gamepad input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; Set "1" to enable mouse lever emulation, "0" to use XInput ; Set "1" to enable mouse lever emulation, "0" to use XInput
mouse=1 mouse=1
; XInput input bindings ; XInput input bindings
; ;
; Left Stick Lever ; Left Stick Lever
; Left Trigger Lever (move to the left) ; Left Trigger Lever (move to the left)
; Right Trigger Lever (move to the right) ; Right Trigger Lever (move to the right)
; Left Left red button ; Left Left red button
; Up Left green button ; Up Left green button
; Right Left blue button ; Right Left blue button
; Left Shoulder Left side button ; Left Shoulder Left side button
; Right Shoulder Right side button ; Right Shoulder Right side button
; X Right red button ; X Right red button
; Y Right green button ; Y Right green button
; A Right blue button ; A Right blue button
; Back Left menu button ; Back Left menu button
; Start Right menu button ; Start Right menu button
; Keyboard input bindings ; Keyboard input bindings
left1=0x41 ; A left1=0x41 ; A
left2=0x53 ; S left2=0x53 ; S
left3=0x44 ; D left3=0x44 ; D
leftSide=0x01 ; Mouse Left leftSide=0x01 ; Mouse Left
rightSide=0x02 ; Mouse Right rightSide=0x02 ; Mouse Right
right1=0x4A ; J right1=0x4A ; J
right2=0x4B ; K right2=0x4B ; K
right3=0x4C ; L right3=0x4C ; L
leftMenu=0x55 ; U leftMenu=0x55 ; U
rightMenu=0x4F ; O rightMenu=0x4F ; O

View File

@ -1,186 +1,186 @@
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Path settings ; Path settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[vfs] [vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2) ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs= amfs=
; Insert the path to the game Option directory here (contains Axxx directories) ; Insert the path to the game Option directory here (contains Axxx directories)
option= option=
; Create an empty directory somewhere and insert the path here. ; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games. ; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%. ; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=appdata appdata=appdata
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Device settings ; Device settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aime] [aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime ; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader. ; reader.
enable=1 enable=1
aimePath=DEVICE\aime.txt aimePath=DEVICE\aime.txt
[vfd] [vfd]
; Enable VFD emulation. Disable to use a real VFD ; Enable VFD emulation. Disable to use a real VFD
; GP1232A02A FUTABA assembly. ; GP1232A02A FUTABA assembly.
enable=1 enable=1
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Network settings ; Network settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[dns] [dns]
; Insert the hostname or IP address of the server you wish to use here. ; 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. ; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1 default=127.0.0.1
[netenv] [netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play. ; 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 ; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended. ; setting enabled is recommended.
enable=1 enable=1
; The final octet of the local host's IP address on the virtualized subnet (so, ; 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 ; 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`). ; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11 addrSuffix=11
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Board settings ; Board settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[keychip] [keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect. ; 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, ; 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. ; in order to find the MAIN cabinet.
subnet=192.168.160.0 subnet=192.168.160.0
[system] [system]
; Enable ALLS system settings. ; Enable ALLS system settings.
enable=1 enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to ; 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 ; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode. ; allow you to start a game in freeplay mode.
freeplay=0 freeplay=0
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Custom IO settings ; Custom IO settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
[aimeio] [aimeio]
; To use a custom card reader IO DLL enter its path here. ; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input. ; Leave empty if you want to use Segatools built-in keyboard input.
path= path=
[swdcio] [swdcio]
; To use a custom SEGA World Drivers Championship DLL enter its path here. ; 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. ; Leave empty if you want to use Segatools built-in gamepad/wheel input.
path= path=
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Input settings ; Input settings
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal ; 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: ; (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 ; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; ;
; This is, admittedly, not the most user-friendly configuration method in the ; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later. ; world. An improved solution will be provided later.
[io4] [io4]
; Test button virtual-key code. Default is the F1 key. ; Test button virtual-key code. Default is the F1 key.
test=0x70 test=0x70
; Service button virtual-key code. Default is the F2 key. ; Service button virtual-key code. Default is the F2 key.
service=0x71 service=0x71
; Keyboard button to increment coin counter. Default is the F3 key. ; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72 coin=0x72
; Input API selection for IO4 input emulator. ; Input API selection for IO4 input emulator.
; Set "xinput" to use a gamepad and "dinput" to use a steering wheel. ; Set "xinput" to use a gamepad and "dinput" to use a steering wheel.
mode=xinput mode=xinput
; Adjust scaling for steering wheel input. ; Adjust scaling for steering wheel input.
; ;
; This setting scales the steering wheel input so that the maximum positive ; This setting scales the steering wheel input so that the maximum positive
; and minimum negative steering inputs reported in the operator menu's input ; 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, ; 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. ; 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 ; NOTE: This is not the same thing as DirectInput steering wheel movement
; range! Segatools cannot control the maximum angle of your physical steering ; range! Segatools cannot control the maximum angle of your physical steering
; wheel controller, this setting is vendor-specific and can only be adjusted ; wheel controller, this setting is vendor-specific and can only be adjusted
; in the Control Panel. ; in the Control Panel.
restrict=128 restrict=128
[xinput] [xinput]
; XInput bindings ; XInput bindings
; ;
; Left Stick Steering ; Left Stick Steering
; Right Stick (Steering) when "singleStickSteering" is disabled ; Right Stick (Steering) when "singleStickSteering" is disabled
; Left Trigger Brake ; Left Trigger Brake
; Right Trigger Accelerator ; Right Trigger Accelerator
; Left Shoulder Left Paddle ; Left Shoulder Left Paddle
; Right Shoulder Right Paddle ; Right Shoulder Right Paddle
; Start Start ; Start Start
; Back View Change ; Back View Change
; A Green (Wheel) ; A Green (Wheel)
; B Red (Wheel) ; B Red (Wheel)
; X Blue (Wheel) ; X Blue (Wheel)
; Y Yellow (Wheel) ; Y Yellow (Wheel)
; D-Pad D-Pad ; D-Pad D-Pad
; Use the left thumbstick for steering instead of both on XInput Controllers. ; 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. ; Not recommended as it will not give you the precision needed for this game.
singleStickSteering=1 singleStickSteering=1
; Use linear steering instead of the default non-linear cubing steering. ; Use linear steering instead of the default non-linear cubing steering.
linearSteering=1 linearSteering=1
; Configure deadzones for the left and right thumbsticks. ; Configure deadzones for the left and right thumbsticks.
; The default value for the left stick is 7849, max value is 32767. ; The default value for the left stick is 7849, max value is 32767.
leftStickDeadzone=7849 leftStickDeadzone=7849
; The default value for the right stick is 8689, max value is 32767. ; The default value for the right stick is 8689, max value is 32767.
rightStickDeadzone=8689 rightStickDeadzone=8689
[dinput] [dinput]
; Name of the DirectInput wheel to use (or any text that occurs in its name) ; Name of the DirectInput wheel to use (or any text that occurs in its name)
; Example: G29 ; Example: G29
; ;
; If this is left blank then the first DirectInput device will be used. ; If this is left blank then the first DirectInput device will be used.
deviceName= deviceName=
; Name of the DirectInput pedals to use (or any subset thereof). ; 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 ; Leave blank if you do not have separate pedals; aka the pedals are part of
; the wheel. ; the wheel.
; ;
; The pedals will be mapped to the accelAxis and brakeAxis. ; The pedals will be mapped to the accelAxis and brakeAxis.
pedalsName= pedalsName=
; Pedal mappings. Valid axis names are: ; Pedal mappings. Valid axis names are:
; ;
; X, Y, Z, RX, RY, RZ, U, V ; X, Y, Z, RX, RY, RZ, U, V
; ;
; (U and V are old names for Slider 1 and Slider 2). ; (U and V are old names for Slider 1 and Slider 2).
; The examples below are valid for a Logitech G29. ; The examples below are valid for a Logitech G29.
brakeAxis=RZ brakeAxis=RZ
accelAxis=Y accelAxis=Y
; DirectInput button numbers to map to menu inputs. Note that buttons are ; DirectInput button numbers to map to menu inputs. Note that buttons are
; numbered from 1; some software numbers buttons from 0. ; numbered from 1; some software numbers buttons from 0.
start=1 start=1
viewChg=2 viewChg=2
; Button mappings for the steering wheel paddles. ; Button mappings for the steering wheel paddles.
paddleLeft=6 paddleLeft=6
paddleRight=5 paddleRight=5
; Button mappings for the steering wheel buttons. ; Button mappings for the steering wheel buttons.
wheelRed=7 wheelRed=7
wheelBlue=8 wheelBlue=8
wheelYellow=9 wheelYellow=9
wheelGreen=10 wheelGreen=10
; Invert the accelerator and or brake axis ; Invert the accelerator and or brake axis
; (Needed when using DirectInput for the Dualshock 4 for example) ; (Needed when using DirectInput for the Dualshock 4 for example)
reverseAccelAxis=0 reverseAccelAxis=0
reverseBrakeAxis=0 reverseBrakeAxis=0
; Force feedback settings. ; Force feedback settings.
; Strength of the force feedback spring effect in percent. Possible values ; Strength of the force feedback spring effect in percent. Possible values
; are 0-100. ; are 0-100.
centerSpringStrength=30 centerSpringStrength=30

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +1,130 @@
project( project(
'segatools', 'segatools',
'c', 'c',
version: '0.1.0', version: '0.1.0',
default_options: [ default_options: [
'werror=true', 'werror=true',
], ],
) )
add_project_arguments( add_project_arguments(
'-DCOBJMACROS', '-DCOBJMACROS',
'-DDIRECTINPUT_VERSION=0x0800', '-DDIRECTINPUT_VERSION=0x0800',
'-DWIN32_LEAN_AND_MEAN', '-DWIN32_LEAN_AND_MEAN',
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7', '-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
'-DMINGW_HAS_SECURE_API=1', '-DMINGW_HAS_SECURE_API=1',
'-Wno-unused', '-Wno-unused',
# '-ggdb', # Add debug information # '-ggdb', # Add debug information
language: 'c', language: 'c',
) )
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
if cc.get_id() != 'msvc' if cc.get_id() != 'msvc'
add_project_arguments( add_project_arguments(
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
language: 'c', language: 'c',
) )
add_project_link_arguments( add_project_link_arguments(
'-Wl,--enable-stdcall-fixup', '-Wl,--enable-stdcall-fixup',
'-Wl,--exclude-all-symbols', '-Wl,--exclude-all-symbols',
'-Wl,--gc-sections', '-Wl,--gc-sections',
'-static-libgcc', '-static-libgcc',
# '-ggdb', # Add debug information # '-ggdb', # Add debug information
'-lcrypt32', # Bcrypt needed for prashook '-lcrypt32', # Bcrypt needed for prashook
# '-Wl,-s', # Strip debug symbols # '-Wl,-s', # Strip debug symbols
language: 'c', language: 'c',
) )
endif endif
if get_option('log_all') or get_option('log_jvs') if get_option('log_all') or get_option('log_jvs')
add_project_arguments('-DLOG_JVS', language: 'c') add_project_arguments('-DLOG_JVS', language: 'c')
endif endif
if get_option('log_all') or get_option('log_io3') if get_option('log_all') or get_option('log_io3')
add_project_arguments('-DLOG_IO3', language: 'c') add_project_arguments('-DLOG_IO3', language: 'c')
endif endif
if get_option('log_all') or get_option('log_led15093') if get_option('log_all') or get_option('log_led15093')
add_project_arguments('-DLOG_LED15093', language: 'c') add_project_arguments('-DLOG_LED15093', language: 'c')
endif endif
if get_option('log_all') or get_option('log_nfc') if get_option('log_all') or get_option('log_nfc')
add_project_arguments('-DLOG_NFC', language: 'c') add_project_arguments('-DLOG_NFC', language: 'c')
endif endif
if get_option('log_all') or get_option('log_carol_control_bd') if get_option('log_all') or get_option('log_carol_control_bd')
add_project_arguments('-DLOG_CAROL_CONTROL_BD', language: 'c') add_project_arguments('-DLOG_CAROL_CONTROL_BD', language: 'c')
endif endif
if get_option('log_all') or get_option('log_carol_led_bd') if get_option('log_all') or get_option('log_carol_led_bd')
add_project_arguments('-DLOG_CAROL_LED_BD', language: 'c') add_project_arguments('-DLOG_CAROL_LED_BD', language: 'c')
endif endif
if get_option('log_all') or get_option('log_carol_touch') if get_option('log_all') or get_option('log_carol_touch')
add_project_arguments('-DLOG_CAROL_TOUCH', language: 'c') add_project_arguments('-DLOG_CAROL_TOUCH', language: 'c')
endif endif
if get_option('log_all') or get_option('log_chuni_slider') if get_option('log_all') or get_option('log_chuni_slider')
add_project_arguments('-DLOG_CHUNI_SLIDER', language: 'c') add_project_arguments('-DLOG_CHUNI_SLIDER', language: 'c')
endif endif
if get_option('log_all') or get_option('log_chusan_slider') if get_option('log_all') or get_option('log_chusan_slider')
add_project_arguments('-DLOG_CHUSAN_SLIDER', language: 'c') add_project_arguments('-DLOG_CHUSAN_SLIDER', language: 'c')
endif endif
if get_option('log_all') or get_option('log_diva_slider') if get_option('log_all') or get_option('log_diva_slider')
add_project_arguments('-DLOG_DIVA_SLIDER', language: 'c') add_project_arguments('-DLOG_DIVA_SLIDER', language: 'c')
endif endif
if get_option('log_all') or get_option('log_mercury_slider') if get_option('log_all') or get_option('log_mercury_slider')
add_project_arguments('-DLOG_MERCURY_SLIDER', language: 'c') add_project_arguments('-DLOG_MERCURY_SLIDER', language: 'c')
endif endif
if get_option('log_all') or get_option('log_clock') if get_option('log_all') or get_option('log_clock')
add_project_arguments('-DLOG_CLOCK', language: 'c') add_project_arguments('-DLOG_CLOCK', language: 'c')
endif endif
shlwapi_lib = cc.find_library('shlwapi') shlwapi_lib = cc.find_library('shlwapi')
dinput8_lib = cc.find_library('dinput8') dinput8_lib = cc.find_library('dinput8')
dxguid_lib = cc.find_library('dxguid') dxguid_lib = cc.find_library('dxguid')
xinput_lib = cc.find_library('xinput') xinput_lib = cc.find_library('xinput')
pathcch_lib = cc.find_library('pathcch') pathcch_lib = cc.find_library('pathcch')
inc = include_directories('.') inc = include_directories('.')
capnhook = subproject('capnhook') capnhook = subproject('capnhook')
subdir('amex') subdir('amex')
subdir('iccard') subdir('iccard')
subdir('board') subdir('board')
subdir('hooklib') subdir('hooklib')
subdir('jvs') subdir('jvs')
subdir('platform') subdir('platform')
subdir('util') subdir('util')
subdir('gfxhook') subdir('gfxhook')
subdir('unityhook') subdir('unityhook')
subdir('aimeio') subdir('aimeio')
subdir('chuniio') subdir('chuniio')
subdir('divaio') subdir('divaio')
subdir('carolio') subdir('carolio')
subdir('idzio') subdir('idzio')
subdir('idacio') subdir('idacio')
subdir('swdcio') subdir('swdcio')
subdir('mu3io') subdir('mu3io')
subdir('mai2io') subdir('mai2io')
subdir('cmio') subdir('cmio')
subdir('apm3io') subdir('apm3io')
subdir('mercuryio') subdir('mercuryio')
subdir('cxbio') subdir('cxbio')
subdir('tokyoio') subdir('tokyoio')
subdir('fgoio') subdir('fgoio')
subdir('chunihook') subdir('chunihook')
subdir('divahook') subdir('divahook')
subdir('carolhook') subdir('carolhook')
subdir('idzhook') subdir('idzhook')
subdir('idachook') subdir('idachook')
subdir('swdchook') subdir('swdchook')
subdir('minihook') subdir('minihook')
subdir('chusanhook') subdir('chusanhook')
subdir('mu3hook') subdir('mu3hook')
subdir('mai2hook') subdir('mai2hook')
subdir('cmhook') subdir('cmhook')
subdir('apm3hook') subdir('apm3hook')
subdir('mercuryhook') subdir('mercuryhook')
subdir('cxbhook') subdir('cxbhook')
subdir('tokyohook') subdir('tokyohook')
subdir('fgohook') subdir('fgohook')