mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-06 10:22:17 +08:00
removed os2 support & support for building SDL with watcom.
This commit is contained in:
35
.github/workflows/watcom.yml
vendored
35
.github/workflows/watcom.yml
vendored
@@ -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 ..
|
||||
@@ -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}\"
|
||||
|
||||
296
Makefile.os2
296
Makefile.os2
@@ -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)
|
||||
280
Makefile.w32
280
Makefile.w32
@@ -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)
|
||||
@@ -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 "\"$<TARGET_FILE_NAME:SampleRate::samplerate>\"")
|
||||
else()
|
||||
set(SDL_LIBSAMPLERATE_DYNAMIC "\"$<TARGET_SONAME_FILE_NAME:SampleRate::samplerate>\"")
|
||||
@@ -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})
|
||||
|
||||
130
configure
vendored
130
configure
vendored
@@ -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 <os2.h>
|
||||
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
|
||||
|
||||
101
configure.ac
101
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 <os2.h>]],
|
||||
[])],[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
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
Simple DirectMedia Layer 2 for OS/2 & eComStation
|
||||
================================================================================
|
||||
SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 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.
|
||||
@@ -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)
|
||||
|
||||
@@ -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__)
|
||||
|
||||
@@ -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@
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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_ */
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -111,10 +111,6 @@ typedef void *EGLSurface;
|
||||
#include "SDL_egl.h"
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_OS2)
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#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
|
||||
{
|
||||
|
||||
@@ -38,13 +38,6 @@
|
||||
#if defined(__WIN32__) || defined(__GDK__)
|
||||
#include <process.h> /* _beginthreadex() and _endthreadex() */
|
||||
#endif
|
||||
#if defined(__OS2__) /* for _beginthread() and _endthread() */
|
||||
#ifndef __EMX__
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
19
src/SDL.c
19
src/SDL.c
@@ -22,17 +22,9 @@
|
||||
|
||||
#if defined(__WIN32__) || defined(__GDK__)
|
||||
#include "core/windows/SDL_windows.h"
|
||||
#elif defined(__OS2__)
|
||||
#include <stdlib.h> /* _exit() */
|
||||
#elif !defined(__WINRT__)
|
||||
#include <unistd.h> /* _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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
|
||||
@@ -1,450 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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: */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
#include <os2me.h>
|
||||
|
||||
/* 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: */
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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: */
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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: */
|
||||
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
#include "geniconv.h"
|
||||
|
||||
/*#define DEBUG*/
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
# 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: */
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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: */
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef ICONV_H_ /* minimal iconv.h header based on public knowledge */
|
||||
#define ICONV_H_
|
||||
|
||||
#include <stddef.h> /* size_t */
|
||||
#include <errno.h>
|
||||
|
||||
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_ */
|
||||
@@ -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
|
||||
@@ -1,416 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
#include "os2cp.h"
|
||||
|
||||
#ifndef GENICONV_STANDALONE
|
||||
#include "../../../SDL_internal.h"
|
||||
#else
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#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: */
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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: */
|
||||
@@ -1,286 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <uconv.h>
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
#define INCL_DOSSEMAPHORES
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#include "os2cp.h"
|
||||
|
||||
#ifndef GENICONV_STANDALONE
|
||||
#include "../../../SDL_internal.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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: */
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <stdlib.h>
|
||||
#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: */
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#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: */
|
||||
@@ -1,4 +0,0 @@
|
||||
# OpenWatcom exports file for libiconv
|
||||
++'libiconv'.'ICONV2'..'_libiconv'
|
||||
++'libiconv_close'.'ICONV2'..'_libiconv_close'
|
||||
++'libiconv_open'.'ICONV2'..'_libiconv_open'
|
||||
@@ -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 <os2.h>
|
||||
#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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,13 +24,6 @@
|
||||
|
||||
#if SDL_DYNAMIC_API
|
||||
|
||||
#if defined(__OS2__)
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#include <dos.h>
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 <os2.h>
|
||||
#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
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
|
||||
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: */
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
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: */
|
||||
@@ -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
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
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: */
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <os2.h>
|
||||
|
||||
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: */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user