Author SHA1 Message Date
NeoandClaude Opus 5.5 364ab80a94 Add a phone book to the Modem and Phone pages, and NVRAM buttons (#95)
* Add a phone book to the Modem and Phone pages, and NVRAM buttons

The phone book (phonebook.cpp) shows on the Modem page and on the Phone
page, with New, Edit and Remove. A click puts the number of an entry in
the Number box. A double-click or Enter dials it: a data call on the
Modem page, a voice call on the Phone page. The entries are the sessions
of the Call dialog ([sessions] in dmodem.ini), so a change shows in all
three places.

The Settings page has Save to NVRAM (AT&W) and Load from NVRAM (ATZ).
Defaults now sends AT&F, because ATZ sets the stored profile. The
built-in modem keeps its stored profile in dmodem0.nvram, near
dmodem.ini, when D-Modem has DMODEM_EMBED_HAS_NVRAM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR9XpLW3ph2RXYHx38
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>

* Link libmedia and libtranslation on Haiku

The Haiku layer of clang-retro MFC now plays and records sound with the
Media Kit (BSoundPlayer, BMediaRecorder) and reads images with the
Translation Kit. The Haiku build failed to link without these two
libraries. libmfc's own CMake package links the same libraries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSTXLQB5LNVgAJbEoU
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>

---------

Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:47:25 -08:00
Neo f15211a64f Merge pull request #91 from D-Modem/bot/d-modem-bump
Bump D-Modem to 7dfc8ad
2026-11-29 11:21:41 -08:00
github-actions[bot] 583d506378 Bump D-Modem to 7dfc8ad
external/D-Modem: 7e65cfc -> 7dfc8ad (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-29 19:11:08 +00:00
Neo 3a5d96d69c Merge pull request #94 from D-Modem/claude/project-thread-mc51gv
Show call progress in the status bar and the tray
2026-11-29 10:49:44 -08:00
Neo 9d588e9afd Merge pull request #93 from D-Modem/claude/project-thread-y208q2
Add an animated start-up splash
2026-11-29 10:43:42 -08:00
Neo-DesktopandClaude Opus 5.5 ba6834945b Merge main into the splash branch
main has the same Haiku link fix (libmedia and libtranslation). The
merge keeps the version of main for those lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSTXLQB5LNVgAJbEoU
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 18:31:30 +00:00
Neo-Desktop 205dd9902c Merge remote-tracking branch 'origin/main' into claude/project-thread-mc51gv
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>

# Conflicts:
#	winport/CMakeLists.txt
2026-11-29 18:31:27 +00:00
Neo a627e6121a Merge pull request #96 from D-Modem/claude/project-thread-sowbs2
CI: Mac OS X 10.4 with the SDK of clang-retro/macosx-sdk, and the Haiku media libraries
2026-11-29 10:30:25 -08:00
Neo-DesktopandClaude Opus 5.5 7c459bf90c ci: build for Mac OS X 10.4 with the SDK of clang-retro/macosx-sdk
The macosx10.4 sysroot of dos-sdk no longer comes with Apple's
MacOSX10.4u.sdk. It now has MacOSX10.4.sdk, the 10.4 SDK of
clang-retro/macosx-sdk. cmake/macosx-legacy.cmake uses
MACOSX_LEGACY_SDK, which is MACOSX_LEGACY_SYSROOT/MacOSX10.4.sdk by
default, and stops if the SDK has no crt1.o. CI builds the SDK from the
main branch of macosx-sdk and uses it.

Haiku: link libmedia and libtranslation. The sound of clang-retro MFC
(port/src/audio_haiku.cpp) uses the Media Kit, and its images use the
Translation Kit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRVSwCR74jLBgo41Zbc
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 18:11:03 +00:00
Neo-DesktopandClaude Opus 5.5 9e9e192158 Draw the failed-call disc at 7 x 7 pixels, round, with a wide cross
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 17:57:29 +00:00
Neo-DesktopandClaude Opus 5.5 d36a71d92c Draw a bigger red disc with a thick cross on the failed-call tray icon
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 17:56:38 +00:00
Neo-DesktopandClaude Opus 5.5 9f480ad79a Make the top and left bezel of the tray screens black, keep 5 x 4 screens
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:37:43 +00:00
Neo-DesktopandClaude Opus 5.5 f2142eb67f Sink the tray screens in the bezel with a black top and left edge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:36:42 +00:00
Neo-DesktopandClaude Opus 5.5 57bc6ab2a7 Light the tray screens with a green and white checkerboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:35:39 +00:00
Neo-DesktopandClaude Opus 5.5 0fdb046328 Make the screens of the tray icons 5 x 4 pixels (about 4:3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:34:05 +00:00
Neo-DesktopandClaude Opus 5.5 83f2af6462 Draw the tray icons as computers in the VGA palette, add a failed-call icon
The computers are a CRT monitor on a desktop case with a power light, in
the 16-colour VGA palette, with a cable between them. A screen that
shows data is a checkerboard. A failed call (BUSY, NO CARRIER) shows the
computers and a red disc with a cross for 5 seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:31:22 +00:00
Neo-DesktopandClaude Opus 5.5 da83e4a9fd Draw the tray icons as CRT monitors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 15:10:05 +00:00
Neo-DesktopandClaude Opus 5.5 70b99da6d2 Show call progress in the status bar and the tray
The status bar has two parts. The left part shows the call stage:
Ready, or Not ready and the reason (from the connection path of the
Settings page), and during a call Dialling, Ringing (the caller and the
count of rings), Answering, Connected at the rate, and Hanging up. A
message replaces the stage for 5 seconds. The right part shows the
timer of the stage.

An icon in the notification area shows the stage too: the app icon with
no call, a computer with signal arcs (an animation) while a call
starts, and two computers when a call is connected. The computers light
for the data that goes out and the data that comes in.
tools/tray_icons.py makes the icon files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRR7VJ9Qom5MgPyFQTd
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 14:59:15 +00:00
Neo-DesktopandClaude Opus 5.5 efbbd54a84 Link libmedia and libtranslation on Haiku
The Haiku layer of clang-retro MFC now plays and records sound with the
Media Kit (BSoundPlayer, BMediaRecorder) and reads images with the
Translation Kit. The Haiku build failed to link without these two
libraries. libmfc's own CMake package links the same libraries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSTXLQB5LNVgAJbEoU
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 14:02:50 +00:00
Neo-DesktopandClaude Opus 5.5 4ba0bb7f32 Use the Windows color scheme for the splash
The splash now uses the button face and button text colors of the
user's scheme, as the rest of the app does, with a raised 3D edge and
the dialog font of the system. The dots are gone.

The logo is now in two bitmaps, on black and on white. The app mixes
them with the button face color when the splash opens, so the logo has
a transparent background on each scheme. This needs no alpha blend
function, so it works on Windows 95.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSTXLQB5LNVgAJbEoU
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 14:01:42 +00:00
Neo-DesktopandClaude Opus 5.5 f091b6f416 Add an animated start-up splash
The splash shows for 4 s when the app starts. The D-Modem logo (the
rainbow D, the italic word "D-Modem" and a rainbow pencil line) and a
block of text (version, build date, copyright) move in from the right
edge in 1.5 s. A click or a key closes it. -nosplash on the command
line stops it.

The logo is one 24-bit bitmap (res/splash.bmp) on the background color,
so it works on Windows 95 and on each clang-retro MFC target.
tools/splash.js and tools/splash.py make it from assets/splash.svg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSTXLQB5LNVgAJbEoU
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-29 13:58:32 +00:00
Neo dd9881ee5c Merge pull request #92 from D-Modem/claude/project-thread-deqtlz
Build the app for Haiku (x86_64)
2026-11-28 13:44:19 -08:00
Neo-DesktopandClaude Opus 5.5 35d66c85e9 Build the app for Haiku (x86_64)
The Windows app now builds for Haiku over the new Haiku backend of
clang-retro MFC (clang-retro/mfc#176), cross-built on Linux with D-Modem's
Haiku toolchain file and sysroot script.

- cmake/haiku.cmake: the toolchain file. It includes D-Modem's and
  keeps the CMAKE_FIND_ROOT_PATH of the command line, so that libssh
  finds the bundled mbedTLS.
- winport/CMakeLists.txt: the Haiku target and its libraries (libbe,
  libdevice, libnetwork, libbsd).
- ssh/: libssh links libnetwork and libbsd on Haiku, has getaddrinfo,
  and skips the termios values that Haiku does not have.
- Look for a modem (windows/src/ports.cpp, ports_haiku.cpp): lists
  /dev/ports, names the usbN ports from the USB Kit, finds the CDC-ACM
  modems, and tells that Haiku has no driver for the MultiTech
  MT9234MU.
- CI: the winport-haiku job builds the app and uploads
  dmodem-win32-haiku-x86_64.tar.gz; the nightly release takes it.
- docs/haiku.md, and short notes in the README, building.md and
  download.md.

Tested on Haiku R1/beta6 in QEMU: the menus, the pages, the dialogs,
modal dialogs, the keyboard, moving the window, and Look for a modem
with the computer's serial port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTJUdomcnCN8okhJSr
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-28 20:11:33 +00:00
Neo 17260c78e7 Merge pull request #90 from D-Modem/bot/d-modem-bump
Bump D-Modem to 7e65cfc
2026-11-28 11:40:15 -08:00
github-actions[bot] 1732160f0b Bump D-Modem to 7e65cfc
external/D-Modem: 29fcea3 -> 7e65cfc (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 19:26:06 +00:00
Neo db55628aee Merge pull request #89 from D-Modem/bot/d-modem-bump
Bump D-Modem to 29fcea3
2026-11-28 11:01:47 -08:00
github-actions[bot] 3aa0e30269 Bump D-Modem to 29fcea3
external/D-Modem: 27536c1 -> 29fcea3 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:53:46 +00:00
Neo bcf6ff67a2 Merge pull request #88 from D-Modem/bot/d-modem-bump
Bump D-Modem to 27536c1
2026-11-28 10:48:46 -08:00
github-actions[bot] 199fe1693d Bump D-Modem to 27536c1
external/D-Modem: d95d15e -> 27536c1 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:43:02 +00:00
Neo 10d09fa159 Merge pull request #87 from D-Modem/bot/d-modem-bump
Bump D-Modem to d95d15e
2026-11-28 10:12:58 -08:00
github-actions[bot] bb08cb7d9c Bump D-Modem to d95d15e
external/D-Modem: 82631e3 -> d95d15e (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:01:08 +00:00
Neo 60b9aa1357 Merge pull request #86 from D-Modem/bot/d-modem-bump
Bump D-Modem to 82631e3
2026-11-28 09:53:03 -08:00
github-actions[bot] 15ffd368bf Bump D-Modem to 82631e3
external/D-Modem: 6236733 -> 82631e3 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 17:29:18 +00:00
Neo 6a73746079 Merge pull request #85 from D-Modem/bot/d-modem-bump
Bump D-Modem to 6236733
2026-11-28 08:11:25 -08:00
github-actions[bot] ce91016223 Bump D-Modem to 6236733
external/D-Modem: d886b4a -> 6236733 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 16:02:23 +00:00
Neo db1c9cd82e Merge pull request #84 from D-Modem/bot/d-modem-bump
Bump D-Modem to 6236733
2026-11-28 08:02:07 -08:00
github-actions[bot] cc48b23ede Bump D-Modem to 6236733
external/D-Modem: d886b4a -> 6236733 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 15:49:30 +00:00
Neo 08008f6341 Merge pull request #83 from D-Modem/bot/d-modem-bump
Bump D-Modem to d886b4a
2026-11-28 07:38:16 -08:00
github-actions[bot] c7c99e64c9 Bump D-Modem to d886b4a
external/D-Modem: 20c1e94 -> d886b4a (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 15:23:35 +00:00
Neo 3ab5a917e1 Merge pull request #82 from D-Modem/bot/d-modem-bump
Bump D-Modem to 20c1e94
2026-11-28 07:09:54 -08:00
github-actions[bot] 01fba1b3c4 Bump D-Modem to 20c1e94
external/D-Modem: 848a7c0 -> 20c1e94 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 14:53:39 +00:00
Neo fd53bbb1e0 Merge pull request #81 from D-Modem/bot/d-modem-bump
Bump D-Modem to 848a7c0
2026-11-28 06:30:54 -08:00
github-actions[bot] 503edd645e Bump D-Modem to 848a7c0
external/D-Modem: 88137e0 -> 848a7c0 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 14:20:22 +00:00
Neo 059e6a88ae Merge pull request #79 from D-Modem/bot/d-modem-bump
Bump D-Modem to 88137e0
2026-11-28 05:57:03 -08:00
github-actions[bot] bdea9ed1cd Bump D-Modem to 88137e0
external/D-Modem: c3ef883 -> 88137e0 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 13:46:27 +00:00
54 changed files with 2430 additions and 424 deletions

No files matched your search

+62 -98
View File
@@ -1,6 +1,6 @@
# Builds and tests the app (windows/) and the library that it uses
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux and macOS over
# clang-retro MFC's portable Win32 layer (winport/)
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux, macOS and
# Haiku over clang-retro MFC's portable Win32 layer (winport/)
name: Build
# The nightly release (nightly.yml) takes its files from this
@@ -250,14 +250,60 @@ jobs:
name: ${{ matrix.artifact }}
path: dmodem-win32-macos-${{ matrix.arch }}.tar.gz
# The app for Haiku (x86_64), cross-built on Linux with the runner's
# clang against a sysroot of Haiku's own packages (D-Modem's
# platforms/haiku/haiku_sysroot.py, which checks them against the
# repositories' SHA-256). Nothing here runs the app: that needs a
# Haiku guest. Refer to docs/haiku.md.
winport-haiku:
name: Windows app on Haiku, the modem built in (clang-retro MFC's Win32 layer)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/checkout@v4
with:
repository: clang-retro/mfc
path: mfc
submodules: recursive
- name: Packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build clang lld llvm libzstd1 python3
- name: Haiku packages cache
uses: actions/cache@v4
with:
path: haiku-packages
key: haiku-packages-${{ hashFiles('external/D-Modem/platforms/haiku/haiku_sysroot.py') }}
- name: Sysroot
run: python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot --cache haiku-packages
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/haiku.cmake" \
-DHAIKU_SYSROOT="$PWD/haiku-sysroot" \
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC="$PWD/mfc"
cmake --build build --target dmodem-win32
- name: The built-in modem is in the app
run: llvm-nm build/winport/dmodem-win32 | grep -q dmodem_embed_start
- name: Package
run: tar -C build/winport -czf dmodem-win32-haiku-x86_64.tar.gz dmodem-win32
- uses: actions/upload-artifact@v4
with:
name: dmodem-win32-haiku
path: dmodem-win32-haiku-x86_64.tar.gz
# The app for Mac OS X 10.4 (Tiger) and later, PowerPC and Intel
# (i386), as one fat program, over the Mac OS X 10.0-10.5 port of
# clang-retro MFC (cmake/macosx-legacy.cmake). All of it builds on
# Linux: clang of clang-retro/llvm (its llvm-prebuilt release, which
# has emulated TLS for 10.4), the macosx10.4 sysroot of dos-sdk (libc++
# and Apple's MacOSX10.4u.sdk, under Apple's license), and Apple's ld64
# and ar for PowerPC (dos-sdk's scripts/build-cctools-ppc.sh, kept in
# the cache).
# and the builtins), the Mac OS X 10.4 SDK of clang-retro/macosx-sdk
# (built from its main branch: stub libraries, start files and
# headers, with no file from Apple), and ld64 and ar for PowerPC
# (dos-sdk's scripts/build-cctools-ppc.sh, kept in the cache).
winport-macosx-legacy:
name: Windows app on Mac OS X 10.4 and later (PowerPC and i386), the modem built in
runs-on: ubuntu-24.04
@@ -276,6 +322,10 @@ jobs:
with:
repository: clang-retro/dos-sdk
path: dos-sdk
- uses: actions/checkout@v4
with:
repository: clang-retro/macosx-sdk
path: macosx-sdk
- name: Packages
run: |
sudo apt-get update
@@ -292,7 +342,7 @@ jobs:
rm llvm.tar.zst
"$RUNNER_TEMP/llvm/bin/clang" --version | head -1
echo "MACOSX_LEGACY_LLVM=$RUNNER_TEMP/llvm" >> "$GITHUB_ENV"
- name: The macosx10.4 sysroot (libc++ and MacOSX10.4u.sdk)
- name: The macosx10.4 sysroot (libc++ and the builtins)
run: |
sh dos-sdk/packaging/get-toolchain.sh -s macosx10.4 "$RUNNER_TEMP/sysroots"
echo "MACOSX_LEGACY_SYSROOT=$RUNNER_TEMP/sysroots/macosx10.4" >> "$GITHUB_ENV"
@@ -306,6 +356,12 @@ jobs:
run: |
PREFIX="$RUNNER_TEMP/cctools-ppc" SRC="$RUNNER_TEMP/cctools-port" \
sh dos-sdk/scripts/build-cctools-ppc.sh > cctools.log 2>&1 || { tail -50 cctools.log; exit 1; }
- name: The Mac OS X 10.4 SDK (clang-retro/macosx-sdk)
run: |
PATH="$RUNNER_TEMP/cctools-ppc/bin:$PATH" CLANG="$MACOSX_LEGACY_LLVM/bin/clang" \
OUT="$RUNNER_TEMP/macosx-sdk" sh macosx-sdk/build-sysroot.sh 10.4
test -f "$RUNNER_TEMP/macosx-sdk/macosx10.4/usr/lib/crt1.o"
echo "MACOSX_LEGACY_SDK=$RUNNER_TEMP/macosx-sdk/macosx10.4" >> "$GITHUB_ENV"
- name: Build (PowerPC and i386)
run: |
export MACOSX_LEGACY_CCTOOLS="$RUNNER_TEMP/cctools-ppc"
@@ -335,95 +391,3 @@ jobs:
with:
name: dmodem-win32-macosx-legacy
path: dmodem-win32-macosx10.4.tar.gz
# The Windows app (windows/) on the classic Mac OS (Mac OS 9) on
# PowerPC, with the modem built in, over the Toolbox backend of
# clang-retro MFC (cmake/macos9.cmake). All of it builds on Linux:
# clang of clang-retro/llvm (llvm-prebuilt), and the C and C++
# libraries of clang-retro/mac-sdk (picolibc, GCC 15.2's libstdc++
# and LLVM's libunwind, kept in the cache).
winport-macos9:
name: Windows app on Mac OS 9 (PowerPC), the modem built in
runs-on: ubuntu-24.04
env:
GH_TOKEN: ${{ github.token }}
GCC_VERSION: 15.2.0
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/checkout@v4
with:
repository: clang-retro/mfc
path: mfc
submodules: recursive
- uses: actions/checkout@v4
with:
repository: clang-retro/mac-sdk
path: mac-sdk
- uses: actions/checkout@v4
with:
repository: clang-retro/picolibc
path: picolibc
- name: Packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build meson make zstd xz-utils
- name: clang (clang-retro/llvm, llvm-prebuilt)
run: |
asset=$(gh api repos/clang-retro/llvm/releases/tags/llvm-prebuilt --jq \
'[.assets[] | select(.name | startswith("llvm-linux-"))] | sort_by(.created_at) | last | .name')
echo "Using $asset"
echo "LLVM_ASSET=$asset" >> "$GITHUB_ENV"
gh release download llvm-prebuilt -R clang-retro/llvm -p "$asset" -O llvm.tar.zst
mkdir -p "$RUNNER_TEMP/llvm"
tar --zstd -xf llvm.tar.zst -C "$RUNNER_TEMP/llvm"
rm llvm.tar.zst
"$RUNNER_TEMP/llvm/bin/clang" --version | head -1
echo "MACOS9_LLVM=$RUNNER_TEMP/llvm" >> "$GITHUB_ENV"
echo "MACOS9_SDK=$PWD/mac-sdk" >> "$GITHUB_ENV"
echo "SDK_REV=$(git -C mac-sdk rev-parse HEAD)-$(git -C picolibc rev-parse HEAD)" >> "$GITHUB_ENV"
- uses: actions/cache@v4
id: maclibs
with:
path: mac-sdk/lib
key: mac-sdk-lib-${{ env.SDK_REV }}-${{ env.LLVM_ASSET }}-gcc${{ env.GCC_VERSION }}
- name: mac-sdk's libraries (runtime, C library, C++ library)
if: steps.maclibs.outputs.cache-hit != 'true'
run: |
# (LLVM: only compiler-rt's builtins and libunwind)
git clone -q --depth 1 --filter=blob:none --sparse \
https://github.com/clang-retro/llvm "$RUNNER_TEMP/llvm-src"
git -C "$RUNNER_TEMP/llvm-src" sparse-checkout set compiler-rt/lib/builtins libunwind
# (GCC: the release, for libstdc++)
curl -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz" \
| tar -xJ -C "$RUNNER_TEMP"
export CLANG="$MACOS9_LLVM/bin/clang" LLVM_SRC="$RUNNER_TEMP/llvm-src"
cd mac-sdk
sh runtime/build.sh > rt.log 2>&1 || { tail -50 rt.log; exit 1; }
PICOLIBC_SRC="$GITHUB_WORKSPACE/picolibc" sh runtime/build-libc.sh > libc.log 2>&1 \
|| { tail -50 libc.log; exit 1; }
CPUS=ppc GCC_SRC="$RUNNER_TEMP/gcc-$GCC_VERSION" sh runtime/build-libstdcxx.sh > cxx.log 2>&1 \
|| { tail -50 cxx.log; exit 1; }
ls lib/ppc
- name: Build
run: |
cmake -S . -B build/os9 -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/macos9.cmake" \
-DCLANG_RETRO_MFC="$PWD/mfc" \
-DDMODEM_GUI_WINPORT=ON -DDMODEM_GUI_EMBED=ON -DDMODEM_GUI_SSH=OFF
cmake --build build/os9 --target dmodem-win32
- name: Check the program
run: |
f=build/os9/winport/dmodem-win32.bin
# (MacBinary: the type APPL in the header, and the modem inside)
head -c 128 "$f" | grep -q APPL
grep -q "User-Agent" "$f"
mkdir -p out
cp "$f" out/dmodem-win32-macos9.bin
ls -l out
- uses: actions/upload-artifact@v4
with:
name: dmodem-win32-macos9
path: out/dmodem-win32-macos9.bin
+2 -2
View File
@@ -76,7 +76,7 @@ jobs:
take dmodem-win32-macos dmodem-win32-macos-arm64.tar.gz
take dmodem-win32-macos-x86_64 dmodem-win32-macos-x86_64.tar.gz
take dmodem-win32-macosx-legacy dmodem-win32-macosx10.4.tar.gz
take dmodem-win32-macos9 dmodem-win32-macos9.bin
take dmodem-win32-haiku dmodem-win32-haiku-x86_64.tar.gz
(cd out && sha256sum * > SHA256SUMS)
ls -l out
{
@@ -92,7 +92,7 @@ jobs:
echo "| \`dmodem-win32-macos-arm64.tar.gz\` | The app on macOS with the modem built in, arm64 (Apple silicon) |"
echo "| \`dmodem-win32-macos-x86_64.tar.gz\` | The app on macOS with the modem built in, x86_64 (Intel Mac) |"
echo "| \`dmodem-win32-macosx10.4.tar.gz\` | The app on Mac OS X 10.4 (Tiger) and later with the modem built in, one program for PowerPC and Intel (i386). Not tested on a Mac yet |"
echo "| \`dmodem-win32-macos9.bin\` | The app on Mac OS 9 (PowerPC) with the modem built in, in MacBinary. Not tested on a Mac yet |"
echo "| \`dmodem-win32-haiku-x86_64.tar.gz\` | The app on Haiku R1/beta6 and later with the modem built in, x86_64. Needs \`pkgman install libusb\` |"
echo "| \`SHA256SUMS\` | The SHA-256 of each file |"
if [ -f missing ]; then
echo
+12 -10
View File
@@ -2,7 +2,8 @@
# D-Modem desktop app
The D-Modem desktop app is one Win32 app for Windows, macOS and Linux. The
The D-Modem desktop app is one Win32 app for Windows, macOS, Linux and
Haiku. The
site of the app is <https://d-modem.github.io/gui/>.
The app has the modem built in, so it needs no dmodemd (refer to
@@ -11,22 +12,22 @@ desktop program. You can dial and answer from a window, change the settings
without AT commands, and see the results of the last call. The app is a
thin Win32 shell over one small C library, libdmodemctl.
- **Modem**: the state of the call, dial, answer and hang up, and the line that the modem uses
- **Phone**: voice calls through the sound card (dial, answer, keypad), and an
- **Modem**: the state of the call, dial, answer and hang up, the line that the modem uses, and a phone book
- **Phone**: voice calls through the sound card (dial, answer, keypad), the phone book, and an
answering machine that takes messages on this computer when you enable it (disabled by default)
- **Terminal**: the AT console, and the setup screens of the modem (AT!CF, AT!CT)
- **Remote**: log in to a server by SSH, Telnet or rlogin, in a separate terminal. SSH is built in, on libssh, and it uses the keys and the agent of OpenSSH and PuTTY
- **Terminal types**: the terminal emulator of the D-Modem app, ported to C: xterm, DEC VT52 to VT525, ANSI-BBS, PETSCII, ATASCII, Viewdata, Minitel and Tektronix 4014, with sixel, ReGIS and Tektronix graphics
- **HyperTerminal items**: file transfers (ZMODEM, YMODEM, XMODEM and Kermit), copy and capture, and the ASCII Setup, Terminal Settings and Call menu of HyperTerminal. Refer to [Features](docs/features.md)
- **Settings**: each modem setting as a native control, from AT!M
- **Settings**: each modem setting as a native control, from AT!M. Save the settings to the NVRAM of the modem (AT&W)
- **Call Stats**: the rate, modulation, error control and line figures of the last call (AT#UD, ATI11)
- **Line settings**: a SIP account, a USB modem, or a modem that already runs (dmodemd, or a hardware modem such as the MultiTech MT9234MU). **Look for a modem** finds the modem and its port
| | Windows | macOS | Linux |
| --- | --- | --- | --- |
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC |
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386, and Mac OS 9 on PowerPC | x86_64 |
| | Windows | macOS | Linux | Haiku |
| --- | --- | --- | --- | --- |
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC | Win32, over the Interface Kit layer of clang-retro MFC |
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang | clang (cross-built on Linux) |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 | R1/beta6 and later, x86_64 |
The source code of the app is the same on each system. Refer to "The
Windows app on Linux and macOS" in [Design](docs/design.md).
@@ -39,7 +40,7 @@ Windows app on Linux and macOS" in [Design](docs/design.md).
The [nightly release](https://github.com/D-Modem/gui/releases/tag/nightly)
has the app from the newest build of `main`: for Windows 95 and later, for
Windows 7 and later, for Linux, and for macOS. A workflow
Windows 7 and later, for Linux, for macOS, and for Haiku. A workflow
(`.github/workflows/nightly.yml`) replaces the release one time each day.
When `main` has no new commits, the release does not change. When the
main branch of D-Modem changes, a workflow moves the built-in modem to it
@@ -67,6 +68,7 @@ For Windows (with clang-retro) and macOS, refer to
- [The site](https://d-modem.github.io/gui/): the home page, the downloads and all the pages below
- [Features](docs/features.md): each page and menu of the app
- [Building](docs/building.md): Windows with clang-retro, and the app on Linux and macOS
- [The app on Haiku](docs/haiku.md): install, build, serial ports and limits
- [The built-in modem](docs/embedded-modem.md): the modem inside the app, with no dmodemd
- [Design](docs/design.md): how the app is built, hardware modems (the MultiTech MT9234MU), the Windows 9x notes, and the app on Linux and macOS
- [libdmodemctl](core/include/dmodemctl.h): the API of the library
+20
View File
@@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="120" viewBox="0 0 400 120">
<!-- The logo of the start-up splash (windows/src/splash.cpp): the D-Modem mark of D-Modem/brand,
the word "D-Modem" in Source Code Pro ExtraBold Italic, and a rainbow pencil line.
The background is transparent. tools/splash.js renders it on black and on white, and
tools/splash.py writes the two renders to windows/res/splash-k.bmp and splash-w.bmp. -->
<defs>
<linearGradient id="books" gradientUnits="userSpaceOnUse" x1="0" y1="100" x2="0" y2="400"><stop offset="0.0000" stop-color="#ff4d5e"/><stop offset="0.1667" stop-color="#ff4d5e"/><stop offset="0.1667" stop-color="#ff8a3d"/><stop offset="0.3333" stop-color="#ff8a3d"/><stop offset="0.3333" stop-color="#ffd23d"/><stop offset="0.5000" stop-color="#ffd23d"/><stop offset="0.5000" stop-color="#3ddc84"/><stop offset="0.6667" stop-color="#3ddc84"/><stop offset="0.6667" stop-color="#3d8bff"/><stop offset="0.8333" stop-color="#3d8bff"/><stop offset="0.8333" stop-color="#a66bff"/><stop offset="1.0000" stop-color="#a66bff"/></linearGradient>
<linearGradient id="rain" x1="0" y1="0" x2="1" y2="0"><stop offset="0.000" stop-color="#ff4d5e"/><stop offset="0.200" stop-color="#ff8a3d"/><stop offset="0.400" stop-color="#ffd23d"/><stop offset="0.600" stop-color="#3ddc84"/><stop offset="0.800" stop-color="#3d8bff"/><stop offset="1.000" stop-color="#a66bff"/></linearGradient>
<filter id="glow" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="6" result="b"/>
<feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
<mask id="grain" maskUnits="userSpaceOnUse" x="-5" y="-5" width="110" height="10"><rect x="-5" y="-5" width="110" height="10" fill="#ffffff"/><path d="M0.00,-0.08 L1.00,-0.08 L2.00,-0.08 L3.00,-0.08 L4.00,-0.08 L5.00,-0.08 L6.00,-0.08 L7.00,-0.09 L8.00,-0.09 L9.00,-0.10 L10.00,-0.11 L11.00,-0.12 L12.00,-0.14 L13.00,-0.15 L14.00,-0.17 L15.00,-0.19 L16.00,-0.22 L17.00,-0.25 L18.00,-0.27 L19.00,-0.31 L20.00,-0.34 L21.00,-0.38 L22.00,-0.42 L23.00,-0.46 L24.00,-0.50 L25.00,-0.54 L26.00,-0.59 L27.00,-0.64 L28.00,-0.69 L29.00,-0.74 L30.00,-0.79 L31.00,-0.84 L32.00,-0.89 L33.00,-0.93 L34.00,-0.98 L35.00,-1.03 L36.00,-1.08 L37.00,-1.12 L38.00,-1.16 L39.00,-1.20 L40.00,-1.24 L41.00,-1.27 L42.00,-1.31 L43.00,-1.34 L44.00,-1.36 L45.00,-1.38 L46.00,-1.40 L47.00,-1.41 L48.00,-1.43 L49.00,-1.43 L50.00,-1.43 L51.00,-1.43 L52.00,-1.43 L53.00,-1.41 L54.00,-1.40 L55.00,-1.38 L56.00,-1.36 L57.00,-1.34 L58.00,-1.31 L59.00,-1.27 L60.00,-1.24 L61.00,-1.20 L62.00,-1.16 L63.00,-1.12 L64.00,-1.08 L65.00,-1.03 L66.00,-0.98 L67.00,-0.93 L68.00,-0.89 L69.00,-0.84 L70.00,-0.79 L71.00,-0.74 L72.00,-0.69 L73.00,-0.64 L74.00,-0.59 L75.00,-0.54 L76.00,-0.50 L77.00,-0.46 L78.00,-0.42 L79.00,-0.38 L80.00,-0.34 L81.00,-0.31 L82.00,-0.27 L83.00,-0.25 L84.00,-0.22 L85.00,-0.19 L86.00,-0.17 L87.00,-0.15 L88.00,-0.14 L89.00,-0.12 L90.00,-0.11 L91.00,-0.10 L92.00,-0.09 L93.00,-0.09 L94.00,-0.08 L95.00,-0.08 L96.00,-0.08 L97.00,-0.08 L98.00,-0.08 L99.00,-0.08 L100.00,-0.08" fill="none" stroke="#000000" stroke-width="0.07" opacity="0.8" stroke-dasharray="1.1 0.6 0.3 1.4"/><path d="M0.00,-0.17 L1.00,-0.17 L2.00,-0.16 L3.00,-0.16 L4.00,-0.16 L5.00,-0.17 L6.00,-0.17 L7.00,-0.17 L8.00,-0.18 L9.00,-0.19 L10.00,-0.19 L11.00,-0.21 L12.00,-0.22 L13.00,-0.24 L14.00,-0.25 L15.00,-0.28 L16.00,-0.30 L17.00,-0.33 L18.00,-0.36 L19.00,-0.39 L20.00,-0.42 L21.00,-0.46 L22.00,-0.50 L23.00,-0.54 L24.00,-0.58 L25.00,-0.63 L26.00,-0.67 L27.00,-0.72 L28.00,-0.77 L29.00,-0.82 L30.00,-0.87 L31.00,-0.92 L32.00,-0.97 L33.00,-1.02 L34.00,-1.07 L35.00,-1.11 L36.00,-1.16 L37.00,-1.20 L38.00,-1.25 L39.00,-1.29 L40.00,-1.32 L41.00,-1.36 L42.00,-1.39 L43.00,-1.42 L44.00,-1.45 L45.00,-1.47 L46.00,-1.49 L47.00,-1.50 L48.00,-1.51 L49.00,-1.51 L50.00,-1.52 L51.00,-1.51 L52.00,-1.51 L53.00,-1.50 L54.00,-1.49 L55.00,-1.47 L56.00,-1.45 L57.00,-1.42 L58.00,-1.39 L59.00,-1.36 L60.00,-1.32 L61.00,-1.29 L62.00,-1.25 L63.00,-1.20 L64.00,-1.16 L65.00,-1.11 L66.00,-1.07 L67.00,-1.02 L68.00,-0.97 L69.00,-0.92 L70.00,-0.87 L71.00,-0.82 L72.00,-0.77 L73.00,-0.72 L74.00,-0.67 L75.00,-0.63 L76.00,-0.58 L77.00,-0.54 L78.00,-0.50 L79.00,-0.46 L80.00,-0.42 L81.00,-0.39 L82.00,-0.36 L83.00,-0.33 L84.00,-0.30 L85.00,-0.28 L86.00,-0.25 L87.00,-0.24 L88.00,-0.22 L89.00,-0.21 L90.00,-0.19 L91.00,-0.19 L92.00,-0.18 L93.00,-0.17 L94.00,-0.17 L95.00,-0.17 L96.00,-0.16 L97.00,-0.16 L98.00,-0.16 L99.00,-0.17 L100.00,-0.17" fill="none" stroke="#000000" stroke-width="0.07" opacity="0.8" stroke-dasharray="1.8 1.1 0.5 1.7"/><path d="M0.00,0.07 L1.00,0.07 L2.00,0.08 L3.00,0.08 L4.00,0.08 L5.00,0.07 L6.00,0.07 L7.00,0.07 L8.00,0.06 L9.00,0.05 L10.00,0.05 L11.00,0.03 L12.00,0.02 L13.00,0.00 L14.00,-0.01 L15.00,-0.04 L16.00,-0.06 L17.00,-0.09 L18.00,-0.12 L19.00,-0.15 L20.00,-0.18 L21.00,-0.22 L22.00,-0.26 L23.00,-0.30 L24.00,-0.34 L25.00,-0.39 L26.00,-0.43 L27.00,-0.48 L28.00,-0.53 L29.00,-0.58 L30.00,-0.63 L31.00,-0.68 L32.00,-0.73 L33.00,-0.78 L34.00,-0.83 L35.00,-0.87 L36.00,-0.92 L37.00,-0.96 L38.00,-1.01 L39.00,-1.05 L40.00,-1.08 L41.00,-1.12 L42.00,-1.15 L43.00,-1.18 L44.00,-1.21 L45.00,-1.23 L46.00,-1.25 L47.00,-1.26 L48.00,-1.27 L49.00,-1.27 L50.00,-1.28 L51.00,-1.27 L52.00,-1.27 L53.00,-1.26 L54.00,-1.25 L55.00,-1.23 L56.00,-1.21 L57.00,-1.18 L58.00,-1.15 L59.00,-1.12 L60.00,-1.08 L61.00,-1.05 L62.00,-1.01 L63.00,-0.96 L64.00,-0.92 L65.00,-0.87 L66.00,-0.83 L67.00,-0.78 L68.00,-0.73 L69.00,-0.68 L70.00,-0.63 L71.00,-0.58 L72.00,-0.53 L73.00,-0.48 L74.00,-0.43 L75.00,-0.39 L76.00,-0.34 L77.00,-0.30 L78.00,-0.26 L79.00,-0.22 L80.00,-0.18 L81.00,-0.15 L82.00,-0.12 L83.00,-0.09 L84.00,-0.06 L85.00,-0.04 L86.00,-0.01 L87.00,0.00 L88.00,0.02 L89.00,0.03 L90.00,0.05 L91.00,0.05 L92.00,0.06 L93.00,0.07 L94.00,0.07 L95.00,0.07 L96.00,0.08 L97.00,0.08 L98.00,0.08 L99.00,0.07 L100.00,0.07" fill="none" stroke="#000000" stroke-width="0.07" opacity="0.8" stroke-dasharray="2.5 1.6 0.7 2.0"/><path d="M0.00,-0.21 L1.00,-0.20 L2.00,-0.20 L3.00,-0.20 L4.00,-0.20 L5.00,-0.20 L6.00,-0.21 L7.00,-0.21 L8.00,-0.21 L9.00,-0.22 L10.00,-0.23 L11.00,-0.24 L12.00,-0.26 L13.00,-0.27 L14.00,-0.29 L15.00,-0.31 L16.00,-0.34 L17.00,-0.37 L18.00,-0.39 L19.00,-0.43 L20.00,-0.46 L21.00,-0.50 L22.00,-0.54 L23.00,-0.58 L24.00,-0.62 L25.00,-0.67 L26.00,-0.71 L27.00,-0.76 L28.00,-0.81 L29.00,-0.86 L30.00,-0.91 L31.00,-0.96 L32.00,-1.01 L33.00,-1.05 L34.00,-1.10 L35.00,-1.15 L36.00,-1.20 L37.00,-1.24 L38.00,-1.28 L39.00,-1.32 L40.00,-1.36 L41.00,-1.40 L42.00,-1.43 L43.00,-1.46 L44.00,-1.48 L45.00,-1.50 L46.00,-1.52 L47.00,-1.53 L48.00,-1.55 L49.00,-1Line truncated
</defs>
<g transform="translate(-10 -6) skewX(-12) translate(18 0)"><g transform="scale(0.2)">
<path d="M140 100 H240 A150 150 0 0 1 240 400 H140 Z" fill="none" stroke="url(#books)" stroke-width="38" stroke-linejoin="round" filter="url(#glow)"/>
<path d="M178.0,250.0 L178.8,246.3 L179.5,242.7 L180.3,239.1 L181.1,235.5 L181.8,232.0 L182.6,228.6 L183.4,225.2 L184.1,222.0 L184.9,218.9 L185.7,215.9 L186.4,213.1 L187.2,210.4 L188.0,207.9 L188.7,205.6 L189.5,203.4 L190.3,201.5 L191.0,199.8 L191.8,198.3 L192.6,197.0 L193.3,195.9 L194.1,195.1 L194.9,194.5 L195.6,194.1 L196.4,194.0 L197.2,194.1 L197.9,194.5 L198.7,195.1 L199.5,195.9 L200.2,197.0 L201.0,198.3 L201.8,199.8 L202.5,201.5 L203.3,203.4 L204.1,205.6 L204.8,207.9 L205.6,210.4 L206.4,213.1 L207.1,215.9 L207.9,218.9 L208.7,222.0 L209.4,225.2 L210.2,228.6 L211.0,232.0 L211.7,235.5 L212.5,239.1 L213.3,242.7 L214.0,246.3 L214.8,250.0 L215.6,253.7 L216.3,257.3 L217.1,260.9 L217.9,264.5 L218.6,268.0 L219.4,271.4 L220.2,274.8 L220.9,278.0 L221.7,281.1 L222.5,284.1 L223.2,286.9 L224.0,289.6 L224.8,292.1 L225.5,294.4 L226.3,296.6 L227.1,298.5 L227.8,300.2 L228.6,301.7 L229.4,303.0 L230.1,304.1 L230.9,304.9 L231.7,305.5 L232.4,305.9 L233.2,306.0 L234.0,305.9 L234.7,305.5 L235.5,304.9 L236.3,304.1 L237.0,303.0 L237.8,301.7 L238.6,300.2 L239.3,298.5 L240.1,296.6 L240.9,294.4 L241.6,292.1 L242.4,289.6 L243.2,286.9 L243.9,284.1 L244.7,281.1 L245.5,278.0 L246.2,274.8 L247.0,271.4 L247.8,268.0 L248.5,264.5 L249.3,260.9 L250.1,257.3 L250.8,253.7 L251.6,250.0 L252.4,246.3 L253.1,242.7 L253.9,239.1 L254.7,235.5 L255.4,232.0 L256.2,228.6 L257.0,225.2 L257.7,222.0 L258.5,218.9 L259.3,215.9 L260.0,213.1 L260.8,210.4 L261.6,207.9 L262.3,205.6 L263.1,203.4 L263.9,201.5 L264.6,199.8 L265.4,198.3 L266.2,197.0 L266.9,195.9 L267.7,195.1 L268.5,194.5 L269.2,194.1 L270.0,194.0 H288.4 V306.0 H325.2 V194.0 H362.0" fill="none" stroke="#000000" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
</g></g>
<text transform="translate(98 74) skewX(-11)" font-family="'Source Code Pro', 'SauceCodePro Nerd Font Mono', monospace" font-weight="800" font-style="italic" font-size="62"
letter-spacing="-1" fill="#000000">D-Modem</text>
<g transform="translate(14 92) scale(3.72)"><path d="M-0.00,0.04 L0.25,0.07 L0.50,0.12 L0.75,0.16 L1.00,0.18 L1.25,0.21 L1.50,0.24 L1.75,0.27 L2.00,0.28 L2.25,0.29 L2.50,0.30 L2.75,0.33 L3.00,0.35 L3.25,0.37 L3.50,0.39 L3.75,0.41 L4.00,0.44 L4.25,0.44 L4.50,0.43 L4.75,0.42 L5.00,0.41 L5.25,0.41 L5.50,0.41 L5.75,0.40 L6.00,0.39 L6.25,0.39 L6.50,0.40 L6.75,0.40 L7.00,0.39 L7.25,0.38 L7.50,0.37 L7.75,0.37 L8.00,0.37 L8.25,0.36 L8.50,0.35 L8.75,0.36 L9.00,0.38 L9.25,0.39 L9.50,0.39 L9.75,0.38 L10.00,0.38 L10.25,0.39 L10.51,0.38 L10.76,0.37 L11.01,0.36 L11.26,0.37 L11.51,0.38 L11.76,0.38 L12.01,0.37 L12.26,0.36 L12.51,0.36 L12.76,0.35 L13.01,0.34 L13.26,0.32 L13.51,0.30 L13.76,0.29 L14.01,0.30 L14.26,0.29 L14.51,0.28 L14.76,0.28 L15.01,0.28 L15.26,0.28 L15.51,0.27 L15.76,0.26 L16.01,0.24 L16.26,0.24 L16.51,0.25 L16.76,0.25 L17.01,0.24 L17.26,0.24 L17.51,0.25 L17.76,0.25 L18.01,0.24 L18.26,0.22 L18.51,0.21 L18.76,0.20 L19.01,0.19 L19.26,0.18 L19.51,0.16 L19.76,0.15 L20.01,0.15 L20.26,0.15 L20.52,0.13 L20.76,0.11 L21.01,0.09 L21.26,0.08 L21.51,0.07 L21.76,0.05 L22.01,0.03 L22.27,0.03 L22.52,0.03 L22.77,0.03 L23.02,0.03 L23.27,0.02 L23.52,0.01 L23.77,0.01 L24.02,-0.00 L24.27,-0.02 L24.52,-0.04 L24.77,-0.04 L25.02,-0.04 L25.27,-0.05 L25.52,-0.06 L25.77,-0.07 L26.02,-0.08 L26.27,-0.09 L26.52,-0.11 L26.77,-0.14 L27.02,-0.17 L27.27,-0.18 L27.52,-0.19 L27.77,-0.20 L28.02,-0.22 L28.27,-0.23 L28.52,-0.24 L28.77,-0.25 L29.02,-0.26 L29.27,-0.28 L29.52,-0.30 L29.77,-0.31 L30.02,-0.32 L30.27,-0.32 L30.52,-0.33 L30.77,-0.34 L31.02,-0.34 L31.27,-0.34 L31.52,-0.35 L31.77,-0.36 L32.02,-0.38 L32.27,-0.40 L32.52,-0.41 L32.77,-0.43 L33.02,-0.45 L33.27,-0.46 L33.52,-0.46 L33.77,-0.47 L34.02,-0.48 L34.27,-0.51 L34.52,-0.53 L34.77,-0.54 L35.02,-0.56 L35.27,-0.58 L35.52,-0.60 L35.77,-0.62 L36.02,-0.62 L36.27,-0.61 L36.52,-0.62 L36.77,-0.63 L37.02,-0.64 L37.27,-0.64 L37.52,-0.65 L37.77,-0.67 L38.02,-0.68 L38.27,-0.69 L38.52,-0.69 L38.77,-0.69 L39.02,-0.69 L39.27,-0.70 L39.52,-0.71 L39.77,-0.72 L40.02,-0.73 L40.26,-0.75 L40.51,-0.78 L40.76,-0.79 L41.01,-0.80 L41.26,-0.81 L41.51,-0.82 L41.76,-0.83 L42.01,-0.84 L42.26,-0.84 L42.51,-0.84 L42.76,-0.86 L43.01,-0.88 L43.26,-0.88 L43.51,-0.89 L43.76,-0.89 L44.01,-0.90 L44.26,-0.90 L44.51,-0.89 L44.76,-0.88 L45.01,-0.87 L45.26,-0.88 L45.51,-0.89 L45.76,-0.90 L46.01,-0.90 L46.26,-0.90 L46.51,-0.92 L46.75,-0.92 L47.01,-0.92 L47.26,-0.91 L47.50,-0.91 L47.75,-0.93 L48.00,-0.94 L48.25,-0.94 L48.50,-0.95 L48.75,-0.96 L49.00,-0.98 L49.25,-0.98 L49.50,-0.98 L49.75,-0.97 L50.00,-0.96 L50.25,-0.96 L50.50,-0.96 L50.75,-0.95 L51.00,-0.94 L51.25,-0.95 L51.50,-0.95 L51.75,-0.95 L52.00,-0.94 L52.25,-0.93 L52.50,-0.92 L52.74,-0.91 L52.99,-0.91 L53.24,-0.89 L53.49,-0.89 L53.74,-0.90 L53.99,-0.91 L54.24,-0.91 L54.49,-0.91 L54.74,-0.90 L54.99,-0.90 L55.24,-0.90 L55.49,-0.90 L55.74,-0.88 L55.99,-0.88 L56.24,-0.88 L56.49,-0.89 L56.74,-0.88 L56.99,-0.88 L57.24,-0.87 L57.49,-0.86 L57.74,-0.86 L57.99,-0.84 L58.24,-0.81 L58.49,-0.79 L58.74,-0.78 L58.99,-0.78 L59.24,-0.77 L59.49,-0.76 L59.74,-0.75 L59.99,-0.75 L60.23,-0.74 L60.48,-0.73 L60.73,-0.71 L60.98,-0.69 L61.23,-0.69 L61.48,-0.69 L61.73,-0.68 L61.98,-0.67 L62.23,-0.67 L62.48,-0.68 L62.73,-0.68 L62.98,-0.66 L63.23,-0.65 L63.48,-0.63 L63.73,-0.62 L63.98,-0.61 L64.23,-0.59 L64.48,-0.57 L64.73,-0.56 L64.98,-0.56 L65.23,-0.55 L65.48,-0.53 L65.73,-0.51 L65.98,-0.49 L66.23,-0.48 L66.48,-0.46 L66.73,-0.43 L66.98,-0.41 L67.23,-0.41 L67.48,-0.41 L67.73,-0.40 L67.98,-0.39 L68.23,-0.38 L68.48,-0.38 L68.73,-0.37 L68.98,-0.36 L69.23,-0.34 L69.48,-0.32 L69.73,-0.32 L69.98,-0.32 L70.23,-0.31 L70.48,-0.30 L70.73,-0.29 L70.98,-0.28 L71.23,-0.27 L71.48,-0.25 L71.73,-0.22 L71.98,-0.20 L72.23,-0.18 L72.48,-0.17 L72.73,-0.16 L72.98,-0.14 L73.23,-0.13 L73.48,-0.12 L73.73,-0.12 L73.98,-0.10 L74.23,-0.07 L74.48,-0.06 L74.73,-0.05 L74.98,-0.04 L75.23,-0.03 L75.48,-0.02 L75.73,-0.02 L75.98,-0.02 L76.23,-0.03 L76.48,-0.02 L76.73,-0.00 L76.98,0.01 L77.23,0.02 L77.48,0.03 L77.73,0.05 L77.98,0.06 L78.23,0.07 L78.49,0.07 L78.74,0.07 L78.99,0.09 L79.24,0.11 L79.49,0.12 L79.74,0.14 L79.99,0.15 L80.24,0.18 L80.49,0.20 L80.74,0.20 L80.99,0.20 L81.24,0.20 L81.49,0.21 L81.74,0.22 L81.99,0.22 L82.24,0.22 L82.49,0.22 L82.74,0.24 L82.99,0.25 L83.24,0.25 L83.49,0.25 L83.74,0.25 L83.99,0.25 L84.24,0.25 L84.49,0.25 L84.74,0.25 L84.99,0.26 L85.24,0.28 L85.49,0.30 L85.74,0.31 L85.99,0.31 L86.24,0.32 L86.49,0.33 L86.74,0.34 L86.99,0.34 L87.24,0.34 L87.49,0.34 L87.74,0.36 L87.99,0.37 L88.24,0.38 L88.49,0.38 L88.74,0.38 L88.99,0.39 L89.24,0.39 L89.50,0.37 L89.75,0.36 L90.00,0.36 L90.25,0.36 L90.50,0.37 L90.75,0.36 L91.00,0.36 L91.25,0.37 L91.50,0.38 L91.75,0.38 L92.00,0.37 L92.25,0.37 L92.50,0.37 L92.75,0.38 L93.00,0.38 L93.25,0.39 L93.50,0.39 L93.75,0.41 L94.00,0.43 L94.25,0.42 L94.50,0.41 L94.75,0.39 L95.00,0.38 L95.25,0.38 L95.50,0.36 L95.75,0.34 L96.00,0.33 L96.25,0.33 L96.50,0.33 L96.75,0.31 L97.00,0.29 L97.25,0.27 L97.50,0.25 L97.75,0.23 L98.00,0.21 L98.25,0.18 L98.50,0.17 L98.75,0.16 L99.00,0.15 L99.25,0.Line truncated
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

-10
View File
@@ -1,10 +0,0 @@
# The platform file of the classic Mac OS (cmake/macos9.cmake): a POSIX
# system for CMake, over the C library of clang-retro/mac-sdk. A program
# is a MacBinary II file (.bin) that mac-sdk's tools/macapp.py links.
set(UNIX 1)
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set(CMAKE_EXECUTABLE_SUFFIX ".bin")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+20
View File
@@ -0,0 +1,20 @@
# haiku.cmake - the toolchain file for the app on Haiku (x86_64), built
# on Linux with Clang and lld. It is the toolchain file of D-Modem
# (external/D-Modem/platforms/haiku/haiku.cmake), which the modem in the
# app uses too.
#
# python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
# cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=$PWD/haiku-sysroot \
# -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
#
# Refer to docs/haiku.md.
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
message(FATAL_ERROR "cmake/haiku.cmake: no external/D-Modem (git submodule update --init)")
endif()
# (the roots that a project gives, as libssh's build gets the prefix of
# mbedTLS, stay with the sysroot, which D-Modem's file sets)
set(_dmodem_find_roots ${CMAKE_FIND_ROOT_PATH})
include("${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
list(APPEND CMAKE_FIND_ROOT_PATH ${_dmodem_find_roots})
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
-73
View File
@@ -1,73 +0,0 @@
# CMake toolchain file for the classic Mac OS on PowerPC (Mac OS 8.6 to
# 9.2). It builds the Windows app (winport/) over the Toolbox backend of
# clang-retro MFC, on Linux.
#
# cmake -S . -B build/macos9 -DCMAKE_TOOLCHAIN_FILE=cmake/macos9.cmake \
# -DMACOS9_LLVM=/opt/llvm -DMACOS9_SDK=/path/to/mac-sdk \
# -DCLANG_RETRO_MFC=/path/to/mfc -DDMODEM_GUI_WINPORT=ON
#
# You need these:
# MACOS9_LLVM clang of clang-retro/llvm (the llvm-prebuilt release)
# MACOS9_SDK a clang-retro/mac-sdk checkout, with its runtime, C and
# C++ libraries in lib/ (runtime/build.sh,
# runtime/build-libc.sh, runtime/build-libstdcxx.sh)
# CLANG_RETRO_MFC a clang-retro/mfc checkout (port/compat/macos)
# The environment variables of the same names also set them.
#
# CMake builds the static libraries. tools/macapp.py of mac-sdk links each
# program into a PowerPC application (a MacBinary II file, .bin).
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(CMAKE_SYSTEM_NAME MacOS9)
set(CMAKE_SYSTEM_VERSION 9.2)
set(CMAKE_SYSTEM_PROCESSOR powerpc)
foreach(_v MACOS9_LLVM MACOS9_SDK CLANG_RETRO_MFC)
if(NOT ${_v} AND DEFINED ENV{${_v}})
set(${_v} "$ENV{${_v}}")
endif()
if(NOT ${_v})
message(FATAL_ERROR "Set ${_v} (cmake/macos9.cmake)")
endif()
set(${_v} "${${_v}}" CACHE PATH "" FORCE)
# (the builds that D-Modem configures with this file see them too)
set(ENV{${_v}} "${${_v}}")
endforeach()
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MACOS9_LLVM MACOS9_SDK CLANG_RETRO_MFC)
set(MACOS9_TARGET powerpc-apple-macos9)
set(_lib "${MACOS9_SDK}/lib")
# The headers: GCC's C++ library of mac-sdk, port/compat/macos of
# clang-retro MFC (the POSIX declarations that picolibc does not have),
# the C library, then the Toolbox. These are mandatory arguments of the
# compilers, with the target: a -DCMAKE_C_FLAGS of a project or an
# ExternalProject keeps them.
set(_common -isystem ${CLANG_RETRO_MFC}/port/compat/macos -isystem ${_lib}/include
-I${MACOS9_SDK}/include -DMAC_LIBC -D_GNU_SOURCE
-femulated-tls -ffunction-sections -fdata-sections)
set(CMAKE_C_COMPILER "${MACOS9_LLVM}/bin/clang" "--target=${MACOS9_TARGET}" ${_common})
set(CMAKE_CXX_COMPILER "${MACOS9_LLVM}/bin/clang++" "--target=${MACOS9_TARGET}"
-nostdinc++ -isystem ${_lib}/include/c++/15.2.0/${MACOS9_TARGET}
-isystem ${_lib}/include/c++/15.2.0 ${_common} -fexceptions -frtti)
set(CMAKE_AR "${MACOS9_LLVM}/bin/llvm-ar")
set(CMAKE_RANLIB "${MACOS9_LLVM}/bin/llvm-ranlib")
# The tests of CMake and of the projects compile and do not link: the
# linker is macapp.py, which makes a Mac application
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# A program: macapp.py links its objects and libraries with the C and
# C++ libraries of mac-sdk (MACOS9_APP_SIZE: the partition in KB)
set(MACOS9_APP_SIZE 16384 CACHE STRING "The partition of a program, in KB")
find_program(MACOS9_PYTHON NAMES python3 python REQUIRED)
# (macapp.py adds the C++ library only for C++ sources, not for objects:
# a C++ program names libstdc++.a and libunwind.a, which throws the
# exceptions, itself)
set(_macapp "${CMAKE_COMMAND} -E env CLANG=${MACOS9_LLVM}/bin/clang ${MACOS9_PYTHON} ${MACOS9_SDK}/tools/macapp.py --cpu ppc --size ${MACOS9_APP_SIZE} --name <TARGET_NAME> -o <TARGET> -- <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_C_LINK_EXECUTABLE "${_macapp}")
set(CMAKE_CXX_LINK_EXECUTABLE "${_macapp} ${_lib}/ppc/libstdc++.a ${_lib}/ppc/libunwind.a")
set(CMAKE_FIND_ROOT_PATH "${_lib}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+18 -3
View File
@@ -14,9 +14,13 @@
# release), with emulated TLS for Mac OS X 10.4
# MACOSX_LEGACY_SYSROOT the macosx10.4 sysroot of clang-retro/dos-sdk
# (packaging/get-toolchain.sh -s macosx10.4): libc++,
# and MacOSX10.4u.sdk in it
# the builtins, and MacOSX10.4.sdk in it
# MACOSX_LEGACY_CCTOOLS Apple's ld64 and ar for PowerPC
# (dos-sdk's scripts/build-cctools-ppc.sh)
# This is optional:
# MACOSX_LEGACY_SDK the Mac OS X 10.4 SDK: a 10.4 sysroot of
# clang-retro/macosx-sdk (build-sysroot.sh 10.4).
# Default: MACOSX_LEGACY_SYSROOT/MacOSX10.4.sdk.
# The environment variables of the same names also set them.
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_VERSION 8.0)
@@ -33,12 +37,23 @@ foreach(_v ARCH LLVM SYSROOT CCTOOLS)
set(ENV{MACOSX_LEGACY_${_v}} "${MACOSX_LEGACY_${_v}}")
endforeach()
# (try_compile projects see these)
if(NOT MACOSX_LEGACY_SDK AND DEFINED ENV{MACOSX_LEGACY_SDK})
set(MACOSX_LEGACY_SDK "$ENV{MACOSX_LEGACY_SDK}")
endif()
if(NOT MACOSX_LEGACY_SDK)
set(MACOSX_LEGACY_SDK "${MACOSX_LEGACY_SYSROOT}/MacOSX10.4.sdk")
endif()
if(NOT EXISTS "${MACOSX_LEGACY_SDK}/usr/lib/crt1.o")
message(FATAL_ERROR "MACOSX_LEGACY_SDK (${MACOSX_LEGACY_SDK}) is not a Mac OS X 10.4 SDK: it has no usr/lib/crt1.o")
endif()
set(MACOSX_LEGACY_SDK "${MACOSX_LEGACY_SDK}" CACHE STRING "" FORCE)
set(ENV{MACOSX_LEGACY_SDK} "${MACOSX_LEGACY_SDK}")
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
MACOSX_LEGACY_ARCH MACOSX_LEGACY_LLVM MACOSX_LEGACY_SYSROOT MACOSX_LEGACY_CCTOOLS)
MACOSX_LEGACY_ARCH MACOSX_LEGACY_LLVM MACOSX_LEGACY_SYSROOT MACOSX_LEGACY_CCTOOLS
MACOSX_LEGACY_SDK)
set(CMAKE_SYSTEM_PROCESSOR ${MACOSX_LEGACY_ARCH})
set(MACOSX_LEGACY_TARGET "${MACOSX_LEGACY_ARCH}-apple-macosx10.4")
set(MACOSX_LEGACY_SDK "${MACOSX_LEGACY_SYSROOT}/MacOSX10.4u.sdk")
set(_cct "${MACOSX_LEGACY_CCTOOLS}/bin/powerpc-apple-darwin8-")
set(CMAKE_OSX_SYSROOT "${MACOSX_LEGACY_SDK}")
+13 -41
View File
@@ -52,6 +52,11 @@ for an Intel Mac on a Mac with Apple silicon, add
`-DCMAKE_OSX_ARCHITECTURES=x86_64` to the first command. Set one
architecture only. The app cannot be a universal binary.
## Haiku
You build the app for Haiku (x86_64) on Linux, with clang and a sysroot
of Haiku's packages. Refer to [The app on Haiku](haiku.md#build).
## Mac OS X 10.4 and later (PowerPC and Intel)
The app for Mac OS X 10.4 (Tiger) and later builds on Linux. It uses the
@@ -62,9 +67,14 @@ Mac OS X 10.0-10.5 port of clang-retro MFC and the toolchain file
`llvm-prebuilt` release). The clang of the clang-dos package can be too
old: it must have emulated TLS for Mac OS X 10.4.
- The `macosx10.4` sysroot of [clang-retro/dos-sdk](https://github.com/clang-retro/dos-sdk):
`sh packaging/get-toolchain.sh -s macosx10.4 DIR`. It has libc++ and
the builtins, and the script also gets Apple's `MacOSX10.4u.sdk`.
Apple's license applies to the SDK.
`sh packaging/get-toolchain.sh -s macosx10.4 DIR`. It has libc++, the
builtins and `MacOSX10.4.sdk`, the 10.4 SDK of
[clang-retro/macosx-sdk](https://github.com/clang-retro/macosx-sdk).
No file from Apple is in it.
- Optional: a newer 10.4 SDK from a macosx-sdk checkout. Run
`OUT=DIR sh build-sysroot.sh 10.4` in macosx-sdk, then set
`MACOSX_LEGACY_SDK=DIR/macosx10.4`. CI does this, so that it uses the
latest headers of macosx-sdk.
- Apple's `ld64` and `ar` for PowerPC: `PREFIX=DIR sh scripts/build-cctools-ppc.sh`
in dos-sdk. This `ld64` also links for i386.
@@ -86,44 +96,6 @@ Then join the two programs into one fat program:
(`time.h`, `signal.h` and `net/if.h`). The built-in modem needs D-Modem
with the changes for 10.4 to 10.6 (`docs/macos-details.md` in D-Modem).
## Mac OS 9 (PowerPC)
The app for the classic Mac OS on PowerPC builds on Linux. It uses the
Toolbox backend of clang-retro MFC and the toolchain file
`cmake/macos9.cmake`. You need these items:
- clang of [clang-retro/llvm](https://github.com/clang-retro/llvm) (its
`llvm-prebuilt` release).
- A [clang-retro/mac-sdk](https://github.com/clang-retro/mac-sdk)
checkout with its PowerPC libraries in `lib/`. Build them with
`runtime/build.sh`, `runtime/build-libc.sh` (it needs a
[clang-retro/picolibc](https://github.com/clang-retro/picolibc)
checkout) and `runtime/build-libstdcxx.sh` (it needs the GCC 15.2.0
release and the libunwind of clang-retro/llvm). mac-sdk's
`docs/cxx.md` tells more.
Build the app:
export MACOS9_LLVM=/path/to/llvm MACOS9_SDK=/path/to/mac-sdk
cmake -S . -B build/os9 -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/macos9.cmake \
-DCLANG_RETRO_MFC=/path/to/mfc -DDMODEM_GUI_WINPORT=ON \
-DDMODEM_GUI_EMBED=ON -DDMODEM_GUI_SSH=OFF
cmake --build build/os9 --target dmodem-win32
The result is `build/os9/winport/dmodem-win32.bin`, an application in
MacBinary format. `mac-sdk/tools/macapp.py` links it. The memory
partition of the app is 16 MB (`MACOS9_APP_SIZE`, in KB).
These items are different on Mac OS 9:
- There is no SSH (`DMODEM_GUI_SSH=OFF`).
- There is no debug information. Clang cannot write DWARF into XCOFF
objects.
- `cmake/Platform/MacOS9.cmake` gives the CMake system `MacOS9`. The
built-in modem needs D-Modem with the changes for this system
(`docs/macos-details.md` in D-Modem).
## The library only
With no `DMODEM_GUI_WINPORT`, a build on Linux or macOS makes only
+100 -12
View File
@@ -23,6 +23,46 @@ test (`core/test`, which CI runs with ASan and UBSan).
| `dmc_net` | Telnet (option negotiation, terminal type, window size) and rlogin (the handshake, and the window size on the urgent request of the server), for the Remote page |
| `dmc_daemon_*` | It reads the text that dmodemd prints when it starts: the device that it made, or its error |
## The start-up splash
`windows/src/splash.cpp` shows the splash. `WinMain` makes the main window
first, but it does not show it. Then it shows the splash. When the splash
closes, `WinMain` shows the main window. Thus the main window is ready when
the splash closes.
- The splash is a `WS_POPUP` window, 480 x 280 pixels, at the center of
the screen. It stays on top of the other windows. It has the raised 3D
edge of a Windows 95 window.
- The splash uses the colors of the user's scheme, as the rest of the app
does: the button face color (`COLOR_BTNFACE`) for the background, and
the button text color (`COLOR_BTNTEXT`) for the text.
- The logo has the mark of D-Modem/brand, the word "D-Modem" in Source
Code Pro ExtraBold Italic, and a rainbow pencil line under the word. The
logo is in two bitmaps, 400 x 120 pixels, 24-bit: the logo on black
(`windows/res/splash-k.bmp`, `IDB_SPLASH_K`) and the logo on white
(`windows/res/splash-w.bmp`, `IDB_SPLASH_W`). When the splash opens,
the app mixes the two bitmaps with the button face color. For each
channel of each pixel, the result is `k + (w - k) * face / 255`. Thus
the logo has a transparent background on each color scheme. The app
does not use an alpha blend function, so this works on Windows 95 and
on each target of clang-retro MFC.
- The app draws the text at run time: `DMODEM_GUI_VERSION` (`app.h`),
the date of the build (`__DATE__`) and the copyright. The font is the
dialog font of the system. The version line is bold.
- A 15 ms timer moves the logo and the text from the right edge to their
positions in 1.5 s, with an ease-out curve. The app draws each frame in
a memory bitmap first, and then copies the frame to the window. Thus
the motion does not flicker.
- The splash closes at 4 s, or when the user clicks it or pushes a key.
- `-nosplash` (or `/nosplash`) on the command line stops the splash. The
app reads the full command line (`GetCommandLineA`), because the
picolibc start-up code does not give the command line to `WinMain`.
To make the two bitmaps again after a change to `assets/splash.svg`,
install Source Code Pro (ExtraBold Italic), then do these commands:
node tools/splash.js && python3 tools/splash.py
## Where the settings come from
The core of dmodemd has one settings model (`Config::model`). This model
@@ -34,9 +74,22 @@ Thus, if a setting is added to the modem, it shows in the app without a
change here. The library checks a change and sends it as its AT command. The
app keeps the change when the modem says OK.
The modem keeps no stored profile. Thus the page shows the init string of
AT!R. Its **Keep** button saves the string in the line settings of the app.
The app sends the string each time that the modem opens.
The page has these buttons for the settings of the modem:
- **Defaults** sends AT&F. The modem sets each setting to its default.
- **Save to NVRAM** sends AT&W. The modem writes the settings to its
stored profile. The modem uses the stored profile when it starts and
after ATZ. The built-in modem keeps the stored profile in
`dmodem0.nvram`, in the folder of `dmodem.ini`. On Windows, `dmodemd`
uses the same file when it runs alone. If the modem cannot write its
NVRAM, the status bar tells you.
- **Load from NVRAM** sends ATZ. The modem hangs up a call and sets the
settings of its stored profile.
The page also shows the init string of AT!R. Its **Keep** button saves the
string in the line settings of the app. The app sends the string each time
that the modem opens. Use the init string for a modem that has no NVRAM
(for example, `dmodem-ari`).
## The pages
@@ -44,11 +97,11 @@ The app has seven pages:
| Page | Contents |
| --- | --- |
| Modem | The state ("Idle", "Dialling", "Online") and its detail (the CONNECT line, the caller), Dial, Answer, Hang Up, the line and the device, Start or Stop |
| Phone | The state of a voice call, Call and Answer, the keypad (DTMF), Mute and Listen. The answering machine (on or off, rings, the greeting) and its messages |
| Modem | The state ("Idle", "Dialling", "Online") and its detail (the CONNECT line, the caller), Dial, Answer, Hang Up, the line and the device, Start or Stop. The phone book |
| Phone | The state of a voice call, Call and Answer, the keypad (DTMF), Mute and Listen. The answering machine (on or off, rings, the greeting) and its messages. The phone book |
| Terminal | The AT console. The buttons **Full-screen setup** (AT!CF) and **Command-line setup** (AT!CT). The type of terminal |
| Remote | SSH, Telnet or rlogin. The server, its port (empty: the port of the protocol) and the user. The login method of SSH (keys and the agent, the agent only, a key file, the import of a PuTTY key). Connect. A separate terminal, with its type. The terminal sends its size to the server when the size changes |
| Settings | The connection path. Groups of settings as native controls, with the changed settings marked. Defaults (ATZ), the init string and Keep |
| Settings | The connection path. Groups of settings as native controls, with the changed settings marked. Defaults (AT&F), Save to NVRAM (AT&W), Load from NVRAM (ATZ), the init string and Keep |
| Call Stats | The rows of AT#UD and the report of ATI11, refreshed after each call |
| Log | The text that dmodemd printed, and the command line that started it |
@@ -173,18 +226,53 @@ modem's. `dmodem.ini` keeps the settings in `[terminal]` (the modem) and
is empty, Telnet sends the name of the terminal type.
- `exit_on_disconnect` (modem only): the app closes when a call ends.
The status bar shows the connect timer during a call ("Online 0:01:05").
The status bar has two parts:
- The left part shows the call stage. When there is no call, it shows
"Ready", or "Not ready" and the reason. The reason comes from the
connection path of the Settings page (for example, "Not ready: SIP (no
account set up)"). During a call, it shows "Dialling 5551234",
"Ringing: 5551234 NAME (ring 2)", "Answering", "Connected at 50666 bps
V92/LAPM/V44", "Hanging up" or "Voice call". A message (for example,
"BUSY" or "NO CARRIER") replaces the stage for 5 seconds.
- The right part shows the timer of the stage ("0:01:05"). The timer
starts when the modem dials or answers. It starts again from zero when
the call connects.
The app puts an icon in the notification area (`tray.cpp`). The icons
are pixel art in the 16-colour VGA palette. A computer in an icon is a
CRT monitor on a desktop case.
- When there is no call, the icon is the app icon.
- When a call starts (dialling, ringing or answering), the icon is a
computer with signal arcs, in an animation.
- When a call is connected, the icon is two computers and a cable. The
screen of the back computer lights when data goes out. The screen of
the front computer lights when data comes in.
- When a call fails (for example, BUSY or NO CARRIER), the icon is the
two computers and a red disc with a cross, for 5 seconds.
The tip of the icon shows the call stage. Click the icon to show the main
window. `tools/tray_icons.py` makes the icon files
(`windows/res/tray-*.ico`). The winport build has no notification area.
Send Break (Call menu, or Ctrl+Break in a terminal) sends a break. On a
COM port, the app holds the line at space for 250 ms (`SetCommBreak`). On
Telnet, the app sends IAC BRK (`dmc_net_break`). TCP to dmodemd, rlogin
and SSH cannot send a break, and the status bar tells you.
`phonebook.cpp` has the phone book. An entry is a name and a number (or a
SIP address). `dmodem.ini` keeps the entries in the `[sessions]` section
(`count`, `name1`, `number1` ...). The Modem page and the Phone page show
the phone book with the buttons **New**, **Edit** and **Remove**. Click an
entry to put its number in the Number box. Double-click an entry, or
push Enter, to dial it: a data call (ATD) on the Modem page, a voice call
on the Phone page. A change on one page shows on the other page and in
the Call dialog.
`calls.cpp` has the Call menu, as HyperTerminal has it:
- Call opens the Call dialog. A session is a name and a number (or a SIP
address). `dmodem.ini` keeps the sessions in the `[sessions]` section
(`count`, `name1`, `number1` ...). Save adds or changes a session, and
Delete removes it. Call dials the number (ATD) and shows the Terminal
- Call opens the Call dialog. A session is an entry of the phone book.
Save adds or changes a session, and Delete removes it. Call dials the number (ATD) and shows the Terminal
page.
- Wait for a Call sends ATS0=1: the modem answers at the first ring. The
app sends ATS0=1 again each time the modem opens. When you clear the
@@ -587,7 +675,7 @@ code is the same as on Windows.
alphabetical order, with no Bluetooth devices). To use another device,
set the environment variable `WINPORT_COMn`. For example, with
`WINPORT_COM5=/dev/ttyUSB0`, `COM5` is `/dev/ttyUSB0`.
- CI builds the app on Linux, on macOS for arm64 and x86_64, and on Linux for Mac OS X 10.4 (PowerPC and i386, `cmake/macosx-legacy.cmake`) and for Mac OS 9 (PowerPC, `cmake/macos9.cmake`). On Linux, `winport/test/smoke.sh`
- CI builds the app on Linux, on macOS for arm64 and x86_64, and on Linux for Mac OS X 10.4 (PowerPC and i386, `cmake/macosx-legacy.cmake`). On Linux, `winport/test/smoke.sh`
starts the app in Xvfb three times: with a TCP line, with a dmodemd
that the app starts (`winport/test/dmodemd`, a test dmodemd), and with
the built-in modem on a SIP line with no account. For the first two,
+10 -8
View File
@@ -20,7 +20,7 @@ When `main` has no new commits, the release does not change.
| macOS, arm64 (Apple silicon) | [`dmodem-win32-macos-arm64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-arm64.tar.gz) | The app on macOS, with the built-in modem. |
| macOS, x86_64 (Intel Mac) | [`dmodem-win32-macos-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-x86_64.tar.gz) | The app on macOS, with the built-in modem. |
| Mac OS X 10.4 and later, PowerPC and Intel | [`dmodem-win32-macosx10.4.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macosx10.4.tar.gz) | The app with the built-in modem. One program for PowerPC (G3, G4, G5) and Intel (i386). It is not tested on a Mac yet. |
| Mac OS 9, PowerPC | [`dmodem-win32-macos9.bin`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos9.bin) | The app with the built-in modem, in MacBinary format. It is not tested on a Mac yet. |
| Haiku R1/beta6 and later, x86_64 | [`dmodem-win32-haiku-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-haiku-x86_64.tar.gz) | The app on Haiku, with the built-in modem. It needs libusb. |
| All | [`SHA256SUMS`](https://github.com/D-Modem/gui/releases/download/nightly/SHA256SUMS) | The SHA-256 of each file. |
If a file is not in the release, the newest build did not make it. The
@@ -60,13 +60,6 @@ The result for the file must be `OK`.
`tar -xzf dmodem-win32-macosx10.4.tar.gz`.
3. Start the app. Type `./dmodem-win32`.
## Install on Mac OS 9
1. Download `dmodem-win32-macos9.bin`. The file is for PowerPC Macs.
2. Decode the file with StuffIt Expander. The file is in MacBinary
format.
3. Double-click the app. The app needs 16 MB of memory.
## Install on Linux
1. Install the libraries. On Ubuntu 24.04, type
@@ -75,6 +68,15 @@ The result for the file must be `OK`.
3. Extract the file. Type `tar -xzf dmodem-win32-linux-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
## Install on Haiku
1. Install libusb. In a Terminal, type `pkgman install libusb`.
2. Download `dmodem-win32-haiku-x86_64.tar.gz`.
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
For more information, refer to [The app on Haiku](haiku.md).
## Build the app
To build the app from the source code, refer to [Building](building.md).
-1
View File
@@ -80,7 +80,6 @@ Windows and macOS, the build links libusb (LGPL-2.1) statically, as
| Linux | Done. CI builds it, checks that the library is in the app, and starts the built-in modem in Xvfb (`winport/test/smoke.sh`). |
| macOS | Done (arm64 and x86_64). CI builds it for each architecture, and checks that the library is in the app. It is not tested on a Mac yet. |
| Mac OS X 10.4 and later | Done (PowerPC and i386, one fat program). CI builds it on Linux, and checks that the library is in each part of the program. It is not tested on a Mac yet. |
| Mac OS 9 (PowerPC) | Done. CI builds it on Linux with the C and C++ libraries of clang-retro/mac-sdk. There are no ptys: the modem gives its DTE on a socket. It is not tested on a Mac yet. |
### Windows 95
+3 -1
View File
@@ -3,6 +3,7 @@
This page gives the details of the pages and menus of the app. The
[README](../README.md) gives a summary.
- **Splash**: when the app starts, a splash shows for 4 seconds. The D-Modem logo and a block of text move in from the right edge in 1.5 seconds. The text shows the version, the build date and the copyright. Click the splash or push a key to close it. To start the app with no splash, use `-nosplash` on the command line (for example, `dmodem.exe -nosplash` on Windows, or `dmodem-win32 -nosplash` on Linux). Refer to "The start-up splash" in [Design](design.md)
- **Remote**: log in to a server by SSH, Telnet or rlogin, in a separate terminal. SSH is built in, on libssh: it uses the keys, agent, config and known hosts of OpenSSH. It can use or import the `.ppk` keys of PuTTY. It uses Pageant on Windows, and an ssh-agent on Linux and macOS. On Windows 95, SSH needs CryptoAPI (Windows 95 OSR2, or Internet Explorer 3 or later)
- **Terminal types**: the two terminals use the emulator of the D-Modem app, ported to C:
xterm, the VT52 to VT525 of DEC, ANSI-BBS (with Avatar, RIPscrip and Amiga ANSI),
@@ -13,5 +14,6 @@ This page gives the details of the pages and menus of the app. The
- **File transfers**: send and receive files on the modem line or on a Telnet, rlogin or SSH login. The protocols are the same as the D-Modem app: ZMODEM (with Automatic Receive when the remote side starts sz, rz or kermit -s, with Crash Recovery, and with zstd compression to the D-Modem BBS and app), YMODEM, YMODEM-G, XMODEM, XMODEM-1K, Kermit, Intel HEX, Motorola S-records and plain text. Use the Transfer menu, or the Send and Receive buttons of the Terminal page
- **Copy and capture**: select text with the mouse (Shift and the mouse when the remote side uses the mouse), then copy it. Paste to Host, Select All, Capture Text (to a file), Capture to Printer, and Print (the screen or the selection). Text that the remote side sends to its printer port goes to the printer. Use the Edit and Transfer menus, or click the right mouse button on the terminal
- **ASCII Setup** (Modem menu): the same items as HyperTerminal. For the data that you send: Enter sends CR LF, the local echo, and the line delay and character delay of a text file. For the data that you receive: an LF after each CR, 7-bit ASCII, and the wrap of long lines. The settings apply to the modem terminal and to the Remote terminal
- **Terminal Settings** (Modem menu): the same items as HyperTerminal, for the modem terminal and for the Remote terminal. They are what Backspace sends (Ctrl+H, Del, or Ctrl+H, Space, Ctrl+H), the function, arrow and Ctrl keys as terminal keys or Windows keys, the backscroll buffer lines, the font, the cursor, the Telnet terminal ID, and Exit program upon disconnecting. The status bar shows the connect timer during a call
- **Terminal Settings** (Modem menu): the same items as HyperTerminal, for the modem terminal and for the Remote terminal. They are what Backspace sends (Ctrl+H, Del, or Ctrl+H, Space, Ctrl+H), the function, arrow and Ctrl keys as terminal keys or Windows keys, the backscroll buffer lines, the font, the cursor, the Telnet terminal ID, and Exit program upon disconnecting
- **Call progress**: the status bar shows "Ready" or "Not ready" (and the reason) when there is no call. During a call, it shows the stage (Dialling, Ringing, Answering, Connected and the rate, Hanging up) and a timer. An icon in the notification area shows the stage too. When a call is connected, the icon lights for the data that goes out and the data that comes in
- **Call menu**: Call (sessions with a name and a number, as the connection files of HyperTerminal), Wait for a Call (ATS0=1), Disconnect, and Send Break (Ctrl+Break: a COM port or a Telnet connection). Line Settings has the COM port settings: bits per second, data bits, parity, stop bits and flow control. **Look for a modem** finds the modem and selects its port (refer to "Look for a modem" in [Design](design.md))
+98
View File
@@ -0,0 +1,98 @@
# The app on Haiku
The Windows app also runs on Haiku (x86_64). The app is the same Win32
source code. It runs over the portable Win32 layer of
[clang-retro MFC](https://github.com/clang-retro/mfc), which shows the
windows with Haiku's Interface Kit. The built-in modem is in the app, as
on the other systems.
<img src="images/haiku-modem.png" width="49%" alt="The Modem page of the app on Haiku"> <img src="images/haiku-line-settings.png" width="49%" alt="The Line Settings dialog of the app on Haiku">
## Requirements
- Haiku R1/beta6 or later, x86_64. The app was tested on R1/beta6.
- libusb. In a Terminal, type `pkgman install libusb`.
## Install
1. Download `dmodem-win32-haiku-x86_64.tar.gz` from the
[nightly release](https://github.com/D-Modem/gui/releases/tag/nightly).
2. Open a Terminal in the download folder.
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
The app keeps its settings in `~/config/settings/libmfc`.
## Build
You build the app on Linux. The build uses the system's clang and a
sysroot that has Haiku's own packages.
1. Install the tools. On Ubuntu 24.04, type
`sudo apt install cmake ninja-build clang lld llvm libzstd1 python3`.
2. Get [clang-retro MFC](https://github.com/clang-retro/mfc) and the
D-Modem submodule (`git submodule update --init`).
3. Make the sysroot. The script downloads Haiku's packages and examines
them against the SHA-256 of their repositories:
python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
4. Build the app:
cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/haiku.cmake \
-DHAIKU_SYSROOT=$PWD/haiku-sysroot \
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
cmake --build build/haiku --target dmodem-win32
The app is `build/haiku/winport/dmodem-win32`. Copy it to the Haiku
computer.
`cmake/haiku.cmake` includes the toolchain file of D-Modem
(`external/D-Modem/platforms/haiku/haiku.cmake`). The CI job
`winport-haiku` (`.github/workflows/build.yml`) does these steps. It does
not start the app.
## Serial ports and modems
Haiku keeps the serial ports in `/dev/ports`:
- `pc_serial0`, `pc_serial1` and on are the serial ports of the computer.
- `usb0`, `usb1` and on are the USB serial adapters and the CDC-ACM USB
modems. Haiku's `usb_serial` driver makes these ports.
In **Line settings**, the **Port** list shows the ports of `/dev/ports`,
for example `/dev/ports/usb0`. You can also type `COM1` (the first port
by name), `COM2` (the second port), and so on.
**Look for a modem** does these steps:
1. It finds the ports in `/dev/ports`.
2. It finds the USB devices with Haiku's USB Kit. It gives each `usbN`
port the name of its device (the maker and the product).
3. If a CDC-ACM device tells that it takes AT commands, the app selects
its port as the modem.
Haiku has no driver for the MultiTech MT9234MU. If you connect this
modem, **Look for a modem** tells you that Haiku cannot use it. Use a
modem with a serial port, or a CDC-ACM USB modem.
## Keys
The keys are those of a PC keyboard:
| Key on the keyboard | Key in the app |
| --- | --- |
| Control | Control. For example, Control+C copies. |
| Alt (Haiku's Command key, by default) | Alt. For example, Alt+M opens the **Modem** menu. |
| Windows (Haiku's Option key) | Windows |
## Limits
- The app has no sound on Haiku. The **Phone** page cannot play or
record the call.
- The app cannot print. Only "Save as PDF" is available.
- The Deskbar shows a generic icon for the app.
- The USB modems were not tested on Haiku yet. QEMU's USB serial adapter
does not operate with Haiku, so the tests used the serial port of the
computer only.
Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+1 -1
View File
@@ -92,7 +92,7 @@ same way on each system.
| | Windows | macOS | Linux |
| --- | --- | --- | --- |
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of clang-retro MFC | Win32, over the X11 and Wayland layer of clang-retro MFC |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386, and Mac OS 9 on PowerPC | x86_64 |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 |
| Built-in modem | Yes | Yes | Yes |
Refer to [Design](design.md).
+1
View File
@@ -17,6 +17,7 @@ nav:
- Features: features.md
- The built-in modem: embedded-modem.md
- Building: building.md
- The app on Haiku: haiku.md
- Design: design.md
- "libdmodemctl API": https://github.com/D-Modem/gui/blob/main/core/include/dmodemctl.h
- Documentation style: STYLE.md
+5
View File
@@ -38,6 +38,11 @@ if(WIN32)
elseif(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(dmodemssh PUBLIC Threads::Threads)
# Haiku has the sockets in libnetwork and strsep (for libssh) in
# libbsd, not in libroot
if(HAIKU)
target_link_libraries(dmodemssh PUBLIC network bsd)
endif()
endif()
if(MSVC)
target_compile_options(dmodemssh PRIVATE /W4 /wd4996)
+9
View File
@@ -35,6 +35,10 @@ if(MACOSX_LEGACY_TARGET)
list(APPEND _args -D${_v}=${${_v}})
endforeach()
endif()
# (cmake/haiku.cmake: D-Modem's Haiku toolchain file)
if(HAIKU_SYSROOT)
list(APPEND _args -DHAIKU_SYSROOT=${HAIKU_SYSROOT} -DHAIKU_TRIPLE=${HAIKU_TRIPLE})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND _args -DCMAKE_SYSTEM_NAME=iOS)
endif()
@@ -93,6 +97,11 @@ if(CLANG_DOS)
list(APPEND _ssh_args -DHAVE_ARPA_INET_H= -DHAVE_IO_H= -DHAVE_TERMIOS_H=)
endif()
endif()
# (Haiku: getaddrinfo is in libnetwork, which libssh's check does not
# link with)
if(HAIKU)
list(APPEND _ssh_args -DHAVE_GETADDRINFO=1)
endif()
list(APPEND _ssh_args "-DCMAKE_C_FLAGS=${_ssh_cflags}")
# (WITH_SERVER: libssh runs a client's callbacks for the channels the
+28
View File
@@ -150,3 +150,31 @@ dmodem_patch(src/misc.c
#define dmodem_if_nametoindex if_nametoindex /* D-Modem */
")
# The terminal modes that Haiku's termios.h does not have (IMAXBEL,
# VREPRINT, VWERASE, VLNEXT, VDISCARD): sent only where they are.
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_INPUT_OPT(IMAXBEL)
"
"#ifdef IMAXBEL /* D-Modem: not on Haiku */
SSH_ENCODE_INPUT_OPT(IMAXBEL)
#endif
")
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_CC_OPT(VREPRINT)
SSH_ENCODE_CC_OPT(VWERASE)
SSH_ENCODE_CC_OPT(VLNEXT)
"
"#ifdef VREPRINT /* D-Modem: not on Haiku */
SSH_ENCODE_CC_OPT(VREPRINT)
SSH_ENCODE_CC_OPT(VWERASE)
SSH_ENCODE_CC_OPT(VLNEXT)
#endif
")
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_CC_OPT(VDISCARD)
"
"#ifdef VDISCARD /* D-Modem: not on Haiku */
SSH_ENCODE_CC_OPT(VDISCARD)
#endif
")
+26
View File
@@ -0,0 +1,26 @@
// Renders assets/splash.svg (the logo of the start-up splash) two times, 400x120, with
// Playwright's Chromium: on black (build/splash/k.png) and on white (build/splash/w.png).
// The app finds the transparency of each pixel from the two renders (windows/src/splash.cpp).
// Source Code Pro (ExtraBold Italic) must be installed.
// node tools/splash.js && python3 tools/splash.py
const { chromium } = require('playwright');
const fs = require('fs'), path = require('path');
const root = path.join(__dirname, '..');
const svg = fs.readFileSync(path.join(root, 'assets', 'splash.svg'), 'utf8');
const out = path.join(root, 'build', 'splash');
fs.mkdirSync(out, { recursive: true });
/** Render the logo at 1x on each background, and write the two PNGs. */
async function render() {
const browser = await chromium.launch();
for (const [name, bg] of [['k', '#000000'], ['w', '#ffffff']]) {
const page = await browser.newPage({ viewport: { width: 400, height: 120 }, deviceScaleFactor: 1 });
await page.setContent(`<html><body style="margin:0;background:${bg}">${svg}</body></html>`);
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: path.join(out, `${name}.png`) });
await page.close();
}
await browser.close();
}
render();
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""Makes the logo of the start-up splash from tools/splash.js's PNGs:
windows/res/splash-k.bmp the logo on black
windows/res/splash-w.bmp the logo on white
Each is 400x120, 24-bit, with no compression (Windows 95 and each
clang-retro MFC target read it). The app mixes the two with the button
face colour of the user's scheme (windows/src/splash.cpp)."""
import os
from PIL import Image
ROOT = os.path.join(os.path.dirname(__file__), '..')
def main():
"""Convert build/splash/k.png and w.png to 24-bit BMPs in windows/res."""
for name in ('k', 'w'):
img = Image.open(os.path.join(ROOT, 'build', 'splash', f'{name}.png')).convert('RGB')
img.save(os.path.join(ROOT, 'windows', 'res', f'splash-{name}.bmp'), 'BMP')
if __name__ == '__main__':
main()
+166
View File
@@ -0,0 +1,166 @@
#!/usr/bin/env python3
"""Makes the icons of the notification area (the tray), as pixel art in
the 16-colour VGA palette. A computer is a CRT monitor on a desktop
case:
windows/res/tray-net-TR.ico a call is connected: two computers, the
back one lights when data goes out (T=1)
and the front one lights when data comes
in (R=1)
windows/res/tray-dial-N.ico a call starts (dialling, ringing,
answering): a computer with signal arcs,
N (0 to 2) is the frame of the animation
Each icon has 16 and 32 pixels (32 is the 16 pixel art at 2x), in 256
colours (Windows 9x) and 32-bit colour with alpha. With no call, the tray
shows the app icon (dmodem.ico)."""
import io
import os
import struct
from PIL import Image
from icons import dib_8, dib_32
ROOT = os.path.join(os.path.dirname(__file__), '..')
RES = os.path.join(ROOT, 'windows', 'res')
# the colours of the 16-colour VGA palette, as Windows 9x shows icons
INK = (0, 0, 0, 255)
SHADE = (128, 128, 128, 255)
FACE = (192, 192, 192, 255)
LIGHT = (255, 255, 255, 255)
DARK_GREEN = (0, 128, 0, 255)
GREEN = (0, 255, 0, 255)
NAVY = (0, 0, 128, 255)
OLIVE = (128, 128, 0, 255)
YELLOW = (255, 255, 0, 255)
RED = (255, 0, 0, 255)
MAROON = (128, 0, 0, 255)
# A computer of 9 x 11 pixels: a CRT monitor on a desktop case with a
# power light. The screen is 5 x 4 pixels (about 4:3). The bezel is
# black above and at the left of the screen, so the screen looks sunk. K ink, S shade, F face, W light, C screen, P power light,
# . clear.
UNIT = [
'.SSSSSSS.',
'SKKKKKKFK',
'SKCCCCCFK',
'SKCCCCCFK',
'SKCCCCCFK',
'SKCCCCCFK',
'SFFFFFFFK',
'.KKKKKKK.',
'WWWWWWWWS',
'FPFFFFFFK',
'KKKKKKKKK',
]
def computer(img, x, y, dark, lit=None):
"""Draws a computer (UNIT) with its top left corner at (x, y). The
screen has the colour dark. When lit is set, the screen is a
checkerboard of lit and white, as a screen that shows data."""
colours = {'K': INK, 'S': SHADE, 'F': FACE, 'W': LIGHT,
'P': GREEN}
for dy, row in enumerate(UNIT):
for dx, ch in enumerate(row):
c = colours.get(ch)
if ch == 'C':
if lit:
c = lit if (dx + dy) % 2 == 0 else LIGHT
else:
c = dark
if c:
img.putpixel((x + dx, y + dy), c)
def cable(img):
"""Draws the cable from the back computer to the front computer."""
for p in [(9, 2), (10, 2), (11, 2), (12, 2), (12, 3), (12, 4)]:
img.putpixel(p, NAVY)
def net(tx, rx):
"""Draws the icon of a connected call: the back computer lit for
data out (tx), the front computer lit for data in (rx)."""
img = Image.new('RGBA', (16, 16), (0, 0, 0, 0))
cable(img)
computer(img, 0, 0, DARK_GREEN, GREEN if tx else None)
computer(img, 7, 5, DARK_GREEN, GREEN if rx else None)
return img
# the pixels of the three signal arcs, from the nearest
ARCS = [
[(10, 4), (11, 5), (11, 6), (10, 7)],
[(11, 2), (12, 3), (13, 4), (13, 5), (13, 6), (13, 7), (12, 8),
(11, 9)],
[(12, 0), (13, 1), (14, 2), (15, 3), (15, 4), (15, 5), (15, 6),
(15, 7), (15, 8), (14, 9), (13, 10), (12, 11)],
]
def dial(frame):
"""Draws the icon of a call that starts: a computer with a yellow
screen, and frame + 1 signal arcs."""
img = Image.new('RGBA', (16, 16), (0, 0, 0, 0))
computer(img, 0, 2, OLIVE, YELLOW)
for arc in ARCS[:frame + 1]:
for p in arc:
img.putpixel(p, YELLOW)
return img
# a red disc of 7 x 7 pixels with a wide white cross: R red, W white
FAIL = [
'..RRR..',
'.RRRRR.',
'RWWRWWR',
'RRWWWRR',
'RWWRWWR',
'.RRRRR.',
'..RRR..',
]
def fail():
"""Draws the icon of a call that failed (BUSY, NO CARRIER): the two
computers with dark screens, and a red disc with a cross."""
img = Image.new('RGBA', (16, 16), (0, 0, 0, 0))
cable(img)
computer(img, 0, 0, DARK_GREEN)
computer(img, 7, 5, DARK_GREEN)
colours = {'R': RED, 'M': MAROON, 'W': LIGHT}
for dy, row in enumerate(FAIL):
for dx, ch in enumerate(row):
if ch in colours:
img.putpixel((9 + dx, 9 + dy), colours[ch])
return img
def ico(path, img16):
"""Writes img16 (16 x 16) as an icon file of 16 and 32 pixels, in
256 colours and in 32-bit colour."""
img32 = img16.resize((32, 32), Image.NEAREST)
entries = [(16, 8, 256, dib_8(img16)), (32, 8, 256, dib_8(img32)),
(16, 32, 0, dib_32(img16)), (32, 32, 0, dib_32(img32))]
head = struct.pack('<HHH', 0, 1, len(entries))
offset = 6 + 16 * len(entries)
dirs, data = b'', b''
for size, bpp, colours, blob in entries:
dirs += struct.pack('<BBBBHHII', size, size, colours % 256, 0, 1,
bpp, len(blob), offset)
offset += len(blob)
data += blob
with open(path, 'wb') as f:
f.write(head + dirs + data)
if __name__ == '__main__':
for tx in (0, 1):
for rx in (0, 1):
ico(os.path.join(RES, f'tray-net-{tx}{rx}.ico'), net(tx, rx))
for frame in range(3):
ico(os.path.join(RES, f'tray-dial-{frame}.ico'), dial(frame))
ico(os.path.join(RES, 'tray-fail.ico'), fail())
+30 -1
View File
@@ -2,7 +2,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* app.rc - the Windows app's icon, menu and dialogs (MS Shell Dlg: MS
* app.rc - the Windows app's icon, splash logo, menu and dialogs (MS Shell Dlg: MS
* Sans Serif on Windows 9x, Tahoma or Segoe UI later)
*/
#include <windows.h>
@@ -10,6 +10,20 @@
IDI_APP ICON "dmodem.ico"
/* the icons of the notification area (tray.cpp, tools/tray_icons.py) */
IDI_TRAY_DIAL0 ICON "tray-dial-0.ico"
IDI_TRAY_DIAL1 ICON "tray-dial-1.ico"
IDI_TRAY_DIAL2 ICON "tray-dial-2.ico"
IDI_TRAY_NET00 ICON "tray-net-00.ico"
IDI_TRAY_NET01 ICON "tray-net-01.ico"
IDI_TRAY_NET10 ICON "tray-net-10.ico"
IDI_TRAY_NET11 ICON "tray-net-11.ico"
IDI_TRAY_FAIL ICON "tray-fail.ico"
/* the logo of the start-up splash, on black and on white (splash.cpp) */
IDB_SPLASH_K BITMAP "splash-k.bmp"
IDB_SPLASH_W BITMAP "splash-w.bmp"
/* visual styles from Windows XP on (Windows 9x ignores it) */
1 24 "app.manifest"
@@ -232,6 +246,21 @@ BEGIN
PUSHBUTTON "Cancel", IDCANCEL, 182, 68, 50, 14
END
/* an entry of the phone book (phonebook.cpp): New and Edit */
IDD_PHONEBOOK DIALOG 0, 0, 220, 76
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Entry"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Name:", -1, 8, 10, 54, 8
EDITTEXT IDC_P_NAME, 64, 8, 148, 12, ES_AUTOHSCROLL
LTEXT "&Phone number:", -1, 8, 28, 54, 8
EDITTEXT IDC_P_NUMBER, 64, 26, 148, 12, ES_AUTOHSCROLL
LTEXT "A number, or a SIP address (sip:user@host).", -1, 64, 41, 148, 8
DEFPUSHBUTTON "OK", IDOK, 108, 56, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 162, 56, 50, 14
END
/* the Modem menu's Terminal Settings, as HyperTerminal has them, for the
terminal of the page shown (the Remote page's, else the modem's) */
IDD_TERMSET DIALOG 0, 0, 284, 232
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

+4 -1
View File
@@ -17,5 +17,8 @@ set(DMODEM_WIN_SOURCES
ascii.cpp
termset.cpp
calls.cpp
ports.cpp)
phonebook.cpp
ports.cpp
splash.cpp
tray.cpp)
list(TRANSFORM DMODEM_WIN_SOURCES PREPEND "${CMAKE_CURRENT_LIST_DIR}/src/")
+54
View File
@@ -97,6 +97,14 @@ struct Config {
int voicemail, vm_rings, vm_max;
};
/* the version of the app, for the splash and About */
#define DMODEM_GUI_VERSION "1.0.0"
/* the start-up splash (splash.cpp): false when the command line has
-nosplash; show the splash and return when it closes */
bool splash_wanted(const char *cmd);
void splash_show(HINSTANCE inst);
/* where the app keeps its files: %APPDATA%\D-Modem, or beside the
app */
void app_data_dir(char *out, int n);
@@ -155,6 +163,8 @@ void link_embed(WPARAM w, LPARAM l);
void link_type(const char *data, int n);
/* bytes to the far end as they are (a file transfer's) */
void link_send(const char *data, int n);
/* the counts of bytes that went to the modem (tx) and came from it (rx) */
void link_traffic(unsigned long *tx, unsigned long *rx);
/* how many more bytes link_send can take now */
int link_room();
int link_command(const char *cmd, int flags, ResponseFn fn, void *data);
@@ -179,6 +189,8 @@ void link_wait(int tag, ResponseFn fn, void *data);
/* main.cpp */
void app_log(const char *line);
void app_message(const char *text); /* the status bar's */
/* the number that a data or voice call dials, for the status bar */
void app_dialling(const char *number);
/* the modem's events, the state */
void app_event(const dmc_event *ev);
void app_state();
@@ -291,6 +303,35 @@ bool call_waiting();
void call_wait(bool on);
void call_opened();
/* phonebook.cpp: the phone book (names and numbers, in [sessions] of
dmodem.ini), for the Modem and Phone pages and the Call dialog */
struct PhoneEntry {
char name[64];
char number[128];
};
/* Reads the entries from dmodem.ini again. */
void phonebook_reload();
/* Gives the number of entries. */
int phonebook_count();
/* Gives entry i (in the order of the names), or NULL. */
const PhoneEntry *phonebook_entry(int i);
/* Gives the index of the entry called name (case is ignored), or -1. */
int phonebook_find(const char *name);
/* Adds an entry, or changes the entry called old_name (NULL: a new
one, or the entry that has the same name). Returns false if the
phone book is full or name or number is empty. */
bool phonebook_put(const char *old_name, const char *name,
const char *number);
/* Removes the entry called name. */
void phonebook_remove(const char *name);
/* What the phone book control gives its page: the number of the entry
that the user clicked (dial false) or double-clicked (dial true). */
typedef void (*PhonebookFn)(const char *number, bool dial);
/* Makes a phone book control (a group box, the list, the New, Edit and
Remove buttons) on parent, with the id id. New starts with the text
of the control number_id of parent. */
HWND phonebook_new(HWND parent, int id, int number_id, PhonebookFn fn);
/* termset.cpp: Terminal Settings, for the modem's terminal or the
Remote page's ([terminal], [remote_terminal] in dmodem.ini) */
void termset_apply(HWND view, bool remote);
@@ -353,7 +394,20 @@ HWND settings_page_new(HWND parent);
the line settings and the modem are now; its height */
HWND pathview_new(HWND parent);
void pathview_update();
/* tray.cpp: the icon in the notification area */
void tray_init(HWND w);
/* the icon for the modem state, and its tip (ANSI) */
void tray_state(int st, const char *text);
void tray_tick();
/* the icon of a failed call (BUSY, NO CARRIER), for a short time */
void tray_failed();
/* true when the main window's message was for the icon */
bool tray_message(UINT m, WPARAM wp, LPARAM lp);
void tray_remove();
int pathview_height();
/* the headline when a step of the path needs setup ("Not ready: SIP (no
account set up)"); false when no step needs setup */
bool pathview_not_ready(char *out, int n);
void settings_page_layout(HWND page, int w, int h);
void settings_load();
void settings_clear();
+27 -88
View File
@@ -4,8 +4,9 @@
*
* calls.cpp - the Call menu's Call dialog: the sessions, as
* HyperTerminal's connection files have them (a name and a
* number, kept in [sessions] of dmodem.ini), the number to
* dial chosen or typed; and Wait for a Call (ATS0=1).
* number: the entries of the phone book, phonebook.cpp),
* the number to dial chosen or typed; and Wait for a Call
* (ATS0=1).
*/
#include <stdio.h>
#include <stdlib.h>
@@ -14,77 +15,21 @@
#include "app.h"
#include "resource.h"
#define MAX_SESSIONS 64
struct Session {
char name[64];
char number[128];
};
static Session sessions[MAX_SESSIONS];
static int n_sessions;
static char *dial_out; /* the number chosen, for the caller */
static int dial_max;
static void ini(char *out, int n)
{
char dir[MAX_PATH];
app_data_dir(dir, sizeof(dir));
_snprintf(out, n, "%s\\dmodem.ini", dir);
out[n - 1] = '\0';
}
static void load()
{
char path[MAX_PATH], key[32];
ini(path, sizeof(path));
n_sessions = 0;
int n = (int)GetPrivateProfileInt("sessions", "count", 0, path);
for (int i = 0; i < n && n_sessions < MAX_SESSIONS; i++) {
Session *s = &sessions[n_sessions];
_snprintf(key, sizeof(key), "name%d", i + 1);
GetPrivateProfileString("sessions", key, "", s->name, sizeof(s->name), path);
_snprintf(key, sizeof(key), "number%d", i + 1);
GetPrivateProfileString("sessions", key, "", s->number, sizeof(s->number), path);
if (s->name[0])
n_sessions++;
}
}
static void save()
{
char path[MAX_PATH], key[32], v[16];
ini(path, sizeof(path));
/* (the section written again: no entries left from before) */
WritePrivateProfileString("sessions", NULL, NULL, path);
_snprintf(v, sizeof(v), "%d", n_sessions);
WritePrivateProfileString("sessions", "count", v, path);
for (int i = 0; i < n_sessions; i++) {
_snprintf(key, sizeof(key), "name%d", i + 1);
WritePrivateProfileString("sessions", key, sessions[i].name, path);
_snprintf(key, sizeof(key), "number%d", i + 1);
WritePrivateProfileString("sessions", key, sessions[i].number, path);
}
}
static int find(const char *name)
{
for (int i = 0; i < n_sessions; i++)
if (!lstrcmpi(sessions[i].name, name))
return i;
return -1;
}
/* Fills the Session box with the names of the phone book, sel typed. */
static void fill(HWND d, const char *sel)
{
HWND c = GetDlgItem(d, IDC_C_NAME);
SendMessage(c, CB_RESETCONTENT, 0, 0);
for (int i = 0; i < n_sessions; i++)
SendMessage(c, CB_ADDSTRING, 0, (LPARAM)sessions[i].name);
for (int i = 0; i < phonebook_count(); i++)
SendMessage(c, CB_ADDSTRING, 0, (LPARAM)phonebook_entry(i)->name);
SetWindowText(c, sel);
}
/* the session chosen in the list: its number */
/* Puts the number of the session chosen in the list in the Phone
number box. */
static void picked(HWND d)
{
int i = (int)SendDlgItemMessage(d, IDC_C_NAME, CB_GETCURSEL, 0, 0);
@@ -92,20 +37,22 @@ static void picked(HWND d)
if (i < 0)
return;
SendDlgItemMessage(d, IDC_C_NAME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)name);
int k = find(name);
int k = phonebook_find(name);
if (k >= 0)
SetDlgItemText(d, IDC_C_NUMBER, sessions[k].number);
SetDlgItemText(d, IDC_C_NUMBER, phonebook_entry(k)->number);
}
/* The Call dialog: a session chosen or typed, saved or deleted; Call
gives its number to the caller. */
static INT_PTR CALLBACK call_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
{
(void)lp;
char name[64], number[128];
switch (m) {
case WM_INITDIALOG:
fill(d, n_sessions ? sessions[0].name : "");
if (n_sessions)
SetDlgItemText(d, IDC_C_NUMBER, sessions[0].number);
fill(d, phonebook_count() ? phonebook_entry(0)->name : "");
if (phonebook_count())
SetDlgItemText(d, IDC_C_NUMBER, phonebook_entry(0)->number);
return TRUE;
case WM_COMMAND:
GetDlgItemText(d, IDC_C_NAME, name, sizeof(name));
@@ -115,36 +62,22 @@ static INT_PTR CALLBACK call_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
if (HIWORD(wp) == CBN_SELCHANGE)
picked(d);
return TRUE;
case IDC_C_SAVE: {
case IDC_C_SAVE:
if (!name[0] || !number[0]) {
MessageBox(d, "Type a name and a number to save the session.",
"Call", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
int k = find(name);
if (k < 0) {
if (n_sessions >= MAX_SESSIONS)
return TRUE;
k = n_sessions++;
}
_snprintf(sessions[k].name, sizeof(sessions[k].name), "%s", name);
_snprintf(sessions[k].number, sizeof(sessions[k].number), "%s", number);
save();
phonebook_put(name, name, number);
fill(d, name);
return TRUE;
}
case IDC_C_DELETE: {
int k = find(name);
if (k < 0)
case IDC_C_DELETE:
if (phonebook_find(name) < 0)
return TRUE;
memmove(&sessions[k], &sessions[k + 1],
(size_t)(n_sessions - k - 1) * sizeof(Session));
n_sessions--;
save();
phonebook_remove(name);
fill(d, "");
SetDlgItemText(d, IDC_C_NUMBER, "");
return TRUE;
}
case IDOK:
if (!number[0]) {
MessageBox(d, "Type a number or a SIP address (sip:user@host) to call.",
@@ -164,9 +97,11 @@ static INT_PTR CALLBACK call_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
return FALSE;
}
/* Shows the Call dialog. Returns true and the number in number when the
user pushes Call. */
bool call_dialog(HWND parent, char *number, int n)
{
load();
phonebook_reload();
dial_out = number;
dial_max = n;
return DialogBoxParam(app.inst, MAKEINTRESOURCE(IDD_CALL), parent,
@@ -175,11 +110,13 @@ bool call_dialog(HWND parent, char *number, int n)
static bool waiting;
/* Gives true while the app waits for a call (ATS0=1). */
bool call_waiting()
{
return waiting;
}
/* The result of ATS0: a refusal stops the wait. */
static void wait_done(const dmc_event *ev, void *data)
{
(void)data;
@@ -189,6 +126,7 @@ static void wait_done(const dmc_event *ev, void *data)
}
}
/* Starts (on) or stops the wait for a call: ATS0=1 or ATS0=0. */
void call_wait(bool on)
{
waiting = on;
@@ -201,6 +139,7 @@ void call_wait(bool on)
"Not waiting for a call");
}
/* Sends ATS0=1 again when the modem opens during a wait. */
void call_opened()
{
if (waiting)
+26 -2
View File
@@ -43,6 +43,9 @@ static char proc_line[1024];
static int proc_n;
static char port_out[8192]; /* what the DTE has yet to take */
static int port_out_n;
/* the counts of bytes that went to the modem and came from it, for the
icon in the notification area (tray.cpp) */
static unsigned long tx_bytes, rx_bytes;
static int connect_tries;
#ifdef DMODEM_GUI_EMBED
static dmodem_embed *embed; /* the modem built in */
@@ -446,6 +449,14 @@ static bool start_embedded()
/* (the library opens it with the C library: "/" on Linux and macOS) */
strcat(data, DIR_SEP "dmodem0.data");
e.data_file = data;
#ifdef DMODEM_EMBED_HAS_NVRAM
/* the stored profile (AT&W, ATZ), beside dmodem.ini: on Windows the
file that dmodemd uses when it runs by itself */
char nvram[MAX_PATH];
app_data_dir(nvram, sizeof(nvram) - 16);
strcat(nvram, DIR_SEP "dmodem0.nvram");
e.nvram_file = nvram;
#endif
if (!embed)
embed = dmodem_embed_new();
if (!embed)
@@ -653,8 +664,10 @@ static void port_read()
char buf[4096];
if (com != INVALID_HANDLE_VALUE) {
DWORD n = 0;
while (ReadFile(com, buf, sizeof(buf), &n, NULL) && n > 0)
while (ReadFile(com, buf, sizeof(buf), &n, NULL) && n > 0) {
rx_bytes += n;
dmc_feed(app.s, buf, (int)n);
}
}
}
@@ -690,8 +703,10 @@ void link_socket(WPARAM w, LPARAM l)
} else if (ev == FD_READ) {
char buf[4096];
int n = recv(sock, buf, sizeof(buf), 0);
if (n > 0)
if (n > 0) {
rx_bytes += (unsigned long)n;
dmc_feed(app.s, buf, n);
}
link_pump();
} else if (ev == FD_WRITE) {
port_write();
@@ -702,6 +717,14 @@ void link_socket(WPARAM w, LPARAM l)
}
}
/* Gets the counts of bytes that went to the modem (tx) and came from it
(rx) since the app started. */
void link_traffic(unsigned long *tx, unsigned long *rx)
{
*tx = tx_bytes;
*rx = rx_bytes;
}
void link_pump()
{
if (proc_out)
@@ -719,6 +742,7 @@ void link_pump()
room = (int)sizeof(buf);
if (room <= 0 || (n = dmc_output(app.s, buf, room)) <= 0)
break;
tx_bytes += (unsigned long)n;
memcpy(port_out + port_out_n, buf, n);
port_out_n += n;
port_write();
+214 -31
View File
@@ -15,6 +15,16 @@
App app;
static HWND status_bar;
/* The parts of the status bar: the call stage (or Ready / Not ready) at
the left, and the time of the stage at the right edge. A message
replaces the stage for MESSAGE_MS. */
enum { SB_STAGE, SB_TIME, SB_PARTS };
#define MESSAGE_MS 5000
/* the last message (ANSI), and when it stops (GetTickCount); 0 when no
message shows */
static char message[512];
static DWORD message_until;
static void show_state();
enum { PAGE_MODEM, PAGE_PHONE, PAGE_TERM, PAGE_REMOTE, PAGE_SETTINGS,
PAGE_STATS, PAGE_LOG, PAGES };
@@ -96,11 +106,15 @@ void to_ansi(const char *s, char *out, int n)
out[o] = '\0';
}
/* Shows a message in the stage part of the status bar for MESSAGE_MS.
After that time, the call stage shows again. */
void app_message(const char *text)
{
char a[512];
to_ansi(text, a, sizeof(a));
SendMessage(status_bar, SB_SETTEXT, 0, (LPARAM)a);
to_ansi(text, message, sizeof(message));
message_until = GetTickCount() + MESSAGE_MS;
if (!message_until)
message_until = 1;
show_state();
}
void app_log(const char *line)
@@ -108,38 +122,173 @@ void app_log(const char *line)
log_append(line);
}
/* when the call was connected (GetTickCount), 0 when not online; the
seconds the status bar shows */
/* when the call was connected (GetTickCount), 0 when not online */
static DWORD online_at;
static long online_shown = -1;
/* when the timed stage started (GetTickCount): dialling, answering, or
the call; 0 when no stage is timed. The seconds that the status bar
shows. */
static DWORD stage_at;
static long stage_shown = -1;
/* the number that the last call dials, empty when it is not known (an
ATD that the user types on the Terminal page) */
static char dial_number[128];
/* the state in the status bar, with the connect timer when online, as
HyperTerminal has it: "Online 0:01:05" */
static void show_state()
/* Keeps the number that a call dials, to show it in the status bar
while the modem dials. */
void app_dialling(const char *number)
{
char t[160];
int st = dmc_state(app.s);
if (link_running() && st == DMC_CLOSED) {
strcpy(t, "Starting");
} else if (online_at) {
long s = (long)((GetTickCount() - online_at) / 1000);
online_shown = s;
_snprintf(t, sizeof(t), "%s %ld:%02ld:%02ld", dmc_state_name(st),
s / 3600, s / 60 % 60, s % 60);
} else {
_snprintf(t, sizeof(t), "%s", dmc_state_name(st));
}
t[sizeof(t) - 1] = '\0';
SendMessage(status_bar, SB_SETTEXT, 1, (LPARAM)t);
_snprintf(dial_number, sizeof(dial_number), "%s", number);
dial_number[sizeof(dial_number) - 1] = '\0';
}
/* the connect timer moved on a second */
/* Gets the group of a modem state for the stage timer: 1 for dialling
or answering, 2 for a data call, 3 for a voice call, 0 for a state
with no timer. A change of group starts the timer again. */
static int timed_group(int st)
{
switch (st) {
case DMC_DIALING:
case DMC_ANSWERING:
return 1;
case DMC_ONLINE:
case DMC_ONLINE_COMMAND:
return 2;
case DMC_VOICE:
case DMC_VOICEMAIL:
return 3;
}
return 0;
}
/* Writes the connection of a data call to t: the rate and the
protocols of the CONNECT line ("CONNECT 31200/V34/LAPM" gives
" at 31200 bps V34/LAPM"). Writes an empty text when the CONNECT line
has no rate or protocols. */
static void link_text(char *t, int n)
{
t[0] = '\0';
const char *c = dmc_connect_text(app.s);
if (!c)
return;
if (!strncmp(c, "CONNECT", 7))
c += 7;
while (*c == ' ')
c++;
int rate = dmc_connect_rate(app.s);
if (rate > 0) {
while (*c >= '0' && *c <= '9')
c++;
while (*c == '/' || *c == ' ')
c++;
_snprintf(t, n, " at %d bps%s%s", rate, *c ? " " : "", c);
} else if (*c) {
_snprintf(t, n, " (%s)", c);
}
t[n - 1] = '\0';
}
/* Writes the call stage for the status bar to t: "Ready" or the reason
for "Not ready" when there is no call, else the stage of the call
("Dialling 5551234", "Ringing", "Connected" and so on). */
static void stage_text(int st, char *t, int n)
{
const char *num = dmc_caller_number(app.s);
const char *name = dmc_caller_name(app.s);
switch (st) {
case DMC_CLOSED:
if (pathview_not_ready(t, n))
return;
_snprintf(t, n, "%s", link_running() ? "Starting the modem" :
"Not ready: the modem is off");
break;
case DMC_IDLE:
if (pathview_not_ready(t, n))
return;
_snprintf(t, n, "Ready");
break;
case DMC_DIALING:
_snprintf(t, n, "Dialling%s%s", dial_number[0] ? " " : "",
dial_number);
break;
case DMC_RINGING: {
int rings = dmc_ring_count(app.s);
_snprintf(t, n, "Ringing%s%s%s%s (ring %d)",
num && *num ? ": " : "", num ? num : "",
name && *name ? " " : "", name ? name : "",
rings > 0 ? rings : 1);
break;
}
case DMC_ANSWERING:
_snprintf(t, n, "Answering");
break;
case DMC_ONLINE:
case DMC_ONLINE_COMMAND: {
char l[256];
link_text(l, sizeof(l));
_snprintf(t, n, "Connected%s%s", l,
st == DMC_ONLINE_COMMAND ? " (command mode)" : "");
break;
}
case DMC_HANGING_UP:
_snprintf(t, n, "Hanging up");
break;
case DMC_CONFIGURATOR:
_snprintf(t, n, "Busy: the configurator runs");
break;
case DMC_VOICE:
_snprintf(t, n, "Voice call");
break;
case DMC_VOICEMAIL:
_snprintf(t, n, "Taking a message");
break;
default:
_snprintf(t, n, "%s", dmc_state_name(st));
break;
}
t[n - 1] = '\0';
}
/* Shows the call stage (or a message that has not timed out) and the
timer in the status bar. The timer is "0:01:05", as HyperTerminal
shows it. */
static void show_state()
{
char t[512];
int st = dmc_state(app.s);
if (message_until && (int)(GetTickCount() - message_until) >= 0)
message_until = 0;
if (message_until)
SendMessage(status_bar, SB_SETTEXT, SB_STAGE, (LPARAM)message);
else {
stage_text(st, t, sizeof(t));
SendMessage(status_bar, SB_SETTEXT, SB_STAGE, (LPARAM)t);
}
t[0] = '\0';
if (stage_at) {
long s = (long)((GetTickCount() - stage_at) / 1000);
stage_shown = s;
/* (two tabs: the status bar aligns the text on the right) */
_snprintf(t, sizeof(t), "\t\t%ld:%02ld:%02ld", s / 3600,
s / 60 % 60, s % 60);
t[sizeof(t) - 1] = '\0';
}
SendMessage(status_bar, SB_SETTEXT, SB_TIME, (LPARAM)t);
/* (the tip of the tray icon: the stage, not a message) */
stage_text(st, t, sizeof(t));
tray_state(st, t);
}
/* Shows the status bar again when the timer moved on by a second, or
when the message timed out. */
static void state_tick()
{
if (online_at && (long)((GetTickCount() - online_at) / 1000) != online_shown)
if ((stage_at && (long)((GetTickCount() - stage_at) / 1000) !=
stage_shown) ||
(message_until && (int)(GetTickCount() - message_until) >= 0))
show_state();
}
/* Updates the pages and the status bar for the state of the modem. */
void app_state()
{
int st = dmc_state(app.s);
@@ -149,7 +298,13 @@ void app_state()
online_at = GetTickCount() ? GetTickCount() : 1;
else if (!on)
online_at = 0;
show_state();
static int group;
int g = timed_group(st);
if (g != group)
stage_at = g ? (GetTickCount() ? GetTickCount() : 1) : 0;
group = g;
if (st == DMC_IDLE)
dial_number[0] = '\0';
/* Terminal Settings: Exit program upon disconnecting */
if (was_online && !online_at && termset_exit_on_disconnect())
PostMessage(app.main, WM_CLOSE, 0, 0);
@@ -157,6 +312,9 @@ void app_state()
voice_state();
term_state();
settings_state();
/* (after settings_state: it updates the path, which tells if the
modem is ready) */
show_state();
}
void app_opened()
@@ -191,11 +349,16 @@ void app_event(const dmc_event *ev)
}
case DMC_EV_RESULT:
if (!strcmp(ev->result, "RING")) {
app_message("Ringing");
/* (the stage shows the ring and its count) */
message_until = 0;
show_state();
if (GetForegroundWindow() != app.main)
FlashWindow(app.main, TRUE);
} else if (ev->result[0]) {
} else if (ev->result[0] && strncmp(ev->result, "CONNECT", 7)) {
/* (not CONNECT: the stage shows the rate) */
app_message(ev->result);
if (!ev->ok)
tray_failed();
}
break;
case DMC_EV_CALLER:
@@ -285,8 +448,13 @@ static void layout()
RECT sb;
GetWindowRect(status_bar, &sb);
int sbh = sb.bottom - sb.top;
int parts[2] = { r.right - 200, -1 };
SendMessage(status_bar, SB_SETPARTS, 2, (LPARAM)parts);
/* the stage at the left, the timer at the right edge; the timer
ends before the size grip, which would cover it */
int grip = GetSystemMetrics(SM_CXVSCROLL);
int parts[SB_PARTS] = { r.right - grip - 80, r.right - grip };
SendMessage(status_bar, SB_SETPARTS, SB_PARTS, (LPARAM)parts);
/* (a part gets no text before it is made) */
show_state();
MoveWindow(app.tabs, 4, 4, r.right - 8, r.bottom - sbh - 8, TRUE);
RECT in = { 0, 0, r.right - 8, r.bottom - sbh - 8 };
TabCtrl_AdjustRect(app.tabs, FALSE, &in);
@@ -306,7 +474,7 @@ static void layout()
static void about()
{
MessageBox(app.main,
"D-Modem 1.0.0\r\n\r\n"
"D-Modem " DMODEM_GUI_VERSION "\r\n\r\n"
"The front panel of D-Modem, the open V.92 softmodem.\r\n"
"https://github.com/D-Modem/gui\r\n\r\n"
"Copyright (C) 2026 D-Modem Authors. AGPL-3.0-only.",
@@ -343,6 +511,7 @@ static LRESULT CALLBACK main_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
}
show_page(PAGE_MODEM);
SetTimer(w, TIMER_PUMP, 50, NULL);
tray_init(w);
app_state();
return 0;
}
@@ -402,6 +571,7 @@ static LRESULT CALLBACK main_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
char cmd[140];
_snprintf(cmd, sizeof(cmd), "ATD%s", n);
cmd[sizeof(cmd) - 1] = '\0';
app_dialling(n);
link_command(cmd, 0, call_done, NULL);
/* (the call on the Terminal page, as HyperTerminal) */
TabCtrl_SetCurSel(app.tabs, PAGE_TERM);
@@ -547,6 +717,7 @@ static LRESULT CALLBACK main_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
xfer_pump();
capture_tick();
state_tick();
tray_tick();
return 0;
case WM_APP_XFER:
xfer_message(wp, lp);
@@ -564,6 +735,7 @@ static LRESULT CALLBACK main_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
remote_ssh(lp);
return 0;
case WM_DESTROY:
tray_remove();
KillTimer(w, TIMER_PUMP);
KillTimer(w, TIMER_VOICE);
audio_stop();
@@ -574,6 +746,8 @@ static LRESULT CALLBACK main_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
PostQuitMessage(0);
return 0;
}
if (tray_message(m, wp, lp))
return 0;
return DefWindowProc(w, m, wp, lp);
}
@@ -592,6 +766,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show)
{
(void)prev;
(void)cmd;
/* (the whole command line: the picolibc start-up code gives no
cmd) */
bool splash = splash_wanted(GetCommandLineA());
app.inst = inst;
InitCommonControls();
WSADATA wsa;
@@ -636,7 +813,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show)
NULL, inst, NULL);
if (!w)
return 1;
/* the splash shows before the main window, which is ready
behind it */
if (splash)
splash_show(inst);
ShowWindow(w, show);
if (splash)
SetForegroundWindow(w);
UpdateWindow(w);
/* a modem that is set up starts at once */
if (app.cfg.line != LINE_DMODEMD || config_sip_ready(&app.cfg) ||
+17 -1
View File
@@ -117,6 +117,7 @@ static void modem_command(HWND page, int id, int code)
}
_snprintf(cmd, sizeof(cmd), "ATD%s", n);
cmd[sizeof(cmd) - 1] = '\0';
app_dialling(n);
link_command(cmd, 0, dialled, NULL);
break;
}
@@ -136,6 +137,15 @@ static void modem_command(HWND page, int id, int code)
}
}
/* The phone book's number to the Number box; dial dials it when the
modem is idle. */
static void modem_picked(const char *number, bool dial)
{
SetDlgItemText(modem, IDC_NUMBER, number);
if (dial && dmc_state(app.s) == DMC_IDLE)
modem_command(modem, IDC_DIAL, BN_CLICKED);
}
HWND modem_page_new(HWND parent)
{
modem = page_new(parent, modem_command);
@@ -156,6 +166,7 @@ HWND modem_page_new(HWND parent)
make_child("BUTTON", "&Start", WS_TABSTOP, modem, IDC_RUN);
make_child("BUTTON", "&Line Settings...", WS_TABSTOP, modem,
IDC_LINEBTN);
phonebook_new(modem, IDC_PHONEBOOK, IDC_NUMBER, modem_picked);
return modem;
}
@@ -166,7 +177,6 @@ static void place(HWND page, int id, int x, int y, int w, int h)
void modem_page_layout(HWND page, int w, int h)
{
(void)h;
int m = 12, bw = 90, bh = 24, x = m, y = m;
int inner = w - 2 * m;
if (inner > 560)
@@ -187,6 +197,12 @@ void modem_page_layout(HWND page, int w, int h)
place(page, IDC_DEVICE, x + 12, y + 48, inner - bw - 36, 20);
place(page, IDC_RUN, x + inner - bw - 12, y + 22, bw, bh);
place(page, IDC_LINEBTN, x + inner - 130 - 12, y + 66, 130, bh);
y += 116;
/* the phone book, the rest */
int ph = h - y - m;
if (ph < 120)
ph = 120;
place(page, IDC_PHONEBOOK, x, y, inner, ph);
}
/*
+12
View File
@@ -217,3 +217,15 @@ void pathview_update()
SetWindowText(view, a); /* (for a screen reader) */
InvalidateRect(view, NULL, FALSE);
}
/* Gets the reason that the modem cannot make a call: the headline of
the path when a step needs setup, for example "Not ready: SIP (no
account set up)". Writes the text (ANSI) to out. Returns false when
no step needs setup. */
bool pathview_not_ready(char *out, int n)
{
if (!path || !dmc_path_needs_setup(path))
return false;
to_ansi(dmc_path_headline(path), out, n);
return true;
}
+503
View File
@@ -0,0 +1,503 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* phonebook.cpp - the phone book: names and numbers, kept in [sessions]
* of dmodem.ini (the sessions of the Call dialog), and
* the phone book control of the Modem and Phone pages.
*
* The control is a group box with a list (Name, Number) and the New,
* Edit and Remove buttons. A click on an entry puts its number in the
* page's Number box; a double-click (or Enter) dials it. All the
* controls show the same entries: a change in one shows in each.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "app.h"
#include "resource.h"
#define MAX_ENTRIES 64
#define MAX_VIEWS 4
static PhoneEntry entries[MAX_ENTRIES];
static int n_entries;
static bool loaded;
/* the controls, and the function of each that gets a number */
struct View {
HWND w;
PhonebookFn fn;
};
static View views[MAX_VIEWS];
static int n_views;
/* Puts the path of dmodem.ini into out. */
static void ini(char *out, int n)
{
char dir[MAX_PATH];
app_data_dir(dir, sizeof(dir));
_snprintf(out, n, "%s\\dmodem.ini", dir);
out[n - 1] = '\0';
}
/* Reads the entries from [sessions] of dmodem.ini. */
void phonebook_reload()
{
char path[MAX_PATH], key[32];
ini(path, sizeof(path));
n_entries = 0;
int n = (int)GetPrivateProfileInt("sessions", "count", 0, path);
for (int i = 0; i < n && n_entries < MAX_ENTRIES; i++) {
PhoneEntry *e = &entries[n_entries];
_snprintf(key, sizeof(key), "name%d", i + 1);
GetPrivateProfileString("sessions", key, "", e->name,
sizeof(e->name), path);
_snprintf(key, sizeof(key), "number%d", i + 1);
GetPrivateProfileString("sessions", key, "", e->number,
sizeof(e->number), path);
if (e->name[0])
n_entries++;
}
loaded = true;
}
/* Reads the entries one time, before the first use. */
static void need()
{
if (!loaded)
phonebook_reload();
}
/* Writes the entries to [sessions] of dmodem.ini. */
static void save()
{
char path[MAX_PATH], key[32], v[16];
ini(path, sizeof(path));
/* (the section written again: no entries left from before) */
WritePrivateProfileString("sessions", NULL, NULL, path);
_snprintf(v, sizeof(v), "%d", n_entries);
WritePrivateProfileString("sessions", "count", v, path);
for (int i = 0; i < n_entries; i++) {
_snprintf(key, sizeof(key), "name%d", i + 1);
WritePrivateProfileString("sessions", key, entries[i].name, path);
_snprintf(key, sizeof(key), "number%d", i + 1);
WritePrivateProfileString("sessions", key, entries[i].number,
path);
}
}
/* Compares two entries by name, for qsort (case is ignored). */
static int by_name(const void *a, const void *b)
{
return lstrcmpi(((const PhoneEntry *)a)->name,
((const PhoneEntry *)b)->name);
}
/* Gives the number of entries (see app.h). */
int phonebook_count()
{
need();
return n_entries;
}
/* Gives entry i, or NULL (see app.h). */
const PhoneEntry *phonebook_entry(int i)
{
need();
return i >= 0 && i < n_entries ? &entries[i] : NULL;
}
/* Gives the index of the entry called name, or -1 (see app.h). */
int phonebook_find(const char *name)
{
need();
for (int i = 0; i < n_entries; i++)
if (!lstrcmpi(entries[i].name, name))
return i;
return -1;
}
static void refresh_all(const char *select);
/* Adds or changes an entry, then writes the phone book and fills each
control again (see app.h). */
bool phonebook_put(const char *old_name, const char *name, const char *number)
{
need();
if (!name[0] || !number[0])
return false;
int k = old_name ? phonebook_find(old_name) : -1;
int same = phonebook_find(name);
/* (a new name that another entry has: that entry changes) */
if (k < 0 || (same >= 0 && same != k)) {
if (same >= 0 && k >= 0) {
memmove(&entries[k], &entries[k + 1],
(size_t)(n_entries - k - 1) * sizeof(PhoneEntry));
n_entries--;
same = phonebook_find(name);
}
k = same;
}
if (k < 0) {
if (n_entries >= MAX_ENTRIES)
return false;
k = n_entries++;
}
_snprintf(entries[k].name, sizeof(entries[k].name), "%s", name);
entries[k].name[sizeof(entries[k].name) - 1] = '\0';
_snprintf(entries[k].number, sizeof(entries[k].number), "%s", number);
entries[k].number[sizeof(entries[k].number) - 1] = '\0';
qsort(entries, (size_t)n_entries, sizeof(PhoneEntry), by_name);
save();
refresh_all(name);
return true;
}
/* Removes the entry called name, then writes the phone book and fills
each control again. */
void phonebook_remove(const char *name)
{
int k = phonebook_find(name);
if (k < 0)
return;
memmove(&entries[k], &entries[k + 1],
(size_t)(n_entries - k - 1) * sizeof(PhoneEntry));
n_entries--;
save();
refresh_all(NULL);
}
/*
* the New and Edit dialog
*/
/* the entry that the dialog changes: its name before ("" for a new
one), then the name and number typed */
static PhoneEntry editing;
static char editing_old[64];
/* The dialog of one entry: OK keeps the name and number typed. */
static INT_PTR CALLBACK entry_proc(HWND d, UINT m, WPARAM wp, LPARAM lp)
{
(void)lp;
switch (m) {
case WM_INITDIALOG:
SetWindowText(d, editing_old[0] ? "Edit Entry" : "New Entry");
SendDlgItemMessage(d, IDC_P_NAME, EM_LIMITTEXT,
sizeof(editing.name) - 1, 0);
SendDlgItemMessage(d, IDC_P_NUMBER, EM_LIMITTEXT,
sizeof(editing.number) - 1, 0);
SetDlgItemText(d, IDC_P_NAME, editing.name);
SetDlgItemText(d, IDC_P_NUMBER, editing.number);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wp)) {
case IDOK:
GetDlgItemText(d, IDC_P_NAME, editing.name,
sizeof(editing.name));
GetDlgItemText(d, IDC_P_NUMBER, editing.number,
sizeof(editing.number));
if (!editing.name[0] || !editing.number[0]) {
MessageBox(d, "Type a name and a number.",
"Phone Book", MB_OK | MB_ICONINFORMATION);
return TRUE;
}
EndDialog(d, IDOK);
return TRUE;
case IDCANCEL:
EndDialog(d, IDCANCEL);
return TRUE;
}
break;
}
return FALSE;
}
/* Shows the dialog for the entry called name (NULL: a new entry, with
number as its number) and keeps what the user typed. */
static void edit_entry(HWND owner, const char *name, const char *number)
{
memset(&editing, 0, sizeof(editing));
editing_old[0] = '\0';
int k = name ? phonebook_find(name) : -1;
if (k >= 0) {
editing = entries[k];
strcpy(editing_old, entries[k].name);
} else if (number) {
_snprintf(editing.number, sizeof(editing.number), "%s", number);
editing.number[sizeof(editing.number) - 1] = '\0';
}
if (DialogBoxParam(app.inst, MAKEINTRESOURCE(IDD_PHONEBOOK), owner,
entry_proc, 0) != IDOK)
return;
if (!phonebook_put(editing_old[0] ? editing_old : NULL, editing.name,
editing.number))
MessageBox(owner, "The phone book is full.", "Phone Book",
MB_OK | MB_ICONINFORMATION);
}
/*
* the control
*/
static void fit_columns(HWND lv);
/* Gives the view of the control w, or NULL. */
static View *view_of(HWND w)
{
for (int i = 0; i < n_views; i++)
if (views[i].w == w)
return &views[i];
return NULL;
}
/* Gives the name of the entry selected in the control w, or NULL. */
static const char *selected(HWND w)
{
HWND lv = GetDlgItem(w, IDC_P_LIST);
int r = ListView_GetNextItem(lv, -1, LVNI_SELECTED);
const PhoneEntry *e = phonebook_entry(r);
return e ? e->name : NULL;
}
/* Enables Edit and Remove when an entry is selected. */
static void buttons(HWND w)
{
bool sel = selected(w) != NULL;
EnableWindow(GetDlgItem(w, IDC_P_EDIT), sel);
EnableWindow(GetDlgItem(w, IDC_P_REMOVE), sel);
}
/* Fills the list of the control w with the entries, select (if not
NULL) selected. */
static void fill(HWND w, const char *select)
{
HWND lv = GetDlgItem(w, IDC_P_LIST);
ListView_DeleteAllItems(lv);
for (int i = 0; i < n_entries; i++) {
char name[80], number[160];
to_ansi(entries[i].name, name, sizeof(name));
to_ansi(entries[i].number, number, sizeof(number));
LVITEM it;
memset(&it, 0, sizeof(it));
it.mask = LVIF_TEXT;
it.iItem = i;
it.pszText = name;
ListView_InsertItem(lv, &it);
ListView_SetItemText(lv, i, 1, number);
if (select && !lstrcmpi(entries[i].name, select)) {
ListView_SetItemState(lv, i, LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED);
ListView_EnsureVisible(lv, i, FALSE);
}
}
fit_columns(lv);
buttons(w);
}
/* Fills each control again, select (if not NULL) selected. */
static void refresh_all(const char *select)
{
for (int i = 0; i < n_views; i++)
fill(views[i].w, select);
}
/* Gives the number of the entry selected in w to the page: dial true
dials it. */
static void pick(HWND w, bool dial)
{
View *v = view_of(w);
const char *name = selected(w);
int k = name ? phonebook_find(name) : -1;
if (v && v->fn && k >= 0)
v->fn(entries[k].number, dial);
}
/* the list's window procedure before ours (one for all the lists) */
static WNDPROC list_old;
/* The list of a control: Enter dials the entry selected, Delete removes
it. */
static LRESULT CALLBACK list_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
{
if (m == WM_KEYDOWN && wp == VK_RETURN) {
pick(GetParent(w), true);
return 0;
}
if (m == WM_GETDLGCODE && lp) {
MSG *msg = (MSG *)lp;
if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN)
return DLGC_WANTMESSAGE;
}
return CallWindowProc(list_old, w, m, wp, lp);
}
/* Sets the widths of the columns of the list lv to fill its client
area, so that the list has no horizontal scroll bar. */
static void fit_columns(HWND lv)
{
RECT r;
GetClientRect(lv, &r);
int cw = r.right - r.left;
if (cw < 40)
return;
int nw = cw * 45 / 100;
ListView_SetColumnWidth(lv, 0, nw);
ListView_SetColumnWidth(lv, 1, cw - nw);
}
/* Puts the parts of the control w (cw by ch pixels) in their places:
the buttons at the right of the list when the control is wide, else
below it. */
static void layout(HWND w, int cw, int ch)
{
int bw = 80, bh = 24;
MoveWindow(GetDlgItem(w, IDC_P_BOX), 0, 0, cw, ch, TRUE);
HWND lv = GetDlgItem(w, IDC_P_LIST);
int ids[3] = { IDC_P_NEW, IDC_P_EDIT, IDC_P_REMOVE };
if (cw >= 400) {
int lh = ch - 22 - 12;
if (lh < 3 * (bh + 6))
lh = 3 * (bh + 6);
MoveWindow(lv, 12, 22, cw - 24 - bw - 12, lh, TRUE);
for (int i = 0; i < 3; i++)
MoveWindow(GetDlgItem(w, ids[i]), cw - 12 - bw,
22 + i * (bh + 6), bw, bh, TRUE);
} else {
int lh = ch - 22 - bh - 20;
if (lh < 30)
lh = 30;
MoveWindow(lv, 12, 22, cw - 24, lh, TRUE);
int x = 12, gap = 6;
bw = (cw - 24 - 2 * gap) / 3;
if (bw > 80)
bw = 80;
for (int i = 0; i < 3; i++, x += bw + gap)
MoveWindow(GetDlgItem(w, ids[i]), x, 22 + lh + 8, bw, bh,
TRUE);
}
fit_columns(lv);
}
/* The window procedure of the control: its buttons and its list. */
static LRESULT CALLBACK book_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
{
switch (m) {
case WM_COMMAND:
switch (LOWORD(wp)) {
case IDC_P_NEW: {
/* (the number that the page has now, as the start) */
char n[128];
n[0] = '\0';
GetWindowText(GetDlgItem(GetParent(w),
(int)GetWindowLongPtr(w, GWLP_USERDATA)),
n, sizeof(n));
edit_entry(app.main, NULL, n);
return 0;
}
case IDC_P_EDIT:
if (selected(w)) {
char name[64];
strcpy(name, selected(w));
edit_entry(app.main, name, NULL);
}
return 0;
case IDC_P_REMOVE:
if (selected(w)) {
char name[64], q[128];
strcpy(name, selected(w));
_snprintf(q, sizeof(q), "Remove %s from the phone "
"book?", name);
q[sizeof(q) - 1] = '\0';
if (MessageBox(app.main, q, "Phone Book",
MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
phonebook_remove(name);
}
return 0;
}
return 0;
case WM_NOTIFY: {
NMHDR *h = (NMHDR *)lp;
if (h->idFrom != IDC_P_LIST)
break;
if (h->code == NM_DBLCLK) {
pick(w, true);
} else if (h->code == LVN_ITEMCHANGED) {
NMLISTVIEW *nl = (NMLISTVIEW *)lp;
if ((nl->uNewState & LVIS_SELECTED) &&
!(nl->uOldState & LVIS_SELECTED))
pick(w, false);
buttons(w);
}
return 0;
}
case WM_SIZE:
layout(w, LOWORD(lp), HIWORD(lp));
return 0;
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
case WM_DRAWITEM:
return SendMessage(GetParent(w), m, wp, lp);
case WM_DESTROY:
for (int i = 0; i < n_views; i++)
if (views[i].w == w) {
views[i] = views[--n_views];
break;
}
break;
}
return DefWindowProc(w, m, wp, lp);
}
/* Makes a phone book control on parent (see app.h). */
HWND phonebook_new(HWND parent, int id, int number_id, PhonebookFn fn)
{
static bool registered;
if (!registered) {
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = book_proc;
wc.hInstance = app.inst;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszClassName = "DModemPhonebook";
RegisterClass(&wc);
registered = true;
}
need();
HWND w = CreateWindowEx(WS_EX_CONTROLPARENT, "DModemPhonebook", "",
WS_CHILD | WS_VISIBLE, 0, 0, 10, 10, parent,
(HMENU)(INT_PTR)id, app.inst, NULL);
/* (the page's Number box, for New) */
SetWindowLongPtr(w, GWLP_USERDATA, (LONG_PTR)number_id);
make_child("BUTTON", "Phone Book", BS_GROUPBOX, w, IDC_P_BOX);
HWND lv = make_child(WC_LISTVIEW, "", WS_TABSTOP | LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS, w, IDC_P_LIST,
WS_EX_CLIENTEDGE);
ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT);
LVCOLUMN c;
memset(&c, 0, sizeof(c));
c.mask = LVCF_TEXT | LVCF_WIDTH;
c.pszText = (char *)"Name";
c.cx = 140;
ListView_InsertColumn(lv, 0, &c);
c.pszText = (char *)"Number";
c.cx = 160;
ListView_InsertColumn(lv, 1, &c);
WNDPROC old = (WNDPROC)SetWindowLongPtr(lv, GWLP_WNDPROC,
(LONG_PTR)list_proc);
if (!list_old)
list_old = old;
make_child("BUTTON", "Ne&w...", WS_TABSTOP, w, IDC_P_NEW);
make_child("BUTTON", "&Edit...", WS_TABSTOP, w, IDC_P_EDIT);
make_child("BUTTON", "Remo&ve", WS_TABSTOP, w, IDC_P_REMOVE);
if (n_views < MAX_VIEWS) {
views[n_views].w = w;
views[n_views].fn = fn;
n_views++;
}
fill(w, NULL);
return w;
}
+118
View File
@@ -13,6 +13,12 @@
* USB maker and product of each port. A MultiTech MT9234MU with no
* firmware has no port: ports_problem() tells you what to do.
* - macOS (winport/): the /dev/cu.* devices.
* - Haiku (winport/): the devices in /dev/ports: pc_serial0 and the
* other ports of the computer, and usb0 and the other USB serial
* ports and USB modems (CDC-ACM) of the usb_serial driver, with the
* USB maker and product of each one from the USB Kit
* (ports_haiku.cpp). A CDC-ACM device that takes AT commands is a
* modem.
*/
#include "app.h"
@@ -282,6 +288,118 @@ void ports_problem(char *out, int n)
out[0] = '\0';
}
#elif defined(__HAIKU__)
#include "ports_haiku.h"
/* the directory of the serial ports (a test can give another one) */
#ifndef PORTS_DEVDIR
#define PORTS_DEVDIR "/dev/ports"
#endif
/* Compares two port names for qsort: in the order of their names. */
static int by_name(const void *a, const void *b)
{
return strcmp(((const PortInfo *)a)->name, ((const PortInfo *)b)->name);
}
/* Gives the ports of /dev/ports in the order of their names, with the
names of their USB devices and the CDC-ACM modems from the USB Kit. */
int ports_list(PortInfo *out, int max)
{
int count = 0;
DIR *d = opendir(PORTS_DEVDIR);
if (!d)
return 0;
struct dirent *e;
while ((e = readdir(d)) != NULL) {
const char *n = e->d_name;
if (n[0] == '.')
continue;
char path[64];
_snprintf(path, sizeof(path), PORTS_DEVDIR "/%s", n);
path[sizeof(path) - 1] = '\0';
/* (usb_serial names each USB port usbN: a serial adapter
or a CDC-ACM modem; the ports of the computer are
pc_serialN) */
count = add(out, count, max, path,
!strncmp(n, "usb", 3) ? "USB serial port or modem" :
!strncmp(n, "pc_serial", 9) ? "Serial port" : NULL,
0);
}
closedir(d);
/* (the order of COM1, COM2 and on in clang-retro MFC) */
qsort(out, (size_t)count, sizeof(out[0]), by_name);
/* The USB devices with a usbN port, in the order of their places
on the buses, which is the order that usb_serial numbers them
in when the computer starts. When there are as many devices as
usbN ports, each port gets the maker, the product and the modem
flag of its device. */
HaikuUsbSerial usb[32];
int n_usb = haiku_usb_serial(usb, 32), n_serial = 0;
for (int i = 0; i < n_usb; i++)
if (usb[i].has_port)
usb[n_serial++] = usb[i];
int n_ports = 0;
for (int i = 0; i < count; i++)
if (!strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
n_ports++;
if (n_serial > 0 && n_serial == n_ports) {
int k = 0;
for (int i = 0; i < count; i++) {
if (strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
continue;
if (usb[k].desc[0])
copy(out[i].desc, usb[k].desc, sizeof(out[i].desc));
const char *mt = NULL;
for (int m = 0; m < N_MULTITECH; m++) {
char pid[8];
_snprintf(pid, sizeof(pid), "%04x", usb[k].product);
pid[sizeof(pid) - 1] = '\0';
if (usb[k].vendor == 0x06e0 && !_stricmp(pid, multitech[m].product))
mt = multitech[m].name;
}
if (mt)
copy(out[i].desc, mt, sizeof(out[i].desc));
out[i].modem = usb[k].modem || mt;
k++;
}
}
modems_first(out, count);
return count;
}
/* Tells why a modem that is connected has no port on Haiku (the
MultiTech MT9234MU has no driver), or gives an empty string. */
void ports_problem(char *out, int n)
{
if (n <= 0)
return;
out[0] = '\0';
/* A MultiTech modem with no usbN port: usb_serial has no driver
for its USB UART (a TI TUSB3410). */
HaikuUsbSerial usb[32];
int n_usb = haiku_usb_serial(usb, 32);
for (int i = 0; i < n_usb; i++) {
if (usb[i].vendor != 0x06e0 || usb[i].has_port)
continue;
for (int m = 0; m < N_MULTITECH; m++) {
char pid[8];
_snprintf(pid, sizeof(pid), "%04x", usb[i].product);
pid[sizeof(pid) - 1] = '\0';
if (_stricmp(pid, multitech[m].product))
continue;
_snprintf(out, (size_t)n,
"%s: Haiku has no serial port driver for "
"this modem. Use a modem with a serial port, "
"or a CDC-ACM USB modem.", multitech[m].name);
out[n - 1] = '\0';
return;
}
}
}
#else /* Linux */
/* the root of sysfs (a test can give another one) */
+115
View File
@@ -0,0 +1,115 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* ports_haiku.cpp - the USB serial devices of a Haiku computer, from
* the USB Kit, for ports.cpp ("Look for a modem").
*
* This file uses Haiku's headers and none of the Windows headers (their
* types clash). ports.cpp calls haiku_usb_serial() and matches the
* devices to the usbN ports of the usb_serial driver.
*/
#if defined(__HAIKU__)
#include "ports_haiku.h"
#include <USBKit.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <algorithm>
#include <string>
#include <vector>
/* The vendors of the USB serial adapters that usb_serial knows: FTDI,
KLSI, Prolific, Silicon Labs and WinChipHead */
static const uint16 serial_vendors[] = { 0x0403, 0x05e9, 0x067b, 0x10c4, 0x1a86 };
/* Gives the paths of the USB devices under dir (/dev/bus/usb), in the
order of their names, each hub with the devices on it after it. */
static void walk(const std::string &dir, std::vector<std::string> *out)
{
DIR *d = opendir(dir.c_str());
if (!d)
return;
std::vector<std::string> names;
struct dirent *e;
while ((e = readdir(d)) != NULL)
if (e->d_name[0] != '.')
names.push_back(e->d_name);
closedir(d);
std::sort(names.begin(), names.end());
for (const std::string &n : names) {
std::string p = dir + "/" + n;
struct stat st;
if (stat(p.c_str(), &st) != 0)
continue;
if (S_ISDIR(st.st_mode))
walk(p, out);
else if (n != "hub")
out->push_back(p);
}
}
/* Tells if a device has a CDC-ACM interface (class 2, subclass 2), and
if that interface takes AT commands (protocol 1, V.250): a modem. */
static bool acm(const BUSBDevice &dev, bool *at)
{
*at = false;
bool found = dev.Class() == 2 && dev.Subclass() == 2;
if (found && dev.Protocol() == 1)
*at = true;
const BUSBConfiguration *c = dev.ActiveConfiguration();
if (!c && dev.CountConfigurations() > 0)
c = dev.ConfigurationAt(0);
for (uint32 i = 0; c && i < c->CountInterfaces(); i++) {
const BUSBInterface *itf = c->InterfaceAt(i);
if (!itf || itf->Class() != 2 || itf->Subclass() != 2)
continue;
found = true;
if (itf->Protocol() == 1)
*at = true;
}
return found;
}
/* Gives the USB devices (at most max, hubs not included) in the order
of their places on the USB buses, with the vendors and products, if
usb_serial makes a port for each, and if each is a modem. */
int haiku_usb_serial(HaikuUsbSerial *out, int max)
{
std::vector<std::string> paths;
walk("/dev/bus/usb", &paths);
int n = 0;
for (const std::string &p : paths) {
if (n >= max)
break;
BUSBDevice dev(p.c_str());
if (dev.InitCheck() != B_OK || dev.IsHub())
continue;
bool at = false;
bool is_acm = acm(dev, &at);
bool serial = is_acm;
for (uint16 v : serial_vendors)
if (dev.VendorID() == v)
serial = true;
HaikuUsbSerial *s = &out[n];
memset(s, 0, sizeof(*s));
s->vendor = dev.VendorID();
s->product = dev.ProductID();
s->has_port = serial;
s->modem = at;
const char *maker = dev.ManufacturerString();
const char *product = dev.ProductString();
snprintf(s->desc, sizeof(s->desc), "%s%s%s", maker ? maker : "",
maker && *maker && product && *product ? " " : "",
product ? product : "");
n++;
}
return n;
}
#endif
+24
View File
@@ -0,0 +1,24 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* ports_haiku.h - the USB devices of a Haiku computer (ports_haiku.cpp),
* for ports.cpp. It uses neither the Windows headers
* nor Haiku's, so that both files can include it.
*/
#ifndef DMODEM_PORTS_HAIKU_H
#define DMODEM_PORTS_HAIKU_H
/* A USB device, as the USB Kit tells it */
typedef struct HaikuUsbSerial {
unsigned short vendor, product;
int has_port; /* usb_serial makes a usbN port for it */
int modem; /* a CDC-ACM interface that takes AT commands */
char desc[128]; /* its maker and product, from the device */
} HaikuUsbSerial;
/* Gives the USB devices (at most max, hubs not included), in the order
of their places on the USB buses. */
int haiku_usb_serial(HaikuUsbSerial *out, int max);
#endif
-11
View File
@@ -71,17 +71,6 @@ static HANDLE proc;
#endif
#define ATTR_PSEUDOCONSOLE 0x00020016
/* (the Win32 layer of clang-retro MFC has no console API and no COORD:
the Windows app on another system with no SSH, as on the classic Mac
OS. There, the look-up of ConPTY fails and SSH is not available.) */
#if defined(DMODEM_WINPORT) && !defined(_COORD_DEFINED)
#define _COORD_DEFINED
typedef struct _COORD {
SHORT X;
SHORT Y;
} COORD;
#endif
typedef long (WINAPI *CreatePCFn)(COORD, HANDLE, HANDLE, DWORD, void **);
typedef long (WINAPI *ResizePCFn)(void *, COORD);
typedef void (WINAPI *ClosePCFn)(void *);
+28
View File
@@ -9,6 +9,18 @@
#define IDI_APP 1
#define IDR_MENU 100
#define IDB_SPLASH_K 101 /* the logo of the splash, on black */
#define IDB_SPLASH_W 102 /* the logo of the splash, on white */
/* the icons of the notification area (tray.cpp): a call that starts
(three frames), and a connected call (data out, data in) */
#define IDI_TRAY_DIAL0 110
#define IDI_TRAY_DIAL1 111
#define IDI_TRAY_DIAL2 112
#define IDI_TRAY_NET00 113
#define IDI_TRAY_NET01 114
#define IDI_TRAY_NET10 115
#define IDI_TRAY_NET11 116
#define IDI_TRAY_FAIL 117 /* a call failed */
#define IDM_LINE 200
#define IDM_START 201
@@ -239,4 +251,20 @@
#define IDC_T_TELNETLABEL 1263
#define IDC_T_EXIT 1264
/* the phone book (phonebook.cpp): the control, its parts, the dialog of
an entry; the control on the Modem and Phone pages */
#define IDD_PHONEBOOK 1280
#define IDC_P_NAME 1281
#define IDC_P_NUMBER 1282
#define IDC_P_BOX 1283
#define IDC_P_LIST 1284
#define IDC_P_NEW 1285
#define IDC_P_EDIT 1286
#define IDC_P_REMOVE 1287
#define IDC_PHONEBOOK 413
#define IDC_V_PHONEBOOK 1024
/* the Settings page's NVRAM buttons (AT&W, ATZ) */
#define IDC_NVSAVE 608
#define IDC_NVLOAD 609
#endif
+32 -3
View File
@@ -165,6 +165,8 @@ void settings_state()
bool idle = dmc_state(app.s) == DMC_IDLE && model;
EnableWindow(GetDlgItem(page, IDC_CHANGE), idle);
EnableWindow(GetDlgItem(page, IDC_DEFAULTS), idle);
EnableWindow(GetDlgItem(page, IDC_NVSAVE), idle);
EnableWindow(GetDlgItem(page, IDC_NVLOAD), idle);
EnableWindow(GetDlgItem(page, IDC_RELOAD),
dmc_state(app.s) != DMC_CLOSED);
}
@@ -300,14 +302,25 @@ static void change_selected()
}
}
/* The result of AT&F or ATZ: the settings read again. */
static void reset_done(const dmc_event *ev, void *data)
{
(void)data;
if (!ev->ok)
app_message("The modem refused ATZ");
app_message("The modem refused the command");
settings_load();
}
/* The result of AT&W: a message on the status bar. */
static void nv_saved(const dmc_event *ev, void *data)
{
(void)data;
app_message(ev->ok ? "The settings are in the modem's NVRAM: the "
"modem uses them when it starts and after ATZ" :
"The modem cannot save its NVRAM (AT&W): the file is "
"read-only, or the modem has no NVRAM");
}
static void settings_command(HWND p, int id, int code)
{
(void)p;
@@ -326,9 +339,18 @@ static void settings_command(HWND p, int id, int code)
settings_load();
break;
case IDC_DEFAULTS:
if (MessageBox(app.main, "Put every setting back to its default "
"(ATZ)?", "D-Modem", MB_OKCANCEL |
if (MessageBox(app.main, "Put every setting back to its factory "
"default (AT&F)?", "D-Modem", MB_OKCANCEL |
MB_ICONQUESTION) == IDOK)
link_command("AT&F", 0, reset_done, NULL);
break;
case IDC_NVSAVE:
link_command("AT&W", 0, nv_saved, NULL);
break;
case IDC_NVLOAD:
if (MessageBox(app.main, "Put every setting back as the NVRAM "
"has it (ATZ)? This hangs up a call.", "D-Modem",
MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
link_command("ATZ", 0, reset_done, NULL);
break;
case IDC_KEEP:
@@ -403,6 +425,8 @@ HWND settings_page_new(HWND parent)
make_child("BUTTON", "&Change...", WS_TABSTOP, page, IDC_CHANGE);
make_child("BUTTON", "&Reload", WS_TABSTOP, page, IDC_RELOAD);
make_child("BUTTON", "&Defaults", WS_TABSTOP, page, IDC_DEFAULTS);
make_child("BUTTON", "Save to &NVRAM", WS_TABSTOP, page, IDC_NVSAVE);
make_child("BUTTON", "Load &from NVRAM", WS_TABSTOP, page, IDC_NVLOAD);
make_child("EDIT", "", WS_TABSTOP | ES_READONLY | ES_AUTOHSCROLL, page,
IDC_INIT, WS_EX_CLIENTEDGE);
make_child("BUTTON", "&Keep", WS_TABSTOP, page, IDC_KEEP);
@@ -428,6 +452,11 @@ void settings_page_layout(HWND p, int w, int h)
MoveWindow(GetDlgItem(p, IDC_CHANGE), m, y, bw, bh, TRUE);
MoveWindow(GetDlgItem(p, IDC_RELOAD), 2 * m + bw, y, bw, bh, TRUE);
MoveWindow(GetDlgItem(p, IDC_DEFAULTS), 3 * m + 2 * bw, y, bw, bh, TRUE);
/* (the NVRAM's at the right) */
int nw = 120;
MoveWindow(GetDlgItem(p, IDC_NVLOAD), w - m - nw, y, nw, bh, TRUE);
MoveWindow(GetDlgItem(p, IDC_NVSAVE), w - 2 * m - 2 * nw, y, nw, bh,
TRUE);
y += bh + m;
MoveWindow(GetDlgItem(p, IDC_INIT), m, y, w - 3 * m - bw, bh, TRUE);
MoveWindow(GetDlgItem(p, IDC_KEEP), w - m - bw, y, bw, bh, TRUE);
+312
View File
@@ -0,0 +1,312 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* splash.cpp - the start-up splash: a borderless window at the centre
* of the screen. The logo (the rainbow D, the italic
* word "D-Modem" and the rainbow pencil line under it) and
* a block of text (the version, the build date and the
* copyright) fly in from the right edge in 1.5 s. The
* splash closes at 4 s, or at a click or a key press.
* "-nosplash" on the command line skips it (main.cpp).
*
* The splash uses the colours of the user's scheme (the
* button face and the button text), as the rest of the
* app does. The logo is in two bitmaps: on black
* (res/splash-k.bmp) and on white (res/splash-w.bmp).
* The difference of the two gives the transparency of
* each pixel, so the logo is mixed with the button face
* colour one time, when the splash opens. This needs no
* alpha blend function, so it works on Windows 95. The
* text is drawn at run time. Each frame is drawn in a
* memory bitmap first, so the motion does not flicker.
*/
#include <stdlib.h>
#include <string.h>
#include "app.h"
#include "resource.h"
/* the size of the window, and where the logo and the text stop */
enum {
SPLASH_W = 480, SPLASH_H = 280,
LOGO_X = 34, LOGO_Y = 48, LOGO_W = 400, LOGO_H = 120,
TEXT_X = 48, TEXT_Y = 186,
FLY_MS = 1500, END_MS = 4000, TICK_MS = 15
};
static struct {
HBITMAP logo;
DWORD start;
bool done;
char date[16];
} sp;
/*
* splash_ease - Return the ease-out cubic value of the time t from
* 0 to 1. The motion is fast at the start and slow at the end.
*/
static double splash_ease(double t)
{
if (t < 0)
t = 0;
if (t > 1)
t = 1;
double u = 1 - t;
return 1 - u * u * u;
}
/*
* splash_offset - Return how far (in pixels) an item that stops at x
* is to the right of its stop, ms milliseconds after the start. At
* the start, the left edge of the item is at the right edge of the
* window.
*/
static int splash_offset(int x, DWORD ms)
{
return (int)((SPLASH_W - x) * (1 - splash_ease(ms / (double)FLY_MS)) + 0.5);
}
/*
* splash_build_date - Write the build date (from __DATE__, for example
* "Nov 29 2026") to out, with one space between the parts.
*/
static void splash_build_date(char *out, int n)
{
const char *d = __DATE__;
int j = 0;
for (int i = 0; d[i] && j < n - 1; i++)
if (d[i] != ' ' || (j > 0 && out[j - 1] != ' '))
out[j++] = d[i];
out[j] = '\0';
}
/*
* splash_draw - Draw the frame of the time ms on dc: the background,
* the dots, the logo and the text block.
*/
static void splash_draw(HDC dc, DWORD ms)
{
RECT r = { 0, 0, SPLASH_W, SPLASH_H };
HBRUSH bg = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
FillRect(dc, &r, bg);
DeleteObject(bg);
if (sp.logo) {
HDC mem = CreateCompatibleDC(dc);
HGDIOBJ old = SelectObject(mem, sp.logo);
BitBlt(dc, LOGO_X + splash_offset(LOGO_X, ms), LOGO_Y,
LOGO_W, LOGO_H, mem, 0, 0, SRCCOPY);
SelectObject(mem, old);
DeleteDC(mem);
}
char version[64], built[32];
_snprintf(version, sizeof(version), "Version %s", DMODEM_GUI_VERSION);
version[sizeof(version) - 1] = '\0';
_snprintf(built, sizeof(built), "Built %s", sp.date);
built[sizeof(built) - 1] = '\0';
const char *lines[] = {
version, built, "Copyright (C) 2026 D-Modem Authors",
"AGPL-3.0-only"
};
int x = TEXT_X + splash_offset(TEXT_X, ms);
/* the dialog font of the system; the version line is bold */
HGDIOBJ oldf = SelectObject(dc, app.font);
TEXTMETRIC tm;
GetTextMetrics(dc, &tm);
int line = tm.tmHeight + tm.tmExternalLeading + 2;
SetBkMode(dc, TRANSPARENT);
SetTextColor(dc, GetSysColor(COLOR_BTNTEXT));
for (int i = 0; i < 4; i++) {
SelectObject(dc, i == 0 ? app.bold_font : app.font);
TextOut(dc, x, TEXT_Y + i * line, lines[i],
(int)strlen(lines[i]));
}
SelectObject(dc, oldf);
/* the raised 3D edge of a Windows 95 window */
DrawEdge(dc, &r, EDGE_RAISED, BF_RECT);
}
/*
* splash_logo - Load the logo on black and on white, and return one
* bitmap of the logo on the colour bg. Each channel of a pixel is
* k + (w - k) * bg / 255, where k and w are the channel on black and
* on white. Return NULL when a bitmap does not load.
*/
static HBITMAP splash_logo(HINSTANCE inst, COLORREF bg)
{
HBITMAP k = LoadBitmap(inst, MAKEINTRESOURCE(IDB_SPLASH_K));
HBITMAP w = LoadBitmap(inst, MAKEINTRESOURCE(IDB_SPLASH_W));
int stride = (LOGO_W * 3 + 3) & ~3;
unsigned char *pk = (unsigned char *)malloc(stride * LOGO_H);
unsigned char *pw = (unsigned char *)malloc(stride * LOGO_H);
HBITMAP out = NULL;
HDC dc = GetDC(NULL);
BITMAPINFO bi;
memset(&bi, 0, sizeof(bi));
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
bi.bmiHeader.biWidth = LOGO_W;
bi.bmiHeader.biHeight = LOGO_H;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 24;
bi.bmiHeader.biCompression = BI_RGB;
BITMAPINFO bi2 = bi;
if (k && w && pk && pw &&
GetDIBits(dc, k, 0, LOGO_H, pk, &bi, DIB_RGB_COLORS) == LOGO_H &&
GetDIBits(dc, w, 0, LOGO_H, pw, &bi2, DIB_RGB_COLORS) == LOGO_H) {
/* (a DIB keeps blue, green, red in this order) */
int b[3] = { GetBValue(bg), GetGValue(bg), GetRValue(bg) };
for (int y = 0; y < LOGO_H; y++)
for (int x = 0; x < LOGO_W * 3; x++) {
int i = y * stride + x;
int d = pw[i] - pk[i];
if (d < 0)
d = 0;
int v = pk[i] + d * b[x % 3] / 255;
pk[i] = (unsigned char)(v > 255 ? 255 : v);
}
out = CreateCompatibleBitmap(dc, LOGO_W, LOGO_H);
if (out)
SetDIBits(dc, out, 0, LOGO_H, pk, &bi, DIB_RGB_COLORS);
}
ReleaseDC(NULL, dc);
free(pk);
free(pw);
if (k)
DeleteObject(k);
if (w)
DeleteObject(w);
return out;
}
/*
* splash_paint - Draw the current frame in a memory bitmap, then copy
* it to the window in one step.
*/
static void splash_paint(HWND w)
{
PAINTSTRUCT ps;
HDC dc = BeginPaint(w, &ps);
HDC mem = CreateCompatibleDC(dc);
HBITMAP buf = CreateCompatibleBitmap(dc, SPLASH_W, SPLASH_H);
HGDIOBJ old = SelectObject(mem, buf);
splash_draw(mem, GetTickCount() - sp.start);
BitBlt(dc, 0, 0, SPLASH_W, SPLASH_H, mem, 0, 0, SRCCOPY);
SelectObject(mem, old);
DeleteObject(buf);
DeleteDC(mem);
EndPaint(w, &ps);
}
/*
* splash_close - Stop the timer and close the splash window.
*/
static void splash_close(HWND w)
{
if (sp.done)
return;
sp.done = true;
KillTimer(w, 1);
DestroyWindow(w);
}
/*
* splash_proc - The window procedure of the splash: draw each frame,
* advance the time, and close at the end or at a click or a key.
*/
static LRESULT CALLBACK splash_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
{
switch (m) {
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
splash_paint(w);
return 0;
case WM_TIMER:
if (GetTickCount() - sp.start >= END_MS)
splash_close(w);
else
InvalidateRect(w, NULL, FALSE);
return 0;
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
splash_close(w);
return 0;
case WM_CLOSE:
splash_close(w);
return 0;
}
return DefWindowProc(w, m, wp, lp);
}
/*
* splash_wanted - Return false when the command line cmd has the
* option "-nosplash" (or "/nosplash"), in any case. Else return true.
*/
bool splash_wanted(const char *cmd)
{
const char *p = cmd ? cmd : "";
while (*p) {
while (*p == ' ' || *p == '\t')
p++;
const char *start = p;
while (*p && *p != ' ' && *p != '\t')
p++;
int n = (int)(p - start);
if (n == 9 && (start[0] == '-' || start[0] == '/') &&
!_strnicmp(start + 1, "nosplash", 8))
return false;
}
return true;
}
/*
* splash_show - Show the splash and return when it closes. The
* messages of the other windows of the app go on while it shows.
* A WM_QUIT that comes while the splash shows is posted again, for
* the main message loop.
*/
void splash_show(HINSTANCE inst)
{
memset(&sp, 0, sizeof(sp));
splash_build_date(sp.date, sizeof(sp.date));
sp.logo = splash_logo(inst, GetSysColor(COLOR_BTNFACE));
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = splash_proc;
wc.hInstance = inst;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = "DModemSplash";
RegisterClass(&wc);
int x = (GetSystemMetrics(SM_CXSCREEN) - SPLASH_W) / 2;
int y = (GetSystemMetrics(SM_CYSCREEN) - SPLASH_H) / 2;
HWND w = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
"DModemSplash", "D-Modem", WS_POPUP,
x, y, SPLASH_W, SPLASH_H, NULL, NULL, inst,
NULL);
if (w) {
sp.start = GetTickCount();
ShowWindow(w, SW_SHOW);
SetForegroundWindow(w);
UpdateWindow(w);
SetTimer(w, 1, TICK_MS, NULL);
MSG msg;
while (!sp.done) {
if (GetMessage(&msg, NULL, 0, 0) <= 0) {
PostQuitMessage((int)msg.wParam);
if (!sp.done)
DestroyWindow(w);
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if (sp.logo)
DeleteObject(sp.logo);
sp.logo = NULL;
}
+243
View File
@@ -0,0 +1,243 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* tray.cpp - the icon of the app in the notification area (the tray).
* The icon shows the call stage:
* - No call: the app icon (the D-Modem logo).
* - A call starts (dialling, ringing, answering): a
* computer with signal arcs, in an animation.
* - A call is connected: two computers. The back computer
* lights when data goes out. The front computer lights
* when data comes in.
* - A call failed (BUSY, NO CARRIER): the two computers
* and a red disc with a cross, for FAIL_MS.
* The tip of the icon is the text of the status bar. A click
* on the icon shows the main window.
*
* The winport build (Linux, macOS, Haiku) has no
* notification area, so there these functions do nothing.
*/
#include "app.h"
#include "resource.h"
#ifndef DMODEM_WINPORT
#include <shellapi.h>
/* the id of the icon, and the message of its mouse events */
#define TRAY_ID 1
#define WM_APP_TRAY (WM_APP + 20)
/* how long a computer stays lit after data (ms); the time of a frame of
the animation (ms) */
#define LIT_MS 150
#define FRAME_MS 400
/* how long the icon of a failed call shows (ms) */
#define FAIL_MS 5000
enum { TRAY_NONE, TRAY_IDLE, TRAY_DIAL, TRAY_NET };
static HWND owner;
static bool added;
static int kind = TRAY_NONE;
static int frame;
static DWORD frame_at;
static unsigned long tx_seen, rx_seen;
static DWORD tx_until, rx_until;
/* when the icon of a failed call stops (GetTickCount), 0 for none */
static DWORD fail_until;
/* the icon and the tip that the tray shows now */
static int shown_icon = -1;
static char tip[64];
static UINT taskbar_created;
/* Gets the icon resource for the icon number n: 0 is the app icon, 1 to
3 are the frames of a call that starts, 4 to 7 are a connected call
(4 + 2 * data out + data in), 8 is a failed call. */
static HICON icon_of(int n)
{
static HICON icons[9];
static const int ids[9] = {
IDI_APP, IDI_TRAY_DIAL0, IDI_TRAY_DIAL1, IDI_TRAY_DIAL2,
IDI_TRAY_NET00, IDI_TRAY_NET01, IDI_TRAY_NET10, IDI_TRAY_NET11,
IDI_TRAY_FAIL
};
if (!icons[n])
icons[n] = (HICON)LoadImage(app.inst, MAKEINTRESOURCE(ids[n]),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), 0);
return icons[n];
}
/* Fills the structure of the icon for Shell_NotifyIcon. Uses the size
of the first version of the structure, so that Windows 95 accepts
it. */
static void fill(NOTIFYICONDATA *d, UINT flags)
{
memset(d, 0, sizeof(*d));
#ifdef NOTIFYICONDATA_V1_SIZE
d->cbSize = NOTIFYICONDATA_V1_SIZE;
#else
d->cbSize = sizeof(*d);
#endif
d->hWnd = owner;
d->uID = TRAY_ID;
d->uFlags = flags;
d->uCallbackMessage = WM_APP_TRAY;
}
/* Gets the icon number for the call stage and the data flow now. */
static int icon_now()
{
DWORD now = GetTickCount();
switch (kind) {
case TRAY_DIAL:
if (now - frame_at >= FRAME_MS) {
frame = (frame + 1) % 3;
frame_at = now;
}
return 1 + frame;
case TRAY_NET: {
unsigned long tx, rx;
link_traffic(&tx, &rx);
if (tx != tx_seen)
tx_until = now + LIT_MS;
if (rx != rx_seen)
rx_until = now + LIT_MS;
tx_seen = tx;
rx_seen = rx;
bool t = (int)(tx_until - now) > 0;
bool r = (int)(rx_until - now) > 0;
return 4 + (t ? 2 : 0) + (r ? 1 : 0);
}
}
if (fail_until && (int)(fail_until - now) > 0)
return 8;
fail_until = 0;
return 0;
}
/* Puts the icon and the tip in the notification area, or changes them
when they are different from the last ones. */
static void show(bool tip_changed)
{
if (!owner)
return;
int n = icon_now();
if (added && n == shown_icon && !tip_changed)
return;
NOTIFYICONDATA d;
fill(&d, NIF_ICON | NIF_TIP | NIF_MESSAGE);
d.hIcon = icon_of(n);
lstrcpyn(d.szTip, tip, sizeof(tip));
if (!added)
added = Shell_NotifyIcon(NIM_ADD, &d) != FALSE;
else
Shell_NotifyIcon(NIM_MODIFY, &d);
shown_icon = n;
}
/* Puts the app icon in the notification area of the main window w. */
void tray_init(HWND w)
{
owner = w;
taskbar_created = RegisterWindowMessage("TaskbarCreated");
kind = TRAY_IDLE;
lstrcpyn(tip, "D-Modem", sizeof(tip));
show(true);
}
/* Sets the icon for the modem state st and sets the tip to text (ANSI).
A change of the call stage starts the icon again from its first
frame. */
void tray_state(int st, const char *text)
{
int k = TRAY_IDLE;
if (st == DMC_DIALING || st == DMC_RINGING || st == DMC_ANSWERING)
k = TRAY_DIAL;
else if (st == DMC_ONLINE || st == DMC_ONLINE_COMMAND)
k = TRAY_NET;
if (k != kind) {
kind = k;
frame = 0;
frame_at = GetTickCount();
link_traffic(&tx_seen, &rx_seen);
tx_until = rx_until = 0;
}
char t[64];
_snprintf(t, sizeof(t), "D-Modem: %s", text);
t[sizeof(t) - 1] = '\0';
bool changed = strcmp(t, tip) != 0;
if (changed)
lstrcpyn(tip, t, sizeof(tip));
show(changed);
}
/* Moves the animation on, lights the computers for the data flow, and
ends the icon of a failed call.
The main window's timer calls it. */
void tray_tick()
{
if (kind == TRAY_DIAL || kind == TRAY_NET || fail_until)
show(false);
}
/* Shows the icon of a failed call for FAIL_MS. The main window calls it
for a result such as BUSY or NO CARRIER. */
void tray_failed()
{
fail_until = GetTickCount() + FAIL_MS;
if (!fail_until)
fail_until = 1;
show(false);
}
/* Handles a message of the main window for the icon: a click shows the
main window, and a new taskbar (Explorer started again) gets the icon
again. Returns true when the message was for the icon. */
bool tray_message(UINT m, WPARAM wp, LPARAM lp)
{
(void)wp;
if (m == WM_APP_TRAY) {
if (lp == WM_LBUTTONUP || lp == WM_LBUTTONDBLCLK ||
lp == WM_RBUTTONUP) {
if (IsIconic(owner))
ShowWindow(owner, SW_RESTORE);
SetForegroundWindow(owner);
}
return true;
}
if (taskbar_created && m == taskbar_created) {
added = false;
show(true);
return true;
}
return false;
}
/* Removes the icon from the notification area. */
void tray_remove()
{
if (!added)
return;
NOTIFYICONDATA d;
fill(&d, 0);
Shell_NotifyIcon(NIM_DELETE, &d);
added = false;
}
#else /* DMODEM_WINPORT */
/* (no notification area: these functions do nothing) */
void tray_init(HWND w) { (void)w; }
void tray_state(int st, const char *text) { (void)st; (void)text; }
void tray_tick() {}
void tray_failed() {}
bool tray_message(UINT m, WPARAM wp, LPARAM lp)
{
(void)m; (void)wp; (void)lp;
return false;
}
void tray_remove() {}
#endif
+22 -9
View File
@@ -717,6 +717,7 @@ static void voice_command(HWND p, int id, int code)
return;
}
stop_sound();
app_dialling(n);
int tag = dmc_voice_dial(app.s, n);
if (tag > 0)
link_wait(tag, dialled, NULL);
@@ -958,6 +959,15 @@ static LRESULT CALLBACK voice_proc(HWND w, UINT m, WPARAM wp, LPARAM lp)
return CallWindowProc(page_base, w, m, wp, lp);
}
/* The phone book's number to the Number box; dial makes the voice
call when Call is enabled. */
static void voice_picked(const char *number, bool dial)
{
SetDlgItemText(page, IDC_V_NUMBER, number);
if (dial && IsWindowEnabled(GetDlgItem(page, IDC_V_CALL)))
voice_command(page, IDC_V_CALL, BN_CLICKED);
}
HWND voice_page_new(HWND parent)
{
page = page_new(parent, voice_command);
@@ -1018,6 +1028,7 @@ HWND voice_page_new(HWND parent)
insert_column(lv, 2, "Length", 60);
make_child("BUTTON", "P&lay", WS_TABSTOP, page, IDC_V_PLAY);
make_child("BUTTON", "&Delete", WS_TABSTOP, page, IDC_V_DELETE);
phonebook_new(page, IDC_V_PHONEBOOK, IDC_V_NUMBER, voice_picked);
load_greeting();
refresh_messages();
voice_configure();
@@ -1040,7 +1051,7 @@ void voice_page_layout(HWND p, int w, int h)
/* the call: the number, its buttons, the keypad at the right */
int kw = 34, kh = 24, pad = 3 * kw + 2 * 4;
int left = inner - pad - 36;
place(p, IDC_V_CALLBOX, x, y, inner, 156);
place(p, IDC_V_CALLBOX, x, y, inner, 144);
place(p, IDC_V_NUMLABEL, x + 12, y + 28, 56, 20);
place(p, IDC_V_NUMBER, x + 70, y + 24, left - 70 - bw - 6, bh);
place(p, IDC_V_CALL, x + left - bw, y + 24, bw, bh);
@@ -1053,7 +1064,7 @@ void voice_page_layout(HWND p, int w, int h)
for (int i = 0; i < 12; i++)
place(p, IDC_V_KEY + i, x + inner - pad - 12 + (i % 3) * (kw + 4),
y + 20 + (i / 3) * (kh + 6), kw, kh);
y += 166;
y += 154;
/* the answering machine */
place(p, IDC_V_VMBOX, x, y, inner, 84);
place(p, IDC_V_VMON, x + 12, y + 24, 230, 20);
@@ -1066,12 +1077,14 @@ void voice_page_layout(HWND p, int w, int h)
place(p, IDC_V_CHOOSE, x + inner - 2 * (gb + 6) - 6, y + 52, gb, bh);
place(p, IDC_V_CLEARGREET, x + inner - (gb + 6) - 6, y + 52, gb, bh);
y += 94;
/* the messages, the rest */
/* the rest: the phone book at the left, the messages at the right */
int mh = h - y - m;
if (mh < 90)
mh = 90;
place(p, IDC_V_MSGBOX, x, y, inner, mh);
place(p, IDC_V_MESSAGES, x + 12, y + 22, inner - bw - 36, mh - 34);
place(p, IDC_V_PLAY, x + inner - bw - 12, y + 22, bw, bh);
place(p, IDC_V_DELETE, x + inner - bw - 12, y + 52, bw, bh);
if (mh < 120)
mh = 120;
int pw = (inner - m) * 45 / 100, mx = x + pw + m, mw = inner - pw - m;
place(p, IDC_V_PHONEBOOK, x, y, pw, mh);
place(p, IDC_V_MSGBOX, mx, y, mw, mh);
place(p, IDC_V_MESSAGES, mx + 12, y + 22, mw - bw - 36, mh - 34);
place(p, IDC_V_PLAY, mx + mw - bw - 12, y + 22, bw, bh);
place(p, IDC_V_DELETE, mx + mw - bw - 12, y + 52, bw, bh);
}
+29 -16
View File
@@ -1,8 +1,14 @@
# The Windows app (windows/) for Linux and macOS, over the portable Win32
# layer of clang-retro MFC (libwinport, in port/ of that project).
# The Windows app (windows/) for Linux, macOS and Haiku, over the
# portable Win32 layer of clang-retro MFC (libwinport, in port/ of that
# project).
#
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
# -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
#
# Haiku, from Linux (cmake/haiku.cmake and docs/haiku.md):
#
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=/path/to/sysroot
enable_language(CXX)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -40,14 +46,14 @@ else()
set(_arch_linux x86_64)
set(_arch_apple x86_64)
endif()
if(MACOS9_TARGET)
# The classic Mac OS on PowerPC (cmake/macos9.cmake)
set(WINPORT_TARGET "${MACOS9_TARGET}")
elseif(MACOSX_LEGACY_TARGET)
if(MACOSX_LEGACY_TARGET)
# Mac OS X 10.4 and later (cmake/macosx-legacy.cmake)
set(WINPORT_TARGET "${MACOSX_LEGACY_TARGET}")
elseif(APPLE)
set(WINPORT_TARGET "${_arch_apple}-apple-macos11")
elseif(HAIKU)
# (the Haiku toolchain file gives the triple and the sysroot)
set(WINPORT_TARGET "${HAIKU_TRIPLE}")
else()
set(WINPORT_TARGET "${_arch_linux}-linux-gnu")
endif()
@@ -62,10 +68,7 @@ ProcessorCount(_ncpu)
if(_ncpu EQUAL 0)
set(_ncpu 1)
endif()
if(MACOS9_TARGET)
# (the Makefile sets the flags of mac-sdk's C and C++ libraries itself)
set(_winport_make_args BIN=${MACOS9_LLVM}/bin MACSDK=${MACOS9_SDK})
elseif(MACOSX_LEGACY_TARGET)
if(MACOSX_LEGACY_TARGET)
# (the Makefile sets the flags of the 10.4 SDK and libc++ itself.
# winhelp_file.cpp uses std::abs with no <cstdlib>: the libc++ of the
# sysroot does not give it through <algorithm>.)
@@ -73,6 +76,10 @@ elseif(MACOSX_LEGACY_TARGET)
SDK=${MACOSX_LEGACY_SDK} LIBCXX=${MACOSX_LEGACY_SYSROOT}
CCTOOLS=${MACOSX_LEGACY_CCTOOLS}/bin/powerpc-apple-darwin8-
"CXXFLAGS=-O2 -include cstdlib")
elseif(HAIKU)
# (Haiku's C++ library is libstdc++, which the sysroot has)
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR}
SYSROOT=${HAIKU_SYSROOT})
else()
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR})
endif()
@@ -120,16 +127,22 @@ if(DMODEM_GUI_EMBED AND TARGET dmodem_embed)
target_link_libraries(dmodem-win32 PRIVATE dmodem_embed)
target_compile_definitions(dmodem-win32 PRIVATE DMODEM_GUI_EMBED)
endif()
if(MACOS9_TARGET)
# (cmake/macos9.cmake links with macapp.py: the C and C++ libraries of
# mac-sdk, and the Toolbox. The cooperative threads are in its C
# library.)
elseif(MACOSX_LEGACY_TARGET)
if(MACOSX_LEGACY_TARGET)
# (cmake/macosx-legacy.cmake adds port/compat/macosx, the C library
# functions that 10.4 does not have)
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" "-framework OpenGL" pthread)
elseif(APPLE)
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" pthread)
elseif(HAIKU)
# (the USB devices for Look for a modem, from the USB Kit:
# windows/src/ports_haiku.cpp, with Haiku's headers only)
target_sources(dmodem-win32 PRIVATE "${_win}/src/ports_haiku.cpp")
# (libbe: the Interface Kit; libmedia: the Media Kit, for the sound of
# clang-retro MFC (port/src/audio_haiku.cpp); libtranslation: the
# Translation Kit, for its images; libdevice: the USB Kit; libnetwork:
# the sockets; libbsd: dl_iterate_phdr. libroot has the rest, dlopen
# and the threads too.)
target_link_libraries(dmodem-win32 PRIVATE be media translation device network bsd)
else()
target_link_libraries(dmodem-win32 PRIVATE dl pthread)
endif()
@@ -137,7 +150,7 @@ endif()
# The install on Linux (cmake --install): the app, its desktop entry,
# its AppStream data and its icon. Also the firmware of the MultiTech
# MT9234MU (the licence is unknown: firmware/README.md).
if(UNIX AND NOT APPLE AND NOT MACOS9_TARGET)
if(UNIX AND NOT APPLE AND NOT HAIKU)
include(GNUInstallDirs)
install(TARGETS dmodem-win32 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES data/io.github.d_modem.DModem.desktop