GithubHelp home page GithubHelp logo

leapward-koex / maitouchsensoremulator Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 2.0 425 KB

Touch sensor emulator for SDEZ/SDEZ触摸传感器模拟器

License: GNU General Public License v3.0

C# 100.00%
maimai maimai-dx maimaidx rythm-game serial-communication sinmai touchscreen wpf

maitouchsensoremulator's Introduction

WpfMaiTouchEmulator

A WPF C# app meant to emulate the touch sensor hardware for SDEZ MaiMai using software on a touchscreen.

README in Other Languages

How it works

The app uses com0com to install a virtual COM port pairing of COM3 - COM23. The app then connects to COM23 and emulates how the hardware touch sensor works, sending data over this port.

Demo

InGameDemo.mp4
PanelDemo.mp4

Setup

Disable Three- and four-finger touch gestures in windows (on W11 Settings -> Bluetooth & devices -> Touch)

COM3 needs to be free for this app to work as that is the port used by SDEZ. By default most people will find that COM3 is already in use by a USB Serial device. This will need to be uninstalled via Device Manager,

  1. Open Device Manager
  2. Show hidden devices. "View" -> "Show Hidden Devices" -> "Ports (COM & LPT)" -> Right click the COM3 device and uninstall.

Set DummyTouchPanel=0 in the [AM] section of your maimai .ini file.

Open the WpfMaiTouchEmulator.exe app, Install the virtual port via the "Install COM port" button, either tick the "Automatic port connecting" for the app to connect to the COM23 port on start up or press the "Connect to port" button.

If you have issues where the app can't bind to COM23 after installing the virtual port I find that restarting my PC normally fixes it.

Start SDEZ and use your touchscreen as normal.

[Optional] To avoid having to manually open the application each time, you can enable "Automatic port connecting" and add this line after @echo off in your MaiMai's start.bat file. start "" "<your path to WpfMaiTouchEmulator.exe>"

[Optional] If you're on W11 and find that left swipes sometimes open the "widgets" pane you can remove the pane by running this command as administrator winget uninstall "windows web experience pack" and following the onscreen instructions.

Installing the virtual COM ports without using the included com0com program

If you don't want to use the included install/remove virtual com actions in the app because you don't want to give admin access to this unknown app then you can achieve the same outcome by manually downloading Null-modem com0com online (version 2.2.2.0 required!) and then running this command. cd "C:\Program Files (x86)\com0com" && setupc.exe install Portname=COM3 Portname=COM23 to install the virtual port and cd "C:\Program Files (x86)\com0com" && setupc.exe uninstall to uninstall the virtual ports.

Why?

Most SDEZ don't work very will with the built in touchscreen and require either someone else to modify the SDEZ source code to get the inbuilt touch controls to work or for you to edit and recompile the .dll files. This app should work with all SDEZ versions (afaik) out of the box.

Another reason is sourcing a ITO etched panel for use as a touch sensor can be difficult and reasonable expensive.

Performance

Its ok, the app polls the touch sensor window at up to 1Khz but its running in C# so it may or may not actually be running at this speed, depending on the performance of the host machine.

As for accuracy. I'm not that good so I can't say how well it works at high levels of play but in my experience it works pretty well.

Thanks

Thanks to whowechina - mai_pico and Sucareto - Mai2Touch for the basic serial data format and touch implementation research.

maitouchsensoremulator's People

Contributors

leapward-koex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ag-lab error063

maitouchsensoremulator's Issues

Cannot install the com port

The touch screen can work fine in my device (lenovo miix720) , but it throws error when I click install com button.

Here is the log.

2024-02-15 01:46:52 [INFO] Main window loaded, creating touch panel
2024-02-15 01:46:57 [FATAL] App encountered a fatal exception
Exception: Test exception for crash dump generation
StackTrace:    at WpfMaiTouchEmulator.MainWindow.buttonInstallComPort_Click(Object sender, RoutedEventArgs e) in D:\a\MaiTouchSensorEmulator\MaiTouchSensorEmulator\MainWindow.xaml.cs:line 206
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

2024-02-15 01:46:59 [INFO] Disconnecting from COM port
2024-02-15 01:51:01 [INFO] Main window loaded, creating touch panel
2024-02-15 01:51:05 [INFO] Disconnecting from COM port
2024-02-15 01:51:05 [FATAL] App encountered a fatal exception
Exception: Cannot set Visibility to Visible or call Show, ShowDialog, Close, or WindowInteropHelper.EnsureHandle while a Window is closing.
StackTrace:    at System.Windows.Window.VerifyNotClosing()
   at System.Windows.Window.InternalClose(Boolean shutdown, Boolean ignoreCancel)
   at WpfMaiTouchEmulator.MainWindow.MainWindow_Closing(Object sender, CancelEventArgs e) in D:\a\MaiTouchSensorEmulator\MaiTouchSensorEmulator\MainWindow.xaml.cs:line 88
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Btw there's don't have com3 in my device manager, so I don't know whether com3 is in use.

image

Crash when starting sinmai

The program immedietely crashes when starting sinmai
everything is working (connect to port, sensor values and stuff) prior to starting sinmai
using SDEZ 1.35

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.