Skip to content

Commit 237a0b3

Browse files
committed
Fix DOS platform comments and workarounds for DJGPP support
1 parent 2e33176 commit 237a0b3

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3724,7 +3724,7 @@ if(NOT HAVE_SDL_THREADS)
37243724
endif()
37253725
endif()
37263726
if(NOT HAVE_SDL_TIMERS)
3727-
# message(FATAL_ERROR "Timers are needed by many SDL subsystems and may not be disabled")
3727+
message(FATAL_ERROR "Timers are needed by many SDL subsystems and may not be disabled")
37283728
endif()
37293729

37303730
# Most platforms use this.

src/dynapi/SDL_dynapi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
#define SDL_DYNAMIC_API 0 // devkitARM doesn't support dynamic linking
6666
#elif defined(SDL_PLATFORM_NGAGE)
6767
#define SDL_DYNAMIC_API 0
68-
#elif defined(SDL_PLATFORM_DOS) // !!! FIXME: maybe with DXE3 support...
69-
#define SDL_DYNAMIC_API 0
68+
#elif defined(SDL_PLATFORM_DOS)
69+
#define SDL_DYNAMIC_API 0 // DJGPP doesn't support dynamic linking
7070
#elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN)
7171
#define SDL_DYNAMIC_API 0 // we need dlopen(), but don't have it....
7272
#endif

src/io/SDL_iostream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, SDL_IOWhence whe
751751
const bool is_noop = (whence == SDL_IO_SEEK_CUR) && (offset == 0);
752752

753753
if (is_noop || fseek(iodata->fp, (fseek_off_t)offset, stdiowhence) == 0) {
754-
#ifdef SDL_PLATFORM_DOS // !!! FIXME: I don't know know why, but seeking seems to be broken in djgpp if buffering is enabled. Dump the buffer and recreate it for now.
754+
#ifdef SDL_PLATFORM_DOS // DJGPP libc bug: fseek doesn't invalidate the read buffer, so subsequent reads return stale data. Flush and recreate the buffer as a workaround.
755755
setvbuf(iodata->fp, NULL, _IONBF, 0);
756756
setvbuf(iodata->fp, NULL, _IOFBF, 16 * 1024);
757757
#endif

src/timer/dos/SDL_systimer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void SDL_SYS_DelayNS(Uint64 ns)
6363
}
6464
DOS_Yield();
6565
delay(chunk);
66+
DOS_Yield();
6667
ms -= chunk;
6768
}
6869
ns -= (Uint64)((Uint32)(ns / SDL_NS_PER_MS)) * SDL_NS_PER_MS;

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ function(add_sdl_test_executable TARGET)
151151
SDL_AddCommonCompilerFlags(${TARGET})
152152
target_include_directories(${TARGET} PRIVATE "${SDL3_SOURCE_DIR}/src/video/khronos")
153153
target_link_libraries(${TARGET} PRIVATE SDL3::SDL3_test SDL3::${sdl_name_component})
154-
155154
if(AST_DEPENDS)
156155
add_dependencies(${TARGET} ${AST_DEPENDS})
157156
endif()

0 commit comments

Comments
 (0)