Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/libdmdutil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,25 @@ jobs:
name: Add autoconf and automake (mac runner)
run: |
brew install autoconf automake libtool
- if: (matrix.platform == 'linux')
name: Add libudev and autotools (linux runner)
run: |
sudo apt-get update
sudo apt install libudev-dev autoconf automake libtool pkg-config
- if: (matrix.platform == 'linux' && matrix.arch == 'aarch64')
name: Add libgpiod (Raspberry Pi Linux)
run: |
sudo apt-get update
sudo apt-get install -y libgpiod-dev
- name: Build libdmdutil-${{ matrix.platform }}-${{ matrix.arch }}
run: |
./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh
if [[ "${{ matrix.platform }}" == "win" ]]; then
if [[ "${{ matrix.arch }}" == "x64" ]]; then
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
elif [[ "${{ matrix.arch }}" == "x86" ]]; then
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
cmake -G "Visual Studio 17 2022" -A ARM64 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
cmake -G "Visual Studio 17 2022" -A ARM64 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build
fi
cmake --build build --config Release
else
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ third-party/include/serum-decode.h
third-party/include/ZeDMD.h
third-party/include/LZ4Stream.h
third-party/include/lz4
third-party/include/TimeUtils.h
third-party/include/vni.h
third-party/include/libusb-1.0
.DS_Store
63 changes: 51 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,31 @@ set(DMDUTIL_SOURCES
src/DMDServer.cpp
)

set(DMDUTIL_COMPILE_DEFINITIONS "")
set(DMDUTIL_PIN2DMD_LIBS "")

if(PLATFORM STREQUAL "win" OR PLATFORM STREQUAL "macos" OR PLATFORM STREQUAL "linux")
list(APPEND DMDUTIL_SOURCES
src/PixelcadeDMD.cpp
)
endif()

if(PLATFORM STREQUAL "win" OR PLATFORM STREQUAL "macos" OR PLATFORM STREQUAL "linux")
list(APPEND DMDUTIL_SOURCES
src/PIN2DMD.cpp
)
list(APPEND DMDUTIL_COMPILE_DEFINITIONS DMDUTIL_ENABLE_PIN2DMD)
if(PLATFORM STREQUAL "win")
if(ARCH STREQUAL "x64")
list(APPEND DMDUTIL_PIN2DMD_LIBS libusb64-1.0)
else()
list(APPEND DMDUTIL_PIN2DMD_LIBS libusb-1.0)
endif()
else()
list(APPEND DMDUTIL_PIN2DMD_LIBS usb-1.0)
endif()
endif()

set(DMDUTIL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
third-party/include
Expand All @@ -110,37 +129,44 @@ if(BUILD_SHARED)
add_library(dmdutil_shared SHARED ${DMDUTIL_SOURCES})

target_include_directories(dmdutil_shared PUBLIC ${DMDUTIL_INCLUDE_DIRS})
if(DMDUTIL_COMPILE_DEFINITIONS)
target_compile_definitions(dmdutil_shared PUBLIC ${DMDUTIL_COMPILE_DEFINITIONS})
endif()

if(PLATFORM STREQUAL "win")
target_link_directories(dmdutil_shared PUBLIC
third-party/build-libs/${PLATFORM}/${ARCH}
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
if(ARCH STREQUAL "x64")
target_link_libraries(dmdutil_shared PUBLIC cargs64 zedmd64 serum64 libserialport64 sockpp64 pupdmd64 ws2_32)
target_link_libraries(dmdutil_shared PUBLIC cargs64 zedmd64 serum64 vni64 libserialport64 sockpp64 pupdmd64 ws2_32)
else()
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum libserialport sockpp pupdmd ws2_32)
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum vni libserialport sockpp pupdmd ws2_32)
endif()
elseif(PLATFORM STREQUAL "macos")
target_link_directories(dmdutil_shared PUBLIC
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum serialport sockpp pupdmd)
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum vni serialport sockpp pupdmd)
elseif(PLATFORM STREQUAL "linux")
target_link_directories(dmdutil_shared PUBLIC
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum serialport sockpp pupdmd)
target_link_libraries(dmdutil_shared PUBLIC cargs zedmd serum vni serialport sockpp pupdmd)
elseif(PLATFORM STREQUAL "ios" OR PLATFORM STREQUAL "ios-simulator" OR PLATFORM STREQUAL "tvos")
target_link_directories(dmdutil_shared PUBLIC
third-party/build-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_shared PUBLIC zedmd serum sockpp pupdmd)
target_link_libraries(dmdutil_shared PUBLIC zedmd serum vni sockpp pupdmd)
elseif(PLATFORM STREQUAL "android")
target_link_directories(dmdutil_shared PUBLIC
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_shared PUBLIC zedmd serum sockpp pupdmd)
target_link_libraries(dmdutil_shared PUBLIC zedmd serum vni sockpp pupdmd)
endif()

if(DMDUTIL_PIN2DMD_LIBS)
target_link_libraries(dmdutil_shared PUBLIC ${DMDUTIL_PIN2DMD_LIBS})
endif()

if(PLATFORM STREQUAL "win" AND ARCH STREQUAL "x64")
Expand Down Expand Up @@ -181,11 +207,17 @@ if(BUILD_SHARED)
)
target_link_libraries(dmdutil-generate-scenes PUBLIC dmdutil_shared)

add_executable(dmdutil-play-dump
src/playDump.cpp
)
target_link_libraries(dmdutil-play-dump PUBLIC dmdutil_shared)

if(POST_BUILD_COPY_EXT_LIBS)
add_dependencies(dmdserver copy_ext_libs)
add_dependencies(dmdserver_test copy_ext_libs)
add_dependencies(dmdutil_test copy_ext_libs)
add_dependencies(dmdutil-generate-scenes copy_ext_libs)
add_dependencies(dmdutil-play-dump copy_ext_libs)
endif()
endif()
endif()
Expand All @@ -194,6 +226,13 @@ if(BUILD_STATIC)
add_library(dmdutil_static STATIC ${DMDUTIL_SOURCES})

target_include_directories(dmdutil_static PUBLIC ${DMDUTIL_INCLUDE_DIRS})
if(DMDUTIL_COMPILE_DEFINITIONS)
target_compile_definitions(dmdutil_static PUBLIC ${DMDUTIL_COMPILE_DEFINITIONS})
endif()

if(DMDUTIL_PIN2DMD_LIBS)
target_link_libraries(dmdutil_static PUBLIC ${DMDUTIL_PIN2DMD_LIBS})
endif()

if(PLATFORM STREQUAL "win")
set_target_properties(dmdutil_static PROPERTIES
Expand Down Expand Up @@ -221,20 +260,20 @@ if(BUILD_STATIC)
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
if(ARCH STREQUAL "x64")
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs64 zedmd64 serum64 libserialport64 sockpp64 pupdmd64 ws2_32)
else()
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum libserialport sockpp pupdmd ws2_32)
endif()
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs64 zedmd64 serum64 vni64 libserialport64 sockpp64 pupdmd64 ws2_32)
else()
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum vni libserialport sockpp pupdmd ws2_32)
endif()
elseif(PLATFORM STREQUAL "macos")
target_link_directories(dmdutil_test_s PUBLIC
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum serialport sockpp pupdmd)
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum vni serialport sockpp pupdmd)
elseif(PLATFORM STREQUAL "linux")
target_link_directories(dmdutil_test_s PUBLIC
third-party/runtime-libs/${PLATFORM}/${ARCH}
)
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum serialport sockpp pupdmd)
target_link_libraries(dmdutil_test_s PUBLIC dmdutil_static cargs zedmd serum vni serialport sockpp pupdmd)
endif()

if(POST_BUILD_COPY_EXT_LIBS)
Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A cross platform library for performing DMD tasks.

This library is currently used by [Visual Pinball Standalone](https://github.com/vpinball/vpinball/tree/standalone) for processing [PinMAME](https://github.com/vpinball/pinmame/tree/master/src/libpinmame) and [FlexDMD](https://github.com/vbousquet/flexdmd) DMD frames. It supports colorizing using [Serum](https://github.com/PPUC/libserum), outputing to [ZeDMD](https://github.com/PPUC/zedmd) and [Pixelcade](https://pixelcade.org) devices, and providing intensity and RGB24 buffers that can be used to render in table and external DMDs for [Visual Pinball](https://github.com/vpinball/vpinball).
This library is currently used by [Visual Pinball Standalone](https://github.com/vpinball/vpinball/tree/standalone) for processing [PinMAME](https://github.com/vpinball/pinmame/tree/master/src/libpinmame) and [FlexDMD](https://github.com/vbousquet/flexdmd) DMD frames. It supports colorizing using [Serum](https://github.com/PPUC/libserum), outputing to [ZeDMD](https://github.com/PPUC/zedmd), [Pixelcade](https://pixelcade.org) and [PIN2DMD](https://https://pin2dmd.com/)devices, and providing intensity and RGB24 buffers that can be used to render in table and external DMDs for [Visual Pinball](https://github.com/vpinball/vpinball).

## Usage:

Expand Down Expand Up @@ -211,6 +211,10 @@ Height = 32
Enabled = 1
# Disable auto-detection and provide a fixed serial port
Device =

[PIN2DMD]
# Set to 1 if PIN2DMD is attached
Enabled = 0
```

## Serum PUP Scenes Generator
Expand All @@ -231,6 +235,31 @@ The `dmdutil-generate-scenes` tool generates a dump of such scene frames accordi
-h, --help Show help
```

## DMD Dump Player

`dmdutil-play-dump` plays an existing txt, rgb565, rgb888, or raw dump and sends the frames to all attached DMDs. Txt/raw inputs are sent as
2-bit or 4-bit data frames, while rgb565/rgb888 inputs are sent as color frames. The timestamps in the dump represent the absolute time
(ms since start). It can optionally connect to a remote DMD server and can dump txt/rgb565/rgb888 while playing (raw output is not supported).
Dump output uses the live DMD dumpers (same as libdmdutil), so colorized frames are preserved. By default, playback uses the original frame
timings from the dump. Use `--delay-ms` to cap the per-frame delay; if a frame's original duration is shorter, the original duration is used.

`dmdutil-play-dump` accepts these command line options:
```
-i, --input=FILE Input dump file (.txt, .565.txt, .888.txt, or .raw)
-a, --alt-color-path=PATH Alt color base path (optional, enables Serum colorization)
-d, --depth=VALUE Bit depth to send (2 or 4) (optional, default is 2)
-s, --server=HOST[:PORT] Connect to a DMD server (optional)
-L, --no-local Disable local displays
-t, --dump-txt Dump txt while playing
-5, --dump-565 Dump rgb565 while playing
-8, --dump-888 Dump rgb888 while playing
-w, --delay-ms[=MS] Fixed delay between frames in milliseconds (optional, default is 8 when specified without a value)
-o, --dump-path=PATH Output path for dumps (optional)
-r, --rom=NAME ROM name for dumps (optional)
-R, --raw Force raw dump parsing
-h, --help Show help
```

## Building:

#### Windows (x64)
Expand Down
4 changes: 4 additions & 0 deletions dmdserver.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ Height = 32
Enabled = 0
# Disable auto-detection and provide a fixed serial port
Device =

[PIN2DMD]
# Set to 1 if PIN2DMD is attached
Enabled = 0
6 changes: 6 additions & 0 deletions include/DMDUtil/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class DMDUTILAPI Config
void SetPUPCapture(bool pupCapture) { m_pupCapture = pupCapture; }
bool IsSerumPUPTriggers() const { return m_serumPupTriggers; }
void SetSerumPUPTriggers(bool serumPupTriggers) { m_serumPupTriggers = serumPupTriggers; }
void SetVniKey(const char* key) { m_vniKey = key ? key : ""; }
const char* GetVniKey() const { return m_vniKey.c_str(); }
void SetPUPVideosPath(const char* path) { m_pupVideosPath = path; }
const char* GetPUPVideosPath() const { return m_pupVideosPath.c_str(); }
bool IsPUPExactColorMatch() const { return m_pupExactColorMatch; }
Expand Down Expand Up @@ -92,6 +94,8 @@ class DMDUTILAPI Config
void SetPixelcade(bool pixelcade) { m_pixelcade = pixelcade; }
void SetPixelcadeDevice(const char* port) { m_pixelcadeDevice = port; }
const char* GetPixelcadeDevice() const { return m_pixelcadeDevice.c_str(); }
bool IsPIN2DMD() const { return m_PIN2DMD; }
void SetPIN2DMD(bool PIN2DMD) { m_PIN2DMD = PIN2DMD; }
void SetDMDServer(bool dmdServer)
{
m_dmdServer = dmdServer;
Expand Down Expand Up @@ -125,6 +129,7 @@ class DMDUTILAPI Config
std::string m_altColorPath;
bool m_pupCapture;
bool m_serumPupTriggers;
std::string m_vniKey;
std::string m_pupVideosPath;
bool m_pupExactColorMatch;
int m_framesTimeout;
Expand All @@ -151,6 +156,7 @@ class DMDUTILAPI Config
int m_dmdServerPort;
bool m_pixelcade;
std::string m_pixelcadeDevice;
bool m_PIN2DMD;
DMDUtil_LogLevel m_logLevel;
DMDUtil_LogCallback m_logCallback;
DMDUtil_PUPTriggerCallbackContext m_pupTriggerCallbackContext;
Expand Down
Loading