Skip to content

Commit a2d3f74

Browse files
committed
platform: MS-DOS port! :)
SDL3 just got MS-DOS support, so here's a quick run at getting DirkSimple running there. I dropped lair.ogv to 320x200 to reduce CPU load, ymmv. ```bash ffmpeg -i lair.ogv -vf "scale=(iw*sar)*min(320/(iw*sar)\,200/ih):ih*min(320/(iw*sar)\,200/ih), pad=320:200:(320-iw*min(320/iw\,200/ih))/2:(200-ih*min(320/iw\,200/ih))/2" output.ogv ``` This command line is from: https://superuser.com/questions/891145/ffmpeg-upscale-and-letterbox-a-video I have no idea if this is a good way to scale the video down. It looks a little blurry, like the quality dropped more than the resolution. I would recommend experimenting with this more.
1 parent 3d5c766 commit a2d3f74

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ CHECK_LIBRARY_EXISTS(m floor "" HAVE_LIB_M)
1919
set(DIRKSIMPLE_SDL_DEFAULT ON)
2020
set(DIRKSIMPLE_LIBRETRO_DEFAULT ON)
2121

22+
if(CMAKE_SYSTEM_NAME STREQUAL "DOS")
23+
set(DOS TRUE)
24+
set(DIRKSIMPLE_LIBRETRO_DEFAULT OFF)
25+
endif()
26+
2227
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
2328
set(EMSCRIPTEN TRUE)
2429
set(IPO_SUPPORTED YES) # !!! FIXME: -flto=thin currently broken in Emscripten: https://github.com/emscripten-core/emscripten/issues/12763
@@ -51,7 +56,7 @@ if(MSVC)
5156
add_definitions(-wd4305) # truncation from double to float
5257
else() # This assumes you have GCC or Clang at the moment.
5358
add_definitions(-Wall)
54-
if(NOT EMSCRIPTEN AND NOT ANDROID)
59+
if(NOT DOS AND NOT EMSCRIPTEN AND NOT ANDROID)
5560
set(USE_PTHREAD TRUE)
5661
endif()
5762
endif()
@@ -60,7 +65,9 @@ add_library(dirksimple-ogg STATIC
6065
thirdparty/libogg/src/bitwise.c
6166
thirdparty/libogg/src/framing.c
6267
)
63-
set_target_properties(dirksimple-ogg PROPERTIES POSITION_INDEPENDENT_CODE ON)
68+
if(NOT DOS)
69+
set_target_properties(dirksimple-ogg PROPERTIES POSITION_INDEPENDENT_CODE ON)
70+
endif()
6471
target_include_directories(dirksimple-ogg PRIVATE
6572
thirdparty/libogg/include
6673
)
@@ -88,7 +95,9 @@ add_library(dirksimple-vorbis STATIC
8895
thirdparty/libvorbis/lib/vorbisfile.c
8996
thirdparty/libvorbis/lib/window.c
9097
)
91-
set_target_properties(dirksimple-vorbis PROPERTIES POSITION_INDEPENDENT_CODE ON)
98+
if(NOT DOS)
99+
set_target_properties(dirksimple-vorbis PROPERTIES POSITION_INDEPENDENT_CODE ON)
100+
endif()
92101
target_include_directories(dirksimple-vorbis PRIVATE
93102
thirdparty/libogg/include
94103
thirdparty/libvorbis/include
@@ -110,7 +119,9 @@ add_library(dirksimple-theora STATIC
110119
thirdparty/libtheora/lib/quant.c
111120
thirdparty/libtheora/lib/state.c
112121
)
113-
set_target_properties(dirksimple-theora PROPERTIES POSITION_INDEPENDENT_CODE ON)
122+
if(NOT DOS)
123+
set_target_properties(dirksimple-theora PROPERTIES POSITION_INDEPENDENT_CODE ON)
124+
endif()
114125
target_include_directories(dirksimple-theora PRIVATE
115126
thirdparty/libogg/include
116127
thirdparty/libtheora/include
@@ -119,7 +130,9 @@ target_include_directories(dirksimple-theora PRIVATE
119130
add_library(dirksimple-theoraplay STATIC
120131
thirdparty/theoraplay/theoraplay.c
121132
)
122-
set_target_properties(dirksimple-theoraplay PROPERTIES POSITION_INDEPENDENT_CODE ON)
133+
if(NOT DOS)
134+
set_target_properties(dirksimple-theoraplay PROPERTIES POSITION_INDEPENDENT_CODE ON)
135+
endif()
123136
target_include_directories(dirksimple-theoraplay PRIVATE
124137
thirdparty/libogg/include
125138
thirdparty/libvorbis/include
@@ -131,8 +144,9 @@ target_compile_definitions(dirksimple-theoraplay PRIVATE "-DTHEORAPLAY_NO_FOPEN_
131144
add_library(dirksimple-lodepng STATIC
132145
thirdparty/lodepng/lodepng.c
133146
)
134-
set_target_properties(dirksimple-lodepng PROPERTIES POSITION_INDEPENDENT_CODE ON)
135-
147+
if(NOT DOS)
148+
set_target_properties(dirksimple-lodepng PROPERTIES POSITION_INDEPENDENT_CODE ON)
149+
endif()
136150
add_library(dirksimple-lua STATIC
137151
thirdparty/lua/src/lapi.c
138152
thirdparty/lua/src/ldebug.c
@@ -167,8 +181,11 @@ add_library(dirksimple-lua STATIC
167181
thirdparty/lua/src/lcorolib.c
168182
thirdparty/lua/src/loadlib.c
169183
)
170-
set_target_properties(dirksimple-lua PROPERTIES POSITION_INDEPENDENT_CODE ON)
171-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
184+
if(NOT DOS)
185+
set_target_properties(dirksimple-lua PROPERTIES POSITION_INDEPENDENT_CODE ON)
186+
endif()
187+
188+
if(NOT DOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
172189
target_compile_definitions(dirksimple-lua PRIVATE "-DLUA_USE_POSIX=1")
173190
endif()
174191

@@ -199,6 +216,9 @@ if(DIRKSIMPLE_SDL)
199216
if(HAVE_LIB_M)
200217
target_link_libraries(dirksimple m)
201218
endif()
219+
if(DOS)
220+
set_target_properties(dirksimple PROPERTIES OUTPUT_NAME "DIRKSIMP") # 8.3 file names!
221+
endif()
202222
if(EMSCRIPTEN)
203223
set_target_properties(dirksimple PROPERTIES OUTPUT_NAME "dirksimple-wasm")
204224
set_target_properties(dirksimple PROPERTIES LINK_FLAGS "${IPO_FLAG} -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s EXPORTED_RUNTIME_METHODS=['addRunDependency','removeRunDependency'] -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall']")

dirksimple_platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
3333
#define DIRKSIMPLE_MULTITHREADED 0
34+
#elif defined(DJGPP)
35+
#define DIRKSIMPLE_MULTITHREADED 0
3436
#else
3537
#define DIRKSIMPLE_MULTITHREADED 1
3638
#endif

thirdparty/libogg/include/ogg/os_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115

116116
/* DJGPP */
117117
typedef short ogg_int16_t;
118+
typedef unsigned short ogg_uint16_t;
118119
typedef int ogg_int32_t;
119120
typedef unsigned int ogg_uint32_t;
120121
typedef long long ogg_int64_t;

thirdparty/theoraplay/theoraplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define THEORAPLAY_THREAD_T HANDLE
2121
#define THEORAPLAY_MUTEX_T HANDLE
2222
#define sleepms(x) Sleep(x)
23-
#elif defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
23+
#elif defined(DJGPP) || (defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__))
2424
#define THEORAPLAY_ONLY_SINGLE_THREADED 1
2525
#define THEORAPLAY_THREAD_T int
2626
#define THEORAPLAY_MUTEX_T int

0 commit comments

Comments
 (0)