This commit is contained in:
Anonymous Maarten 2026-06-05 10:43:21 +08:00 committed by GitHub
commit 787ca8341f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 243 additions and 16 deletions

View file

@ -286,7 +286,7 @@ SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
/* Byte swap 32-bit integer. */
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
#if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x)
#define SDL_Swap32(x) (Uint32)__builtin_bswap32(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)

View file

@ -220,6 +220,7 @@
void reset_IOP() {}
#elif defined(SDL_PLATFORM_DOS)
/*
On DOS, SDL provides a main function that sets up memory
page locking (code, data, stack are locked, future

View file

@ -148,4 +148,116 @@
#endif /* SDL_MAIN_HANDLED */
#ifdef SDL_PLATFORM_DOS
/* On DOS, the executable must export symbols for the SDL3 module.
*/
#define FOR_EACH_DXE_EXPORT(X) \
X(__Exit) \
X(___dj_huge_val) \
X(___dj_stderr) \
X(___dj_stdin) \
X(___djgpp_base_address) \
X(___djgpp_nearptr_enable) \
X(___dpmi_free_physical_address_mapping) \
X(___dpmi_int) \
X(___dpmi_physical_address_mapping) \
X(___dpmi_simulate_real_mode_procedure_retf) \
X(___fpclassifyd) \
X(___fpclassifyf) \
X(__go32_dpmi_allocate_dos_memory) \
X(__go32_dpmi_chain_protected_mode_interrupt_vector) \
X(__go32_dpmi_free_dos_memory) \
X(__go32_dpmi_get_protected_mode_interrupt_vector) \
X(__go32_dpmi_lock_code) \
X(__go32_dpmi_lock_data) \
X(__go32_dpmi_set_protected_mode_interrupt_vector) \
X(__go32_info_block) \
X(_abort) \
X(_atof) \
X(_atoi) \
X(_calloc) \
X(_clearerr) \
X(_close) \
X(_closedir) \
X(_delay) \
X(_dlregsym) \
X(_dosmemput) \
X(_environ) \
X(_errno) \
X(_fclose) \
X(_ferror) \
X(_fflush) \
X(_fgets) \
X(_fileno) \
X(_fopen) \
X(_fprintf) \
X(_fputs) \
X(_fread) \
X(_free) \
X(_fseeko) \
X(_fstat) \
X(_ftello) \
X(_fwrite) \
X(_getcwd) \
X(_getenv) \
X(_gethostname) \
X(_getpagesize) \
X(_gettimeofday) \
X(_gmtime_r) \
X(_itoa) \
X(_localtime_r) \
X(_longjmp) \
X(_lseek) \
X(_malloc) \
X(_memcmp) \
X(_memcpy) \
X(_memmove) \
X(_mkdir) \
X(_opendir) \
X(_read) \
X(_readdir) \
X(_realloc) \
X(_remove) \
X(_rename) \
X(_searchpath) \
X(_setenv) \
X(_setjmp) \
X(_sigaction) \
X(_stat) \
X(_strchr) \
X(_strcmp) \
X(_strerror) \
X(_strlcat) \
X(_strlcpy) \
X(_strlen) \
X(_strncmp) \
X(_strnlen) \
X(_strpbrk) \
X(_strrchr) \
X(_strstr) \
X(_strtod) \
X(_strtok_r) \
X(_strtol) \
X(_strtoll) \
X(_strtoul) \
X(_strtoull) \
X(_uclock) \
X(_unsetenv) \
X(_vsnprintf) \
X(_vsscanf) \
X(_write)
#define EXTERN_ASM_SEMICOLON(V) extern_asm(V);
#include <sys/dxe.h>
FOR_EACH_DXE_EXPORT(EXTERN_ASM_SEMICOLON)
DXE_EXPORT_TABLE(sdl3_export_syms)
FOR_EACH_DXE_EXPORT(DXE_EXPORT_ASM)
DXE_EXPORT_END
static __attribute__((constructor)) void sdl3_export_syms_auto_register (void)
{
dlregsym (sdl3_export_syms);
}
#endif
#endif /* SDL_main_impl_h_ */