Skip to content

Commit 090348d

Browse files
committed
Add experimental direct serial TCode provider
1 parent 4c80dfc commit 090348d

File tree

18 files changed

+1092
-75
lines changed

18 files changed

+1092
-75
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">ScriptPlayer+</h1>
66

77
<p align="center">
8-
A modern funscript video player with <b>The Handy</b> integration, experimental <b>Intiface / Buttplug</b> support, <b>EroScripts</b> browser login, and multi-language support.
8+
A modern funscript video player with <b>The Handy</b> integration, experimental <b>Intiface / Buttplug / Direct Serial</b> support, <b>EroScripts</b> browser login, and multi-language support.
99
</p>
1010

1111
<p align="center">
@@ -36,15 +36,15 @@
3636
|:-:|:-:|
3737
| ![Settings](docs/screenshots/setting.png) | ![macOS](docs/screenshots/macos.png) |
3838

39-
## Experimental v0.1.5-exp.2
39+
## Experimental v0.1.5-exp.3
4040

41-
The `v0.1.5-exp.2` prerelease adds experimental `Intiface / Buttplug` multi-axis support for compatible devices exposed by Intiface. This includes FUNSR-style SR1 / SR6 / PRO setups when they are detected correctly by Intiface.
41+
The `v0.1.5-exp.3` prerelease adds an experimental `Direct Serial (COM)` provider for TCode-compatible multi-axis devices. It sends OSR / FUNSR-style `L0/L1/L2/R0/R1/R2` commands as a single-line TCode payload and keeps the existing `Intiface / Buttplug` path as an alternative.
4242

4343
| Experimental v0.1.5 Preview |
4444
|:-:|
4545
| ![Experimental v0.1.5 Preview](docs/screenshots/preview_v015_exp1.png) |
4646

47-
- Download the prerelease: [ScriptPlayer+ v0.1.5-exp.2](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)
47+
- Download the prerelease: [ScriptPlayer+ v0.1.5-exp.3](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)
4848

4949
## What's New In v0.1.4
5050

@@ -83,7 +83,7 @@ The `v0.1.5-exp.2` prerelease adds experimental `Intiface / Buttplug` multi-axis
8383

8484
1. Download the latest `ScriptPlayerPlus-0.1.4-Windows-x64.zip` from [Releases](https://github.com/sioaeko/scriptplayer-plus/releases)
8585
2. Extract and run `ScriptPlayerPlus.exe` — no installation required
86-
3. For the experimental Intiface build, download `ScriptPlayerPlus-0.1.5-exp.2-Windows-x64.zip` from [the v0.1.5-exp.2 prerelease](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)
86+
3. For the experimental Direct Serial / Intiface build, download `ScriptPlayerPlus-0.1.5-exp.3-Windows-x64.zip` from [the v0.1.5-exp.3 prerelease](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)
8787

8888
### macOS
8989

docs/README_JA.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">ScriptPlayer+</h1>
66

77
<p align="center">
8-
<b>The Handy</b>連携、実験的な <b>Intiface / Buttplug</b> 対応、<b>EroScripts</b>ブラウザログイン、多言語対応のモダンなファンスクリプトビデオプレーヤー
8+
<b>The Handy</b>連携、実験的な <b>Intiface / Buttplug / Direct Serial</b> 対応、<b>EroScripts</b>ブラウザログイン、多言語対応のモダンなファンスクリプトビデオプレーヤー
99
</p>
1010

1111
<p align="center">
@@ -36,15 +36,15 @@
3636
|:-:|:-:|
3737
| ![設定](screenshots/setting.png) | ![macOS](screenshots/macos.png) |
3838

39-
## 実験版 v0.1.5-exp.2
39+
## 実験版 v0.1.5-exp.3
4040

41-
`v0.1.5-exp.2` のプレリリースでは、Intiface が認識した互換デバイス向けに実験的な `Intiface / Buttplug` マルチアクシス制御を追加しています。FUNSR 系の SR1 / SR6 / PRO も、Intiface で正しく検出されればこの経路でテストできます
41+
`v0.1.5-exp.3` のプレリリースでは、TCode 対応のマルチアクシス機器向けに実験的な `Direct Serial (COM)` provider を追加しています。OSR / FUNSR 系の `L0/L1/L2/R0/R1/R2` コマンドを 1 行の TCode として送信し、既存の `Intiface / Buttplug` 経路も代替手段として維持しています
4242

43-
| v0.1.5-exp.2 プレビュー |
43+
| v0.1.5-exp.3 プレビュー |
4444
|:-:|
45-
| ![v0.1.5-exp.2 プレビュー](screenshots/preview_v015_exp1.png) |
45+
| ![v0.1.5-exp.3 プレビュー](screenshots/preview_v015_exp1.png) |
4646

47-
- プレリリースのダウンロード: [ScriptPlayer+ v0.1.5-exp.2](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)
47+
- プレリリースのダウンロード: [ScriptPlayer+ v0.1.5-exp.3](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)
4848

4949
## v0.1.4 の追加内容
5050

@@ -83,7 +83,7 @@
8383

8484
1. [Releases](https://github.com/sioaeko/scriptplayer-plus/releases)から最新の `ScriptPlayerPlus-0.1.4-Windows-x64.zip` をダウンロード
8585
2. 解凍して`ScriptPlayerPlus.exe`を実行 — インストール不要
86-
3. Intiface 実験ビルドは [v0.1.5-exp.2 プレリリース](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2) から `ScriptPlayerPlus-0.1.5-exp.2-Windows-x64.zip` をダウンロード
86+
3. Direct Serial / Intiface 実験ビルドは [v0.1.5-exp.3 プレリリース](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3) から `ScriptPlayerPlus-0.1.5-exp.3-Windows-x64.zip` をダウンロード
8787

8888
### macOS
8989

docs/README_KO.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">ScriptPlayer+</h1>
66

77
<p align="center">
8-
<b>The Handy</b> 연동, 실험적 <b>Intiface / Buttplug</b> 지원, <b>EroScripts</b> 브라우저 로그인, 다국어 지원을 갖춘 모던 펀스크립트 비디오 플레이어
8+
<b>The Handy</b> 연동, 실험적 <b>Intiface / Buttplug / Direct Serial</b> 지원, <b>EroScripts</b> 브라우저 로그인, 다국어 지원을 갖춘 모던 펀스크립트 비디오 플레이어
99
</p>
1010

1111
<p align="center">
@@ -36,15 +36,15 @@
3636
|:-:|:-:|
3737
| ![설정](screenshots/setting_kor.png) | ![macOS](screenshots/macos.png) |
3838

39-
## 실험판 v0.1.5-exp.2
39+
## 실험판 v0.1.5-exp.3
4040

41-
`v0.1.5-exp.2` 프리릴리스는 Intiface가 인식한 호환 장치에 대해 실험적인 `Intiface / Buttplug` 다축 제어를 추가합니다. FUNSR 계열 SR1 / SR6 / PRO도 Intiface에서 정상 인식되면 이 경로로 테스트할 수 있습니다.
41+
`v0.1.5-exp.3` 프리릴리스는 TCode 호환 다축 장치를 위한 실험적인 `Direct Serial (COM)` provider를 추가합니다. OSR / FUNSR 계열 `L0/L1/L2/R0/R1/R2` 명령을 한 줄 TCode로 전송하고, 기존 `Intiface / Buttplug` 경로도 대안으로 유지합니다.
4242

43-
| v0.1.5-exp.2 미리보기 |
43+
| v0.1.5-exp.3 미리보기 |
4444
|:-:|
45-
| ![v0.1.5-exp.2 미리보기](screenshots/preview_v015_exp1.png) |
45+
| ![v0.1.5-exp.3 미리보기](screenshots/preview_v015_exp1.png) |
4646

47-
- 프리릴리스 다운로드: [ScriptPlayer+ v0.1.5-exp.2](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)
47+
- 프리릴리스 다운로드: [ScriptPlayer+ v0.1.5-exp.3](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)
4848

4949
## v0.1.4에서 추가된 내용
5050

@@ -83,7 +83,7 @@
8383

8484
1. [Releases](https://github.com/sioaeko/scriptplayer-plus/releases)에서 최신 `ScriptPlayerPlus-0.1.4-Windows-x64.zip` 다운로드
8585
2. 압축 해제 후 `ScriptPlayerPlus.exe` 실행 — 설치 불필요
86-
3. Intiface 실험 빌드는 [v0.1.5-exp.2 프리릴리스](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)에서 `ScriptPlayerPlus-0.1.5-exp.2-Windows-x64.zip` 다운로드
86+
3. Direct Serial / Intiface 실험 빌드는 [v0.1.5-exp.3 프리릴리스](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)에서 `ScriptPlayerPlus-0.1.5-exp.3-Windows-x64.zip` 다운로드
8787

8888
### macOS
8989

docs/README_ZH.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">ScriptPlayer+</h1>
66

77
<p align="center">
8-
集成 <b>The Handy</b> 设备、实验性 <b>Intiface / Buttplug</b> 支持、<b>EroScripts</b> 浏览器登录和多语言支持的现代 Funscript 视频播放器
8+
集成 <b>The Handy</b> 设备、实验性 <b>Intiface / Buttplug / Direct Serial</b> 支持、<b>EroScripts</b> 浏览器登录和多语言支持的现代 Funscript 视频播放器
99
</p>
1010

1111
<p align="center">
@@ -36,15 +36,15 @@
3636
|:-:|:-:|
3737
| ![设置](screenshots/setting.png) | ![macOS](screenshots/macos.png) |
3838

39-
## 实验版 v0.1.5-exp.2
39+
## 实验版 v0.1.5-exp.3
4040

41-
`v0.1.5-exp.2` 预发布为 Intiface 已识别的兼容设备加入了实验性的 `Intiface / Buttplug` 多轴控制。FUNSR 系列 SR1 / SR6 / PRO 只要能被 Intiface 正确识别,也可以通过这一路径进行测试
41+
`v0.1.5-exp.3` 预发布为 TCode 兼容多轴设备加入了实验性的 `Direct Serial (COM)` provider。它会把 OSR / FUNSR 风格的 `L0/L1/L2/R0/R1/R2` 命令合并成单行 TCode 发送,同时保留现有的 `Intiface / Buttplug` 作为替代路径
4242

43-
| v0.1.5-exp.2 预览 |
43+
| v0.1.5-exp.3 预览 |
4444
|:-:|
45-
| ![v0.1.5-exp.2 预览](screenshots/preview_v015_exp1.png) |
45+
| ![v0.1.5-exp.3 预览](screenshots/preview_v015_exp1.png) |
4646

47-
- 下载预发布版本: [ScriptPlayer+ v0.1.5-exp.2](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2)
47+
- 下载预发布版本: [ScriptPlayer+ v0.1.5-exp.3](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3)
4848

4949
## v0.1.4 新增内容
5050

@@ -83,7 +83,7 @@
8383

8484
1.[Releases](https://github.com/sioaeko/scriptplayer-plus/releases) 下载最新的 `ScriptPlayerPlus-0.1.4-Windows-x64.zip`
8585
2. 解压后运行 `ScriptPlayerPlus.exe` — 无需安装
86-
3. Intiface 实验构建可从 [v0.1.5-exp.2 预发布](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.2) 下载 `ScriptPlayerPlus-0.1.5-exp.2-Windows-x64.zip`
86+
3. Direct Serial / Intiface 实验构建可从 [v0.1.5-exp.3 预发布](https://github.com/sioaeko/scriptplayer-plus/releases/tag/v0.1.5-exp.3) 下载 `ScriptPlayerPlus-0.1.5-exp.3-Windows-x64.zip`
8787

8888
### macOS
8989

electron/main.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import fs from 'fs'
44
import http from 'http'
55
import https from 'https'
66
import { URL } from 'url'
7+
import { OsrSerialManager } from './osrSerial'
78
import { SCRIPT_AXIS_DEFINITIONS, inferAxisIdFromStem, stripKnownAxisSuffix } from '../src/services/multiaxis'
89
import { getVideoSubtitleMatchScore, parseSubtitleFile } from '../src/services/subtitles'
910
import { ScriptAxisId } from '../src/types'
@@ -47,6 +48,9 @@ let mainWindow: BrowserWindow | null = null
4748
const subtitleCandidateCache = new Map<string, string[]>()
4849
const subtitleAnalysisCache = new Map<string, { content: string; hasCues: boolean } | null>()
4950
const FUNSCRIPT_EXTS = ['.funscript', '.json']
51+
const osrSerialManager = new OsrSerialManager((state) => {
52+
mainWindow?.webContents.send('osrSerial:stateChanged', state)
53+
})
5054

5155
function createWindow() {
5256
mainWindow = new BrowserWindow({
@@ -71,6 +75,10 @@ function createWindow() {
7175
} else {
7276
mainWindow.loadFile(path.join(__dirname, '../dist/index.html'))
7377
}
78+
79+
osrSerialManager.setNotifier((state) => {
80+
mainWindow?.webContents.send('osrSerial:stateChanged', state)
81+
})
7482
}
7583

7684
app.whenReady().then(() => {
@@ -264,6 +272,30 @@ ipcMain.handle('fs:readSubtitleFile', async (_event, filePath: string) => {
264272
}
265273
})
266274

275+
ipcMain.handle('osrSerial:listPorts', async () => {
276+
try {
277+
return await osrSerialManager.listPorts()
278+
} catch {
279+
return []
280+
}
281+
})
282+
283+
ipcMain.handle('osrSerial:getState', () => {
284+
return osrSerialManager.getState()
285+
})
286+
287+
ipcMain.handle('osrSerial:connect', async (_event, portPath: string, baudRate?: number) => {
288+
return osrSerialManager.connect(portPath, baudRate)
289+
})
290+
291+
ipcMain.handle('osrSerial:disconnect', async () => {
292+
return osrSerialManager.disconnect()
293+
})
294+
295+
ipcMain.handle('osrSerial:write', async (_event, command: string) => {
296+
return osrSerialManager.write(command)
297+
})
298+
267299
// ============================================================
268300
// NAS (WebDAV / FTP) Service
269301
// ============================================================
@@ -935,6 +967,7 @@ function ensureProxyServer(): Promise<number> {
935967

936968
// Clean up proxy on app quit
937969
app.on('before-quit', () => {
970+
void osrSerialManager.dispose()
938971
if (proxyServer) {
939972
proxyServer.close()
940973
proxyServer = null

0 commit comments

Comments
 (0)