Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sdl2 #203

Closed
wants to merge 14 commits into from
6 changes: 3 additions & 3 deletions .github/workflows/xpinmame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:
- uses: actions/checkout@v4
- if: matrix.os == 'macos-latest'
run: |
brew install xquartz
brew install sdl2

- if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install libx11-dev libxv-dev libasound2-dev
run: |
sudo apt update && sudo apt install libasound2-dev libsdl2-dev
- name: Build xpinmame-${{ matrix.platform }}
run: |
cp cmake/xpinmame/CMakeLists_${{ matrix.platform }}.txt CMakeLists.txt
Expand Down
38 changes: 23 additions & 15 deletions cmake/xpinmame/CMakeLists_linux-x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ add_compile_definitions(
USE_MITSHM
USE_XV
USE_HWSCALE
DISPLAY_METHOD="x11"
DISPLAY_METHOD="SDL2"
XMAMEROOT="/usr/local/share/xpinmame"
HAVE_SNPRINTF
HAVE_GETTIMEOFDAY
#SYSDEP_DSP_ALSA
#SYSDEP_MIXER_ALSA
SYSDEP_DSP_OSS
# SYSDEP_DSP_ALSA
# SYSDEP_MIXER_ALSA
SYSDEP_DSP_SDL
SDL_DEBUG
)

add_executable(xpinmame
Expand Down Expand Up @@ -625,10 +626,11 @@ add_executable(xpinmame
src/unix/sysdep/sysdep_mixer.c
# src/unix/sysdep/dsp-drivers/alsa.c
# src/unix/sysdep/mixer-drivers/alsa.c
src/unix/sysdep/dsp-drivers/oss.c
src/unix/video-drivers/x11.c
src/unix/video-drivers/xinput.c
src/unix/video-drivers/x11_window.c
src/unix/sysdep/dsp-drivers/sdl.c
# src/unix/video-drivers/x11.c
# src/unix/video-drivers/xinput.c
# src/unix/video-drivers/x11_window.c
src/unix/video-drivers/sdl.c
src/unix/joystick-drivers/joy_i386.c
src/unix/joystick-drivers/joy_pad.c
src/unix/joystick-drivers/joy_x11.c
Expand All @@ -641,12 +643,16 @@ find_package(
ZLIB REQUIRED
)

#find_package(
# X11
#)

find_package(
X11 REQUIRED
ALSA
)

find_package(
ALSA
SDL2 REQUIRED
)

target_include_directories(xpinmame PUBLIC
Expand All @@ -656,17 +662,19 @@ target_include_directories(xpinmame PUBLIC
src/cpu/m68000/generated_by_m68kmake
src/unix
src/unix/sysdep
${X11_X11_INCLUDE_PATH}
${X11_Xv_INCLUDE_PATH}
# ${X11_X11_INCLUDE_PATH}
# ${X11_Xv_INCLUDE_PATH}
${ALSA_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
)

target_link_libraries(xpinmame PUBLIC
ZLIB::ZLIB
${X11_X11_LIB}
${X11_Xv_LIB}
${X11_Xext_LIB}
# ${X11_X11_LIB}
# ${X11_Xv_LIB}
# ${X11_Xext_LIB}
${ALSA_LIBRARIES}
${SDL2_LIBRARIES}
)

set_target_properties(xpinmame PROPERTIES
Expand Down
32 changes: 21 additions & 11 deletions cmake/xpinmame/CMakeLists_osx-x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ add_compile_definitions(
HAS_SAA1099=1
HAS_QSOUND=1

INLINE=static __inline
LSB_FIRST
x11
stricmp=strcasecmp
Expand All @@ -94,14 +93,18 @@ add_compile_definitions(
USE_XV
USE_HWSCALE
NAME="xpinmame"
DISPLAY_METHOD="x11"
DISPLAY_METHOD="SDL2"
XMAMEROOT="/usr/local/share/xpinmame"
HAVE_SNPRINTF
HAVE_GETTIMEOFDAY

SYSDEP_DSP_COREAUDIO
)

add_definitions(
"-DINLINE=static inline __attribute__((always_inline))"
)

add_executable(xpinmame
src/artwork.c
src/artwork.h
Expand Down Expand Up @@ -612,9 +615,10 @@ add_executable(xpinmame
src/unix/sysdep/sysdep_dsp.c
src/unix/sysdep/sysdep_mixer.c
src/unix/sysdep/dsp-drivers/coreaudio.c
src/unix/video-drivers/x11.c
src/unix/video-drivers/xinput.c
src/unix/video-drivers/x11_window.c
# src/unix/video-drivers/x11.c
# src/unix/video-drivers/xinput.c
# src/unix/video-drivers/x11_window.c
src/unix/video-drivers/sdl.c
src/unix/joystick-drivers/joy_i386.c
src/unix/joystick-drivers/joy_pad.c
src/unix/joystick-drivers/joy_x11.c
Expand All @@ -627,8 +631,12 @@ find_package(
ZLIB
)

#find_package(
# X11
#)

find_package(
X11
SDL2 REQUIRED
)

find_library(
Expand All @@ -641,16 +649,18 @@ target_include_directories(xpinmame PUBLIC
src/cpu/m68000
src/cpu/m68000/generated_by_m68kmake
src/unix
${X11_X11_INCLUDE_PATH}
${X11_Xv_INCLUDE_PATH}
# ${X11_X11_INCLUDE_PATH}
# ${X11_Xv_INCLUDE_PATH}
${SDL2_INCLUDE_DIRS}
)

target_link_libraries(xpinmame PUBLIC
ZLIB::ZLIB
${X11_X11_LIB}
${X11_Xv_LIB}
${X11_Xext_LIB}
# ${X11_X11_LIB}
# ${X11_Xv_LIB}
# ${X11_Xext_LIB}
${COREAUDIO_FRAMEWORK}
${SDL2_LIBRARIES}
)

set_target_properties(xpinmame PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion src/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ const struct GameDriver driver_##NAME = \

***************************************************************************/

extern struct GameDriver *drivers[];
extern const struct GameDriver *drivers[];
extern const struct GameDriver *test_drivers[];

#endif
Loading