mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 11:28:15 +00:00
Compare commits
80 Commits
SDL2
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5d24957039 | ||
![]() |
fd5dcfba03 | ||
![]() |
5806036c68 | ||
![]() |
9f369a1736 | ||
![]() |
1f6e0e3a23 | ||
![]() |
c8e984701e | ||
![]() |
2a506c8778 | ||
![]() |
a455f023c2 | ||
![]() |
2a10b8c4e7 | ||
![]() |
f610a3d66b | ||
![]() |
54772f345a | ||
![]() |
e257904eb3 | ||
![]() |
cc7a73e727 | ||
![]() |
9f1cc301a7 | ||
![]() |
e321995244 | ||
![]() |
28e9533d34 | ||
![]() |
f9fc36be9e | ||
![]() |
f8119d4760 | ||
![]() |
1b35c66aa8 | ||
![]() |
553ea4e4ee | ||
![]() |
c438953aa2 | ||
![]() |
6e77327789 | ||
![]() |
e25c61cda8 | ||
![]() |
28f2944947 | ||
![]() |
ab9f59e59a | ||
![]() |
f99f57ffd1 | ||
![]() |
7f371c7808 | ||
![]() |
d98087a0c3 | ||
![]() |
933715fa45 | ||
![]() |
73492c5570 | ||
![]() |
19fc5c2953 | ||
![]() |
c2a62ee696 | ||
![]() |
c1b8ac9764 | ||
![]() |
7a43692bdf | ||
![]() |
99ad0871b1 | ||
![]() |
f901079dd5 | ||
![]() |
98d1f3a45a | ||
![]() |
1226e6b2bc | ||
![]() |
213b074697 | ||
![]() |
4177e06c09 | ||
![]() |
4318013777 | ||
![]() |
3364486f56 | ||
![]() |
dc69988fdf | ||
![]() |
4ed1fc5bff | ||
![]() |
84081d884b | ||
![]() |
a5fad8b0cb | ||
![]() |
6510d6ccbf | ||
![]() |
b0b50da4b6 | ||
![]() |
8b7a088efc | ||
![]() |
7fc5edab8e | ||
![]() |
24ccde693e | ||
![]() |
f46ef5d76d | ||
![]() |
5696677558 | ||
![]() |
093307f1f4 | ||
![]() |
f54014e173 | ||
![]() |
64ad33884d | ||
![]() |
2359383fc1 | ||
![]() |
b2a95b2482 | ||
![]() |
2708e08f40 | ||
![]() |
3f6efbf2df | ||
![]() |
9b048e73a2 | ||
![]() |
d3bb91522f | ||
![]() |
c8c4c97727 | ||
![]() |
f08a5cfcab | ||
![]() |
e9d2f60e1c | ||
![]() |
9e079fe9c7 | ||
![]() |
53c022c880 | ||
![]() |
e11183ea6c | ||
![]() |
024c27645a | ||
![]() |
c2047f0496 | ||
![]() |
220895d4d2 | ||
![]() |
282f7a84fc | ||
![]() |
9be8c2a899 | ||
![]() |
51e20f1666 | ||
![]() |
a34c8403e7 | ||
![]() |
dc74448014 | ||
![]() |
155f99a4e6 | ||
![]() |
63bb1a8583 | ||
![]() |
8b0c9e1dce | ||
![]() |
7f74c1ed63 |
@@ -23,8 +23,7 @@ manpageheaderfiletext = Defined in %fname%
|
|||||||
# A handful of others we fix up in the header itself with /* WIKI CATEGORY: x */ comments.
|
# A handful of others we fix up in the header itself with /* WIKI CATEGORY: x */ comments.
|
||||||
headercategoryeval = s/\ASDL_config_.*?\.h\Z//; s/\ASDL_test_.*?\.h\Z//; s/\ASDL_?(.*?)\.h\Z/$1/; ucfirst();
|
headercategoryeval = s/\ASDL_config_.*?\.h\Z//; s/\ASDL_test_.*?\.h\Z//; s/\ASDL_?(.*?)\.h\Z/$1/; ucfirst();
|
||||||
|
|
||||||
# !!! FIXME: maybe later, but there are probably documentation gaps to fix first.
|
quickrefenabled = 0 # !!! FIXME: maybe later, but there are probably documentation gaps to fix first.
|
||||||
quickrefenabled = 0
|
|
||||||
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gesture,GameController,Joystick,Haptic,Audio,Timer,Render,LoadSO,Thread,Mutex,Atomic,Filesystem,RWOPS,Pixels,Surface,Blendmode,Rect,Clipboard,Messagebox,Vulkan,Metal,Platform,Power,Sensor,Bits,Endian,Assert,CPUInfo,Locale,System,Misc,GUID,Main,Stdinc
|
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gesture,GameController,Joystick,Haptic,Audio,Timer,Render,LoadSO,Thread,Mutex,Atomic,Filesystem,RWOPS,Pixels,Surface,Blendmode,Rect,Clipboard,Messagebox,Vulkan,Metal,Platform,Power,Sensor,Bits,Endian,Assert,CPUInfo,Locale,System,Misc,GUID,Main,Stdinc
|
||||||
quickreftitle = SDL2 API Quick Reference
|
quickreftitle = SDL2 API Quick Reference
|
||||||
quickrefurl = https://libsdl.org/
|
quickrefurl = https://libsdl.org/
|
||||||
|
@@ -88,8 +88,8 @@ endif()
|
|||||||
|
|
||||||
# See docs/release_checklist.md
|
# See docs/release_checklist.md
|
||||||
set(SDL_MAJOR_VERSION 2)
|
set(SDL_MAJOR_VERSION 2)
|
||||||
set(SDL_MINOR_VERSION 33)
|
set(SDL_MINOR_VERSION 32)
|
||||||
set(SDL_MICRO_VERSION 0)
|
set(SDL_MICRO_VERSION 10)
|
||||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||||
|
|
||||||
# Set defaults preventing destination file conflicts
|
# Set defaults preventing destination file conflicts
|
||||||
|
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
LIBNAME = SDL2
|
LIBNAME = SDL2
|
||||||
MAJOR_VERSION = 2
|
MAJOR_VERSION = 2
|
||||||
MINOR_VERSION = 33
|
MINOR_VERSION = 32
|
||||||
MICRO_VERSION = 0
|
MICRO_VERSION = 10
|
||||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||||
DESCRIPTION = Simple DirectMedia Layer 2
|
DESCRIPTION = Simple DirectMedia Layer 2
|
||||||
|
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
LIBNAME = SDL2
|
LIBNAME = SDL2
|
||||||
MAJOR_VERSION = 2
|
MAJOR_VERSION = 2
|
||||||
MINOR_VERSION = 33
|
MINOR_VERSION = 32
|
||||||
MICRO_VERSION = 0
|
MICRO_VERSION = 10
|
||||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||||
|
|
||||||
LIBHOME = .
|
LIBHOME = .
|
||||||
|
@@ -371,7 +371,6 @@
|
|||||||
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
|
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
|
||||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
<WindowsTargetPlatformMinVersion>10.0.0.0</WindowsTargetPlatformMinVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@@ -392,7 +391,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
@@ -604,4 +603,4 @@
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.33.0</string>
|
<string>2.32.10</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>SDLX</string>
|
<string>SDLX</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2.33.0</string>
|
<string>2.32.10</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@@ -9728,8 +9728,8 @@
|
|||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEPLOYMENT_POSTPROCESSING = YES;
|
DEPLOYMENT_POSTPROCESSING = YES;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 3301.0.0;
|
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||||
DYLIB_CURRENT_VERSION = 3301.0.0;
|
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||||
@@ -9770,7 +9770,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||||
MARKETING_VERSION = 2.33.0;
|
MARKETING_VERSION = 2.32.10;
|
||||||
OTHER_LDFLAGS = "-liconv";
|
OTHER_LDFLAGS = "-liconv";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@@ -9813,8 +9813,8 @@
|
|||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 3301.0.0;
|
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||||
DYLIB_CURRENT_VERSION = 3301.0.0;
|
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
@@ -9856,7 +9856,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||||
MARKETING_VERSION = 2.33.0;
|
MARKETING_VERSION = 2.32.10;
|
||||||
OTHER_LDFLAGS = "-liconv";
|
OTHER_LDFLAGS = "-liconv";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@@ -10062,8 +10062,8 @@
|
|||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 3301.0.0;
|
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||||
DYLIB_CURRENT_VERSION = 3301.0.0;
|
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
@@ -10114,8 +10114,8 @@
|
|||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 3301.0.0;
|
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
|
||||||
DYLIB_CURRENT_VERSION = 3301.0.0;
|
DYLIB_CURRENT_VERSION = 3201.10.0;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Title SDL 2.33.0
|
Title SDL 2.32.10
|
||||||
Version 1
|
Version 1
|
||||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||||
DefaultLocation /Library/Frameworks
|
DefaultLocation /Library/Frameworks
|
||||||
|
@@ -60,8 +60,8 @@ import java.util.Locale;
|
|||||||
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
||||||
private static final String TAG = "SDL";
|
private static final String TAG = "SDL";
|
||||||
private static final int SDL_MAJOR_VERSION = 2;
|
private static final int SDL_MAJOR_VERSION = 2;
|
||||||
private static final int SDL_MINOR_VERSION = 33;
|
private static final int SDL_MINOR_VERSION = 32;
|
||||||
private static final int SDL_MICRO_VERSION = 0;
|
private static final int SDL_MICRO_VERSION = 10;
|
||||||
/*
|
/*
|
||||||
// Display InputType.SOURCE/CLASS of events and devices
|
// Display InputType.SOURCE/CLASS of events and devices
|
||||||
//
|
//
|
||||||
|
@@ -37,8 +37,6 @@ logger = logging.getLogger(__name__)
|
|||||||
GIT_HASH_FILENAME = ".git-hash"
|
GIT_HASH_FILENAME = ".git-hash"
|
||||||
REVISION_TXT = "REVISION.txt"
|
REVISION_TXT = "REVISION.txt"
|
||||||
|
|
||||||
RE_ILLEGAL_MINGW_LIBRARIES = re.compile(r"(?:lib)?(?:gcc|(?:std)?c[+][+]|(?:win)?pthread).*", flags=re.I)
|
|
||||||
|
|
||||||
|
|
||||||
def safe_isotime_to_datetime(str_isotime: str) -> datetime.datetime:
|
def safe_isotime_to_datetime(str_isotime: str) -> datetime.datetime:
|
||||||
try:
|
try:
|
||||||
@@ -341,12 +339,6 @@ class ArchiveFileTree:
|
|||||||
def add_file(self, file: NodeInArchive):
|
def add_file(self, file: NodeInArchive):
|
||||||
self._tree[file.arcpath] = file
|
self._tree[file.arcpath] = file
|
||||||
|
|
||||||
def __iter__(self) -> typing.Iterable[NodeInArchive]:
|
|
||||||
yield from self._tree.values()
|
|
||||||
|
|
||||||
def __contains__(self, value: str) -> bool:
|
|
||||||
return value in self._tree
|
|
||||||
|
|
||||||
def get_latest_mod_time(self) -> datetime.datetime:
|
def get_latest_mod_time(self) -> datetime.datetime:
|
||||||
return max(item.time for item in self._tree.values() if item.time)
|
return max(item.time for item in self._tree.values() if item.time)
|
||||||
|
|
||||||
@@ -534,16 +526,6 @@ class SourceCollector:
|
|||||||
return path_times
|
return path_times
|
||||||
|
|
||||||
|
|
||||||
class AndroidApiVersion:
|
|
||||||
def __init__(self, name: str, ints: tuple[int, ...]):
|
|
||||||
self.name = name
|
|
||||||
self.ints = ints
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>"
|
|
||||||
|
|
||||||
ANDROID_ABI_EXTRA_LINK_OPTIONS = {}
|
|
||||||
|
|
||||||
class Releaser:
|
class Releaser:
|
||||||
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
|
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
|
||||||
self.release_info = release_info
|
self.release_info = release_info
|
||||||
@@ -604,22 +586,12 @@ class Releaser:
|
|||||||
def create_source_archives(self) -> None:
|
def create_source_archives(self) -> None:
|
||||||
source_collector = SourceCollector(root=self.root, commit=self.commit, executer=self.executer, filter=self._path_filter)
|
source_collector = SourceCollector(root=self.root, commit=self.commit, executer=self.executer, filter=self._path_filter)
|
||||||
print(f"Collecting sources of {self.project}...")
|
print(f"Collecting sources of {self.project}...")
|
||||||
archive_tree: ArchiveFileTree = source_collector.get_archive_file_tree()
|
archive_tree = source_collector.get_archive_file_tree()
|
||||||
latest_mod_time = archive_tree.get_latest_mod_time()
|
latest_mod_time = archive_tree.get_latest_mod_time()
|
||||||
archive_tree.add_file(NodeInArchive.from_text(arcpath=REVISION_TXT, text=f"{self.revision}\n", time=latest_mod_time))
|
archive_tree.add_file(NodeInArchive.from_text(arcpath=REVISION_TXT, text=f"{self.revision}\n", time=latest_mod_time))
|
||||||
archive_tree.add_file(NodeInArchive.from_text(arcpath=f"{GIT_HASH_FILENAME}", text=f"{self.commit}\n", time=latest_mod_time))
|
archive_tree.add_file(NodeInArchive.from_text(arcpath=f"{GIT_HASH_FILENAME}", text=f"{self.commit}\n", time=latest_mod_time))
|
||||||
archive_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["source"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=latest_mod_time)
|
archive_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["source"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=latest_mod_time)
|
||||||
|
|
||||||
if "Makefile.am" in archive_tree:
|
|
||||||
patched_time = latest_mod_time + datetime.timedelta(minutes=1)
|
|
||||||
print(f"Makefile.am detected -> touching aclocal.m4, */Makefile.in, configure")
|
|
||||||
for node_data in archive_tree:
|
|
||||||
arc_name = os.path.basename(node_data.arcpath)
|
|
||||||
arc_name_we, arc_name_ext = os.path.splitext(arc_name)
|
|
||||||
if arc_name in ("aclocal.m4", "configure", "Makefile.in"):
|
|
||||||
print(f"Bumping time of {node_data.arcpath}")
|
|
||||||
node_data.time = patched_time
|
|
||||||
|
|
||||||
archive_base = f"{self.project}-{self.version}"
|
archive_base = f"{self.project}-{self.version}"
|
||||||
zip_path = self.dist_path / f"{archive_base}.zip"
|
zip_path = self.dist_path / f"{archive_base}.zip"
|
||||||
tgz_path = self.dist_path / f"{archive_base}.tar.gz"
|
tgz_path = self.dist_path / f"{archive_base}.tar.gz"
|
||||||
@@ -696,15 +668,6 @@ class Releaser:
|
|||||||
def git_hash_data(self) -> bytes:
|
def git_hash_data(self) -> bytes:
|
||||||
return f"{self.commit}\n".encode()
|
return f"{self.commit}\n".encode()
|
||||||
|
|
||||||
def verify_mingw_library(self, triplet: str, path: Path):
|
|
||||||
objdump_output = self.executer.check_output([f"{triplet}-objdump", "-p", str(path)])
|
|
||||||
libraries = re.findall(r"DLL Name: ([^\n]+)", objdump_output)
|
|
||||||
logger.info("%s (%s) libraries: %r", path, triplet, libraries)
|
|
||||||
illegal_libraries = list(filter(RE_ILLEGAL_MINGW_LIBRARIES.match, libraries))
|
|
||||||
logger.error("Detected 'illegal' libraries: %r", illegal_libraries)
|
|
||||||
if illegal_libraries:
|
|
||||||
raise Exception(f"{path} links to illegal libraries: {illegal_libraries}")
|
|
||||||
|
|
||||||
def create_mingw_archives(self) -> None:
|
def create_mingw_archives(self) -> None:
|
||||||
build_type = "Release"
|
build_type = "Release"
|
||||||
build_parent_dir = self.root / "build-mingw"
|
build_parent_dir = self.root / "build-mingw"
|
||||||
@@ -801,6 +764,7 @@ class Releaser:
|
|||||||
f"--includedir=${{prefix}}/include",
|
f"--includedir=${{prefix}}/include",
|
||||||
f"--libdir=${{prefix}}/lib",
|
f"--libdir=${{prefix}}/lib",
|
||||||
f"--bindir=${{prefix}}/bin",
|
f"--bindir=${{prefix}}/bin",
|
||||||
|
f"--exec-prefix=${{prefix}}/bin",
|
||||||
f"--host={triplet}",
|
f"--host={triplet}",
|
||||||
f"--build=x86_64-none-linux-gnu",
|
f"--build=x86_64-none-linux-gnu",
|
||||||
"CFLAGS=-O2",
|
"CFLAGS=-O2",
|
||||||
@@ -808,10 +772,9 @@ class Releaser:
|
|||||||
"LDFLAGS=-Wl,-s",
|
"LDFLAGS=-Wl,-s",
|
||||||
] + extra_args, cwd=build_path, env=new_env)
|
] + extra_args, cwd=build_path, env=new_env)
|
||||||
with self.section_printer.group(f"Build MinGW {triplet} (autotools)"):
|
with self.section_printer.group(f"Build MinGW {triplet} (autotools)"):
|
||||||
self.executer.run(["make", f"-j{self.cpu_count}"], cwd=build_path, env=new_env)
|
self.executer.run(["make", "V=1", f"-j{self.cpu_count}"], cwd=build_path, env=new_env)
|
||||||
with self.section_printer.group(f"Install MinGW {triplet} (autotools)"):
|
with self.section_printer.group(f"Install MinGW {triplet} (autotools)"):
|
||||||
self.executer.run(["make", "install"], cwd=build_path, env=new_env)
|
self.executer.run(["make", "install"], cwd=build_path, env=new_env)
|
||||||
self.verify_mingw_library(triplet=ARCH_TO_TRIPLET[arch], path=install_path / "bin" / f"{self.project}.dll")
|
|
||||||
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
|
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
|
||||||
|
|
||||||
print("Recording arch-dependent extra files for MinGW development archive ...")
|
print("Recording arch-dependent extra files for MinGW development archive ...")
|
||||||
@@ -867,7 +830,6 @@ class Releaser:
|
|||||||
self.executer.run(["cmake", "--build", str(build_path), "--verbose", "--config", build_type], cwd=build_path, env=new_env)
|
self.executer.run(["cmake", "--build", str(build_path), "--verbose", "--config", build_type], cwd=build_path, env=new_env)
|
||||||
with self.section_printer.group(f"Install MinGW {triplet} (CMake)"):
|
with self.section_printer.group(f"Install MinGW {triplet} (CMake)"):
|
||||||
self.executer.run(["cmake", "--install", str(build_path)], cwd=build_path, env=new_env)
|
self.executer.run(["cmake", "--install", str(build_path)], cwd=build_path, env=new_env)
|
||||||
self.verify_mingw_library(triplet=ARCH_TO_TRIPLET[arch], path=install_path / "bin" / f"{self.project}.dll")
|
|
||||||
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
|
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
|
||||||
|
|
||||||
print("Recording arch-dependent extra files for MinGW development archive ...")
|
print("Recording arch-dependent extra files for MinGW development archive ...")
|
||||||
@@ -895,25 +857,22 @@ class Releaser:
|
|||||||
self.artifacts["mingw-devel-tar-gz"] = tgz_path
|
self.artifacts["mingw-devel-tar-gz"] = tgz_path
|
||||||
self.artifacts["mingw-devel-tar-xz"] = txz_path
|
self.artifacts["mingw-devel-tar-xz"] = txz_path
|
||||||
|
|
||||||
def _detect_android_api(self, android_home: str) -> typing.Optional[AndroidApiVersion]:
|
def _detect_android_api(self, android_home: str) -> typing.Optional[int]:
|
||||||
platform_dirs = list(Path(p) for p in glob.glob(f"{android_home}/platforms/android-*"))
|
platform_dirs = list(Path(p) for p in glob.glob(f"{android_home}/platforms/android-*"))
|
||||||
re_platform = re.compile("^android-([0-9]+)(?:-ext([0-9]+))?$")
|
re_platform = re.compile("android-([0-9]+)")
|
||||||
platform_versions: list[AndroidApiVersion] = []
|
platform_versions = []
|
||||||
for platform_dir in platform_dirs:
|
for platform_dir in platform_dirs:
|
||||||
logger.debug("Found Android Platform SDK: %s", platform_dir)
|
logger.debug("Found Android Platform SDK: %s", platform_dir)
|
||||||
if not (platform_dir / "android.jar").is_file():
|
|
||||||
logger.debug("Skipping SDK, missing android.jar")
|
|
||||||
continue
|
|
||||||
if m:= re_platform.match(platform_dir.name):
|
if m:= re_platform.match(platform_dir.name):
|
||||||
platform_versions.append(AndroidApiVersion(name=platform_dir.name, ints=(int(m.group(1)), int(m.group(2) or 0))))
|
platform_versions.append(int(m.group(1)))
|
||||||
platform_versions.sort(key=lambda v: v.ints)
|
platform_versions.sort()
|
||||||
logger.info("Available platform versions: %s", platform_versions)
|
logger.info("Available platform versions: %s", platform_versions)
|
||||||
platform_versions = list(filter(lambda v: v.ints >= self._android_api_minimum.ints, platform_versions))
|
platform_versions = list(filter(lambda v: v >= self._android_api_minimum, platform_versions))
|
||||||
logger.info("Valid platform versions (>=%s): %s", self._android_api_minimum.ints, platform_versions)
|
logger.info("Valid platform versions (>=%d): %s", self._android_api_minimum, platform_versions)
|
||||||
if not platform_versions:
|
if not platform_versions:
|
||||||
return None
|
return None
|
||||||
android_api = platform_versions[0]
|
android_api = platform_versions[0]
|
||||||
logger.info("Selected API version %s", android_api)
|
logger.info("Selected API version %d", android_api)
|
||||||
return android_api
|
return android_api
|
||||||
|
|
||||||
def _get_prefab_json_text(self) -> str:
|
def _get_prefab_json_text(self) -> str:
|
||||||
@@ -937,19 +896,8 @@ class Releaser:
|
|||||||
return json.dumps(module_json_dict, indent=4)
|
return json.dumps(module_json_dict, indent=4)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _android_api_minimum(self) -> AndroidApiVersion:
|
def _android_api_minimum(self):
|
||||||
value = self.release_info["android"]["api-minimum"]
|
return self.release_info["android"]["api-minimum"]
|
||||||
if isinstance(value, int):
|
|
||||||
ints = (value, )
|
|
||||||
elif isinstance(value, str):
|
|
||||||
ints = tuple(split("."))
|
|
||||||
else:
|
|
||||||
raise ValueError("Invalid android.api-minimum: must be X or X.Y")
|
|
||||||
match len(ints):
|
|
||||||
case 1: name = f"android-{ints[0]}"
|
|
||||||
case 2: name = f"android-{ints[0]}-ext-{ints[1]}"
|
|
||||||
case _: raise ValueError("Invalid android.api-minimum: must be X or X.Y")
|
|
||||||
return AndroidApiVersion(name=name, ints=ints)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _android_api_target(self):
|
def _android_api_target(self):
|
||||||
@@ -962,7 +910,7 @@ class Releaser:
|
|||||||
def _get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str:
|
def _get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str:
|
||||||
abi_json_dict = {
|
abi_json_dict = {
|
||||||
"abi": abi,
|
"abi": abi,
|
||||||
"api": self._android_api_minimum.ints[0],
|
"api": self._android_api_minimum,
|
||||||
"ndk": self._android_ndk_minimum,
|
"ndk": self._android_ndk_minimum,
|
||||||
"stl": "c++_shared" if cpp else "none",
|
"stl": "c++_shared" if cpp else "none",
|
||||||
"static": not shared,
|
"static": not shared,
|
||||||
@@ -975,7 +923,7 @@ class Releaser:
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.libsdl.android.{self.project}" android:versionCode="1"
|
package="org.libsdl.android.{self.project}" android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
<uses-sdk android:minSdkVersion="{self._android_api_minimum.ints[0]}"
|
<uses-sdk android:minSdkVersion="{self._android_api_minimum}"
|
||||||
android:targetSdkVersion="{self._android_api_target}" />
|
android:targetSdkVersion="{self._android_api_target}" />
|
||||||
</manifest>
|
</manifest>
|
||||||
""")
|
""")
|
||||||
@@ -985,8 +933,7 @@ class Releaser:
|
|||||||
if not cmake_toolchain_file.exists():
|
if not cmake_toolchain_file.exists():
|
||||||
logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file)
|
logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
aar_path = self.root / "build-android" / f"{self.project}-{self.version}.aar"
|
aar_path = self.dist_path / f"{self.project}-{self.version}.aar"
|
||||||
android_dist_path = self.dist_path / f"{self.project}-devel-{self.version}-android.zip"
|
|
||||||
android_abis = self.release_info["android"]["abis"]
|
android_abis = self.release_info["android"]["abis"]
|
||||||
java_jars_added = False
|
java_jars_added = False
|
||||||
module_data_added = False
|
module_data_added = False
|
||||||
@@ -994,27 +941,16 @@ class Releaser:
|
|||||||
shutil.rmtree(android_deps_path, ignore_errors=True)
|
shutil.rmtree(android_deps_path, ignore_errors=True)
|
||||||
|
|
||||||
for dep, depinfo in self.release_info["android"].get("dependencies", {}).items():
|
for dep, depinfo in self.release_info["android"].get("dependencies", {}).items():
|
||||||
dep_devel_zip = self.deps_path / glob.glob(depinfo["artifact"], root_dir=self.deps_path)[0]
|
android_aar = self.deps_path / glob.glob(depinfo["artifact"], root_dir=self.deps_path)[0]
|
||||||
|
with self.section_printer.group(f"Extracting Android dependency {dep} ({android_aar.name})"):
|
||||||
dep_extract_path = self.deps_path / f"extract/android/{dep}"
|
self.executer.run([sys.executable, str(android_aar), "-o", str(android_deps_path)])
|
||||||
shutil.rmtree(dep_extract_path, ignore_errors=True)
|
|
||||||
dep_extract_path.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
with self.section_printer.group(f"Extracting Android dependency {dep} ({dep_devel_zip})"):
|
|
||||||
with zipfile.ZipFile(dep_devel_zip, "r") as zf:
|
|
||||||
zf.extractall(dep_extract_path)
|
|
||||||
|
|
||||||
dep_devel_aar = dep_extract_path / glob.glob("*.aar", root_dir=dep_extract_path)[0]
|
|
||||||
self.executer.run([sys.executable, str(dep_devel_aar), "-o", str(android_deps_path)])
|
|
||||||
|
|
||||||
for module_name, module_info in self.release_info["android"]["modules"].items():
|
for module_name, module_info in self.release_info["android"]["modules"].items():
|
||||||
assert "type" in module_info and module_info["type"] in ("interface", "library"), f"module {module_name} must have a valid type"
|
assert "type" in module_info and module_info["type"] in ("interface", "library"), f"module {module_name} must have a valid type"
|
||||||
|
|
||||||
aar_file_tree = ArchiveFileTree()
|
archive_file_tree = ArchiveFileTree()
|
||||||
android_devel_file_tree = ArchiveFileTree()
|
|
||||||
|
|
||||||
for android_abi in android_abis:
|
for android_abi in android_abis:
|
||||||
extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS.get(android_abi, "")
|
|
||||||
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
|
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
|
||||||
build_dir = self.root / "build-android" / f"{android_abi}-build"
|
build_dir = self.root / "build-android" / f"{android_abi}-build"
|
||||||
install_dir = self.root / "install-android" / f"{android_abi}-install"
|
install_dir = self.root / "install-android" / f"{android_abi}-install"
|
||||||
@@ -1025,11 +961,8 @@ class Releaser:
|
|||||||
"cmake",
|
"cmake",
|
||||||
"-S", str(self.root),
|
"-S", str(self.root),
|
||||||
"-B", str(build_dir),
|
"-B", str(build_dir),
|
||||||
# NDK 21e does not support -ffile-prefix-map
|
f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||||
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||||
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
|
||||||
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
|
|
||||||
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
|
|
||||||
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
|
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
|
||||||
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
|
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
|
||||||
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
|
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
|
||||||
@@ -1066,20 +999,20 @@ class Releaser:
|
|||||||
assert library.suffix in (".so", ".a")
|
assert library.suffix in (".so", ".a")
|
||||||
assert library.is_file(), f"CMake should have built library '{library}' for module {module_name}"
|
assert library.is_file(), f"CMake should have built library '{library}' for module {module_name}"
|
||||||
arcdir_prefab_libs = f"{arcdir_prefab_module}/libs/android.{android_abi}"
|
arcdir_prefab_libs = f"{arcdir_prefab_module}/libs/android.{android_abi}"
|
||||||
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath=f"{arcdir_prefab_libs}/{library.name}", path=library, time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath=f"{arcdir_prefab_libs}/{library.name}", path=library, time=self.arc_time))
|
||||||
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=f"{arcdir_prefab_libs}/abi.json", text=self._get_prefab_abi_json_text(abi=android_abi, cpp=False, shared=library.suffix == ".so"), time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=f"{arcdir_prefab_libs}/abi.json", text=self._get_prefab_abi_json_text(abi=android_abi, cpp=False, shared=library.suffix == ".so"), time=self.arc_time))
|
||||||
|
|
||||||
if not module_data_added:
|
if not module_data_added:
|
||||||
library_name = None
|
library_name = None
|
||||||
if module_info["type"] == "library":
|
if module_info["type"] == "library":
|
||||||
library_name = Path(module_info["library"]).stem.removeprefix("lib")
|
library_name = Path(module_info["library"]).stem.removeprefix("lib")
|
||||||
export_libraries = module_info.get("export-libraries", [])
|
export_libraries = module_info.get("export-libraries", [])
|
||||||
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_module, "module.json"), text=self._get_prefab_module_json_text(library_name=library_name, export_libraries=export_libraries), time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_module, "module.json"), text=self._get_prefab_module_json_text(library_name=library_name, export_libraries=export_libraries), time=self.arc_time))
|
||||||
arcdir_prefab_include = f"prefab/modules/{module_name}/include"
|
arcdir_prefab_include = f"prefab/modules/{module_name}/include"
|
||||||
if "includes" in module_info:
|
if "includes" in module_info:
|
||||||
aar_file_tree.add_file_mapping(arc_dir=arcdir_prefab_include, file_mapping=module_info["includes"], file_mapping_root=install_dir, context=self.get_context(), time=self.arc_time)
|
archive_file_tree.add_file_mapping(arc_dir=arcdir_prefab_include, file_mapping=module_info["includes"], file_mapping_root=install_dir, context=self.get_context(), time=self.arc_time)
|
||||||
else:
|
else:
|
||||||
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time))
|
||||||
module_data_added = True
|
module_data_added = True
|
||||||
|
|
||||||
if not java_jars_added:
|
if not java_jars_added:
|
||||||
@@ -1092,28 +1025,21 @@ class Releaser:
|
|||||||
assert sources_jar_path.is_file(), f"CMake should have archived the java sources into a JAR ({sources_jar_path})"
|
assert sources_jar_path.is_file(), f"CMake should have archived the java sources into a JAR ({sources_jar_path})"
|
||||||
assert doc_jar_path.is_file(), f"CMake should have archived javadoc into a JAR ({doc_jar_path})"
|
assert doc_jar_path.is_file(), f"CMake should have archived javadoc into a JAR ({doc_jar_path})"
|
||||||
|
|
||||||
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes.jar", path=classes_jar_path, time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes.jar", path=classes_jar_path, time=self.arc_time))
|
||||||
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-sources.jar", path=sources_jar_path, time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-sources.jar", path=sources_jar_path, time=self.arc_time))
|
||||||
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-doc.jar", path=doc_jar_path, time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-doc.jar", path=doc_jar_path, time=self.arc_time))
|
||||||
|
|
||||||
assert ("jars" in self.release_info["android"] and java_jars_added) or "jars" not in self.release_info["android"], "Must have archived java JAR archives"
|
assert ("jars" in self.release_info["android"] and java_jars_added) or "jars" not in self.release_info["android"], "Must have archived java JAR archives"
|
||||||
|
|
||||||
aar_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"]["aar-files"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
|
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
|
||||||
|
|
||||||
aar_file_tree.add_file(NodeInArchive.from_text(arcpath="prefab/prefab.json", text=self._get_prefab_json_text(), time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_text(arcpath="prefab/prefab.json", text=self._get_prefab_json_text(), time=self.arc_time))
|
||||||
aar_file_tree.add_file(NodeInArchive.from_text(arcpath="AndroidManifest.xml", text=self._get_android_manifest_text(), time=self.arc_time))
|
archive_file_tree.add_file(NodeInArchive.from_text(arcpath="AndroidManifest.xml", text=self._get_android_manifest_text(), time=self.arc_time))
|
||||||
|
|
||||||
with Archiver(zip_path=aar_path) as archiver:
|
with Archiver(zip_path=aar_path) as archiver:
|
||||||
aar_file_tree.add_to_archiver(archive_base="", archiver=archiver)
|
archive_file_tree.add_to_archiver(archive_base="", archiver=archiver)
|
||||||
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time)
|
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time)
|
||||||
|
self.artifacts[f"android-aar"] = aar_path
|
||||||
android_devel_file_tree.add_file(NodeInArchive.from_fs(arcpath=aar_path.name, path=aar_path))
|
|
||||||
android_devel_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"]["files"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
|
|
||||||
with Archiver(zip_path=android_dist_path) as archiver:
|
|
||||||
android_devel_file_tree.add_to_archiver(archive_base="", archiver=archiver)
|
|
||||||
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time)
|
|
||||||
|
|
||||||
self.artifacts[f"android-aar"] = android_dist_path
|
|
||||||
|
|
||||||
def download_dependencies(self):
|
def download_dependencies(self):
|
||||||
shutil.rmtree(self.deps_path, ignore_errors=True)
|
shutil.rmtree(self.deps_path, ignore_errors=True)
|
||||||
@@ -1150,7 +1076,7 @@ class Releaser:
|
|||||||
assert len(msvc_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
|
assert len(msvc_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
|
||||||
if "android" in self.release_info:
|
if "android" in self.release_info:
|
||||||
android_matches = glob.glob(self.release_info["android"]["dependencies"][dep]["artifact"], root_dir=self.deps_path)
|
android_matches = glob.glob(self.release_info["android"]["dependencies"][dep]["artifact"], root_dir=self.deps_path)
|
||||||
assert len(android_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {android_matches}"
|
assert len(android_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _arch_to_vs_platform(arch: str, configuration: str="Release") -> VsArchPlatformConfig:
|
def _arch_to_vs_platform(arch: str, configuration: str="Release") -> VsArchPlatformConfig:
|
||||||
@@ -1276,10 +1202,6 @@ class Releaser:
|
|||||||
platform_context = self.get_context(extra_context=arch_platform.extra_context())
|
platform_context = self.get_context(extra_context=arch_platform.extra_context())
|
||||||
|
|
||||||
build_type = "Release"
|
build_type = "Release"
|
||||||
extra_context = {
|
|
||||||
"ARCH": arch_platform.arch,
|
|
||||||
"PLATFORM": arch_platform.platform,
|
|
||||||
}
|
|
||||||
|
|
||||||
built_paths = set(install_path / configure_text(f, context=platform_context) for file_mapping in (self.release_info["msvc"]["cmake"]["files-lib"], self.release_info["msvc"]["cmake"]["files-devel"]) for files_list in file_mapping.values() for f in files_list)
|
built_paths = set(install_path / configure_text(f, context=platform_context) for file_mapping in (self.release_info["msvc"]["cmake"]["files-lib"], self.release_info["msvc"]["cmake"]["files-devel"]) for files_list in file_mapping.values() for f in files_list)
|
||||||
logger.info("CMake builds these files, to be included in the package: %s", built_paths)
|
logger.info("CMake builds these files, to be included in the package: %s", built_paths)
|
||||||
@@ -1330,7 +1252,7 @@ class Releaser:
|
|||||||
logger.info("Collecting files...")
|
logger.info("Collecting files...")
|
||||||
archive_file_tree = ArchiveFileTree()
|
archive_file_tree = ArchiveFileTree()
|
||||||
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["cmake"]["files-lib"], file_mapping_root=install_path, context=platform_context, time=self.arc_time)
|
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["cmake"]["files-lib"], file_mapping_root=install_path, context=platform_context, time=self.arc_time)
|
||||||
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(extra_context=extra_context), time=self.arc_time)
|
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
|
||||||
|
|
||||||
logger.info("Creating %s", zip_path)
|
logger.info("Creating %s", zip_path)
|
||||||
with Archiver(zip_path=zip_path) as archiver:
|
with Archiver(zip_path=zip_path) as archiver:
|
||||||
@@ -1394,7 +1316,7 @@ def main(argv=None) -> int:
|
|||||||
parser.add_argument("--actions", choices=["download", "source", "android", "mingw", "msvc", "dmg"], required=True, nargs="+", dest="actions", help="What to do?")
|
parser.add_argument("--actions", choices=["download", "source", "android", "mingw", "msvc", "dmg"], required=True, nargs="+", dest="actions", help="What to do?")
|
||||||
parser.set_defaults(loglevel=logging.INFO)
|
parser.set_defaults(loglevel=logging.INFO)
|
||||||
parser.add_argument('--vs-year', dest="vs_year", help="Visual Studio year")
|
parser.add_argument('--vs-year', dest="vs_year", help="Visual Studio year")
|
||||||
parser.add_argument('--android-api', dest="android_api", help="Android API version")
|
parser.add_argument('--android-api', type=int, dest="android_api", help="Android API version")
|
||||||
parser.add_argument('--android-home', dest="android_home", default=os.environ.get("ANDROID_HOME"), help="Android Home folder")
|
parser.add_argument('--android-home', dest="android_home", default=os.environ.get("ANDROID_HOME"), help="Android Home folder")
|
||||||
parser.add_argument('--android-ndk-home', dest="android_ndk_home", default=os.environ.get("ANDROID_NDK_HOME"), help="Android NDK Home folder")
|
parser.add_argument('--android-ndk-home', dest="android_ndk_home", default=os.environ.get("ANDROID_NDK_HOME"), help="Android NDK Home folder")
|
||||||
parser.add_argument('--cmake-generator', dest="cmake_generator", default="Ninja", help="CMake Generator")
|
parser.add_argument('--cmake-generator', dest="cmake_generator", default="Ninja", help="CMake Generator")
|
||||||
@@ -1521,27 +1443,14 @@ def main(argv=None) -> int:
|
|||||||
if args.android_api is None:
|
if args.android_api is None:
|
||||||
with section_printer.group("Detect Android APIS"):
|
with section_printer.group("Detect Android APIS"):
|
||||||
args.android_api = releaser._detect_android_api(android_home=args.android_home)
|
args.android_api = releaser._detect_android_api(android_home=args.android_home)
|
||||||
else:
|
if args.android_api is None or not (Path(args.android_home) / f"platforms/android-{args.android_api}").is_dir():
|
||||||
try:
|
|
||||||
android_api_ints = tuple(int(v) for v in args.android_api.split("."))
|
|
||||||
match len(android_api_ints):
|
|
||||||
case 1: android_api_name = f"android-{android_api_ints[0]}"
|
|
||||||
case 2: android_api_name = f"android-{android_api_ints[0]}-ext-{android_api_ints[1]}"
|
|
||||||
case _: raise ValueError
|
|
||||||
except ValueError:
|
|
||||||
logger.error("Invalid --android-api, must be a 'X' or 'X.Y' version")
|
|
||||||
args.android_api = AndroidApiVersion(ints=android_api_ints, name=android_api_name)
|
|
||||||
if args.android_api is None:
|
|
||||||
parser.error("Invalid --android-api, and/or could not be detected")
|
parser.error("Invalid --android-api, and/or could not be detected")
|
||||||
android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}"
|
|
||||||
if not android_api_path.is_dir():
|
|
||||||
logger.warning(f"Android API directory does not exist ({android_api_path})")
|
|
||||||
with section_printer.group("Android arguments"):
|
with section_printer.group("Android arguments"):
|
||||||
print(f"android_home = {args.android_home}")
|
print(f"android_home = {args.android_home}")
|
||||||
print(f"android_ndk_home = {args.android_ndk_home}")
|
print(f"android_ndk_home = {args.android_ndk_home}")
|
||||||
print(f"android_api = {args.android_api}")
|
print(f"android_api = {args.android_api}")
|
||||||
releaser.create_android_archives(
|
releaser.create_android_archives(
|
||||||
android_api=args.android_api.ints[0],
|
android_api=args.android_api,
|
||||||
android_home=args.android_home,
|
android_home=args.android_home,
|
||||||
android_ndk_home=args.android_ndk_home,
|
android_ndk_home=args.android_ndk_home,
|
||||||
)
|
)
|
||||||
|
4
configure
vendored
4
configure
vendored
@@ -3515,8 +3515,8 @@ orig_CFLAGS="$CFLAGS"
|
|||||||
|
|
||||||
# See docs/release_checklist.md
|
# See docs/release_checklist.md
|
||||||
SDL_MAJOR_VERSION=2
|
SDL_MAJOR_VERSION=2
|
||||||
SDL_MINOR_VERSION=33
|
SDL_MINOR_VERSION=32
|
||||||
SDL_MICRO_VERSION=0
|
SDL_MICRO_VERSION=10
|
||||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||||
|
|
||||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||||
|
@@ -12,8 +12,8 @@ orig_CFLAGS="$CFLAGS"
|
|||||||
dnl Set various version strings - taken gratefully from the GTk sources
|
dnl Set various version strings - taken gratefully from the GTk sources
|
||||||
# See docs/release_checklist.md
|
# See docs/release_checklist.md
|
||||||
SDL_MAJOR_VERSION=2
|
SDL_MAJOR_VERSION=2
|
||||||
SDL_MINOR_VERSION=33
|
SDL_MINOR_VERSION=32
|
||||||
SDL_MICRO_VERSION=0
|
SDL_MICRO_VERSION=10
|
||||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||||
|
|
||||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||||
|
@@ -29,7 +29,7 @@ cmake --install build
|
|||||||
|
|
||||||
|
|
||||||
## Compiling a HelloWorld
|
## Compiling a HelloWorld
|
||||||
[PSP Hello World](https://pspdev.github.io/basic_programs.html#hello-world)
|
[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
|
||||||
|
|
||||||
## To Do
|
## To Do
|
||||||
- PSP Screen Keyboard
|
- PSP Screen Keyboard
|
||||||
|
@@ -14,6 +14,7 @@ Works out of box.
|
|||||||
Windows:
|
Windows:
|
||||||
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
Events
|
Events
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL_FINGERDOWN:
|
SDL_FINGERDOWN:
|
||||||
@@ -38,6 +39,7 @@ Fields:
|
|||||||
Same as SDL_FINGERDOWN.
|
Same as SDL_FINGERDOWN.
|
||||||
|
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
Functions
|
Functions
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides the ability to access the underlying SDL_Finger structures.
|
SDL provides the ability to access the underlying SDL_Finger structures.
|
||||||
@@ -74,6 +76,7 @@ A SDL_Finger has the following fields:
|
|||||||
The pressure of the touch.
|
The pressure of the touch.
|
||||||
|
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
Notes
|
Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
For a complete example see test/testgesture.c
|
For a complete example see test/testgesture.c
|
||||||
|
@@ -648,7 +648,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
|
|||||||
* \param obtained an SDL_AudioSpec structure filled in with the actual output
|
* \param obtained an SDL_AudioSpec structure filled in with the actual output
|
||||||
* format; see SDL_OpenAudio() for more information.
|
* format; see SDL_OpenAudio() for more information.
|
||||||
* \param allowed_changes 0, or one or more flags OR'd together.
|
* \param allowed_changes 0, or one or more flags OR'd together.
|
||||||
* \returns a valid device ID > 0 on success or 0 on failure; call
|
* \returns a valid device ID that is > 0 on success or 0 on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
* For compatibility with SDL 1.2, this will never return 1, since
|
* For compatibility with SDL 1.2, this will never return 1, since
|
||||||
|
@@ -41,18 +41,12 @@
|
|||||||
*
|
*
|
||||||
* A special exception is the number keys at the top of the keyboard which map
|
* A special exception is the number keys at the top of the keyboard which map
|
||||||
* to SDLK_0...SDLK_9 on AZERTY layouts.
|
* to SDLK_0...SDLK_9 on AZERTY layouts.
|
||||||
*
|
|
||||||
* The actual values that might be set for this type are listed in the
|
|
||||||
* SDL_KeyCode (capital C) enumeration.
|
|
||||||
*/
|
*/
|
||||||
typedef Sint32 SDL_Keycode;
|
typedef Sint32 SDL_Keycode;
|
||||||
|
|
||||||
#define SDLK_SCANCODE_MASK (1<<30)
|
#define SDLK_SCANCODE_MASK (1<<30)
|
||||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||||
|
|
||||||
/**
|
|
||||||
* The possible values for keycodes.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_KeyCode
|
typedef enum SDL_KeyCode
|
||||||
{
|
{
|
||||||
SDLK_UNKNOWN = 0,
|
SDLK_UNKNOWN = 0,
|
||||||
|
@@ -187,8 +187,8 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
|||||||
* \param name the window class name, in UTF-8 encoding. If NULL, SDL
|
* \param name the window class name, in UTF-8 encoding. If NULL, SDL
|
||||||
* currently uses "SDL_app" but this isn't guaranteed.
|
* currently uses "SDL_app" but this isn't guaranteed.
|
||||||
* \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
|
* \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
|
||||||
* currently uses `(CS_BYTEALIGNCLIENT \| CS_OWNDC)` regardless
|
* currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of
|
||||||
* of what is specified here.
|
* what is specified here.
|
||||||
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
|
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
|
||||||
* will use `GetModuleHandle(NULL)` instead.
|
* will use `GetModuleHandle(NULL)` instead.
|
||||||
* \returns 0 on success, -1 on error. SDL_GetError() may have details.
|
* \returns 0 on success, -1 on error. SDL_GetError() may have details.
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
* - single pixel lines
|
* - single pixel lines
|
||||||
* - filled rectangles
|
* - filled rectangles
|
||||||
* - texture images
|
* - texture images
|
||||||
* - 2D polygons
|
|
||||||
*
|
*
|
||||||
* The primitives may be drawn in opaque, blended, or additive modes.
|
* The primitives may be drawn in opaque, blended, or additive modes.
|
||||||
*
|
*
|
||||||
@@ -39,7 +38,7 @@
|
|||||||
* may also be stretched with linear interpolation.
|
* may also be stretched with linear interpolation.
|
||||||
*
|
*
|
||||||
* This API is designed to accelerate simple 2D operations. You may want more
|
* This API is designed to accelerate simple 2D operations. You may want more
|
||||||
* functionality such as 3D polygons and particle effects and in that case you
|
* functionality such as polygons and particle effects and in that case you
|
||||||
* should use SDL's OpenGL/Direct3D support or one of the many good 3D
|
* should use SDL's OpenGL/Direct3D support or one of the many good 3D
|
||||||
* engines.
|
* engines.
|
||||||
*
|
*
|
||||||
|
@@ -808,8 +808,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||||||
*
|
*
|
||||||
* This assumes that the source and destination rectangles are the same size.
|
* This assumes that the source and destination rectangles are the same size.
|
||||||
* If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
|
* If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
|
||||||
* `dst`) is copied. The final blit rectangle is saved in `dstrect` after all
|
* `dst`) is copied. The final blit rectangle is saved in `dstrect` after
|
||||||
* clipping is performed.
|
* all clipping is performed.
|
||||||
*
|
*
|
||||||
* The blit function should not be called on a locked surface.
|
* The blit function should not be called on a locked surface.
|
||||||
*
|
*
|
||||||
|
@@ -57,8 +57,8 @@ typedef struct SDL_version
|
|||||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||||
*/
|
*/
|
||||||
#define SDL_MAJOR_VERSION 2
|
#define SDL_MAJOR_VERSION 2
|
||||||
#define SDL_MINOR_VERSION 33
|
#define SDL_MINOR_VERSION 32
|
||||||
#define SDL_PATCHLEVEL 0
|
#define SDL_PATCHLEVEL 10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro to determine SDL version program was compiled against.
|
* Macro to determine SDL version program was compiled against.
|
||||||
|
@@ -62,7 +62,6 @@ static int (*ALSA_snd_pcm_hw_params_set_access)(snd_pcm_t *, snd_pcm_hw_params_t
|
|||||||
static int (*ALSA_snd_pcm_hw_params_set_format)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
|
static int (*ALSA_snd_pcm_hw_params_set_format)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
|
||||||
static int (*ALSA_snd_pcm_hw_params_set_channels)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
|
static int (*ALSA_snd_pcm_hw_params_set_channels)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
|
||||||
static int (*ALSA_snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *, unsigned int *);
|
static int (*ALSA_snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *, unsigned int *);
|
||||||
static int (*ALSA_snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *, unsigned int*, int*);
|
|
||||||
static int (*ALSA_snd_pcm_hw_params_set_rate_near)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
|
static int (*ALSA_snd_pcm_hw_params_set_rate_near)(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
|
||||||
static int (*ALSA_snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
|
static int (*ALSA_snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
|
||||||
static int (*ALSA_snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
|
static int (*ALSA_snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
|
||||||
@@ -89,7 +88,7 @@ static const char *(*ALSA_snd_pcm_info_get_name)(const snd_pcm_info_t *);
|
|||||||
static int (*ALSA_snd_pcm_info_get_card)(const snd_pcm_info_t *);
|
static int (*ALSA_snd_pcm_info_get_card)(const snd_pcm_info_t *);
|
||||||
static int (*ALSA_snd_card_get_name)(int, char **);
|
static int (*ALSA_snd_card_get_name)(int, char **);
|
||||||
static int (*ALSA_snd_pcm_info_malloc)(snd_pcm_info_t **);
|
static int (*ALSA_snd_pcm_info_malloc)(snd_pcm_info_t **);
|
||||||
static void (*ALSA_snd_pcm_info_free)(snd_pcm_info_t *);
|
static int (*ALSA_snd_pcm_info_free)(snd_pcm_info_t *);
|
||||||
#ifdef SND_CHMAP_API_VERSION
|
#ifdef SND_CHMAP_API_VERSION
|
||||||
static snd_pcm_chmap_t *(*ALSA_snd_pcm_get_chmap)(snd_pcm_t *);
|
static snd_pcm_chmap_t *(*ALSA_snd_pcm_get_chmap)(snd_pcm_t *);
|
||||||
static int (*ALSA_snd_pcm_chmap_print)(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
|
static int (*ALSA_snd_pcm_chmap_print)(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
|
||||||
@@ -139,7 +138,6 @@ static int load_alsa_syms(void)
|
|||||||
SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
|
SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
|
SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
|
SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_get_rate);
|
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
|
SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
|
SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
|
||||||
SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
|
SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
|
||||||
@@ -782,16 +780,6 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
|
|||||||
char *desc;
|
char *desc;
|
||||||
char *handle = NULL;
|
char *handle = NULL;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
snd_pcm_t *pcm_handle;
|
|
||||||
snd_pcm_stream_t stream;
|
|
||||||
snd_pcm_hw_params_t *hwparams;
|
|
||||||
|
|
||||||
unsigned int freq = 0;
|
|
||||||
int dir;
|
|
||||||
unsigned int channels = 0;
|
|
||||||
snd_pcm_uframes_t samples = 0;
|
|
||||||
|
|
||||||
SDL_AudioSpec spec;
|
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
return;
|
return;
|
||||||
@@ -831,36 +819,12 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
|
|||||||
SDL_free(dev);
|
SDL_free(dev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stream = iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK;
|
|
||||||
|
|
||||||
if (ALSA_snd_pcm_open(&pcm_handle, handle, stream, SND_PCM_NONBLOCK) < 0) {
|
|
||||||
SDL_free(dev);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
snd_pcm_hw_params_alloca(&hwparams);
|
/* Note that spec is NULL, because we are required to open the device before
|
||||||
ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
|
* acquiring the mix format, making this information inaccessible at
|
||||||
|
* enumeration time
|
||||||
ALSA_snd_pcm_hw_params_get_rate(hwparams, &freq, &dir);
|
*/
|
||||||
ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
|
SDL_AddAudioDevice(iscapture, desc, NULL, handle);
|
||||||
ALSA_snd_pcm_hw_params_get_period_size(hwparams, &samples, &dir);
|
|
||||||
|
|
||||||
ALSA_snd_pcm_close(pcm_handle);
|
|
||||||
|
|
||||||
/* Let's fill the spec */
|
|
||||||
|
|
||||||
spec.freq = freq;
|
|
||||||
spec.channels = channels;
|
|
||||||
spec.samples = samples;
|
|
||||||
spec.silence = 0;
|
|
||||||
spec.padding = 0;
|
|
||||||
/* Can't calculate size yet because this is an exploratory device opening
|
|
||||||
* so we don't know the sample format.
|
|
||||||
* Probably AUDIO_S16SYS/SND_PCM_FORMAT_S16_LE would be a good default
|
|
||||||
* if required.*/
|
|
||||||
spec.size = 0;
|
|
||||||
|
|
||||||
SDL_AddAudioDevice(iscapture, desc, &spec, handle);
|
|
||||||
if (hint) {
|
if (hint) {
|
||||||
free(desc);
|
free(desc);
|
||||||
}
|
}
|
||||||
|
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,33,0,0
|
FILEVERSION 2,32,10,0
|
||||||
PRODUCTVERSION 2,33,0,0
|
PRODUCTVERSION 2,32,10,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
FILEFLAGS 0x0L
|
FILEFLAGS 0x0L
|
||||||
FILEOS 0x40004L
|
FILEOS 0x40004L
|
||||||
@@ -23,12 +23,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "\0"
|
VALUE "CompanyName", "\0"
|
||||||
VALUE "FileDescription", "SDL\0"
|
VALUE "FileDescription", "SDL\0"
|
||||||
VALUE "FileVersion", "2, 33, 0, 0\0"
|
VALUE "FileVersion", "2, 32, 10, 0\0"
|
||||||
VALUE "InternalName", "SDL\0"
|
VALUE "InternalName", "SDL\0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
|
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
|
||||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||||
VALUE "ProductVersion", "2, 33, 0, 0\0"
|
VALUE "ProductVersion", "2, 32, 10, 0\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@@ -399,7 +399,6 @@ struct SDL_VideoDevice
|
|||||||
int no_error;
|
int no_error;
|
||||||
int retained_backing;
|
int retained_backing;
|
||||||
int driver_loaded;
|
int driver_loaded;
|
||||||
int HAS_GL_ARB_color_buffer_float;
|
|
||||||
char driver_path[256];
|
char driver_path[256];
|
||||||
void *dll_handle;
|
void *dll_handle;
|
||||||
} gl_config;
|
} gl_config;
|
||||||
|
@@ -70,10 +70,6 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_RGBA_FLOAT_MODE_ARB
|
|
||||||
#define GL_RGBA_FLOAT_MODE_ARB 0x8820
|
|
||||||
#endif /* GL_RGBA_FLOAT_MODE_ARB */
|
|
||||||
|
|
||||||
/* Available video drivers */
|
/* Available video drivers */
|
||||||
static VideoBootStrap *bootstrap[] = {
|
static VideoBootStrap *bootstrap[] = {
|
||||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||||
@@ -4040,15 +4036,6 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
|||||||
*value = _this->gl_config.no_error;
|
*value = _this->gl_config.no_error;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case SDL_GL_FLOATBUFFERS:
|
|
||||||
{
|
|
||||||
if (_this->gl_config.HAS_GL_ARB_color_buffer_float) {
|
|
||||||
attrib = GL_RGBA_FLOAT_MODE_ARB;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return SDL_SetError("Unknown OpenGL attribute");
|
return SDL_SetError("Unknown OpenGL attribute");
|
||||||
}
|
}
|
||||||
|
@@ -511,10 +511,6 @@ void WIN_GL_InitExtensions(_THIS)
|
|||||||
_this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE;
|
_this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for WGL_ARB_pixel_format_float */
|
|
||||||
_this->gl_data->HAS_WGL_ARB_pixel_format_float =
|
|
||||||
HasExtension("WGL_ARB_pixel_format_float", extensions);
|
|
||||||
|
|
||||||
_this->gl_data->wglMakeCurrent(hdc, NULL);
|
_this->gl_data->wglMakeCurrent(hdc, NULL);
|
||||||
_this->gl_data->wglDeleteContext(hglrc);
|
_this->gl_data->wglDeleteContext(hglrc);
|
||||||
ReleaseDC(hwnd, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
@@ -645,7 +641,7 @@ static int WIN_GL_SetupWindowInternal(_THIS, SDL_Window *window)
|
|||||||
*iAttr++ = _this->gl_config.multisamplesamples;
|
*iAttr++ = _this->gl_config.multisamplesamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->gl_data->HAS_WGL_ARB_pixel_format_float && _this->gl_config.floatbuffers) {
|
if (_this->gl_config.floatbuffers) {
|
||||||
*iAttr++ = WGL_PIXEL_TYPE_ARB;
|
*iAttr++ = WGL_PIXEL_TYPE_ARB;
|
||||||
*iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB;
|
*iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB;
|
||||||
}
|
}
|
||||||
@@ -829,9 +825,6 @@ SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window *window)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_this->gl_config.HAS_GL_ARB_color_buffer_float =
|
|
||||||
SDL_GL_ExtensionSupported("GL_ARB_color_buffer_float");
|
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,7 +64,6 @@ struct SDL_GLDriverData
|
|||||||
SDL_bool HAS_WGL_ARB_context_flush_control;
|
SDL_bool HAS_WGL_ARB_context_flush_control;
|
||||||
SDL_bool HAS_WGL_ARB_create_context_robustness;
|
SDL_bool HAS_WGL_ARB_create_context_robustness;
|
||||||
SDL_bool HAS_WGL_ARB_create_context_no_error;
|
SDL_bool HAS_WGL_ARB_create_context_no_error;
|
||||||
SDL_bool HAS_WGL_ARB_pixel_format_float;
|
|
||||||
|
|
||||||
/* Max version of OpenGL ES context that can be created if the
|
/* Max version of OpenGL ES context that can be created if the
|
||||||
implementation supports WGL_EXT_create_context_es2_profile.
|
implementation supports WGL_EXT_create_context_es2_profile.
|
||||||
|
@@ -67,9 +67,6 @@ static SDL_bool DriverIsProblematic(const char *driver)
|
|||||||
*/
|
*/
|
||||||
"dsp",
|
"dsp",
|
||||||
|
|
||||||
/* Jack isn't always configured properly on end user systems */
|
|
||||||
"jack",
|
|
||||||
|
|
||||||
/* OpenBSD sound API. Can be used on Linux, but very rare. */
|
/* OpenBSD sound API. Can be used on Linux, but very rare. */
|
||||||
"sndio",
|
"sndio",
|
||||||
|
|
||||||
|
@@ -88,19 +88,9 @@ int hints_getHint(void *arg)
|
|||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
char *value;
|
|
||||||
char *oldValue;
|
|
||||||
} HintCallbackContext;
|
|
||||||
|
|
||||||
static void SDLCALL hints_testHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
static void SDLCALL hints_testHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||||
{
|
{
|
||||||
HintCallbackContext *context = userdata;
|
*(char **)userdata = hint ? SDL_strdup(hint) : NULL;
|
||||||
|
|
||||||
context->name = name ? SDL_strdup(name) : NULL;
|
|
||||||
context->value = hint ? SDL_strdup(hint) : NULL;
|
|
||||||
context->oldValue = oldValue ? SDL_strdup(oldValue) : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +102,7 @@ int hints_setHint(void *arg)
|
|||||||
const char *originalValue;
|
const char *originalValue;
|
||||||
char *value;
|
char *value;
|
||||||
const char *testValue;
|
const char *testValue;
|
||||||
HintCallbackContext callback_data;
|
char *callbackValue;
|
||||||
SDL_bool result;
|
SDL_bool result;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@@ -162,10 +152,8 @@ int hints_setHint(void *arg)
|
|||||||
SDLTest_AssertPass("Call to SDL_GetHint() after saving and restoring hint");
|
SDLTest_AssertPass("Call to SDL_GetHint() after saving and restoring hint");
|
||||||
originalValue = SDL_GetHint(testHint);
|
originalValue = SDL_GetHint(testHint);
|
||||||
value = (originalValue == NULL) ? NULL : SDL_strdup(originalValue);
|
value = (originalValue == NULL) ? NULL : SDL_strdup(originalValue);
|
||||||
result = SDL_SetHint(testHint, "temp");
|
SDL_SetHint(testHint, "temp");
|
||||||
SDLTest_AssertCheck(!result, "SDL_SetHint(\"%s\", \"temp\") should return false", testHint);
|
SDL_SetHint(testHint, value);
|
||||||
result = SDL_SetHint(testHint, value);
|
|
||||||
SDLTest_AssertCheck(!result, "SDL_SetHint(\"%s\", \"%s\" should return false", testHint, value);
|
|
||||||
SDL_free(value);
|
SDL_free(value);
|
||||||
testValue = SDL_GetHint(testHint);
|
testValue = SDL_GetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
@@ -174,26 +162,15 @@ int hints_setHint(void *arg)
|
|||||||
testValue);
|
testValue);
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_DEFAULT)");
|
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_DEFAULT)");
|
||||||
result = SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_DEFAULT);
|
SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_DEFAULT);
|
||||||
SDLTest_AssertCheck(!result, "SDL_SetHintWithPriority(\"%s\", NULL, SDL_HINT_DEFAULT) should return false", testHint);
|
|
||||||
testValue = SDL_GetHint(testHint);
|
testValue = SDL_GetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
testValue && SDL_strcmp(testValue, "original") == 0,
|
testValue && SDL_strcmp(testValue, "original") == 0,
|
||||||
"testValue = %s, expected \"original\"",
|
"testValue = %s, expected \"original\"",
|
||||||
testValue);
|
testValue);
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHint(\"\", \"data\")");
|
|
||||||
result = SDL_SetHint("", "data");
|
|
||||||
SDLTest_AssertCheck(result, "SDL_SetHint(\"\", \"data\") should return true");
|
|
||||||
testValue = SDL_GetHint("");
|
|
||||||
SDLTest_AssertCheck(
|
|
||||||
testValue && SDL_strcmp(testValue, "data") == 0,
|
|
||||||
"testValue = %s, expected \"data\"",
|
|
||||||
testValue);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE)");
|
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE)");
|
||||||
result = SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
|
SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
|
||||||
SDLTest_AssertCheck(result, "SDL_SetHintWithPriority(\"%s\", \"temp\", SDL_HINT_OVERRIDE) should return true", testHint);
|
|
||||||
testValue = SDL_GetHint(testHint);
|
testValue = SDL_GetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
testValue && SDL_strcmp(testValue, "temp") == 0,
|
testValue && SDL_strcmp(testValue, "temp") == 0,
|
||||||
@@ -201,8 +178,7 @@ int hints_setHint(void *arg)
|
|||||||
testValue);
|
testValue);
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_OVERRIDE)");
|
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_OVERRIDE)");
|
||||||
result = SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_OVERRIDE);
|
SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_OVERRIDE);
|
||||||
SDLTest_AssertCheck(result, "SDL_SetHintWithPriority(\"%s\", NULL, SDL_HINT_OVERRIDE) should return true", testHint);
|
|
||||||
testValue = SDL_GetHint(testHint);
|
testValue = SDL_GetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
testValue == NULL,
|
testValue == NULL,
|
||||||
@@ -218,75 +194,49 @@ int hints_setHint(void *arg)
|
|||||||
testValue);
|
testValue);
|
||||||
|
|
||||||
/* Make sure callback functionality works past a reset */
|
/* Make sure callback functionality works past a reset */
|
||||||
SDL_zero(callback_data);
|
|
||||||
SDLTest_AssertPass("Call to SDL_AddHintCallback()");
|
SDLTest_AssertPass("Call to SDL_AddHintCallback()");
|
||||||
SDL_AddHintCallback(testHint, hints_testHintChanged, &callback_data);
|
callbackValue = NULL;
|
||||||
|
SDL_AddHintCallback(testHint, hints_testHintChanged, &callbackValue);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
callback_data.name && SDL_strcmp(callback_data.name, testHint) == 0,
|
callbackValue && SDL_strcmp(callbackValue, "original") == 0,
|
||||||
"callback_data.name = \"%s\", expected \"%s\"",
|
"callbackValue = %s, expected \"original\"",
|
||||||
callback_data.name, testHint);
|
callbackValue);
|
||||||
|
SDL_free(callbackValue);
|
||||||
|
|
||||||
|
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback");
|
||||||
|
callbackValue = NULL;
|
||||||
|
SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
callback_data.value && SDL_strcmp(callback_data.value, "original") == 0,
|
callbackValue && SDL_strcmp(callbackValue, "temp") == 0,
|
||||||
"callback_data.value = \"%s\", expected \"%s\"",
|
"callbackValue = %s, expected \"temp\"",
|
||||||
callback_data.value, "original");
|
callbackValue);
|
||||||
SDL_free(callback_data.name);
|
SDL_free(callbackValue);
|
||||||
SDL_free(callback_data.value);
|
|
||||||
SDL_free(callback_data.oldValue);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_ResetHint(), using callback");
|
SDLTest_AssertPass("Call to SDL_ResetHint(), using callback");
|
||||||
SDL_zero(callback_data);
|
callbackValue = NULL;
|
||||||
SDL_ResetHint(testHint);
|
SDL_ResetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
callback_data.value && SDL_strcmp(callback_data.value, "original") == 0,
|
callbackValue && SDL_strcmp(callbackValue, "original") == 0,
|
||||||
"callbackValue = %s, expected \"original\"",
|
"callbackValue = %s, expected \"original\"",
|
||||||
callback_data.value);
|
callbackValue);
|
||||||
SDL_free(callback_data.name);
|
|
||||||
SDL_free(callback_data.value);
|
|
||||||
SDL_free(callback_data.oldValue);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback after reset");
|
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback after reset");
|
||||||
SDL_zero(callback_data);
|
callbackValue = NULL;
|
||||||
result = SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
|
SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE);
|
||||||
SDLTest_AssertCheck(result, "SDL_SetHintWithPriority(\"%s\", \"temp\", SDL_HINT_OVERRIDE) should return true", testHint);
|
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
callback_data.value && SDL_strcmp(callback_data.value, "temp") == 0,
|
callbackValue && SDL_strcmp(callbackValue, "temp") == 0,
|
||||||
"callbackValue = %s, expected \"temp\"",
|
"callbackValue = %s, expected \"temp\"",
|
||||||
callback_data.value);
|
callbackValue);
|
||||||
SDL_free(callback_data.name);
|
SDL_free(callbackValue);
|
||||||
SDL_free(callback_data.value);
|
|
||||||
SDL_free(callback_data.oldValue);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("Call to SDL_ResetHint(), after clearing callback");
|
SDLTest_AssertPass("Call to SDL_ResetHint(), after clearing callback");
|
||||||
SDL_zero(callback_data);
|
callbackValue = NULL;
|
||||||
SDL_DelHintCallback(testHint, hints_testHintChanged, &callback_data);
|
SDL_DelHintCallback(testHint, hints_testHintChanged, &callbackValue);
|
||||||
SDL_ResetHint(testHint);
|
SDL_ResetHint(testHint);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
!callback_data.value,
|
callbackValue == NULL,
|
||||||
"callbackValue = %s, expected \"(null)\"",
|
"callbackValue = %s, expected \"(null)\"",
|
||||||
callback_data.value);
|
callbackValue);
|
||||||
SDL_free(callback_data.name);
|
|
||||||
SDL_free(callback_data.value);
|
|
||||||
SDL_free(callback_data.oldValue);
|
|
||||||
|
|
||||||
/* Make sure callback functionality work with hint renamed in sdl3 */
|
|
||||||
SDLTest_AssertPass("Call to SDL_AddHintCallback()");
|
|
||||||
SDL_AddHintCallback(SDL_HINT_ALLOW_TOPMOST, hints_testHintChanged, &callback_data);
|
|
||||||
SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE), using callback");
|
|
||||||
SDL_zero(callback_data);
|
|
||||||
result = SDL_SetHintWithPriority(SDL_HINT_ALLOW_TOPMOST, "temp", SDL_HINT_OVERRIDE);
|
|
||||||
SDLTest_AssertCheck(result, "SDL_SetHintWithPriority(\"%s\", \"temp\", SDL_HINT_OVERRIDE) should return true", testHint);
|
|
||||||
SDLTest_AssertCheck(
|
|
||||||
callback_data.name && SDL_strcmp(callback_data.name, SDL_HINT_ALLOW_TOPMOST) == 0,
|
|
||||||
"callback_data.name = \"%s\", expected \"%s\"",
|
|
||||||
callback_data.name, SDL_HINT_ALLOW_TOPMOST);
|
|
||||||
SDLTest_AssertCheck(
|
|
||||||
callback_data.value && SDL_strcmp(callback_data.value, "temp") == 0,
|
|
||||||
"callback_data.value = \"%s\", expected \"%s\"",
|
|
||||||
callback_data.value, "temp");
|
|
||||||
SDL_free(callback_data.name);
|
|
||||||
SDL_free(callback_data.value);
|
|
||||||
SDL_free(callback_data.oldValue);
|
|
||||||
SDL_ResetHint(testHint);
|
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
@@ -12,38 +12,6 @@
|
|||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Private helper to check SDL_FRect equality
|
|
||||||
*/
|
|
||||||
static SDL_bool IsFRectEqual(const SDL_FRect *r1, const SDL_FRect *r2) {
|
|
||||||
static const float MAX_DELTA = 1e-5f;
|
|
||||||
SDL_FRect delta;
|
|
||||||
delta.x = r1->x - r2->x;
|
|
||||||
delta.y = r1->y - r2->y;
|
|
||||||
delta.w = r1->w - r2->w;
|
|
||||||
delta.h = r1->h - r2->h;
|
|
||||||
|
|
||||||
return -MAX_DELTA <= delta.x && delta.x <= MAX_DELTA
|
|
||||||
&& -MAX_DELTA <= delta.y && delta.y <= MAX_DELTA
|
|
||||||
&& -MAX_DELTA <= delta.w && delta.w <= MAX_DELTA
|
|
||||||
&& -MAX_DELTA <= delta.w && delta.h <= MAX_DELTA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Private helper to check SDL_FPoint equality
|
|
||||||
*/
|
|
||||||
static SDL_bool IsFPointEqual(const SDL_FPoint *p1, const SDL_FPoint *p2) {
|
|
||||||
static const float MAX_DELTA = 1e-5f;
|
|
||||||
SDL_FPoint delta;
|
|
||||||
delta.x = p1->x - p2->x;
|
|
||||||
delta.y = p1->y - p2->y;
|
|
||||||
|
|
||||||
return -MAX_DELTA <= delta.x && delta.x <= MAX_DELTA
|
|
||||||
&& -MAX_DELTA <= delta.y && delta.y <= MAX_DELTA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper functions */
|
|
||||||
|
|
||||||
/* !
|
/* !
|
||||||
* \brief Private helper to check SDL_IntersectRectAndLine results
|
* \brief Private helper to check SDL_IntersectRectAndLine results
|
||||||
*/
|
*/
|
||||||
@@ -1730,226 +1698,6 @@ int rect_testFRectEqualsParam(void *arg)
|
|||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Test SDL_HasIntersectionF
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_HasIntersectionF
|
|
||||||
*/
|
|
||||||
int rect_testHasIntersectionF(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
SDL_FRect r1;
|
|
||||||
SDL_FRect r2;
|
|
||||||
SDL_bool expected;
|
|
||||||
} cases[] = {
|
|
||||||
{ { 0, 0, 0, 0 }, {0, 0, 0, 0}, SDL_FALSE },
|
|
||||||
{ { 0, 0, -200, 200 }, {0, 0, -200, 200}, SDL_FALSE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-5, 5, 10, 2}, SDL_TRUE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-5, -5, 10, 2}, SDL_FALSE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-5, -5, 2, 10}, SDL_FALSE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-5, -5, 5, 5}, SDL_FALSE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-5, -5, 5.1f, 5.1f}, SDL_TRUE },
|
|
||||||
{ { 0, 0, 10, 10 }, {-4.99f, -4.99f, 5, 5}, SDL_TRUE },
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(cases); i++) {
|
|
||||||
SDL_bool result;
|
|
||||||
SDLTest_AssertPass("About to call SDL_HasIntersectionF(&{ %g, %g, %g, %g }, &{ %g, %g, %g, %g })",
|
|
||||||
cases[i].r1.x, cases[i].r1.y, cases[i].r1.w, cases[i].r1.h,
|
|
||||||
cases[i].r2.x, cases[i].r2.y, cases[i].r2.w, cases[i].r2.h
|
|
||||||
);
|
|
||||||
result = SDL_HasIntersectionF(&cases[i].r1, &cases[i].r2);
|
|
||||||
SDLTest_AssertCheck(result == cases[i].expected, "Got %d, expected %d", result, cases[i].expected);
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Test SDL_IntersectFRect
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_IntersectFRect
|
|
||||||
*/
|
|
||||||
int rect_testIntersectFRect(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
SDL_FRect r1;
|
|
||||||
SDL_FRect r2;
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FRect intersect;
|
|
||||||
} cases[] = {
|
|
||||||
{ { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, SDL_FALSE },
|
|
||||||
{ { 0, 0, -200, 200 }, { 0, 0, -200, 200 }, SDL_FALSE },
|
|
||||||
{ { 0, 0, 10, 10 }, { -5, 5, 9.9f, 2 }, SDL_TRUE, { 0, 5, 4.9f, 2 } },
|
|
||||||
{ { 0, 0, 10, 10 }, { -5, -5, 10, 2 }, SDL_FALSE},
|
|
||||||
{ { 0, 0, 10, 10 }, { -5, -5, 2, 10 }, SDL_FALSE},
|
|
||||||
{ { 0, 0, 10, 10 }, { -5, -5, 5, 5 }, SDL_FALSE},
|
|
||||||
{ { 0, 0, 10, 10 }, { -5, -5, 5.5f, 6 }, SDL_TRUE, { 0, 0, 0.5f, 1 } }
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(cases); i++) {
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FRect intersect;
|
|
||||||
SDLTest_AssertPass("About to call SDL_IntersectFRect(&{ %g, %g, %g, %g }, &{ %g, %g, %g, %g })",
|
|
||||||
cases[i].r1.x, cases[i].r1.y, cases[i].r1.w, cases[i].r1.h,
|
|
||||||
cases[i].r2.x, cases[i].r2.y, cases[i].r2.w, cases[i].r2.h
|
|
||||||
);
|
|
||||||
result = SDL_IntersectFRect(&cases[i].r1, &cases[i].r2, &intersect);
|
|
||||||
SDLTest_AssertCheck(result == cases[i].result, "Got %d, expected %d", result, cases[i].result);
|
|
||||||
if (cases[i].result) {
|
|
||||||
SDLTest_AssertCheck(IsFRectEqual(&intersect, &cases[i].intersect),
|
|
||||||
"Got { %g, %g, %g, %g }, expected { %g, %g, %g, %g }",
|
|
||||||
intersect.x, intersect.y, intersect.w, intersect.h,
|
|
||||||
cases[i].intersect.x, cases[i].intersect.y, cases[i].intersect.w, cases[i].intersect.h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Test SDL_UnionFRect
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_UnionFRect
|
|
||||||
*/
|
|
||||||
int rect_testUnionFRect(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
SDL_FRect r1;
|
|
||||||
SDL_FRect r2;
|
|
||||||
SDL_FRect expected;
|
|
||||||
} cases[] = {
|
|
||||||
{ { 0, 0, 10, 10 }, { 19.9f, 20, 10, 10 }, { 0, 0, 29.9f, 30 } },
|
|
||||||
{ { 0, 0, 0, 0 }, { 20, 20.1f, 10.1f, 10 }, { 20, 20.1f, 10.1f, 10 } },
|
|
||||||
{ { -200, -4.5f, 450, 33 }, { 20, 20, 10, 10 }, { -200, -4.5f, 450, 34.5f } },
|
|
||||||
{ { 0, 0, 15, 16.5f }, { 20, 20, 0, 0 }, { 0, 0, 15, 16.5f } }
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(cases); i++) {
|
|
||||||
SDL_FRect result;
|
|
||||||
SDLTest_AssertPass("About to call SDL_UnionFRect(&{ %g, %g, %g, %g }, &{ %g, %g, %g, %g })",
|
|
||||||
cases[i].r1.x, cases[i].r1.y, cases[i].r1.w, cases[i].r1.h,
|
|
||||||
cases[i].r2.x, cases[i].r2.y, cases[i].r2.w, cases[i].r2.h
|
|
||||||
);
|
|
||||||
SDL_UnionFRect(&cases[i].r1, &cases[i].r2, &result);
|
|
||||||
SDLTest_AssertCheck(IsFRectEqual(&result, &cases[i].expected),
|
|
||||||
"Got { %g, %g, %g, %g }, expected { %g, %g, %g, %g }",
|
|
||||||
result.x, result.y, result.w, result.h,
|
|
||||||
cases[i].expected.x, cases[i].expected.y, cases[i].expected.w, cases[i].expected.h);
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Test SDL_EncloseFPointsUnionFRect
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_EncloseFPoints
|
|
||||||
*/
|
|
||||||
int rect_testEncloseFPoints(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
SDL_bool with_clip;
|
|
||||||
SDL_FRect clip;
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FRect enclosing;
|
|
||||||
} cases[] = {
|
|
||||||
{ SDL_TRUE, { 0, 0, 10, 10 }, SDL_TRUE, { 0.5f, 0.1f, 6, 8 }},
|
|
||||||
{ SDL_TRUE, { 1.2f, 1, 10, 10 }, SDL_TRUE, { 1.5f, 1.1f, 5, 7 }},
|
|
||||||
{ SDL_TRUE, { -10, -10, 3, 3 }, SDL_FALSE },
|
|
||||||
{ SDL_FALSE, { 0 }, SDL_TRUE, { 0.5, 0.1f, 6, 8 }}
|
|
||||||
};
|
|
||||||
const SDL_FPoint points[] = {
|
|
||||||
{ 0.5f, 0.1f },
|
|
||||||
{ 5.5f, 7.1f },
|
|
||||||
{ 1.5f, 1.1f }
|
|
||||||
};
|
|
||||||
char points_str[256];
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
SDL_strlcpy(points_str, "{", sizeof(points_str));
|
|
||||||
for (i = 0; i < SDL_arraysize(points); i++) {
|
|
||||||
char point_str[32];
|
|
||||||
SDL_snprintf(point_str, sizeof(point_str), "{ %g, %g }, ", points[i].x, points[i].y);
|
|
||||||
SDL_strlcat(points_str, point_str, sizeof(points_str));
|
|
||||||
}
|
|
||||||
SDL_strlcat(points_str, "}", sizeof(points_str));
|
|
||||||
for (i = 0; i < SDL_arraysize(cases); i++) {
|
|
||||||
char clip_str[64];
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FRect enclosing;
|
|
||||||
const SDL_FRect* clip_ptr = NULL;
|
|
||||||
if (cases[i].with_clip) {
|
|
||||||
SDL_snprintf(clip_str, sizeof(clip_str), "&{ %g, %g, %g, %g }",
|
|
||||||
cases[i].clip.x, cases[i].clip.y, cases[i].clip.w, cases[i].clip.h);
|
|
||||||
clip_ptr = &cases[i].clip;
|
|
||||||
} else {
|
|
||||||
SDL_strlcpy(clip_str, "NULL", sizeof(clip_str));
|
|
||||||
}
|
|
||||||
SDLTest_AssertPass("About to call SDL_EncloseFPoints(&%s, %d, %s)", points_str, (int)SDL_arraysize(points), clip_str);
|
|
||||||
result = SDL_EncloseFPoints(points, SDL_arraysize(points), clip_ptr, &enclosing);
|
|
||||||
SDLTest_AssertCheck(result == cases[i].result, "Got %d, expected %d", result, cases[i].result);
|
|
||||||
if (cases[i].result) {
|
|
||||||
SDLTest_AssertCheck(IsFRectEqual(&enclosing, &cases[i].enclosing),
|
|
||||||
"Got { %g, %g, %g, %g }, expected { %g, %g, %g, %g }",
|
|
||||||
enclosing.x, enclosing.y, enclosing.w, enclosing.h,
|
|
||||||
cases[i].enclosing.x, cases[i].enclosing.y, cases[i].enclosing.w, cases[i].enclosing.h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !
|
|
||||||
* \brief Test SDL_IntersectFRectAndLine
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_IntersectFRectAndLine
|
|
||||||
*/
|
|
||||||
int rect_testIntersectFRectAndLine(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
SDL_FRect rect;
|
|
||||||
SDL_FPoint p1;
|
|
||||||
SDL_FPoint p2;
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FPoint expected1;
|
|
||||||
SDL_FPoint expected2;
|
|
||||||
} cases[] = {
|
|
||||||
{ { 0, 0, 0, 0 }, { -4.8f, -4.8f }, { 5.2f, 5.2f }, SDL_FALSE },
|
|
||||||
{ { 0, 0, 2, 2 }, { -1, -1 }, { 3.5f, 3.5f }, SDL_TRUE, { 0, 0 }, { 1, 1 } },
|
|
||||||
{ { -4, -4, 14, 14 }, { 8, 22 }, { 8, 33}, SDL_FALSE }
|
|
||||||
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(cases); i++) {
|
|
||||||
SDL_bool result;
|
|
||||||
SDL_FPoint p1 = cases[i].p1;
|
|
||||||
SDL_FPoint p2 = cases[i].p2;
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_IntersectFRectAndLine(&{%g, %g, %g, %g}, &%g, &%g, &%g, &%g)",
|
|
||||||
cases[i].rect.x, cases[i].rect.y, cases[i].rect.w, cases[i].rect.h,
|
|
||||||
p1.x, p1.y, p2.x, p2.y);
|
|
||||||
result = SDL_IntersectFRectAndLine(&cases[i].rect, &p1.x, &p1.y, &p2.x, &p2.y);
|
|
||||||
SDLTest_AssertCheck(result == cases[i].result, "Got %d, expected %d", result, cases[i].result);
|
|
||||||
if (cases[i].result) {
|
|
||||||
SDLTest_AssertCheck(IsFPointEqual(&p1, &cases[i].expected1),
|
|
||||||
"Got p1={ %g, %g }, expected p1={ %g, %g }",
|
|
||||||
p1.x, p1.y,
|
|
||||||
cases[i].expected1.x, cases[i].expected1.y);
|
|
||||||
SDLTest_AssertCheck(IsFPointEqual(&p2, &cases[i].expected2),
|
|
||||||
"Got p2={ %g, %g }, expected p2={ %g, %g }",
|
|
||||||
p2.x, p2.y,
|
|
||||||
cases[i].expected2.x, cases[i].expected2.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================= Test References ================== */
|
/* ================= Test References ================== */
|
||||||
|
|
||||||
/* Rect test cases */
|
/* Rect test cases */
|
||||||
@@ -2088,26 +1836,6 @@ static const SDLTest_TestCaseReference rectTest31 = {
|
|||||||
(SDLTest_TestCaseFp)rect_testFRectEqualsParam, "rect_testFRectEqualsParam", "Negative tests against SDL_FRectEquals with invalid parameters", TEST_ENABLED
|
(SDLTest_TestCaseFp)rect_testFRectEqualsParam, "rect_testFRectEqualsParam", "Negative tests against SDL_FRectEquals with invalid parameters", TEST_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference rectTest32 = {
|
|
||||||
(SDLTest_TestCaseFp)rect_testHasIntersectionF, "rect_testHasIntersectionF", "Tests SDL_HasIntersectionF", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference rectTest33 = {
|
|
||||||
(SDLTest_TestCaseFp)rect_testIntersectFRect, "rect_testIntersectFRect", "Tests SDL_IntersectFRect", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference rectTest34 = {
|
|
||||||
(SDLTest_TestCaseFp)rect_testUnionFRect, "rect_testUnionFRect", "Tests SDL_UnionFRect", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference rectTest35 = {
|
|
||||||
(SDLTest_TestCaseFp)rect_testEncloseFPoints, "rect_testEncloseFPoints", "Tests SDL_EncloseFPoints", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference rectTest36 = {
|
|
||||||
(SDLTest_TestCaseFp)rect_testIntersectFRectAndLine, "rect_testIntersectFRectAndLine", "Tests SDL_IntersectFRectAndLine", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
/* !
|
/* !
|
||||||
* \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
|
* \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
|
||||||
*
|
*
|
||||||
@@ -2117,7 +1845,7 @@ static const SDLTest_TestCaseReference rectTest36 = {
|
|||||||
static const SDLTest_TestCaseReference *rectTests[] = {
|
static const SDLTest_TestCaseReference *rectTests[] = {
|
||||||
&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14,
|
&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14,
|
||||||
&rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27,
|
&rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27,
|
||||||
&rectTest28, &rectTest29, &rectTest30, &rectTest31, &rectTest32, &rectTest33, &rectTest34, &rectTest35, &rectTest36, NULL
|
&rectTest28, &rectTest29, &rectTest30, &rectTest31, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Rect test suite (global) */
|
/* Rect test suite (global) */
|
||||||
|
@@ -811,136 +811,6 @@ int render_testBlitBlend(void *arg)
|
|||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Uint32 read_surface_pixel32(SDL_Surface *surface, int x, int y) {
|
|
||||||
Uint32 result;
|
|
||||||
|
|
||||||
if (x >= surface->w || y >= surface->h) {
|
|
||||||
SDLTest_AssertCheck(x < surface->w, "x (%d) < surface->w (%d)", x, surface->w);
|
|
||||||
SDLTest_AssertCheck(y < surface->h, "y (%d) < surface->h (%d)", y, surface->h);
|
|
||||||
result = 0xdeadbabe;
|
|
||||||
} else {
|
|
||||||
SDL_memcpy(&result, (Uint8 *)surface->pixels + surface->pitch * y + surface->format->BytesPerPixel * x, sizeof(Uint32));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int render_testRGBSurfaceNoAlpha(void* arg)
|
|
||||||
{
|
|
||||||
SDL_Surface *surface;
|
|
||||||
SDL_Renderer *software_renderer;
|
|
||||||
SDL_Surface *surface2;
|
|
||||||
SDL_Texture *texture2;
|
|
||||||
int result;
|
|
||||||
SDL_Rect dest_rect;
|
|
||||||
SDL_Point point;
|
|
||||||
Uint32 pixel;
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_CreateRGBSurface(0, 128, 128, 32, 0xff0000, 0xff00, 0xff, 0)");
|
|
||||||
surface = SDL_CreateRGBSurface(0, 128, 128, 32, 0xff0000, 0xff00, 0xff, 0);
|
|
||||||
SDLTest_AssertCheck(surface != NULL, "Returned surface must be not NULL");
|
|
||||||
|
|
||||||
SDLTest_AssertCheck(surface->format->BitsPerPixel == 32, "surface->format->BitsPerPixel should be 32, actual value is %d", surface->format->BitsPerPixel);
|
|
||||||
SDLTest_AssertCheck(surface->format->BytesPerPixel == 4, "surface->format->BytesPerPixels should be 4, actual value is %d", surface->format->BytesPerPixel);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_CreateSoftwareRenderer(surface)");
|
|
||||||
software_renderer = SDL_CreateSoftwareRenderer(surface);
|
|
||||||
SDLTest_AssertCheck(software_renderer != NULL, "Returned renderer must be not NULL");
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_CreateRGBSurface(0, 16, 16, 32, 0xff0000, 0xff00, 0xff, 0)");
|
|
||||||
surface2 = SDL_CreateRGBSurface(0, 16, 16, 32, 0xff0000, 0xff00, 0xff, 0);
|
|
||||||
SDLTest_AssertCheck(surface2 != NULL, "Returned surface must be not NULL");
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_FillRect(surface2, NULL, 0)");
|
|
||||||
result = SDL_FillRect(surface2, NULL, SDL_MapRGB(surface2->format, 0, 0, 0));
|
|
||||||
SDLTest_AssertCheck(result == 0, "Result should be 0, actual value is %d", result);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_CreateTextureFromSurface(software_renderer, surface2)");
|
|
||||||
texture2 = SDL_CreateTextureFromSurface(software_renderer, surface2);
|
|
||||||
SDLTest_AssertCheck(texture2 != NULL, "Returned texture is not NULL");
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_SetRenderDrawColor(renderer, 0xaa, 0xbb, 0xcc, 0x0)");
|
|
||||||
result = SDL_SetRenderDrawColor(software_renderer, 0xaa, 0xbb, 0xcc, 0x0);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_RenderClear(renderer)");
|
|
||||||
result = SDL_RenderClear(software_renderer);
|
|
||||||
SDLTest_AssertCheck(result == 0, "Result should be 0, actual value is %d", result);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_SetRenderDrawColor(renderer, 0x0, 0x0, 0x0, 0x0)");
|
|
||||||
result = SDL_SetRenderDrawColor(software_renderer, 0x0, 0x0, 0x0, 0x0);
|
|
||||||
SDLTest_AssertCheck(result == 0, "Result should be 0, actual value is %d", result);
|
|
||||||
|
|
||||||
dest_rect.x = 32;
|
|
||||||
dest_rect.y = 32;
|
|
||||||
dest_rect.w = surface2->w;
|
|
||||||
dest_rect.h = surface2->h;
|
|
||||||
point.x = 0;
|
|
||||||
point.y = 0;
|
|
||||||
SDLTest_AssertPass("About to call SDL_RenderCopy(software_renderer, texture, NULL, &{%d, %d, %d, %d})",
|
|
||||||
dest_rect.x, dest_rect.h, dest_rect.w, dest_rect.h);
|
|
||||||
result = SDL_RenderCopyEx(software_renderer, texture2, NULL, &dest_rect, 180, &point, SDL_FLIP_NONE);
|
|
||||||
SDLTest_AssertCheck(result == 0, "Result should be 0, actual value is %d", result);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_RenderPresent(software_renderer)");
|
|
||||||
SDL_RenderPresent(software_renderer);
|
|
||||||
|
|
||||||
pixel = read_surface_pixel32(surface, 0, 0);
|
|
||||||
SDLTest_AssertCheck(pixel == 0xAABBCCu, "Pixel at (0, 0) should be 0x%08x, actual value is 0x%08" SDL_PRIx32, 0xAABBCCu, pixel);
|
|
||||||
pixel = read_surface_pixel32(surface, 15, 15);
|
|
||||||
SDLTest_AssertCheck(pixel == 0xAABBCCu, "Pixel at (15, 15) should be 0x%08x, actual value is 0x%08" SDL_PRIx32, 0xAABBCCu, pixel);
|
|
||||||
pixel = read_surface_pixel32(surface, 16, 16);
|
|
||||||
SDLTest_AssertCheck(pixel == 0xFF000000u, "Pixel at (16, 16) should be 0x%08x, actual value is 0x%08" SDL_PRIx32, 0xFF000000u, pixel);
|
|
||||||
pixel = read_surface_pixel32(surface, 31, 31);
|
|
||||||
SDLTest_AssertCheck(pixel == 0xFF000000u, "Pixel at (31, 31) should be 0x%08x, actual value is 0x%08" SDL_PRIx32, 0xFF000000u, pixel);
|
|
||||||
pixel = read_surface_pixel32(surface, 32, 32);
|
|
||||||
SDLTest_AssertCheck(pixel == 0xAABBCCu, "Pixel at (32, 32) should be 0x%08x, actual value is 0x%08" SDL_PRIx32, 0xAABBCCu, pixel);
|
|
||||||
|
|
||||||
SDL_DestroyTexture(texture2);
|
|
||||||
SDL_FreeSurface(surface2);
|
|
||||||
SDL_DestroyRenderer(software_renderer);
|
|
||||||
SDL_FreeSurface(surface);
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Tests setting and getting texture scale mode.
|
|
||||||
*
|
|
||||||
* \sa
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_SetTextureScaleMode
|
|
||||||
* http://wiki.libsdl.org/SDL2/SDL_GetTextureScaleMode
|
|
||||||
*/
|
|
||||||
int render_testGetSetTextureScaleMode(void *arg)
|
|
||||||
{
|
|
||||||
const struct {
|
|
||||||
const char *name;
|
|
||||||
SDL_ScaleMode mode;
|
|
||||||
} modes[] = {
|
|
||||||
{ "SDL_ScaleModeNearest", SDL_ScaleModeNearest },
|
|
||||||
{ "SDL_ScaleModeLinear", SDL_ScaleModeLinear },
|
|
||||||
{ "SDL_ScaleModeBest", SDL_ScaleModeBest }
|
|
||||||
};
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(modes); i++) {
|
|
||||||
SDL_Texture *texture;
|
|
||||||
int result;
|
|
||||||
SDL_ScaleMode actual_mode = SDL_ScaleModeNearest;
|
|
||||||
|
|
||||||
SDL_ClearError();
|
|
||||||
SDLTest_AssertPass("About to call SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 16, 16)");
|
|
||||||
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 16, 16);
|
|
||||||
SDLTest_AssertCheck(texture != NULL, "SDL_CreateTexture must return a non-NULL texture");
|
|
||||||
SDLTest_AssertPass("About to call SDL_SetTextureScaleMode(texture, %s)", modes[i].name);
|
|
||||||
result = SDL_SetTextureScaleMode(texture, modes[i].mode);
|
|
||||||
SDLTest_AssertCheck(result == 0, "SDL_SetTextureScaleMode must return 0, actual %d", result);
|
|
||||||
SDLTest_AssertPass("About to call SDL_GetTextureScaleMode(texture)");
|
|
||||||
result = SDL_GetTextureScaleMode(texture, &actual_mode);
|
|
||||||
SDLTest_AssertCheck(result == 0, "SDL_SetTextureScaleMode must return 0, actual %d", result);
|
|
||||||
SDLTest_AssertCheck(actual_mode == modes[i].mode, "SDL_GetTextureScaleMode must return %s (%d), actual=%d",
|
|
||||||
modes[i].name, modes[i].mode, actual_mode);
|
|
||||||
}
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks to see if functionality is supported. Helper function.
|
* @brief Checks to see if functionality is supported. Helper function.
|
||||||
*/
|
*/
|
||||||
@@ -1291,17 +1161,9 @@ static const SDLTest_TestCaseReference renderTest7 = {
|
|||||||
(SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED
|
(SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference renderTest8 = {
|
|
||||||
(SDLTest_TestCaseFp)render_testGetSetTextureScaleMode, "render_testGetSetTextureScaleMode", "Tests setting/getting texture scale mode", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference renderTest9 = {
|
|
||||||
(SDLTest_TestCaseFp)render_testRGBSurfaceNoAlpha, "render_testRGBSurfaceNoAlpha", "Tests RGB surface with no alpha using software renderer", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Sequence of Render test cases */
|
/* Sequence of Render test cases */
|
||||||
static const SDLTest_TestCaseReference *renderTests[] = {
|
static const SDLTest_TestCaseReference *renderTests[] = {
|
||||||
&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, &renderTest8, &renderTest9, NULL
|
&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Render test suite (global) */
|
/* Render test suite (global) */
|
||||||
|
@@ -208,42 +208,6 @@ static int subsystems_dependRefCountWithExtraInit(void)
|
|||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Inits and Quits timers subsystem, which cannot be explicitly initialized in SDL3
|
|
||||||
*
|
|
||||||
* \sa SDL_InitSubSystem
|
|
||||||
* \sa SDL_QuitSubSystem
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static int subsystems_timersSubsystem(void)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
/* Ensure that we start with reset subsystems. */
|
|
||||||
SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0,
|
|
||||||
"Check result from SDL_WasInit(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)");
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_WasInit(0)");
|
|
||||||
result = SDL_WasInit(0);
|
|
||||||
SDLTest_AssertCheck(result == 0, "SDL_WasInit(0) should return 0, actual 0x%x", result);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_InitSubSystem(SDL_INIT_TIMER)");
|
|
||||||
result = SDL_InitSubSystem(SDL_INIT_TIMER);
|
|
||||||
SDLTest_AssertCheck(result == 0, "Must return 0, actually %d", result);
|
|
||||||
SDLTest_AssertPass("About to call SDL_WasInit(SDL_INIT_TIMER)");
|
|
||||||
result = SDL_WasInit(SDL_INIT_TIMER);
|
|
||||||
SDLTest_AssertCheck(result == SDL_INIT_TIMER, "Must return SDL_INIT_TIMER (=%d), actually %d", SDL_INIT_TIMER, result);
|
|
||||||
SDLTest_AssertPass("About to call SDL_WasInit(0)");
|
|
||||||
result = SDL_WasInit(0);
|
|
||||||
SDLTest_AssertCheck(result == SDL_INIT_TIMER, "SDL_WasInit(0) should return SDL_INIT_TIMER, actual 0x%x", result);
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_QuitSubSystem(SDL_INIT_TIMER)");
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_TIMER);
|
|
||||||
SDLTest_AssertPass("SDL_QuitSubSystem finished");
|
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================= Test References ================== */
|
/* ================= Test References ================== */
|
||||||
|
|
||||||
/* Subsystems test cases */
|
/* Subsystems test cases */
|
||||||
@@ -263,13 +227,9 @@ static const SDLTest_TestCaseReference subsystemsTest4 = {
|
|||||||
(SDLTest_TestCaseFp)subsystems_dependRefCountWithExtraInit, "subsystems_dependRefCountWithExtraInit", "Check reference count of subsystem dependencies.", TEST_ENABLED
|
(SDLTest_TestCaseFp)subsystems_dependRefCountWithExtraInit, "subsystems_dependRefCountWithExtraInit", "Check reference count of subsystem dependencies.", TEST_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference subsystemsTest5 = {
|
|
||||||
(SDLTest_TestCaseFp)subsystems_timersSubsystem, "subsystems_timersSubsystem", "Check timer subsystem, removed in SDL3.", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Sequence of Events test cases */
|
/* Sequence of Events test cases */
|
||||||
static const SDLTest_TestCaseReference *subsystemsTests[] = {
|
static const SDLTest_TestCaseReference *subsystemsTests[] = {
|
||||||
&subsystemsTest1, &subsystemsTest2, &subsystemsTest3, &subsystemsTest4, &subsystemsTest5, NULL
|
&subsystemsTest1, &subsystemsTest2, &subsystemsTest3, &subsystemsTest4, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Events test suite (global) */
|
/* Events test suite (global) */
|
||||||
|
@@ -2251,33 +2251,6 @@ static int video_getWindowSurface(void *arg)
|
|||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests SDL_SetWindowInputFocus
|
|
||||||
*/
|
|
||||||
static int video_setWindowInputFocus(void *arg)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
SDL_Window *window;
|
|
||||||
|
|
||||||
SDLTest_AssertPass("SDL_SetWindowInputFocus is not supported on dummy and SDL2 wayland driver");
|
|
||||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0 || SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
|
||||||
return TEST_SKIPPED;
|
|
||||||
}
|
|
||||||
|
|
||||||
window = _createVideoSuiteTestWindow("video_setWindowInputFocus");
|
|
||||||
if (!window) {
|
|
||||||
return TEST_ABORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDLTest_AssertPass("About to call SDL_SetWindowInputFocus(window)");
|
|
||||||
result = SDL_SetWindowInputFocus(window);
|
|
||||||
SDLTest_AssertCheck(result == 0, "Result is %d, expected 0", result);
|
|
||||||
|
|
||||||
_destroyVideoSuiteTestWindow(window);
|
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================= Test References ================== */
|
/* ================= Test References ================== */
|
||||||
|
|
||||||
/* Video test cases */
|
/* Video test cases */
|
||||||
@@ -2365,9 +2338,6 @@ static const SDLTest_TestCaseReference videoTest24 =
|
|||||||
static const SDLTest_TestCaseReference videoTest25 = {
|
static const SDLTest_TestCaseReference videoTest25 = {
|
||||||
(SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
|
(SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED
|
||||||
};
|
};
|
||||||
static const SDLTest_TestCaseReference videoTest26 = {
|
|
||||||
(SDLTest_TestCaseFp)video_setWindowInputFocus, "video_setWindowInputFocus", "Checks window input focus", TEST_ENABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Sequence of Video test cases */
|
/* Sequence of Video test cases */
|
||||||
static const SDLTest_TestCaseReference *videoTests[] = {
|
static const SDLTest_TestCaseReference *videoTests[] = {
|
||||||
@@ -2375,7 +2345,7 @@ static const SDLTest_TestCaseReference *videoTests[] = {
|
|||||||
&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
|
&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
|
||||||
&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
|
&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
|
||||||
&videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22,
|
&videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22,
|
||||||
&videoTest23, &videoTest24, &videoTest25, &videoTest26, NULL
|
&videoTest23, &videoTest24, &videoTest25, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Video test suite (global) */
|
/* Video test suite (global) */
|
||||||
|
Reference in New Issue
Block a user