Compare commits

...

11 Commits

Author SHA1 Message Date
Brad Smith
ede668b712 Fixes for BSD build
- patch fixes for BSD handling
- OpenBSD/aarch64 has elf_aux_info()
- unrar build fix for FreeBSD/NetBSD/OpenBSD
- OpenBSD does not have librt

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-25 15:05:32 +00:00
Rafael Kitover
5bd8904746 build: fix check for SDL3 pixel art filter
Fix the CMake compile check for SDL_SCALEMODE_PIXELART to use
CheckSourceCompiles instead of CheckSymbolExists which does not work for
this purpose.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-21 19:33:29 +00:00
Rafael Kitover
46326939eb translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-19 05:00:21 +00:00
Brad Smith
3f005837dd Rename swap16/swap32 functions which conflict with OpenBSD macros 2025-09-19 01:28:30 +00:00
Rafael Kitover
2b3edb266a translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 14:00:23 +00:00
Rafael Kitover
8e5fc43dd6 translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 13:00:23 +00:00
Rafael Kitover
362ca53cbe translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 02:00:23 +00:00
Rafael Kitover
9dc10ff6c4 translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 02:00:07 +00:00
Rafael Kitover
ab01be3373 Add option to enable SDL pixel art texture filter
Add a checkbox in display config to enable SDL_SCALEMODE_PIXELART when
it is available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 01:22:47 +00:00
Rafael Kitover
6ec0ba0610 Apply bilinear option for SDL texture
Set the texture option for bilinear or nearest on the SDL texture
depending on the value of the bilinear checkbox.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-18 01:22:47 +00:00
Rafael Kitover
9fcc0ad7a8 build: fix finding static vcpkg x265 for FFmpeg
Fix finding static vcpkg x265 when it is named `x265-static.lib` as it
is right now.

Fix finding vcpkg host pkgconf on ARM64 Windows, which uses x64 host
binaries.

Remove build environment architecture check, which fails building x64 on
ARM64. That whole file needs to be rewritten to use the compiler target
architecture.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-09-13 20:59:08 -07:00
39 changed files with 5756 additions and 5510 deletions

View File

@@ -2,6 +2,8 @@ if(TRANSLATIONS_ONLY)
return()
endif()
# TODO: Use compiler CPU not CMake.
if(NOT CMAKE_SYSTEM_PROCESSOR)
if(NOT CMAKE_TOOLCHAIN_FILE AND CMAKE_HOST_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
@@ -71,14 +73,6 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
endif()
endif()
if(DEFINED VCPKG_TARGET_TRIPLET)
string(REGEX MATCH "^[^-]+" target_arch ${VCPKG_TARGET_TRIPLET})
if(NOT WINARCH STREQUAL target_arch)
message(FATAL_ERROR "Wrong build environment architecture for VCPKG_TARGET_TRIPLET, you specified ${target_arch} but your compiler is for ${WINARCH}")
endif()
endif()
# We do not support amd64 asm yet
if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX))
message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.")

View File

@@ -97,6 +97,11 @@ endmacro()
# Check for cached results. If there are skip the costly part.
if (NOT FFMPEG_LIBRARIES)
set(x265_lib "x265")
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" AND FFMPEG_STATIC)
set(x265_lib "x265-static")
endif()
# Check for all possible component.
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
@@ -108,7 +113,7 @@ if (NOT FFMPEG_LIBRARIES)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
find_component(X264 x264 x264 x264.h)
find_component(X265 x265 x265 x265.h)
find_component(X265 x265 "${x265_lib}" x265.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach (_component ${FFmpeg_FIND_COMPONENTS})

View File

@@ -40,7 +40,7 @@ if(VBAM_STATIC)
endif()
endif()
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^([xX]86_64|[aA][mM][dD]64)$")
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
set(PKG_CONFIG_EXECUTABLE "$ENV{VCPKG_ROOT}/installed/x64-windows/tools/pkgconf/pkgconf.exe")
endif()
@@ -76,6 +76,18 @@ option(ENABLE_LZMA "Enable LZMA archive support" ON)
if(ENABLE_SDL3)
set(CMAKE_C_FLAGS "-DENABLE_SDL3 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DENABLE_SDL3 ${CMAKE_CXX_FLAGS}")
include(CheckSourceCompiles)
check_source_compiles(CXX
"#include <SDL3/SDL.h>
int main() { return SDL_SCALEMODE_PIXELART; }
" HAVE_SDL_SCALEMODE_PIXELART)
if(HAVE_SDL_SCALEMODE_PIXELART)
set(CMAKE_C_FLAGS "-DHAVE_SDL3_PIXELART ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DHAVE_SDL3_PIXELART ${CMAKE_CXX_FLAGS}")
endif()
endif()
if(DISABLE_OPENGL)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/param.h>
#define fopen64 fopen
#define fseeko64 fseeko
@@ -34,7 +34,7 @@
#include "core/base/file_util.h"
#ifdef __GNUC__
#if defined(__MUSL__) || defined(__APPLE__) || defined(BSD) || defined(__NetBSD__)
#if defined(__MUSL__) || defined(__APPLE__) || defined(BSD)
typedef off_t __off64_t; /* off_t is 64 bits on BSD. */
#define fseeko64 fseeko
#define ftello64 ftello

View File

@@ -37,21 +37,21 @@
#else
// swaps a 16-bit value
static inline uint16_t swap16(uint16_t v)
static inline uint16_t vbswap16(uint16_t v)
{
return (v << 8) | (v >> 8);
}
// swaps a 32-bit value
static inline uint32_t swap32(uint32_t v)
static inline uint32_t vbswap32(uint32_t v)
{
return (v << 24) | ((v << 8) & 0xff0000) | ((v >> 8) & 0xff00) | (v >> 24);
}
#define READ16LE(x) swap16(*((uint16_t *)(x)))
#define READ32LE(x) swap32(*((uint32_t *)(x)))
#define WRITE16LE(x, v) *((uint16_t *)x) = swap16((v))
#define WRITE32LE(x, v) *((uint32_t *)x) = swap32((v))
#define READ16LE(x) vbswap16(*((uint16_t *)(x)))
#define READ32LE(x) vbswap32(*((uint32_t *)(x)))
#define WRITE16LE(x, v) *((uint16_t *)x) = vbswap16((v))
#define WRITE32LE(x, v) *((uint32_t *)x) = vbswap32((v))
#endif
#else
#define READ16LE(x) *((uint16_t *)x)

View File

@@ -877,7 +877,7 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
#ifdef USE_HWCAP
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__OpenBSD__)
static unsigned long MY_getauxval(int aux)
{
unsigned long val;

View File

@@ -129,7 +129,9 @@ wchar etoupperw(wchar ch)
{
if (ch=='i')
return('I');
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__linux__)
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__MINGW32__) || \
defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__)
return(toupper(ch));
#else
return(toupperw(ch));
@@ -234,7 +236,9 @@ bool LowAscii(const wchar *Str)
int wcsicompc(const wchar *Str1,const wchar *Str2)
{
#if defined(_UNIX) || defined(_MSC_VER) || defined(__APPLE__) || defined(__linux__)
#if defined(_UNIX) || defined(_MSC_VER) || defined(__APPLE__) || \
defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__)
return my_wcscmp(Str1,Str2);
#elif defined(__MINGW32__)
return _wcsicmp(Str1,Str2);

View File

@@ -151,6 +151,7 @@ std::array<Option, kNbOptions>& Option::All() {
struct OwnedOptions {
/// Display
bool bilinear = true;
bool sdl_pixel_art = false;
Filter filter = Filter::kNone;
wxString filter_plugin = wxEmptyString;
Interframe interframe = Interframe::kNone;
@@ -280,6 +281,7 @@ std::array<Option, kNbOptions>& Option::All() {
static std::array<Option, kNbOptions> g_all_opts = {
/// Display
Option(OptionID::kDispBilinear, &g_owned_opts.bilinear),
Option(OptionID::kDispSDLPixelArt, &g_owned_opts.sdl_pixel_art),
Option(OptionID::kDispFilter, &g_owned_opts.filter),
Option(OptionID::kDispFilterPlugin, &g_owned_opts.filter_plugin),
Option(OptionID::kDispIFB, &g_owned_opts.interframe),
@@ -427,6 +429,7 @@ namespace internal {
const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
/// Display
OptionData{"Display/Bilinear", "Bilinear", _("Use bilinear filter with 3d renderer")},
OptionData{"Display/SDLPixelArt", "SDLPixelArt", _("Use the SDL pixel art filter with an SDL renderer")},
OptionData{"Display/Filter", "", _("Full-screen filter to apply")},
OptionData{"Display/FilterPlugin", "", _("Filter plugin library")},
OptionData{"Display/IFB", "", _("Interframe blending function")},

View File

@@ -8,6 +8,7 @@ namespace config {
enum class OptionID {
/// Display
kDispBilinear = 0,
kDispSDLPixelArt,
kDispFilter,
kDispFilterPlugin,
kDispIFB,

View File

@@ -12,6 +12,7 @@ namespace config {
static constexpr std::array<Option::Type, kNbOptions> kOptionsTypes = {
/// Display
/*kDispBilinear*/ Option::Type::kBool,
/*kDispSDLPixelArt*/ Option::Type::kBool,
/*kDispFilter*/ Option::Type::kFilter,
/*kDispFilterPlugin*/ Option::Type::kString,
/*kDispIFB*/ Option::Type::kInterframe,

View File

@@ -386,6 +386,14 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
sdlrenderer_selector_ = GetValidatedChild<wxChoice>("SDLRenderer");
sdlrenderer_selector_->SetValidator(SDLDevicesValidator());
#if !defined(ENABLE_SDL3) || !defined(HAVE_SDL3_PIXELART)
GetValidatedChild<wxCheckBox>("SDLPixelArt")->Hide();
#else
GetValidatedChild<wxCheckBox>("SDLPixelArt")
->SetValidator(
widgets::OptionBoolValidator(config::OptionID::kDispSDLPixelArt));
#endif
wxWindow* color_profile_srgb = GetValidatedChild("ColorProfileSRGB");
color_profile_srgb->SetValidator(
ColorCorrectionProfileValidator(config::ColorCorrectionProfile::kSRGB));

View File

@@ -2574,6 +2574,17 @@ SDL_TEXTUREACCESS_STREAMING, (width * scale), (height * scale));
}
#endif
}
// Set bilinear or nearest on the texture.
#ifdef ENABLE_SDL3
#ifdef HAVE_SDL3_PIXELART
SDL_SetTextureScaleMode(texture, OPTION(kDispSDLPixelArt) ? SDL_SCALEMODE_PIXELART : OPTION(kDispBilinear) ? SDL_SCALEMODE_LINEAR : SDL_SCALEMODE_NEAREST);
#else
SDL_SetTextureScaleMode(texture, OPTION(kDispBilinear) ? SDL_SCALEMODE_LINEAR : SDL_SCALEMODE_NEAREST);
#endif
#else
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, OPTION(kDispBilinear) ? "1" : "0");
#endif
did_init = true;
}

View File

@@ -170,6 +170,13 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="SDLPixelArt">
<label>SDL Pixel Art Filter</label>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<cols>2</cols>
<growablecols>1</growablecols>
</object>

View File

@@ -88,7 +88,7 @@ endif()
if(UNIX OR APPLE)
target_link_libraries(sfml-system PRIVATE pthread)
endif()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
target_link_libraries(sfml-system PRIVATE rt)
elseif(WIN32)
target_link_libraries(sfml-system PRIVATE winmm)