From cae343b20d79c51eb8ca76227dffef8ec2217d15 Mon Sep 17 00:00:00 2001 From: Andreas T Jonsson Date: Fri, 11 Oct 2024 19:15:48 +0200 Subject: [PATCH] Added SDL3 frontend --- front/{sdl => sdl2}/docopt.c | 0 front/{sdl => sdl2}/docopt.h | 0 front/{sdl => sdl2}/icons.h | 0 front/{sdl => sdl2}/keys.h | 0 front/{sdl => sdl2}/main.c | 0 front/{sdl => sdl2}/mu_atlas.inl | 0 front/{sdl => sdl2}/mu_renderer.c | 0 front/{sdl => sdl2}/mu_renderer.h | 0 front/{sdl => sdl2}/virtualxt.docopt | 0 front/{sdl => sdl2}/window.c | 0 front/{sdl => sdl2}/window.h | 0 front/sdl3/main.c | 27 +++++++++++++++ front/sdl3/virtualxt.docopt | 20 +++++++++++ premake5.lua | 52 +++++++++++++++++++++++++++- 14 files changed, 98 insertions(+), 1 deletion(-) rename front/{sdl => sdl2}/docopt.c (100%) rename front/{sdl => sdl2}/docopt.h (100%) rename front/{sdl => sdl2}/icons.h (100%) rename front/{sdl => sdl2}/keys.h (100%) rename front/{sdl => sdl2}/main.c (100%) rename front/{sdl => sdl2}/mu_atlas.inl (100%) rename front/{sdl => sdl2}/mu_renderer.c (100%) rename front/{sdl => sdl2}/mu_renderer.h (100%) rename front/{sdl => sdl2}/virtualxt.docopt (100%) rename front/{sdl => sdl2}/window.c (100%) rename front/{sdl => sdl2}/window.h (100%) create mode 100644 front/sdl3/main.c create mode 100644 front/sdl3/virtualxt.docopt diff --git a/front/sdl/docopt.c b/front/sdl2/docopt.c similarity index 100% rename from front/sdl/docopt.c rename to front/sdl2/docopt.c diff --git a/front/sdl/docopt.h b/front/sdl2/docopt.h similarity index 100% rename from front/sdl/docopt.h rename to front/sdl2/docopt.h diff --git a/front/sdl/icons.h b/front/sdl2/icons.h similarity index 100% rename from front/sdl/icons.h rename to front/sdl2/icons.h diff --git a/front/sdl/keys.h b/front/sdl2/keys.h similarity index 100% rename from front/sdl/keys.h rename to front/sdl2/keys.h diff --git a/front/sdl/main.c b/front/sdl2/main.c similarity index 100% rename from front/sdl/main.c rename to front/sdl2/main.c diff --git a/front/sdl/mu_atlas.inl b/front/sdl2/mu_atlas.inl similarity index 100% rename from front/sdl/mu_atlas.inl rename to front/sdl2/mu_atlas.inl diff --git a/front/sdl/mu_renderer.c b/front/sdl2/mu_renderer.c similarity index 100% rename from front/sdl/mu_renderer.c rename to front/sdl2/mu_renderer.c diff --git a/front/sdl/mu_renderer.h b/front/sdl2/mu_renderer.h similarity index 100% rename from front/sdl/mu_renderer.h rename to front/sdl2/mu_renderer.h diff --git a/front/sdl/virtualxt.docopt b/front/sdl2/virtualxt.docopt similarity index 100% rename from front/sdl/virtualxt.docopt rename to front/sdl2/virtualxt.docopt diff --git a/front/sdl/window.c b/front/sdl2/window.c similarity index 100% rename from front/sdl/window.c rename to front/sdl2/window.c diff --git a/front/sdl/window.h b/front/sdl2/window.h similarity index 100% rename from front/sdl/window.h rename to front/sdl2/window.h diff --git a/front/sdl3/main.c b/front/sdl3/main.c new file mode 100644 index 00000000..eda796ba --- /dev/null +++ b/front/sdl3/main.c @@ -0,0 +1,27 @@ +// Copyright (c) 2019-2024 Andreas T Jonsson +// +// 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 (see the following) in the product +// documentation is required. +// +// This product make use of the VirtualXT software emulator. +// Visit https://virtualxt.org for more information. +// +// 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. + +int main(int argc, char *argv[]) { + (void)argc; (void)argv; + return 0; +} diff --git a/front/sdl3/virtualxt.docopt b/front/sdl3/virtualxt.docopt new file mode 100644 index 00000000..d5bdfcc9 --- /dev/null +++ b/front/sdl3/virtualxt.docopt @@ -0,0 +1,20 @@ +Usage: virtualxt [options] + +Options: + -h --help Show this screen. + -v --version Display version. + --hdboot Prefer booting from harddrive. + --halt Debug break on startup. + --mute Disable audio. + --a20 Enable support for A20 line. + --no-activity Disable disk activity indicator. + --no-idle Disable CPU idle on INT28. + --clean Remove config file and write a new default one. + --edit Open config file in system text editor. + --locate Locate the configuration directory. + --rifs=PATH Share directory with guest OS via RIFS. (Experimental) + --config=PATH Set config directory. + --trace=FILE Write CPU trace to file. + --frequency=MHZ CPU frequency. [default: 10.0] + -a --floppy=FILE Mount floppy image as drive A. + -c --harddrive=FILE Mount harddrive image as drive C. diff --git a/premake5.lua b/premake5.lua index 4b0123f6..f1a7f747 100644 --- a/premake5.lua +++ b/premake5.lua @@ -327,7 +327,7 @@ workspace "virtualxt" end end - files { "front/sdl/*.h", "front/sdl/*.c" } + files { "front/sdl2/*.h", "front/sdl2/*.c" } includedirs { "lib/vxt/include", "lib/inih", "lib/microui/src", "front/common" } links { "vxt", "inih", "microui" } @@ -359,7 +359,57 @@ workspace "virtualxt" filter "toolset:gcc" buildoptions { "-Wno-uninitialized", "-Wno-missing-field-initializers", "-Wno-missing-braces" } + + project "sdl3-frontend" + kind "ConsoleApp" + targetname "virtualxt" + targetdir "build/sdl3" + + files "modules/modules.h" + includedirs "modules" + + if not _OPTIONS["no-modules"] then + if _OPTIONS["dynamic"] then + dependson "modules" + else + links(modules) + for _,f in ipairs(modules_link_callback) do + f() + filter {} + end + end + end + + files { "front/sdl3/*.h", "front/sdl3/*.c" } + includedirs { "lib/vxt/include", "lib/inih", "lib/microui/src", "front/common" } + links { "vxt", "inih", "microui" } + + cleancommands { + "{RMDIR} build/sdl3", + "make clean %{cfg.buildcfg}" + } + + filter "action:vs*" + libdirs { path.join(_OPTIONS["sdl-config"], "lib", "x64") } + includedirs { path.join(_OPTIONS["sdl-config"], "include") } + links { "SDL3", "SDL3main" } + + filter "not action:vs*" + local sdl_cfg = path.join(_OPTIONS["sdl-config"], "sdl3-config") + buildoptions { string.format("`%s --cflags`", sdl_cfg) } + linkoptions { string.format("`%s --libs`", sdl_cfg) } + filter "toolset:clang or gcc" + links "m" + buildoptions "-Wno-unused-parameter" + linkoptions "-Wl,-rpath,'$$ORIGIN'/../lib" + + filter "toolset:clang" + buildoptions { "-Wno-missing-field-initializers", "-Wno-missing-braces" } + + filter "toolset:gcc" + buildoptions { "-Wno-uninitialized", "-Wno-missing-field-initializers", "-Wno-missing-braces" } + project "terminal-frontend" kind "ConsoleApp" targetname "vxterm"