From 8d6fda48103caf25288f0ba67364851c7472ef09 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 22 Nov 2022 19:18:47 +0300 Subject: [PATCH] removed os2 support & support for building SDL with watcom. --- .github/workflows/watcom.yml | 35 - CMakeLists.txt | 75 +- Makefile.os2 | 296 ----- Makefile.w32 | 280 ---- cmake/sdlchecks.cmake | 4 +- configure | 130 -- configure.ac | 101 -- docs/README-os2.md | 89 -- docs/README.md | 1 - include/SDL_config.h | 2 - include/SDL_config.h.cmake | 7 - include/SDL_config.h.in | 7 - include/SDL_config_os2.h | 207 --- include/SDL_config_windows.h | 15 - include/SDL_opengl.h | 7 - include/SDL_syswm.h | 23 - include/SDL_thread.h | 43 - include/begin_code.h | 11 - src/SDL.c | 19 - src/audio/SDL_audio.c | 3 - src/audio/SDL_sysaudio.h | 1 - src/audio/os2/SDL_os2audio.c | 450 ------- src/audio/os2/SDL_os2audio.h | 54 - src/core/os2/SDL_os2.c | 38 - src/core/os2/SDL_os2.h | 57 - src/core/os2/geniconv/geniconv.c | 161 --- src/core/os2/geniconv/geniconv.h | 85 -- src/core/os2/geniconv/iconv.h | 21 - src/core/os2/geniconv/makefile | 37 - src/core/os2/geniconv/os2cp.c | 416 ------ src/core/os2/geniconv/os2cp.h | 32 - src/core/os2/geniconv/os2iconv.c | 286 ---- src/core/os2/geniconv/sys2utf8.c | 119 -- src/core/os2/geniconv/test.c | 69 - src/core/os2/iconv2.lbc | 4 - src/cpuinfo/SDL_cpuinfo.c | 21 - src/dynapi/SDL3.exports | 869 ------------ src/dynapi/SDL_dynapi.c | 21 - src/dynapi/SDL_dynapi_procs.h | 4 - src/dynapi/gendynapi.pl | 4 - src/events/SDL_mouse.c | 6 - src/filesystem/os2/SDL_sysfilesystem.c | 131 -- src/hidapi/libusb/hid.c | 3 - src/joystick/SDL_joystick.c | 3 - src/joystick/SDL_sysjoystick.h | 1 - src/joystick/os2/SDL_os2joystick.c | 799 ----------- src/loadso/os2/SDL_sysloadso.c | 103 -- src/thread/SDL_thread_c.h | 2 - src/thread/os2/SDL_sysmutex.c | 129 -- src/thread/os2/SDL_syssem.c | 190 --- src/thread/os2/SDL_systhread.c | 133 -- src/thread/os2/SDL_systhread_c.h | 25 - src/thread/os2/SDL_systls.c | 89 -- src/thread/os2/SDL_systls_c.h | 38 - src/thread/windows/SDL_systhread.c | 17 - src/timer/os2/SDL_systimer.c | 186 --- src/video/SDL_sysvideo.h | 2 - src/video/SDL_video.c | 16 +- src/video/os2/SDL_gradd.h | 171 --- src/video/os2/SDL_os2dive.c | 331 ----- src/video/os2/SDL_os2messagebox.c | 561 -------- src/video/os2/SDL_os2messagebox.h | 29 - src/video/os2/SDL_os2mouse.c | 194 --- src/video/os2/SDL_os2mouse.h | 33 - src/video/os2/SDL_os2output.h | 59 - src/video/os2/SDL_os2util.c | 114 -- src/video/os2/SDL_os2util.h | 38 - src/video/os2/SDL_os2video.c | 1696 ------------------------ src/video/os2/SDL_os2video.h | 82 -- src/video/os2/SDL_os2vman.c | 483 ------- test/Makefile.in | 8 - test/Makefile.os2 | 18 - test/Makefile.w32 | 21 - test/configure | 9 - test/configure.ac | 8 - test/testnative.c | 3 - test/testnative.h | 6 - test/testnativeos2.c | 57 - test/watcom.mif | 122 -- 79 files changed, 3 insertions(+), 10017 deletions(-) delete mode 100644 .github/workflows/watcom.yml delete mode 100644 Makefile.os2 delete mode 100644 Makefile.w32 delete mode 100644 docs/README-os2.md delete mode 100644 include/SDL_config_os2.h delete mode 100644 src/audio/os2/SDL_os2audio.c delete mode 100644 src/audio/os2/SDL_os2audio.h delete mode 100644 src/core/os2/SDL_os2.c delete mode 100644 src/core/os2/SDL_os2.h delete mode 100644 src/core/os2/geniconv/geniconv.c delete mode 100644 src/core/os2/geniconv/geniconv.h delete mode 100644 src/core/os2/geniconv/iconv.h delete mode 100644 src/core/os2/geniconv/makefile delete mode 100644 src/core/os2/geniconv/os2cp.c delete mode 100644 src/core/os2/geniconv/os2cp.h delete mode 100644 src/core/os2/geniconv/os2iconv.c delete mode 100644 src/core/os2/geniconv/sys2utf8.c delete mode 100644 src/core/os2/geniconv/test.c delete mode 100644 src/core/os2/iconv2.lbc delete mode 100644 src/dynapi/SDL3.exports delete mode 100644 src/filesystem/os2/SDL_sysfilesystem.c delete mode 100644 src/joystick/os2/SDL_os2joystick.c delete mode 100644 src/loadso/os2/SDL_sysloadso.c delete mode 100644 src/thread/os2/SDL_sysmutex.c delete mode 100644 src/thread/os2/SDL_syssem.c delete mode 100644 src/thread/os2/SDL_systhread.c delete mode 100644 src/thread/os2/SDL_systhread_c.h delete mode 100644 src/thread/os2/SDL_systls.c delete mode 100644 src/thread/os2/SDL_systls_c.h delete mode 100644 src/timer/os2/SDL_systimer.c delete mode 100644 src/video/os2/SDL_gradd.h delete mode 100644 src/video/os2/SDL_os2dive.c delete mode 100644 src/video/os2/SDL_os2messagebox.c delete mode 100644 src/video/os2/SDL_os2messagebox.h delete mode 100644 src/video/os2/SDL_os2mouse.c delete mode 100644 src/video/os2/SDL_os2mouse.h delete mode 100644 src/video/os2/SDL_os2output.h delete mode 100644 src/video/os2/SDL_os2util.c delete mode 100644 src/video/os2/SDL_os2util.h delete mode 100644 src/video/os2/SDL_os2video.c delete mode 100644 src/video/os2/SDL_os2video.h delete mode 100644 src/video/os2/SDL_os2vman.c delete mode 100644 test/Makefile.os2 delete mode 100644 test/Makefile.w32 delete mode 100644 test/testnativeos2.c delete mode 100644 test/watcom.mif diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml deleted file mode 100644 index 13f1505ff..000000000 --- a/.github/workflows/watcom.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build (OpenWatcom) - -on: [push, pull_request] - -jobs: - os2: - name: ${{ matrix.platform.name }} - runs-on: windows-latest - - strategy: - matrix: - platform: - - { name: Windows, makefile: Makefile.w32 } - - { name: OS/2, makefile: Makefile.os2 } - - steps: - - uses: actions/checkout@v3 - - uses: open-watcom/setup-watcom@v0 - - name: Build - run: | - wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - - name: Build tests - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1 - cd .. - - name: Run tests - if: "matrix.platform.makefile == 'Makefile.w32'" - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} check-quick - cd .. - - name: distclean - run: | - wmake -f ${{ matrix.platform.makefile }} distclean - cd test && wmake -f ${{ matrix.platform.makefile }} distclean - cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 60a4782ae..702d0c433 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2696,76 +2696,6 @@ elseif(PS2) ps2_drivers ) -elseif(OS2) - list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") - - file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) - file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/os2/geniconv/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - endif() - - if(SDL_THREADS) - set(SDL_THREAD_OS2 1) - file(GLOB OS2_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) - set(HAVE_SDL_THREADS TRUE) - endif() - - if(SDL_TIMERS) - set(SDL_TIMER_UNIX 1) - file(GLOB OS2_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) - set(HAVE_SDL_TIMERS TRUE) - endif() - - if(SDL_LOADSO) - set(SDL_LOADSO_OS2 1) - file(GLOB OS2_LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) - set(HAVE_SDL_LOADSO TRUE) - endif() - - if(SDL_FILESYSTEM) - set(SDL_FILESYSTEM_OS2 1) - file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/os2/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) - set(HAVE_SDL_FILESYSTEM TRUE) - endif() - - if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/unix/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) - set(HAVE_SDL_LOCALE TRUE) - endif() - - if(SDL_VIDEO) - set(SDL_VIDEO_DRIVER_OS2 1) - file(GLOB OS2_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) - set(HAVE_SDL_VIDEO TRUE) - endif() - - if(SDL_AUDIO) - set(SDL_AUDIO_DRIVER_OS2 1) - file(GLOB OS2_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - list(APPEND EXTRA_LIBS mmpm2) - endif() - - if(SDL_JOYSTICK) - set(SDL_JOYSTICK_OS2 1) - file(GLOB OS2_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) - set(HAVE_SDL_JOYSTICK TRUE) - endif() - - if(SDL_HIDAPI) - CheckHIDAPI() - endif() - elseif(N3DS) file(GLOB N3DS_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/n3ds/*.c) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${N3DS_MAIN_SOURCES}) @@ -3302,9 +3232,6 @@ if(SDL_SHARED) if(WINDOWS OR CYGWIN) set_target_properties(SDL3 PROPERTIES DEFINE_SYMBOL DLL_EXPORT) - elseif(OS2) - set_target_properties(SDL3 PROPERTIES - DEFINE_SYMBOL BUILD_SDL) endif() set_target_properties(SDL3 PROPERTIES VERSION ${SDL_VERSION} @@ -3522,7 +3449,7 @@ if(NOT SDL3_DISABLE_INSTALL) if(SDL_SHARED) set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. get_target_property(SONAME SDL3 OUTPUT_NAME) - if(NOT ANDROID AND NOT MINGW AND NOT OS2) + if(NOT ANDROID AND NOT MINGW) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL3${SOPOSTFIX}${SOEXT}\" diff --git a/Makefile.os2 b/Makefile.os2 deleted file mode 100644 index 0cefb4b3e..000000000 --- a/Makefile.os2 +++ /dev/null @@ -1,296 +0,0 @@ -# Open Watcom makefile to build SDL3.dll for OS/2 -# wmake -f Makefile.os2 -# -# If you have GNU libiconv installed (iconv2.dll), you -# can compile against it by specifying LIBICONV=1, e.g.: -# wmake -f Makefile.os2 LIBICONV=1 -# -# If you have libusb-1.0 installed (usb100.dll, libusb.h), you -# can compile hidapi joystick support against it (experimental) -# by specifying HIDAPI=1, e.g.: -# wmake -f Makefile.os2 HIDAPI=1 -# -# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 - -LIBNAME = SDL3 -MAJOR_VERSION = 3 -MINOR_VERSION = 0 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) -DESCRIPTION = Simple DirectMedia Layer 2 - -LIBICONV=0 -ICONVLIB=$(LIBICONV_LIB) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude - -LIBM = SDL3libm.lib -TLIB = SDL3test.lib -LIBS = mmpm2.lib $(LIBM) -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# Debug options: -# - debug messages from OS/2 related code to stdout: -#CFLAGS+= -DOS2DEBUG -# - debug messages from OS/2 code via SDL_LogDebug(): -#CFLAGS+= -DOS2DEBUG=2 - -# max warnings: -CFLAGS+= -wx -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# iconv: -LIBICONV_LIB=iconv2.lib -!ifeq LIBICONV 1 -CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -LIBS+= $(ICONVLIB) -!else -LIBS+= libuls.lib libconv.lib -!endif -# hidapi (libusb): -!ifeq HIDAPI 1 -CFLAGS_DLL+= -DHAVE_LIBUSB_H=1 -!endif -# building SDL itself (for DECLSPEC): -CFLAGS_DLL+= -DBUILD_SDL - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_os2.c -!ifeq LIBICONV 0 -SRCS+= geniconv.c os2cp.c os2iconv.c sys2utf8.c -!endif -SRCS+= SDL_os2audio.c -SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c & - SDL_os2mouse.c SDL_os2messagebox.c - -SRCS+= SDL_dynapi.c - -OBJS = $(SRCS:.c=.obj) - -.extensions: -.extensions: .lib .dll .obj .c .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/os2;./src/audio/os2;./src/loadso/os2;./src/filesystem/os2;./src/joystick/os2;./src/thread/os2;./src/timer/os2;./src/video/os2; -.c: ./src/core/os2/geniconv; -.c: ./src/locale/;./src/locale/unix;./src/misc;./src/misc/dummy;./src/joystick/hidapi;./src/hidapi - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(LIBICONV_LIB) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* $(DLLFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -!ifeq HIDAPI 1 -# c99 mode needed because of structs with flexible array members in libusb.h -SDL_hidapi.obj: SDL_hidapi.c - wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $< -!endif - -$(LIBICONV_LIB): "src/core/os2/iconv2.lbc" - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ @$< - -# SDL3libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL3test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(LIBHOME)/$^&.exp - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)' - @%append $@ OPTION ELIMINATE - @%append $@ OPTION MANYAUTODATA - @%append $@ OPTION OSNAME='OS/2 and eComStation' - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - @if exist $(LIBICONV_LIB) rm $(LIBICONV_LIB) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/Makefile.w32 b/Makefile.w32 deleted file mode 100644 index b89a44e57..000000000 --- a/Makefile.w32 +++ /dev/null @@ -1,280 +0,0 @@ -# Open Watcom makefile to build SDL3.dll for Win32 -# wmake -f Makefile.w32 -# -# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 - -LIBNAME = SDL3 -MAJOR_VERSION = 3 -MINOR_VERSION = 0 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -EXPFILE = $(LIBHOME)/$(LIBNAME).exp -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude -INCPATH+= -I"src/video/khronos" - -LIBM = SDL3libm.lib -TLIB = SDL3test.lib -# user32.lib, gdi32.lib, ole32.lib and oleaut32.lib are actually -# among the default libraries in wlink.lnk for nt_dll linkage... -LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) - -CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# max warnings: -CFLAGS+= -wx -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# new vulkan headers result in lots of W202 warnings -CFLAGS+= -wcd=202 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# we override the DECLSPEC define in begin_code.h, because we are using -# an exports file to remove the _cdecl '_' prefix from the symbol names -CFLAGS_DLL+= -DDECLSPEC= - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -RCFLAGS = -q -r -bt=nt $(INCPATH) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c -SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c -SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c -SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c -SRCS+= SDL_syspower.c -SRCS+= SDL_d3dmath.c -SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c -SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c -SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c -SRCS+= SDL_render_gl.c SDL_shaders_gl.c -SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c -SRCS+= SDL_windowssensor.c -SRCS+= SDL_syscond_cv.c -SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c - -SRCS+= SDL_dynapi.c - -RCSRCS = version.rc - -OBJS = $(SRCS:.c=.obj) -RCOBJS= $(RCSRCS:.rc=.res) - -.extensions: -.extensions: .lib .dll .obj .res .c .rc .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows; -.c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2 -.rc: ./src/main/windows - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -.rc.res: - wrc $(RCFLAGS) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -SDL_malloc.obj: SDL_malloc.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< - -# SDL3libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL3test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): Makefile.w32 - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION RESOURCE=$(RCOBJS) - @%append $@ EXPORT=src/dynapi/SDL3.exports - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(EXPFILE) - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION ELIMINATE - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.res rm *.res - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 462fdd4ba..b65d63aab 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -364,7 +364,7 @@ macro(CheckLibSampleRate) get_property(_samplerate_type TARGET SampleRate::samplerate PROPERTY TYPE) if(_samplerate_type STREQUAL "SHARED_LIBRARY") set(HAVE_LIBSAMPLERATE_SHARED TRUE) - if(WIN32 OR OS2) + if(WIN32) set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") else() set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") @@ -1172,8 +1172,6 @@ macro(CheckHIDAPI) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}") if(HIDAPI_ONLY_LIBUSB) list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES}) - elseif(OS2) - set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS FindLibraryAndSONAME("usb-1.0" LIBDIRS ${PKG_LIBUSB_LIBRARY_DIRS}) diff --git a/configure b/configure index 677132988..79763cbba 100755 --- a/configure +++ b/configure @@ -27236,36 +27236,6 @@ printf "%s\n" "#define HAVE_SHELLSCALINGAPI_H 1" >>confdefs.h fi } -CheckOS2() -{ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 -printf %s "checking OS/2 compiler... " >&6; } - have_os2_gcc=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_os2_gcc=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 -printf "%s\n" "$have_os2_gcc" >&6; } - if test x$have_os2_gcc != xyes; then - as_fn_error $? " -*** Your compiler ($CC) does not produce OS/2 executables! - " "$LINENO" 5 - fi -} - CheckDIRECTX() { # Check whether --enable-directx was given. @@ -28008,9 +27978,6 @@ fi enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -28123,9 +28090,6 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` @@ -29361,100 +29325,6 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckWerror - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_system_iconv = xyes; then - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - -printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - -printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - -printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - -printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - -printf "%s\n" "#define SDL_JOYSTICK_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) as_fn_error $? " *** Unsupported host: Please add to configure.ac diff --git a/configure.ac b/configure.ac index 9d2cc2934..d0bcbf16f 100644 --- a/configure.ac +++ b/configure.ac @@ -3294,21 +3294,6 @@ CheckWINDOWS() fi } -dnl Determine whether the compiler can produce OS/2 executables -CheckOS2() -{ - AC_MSG_CHECKING(OS/2 compiler) - have_os2_gcc=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [])],[have_os2_gcc=yes],[]) - AC_MSG_RESULT($have_os2_gcc) - if test x$have_os2_gcc != xyes; then - AC_MSG_ERROR([ -*** Your compiler ($CC) does not produce OS/2 executables! - ]) - fi -} - dnl Find the DirectX includes and libraries CheckDIRECTX() { @@ -3607,9 +3592,6 @@ CheckHIDAPI() enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -3643,9 +3625,6 @@ CheckHIDAPI() *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -4580,86 +4559,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckWerror - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$enable_system_iconv = xyes; then - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - AC_DEFINE(SDL_THREAD_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - AC_DEFINE(SDL_JOYSTICK_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) AC_MSG_ERROR([ *** Unsupported host: Please add to configure.ac diff --git a/docs/README-os2.md b/docs/README-os2.md deleted file mode 100644 index 3024f1125..000000000 --- a/docs/README-os2.md +++ /dev/null @@ -1,89 +0,0 @@ -Simple DirectMedia Layer 2 for OS/2 & eComStation -================================================================================ -SDL port for OS/2, authored by Andrey Vasilkin , 2016 - - -OpenGL and audio capture not supported by this port. - -Additional optional environment variables: - -SDL_AUDIO_SHARE - Values: 0 or 1, default is 0 - Initializes the device as shareable or exclusively acquired. - -SDL_VIDEODRIVER - Values: DIVE or VMAN, default is DIVE - Use video subsystem: Direct interface video extensions (DIVE) or - Video Manager (VMAN). - -You may significantly increase video output speed with OS4 kernel and patched -files vman.dll and dive.dll or with latest versions of ACPI support and video -driver Panorama. - -Latest versions of OS/4 kernel: - http://gus.biysk.ru/os4/ - (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4) - -Patched files vman.dll and dive.dll: - http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR - - -Compiling: ----------- - -Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see: -https://github.com/open-watcom/ and https://open-watcom.github.io -WATCOM environment variable must to be set to the Open Watcom install -directory. To compile, run: wmake -f Makefile.os2 - - -Installing: ------------ - -- eComStation: - - If you have previously installed SDL3, make a Backup copy of SDL3.dll - located in D:\ecs\dll (where D: is disk on which installed eComStation). - Stop all programs running with SDL3. Copy SDL3.dll to D:\ecs\dll - -- OS/2: - - Copy SDL3.dll to any directory on your LIBPATH. If you have a previous - version installed, close all SDL3 applications before replacing the old - copy. Also make sure that any other older versions of DLLs are removed - from your system. - - -Joysticks: ------------------- - -The Joystick detection only works for standard joysticks (2 buttons, 2 axes -and the like). Therefore, if you use a non-standard joystick, you should -specify its features in the SDL_OS2_JOYSTICK environment variable in a batch -file or CONFIG.SYS, so SDL applications can provide full capability to your -device. The syntax is: - -SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] - -So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, -the line should be: - -SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 - -If you want to add spaces in your joystick name, just surround it with -quotes or double-quotes: - -SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 - -or - -SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 - - Note however that Balls and Hats are not supported under OS/2, and the -value will be ignored... but it is wise to define these correctly because -in the future those can be supported. - - Also the number of buttons is limited to 2 when using two joysticks, -4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes -and 8 when using a joystick with 2 axes. Notice however these are limitations -of the Joystick Port hardware, not OS/2. diff --git a/docs/README.md b/docs/README.md index 7666060c9..9af1ceb6b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,7 +34,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [iOS](README-ios.md) - [Linux](README-linux.md) - [macOS](README-macos.md) -- [OS/2](README-os2.md) - [Native Client](README-nacl.md) - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) diff --git a/include/SDL_config.h b/include/SDL_config.h index f91cb47ec..f59b6bbff 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -43,8 +43,6 @@ #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" -#elif defined(__OS2__) -#include "SDL_config_os2.h" #elif defined(__EMSCRIPTEN__) #include "SDL_config_emscripten.h" #elif defined(__NGAGE__) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 8fcb63d18..41acf1c71 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -322,7 +322,6 @@ #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ #cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ @@ -341,7 +340,6 @@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ #cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_OS2 @SDL_JOYSTICK_OS2@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ #cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ @@ -373,7 +371,6 @@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ #cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ -#cmakedefine SDL_LOADSO_OS2 @SDL_LOADSO_OS2@ /* Enable various threading systems */ #cmakedefine SDL_THREAD_GENERIC_COND_SUFFIX @SDL_THREAD_GENERIC_COND_SUFFIX@ @@ -381,7 +378,6 @@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ #cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ -#cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ #cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ @@ -392,7 +388,6 @@ #cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ #cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ #cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ -#cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ #cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ @@ -414,7 +409,6 @@ #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ -#cmakedefine SDL_VIDEO_DRIVER_OS2 @SDL_VIDEO_DRIVER_OS2@ #cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@ #cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@ #cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@ @@ -505,7 +499,6 @@ #cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ #cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ #cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ -#cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ #cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 7b8d848e0..a4756ee7b 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -310,7 +310,6 @@ #undef SDL_AUDIO_DRIVER_SUNAUDIO #undef SDL_AUDIO_DRIVER_WASAPI #undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_OS2 /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -326,7 +325,6 @@ #undef SDL_JOYSTICK_MFI #undef SDL_JOYSTICK_LINUX #undef SDL_JOYSTICK_ANDROID -#undef SDL_JOYSTICK_OS2 #undef SDL_JOYSTICK_USBHID #undef SDL_HAVE_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_HIDAPI @@ -351,7 +349,6 @@ #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG #undef SDL_LOADSO_WINDOWS -#undef SDL_LOADSO_OS2 /* Enable various threading systems */ #undef SDL_THREAD_GENERIC_COND_SUFFIX @@ -359,14 +356,12 @@ #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP #undef SDL_THREAD_WINDOWS -#undef SDL_THREAD_OS2 /* Enable various timer systems */ #undef SDL_TIMER_HAIKU #undef SDL_TIMER_DUMMY #undef SDL_TIMER_UNIX #undef SDL_TIMER_WINDOWS -#undef SDL_TIMER_OS2 /* Enable various video drivers */ #undef SDL_VIDEO_DRIVER_HAIKU @@ -410,7 +405,6 @@ #undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK -#undef SDL_VIDEO_DRIVER_OS2 #undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_DRIVER_RISCOS @@ -460,7 +454,6 @@ #undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_NACL #undef SDL_FILESYSTEM_EMSCRIPTEN -#undef SDL_FILESYSTEM_OS2 #undef SDL_FILESYSTEM_VITA #undef SDL_FILESYSTEM_PSP #undef SDL_FILESYSTEM_PS2 diff --git a/include/SDL_config_os2.h b/include/SDL_config_os2.h deleted file mode 100644 index c86769db4..000000000 --- a/include/SDL_config_os2.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_os2_h_ -#define SDL_config_os2_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#define SIZEOF_VOIDP 4 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_OS2 1 - -#define SDL_POWER_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 - -#define SDL_SENSOR_DUMMY 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_OS2 1 -#define SDL_JOYSTICK_OS2 1 -#ifndef HAVE_LIBUSB_H /* see Makefile */ -#define SDL_HIDAPI_DISABLED 1 -/*#undef SDL_JOYSTICK_HIDAPI */ -#else -#define SDL_JOYSTICK_HIDAPI 1 -#define HAVE_LIBUSB 1 -/* dynamically loaded libusb-1.0 dll: */ -#define SDL_LIBUSB_DYNAMIC "usb100.dll" -#endif -/*#undef SDL_JOYSTICK_VIRTUAL */ - -/* Enable OpenGL support */ -/* #undef SDL_VIDEO_OPENGL */ - -#define SDL_THREAD_OS2 1 -#define SDL_LOADSO_OS2 1 -#define SDL_TIMER_OS2 1 -#define SDL_FILESYSTEM_OS2 1 - -/* use libsamplerate for audio rate conversion. */ -/*#define HAVE_LIBSAMPLERATE_H 1 */ - -/* Enable dynamic libsamplerate support */ -#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL" - -#define HAVE_LIBC 1 - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 - -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_WCHAR_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_SIGNAL_H 1 - -#if 0 /* see Makefile */ -#define HAVE_ICONV 1 -#define HAVE_ICONV_H 1 -#endif - -/* #undef HAVE_DLOPEN */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#if defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE__FTELLI64 1 -#endif -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -#define HAVE_WCSCMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -/* #undef HAVE_WCSDUP */ -#define HAVE__WCSDUP 1 -#define HAVE_WCSSTR 1 -#define HAVE_WCSCMP 1 -#define HAVE_WCSNCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -#define HAVE_ITOA 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE__I64TOA 1 -#define HAVE__UI64TOA 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_VSSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_SETJMP 1 -#define HAVE_ACOS 1 -/* #undef HAVE_ACOSF */ -#define HAVE_ASIN 1 -/* #undef HAVE_ASINF */ -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -/* #undef HAVE_ATAN2F */ -#define HAVE_CEIL 1 -/* #undef HAVE_CEILF */ -/* #undef HAVE_COPYSIGN */ -/* #undef HAVE_COPYSIGNF */ -#define HAVE_COS 1 -/* #undef HAVE_COSF */ -#define HAVE_EXP 1 -/* #undef HAVE_EXPF */ -#define HAVE_FABS 1 -/* #undef HAVE_FABSF */ -#define HAVE_FLOOR 1 -/* #undef HAVE_FLOORF */ -#define HAVE_FMOD 1 -/* #undef HAVE_FMODF */ -#define HAVE_LOG 1 -/* #undef HAVE_LOGF */ -#define HAVE_LOG10 1 -/* #undef HAVE_LOG10F */ -#define HAVE_POW 1 -/* #undef HAVE_POWF */ -#define HAVE_SIN 1 -/* #undef HAVE_SINF */ -/* #undef HAVE_SCALBN */ -/* #undef HAVE_SCALBNF */ -#define HAVE_SQRT 1 -/* #undef HAVE_SQRTF */ -#define HAVE_TAN 1 -/* #undef HAVE_TANF */ -/* #undef HAVE_TRUNC */ -/* #undef HAVE_TRUNCF */ -/* #undef HAVE_LROUND */ -/* #undef HAVE_LROUNDF */ -/* #undef HAVE_ROUND */ -/* #undef HAVE_ROUNDF */ - -#endif /* SDL_config_os2_h_ */ diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h index 58e0b7ecb..1ae40aab3 100644 --- a/include/SDL_config_windows.h +++ b/include/SDL_config_windows.h @@ -89,7 +89,6 @@ typedef unsigned int uintptr_t; #define HAVE_DDRAW_H 1 #define HAVE_DINPUT_H 1 #define HAVE_DSOUND_H 1 -#ifndef __WATCOMC__ #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ @@ -101,7 +100,6 @@ typedef unsigned int uintptr_t; #endif #if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ #define HAVE_D3D12_H 1 -#endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ #define HAVE_SHELLSCALINGAPI_H 1 #endif @@ -136,11 +134,8 @@ typedef unsigned int uintptr_t; #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ #define HAVE_QSORT 1 #define HAVE_BSEARCH 1 -#endif #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -186,7 +181,6 @@ typedef unsigned int uintptr_t; #define HAVE_SIN 1 #define HAVE_SQRT 1 #define HAVE_TAN 1 -#ifndef __WATCOMC__ #define HAVE_ACOSF 1 #define HAVE_ASINF 1 #define HAVE_ATANF 1 @@ -204,7 +198,6 @@ typedef unsigned int uintptr_t; #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#endif #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 @@ -227,14 +220,6 @@ typedef unsigned int uintptr_t; #ifdef _USE_MATH_DEFINES #define HAVE_M_PI 1 #endif -#elif defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_ROUND 1 -#define HAVE_SCALBN 1 -#define HAVE_TRUNC 1 #else #define HAVE_M_PI 1 #endif diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 0f2b257ab..1816d4eb4 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -97,13 +97,6 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall -#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ -# define GLAPI extern -# define GLAPIENTRY _System -# define APIENTRY _System -# if defined(__GNUC__) && !defined(_System) -# define _System -# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 45f8e7540..f28b19d57 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -111,10 +111,6 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif -#if defined(SDL_VIDEO_DRIVER_OS2) -#define INCL_WIN -#include -#endif #endif /* SDL_PROTOTYPES_ONLY */ #if defined(SDL_VIDEO_DRIVER_KMSDRM) @@ -145,7 +141,6 @@ typedef enum SDL_SYSWM_WINRT, SDL_SYSWM_ANDROID, SDL_SYSWM_VIVANTE, - SDL_SYSWM_OS2, SDL_SYSWM_HAIKU, SDL_SYSWM_KMSDRM, SDL_SYSWM_RISCOS @@ -201,16 +196,6 @@ struct SDL_SysWMmsg int dummy; /* No Vivante window events yet */ } vivante; -#endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - BOOL fFrame; /**< TRUE if hwnd is a frame window */ - HWND hwnd; /**< The window receiving the message */ - ULONG msg; /**< The message identifier */ - MPARAM mp1; /**< The first first message parameter */ - MPARAM mp2; /**< The second first message parameter */ - } os2; #endif /* Can't have an empty union */ int dummy; @@ -318,14 +303,6 @@ struct SDL_SysWMinfo } android; #endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - HWND hwnd; /**< The window handle */ - HWND hwndFrame; /**< The frame window handle */ - } os2; -#endif - #if defined(SDL_VIDEO_DRIVER_VIVANTE) struct { diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 6bedcb555..ea8d36fb6 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -38,13 +38,6 @@ #if defined(__WIN32__) || defined(__GDK__) #include /* _beginthreadex() and _endthreadex() */ #endif -#if defined(__OS2__) /* for _beginthread() and _endthread() */ -#ifndef __EMX__ -#include -#else -#include -#endif -#endif #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -145,42 +138,6 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) #endif -#elif defined(__OS2__) -/* - * just like the windows case above: We compile SDL3 - * into a dll with Watcom's runtime statically linked. - */ -#define SDL_PASSED_BEGINTHREAD_ENDTHREAD - -typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); -typedef void (*pfnSDL_CurrentEndThread)(void); - -#ifndef SDL_beginthread -#define SDL_beginthread _beginthread -#endif -#ifndef SDL_endthread -#define SDL_endthread _endthread -#endif - -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); - -#if defined(SDL_CreateThread) && SDL_DYNAMIC_API -#undef SDL_CreateThread -#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#undef SDL_CreateThreadWithStackSize -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#else -#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#endif - #else /** diff --git a/include/begin_code.h b/include/begin_code.h index b3e69e85c..bc248b2e4 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -57,12 +57,6 @@ # else # define DECLSPEC # endif -# elif defined(__OS2__) -# ifdef BUILD_SDL -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -76,11 +70,6 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__) #define SDLCALL __cdecl -#elif defined(__OS2__) || defined(__EMX__) -#define SDLCALL _System -# if defined (__GNUC__) && !defined(_System) -# define _System /* for old EMX/GCC compat. */ -# endif #else #define SDLCALL #endif diff --git a/src/SDL.c b/src/SDL.c index 6297159e4..90bf7a2cb 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -22,17 +22,9 @@ #if defined(__WIN32__) || defined(__GDK__) #include "core/windows/SDL_windows.h" -#elif defined(__OS2__) -#include /* _exit() */ #elif !defined(__WINRT__) #include /* _exit(), etc. */ #endif -#if defined(__OS2__) -#include "core/os2/SDL_os2.h" -#if SDL_THREAD_OS2 -#include "thread/os2/SDL_systls_c.h" -#endif -#endif /* this checks for HAVE_DBUS_DBUS_H internally. */ #include "core/linux/SDL_dbus.h" @@ -198,10 +190,6 @@ SDL_InitSubSystem(Uint32 flags) flags |= SDL_INIT_EVENTS; } -#if SDL_THREAD_OS2 - SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ -#endif - #if SDL_VIDEO_DRIVER_WINDOWS if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { if (SDL_HelperWindowCreate() < 0) { @@ -359,13 +347,6 @@ SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { -#if defined(__OS2__) -#if SDL_THREAD_OS2 - SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ -#endif - SDL_OS2Quit(); -#endif - /* Shut down requested initialized subsystems */ #if !SDL_SENSOR_DISABLED if ((flags & SDL_INIT_SENSOR)) { diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 088887822..76395f54f 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -120,9 +120,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OS2 - &OS2AUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_DISK &DISKAUDIO_bootstrap, #endif diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index a911de041..a76c5c21b 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -211,7 +211,6 @@ extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; extern AudioBootStrap N3DSAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; -extern AudioBootStrap OS2AUDIO_bootstrap; #endif /* SDL_sysaudio_h_ */ diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c deleted file mode 100644 index 9ddfb7607..000000000 --- a/src/audio/os2/SDL_os2audio.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_OS2 - -/* Allow access to a raw mixing buffer */ - -#include "../../core/os2/SDL_os2.h" - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_os2audio.h" - -/* -void lockIncr(volatile int *piVal); -#pragma aux lockIncr = \ - "lock add [eax], 1 "\ - parm [eax]; - -void lockDecr(volatile int *piVal); -#pragma aux lockDecr = \ - "lock sub [eax], 1 "\ - parm [eax]; -*/ - -static ULONG _getEnvULong(const char *name, ULONG ulMax, ULONG ulDefault) -{ - ULONG ulValue; - char* end; - char* envval = SDL_getenv(name); - - if (envval == NULL) - return ulDefault; - - ulValue = SDL_strtoul(envval, &end, 10); - return (end == envval) || (ulValue > ulMax)? ulDefault : ulMax; -} - -static int _MCIError(const char *func, ULONG ulResult) -{ - CHAR acBuf[128]; - mciGetErrorString(ulResult, acBuf, sizeof(acBuf)); - return SDL_SetError("[%s] %s", func, acBuf); -} - -static void _mixIOError(const char *function, ULONG ulRC) -{ - debug_os2("%s() - failed, rc = 0x%X (%s)", - function, ulRC, - (ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" : - (ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown"); -} - -static LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, - ULONG ulFlags) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; - ULONG ulRC; - - if (ulFlags != MIX_WRITE_COMPLETE) { - debug_os2("flags = 0x%X", ulFlags); - return 0; - } - - /*lockDecr((int *)&pAData->ulQueuedBuf);*/ - ulRC = DosPostEventSem(pAData->hevBuf); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem(), rc = %u", ulRC); - } - - return 1; /* return value doesn't seem to matter. */ -} - -static LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, - ULONG ulFlags) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; - ULONG ulRC; - - if (ulFlags != MIX_READ_COMPLETE) { - debug_os2("flags = 0x%X", ulFlags); - return 0; - } - - pAData->stMCIMixSetup.pmixRead(pAData->stMCIMixSetup.ulMixHandle, pBuffer, 1); - - ulRC = DosPostEventSem(pAData->hevBuf); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem(), rc = %u", ulRC); - } - - return 1; -} - - -static void OS2_DetectDevices(void) -{ - MCI_SYSINFO_PARMS stMCISysInfo; - CHAR acBuf[256]; - ULONG ulDevicesNum; - MCI_SYSINFO_LOGDEVICE stLogDevice; - MCI_SYSINFO_PARMS stSysInfoParams; - ULONG ulRC; - ULONG ulHandle = 0; - - acBuf[0] = '\0'; - stMCISysInfo.pszReturn = acBuf; - stMCISysInfo.ulRetSize = sizeof(acBuf); - stMCISysInfo.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_QUANTITY, - &stMCISysInfo, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_QUANTITY - failed, rc = 0x%X", ulRC); - return; - } - - ulDevicesNum = SDL_strtoul(stMCISysInfo.pszReturn, NULL, 10); - - for (stSysInfoParams.ulNumber = 0; stSysInfoParams.ulNumber < ulDevicesNum; - stSysInfoParams.ulNumber++) { - /* Get device install name. */ - stSysInfoParams.pszReturn = acBuf; - stSysInfoParams.ulRetSize = sizeof(acBuf); - stSysInfoParams.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_INSTALLNAME, - &stSysInfoParams, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_INSTALLNAME - failed, rc = 0x%X", ulRC); - continue; - } - - /* Get textual product description. */ - stSysInfoParams.ulItem = MCI_SYSINFO_QUERY_DRIVER; - stSysInfoParams.pSysInfoParm = &stLogDevice; - SDL_strlcpy(stLogDevice.szInstallName, stSysInfoParams.pszReturn, MAX_DEVICE_NAME); - ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_ITEM, - &stSysInfoParams, 0); - if (ulRC != NO_ERROR) { - debug_os2("MCI_SYSINFO, MCI_SYSINFO_ITEM - failed, rc = 0x%X", ulRC); - continue; - } - - ulHandle++; - SDL_AddAudioDevice(0, stLogDevice.szProductInfo, NULL, (void *)(ulHandle)); - ulHandle++; - SDL_AddAudioDevice(1, stLogDevice.szProductInfo, NULL, (void *)(ulHandle)); - } -} - -static void OS2_WaitDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - ULONG ulRC; - - /* Wait for an audio chunk to finish */ - ulRC = DosWaitEventSem(pAData->hevBuf, 5000); - if (ulRC != NO_ERROR) { - debug_os2("DosWaitEventSem(), rc = %u", ulRC); - } -} - -static Uint8 *OS2_GetDeviceBuf(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - return (Uint8 *) pAData->aMixBuffers[pAData->ulNextBuf].pBuffer; -} - -static void OS2_PlayDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - ULONG ulRC; - PMCI_MIX_BUFFER pMixBuffer = &pAData->aMixBuffers[pAData->ulNextBuf]; - - /* Queue it up */ - /*lockIncr((int *)&pAData->ulQueuedBuf);*/ - ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle, - pMixBuffer, 1); - if (ulRC != MCIERR_SUCCESS) { - _mixIOError("pmixWrite", ulRC); - } else { - pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers; - } -} - -static void OS2_CloseDevice(_THIS) -{ - SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden; - MCI_GENERIC_PARMS sMCIGenericParms; - ULONG ulRC; - - if (pAData == NULL) - return; - - /* Close up audio */ - if (pAData->usDeviceId != (USHORT)~0) { /* Device is open. */ - if (pAData->stMCIMixSetup.ulBitsPerSample != 0) { /* Mixer was initialized. */ - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_DEINIT, - &pAData->stMCIMixSetup, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_MIXSETUP, MCI_MIXSETUP_DEINIT - failed"); - } - } - - if (pAData->cMixBuffers != 0) { /* Buffers was allocated. */ - MCI_BUFFER_PARMS stMCIBuffer; - - stMCIBuffer.ulBufferSize = pAData->aMixBuffers[0].ulBufferLength; - stMCIBuffer.ulNumBuffers = pAData->cMixBuffers; - stMCIBuffer.pBufList = pAData->aMixBuffers; - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER, - MCI_WAIT | MCI_DEALLOCATE_MEMORY, &stMCIBuffer, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_BUFFER, MCI_DEALLOCATE_MEMORY - failed"); - } - } - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_CLOSE, MCI_WAIT, - &sMCIGenericParms, 0); - if (ulRC != MCIERR_SUCCESS) { - debug_os2("MCI_CLOSE - failed"); - } - } - - if (pAData->hevBuf != NULLHANDLE) - DosCloseEventSem(pAData->hevBuf); - - SDL_free(pAData); -} - -static int OS2_OpenDevice(_THIS, const char *devname) -{ - SDL_PrivateAudioData *pAData; - SDL_AudioFormat test_format; - MCI_AMP_OPEN_PARMS stMCIAmpOpen; - MCI_BUFFER_PARMS stMCIBuffer; - ULONG ulRC; - ULONG ulIdx; - BOOL new_freq; - SDL_bool iscapture = _this->iscapture; - - new_freq = FALSE; - SDL_zero(stMCIAmpOpen); - SDL_zero(stMCIBuffer); - - for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - if (test_format == AUDIO_U8 || test_format == AUDIO_S16) - break; - } - if (!test_format) { - debug_os2("Unsupported audio format, AUDIO_S16 used"); - test_format = AUDIO_S16; - } - - pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); - if (pAData == NULL) - return SDL_OutOfMemory(); - _this->hidden = pAData; - - ulRC = DosCreateEventSem(NULL, &pAData->hevBuf, DCE_AUTORESET, TRUE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateEventSem() failed, rc = %u", ulRC); - return -1; - } - - /* Open audio device */ - stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0; - stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX; - ulRC = mciSendCommand(0, MCI_OPEN, - (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)? - MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE : - MCI_WAIT | MCI_OPEN_TYPE_ID, - &stMCIAmpOpen, 0); - if (ulRC != MCIERR_SUCCESS) { - stMCIAmpOpen.usDeviceID = (USHORT)~0; - return _MCIError("MCI_OPEN", ulRC); - } - pAData->usDeviceId = stMCIAmpOpen.usDeviceID; - - if (iscapture) { - MCI_CONNECTOR_PARMS stMCIConnector; - MCI_AMP_SET_PARMS stMCIAmpSet; - BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0); - - /* Set particular connector. */ - SDL_zero(stMCIConnector); - stMCIConnector.ulConnectorType = (fLineIn)? MCI_LINE_IN_CONNECTOR : - MCI_MICROPHONE_CONNECTOR; - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_CONNECTOR, - MCI_WAIT | MCI_ENABLE_CONNECTOR | - MCI_CONNECTOR_TYPE, &stMCIConnector, 0); - - /* Disable monitor. */ - SDL_zero(stMCIAmpSet); - stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR; - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET, - MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM, - &stMCIAmpSet, 0); - - /* Set record volume. */ - stMCIAmpSet.ulLevel = _getEnvULong("SDL_AUDIO_RECVOL", 100, 90); - stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO; - stMCIAmpSet.ulAudio = MCI_SET_AUDIO_ALL; /* Both cnannels. */ - stMCIAmpSet.ulValue = (fLineIn) ? MCI_LINE_IN_CONNECTOR : - MCI_MICROPHONE_CONNECTOR ; - - mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET, - MCI_WAIT | MCI_SET_AUDIO | MCI_AMP_SET_GAIN, - &stMCIAmpSet, 0); - } - - _this->spec.format = test_format; - _this->spec.channels = _this->spec.channels > 1 ? 2 : 1; - if (_this->spec.freq < 8000) { - _this->spec.freq = 8000; - new_freq = TRUE; - } else if (_this->spec.freq > 48000) { - _this->spec.freq = 48000; - new_freq = TRUE; - } - - /* Setup mixer. */ - pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM; - pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(test_format); - pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq; - pAData->stMCIMixSetup.ulChannels = _this->spec.channels; - pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; - if (!iscapture) { - pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY; - pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent; - } else { - pAData->stMCIMixSetup.ulFormatMode= MCI_RECORD; - pAData->stMCIMixSetup.pmixEvent = cbAudioReadEvent; - } - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0); - if (ulRC != MCIERR_SUCCESS && _this->spec.freq > 44100) { - new_freq = TRUE; - pAData->stMCIMixSetup.ulSamplesPerSec = 44100; - _this->spec.freq = 44100; - ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP, - MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0); - } - - debug_os2("Setup mixer [BPS: %u, Freq.: %u, Channels: %u]: %s", - pAData->stMCIMixSetup.ulBitsPerSample, - pAData->stMCIMixSetup.ulSamplesPerSec, - pAData->stMCIMixSetup.ulChannels, - (ulRC == MCIERR_SUCCESS)? "SUCCESS" : "FAIL"); - - if (ulRC != MCIERR_SUCCESS) { - pAData->stMCIMixSetup.ulBitsPerSample = 0; - return _MCIError("MCI_MIXSETUP", ulRC); - } - - if (_this->spec.samples == 0 || new_freq == TRUE) { - /* also see SDL_audio.c:prepare_audiospec() */ - /* Pick a default of ~46 ms at desired frequency */ - Uint32 samples = (_this->spec.freq / 1000) * 46; - Uint32 power2 = 1; - while (power2 < samples) { - power2 <<= 1; - } - _this->spec.samples = power2; - } - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&_this->spec); - - /* Allocate memory buffers */ - stMCIBuffer.ulBufferSize = _this->spec.size;/* (_this->spec.freq / 1000) * 100 */ - stMCIBuffer.ulNumBuffers = NUM_BUFFERS; - stMCIBuffer.pBufList = pAData->aMixBuffers; - - ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER, - MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0); - if (ulRC != MCIERR_SUCCESS) { - return _MCIError("MCI_BUFFER", ulRC); - } - pAData->cMixBuffers = stMCIBuffer.ulNumBuffers; - _this->spec.size = stMCIBuffer.ulBufferSize; - - /* Fill all device buffers with data */ - for (ulIdx = 0; ulIdx < stMCIBuffer.ulNumBuffers; ulIdx++) { - pAData->aMixBuffers[ulIdx].ulFlags = 0; - pAData->aMixBuffers[ulIdx].ulBufferLength = stMCIBuffer.ulBufferSize; - pAData->aMixBuffers[ulIdx].ulUserParm = (ULONG)pAData; - - SDL_memset(((PMCI_MIX_BUFFER)stMCIBuffer.pBufList)[ulIdx].pBuffer, - _this->spec.silence, stMCIBuffer.ulBufferSize); - } - - /* Write buffers to kick off the amp mixer */ - ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle, - pAData->aMixBuffers, 1); - if (ulRC != MCIERR_SUCCESS) { - _mixIOError("pmixWrite", ulRC); - return -1; - } - - return 0; -} - - -static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->DetectDevices = OS2_DetectDevices; - impl->OpenDevice = OS2_OpenDevice; - impl->PlayDevice = OS2_PlayDevice; - impl->WaitDevice = OS2_WaitDevice; - impl->GetDeviceBuf = OS2_GetDeviceBuf; - impl->CloseDevice = OS2_CloseDevice; - - /* TODO: IMPLEMENT CAPTURE SUPPORT: - impl->CaptureFromDevice = ; - impl->FlushCapture = ; - impl->HasCaptureSupport = SDL_TRUE; - */ - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap OS2AUDIO_bootstrap = { - "DART", "OS/2 DART", OS2_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/os2/SDL_os2audio.h b/src/audio/os2/SDL_os2audio.h deleted file mode 100644 index 07ebbae39..000000000 --- a/src/audio/os2/SDL_os2audio.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2mm_h_ -#define SDL_os2mm_h_ - -#include "../SDL_sysaudio.h" - -#define INCL_OS2MM -#define INCL_PM -#define INCL_DOS -#define INCL_DOSERRORS -#include -#include - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *_this - -#define NUM_BUFFERS 3 - -typedef struct SDL_PrivateAudioData -{ - USHORT usDeviceId; - BYTE _pad[2]; - MCI_MIXSETUP_PARMS stMCIMixSetup; - HEV hevBuf; - ULONG ulNextBuf; - ULONG cMixBuffers; - MCI_MIX_BUFFER aMixBuffers[NUM_BUFFERS]; -/* ULONG ulQueuedBuf;*/ -} SDL_PrivateAudioData; - -#endif /* SDL_os2mm_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/SDL_os2.c b/src/core/os2/SDL_os2.c deleted file mode 100644 index 553f88cfd..000000000 --- a/src/core/os2/SDL_os2.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if defined(__OS2__) - -#include "SDL_os2.h" - -/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */ -void SDL_OS2Quit(void) -{ - /* Unload DLL used for iconv. We can do it at any time and use iconv again - - * dynamic library will be loaded on first call iconv_open() (see geniconv). */ - libiconv_clean(); -} - -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/SDL_os2.h b/src/core/os2/SDL_os2.h deleted file mode 100644 index 84068cc13..000000000 --- a/src/core/os2/SDL_os2.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef SDL_os2_h_ -#define SDL_os2_h_ - -#include "SDL_log.h" -#include "SDL_stdinc.h" - -#ifdef OS2DEBUG -#if (OS2DEBUG-0 >= 2) -# define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \ - __func__ "(): " ##s, ##__VA_ARGS__) -#else -# define debug_os2(s,...) printf(__func__ "(): " ##s "\n", ##__VA_ARGS__) -#endif - -#else /* no debug */ - -# define debug_os2(s,...) do {} while (0) - -#endif /* OS2DEBUG */ - -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -#define OS2_SysToUTF8(S) SDL_iconv_string("UTF-8", "", (char *)(S), SDL_strlen(S)+1) -#define OS2_UTF8ToSys(S) SDL_iconv_string("", "UTF-8", (char *)(S), SDL_strlen(S)+1) -#define libiconv_clean() do {} while(0) -#else -/* StrUTF8New() - geniconv/sys2utf8.c */ -#include "geniconv/geniconv.h" -#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1) -#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1) -#endif - -/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */ -void SDL_OS2Quit(void); - -#endif /* SDL_os2_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/geniconv.c b/src/core/os2/geniconv/geniconv.c deleted file mode 100644 index 5976fe79f..000000000 --- a/src/core/os2/geniconv/geniconv.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Universal iconv implementation for OS/2. - - Andrey Vasilkin, 2016. -*/ - -#define INCL_DOSMODULEMGR /* Module Manager */ -#define INCL_DOSERRORS /* Error values */ -#include - -#include "geniconv.h" - -/*#define DEBUG*/ -#ifdef DEBUG -# include -# define iconv_debug(s,...) printf(__func__"(): "##s"\n" ,##__VA_ARGS__) -#else -# define iconv_debug(s,...) do {} while (0) -#endif - -/* Exports from os2iconv.c */ -extern iconv_t _System os2_iconv_open (const char* tocode, const char* fromcode); -extern size_t _System os2_iconv (iconv_t cd, - char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); -extern int _System os2_iconv_close (iconv_t cd); - -/* Functions pointers */ -typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*); -typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *); -typedef int (_System *FNICONV_CLOSE)(iconv_t); - -static HMODULE hmIconv = NULLHANDLE; -static FNICONV_OPEN fn_iconv_open = os2_iconv_open; -static FNICONV fn_iconv = os2_iconv; -static FNICONV_CLOSE fn_iconv_close = os2_iconv_close; - -static int geniconv_init = 0; - - -static BOOL _loadDLL(const char *dllname, - const char *sym_iconvopen, - const char *sym_iconv, - const char *sym_iconvclose) -{ - ULONG rc; - char error[256]; - - rc = DosLoadModule(error, sizeof(error), dllname, &hmIconv); - if (rc != NO_ERROR) { - iconv_debug("DLL %s not loaded: %s", dllname, error); - return FALSE; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconvopen, (PFN *)&fn_iconv_open); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconvopen, dllname); - goto fail; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconv, (PFN *)&fn_iconv); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconv, dllname); - goto fail; - } - - rc = DosQueryProcAddr(hmIconv, 0, sym_iconvclose, (PFN *)&fn_iconv_close); - if (rc != NO_ERROR) { - iconv_debug("Error: cannot find entry %s in %s", sym_iconvclose, dllname); - goto fail; - } - - iconv_debug("DLL %s used", dllname); - return TRUE; - - fail: - DosFreeModule(hmIconv); - hmIconv = NULLHANDLE; - return FALSE; -} - -static void _init(void) -{ - if (geniconv_init) { - return; /* Already initialized */ - } - - geniconv_init = 1; - - /* Try to load kiconv.dll, iconv2.dll or iconv.dll */ - if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") && - !_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") && - !_loadDLL("ICONV", "_iconv_open", "_iconv", "_iconv_close") ) { - /* No DLL was loaded - use OS/2 conversion objects API */ - iconv_debug("Uni*() API used"); - fn_iconv_open = os2_iconv_open; - fn_iconv = os2_iconv; - fn_iconv_close = os2_iconv_close; - } -} - - -/* Public routines. - * ---------------- - */ - -/* function to unload the used iconv dynamic library */ -void libiconv_clean(void) -{ - geniconv_init = 0; - - /* reset the function pointers. */ - fn_iconv_open = os2_iconv_open; - fn_iconv = os2_iconv; - fn_iconv_close = os2_iconv_close; - - if (hmIconv != NULLHANDLE) { - DosFreeModule(hmIconv); - hmIconv = NULLHANDLE; - } -} - -iconv_t libiconv_open(const char* tocode, const char* fromcode) -{ - _init(); - return fn_iconv_open(tocode, fromcode); -} - -size_t libiconv(iconv_t cd, char* * inbuf, size_t *inbytesleft, - char* * outbuf, size_t *outbytesleft) -{ - return fn_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); -} - -int libiconv_close(iconv_t cd) -{ - return fn_iconv_close(cd); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/geniconv.h b/src/core/os2/geniconv/geniconv.h deleted file mode 100644 index 607fe8f8d..000000000 --- a/src/core/os2/geniconv/geniconv.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Universal iconv implementation for OS/2. - - Andrey Vasilkin, 2016. -*/ - -#ifndef GENICONV_H -#define GENICONV_H - -#include "iconv.h" - -#ifdef iconv_open -#undef iconv_open -#endif -#define iconv_open libiconv_open - -#ifdef iconv -#undef iconv -#endif -#define iconv libiconv - -#ifdef iconv_close -#undef iconv_close -#endif -#define iconv_close libiconv_close - -#define iconv_clean libiconv_clean - -/* Non-standard function for iconv to unload the used dynamic library */ -void libiconv_clean(void); - -iconv_t libiconv_open (const char *tocode, const char *fromcode); -int libiconv_close(iconv_t cd); -size_t libiconv (iconv_t cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - -/* System codepage <-> UTF-8 - * - * StrUTF8() - * Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8 to - * the system cp (to_utf8 is 0). Converted ASCIIZ string will be placed at the - * buffer dst, up to c_dst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes. - * Returns the number of bytes written into dst, not counting the terminating - * 0 byte(s) or -1 on error. - */ -int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src); - -/* StrUTF8New() - * Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8 - * to the system cp (to_utf8 is 0). Memory for the new string is obtained by - * using libc malloc(). - * Returns converted string, terminating two bytes 0 is appended to the result. - * Returns null on error. - */ -char *StrUTF8New(int to_utf8, char *str, int c_str); - -/* StrUTF8Free() - * Deallocates the memory block allocated by StrUTF8New() (just libc free()). - */ -void StrUTF8Free(char *str); - -#endif /* GENICONV_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/iconv.h b/src/core/os2/geniconv/iconv.h deleted file mode 100644 index b336dabe3..000000000 --- a/src/core/os2/geniconv/iconv.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ICONV_H_ /* minimal iconv.h header based on public knowledge */ -#define ICONV_H_ - -#include /* size_t */ -#include - -typedef void *iconv_t; - -#ifdef __cplusplus -extern "C" { -#endif - -extern iconv_t iconv_open(const char *, const char *); -extern size_t iconv(iconv_t, char **, size_t *, char **, size_t *); -extern int iconv_close(iconv_t); - -#ifdef __cplusplus -} -#endif - -#endif /* ICONV_H_ */ diff --git a/src/core/os2/geniconv/makefile b/src/core/os2/geniconv/makefile deleted file mode 100644 index 566c13d29..000000000 --- a/src/core/os2/geniconv/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# Universal iconv implementation for OS/2. -# -# OpenWatcom makefile to build a library that uses kiconv.dll / iconv2.dll / -# iconv.dll or OS/2 Uni*() API. -# -# Andrey Vasilkin, 2016. -# - -LIBFILE = geniconv.lib - -all: $(LIBFILE) test.exe .symbolic - -CFLAGS = -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h -I. -bt=os2 -q -d0 -w2 -DGENICONV_STANDALONE=1 - -SRCS = geniconv.c os2cp.c os2iconv.c -SRCS+= sys2utf8.c - -OBJS = $(SRCS:.c=.obj) - -LIBS = libuls.lib libconv.lib $(LIBFILE) - -test.exe: $(LIBFILE) test.obj - wlink op quiet system os2v2 file test.obj lib {$(LIBS)} name $* - -$(LIBFILE): $(OBJS) - @if exist $@ rm $@ - @for %f in ($(OBJS)) do wlib -q -b $* +%f - -.c.obj: - wcc386 $(CFLAGS) -fo=$^@ $< - -clean: .SYMBOLIC - @if exist *.obj rm *.obj - @if exist *.err rm *.err - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist test.exe rm test.exe diff --git a/src/core/os2/geniconv/os2cp.c b/src/core/os2/geniconv/os2cp.c deleted file mode 100644 index 0a651e17d..000000000 --- a/src/core/os2/geniconv/os2cp.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#define INCL_DOSNLS -#define INCL_DOSERRORS -#include - -#include "os2cp.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#include -#define SDL_isspace isspace -#define SDL_strchr strchr -#define SDL_memcpy memcpy -#define SDL_strupr strupr -#define SDL_strcmp strcmp -#endif - -typedef struct _CP2NAME { - ULONG ulCode; - PSZ pszName; -} CP2NAME; - -typedef struct _NAME2CP { - PSZ pszName; - ULONG ulCode; -} NAME2CP; - -static CP2NAME aCP2Name[] = { - {367, "ANSI_X3.4-1968"}, - {813, "ECMA-118"}, - {819, "CP819"}, - {850, "850"}, - {862, "862"}, - {866, "866"}, - {874, "ISO-IR-166"}, - {878, "KOI8-R"}, - {896, "JISX0201-1976"}, - {901, "ISO-8859-13"}, - {912, "ISO-8859-2"}, - {913, "ISO-8859-3"}, - {914, "ISO-8859-4"}, - {915, "CYRILLIC"}, - {920, "ISO-8859-9"}, - {923, "ISO-8859-15"}, - {943, "MS_KANJI"}, - {954, "EUC-JP"}, - {964, "EUC-TW"}, - {970, "EUC-KR"}, - {1051, "HP-ROMAN8"}, - {1089, "ARABIC"}, - {1129, "VISCII"}, - {1168, "KOI8-U"}, - {1200, "ISO-10646-UCS-2"}, - {1202, "UTF-16LE"}, - {1204, "UCS-2BE"}, - {1208, "UTF-8"}, - {1232, "UTF-32BE"}, - {1234, "UTF-32LE"}, - {1236, "ISO-10646-UCS-4"}, - {1250, "CP1250"}, - {1251, "CP1251"}, - {1252, "CP1252"}, - {1253, "CP1253"}, - {1254, "CP1254"}, - {1255, "CP1255"}, - {1256, "CP1256"}, - {1257, "CP1257"}, - {1275, "MAC"}, - {1383, "CN-GB"}, - {1386, "GBK"}, - {1392, "GB18030"}, - {62210, "HEBREW"} -}; - -static NAME2CP aName2CP[] = { - {"850", 850}, - {"862", 862}, - {"866", 866}, - {"ANSI_X3.4-1968", 367}, - {"ANSI_X3.4-1986", 367}, - {"ARABIC", 1089}, - {"ASCII", 367}, - {"ASMO-708", 1089}, - {"CN-GB", 1383}, - {"CP1250", 1250}, - {"CP1251", 1251}, - {"CP1252", 1252}, - {"CP1253", 1253}, - {"CP1254", 1254}, - {"CP1255", 1255}, - {"CP1256", 1256}, - {"CP1257", 1257}, - {"CP367", 367}, - {"CP819", 819}, - {"CP850", 850}, - {"CP862", 862}, - {"CP866", 866}, - {"CP936", 1386}, - {"CSASCII", 367}, - {"CSEUCKR", 970}, - {"CSEUCPKDFMTJAPANESE", 954}, - {"CSEUCTW", 964}, - {"CSGB2312", 1383}, - {"CSHALFWIDTHKATAKANA", 896}, - {"CSHPROMAN8", 1051}, - {"CSIBM866", 866}, - {"CSISOLATIN1", 819}, - {"CSISOLATIN2", 912}, - {"CSISOLATIN3", 913}, - {"CSISOLATIN4", 914}, - {"CSISOLATIN5", 920}, - {"CSISOLATINARABIC", 1089}, - {"CSISOLATINCYRILLIC", 915}, - {"CSISOLATINGREEK", 813}, - {"CSISOLATINHEBREW", 62210}, - {"CSKOI8R", 878}, - {"CSKSC56011987", 970}, - {"CSMACINTOSH", 1275}, - {"CSPC850MULTILINGUAL", 850}, - {"CSPC862LATINHEBREW", 862}, - {"CSSHIFTJIS", 943}, - {"CSUCS4", 1236}, - {"CSUNICODE", 1200}, - {"CSUNICODE11", 1204}, - {"CSVISCII", 1129}, - {"CYRILLIC", 915}, - {"ECMA-114", 1089}, - {"ECMA-118", 813}, - {"ELOT_928", 813}, - {"EUC-CN", 1383}, - {"EUC-JP", 954}, - {"EUC-KR", 970}, - {"EUC-TW", 964}, - {"EUCCN", 1383}, - {"EUCJP", 954}, - {"EUCKR", 970}, - {"EUCTW", 964}, - {"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 954}, - {"GB18030", 1392}, - {"GB2312", 1383}, - {"GBK", 1386}, - {"GREEK", 813}, - {"GREEK8", 813}, - {"HEBREW", 62210}, - {"HP-ROMAN8", 1051}, - {"IBM367", 367}, - {"IBM819", 819}, - {"IBM850", 850}, - {"IBM862", 862}, - {"IBM866", 866}, - {"ISO-10646-UCS-2", 1200}, - {"ISO-10646-UCS-4", 1236}, - {"ISO-8859-1", 819}, - {"ISO-8859-13", 901}, - {"ISO-8859-15", 923}, - {"ISO-8859-2", 912}, - {"ISO-8859-3", 913}, - {"ISO-8859-4", 914}, - {"ISO-8859-5", 915}, - {"ISO-8859-6", 1089}, - {"ISO-8859-7", 813}, - {"ISO-8859-8", 62210}, - {"ISO-8859-9", 920}, - {"ISO-IR-100", 819}, - {"ISO-IR-101", 912}, - {"ISO-IR-109", 913}, - {"ISO-IR-110", 914}, - {"ISO-IR-126", 813}, - {"ISO-IR-127", 1089}, - {"ISO-IR-138", 62210}, - {"ISO-IR-144", 915}, - {"ISO-IR-148", 920}, - {"ISO-IR-149", 970}, - {"ISO-IR-166", 874}, - {"ISO-IR-179", 901}, - {"ISO-IR-203", 923}, - {"ISO-IR-6", 367}, - {"ISO646-US", 367}, - {"ISO8859-1", 819}, - {"ISO8859-13", 901}, - {"ISO8859-15", 923}, - {"ISO8859-2", 912}, - {"ISO8859-3", 913}, - {"ISO8859-4", 914}, - {"ISO8859-5", 915}, - {"ISO8859-6", 1089}, - {"ISO8859-7", 813}, - {"ISO8859-8", 62210}, - {"ISO8859-9", 920}, - {"ISO_646.IRV:1991", 367}, - {"ISO_8859-1", 819}, - {"ISO_8859-13", 901}, - {"ISO_8859-15", 923}, - {"ISO_8859-15:1998", 923}, - {"ISO_8859-1:1987", 819}, - {"ISO_8859-2", 912}, - {"ISO_8859-2:1987", 912}, - {"ISO_8859-3", 913}, - {"ISO_8859-3:1988", 913}, - {"ISO_8859-4", 914}, - {"ISO_8859-4:1988", 914}, - {"ISO_8859-5", 915}, - {"ISO_8859-5:1988", 915}, - {"ISO_8859-6", 1089}, - {"ISO_8859-6:1987", 1089}, - {"ISO_8859-7", 813}, - {"ISO_8859-7:1987", 813}, - {"ISO_8859-7:2003", 813}, - {"ISO_8859-8", 62210}, - {"ISO_8859-8:1988", 62210}, - {"ISO_8859-9", 920}, - {"ISO_8859-9:1989", 920}, - {"JISX0201-1976", 896}, - {"JIS_X0201", 896}, - {"KOI8-R", 878}, - {"KOI8-U", 1168}, - {"KOREAN", 970}, - {"KSC_5601", 970}, - {"KS_C_5601-1987", 970}, - {"KS_C_5601-1989", 970}, - {"L1", 819}, - {"L2", 912}, - {"L3", 913}, - {"L4", 914}, - {"L5", 920}, - {"L7", 901}, - {"LATIN-9", 923}, - {"LATIN1", 819}, - {"LATIN2", 912}, - {"LATIN3", 913}, - {"LATIN4", 914}, - {"LATIN5", 920}, - {"LATIN7", 901}, - {"MAC", 1275}, - {"MACINTOSH", 1275}, - {"MACROMAN", 1275}, - {"MS-ANSI", 1252}, - {"MS-ARAB", 1256}, - {"MS-CYRL", 1251}, - {"MS-EE", 1250}, - {"MS-GREEK", 1253}, - {"MS-HEBR", 1255}, - {"MS-TURK", 1254}, - {"MS936", 1386}, - {"MS_KANJI", 943}, - {"R8", 1051}, - {"ROMAN8", 1051}, - {"SHIFT-JIS", 943}, - {"SHIFT_JIS", 943}, - {"SJIS", 943}, - {"TIS-620", 874}, - {"TIS620", 874}, - {"TIS620-0", 874}, - {"TIS620.2529-1", 874}, - {"TIS620.2533-0", 874}, - {"TIS620.2533-1", 874}, - {"UCS-2", 1200}, - {"UCS-2BE", 1204}, - {"UCS-4", 1236}, - {"UNICODE-1-1", 1204}, - {"UNICODEBIG", 1204}, - {"US", 367}, - {"US-ASCII", 367}, - {"UTF-16", 1204}, - {"UTF-16BE", 1200}, - {"UTF-16LE", 1202}, - {"UTF-32", 1236}, - {"UTF-32BE", 1232}, - {"UTF-32LE", 1234}, - {"UTF-8", 1208}, - {"VISCII", 1129}, - {"VISCII1.1-1", 1129}, - {"WINBALTRIM", 1257}, - {"WINDOWS-1250", 1250}, - {"WINDOWS-1251", 1251}, - {"WINDOWS-1252", 1252}, - {"WINDOWS-1253", 1253}, - {"WINDOWS-1254", 1254}, - {"WINDOWS-1255", 1255}, - {"WINDOWS-1256", 1256}, - {"WINDOWS-1257", 1257}, - {"WINDOWS-936", 1386}, - {"X0201", 896} -}; - -char *os2cpToName(unsigned long cp) -{ - ULONG ulLo = 0; - ULONG ulHi = (sizeof(aCP2Name) / sizeof(struct _CP2NAME)) - 1; - ULONG ulNext; - LONG lFound = -1; - - if (cp == SYSTEM_CP) { - ULONG aulCP[3]; - ULONG cCP; - if (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR) { - return NULL; - } - cp = aulCP[0]; - } - - if (aCP2Name[0].ulCode > cp || aCP2Name[ulHi].ulCode < cp) { - return NULL; - } - if (aCP2Name[0].ulCode == cp) { - return aCP2Name[0].pszName; - } - if (aCP2Name[ulHi].ulCode == cp) { - return aCP2Name[ulHi].pszName; - } - - while ((ulHi - ulLo) > 1) { - ulNext = (ulLo + ulHi) / 2; - - if (aCP2Name[ulNext].ulCode < cp) { - ulLo = ulNext; - } else if (aCP2Name[ulNext].ulCode > cp) { - ulHi = ulNext; - } else { - lFound = ulNext; - break; - } - } - - return (lFound == -1)? NULL : aCP2Name[lFound].pszName; -} - -unsigned long os2cpFromName(char *cp) -{ - ULONG ulLo = 0; - ULONG ulHi = (sizeof(aName2CP) / sizeof(struct _NAME2CP)) - 1; - ULONG ulNext; - LONG lFound = -1; - LONG lCmp; - PCHAR pcEnd; - CHAR acBuf[64]; - - if (cp == NULL) { - ULONG aulCP[3]; - ULONG cCP; - return (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)? 0 : aulCP[0]; - } - - while (SDL_isspace((unsigned char) *cp)) { - cp++; - } - - pcEnd = SDL_strchr(cp, ' '); - if (pcEnd == NULL) { - pcEnd = SDL_strchr(cp, '\0'); - } - ulNext = pcEnd - cp; - if (ulNext >= sizeof(acBuf)) { - return 0; - } - - SDL_memcpy(acBuf, cp, ulNext); - acBuf[ulNext] = '\0'; - SDL_strupr(acBuf); - - lCmp = SDL_strcmp(aName2CP[0].pszName, acBuf); - if (lCmp > 0) { - return 0; - } - if (lCmp == 0) { - return aName2CP[0].ulCode; - } - - lCmp = SDL_strcmp(aName2CP[ulHi].pszName, acBuf); - if (lCmp < 0) { - return 0; - } - if (lCmp == 0) { - return aName2CP[ulHi].ulCode; - } - - while ((ulHi - ulLo) > 1) { - ulNext = (ulLo + ulHi) / 2; - - lCmp = SDL_strcmp(aName2CP[ulNext].pszName, acBuf); - if (lCmp < 0) { - ulLo = ulNext; - } else if (lCmp > 0) { - ulHi = ulNext; - } else { - lFound = ulNext; - break; - } - } - - return (lFound == -1)? 0 : aName2CP[lFound].ulCode; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/os2cp.h b/src/core/os2/geniconv/os2cp.h deleted file mode 100644 index db3e167ec..000000000 --- a/src/core/os2/geniconv/os2cp.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef OS2CP_H -#define OS2CP_H 1 - -#define SYSTEM_CP 0 - -char *os2cpToName(unsigned long cp); -unsigned long os2cpFromName(char *cp); - -#endif /* OS2CP_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/os2iconv.c b/src/core/os2/geniconv/os2iconv.c deleted file mode 100644 index 13ad2cdc6..000000000 --- a/src/core/os2/geniconv/os2iconv.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Implementation iconv via OS/2 conversion objects API. - - Andrey Vasilkin. -*/ - -#define ICONV_THREAD_SAFE 1 - -#include "geniconv.h" -#define _ULS_CALLCONV_ -#define CALLCONV _System -#include -#ifdef ICONV_THREAD_SAFE -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#include -#endif - -#include "os2cp.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#include -#include -#if !defined(min) -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#endif -#define SDL_min min -#define SDL_strcasecmp stricmp -#define SDL_snprintf _snprintf -#define SDL_malloc malloc -#define SDL_free free -#define SDL_memcpy memcpy -#endif - -#define MAX_CP_NAME_LEN 64 - -typedef struct iuconv_obj { - UconvObject uo_tocode; - UconvObject uo_fromcode; - int buf_len; - UniChar *buf; -#ifdef ICONV_THREAD_SAFE - HMTX hMtx; -#endif -} iuconv_obj; - - -static int _createUconvObj(const char *code, UconvObject *uobj) -{ - UniChar uc_code[MAX_CP_NAME_LEN]; - int i; - const unsigned char *ch = - (const unsigned char *)code; - - if (code == NULL) - uc_code[0] = 0; - else { - for (i = 0; i < MAX_CP_NAME_LEN; i++) { - uc_code[i] = (unsigned short)*ch; - if (! (*ch)) - break; - ch++; - } - } - - return UniCreateUconvObject(uc_code, uobj); -} - -static int uconv_open(const char *code, UconvObject *uobj) -{ - int rc; - - if (!SDL_strcasecmp(code, "UTF-16")) { - *uobj = NULL; - return ULS_SUCCESS; - } - - rc = _createUconvObj(code, uobj); - if (rc != ULS_SUCCESS) { - unsigned long cp = os2cpFromName((char *)code); - char cp_name[16]; - if (cp != 0 && SDL_snprintf(cp_name, sizeof(cp_name), "IBM-%u", cp) > 0) { - rc = _createUconvObj(cp_name, uobj); - } - } - - return rc; -} - - -iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode) -{ - UconvObject uo_tocode; - UconvObject uo_fromcode; - int rc; - iuconv_obj *iuobj; - - if (tocode == NULL) { - tocode = ""; - } - if (fromcode == NULL) { - fromcode = ""; - } - - if (SDL_strcasecmp(tocode, fromcode) != 0) { - rc = uconv_open(fromcode, &uo_fromcode); - if (rc != ULS_SUCCESS) { - errno = EINVAL; - return (iconv_t)(-1); - } - rc = uconv_open(tocode, &uo_tocode); - if (rc != ULS_SUCCESS) { - UniFreeUconvObject(uo_fromcode); - errno = EINVAL; - return (iconv_t)(-1); - } - } else { - uo_tocode = NULL; - uo_fromcode = NULL; - } - - iuobj = (iuconv_obj *) SDL_malloc(sizeof(iuconv_obj)); - iuobj->uo_tocode = uo_tocode; - iuobj->uo_fromcode = uo_fromcode; - iuobj->buf_len = 0; - iuobj->buf = NULL; -#ifdef ICONV_THREAD_SAFE - DosCreateMutexSem(NULL, &iuobj->hMtx, 0, FALSE); -#endif - - return iuobj; -} - -size_t _System os2_iconv(iconv_t cd, - char **inbuf, size_t *inbytesleft , - char **outbuf, size_t *outbytesleft) -{ - UconvObject uo_tocode = ((iuconv_obj *)(cd))->uo_tocode; - UconvObject uo_fromcode = ((iuconv_obj *)(cd))->uo_fromcode; - size_t nonIdenticalConv = 0; - UniChar *uc_buf; - size_t uc_buf_len; - UniChar **uc_str; - size_t *uc_str_len; - int rc; - size_t ret = (size_t)(-1); - - if (uo_tocode == NULL && uo_fromcode == NULL) { - uc_buf_len = SDL_min(*inbytesleft, *outbytesleft); - SDL_memcpy(*outbuf, *inbuf, uc_buf_len); - *inbytesleft -= uc_buf_len; - *outbytesleft -= uc_buf_len; - outbuf += uc_buf_len; - inbuf += uc_buf_len; - return uc_buf_len; - } - -#ifdef ICONV_THREAD_SAFE - DosRequestMutexSem(((iuconv_obj *)(cd))->hMtx, SEM_INDEFINITE_WAIT); -#endif - - if (uo_tocode && uo_fromcode && (((iuconv_obj *)cd)->buf_len >> 1) < *inbytesleft) { - if (((iuconv_obj *)cd)->buf != NULL) { - SDL_free(((iuconv_obj *)cd)->buf); - } - ((iuconv_obj *)cd)->buf_len = *inbytesleft << 1; - ((iuconv_obj *)cd)->buf = (UniChar *) SDL_malloc(((iuconv_obj *)cd)->buf_len); - } - - if (uo_fromcode) { - if (uo_tocode) { - uc_buf = ((iuconv_obj *)cd)->buf; - uc_buf_len = ((iuconv_obj *)cd)->buf_len; - uc_str = &uc_buf; - } else { - uc_str = (UniChar **)outbuf; - uc_buf_len = *outbytesleft; - } - uc_buf_len = uc_buf_len >> 1; - uc_str_len = &uc_buf_len; - rc = UniUconvToUcs(uo_fromcode, (void **)inbuf, inbytesleft, - uc_str, uc_str_len, &nonIdenticalConv); - uc_buf_len = uc_buf_len << 1; - if (!uo_tocode) { - *outbytesleft = uc_buf_len; - } - - if (rc != ULS_SUCCESS) { - errno = EILSEQ; - goto done; - } else if (*inbytesleft && !*uc_str_len) { - errno = E2BIG; - goto done; - } - - if (!uo_tocode) { - return nonIdenticalConv; - } - - uc_buf = ((iuconv_obj *)cd)->buf; - uc_buf_len = ((iuconv_obj *)cd)->buf_len - uc_buf_len; - uc_str = &uc_buf; - uc_str_len = &uc_buf_len; - } else { - uc_str = (UniChar **)inbuf; - uc_str_len = inbytesleft; - } - - *uc_str_len = *uc_str_len>>1; - rc = UniUconvFromUcs(uo_tocode, uc_str, uc_str_len, (void **)outbuf, - outbytesleft, &nonIdenticalConv); - if (rc != ULS_SUCCESS) { - switch (rc) { - case ULS_BUFFERFULL: - errno = E2BIG; - break; - case ULS_ILLEGALSEQUENCE: - errno = EILSEQ; - break; - case ULS_INVALID: - errno = EINVAL; - break; - } - goto done; - } else if (*uc_str_len && !*outbytesleft) { - errno = E2BIG; - goto done; - } - - ret = nonIdenticalConv; - -done: - -#ifdef ICONV_THREAD_SAFE - DosReleaseMutexSem(((iuconv_obj *)cd)->hMtx); -#endif - return ret; -} - -int _System os2_iconv_close(iconv_t cd) -{ - if (!cd) return 0; - -#ifdef ICONV_THREAD_SAFE - DosCloseMutexSem(((iuconv_obj *)cd)->hMtx); -#endif - if (((iuconv_obj *)cd)->uo_tocode != NULL) { - UniFreeUconvObject(((iuconv_obj *)cd)->uo_tocode); - } - if (((iuconv_obj *)cd)->uo_fromcode != NULL) { - UniFreeUconvObject(((iuconv_obj *)cd)->uo_fromcode); - } - - if (((iuconv_obj *)cd)->buf != NULL) { - SDL_free(((iuconv_obj *)cd)->buf); - } - SDL_free(cd); - - return 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/sys2utf8.c b/src/core/os2/geniconv/sys2utf8.c deleted file mode 100644 index 753e9b67f..000000000 --- a/src/core/os2/geniconv/sys2utf8.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "geniconv.h" - -#ifndef GENICONV_STANDALONE -#include "../../../SDL_internal.h" -#else -#include -#define SDL_malloc malloc -#define SDL_realloc realloc -#define SDL_free free -#endif - -int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src) -{ - size_t rc; - char *dststart = dst; - iconv_t cd; - char *tocp, *fromcp; - int err = 0; - - if (c_dst < 4) { - return -1; - } - - if (to_utf8) { - tocp = "UTF-8"; - fromcp = ""; - } else { - tocp = ""; - fromcp = "UTF-8"; - } - - cd = iconv_open(tocp, fromcp); - if (cd == (iconv_t)-1) { - return -1; - } - - while (c_src > 0) { - rc = iconv(cd, &src, (size_t *)&c_src, &dst, (size_t *)&c_dst); - if (rc == (size_t)-1) { - if (errno == EILSEQ) { - /* Try to skip invalid character */ - src++; - c_src--; - continue; - } - - err = 1; - break; - } - } - - iconv_close(cd); - - /* Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp) */ - if (to_utf8) { - if (c_dst < 1) { - dst--; - err = 1; /* The destination buffer overflow */ - } - *dst = '\0'; - } else { - if (c_dst < 2) { - dst -= (c_dst == 0) ? 2 : 1; - err = 1; /* The destination buffer overflow */ - } - *((short *)dst) = '\0'; - } - - return (err) ? -1 : (dst - dststart); -} - -char *StrUTF8New(int to_utf8, char *str, int c_str) -{ - int c_newstr = (((c_str > 4) ? c_str : 4) + 1) * 2; - char * newstr = (char *) SDL_malloc(c_newstr); - - if (newstr == NULL) { - return NULL; - } - - c_newstr = StrUTF8(to_utf8, newstr, c_newstr, str, c_str); - if (c_newstr != -1) { - str = (char *) SDL_realloc(newstr, c_newstr + ((to_utf8) ? 1 : sizeof(short))); - if (str) { - return str; - } - } - - SDL_free(newstr); - return NULL; -} - -void StrUTF8Free(char *str) -{ - SDL_free(str); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/geniconv/test.c b/src/core/os2/geniconv/test.c deleted file mode 100644 index 25e16228a..000000000 --- a/src/core/os2/geniconv/test.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include -#include -#include -#include "geniconv.h" - -int main(void) -{ - char acBuf[128]; - char *inbuf = "ôÅÓÔ - ÐÒÏ×ÅÒËÁ"; /* KOI8-R string */ - size_t inbytesleft = strlen(inbuf); - char *outbuf = acBuf; - size_t outbytesleft = sizeof(acBuf); - iconv_t ic; - - /* KOI8 -> system cp */ - ic = iconv_open("", "KOI8-R"); - if (ic == (iconv_t)(-1)) { - puts("iconv_open() fail"); - return 1; - } - - iconv(ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft); - printf("KOI8-R to system cp: %s\n", acBuf); - - iconv_close(ic); - - /* System cp -> UTF-8 -> system cp: */ - - /* System cp -> UTF-8 by StrUTF8New() */ - inbuf = StrUTF8New(1, acBuf, strlen(acBuf)); - - /* UTF-8 -> system cp. by StrUTF8() */ - if (StrUTF8(0, acBuf, sizeof(acBuf), inbuf, strlen(inbuf)) == -1) { - puts("StrUTF8() failed"); - } else { - printf("system cp. -> UTF-8 -> system cp.: %s\n", acBuf); - } - - free(inbuf); - - /* Unload used DLL */ - iconv_clean(); - - puts("Done."); - return 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/os2/iconv2.lbc b/src/core/os2/iconv2.lbc deleted file mode 100644 index d9c68753f..000000000 --- a/src/core/os2/iconv2.lbc +++ /dev/null @@ -1,4 +0,0 @@ -# OpenWatcom exports file for libiconv -++'libiconv'.'ICONV2'..'_libiconv' -++'libiconv_close'.'ICONV2'..'_libiconv_close' -++'libiconv_open'.'ICONV2'..'_libiconv_open' diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 540f6a54e..b922418a1 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -27,14 +27,6 @@ #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" #endif -#if defined(__OS2__) -#undef HAVE_SYSCTLBYNAME -#define INCL_DOS -#include -#ifndef QSV_NUMPROCESSORS -#define QSV_NUMPROCESSORS 26 -#endif -#endif /* CPU feature detection for SDL */ @@ -680,12 +672,6 @@ SDL_GetCPUCount(void) SDL_CPUCount = info.dwNumberOfProcessors; } #endif -#ifdef __OS2__ - if (SDL_CPUCount <= 0) { - DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, - &SDL_CPUCount, sizeof(SDL_CPUCount) ); - } -#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -1064,13 +1050,6 @@ SDL_GetSystemRAM(void) } } #endif -#ifdef __OS2__ - if (SDL_SystemRAM <= 0) { - Uint32 sysram = 0; - DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); - SDL_SystemRAM = (int) (sysram / 0x100000U); - } -#endif #ifdef __RISCOS__ if (SDL_SystemRAM <= 0) { _kernel_swi_regs regs; diff --git a/src/dynapi/SDL3.exports b/src/dynapi/SDL3.exports deleted file mode 100644 index 7bc5863a3..000000000 --- a/src/dynapi/SDL3.exports +++ /dev/null @@ -1,869 +0,0 @@ -# Windows exports file for Watcom -# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. -++'_SDL_DYNAPI_entry'.'SDL3.dll'.'SDL_DYNAPI_entry' -++'_SDL_SetError'.'SDL3.dll'.'SDL_SetError' -++'_SDL_Log'.'SDL3.dll'.'SDL_Log' -++'_SDL_LogVerbose'.'SDL3.dll'.'SDL_LogVerbose' -++'_SDL_LogDebug'.'SDL3.dll'.'SDL_LogDebug' -++'_SDL_LogInfo'.'SDL3.dll'.'SDL_LogInfo' -++'_SDL_LogWarn'.'SDL3.dll'.'SDL_LogWarn' -++'_SDL_LogError'.'SDL3.dll'.'SDL_LogError' -++'_SDL_LogCritical'.'SDL3.dll'.'SDL_LogCritical' -++'_SDL_LogMessage'.'SDL3.dll'.'SDL_LogMessage' -++'_SDL_sscanf'.'SDL3.dll'.'SDL_sscanf' -++'_SDL_snprintf'.'SDL3.dll'.'SDL_snprintf' -++'_SDL_CreateThread'.'SDL3.dll'.'SDL_CreateThread' -++'_SDL_RWFromFP'.'SDL3.dll'.'SDL_RWFromFP' -++'_SDL_RegisterApp'.'SDL3.dll'.'SDL_RegisterApp' -++'_SDL_UnregisterApp'.'SDL3.dll'.'SDL_UnregisterApp' -++'_SDL_Direct3D9GetAdapterIndex'.'SDL3.dll'.'SDL_Direct3D9GetAdapterIndex' -++'_SDL_RenderGetD3D9Device'.'SDL3.dll'.'SDL_RenderGetD3D9Device' -# ++'_SDL_iPhoneSetAnimationCallback'.'SDL3.dll'.'SDL_iPhoneSetAnimationCallback' -# ++'_SDL_iPhoneSetEventPump'.'SDL3.dll'.'SDL_iPhoneSetEventPump' -# ++'_SDL_AndroidGetJNIEnv'.'SDL3.dll'.'SDL_AndroidGetJNIEnv' -# ++'_SDL_AndroidGetActivity'.'SDL3.dll'.'SDL_AndroidGetActivity' -# ++'_SDL_AndroidGetInternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetInternalStoragePath' -# ++'_SDL_AndroidGetExternalStorageState'.'SDL3.dll'.'SDL_AndroidGetExternalStorageState' -# ++'_SDL_AndroidGetExternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetExternalStoragePath' -++'_SDL_Init'.'SDL3.dll'.'SDL_Init' -++'_SDL_InitSubSystem'.'SDL3.dll'.'SDL_InitSubSystem' -++'_SDL_QuitSubSystem'.'SDL3.dll'.'SDL_QuitSubSystem' -++'_SDL_WasInit'.'SDL3.dll'.'SDL_WasInit' -++'_SDL_Quit'.'SDL3.dll'.'SDL_Quit' -++'_SDL_ReportAssertion'.'SDL3.dll'.'SDL_ReportAssertion' -++'_SDL_SetAssertionHandler'.'SDL3.dll'.'SDL_SetAssertionHandler' -++'_SDL_GetAssertionReport'.'SDL3.dll'.'SDL_GetAssertionReport' -++'_SDL_ResetAssertionReport'.'SDL3.dll'.'SDL_ResetAssertionReport' -++'_SDL_AtomicTryLock'.'SDL3.dll'.'SDL_AtomicTryLock' -++'_SDL_AtomicLock'.'SDL3.dll'.'SDL_AtomicLock' -++'_SDL_AtomicUnlock'.'SDL3.dll'.'SDL_AtomicUnlock' -++'_SDL_AtomicCAS'.'SDL3.dll'.'SDL_AtomicCAS' -++'_SDL_AtomicSet'.'SDL3.dll'.'SDL_AtomicSet' -++'_SDL_AtomicGet'.'SDL3.dll'.'SDL_AtomicGet' -++'_SDL_AtomicAdd'.'SDL3.dll'.'SDL_AtomicAdd' -++'_SDL_AtomicCASPtr'.'SDL3.dll'.'SDL_AtomicCASPtr' -++'_SDL_AtomicSetPtr'.'SDL3.dll'.'SDL_AtomicSetPtr' -++'_SDL_AtomicGetPtr'.'SDL3.dll'.'SDL_AtomicGetPtr' -++'_SDL_GetNumAudioDrivers'.'SDL3.dll'.'SDL_GetNumAudioDrivers' -++'_SDL_GetAudioDriver'.'SDL3.dll'.'SDL_GetAudioDriver' -++'_SDL_AudioInit'.'SDL3.dll'.'SDL_AudioInit' -++'_SDL_AudioQuit'.'SDL3.dll'.'SDL_AudioQuit' -++'_SDL_GetCurrentAudioDriver'.'SDL3.dll'.'SDL_GetCurrentAudioDriver' -++'_SDL_OpenAudio'.'SDL3.dll'.'SDL_OpenAudio' -++'_SDL_GetNumAudioDevices'.'SDL3.dll'.'SDL_GetNumAudioDevices' -++'_SDL_GetAudioDeviceName'.'SDL3.dll'.'SDL_GetAudioDeviceName' -++'_SDL_OpenAudioDevice'.'SDL3.dll'.'SDL_OpenAudioDevice' -++'_SDL_GetAudioStatus'.'SDL3.dll'.'SDL_GetAudioStatus' -++'_SDL_GetAudioDeviceStatus'.'SDL3.dll'.'SDL_GetAudioDeviceStatus' -++'_SDL_PauseAudio'.'SDL3.dll'.'SDL_PauseAudio' -++'_SDL_PauseAudioDevice'.'SDL3.dll'.'SDL_PauseAudioDevice' -++'_SDL_LoadWAV_RW'.'SDL3.dll'.'SDL_LoadWAV_RW' -++'_SDL_FreeWAV'.'SDL3.dll'.'SDL_FreeWAV' -++'_SDL_BuildAudioCVT'.'SDL3.dll'.'SDL_BuildAudioCVT' -++'_SDL_ConvertAudio'.'SDL3.dll'.'SDL_ConvertAudio' -++'_SDL_MixAudio'.'SDL3.dll'.'SDL_MixAudio' -++'_SDL_MixAudioFormat'.'SDL3.dll'.'SDL_MixAudioFormat' -++'_SDL_LockAudio'.'SDL3.dll'.'SDL_LockAudio' -++'_SDL_LockAudioDevice'.'SDL3.dll'.'SDL_LockAudioDevice' -++'_SDL_UnlockAudio'.'SDL3.dll'.'SDL_UnlockAudio' -++'_SDL_UnlockAudioDevice'.'SDL3.dll'.'SDL_UnlockAudioDevice' -++'_SDL_CloseAudio'.'SDL3.dll'.'SDL_CloseAudio' -++'_SDL_CloseAudioDevice'.'SDL3.dll'.'SDL_CloseAudioDevice' -++'_SDL_SetClipboardText'.'SDL3.dll'.'SDL_SetClipboardText' -++'_SDL_GetClipboardText'.'SDL3.dll'.'SDL_GetClipboardText' -++'_SDL_HasClipboardText'.'SDL3.dll'.'SDL_HasClipboardText' -++'_SDL_GetCPUCount'.'SDL3.dll'.'SDL_GetCPUCount' -++'_SDL_GetCPUCacheLineSize'.'SDL3.dll'.'SDL_GetCPUCacheLineSize' -++'_SDL_HasRDTSC'.'SDL3.dll'.'SDL_HasRDTSC' -++'_SDL_HasAltiVec'.'SDL3.dll'.'SDL_HasAltiVec' -++'_SDL_HasMMX'.'SDL3.dll'.'SDL_HasMMX' -++'_SDL_Has3DNow'.'SDL3.dll'.'SDL_Has3DNow' -++'_SDL_HasSSE'.'SDL3.dll'.'SDL_HasSSE' -++'_SDL_HasSSE2'.'SDL3.dll'.'SDL_HasSSE2' -++'_SDL_HasSSE3'.'SDL3.dll'.'SDL_HasSSE3' -++'_SDL_HasSSE41'.'SDL3.dll'.'SDL_HasSSE41' -++'_SDL_HasSSE42'.'SDL3.dll'.'SDL_HasSSE42' -++'_SDL_GetSystemRAM'.'SDL3.dll'.'SDL_GetSystemRAM' -++'_SDL_GetError'.'SDL3.dll'.'SDL_GetError' -++'_SDL_ClearError'.'SDL3.dll'.'SDL_ClearError' -++'_SDL_Error'.'SDL3.dll'.'SDL_Error' -++'_SDL_PumpEvents'.'SDL3.dll'.'SDL_PumpEvents' -++'_SDL_PeepEvents'.'SDL3.dll'.'SDL_PeepEvents' -++'_SDL_HasEvent'.'SDL3.dll'.'SDL_HasEvent' -++'_SDL_HasEvents'.'SDL3.dll'.'SDL_HasEvents' -++'_SDL_FlushEvent'.'SDL3.dll'.'SDL_FlushEvent' -++'_SDL_FlushEvents'.'SDL3.dll'.'SDL_FlushEvents' -++'_SDL_PollEvent'.'SDL3.dll'.'SDL_PollEvent' -++'_SDL_WaitEvent'.'SDL3.dll'.'SDL_WaitEvent' -++'_SDL_WaitEventTimeout'.'SDL3.dll'.'SDL_WaitEventTimeout' -++'_SDL_PushEvent'.'SDL3.dll'.'SDL_PushEvent' -++'_SDL_SetEventFilter'.'SDL3.dll'.'SDL_SetEventFilter' -++'_SDL_GetEventFilter'.'SDL3.dll'.'SDL_GetEventFilter' -++'_SDL_AddEventWatch'.'SDL3.dll'.'SDL_AddEventWatch' -++'_SDL_DelEventWatch'.'SDL3.dll'.'SDL_DelEventWatch' -++'_SDL_FilterEvents'.'SDL3.dll'.'SDL_FilterEvents' -++'_SDL_EventState'.'SDL3.dll'.'SDL_EventState' -++'_SDL_RegisterEvents'.'SDL3.dll'.'SDL_RegisterEvents' -++'_SDL_GetBasePath'.'SDL3.dll'.'SDL_GetBasePath' -++'_SDL_GetPrefPath'.'SDL3.dll'.'SDL_GetPrefPath' -++'_SDL_GameControllerAddMapping'.'SDL3.dll'.'SDL_GameControllerAddMapping' -++'_SDL_GameControllerMappingForGUID'.'SDL3.dll'.'SDL_GameControllerMappingForGUID' -++'_SDL_GameControllerMapping'.'SDL3.dll'.'SDL_GameControllerMapping' -++'_SDL_IsGameController'.'SDL3.dll'.'SDL_IsGameController' -++'_SDL_GameControllerNameForIndex'.'SDL3.dll'.'SDL_GameControllerNameForIndex' -++'_SDL_GameControllerOpen'.'SDL3.dll'.'SDL_GameControllerOpen' -++'_SDL_GameControllerName'.'SDL3.dll'.'SDL_GameControllerName' -++'_SDL_GameControllerGetAttached'.'SDL3.dll'.'SDL_GameControllerGetAttached' -++'_SDL_GameControllerGetJoystick'.'SDL3.dll'.'SDL_GameControllerGetJoystick' -++'_SDL_GameControllerEventState'.'SDL3.dll'.'SDL_GameControllerEventState' -++'_SDL_GameControllerUpdate'.'SDL3.dll'.'SDL_GameControllerUpdate' -++'_SDL_GameControllerGetAxisFromString'.'SDL3.dll'.'SDL_GameControllerGetAxisFromString' -++'_SDL_GameControllerGetStringForAxis'.'SDL3.dll'.'SDL_GameControllerGetStringForAxis' -++'_SDL_GameControllerGetBindForAxis'.'SDL3.dll'.'SDL_GameControllerGetBindForAxis' -++'_SDL_GameControllerGetAxis'.'SDL3.dll'.'SDL_GameControllerGetAxis' -++'_SDL_GameControllerGetButtonFromString'.'SDL3.dll'.'SDL_GameControllerGetButtonFromString' -++'_SDL_GameControllerGetStringForButton'.'SDL3.dll'.'SDL_GameControllerGetStringForButton' -++'_SDL_GameControllerGetBindForButton'.'SDL3.dll'.'SDL_GameControllerGetBindForButton' -++'_SDL_GameControllerGetButton'.'SDL3.dll'.'SDL_GameControllerGetButton' -++'_SDL_GameControllerClose'.'SDL3.dll'.'SDL_GameControllerClose' -++'_SDL_RecordGesture'.'SDL3.dll'.'SDL_RecordGesture' -++'_SDL_SaveAllDollarTemplates'.'SDL3.dll'.'SDL_SaveAllDollarTemplates' -++'_SDL_SaveDollarTemplate'.'SDL3.dll'.'SDL_SaveDollarTemplate' -++'_SDL_LoadDollarTemplates'.'SDL3.dll'.'SDL_LoadDollarTemplates' -++'_SDL_NumHaptics'.'SDL3.dll'.'SDL_NumHaptics' -++'_SDL_HapticName'.'SDL3.dll'.'SDL_HapticName' -++'_SDL_HapticOpen'.'SDL3.dll'.'SDL_HapticOpen' -++'_SDL_HapticOpened'.'SDL3.dll'.'SDL_HapticOpened' -++'_SDL_HapticIndex'.'SDL3.dll'.'SDL_HapticIndex' -++'_SDL_MouseIsHaptic'.'SDL3.dll'.'SDL_MouseIsHaptic' -++'_SDL_HapticOpenFromMouse'.'SDL3.dll'.'SDL_HapticOpenFromMouse' -++'_SDL_JoystickIsHaptic'.'SDL3.dll'.'SDL_JoystickIsHaptic' -++'_SDL_HapticOpenFromJoystick'.'SDL3.dll'.'SDL_HapticOpenFromJoystick' -++'_SDL_HapticClose'.'SDL3.dll'.'SDL_HapticClose' -++'_SDL_HapticNumEffects'.'SDL3.dll'.'SDL_HapticNumEffects' -++'_SDL_HapticNumEffectsPlaying'.'SDL3.dll'.'SDL_HapticNumEffectsPlaying' -++'_SDL_HapticQuery'.'SDL3.dll'.'SDL_HapticQuery' -++'_SDL_HapticNumAxes'.'SDL3.dll'.'SDL_HapticNumAxes' -++'_SDL_HapticEffectSupported'.'SDL3.dll'.'SDL_HapticEffectSupported' -++'_SDL_HapticNewEffect'.'SDL3.dll'.'SDL_HapticNewEffect' -++'_SDL_HapticUpdateEffect'.'SDL3.dll'.'SDL_HapticUpdateEffect' -++'_SDL_HapticRunEffect'.'SDL3.dll'.'SDL_HapticRunEffect' -++'_SDL_HapticStopEffect'.'SDL3.dll'.'SDL_HapticStopEffect' -++'_SDL_HapticDestroyEffect'.'SDL3.dll'.'SDL_HapticDestroyEffect' -++'_SDL_HapticGetEffectStatus'.'SDL3.dll'.'SDL_HapticGetEffectStatus' -++'_SDL_HapticSetGain'.'SDL3.dll'.'SDL_HapticSetGain' -++'_SDL_HapticSetAutocenter'.'SDL3.dll'.'SDL_HapticSetAutocenter' -++'_SDL_HapticPause'.'SDL3.dll'.'SDL_HapticPause' -++'_SDL_HapticUnpause'.'SDL3.dll'.'SDL_HapticUnpause' -++'_SDL_HapticStopAll'.'SDL3.dll'.'SDL_HapticStopAll' -++'_SDL_HapticRumbleSupported'.'SDL3.dll'.'SDL_HapticRumbleSupported' -++'_SDL_HapticRumbleInit'.'SDL3.dll'.'SDL_HapticRumbleInit' -++'_SDL_HapticRumblePlay'.'SDL3.dll'.'SDL_HapticRumblePlay' -++'_SDL_HapticRumbleStop'.'SDL3.dll'.'SDL_HapticRumbleStop' -++'_SDL_SetHintWithPriority'.'SDL3.dll'.'SDL_SetHintWithPriority' -++'_SDL_SetHint'.'SDL3.dll'.'SDL_SetHint' -++'_SDL_GetHint'.'SDL3.dll'.'SDL_GetHint' -++'_SDL_AddHintCallback'.'SDL3.dll'.'SDL_AddHintCallback' -++'_SDL_DelHintCallback'.'SDL3.dll'.'SDL_DelHintCallback' -++'_SDL_ClearHints'.'SDL3.dll'.'SDL_ClearHints' -++'_SDL_NumJoysticks'.'SDL3.dll'.'SDL_NumJoysticks' -++'_SDL_JoystickNameForIndex'.'SDL3.dll'.'SDL_JoystickNameForIndex' -++'_SDL_JoystickOpen'.'SDL3.dll'.'SDL_JoystickOpen' -++'_SDL_JoystickName'.'SDL3.dll'.'SDL_JoystickName' -++'_SDL_JoystickGetDeviceGUID'.'SDL3.dll'.'SDL_JoystickGetDeviceGUID' -++'_SDL_JoystickGetGUID'.'SDL3.dll'.'SDL_JoystickGetGUID' -++'_SDL_JoystickGetGUIDString'.'SDL3.dll'.'SDL_JoystickGetGUIDString' -++'_SDL_JoystickGetGUIDFromString'.'SDL3.dll'.'SDL_JoystickGetGUIDFromString' -++'_SDL_JoystickGetAttached'.'SDL3.dll'.'SDL_JoystickGetAttached' -++'_SDL_JoystickInstanceID'.'SDL3.dll'.'SDL_JoystickInstanceID' -++'_SDL_JoystickNumAxes'.'SDL3.dll'.'SDL_JoystickNumAxes' -++'_SDL_JoystickNumBalls'.'SDL3.dll'.'SDL_JoystickNumBalls' -++'_SDL_JoystickNumHats'.'SDL3.dll'.'SDL_JoystickNumHats' -++'_SDL_JoystickNumButtons'.'SDL3.dll'.'SDL_JoystickNumButtons' -++'_SDL_JoystickUpdate'.'SDL3.dll'.'SDL_JoystickUpdate' -++'_SDL_JoystickEventState'.'SDL3.dll'.'SDL_JoystickEventState' -++'_SDL_JoystickGetAxis'.'SDL3.dll'.'SDL_JoystickGetAxis' -++'_SDL_JoystickGetHat'.'SDL3.dll'.'SDL_JoystickGetHat' -++'_SDL_JoystickGetBall'.'SDL3.dll'.'SDL_JoystickGetBall' -++'_SDL_JoystickGetButton'.'SDL3.dll'.'SDL_JoystickGetButton' -++'_SDL_JoystickClose'.'SDL3.dll'.'SDL_JoystickClose' -++'_SDL_GetKeyboardFocus'.'SDL3.dll'.'SDL_GetKeyboardFocus' -++'_SDL_GetKeyboardState'.'SDL3.dll'.'SDL_GetKeyboardState' -++'_SDL_GetModState'.'SDL3.dll'.'SDL_GetModState' -++'_SDL_SetModState'.'SDL3.dll'.'SDL_SetModState' -++'_SDL_GetKeyFromScancode'.'SDL3.dll'.'SDL_GetKeyFromScancode' -++'_SDL_GetScancodeFromKey'.'SDL3.dll'.'SDL_GetScancodeFromKey' -++'_SDL_GetScancodeName'.'SDL3.dll'.'SDL_GetScancodeName' -++'_SDL_GetScancodeFromName'.'SDL3.dll'.'SDL_GetScancodeFromName' -++'_SDL_GetKeyName'.'SDL3.dll'.'SDL_GetKeyName' -++'_SDL_GetKeyFromName'.'SDL3.dll'.'SDL_GetKeyFromName' -++'_SDL_StartTextInput'.'SDL3.dll'.'SDL_StartTextInput' -++'_SDL_IsTextInputActive'.'SDL3.dll'.'SDL_IsTextInputActive' -++'_SDL_StopTextInput'.'SDL3.dll'.'SDL_StopTextInput' -++'_SDL_SetTextInputRect'.'SDL3.dll'.'SDL_SetTextInputRect' -++'_SDL_HasScreenKeyboardSupport'.'SDL3.dll'.'SDL_HasScreenKeyboardSupport' -++'_SDL_IsScreenKeyboardShown'.'SDL3.dll'.'SDL_IsScreenKeyboardShown' -++'_SDL_LoadObject'.'SDL3.dll'.'SDL_LoadObject' -++'_SDL_LoadFunction'.'SDL3.dll'.'SDL_LoadFunction' -++'_SDL_UnloadObject'.'SDL3.dll'.'SDL_UnloadObject' -++'_SDL_LogSetAllPriority'.'SDL3.dll'.'SDL_LogSetAllPriority' -++'_SDL_LogSetPriority'.'SDL3.dll'.'SDL_LogSetPriority' -++'_SDL_LogGetPriority'.'SDL3.dll'.'SDL_LogGetPriority' -++'_SDL_LogResetPriorities'.'SDL3.dll'.'SDL_LogResetPriorities' -++'_SDL_LogMessageV'.'SDL3.dll'.'SDL_LogMessageV' -++'_SDL_LogGetOutputFunction'.'SDL3.dll'.'SDL_LogGetOutputFunction' -++'_SDL_LogSetOutputFunction'.'SDL3.dll'.'SDL_LogSetOutputFunction' -++'_SDL_SetMainReady'.'SDL3.dll'.'SDL_SetMainReady' -++'_SDL_ShowMessageBox'.'SDL3.dll'.'SDL_ShowMessageBox' -++'_SDL_ShowSimpleMessageBox'.'SDL3.dll'.'SDL_ShowSimpleMessageBox' -++'_SDL_GetMouseFocus'.'SDL3.dll'.'SDL_GetMouseFocus' -++'_SDL_GetMouseState'.'SDL3.dll'.'SDL_GetMouseState' -++'_SDL_GetRelativeMouseState'.'SDL3.dll'.'SDL_GetRelativeMouseState' -++'_SDL_WarpMouseInWindow'.'SDL3.dll'.'SDL_WarpMouseInWindow' -++'_SDL_SetRelativeMouseMode'.'SDL3.dll'.'SDL_SetRelativeMouseMode' -++'_SDL_GetRelativeMouseMode'.'SDL3.dll'.'SDL_GetRelativeMouseMode' -++'_SDL_CreateCursor'.'SDL3.dll'.'SDL_CreateCursor' -++'_SDL_CreateColorCursor'.'SDL3.dll'.'SDL_CreateColorCursor' -++'_SDL_CreateSystemCursor'.'SDL3.dll'.'SDL_CreateSystemCursor' -++'_SDL_SetCursor'.'SDL3.dll'.'SDL_SetCursor' -++'_SDL_GetCursor'.'SDL3.dll'.'SDL_GetCursor' -++'_SDL_GetDefaultCursor'.'SDL3.dll'.'SDL_GetDefaultCursor' -++'_SDL_FreeCursor'.'SDL3.dll'.'SDL_FreeCursor' -++'_SDL_ShowCursor'.'SDL3.dll'.'SDL_ShowCursor' -++'_SDL_CreateMutex'.'SDL3.dll'.'SDL_CreateMutex' -++'_SDL_LockMutex'.'SDL3.dll'.'SDL_LockMutex' -++'_SDL_TryLockMutex'.'SDL3.dll'.'SDL_TryLockMutex' -++'_SDL_UnlockMutex'.'SDL3.dll'.'SDL_UnlockMutex' -++'_SDL_DestroyMutex'.'SDL3.dll'.'SDL_DestroyMutex' -++'_SDL_CreateSemaphore'.'SDL3.dll'.'SDL_CreateSemaphore' -++'_SDL_DestroySemaphore'.'SDL3.dll'.'SDL_DestroySemaphore' -++'_SDL_SemWait'.'SDL3.dll'.'SDL_SemWait' -++'_SDL_SemTryWait'.'SDL3.dll'.'SDL_SemTryWait' -++'_SDL_SemWaitTimeout'.'SDL3.dll'.'SDL_SemWaitTimeout' -++'_SDL_SemPost'.'SDL3.dll'.'SDL_SemPost' -++'_SDL_SemValue'.'SDL3.dll'.'SDL_SemValue' -++'_SDL_CreateCond'.'SDL3.dll'.'SDL_CreateCond' -++'_SDL_DestroyCond'.'SDL3.dll'.'SDL_DestroyCond' -++'_SDL_CondSignal'.'SDL3.dll'.'SDL_CondSignal' -++'_SDL_CondBroadcast'.'SDL3.dll'.'SDL_CondBroadcast' -++'_SDL_CondWait'.'SDL3.dll'.'SDL_CondWait' -++'_SDL_CondWaitTimeout'.'SDL3.dll'.'SDL_CondWaitTimeout' -++'_SDL_GetPixelFormatName'.'SDL3.dll'.'SDL_GetPixelFormatName' -++'_SDL_PixelFormatEnumToMasks'.'SDL3.dll'.'SDL_PixelFormatEnumToMasks' -++'_SDL_MasksToPixelFormatEnum'.'SDL3.dll'.'SDL_MasksToPixelFormatEnum' -++'_SDL_AllocFormat'.'SDL3.dll'.'SDL_AllocFormat' -++'_SDL_FreeFormat'.'SDL3.dll'.'SDL_FreeFormat' -++'_SDL_AllocPalette'.'SDL3.dll'.'SDL_AllocPalette' -++'_SDL_SetPixelFormatPalette'.'SDL3.dll'.'SDL_SetPixelFormatPalette' -++'_SDL_SetPaletteColors'.'SDL3.dll'.'SDL_SetPaletteColors' -++'_SDL_FreePalette'.'SDL3.dll'.'SDL_FreePalette' -++'_SDL_MapRGB'.'SDL3.dll'.'SDL_MapRGB' -++'_SDL_MapRGBA'.'SDL3.dll'.'SDL_MapRGBA' -++'_SDL_GetRGB'.'SDL3.dll'.'SDL_GetRGB' -++'_SDL_GetRGBA'.'SDL3.dll'.'SDL_GetRGBA' -++'_SDL_CalculateGammaRamp'.'SDL3.dll'.'SDL_CalculateGammaRamp' -++'_SDL_GetPlatform'.'SDL3.dll'.'SDL_GetPlatform' -++'_SDL_GetPowerInfo'.'SDL3.dll'.'SDL_GetPowerInfo' -++'_SDL_HasIntersection'.'SDL3.dll'.'SDL_HasIntersection' -++'_SDL_IntersectRect'.'SDL3.dll'.'SDL_IntersectRect' -++'_SDL_UnionRect'.'SDL3.dll'.'SDL_UnionRect' -++'_SDL_EnclosePoints'.'SDL3.dll'.'SDL_EnclosePoints' -++'_SDL_IntersectRectAndLine'.'SDL3.dll'.'SDL_IntersectRectAndLine' -++'_SDL_GetNumRenderDrivers'.'SDL3.dll'.'SDL_GetNumRenderDrivers' -++'_SDL_GetRenderDriverInfo'.'SDL3.dll'.'SDL_GetRenderDriverInfo' -++'_SDL_CreateWindowAndRenderer'.'SDL3.dll'.'SDL_CreateWindowAndRenderer' -++'_SDL_CreateRenderer'.'SDL3.dll'.'SDL_CreateRenderer' -++'_SDL_CreateSoftwareRenderer'.'SDL3.dll'.'SDL_CreateSoftwareRenderer' -++'_SDL_GetRenderer'.'SDL3.dll'.'SDL_GetRenderer' -++'_SDL_GetRendererInfo'.'SDL3.dll'.'SDL_GetRendererInfo' -++'_SDL_GetRendererOutputSize'.'SDL3.dll'.'SDL_GetRendererOutputSize' -++'_SDL_CreateTexture'.'SDL3.dll'.'SDL_CreateTexture' -++'_SDL_CreateTextureFromSurface'.'SDL3.dll'.'SDL_CreateTextureFromSurface' -++'_SDL_QueryTexture'.'SDL3.dll'.'SDL_QueryTexture' -++'_SDL_SetTextureColorMod'.'SDL3.dll'.'SDL_SetTextureColorMod' -++'_SDL_GetTextureColorMod'.'SDL3.dll'.'SDL_GetTextureColorMod' -++'_SDL_SetTextureAlphaMod'.'SDL3.dll'.'SDL_SetTextureAlphaMod' -++'_SDL_GetTextureAlphaMod'.'SDL3.dll'.'SDL_GetTextureAlphaMod' -++'_SDL_SetTextureBlendMode'.'SDL3.dll'.'SDL_SetTextureBlendMode' -++'_SDL_GetTextureBlendMode'.'SDL3.dll'.'SDL_GetTextureBlendMode' -++'_SDL_UpdateTexture'.'SDL3.dll'.'SDL_UpdateTexture' -++'_SDL_UpdateYUVTexture'.'SDL3.dll'.'SDL_UpdateYUVTexture' -++'_SDL_LockTexture'.'SDL3.dll'.'SDL_LockTexture' -++'_SDL_UnlockTexture'.'SDL3.dll'.'SDL_UnlockTexture' -++'_SDL_RenderTargetSupported'.'SDL3.dll'.'SDL_RenderTargetSupported' -++'_SDL_SetRenderTarget'.'SDL3.dll'.'SDL_SetRenderTarget' -++'_SDL_GetRenderTarget'.'SDL3.dll'.'SDL_GetRenderTarget' -++'_SDL_RenderSetLogicalSize'.'SDL3.dll'.'SDL_RenderSetLogicalSize' -++'_SDL_RenderGetLogicalSize'.'SDL3.dll'.'SDL_RenderGetLogicalSize' -++'_SDL_RenderSetViewport'.'SDL3.dll'.'SDL_RenderSetViewport' -++'_SDL_RenderGetViewport'.'SDL3.dll'.'SDL_RenderGetViewport' -++'_SDL_RenderSetClipRect'.'SDL3.dll'.'SDL_RenderSetClipRect' -++'_SDL_RenderGetClipRect'.'SDL3.dll'.'SDL_RenderGetClipRect' -++'_SDL_RenderSetScale'.'SDL3.dll'.'SDL_RenderSetScale' -++'_SDL_RenderGetScale'.'SDL3.dll'.'SDL_RenderGetScale' -++'_SDL_SetRenderDrawColor'.'SDL3.dll'.'SDL_SetRenderDrawColor' -++'_SDL_GetRenderDrawColor'.'SDL3.dll'.'SDL_GetRenderDrawColor' -++'_SDL_SetRenderDrawBlendMode'.'SDL3.dll'.'SDL_SetRenderDrawBlendMode' -++'_SDL_GetRenderDrawBlendMode'.'SDL3.dll'.'SDL_GetRenderDrawBlendMode' -++'_SDL_RenderClear'.'SDL3.dll'.'SDL_RenderClear' -++'_SDL_RenderDrawPoint'.'SDL3.dll'.'SDL_RenderDrawPoint' -++'_SDL_RenderDrawPoints'.'SDL3.dll'.'SDL_RenderDrawPoints' -++'_SDL_RenderDrawLine'.'SDL3.dll'.'SDL_RenderDrawLine' -++'_SDL_RenderDrawLines'.'SDL3.dll'.'SDL_RenderDrawLines' -++'_SDL_RenderDrawRect'.'SDL3.dll'.'SDL_RenderDrawRect' -++'_SDL_RenderDrawRects'.'SDL3.dll'.'SDL_RenderDrawRects' -++'_SDL_RenderFillRect'.'SDL3.dll'.'SDL_RenderFillRect' -++'_SDL_RenderFillRects'.'SDL3.dll'.'SDL_RenderFillRects' -++'_SDL_RenderCopy'.'SDL3.dll'.'SDL_RenderCopy' -++'_SDL_RenderCopyEx'.'SDL3.dll'.'SDL_RenderCopyEx' -++'_SDL_RenderReadPixels'.'SDL3.dll'.'SDL_RenderReadPixels' -++'_SDL_RenderPresent'.'SDL3.dll'.'SDL_RenderPresent' -++'_SDL_DestroyTexture'.'SDL3.dll'.'SDL_DestroyTexture' -++'_SDL_DestroyRenderer'.'SDL3.dll'.'SDL_DestroyRenderer' -++'_SDL_GL_BindTexture'.'SDL3.dll'.'SDL_GL_BindTexture' -++'_SDL_GL_UnbindTexture'.'SDL3.dll'.'SDL_GL_UnbindTexture' -++'_SDL_RWFromFile'.'SDL3.dll'.'SDL_RWFromFile' -++'_SDL_RWFromMem'.'SDL3.dll'.'SDL_RWFromMem' -++'_SDL_RWFromConstMem'.'SDL3.dll'.'SDL_RWFromConstMem' -++'_SDL_AllocRW'.'SDL3.dll'.'SDL_AllocRW' -++'_SDL_FreeRW'.'SDL3.dll'.'SDL_FreeRW' -++'_SDL_ReadU8'.'SDL3.dll'.'SDL_ReadU8' -++'_SDL_ReadLE16'.'SDL3.dll'.'SDL_ReadLE16' -++'_SDL_ReadBE16'.'SDL3.dll'.'SDL_ReadBE16' -++'_SDL_ReadLE32'.'SDL3.dll'.'SDL_ReadLE32' -++'_SDL_ReadBE32'.'SDL3.dll'.'SDL_ReadBE32' -++'_SDL_ReadLE64'.'SDL3.dll'.'SDL_ReadLE64' -++'_SDL_ReadBE64'.'SDL3.dll'.'SDL_ReadBE64' -++'_SDL_WriteU8'.'SDL3.dll'.'SDL_WriteU8' -++'_SDL_WriteLE16'.'SDL3.dll'.'SDL_WriteLE16' -++'_SDL_WriteBE16'.'SDL3.dll'.'SDL_WriteBE16' -++'_SDL_WriteLE32'.'SDL3.dll'.'SDL_WriteLE32' -++'_SDL_WriteBE32'.'SDL3.dll'.'SDL_WriteBE32' -++'_SDL_WriteLE64'.'SDL3.dll'.'SDL_WriteLE64' -++'_SDL_WriteBE64'.'SDL3.dll'.'SDL_WriteBE64' -++'_SDL_CreateShapedWindow'.'SDL3.dll'.'SDL_CreateShapedWindow' -++'_SDL_IsShapedWindow'.'SDL3.dll'.'SDL_IsShapedWindow' -++'_SDL_SetWindowShape'.'SDL3.dll'.'SDL_SetWindowShape' -++'_SDL_GetShapedWindowMode'.'SDL3.dll'.'SDL_GetShapedWindowMode' -++'_SDL_malloc'.'SDL3.dll'.'SDL_malloc' -++'_SDL_calloc'.'SDL3.dll'.'SDL_calloc' -++'_SDL_realloc'.'SDL3.dll'.'SDL_realloc' -++'_SDL_free'.'SDL3.dll'.'SDL_free' -++'_SDL_getenv'.'SDL3.dll'.'SDL_getenv' -++'_SDL_setenv'.'SDL3.dll'.'SDL_setenv' -++'_SDL_qsort'.'SDL3.dll'.'SDL_qsort' -++'_SDL_abs'.'SDL3.dll'.'SDL_abs' -++'_SDL_isdigit'.'SDL3.dll'.'SDL_isdigit' -++'_SDL_isspace'.'SDL3.dll'.'SDL_isspace' -++'_SDL_toupper'.'SDL3.dll'.'SDL_toupper' -++'_SDL_tolower'.'SDL3.dll'.'SDL_tolower' -++'_SDL_memset'.'SDL3.dll'.'SDL_memset' -++'_SDL_memcpy'.'SDL3.dll'.'SDL_memcpy' -++'_SDL_memmove'.'SDL3.dll'.'SDL_memmove' -++'_SDL_memcmp'.'SDL3.dll'.'SDL_memcmp' -++'_SDL_wcslen'.'SDL3.dll'.'SDL_wcslen' -++'_SDL_wcslcpy'.'SDL3.dll'.'SDL_wcslcpy' -++'_SDL_wcslcat'.'SDL3.dll'.'SDL_wcslcat' -++'_SDL_strlen'.'SDL3.dll'.'SDL_strlen' -++'_SDL_strlcpy'.'SDL3.dll'.'SDL_strlcpy' -++'_SDL_utf8strlcpy'.'SDL3.dll'.'SDL_utf8strlcpy' -++'_SDL_strlcat'.'SDL3.dll'.'SDL_strlcat' -++'_SDL_strdup'.'SDL3.dll'.'SDL_strdup' -++'_SDL_strrev'.'SDL3.dll'.'SDL_strrev' -++'_SDL_strupr'.'SDL3.dll'.'SDL_strupr' -++'_SDL_strlwr'.'SDL3.dll'.'SDL_strlwr' -++'_SDL_strchr'.'SDL3.dll'.'SDL_strchr' -++'_SDL_strrchr'.'SDL3.dll'.'SDL_strrchr' -++'_SDL_strstr'.'SDL3.dll'.'SDL_strstr' -++'_SDL_itoa'.'SDL3.dll'.'SDL_itoa' -++'_SDL_uitoa'.'SDL3.dll'.'SDL_uitoa' -++'_SDL_ltoa'.'SDL3.dll'.'SDL_ltoa' -++'_SDL_ultoa'.'SDL3.dll'.'SDL_ultoa' -++'_SDL_lltoa'.'SDL3.dll'.'SDL_lltoa' -++'_SDL_ulltoa'.'SDL3.dll'.'SDL_ulltoa' -++'_SDL_atoi'.'SDL3.dll'.'SDL_atoi' -++'_SDL_atof'.'SDL3.dll'.'SDL_atof' -++'_SDL_strtol'.'SDL3.dll'.'SDL_strtol' -++'_SDL_strtoul'.'SDL3.dll'.'SDL_strtoul' -++'_SDL_strtoll'.'SDL3.dll'.'SDL_strtoll' -++'_SDL_strtoull'.'SDL3.dll'.'SDL_strtoull' -++'_SDL_strtod'.'SDL3.dll'.'SDL_strtod' -++'_SDL_strcmp'.'SDL3.dll'.'SDL_strcmp' -++'_SDL_strncmp'.'SDL3.dll'.'SDL_strncmp' -++'_SDL_strcasecmp'.'SDL3.dll'.'SDL_strcasecmp' -++'_SDL_strncasecmp'.'SDL3.dll'.'SDL_strncasecmp' -++'_SDL_vsnprintf'.'SDL3.dll'.'SDL_vsnprintf' -++'_SDL_acos'.'SDL3.dll'.'SDL_acos' -++'_SDL_asin'.'SDL3.dll'.'SDL_asin' -++'_SDL_atan'.'SDL3.dll'.'SDL_atan' -++'_SDL_atan2'.'SDL3.dll'.'SDL_atan2' -++'_SDL_ceil'.'SDL3.dll'.'SDL_ceil' -++'_SDL_copysign'.'SDL3.dll'.'SDL_copysign' -++'_SDL_cos'.'SDL3.dll'.'SDL_cos' -++'_SDL_cosf'.'SDL3.dll'.'SDL_cosf' -++'_SDL_fabs'.'SDL3.dll'.'SDL_fabs' -++'_SDL_floor'.'SDL3.dll'.'SDL_floor' -++'_SDL_log'.'SDL3.dll'.'SDL_log' -++'_SDL_pow'.'SDL3.dll'.'SDL_pow' -++'_SDL_scalbn'.'SDL3.dll'.'SDL_scalbn' -++'_SDL_sin'.'SDL3.dll'.'SDL_sin' -++'_SDL_sinf'.'SDL3.dll'.'SDL_sinf' -++'_SDL_sqrt'.'SDL3.dll'.'SDL_sqrt' -++'_SDL_iconv_open'.'SDL3.dll'.'SDL_iconv_open' -++'_SDL_iconv_close'.'SDL3.dll'.'SDL_iconv_close' -++'_SDL_iconv'.'SDL3.dll'.'SDL_iconv' -++'_SDL_iconv_string'.'SDL3.dll'.'SDL_iconv_string' -++'_SDL_CreateRGBSurface'.'SDL3.dll'.'SDL_CreateRGBSurface' -++'_SDL_CreateRGBSurfaceFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceFrom' -++'_SDL_FreeSurface'.'SDL3.dll'.'SDL_FreeSurface' -++'_SDL_SetSurfacePalette'.'SDL3.dll'.'SDL_SetSurfacePalette' -++'_SDL_LockSurface'.'SDL3.dll'.'SDL_LockSurface' -++'_SDL_UnlockSurface'.'SDL3.dll'.'SDL_UnlockSurface' -++'_SDL_LoadBMP_RW'.'SDL3.dll'.'SDL_LoadBMP_RW' -++'_SDL_SaveBMP_RW'.'SDL3.dll'.'SDL_SaveBMP_RW' -++'_SDL_SetSurfaceRLE'.'SDL3.dll'.'SDL_SetSurfaceRLE' -++'_SDL_SetColorKey'.'SDL3.dll'.'SDL_SetColorKey' -++'_SDL_GetColorKey'.'SDL3.dll'.'SDL_GetColorKey' -++'_SDL_SetSurfaceColorMod'.'SDL3.dll'.'SDL_SetSurfaceColorMod' -++'_SDL_GetSurfaceColorMod'.'SDL3.dll'.'SDL_GetSurfaceColorMod' -++'_SDL_SetSurfaceAlphaMod'.'SDL3.dll'.'SDL_SetSurfaceAlphaMod' -++'_SDL_GetSurfaceAlphaMod'.'SDL3.dll'.'SDL_GetSurfaceAlphaMod' -++'_SDL_SetSurfaceBlendMode'.'SDL3.dll'.'SDL_SetSurfaceBlendMode' -++'_SDL_GetSurfaceBlendMode'.'SDL3.dll'.'SDL_GetSurfaceBlendMode' -++'_SDL_SetClipRect'.'SDL3.dll'.'SDL_SetClipRect' -++'_SDL_GetClipRect'.'SDL3.dll'.'SDL_GetClipRect' -++'_SDL_ConvertSurface'.'SDL3.dll'.'SDL_ConvertSurface' -++'_SDL_ConvertSurfaceFormat'.'SDL3.dll'.'SDL_ConvertSurfaceFormat' -++'_SDL_ConvertPixels'.'SDL3.dll'.'SDL_ConvertPixels' -++'_SDL_FillRect'.'SDL3.dll'.'SDL_FillRect' -++'_SDL_FillRects'.'SDL3.dll'.'SDL_FillRects' -++'_SDL_UpperBlit'.'SDL3.dll'.'SDL_UpperBlit' -++'_SDL_LowerBlit'.'SDL3.dll'.'SDL_LowerBlit' -++'_SDL_SoftStretch'.'SDL3.dll'.'SDL_SoftStretch' -++'_SDL_UpperBlitScaled'.'SDL3.dll'.'SDL_UpperBlitScaled' -++'_SDL_LowerBlitScaled'.'SDL3.dll'.'SDL_LowerBlitScaled' -++'_SDL_GetWindowWMInfo'.'SDL3.dll'.'SDL_GetWindowWMInfo' -++'_SDL_GetThreadName'.'SDL3.dll'.'SDL_GetThreadName' -++'_SDL_ThreadID'.'SDL3.dll'.'SDL_ThreadID' -++'_SDL_GetThreadID'.'SDL3.dll'.'SDL_GetThreadID' -++'_SDL_SetThreadPriority'.'SDL3.dll'.'SDL_SetThreadPriority' -++'_SDL_WaitThread'.'SDL3.dll'.'SDL_WaitThread' -++'_SDL_DetachThread'.'SDL3.dll'.'SDL_DetachThread' -++'_SDL_TLSCreate'.'SDL3.dll'.'SDL_TLSCreate' -++'_SDL_TLSGet'.'SDL3.dll'.'SDL_TLSGet' -++'_SDL_TLSSet'.'SDL3.dll'.'SDL_TLSSet' -++'_SDL_GetTicks'.'SDL3.dll'.'SDL_GetTicks' -++'_SDL_GetPerformanceCounter'.'SDL3.dll'.'SDL_GetPerformanceCounter' -++'_SDL_GetPerformanceFrequency'.'SDL3.dll'.'SDL_GetPerformanceFrequency' -++'_SDL_Delay'.'SDL3.dll'.'SDL_Delay' -++'_SDL_AddTimer'.'SDL3.dll'.'SDL_AddTimer' -++'_SDL_RemoveTimer'.'SDL3.dll'.'SDL_RemoveTimer' -++'_SDL_GetNumTouchDevices'.'SDL3.dll'.'SDL_GetNumTouchDevices' -++'_SDL_GetTouchDevice'.'SDL3.dll'.'SDL_GetTouchDevice' -++'_SDL_GetNumTouchFingers'.'SDL3.dll'.'SDL_GetNumTouchFingers' -++'_SDL_GetTouchFinger'.'SDL3.dll'.'SDL_GetTouchFinger' -++'_SDL_GetVersion'.'SDL3.dll'.'SDL_GetVersion' -++'_SDL_GetRevision'.'SDL3.dll'.'SDL_GetRevision' -++'_SDL_GetRevisionNumber'.'SDL3.dll'.'SDL_GetRevisionNumber' -++'_SDL_GetNumVideoDrivers'.'SDL3.dll'.'SDL_GetNumVideoDrivers' -++'_SDL_GetVideoDriver'.'SDL3.dll'.'SDL_GetVideoDriver' -++'_SDL_VideoInit'.'SDL3.dll'.'SDL_VideoInit' -++'_SDL_VideoQuit'.'SDL3.dll'.'SDL_VideoQuit' -++'_SDL_GetCurrentVideoDriver'.'SDL3.dll'.'SDL_GetCurrentVideoDriver' -++'_SDL_GetNumVideoDisplays'.'SDL3.dll'.'SDL_GetNumVideoDisplays' -++'_SDL_GetDisplayName'.'SDL3.dll'.'SDL_GetDisplayName' -++'_SDL_GetDisplayBounds'.'SDL3.dll'.'SDL_GetDisplayBounds' -++'_SDL_GetDisplayDPI'.'SDL3.dll'.'SDL_GetDisplayDPI' -++'_SDL_GetNumDisplayModes'.'SDL3.dll'.'SDL_GetNumDisplayModes' -++'_SDL_GetDisplayMode'.'SDL3.dll'.'SDL_GetDisplayMode' -++'_SDL_GetDesktopDisplayMode'.'SDL3.dll'.'SDL_GetDesktopDisplayMode' -++'_SDL_GetCurrentDisplayMode'.'SDL3.dll'.'SDL_GetCurrentDisplayMode' -++'_SDL_GetClosestDisplayMode'.'SDL3.dll'.'SDL_GetClosestDisplayMode' -++'_SDL_GetWindowDisplayIndex'.'SDL3.dll'.'SDL_GetWindowDisplayIndex' -++'_SDL_SetWindowDisplayMode'.'SDL3.dll'.'SDL_SetWindowDisplayMode' -++'_SDL_GetWindowDisplayMode'.'SDL3.dll'.'SDL_GetWindowDisplayMode' -++'_SDL_GetWindowPixelFormat'.'SDL3.dll'.'SDL_GetWindowPixelFormat' -++'_SDL_CreateWindow'.'SDL3.dll'.'SDL_CreateWindow' -++'_SDL_CreateWindowFrom'.'SDL3.dll'.'SDL_CreateWindowFrom' -++'_SDL_GetWindowID'.'SDL3.dll'.'SDL_GetWindowID' -++'_SDL_GetWindowFromID'.'SDL3.dll'.'SDL_GetWindowFromID' -++'_SDL_GetWindowFlags'.'SDL3.dll'.'SDL_GetWindowFlags' -++'_SDL_SetWindowTitle'.'SDL3.dll'.'SDL_SetWindowTitle' -++'_SDL_GetWindowTitle'.'SDL3.dll'.'SDL_GetWindowTitle' -++'_SDL_SetWindowIcon'.'SDL3.dll'.'SDL_SetWindowIcon' -++'_SDL_SetWindowData'.'SDL3.dll'.'SDL_SetWindowData' -++'_SDL_GetWindowData'.'SDL3.dll'.'SDL_GetWindowData' -++'_SDL_SetWindowPosition'.'SDL3.dll'.'SDL_SetWindowPosition' -++'_SDL_GetWindowPosition'.'SDL3.dll'.'SDL_GetWindowPosition' -++'_SDL_SetWindowSize'.'SDL3.dll'.'SDL_SetWindowSize' -++'_SDL_GetWindowSize'.'SDL3.dll'.'SDL_GetWindowSize' -++'_SDL_SetWindowMinimumSize'.'SDL3.dll'.'SDL_SetWindowMinimumSize' -++'_SDL_GetWindowMinimumSize'.'SDL3.dll'.'SDL_GetWindowMinimumSize' -++'_SDL_SetWindowMaximumSize'.'SDL3.dll'.'SDL_SetWindowMaximumSize' -++'_SDL_GetWindowMaximumSize'.'SDL3.dll'.'SDL_GetWindowMaximumSize' -++'_SDL_SetWindowBordered'.'SDL3.dll'.'SDL_SetWindowBordered' -++'_SDL_ShowWindow'.'SDL3.dll'.'SDL_ShowWindow' -++'_SDL_HideWindow'.'SDL3.dll'.'SDL_HideWindow' -++'_SDL_RaiseWindow'.'SDL3.dll'.'SDL_RaiseWindow' -++'_SDL_MaximizeWindow'.'SDL3.dll'.'SDL_MaximizeWindow' -++'_SDL_MinimizeWindow'.'SDL3.dll'.'SDL_MinimizeWindow' -++'_SDL_RestoreWindow'.'SDL3.dll'.'SDL_RestoreWindow' -++'_SDL_SetWindowFullscreen'.'SDL3.dll'.'SDL_SetWindowFullscreen' -++'_SDL_GetWindowSurface'.'SDL3.dll'.'SDL_GetWindowSurface' -++'_SDL_UpdateWindowSurface'.'SDL3.dll'.'SDL_UpdateWindowSurface' -++'_SDL_UpdateWindowSurfaceRects'.'SDL3.dll'.'SDL_UpdateWindowSurfaceRects' -++'_SDL_SetWindowGrab'.'SDL3.dll'.'SDL_SetWindowGrab' -++'_SDL_GetWindowGrab'.'SDL3.dll'.'SDL_GetWindowGrab' -++'_SDL_SetWindowBrightness'.'SDL3.dll'.'SDL_SetWindowBrightness' -++'_SDL_GetWindowBrightness'.'SDL3.dll'.'SDL_GetWindowBrightness' -++'_SDL_SetWindowGammaRamp'.'SDL3.dll'.'SDL_SetWindowGammaRamp' -++'_SDL_GetWindowGammaRamp'.'SDL3.dll'.'SDL_GetWindowGammaRamp' -++'_SDL_DestroyWindow'.'SDL3.dll'.'SDL_DestroyWindow' -++'_SDL_IsScreenSaverEnabled'.'SDL3.dll'.'SDL_IsScreenSaverEnabled' -++'_SDL_EnableScreenSaver'.'SDL3.dll'.'SDL_EnableScreenSaver' -++'_SDL_DisableScreenSaver'.'SDL3.dll'.'SDL_DisableScreenSaver' -++'_SDL_GL_LoadLibrary'.'SDL3.dll'.'SDL_GL_LoadLibrary' -++'_SDL_GL_GetProcAddress'.'SDL3.dll'.'SDL_GL_GetProcAddress' -++'_SDL_GL_UnloadLibrary'.'SDL3.dll'.'SDL_GL_UnloadLibrary' -++'_SDL_GL_ExtensionSupported'.'SDL3.dll'.'SDL_GL_ExtensionSupported' -++'_SDL_GL_SetAttribute'.'SDL3.dll'.'SDL_GL_SetAttribute' -++'_SDL_GL_GetAttribute'.'SDL3.dll'.'SDL_GL_GetAttribute' -++'_SDL_GL_CreateContext'.'SDL3.dll'.'SDL_GL_CreateContext' -++'_SDL_GL_MakeCurrent'.'SDL3.dll'.'SDL_GL_MakeCurrent' -++'_SDL_GL_GetCurrentWindow'.'SDL3.dll'.'SDL_GL_GetCurrentWindow' -++'_SDL_GL_GetCurrentContext'.'SDL3.dll'.'SDL_GL_GetCurrentContext' -++'_SDL_GL_GetDrawableSize'.'SDL3.dll'.'SDL_GL_GetDrawableSize' -++'_SDL_GL_SetSwapInterval'.'SDL3.dll'.'SDL_GL_SetSwapInterval' -++'_SDL_GL_GetSwapInterval'.'SDL3.dll'.'SDL_GL_GetSwapInterval' -++'_SDL_GL_SwapWindow'.'SDL3.dll'.'SDL_GL_SwapWindow' -++'_SDL_GL_DeleteContext'.'SDL3.dll'.'SDL_GL_DeleteContext' -++'_SDL_vsscanf'.'SDL3.dll'.'SDL_vsscanf' -++'_SDL_GameControllerAddMappingsFromRW'.'SDL3.dll'.'SDL_GameControllerAddMappingsFromRW' -++'_SDL_GL_ResetAttributes'.'SDL3.dll'.'SDL_GL_ResetAttributes' -++'_SDL_HasAVX'.'SDL3.dll'.'SDL_HasAVX' -++'_SDL_GetDefaultAssertionHandler'.'SDL3.dll'.'SDL_GetDefaultAssertionHandler' -++'_SDL_GetAssertionHandler'.'SDL3.dll'.'SDL_GetAssertionHandler' -++'_SDL_DXGIGetOutputInfo'.'SDL3.dll'.'SDL_DXGIGetOutputInfo' -++'_SDL_RenderIsClipEnabled'.'SDL3.dll'.'SDL_RenderIsClipEnabled' -# ++'_SDL_WinRTRunApp'.'SDL3.dll'.'SDL_WinRTRunApp' -++'_SDL_WarpMouseGlobal'.'SDL3.dll'.'SDL_WarpMouseGlobal' -# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL3.dll'.'SDL_WinRTGetFSPathUNICODE' -# ++'_SDL_WinRTGetFSPathUTF8'.'SDL3.dll'.'SDL_WinRTGetFSPathUTF8' -++'_SDL_sqrtf'.'SDL3.dll'.'SDL_sqrtf' -++'_SDL_tan'.'SDL3.dll'.'SDL_tan' -++'_SDL_tanf'.'SDL3.dll'.'SDL_tanf' -++'_SDL_CaptureMouse'.'SDL3.dll'.'SDL_CaptureMouse' -++'_SDL_SetWindowHitTest'.'SDL3.dll'.'SDL_SetWindowHitTest' -++'_SDL_GetGlobalMouseState'.'SDL3.dll'.'SDL_GetGlobalMouseState' -++'_SDL_HasAVX2'.'SDL3.dll'.'SDL_HasAVX2' -++'_SDL_QueueAudio'.'SDL3.dll'.'SDL_QueueAudio' -++'_SDL_GetQueuedAudioSize'.'SDL3.dll'.'SDL_GetQueuedAudioSize' -++'_SDL_ClearQueuedAudio'.'SDL3.dll'.'SDL_ClearQueuedAudio' -++'_SDL_GetGrabbedWindow'.'SDL3.dll'.'SDL_GetGrabbedWindow' -++'_SDL_SetWindowsMessageHook'.'SDL3.dll'.'SDL_SetWindowsMessageHook' -++'_SDL_JoystickCurrentPowerLevel'.'SDL3.dll'.'SDL_JoystickCurrentPowerLevel' -++'_SDL_GameControllerFromInstanceID'.'SDL3.dll'.'SDL_GameControllerFromInstanceID' -++'_SDL_JoystickFromInstanceID'.'SDL3.dll'.'SDL_JoystickFromInstanceID' -++'_SDL_GetDisplayUsableBounds'.'SDL3.dll'.'SDL_GetDisplayUsableBounds' -++'_SDL_GetWindowBordersSize'.'SDL3.dll'.'SDL_GetWindowBordersSize' -++'_SDL_SetWindowOpacity'.'SDL3.dll'.'SDL_SetWindowOpacity' -++'_SDL_GetWindowOpacity'.'SDL3.dll'.'SDL_GetWindowOpacity' -++'_SDL_SetWindowInputFocus'.'SDL3.dll'.'SDL_SetWindowInputFocus' -++'_SDL_SetWindowModalFor'.'SDL3.dll'.'SDL_SetWindowModalFor' -++'_SDL_RenderSetIntegerScale'.'SDL3.dll'.'SDL_RenderSetIntegerScale' -++'_SDL_RenderGetIntegerScale'.'SDL3.dll'.'SDL_RenderGetIntegerScale' -++'_SDL_DequeueAudio'.'SDL3.dll'.'SDL_DequeueAudio' -++'_SDL_SetWindowResizable'.'SDL3.dll'.'SDL_SetWindowResizable' -++'_SDL_CreateRGBSurfaceWithFormat'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormat' -++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormatFrom' -++'_SDL_GetHintBoolean'.'SDL3.dll'.'SDL_GetHintBoolean' -++'_SDL_JoystickGetDeviceVendor'.'SDL3.dll'.'SDL_JoystickGetDeviceVendor' -++'_SDL_JoystickGetDeviceProduct'.'SDL3.dll'.'SDL_JoystickGetDeviceProduct' -++'_SDL_JoystickGetDeviceProductVersion'.'SDL3.dll'.'SDL_JoystickGetDeviceProductVersion' -++'_SDL_JoystickGetVendor'.'SDL3.dll'.'SDL_JoystickGetVendor' -++'_SDL_JoystickGetProduct'.'SDL3.dll'.'SDL_JoystickGetProduct' -++'_SDL_JoystickGetProductVersion'.'SDL3.dll'.'SDL_JoystickGetProductVersion' -++'_SDL_GameControllerGetVendor'.'SDL3.dll'.'SDL_GameControllerGetVendor' -++'_SDL_GameControllerGetProduct'.'SDL3.dll'.'SDL_GameControllerGetProduct' -++'_SDL_GameControllerGetProductVersion'.'SDL3.dll'.'SDL_GameControllerGetProductVersion' -++'_SDL_HasNEON'.'SDL3.dll'.'SDL_HasNEON' -++'_SDL_GameControllerNumMappings'.'SDL3.dll'.'SDL_GameControllerNumMappings' -++'_SDL_GameControllerMappingForIndex'.'SDL3.dll'.'SDL_GameControllerMappingForIndex' -++'_SDL_JoystickGetAxisInitialState'.'SDL3.dll'.'SDL_JoystickGetAxisInitialState' -++'_SDL_JoystickGetDeviceType'.'SDL3.dll'.'SDL_JoystickGetDeviceType' -++'_SDL_JoystickGetType'.'SDL3.dll'.'SDL_JoystickGetType' -++'_SDL_MemoryBarrierReleaseFunction'.'SDL3.dll'.'SDL_MemoryBarrierReleaseFunction' -++'_SDL_MemoryBarrierAcquireFunction'.'SDL3.dll'.'SDL_MemoryBarrierAcquireFunction' -++'_SDL_JoystickGetDeviceInstanceID'.'SDL3.dll'.'SDL_JoystickGetDeviceInstanceID' -++'_SDL_utf8strlen'.'SDL3.dll'.'SDL_utf8strlen' -++'_SDL_LoadFile_RW'.'SDL3.dll'.'SDL_LoadFile_RW' -++'_SDL_wcscmp'.'SDL3.dll'.'SDL_wcscmp' -++'_SDL_ComposeCustomBlendMode'.'SDL3.dll'.'SDL_ComposeCustomBlendMode' -++'_SDL_DuplicateSurface'.'SDL3.dll'.'SDL_DuplicateSurface' -++'_SDL_Vulkan_LoadLibrary'.'SDL3.dll'.'SDL_Vulkan_LoadLibrary' -++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL3.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr' -++'_SDL_Vulkan_UnloadLibrary'.'SDL3.dll'.'SDL_Vulkan_UnloadLibrary' -++'_SDL_Vulkan_GetInstanceExtensions'.'SDL3.dll'.'SDL_Vulkan_GetInstanceExtensions' -++'_SDL_Vulkan_CreateSurface'.'SDL3.dll'.'SDL_Vulkan_CreateSurface' -++'_SDL_Vulkan_GetDrawableSize'.'SDL3.dll'.'SDL_Vulkan_GetDrawableSize' -++'_SDL_LockJoysticks'.'SDL3.dll'.'SDL_LockJoysticks' -++'_SDL_UnlockJoysticks'.'SDL3.dll'.'SDL_UnlockJoysticks' -++'_SDL_GetMemoryFunctions'.'SDL3.dll'.'SDL_GetMemoryFunctions' -++'_SDL_SetMemoryFunctions'.'SDL3.dll'.'SDL_SetMemoryFunctions' -++'_SDL_GetNumAllocations'.'SDL3.dll'.'SDL_GetNumAllocations' -++'_SDL_NewAudioStream'.'SDL3.dll'.'SDL_NewAudioStream' -++'_SDL_AudioStreamPut'.'SDL3.dll'.'SDL_AudioStreamPut' -++'_SDL_AudioStreamGet'.'SDL3.dll'.'SDL_AudioStreamGet' -++'_SDL_AudioStreamClear'.'SDL3.dll'.'SDL_AudioStreamClear' -++'_SDL_AudioStreamAvailable'.'SDL3.dll'.'SDL_AudioStreamAvailable' -++'_SDL_FreeAudioStream'.'SDL3.dll'.'SDL_FreeAudioStream' -++'_SDL_AudioStreamFlush'.'SDL3.dll'.'SDL_AudioStreamFlush' -++'_SDL_acosf'.'SDL3.dll'.'SDL_acosf' -++'_SDL_asinf'.'SDL3.dll'.'SDL_asinf' -++'_SDL_atanf'.'SDL3.dll'.'SDL_atanf' -++'_SDL_atan2f'.'SDL3.dll'.'SDL_atan2f' -++'_SDL_ceilf'.'SDL3.dll'.'SDL_ceilf' -++'_SDL_copysignf'.'SDL3.dll'.'SDL_copysignf' -++'_SDL_fabsf'.'SDL3.dll'.'SDL_fabsf' -++'_SDL_floorf'.'SDL3.dll'.'SDL_floorf' -++'_SDL_logf'.'SDL3.dll'.'SDL_logf' -++'_SDL_powf'.'SDL3.dll'.'SDL_powf' -++'_SDL_scalbnf'.'SDL3.dll'.'SDL_scalbnf' -++'_SDL_fmod'.'SDL3.dll'.'SDL_fmod' -++'_SDL_fmodf'.'SDL3.dll'.'SDL_fmodf' -++'_SDL_SetYUVConversionMode'.'SDL3.dll'.'SDL_SetYUVConversionMode' -++'_SDL_GetYUVConversionMode'.'SDL3.dll'.'SDL_GetYUVConversionMode' -++'_SDL_GetYUVConversionModeForResolution'.'SDL3.dll'.'SDL_GetYUVConversionModeForResolution' -++'_SDL_RenderGetMetalLayer'.'SDL3.dll'.'SDL_RenderGetMetalLayer' -++'_SDL_RenderGetMetalCommandEncoder'.'SDL3.dll'.'SDL_RenderGetMetalCommandEncoder' -# ++'_SDL_IsAndroidTV'.'SDL3.dll'.'SDL_IsAndroidTV' -# ++'_SDL_WinRTGetDeviceFamily'.'SDL3.dll'.'SDL_WinRTGetDeviceFamily' -++'_SDL_log10'.'SDL3.dll'.'SDL_log10' -++'_SDL_log10f'.'SDL3.dll'.'SDL_log10f' -++'_SDL_GameControllerMappingForDeviceIndex'.'SDL3.dll'.'SDL_GameControllerMappingForDeviceIndex' -# ++'_SDL_LinuxSetThreadPriority'.'SDL3.dll'.'SDL_LinuxSetThreadPriority' -++'_SDL_HasAVX512F'.'SDL3.dll'.'SDL_HasAVX512F' -# ++'_SDL_IsChromebook'.'SDL3.dll'.'SDL_IsChromebook' -# ++'_SDL_IsDeXMode'.'SDL3.dll'.'SDL_IsDeXMode' -# ++'_SDL_AndroidBackButton'.'SDL3.dll'.'SDL_AndroidBackButton' -++'_SDL_exp'.'SDL3.dll'.'SDL_exp' -++'_SDL_expf'.'SDL3.dll'.'SDL_expf' -++'_SDL_wcsdup'.'SDL3.dll'.'SDL_wcsdup' -++'_SDL_GameControllerRumble'.'SDL3.dll'.'SDL_GameControllerRumble' -++'_SDL_JoystickRumble'.'SDL3.dll'.'SDL_JoystickRumble' -++'_SDL_NumSensors'.'SDL3.dll'.'SDL_NumSensors' -++'_SDL_SensorGetDeviceName'.'SDL3.dll'.'SDL_SensorGetDeviceName' -++'_SDL_SensorGetDeviceType'.'SDL3.dll'.'SDL_SensorGetDeviceType' -++'_SDL_SensorGetDeviceNonPortableType'.'SDL3.dll'.'SDL_SensorGetDeviceNonPortableType' -++'_SDL_SensorGetDeviceInstanceID'.'SDL3.dll'.'SDL_SensorGetDeviceInstanceID' -++'_SDL_SensorOpen'.'SDL3.dll'.'SDL_SensorOpen' -++'_SDL_SensorFromInstanceID'.'SDL3.dll'.'SDL_SensorFromInstanceID' -++'_SDL_SensorGetName'.'SDL3.dll'.'SDL_SensorGetName' -++'_SDL_SensorGetType'.'SDL3.dll'.'SDL_SensorGetType' -++'_SDL_SensorGetNonPortableType'.'SDL3.dll'.'SDL_SensorGetNonPortableType' -++'_SDL_SensorGetInstanceID'.'SDL3.dll'.'SDL_SensorGetInstanceID' -++'_SDL_SensorGetData'.'SDL3.dll'.'SDL_SensorGetData' -++'_SDL_SensorClose'.'SDL3.dll'.'SDL_SensorClose' -++'_SDL_SensorUpdate'.'SDL3.dll'.'SDL_SensorUpdate' -++'_SDL_IsTablet'.'SDL3.dll'.'SDL_IsTablet' -++'_SDL_GetDisplayOrientation'.'SDL3.dll'.'SDL_GetDisplayOrientation' -++'_SDL_HasColorKey'.'SDL3.dll'.'SDL_HasColorKey' -++'_SDL_CreateThreadWithStackSize'.'SDL3.dll'.'SDL_CreateThreadWithStackSize' -++'_SDL_JoystickGetDevicePlayerIndex'.'SDL3.dll'.'SDL_JoystickGetDevicePlayerIndex' -++'_SDL_JoystickGetPlayerIndex'.'SDL3.dll'.'SDL_JoystickGetPlayerIndex' -++'_SDL_GameControllerGetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerGetPlayerIndex' -++'_SDL_RenderFlush'.'SDL3.dll'.'SDL_RenderFlush' -++'_SDL_RenderDrawPointF'.'SDL3.dll'.'SDL_RenderDrawPointF' -++'_SDL_RenderDrawPointsF'.'SDL3.dll'.'SDL_RenderDrawPointsF' -++'_SDL_RenderDrawLineF'.'SDL3.dll'.'SDL_RenderDrawLineF' -++'_SDL_RenderDrawLinesF'.'SDL3.dll'.'SDL_RenderDrawLinesF' -++'_SDL_RenderDrawRectF'.'SDL3.dll'.'SDL_RenderDrawRectF' -++'_SDL_RenderDrawRectsF'.'SDL3.dll'.'SDL_RenderDrawRectsF' -++'_SDL_RenderFillRectF'.'SDL3.dll'.'SDL_RenderFillRectF' -++'_SDL_RenderFillRectsF'.'SDL3.dll'.'SDL_RenderFillRectsF' -++'_SDL_RenderCopyF'.'SDL3.dll'.'SDL_RenderCopyF' -++'_SDL_RenderCopyExF'.'SDL3.dll'.'SDL_RenderCopyExF' -++'_SDL_GetTouchDeviceType'.'SDL3.dll'.'SDL_GetTouchDeviceType' -# ++'_SDL_UIKitRunApp'.'SDL3.dll'.'SDL_UIKitRunApp' -++'_SDL_SIMDGetAlignment'.'SDL3.dll'.'SDL_SIMDGetAlignment' -++'_SDL_SIMDAlloc'.'SDL3.dll'.'SDL_SIMDAlloc' -++'_SDL_SIMDFree'.'SDL3.dll'.'SDL_SIMDFree' -++'_SDL_RWsize'.'SDL3.dll'.'SDL_RWsize' -++'_SDL_RWseek'.'SDL3.dll'.'SDL_RWseek' -++'_SDL_RWtell'.'SDL3.dll'.'SDL_RWtell' -++'_SDL_RWread'.'SDL3.dll'.'SDL_RWread' -++'_SDL_RWwrite'.'SDL3.dll'.'SDL_RWwrite' -++'_SDL_RWclose'.'SDL3.dll'.'SDL_RWclose' -++'_SDL_LoadFile'.'SDL3.dll'.'SDL_LoadFile' -++'_SDL_Metal_CreateView'.'SDL3.dll'.'SDL_Metal_CreateView' -++'_SDL_Metal_DestroyView'.'SDL3.dll'.'SDL_Metal_DestroyView' -++'_SDL_LockTextureToSurface'.'SDL3.dll'.'SDL_LockTextureToSurface' -++'_SDL_HasARMSIMD'.'SDL3.dll'.'SDL_HasARMSIMD' -++'_SDL_strtokr'.'SDL3.dll'.'SDL_strtokr' -++'_SDL_wcsstr'.'SDL3.dll'.'SDL_wcsstr' -++'_SDL_wcsncmp'.'SDL3.dll'.'SDL_wcsncmp' -++'_SDL_GameControllerTypeForIndex'.'SDL3.dll'.'SDL_GameControllerTypeForIndex' -++'_SDL_GameControllerGetType'.'SDL3.dll'.'SDL_GameControllerGetType' -++'_SDL_GameControllerFromPlayerIndex'.'SDL3.dll'.'SDL_GameControllerFromPlayerIndex' -++'_SDL_GameControllerSetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerSetPlayerIndex' -++'_SDL_JoystickFromPlayerIndex'.'SDL3.dll'.'SDL_JoystickFromPlayerIndex' -++'_SDL_JoystickSetPlayerIndex'.'SDL3.dll'.'SDL_JoystickSetPlayerIndex' -++'_SDL_SetTextureScaleMode'.'SDL3.dll'.'SDL_SetTextureScaleMode' -++'_SDL_GetTextureScaleMode'.'SDL3.dll'.'SDL_GetTextureScaleMode' -++'_SDL_OnApplicationWillTerminate'.'SDL3.dll'.'SDL_OnApplicationWillTerminate' -++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL3.dll'.'SDL_OnApplicationDidReceiveMemoryWarning' -++'_SDL_OnApplicationWillResignActive'.'SDL3.dll'.'SDL_OnApplicationWillResignActive' -++'_SDL_OnApplicationDidEnterBackground'.'SDL3.dll'.'SDL_OnApplicationDidEnterBackground' -++'_SDL_OnApplicationWillEnterForeground'.'SDL3.dll'.'SDL_OnApplicationWillEnterForeground' -++'_SDL_OnApplicationDidBecomeActive'.'SDL3.dll'.'SDL_OnApplicationDidBecomeActive' -# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL3.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation' -# ++'_SDL_GetAndroidSDKVersion'.'SDL3.dll'.'SDL_GetAndroidSDKVersion' -++'_SDL_isupper'.'SDL3.dll'.'SDL_isupper' -++'_SDL_islower'.'SDL3.dll'.'SDL_islower' -++'_SDL_JoystickAttachVirtual'.'SDL3.dll'.'SDL_JoystickAttachVirtual' -++'_SDL_JoystickDetachVirtual'.'SDL3.dll'.'SDL_JoystickDetachVirtual' -++'_SDL_JoystickIsVirtual'.'SDL3.dll'.'SDL_JoystickIsVirtual' -++'_SDL_JoystickSetVirtualAxis'.'SDL3.dll'.'SDL_JoystickSetVirtualAxis' -++'_SDL_JoystickSetVirtualButton'.'SDL3.dll'.'SDL_JoystickSetVirtualButton' -++'_SDL_JoystickSetVirtualHat'.'SDL3.dll'.'SDL_JoystickSetVirtualHat' -++'_SDL_GetErrorMsg'.'SDL3.dll'.'SDL_GetErrorMsg' -++'_SDL_LockSensors'.'SDL3.dll'.'SDL_LockSensors' -++'_SDL_UnlockSensors'.'SDL3.dll'.'SDL_UnlockSensors' -++'_SDL_Metal_GetLayer'.'SDL3.dll'.'SDL_Metal_GetLayer' -++'_SDL_Metal_GetDrawableSize'.'SDL3.dll'.'SDL_Metal_GetDrawableSize' -++'_SDL_trunc'.'SDL3.dll'.'SDL_trunc' -++'_SDL_truncf'.'SDL3.dll'.'SDL_truncf' -++'_SDL_GetPreferredLocales'.'SDL3.dll'.'SDL_GetPreferredLocales' -++'_SDL_SIMDRealloc'.'SDL3.dll'.'SDL_SIMDRealloc' -# ++'_SDL_AndroidRequestPermission'.'SDL3.dll'.'SDL_AndroidRequestPermission' -++'_SDL_OpenURL'.'SDL3.dll'.'SDL_OpenURL' -++'_SDL_HasSurfaceRLE'.'SDL3.dll'.'SDL_HasSurfaceRLE' -++'_SDL_GameControllerHasLED'.'SDL3.dll'.'SDL_GameControllerHasLED' -++'_SDL_GameControllerSetLED'.'SDL3.dll'.'SDL_GameControllerSetLED' -++'_SDL_JoystickHasLED'.'SDL3.dll'.'SDL_JoystickHasLED' -++'_SDL_JoystickSetLED'.'SDL3.dll'.'SDL_JoystickSetLED' -++'_SDL_GameControllerRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerRumbleTriggers' -++'_SDL_JoystickRumbleTriggers'.'SDL3.dll'.'SDL_JoystickRumbleTriggers' -++'_SDL_GameControllerHasAxis'.'SDL3.dll'.'SDL_GameControllerHasAxis' -++'_SDL_GameControllerHasButton'.'SDL3.dll'.'SDL_GameControllerHasButton' -++'_SDL_GameControllerGetNumTouchpads'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpads' -++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpadFingers' -++'_SDL_GameControllerGetTouchpadFinger'.'SDL3.dll'.'SDL_GameControllerGetTouchpadFinger' -++'_SDL_crc32'.'SDL3.dll'.'SDL_crc32' -++'_SDL_GameControllerGetSerial'.'SDL3.dll'.'SDL_GameControllerGetSerial' -++'_SDL_JoystickGetSerial'.'SDL3.dll'.'SDL_JoystickGetSerial' -++'_SDL_GameControllerHasSensor'.'SDL3.dll'.'SDL_GameControllerHasSensor' -++'_SDL_GameControllerSetSensorEnabled'.'SDL3.dll'.'SDL_GameControllerSetSensorEnabled' -++'_SDL_GameControllerIsSensorEnabled'.'SDL3.dll'.'SDL_GameControllerIsSensorEnabled' -++'_SDL_GameControllerGetSensorData'.'SDL3.dll'.'SDL_GameControllerGetSensorData' -++'_SDL_wcscasecmp'.'SDL3.dll'.'SDL_wcscasecmp' -++'_SDL_wcsncasecmp'.'SDL3.dll'.'SDL_wcsncasecmp' -++'_SDL_round'.'SDL3.dll'.'SDL_round' -++'_SDL_roundf'.'SDL3.dll'.'SDL_roundf' -++'_SDL_lround'.'SDL3.dll'.'SDL_lround' -++'_SDL_lroundf'.'SDL3.dll'.'SDL_lroundf' -++'_SDL_SoftStretchLinear'.'SDL3.dll'.'SDL_SoftStretchLinear' -++'_SDL_RenderGetD3D11Device'.'SDL3.dll'.'SDL_RenderGetD3D11Device' -++'_SDL_UpdateNVTexture'.'SDL3.dll'.'SDL_UpdateNVTexture' -++'_SDL_SetWindowKeyboardGrab'.'SDL3.dll'.'SDL_SetWindowKeyboardGrab' -++'_SDL_SetWindowMouseGrab'.'SDL3.dll'.'SDL_SetWindowMouseGrab' -++'_SDL_GetWindowKeyboardGrab'.'SDL3.dll'.'SDL_GetWindowKeyboardGrab' -++'_SDL_GetWindowMouseGrab'.'SDL3.dll'.'SDL_GetWindowMouseGrab' -++'_SDL_isalpha'.'SDL3.dll'.'SDL_isalpha' -++'_SDL_isalnum'.'SDL3.dll'.'SDL_isalnum' -++'_SDL_isblank'.'SDL3.dll'.'SDL_isblank' -++'_SDL_iscntrl'.'SDL3.dll'.'SDL_iscntrl' -++'_SDL_isxdigit'.'SDL3.dll'.'SDL_isxdigit' -++'_SDL_ispunct'.'SDL3.dll'.'SDL_ispunct' -++'_SDL_isprint'.'SDL3.dll'.'SDL_isprint' -++'_SDL_isgraph'.'SDL3.dll'.'SDL_isgraph' -# ++'_SDL_AndroidShowToast'.'SDL3.dll'.'SDL_AndroidShowToast' -++'_SDL_GetAudioDeviceSpec'.'SDL3.dll'.'SDL_GetAudioDeviceSpec' -++'_SDL_TLSCleanup'.'SDL3.dll'.'SDL_TLSCleanup' -++'_SDL_SetWindowAlwaysOnTop'.'SDL3.dll'.'SDL_SetWindowAlwaysOnTop' -++'_SDL_FlashWindow'.'SDL3.dll'.'SDL_FlashWindow' -++'_SDL_GameControllerSendEffect'.'SDL3.dll'.'SDL_GameControllerSendEffect' -++'_SDL_JoystickSendEffect'.'SDL3.dll'.'SDL_JoystickSendEffect' -++'_SDL_GameControllerGetSensorDataRate'.'SDL3.dll'.'SDL_GameControllerGetSensorDataRate' -++'_SDL_SetTextureUserData'.'SDL3.dll'.'SDL_SetTextureUserData' -++'_SDL_GetTextureUserData'.'SDL3.dll'.'SDL_GetTextureUserData' -++'_SDL_RenderGeometry'.'SDL3.dll'.'SDL_RenderGeometry' -++'_SDL_RenderGeometryRaw'.'SDL3.dll'.'SDL_RenderGeometryRaw' -++'_SDL_RenderSetVSync'.'SDL3.dll'.'SDL_RenderSetVSync' -++'_SDL_asprintf'.'SDL3.dll'.'SDL_asprintf' -++'_SDL_vasprintf'.'SDL3.dll'.'SDL_vasprintf' -++'_SDL_GetWindowICCProfile'.'SDL3.dll'.'SDL_GetWindowICCProfile' -++'_SDL_GetTicks64'.'SDL3.dll'.'SDL_GetTicks64' -# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL3.dll'.'SDL_LinuxSetThreadPriorityAndPolicy' -++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton' -++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis' -++'_SDL_hid_init'.'SDL3.dll'.'SDL_hid_init' -++'_SDL_hid_exit'.'SDL3.dll'.'SDL_hid_exit' -++'_SDL_hid_device_change_count'.'SDL3.dll'.'SDL_hid_device_change_count' -++'_SDL_hid_enumerate'.'SDL3.dll'.'SDL_hid_enumerate' -++'_SDL_hid_free_enumeration'.'SDL3.dll'.'SDL_hid_free_enumeration' -++'_SDL_hid_open'.'SDL3.dll'.'SDL_hid_open' -++'_SDL_hid_open_path'.'SDL3.dll'.'SDL_hid_open_path' -++'_SDL_hid_write'.'SDL3.dll'.'SDL_hid_write' -++'_SDL_hid_read_timeout'.'SDL3.dll'.'SDL_hid_read_timeout' -++'_SDL_hid_read'.'SDL3.dll'.'SDL_hid_read' -++'_SDL_hid_set_nonblocking'.'SDL3.dll'.'SDL_hid_set_nonblocking' -++'_SDL_hid_send_feature_report'.'SDL3.dll'.'SDL_hid_send_feature_report' -++'_SDL_hid_get_feature_report'.'SDL3.dll'.'SDL_hid_get_feature_report' -++'_SDL_hid_close'.'SDL3.dll'.'SDL_hid_close' -++'_SDL_hid_get_manufacturer_string'.'SDL3.dll'.'SDL_hid_get_manufacturer_string' -++'_SDL_hid_get_product_string'.'SDL3.dll'.'SDL_hid_get_product_string' -++'_SDL_hid_get_serial_number_string'.'SDL3.dll'.'SDL_hid_get_serial_number_string' -++'_SDL_hid_get_indexed_string'.'SDL3.dll'.'SDL_hid_get_indexed_string' -++'_SDL_SetWindowMouseRect'.'SDL3.dll'.'SDL_SetWindowMouseRect' -++'_SDL_GetWindowMouseRect'.'SDL3.dll'.'SDL_GetWindowMouseRect' -++'_SDL_RenderWindowToLogical'.'SDL3.dll'.'SDL_RenderWindowToLogical' -++'_SDL_RenderLogicalToWindow'.'SDL3.dll'.'SDL_RenderLogicalToWindow' -++'_SDL_JoystickHasRumble'.'SDL3.dll'.'SDL_JoystickHasRumble' -++'_SDL_JoystickHasRumbleTriggers'.'SDL3.dll'.'SDL_JoystickHasRumbleTriggers' -++'_SDL_GameControllerHasRumble'.'SDL3.dll'.'SDL_GameControllerHasRumble' -++'_SDL_GameControllerHasRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerHasRumbleTriggers' -++'_SDL_hid_ble_scan'.'SDL3.dll'.'SDL_hid_ble_scan' -++'_SDL_PremultiplyAlpha'.'SDL3.dll'.'SDL_PremultiplyAlpha' -# ++'_SDL_AndroidSendMessage'.'SDL3.dll'.'SDL_AndroidSendMessage' -++'_SDL_GetTouchName'.'SDL3.dll'.'SDL_GetTouchName' -++'_SDL_ClearComposition'.'SDL3.dll'.'SDL_ClearComposition' -++'_SDL_IsTextInputShown'.'SDL3.dll'.'SDL_IsTextInputShown' -++'_SDL_HasIntersectionF'.'SDL3.dll'.'SDL_HasIntersectionF' -++'_SDL_IntersectFRect'.'SDL3.dll'.'SDL_IntersectFRect' -++'_SDL_UnionFRect'.'SDL3.dll'.'SDL_UnionFRect' -++'_SDL_EncloseFPoints'.'SDL3.dll'.'SDL_EncloseFPoints' -++'_SDL_IntersectFRectAndLine'.'SDL3.dll'.'SDL_IntersectFRectAndLine' -++'_SDL_RenderGetWindow'.'SDL3.dll'.'SDL_RenderGetWindow' -++'_SDL_bsearch'.'SDL3.dll'.'SDL_bsearch' -++'_SDL_GameControllerPathForIndex'.'SDL3.dll'.'SDL_GameControllerPathForIndex' -++'_SDL_GameControllerPath'.'SDL3.dll'.'SDL_GameControllerPath' -++'_SDL_JoystickPathForIndex'.'SDL3.dll'.'SDL_JoystickPathForIndex' -++'_SDL_JoystickPath'.'SDL3.dll'.'SDL_JoystickPath' -++'_SDL_JoystickAttachVirtualEx'.'SDL3.dll'.'SDL_JoystickAttachVirtualEx' -++'_SDL_GameControllerGetFirmwareVersion'.'SDL3.dll'.'SDL_GameControllerGetFirmwareVersion' -++'_SDL_JoystickGetFirmwareVersion'.'SDL3.dll'.'SDL_JoystickGetFirmwareVersion' -++'_SDL_GUIDToString'.'SDL3.dll'.'SDL_GUIDToString' -++'_SDL_GUIDFromString'.'SDL3.dll'.'SDL_GUIDFromString' -++'_SDL_HasLSX'.'SDL3.dll'.'SDL_HasLSX' -++'_SDL_HasLASX'.'SDL3.dll'.'SDL_HasLASX' -++'_SDL_RenderGetD3D12Device'.'SDL3.dll'.'SDL_RenderGetD3D12Device' -++'_SDL_utf8strnlen'.'SDL3.dll'.'SDL_utf8strnlen' -# ++'_SDL_GDKGetTaskQueue'.'SDL3.dll'.'SDL_GDKGetTaskQueue' -# ++'_SDL_GDKRunApp'.'SDL3.dll'.'SDL_GDKRunApp' -++'_SDL_GetOriginalMemoryFunctions'.'SDL3.dll'.'SDL_GetOriginalMemoryFunctions' -++'_SDL_ResetKeyboard'.'SDL3.dll'.'SDL_ResetKeyboard' -++'_SDL_GetDefaultAudioInfo'.'SDL3.dll'.'SDL_GetDefaultAudioInfo' -++'_SDL_GetPointDisplayIndex'.'SDL3.dll'.'SDL_GetPointDisplayIndex' -++'_SDL_GetRectDisplayIndex'.'SDL3.dll'.'SDL_GetRectDisplayIndex' -++'_SDL_ResetHint'.'SDL3.dll'.'SDL_ResetHint' -++'_SDL_crc16'.'SDL3.dll'.'SDL_crc16' -++'_SDL_GetWindowSizeInPixels'.'SDL3.dll'.'SDL_GetWindowSizeInPixels' -++'_SDL_GetJoystickGUIDInfo'.'SDL3.dll'.'SDL_GetJoystickGUIDInfo' -++'_SDL_SetPrimarySelectionText'.'SDL3.dll'.'SDL_SetPrimarySelectionText' -++'_SDL_GetPrimarySelectionText'.'SDL3.dll'.'SDL_GetPrimarySelectionText' -++'_SDL_HasPrimarySelectionText'.'SDL3.dll'.'SDL_HasPrimarySelectionText' -++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL3.dll'.'SDL_GameControllerGetSensorDataWithTimestamp' -++'_SDL_SensorGetDataWithTimestamp'.'SDL3.dll'.'SDL_SensorGetDataWithTimestamp' -++'_SDL_ResetHints'.'SDL3.dll'.'SDL_ResetHints' -++'_SDL_strcasestr'.'SDL3.dll'.'SDL_strcasestr' diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 033c4a75d..58b189842 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -24,13 +24,6 @@ #if SDL_DYNAMIC_API -#if defined(__OS2__) -#define INCL_DOS -#define INCL_DOSERRORS -#include -#include -#endif - #include "SDL.h" /* These headers have system specific definitions, so aren't included above */ @@ -356,20 +349,6 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) return retval; } -#elif defined(__OS2__) -static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) -{ - HMODULE hmodule; - PFN retval = NULL; - char error[256]; - if (DosLoadModule(error, sizeof(error), fname, &hmodule) == NO_ERROR) { - if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { - DosFreeModule(hmodule); - } - } - return (void *)retval; -} - #else #error Please define your platform. #endif diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 7b3e02da1..be2c9379b 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -50,8 +50,6 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) -#elif defined(__OS2__) -SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif @@ -749,8 +747,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return) #if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) -#elif defined(__OS2__) -SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return) #endif diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl index 6c19a8f7d..b99a8a492 100755 --- a/src/dynapi/gendynapi.pl +++ b/src/dynapi/gendynapi.pl @@ -33,7 +33,6 @@ use File::Basename; chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; -my $sdl3_exports = "src/dynapi/SDL3.exports"; my %existing = (); if (-f $sdl_dynapi_procs_h) { @@ -48,7 +47,6 @@ if (-f $sdl_dynapi_procs_h) { open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); -open(SDL3_EXPORTS, '>>', $sdl3_exports) or die("Can't open $sdl3_exports: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { @@ -135,7 +133,6 @@ while (my $d = readdir(HEADERS)) { print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; - print SDL3_EXPORTS "++'_${fn}'.'SDL3.dll'.'${fn}'\n"; } else { print("Failed to parse decl [$decl]!\n"); } @@ -146,6 +143,5 @@ closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); -close(SDL3_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 994b6a6db..27ee80393 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -31,10 +31,6 @@ #if defined(__WIN32__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif -#if defined(__OS2__) -#define INCL_WIN -#include -#endif /* #define DEBUG_MOUSE */ @@ -57,8 +53,6 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol } else { #if defined(__WIN32__) || defined(__WINGDK__) mouse->double_click_time = GetDoubleClickTime(); -#elif defined(__OS2__) - mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME); #else mouse->double_click_time = 500; #endif diff --git a/src/filesystem/os2/SDL_sysfilesystem.c b/src/filesystem/os2/SDL_sysfilesystem.c deleted file mode 100644 index 3203f0b3a..000000000 --- a/src/filesystem/os2/SDL_sysfilesystem.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_FILESYSTEM_OS2 - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent filesystem routines */ - -#include "../../core/os2/SDL_os2.h" -#include "SDL_error.h" -#include "SDL_filesystem.h" - -#define INCL_DOSFILEMGR -#define INCL_DOSPROCESS -#define INCL_DOSMODULEMGR -#define INCL_DOSERRORS -#include - - -char * -SDL_GetBasePath(void) -{ - PTIB tib; - PPIB pib; - ULONG ulRC = DosGetInfoBlocks(&tib, &pib); - PCHAR pcEnd; - CHAR acBuf[CCHMAXPATH]; - - if (ulRC != NO_ERROR) { - SDL_SetError("Can't get process information block (E%lu)", ulRC); - return NULL; - } - - ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf); - if (ulRC != NO_ERROR) { - SDL_SetError("Can't query the module name (E%lu)", ulRC); - return NULL; - } - - pcEnd = SDL_strrchr(acBuf, '\\'); - if (pcEnd != NULL) - pcEnd[1] = '\0'; - else { - if (acBuf[1] == ':') /* e.g. "C:FOO" */ - acBuf[2] = '\0'; - else { - SDL_SetError("No path in module name"); - return NULL; - } - } - - return OS2_SysToUTF8(acBuf); -} - -char * -SDL_GetPrefPath(const char *org, const char *app) -{ - PSZ pszPath; - CHAR acBuf[CCHMAXPATH]; - int lPosApp, lPosOrg; - PSZ pszApp, pszOrg; - - if (!app) { - SDL_InvalidParamError("app"); - return NULL; - } - - pszPath = SDL_getenv("HOME"); - if (!pszPath) { - pszPath = SDL_getenv("ETC"); - if (!pszPath) { - SDL_SetError("HOME or ETC environment not set"); - return NULL; - } - } - - if (!org) { - lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s", pszPath); - } else { - pszOrg = OS2_UTF8ToSys(org); - if (!pszOrg) { - SDL_OutOfMemory(); - return NULL; - } - lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg); - SDL_free(pszOrg); - } - if (lPosApp < 0) - return NULL; - - DosCreateDir(acBuf, NULL); - - pszApp = OS2_UTF8ToSys(app); - if (!pszApp) { - SDL_OutOfMemory(); - return NULL; - } - - lPosOrg = SDL_snprintf(&acBuf[lPosApp], sizeof(acBuf) - lPosApp - 1, "\\%s", pszApp); - SDL_free(pszApp); - if (lPosOrg < 0) - return NULL; - - DosCreateDir(acBuf, NULL); - *((PUSHORT)&acBuf[lPosApp + lPosOrg]) = (USHORT)'\0\\'; - - return OS2_SysToUTF8(acBuf); -} - -#endif /* SDL_FILESYSTEM_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index 9e2a43589..199870197 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -418,9 +418,6 @@ static int is_language_supported(libusb_device_handle *dev, uint16_t lang) /* This function returns a newly allocated wide string containing the USB device string numbered by the index. The returned string must be freed by using free(). */ -#if defined(__OS2__) /* don't use iconv on OS/2: no support for wchar_t. */ -#define NO_ICONV -#endif static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) { char buf[512]; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 033929694..de15d5d12 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -87,9 +87,6 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */ &SDL_BSD_JoystickDriver, #endif -#ifdef SDL_JOYSTICK_OS2 - &SDL_OS2_JoystickDriver, -#endif #ifdef SDL_JOYSTICK_PS2 &SDL_PS2_JoystickDriver, #endif diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 015007c59..ae8372ef7 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -239,7 +239,6 @@ extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; extern SDL_JoystickDriver SDL_WGI_JoystickDriver; extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver; extern SDL_JoystickDriver SDL_WINMM_JoystickDriver; -extern SDL_JoystickDriver SDL_OS2_JoystickDriver; extern SDL_JoystickDriver SDL_PS2_JoystickDriver; extern SDL_JoystickDriver SDL_PSP_JoystickDriver; extern SDL_JoystickDriver SDL_VITA_JoystickDriver; diff --git a/src/joystick/os2/SDL_os2joystick.c b/src/joystick/os2/SDL_os2joystick.c deleted file mode 100644 index bf2dc605c..000000000 --- a/src/joystick/os2/SDL_os2joystick.c +++ /dev/null @@ -1,799 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_JOYSTICK_OS2 - -/* OS/2 Joystick driver, contributed by Daniel Caetano */ - -#define INCL_DOSDEVICES -#define INCL_DOSDEVIOCTL -#define INCL_DOSMEMMGR -#include - -/***************************************************************** - * OS/2 Joystick driver defs. Based on docs at edm2.com and in old - * drivers available at hobbes.nmsu.edu and www.os2site.com - *****************************************************************/ - -#define GAME_GET_VERSION 0x01 -#define GAME_GET_PARMS 0x02 -#define GAME_GET_CALIB 0x04 -#define GAME_GET_STATUS 0x10 - -#define IOCTL_CAT_USER 0x80 -#define GAME_PORT_GET 0x20 -#define GAME_PORT_RESET 0x60 - -#pragma pack(push,1) -typedef struct { - USHORT uJs_AxCnt, uJs_AyCnt; /* A joystick X/Y pos */ - USHORT uJs_BxCnt, uJs_ByCnt; /* B joystick X/Y pos */ - USHORT usJs_ButtonA1Cnt, usJs_ButtonA2Cnt;/* A1/A2 press cnts */ - USHORT usJs_ButtonB1Cnt, usJs_ButtonB2Cnt;/* B1/B2 press cnts */ - UCHAR ucJs_JoyStickMask; /* mask of connected joystick pots */ - UCHAR ucJs_ButtonStatus; /* bits of switches down */ - ULONG ulJs_Ticks; /* total clock ticks (60 Hz) */ -} GAME_PORT_STRUCT; -#pragma pack(pop) - -typedef struct { - USHORT useA, useB; - USHORT mode; - USHORT format; - USHORT sampDiv; - USHORT scale; - USHORT res1, res2; -} GAME_PARM_STRUCT; - -typedef struct { - SHORT x, y; -} GAME_2DPOS_STRUCT; - -typedef struct { - SHORT lower, centre, upper; -} GAME_3POS_STRUCT; - -typedef struct { - GAME_3POS_STRUCT Ax, Ay, Bx, By; -} GAME_CALIB_STRUCT; - -typedef struct { - GAME_2DPOS_STRUCT A, B; - USHORT butMask; -} GAME_DATA_STRUCT; - -typedef struct { - GAME_DATA_STRUCT curdata; - USHORT b1cnt, b2cnt, b3cnt, b4cnt; -} GAME_STATUS_STRUCT; - -/*****************************************************************/ - -#include "SDL_joystick.h" -#include "SDL_events.h" -#include "../SDL_sysjoystick.h" -#include "../SDL_joystick_c.h" - -static HFILE hJoyPort = NULLHANDLE; /* Joystick GAME$ Port Address */ -#define MAX_JOYSTICKS 2 /* Maximum of two joysticks */ -#define MAX_AXES 4 /* each joystick can have up to 4 axes */ -#define MAX_BUTTONS 8 /* 8 buttons */ -#define MAX_HATS 0 /* 0 hats - OS/2 doesn't support it */ -#define MAX_BALLS 0 /* and 0 balls - OS/2 doesn't support it */ -#define MAX_JOYNAME 128 /* Joystick name may have 128 characters */ -/* Calc Button Flag for buttons A to D */ -#define JOY_BUTTON_FLAG(n) (1< MAX_JOYSTICKS) maxdevs = MAX_JOYSTICKS; - - /* Defines min/max axes values (callibration) */ - ulDataLen = sizeof(stGameCalib); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_CALIB, - NULL, 0, NULL, &stGameCalib, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(&hJoyPort); - return SDL_SetError("Could not read callibration data."); - } - - /* Determine how many joysticks are active */ - numdevs = 0; /* Points no device */ - ucNewJoystickMask = 0x0F; /* read all 4 joystick axis */ - ulDataLen = sizeof(ucNewJoystickMask); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_RESET, - &ucNewJoystickMask, ulDataLen, &ulDataLen, NULL, 0, NULL); - if (rc == 0) - { - ulDataLen = sizeof(stJoyStatus); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET, - NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(&hJoyPort); - return SDL_SetError("Could not call joystick port."); - } - ulLastTick = stJoyStatus.ulJs_Ticks; - while (stJoyStatus.ulJs_Ticks == ulLastTick) - { - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET, - NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen); - } - if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0) numdevs++; - if (((stJoyStatus.ucJs_JoyStickMask >> 2) & 0x03) > 0) numdevs++; - } - - if (numdevs > maxdevs) numdevs = maxdevs; - - /* If *any* joystick was detected... Let's configure SDL for them */ - if (numdevs > 0) - { - /* Verify if it is a "user defined" joystick */ - if (joyGetEnv(&joycfg)) - { - GAME_3POS_STRUCT * axis[4]; - axis[0] = &stGameCalib.Ax; - axis[1] = &stGameCalib.Ay; - axis[2] = &stGameCalib.Bx; - axis[3] = &stGameCalib.By; - - /* Say it has one device only (user defined is always one device only) */ - numdevs = 1; - - /* Define Device 0 as... */ - SYS_JoyData[0].id = 0; - - /* Define Number of Axes... up to 4 */ - if (joycfg.axes>MAX_AXES) joycfg.axes = MAX_AXES; - SYS_JoyData[0].axes = joycfg.axes; - - /* Define number of buttons... 8 if 2 axes, 6 if 3 axes and 4 if 4 axes */ - maxbut = MAX_BUTTONS; - if (joycfg.axes>2) maxbut -= ((joycfg.axes - 2)<<1); /* MAX_BUTTONS - 2*(axes-2) */ - if (joycfg.buttons > maxbut) joycfg.buttons = maxbut; - SYS_JoyData[0].buttons = joycfg.buttons; - - /* Define number of hats */ - if (joycfg.hats > MAX_HATS) joycfg.hats = MAX_HATS; - SYS_JoyData[0].hats = joycfg.hats; - - /* Define number of balls */ - if (joycfg.balls > MAX_BALLS) joycfg.balls = MAX_BALLS; - SYS_JoyData[0].balls = joycfg.balls; - - /* Initialize Axes Callibration Values */ - for (i=0; ilower; - SYS_JoyData[0].axes_med[i] = axis[i]->centre; - SYS_JoyData[0].axes_max[i] = axis[i]->upper; - } - /* Initialize Buttons 5 to 8 structures */ - if (joycfg.buttons>=5) SYS_JoyData[0].buttoncalc[0] = ((axis[2]->lower+axis[3]->centre)>>1); - if (joycfg.buttons>=6) SYS_JoyData[0].buttoncalc[1] = ((axis[3]->lower+axis[3]->centre)>>1); - if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2] = ((axis[2]->upper+axis[3]->centre)>>1); - if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3] = ((axis[3]->upper+axis[3]->centre)>>1); - /* Intialize Joystick Name */ - SDL_strlcpy (SYS_JoyData[0].szDeviceName,joycfg.name, SDL_arraysize(SYS_JoyData[0].szDeviceName)); - } - /* Default Init ... autoconfig */ - else - { - /* if two devices were detected... configure as Joy1 4 axis and Joy2 2 axis */ - if (numdevs == 2) - { - /* Define Device 0 as 4 axes, 4 buttons */ - SYS_JoyData[0].id=0; - SYS_JoyData[0].axes = 4; - SYS_JoyData[0].buttons = 4; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper; - SYS_JoyData[0].axes_min[2] = stGameCalib.Bx.lower; - SYS_JoyData[0].axes_med[2] = stGameCalib.Bx.centre; - SYS_JoyData[0].axes_max[2] = stGameCalib.Bx.upper; - SYS_JoyData[0].axes_min[3] = stGameCalib.By.lower; - SYS_JoyData[0].axes_med[3] = stGameCalib.By.centre; - SYS_JoyData[0].axes_max[3] = stGameCalib.By.upper; - /* Define Device 1 as 2 axes, 2 buttons */ - SYS_JoyData[1].id=1; - SYS_JoyData[1].axes = 2; - SYS_JoyData[1].buttons = 2; - SYS_JoyData[1].hats = 0; - SYS_JoyData[1].balls = 0; - SYS_JoyData[1].axes_min[0] = stGameCalib.Bx.lower; - SYS_JoyData[1].axes_med[0] = stGameCalib.Bx.centre; - SYS_JoyData[1].axes_max[0] = stGameCalib.Bx.upper; - SYS_JoyData[1].axes_min[1] = stGameCalib.By.lower; - SYS_JoyData[1].axes_med[1] = stGameCalib.By.centre; - SYS_JoyData[1].axes_max[1] = stGameCalib.By.upper; - } - /* One joystick only? */ - else - { - /* If it is joystick A... */ - if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0) - { - /* Define Device 0 as 2 axes, 4 buttons */ - SYS_JoyData[0].id=0; - SYS_JoyData[0].axes = 2; - SYS_JoyData[0].buttons = 4; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper; - } - /* If not, it is joystick B */ - else - { - /* Define Device 1 as 2 axes, 2 buttons */ - SYS_JoyData[0].id=1; - SYS_JoyData[0].axes = 2; - SYS_JoyData[0].buttons = 2; - SYS_JoyData[0].hats = 0; - SYS_JoyData[0].balls = 0; - SYS_JoyData[0].axes_min[0] = stGameCalib.Bx.lower; - SYS_JoyData[0].axes_med[0] = stGameCalib.Bx.centre; - SYS_JoyData[0].axes_max[0] = stGameCalib.Bx.upper; - SYS_JoyData[0].axes_min[1] = stGameCalib.By.lower; - SYS_JoyData[0].axes_med[1] = stGameCalib.By.centre; - SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper; - } - } - - /* Hack to define Joystick Port Names */ - if (numdevs > maxdevs) numdevs = maxdevs; - - for (i = 0; i < numdevs; i++) - { - SDL_snprintf(SYS_JoyData[i].szDeviceName, - SDL_arraysize(SYS_JoyData[i].szDeviceName), - "Default Joystick %c", 'A'+SYS_JoyData[i].id); - } - } - } - /* Return the number of devices found */ - numjoysticks = numdevs; - return numdevs; -} - -static int OS2_NumJoysticks(void) -{ - return numjoysticks; -} - -static void OS2_JoystickDetect(void) -{ -} - -static const char *OS2_JoystickGetDeviceName(int device_index) -{ - /* No need to verify if device exists, already done in upper layer */ - return SYS_JoyData[device_index].szDeviceName; -} - -static const char *OS2_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - -static int OS2_JoystickGetDevicePlayerIndex(int device_index) -{ - return -1; -} - -static void OS2_JoystickSetDevicePlayerIndex(int device_index, int player_index) -{ -} - -static SDL_JoystickGUID OS2_JoystickGetDeviceGUID(int device_index) -{ - /* the GUID is just the name for now */ - const char *name = OS2_JoystickGetDeviceName(device_index); - return SDL_CreateJoystickGUIDForName(name); -} - -static SDL_JoystickID OS2_JoystickGetDeviceInstanceID(int device_index) -{ - return device_index; -} - -/******************************************************************************/ -/* Function to open a joystick for use. */ -/* The joystick to open is specified by the device index. */ -/* This should fill the nbuttons and naxes fields of the joystick structure. */ -/* It returns 0, or -1 if there is an error. */ -/******************************************************************************/ -static int OS2_JoystickOpen(SDL_Joystick *joystick, int device_index) -{ - int index; /* Index shortcut for index in joystick structure */ - int i; /* Generic Counter */ - - /* allocate memory for system specific hardware data */ - joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata)); - if (!joystick->hwdata) - { - return SDL_OutOfMemory(); - } - - /* ShortCut Pointer */ - index = device_index; - joystick->instance_id = device_index; - - /* Define offsets and scales for all axes */ - joystick->hwdata->id = SYS_JoyData[index].id; - for (i = 0; i < MAX_AXES; ++i) - { - if ((i < 2) || i < SYS_JoyData[index].axes) - { - joystick->hwdata->transaxes[i].offset = ((SDL_JOYSTICK_AXIS_MAX + SDL_JOYSTICK_AXIS_MIN)>>1) - SYS_JoyData[index].axes_med[i]; - joystick->hwdata->transaxes[i].scale1 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MIN/SYS_JoyData[index].axes_min[i])); - joystick->hwdata->transaxes[i].scale2 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MAX/SYS_JoyData[index].axes_max[i])); - } - else - { - joystick->hwdata->transaxes[i].offset = 0; - joystick->hwdata->transaxes[i].scale1 = 1.0f; /* Just in case */ - joystick->hwdata->transaxes[i].scale2 = 1.0f; /* Just in case */ - } - } - - /* fill nbuttons, naxes, and nhats fields */ - joystick->nbuttons = SYS_JoyData[index].buttons; - joystick->naxes = SYS_JoyData[index].axes; - - /* joystick->nhats = SYS_JoyData[index].hats; */ - joystick->nhats = 0; /* No support for hats at this time */ - - /* joystick->nballs = SYS_JoyData[index].balls; */ - joystick->nballs = 0; /* No support for balls at this time */ - - return 0; -} - -static int OS2_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) -{ - return SDL_Unsupported(); -} - -static Uint32 OS2_JoystickGetCapabilities(SDL_Joystick *joystick) -{ - return 0; -} - -static int OS2_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) -{ - return SDL_Unsupported(); -} - -static int OS2_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) -{ - return SDL_Unsupported(); -} - -/***************************************************************************/ -/* Function to update the state of a joystick - called as a device poll. */ -/* This function shouldn't update the joystick structure directly, */ -/* but instead should call SDL_PrivateJoystick*() to deliver events */ -/* and update joystick device state. */ -/***************************************************************************/ -static void OS2_JoystickUpdate(SDL_Joystick *joystick) -{ - APIRET rc; /* Generic OS/2 return code */ - int index; /* index shortcurt to joystick index */ - int i; /* Generic counter */ - int normbut; /* Number of buttons reported by joystick */ - int corr; /* Correction for button names */ - Sint16 value; /* Values used to update axis values */ - struct _transaxes *transaxes; /* Shortcut for Correction structure */ - Uint32 pos[MAX_AXES]; /* Vector to inform the Axis status */ - ULONG ulDataLen; /* Size of data */ - GAME_STATUS_STRUCT stGameStatus; /* Joystick Status Structure */ - - ulDataLen = sizeof(stGameStatus); - rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_STATUS, - NULL, 0, NULL, &stGameStatus, ulDataLen, &ulDataLen); - if (rc != 0) - { - SDL_SetError("Could not read joystick status."); - return; /* Could not read data */ - } - - /* Shortcut pointer */ - index = joystick->instance_id; - - /* joystick motion events */ - - if (SYS_JoyData[index].id == 0) - { - pos[0] = stGameStatus.curdata.A.x; - pos[1] = stGameStatus.curdata.A.y; - if (SYS_JoyData[index].axes >= 3) pos[2] = stGameStatus.curdata.B.x; - else pos[2] = 0; - if (SYS_JoyData[index].axes >= 4) pos[3] = stGameStatus.curdata.B.y; - else pos[3] = 0; - /* OS/2 basic drivers do not support more than 4 axes joysticks */ - } - else if (SYS_JoyData[index].id == 1) - { - pos[0] = stGameStatus.curdata.B.x; - pos[1] = stGameStatus.curdata.B.y; - pos[2] = 0; - pos[3] = 0; - } - - /* Corrects the movements using the callibration */ - transaxes = joystick->hwdata->transaxes; - for (i = 0; i < joystick->naxes; i++) - { - value = pos[i] + transaxes[i].offset; - if (value < 0) - { - value *= transaxes[i].scale1; - if (value > 0) value = SDL_JOYSTICK_AXIS_MIN; - } - else - { - value *= transaxes[i].scale2; - if (value < 0) value = SDL_JOYSTICK_AXIS_MAX; - } - SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)value); - } - - /* joystick button A to D events */ - if (SYS_JoyData[index].id == 1) corr = 2; - else corr = 0; - normbut = 4; /* Number of normal buttons */ - if (joystick->nbuttons < normbut) normbut = joystick->nbuttons; - for (i = corr; (i-corr) < normbut; ++i) - { - /* - Button A: 1110 0000 - Button B: 1101 0000 - Button C: 1011 0000 - Button D: 0111 0000 - */ - if ((~stGameStatus.curdata.butMask)>>4 & JOY_BUTTON_FLAG(i)) - { - SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_PRESSED); - } - else - { - SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_RELEASED); - } - } - - /* Joystick button E to H buttons */ - /* - Button E: Axis 2 X Left - Button F: Axis 2 Y Up - Button G: Axis 2 X Right - Button H: Axis 2 Y Down - */ - if (joystick->nbuttons >= 5) - { - if (stGameStatus.curdata.B.x < SYS_JoyData[index].buttoncalc[0]) SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_RELEASED); - } - if (joystick->nbuttons >= 6) - { - if (stGameStatus.curdata.B.y < SYS_JoyData[index].buttoncalc[1]) SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_RELEASED); - } - if (joystick->nbuttons >= 7) - { - if (stGameStatus.curdata.B.x > SYS_JoyData[index].buttoncalc[2]) SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_RELEASED); - } - if (joystick->nbuttons >= 8) - { - if (stGameStatus.curdata.B.y > SYS_JoyData[index].buttoncalc[3]) SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_PRESSED); - else SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_RELEASED); - } - - /* joystick hat events */ - /* Not Supported under OS/2 */ - /* joystick ball events */ - /* Not Supported under OS/2 */ -} - -/******************************************/ -/* Function to close a joystick after use */ -/******************************************/ -static void OS2_JoystickClose(SDL_Joystick *joystick) -{ - /* free system specific hardware data */ - SDL_free(joystick->hwdata); -} - -/********************************************************************/ -/* Function to perform any system-specific joystick related cleanup */ -/********************************************************************/ -static void OS2_JoystickQuit(void) -{ - joyPortClose(&hJoyPort); -} - -static SDL_bool OS2_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) -{ - return SDL_FALSE; -} - - -/************************/ -/* OS/2 Implementations */ -/************************/ - -/*****************************************/ -/* Open Joystick Port, if not opened yet */ -/*****************************************/ -static int joyPortOpen(HFILE * hGame) -{ - APIRET rc; /* Generic Return Code */ - ULONG ulAction; /* ? */ - ULONG ulVersion; /* Version of joystick driver */ - ULONG ulDataLen; /* Size of version data */ - - /* Verifies if joyport is not already open... */ - if (*hGame != NULLHANDLE) return 0; - - /* Open GAME$ for read */ - rc = DosOpen("GAME$ ", hGame, &ulAction, 0, FILE_READONLY, - FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL); - if (rc != 0) - { - return SDL_SetError("Could not open Joystick Port."); - } - - /* Get Joystick Driver Version... must be 2.0 or higher */ - ulVersion = 0; - ulDataLen = sizeof(ulVersion); - rc = DosDevIOCtl(*hGame, IOCTL_CAT_USER, GAME_GET_VERSION, - NULL, 0, NULL, &ulVersion, ulDataLen, &ulDataLen); - if (rc != 0) - { - joyPortClose(hGame); - return SDL_SetError("Could not get Joystick Driver version."); - } - if (ulVersion < 0x20) - { - joyPortClose(hGame); - return SDL_SetError("Driver too old. At least IBM driver version 2.0 required."); - } - return 0; -} - -/****************************/ -/* Close JoyPort, if opened */ -/****************************/ -static void joyPortClose(HFILE * hGame) -{ - if (*hGame != NULLHANDLE) DosClose(*hGame); - *hGame = NULLHANDLE; -} - -/***************************/ -/* Get SDL Joystick EnvVar */ -/***************************/ -static int joyGetEnv(struct _joycfg * joydata) -{ - const char *joyenv; /* Pointer to tested character */ - char tempnumber[5]; /* Temporary place to put numeric texts */ - - joyenv = SDL_getenv("SDL_OS2_JOYSTICK"); - if (joyenv == NULL) return 0; - - /* Joystick Environment is defined! */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - - /* If the string name starts with '... get if fully */ - if (*joyenv == '\'') { - joyenv++; - joyenv += joyGetData(joyenv,joydata->name,'\'',sizeof(joydata->name)); - } - /* If not, get it until the next space */ - else if (*joyenv == '\"') { - joyenv++; - joyenv += joyGetData(joyenv,joydata->name,'\"',sizeof(joydata->name)); - } - else { - joyenv += joyGetData(joyenv,joydata->name, ' ',sizeof(joydata->name)); - } - - /* Now get the number of axes */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->axes = SDL_atoi(tempnumber); - - /* Now get the number of buttons */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->buttons = SDL_atoi(tempnumber); - - /* Now get the number of hats */ - while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->hats = SDL_atoi(tempnumber); - - /* Now get the number of balls */ - while (*joyenv==' ' && *joyenv != 0) joyenv++; /* jump spaces... */ - joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber)); - joydata->balls = SDL_atoi(tempnumber); - return 1; -} - -/************************************************************************/ -/* Get a text from in the string starting in joyenv until it finds */ -/* the stopchar or maxchars is reached. The result is placed in name. */ -/************************************************************************/ -static int joyGetData(const char *joyenv, char *name, char stopchar, size_t maxchars) -{ - char *nameptr; /* Pointer to the selected character */ - int chcnt = 0; /* Count how many characters where copied */ - - nameptr = name; - while (*joyenv!=stopchar && *joyenv!=0) - { - if (nameptr < (name + (maxchars-1))) - { - *nameptr = *joyenv; /* Only copy if smaller than maximum */ - nameptr++; - } - chcnt++; - joyenv++; - } - if (*joyenv == stopchar) - { - joyenv++; /* Jump stopchar */ - chcnt++; - } - *nameptr = 0; /* Mark last byte */ - return chcnt; -} - -SDL_JoystickDriver SDL_OS2_JoystickDriver = -{ - OS2_JoystickInit, - OS2_NumJoysticks, - OS2_JoystickDetect, - OS2_JoystickGetDeviceName, - OS2_JoystickGetDevicePath, - OS2_JoystickGetDevicePlayerIndex, - OS2_JoystickSetDevicePlayerIndex, - OS2_JoystickGetDeviceGUID, - OS2_JoystickGetDeviceInstanceID, - OS2_JoystickOpen, - OS2_JoystickRumble, - OS2_JoystickRumbleTriggers, - OS2_JoystickGetCapabilities, - OS2_JoystickSetLED, - OS2_JoystickSendEffect, - OS2_JoystickSetSensorsEnabled, - OS2_JoystickUpdate, - OS2_JoystickClose, - OS2_JoystickQuit, - OS2_JoystickGetGamepadMapping -}; - -#endif /* SDL_JOYSTICK_OS2 */ diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c deleted file mode 100644 index 292196ecb..000000000 --- a/src/loadso/os2/SDL_sysloadso.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_LOADSO_OS2 - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent library loading routines */ - -#include "SDL_loadso.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSMODULEMGR -#define INCL_DOSERRORS -#include - -void * -SDL_LoadObject(const char *sofile) -{ - ULONG ulRC; - HMODULE hModule; - CHAR acError[256]; - PSZ pszModName; - - if (!sofile) { - SDL_InvalidParamError("sofile"); - return NULL; - } - - pszModName = OS2_UTF8ToSys(sofile); - ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); - - if (ulRC != NO_ERROR && !SDL_strrchr(pszModName, '\\') && !SDL_strrchr(pszModName, '/')) { - /* strip .dll extension and retry only if name has no path. */ - size_t len = SDL_strlen(pszModName); - if (len > 4 && SDL_strcasecmp(&pszModName[len - 4], ".dll") == 0) { - pszModName[len - 4] = '\0'; - ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); - } - } - if (ulRC != NO_ERROR) { - SDL_SetError("Failed loading %s: %s (E%u)", sofile, acError, ulRC); - hModule = NULLHANDLE; - } - SDL_free(pszModName); - - return (void *)hModule; -} - -void * -SDL_LoadFunction(void *handle, const char *name) -{ - ULONG ulRC; - PFN pFN; - - ulRC = DosQueryProcAddr((HMODULE)handle, 0, name, &pFN); - if (ulRC != NO_ERROR) { - /* retry with an underscore prepended, e.g. for gcc-built dlls. */ - SDL_bool isstack; - size_t len = SDL_strlen(name) + 1; - char *_name = SDL_small_alloc(char, len + 1, &isstack); - _name[0] = '_'; - SDL_memcpy(&_name[1], name, len); - ulRC = DosQueryProcAddr((HMODULE)handle, 0, _name, &pFN); - SDL_small_free(_name, isstack); - } - if (ulRC != NO_ERROR) { - SDL_SetError("Failed loading procedure %s (E%u)", name, ulRC); - return NULL; - } - - return (void *)pFN; -} - -void -SDL_UnloadObject(void *handle) -{ - if (handle != NULL) { - DosFreeModule((HMODULE)handle); - } -} - -#endif /* SDL_LOADSO_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index f3348eaa9..faa66d715 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -42,8 +42,6 @@ #include "n3ds/SDL_systhread_c.h" #elif SDL_THREAD_STDCPP #include "stdcpp/SDL_systhread_c.h" -#elif SDL_THREAD_OS2 -#include "os2/SDL_systhread_c.h" #elif SDL_THREAD_NGAGE #include "ngage/SDL_systhread_c.h" #else diff --git a/src/thread/os2/SDL_sysmutex.c b/src/thread/os2/SDL_sysmutex.c deleted file mode 100644 index d3fc7a3bd..000000000 --- a/src/thread/os2/SDL_sysmutex.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* An implementation of mutexes for OS/2 */ - -#include "SDL_thread.h" -#include "SDL_systhread_c.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#include - -struct SDL_mutex { - HMTX _handle; -}; - -/* Create a mutex */ -SDL_mutex * -SDL_CreateMutex(void) -{ - ULONG ulRC; - HMTX hMtx; - - ulRC = DosCreateMutexSem(NULL, &hMtx, 0, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateMutexSem(), rc = %u", ulRC); - return NULL; - } - - return (SDL_mutex *)hMtx; -} - -/* Free the mutex */ -void -SDL_DestroyMutex(SDL_mutex * mutex) -{ - HMTX hMtx = (HMTX)mutex; - if (hMtx != NULLHANDLE) { - const ULONG ulRC = DosCloseMutexSem(hMtx); - if (ulRC != NO_ERROR) { - debug_os2("DosCloseMutexSem(), rc = %u", ulRC); - } - } -} - -/* Lock the mutex */ -int -SDL_LockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosRequestMutexSem(hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) { - debug_os2("DosRequestMutexSem(), rc = %u", ulRC); - return -1; - } - - return 0; -} - -/* try Lock the mutex */ -int -SDL_TryLockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosRequestMutexSem(hMtx, SEM_IMMEDIATE_RETURN); - - if (ulRC == ERROR_TIMEOUT) - return SDL_MUTEX_TIMEDOUT; - - if (ulRC != NO_ERROR) { - debug_os2("DosRequestMutexSem(), rc = %u", ulRC); - return -1; - } - - return 0; -} - -/* Unlock the mutex */ -int -SDL_UnlockMutex(SDL_mutex * mutex) -{ - ULONG ulRC; - HMTX hMtx = (HMTX)mutex; - - if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); - - ulRC = DosReleaseMutexSem(hMtx); - if (ulRC != NO_ERROR) - return SDL_SetError("DosReleaseMutexSem(), rc = %u", ulRC); - - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_syssem.c b/src/thread/os2/SDL_syssem.c deleted file mode 100644 index 79bf0673f..000000000 --- a/src/thread/os2/SDL_syssem.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* An implementation of semaphores for OS/2 */ - -#include "SDL_thread.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#define INCL_DOSMISC -#include - -struct SDL_semaphore { - HEV hEv; - HMTX hMtx; - ULONG cPost; -}; - - -SDL_sem * -SDL_CreateSemaphore(Uint32 initial_value) -{ - ULONG ulRC; - SDL_sem *pSDLSem = SDL_malloc(sizeof(SDL_sem)); - - if (pSDLSem == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - ulRC = DosCreateEventSem(NULL, &pSDLSem->hEv, DCE_AUTORESET, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateEventSem(), rc = %u", ulRC); - SDL_free(pSDLSem); - return NULL; - } - - ulRC = DosCreateMutexSem(NULL, &pSDLSem->hMtx, 0, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosCreateMutexSem(), rc = %u", ulRC); - DosCloseEventSem(pSDLSem->hEv); - SDL_free(pSDLSem); - return NULL; - } - - pSDLSem->cPost = initial_value; - - return pSDLSem; -} - -void -SDL_DestroySemaphore(SDL_sem * sem) -{ - if (!sem) return; - - DosCloseMutexSem(sem->hMtx); - DosCloseEventSem(sem->hEv); - SDL_free(sem); -} - -int -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) -{ - ULONG ulRC; - ULONG ulStartTime, ulCurTime; - ULONG ulTimeout; - ULONG cPost; - - if (sem == NULL) - return SDL_InvalidParamError("sem"); - - if (timeout != SEM_INDEFINITE_WAIT) - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStartTime, sizeof(ULONG)); - - while (TRUE) { - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - cPost = sem->cPost; - if (sem->cPost != 0) - sem->cPost--; - - DosReleaseMutexSem(sem->hMtx); - - if (cPost != 0) - break; - - if (timeout == SEM_INDEFINITE_WAIT) - ulTimeout = SEM_INDEFINITE_WAIT; - else { - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulCurTime, sizeof(ULONG)); - ulTimeout = ulCurTime - ulStartTime; - if (timeout < ulTimeout) - return SDL_MUTEX_TIMEDOUT; - ulTimeout = timeout - ulTimeout; - } - - ulRC = DosWaitEventSem(sem->hEv, ulTimeout); - if (ulRC == ERROR_TIMEOUT) - return SDL_MUTEX_TIMEDOUT; - - if (ulRC != NO_ERROR) - return SDL_SetError("DosWaitEventSem() failed, rc = %u", ulRC); - } - - return 0; -} - -int -SDL_SemTryWait(SDL_sem * sem) -{ - return SDL_SemWaitTimeout(sem, 0); -} - -int -SDL_SemWait(SDL_sem * sem) -{ - return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); -} - -Uint32 -SDL_SemValue(SDL_sem * sem) -{ - ULONG ulRC; - - if (sem == NULL) { - SDL_InvalidParamError("sem"); - return 0; - } - - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - ulRC = sem->cPost; - DosReleaseMutexSem(sem->hMtx); - - return ulRC; -} - -int -SDL_SemPost(SDL_sem * sem) -{ - ULONG ulRC; - - if (sem == NULL) - return SDL_InvalidParamError("sem"); - - ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); - if (ulRC != NO_ERROR) - return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC); - - sem->cPost++; - - ulRC = DosPostEventSem(sem->hEv); - if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) { - debug_os2("DosPostEventSem() failed, rc = %u", ulRC); - } - - DosReleaseMutexSem(sem->hMtx); - - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c deleted file mode 100644 index 8c64e9c32..000000000 --- a/src/thread/os2/SDL_systhread.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -/* Thread management routines for SDL */ - -#include "SDL_thread.h" -#include "../SDL_systhread.h" -#include "../SDL_thread_c.h" -#include "../SDL_systhread.h" -#include "SDL_systls_c.h" -#include "../../core/os2/SDL_os2.h" -#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD -#error This source only adjusted for SDL_PASSED_BEGINTHREAD_ENDTHREAD -#endif - -#define INCL_DOSPROCESS -#define INCL_DOSERRORS -#include -#include - - -static void RunThread(void *data) -{ - SDL_Thread *thread = (SDL_Thread *) data; - pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc; - - if (ppSDLTLSData != NULL) - *ppSDLTLSData = NULL; - - SDL_RunThread(thread); - - if (pfnEndThread != NULL) - pfnEndThread(); -} - -int -SDL_SYS_CreateThread(SDL_Thread * thread, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread) -{ - if (thread->stacksize == 0) - thread->stacksize = 65536; - - if (pfnBeginThread) { - /* Save the function which we will have to call to clear the RTL of calling app! */ - thread->endfunc = pfnEndThread; - /* Start the thread using the runtime library of calling app! */ - thread->handle = (SYS_ThreadHandle) - pfnBeginThread(RunThread, NULL, thread->stacksize, thread); - } else { - thread->endfunc = _endthread; - thread->handle = (SYS_ThreadHandle) - _beginthread(RunThread, NULL, thread->stacksize, thread); - } - - if (thread->handle == -1) - return SDL_SetError("Not enough resources to create thread"); - - return 0; -} - -void -SDL_SYS_SetupThread(const char *name) -{ - /* nothing. */ -} - -SDL_threadID -SDL_ThreadID(void) -{ - PTIB tib; - PPIB pib; - - DosGetInfoBlocks(&tib, &pib); - return tib->tib_ptib2->tib2_ultid; -} - -int -SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) -{ - ULONG ulRC; - - ulRC = DosSetPriority(PRTYS_THREAD, - (priority < SDL_THREAD_PRIORITY_NORMAL)? PRTYC_IDLETIME : - (priority > SDL_THREAD_PRIORITY_NORMAL)? PRTYC_TIMECRITICAL : - PRTYC_REGULAR, - 0, 0); - if (ulRC != NO_ERROR) - return SDL_SetError("DosSetPriority() failed, rc = %u", ulRC); - - return 0; -} - -void -SDL_SYS_WaitThread(SDL_Thread * thread) -{ - ULONG ulRC = DosWaitThread((PTID)&thread->handle, DCWW_WAIT); - - if (ulRC != NO_ERROR) { - debug_os2("DosWaitThread() failed, rc = %u", ulRC); - } -} - -void -SDL_SYS_DetachThread(SDL_Thread * thread) -{ - /* nothing. */ -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systhread_c.h b/src/thread/os2/SDL_systhread_c.h deleted file mode 100644 index dedceb396..000000000 --- a/src/thread/os2/SDL_systhread_c.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -typedef int SYS_ThreadHandle; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systls.c b/src/thread/os2/SDL_systls.c deleted file mode 100644 index b48a4bd39..000000000 --- a/src/thread/os2/SDL_systls.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -#include "../../core/os2/SDL_os2.h" - -#include "SDL_thread.h" -#include "../SDL_thread_c.h" - -#define INCL_DOSPROCESS -#define INCL_DOSERRORS -#include - -SDL_TLSData **ppSDLTLSData = NULL; - -static ULONG cTLSAlloc = 0; - -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void) -{ - ULONG ulRC; - - if (cTLSAlloc == 0 || ppSDLTLSData == NULL) { - /* First call - allocate the thread local memory (1 DWORD) */ - ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC); - } - } - cTLSAlloc++; -} - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void) -{ - ULONG ulRC; - - if (cTLSAlloc != 0) - cTLSAlloc--; - - if (cTLSAlloc == 0 && ppSDLTLSData != NULL) { - /* Last call - free the thread local memory */ - ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC); - } else { - ppSDLTLSData = NULL; - } - } -} - -SDL_TLSData *SDL_SYS_GetTLSData(void) -{ - return (ppSDLTLSData == NULL)? NULL : *ppSDLTLSData; -} - -int SDL_SYS_SetTLSData(SDL_TLSData *data) -{ - if (!ppSDLTLSData) - return -1; - - *ppSDLTLSData = data; - return 0; -} - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/os2/SDL_systls_c.h b/src/thread/os2/SDL_systls_c.h deleted file mode 100644 index e40d5ddcf..000000000 --- a/src/thread/os2/SDL_systls_c.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_THREAD_OS2 - -#include "../SDL_thread_c.h" - -extern SDL_TLSData **ppSDLTLSData; - -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void); - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void); - -#endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index 8f44e473c..3701cf01f 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -45,23 +45,6 @@ typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned, unsigned *threadID); typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); -#elif defined(__WATCOMC__) -/* This is for Watcom targets except OS2 */ -#if __WATCOMC__ < 1240 -#define __watcall -#endif -typedef unsigned long (__watcall * pfnSDL_CurrentBeginThread) (void *, - unsigned, - unsigned - (__stdcall * - func) (void - *), - void *arg, - unsigned, - unsigned - *threadID); -typedef void (__watcall * pfnSDL_CurrentEndThread) (unsigned code); - #else typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall * diff --git a/src/timer/os2/SDL_systimer.c b/src/timer/os2/SDL_systimer.c deleted file mode 100644 index 8a8425d29..000000000 --- a/src/timer/os2/SDL_systimer.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_TIMER_OS2 - -#include "SDL_timer.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOSERRORS -#define INCL_DOSMISC -#define INCL_DOSPROFILE -#define INCL_DOSSEMAPHORES -#define INCL_DOSDATETIME -#define INCL_DOSPROCESS -#define INCL_DOSEXCEPTIONS -#include - -/* No need to switch priorities in SDL_Delay() for OS/2 versions > Warp3 fp 42, */ -/*#define _SWITCH_PRIORITY*/ - -typedef unsigned long long ULLONG; - -static SDL_bool ticks_started = SDL_FALSE; -static ULONG ulTmrFreq = 0; -static ULLONG ullTmrStart = 0; - -void -SDL_TicksInit(void) -{ - ULONG ulTmrStart; /* for 32-bit fallback. */ - ULONG ulRC; - - if (ticks_started) { - return; - } - ticks_started = SDL_TRUE; - - ulRC = DosTmrQueryFreq(&ulTmrFreq); - if (ulRC != NO_ERROR) { - debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC); - } else { - ulRC = DosTmrQueryTime((PQWORD)&ullTmrStart); - if (ulRC == NO_ERROR) { - return; - } - debug_os2("DosTmrQueryTime() failed, rc = %u", ulRC); - } - - ulTmrFreq = 0; /* Error - use DosQuerySysInfo() for timer. */ - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrStart, sizeof (ULONG)); - ullTmrStart = (ULLONG) ulTmrStart; -} - -void -SDL_TicksQuit(void) -{ - ticks_started = SDL_FALSE; -} - -Uint64 -SDL_GetTicks64(void) -{ - Uint64 ui64Result; - ULLONG ullTmrNow; - - if (!ticks_started) { - SDL_TicksInit(); - } - - if (ulTmrFreq != 0) { - DosTmrQueryTime((PQWORD)&ullTmrNow); - ui64Result = (ullTmrNow - ullTmrStart) * 1000 / ulTmrFreq; - } else { - /* note that this counter rolls over to 0 every ~49 days. Fix your system so DosTmrQueryTime works if you need to avoid this. */ - ULONG ulTmrNow; - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrNow, sizeof (ULONG)); - ui64Result = (((Uint64) ulTmrNow) - ullTmrStart); - } - - return ui64Result; -} - -Uint64 -SDL_GetPerformanceCounter(void) -{ - QWORD qwTmrNow; - - if (ulTmrFreq == 0 || (DosTmrQueryTime(&qwTmrNow) != NO_ERROR)) { - return SDL_GetTicks64(); - } - return *((Uint64 *)&qwTmrNow); -} - -Uint64 -SDL_GetPerformanceFrequency(void) -{ - return (ulTmrFreq == 0)? 1000 : (Uint64)ulTmrFreq; -} - -void -SDL_Delay(Uint32 ms) -{ - HTIMER hTimer = NULLHANDLE; - ULONG ulRC; -#ifdef _SWITCH_PRIORITY - PPIB pib; - PTIB tib; - BOOL fSetPriority = ms < 50; - ULONG ulSavePriority; - ULONG ulNesting; -#endif - HEV hevTimer; - - if (ms == 0) { - DosSleep(0); - return; - } - - ulRC = DosCreateEventSem(NULL, &hevTimer, DC_SEM_SHARED, FALSE); - if (ulRC != NO_ERROR) { - debug_os2("DosAsyncTimer() failed, rc = %u", ulRC); - DosSleep(ms); - return; - } - -#ifdef _SWITCH_PRIORITY - if (fSetPriority) { - if (DosGetInfoBlocks(&tib, &pib) != NO_ERROR) - fSetPriority = FALSE; - else { - ulSavePriority = tib->tib_ptib2->tib2_ulpri; - if (((ulSavePriority & 0xFF00) == 0x0300) || /* already have high pr. */ - (DosEnterMustComplete( &ulNesting) != NO_ERROR)) - fSetPriority = FALSE; - else { - DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0); - } - } - } -#endif - - DosResetEventSem(hevTimer, &ulRC); - ulRC = DosAsyncTimer(ms, (HSEM)hevTimer, &hTimer); - -#ifdef _SWITCH_PRIORITY - if (fSetPriority) { - if (DosSetPriority(PRTYS_THREAD, (ulSavePriority >> 8) & 0xFF, 0, 0) == NO_ERROR) - DosSetPriority(PRTYS_THREAD, 0, ulSavePriority & 0xFF, 0); - DosExitMustComplete(&ulNesting); - } -#endif - - if (ulRC != NO_ERROR) { - debug_os2("DosAsyncTimer() failed, rc = %u", ulRC); - } else { - DosWaitEventSem(hevTimer, SEM_INDEFINITE_WAIT); - } - - if (ulRC != NO_ERROR) - DosSleep(ms); - - DosCloseEventSem(hevTimer); -} - -#endif /* SDL_TIMER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 4bc1f111f..8f2a9308a 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -474,8 +474,6 @@ extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; extern VideoBootStrap NGAGE_bootstrap; -extern VideoBootStrap OS2DIVE_bootstrap; -extern VideoBootStrap OS2VMAN_bootstrap; /* Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work */ extern SDL_bool SDL_OnVideoThread(void); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 064276cb1..019aa78ae 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -131,10 +131,6 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_NGAGE &NGAGE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OS2 - &OS2DIVE_bootstrap, - &OS2VMAN_bootstrap, -#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #if SDL_INPUT_LINUXEV @@ -4456,9 +4452,6 @@ SDL_GetMessageBoxCount(void) #if SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_OS2 -#include "os2/SDL_os2messagebox.h" -#endif #if SDL_VIDEO_DRIVER_RISCOS #include "riscos/SDL_riscosmessagebox.h" #endif @@ -4466,7 +4459,7 @@ SDL_GetMessageBoxCount(void) #include "vita/SDL_vitamessagebox.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 || SDL_VIDEO_DRIVER_RISCOS +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_RISCOS static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; @@ -4581,13 +4574,6 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) retval = 0; } #endif -#if SDL_VIDEO_DRIVER_OS2 - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) && - OS2_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif #if SDL_VIDEO_DRIVER_RISCOS if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) && diff --git a/src/video/os2/SDL_gradd.h b/src/video/os2/SDL_gradd.h deleted file mode 100644 index a1369a260..000000000 --- a/src/video/os2/SDL_gradd.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -gradd.h structures and constants -- only the ones used by SDL_os2vman.c. - -Based on public knowledge from around the internet including pages from -http://www.osfree.org and http://www.edm2.com -*/ - -#ifndef SDL_gradd_h_ -#define SDL_gradd_h_ - -typedef struct _INITPROCOUT { - ULONG ulLength; /* Length of the INITPROCOUT data structure, in bytes. */ - ULONG ulVRAMVirt; /* 32-bit virtual address of VRAM. */ -} INITPROCOUT; -typedef INITPROCOUT *PINITPROCOUT; - -#define RC_SUCCESS 0 - -typedef ULONG GID; -typedef ULONG (_System FNVMIENTRY) ( - GID gid, ULONG ulFunction, - PVOID pIn, - PVOID pOut /* PINITPROCOUT */ -); - -#define VMI_CMD_INITPROC 1 -#define VMI_CMD_TERMPROC 3 -#define VMI_CMD_QUERYMODES 5 -#define VMI_CMD_SETMODE 6 -#define VMI_CMD_PALETTE 7 -#define VMI_CMD_BITBLT 8 -#define VMI_CMD_LINE 9 -#define VMI_CMD_REQUESTHW 14 -#define VMI_CMD_QUERYCURRENTMODE 0x1001 - -#define QUERYMODE_NUM_MODES 0x01 -#define QUERYMODE_MODE_DATA 0x02 - -typedef struct _HWPALETTEINFO { - ULONG ulLength; /* Size of the HWPALETTEINFO data structure, in bytes. */ - ULONG fFlags; /* Palette flag. */ - ULONG ulStartIndex; /* Starting palette index. */ - ULONG ulNumEntries; /* Number of palette slots to query or set. */ - PRGB2 pRGBs; /* Pointer to the array of RGB values. */ -} HWPALETTEINFO; -typedef HWPALETTEINFO *PHWPALETTEINFO; - -#define PALETTE_GET 0x01 -#define PALETTE_SET 0x02 - -typedef struct _BMAPINFO { - ULONG ulLength; /* Length of the BMAPINFO data structure, in bytes. */ - ULONG ulType; /* Description of the Blt. */ - ULONG ulWidth; /* Width in pels of the bit map. */ - ULONG ulHeight; /* Height in pels of the bit map. */ - ULONG ulBpp; /* Number of bits per pel/color depth. */ - ULONG ulBytesPerLine; /* Number of aligned bytes per line. */ - PBYTE pBits; /* Pointer to bit-map bits. */ -} BMAPINFO; -typedef BMAPINFO *PBMAPINFO; - -#define BMAP_VRAM 0 -#define BMAP_MEMORY 1 - -typedef struct _LINEPACK { - ULONG ulStyleStep; /* Value to be added to ulStyleValue. */ - ULONG ulStyleValue; /* Style value at the current pel. */ - ULONG ulFlags; /* Flags used for the LINEPACK data structure. */ - struct _LINEPACK *plpkNext; /* Pointer to next LINEPACK data structure. */ - ULONG ulAbsDeltaX; /* Clipped Bresenham Delta X, absolute. */ - ULONG ulAbsDeltaY; /* Clipped Bresenham Delta Y, absolute. */ - POINTL ptlClipStart; /* Pointer to location for device to perform Bresenham algorithm. */ - POINTL ptlClipEnd; /* Ending location for Bresenham algorithm (see ptlClipStart). */ - POINTL ptlStart; /* Pointer to starting location for line. */ - POINTL ptlEnd; /* Ending location for line. */ - LONG lClipStartError;/* Standard Bresenham error at the clipped start point. */ -} LINEPACK; -typedef LINEPACK *PLINEPACK; - -typedef struct _LINEINFO { - ULONG ulLength; /* Length of LINEINFO data structure. */ - ULONG ulType; /* Defines line type. */ - ULONG ulStyleMask; /* A 32-bit style mask. */ - ULONG cLines; /* Count of lines to be drawn. */ - ULONG ulFGColor; /* Line Foreground color. */ - ULONG ulBGColor; /* Line Background color. */ - USHORT usForeROP; /* Line Foreground mix. */ - USHORT usBackROP; /* Line Background mix. */ - PBMAPINFO pDstBmapInfo; /* Pointer to destination surface bit map. */ - PLINEPACK alpkLinePack; /* Pointer to LINEPACK data structure. */ - PRECTL prclBounds; /* Pointer to bounding rect of a clipped line. */ -} LINEINFO; -typedef LINEINFO *PLINEINFO; - -#define LINE_DO_FIRST_PEL 0x02 -#define LINE_DIR_Y_POSITIVE 0x04 -#define LINE_HORIZONTAL 0x08 -#define LINE_DIR_X_POSITIVE 0x20 -#define LINE_VERTICAL 0x1000 -#define LINE_DO_LAST_PEL 0x4000 -#define LINE_SOLID 0x01 - -typedef struct _BLTRECT { - ULONG ulXOrg; /* X origin of the destination Blt. */ - ULONG ulYOrg; /* Y origin of the destination Blt. */ - ULONG ulXExt; /* X extent of the BitBlt. */ - ULONG ulYExt; /* Y extent of the BitBlt. */ -} BLTRECT; -typedef BLTRECT *PBLTRECT; - -typedef struct _BITBLTINFO { - ULONG ulLength; /* Length of the BITBLTINFO data structure, in bytes. */ - ULONG ulBltFlags; /* Flags for rendering of rasterized data. */ - ULONG cBlits; /* Count of Blts to be performed. */ - ULONG ulROP; /* Raster operation. */ - ULONG ulMonoBackROP; /* Background mix if B_APPLY_BACK_ROP is set. */ - ULONG ulSrcFGColor; /* Monochrome source Foreground color. */ - ULONG ulSrcBGColor; /* Monochrome source Background color and transparent color. */ - ULONG ulPatFGColor; /* Monochrome pattern Foreground color. */ - ULONG ulPatBGColor; /* Monochrome pattern Background color. */ - PBYTE abColors; /* Pointer to color translation table. */ - PBMAPINFO pSrcBmapInfo; /* Pointer to source bit map (BMAPINFO) */ - PBMAPINFO pDstBmapInfo; /* Pointer to destination bit map (BMAPINFO). */ - PBMAPINFO pPatBmapInfo; /* Pointer to pattern bit map (BMAPINFO). */ - PPOINTL aptlSrcOrg; /* Pointer to array of source origin POINTLs. */ - PPOINTL aptlPatOrg; /* Pointer to array of pattern origin POINTLs. */ - PBLTRECT abrDst; /* Pointer to array of Blt rects. */ - PRECTL prclSrcBounds; /* Pointer to source bounding rect of source Blts. */ - PRECTL prclDstBounds; /* Pointer to destination bounding rect of destination Blts. */ -} BITBLTINFO; -typedef BITBLTINFO *PBITBLTINFO; - -#define BF_DEFAULT_STATE 0x0 -#define BF_ROP_INCL_SRC (0x01 << 2) -#define BF_PAT_HOLLOW (0x01 << 8) - -typedef struct _GDDMODEINFO { - ULONG ulLength; /* Size of the GDDMODEINFO data structure, in bytes. */ - ULONG ulModeId; /* ID used to make SETMODE request. */ - ULONG ulBpp; /* Number of colors (bpp). */ - ULONG ulHorizResolution;/* Number of horizontal pels. */ - ULONG ulVertResolution; /* Number of vertical scan lines. */ - ULONG ulRefreshRate; /* Refresh rate in Hz. */ - PBYTE pbVRAMPhys; /* Physical address of VRAM. */ - ULONG ulApertureSize; /* Size of VRAM, in bytes. */ - ULONG ulScanLineSize; /* Size of one scan line, in bytes. */ - - ULONG fccColorEncoding, ulTotalVRAMSize, cColors; -} GDDMODEINFO; -typedef GDDMODEINFO *PGDDMODEINFO; - -typedef struct _HWREQIN { - ULONG ulLength; /* Size of the HWREQIN data structure, in bytes. */ - ULONG ulFlags; /* Request option flags. */ - ULONG cScrChangeRects; /* Count of screen rectangles affected by HWREQIN. */ - PRECTL arectlScreen; /* Array of screen rectangles affected by HWREQIN. */ -} HWREQIN; -typedef HWREQIN *PHWREQIN; - -#define REQUEST_HW 0x01 - -/* -BOOL GreDeath(HDC hdc, PVOID pInstance, LONG lFunction); -LONG GreResurrection(HDC hdc, LONG cbVmem, PULONG pReserved, PVOID pInstance, LONG lFunction); -*/ -#define GreDeath(h) (BOOL)Gre32Entry3((ULONG)(h), 0, 0x40B7L) -#define GreResurrection(h,n,r) (LONG)Gre32Entry5((ULONG)(h), (ULONG)(n), (ULONG)(r), 0, 0x40B8L) -ULONG _System Gre32Entry3(ULONG, ULONG, ULONG); -ULONG _System Gre32Entry5(ULONG, ULONG, ULONG, ULONG, ULONG); - -#endif /* SDL_gradd_h_ */ diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c deleted file mode 100644 index 56cfde1b3..000000000 --- a/src/video/os2/SDL_os2dive.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" -#include "../SDL_sysvideo.h" -#define INCL_WIN -#define INCL_GPI -#include -#define _MEERROR_H_ -#include -#include -#define INCL_MM_OS2 -#include -#include -#include "SDL_os2output.h" - -typedef struct _VODATA { - HDIVE hDive; - PVOID pBuffer; - ULONG ulDIVEBufNum; - FOURCC fccColorEncoding; - ULONG ulWidth; - ULONG ulHeight; - BOOL fBlitterReady; -} VODATA; - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo); -static PVODATA voOpen(void); -static VOID voClose(PVODATA pVOData); -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible); -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); -static VOID voVideoBufFree(PVODATA pVOData); -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); - -OS2VIDEOOUTPUT voDive = { - voQueryInfo, - voOpen, - voClose, - voSetVisibleRegion, - voVideoBufAlloc, - voVideoBufFree, - voUpdate -}; - - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) -{ - DIVE_CAPS sDiveCaps; - FOURCC fccFormats[100]; - - /* Query information about display hardware from DIVE. */ - SDL_zeroa(fccFormats); - SDL_zero(sDiveCaps); - sDiveCaps.pFormatData = fccFormats; - sDiveCaps.ulFormatLength = 100; - sDiveCaps.ulStructLen = sizeof(DIVE_CAPS); - - if (DiveQueryCaps(&sDiveCaps, DIVE_BUFFER_SCREEN)) { - debug_os2("DiveQueryCaps() failed."); - return FALSE; - } - - if (sDiveCaps.ulDepth < 8) { - debug_os2("Not enough screen colors to run DIVE. " - "Must be at least 256 colors."); - return FALSE; - } - - pInfo->ulBPP = sDiveCaps.ulDepth; - pInfo->fccColorEncoding = sDiveCaps.fccColorEncoding; - pInfo->ulScanLineSize = sDiveCaps.ulScanLineBytes; - pInfo->ulHorizResolution = sDiveCaps.ulHorizontalResolution; - pInfo->ulVertResolution = sDiveCaps.ulVerticalResolution; - - return TRUE; -} - -PVODATA voOpen(void) -{ - PVODATA pVOData = SDL_calloc(1, sizeof(VODATA)); - - if (pVOData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - if (DiveOpen(&pVOData->hDive, FALSE, NULL) != DIVE_SUCCESS) { - SDL_free(pVOData); - SDL_SetError("DIVE: A display engine instance open failed"); - return NULL; - } - - return pVOData; -} - -static VOID voClose(PVODATA pVOData) -{ - voVideoBufFree(pVOData); - DiveClose(pVOData->hDive); - SDL_free(pVOData); -} - -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible) -{ - HPS hps; - HRGN hrgn; - RGNRECT rgnCtl; - PRECTL prectl = NULL; - ULONG ulRC; - - if (!fVisible) { - if (pVOData->fBlitterReady) { - pVOData->fBlitterReady = FALSE; - DiveSetupBlitter(pVOData->hDive, 0); - debug_os2("DIVE blitter is tuned off"); - } - return TRUE; - } - - /* Query visible rectangles */ - hps = WinGetPS(hwnd); - hrgn = GpiCreateRegion(hps, 0, NULL); - if (hrgn == NULLHANDLE) { - WinReleasePS(hps); - SDL_SetError("GpiCreateRegion() failed"); - } else { - WinQueryVisibleRegion(hwnd, hrgn); - if (hrgnShape != NULLHANDLE) - GpiCombineRegion(hps, hrgn, hrgn, hrgnShape, CRGN_AND); - - rgnCtl.ircStart = 1; - rgnCtl.crc = 0; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL); - if (rgnCtl.crcReturned != 0) { - prectl = SDL_malloc(rgnCtl.crcReturned * sizeof(RECTL)); - if (prectl != NULL) { - rgnCtl.ircStart = 1; - rgnCtl.crc = rgnCtl.crcReturned; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prectl); - } else { - SDL_OutOfMemory(); - } - } - GpiDestroyRegion(hps, hrgn); - WinReleasePS(hps); - - if (prectl != NULL) { - /* Setup DIVE blitter. */ - SETUP_BLITTER sSetupBlitter; - SWP swp; - POINTL pointl = { 0,0 }; - - WinQueryWindowPos(hwnd, &swp); - WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); - - sSetupBlitter.ulStructLen = sizeof(SETUP_BLITTER); - sSetupBlitter.fccSrcColorFormat = pVOData->fccColorEncoding; - sSetupBlitter.fInvert = FALSE; - sSetupBlitter.ulSrcWidth = pVOData->ulWidth; - sSetupBlitter.ulSrcHeight = pVOData->ulHeight; - sSetupBlitter.ulSrcPosX = 0; - sSetupBlitter.ulSrcPosY = 0; - sSetupBlitter.ulDitherType = 0; - sSetupBlitter.fccDstColorFormat = FOURCC_SCRN; - sSetupBlitter.ulDstWidth = swp.cx; - sSetupBlitter.ulDstHeight = swp.cy; - sSetupBlitter.lDstPosX = 0; - sSetupBlitter.lDstPosY = 0; - sSetupBlitter.lScreenPosX = pointl.x; - sSetupBlitter.lScreenPosY = pointl.y; - - sSetupBlitter.ulNumDstRects = rgnCtl.crcReturned; - sSetupBlitter.pVisDstRects = prectl; - - ulRC = DiveSetupBlitter(pVOData->hDive, &sSetupBlitter); - SDL_free(prectl); - - if (ulRC == DIVE_SUCCESS) { - pVOData->fBlitterReady = TRUE; - WinInvalidateRect(hwnd, NULL, TRUE); - debug_os2("DIVE blitter is ready now."); - return TRUE; - } - - SDL_SetError("DiveSetupBlitter(), rc = 0x%X", ulRC); - } /* if (prectl != NULL) */ - } /* if (hrgn == NULLHANDLE) else */ - - pVOData->fBlitterReady = FALSE; - DiveSetupBlitter(pVOData->hDive, 0); - return FALSE; -} - -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, FOURCC fccColorEncoding, - PULONG pulScanLineSize) -{ - ULONG ulRC; - ULONG ulScanLineSize = ulWidth * (ulBPP >> 3); - - /* Destroy previous buffer. */ - voVideoBufFree(pVOData); - - if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0) - return NULL; - - /* Bytes per line. */ - ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */ - *pulScanLineSize = ulScanLineSize; - - ulRC = DosAllocMem(&pVOData->pBuffer, - (ulHeight * ulScanLineSize) + sizeof(ULONG), - PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocMem(), rc = %u", ulRC); - return NULL; - } - - ulRC = DiveAllocImageBuffer(pVOData->hDive, &pVOData->ulDIVEBufNum, - fccColorEncoding, ulWidth, ulHeight, - ulScanLineSize, pVOData->pBuffer); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveAllocImageBuffer(), rc = 0x%X", ulRC); - DosFreeMem(pVOData->pBuffer); - pVOData->pBuffer = NULL; - pVOData->ulDIVEBufNum = 0; - return NULL; - } - - pVOData->fccColorEncoding = fccColorEncoding; - pVOData->ulWidth = ulWidth; - pVOData->ulHeight = ulHeight; - - debug_os2("buffer: 0x%P, DIVE buffer number: %u", - pVOData->pBuffer, pVOData->ulDIVEBufNum); - - return pVOData->pBuffer; -} - -static VOID voVideoBufFree(PVODATA pVOData) -{ - ULONG ulRC; - - if (pVOData->ulDIVEBufNum != 0) { - ulRC = DiveFreeImageBuffer(pVOData->hDive, pVOData->ulDIVEBufNum); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveFreeImageBuffer(,%u), rc = %u", pVOData->ulDIVEBufNum, ulRC); - } else { - debug_os2("DIVE buffer %u destroyed", pVOData->ulDIVEBufNum); - } - pVOData->ulDIVEBufNum = 0; - } - - if (pVOData->pBuffer != NULL) { - ulRC = DosFreeMem(pVOData->pBuffer); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeMem(), rc = %u", ulRC); - } - pVOData->pBuffer = NULL; - } -} - -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects) -{ - ULONG ulRC; - - if (!pVOData->fBlitterReady || (pVOData->ulDIVEBufNum == 0)) { - debug_os2("DIVE blitter is not ready"); - return FALSE; - } - - if (pSDLRects != NULL) { - PBYTE pbLineMask; - - pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight); - if (pbLineMask == NULL) { - debug_os2("Not enough stack size"); - return FALSE; - } - SDL_memset(pbLineMask, 0, pVOData->ulHeight); - - for ( ; ((LONG)cSDLRects) > 0; cSDLRects--, pSDLRects++) { - SDL_memset(&pbLineMask[pSDLRects->y], 1, pSDLRects->h); - } - - ulRC = DiveBlitImageLines(pVOData->hDive, pVOData->ulDIVEBufNum, - DIVE_BUFFER_SCREEN, pbLineMask); - SDL_stack_free(pbLineMask); - - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveBlitImageLines(), rc = 0x%X", ulRC); - } - } else { - ulRC = DiveBlitImage(pVOData->hDive, pVOData->ulDIVEBufNum, - DIVE_BUFFER_SCREEN); - if (ulRC != DIVE_SUCCESS) { - debug_os2("DiveBlitImage(), rc = 0x%X", ulRC); - } - } - - return ulRC == DIVE_SUCCESS; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2messagebox.c b/src/video/os2/SDL_os2messagebox.c deleted file mode 100644 index c904fa5cb..000000000 --- a/src/video/os2/SDL_os2messagebox.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -/* Display a OS/2 message box */ - -#include "SDL.h" -#include "../../core/os2/SDL_os2.h" -#include "SDL_os2video.h" -#define INCL_WIN -#include - -#define IDD_TEXT_MESSAGE 1001 -#define IDD_BITMAP 1002 -#define IDD_PB_FIRST 1003 - -typedef struct _MSGBOXDLGDATA { - USHORT cb; - HWND hwndUnder; -} MSGBOXDLGDATA; - -static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData) -{ - HPS hps = WinGetPS(hwnd); - POINTL aptText[TXTBOX_COUNT]; - HENUM hEnum; - HWND hWndNext; - CHAR acBuf[256]; - ULONG cbBuf; - ULONG cButtons = 0; - ULONG ulButtonsCY = 0; - ULONG ulButtonsCX = 0; - RECTL rectl; - ULONG ulX; - ULONG ulIdx; - struct _BUTTON { - HWND hwnd; /* Button window handle. */ - ULONG ulCX; /* Button width in dialog coordinates. */ - } aButtons[32]; - RECTL rectlItem; - HAB hab = WinQueryAnchorBlock(hwnd); - - /* --- Align the buttons to the right/bottom. --- */ - - /* Collect window handles of all buttons in dialog. */ - hEnum = WinBeginEnumWindows(hwnd); - - while ((hWndNext = WinGetNextWindow(hEnum)) != NULLHANDLE) { - if (WinQueryClassName(hWndNext, sizeof(acBuf), acBuf) == 0) { - continue; - } - if (SDL_strcmp(acBuf, "#3") == 0) { /* Class name of button. */ - if (cButtons < sizeof(aButtons) / sizeof(struct _BUTTON)) { - aButtons[cButtons].hwnd = hWndNext; - cButtons++; - } - } - } - WinEndEnumWindows(hEnum); - - /* Query size of text for each button, get width of each button, total - * buttons width (ulButtonsCX) and max. height (ulButtonsCX) in _dialog - * coordinates_. */ - hps = WinGetPS(hwnd); - - for(ulIdx = 0; ulIdx < cButtons; ulIdx++) { - /* Query size of text in window coordinates. */ - cbBuf = WinQueryWindowText(aButtons[ulIdx].hwnd, sizeof(acBuf), acBuf); - GpiQueryTextBox(hps, cbBuf, acBuf, TXTBOX_COUNT, aptText); - aptText[TXTBOX_TOPRIGHT].x -= aptText[TXTBOX_BOTTOMLEFT].x; - aptText[TXTBOX_TOPRIGHT].y -= aptText[TXTBOX_BOTTOMLEFT].y; - /* Convert text size to dialog coordinates. */ - WinMapDlgPoints(hwnd, &aptText[TXTBOX_TOPRIGHT], 1, FALSE); - /* Add vertical and horizontal space for button's frame (dialog coord.). */ - if (aptText[TXTBOX_TOPRIGHT].x < 30) { /* Minimal button width. */ - aptText[TXTBOX_TOPRIGHT].x = 30; - } else { - aptText[TXTBOX_TOPRIGHT].x += 4; - } - aptText[TXTBOX_TOPRIGHT].y += 3; - - aButtons[ulIdx].ulCX = aptText[TXTBOX_TOPRIGHT].x; /* Store button width */ - ulButtonsCX += aptText[TXTBOX_TOPRIGHT].x + 2; /* Add total btn. width */ - /* Get max. height for buttons. */ - if (ulButtonsCY < aptText[TXTBOX_TOPRIGHT].y) - ulButtonsCY = aptText[TXTBOX_TOPRIGHT].y + 1; - } - - WinReleasePS(hps); - - /* Expand horizontal size of the window to fit all buttons and move window - * to the center of parent window. */ - - /* Convert total width of buttons to window coordinates. */ - aptText[0].x = ulButtonsCX + 4; - WinMapDlgPoints(hwnd, &aptText[0], 1, TRUE); - /* Check width of the window and expand as needed. */ - WinQueryWindowRect(hwnd, &rectlItem); - if (rectlItem.xRight <= aptText[0].x) - rectlItem.xRight = aptText[0].x; - - /* Move window rectangle to the center of owner window. */ - WinQueryWindowRect(pDlgData->hwndUnder, &rectl); - /* Left-bottom point of centered dialog on owner window. */ - rectl.xLeft = (rectl.xRight - rectlItem.xRight) / 2; - rectl.yBottom = (rectl.yTop - rectlItem.yTop) / 2; - /* Map left-bottom point to desktop. */ - WinMapWindowPoints(pDlgData->hwndUnder, HWND_DESKTOP, (PPOINTL)&rectl, 1); - WinOffsetRect(hab, &rectlItem, rectl.xLeft, rectl.yBottom); - - /* Set new rectangle for the window. */ - WinSetWindowPos(hwnd, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom, - rectlItem.xRight - rectlItem.xLeft, - rectlItem.yTop - rectlItem.yBottom, - SWP_SIZE | SWP_MOVE); - - /* Set buttons positions. */ - - /* Get horizontal position for the first button. */ - WinMapDlgPoints(hwnd, (PPOINTL)&rectlItem, 2, FALSE); /* Win size to dlg coord. */ - ulX = rectlItem.xRight - rectlItem.xLeft - ulButtonsCX - 2; /* First button position. */ - - /* Set positions and sizes for all buttons. */ - for (ulIdx = 0; ulIdx < cButtons; ulIdx++) { - /* Get poisition and size for the button in dialog coordinates. */ - aptText[0].x = ulX; - aptText[0].y = 2; - aptText[1].x = aButtons[ulIdx].ulCX; - aptText[1].y = ulButtonsCY; - /* Convert to window coordinates. */ - WinMapDlgPoints(hwnd, aptText, 2, TRUE); - - WinSetWindowPos(aButtons[ulIdx].hwnd, HWND_TOP, - aptText[0].x, aptText[0].y, aptText[1].x, aptText[1].y, - SWP_MOVE | SWP_SIZE); - - /* Offset horizontal position for the next button. */ - ulX += aButtons[ulIdx].ulCX + 2; - } - - /* Set right bound of the text to right bound of the last button and - * bottom bound of the text just above the buttons. */ - - aptText[2].x = 25; /* Left bound of text in dlg coordinates. */ - aptText[2].y = ulButtonsCY + 3; /* Bottom bound of the text in dlg coords. */ - WinMapDlgPoints(hwnd, &aptText[2], 1, TRUE); /* Convert ^^^ to win. coords */ - hWndNext = WinWindowFromID(hwnd, IDD_TEXT_MESSAGE); - WinQueryWindowRect(hWndNext, &rectlItem); - rectlItem.xLeft = aptText[2].x; - rectlItem.yBottom = aptText[2].y; - /* Right bound of the text equals right bound of the last button. */ - rectlItem.xRight = aptText[0].x + aptText[1].x; - WinSetWindowPos(hWndNext, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom, - rectlItem.xRight - rectlItem.xLeft, - rectlItem.yTop - rectlItem.yBottom, - SWP_MOVE | SWP_SIZE); -} - -static MRESULT EXPENTRY DynDlgProc(HWND hwnd, USHORT message, MPARAM mp1, MPARAM mp2) -{ - switch (message) { - case WM_INITDLG: - _wmInitDlg(hwnd, (MSGBOXDLGDATA*)mp2); - break; - - case WM_COMMAND: - switch (SHORT1FROMMP(mp1)) { - case DID_OK: - WinDismissDlg(hwnd, FALSE); - break; - default: - break; - } - - default: - return(WinDefDlgProc(hwnd, message, mp1, mp2)); - } - - return FALSE; -} - -static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) -{ - SDL_MessageBoxButtonData* - pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; - ULONG cSDLBtnData = messageboxdata->numbuttons; - - PSZ pszTitle = OS2_UTF8ToSys(messageboxdata->title); - ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1); - PSZ pszText = OS2_UTF8ToSys(messageboxdata->message); - ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1); - - PDLGTEMPLATE pTemplate; - ULONG cbTemplate; - ULONG ulIdx; - PCHAR pcDlgData; - PDLGTITEM pDlgItem; - PSZ pszBtnText; - ULONG cbBtnText; - HWND hwnd; - - const SDL_MessageBoxColor* pSDLColors = (messageboxdata->colorScheme == NULL)? - NULL : messageboxdata->colorScheme->colors; - const SDL_MessageBoxColor* pSDLColor; - - MSGBOXDLGDATA stDlgData; - - /* Build a dialog tamplate in memory */ - - /* Size of template */ - cbTemplate = sizeof(DLGTEMPLATE) + ((2 + cSDLBtnData) * sizeof(DLGTITEM)) + - sizeof(ULONG) + /* First item data - frame control data. */ - cbTitle + /* First item data - frame title + ZERO. */ - cbText + /* Second item data - ststic text + ZERO.*/ - 3; /* Third item data - system icon Id. */ - - /* Button items datas - text for buttons. */ - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) { - pszBtnText = (PSZ)pSDLBtnData[ulIdx].text; - cbTemplate += (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); - } - - /* Presentation parameter space. */ - if (pSDLColors != NULL) { - cbTemplate += 26 /* PP for frame. */ + - 26 /* PP for static text. */ + - (48 * cSDLBtnData); /* PP for buttons. */ - } - - /* Allocate memory for the dialog template. */ - pTemplate = (PDLGTEMPLATE) SDL_malloc(cbTemplate); - /* Pointer on data for dialog items in allocated memory. */ - pcDlgData = &((PCHAR)pTemplate)[sizeof(DLGTEMPLATE) + - ((2 + cSDLBtnData) * sizeof(DLGTITEM))]; - - /* Header info */ - pTemplate->cbTemplate = cbTemplate; /* size of dialog template to pass to WinCreateDlg() */ - pTemplate->type = 0; /* Currently always 0. */ - pTemplate->codepage = 0; - pTemplate->offadlgti = 14; /* Offset to array of DLGTITEMs. */ - pTemplate->fsTemplateStatus = 0; /* Reserved field? */ - - /* Index in array of dlg items of item to get focus, */ - /* if 0 then focus goes to first control that can have focus. */ - pTemplate->iItemFocus = 0; - pTemplate->coffPresParams = 0; - - /* First item info - frame */ - pDlgItem = pTemplate->adlgti; - pDlgItem->fsItemStatus = 0; /* Reserved? */ - /* Number of dialog item child windows owned by this item. */ - pDlgItem->cChildren = 2 + cSDLBtnData; /* Ststic text + buttons. */ - /* Length of class name, if 0 then offClassname contains a WC_ value. */ - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_FRAME; - /* Length of text. */ - pDlgItem->cchText = cbTitle; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to title text. */ - /* Copy text for the title into the dialog template. */ - if (pszTitle != NULL) { - SDL_memcpy(pcDlgData, pszTitle, cbTitle); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - - pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | - FS_DLGBORDER | WS_SAVEBITS; - pDlgItem->x = 100; - pDlgItem->y = 100; - pDlgItem->cx = 175; - pDlgItem->cy = 65; - pDlgItem->id = DID_OK; /* An ID value? */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the frame - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 22; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r; - pcDlgData += 11; - } - - /* Offset to ctl data. */ - pDlgItem->offCtlData = pcDlgData - (PCHAR)pTemplate; - /* Put CtlData for the dialog in here */ - *((PULONG)pcDlgData) = FCF_TITLEBAR | FCF_SYSMENU; - pcDlgData += sizeof(ULONG); - - /* Second item info - static text (message). */ - pDlgItem++; - pDlgItem->fsItemStatus = 0; - /* No children since its a control, it could have child control */ - /* (ex. a group box). */ - pDlgItem->cChildren = 0; - /* Length of class name, 0 - offClassname contains a WC_ constant. */ - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_STATIC; - - pDlgItem->cchText = cbText; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ - /* Copy message text into the dialog template. */ - if (pszText != NULL) { - SDL_memcpy(pcDlgData, pszText, cbText); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - - pDlgItem->flStyle = SS_TEXT | DT_TOP | DT_LEFT | DT_WORDBREAK | WS_VISIBLE; - /* It will be really set in _wmInitDlg(). */ - pDlgItem->x = 25; - pDlgItem->y = 13; - pDlgItem->cx = 147; - pDlgItem->cy = 62; /* It will be used. */ - - pDlgItem->id = IDD_TEXT_MESSAGE; /* an ID value */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the static text - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 22; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r; - pcDlgData += 11; - } - pDlgItem->offCtlData = 0; - - /* Third item info - static bitmap. */ - pDlgItem++; - pDlgItem->fsItemStatus = 0; - pDlgItem->cChildren = 0; - pDlgItem->cchClassName = 0; - pDlgItem->offClassName = (USHORT)WC_STATIC; - - pDlgItem->cchText = 3; /* 0xFF, low byte of the icon Id, high byte of icon Id. */ - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the Id. */ - /* Write system icon ID into dialog template. */ - *((PBYTE)pcDlgData) = 0xFF; /* First byte is 0xFF, next 2 are system pointer Id. */ - pcDlgData++; - *((PUSHORT)pcDlgData) = ((messageboxdata->flags & SDL_MESSAGEBOX_ERROR) != 0)? - SPTR_ICONERROR : - ((messageboxdata->flags & SDL_MESSAGEBOX_WARNING) != 0)? - SPTR_ICONWARNING : SPTR_ICONINFORMATION; - pcDlgData += 2; - - pDlgItem->flStyle = SS_SYSICON | WS_VISIBLE; - - pDlgItem->x = 4; - pDlgItem->y = 45; /* It will be really set in _wmInitDlg(). */ - pDlgItem->cx = 0; - pDlgItem->cy = 0; - - pDlgItem->id = IDD_BITMAP; - pDlgItem->offPresParams = 0; - pDlgItem->offCtlData = 0; - - /* Next items - buttons. */ - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) { - pDlgItem++; - - pDlgItem->fsItemStatus = 0; - pDlgItem->cChildren = 0; /* No children. */ - pDlgItem->cchClassName = 0; /* 0 - offClassname is WC_ constant. */ - pDlgItem->offClassName = (USHORT)WC_BUTTON; - - pszBtnText = OS2_UTF8ToSys(pSDLBtnData[ulIdx].text); - cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); - pDlgItem->cchText = cbBtnText; - pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ - /* Copy text for the button into the dialog template. */ - if (pszBtnText != NULL) { - SDL_memcpy(pcDlgData, pszBtnText, cbBtnText); - } else { - *pcDlgData = '\0'; - } - pcDlgData += pDlgItem->cchText; - SDL_free(pszBtnText); - - pDlgItem->flStyle = BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE; - if (pSDLBtnData[ulIdx].flags == SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { - pDlgItem->flStyle |= BS_DEFAULT; - pTemplate->iItemFocus = ulIdx + 3; /* +3 - frame, static text and icon. */ - pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]; - } else { - pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT]; - } - - /* It will be really set in _wmInitDlg() */ - pDlgItem->x = 10; - pDlgItem->y = 10; - pDlgItem->cx = 70; - pDlgItem->cy = 15; - - pDlgItem->id = IDD_PB_FIRST + ulIdx; /* an ID value */ - if (pSDLColors == NULL) - pDlgItem->offPresParams = 0; - else { - /* Presentation parameter for the button - dialog colors. */ - pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate; - ((PPRESPARAMS)pcDlgData)->cb = 44; - pcDlgData += 4; - ((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColor->b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColor->g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColor->r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BORDERLIGHTCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r; - pcDlgData += 11; - ((PPARAM)pcDlgData)->id = PP_BORDERDARKCOLOR; - ((PPARAM)pcDlgData)->cb = 3; - ((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b; - ((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g; - ((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r; - pcDlgData += 11; - } - pDlgItem->offCtlData = 0; - } - /* Check, end of templ. data: &((PCHAR)pTemplate)[cbTemplate] == pcDlgData */ - - /* Create the dialog from template. */ - stDlgData.cb = sizeof(MSGBOXDLGDATA); - stDlgData.hwndUnder = (messageboxdata->window != NULL && messageboxdata->window->driverdata != NULL)? - ((WINDATA *)messageboxdata->window->driverdata)->hwnd : HWND_DESKTOP; - - hwnd = WinCreateDlg(HWND_DESKTOP, /* Parent is desktop. */ - stDlgData.hwndUnder, - (PFNWP)DynDlgProc, pTemplate, &stDlgData); - SDL_free(pTemplate); - SDL_free(pszTitle); - SDL_free(pszText); - - return hwnd; -} - - -int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) -{ - HWND hwnd; - ULONG ulRC; - SDL_MessageBoxButtonData - *pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; - ULONG cSDLBtnData = messageboxdata->numbuttons; - BOOL fVideoInitialized = SDL_WasInit(SDL_INIT_VIDEO); - HAB hab; - HMQ hmq; - BOOL fSuccess = FALSE; - - if (!fVideoInitialized) { - PTIB tib; - PPIB pib; - - DosGetInfoBlocks(&tib, &pib); - if (pib->pib_ultype == 2 || pib->pib_ultype == 0) { - /* VIO windowable or fullscreen protect-mode session */ - pib->pib_ultype = 3; /* Presentation Manager protect-mode session */ - } - - hab = WinInitialize(0); - if (hab == NULLHANDLE) { - debug_os2("WinInitialize() failed"); - return -1; - } - hmq = WinCreateMsgQueue(hab, 0); - if (hmq == NULLHANDLE) { - debug_os2("WinCreateMsgQueue() failed"); - return -1; - } - } - - /* Create dynamic dialog. */ - hwnd = _makeDlg(messageboxdata); - /* Show dialog and obtain button Id. */ - ulRC = WinProcessDlg(hwnd); - /* Destroy dialog, */ - WinDestroyWindow(hwnd); - - if (ulRC == DID_CANCEL) { - /* Window closed by ESC, Alt+F4 or system menu. */ - ULONG ulIdx; - - for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++, pSDLBtnData++) { - if (pSDLBtnData->flags == SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { - *buttonid = pSDLBtnData->buttonid; - fSuccess = TRUE; - break; - } - } - } else { - /* Button pressed. */ - ulRC -= IDD_PB_FIRST; - if (ulRC < cSDLBtnData) { - *buttonid = pSDLBtnData[ulRC].buttonid; - fSuccess = TRUE; - } - } - - if (!fVideoInitialized) { - WinDestroyMsgQueue(hmq); - WinTerminate(hab); - } - - return (fSuccess)? 0 : -1; -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2messagebox.h b/src/video/os2/SDL_os2messagebox.h deleted file mode 100644 index c3b8969df..000000000 --- a/src/video/os2/SDL_os2messagebox.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -extern int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2mouse.c b/src/video/os2/SDL_os2mouse.c deleted file mode 100644 index dd0b7c193..000000000 --- a/src/video/os2/SDL_os2mouse.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_os2video.h" -#include "../../events/SDL_mouse_c.h" -#include "SDL_os2util.h" - -HPOINTER hptrCursor = NULLHANDLE; - -static SDL_Cursor* OS2_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) -{ - ULONG ulMaxW = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER); - ULONG ulMaxH = WinQuerySysValue(HWND_DESKTOP, SV_CYPOINTER); - HPOINTER hptr; - SDL_Cursor* pSDLCursor; - - if (surface->w > ulMaxW || surface->h > ulMaxH) { - debug_os2("Given image size is %u x %u, maximum allowed size is %u x %u", - surface->w, surface->h, ulMaxW, ulMaxH); - return NULL; - } - - hptr = utilCreatePointer(surface, hot_x, ulMaxH - hot_y - 1); - if (hptr == NULLHANDLE) - return NULL; - - pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { - WinDestroyPointer(hptr); - SDL_OutOfMemory(); - return NULL; - } - - pSDLCursor->driverdata = (void *)hptr; - return pSDLCursor; -} - -static SDL_Cursor* OS2_CreateSystemCursor(SDL_SystemCursor id) -{ - SDL_Cursor* pSDLCursor; - LONG lSysId; - HPOINTER hptr; - - switch (id) { - case SDL_SYSTEM_CURSOR_ARROW: lSysId = SPTR_ARROW; break; - case SDL_SYSTEM_CURSOR_IBEAM: lSysId = SPTR_TEXT; break; - case SDL_SYSTEM_CURSOR_WAIT: lSysId = SPTR_WAIT; break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: lSysId = SPTR_MOVE; break; - case SDL_SYSTEM_CURSOR_WAITARROW: lSysId = SPTR_WAIT; break; - case SDL_SYSTEM_CURSOR_SIZENWSE: lSysId = SPTR_SIZENWSE; break; - case SDL_SYSTEM_CURSOR_SIZENESW: lSysId = SPTR_SIZENESW; break; - case SDL_SYSTEM_CURSOR_SIZEWE: lSysId = SPTR_SIZEWE; break; - case SDL_SYSTEM_CURSOR_SIZENS: lSysId = SPTR_SIZENS; break; - case SDL_SYSTEM_CURSOR_SIZEALL: lSysId = SPTR_MOVE; break; - case SDL_SYSTEM_CURSOR_NO: lSysId = SPTR_ILLEGAL; break; - case SDL_SYSTEM_CURSOR_HAND: lSysId = SPTR_ARROW; break; - default: - debug_os2("Unknown cursor id: %u", id); - return NULL; - } - - /* On eCS SPTR_WAIT for last paramether fCopy=TRUE/FALSE gives different - * "wait" icons. -=8( ) */ - hptr = WinQuerySysPointer(HWND_DESKTOP, lSysId, - id == SDL_SYSTEM_CURSOR_WAIT); - if (hptr == NULLHANDLE) { - debug_os2("Cannot load OS/2 system pointer %u for SDL cursor id %u", - lSysId, id); - return NULL; - } - - pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { - WinDestroyPointer(hptr); - SDL_OutOfMemory(); - return NULL; - } - - pSDLCursor->driverdata = (void *)hptr; - return pSDLCursor; -} - -static void OS2_FreeCursor(SDL_Cursor *cursor) -{ - HPOINTER hptr = (HPOINTER)cursor->driverdata; - - WinDestroyPointer(hptr); - SDL_free(cursor); -} - -static int OS2_ShowCursor(SDL_Cursor *cursor) -{ - hptrCursor = (cursor != NULL)? (HPOINTER)cursor->driverdata : NULLHANDLE; - return ((SDL_GetMouseFocus() == NULL) || - WinSetPointer(HWND_DESKTOP, hptrCursor))? 0 : -1; -} - -static void OS2_WarpMouse(SDL_Window * window, int x, int y) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - POINTL pointl; - - pointl.x = x; - pointl.y = window->h - y; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); -/* pWinData->lSkipWMMouseMove++; ???*/ - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); -} - -static int OS2_WarpMouseGlobal(int x, int y) -{ - WinSetPointerPos(HWND_DESKTOP, x, - WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - y); - return 0; -} - -static int OS2_CaptureMouse(SDL_Window *window) -{ - return WinSetCapture(HWND_DESKTOP, (window == NULL)? NULLHANDLE : - ((WINDATA *)window->driverdata)->hwnd)? 0 : -1; -} - -static Uint32 OS2_GetGlobalMouseState(int *x, int *y) -{ - POINTL pointl; - ULONG ulRes; - - WinQueryPointerPos(HWND_DESKTOP, &pointl); - *x = pointl.x; - *y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - pointl.y - 1; - - ulRes = (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)? SDL_BUTTON_LMASK : 0; - if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) - ulRes |= SDL_BUTTON_RMASK; - if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) - ulRes |= SDL_BUTTON_MMASK; - - return ulRes; -} - - -void OS2_InitMouse(_THIS, ULONG hab) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - pSDLMouse->CreateCursor = OS2_CreateCursor; - pSDLMouse->CreateSystemCursor = OS2_CreateSystemCursor; - pSDLMouse->ShowCursor = OS2_ShowCursor; - pSDLMouse->FreeCursor = OS2_FreeCursor; - pSDLMouse->WarpMouse = OS2_WarpMouse; - pSDLMouse->WarpMouseGlobal = OS2_WarpMouseGlobal; - pSDLMouse->CaptureMouse = OS2_CaptureMouse; - pSDLMouse->GetGlobalMouseState = OS2_GetGlobalMouseState; - - SDL_SetDefaultCursor(OS2_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); - if (hptrCursor == NULLHANDLE) - hptrCursor = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, TRUE); -} - -void OS2_QuitMouse(_THIS) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if (pSDLMouse->def_cursor != NULL) { - SDL_free(pSDLMouse->def_cursor); - pSDLMouse->def_cursor = NULL; - pSDLMouse->cur_cursor = NULL; - } -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2mouse.h b/src/video/os2/SDL_os2mouse.h deleted file mode 100644 index 52f5ba3f7..000000000 --- a/src/video/os2/SDL_os2mouse.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2mouse_h_ -#define SDL_os2mouse_h_ - -extern HPOINTER hptrCursor; - -extern void OS2_InitMouse(_THIS, ULONG hab); -extern void OS2_QuitMouse(_THIS); - -#endif /* SDL_os2mouse_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2output.h b/src/video/os2/SDL_os2output.h deleted file mode 100644 index 7ded650e9..000000000 --- a/src/video/os2/SDL_os2output.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef SDL_os2output_ -#define SDL_os2output_ - -#include "../../core/os2/SDL_os2.h" - -typedef struct _VODATA *PVODATA; - -typedef struct _VIDEOOUTPUTINFO { - ULONG ulBPP; - ULONG fccColorEncoding; - ULONG ulScanLineSize; - ULONG ulHorizResolution; - ULONG ulVertResolution; -} VIDEOOUTPUTINFO; - -typedef struct _OS2VIDEOOUTPUT { - BOOL (*QueryInfo)(VIDEOOUTPUTINFO *pInfo); - PVODATA (*Open)(); - VOID (*Close)(PVODATA pVOData); - - BOOL (*SetVisibleRegion)(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, HRGN hrgnShape, - BOOL fVisible); - - PVOID (*VideoBufAlloc)(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); - - VOID (*VideoBufFree)(PVODATA pVOData); - BOOL (*Update)(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); -} OS2VIDEOOUTPUT; - -extern OS2VIDEOOUTPUT voDive; -extern OS2VIDEOOUTPUT voVMan; - -#endif /* SDL_os2output_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2util.c b/src/video/os2/SDL_os2util.c deleted file mode 100644 index bcc6c54e8..000000000 --- a/src/video/os2/SDL_os2util.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_os2util.h" - -HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) -{ - HBITMAP hbm; - BITMAPINFOHEADER2 bmih; - BITMAPINFO bmi; - HPS hps; - PULONG pulBitmap; - PULONG pulDst, pulSrc, pulDstMask; - ULONG ulY, ulX; - HPOINTER hptr = NULLHANDLE; - - if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) { - debug_os2("Image format should be SDL_PIXELFORMAT_ARGB8888"); - return NULLHANDLE; - } - - pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG)); - if (pulBitmap == NULL) { - SDL_OutOfMemory(); - return NULLHANDLE; - } - - /* pulDst - last line of surface (image) part of the result bitmap */ - pulDst = &pulBitmap[ (surface->h - 1) * surface->w ]; - /* pulDstMask - last line of mask part of the result bitmap */ - pulDstMask = &pulBitmap[ (2 * surface->h - 1) * surface->w ]; - /* pulSrc - first line of source image */ - pulSrc = (PULONG)surface->pixels; - - for (ulY = 0; ulY < surface->h; ulY++) { - for (ulX = 0; ulX < surface->w; ulX++) { - if ((pulSrc[ulX] & 0xFF000000) == 0) { - pulDst[ulX] = 0; - pulDstMask[ulX] = 0xFFFFFFFF; - } else { - pulDst[ulX] = pulSrc[ulX] & 0xFFFFFF; - pulDstMask[ulX] = 0; - } - } - - /* Set image and mask pointers on one line up */ - pulDst -= surface->w; - pulDstMask -= surface->w; - /* Set source image pointer to the next line */ - pulSrc = (PULONG) (((PCHAR)pulSrc) + surface->pitch); - } - - /* Create system bitmap object. */ - SDL_zero(bmih); - SDL_zero(bmi); - - bmih.cbFix = sizeof(BITMAPINFOHEADER2); - bmih.cx = surface->w; - bmih.cy = 2 * surface->h; - bmih.cPlanes = 1; - bmih.cBitCount = 32; - bmih.ulCompression = BCA_UNCOMP; - bmih.cbImage = bmih.cx * bmih.cy * 4; - - bmi.cbFix = sizeof(BITMAPINFOHEADER); - bmi.cx = bmih.cx; - bmi.cy = bmih.cy; - bmi.cPlanes = 1; - bmi.cBitCount = 32; - - hps = WinGetPS(HWND_DESKTOP); - hbm = GpiCreateBitmap(hps, (PBITMAPINFOHEADER2)&bmih, CBM_INIT, - (PBYTE)pulBitmap, (PBITMAPINFO2)&bmi); - if (hbm == GPI_ERROR) { - debug_os2("GpiCreateBitmap() failed"); - } else { - /* Create a system pointer object. */ - hptr = WinCreatePointer(HWND_DESKTOP, hbm, TRUE, ulHotX, ulHotY); - if (hptr == NULLHANDLE) { - debug_os2("WinCreatePointer() failed"); - } - } - GpiDeleteBitmap(hbm); - - WinReleasePS(hps); - SDL_free(pulBitmap); - - return hptr; -} - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2util.h b/src/video/os2/SDL_os2util.h deleted file mode 100644 index 9379dec54..000000000 --- a/src/video/os2/SDL_os2util.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_os2util_h_ -#define SDL_os2util_h_ - -#include "SDL_log.h" -#include "../SDL_sysvideo.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_WIN -#define INCL_GPI -#include - -HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY); - -#endif /* SDL_os2util_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c deleted file mode 100644 index f0147dc08..000000000 --- a/src/video/os2/SDL_os2video.c +++ /dev/null @@ -1,1696 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_OS2 - -#include "SDL_video.h" -#include "SDL_mouse.h" -#include "../SDL_pixels_c.h" -#include "../SDL_shape_internals.h" -#include "../../events/SDL_events_c.h" -#include "SDL_os2video.h" -#include "SDL_syswm.h" -#include "SDL_os2util.h" - -#define __MEERROR_H__ -#define _MEERROR_H_ -#include -#include -#ifndef FOURCC_R666 -#define FOURCC_R666 mmioFOURCC('R','6','6','6') -#endif - -#define WIN_CLIENT_CLASS "SDL3" -#define OS2DRIVER_NAME_DIVE "DIVE" -#define OS2DRIVER_NAME_VMAN "VMAN" - - -static const SDL_Scancode aSDLScancode[] = { - /* 0 1 2 3 4 5 6 7 */ - /* 8 9 A B C D E F */ - SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */ - SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */ - - SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */ - SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */ - - SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */ - SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */ - - SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, /*55*/SDL_SCANCODE_KP_MULTIPLY,/* 3 */ - SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */ - - SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_KP_7, /* 4 */ - /*72*/ SDL_SCANCODE_KP_8, /*73*/SDL_SCANCODE_KP_9, SDL_SCANCODE_KP_MINUS,/*75*/SDL_SCANCODE_KP_4, /*76*/SDL_SCANCODE_KP_5, /*77*/SDL_SCANCODE_KP_6, /*78*/SDL_SCANCODE_KP_PLUS, /*79*/SDL_SCANCODE_KP_1, /* 4 */ - - /*80*/ SDL_SCANCODE_KP_2, /*81*/SDL_SCANCODE_KP_3, SDL_SCANCODE_KP_0, /*83*/SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */ - /*88*/ SDL_SCANCODE_F12, /*89*/SDL_SCANCODE_PAUSE, /*90*/SDL_SCANCODE_KP_ENTER,/*91*/SDL_SCANCODE_RCTRL, /*92*/SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_RALT, /*95*/SDL_SCANCODE_UNKNOWN, /* 5 */ - - /*96*/ SDL_SCANCODE_HOME, /*97*/SDL_SCANCODE_UP, /*98*/SDL_SCANCODE_PAGEUP, SDL_SCANCODE_LEFT, /*100*/SDL_SCANCODE_RIGHT, SDL_SCANCODE_END, /*102*/SDL_SCANCODE_DOWN, /*103*/SDL_SCANCODE_PAGEDOWN, /* 6 */ -/*104*/ SDL_SCANCODE_F17, /*105*/SDL_SCANCODE_DELETE, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN,/*110*/SDL_SCANCODE_UNKNOWN,/*111*/SDL_SCANCODE_UNKNOWN, /* 6 */ - -/*112*/ SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1,SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */ -/*120*/ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4,SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5,SDL_SCANCODE_APPLICATION,SDL_SCANCODE_INTERNATIONAL3,SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI /* 7 */ -}; - -/* Utilites. - * --------- - */ -static BOOL _getSDLPixelFormatData(SDL_PixelFormat *pSDLPixelFormat, - ULONG ulBPP, ULONG fccColorEncoding) -{ - ULONG ulRshift, ulGshift, ulBshift; - ULONG ulRmask, ulGmask, ulBmask; - ULONG ulRloss, ulGloss, ulBloss; - - pSDLPixelFormat->BitsPerPixel = ulBPP; - pSDLPixelFormat->BytesPerPixel = (pSDLPixelFormat->BitsPerPixel + 7) / 8; - - switch (fccColorEncoding) { - case FOURCC_LUT8: - ulRshift = 0; ulGshift = 0; ulBshift = 0; - ulRmask = 0; ulGmask = 0; ulBmask = 0; - ulRloss = 8; ulGloss = 8; ulBloss = 8; - break; - - case FOURCC_R555: - ulRshift = 10; ulGshift = 5; ulBshift = 0; - ulRmask = 0x7C00; ulGmask = 0x03E0; ulBmask = 0x001F; - ulRloss = 3; ulGloss = 3; ulBloss = 3; - break; - - case FOURCC_R565: - ulRshift = 11; ulGshift = 5; ulBshift = 0; - ulRmask = 0xF800; ulGmask = 0x07E0; ulBmask = 0x001F; - ulRloss = 3; ulGloss = 2; ulBloss = 3; - break; - - case FOURCC_R664: - ulRshift = 10; ulGshift = 4; ulBshift = 0; - ulRmask = 0xFC00; ulGmask = 0x03F0; ulBmask = 0x000F; - ulRloss = 2; ulGloss = 4; ulBloss = 3; - break; - - case FOURCC_R666: - ulRshift = 12; ulGshift = 6; ulBshift = 0; - ulRmask = 0x03F000; ulGmask = 0x000FC0; ulBmask = 0x00003F; - ulRloss = 2; ulGloss = 2; ulBloss = 2; - break; - - case FOURCC_RGB3: - case FOURCC_RGB4: - ulRshift = 0; ulGshift = 8; ulBshift = 16; - ulRmask = 0x0000FF; ulGmask = 0x00FF00; ulBmask = 0xFF0000; - ulRloss = 0x00; ulGloss = 0x00; ulBloss = 0x00; - break; - - case FOURCC_BGR3: - case FOURCC_BGR4: - ulRshift = 16; ulGshift = 8; ulBshift = 0; - ulRmask = 0xFF0000; ulGmask = 0x00FF00; ulBmask = 0x0000FF; - ulRloss = 0; ulGloss = 0; ulBloss = 0; - break; - - default: -/* printf("Unknown color encoding: %.4s\n", fccColorEncoding);*/ - SDL_memset(pSDLPixelFormat, 0, sizeof(SDL_PixelFormat)); - return FALSE; - } - - pSDLPixelFormat->Rshift = ulRshift; - pSDLPixelFormat->Gshift = ulGshift; - pSDLPixelFormat->Bshift = ulBshift; - pSDLPixelFormat->Rmask = ulRmask; - pSDLPixelFormat->Gmask = ulGmask; - pSDLPixelFormat->Bmask = ulBmask; - pSDLPixelFormat->Rloss = ulRloss; - pSDLPixelFormat->Gloss = ulGloss; - pSDLPixelFormat->Bloss = ulBloss; - - pSDLPixelFormat->Ashift = 0x00; - pSDLPixelFormat->Amask = 0x00; - pSDLPixelFormat->Aloss = 0x00; - - return TRUE; -} - -static Uint32 _getSDLPixelFormat(ULONG ulBPP, FOURCC fccColorEncoding) -{ - SDL_PixelFormat stSDLPixelFormat; - Uint32 uiResult = SDL_PIXELFORMAT_UNKNOWN; - - if (_getSDLPixelFormatData(&stSDLPixelFormat, ulBPP, fccColorEncoding)) - uiResult = SDL_MasksToPixelFormatEnum(ulBPP, stSDLPixelFormat.Rmask, - stSDLPixelFormat.Gmask, - stSDLPixelFormat.Bmask, 0); - - return uiResult; -} - -static SDL_DisplayMode *_getDisplayModeForSDLWindow(SDL_Window *window) -{ - SDL_VideoDisplay *pSDLDisplay = SDL_GetDisplayForWindow(window); - - if (pSDLDisplay == NULL) { - debug_os2("No display for the window"); - return FALSE; - } - - return &pSDLDisplay->current_mode; -} - -static VOID _mouseCheck(WINDATA *pWinData) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if ((pSDLMouse->relative_mode || (pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) && - ((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0)) { - /* We will make a real capture in _wmMouseButton() */ - } else { - WinSetCapture(HWND_DESKTOP, NULLHANDLE); - } -} - - -/* PM window procedure. - * -------------------- - */ -static int OS2_ResizeWindowShape(SDL_Window *window); - -static VOID _setVisibleRegion(WINDATA *pWinData, BOOL fVisible) -{ - SDL_VideoDisplay *pSDLDisplay; - - if (! pWinData->pVOData) - return; - - pSDLDisplay = (fVisible)? SDL_GetDisplayForWindow(pWinData->window) : NULL; - pWinData->pOutput->SetVisibleRegion(pWinData->pVOData, pWinData->hwnd, - (pSDLDisplay == NULL) ? - NULL : &pSDLDisplay->current_mode, - pWinData->hrgnShape, fVisible); -} - -static VOID _wmPaint(WINDATA *pWinData, HWND hwnd) -{ - if (pWinData->pVOData == NULL || - !pWinData->pOutput->Update(pWinData->pVOData, hwnd, NULL, 0)) { - RECTL rectl; - HPS hps; - - hps = WinBeginPaint(hwnd, 0, &rectl); - WinFillRect(hps, &rectl, CLR_BLACK); - WinEndPaint(hps); - } -} - -static VOID _wmMouseMove(WINDATA *pWinData, SHORT lX, SHORT lY) -{ - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - POINTL pointl; - BOOL fWinActive = (pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0; - - if (!pSDLMouse->relative_mode || pSDLMouse->relative_mode_warp) { - if (!pSDLMouse->relative_mode && fWinActive && - ((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) && - (WinQueryCapture(HWND_DESKTOP) == pWinData->hwnd)) { - - pointl.x = lX; - pointl.y = lY; - - if (lX < 0) - lX = 0; - else if (lX >= pWinData->window->w) - lX = pWinData->window->w - 1; - - if (lY < 0) - lY = 0; - else if (lY >= pWinData->window->h) - lY = pWinData->window->h - 1; - - if (lX != pointl.x || lY != pointl.x) { - pointl.x = lX; - pointl.y = lY; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } - } - - SDL_SendMouseMotion(pWinData->window, 0, 0, lX, - pWinData->window->h - lY - 1); - return; - } - - if (fWinActive) { - pointl.x = pWinData->window->w / 2; - pointl.y = pWinData->window->h / 2; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - - SDL_SendMouseMotion(pWinData->window, 0, 1, - lX - pointl.x, pointl.y - lY); - - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } -} - -static VOID _wmMouseButton(WINDATA *pWinData, ULONG ulButton, BOOL fDown) -{ - static ULONG aBtnGROP2SDL[3] = { SDL_BUTTON_LEFT, SDL_BUTTON_RIGHT, - SDL_BUTTON_MIDDLE }; - SDL_Mouse *pSDLMouse = SDL_GetMouse(); - - if ((pSDLMouse->relative_mode || ((pWinData->window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0)) && - ((pWinData->window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) && - (WinQueryCapture(HWND_DESKTOP) != pWinData->hwnd)) { - /* Mouse should be captured. */ - if (pSDLMouse->relative_mode && !pSDLMouse->relative_mode_warp) { - POINTL pointl; - - pointl.x = pWinData->window->w / 2; - pointl.y = pWinData->window->h / 2; - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - pWinData->lSkipWMMouseMove++; - WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y); - } - - WinSetCapture(HWND_DESKTOP, pWinData->hwnd); - } - - SDL_SendMouseButton(pWinData->window, 0, - (fDown)? SDL_PRESSED : SDL_RELEASED, - aBtnGROP2SDL[ulButton]); -} - -static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2) -{ - ULONG ulFlags = SHORT1FROMMP(mp1); /* WM_CHAR flags */ - ULONG ulVirtualKey = SHORT2FROMMP(mp2); /* Virtual key code VK_* */ - ULONG ulCharCode = SHORT1FROMMP(mp2); /* Character code */ - ULONG ulScanCode = CHAR4FROMMP(mp1); /* Scan code */ - - if (((ulFlags & (KC_VIRTUALKEY | KC_KEYUP | KC_ALT)) == (KC_VIRTUALKEY | KC_ALT)) && - (ulVirtualKey == VK_F4)) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_CLOSE, 0, 0); - } - - if ((ulFlags & KC_SCANCODE) != 0) { - SDL_SendKeyboardKey(((ulFlags & KC_KEYUP) == 0)? SDL_PRESSED : SDL_RELEASED, aSDLScancode[ulScanCode]); - } - - if ((ulFlags & KC_CHAR) != 0) { -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) - char *utf8 = SDL_iconv_string("UTF-8", "", (char *)&ulCharCode, 1); - SDL_SendKeyboardText((utf8 && *utf8) ? utf8 : (char *)&ulCharCode); - SDL_free(utf8); -#else - char utf8[4]; - int rc = StrUTF8(1, utf8, sizeof(utf8), (char *)&ulCharCode, 1); - SDL_SendKeyboardText((rc > 0) ? utf8 : (char *) &ulCharCode); -#endif - } -} - -static VOID _wmMove(WINDATA *pWinData) -{ - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(pWinData->window); - POINTL pointl = { 0,0 }; - RECTL rectl; - - WinQueryWindowRect(pWinData->hwnd, &rectl); - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 2); - - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1); - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MOVED, rectl.xLeft, - pSDLDisplayMode->h - rectl.yTop); -} - -static MRESULT _wmDragOver(WINDATA *pWinData, PDRAGINFO pDragInfo) -{ - ULONG ulIdx; - PDRAGITEM pDragItem; - USHORT usDrag = DOR_NEVERDROP; - USHORT usDragOp = DO_UNKNOWN; - - if (!DrgAccessDraginfo(pDragInfo)) - return MRFROM2SHORT(DOR_NEVERDROP, DO_UNKNOWN); - - for (ulIdx = 0; ulIdx < pDragInfo->cditem; ulIdx++) { - pDragItem = DrgQueryDragitemPtr(pDragInfo, ulIdx); - - /* We accept WPS files only. */ - if (!DrgVerifyRMF(pDragItem, "DRM_OS2FILE", NULL)) { - usDrag = DOR_NEVERDROP; - usDragOp = DO_UNKNOWN; - break; - } - - if (pDragInfo->usOperation == DO_DEFAULT && - (pDragItem->fsSupportedOps & DO_COPYABLE) != 0) { - usDrag = DOR_DROP; - usDragOp = DO_COPY; - } else - if (pDragInfo->usOperation == DO_LINK && - (pDragItem->fsSupportedOps & DO_LINKABLE) != 0) { - usDrag = DOR_DROP; - usDragOp = DO_LINK; - } else { - usDrag = DOR_NODROPOP; - usDragOp = DO_UNKNOWN; - break; - } - } - - /* Update window (The DIVE surface spoiled while dragging) */ - WinInvalidateRect(pWinData->hwnd, NULL, FALSE); - WinUpdateWindow(pWinData->hwnd); - - DrgFreeDraginfo(pDragInfo); - return MPFROM2SHORT(usDrag, usDragOp); -} - -static MRESULT _wmDrop(WINDATA *pWinData, PDRAGINFO pDragInfo) -{ - ULONG ulIdx; - PDRAGITEM pDragItem; - CHAR acFName[CCHMAXPATH]; - PCHAR pcFName; - - if (!DrgAccessDraginfo(pDragInfo)) - return MRFROM2SHORT(DOR_NEVERDROP, 0); - - for (ulIdx = 0; ulIdx < pDragInfo->cditem; ulIdx++) { - pDragItem = DrgQueryDragitemPtr(pDragInfo, ulIdx); - - if (DrgVerifyRMF(pDragItem, "DRM_OS2FILE", NULL) && - pDragItem->hstrContainerName != NULLHANDLE && - pDragItem->hstrSourceName != NULLHANDLE) { - /* Get file name from the item. */ - DrgQueryStrName(pDragItem->hstrContainerName, sizeof(acFName), acFName); - pcFName = SDL_strchr(acFName, '\0'); - DrgQueryStrName(pDragItem->hstrSourceName, - sizeof(acFName) - (pcFName - acFName), pcFName); - - /* Send to SDL full file name converted to UTF-8. */ - pcFName = OS2_SysToUTF8(acFName); - SDL_SendDropFile(pWinData->window, pcFName); - SDL_free(pcFName); - - /* Notify a source that a drag operation is complete. */ - if (pDragItem->hwndItem) - DrgSendTransferMsg(pDragItem->hwndItem, DM_ENDCONVERSATION, - (MPARAM)pDragItem->ulItemID, - (MPARAM)DMFL_TARGETSUCCESSFUL); - } - } - - DrgDeleteDraginfoStrHandles(pDragInfo); - DrgFreeDraginfo(pDragInfo); - - SDL_SendDropComplete(pWinData->window); - - return (MRESULT)FALSE; -} - -static MRESULT EXPENTRY wndFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - HWND hwndClient = WinQueryWindow(hwnd, QW_BOTTOM); - WINDATA * pWinData = (WINDATA *)WinQueryWindowULong(hwndClient, 0); - - if (pWinData == NULL) - return WinDefWindowProc(hwnd, msg, mp1, mp2); - - /* Send a SDL_SYSWMEVENT if the application wants them */ - if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { - SDL_SysWMmsg wmmsg; - - SDL_VERSION(&wmmsg.version); - wmmsg.subsystem = SDL_SYSWM_OS2; - wmmsg.msg.os2.fFrame = TRUE; - wmmsg.msg.os2.hwnd = hwnd; - wmmsg.msg.os2.msg = msg; - wmmsg.msg.os2.mp1 = mp1; - wmmsg.msg.os2.mp2 = mp2; - SDL_SendSysWMEvent(&wmmsg); - } - - switch (msg) { - case WM_MINMAXFRAME: - if ((((PSWP)mp1)->fl & SWP_RESTORE) != 0) { - pWinData->lSkipWMMove += 2; - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - if ((((PSWP)mp1)->fl & SWP_MINIMIZE) != 0) { - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove += 2; - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - if ((((PSWP)mp1)->fl & SWP_MAXIMIZE) != 0) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); - } - break; - - case WM_ADJUSTFRAMEPOS: - if (pWinData->lSkipWMAdjustFramePos > 0) { - pWinData->lSkipWMAdjustFramePos++; - break; - } - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) != 0 && - (((PSWP)mp1)->fl & SWP_RESTORE) != 0) { - /* Keep fullscreen window size on restore. */ - RECTL rectl; - - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); - rectl.yTop = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); - WinCalcFrameRect(hwnd, &rectl, FALSE); - ((PSWP)mp1)->x = rectl.xLeft; - ((PSWP)mp1)->y = rectl.yBottom; - ((PSWP)mp1)->cx = rectl.xRight - rectl.xLeft; - ((PSWP)mp1)->cy = rectl.yTop - rectl.yBottom; - } - if ((((PSWP)mp1)->fl & (SWP_SIZE | SWP_MINIMIZE)) == SWP_SIZE) { - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) != 0) { - /* SDL_WINDOW_FULLSCREEN_DESKTOP have flag SDL_WINDOW_FULLSCREEN... */ - if (SDL_IsShapedWindow(pWinData->window)) - OS2_ResizeWindowShape(pWinData->window); - break; - } - if ((SDL_GetWindowFlags(pWinData->window) & SDL_WINDOW_RESIZABLE) != 0) { - RECTL rectl; - int iMinW, iMinH, iMaxW, iMaxH; - int iWinW, iWinH; - - rectl.xLeft = 0; - rectl.yBottom = 0; - SDL_GetWindowSize(pWinData->window, - (int *)&rectl.xRight, (int *)&rectl.yTop); - iWinW = rectl.xRight; - iWinH = rectl.yTop; - - SDL_GetWindowMinimumSize(pWinData->window, &iMinW, &iMinH); - SDL_GetWindowMaximumSize(pWinData->window, &iMaxW, &iMaxH); - - if (iWinW < iMinW) - rectl.xRight = iMinW; - else if (iMaxW != 0 && iWinW > iMaxW) - rectl.xRight = iMaxW; - - if (iWinH < iMinH) - rectl.yTop = iMinW; - else if (iMaxH != 0 && iWinH > iMaxH) - rectl.yTop = iMaxH; - - if (rectl.xRight == iWinW && rectl.yTop == iWinH) { - if (SDL_IsShapedWindow(pWinData->window)) - OS2_ResizeWindowShape(pWinData->window); - break; - } - - WinCalcFrameRect(hwnd, &rectl, FALSE); - ((PSWP)mp1)->cx = rectl.xRight - rectl.xLeft; - ((PSWP)mp1)->cy = rectl.yTop - rectl.yBottom; - } - } - break; - } - - return pWinData->fnWndFrameProc(hwnd, msg, mp1, mp2); -} - -static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - WINDATA *pWinData = (WINDATA *)WinQueryWindowULong(hwnd, 0); - - if (pWinData == NULL) - return WinDefWindowProc(hwnd, msg, mp1, mp2); - - /* Send a SDL_SYSWMEVENT if the application wants them */ - if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { - SDL_SysWMmsg wmmsg; - - SDL_VERSION(&wmmsg.version); - wmmsg.subsystem = SDL_SYSWM_OS2; - wmmsg.msg.os2.fFrame = FALSE; - wmmsg.msg.os2.hwnd = hwnd; - wmmsg.msg.os2.msg = msg; - wmmsg.msg.os2.mp1 = mp1; - wmmsg.msg.os2.mp2 = mp2; - SDL_SendSysWMEvent(&wmmsg); - } - - switch (msg) { - case WM_CLOSE: - case WM_QUIT: - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_CLOSE, 0, 0); - if (pWinData->fnUserWndProc == NULL) - return (MRESULT)FALSE; - break; - - case WM_PAINT: - _wmPaint(pWinData, hwnd); - break; - - case WM_SHOW: - SDL_SendWindowEvent(pWinData->window, (SHORT1FROMMP(mp1) == 0)? - SDL_WINDOWEVENT_HIDDEN : - SDL_WINDOWEVENT_SHOWN , - 0, 0); - break; - - case WM_UPDATEFRAME: - /* Return TRUE - no further action for the frame control window procedure */ - return (MRESULT)TRUE; - - case WM_ACTIVATE: - if ((BOOL)mp1) { - POINTL pointl; - - if (SDL_GetKeyboardFocus() != pWinData->window) - SDL_SetKeyboardFocus(pWinData->window); - - WinQueryPointerPos(HWND_DESKTOP, &pointl); - WinMapWindowPoints(HWND_DESKTOP, pWinData->hwnd, &pointl, 1); - SDL_SendMouseMotion(pWinData->window, 0, 0, - pointl.x, pWinData->window->h - pointl.y - 1); - } else { - if (SDL_GetKeyboardFocus() == pWinData->window) - SDL_SetKeyboardFocus(NULL); - - WinSetCapture(HWND_DESKTOP, NULLHANDLE); - } - break; - - case WM_MOUSEMOVE: - WinSetPointer(HWND_DESKTOP, hptrCursor); - - if (pWinData->lSkipWMMouseMove > 0) - pWinData->lSkipWMMouseMove--; - else { - _wmMouseMove(pWinData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1)); - } - return (MRESULT)FALSE; - - case WM_BUTTON1DOWN: - case WM_BUTTON1DBLCLK: - _wmMouseButton(pWinData, 0, TRUE); - break; - - case WM_BUTTON1UP: - _wmMouseButton(pWinData, 0, FALSE); - break; - - case WM_BUTTON2DOWN: - case WM_BUTTON2DBLCLK: - _wmMouseButton(pWinData, 1, TRUE); - break; - - case WM_BUTTON2UP: - _wmMouseButton(pWinData, 1, FALSE); - break; - - case WM_BUTTON3DOWN: - case WM_BUTTON3DBLCLK: - _wmMouseButton(pWinData, 2, TRUE); - break; - - case WM_BUTTON3UP: - _wmMouseButton(pWinData, 2, FALSE); - break; - - case WM_TRANSLATEACCEL: - /* ALT and acceleration keys not allowed (must be processed in WM_CHAR) */ - if (mp1 == NULL || ((PQMSG)mp1)->msg != WM_CHAR) - break; - return (MRESULT)FALSE; - - case WM_CHAR: - _wmChar(pWinData, mp1, mp2); - break; - - case WM_SIZE: - if (pWinData->lSkipWMSize > 0) - pWinData->lSkipWMSize--; - else { - if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { - SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_RESIZED, - SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); - } else { - pWinData->lSkipWMVRNEnabled++; - } - } - break; - - case WM_MOVE: - if (pWinData->lSkipWMMove > 0) - pWinData->lSkipWMMove--; - else if ((pWinData->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { - _wmMove(pWinData); - } - break; - - case WM_VRNENABLED: - if (pWinData->lSkipWMVRNEnabled > 0) - pWinData->lSkipWMVRNEnabled--; - else { - _setVisibleRegion(pWinData, TRUE); - } - return (MRESULT)TRUE; - - case WM_VRNDISABLED: - _setVisibleRegion(pWinData, FALSE); - return (MRESULT)TRUE; - - case DM_DRAGOVER: - return _wmDragOver(pWinData, (PDRAGINFO)PVOIDFROMMP(mp1)); - - case DM_DROP: - return _wmDrop(pWinData, (PDRAGINFO)PVOIDFROMMP(mp1)); - } - - return (pWinData->fnUserWndProc != NULL)? - pWinData->fnUserWndProc(hwnd, msg, mp1, mp2) : - WinDefWindowProc(hwnd, msg, mp1, mp2); -} - - -/* SDL routines. - * ------------ - */ - -static void OS2_PumpEvents(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - QMSG qmsg; - - if (WinPeekMsg(pVData->hab, &qmsg, NULLHANDLE, 0, 0, PM_REMOVE)) - WinDispatchMsg(pVData->hab, &qmsg); -} - -static WINDATA *_setupWindow(_THIS, SDL_Window *window, HWND hwndFrame, - HWND hwnd) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - WINDATA *pWinData = SDL_calloc(1, sizeof(WINDATA)); - - if (pWinData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - pWinData->hwnd = hwnd; - pWinData->hwndFrame = hwndFrame; - pWinData->window = window; - window->driverdata = pWinData; - - WinSetWindowULong(hwnd, 0, (ULONG)pWinData); - pWinData->fnWndFrameProc = WinSubclassWindow(hwndFrame, wndFrameProc); - - pWinData->pOutput = pVData->pOutput; - pWinData->pVOData = pVData->pOutput->Open(); - - WinSetVisibleRegionNotify(hwnd, TRUE); - - return pWinData; -} - -static int OS2_CreateWindow(_THIS, SDL_Window *window) -{ - RECTL rectl; - HWND hwndFrame, hwnd; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - ULONG ulFrameFlags = FCF_TASKLIST | FCF_TITLEBAR | FCF_SYSMENU | - FCF_MINBUTTON | FCF_SHELLPOSITION; - ULONG ulSWPFlags = SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE; - WINDATA *pWinData; - - if (pSDLDisplayMode == NULL) - return -1; - - /* Create a PM window */ - if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) - ulFrameFlags |= FCF_SIZEBORDER | FCF_DLGBORDER | FCF_MAXBUTTON; - else if ((window->flags & SDL_WINDOW_BORDERLESS) == 0) - ulFrameFlags |= FCF_DLGBORDER; - - if ((window->flags & SDL_WINDOW_MAXIMIZED) != 0) - ulSWPFlags |= SWP_MAXIMIZE; - else if ((window->flags & SDL_WINDOW_MINIMIZED) != 0) - ulSWPFlags |= SWP_MINIMIZE; - - hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags, - WIN_CLIENT_CLASS, "SDL3", 0, 0, 0, &hwnd); - if (hwndFrame == NULLHANDLE) - return SDL_SetError("Couldn't create window"); - - /* Setup window data and frame window procedure */ - pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { - WinDestroyWindow(hwndFrame); - return -1; - } - - /* Show window */ - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = window->w; - rectl.yTop = window->h; - WinCalcFrameRect(hwndFrame, &rectl, FALSE); - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove++; - WinSetWindowPos(hwndFrame, HWND_TOP, rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulSWPFlags); - - rectl.xLeft = 0; - rectl.yBottom = 0; - WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 1); - window->x = rectl.xLeft; - window->y = pSDLDisplayMode->h - (rectl.yBottom + window->h); - - window->flags |= SDL_WINDOW_SHOWN; - - return 0; -} - -static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - CHAR acBuf[256]; - CLASSINFO stCI; - HWND hwndUser = (HWND)data; - HWND hwndFrame, hwnd; - ULONG cbText; - PSZ pszText; - WINDATA *pWinData; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - SWP swp; - POINTL pointl; - - debug_os2("Enter"); - if (pSDLDisplayMode == NULL) - return -1; - - /* User can accept client OR frame window handle. - * Get client and frame window handles. */ - WinQueryClassName(hwndUser, sizeof(acBuf), acBuf); - if (!WinQueryClassInfo(pVData->hab, acBuf, &stCI)) - return SDL_SetError("Cannot get user window class information"); - - if ((stCI.flClassStyle & CS_FRAME) == 0) { - /* Client window handle is specified */ - hwndFrame = WinQueryWindow(hwndUser, QW_PARENT); - if (hwndFrame == NULLHANDLE) - return SDL_SetError("Cannot get parent window handle"); - - if ((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, 0, 0) == 0) - return SDL_SetError("Parent window is not a frame window"); - - hwnd = hwndUser; - } else { - /* Frame window handle is specified */ - hwnd = WinWindowFromID(hwndUser, FID_CLIENT); - if (hwnd == NULLHANDLE) - return SDL_SetError("Cannot get client window handle"); - - hwndFrame = hwndUser; - - WinQueryClassName(hwnd, sizeof(acBuf), acBuf); - if (!WinQueryClassInfo(pVData->hab, acBuf, &stCI)) - return SDL_SetError("Cannot get client window class information"); - } - - /* Check window's reserved storage */ - if (stCI.cbWindowData < sizeof(ULONG)) - return SDL_SetError("Reserved storage of window must be at least %u bytes", sizeof(ULONG)); - - /* Set SDL-window title */ - cbText = WinQueryWindowTextLength(hwndFrame); - pszText = SDL_stack_alloc(CHAR, cbText + 1); - - if (pszText != NULL) - cbText = (pszText != NULL)? WinQueryWindowText(hwndFrame, cbText, pszText) : 0; - - if (cbText != 0) - window->title = OS2_SysToUTF8(pszText); - - if (pszText != NULL) { - SDL_stack_free(pszText); - } - - /* Set SDL-window flags */ - window->flags &= ~(SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | - SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED | - SDL_WINDOW_MINIMIZED | SDL_WINDOW_INPUT_FOCUS); - - if (WinIsWindowVisible(hwnd)) - window->flags |= SDL_WINDOW_SHOWN; - - WinSendMsg(hwndFrame, WM_QUERYBORDERSIZE, MPFROMP(&pointl), 0); - if (pointl.y == WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER)) - window->flags |= SDL_WINDOW_RESIZABLE; - else if (pointl.y <= WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER)) - window->flags |= SDL_WINDOW_BORDERLESS; - - WinQueryWindowPos(hwndFrame, &swp); - - if ((swp.fl & SWP_MAXIMIZE) != 0) - window->flags |= SDL_WINDOW_MAXIMIZED; - if ((swp.fl & SWP_MINIMIZE) != 0) - window->flags |= SDL_WINDOW_MINIMIZED; - - pointl.x = 0; - pointl.y = 0; - WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); - window->x = pointl.x; - window->y = pSDLDisplayMode->h - (pointl.y + swp.cy); - - WinQueryWindowPos(hwnd, &swp); - window->w = swp.cx; - window->h = swp.cy; - - /* Setup window data and frame window procedure */ - pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { - SDL_free(window->title); - window->title = NULL; - return -1; - } - pWinData->fnUserWndProc = WinSubclassWindow(hwnd, wndProc); - - if (WinQueryActiveWindow(HWND_DESKTOP) == hwndFrame) - SDL_SetKeyboardFocus(window); - - return 0; -} - -static void OS2_DestroyWindow(_THIS, SDL_Window * window) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - if (pWinData == NULL) - return; - - if (pWinData->hrgnShape != NULLHANDLE) { - HPS hps = WinGetPS(pWinData->hwnd); - GpiDestroyRegion(hps, pWinData->hrgnShape); - WinReleasePS(hps); - } - - if (window->shaper) { - SDL_free(window->shaper); - window->shaper = NULL; - } - - if (pWinData->fnUserWndProc == NULL) { - /* Window was created by SDL (OS2_CreateWindow()), - * not by user (OS2_CreateWindowFrom()) */ - WinDestroyWindow(pWinData->hwndFrame); - } else { - WinSetWindowULong(pWinData->hwnd, 0, 0); - } - - if ((pVData != NULL) && (pWinData->pVOData != NULL)) { - pVData->pOutput->Close(pWinData->pVOData); - pWinData->pVOData = NULL; - } - - if (pWinData->hptrIcon != NULLHANDLE) { - WinDestroyPointer(pWinData->hptrIcon); - pWinData->hptrIcon = NULLHANDLE; - } - - SDL_free(pWinData); - window->driverdata = NULL; -} - -static void OS2_SetWindowTitle(_THIS, SDL_Window *window) -{ - PSZ pszTitle = (window->title == NULL)? NULL : OS2_UTF8ToSys(window->title); - - WinSetWindowText(((WINDATA *)window->driverdata)->hwndFrame, pszTitle); - SDL_free(pszTitle); -} - -static void OS2_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - HPOINTER hptr = utilCreatePointer(icon, 0, 0); - - if (hptr == NULLHANDLE) - return; - - /* Destroy old icon */ - if (pWinData->hptrIcon != NULLHANDLE) - WinDestroyPointer(pWinData->hptrIcon); - - /* Set new window icon */ - pWinData->hptrIcon = hptr; - if (!WinSendMsg(pWinData->hwndFrame, WM_SETICON, MPFROMLONG(hptr), 0)) { - debug_os2("Cannot set icon for the window"); - } -} - -static void OS2_SetWindowPosition(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - RECTL rectl; - ULONG ulFlags; - SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); - - debug_os2("Enter"); - if (pSDLDisplayMode == NULL) - return; - - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = window->w; - rectl.yTop = window->h; - WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE); - - if (SDL_ShouldAllowTopmost() && - (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == - (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) ) - ulFlags = SWP_ZORDER | SWP_MOVE | SWP_SIZE; - else - ulFlags = SWP_MOVE | SWP_SIZE; - - pWinData->lSkipWMSize++; - pWinData->lSkipWMMove++; - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, - window->x + rectl.xLeft, - (pSDLDisplayMode->h - window->y) - window->h + rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulFlags); -} - -static void OS2_SetWindowSize(_THIS, SDL_Window *window) -{ - debug_os2("Enter"); - OS2_SetWindowPosition(_this, window); -} - -static void OS2_ShowWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinShowWindow(pWinData->hwndFrame, TRUE); -} - -static void OS2_HideWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinShowWindow(pWinData->hwndFrame, FALSE); -} - -static void OS2_RaiseWindow(_THIS, SDL_Window *window) -{ - debug_os2("Enter"); - OS2_SetWindowPosition(_this, window); -} - -static void OS2_MaximizeWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE); -} - -static void OS2_MinimizeWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_DEACTIVATE); -} - -static void OS2_RestoreWindow(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_RESTORE); -} - -static void OS2_SetWindowBordered(_THIS, SDL_Window * window, - SDL_bool bordered) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - ULONG ulStyle = WinQueryWindowULong(pWinData->hwndFrame, QWL_STYLE); - RECTL rectl; - - debug_os2("Enter"); - - /* New frame sytle */ - if (bordered) - ulStyle |= ((window->flags & SDL_WINDOW_RESIZABLE) != 0) ? FS_SIZEBORDER : FS_DLGBORDER; - else - ulStyle &= ~(FS_SIZEBORDER | FS_BORDER | FS_DLGBORDER); - - /* Save client window position */ - WinQueryWindowRect(pWinData->hwnd, &rectl); - WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, (PPOINTL)&rectl, 2); - - /* Change the frame */ - WinSetWindowULong(pWinData->hwndFrame, QWL_STYLE, ulStyle); - WinSendMsg(pWinData->hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_BORDER), 0); - - /* Restore client window position */ - WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE); - pWinData->lSkipWMMove++; - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, - rectl.yTop - rectl.yBottom, - SWP_SIZE | SWP_MOVE | SWP_NOADJUST); -} - -static void OS2_SetWindowFullscreen(_THIS, SDL_Window *window, - SDL_VideoDisplay *display, - SDL_bool fullscreen) -{ - RECTL rectl; - ULONG ulFlags; - WINDATA *pWinData = (WINDATA *)window->driverdata; - SDL_DisplayMode *pSDLDisplayMode = &display->current_mode; - - debug_os2("Enter, fullscreen: %u", fullscreen); - - if (pSDLDisplayMode == NULL) - return; - - if (SDL_ShouldAllowTopmost() && - (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) - ulFlags = SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_NOADJUST; - else - ulFlags = SWP_SIZE | SWP_MOVE | SWP_NOADJUST; - - if (fullscreen) { - rectl.xLeft = 0; - rectl.yBottom = 0; - rectl.xRight = pSDLDisplayMode->w; - rectl.yTop = pSDLDisplayMode->h; - /* We need send the restore command now to allow WinCalcFrameRect() */ - WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_RESTORE); - } else { - pWinData->lSkipWMMove++; - rectl.xLeft = window->windowed.x; - rectl.yTop = pSDLDisplayMode->h - window->windowed.y; - rectl.xRight = rectl.xLeft + window->windowed.w; - rectl.yBottom = rectl.yTop - window->windowed.h; - } - - if (!WinCalcFrameRect(pWinData->hwndFrame, &rectl, FALSE)) { - debug_os2("WinCalcFrameRect() failed"); - } - else if (!WinSetWindowPos(pWinData->hwndFrame, HWND_TOP, - rectl.xLeft, rectl.yBottom, - rectl.xRight - rectl.xLeft, rectl.yTop - rectl.yBottom, - ulFlags)) { - debug_os2("WinSetWindowPos() failed"); - } -} - -static SDL_bool OS2_GetWindowWMInfo(_THIS, SDL_Window * window, - struct SDL_SysWMinfo *info) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - if (info->version.major <= SDL_MAJOR_VERSION) { - info->subsystem = SDL_SYSWM_OS2; - info->info.os2.hwnd = pWinData->hwnd; - info->info.os2.hwndFrame = pWinData->hwndFrame; - return SDL_TRUE; - } - - SDL_SetError("Application not compiled with SDL %u", - SDL_MAJOR_VERSION); - return SDL_FALSE; -} - -static void OS2_OnWindowEnter(_THIS, SDL_Window * window) -{ -} - -static int OS2_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) -{ - debug_os2("Enter"); - return 0; -} - -static void OS2_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter, %u", grabbed); - _mouseCheck(pWinData); -} - - -/* Shaper - */ -typedef struct _SHAPERECTS { - PRECTL pRects; - ULONG cRects; - ULONG ulWinHeight; -} SHAPERECTS; - -static void _combineRectRegions(SDL_ShapeTree *node, void *closure) -{ - SHAPERECTS *pShapeRects = (SHAPERECTS *)closure; - PRECTL pRect; - - /* Expand rectangles list */ - if ((pShapeRects->cRects & 0x0F) == 0) { - pRect = SDL_realloc(pShapeRects->pRects, (pShapeRects->cRects + 0x10) * sizeof(RECTL)); - if (pRect == NULL) - return; - pShapeRects->pRects = pRect; - } - - /* Add a new rectangle */ - pRect = &pShapeRects->pRects[pShapeRects->cRects]; - pShapeRects->cRects++; - /* Fill rectangle data */ - pRect->xLeft = node->data.shape.x; - pRect->yTop = pShapeRects->ulWinHeight - node->data.shape.y; - pRect->xRight += node->data.shape.w; - pRect->yBottom = pRect->yTop - node->data.shape.h; -} - -static SDL_WindowShaper* OS2_CreateShaper(SDL_Window * window) -{ - SDL_WindowShaper* pSDLShaper = SDL_malloc(sizeof(SDL_WindowShaper)); - - debug_os2("Enter"); - pSDLShaper->window = window; - pSDLShaper->mode.mode = ShapeModeDefault; - pSDLShaper->mode.parameters.binarizationCutoff = 1; - pSDLShaper->userx = 0; - pSDLShaper->usery = 0; - pSDLShaper->driverdata = (SDL_ShapeTree *)NULL; - window->shaper = pSDLShaper; - - if (OS2_ResizeWindowShape(window) != 0) { - window->shaper = NULL; - SDL_free(pSDLShaper); - return NULL; - } - - return pSDLShaper; -} - -static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, - SDL_WindowShapeMode *shape_mode) -{ - SDL_ShapeTree *pShapeTree; - WINDATA *pWinData; - SHAPERECTS stShapeRects; - HPS hps; - - debug_os2("Enter"); - if (shaper == NULL || shape == NULL || - (shape->format->Amask == 0 && shape_mode->mode != ShapeModeColorKey) || - shape->w != shaper->window->w || shape->h != shaper->window->h) { - return SDL_INVALID_SHAPE_ARGUMENT; - } - - if (shaper->driverdata != NULL) - SDL_FreeShapeTree((SDL_ShapeTree **)&shaper->driverdata); - - pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape); - shaper->driverdata = pShapeTree; - - SDL_zero(stShapeRects); - stShapeRects.ulWinHeight = shaper->window->h; - SDL_TraverseShapeTree(pShapeTree, &_combineRectRegions, &stShapeRects); - - pWinData = (WINDATA *)shaper->window->driverdata; - hps = WinGetPS(pWinData->hwnd); - - if (pWinData->hrgnShape != NULLHANDLE) - GpiDestroyRegion(hps, pWinData->hrgnShape); - - pWinData->hrgnShape = (stShapeRects.pRects == NULL) ? NULLHANDLE : - GpiCreateRegion(hps, stShapeRects.cRects, stShapeRects.pRects); - - WinReleasePS(hps); - SDL_free(stShapeRects.pRects); - WinSendMsg(pWinData->hwnd, WM_VRNENABLED, 0, 0); - - return 0; -} - -static int OS2_ResizeWindowShape(SDL_Window *window) -{ - debug_os2("Enter"); - if (window == NULL) - return -1; - - if (window->x != -1000) { - if (window->shaper->driverdata != NULL) - SDL_FreeShapeTree((SDL_ShapeTree **)window->shaper->driverdata); - - if (window->shaper->hasshape == SDL_TRUE) { - window->shaper->userx = window->x; - window->shaper->usery = window->y; - SDL_SetWindowPosition(window, -1000, -1000); - } - } - - return 0; -} - - -/* Frame buffer - */ -static void OS2_DestroyWindowFramebuffer(_THIS, SDL_Window *window) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - debug_os2("Enter"); - if (pWinData != NULL && pWinData->pVOData != NULL) - pWinData->pOutput->VideoBufFree(pWinData->pVOData); -} - -static int OS2_CreateWindowFramebuffer(_THIS, SDL_Window *window, - Uint32 *format, void **pixels, - int *pitch) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - SDL_VideoDisplay *pSDLDisplay = SDL_GetDisplayForWindow(window); - SDL_DisplayMode *pSDLDisplayMode; - MODEDATA *pModeData; - ULONG ulWidth, ulHeight; - - debug_os2("Enter"); - if (pSDLDisplay == NULL) { - debug_os2("No display for the window"); - return -1; - } - - pSDLDisplayMode = &pSDLDisplay->current_mode; - pModeData = (MODEDATA *)pSDLDisplayMode->driverdata; - if (pModeData == NULL) - return SDL_SetError("No mode data for the display"); - - SDL_GetWindowSize(window, (int *)&ulWidth, (int *)&ulHeight); - debug_os2("Window size: %u x %u", ulWidth, ulHeight); - - *pixels = pWinData->pOutput->VideoBufAlloc( - pWinData->pVOData, ulWidth, ulHeight, pModeData->ulDepth, - pModeData->fccColorEncoding, (PULONG)pitch); - if (*pixels == NULL) - return -1; - - *format = pSDLDisplayMode->format; - debug_os2("Pitch: %u, frame buffer: 0x%X.", *pitch, *pixels); - WinSendMsg(pWinData->hwnd, WM_VRNENABLED, 0, 0); - - return 0; -} - -static int OS2_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - const SDL_Rect *rects, int numrects) -{ - WINDATA *pWinData = (WINDATA *)window->driverdata; - - return pWinData->pOutput->Update(pWinData->pVOData, pWinData->hwnd, - (SDL_Rect *)rects, (ULONG)numrects) - ? 0 : -1; -} - - -/* Clipboard - */ -static int OS2_SetClipboardText(_THIS, const char *text) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard; - PSZ pszText = (text == NULL)? NULL : OS2_UTF8ToSys(text); - ULONG cbText; - ULONG ulRC; - BOOL fSuccess; - - debug_os2("Enter"); - if (pszText == NULL) - return -1; - cbText = SDL_strlen(pszText) + 1; - - ulRC = DosAllocSharedMem((PPVOID)&pszClipboard, 0, cbText, - PAG_COMMIT | PAG_READ | PAG_WRITE | - OBJ_GIVEABLE | OBJ_GETTABLE | OBJ_TILE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocSharedMem() failed, rc = %u", ulRC); - SDL_free(pszText); - return -1; - } - - SDL_memcpy(pszClipboard, pszText, cbText); - SDL_free(pszText); - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - fSuccess = FALSE; - } else { - WinEmptyClipbrd(pVData->hab); - fSuccess = WinSetClipbrdData(pVData->hab, (ULONG)pszClipboard, CF_TEXT, CFI_POINTER); - if (!fSuccess) { - debug_os2("WinOpenClipbrd() failed"); - } - WinCloseClipbrd(pVData->hab); - } - - if (!fSuccess) { - DosFreeMem(pszClipboard); - return -1; - } - return 0; -} - -static char *OS2_GetClipboardText(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard = NULL; - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - } else { - pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); - if (pszClipboard != NULL) - pszClipboard = OS2_SysToUTF8(pszClipboard); - WinCloseClipbrd(pVData->hab); - } - - return (pszClipboard == NULL) ? SDL_strdup("") : pszClipboard; -} - -static SDL_bool OS2_HasClipboardText(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard; - SDL_bool result; - - if (!WinOpenClipbrd(pVData->hab)) { - debug_os2("WinOpenClipbrd() failed"); - return SDL_FALSE; - } - - pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); - result = (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; - WinCloseClipbrd(pVData->hab); - - return result; -} - - -static int OS2_VideoInit(_THIS) -{ - SDL_VideoData *pVData; - PTIB tib; - PPIB pib; - - /* Create SDL video driver private data */ - pVData = SDL_calloc(1, sizeof(SDL_VideoData)); - if (pVData == NULL) - return SDL_OutOfMemory(); - - /* Change process type code for use Win* API from VIO session */ - DosGetInfoBlocks(&tib, &pib); - if (pib->pib_ultype == 2 || pib->pib_ultype == 0) { - /* VIO windowable or fullscreen protect-mode session */ - pib->pib_ultype = 3; /* Presentation Manager protect-mode session */ - } - - /* PM initialization */ - pVData->hab = WinInitialize(0); - pVData->hmq = WinCreateMsgQueue(pVData->hab, 0); - if (pVData->hmq == NULLHANDLE) { - SDL_free(pVData); - return SDL_SetError("Message queue cannot be created."); - } - - if (!WinRegisterClass(pVData->hab, WIN_CLIENT_CLASS, wndProc, - CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT, - sizeof(SDL_VideoData*))) { - SDL_free(pVData); - return SDL_SetError("Window class not successfully registered."); - } - - if (SDL_strcasecmp(_this->name, OS2DRIVER_NAME_VMAN) == 0) - pVData->pOutput = &voVMan; - else - pVData->pOutput = &voDive; - - _this->driverdata = pVData; - - /* Add display */ - { - SDL_VideoDisplay stSDLDisplay; - SDL_DisplayMode stSDLDisplayMode; - DISPLAYDATA *pDisplayData; - MODEDATA *pModeData; - VIDEOOUTPUTINFO stVOInfo; - - if (!pVData->pOutput->QueryInfo(&stVOInfo)) { - SDL_free(pVData); - return SDL_SetError("Video mode query failed."); - } - - SDL_zero(stSDLDisplay); SDL_zero(stSDLDisplayMode); - - stSDLDisplayMode.format = _getSDLPixelFormat(stVOInfo.ulBPP, - stVOInfo.fccColorEncoding); - stSDLDisplayMode.w = stVOInfo.ulHorizResolution; - stSDLDisplayMode.h = stVOInfo.ulVertResolution; - stSDLDisplayMode.refresh_rate = 0; - stSDLDisplayMode.driverdata = NULL; - - pModeData = SDL_malloc(sizeof(MODEDATA)); - if (pModeData != NULL) { - pModeData->ulDepth = stVOInfo.ulBPP; - pModeData->fccColorEncoding = stVOInfo.fccColorEncoding; - pModeData->ulScanLineBytes = stVOInfo.ulScanLineSize; - stSDLDisplayMode.driverdata = pModeData; - } - - stSDLDisplay.name = "Primary"; - stSDLDisplay.desktop_mode = stSDLDisplayMode; - stSDLDisplay.current_mode = stSDLDisplayMode; - stSDLDisplay.driverdata = NULL; - stSDLDisplay.num_display_modes = 0; - - pDisplayData = SDL_malloc(sizeof(DISPLAYDATA)); - if (pDisplayData != NULL) { - HPS hps = WinGetPS(HWND_DESKTOP); - HDC hdc = GpiQueryDevice(hps); - - /* May be we can use CAPS_HORIZONTAL_RESOLUTION and - * CAPS_VERTICAL_RESOLUTION - pels per meter? */ - DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1, - (PLONG)&pDisplayData->ulDPIHor); - DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1, - (PLONG)&pDisplayData->ulDPIVer); - WinReleasePS(hps); - - pDisplayData->ulDPIDiag = SDL_ComputeDiagonalDPI( - stVOInfo.ulHorizResolution, stVOInfo.ulVertResolution, - (float)stVOInfo.ulHorizResolution / pDisplayData->ulDPIHor, - (float)stVOInfo.ulVertResolution / pDisplayData->ulDPIVer); - - stSDLDisplayMode.driverdata = pDisplayData; - } - - SDL_AddVideoDisplay(&stSDLDisplay, SDL_FALSE); - } - - OS2_InitMouse(_this, pVData->hab); - - return 0; -} - -static void OS2_VideoQuit(_THIS) -{ - SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - - OS2_QuitMouse(_this); - - WinDestroyMsgQueue(pVData->hmq); - WinTerminate(pVData->hab); - - /* our caller SDL_VideoQuit() already frees display_modes, driverdata, etc. */ -} - -static int OS2_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, - SDL_Rect *rect) -{ - debug_os2("Enter"); - - rect->x = 0; - rect->y = 0; - rect->w = display->desktop_mode.w; - rect->h = display->desktop_mode.h; - - return 0; -} - -static int OS2_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, - float *hdpi, float *vdpi) -{ - DISPLAYDATA *pDisplayData = (DISPLAYDATA *)display->driverdata; - - debug_os2("Enter"); - if (pDisplayData == NULL) - return -1; - - if (ddpi != NULL) - *hdpi = pDisplayData->ulDPIDiag; - if (hdpi != NULL) - *hdpi = pDisplayData->ulDPIHor; - if (vdpi != NULL) - *vdpi = pDisplayData->ulDPIVer; - - return 0; -} - -static void OS2_GetDisplayModes(_THIS, SDL_VideoDisplay *display) -{ - SDL_DisplayMode mode; - - debug_os2("Enter"); - SDL_copyp(&mode, &display->current_mode); - mode.driverdata = (MODEDATA *) SDL_malloc(sizeof(MODEDATA)); - if (!mode.driverdata) return; /* yikes.. */ - SDL_memcpy(mode.driverdata, display->current_mode.driverdata, sizeof(MODEDATA)); - SDL_AddDisplayMode(display, &mode); -} - -static int OS2_SetDisplayMode(_THIS, SDL_VideoDisplay *display, - SDL_DisplayMode *mode) -{ - debug_os2("Enter"); - return -1; -} - - -static void OS2_DeleteDevice(SDL_VideoDevice *device) -{ - SDL_free(device); -} - -static SDL_VideoDevice *OS2_CreateDevice(void) -{ - SDL_VideoDevice *device; - - /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_OutOfMemory(); - return NULL; - } - - /* Set the function pointers */ - device->VideoInit = OS2_VideoInit; - device->VideoQuit = OS2_VideoQuit; - device->GetDisplayBounds = OS2_GetDisplayBounds; - device->GetDisplayDPI = OS2_GetDisplayDPI; - device->GetDisplayModes = OS2_GetDisplayModes; - device->SetDisplayMode = OS2_SetDisplayMode; - device->PumpEvents = OS2_PumpEvents; - device->CreateSDLWindow = OS2_CreateWindow; - device->CreateSDLWindowFrom = OS2_CreateWindowFrom; - device->DestroyWindow = OS2_DestroyWindow; - device->SetWindowTitle = OS2_SetWindowTitle; - device->SetWindowIcon = OS2_SetWindowIcon; - device->SetWindowPosition = OS2_SetWindowPosition; - device->SetWindowSize = OS2_SetWindowSize; - device->ShowWindow = OS2_ShowWindow; - device->HideWindow = OS2_HideWindow; - device->RaiseWindow = OS2_RaiseWindow; - device->MaximizeWindow = OS2_MaximizeWindow; - device->MinimizeWindow = OS2_MinimizeWindow; - device->RestoreWindow = OS2_RestoreWindow; - device->SetWindowBordered = OS2_SetWindowBordered; - device->SetWindowFullscreen = OS2_SetWindowFullscreen; - device->GetWindowWMInfo = OS2_GetWindowWMInfo; - device->OnWindowEnter = OS2_OnWindowEnter; - device->SetWindowHitTest = OS2_SetWindowHitTest; - device->SetWindowMouseGrab = OS2_SetWindowMouseGrab; - device->CreateWindowFramebuffer = OS2_CreateWindowFramebuffer; - device->UpdateWindowFramebuffer = OS2_UpdateWindowFramebuffer; - device->DestroyWindowFramebuffer = OS2_DestroyWindowFramebuffer; - - device->SetClipboardText = OS2_SetClipboardText; - device->GetClipboardText = OS2_GetClipboardText; - device->HasClipboardText = OS2_HasClipboardText; - - device->shape_driver.CreateShaper = OS2_CreateShaper; - device->shape_driver.SetWindowShape = OS2_SetWindowShape; - device->shape_driver.ResizeWindowShape = OS2_ResizeWindowShape; - - device->free = OS2_DeleteDevice; - - return device; -} - -static SDL_VideoDevice *OS2DIVE_CreateDevice(void) -{ - VIDEOOUTPUTINFO stVOInfo; - if (!voDive.QueryInfo(&stVOInfo)) { - return NULL; - } - return OS2_CreateDevice(); -} - -static SDL_VideoDevice *OS2VMAN_CreateDevice(void) -{ - VIDEOOUTPUTINFO stVOInfo; - if (!voVMan.QueryInfo(&stVOInfo)) { - return NULL; - } - return OS2_CreateDevice(); -} - - -/* DIVE and VMAN bootstraps both call the same OS2_CreateDevice() function. - * Video output system will be selected in OS2_VideoInit() by driver name. */ -VideoBootStrap OS2DIVE_bootstrap = -{ - OS2DRIVER_NAME_DIVE, "OS/2 video driver", - OS2DIVE_CreateDevice -}; -VideoBootStrap OS2VMAN_bootstrap = -{ - OS2DRIVER_NAME_VMAN, "OS/2 video driver", - OS2VMAN_CreateDevice -}; - -#endif /* SDL_VIDEO_DRIVER_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2video.h b/src/video/os2/SDL_os2video.h deleted file mode 100644 index 688410c68..000000000 --- a/src/video/os2/SDL_os2video.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_os2video_h_ -#define SDL_os2video_h_ - -#include "../SDL_sysvideo.h" -#include "../../core/os2/SDL_os2.h" - -#define INCL_DOS -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_WIN -#define INCL_GPI -#define INCL_OS2MM -#define INCL_DOSMEMMGR -#include - -#include "SDL_os2mouse.h" -#include "SDL_os2output.h" - -typedef struct SDL_VideoData { - HAB hab; - HMQ hmq; - OS2VIDEOOUTPUT *pOutput; /* Video output routines */ -} SDL_VideoData; - -typedef struct _WINDATA { - SDL_Window *window; - OS2VIDEOOUTPUT *pOutput; /* Video output routines */ - HWND hwndFrame; - HWND hwnd; - PFNWP fnUserWndProc; - PFNWP fnWndFrameProc; - - PVODATA pVOData; /* Video output data */ - - HRGN hrgnShape; - HPOINTER hptrIcon; - RECTL rectlBeforeFS; - - LONG lSkipWMSize; - LONG lSkipWMMove; - LONG lSkipWMMouseMove; - LONG lSkipWMVRNEnabled; - LONG lSkipWMAdjustFramePos; -} WINDATA; - -typedef struct _DISPLAYDATA { - ULONG ulDPIHor; - ULONG ulDPIVer; - ULONG ulDPIDiag; -} DISPLAYDATA; - -typedef struct _MODEDATA { - ULONG ulDepth; - ULONG fccColorEncoding; - ULONG ulScanLineBytes; -} MODEDATA; - -#endif /* SDL_os2video_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2/SDL_os2vman.c b/src/video/os2/SDL_os2vman.c deleted file mode 100644 index acb920061..000000000 --- a/src/video/os2/SDL_os2vman.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" -#include "../SDL_sysvideo.h" - -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_DOSMODULEMGR -#define INCL_WIN -#define INCL_GPI -#define INCL_GPIBITMAPS /* GPI bit map functions */ -#include -#include "SDL_os2output.h" -#include "SDL_os2video.h" - -#include "SDL_gradd.h" - -typedef struct _VODATA { - PVOID pBuffer; - HRGN hrgnVisible; - ULONG ulBPP; - ULONG ulScanLineSize; - ULONG ulWidth; - ULONG ulHeight; - ULONG ulScreenHeight; - ULONG ulScreenBytesPerLine; - RECTL rectlWin; - - PRECTL pRectl; - ULONG cRectl; - PBLTRECT pBltRect; - ULONG cBltRect; -} VODATA; - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo); -static PVODATA voOpen(); -static VOID voClose(PVODATA pVOData); -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible); -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize); -static VOID voVideoBufFree(PVODATA pVOData); -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects); - -OS2VIDEOOUTPUT voVMan = { - voQueryInfo, - voOpen, - voClose, - voSetVisibleRegion, - voVideoBufAlloc, - voVideoBufFree, - voUpdate -}; - - -static HMODULE hmodVMan = NULLHANDLE; -static FNVMIENTRY *pfnVMIEntry = NULL; -static ULONG ulVRAMAddress = 0; - -static VOID APIENTRY ExitVMan(VOID) -{ - if (ulVRAMAddress != 0 && hmodVMan != NULLHANDLE) { - pfnVMIEntry(0, VMI_CMD_TERMPROC, NULL, NULL); - DosFreeModule(hmodVMan); - } - - DosExitList(EXLST_EXIT, (PFNEXITLIST)NULL); -} - -static BOOL _vmanInit(void) -{ - ULONG ulRC; - CHAR acBuf[256]; - INITPROCOUT stInitProcOut; - - if (hmodVMan != NULLHANDLE) /* already initialized */ - return TRUE; - - /* Load vman.dll */ - ulRC = DosLoadModule(acBuf, sizeof(acBuf), "VMAN", &hmodVMan); - if (ulRC != NO_ERROR) { - debug_os2("Could not load VMAN.DLL, rc = %u : %s", ulRC, acBuf); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* Get VMIEntry */ - ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry); - if (ulRC != NO_ERROR) { - debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC); - DosFreeModule(hmodVMan); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* VMAN initialization */ - stInitProcOut.ulLength = sizeof(stInitProcOut); - ulRC = pfnVMIEntry(0, VMI_CMD_INITPROC, NULL, &stInitProcOut); - if (ulRC != RC_SUCCESS) { - debug_os2("Could not initialize VMAN for this process"); - pfnVMIEntry = NULL; - DosFreeModule(hmodVMan); - hmodVMan = NULLHANDLE; - return FALSE; - } - - /* Store video memory virtual address */ - ulVRAMAddress = stInitProcOut.ulVRAMVirt; - /* We use exit list for VMI_CMD_TERMPROC */ - if (DosExitList(EXLST_ADD | 0x00001000, (PFNEXITLIST)ExitVMan) != NO_ERROR) { - debug_os2("DosExitList() failed"); - } - - return TRUE; -} - -static PRECTL _getRectlArray(PVODATA pVOData, ULONG cRects) -{ - PRECTL pRectl; - - if (pVOData->cRectl >= cRects) - return pVOData->pRectl; - - pRectl = SDL_realloc(pVOData->pRectl, cRects * sizeof(RECTL)); - if (pRectl == NULL) - return NULL; - - pVOData->pRectl = pRectl; - pVOData->cRectl = cRects; - return pRectl; -} - -static PBLTRECT _getBltRectArray(PVODATA pVOData, ULONG cRects) -{ - PBLTRECT pBltRect; - - if (pVOData->cBltRect >= cRects) - return pVOData->pBltRect; - - pBltRect = SDL_realloc(pVOData->pBltRect, cRects * sizeof(BLTRECT)); - if (pBltRect == NULL) - return NULL; - - pVOData->pBltRect = pBltRect; - pVOData->cBltRect = cRects; - return pBltRect; -} - - -static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) -{ - ULONG ulRC; - GDDMODEINFO sCurModeInfo; - - if (!_vmanInit()) - return FALSE; - - /* Query current (desktop) mode */ - ulRC = pfnVMIEntry(0, VMI_CMD_QUERYCURRENTMODE, NULL, &sCurModeInfo); - if (ulRC != RC_SUCCESS) { - debug_os2("Could not query desktop video mode."); - return FALSE; - } - - pInfo->ulBPP = sCurModeInfo.ulBpp; - pInfo->ulHorizResolution = sCurModeInfo.ulHorizResolution; - pInfo->ulVertResolution = sCurModeInfo.ulVertResolution; - pInfo->ulScanLineSize = sCurModeInfo.ulScanLineSize; - pInfo->fccColorEncoding = sCurModeInfo.fccColorEncoding; - - return TRUE; -} - -static PVODATA voOpen(void) -{ - PVODATA pVOData; - - if (!_vmanInit()) - return NULL; - - pVOData = SDL_calloc(1, sizeof(VODATA)); - if (pVOData == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - return pVOData; -} - -static VOID voClose(PVODATA pVOData) -{ - if (pVOData->pRectl != NULL) - SDL_free(pVOData->pRectl); - - if (pVOData->pBltRect != NULL) - SDL_free(pVOData->pBltRect); - - voVideoBufFree(pVOData); -} - -static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, - SDL_DisplayMode *pSDLDisplayMode, - HRGN hrgnShape, BOOL fVisible) -{ - HPS hps; - BOOL fSuccess = FALSE; - - hps = WinGetPS(hwnd); - - if (pVOData->hrgnVisible != NULLHANDLE) { - GpiDestroyRegion(hps, pVOData->hrgnVisible); - pVOData->hrgnVisible = NULLHANDLE; - } - - if (fVisible) { - /* Query visible rectangles */ - pVOData->hrgnVisible = GpiCreateRegion(hps, 0, NULL); - if (pVOData->hrgnVisible == NULLHANDLE) { - SDL_SetError("GpiCreateRegion() failed"); - } else { - if (WinQueryVisibleRegion(hwnd, pVOData->hrgnVisible) == RGN_ERROR) { - GpiDestroyRegion(hps, pVOData->hrgnVisible); - pVOData->hrgnVisible = NULLHANDLE; - } else { - if (hrgnShape != NULLHANDLE) - GpiCombineRegion(hps, pVOData->hrgnVisible, pVOData->hrgnVisible, - hrgnShape, CRGN_AND); - fSuccess = TRUE; - } - } - - WinQueryWindowRect(hwnd, &pVOData->rectlWin); - WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&pVOData->rectlWin, 2); - - if (pSDLDisplayMode != NULL) { - pVOData->ulScreenHeight = pSDLDisplayMode->h; - pVOData->ulScreenBytesPerLine = - ((MODEDATA *)pSDLDisplayMode->driverdata)->ulScanLineBytes; - } - } - - WinReleasePS(hps); - - return fSuccess; -} - -static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight, - ULONG ulBPP, ULONG fccColorEncoding, - PULONG pulScanLineSize) -{ - ULONG ulRC; - ULONG ulScanLineSize = ulWidth * (ulBPP >> 3); - - /* Destroy previous buffer */ - voVideoBufFree(pVOData); - - if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0) - return NULL; - - /* Bytes per line */ - ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */ - *pulScanLineSize = ulScanLineSize; - - ulRC = DosAllocMem(&pVOData->pBuffer, - (ulHeight * ulScanLineSize) + sizeof(ULONG), - PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE); - if (ulRC != NO_ERROR) { - debug_os2("DosAllocMem(), rc = %u", ulRC); - return NULL; - } - - pVOData->ulBPP = ulBPP; - pVOData->ulScanLineSize = ulScanLineSize; - pVOData->ulWidth = ulWidth; - pVOData->ulHeight = ulHeight; - - return pVOData->pBuffer; -} - -static VOID voVideoBufFree(PVODATA pVOData) -{ - ULONG ulRC; - - if (pVOData->pBuffer == NULL) - return; - - ulRC = DosFreeMem(pVOData->pBuffer); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeMem(), rc = %u", ulRC); - } else { - pVOData->pBuffer = NULL; - } -} - -static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, - ULONG cSDLRects) -{ - PRECTL prectlDst, prectlScan; - HPS hps; - HRGN hrgnUpdate; - RGNRECT rgnCtl; - SDL_Rect stSDLRectDef; - BMAPINFO bmiSrc; - BMAPINFO bmiDst; - PPOINTL pptlSrcOrg; - PBLTRECT pbrDst; - HWREQIN sHWReqIn; - BITBLTINFO sBitbltInfo; - ULONG ulIdx; - - if (pVOData->pBuffer == NULL) - return FALSE; - - if (pVOData->hrgnVisible == NULLHANDLE) - return TRUE; - - bmiSrc.ulLength = sizeof(BMAPINFO); - bmiSrc.ulType = BMAP_MEMORY; - bmiSrc.ulWidth = pVOData->ulWidth; - bmiSrc.ulHeight = pVOData->ulHeight; - bmiSrc.ulBpp = pVOData->ulBPP; - bmiSrc.ulBytesPerLine = pVOData->ulScanLineSize; - bmiSrc.pBits = (PBYTE)pVOData->pBuffer; - - bmiDst.ulLength = sizeof(BMAPINFO); - bmiDst.ulType = BMAP_VRAM; - bmiDst.pBits = (PBYTE)ulVRAMAddress; - bmiDst.ulWidth = bmiSrc.ulWidth; - bmiDst.ulHeight = bmiSrc.ulHeight; - bmiDst.ulBpp = bmiSrc.ulBpp; - bmiDst.ulBytesPerLine = pVOData->ulScreenBytesPerLine; - - /* List of update rectangles. This is the intersection of requested - * rectangles and visible rectangles. */ - if (cSDLRects == 0) { - /* Full update requested */ - stSDLRectDef.x = 0; - stSDLRectDef.y = 0; - stSDLRectDef.w = bmiSrc.ulWidth; - stSDLRectDef.h = bmiSrc.ulHeight; - pSDLRects = &stSDLRectDef; - cSDLRects = 1; - } - - /* Make list of destination rectangles (prectlDst) list from the source - * list (prectl). */ - prectlDst = _getRectlArray(pVOData, cSDLRects); - if (prectlDst == NULL) { - debug_os2("Not enough memory"); - return FALSE; - } - prectlScan = prectlDst; - for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, pSDLRects++, prectlScan++) { - prectlScan->xLeft = pSDLRects->x; - prectlScan->yTop = pVOData->ulHeight - pSDLRects->y; - prectlScan->xRight = prectlScan->xLeft + pSDLRects->w; - prectlScan->yBottom = prectlScan->yTop - pSDLRects->h; - } - - hps = WinGetPS(hwnd); - if (hps == NULLHANDLE) - return FALSE; - - /* Make destination region to update */ - hrgnUpdate = GpiCreateRegion(hps, cSDLRects, prectlDst); - /* "AND" on visible and destination regions, result is region to update */ - GpiCombineRegion(hps, hrgnUpdate, hrgnUpdate, pVOData->hrgnVisible, CRGN_AND); - - /* Get rectangles of the region to update */ - rgnCtl.ircStart = 1; - rgnCtl.crc = 0; - rgnCtl.ulDirection = 1; - rgnCtl.crcReturned = 0; - GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, NULL); - if (rgnCtl.crcReturned == 0) { - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - return TRUE; - } - /* We don't need prectlDst, use it again to store update regions */ - prectlDst = _getRectlArray(pVOData, rgnCtl.crcReturned); - if (prectlDst == NULL) { - debug_os2("Not enough memory"); - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - return FALSE; - } - rgnCtl.ircStart = 1; - rgnCtl.crc = rgnCtl.crcReturned; - rgnCtl.ulDirection = 1; - GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, prectlDst); - GpiDestroyRegion(hps, hrgnUpdate); - WinReleasePS(hps); - cSDLRects = rgnCtl.crcReturned; - - /* Now cRect/prectlDst is a list of regions in window (update && visible) */ - - /* Make lists for blitting from update regions */ - pbrDst = _getBltRectArray(pVOData, cSDLRects); - if (pbrDst == NULL) { - debug_os2("Not enough memory"); - return FALSE; - } - - prectlScan = prectlDst; - pptlSrcOrg = (PPOINTL)prectlDst; /* Yes, this memory block will be used again */ - for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, prectlScan++, pptlSrcOrg++) { - pbrDst[ulIdx].ulXOrg = pVOData->rectlWin.xLeft + prectlScan->xLeft; - pbrDst[ulIdx].ulYOrg = pVOData->ulScreenHeight - - (pVOData->rectlWin.yBottom + prectlScan->yTop); - pbrDst[ulIdx].ulXExt = prectlScan->xRight - prectlScan->xLeft; - pbrDst[ulIdx].ulYExt = prectlScan->yTop - prectlScan->yBottom; - pptlSrcOrg->x = prectlScan->xLeft; - pptlSrcOrg->y = bmiSrc.ulHeight - prectlScan->yTop; - } - pptlSrcOrg = (PPOINTL)prectlDst; - - /* Request HW */ - sHWReqIn.ulLength = sizeof(HWREQIN); - sHWReqIn.ulFlags = REQUEST_HW; - sHWReqIn.cScrChangeRects = 1; - sHWReqIn.arectlScreen = &pVOData->rectlWin; - if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed"); - sHWReqIn.cScrChangeRects = 0; /* for fail signal only */ - } else { - RECTL rclSrcBounds; - - rclSrcBounds.xLeft = 0; - rclSrcBounds.yBottom = 0; - rclSrcBounds.xRight = bmiSrc.ulWidth; - rclSrcBounds.yTop = bmiSrc.ulHeight; - - SDL_zero(sBitbltInfo); - sBitbltInfo.ulLength = sizeof(BITBLTINFO); - sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW; - sBitbltInfo.cBlits = cSDLRects; - sBitbltInfo.ulROP = ROP_SRCCOPY; - sBitbltInfo.pSrcBmapInfo = &bmiSrc; - sBitbltInfo.pDstBmapInfo = &bmiDst; - sBitbltInfo.prclSrcBounds = &rclSrcBounds; - sBitbltInfo.prclDstBounds = &pVOData->rectlWin; - sBitbltInfo.aptlSrcOrg = pptlSrcOrg; - sBitbltInfo.abrDst = pbrDst; - - /* Screen update */ - if (pfnVMIEntry(0, VMI_CMD_BITBLT, &sBitbltInfo, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_BITBLT,,) failed"); - sHWReqIn.cScrChangeRects = 0; /* for fail signal only */ - } - - /* Release HW */ - sHWReqIn.ulFlags = 0; - if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) { - debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed"); - } - } - - return sHWReqIn.cScrChangeRects != 0; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/Makefile.in b/test/Makefile.in index 0927871e7..aae311280 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -269,22 +269,14 @@ testnative$(EXE): $(srcdir)/testnative.c \ $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ endif -ifeq (@ISOS2@,true) -testnative$(EXE): $(srcdir)/testnative.c \ - $(srcdir)/testnativeos2.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -endif - #there's probably a better way of doing this ifeq (@ISMACOSX@,false) ifeq (@ISWINDOWS@,false) ifeq (@ISUNIX@,false) -ifeq (@ISOS2@,false) testnative$(EXE): ; endif endif endif -endif testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) diff --git a/test/Makefile.os2 b/test/Makefile.os2 deleted file mode 100644 index 3f6daf859..000000000 --- a/test/Makefile.os2 +++ /dev/null @@ -1,18 +0,0 @@ -# Open Watcom makefile to build SDL3 tests for OS/2 -# wmake -f Makefile.os2 -# -# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1 - -SYSTEM = os2v2 - -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" - -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -CFLAGS+= -wx -wcd=303 -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif - -TNSRCS = testnative.c testnativeos2.c - -!include watcom.mif diff --git a/test/Makefile.w32 b/test/Makefile.w32 deleted file mode 100644 index 55ad493f4..000000000 --- a/test/Makefile.w32 +++ /dev/null @@ -1,21 +0,0 @@ -# Open Watcom makefile to build SDL3 tests for Win32 -# wmake -f Makefile.w32 -# -# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 - -SYSTEM = nt - -INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos" - -CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -CFLAGS+= -wx -wcd=303 -!ifeq ENABLE_WERROR 1 -CFLAGS+= -we -!endif -CFLAGS+= -DSDL_MAIN_HANDLED -CFLAGS+= -DHAVE_OPENGL -GLLIBS = opengl32.lib - -TNSRCS = testnative.c testnativew32.c - -!include watcom.mif diff --git a/test/configure b/test/configure index f524bd4d3..c620cc661 100755 --- a/test/configure +++ b/test/configure @@ -633,7 +633,6 @@ SDL_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG -ISOS2 ISUNIX ISWINDOWS ISMACOSX @@ -3557,7 +3556,6 @@ fi ISUNIX="false" ISWINDOWS="false" ISMACOSX="false" -ISOS2="false" case "$host" in *-*-cygwin* | *-*-mingw*) @@ -3658,12 +3656,6 @@ fi MATHLIB="" SYS_GL_LIBS="" ;; - *-*-os2*) - ISOS2="true" - EXE=".exe" - MATHLIB="" - SYS_GL_LIBS="" - ;; *) ISUNIX="true" EXE="" @@ -3718,7 +3710,6 @@ esac - SDL_VERSION=3.0.0 diff --git a/test/configure.ac b/test/configure.ac index 60b60ada1..b096d7330 100644 --- a/test/configure.ac +++ b/test/configure.ac @@ -18,7 +18,6 @@ dnl (Haiku, for example, sets none of these.) ISUNIX="false" ISWINDOWS="false" ISMACOSX="false" -ISOS2="false" dnl Figure out which math library to use case "$host" in @@ -76,12 +75,6 @@ case "$host" in MATHLIB="" SYS_GL_LIBS="" ;; - *-*-os2*) - ISOS2="true" - EXE=".exe" - MATHLIB="" - SYS_GL_LIBS="" - ;; *) dnl Oh well, call it Unix... ISUNIX="true" @@ -97,7 +90,6 @@ AC_SUBST(MATHLIB) AC_SUBST(ISMACOSX) AC_SUBST(ISWINDOWS) AC_SUBST(ISUNIX) -AC_SUBST(ISOS2) dnl Check for SDL SDL_VERSION=3.0.0 diff --git a/test/testnative.c b/test/testnative.c index e115089d5..75ed9808c 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -32,9 +32,6 @@ static NativeWindowFactory *factories[] = { #endif #ifdef TEST_NATIVE_COCOA &CocoaWindowFactory, -#endif -#ifdef TEST_NATIVE_OS2 - &OS2WindowFactory, #endif NULL }; diff --git a/test/testnative.h b/test/testnative.h index 694f46ec8..528194927 100644 --- a/test/testnative.h +++ b/test/testnative.h @@ -13,7 +13,6 @@ /* Definitions for platform dependent windowing functions to test SDL integration with native windows */ - #include "SDL.h" /* This header includes all the necessary system headers for native windows */ @@ -44,8 +43,3 @@ extern NativeWindowFactory X11WindowFactory; #define TEST_NATIVE_COCOA extern NativeWindowFactory CocoaWindowFactory; #endif - -#ifdef SDL_VIDEO_DRIVER_OS2 -#define TEST_NATIVE_OS2 -extern NativeWindowFactory OS2WindowFactory; -#endif diff --git a/test/testnativeos2.c b/test/testnativeos2.c deleted file mode 100644 index 6998fa614..000000000 --- a/test/testnativeos2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely. -*/ - -#include "testnative.h" - -#ifdef TEST_NATIVE_OS2 - -#define WIN_CLIENT_CLASS "SDL Test" - -static void *CreateWindowNative(int w, int h); -static void DestroyWindowNative(void *window); - -NativeWindowFactory OS2WindowFactory = { - "DIVE", - CreateWindowNative, - DestroyWindowNative -}; - -static void *CreateWindowNative(int w, int h) -{ - HWND hwnd, hwndFrame; - ULONG ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR | - FCF_SYSMENU | FCF_SHELLPOSITION | - FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON; - - WinRegisterClass(0, WIN_CLIENT_CLASS, WinDefWindowProc, - CS_SIZEREDRAW | CS_MOVENOTIFY, - sizeof(ULONG)); /* We should have minimum 4 bytes. */ - - hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &ulFrameFlags, - WIN_CLIENT_CLASS, "SDL Test", 0, 0, 1, &hwnd); - if (hwndFrame == NULLHANDLE) { - return NULL; - } - - WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, w, h, - SWP_ZORDER | SWP_ACTIVATE | SWP_SIZE | SWP_SHOW); - - return (void *)hwndFrame; /* We may return client or frame window - handle for SDL_CreateWindowFrom(). */ -} - -static void DestroyWindowNative(void *window) -{ - WinDestroyWindow((HWND) window); -} - -#endif /* TEST_NATIVE_OS2 */ diff --git a/test/watcom.mif b/test/watcom.mif deleted file mode 100644 index 6d0d9d405..000000000 --- a/test/watcom.mif +++ /dev/null @@ -1,122 +0,0 @@ -INCPATH+= -I"../include" -LIBPATH = .. -LIBS = SDL3.lib SDL3test.lib testutils.lib - -#CFLAGS+= -DHAVE_SDL_TTF -#TTFLIBS = SDL3ttf.lib - -CFLAGS+= $(INCPATH) - -TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe & - testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe & - testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe & - testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe & - testintersections.exe testjoystick.exe testkeys.exe testloadso.exe & - testlock.exe testmessage.exe testoverlay2.exe testplatform.exe & - testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe & - testrendertarget.exe testrumble.exe testscale.exe testsem.exe & - testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe & - teststreaming.exe testthread.exe testtimer.exe testver.exe & - testviewport.exe testwm2.exe torturethread.exe checkkeys.exe & - checkkeysthreads.exe testmouse.exe testgles.exe testgles2.exe & - controllermap.exe testhaptic.exe testqsort.exe testresample.exe & - testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe & - testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe & - testautomation.exe testaudiohotplug.exe testcustomcursor.exe testmultiaudio.exe & - testoffscreen.exe testurl.exe - -noninteractive = & - testatomic.exe & - testerror.exe & - testfilesystem.exe & - testkeys.exe & - testlocale.exe & - testplatform.exe & - testpower.exe & - testqsort.exe & - testthread.exe & - testtimer.exe & - testver.exe - -needs_audio = & - testaudioinfo.exe & - testsurround.exe - -needs_display = & - testbounds.exe & - testdisplayinfo.exe - -TESTS = $(noninteractive) $(needs_audio) $(needs_display) - -# testautomation sources -TASRCS = testautomation.c & - testautomation_audio.c testautomation_clipboard.c & - testautomation_events.c testautomation_guid.c & - testautomation_hints.c testautomation_joystick.c & - testautomation_keyboard.c testautomation_main.c & - testautomation_math.c testautomation_mouse.c & - testautomation_pixels.c testautomation_platform.c & - testautomation_rect.c testautomation_render.c & - testautomation_rwops.c testautomation_sdltest.c & - testautomation_stdlib.c testautomation_surface.c & - testautomation_syswm.c testautomation_timer.c & - testautomation_video.c - -OBJS = $(TARGETS:.exe=.obj) -COBJS = $(CSRCS:.c=.obj) -TAOBJS = $(TASRCS:.c=.obj) -TNOBJS = $(TNSRCS:.c=.obj) - -all: testutils.lib $(TARGETS) - -.c: ../src/test - -.obj.exe: - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -.c.obj: - wcc386 $(CFLAGS) -fo=$^@ $< - -# specials -testvulkan.obj: testvulkan.c - # new vulkan headers result in lots of W202 warnings - wcc386 $(CFLAGS) -wcd=202 -fo=$^@ $< - -testautomation.exe: $(TAOBJS) - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testnative.exe: $(TNOBJS) - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testyuv.exe: testyuv.obj testyuv_cvt.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testshader.exe: testshader.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(GLLIBS)} op q op el file {$<} name $@ - -testime.exe: testime.obj - wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ - -testutils.lib: testutils.obj - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $< - -check: .SYMBOLIC $(TESTS) - @set SDL_AUDIODRIVER=dummy - @set SDL_VIDEODRIVER=dummy - @copy "../SDL3.dll" . - @for %exe in ($(TESTS)) do %exe - -check-quick: .SYMBOLIC $(TESTS) - @set SDL_TESTS_QUICK=1 - @set SDL_AUDIODRIVER=dummy - @set SDL_VIDEODRIVER=dummy - @copy "../SDL3.dll" . - @for %exe in ($(TESTS)) do %exe - -clean: .SYMBOLIC - rm -f *.obj *.err -distclean: .SYMBOLIC clean - rm -f *.exe *.lib