mirror of
https://github.com/visualboyadvance-m/visualboyadvance-m
synced 2025-10-06 16:12:51 +02:00
Compare commits
1 Commits
sfml-downg
...
wxwidgets-
Author | SHA1 | Date | |
---|---|---|---|
|
fcae420599 |
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,6 +1,10 @@
|
|||||||
[submodule "win32-deps"]
|
[submodule "win32-deps"]
|
||||||
path = win32-deps
|
path = win32-deps
|
||||||
url = https://github.com/visualboyadvance-m/win32-deps.git
|
url = https://github.com/visualboyadvance-m/win32-deps.git
|
||||||
|
branch = master
|
||||||
[submodule "third_party/googletest"]
|
[submodule "third_party/googletest"]
|
||||||
path = third_party/googletest
|
path = third_party/googletest
|
||||||
url = https://github.com/google/googletest.git
|
url = https://github.com/google/googletest.git
|
||||||
|
[submodule "third_party/wxWidgets"]
|
||||||
|
path = third_party/wxWidgets
|
||||||
|
url = https://github.com/wxWidgets/wxWidgets.git
|
||||||
|
@@ -22,9 +22,10 @@ if(TAG_RELEASE)
|
|||||||
include(MakeReleaseCommitAndTag)
|
include(MakeReleaseCommitAndTag)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets)
|
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext)
|
||||||
|
|
||||||
set(VCPKG_DEPS_OPTIONAL
|
set(VCPKG_DEPS_OPTIONAL
|
||||||
|
sfml ENABLE_LINK
|
||||||
ffmpeg ENABLE_FFMPEG
|
ffmpeg ENABLE_FFMPEG
|
||||||
faudio ENABLE_FAUDIO
|
faudio ENABLE_FAUDIO
|
||||||
)
|
)
|
||||||
@@ -72,16 +73,32 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
project(VBA-M C CXX)
|
set(VBAM_LANGUAGES C CXX)
|
||||||
|
if(APPLE)
|
||||||
|
list(APPEND VBAM_LANGUAGES OBJCXX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(VBA-M ${VBAM_LANGUAGES})
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
include(FetchContent)
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(Architecture)
|
include(Architecture)
|
||||||
include(Options)
|
include(Options)
|
||||||
include(Toolchain)
|
include(Toolchain)
|
||||||
include(Dependencies)
|
include(Dependencies)
|
||||||
|
|
||||||
|
function(configure_vbam_target target)
|
||||||
|
get_target_property(target_type ${target} TYPE)
|
||||||
|
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
|
set(target_scope "INTERFACE")
|
||||||
|
else()
|
||||||
|
set(target_scope "PRIVATE")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(${target} ${target_scope} ${VBAM_COMPILE_DEFS})
|
||||||
|
target_compile_options(${target} ${target_scope} ${VBAM_COMPILE_OPTS})
|
||||||
|
target_link_options(${target} ${target_scope} ${VBAM_LINK_OPTS})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# Disable tests when not in a git checkout.
|
# Disable tests when not in a git checkout.
|
||||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||||
set(BUILD_TESTING OFF)
|
set(BUILD_TESTING OFF)
|
||||||
@@ -91,20 +108,19 @@ endif()
|
|||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||||
|
add_subdirectory(third_party/googletest)
|
||||||
if(NOT EXISTS third_party/googletest/CMakeLists.txt)
|
|
||||||
execute_process(
|
|
||||||
COMMAND git submodule update --init --recursive -- third_party/googletest
|
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS third_party/googletest/CMakeLists.txt)
|
|
||||||
add_subdirectory(./third_party/googletest)
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
else()
|
|
||||||
set(BUILD_TESTING OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Configure wxWidgets.
|
||||||
|
if(NOT VBAM_DEPS_wxWidgets_SYSTEM)
|
||||||
|
set(wxBUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||||
|
set(wxBUILD_INSTALL OFF CACHE BOOL "" FORCE)
|
||||||
|
set(wxUSE_WEBVIEW OFF CACHE BOOL "" FORCE)
|
||||||
|
set(wxWidgets_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/wxWidgets")
|
||||||
|
add_subdirectory(third_party/wxWidgets)
|
||||||
|
set(wxWidgets_LIBRARIES wx::xrc wx::xml wx::html wx::adv wx::net wx::core wx::base wx::gl)
|
||||||
|
set(wxWidgets_INCLUDE_DIRS third_party/wxWidgets/include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
|
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
|
||||||
@@ -182,18 +198,8 @@ endif()
|
|||||||
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
|
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
|
||||||
|
|
||||||
if(NOT TRANSLATIONS_ONLY)
|
if(NOT TRANSLATIONS_ONLY)
|
||||||
include_directories(third_party/include/nonstd)
|
add_subdirectory(third_party/include/nonstd)
|
||||||
include_directories(third_party/include/ghc)
|
|
||||||
add_subdirectory(third_party/include/stb)
|
add_subdirectory(third_party/include/stb)
|
||||||
|
|
||||||
if(ENABLE_LINK)
|
|
||||||
include_directories(third_party/sfml/include)
|
|
||||||
add_subdirectory(third_party/sfml/src/SFML/System EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(third_party/sfml/src/SFML/Network EXCLUDE_FROM_ALL)
|
|
||||||
set(SFML_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/sfml/include)
|
|
||||||
set(SFML_LIBRARIES sfml-system sfml-network)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(src/core)
|
add_subdirectory(src/core)
|
||||||
add_subdirectory(src/components)
|
add_subdirectory(src/components)
|
||||||
add_subdirectory(src/sdl)
|
add_subdirectory(src/sdl)
|
||||||
|
@@ -166,6 +166,7 @@ And the following development libraries:
|
|||||||
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
|
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
|
||||||
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools
|
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools
|
||||||
- [SDL2](https://www.libsdl.org/) (required)
|
- [SDL2](https://www.libsdl.org/) (required)
|
||||||
|
- [SFML](https://www.sfml-dev.org/) (optional, for link)
|
||||||
- [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
- [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
||||||
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
||||||
|
|
||||||
@@ -210,7 +211,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
|
|||||||
| `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds |
|
| `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds |
|
||||||
| `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
| `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
||||||
| `ENABLE_MMX` | Enable MMX | ON for 32 bit builds |
|
| `ENABLE_MMX` | Enable MMX | ON for 32 bit builds |
|
||||||
| `ENABLE_LINK` | Enable GBA linking functionality | AUTO |
|
| `ENABLE_LINK` | Enable GBA linking functionality (requires SFML) | AUTO |
|
||||||
| `ENABLE_LIRC` | Enable LIRC support | OFF |
|
| `ENABLE_LIRC` | Enable LIRC support | OFF |
|
||||||
| `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO |
|
| `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO |
|
||||||
| `ENABLE_ONLINEUPDATES` | Enable online update checks | ON |
|
| `ENABLE_ONLINEUPDATES` | Enable online update checks | ON |
|
||||||
@@ -223,6 +224,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
|
|||||||
| `BUILD_TESTING` | Build the tests and enable ctest support. | ON |
|
| `BUILD_TESTING` | Build the tests and enable ctest support. | ON |
|
||||||
| `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF |
|
| `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF |
|
||||||
| `SDL2_STATIC` | Try to link static SDL2 libraries | OFF |
|
| `SDL2_STATIC` | Try to link static SDL2 libraries | OFF |
|
||||||
|
| `SFML_STATIC_LIBRARIES` | Try to link static SFML libraries | OFF |
|
||||||
| `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF |
|
| `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF |
|
||||||
| `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF |
|
| `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF |
|
||||||
| `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF |
|
| `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF |
|
||||||
|
@@ -57,11 +57,11 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
|
|||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
||||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
|
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
|
||||||
set(ARM32 ON)
|
set(ARM32 ON)
|
||||||
set(ARCH_NAME ARM32)
|
set(ARCH_NAME arm32)
|
||||||
set(WINARCH arm)
|
set(WINARCH arm)
|
||||||
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||||
set(ARM64 ON)
|
set(ARM64 ON)
|
||||||
set(ARCH_NAME ARM64)
|
set(ARCH_NAME arm64)
|
||||||
set(WINARCH arm64)
|
set(WINARCH arm64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ if(ENABLE_FFMPEG)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_definitions(NO_FFMPEG)
|
list(APPEND VBAM_COMPILE_DEFS NO_FFMPEG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_LINK)
|
if(ENABLE_LINK)
|
||||||
@@ -80,10 +80,10 @@ if(ENABLE_LINK)
|
|||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||||
if(SEM_TIMEDWAIT)
|
if(SEM_TIMEDWAIT)
|
||||||
add_compile_definitions(HAVE_SEM_TIMEDWAIT)
|
list(APPEND VBAM_COMPILE_DEFS HAVE_SEM_TIMEDWAIT)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_definitions(NO_LINK)
|
list(APPEND VBAM_COMPILE_DEFS NO_LINK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# for now, only GBALink.cpp uses gettext() directly
|
# for now, only GBALink.cpp uses gettext() directly
|
||||||
@@ -119,3 +119,4 @@ if(ENABLE_LINK OR ENABLE_WX)
|
|||||||
message(FATAL_ERROR "NLS requires libintl/gettext")
|
message(FATAL_ERROR "NLS requires libintl/gettext")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
110
cmake/FindOpenAL.cmake
Normal file
110
cmake/FindOpenAL.cmake
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
#.rst:
|
||||||
|
# FindOpenAL
|
||||||
|
# ----------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
|
||||||
|
# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
|
||||||
|
# the headers
|
||||||
|
#
|
||||||
|
# $OPENALDIR is an environment variable that would correspond to the
|
||||||
|
# ./configure --prefix=$OPENALDIR used in building OpenAL.
|
||||||
|
#
|
||||||
|
# Created by Eric Wing. This was influenced by the FindSDL.cmake
|
||||||
|
# module.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2005-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# This makes the presumption that you are include al.h like
|
||||||
|
# #include "al.h"
|
||||||
|
# and not
|
||||||
|
# #include <AL/al.h>
|
||||||
|
# The reason for this is that the latter is not entirely portable.
|
||||||
|
# Windows/Creative Labs does not by default put their headers in AL/ and
|
||||||
|
# OS X uses the convention <OpenAL/al.h>.
|
||||||
|
#
|
||||||
|
# For Windows, Creative Labs seems to have added a registry key for their
|
||||||
|
# OpenAL 1.1 installer. I have added that key to the list of search paths,
|
||||||
|
# however, the key looks like it could be a little fragile depending on
|
||||||
|
# if they decide to change the 1.00.0000 number for bug fix releases.
|
||||||
|
# Also, they seem to have laid down groundwork for multiple library platforms
|
||||||
|
# which puts the library in an extra subdirectory. Currently there is only
|
||||||
|
# Win32 and I have hardcoded that here. This may need to be adjusted as
|
||||||
|
# platforms are introduced.
|
||||||
|
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
|
||||||
|
# I do not know if the Nvidia OpenAL SDK has a registry key.
|
||||||
|
#
|
||||||
|
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
|
||||||
|
# To support the framework, I originally wrote special framework detection
|
||||||
|
# code in this module which I have now removed with CMake's introduction
|
||||||
|
# of native support for frameworks.
|
||||||
|
# In addition, OpenAL is open source, and it is possible to compile on Panther.
|
||||||
|
# Furthermore, due to bugs in the initial OpenAL release, and the
|
||||||
|
# transition to OpenAL 1.1, it is common to need to override the built-in
|
||||||
|
# framework.
|
||||||
|
# Per my request, CMake should search for frameworks first in
|
||||||
|
# the following order:
|
||||||
|
# ~/Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
# /Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
# /System/Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
#
|
||||||
|
# On OS X, this will prefer the Framework version (if found) over others.
|
||||||
|
# People will have to manually change the cache values of
|
||||||
|
# OPENAL_LIBRARY to override this selection or set the CMake environment
|
||||||
|
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||||
|
|
||||||
|
find_path(OPENAL_INCLUDE_DIR al.h
|
||||||
|
HINTS
|
||||||
|
ENV OPENALDIR
|
||||||
|
PATH_SUFFIXES AL OpenAL
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local # DarwinPorts
|
||||||
|
/opt/csw # Blastwave
|
||||||
|
/opt
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(_OpenAL_ARCH_DIR libs/Win64)
|
||||||
|
else()
|
||||||
|
set(_OpenAL_ARCH_DIR libs/Win32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(OPENAL_LIBRARY
|
||||||
|
NAMES OpenAL al openal OpenAL32
|
||||||
|
HINTS
|
||||||
|
ENV OPENALDIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||||
|
)
|
||||||
|
|
||||||
|
unset(_OpenAL_ARCH_DIR)
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
365
cmake/FindSFML.cmake
Normal file
365
cmake/FindSFML.cmake
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
# This script locates the SFML library
|
||||||
|
# ------------------------------------
|
||||||
|
#
|
||||||
|
# Usage
|
||||||
|
# -----
|
||||||
|
#
|
||||||
|
# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
|
||||||
|
# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
|
||||||
|
# example:
|
||||||
|
# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
|
||||||
|
#
|
||||||
|
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
|
||||||
|
# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
|
||||||
|
# example:
|
||||||
|
# find_package(SFML COMPONENTS ...) # no specific version required
|
||||||
|
# find_package(SFML 2 COMPONENTS ...) # any 2.x version
|
||||||
|
# find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
|
||||||
|
#
|
||||||
|
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
|
||||||
|
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
|
||||||
|
# Since you have to link yourself all the SFML dependencies when you link it statically, the following
|
||||||
|
# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
|
||||||
|
# description below).
|
||||||
|
# In case of static linking, the SFML_STATIC macro will also be defined by this script.
|
||||||
|
# example:
|
||||||
|
# set(SFML_STATIC_LIBRARIES TRUE)
|
||||||
|
# find_package(SFML 2 COMPONENTS network system)
|
||||||
|
#
|
||||||
|
# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
|
||||||
|
# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
|
||||||
|
# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
|
||||||
|
# are available for both release and debug modes.
|
||||||
|
#
|
||||||
|
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
|
||||||
|
# to tell CMake where SFML is.
|
||||||
|
#
|
||||||
|
# Output
|
||||||
|
# ------
|
||||||
|
#
|
||||||
|
# This script defines the following variables:
|
||||||
|
# - For each specified module XXX (system, window, graphics, network, audio, main):
|
||||||
|
# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
|
||||||
|
# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
|
||||||
|
# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
|
||||||
|
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
|
||||||
|
# - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking
|
||||||
|
# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
|
||||||
|
# - SFML_FOUND: true if all the required modules are found
|
||||||
|
# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
|
||||||
|
# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
|
||||||
|
#
|
||||||
|
# example:
|
||||||
|
# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
|
||||||
|
# include_directories(${SFML_INCLUDE_DIR})
|
||||||
|
# add_executable(myapp ...)
|
||||||
|
# target_link_libraries(myapp ${SFML_LIBRARIES})
|
||||||
|
|
||||||
|
# define the SFML_STATIC macro if static build was chosen
|
||||||
|
if(SFML_STATIC_LIBRARIES)
|
||||||
|
list(APPEND VBAM_COMPILE_DEFS SFML_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# define the list of search paths for headers and libraries
|
||||||
|
set(FIND_SFML_PATHS
|
||||||
|
${SFML_ROOT}
|
||||||
|
$ENV{SFML_ROOT}
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt)
|
||||||
|
|
||||||
|
# find the SFML include directory
|
||||||
|
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# check the version number
|
||||||
|
set(SFML_VERSION_OK TRUE)
|
||||||
|
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
||||||
|
# extract the major and minor version numbers from SFML/Config.hpp
|
||||||
|
# we have to handle framework a little bit differently:
|
||||||
|
if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
|
||||||
|
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
|
||||||
|
else()
|
||||||
|
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
|
||||||
|
endif()
|
||||||
|
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
|
||||||
|
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MAJOR *([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
|
||||||
|
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MINOR *([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
|
||||||
|
STRING(REGEX REPLACE ".*#define *SFML_VERSION_PATCH *([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
|
||||||
|
if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
|
||||||
|
set(SFML_VERSION_PATCH 0)
|
||||||
|
endif()
|
||||||
|
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
|
||||||
|
|
||||||
|
# if we could extract them, compare with the requested version number
|
||||||
|
if (SFML_VERSION_MAJOR)
|
||||||
|
# transform version numbers to an integer
|
||||||
|
math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
|
||||||
|
|
||||||
|
# compare them
|
||||||
|
if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
|
||||||
|
set(SFML_VERSION_OK FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# SFML version is < 2.0
|
||||||
|
if (SFML_REQUESTED_VERSION GREATER 10900)
|
||||||
|
set(SFML_VERSION_OK FALSE)
|
||||||
|
set(SFML_VERSION_MAJOR 1)
|
||||||
|
set(SFML_VERSION_MINOR x)
|
||||||
|
set(SFML_VERSION_PATCH x)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# find the requested modules
|
||||||
|
set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
|
||||||
|
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
||||||
|
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
|
||||||
|
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
|
||||||
|
set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
|
||||||
|
|
||||||
|
# no suffix for sfml-main, it is always a static library
|
||||||
|
if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
|
||||||
|
# release library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# debug library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
else()
|
||||||
|
# static release library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}-s
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# static debug library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# dynamic release library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# dynamic debug library
|
||||||
|
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS ${FIND_SFML_PATHS})
|
||||||
|
|
||||||
|
# choose the entries that fit the requested link type
|
||||||
|
if(SFML_STATIC_LIBRARIES)
|
||||||
|
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
|
||||||
|
endif()
|
||||||
|
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
|
||||||
|
endif()
|
||||||
|
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||||
|
# library found
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
|
||||||
|
|
||||||
|
# if both are found, set SFML_XXX_LIBRARY to contain both
|
||||||
|
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
|
||||||
|
optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# if only one debug/release variant is found, set the other to be equal to the found one
|
||||||
|
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||||
|
# debug and not release
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
|
||||||
|
endif()
|
||||||
|
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
|
||||||
|
# release and not debug
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# library not found
|
||||||
|
set(SFML_FOUND FALSE)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
|
||||||
|
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
|
||||||
|
set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# mark as advanced
|
||||||
|
MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
|
||||||
|
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
|
||||||
|
|
||||||
|
# add to the global list of libraries
|
||||||
|
set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# in case of static linking, we must also define the list of all the dependencies of SFML libraries
|
||||||
|
if(SFML_STATIC_LIBRARIES)
|
||||||
|
|
||||||
|
# detect the OS
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
|
set(FIND_SFML_OS_WINDOWS 1)
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
set(FIND_SFML_OS_LINUX 1)
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
|
set(FIND_SFML_OS_FREEBSD 1)
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(FIND_SFML_OS_MACOSX 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# start with an empty list
|
||||||
|
set(SFML_DEPENDENCIES)
|
||||||
|
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||||
|
|
||||||
|
# macro that searches for a 3rd-party library
|
||||||
|
macro(find_sfml_dependency output friendlyname)
|
||||||
|
# No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
|
||||||
|
find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
|
||||||
|
if(${${output}} STREQUAL "${output}-NOTFOUND")
|
||||||
|
unset(output)
|
||||||
|
set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# sfml-system
|
||||||
|
list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
|
||||||
|
if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
|
||||||
|
|
||||||
|
# update the list -- these are only system libraries, no need to find them
|
||||||
|
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
|
||||||
|
set(SFML_SYSTEM_DEPENDENCIES "pthread")
|
||||||
|
endif()
|
||||||
|
if(FIND_SFML_OS_LINUX)
|
||||||
|
set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
|
||||||
|
endif()
|
||||||
|
if(FIND_SFML_OS_WINDOWS)
|
||||||
|
set(SFML_SYSTEM_DEPENDENCIES "winmm")
|
||||||
|
endif()
|
||||||
|
set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# sfml-network
|
||||||
|
list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
|
||||||
|
if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
|
||||||
|
|
||||||
|
# update the list -- these are only system libraries, no need to find them
|
||||||
|
if(FIND_SFML_OS_WINDOWS)
|
||||||
|
set(SFML_NETWORK_DEPENDENCIES "ws2_32")
|
||||||
|
endif()
|
||||||
|
set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# sfml-window
|
||||||
|
list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
|
||||||
|
if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
|
||||||
|
|
||||||
|
# find libraries
|
||||||
|
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
||||||
|
find_sfml_dependency(X11_LIBRARY "X11" X11)
|
||||||
|
find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FIND_SFML_OS_LINUX)
|
||||||
|
find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# update the list
|
||||||
|
if(FIND_SFML_OS_WINDOWS)
|
||||||
|
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
|
||||||
|
elseif(FIND_SFML_OS_LINUX)
|
||||||
|
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
|
||||||
|
elseif(FIND_SFML_OS_FREEBSD)
|
||||||
|
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
|
||||||
|
elseif(FIND_SFML_OS_MACOSX)
|
||||||
|
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
|
||||||
|
endif()
|
||||||
|
set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# sfml-graphics
|
||||||
|
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
|
||||||
|
if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
|
||||||
|
|
||||||
|
# find libraries
|
||||||
|
find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
|
||||||
|
find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
|
||||||
|
|
||||||
|
# update the list
|
||||||
|
set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
|
||||||
|
set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# sfml-audio
|
||||||
|
list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
|
||||||
|
if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
|
||||||
|
|
||||||
|
# find libraries
|
||||||
|
find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
|
||||||
|
find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
|
||||||
|
find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
|
||||||
|
find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
|
||||||
|
find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
|
||||||
|
find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
|
||||||
|
|
||||||
|
# update the list
|
||||||
|
set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
||||||
|
set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# handle errors
|
||||||
|
if(NOT SFML_VERSION_OK)
|
||||||
|
# SFML version not ok
|
||||||
|
set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
|
||||||
|
set(SFML_FOUND FALSE)
|
||||||
|
elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||||
|
set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
|
||||||
|
set(SFML_FOUND FALSE)
|
||||||
|
elseif(NOT SFML_FOUND)
|
||||||
|
# include directory or library not found
|
||||||
|
set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
|
||||||
|
endif()
|
||||||
|
if (NOT SFML_FOUND)
|
||||||
|
if(SFML_FIND_REQUIRED)
|
||||||
|
# fatal error
|
||||||
|
message(FATAL_ERROR ${FIND_SFML_ERROR})
|
||||||
|
elseif(NOT SFML_FIND_QUIETLY)
|
||||||
|
# error but continue
|
||||||
|
message("${FIND_SFML_ERROR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# handle success
|
||||||
|
if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
|
||||||
|
endif()
|
@@ -30,6 +30,7 @@ option(VBAM_STATIC "Try to link all libraries statically" ${VBAM_STATIC_DEFAULT}
|
|||||||
|
|
||||||
if(VBAM_STATIC)
|
if(VBAM_STATIC)
|
||||||
set(SDL2_STATIC ON)
|
set(SDL2_STATIC ON)
|
||||||
|
set(SFML_STATIC_LIBRARIES ON)
|
||||||
set(FFMPEG_STATIC ON)
|
set(FFMPEG_STATIC ON)
|
||||||
set(OPENAL_STATIC ON)
|
set(OPENAL_STATIC ON)
|
||||||
set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
|
set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
|
||||||
@@ -67,9 +68,15 @@ endif()
|
|||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|
||||||
# Link / SFML
|
# Link / SFML
|
||||||
if(NOT TRANSLATIONS_ONLY)
|
if(TRANSLATIONS_ONLY)
|
||||||
|
set(ENABLE_LINK_DEFAULT OFF)
|
||||||
|
else()
|
||||||
|
find_package(SFML 2.4 COMPONENTS network system)
|
||||||
|
set(ENABLE_LINK_DEFAULT OFF)
|
||||||
|
if(SFML_FOUND)
|
||||||
set(ENABLE_LINK_DEFAULT ON)
|
set(ENABLE_LINK_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT})
|
option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT})
|
||||||
|
|
||||||
# FFMpeg
|
# FFMpeg
|
||||||
@@ -154,4 +161,23 @@ if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
|
|||||||
message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled")
|
message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_WX)
|
||||||
|
if(WIN32 OR APPLE)
|
||||||
|
# We always build wxWidgets from source on Windows and macOS. We do not
|
||||||
|
# support using a system wxWidgets on these platforms.
|
||||||
|
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT OFF)
|
||||||
|
else()
|
||||||
|
# On other platforms, we first look for a system wxWidgets, and if that
|
||||||
|
# fails, we build from source. Note that we still prefer building from
|
||||||
|
# source on Linux.
|
||||||
|
find_package(wxWidgets COMPONENTS xrc xml html adv net core base gl)
|
||||||
|
if(wxWidgets_FOUND)
|
||||||
|
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT ON)
|
||||||
|
else()
|
||||||
|
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
option(VBAM_DEPS_wxWidgets_SYSTEM "Use system wxWidgets" ${VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT})
|
||||||
|
endif()
|
||||||
|
|
||||||
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
|
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
|
||||||
|
@@ -502,7 +502,7 @@ function(vcpkg_set_toolchain)
|
|||||||
|
|
||||||
# Install core deps.
|
# Install core deps.
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${vcpkg_exe} --triplet ${VCPKG_TARGET_TRIPLET} install ${pkg}
|
COMMAND ${vcpkg_exe} install ${VCPKG_DEPS_QUALIFIED}
|
||||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ function(vcpkg_set_toolchain)
|
|||||||
set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}")
|
set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}")
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND --triplet ${VCPKG_TARGET_TRIPLET} ${vcpkg_exe} install ${dep}
|
COMMAND ${vcpkg_exe} install ${dep_qualified}
|
||||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -5,8 +5,8 @@ endif()
|
|||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
check_cxx_compiler_flag(/fsanitize=address MSVC_ASAN_SUPPORTED)
|
check_cxx_compiler_flag(/fsanitize=address MSVC_ASAN_SUPPORTED)
|
||||||
if(MSVC_ASAN_SUPPORTED)
|
if(MSVC_ASAN_SUPPORTED)
|
||||||
add_compile_options(/fsanitize=address)
|
list(APPEND VBAM_COMPILE_OPTS /fsanitize=address)
|
||||||
add_compile_definitions(_DISABLE_VECTOR_ANNOTATION _DISABLE_STRING_ANNOTATION)
|
list(APPEND VBAM_COMPILE_DEFS _DISABLE_VECTOR_ANNOTATION _DISABLE_STRING_ANNOTATION)
|
||||||
else()
|
else()
|
||||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||||
set(ENABLE_ASAN OFF)
|
set(ENABLE_ASAN OFF)
|
||||||
@@ -27,8 +27,8 @@ else()
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS ${BACKUP_LINKER_FLAGS})
|
set(CMAKE_EXE_LINKER_FLAGS ${BACKUP_LINKER_FLAGS})
|
||||||
|
|
||||||
if(ASAN_SUPPORTED)
|
if(ASAN_SUPPORTED)
|
||||||
add_compile_options(-fsanitize=address)
|
list(APPEND VBAM_COMPILE_OPTS -fsanitize=address)
|
||||||
add_link_options(-fsanitize=address)
|
list(APPEND VBAM_LINK_OPTS -fsanitize=address)
|
||||||
else()
|
else()
|
||||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||||
set(ENABLE_ASAN OFF)
|
set(ENABLE_ASAN OFF)
|
||||||
|
@@ -1,25 +1,19 @@
|
|||||||
if(X86_32 OR X86_64)
|
if(X86_32 OR X86_64)
|
||||||
add_compile_options(-mfpmath=sse -msse2)
|
list(APPEND VBAM_COMPILE_OPTS -mfpmath=sse -msse2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UPSTREAM_RELEASE)
|
if(UPSTREAM_RELEASE)
|
||||||
if(X86_64)
|
if(X86_64)
|
||||||
# Require and optimize for Core2 level support, tune for generic.
|
# Require and optimize for Core2 level support, tune for generic.
|
||||||
if(APPLE)
|
list(APPEND VBAM_COMPILE_OPTS -march=core2 -mtune=generic)
|
||||||
add_compile_options(-march=core2 -mtune=skylake)
|
|
||||||
else()
|
|
||||||
add_compile_options(-march=core2 -mtune=generic)
|
|
||||||
endif()
|
|
||||||
elseif(X86_32)
|
elseif(X86_32)
|
||||||
# Optimize for pentiumi3 and tune for generic for Windows XP builds.
|
# Optimize for pentium-mmx and tune for generic for older builds.
|
||||||
set(WINXP TRUE)
|
list(APPEND VBAM_COMPILE_OPTS -march=pentium-mmx -mtune=generic)
|
||||||
add_compile_options(-march=pentium3 -mtune=generic)
|
|
||||||
add_compile_definitions(-DWINXP)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Common flags.
|
# Common flags.
|
||||||
add_compile_options(
|
list(APPEND VBAM_COMPILE_OPTS
|
||||||
-pipe
|
-pipe
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
|
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
|
||||||
-Wformat
|
-Wformat
|
||||||
@@ -28,9 +22,9 @@ add_compile_options(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_compile_options(-Wno-unused-command-line-argument)
|
list(APPEND VBAM_COMPILE_OPTS -Wno-unused-command-line-argument)
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(-feliminate-unused-debug-types)
|
list(APPEND VBAM_COMPILE_OPTS -feliminate-unused-debug-types)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# check if ssp flags are supported.
|
# check if ssp flags are supported.
|
||||||
@@ -38,23 +32,23 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||||||
check_cxx_compiler_flag(-fstack-protector-strong STACK_PROTECTOR_SUPPORTED)
|
check_cxx_compiler_flag(-fstack-protector-strong STACK_PROTECTOR_SUPPORTED)
|
||||||
|
|
||||||
if(STACK_PROTECTOR_SUPPORTED)
|
if(STACK_PROTECTOR_SUPPORTED)
|
||||||
add_compile_options(-fstack-protector-strong)
|
list(APPEND VBAM_COMPILE_OPTS -fstack-protector-strong)
|
||||||
|
|
||||||
check_cxx_compiler_flag("--param ssp-buffer-size=4" SSP_BUFFER_SIZE_SUPPORTED)
|
check_cxx_compiler_flag("--param ssp-buffer-size=4" SSP_BUFFER_SIZE_SUPPORTED)
|
||||||
if(SSP_BUFFER_SIZE_SUPPORTED)
|
if(SSP_BUFFER_SIZE_SUPPORTED)
|
||||||
add_compile_options(--param ssp-buffer-size=4)
|
list(APPEND VBAM_COMPILE_OPTS --param ssp-buffer-size=4)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
|
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
|
||||||
add_compile_options(-fPIC)
|
list(APPEND VBAM_COMPILE_OPTS -fPIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_compile_options(-ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
list(APPEND VBAM_COMPILE_OPTS -ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-O3 -ffast-math -fomit-frame-pointer)
|
list(APPEND VBAM_COMPILE_OPTS -Ofast -fomit-frame-pointer)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# for some reason this is necessary
|
# for some reason this is necessary
|
||||||
@@ -64,17 +58,17 @@ endif()
|
|||||||
|
|
||||||
if(VBAM_STATIC)
|
if(VBAM_STATIC)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_link_options(-static-libstdc++)
|
list(APPEND VBAM_LINK_OPTS -static-libstdc++)
|
||||||
else()
|
else()
|
||||||
add_link_options(-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
list(APPEND VBAM_LINK_OPTS -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# To support LTO, this must always fail.
|
# To support LTO, this must always fail.
|
||||||
add_compile_options(-Werror=odr -Werror=strict-aliasing)
|
list(APPEND VBAM_COMPILE_OPTS -Werror=odr -Werror=strict-aliasing)
|
||||||
add_link_options( -Werror=odr -Werror=strict-aliasing)
|
list(APPEND VBAM_LINK_OPTS -Werror=odr -Werror=strict-aliasing)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(-Werror=lto-type-mismatch)
|
list(APPEND VBAM_COMPILE_OPTS -Werror=lto-type-mismatch)
|
||||||
add_link_options( -Werror=lto-type-mismatch)
|
list(APPEND VBAM_LINK_OPTS -Werror=lto-type-mismatch)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -3,38 +3,37 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:DEBUG>:Debug>" CACHE INT
|
|||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
# MSVC-specific flags (not supported by clang-cl).
|
# MSVC-specific flags (not supported by clang-cl).
|
||||||
add_compile_options(/nologo)
|
list(APPEND VBAM_COMPILE_OPTS /nologo)
|
||||||
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
|
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
|
||||||
# Multi-processor compilation does not work well with Ninja.
|
# Multi-processor compilation does not work well with Ninja.
|
||||||
add_compile_options(/MP)
|
list(APPEND VBAM_COMPILE_OPTS /MP)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
|
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
_FORCENAMELESSUNION
|
|
||||||
WIN32_LEAN_AND_MEAN
|
|
||||||
WIN32
|
|
||||||
_WINDOWS
|
|
||||||
__STDC_LIMIT_MACROS
|
__STDC_LIMIT_MACROS
|
||||||
__STDC_CONSTANT_MACROS
|
__STDC_CONSTANT_MACROS
|
||||||
_CRT_SECURE_NO_WARNINGS
|
|
||||||
_UNICODE
|
_UNICODE
|
||||||
UNICODE
|
UNICODE
|
||||||
WINVER=0x0A00
|
WINVER=0x0A00
|
||||||
NTDDI_VERSION=0x0A000007
|
NTDDI_VERSION=0x0A000007
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND VBAM_COMPILE_DEFS
|
||||||
|
WIN32_LEAN_AND_MEAN
|
||||||
|
WIN32
|
||||||
|
_CRT_SECURE_NO_WARNINGS
|
||||||
NOMINMAX
|
NOMINMAX
|
||||||
)
|
)
|
||||||
add_compile_options(
|
list(APPEND VBAM_COMPILE_OPTS
|
||||||
/W4
|
/W4
|
||||||
/GR
|
/GR
|
||||||
/EHsc
|
/EHsc
|
||||||
)
|
)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_compile_definitions(_DEBUG)
|
|
||||||
add_compile_options(/Ob0 /Od /RTC1)
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT ENABLE_ASAN)
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT ENABLE_ASAN)
|
||||||
# Use Edit and Continue with MSVC.
|
# Use Edit and Continue with MSVC.
|
||||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue" CACHE STRING "" FORCE)
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue" CACHE STRING "" FORCE)
|
||||||
@@ -42,17 +41,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_options(/MT /Oi /Gy)
|
add_compile_options(/Oi /Gy)
|
||||||
add_link_options(/OPT:REF /OPT:ICF)
|
add_link_options(/OPT:REF /OPT:ICF)
|
||||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
|
||||||
add_compile_options(/O1 /Ob1)
|
|
||||||
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
|
||||||
add_compile_options(/O2 /Ob1)
|
|
||||||
else()
|
|
||||||
add_compile_options(/O2)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "3.25")
|
if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||||
@@ -67,19 +58,3 @@ if(CMAKE_VERSION VERSION_LESS "3.25")
|
|||||||
message(FATAL_ERROR "Unknown value for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: ${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}")
|
message(FATAL_ERROR "Unknown value for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: ${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/std:c++14>)
|
|
||||||
|
|
||||||
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
# We need to explicitly set all of these to override the CMake defaults.
|
|
||||||
set(CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
|
||||||
|
@@ -29,30 +29,30 @@ endif()
|
|||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
if(NOT HTTPS)
|
if(NOT HTTPS)
|
||||||
add_compile_definitions(NO_HTTPS)
|
list(APPEND VBAM_COMPILE_DEFS NO_HTTPS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_GBA_LOGGING)
|
if(ENABLE_GBA_LOGGING)
|
||||||
add_compile_definitions(GBA_LOGGING )
|
list(APPEND VBAM_COMPILE_DEFS GBA_LOGGING )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_MMX)
|
if(ENABLE_MMX)
|
||||||
add_compile_definitions(MMX)
|
list(APPEND VBAM_COMPILE_DEFS MMX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(NOT ENABLE_ONLINEUPDATES)
|
if(NOT ENABLE_ONLINEUPDATES)
|
||||||
add_compile_definitions(NO_ONLINEUPDATES)
|
list(APPEND VBAM_COMPILE_DEFS NO_ONLINEUPDATES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The debugger is enabled by default
|
# The debugger is enabled by default
|
||||||
if(ENABLE_DEBUGGER)
|
if(ENABLE_DEBUGGER)
|
||||||
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
|
list(APPEND VBAM_COMPILE_DEFS VBAM_ENABLE_DEBUGGER)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The ASM core is disabled by default because we don't know on which platform we are
|
# The ASM core is disabled by default because we don't know on which platform we are
|
||||||
if(NOT ENABLE_ASM_CORE)
|
if(NOT ENABLE_ASM_CORE)
|
||||||
add_compile_definitions(C_CORE)
|
list(APPEND VBAM_COMPILE_DEFS C_CORE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set up "src" and generated directory as a global include directory.
|
# Set up "src" and generated directory as a global include directory.
|
||||||
@@ -63,26 +63,19 @@ include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# C defines
|
# C defines
|
||||||
add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
list(APPEND VBAM_COMPILE_DEFS HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||||
add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
list(APPEND VBAM_COMPILE_DEFS PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||||
add_compile_definitions(__STDC_FORMAT_MACROS)
|
list(APPEND VBAM_COMPILE_DEFS __STDC_FORMAT_MACROS)
|
||||||
add_compile_definitions(LOCALEDIR="${LOCALEDIR}")
|
list(APPEND VBAM_COMPILE_DEFS LOCALEDIR="${LOCALEDIR}")
|
||||||
|
|
||||||
# Common compiler settings.
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
add_compile_definitions(DEBUG)
|
|
||||||
else()
|
|
||||||
add_compile_definitions(NDEBUG)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_compile_definitions(MACHO)
|
list(APPEND VBAM_COMPILE_DEFS MACHO)
|
||||||
elseif("${CMAKE_SYSTEM}" MATCHES "Linux")
|
elseif("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||||
add_compile_definitions(ELF)
|
list(APPEND VBAM_COMPILE_DEFS ELF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(X86_64)
|
if(X86_64)
|
||||||
add_compile_definitions(__AMD64__ __X86_64__)
|
list(APPEND VBAM_COMPILE_DEFS __AMD64__ __X86_64__)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable ASAN if requested and supported.
|
# Enable ASAN if requested and supported.
|
||||||
|
@@ -2,7 +2,7 @@ with import <nixpkgs> {};
|
|||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "visualboyadvance-m";
|
name = "visualboyadvance-m";
|
||||||
buildInputs = if stdenv.isDarwin then
|
buildInputs = if stdenv.isDarwin then
|
||||||
[ ninja cmake nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.System darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ]
|
[ ninja cmake gcc nasm faudio gettext libintl pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.System darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ]
|
||||||
else
|
else
|
||||||
[ ninja cmake gcc clang llvm llvmPackages.libcxx nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 libGL libGLU glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon libepoxy dbus at-spi2-core ];
|
[ ninja cmake gcc nasm faudio gettext libintl pkg-config zip sfml zlib openal ffmpeg wxGTK32 libGL libGLU glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ];
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@ Known preprocessor switches:
|
|||||||
- VBAM_ENABLE_DEBUGGER: Enable remote debugging support
|
- VBAM_ENABLE_DEBUGGER: Enable remote debugging support
|
||||||
- MMX: Enable MMX instruction set
|
- MMX: Enable MMX instruction set
|
||||||
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)
|
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)
|
||||||
- NO_OGL: Exclude OpenGL code
|
|
||||||
- NO_D3D: Exclude Direct3D code
|
- NO_D3D: Exclude Direct3D code
|
||||||
- VBAM_ENABLE_XAUDIO2: Enable XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
- VBAM_ENABLE_XAUDIO2: Enable XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||||
- VBAM_ENABLE_FAUDIO: Enable FAudio code (the FAudio interface is an open source multiplatform re-implementation of XAudio2)
|
- VBAM_ENABLE_FAUDIO: Enable FAudio code (the FAudio interface is an open source multiplatform re-implementation of XAudio2)
|
||||||
|
53
installdeps
53
installdeps
@@ -191,7 +191,7 @@ freebsd_installdeps() {
|
|||||||
|
|
||||||
check sudo pkg update
|
check sudo pkg update
|
||||||
|
|
||||||
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl2 wx31-gtk3 iconv zip ninja"
|
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl2 sfml wx31-gtk3 iconv zip ninja"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||||
|
|
||||||
@@ -318,6 +318,12 @@ debian_installdeps() {
|
|||||||
if [ -z "$target" ]; then
|
if [ -z "$target" ]; then
|
||||||
sudo apt-get -qq -y update
|
sudo apt-get -qq -y update
|
||||||
|
|
||||||
|
sfml_libs=
|
||||||
|
|
||||||
|
for lib in graphics window network; do
|
||||||
|
sfml_libs="$sfml_libs $(apt-cache search "libsfml-$lib" | sed 's/ - .*//' | sort -r | head -1)"
|
||||||
|
done
|
||||||
|
|
||||||
glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//' | sort -r | head -1)
|
glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//' | sort -r | head -1)
|
||||||
|
|
||||||
sdl_lib=$(apt-cache search '^libsdl2-2.0' | sed 's/ - .*//' | sort -r | head -1)
|
sdl_lib=$(apt-cache search '^libsdl2-2.0' | sed 's/ - .*//' | sort -r | head -1)
|
||||||
@@ -344,7 +350,7 @@ debian_installdeps() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev"
|
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
|
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
|
||||||
|
|
||||||
@@ -395,7 +401,7 @@ debian_installdeps() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deps="gcc zlib ffmpeg gettext sdl2 openal wxwidgets openal"
|
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets openal"
|
||||||
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
|
||||||
|
|
||||||
set --
|
set --
|
||||||
@@ -492,7 +498,7 @@ fedora_installdeps() {
|
|||||||
# this is sometimes necessary for rawhide
|
# this is sometimes necessary for rawhide
|
||||||
set -- --exclude='glibc32*'
|
set -- --exclude='glibc32*'
|
||||||
fi
|
fi
|
||||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel openal-soft-devel wxGTK-devel gtk3-devel; do
|
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel SFML-devel openal-soft-devel wxGTK-devel gtk3-devel; do
|
||||||
case $pkg in
|
case $pkg in
|
||||||
*ffmpeg*)
|
*ffmpeg*)
|
||||||
[ -z "$ENABLE_FFMPEG" ] && continue
|
[ -z "$ENABLE_FFMPEG" ] && continue
|
||||||
@@ -591,6 +597,8 @@ fedora_installdeps() {
|
|||||||
|
|
||||||
# get the necessary win32 headers
|
# get the necessary win32 headers
|
||||||
git submodule update --init --remote --recursive
|
git submodule update --init --remote --recursive
|
||||||
|
|
||||||
|
warning='SFML is required for LINK support, Fedora does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
|
[ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
|
||||||
@@ -676,6 +684,8 @@ rhel_installdeps() {
|
|||||||
set -- --exclude='glibc32*'
|
set -- --exclude='glibc32*'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
warning='RHEL does not currently have SFML packages, LINK support will be disabled'
|
||||||
|
|
||||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
|
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
|
||||||
case $pkg in
|
case $pkg in
|
||||||
*ffmpeg*)
|
*ffmpeg*)
|
||||||
@@ -767,6 +777,8 @@ rhel_installdeps() {
|
|||||||
|
|
||||||
# get the necessary win32 headers
|
# get the necessary win32 headers
|
||||||
git submodule update --init --remote --recursive
|
git submodule update --init --remote --recursive
|
||||||
|
|
||||||
|
warning='SFML is required for LINK support, RHEL/EPEL does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$rpms_installed" ] && check sudo yum -y install "$@"
|
[ -z "$rpms_installed" ] && check sudo yum -y install "$@"
|
||||||
@@ -785,12 +797,14 @@ suse_installdeps() {
|
|||||||
check_cross
|
check_cross
|
||||||
installing
|
installing
|
||||||
|
|
||||||
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip ninja"
|
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip sfml2-devel ninja"
|
||||||
|
|
||||||
libs="gcc gcc-c++ libSDL2-devel wxGTK3-3_2-devel openal-soft-devel ffmpeg-7-libavcodec-devel ffmpeg-7-libavdevice-devel ffmpeg-7-libavfilter-devel ffmpeg-7-libavformat-devel ffmpeg-7-libavutil-devel ffmpeg-7-libpostproc-devel ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel"
|
libs="gcc gcc-c++ libSDL2-devel wxWidgets-3_0-devel openal-soft-devel" # ffmpeg-devel
|
||||||
|
|
||||||
|
# ffmpeg requires packman repos
|
||||||
|
|
||||||
if [ "$target" = m32 ]; then
|
if [ "$target" = m32 ]; then
|
||||||
error '32 bit cross builds are no longer supported on OpenSUSE'
|
libs=$(echo "$libs" | sed -E 's/([^ ]) ([^ ])/\1-32bit \2/g; s/$/-32bit/;')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check sudo zypper in -y $tools $libs
|
check sudo zypper in -y $tools $libs
|
||||||
@@ -854,7 +868,7 @@ archlinux_installdeps() {
|
|||||||
|
|
||||||
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
|
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
|
||||||
|
|
||||||
libs="zlib mesa gettext sdl2 wxgtk3 $gtk openal"
|
libs="zlib mesa gettext sdl2 wxgtk3 $gtk sfml openal"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
|
||||||
|
|
||||||
@@ -870,7 +884,7 @@ archlinux_installdeps() {
|
|||||||
else
|
else
|
||||||
# try to build 32 bit binaries
|
# try to build 32 bit binaries
|
||||||
|
|
||||||
# lib32-ffmpeg is in AUR
|
# lib32-sfml and lib32-ffmpeg are in AUR
|
||||||
archlinux_require_yaourt
|
archlinux_require_yaourt
|
||||||
|
|
||||||
# enable multilib repos if not enabled
|
# enable multilib repos if not enabled
|
||||||
@@ -964,6 +978,8 @@ EOF
|
|||||||
|
|
||||||
# get the necessary win32 headers
|
# get the necessary win32 headers
|
||||||
git submodule update --init --remote --recursive
|
git submodule update --init --remote --recursive
|
||||||
|
|
||||||
|
warning 'SFML is required for LINK support, the SFML package in AUR is currently broken, if you want LINK support you will need to install it manually'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
@@ -1026,12 +1042,13 @@ solus_installdeps() {
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
# no 32bit versions of these
|
# no 32bit versions of these
|
||||||
set -- "$@" ffmpeg-devel
|
set -- "$@" SFML-devel ffmpeg-devel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check sudo eopkg -y install "$@"
|
check sudo eopkg -y install "$@"
|
||||||
|
|
||||||
if [ -n "$amd64" -a "$target" = m32 ]; then
|
if [ -n "$amd64" -a "$target" = m32 ]; then
|
||||||
|
warning 'SFML is required for LINK support, there is no 32 bit SFML package in Solus currently, if you want LINK support you will need to install it manually'
|
||||||
warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually'
|
warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1053,6 +1070,7 @@ gentoo_installdeps() {
|
|||||||
dev-util/ccache \
|
dev-util/ccache \
|
||||||
sys-devel/binutils \
|
sys-devel/binutils \
|
||||||
media-libs/libsdl2 \
|
media-libs/libsdl2 \
|
||||||
|
media-libs/libsfml \
|
||||||
media-libs/openal \
|
media-libs/openal \
|
||||||
x11-libs/wxGTK:$wx_slot \
|
x11-libs/wxGTK:$wx_slot \
|
||||||
sys-libs/zlib \
|
sys-libs/zlib \
|
||||||
@@ -1070,7 +1088,7 @@ gentoo_installdeps() {
|
|||||||
alpine_installdeps() {
|
alpine_installdeps() {
|
||||||
installing
|
installing
|
||||||
|
|
||||||
check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl2-dev glu-dev wxwidgets-dev gtk+3.0-dev zip
|
check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl2-dev glu-dev sfml-dev wxwidgets-dev gtk+3.0-dev zip
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
}
|
}
|
||||||
@@ -1105,7 +1123,7 @@ windows_installdeps() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pkgs="$pkgs SDL2 wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal"
|
pkgs="$pkgs SDL2 sfml wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal"
|
||||||
|
|
||||||
case "$target" in
|
case "$target" in
|
||||||
*x86_64)
|
*x86_64)
|
||||||
@@ -1177,10 +1195,15 @@ brew_installdeps() {
|
|||||||
|
|
||||||
check brew -v update
|
check brew -v update
|
||||||
|
|
||||||
brews="nasm cmake ccache gettext libtiff pkg-config sdl2 wxwidgets faudio ccache ninja zlib"
|
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets faudio ccache ninja zlib"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
|
||||||
|
|
||||||
|
# sfml brew currently broken in the travis mac environment
|
||||||
|
# if [ -z "$TRAVIS" ]; then
|
||||||
|
brews="$brews sfml"
|
||||||
|
# fi
|
||||||
|
|
||||||
# This is necessary for the GitHub Actions CI:
|
# This is necessary for the GitHub Actions CI:
|
||||||
brew -v install python
|
brew -v install python
|
||||||
brew link --overwrite python
|
brew link --overwrite python
|
||||||
@@ -1203,7 +1226,7 @@ macports_installdeps() {
|
|||||||
|
|
||||||
check sudo port -v selfupdate
|
check sudo port -v selfupdate
|
||||||
|
|
||||||
ports="cmake ccache nasm gettext pkgconfig libsdl2 wxWidgets-3.0 libiconv ninja"
|
ports="cmake ccache nasm gettext pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv ninja"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg"
|
||||||
|
|
||||||
@@ -1219,7 +1242,7 @@ fink_installdeps() {
|
|||||||
|
|
||||||
check sudo fink -vy selfupdate
|
check sudo fink -vy selfupdate
|
||||||
|
|
||||||
pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev ccache ninja"
|
pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev sfml24-dev ccache ninja"
|
||||||
|
|
||||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
#
|
#
|
||||||
# Translators:
|
# Translators:
|
||||||
# Orfeas Artinopoulos, 2025
|
|
||||||
# Stathis Galazios <infin1ty@hol.gr>, 2016-2017
|
# Stathis Galazios <infin1ty@hol.gr>, 2016-2017
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -11,7 +10,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: Orfeas Artinopoulos, 2025\n"
|
"Last-Translator: Stathis Galazios <infin1ty@hol.gr>, 2016-2017\n"
|
||||||
"Language-Team: Greek (http://app.transifex.com/bgk/vba-m/language/el/)\n"
|
"Language-Team: Greek (http://app.transifex.com/bgk/vba-m/language/el/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -21,7 +20,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: audio/internal/openal.cpp:188
|
#: audio/internal/openal.cpp:188
|
||||||
msgid "OpenAL: Failed to open audio device"
|
msgid "OpenAL: Failed to open audio device"
|
||||||
msgstr "OpenAL: Αποτυχία ανοίγματος της συσκευής ήχου"
|
msgstr ""
|
||||||
|
|
||||||
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
||||||
#: audio/internal/xaudio2.cpp:577
|
#: audio/internal/xaudio2.cpp:577
|
||||||
@@ -34,7 +33,7 @@ msgid ""
|
|||||||
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
||||||
" Boy Files "
|
" Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Αρχεία Game Boy Advance (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game Boy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:144
|
#: cmdevents.cpp:144
|
||||||
msgid "Open ROM file"
|
msgid "Open ROM file"
|
||||||
@@ -44,7 +43,7 @@ msgstr "Άνοιγμα αρχείου ROM"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Files "
|
"Game Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Αρχεία Game Boy (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:171
|
#: cmdevents.cpp:171
|
||||||
msgid "Open GB ROM file"
|
msgid "Open GB ROM file"
|
||||||
@@ -54,7 +53,7 @@ msgstr "Άνοιγμα αρχείου GB ROM"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Color Files "
|
"Game Boy Color Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Αρχεία Game Boy Color (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:198
|
#: cmdevents.cpp:198
|
||||||
msgid "Open GBC ROM file"
|
msgid "Open GBC ROM file"
|
||||||
@@ -66,7 +65,7 @@ msgstr "Επιλογή αρχείου Dot Code"
|
|||||||
|
|
||||||
#: cmdevents.cpp:365 cmdevents.cpp:387
|
#: cmdevents.cpp:365 cmdevents.cpp:387
|
||||||
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
||||||
msgstr "Κώδικας κουκίδας E-Reader (*.bin;*.raw)|*.bin;*.raw"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:406 cmdevents.cpp:601
|
#: cmdevents.cpp:406 cmdevents.cpp:601
|
||||||
msgid "Select battery file"
|
msgid "Select battery file"
|
||||||
@@ -80,7 +79,7 @@ msgstr "Αρχείο μπαταρίας (*.sav)|*.sav|Αποθήκευση Flash
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a battery file will erase any saved games (permanently after the "
|
"Importing a battery file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "Η εισαγωγή ενός αρχείου μπαταρίας θα διαγράψει το ήδη αποθηκευμένο παιχνίδι (μόνιμα μετά την επόμενη εγγραφή). Θέλετε να προχωρήσετε;"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
||||||
msgid "Confirm import"
|
msgid "Confirm import"
|
||||||
@@ -102,17 +101,17 @@ msgstr "Επιλογή αρχείου κωδικών"
|
|||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
||||||
msgstr "Αρχείο κωδικών Game Shark (*.spc;*.xpc)|*.spc;*.xpc"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
||||||
msgstr "Αρχείο κωδικών Game Shark (*.gcf)|*.gcf"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:443
|
#: cmdevents.cpp:443
|
||||||
msgid ""
|
msgid ""
|
||||||
"Importing a code file will replace any loaded cheats. Do you want to "
|
"Importing a code file will replace any loaded cheats. Do you want to "
|
||||||
"continue?"
|
"continue?"
|
||||||
msgstr "Η εισαγωγή αρχείου κωδικών θα αντικαταστήσει τυχόν φορτωμένους κωδικούς. Θέλετε να συνεχίσετε;"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:460
|
#: cmdevents.cpp:460
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -142,17 +141,17 @@ msgstr "Επιλογή αρχείου στιγμιότυπου"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
||||||
" (*.gsv)|*.gsv"
|
" (*.gsv)|*.gsv"
|
||||||
msgstr "Στιγμιότυπα Game Shark & PAC (*.sps;*.xps)|*.sps;*.xps|Στιγμιότυπα Game Shark SP (*.gsv)|*.gsv"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:554
|
#: cmdevents.cpp:554
|
||||||
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
||||||
msgstr "Στιγμιότυπο Game Boy (*.gbs)|*.gbs"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:563
|
#: cmdevents.cpp:563
|
||||||
msgid ""
|
msgid ""
|
||||||
"Importing a snapshot file will erase any saved games (permanently after the "
|
"Importing a snapshot file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "Η εισαγωγή ενός στιγμιοτύπου θα διαγράψει τυχόν αποθηκευμένα παιχνίδια (μόνιμα μετά την επόμενη εγγραφή). Θέλετε να προχωρήσετε;"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:588
|
#: cmdevents.cpp:588
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -180,11 +179,11 @@ msgstr "Δεν είναι δυνατή η εξαγωγή αρχείων αποθ
|
|||||||
|
|
||||||
#: cmdevents.cpp:630
|
#: cmdevents.cpp:630
|
||||||
msgid "Game Shark Snapshot (*.sps)|*.sps"
|
msgid "Game Shark Snapshot (*.sps)|*.sps"
|
||||||
msgstr "Στιγμιότυπο Game Shark (*.sps)|*.sps"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:644
|
#: cmdevents.cpp:644
|
||||||
msgid "Exported from Visual Boy Advance-M"
|
msgid "Exported from Visual Boy Advance-M"
|
||||||
msgstr "Εξαγωγή από το Visual Boy Advance-M"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:656
|
#: cmdevents.cpp:656
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -225,16 +224,16 @@ msgstr "Επιλογή αρχείου κατάστασης"
|
|||||||
|
|
||||||
#: cmdevents.cpp:1263 cmdevents.cpp:1356
|
#: cmdevents.cpp:1263 cmdevents.cpp:1356
|
||||||
msgid "Visual Boy Advance saved game files|*.sgm"
|
msgid "Visual Boy Advance saved game files|*.sgm"
|
||||||
msgstr "Αποθηκευμένα αρχεία παιχνιδιού Visual Boy Advance|*.sgm"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:1386 cmdevents.cpp:1396 cmdevents.cpp:1407
|
#: cmdevents.cpp:1386 cmdevents.cpp:1396 cmdevents.cpp:1407
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Current state slot #%d"
|
msgid "Current state slot #%d"
|
||||||
msgstr "Τρέχουσα θέση στιγμιοτύπου #%d"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:1470
|
#: cmdevents.cpp:1470
|
||||||
msgid "Cannot use Colorizer Hack when Game Boy BIOS File is enabled."
|
msgid "Cannot use Colorizer Hack when Game Boy BIOS File is enabled."
|
||||||
msgstr "Δεν μπορεί να χρησιμοποιηθεί το Colorizer Hack όσο είναι ενεργοποιημένο το αρχείο BIOS του Game Boy "
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:1681
|
#: cmdevents.cpp:1681
|
||||||
msgid "Sound enabled"
|
msgid "Sound enabled"
|
||||||
@@ -275,22 +274,22 @@ msgid ""
|
|||||||
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Are you sure?"
|
"Are you sure?"
|
||||||
msgstr "ΟΙ ΡΥΘΜΙΣΕΙΣ ΣΑΣ ΘΑ ΔΙΑΓΡΑΦΟΥΝ!"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2201
|
#: cmdevents.cpp:2201
|
||||||
msgid "FACTORY RESET"
|
msgid "FACTORY RESET"
|
||||||
msgstr "ΕΡΓΟΣΤΑΣΙΑΚΕΣ ΡΥΘΜΙΣΕΙΣ"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2236
|
#: cmdevents.cpp:2236
|
||||||
msgid "Nintendo Game Boy / Color / Advance emulator."
|
msgid "Nintendo Game Boy / Color / Advance emulator."
|
||||||
msgstr "Εξομοιωτής Nintendo Game Boy / Color / Advance."
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2237
|
#: cmdevents.cpp:2237
|
||||||
msgid ""
|
msgid ""
|
||||||
"Copyright (C) 1999-2003 Forgotten\n"
|
"Copyright (C) 1999-2003 Forgotten\n"
|
||||||
"Copyright (C) 2004-2006 VBA development team\n"
|
"Copyright (C) 2004-2006 VBA development team\n"
|
||||||
"Copyright (C) 2007-2020 VBA-M development team"
|
"Copyright (C) 2007-2020 VBA-M development team"
|
||||||
msgstr "Πνευματική Ιδιοκτησία (C) 1999-2003 Ξεχασμένη Πνευματική Ιδιοκτησία (C) 2004-2006 VBA Ομάδα ανάπτυξης VBA Πνευματική Ιδιοκτησία (C) 2007-2020 Ομάδα ανάπτυξης VBA-M"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2239
|
#: cmdevents.cpp:2239
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
# Translators:
|
# Translators:
|
||||||
# Alain Richell Rodriguez Blazquez, 2021
|
# Alain Richell Rodriguez Blazquez, 2021
|
||||||
# Álvaro Pérez Urbano <alvaro_beta@hotmail.com>, 2021
|
# Álvaro Pérez Urbano <alvaro_beta@hotmail.com>, 2021
|
||||||
# angel quispe, 2025
|
|
||||||
# Damián Cabello Jiménez <jdamiancabello@gmail.com>, 2018
|
# Damián Cabello Jiménez <jdamiancabello@gmail.com>, 2018
|
||||||
# Dani Quiroz, 2022
|
# Dani Quiroz, 2022
|
||||||
# Dani Quiroz, 2022
|
# Dani Quiroz, 2022
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
# javidg96, 2015
|
# javidg96, 2015
|
||||||
# jorge perez <theghostxxaz@gmail.com>, 2021
|
# jorge perez <theghostxxaz@gmail.com>, 2021
|
||||||
# Jose Castillo <josecastillo.prz85@gmail.com>, 2021
|
# Jose Castillo <josecastillo.prz85@gmail.com>, 2021
|
||||||
# José Montoro, 2024
|
|
||||||
# Manu 3L <comokaka777@gmail.com>, 2021
|
# Manu 3L <comokaka777@gmail.com>, 2021
|
||||||
# Marco123V <MarcoVillalejos@hotmail.com>, 2015
|
# Marco123V <MarcoVillalejos@hotmail.com>, 2015
|
||||||
# Marco Yurazeck <luthias@gmail.com>, 2020
|
# Marco Yurazeck <luthias@gmail.com>, 2020
|
||||||
@@ -31,7 +29,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: angel quispe, 2025\n"
|
"Last-Translator: Dani Quiroz, 2022\n"
|
||||||
"Language-Team: Spanish (http://app.transifex.com/bgk/vba-m/language/es/)\n"
|
"Language-Team: Spanish (http://app.transifex.com/bgk/vba-m/language/es/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -41,7 +39,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: audio/internal/openal.cpp:188
|
#: audio/internal/openal.cpp:188
|
||||||
msgid "OpenAL: Failed to open audio device"
|
msgid "OpenAL: Failed to open audio device"
|
||||||
msgstr "OpenAL: Fallo al abrir el dispositivo de audio"
|
msgstr ""
|
||||||
|
|
||||||
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
||||||
#: audio/internal/xaudio2.cpp:577
|
#: audio/internal/xaudio2.cpp:577
|
||||||
@@ -54,7 +52,7 @@ msgid ""
|
|||||||
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
||||||
" Boy Files "
|
" Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Archivos de Game boy Advance (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game Boy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:144
|
#: cmdevents.cpp:144
|
||||||
msgid "Open ROM file"
|
msgid "Open ROM file"
|
||||||
@@ -64,7 +62,7 @@ msgstr "Abrir archivo ROM"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Files "
|
"Game Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Archivos de Game Boy (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:171
|
#: cmdevents.cpp:171
|
||||||
msgid "Open GB ROM file"
|
msgid "Open GB ROM file"
|
||||||
@@ -100,7 +98,7 @@ msgstr "Archivo de batería (*.sav) | *.sav | Guardado Flash (*.dat) | *.dat"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a battery file will erase any saved games (permanently after the "
|
"Importing a battery file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "Importar un archivo de guardado borrará cualquier partida guardada (permanente después del siguiente guardado). ¿Quieres continuar?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
||||||
msgid "Confirm import"
|
msgid "Confirm import"
|
||||||
@@ -132,7 +130,7 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a code file will replace any loaded cheats. Do you want to "
|
"Importing a code file will replace any loaded cheats. Do you want to "
|
||||||
"continue?"
|
"continue?"
|
||||||
msgstr "Importar un archivo de códigos reemplazará cualquier cheat cargado. ¿Quieres continuar?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:460
|
#: cmdevents.cpp:460
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -172,7 +170,7 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a snapshot file will erase any saved games (permanently after the "
|
"Importing a snapshot file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "Importar una snapshot borrará cualquier partida guardada (permanente una vez se sobrescriba) ¿Quieres continuar?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:588
|
#: cmdevents.cpp:588
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -204,7 +202,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: cmdevents.cpp:644
|
#: cmdevents.cpp:644
|
||||||
msgid "Exported from Visual Boy Advance-M"
|
msgid "Exported from Visual Boy Advance-M"
|
||||||
msgstr "Exportado desde Visual Boy Advance-M"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:656
|
#: cmdevents.cpp:656
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -295,15 +293,15 @@ msgid ""
|
|||||||
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Are you sure?"
|
"Are you sure?"
|
||||||
msgstr "¡SE BORRARÁ TU CONFIGURACIÓN!\n\n¿Estás seguro?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2201
|
#: cmdevents.cpp:2201
|
||||||
msgid "FACTORY RESET"
|
msgid "FACTORY RESET"
|
||||||
msgstr "RESETEO DE FÁBRICA"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2236
|
#: cmdevents.cpp:2236
|
||||||
msgid "Nintendo Game Boy / Color / Advance emulator."
|
msgid "Nintendo Game Boy / Color / Advance emulator."
|
||||||
msgstr "Emulador de Nintendo Game Boy / Color / Advance"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2237
|
#: cmdevents.cpp:2237
|
||||||
msgid ""
|
msgid ""
|
||||||
@@ -326,11 +324,11 @@ msgid ""
|
|||||||
"\n"
|
"\n"
|
||||||
"You should have received a copy of the GNU General Public License\n"
|
"You should have received a copy of the GNU General Public License\n"
|
||||||
"along with this program. If not, see http://www.gnu.org/licenses ."
|
"along with this program. If not, see http://www.gnu.org/licenses ."
|
||||||
msgstr "Este programa es un software gratis: puedes redistribuirlo / o modificarlo bajo los terminos de la Licencia Pública General GNU.\npublicada por\nla Free Software Foundation, ya sea la versión 2 de la Licencia, o\n(a su elección) cualquier versión posterior.\n\nEste programa se distribuye con la esperanza de que sea útil,\npero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de\nCOMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Ver el\nLicencia pública general GNU para obtener más detalles.\n\nDebería haber recibido una copia de la Licencia Pública General GNU\njunto con este programa. Si no, consulte http://www.gnu.org/licenses."
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2424
|
#: cmdevents.cpp:2424
|
||||||
msgid "Cannot use Game Boy BIOS when Colorizer Hack is enabled."
|
msgid "Cannot use Game Boy BIOS when Colorizer Hack is enabled."
|
||||||
msgstr "No puedes usar la BIOS de la Game Boy cuando el Hack Colorizer está habilitado."
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2490
|
#: cmdevents.cpp:2490
|
||||||
msgid "LAN link is already active. Disable link mode to disconnect."
|
msgid "LAN link is already active. Disable link mode to disconnect."
|
||||||
@@ -346,7 +344,7 @@ msgstr "Menú de comandos"
|
|||||||
|
|
||||||
#: dialogs/accel-config.cpp:245
|
#: dialogs/accel-config.cpp:245
|
||||||
msgid "This will clear all user-defined accelerators. Are you sure?"
|
msgid "This will clear all user-defined accelerators. Are you sure?"
|
||||||
msgstr "Esto borrará todos los aceleradores definidos por el usuario. ¿Estás seguro?"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/accel-config.cpp:245 dialogs/accel-config.cpp:292
|
#: dialogs/accel-config.cpp:245 dialogs/accel-config.cpp:292
|
||||||
msgid "Confirm"
|
msgid "Confirm"
|
||||||
@@ -403,7 +401,7 @@ msgstr "Desconocido"
|
|||||||
|
|
||||||
#: dialogs/game-maker.cpp:235
|
#: dialogs/game-maker.cpp:235
|
||||||
msgid "Invalid"
|
msgid "Invalid"
|
||||||
msgstr "No válido "
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:22
|
#: dialogs/gb-rom-info.cpp:22
|
||||||
msgid "No mapper"
|
msgid "No mapper"
|
||||||
|
@@ -3,12 +3,10 @@
|
|||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
#
|
#
|
||||||
# Translators:
|
# Translators:
|
||||||
# Andrés Oña, 2025
|
|
||||||
# chxndler perez cueva <chxndlerpc@gmail.com>, 2018
|
# chxndler perez cueva <chxndlerpc@gmail.com>, 2018
|
||||||
# Dani Quiroz, 2022
|
# Dani Quiroz, 2022
|
||||||
# David Martínez <david8dgm@gmail.com>, 2020
|
# David Martínez <david8dgm@gmail.com>, 2020
|
||||||
# Dex Galaxy, 2022
|
# Dex Galaxy, 2022
|
||||||
# Dilan Meza, 2025
|
|
||||||
# Enzo Cortés, 2023
|
# Enzo Cortés, 2023
|
||||||
# FERNANDO AYALA PEREZ, 2021
|
# FERNANDO AYALA PEREZ, 2021
|
||||||
# Kevin Bustinza <ufreshx@gmail.com>, 2021
|
# Kevin Bustinza <ufreshx@gmail.com>, 2021
|
||||||
@@ -23,7 +21,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: Dilan Meza, 2025\n"
|
"Last-Translator: Timoteo Traiber Minnaard, 2024\n"
|
||||||
"Language-Team: Spanish (Latin America) (http://app.transifex.com/bgk/vba-m/language/es_419/)\n"
|
"Language-Team: Spanish (Latin America) (http://app.transifex.com/bgk/vba-m/language/es_419/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -78,7 +76,7 @@ msgstr "Seleccionar archivo de código de punto"
|
|||||||
|
|
||||||
#: cmdevents.cpp:365 cmdevents.cpp:387
|
#: cmdevents.cpp:365 cmdevents.cpp:387
|
||||||
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
||||||
msgstr "Código de puntos del lector electrónico (*.bin;*.raw)|*.bin;*.raw"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:406 cmdevents.cpp:601
|
#: cmdevents.cpp:406 cmdevents.cpp:601
|
||||||
msgid "Select battery file"
|
msgid "Select battery file"
|
||||||
@@ -347,7 +345,7 @@ msgstr "Confirm"
|
|||||||
#: dialogs/accel-config.cpp:290
|
#: dialogs/accel-config.cpp:290
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "This will unassign \"%s\" from \"%s\". Are you sure?"
|
msgid "This will unassign \"%s\" from \"%s\". Are you sure?"
|
||||||
msgstr "Esto desasignará \"1%s\" de \"1%s\". ¿Estás seguro?"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/directories-config.cpp:49
|
#: dialogs/directories-config.cpp:49
|
||||||
msgid "Browse"
|
msgid "Browse"
|
||||||
@@ -355,7 +353,7 @@ msgstr "Browse"
|
|||||||
|
|
||||||
#: dialogs/display-config.cpp:52
|
#: dialogs/display-config.cpp:52
|
||||||
msgid "Invalid value for Default magnification."
|
msgid "Invalid value for Default magnification."
|
||||||
msgstr "Valor no válido para ampliación predeterminada."
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/display-config.cpp:331 xrc/DisplayConfig.xrc:86
|
#: dialogs/display-config.cpp:331 xrc/DisplayConfig.xrc:86
|
||||||
#: xrc/DisplayConfig.xrc:136 xrc/DisplayConfig.xrc:222
|
#: xrc/DisplayConfig.xrc:136 xrc/DisplayConfig.xrc:222
|
||||||
@@ -377,7 +375,7 @@ msgstr "Plugin"
|
|||||||
#: dialogs/display-config.cpp:407
|
#: dialogs/display-config.cpp:407
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Using pixel filter: %s"
|
msgid "Using pixel filter: %s"
|
||||||
msgstr "Usando filtro de píxeles: 1%s"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/display-config.cpp:414
|
#: dialogs/display-config.cpp:414
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -399,19 +397,19 @@ msgstr "Inválido"
|
|||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:22
|
#: dialogs/gb-rom-info.cpp:22
|
||||||
msgid "No mapper"
|
msgid "No mapper"
|
||||||
msgstr "Sin mapeador"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:43
|
#: dialogs/gb-rom-info.cpp:43
|
||||||
msgid "Pocket Camera"
|
msgid "Pocket Camera"
|
||||||
msgstr "Cámara de bolsillo"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:68
|
#: dialogs/gb-rom-info.cpp:68
|
||||||
msgid " + RAM"
|
msgid " + RAM"
|
||||||
msgstr "+ RAM"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:69
|
#: dialogs/gb-rom-info.cpp:69
|
||||||
msgid " + RTC"
|
msgid " + RTC"
|
||||||
msgstr "+RTC"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:70
|
#: dialogs/gb-rom-info.cpp:70
|
||||||
msgid " + Battery"
|
msgid " + Battery"
|
||||||
@@ -419,7 +417,7 @@ msgstr "+ Batería"
|
|||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:71
|
#: dialogs/gb-rom-info.cpp:71
|
||||||
msgid " + Rumble"
|
msgid " + Rumble"
|
||||||
msgstr "+ Rumble"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:72
|
#: dialogs/gb-rom-info.cpp:72
|
||||||
msgid " + Motion Sensor"
|
msgid " + Motion Sensor"
|
||||||
@@ -673,15 +671,15 @@ msgstr "32-bit "
|
|||||||
|
|
||||||
#: guiinit.cpp:1057
|
#: guiinit.cpp:1057
|
||||||
msgid "Signed decimal"
|
msgid "Signed decimal"
|
||||||
msgstr "decimal con signo"
|
msgstr ""
|
||||||
|
|
||||||
#: guiinit.cpp:1061
|
#: guiinit.cpp:1061
|
||||||
msgid "Unsigned decimal"
|
msgid "Unsigned decimal"
|
||||||
msgstr "decimal sin signo"
|
msgstr ""
|
||||||
|
|
||||||
#: guiinit.cpp:1065
|
#: guiinit.cpp:1065
|
||||||
msgid "Unsigned hexadecimal"
|
msgid "Unsigned hexadecimal"
|
||||||
msgstr "hexadecimal sin signo"
|
msgstr ""
|
||||||
|
|
||||||
#: guiinit.cpp:1637
|
#: guiinit.cpp:1637
|
||||||
msgid "Main icon not found"
|
msgid "Main icon not found"
|
||||||
@@ -884,11 +882,11 @@ msgstr "Sin VSYNC disponible en esta plataforma"
|
|||||||
|
|
||||||
#: panel.cpp:2444
|
#: panel.cpp:2444
|
||||||
msgid "Memory allocation error"
|
msgid "Memory allocation error"
|
||||||
msgstr "error en la asignación de memoria"
|
msgstr ""
|
||||||
|
|
||||||
#: panel.cpp:2447
|
#: panel.cpp:2447
|
||||||
msgid "Error initializing codec"
|
msgid "Error initializing codec"
|
||||||
msgstr "error al inicializar codec"
|
msgstr ""
|
||||||
|
|
||||||
#: panel.cpp:2450
|
#: panel.cpp:2450
|
||||||
msgid "Error writing to output file"
|
msgid "Error writing to output file"
|
||||||
@@ -1011,7 +1009,7 @@ msgstr "Select memory dump file"
|
|||||||
|
|
||||||
#: viewsupt.cpp:789
|
#: viewsupt.cpp:789
|
||||||
msgid "Red:"
|
msgid "Red:"
|
||||||
msgstr "Rojo:"
|
msgstr ""
|
||||||
|
|
||||||
#: viewsupt.cpp:798
|
#: viewsupt.cpp:798
|
||||||
msgid "Green:"
|
msgid "Green:"
|
||||||
@@ -3463,7 +3461,7 @@ msgstr "&R"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:494 xrc/MainMenu.xrc:517
|
#: xrc/MainMenu.xrc:494 xrc/MainMenu.xrc:517
|
||||||
msgid "Configure..."
|
msgid "Configure..."
|
||||||
msgstr "Configurar..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:498
|
#: xrc/MainMenu.xrc:498
|
||||||
msgid "&Real-time clock"
|
msgid "&Real-time clock"
|
||||||
@@ -3483,15 +3481,15 @@ msgstr "&LCD Filter"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:521
|
#: xrc/MainMenu.xrc:521
|
||||||
msgid "&Game Boy color option"
|
msgid "&Game Boy color option"
|
||||||
msgstr "Opción de color Game Boy"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:529
|
#: xrc/MainMenu.xrc:529
|
||||||
msgid "&Game Boy Colorizer Hack (requires restart)"
|
msgid "&Game Boy Colorizer Hack (requires restart)"
|
||||||
msgstr "Hack de color Game Boy (requiere reinicio)"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:533
|
#: xrc/MainMenu.xrc:533
|
||||||
msgid "&Game Boy printer"
|
msgid "&Game Boy printer"
|
||||||
msgstr "Impresora Game Boy"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:537
|
#: xrc/MainMenu.xrc:537
|
||||||
msgid "&Gather a full page before printing"
|
msgid "&Gather a full page before printing"
|
||||||
@@ -3503,43 +3501,43 @@ msgstr "&Save printouts as screen captures"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:546
|
#: xrc/MainMenu.xrc:546
|
||||||
msgid "&Use Game Boy BIOS file (requires restart)"
|
msgid "&Use Game Boy BIOS file (requires restart)"
|
||||||
msgstr "Usar archivo BIOS de Game Boy (requiere reinicio)"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:550
|
#: xrc/MainMenu.xrc:550
|
||||||
msgid "&Use Game Boy Color BIOS file"
|
msgid "&Use Game Boy Color BIOS file"
|
||||||
msgstr "Usar archivo BIOS de Game Boy Color"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:555
|
#: xrc/MainMenu.xrc:555
|
||||||
msgid "&General..."
|
msgid "&General..."
|
||||||
msgstr "General"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:558
|
#: xrc/MainMenu.xrc:558
|
||||||
msgid "&Speedup / Turbo..."
|
msgid "&Speedup / Turbo..."
|
||||||
msgstr "Aceleración / Turbo"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:561
|
#: xrc/MainMenu.xrc:561
|
||||||
msgid "D&irectories..."
|
msgid "D&irectories..."
|
||||||
msgstr "Directorios"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:564
|
#: xrc/MainMenu.xrc:564
|
||||||
msgid "&Key Shortcuts..."
|
msgid "&Key Shortcuts..."
|
||||||
msgstr "Atajos de teclas"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:567
|
#: xrc/MainMenu.xrc:567
|
||||||
msgid "UI Settings"
|
msgid "UI Settings"
|
||||||
msgstr "Configuración de UI"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:569
|
#: xrc/MainMenu.xrc:569
|
||||||
msgid "Enable &Status bar"
|
msgid "Enable &Status bar"
|
||||||
msgstr "Habilitar barra de estado"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:573
|
#: xrc/MainMenu.xrc:573
|
||||||
msgid "Hide &Menu Bar"
|
msgid "Hide &Menu Bar"
|
||||||
msgstr "Ocultar barra de menú"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:577
|
#: xrc/MainMenu.xrc:577
|
||||||
msgid "Suspend &Screen Saver"
|
msgid "Suspend &Screen Saver"
|
||||||
msgstr "Suspender y proteger pantalla"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:583
|
#: xrc/MainMenu.xrc:583
|
||||||
msgid "&Tools"
|
msgid "&Tools"
|
||||||
@@ -3551,15 +3549,15 @@ msgstr "&Cheats"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:587
|
#: xrc/MainMenu.xrc:587
|
||||||
msgid "List &cheats..."
|
msgid "List &cheats..."
|
||||||
msgstr "Lista y trucos"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:590
|
#: xrc/MainMenu.xrc:590
|
||||||
msgid "Find c&heat..."
|
msgid "Find c&heat..."
|
||||||
msgstr "Encontrar truco"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:594
|
#: xrc/MainMenu.xrc:594
|
||||||
msgid "A&utomatically save / load cheats"
|
msgid "A&utomatically save / load cheats"
|
||||||
msgstr "Guardar / cargar trucos automáticamente"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:598
|
#: xrc/MainMenu.xrc:598
|
||||||
msgid "&Enable cheats"
|
msgid "&Enable cheats"
|
||||||
@@ -3659,7 +3657,7 @@ msgstr "Report &Bugs"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:733
|
#: xrc/MainMenu.xrc:733
|
||||||
msgid "Visual Boy Advance-M Support &Forum"
|
msgid "Visual Boy Advance-M Support &Forum"
|
||||||
msgstr "Soporte y foro de Visual Boy Advance-M"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:736
|
#: xrc/MainMenu.xrc:736
|
||||||
msgid "Translations"
|
msgid "Translations"
|
||||||
@@ -3747,7 +3745,7 @@ msgstr "Start Network Link"
|
|||||||
|
|
||||||
#: xrc/NetLink.xrc:13
|
#: xrc/NetLink.xrc:13
|
||||||
msgid "WARNING: Link will likely not work over the internet or LAN."
|
msgid "WARNING: Link will likely not work over the internet or LAN."
|
||||||
msgstr "ADVERTENCIA: Es probable que el enlace no funcione a través de Internet o LAN."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/NetLink.xrc:38
|
#: xrc/NetLink.xrc:38
|
||||||
msgid "Server"
|
msgid "Server"
|
||||||
@@ -3763,7 +3761,7 @@ msgstr "Players:"
|
|||||||
|
|
||||||
#: xrc/NetLink.xrc:83
|
#: xrc/NetLink.xrc:83
|
||||||
msgid "2"
|
msgid "2"
|
||||||
msgstr "2"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/NetLink.xrc:107
|
#: xrc/NetLink.xrc:107
|
||||||
msgid "Server:"
|
msgid "Server:"
|
||||||
@@ -3795,7 +3793,7 @@ msgstr "Sound Settings"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:18
|
#: xrc/SoundConfig.xrc:18
|
||||||
msgid "Volume:"
|
msgid "Volume:"
|
||||||
msgstr "Volumen:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:36
|
#: xrc/SoundConfig.xrc:36
|
||||||
msgid "Mute"
|
msgid "Mute"
|
||||||
@@ -3807,7 +3805,7 @@ msgstr "Maximum"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:73
|
#: xrc/SoundConfig.xrc:73
|
||||||
msgid "Sample rate:"
|
msgid "Sample rate:"
|
||||||
msgstr "Frecuencia de muestreo:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:79
|
#: xrc/SoundConfig.xrc:79
|
||||||
msgid "48 KHz"
|
msgid "48 KHz"
|
||||||
@@ -3827,7 +3825,7 @@ msgstr "11 KHz"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:112
|
#: xrc/SoundConfig.xrc:112
|
||||||
msgid "Direct Sound"
|
msgid "Direct Sound"
|
||||||
msgstr "Sonido directo"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:140
|
#: xrc/SoundConfig.xrc:140
|
||||||
msgid "Device"
|
msgid "Device"
|
||||||
@@ -3867,7 +3865,7 @@ msgstr "Center"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:263
|
#: xrc/SoundConfig.xrc:263
|
||||||
msgid "Left / Right"
|
msgid "Left / Right"
|
||||||
msgstr "Izquierda / Derecha"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:292
|
#: xrc/SoundConfig.xrc:292
|
||||||
msgid "Sound filtering"
|
msgid "Sound filtering"
|
||||||
@@ -3895,4 +3893,4 @@ msgstr "Frame skip"
|
|||||||
|
|
||||||
#: xrc/SpeedupConfig.xrc:61
|
#: xrc/SpeedupConfig.xrc:61
|
||||||
msgid "Mute Sound"
|
msgid "Mute Sound"
|
||||||
msgstr "Silenciar sonido"
|
msgstr ""
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
# Chizuru <saiber.one1@gmail.com>, 2015
|
# Chizuru <saiber.one1@gmail.com>, 2015
|
||||||
# Dimas Radityo, 2022
|
# Dimas Radityo, 2022
|
||||||
# Jeremy Belpois <jeremy.belpois.einstein@gmail.com>, 2019
|
# Jeremy Belpois <jeremy.belpois.einstein@gmail.com>, 2019
|
||||||
# heydootdoot last, 2024-2025
|
# heydootdoot last, 2024
|
||||||
# Jeremy Belpois <jeremy.belpois.einstein@gmail.com>, 2019-2020
|
# Jeremy Belpois <jeremy.belpois.einstein@gmail.com>, 2019-2020
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -15,7 +15,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: heydootdoot last, 2024-2025\n"
|
"Last-Translator: heydootdoot last, 2024\n"
|
||||||
"Language-Team: Indonesian (http://app.transifex.com/bgk/vba-m/language/id/)\n"
|
"Language-Team: Indonesian (http://app.transifex.com/bgk/vba-m/language/id/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -146,11 +146,11 @@ msgstr "Pilih snapshot"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
||||||
" (*.gsv)|*.gsv"
|
" (*.gsv)|*.gsv"
|
||||||
msgstr "Snapshot Game Shark & PAC (*.sps;*.xps)|*.sps;*.xps|Snapshot Game Shark SP (*.gsv)|*.gsv"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:554
|
#: cmdevents.cpp:554
|
||||||
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
||||||
msgstr "Snapshot Game Boy (*.gbs)|*.gbs"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:563
|
#: cmdevents.cpp:563
|
||||||
msgid ""
|
msgid ""
|
||||||
@@ -171,7 +171,7 @@ msgstr "Galat memuat snapshot %s"
|
|||||||
#: cmdevents.cpp:613
|
#: cmdevents.cpp:613
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Wrote battery %s"
|
msgid "Wrote battery %s"
|
||||||
msgstr "Simpan baterai %s"
|
msgstr "Menyimpan baterai %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:615 panel.cpp:803
|
#: cmdevents.cpp:615 panel.cpp:803
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -184,11 +184,11 @@ msgstr "Simpanan EEPROM tak dapat diekspor"
|
|||||||
|
|
||||||
#: cmdevents.cpp:630
|
#: cmdevents.cpp:630
|
||||||
msgid "Game Shark Snapshot (*.sps)|*.sps"
|
msgid "Game Shark Snapshot (*.sps)|*.sps"
|
||||||
msgstr "Snapshot Game Shark (*.sps)|*.sps"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:644
|
#: cmdevents.cpp:644
|
||||||
msgid "Exported from Visual Boy Advance-M"
|
msgid "Exported from Visual Boy Advance-M"
|
||||||
msgstr "Diekspor dari Visual Boy Advance-M"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:656
|
#: cmdevents.cpp:656
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -213,7 +213,7 @@ msgstr "Gambar PNG|*.png|Gambar BMP|*.bmp"
|
|||||||
#: cmdevents.cpp:699 sys.cpp:579
|
#: cmdevents.cpp:699 sys.cpp:579
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Wrote snapshot %s"
|
msgid "Wrote snapshot %s"
|
||||||
msgstr "Simpan snapshot %s"
|
msgstr "Menyimpan snapshot %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:720 cmdevents.cpp:790 cmdevents.cpp:859 cmdevents.cpp:925
|
#: cmdevents.cpp:720 cmdevents.cpp:790 cmdevents.cpp:859 cmdevents.cpp:925
|
||||||
msgid " files ("
|
msgid " files ("
|
||||||
@@ -225,7 +225,7 @@ msgstr "Pilih berkas"
|
|||||||
|
|
||||||
#: cmdevents.cpp:1262 cmdevents.cpp:1355
|
#: cmdevents.cpp:1262 cmdevents.cpp:1355
|
||||||
msgid "Select state file"
|
msgid "Select state file"
|
||||||
msgstr "Pilih berkas savestate"
|
msgstr "Pilih berkas state"
|
||||||
|
|
||||||
#: cmdevents.cpp:1263 cmdevents.cpp:1356
|
#: cmdevents.cpp:1263 cmdevents.cpp:1356
|
||||||
msgid "Visual Boy Advance saved game files|*.sgm"
|
msgid "Visual Boy Advance saved game files|*.sgm"
|
||||||
@@ -234,7 +234,7 @@ msgstr "Simpanan permainan Visual Boy Advance|*.sgm"
|
|||||||
#: cmdevents.cpp:1386 cmdevents.cpp:1396 cmdevents.cpp:1407
|
#: cmdevents.cpp:1386 cmdevents.cpp:1396 cmdevents.cpp:1407
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Current state slot #%d"
|
msgid "Current state slot #%d"
|
||||||
msgstr "Slot savestate saat ini #%d"
|
msgstr "Slot keadaan saat ini #%d"
|
||||||
|
|
||||||
#: cmdevents.cpp:1470
|
#: cmdevents.cpp:1470
|
||||||
msgid "Cannot use Colorizer Hack when Game Boy BIOS File is enabled."
|
msgid "Cannot use Colorizer Hack when Game Boy BIOS File is enabled."
|
||||||
@@ -776,22 +776,22 @@ msgstr "pemain"
|
|||||||
#: panel.cpp:751
|
#: panel.cpp:751
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Loaded state %s"
|
msgid "Loaded state %s"
|
||||||
msgstr "Savestate yang dimuat %s"
|
msgstr "State yang dimuat %s"
|
||||||
|
|
||||||
#: panel.cpp:751
|
#: panel.cpp:751
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error loading state %s"
|
msgid "Error loading state %s"
|
||||||
msgstr "Galat memuat savestate %s"
|
msgstr "Terjadi kesalahan dalam memuat state %s"
|
||||||
|
|
||||||
#: panel.cpp:775
|
#: panel.cpp:775
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Saved state %s"
|
msgid "Saved state %s"
|
||||||
msgstr "Savestate yang disimpan %s"
|
msgstr "State yang disimpan %s"
|
||||||
|
|
||||||
#: panel.cpp:775
|
#: panel.cpp:775
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error saving state %s"
|
msgid "Error saving state %s"
|
||||||
msgstr "Galat menyimpan savestate %s"
|
msgstr "Terjadi kesalahan dalam menyimpan state %s"
|
||||||
|
|
||||||
#: panel.cpp:979
|
#: panel.cpp:979
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -828,7 +828,7 @@ msgstr "Tidak ada memori untuk memuat state mundur"
|
|||||||
|
|
||||||
#: panel.cpp:1300
|
#: panel.cpp:1300
|
||||||
msgid "Error writing rewind state"
|
msgid "Error writing rewind state"
|
||||||
msgstr "Galat menulis savestate mundur"
|
msgstr "Terjadi kesalahan dalam menyimpan state mundur"
|
||||||
|
|
||||||
#: panel.cpp:2277
|
#: panel.cpp:2277
|
||||||
msgid "Enabling EGL VSync."
|
msgid "Enabling EGL VSync."
|
||||||
@@ -1049,7 +1049,7 @@ msgstr "Atur berkas konfigurasi"
|
|||||||
|
|
||||||
#: wxvbam.cpp:638
|
#: wxvbam.cpp:638
|
||||||
msgid "Delete shared link state first, if it exists"
|
msgid "Delete shared link state first, if it exists"
|
||||||
msgstr "Hapus dulu tautan savestate, jika adaa"
|
msgstr "Hapus state hubungan yang dibagikan terlebih dahulu, jika ada"
|
||||||
|
|
||||||
#: wxvbam.cpp:645
|
#: wxvbam.cpp:645
|
||||||
msgid "List all settable options and exit"
|
msgid "List all settable options and exit"
|
||||||
@@ -1072,7 +1072,7 @@ msgstr "Galat bina / konfigurasi: Tak dapat cari xrc tertanam"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Wrote built-in configuration to %s.\n"
|
"Wrote built-in configuration to %s.\n"
|
||||||
"To override, remove all but changed root node(s). First found root node of correct name in any .xrc or .xrs files in following search path overrides built-in:"
|
"To override, remove all but changed root node(s). First found root node of correct name in any .xrc or .xrs files in following search path overrides built-in:"
|
||||||
msgstr "Menyimpan konfig tertanam ke %s.\nUntuk timpa berkas, hapus semua node root kecuali yang terubah. Cari dulu node root yang benar pada berkas .xrc / .xrs di pencarian berkas timpaan tertanam berikut:"
|
msgstr ""
|
||||||
|
|
||||||
#: wxvbam.cpp:703
|
#: wxvbam.cpp:703
|
||||||
msgid "Configuration is read from, in order:"
|
msgid "Configuration is read from, in order:"
|
||||||
@@ -1083,7 +1083,7 @@ msgstr "Konfigurasi dibaca dari, secara berurutan:"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Wrote built-in override file to %s\n"
|
"Wrote built-in override file to %s\n"
|
||||||
"To override, delete all but changed section. First found section is used from search path:"
|
"To override, delete all but changed section. First found section is used from search path:"
|
||||||
msgstr "Menyimpan berkas timpaan ke %s\nUntuk timpa berkas, hapus semua bagian kecuali yang terubah. Cari dulu bagian yang digunakan dari pencarian:"
|
msgstr ""
|
||||||
|
|
||||||
#: wxvbam.cpp:723
|
#: wxvbam.cpp:723
|
||||||
msgid ""
|
msgid ""
|
||||||
@@ -1342,7 +1342,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:445
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:445
|
||||||
msgid "Automatically load last saved state"
|
msgid "Automatically load last saved state"
|
||||||
msgstr "Otomatis memuat terakhir savestate"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:447
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:447
|
||||||
msgid ""
|
msgid ""
|
||||||
@@ -1507,11 +1507,11 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:522
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:522
|
||||||
msgid "Do not overwrite cheat list when loading state"
|
msgid "Do not overwrite cheat list when loading state"
|
||||||
msgstr "Jangan timpa daftar cheat saat memuat savestate"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:524
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:524
|
||||||
msgid "Do not overwrite native (battery) save when loading state"
|
msgid "Do not overwrite native (battery) save when loading state"
|
||||||
msgstr "Jangan timpa simpanan lokal (baterai) saat memuat savestate"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:526
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:526
|
||||||
msgid "Throttle game speed, even when accelerated (0-450 %, 0 = no throttle)"
|
msgid "Throttle game speed, even when accelerated (0-450 %, 0 = no throttle)"
|
||||||
@@ -3078,7 +3078,7 @@ msgstr "Ter&baru"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:50
|
#: xrc/MainMenu.xrc:50
|
||||||
msgid "Load current state slot"
|
msgid "Load current state slot"
|
||||||
msgstr "Muat savestate saat ini"
|
msgstr "Muat slot keadaan saat ini"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:53
|
#: xrc/MainMenu.xrc:53
|
||||||
msgid "&Auto load most recent"
|
msgid "&Auto load most recent"
|
||||||
@@ -3098,7 +3098,7 @@ msgstr "Jangan ubah daftar &cheat"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:100
|
#: xrc/MainMenu.xrc:100
|
||||||
msgid "&Load state"
|
msgid "&Load state"
|
||||||
msgstr "&Muat savestate"
|
msgstr "&Muat state"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:104
|
#: xrc/MainMenu.xrc:104
|
||||||
msgid "&Oldest slot"
|
msgid "&Oldest slot"
|
||||||
@@ -3106,11 +3106,11 @@ msgstr "&Slot terlama"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:107
|
#: xrc/MainMenu.xrc:107
|
||||||
msgid "Save current state slot"
|
msgid "Save current state slot"
|
||||||
msgstr "Simpan savestate saat ini"
|
msgstr "Simpan slot keadaan saat ini"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:110
|
#: xrc/MainMenu.xrc:110
|
||||||
msgid "Increase state slot number and save"
|
msgid "Increase state slot number and save"
|
||||||
msgstr "Tambah jumlah savestate lalu simpan"
|
msgstr "Tambah jumlah slot keadaan lalu simpan"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:117
|
#: xrc/MainMenu.xrc:117
|
||||||
msgid "&2"
|
msgid "&2"
|
||||||
@@ -3154,15 +3154,15 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:147
|
#: xrc/MainMenu.xrc:147
|
||||||
msgid "&Save state"
|
msgid "&Save state"
|
||||||
msgstr "&Simpan savestate"
|
msgstr "&Simpan state"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:150
|
#: xrc/MainMenu.xrc:150
|
||||||
msgid "Increase state slot number"
|
msgid "Increase state slot number"
|
||||||
msgstr "Tambah jumlah savestate"
|
msgstr "Tambah jumlah slot keadaan"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:153
|
#: xrc/MainMenu.xrc:153
|
||||||
msgid "Decrease state slot number"
|
msgid "Decrease state slot number"
|
||||||
msgstr "Kurangi jumlah ssavestate"
|
msgstr "Kurangi jumlah slot keadaan"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:158 xrc/MainMenu.xrc:170
|
#: xrc/MainMenu.xrc:158 xrc/MainMenu.xrc:170
|
||||||
msgid "&Battery file..."
|
msgid "&Battery file..."
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
# Giulio Serroni, 2022
|
# Giulio Serroni, 2022
|
||||||
# JustAnOrange, 2023
|
# JustAnOrange, 2023
|
||||||
# Luca Bonello <fenopiu@gmail.com>, 2016
|
# Luca Bonello <fenopiu@gmail.com>, 2016
|
||||||
# ludo thorn, 2025
|
|
||||||
# Michele Rebughini <michelerebughini@gmail.com>, 2020
|
# Michele Rebughini <michelerebughini@gmail.com>, 2020
|
||||||
# OTTO X <blg.dpnx@gmail.com>, 2015
|
# OTTO X <blg.dpnx@gmail.com>, 2015
|
||||||
# Picat <pichu474android@gmail.com>, 2016
|
# Picat <pichu474android@gmail.com>, 2016
|
||||||
@@ -27,7 +26,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: ludo thorn, 2025\n"
|
"Last-Translator: JustAnOrange, 2023\n"
|
||||||
"Language-Team: Italian (Italy) (http://app.transifex.com/bgk/vba-m/language/it_IT/)\n"
|
"Language-Team: Italian (Italy) (http://app.transifex.com/bgk/vba-m/language/it_IT/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -2716,7 +2715,7 @@ msgstr "Impostazioni Game Boy Advance"
|
|||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:21
|
#: xrc/GameBoyAdvanceConfig.xrc:21
|
||||||
msgid "Save type:"
|
msgid "Save type:"
|
||||||
msgstr "Tipo di salvataggio"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:27 xrc/GameBoyAdvanceConfig.xrc:199
|
#: xrc/GameBoyAdvanceConfig.xrc:27 xrc/GameBoyAdvanceConfig.xrc:199
|
||||||
#: xrc/GameBoyConfig.xrc:29 xrc/GameBoyConfig.xrc:59
|
#: xrc/GameBoyConfig.xrc:29 xrc/GameBoyConfig.xrc:59
|
||||||
@@ -2765,7 +2764,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:115
|
#: xrc/GameBoyAdvanceConfig.xrc:115
|
||||||
msgid "Current BIOS file:"
|
msgid "Current BIOS file:"
|
||||||
msgstr "File BIOS attuale:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:136 xrc/GameBoyConfig.xrc:168
|
#: xrc/GameBoyAdvanceConfig.xrc:136 xrc/GameBoyConfig.xrc:168
|
||||||
msgid "Boot ROM"
|
msgid "Boot ROM"
|
||||||
@@ -2819,7 +2818,7 @@ msgstr "Impostazioni speciali per questo gioco"
|
|||||||
|
|
||||||
#: xrc/GameBoyConfig.xrc:4
|
#: xrc/GameBoyConfig.xrc:4
|
||||||
msgid "Game Boy settings"
|
msgid "Game Boy settings"
|
||||||
msgstr "Impostazioni Game Boy"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyConfig.xrc:20
|
#: xrc/GameBoyConfig.xrc:20
|
||||||
msgid "Emulated &system:"
|
msgid "Emulated &system:"
|
||||||
@@ -3331,7 +3330,7 @@ msgstr "&Speed hack"
|
|||||||
#: xrc/MainMenu.xrc:310 xrc/MainMenu.xrc:316 xrc/MainMenu.xrc:383
|
#: xrc/MainMenu.xrc:310 xrc/MainMenu.xrc:316 xrc/MainMenu.xrc:383
|
||||||
#: xrc/MainMenu.xrc:417
|
#: xrc/MainMenu.xrc:417
|
||||||
msgid "&Configure..."
|
msgid "&Configure..."
|
||||||
msgstr "&Configura..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:314
|
#: xrc/MainMenu.xrc:314
|
||||||
msgid "&Video"
|
msgid "&Video"
|
||||||
@@ -3415,7 +3414,7 @@ msgstr "&Attiva suono"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:397
|
#: xrc/MainMenu.xrc:397
|
||||||
msgid "&Game Boy Advance sound interpolation"
|
msgid "&Game Boy Advance sound interpolation"
|
||||||
msgstr "&Game Boy Advance interpolazione suono"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:402
|
#: xrc/MainMenu.xrc:402
|
||||||
msgid "&Game Boy sound enhancement"
|
msgid "&Game Boy sound enhancement"
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
# Giovanni Schiano-Moriello, 2022
|
# Giovanni Schiano-Moriello, 2022
|
||||||
# Hinaloe <hina@hinaloe.net>, 2017
|
# Hinaloe <hina@hinaloe.net>, 2017
|
||||||
# Kuso Bully <aaadsaaads@yahoo.co.jp>, 2018
|
# Kuso Bully <aaadsaaads@yahoo.co.jp>, 2018
|
||||||
# Lanta Liz, 2025
|
|
||||||
# Mach555 <aimmasayukitone@yahoo.co.jp>, 2015
|
# Mach555 <aimmasayukitone@yahoo.co.jp>, 2015
|
||||||
# Mutuda Katuo <afetser@gmail.com>, 2017
|
# Mutuda Katuo <afetser@gmail.com>, 2017
|
||||||
# Okubo Shohei <stream.larn3@gmail.com>, 2021
|
# Okubo Shohei <stream.larn3@gmail.com>, 2021
|
||||||
@@ -19,7 +18,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: Lanta Liz, 2025\n"
|
"Last-Translator: 田中康陽, 2022\n"
|
||||||
"Language-Team: Japanese (http://app.transifex.com/bgk/vba-m/language/ja/)\n"
|
"Language-Team: Japanese (http://app.transifex.com/bgk/vba-m/language/ja/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -29,7 +28,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: audio/internal/openal.cpp:188
|
#: audio/internal/openal.cpp:188
|
||||||
msgid "OpenAL: Failed to open audio device"
|
msgid "OpenAL: Failed to open audio device"
|
||||||
msgstr "OpenAL: オーディオデバイスを開けませんでした"
|
msgstr ""
|
||||||
|
|
||||||
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
||||||
#: audio/internal/xaudio2.cpp:577
|
#: audio/internal/xaudio2.cpp:577
|
||||||
@@ -42,7 +41,7 @@ msgid ""
|
|||||||
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
||||||
" Boy Files "
|
" Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "ゲームボーイアドバンスのファイル\n(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game Boy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:144
|
#: cmdevents.cpp:144
|
||||||
msgid "Open ROM file"
|
msgid "Open ROM file"
|
||||||
@@ -52,7 +51,7 @@ msgstr "ROMファイルを開く"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Files "
|
"Game Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "ゲームボーイのファイル\n(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:171
|
#: cmdevents.cpp:171
|
||||||
msgid "Open GB ROM file"
|
msgid "Open GB ROM file"
|
||||||
@@ -62,7 +61,7 @@ msgstr "ゲームボーイのROMファイルを開く"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Color Files "
|
"Game Boy Color Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "ゲームボーイカラーのファイル(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:198
|
#: cmdevents.cpp:198
|
||||||
msgid "Open GBC ROM file"
|
msgid "Open GBC ROM file"
|
||||||
@@ -74,7 +73,7 @@ msgstr "ドットコードファイルを選択"
|
|||||||
|
|
||||||
#: cmdevents.cpp:365 cmdevents.cpp:387
|
#: cmdevents.cpp:365 cmdevents.cpp:387
|
||||||
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
||||||
msgstr "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:406 cmdevents.cpp:601
|
#: cmdevents.cpp:406 cmdevents.cpp:601
|
||||||
msgid "Select battery file"
|
msgid "Select battery file"
|
||||||
@@ -88,7 +87,7 @@ msgstr "バッテリーファイル (*.sav) | *. sav|フラッシュセーブフ
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a battery file will erase any saved games (permanently after the "
|
"Importing a battery file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "バッテリー ファイルを読み込むと、保存したゲームがすべて消去されます (次回の書き込み後、完全に消去されます)続行しますか?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
||||||
msgid "Confirm import"
|
msgid "Confirm import"
|
||||||
@@ -110,17 +109,17 @@ msgstr "コードファイルを選択"
|
|||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
||||||
msgstr "ゲームシャークのコードファイル (*.spc;*.xpc)|*.spc;*.xpc"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
||||||
msgstr "ゲームシャークのコードファイル(*.gcf)|*.gcf"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:443
|
#: cmdevents.cpp:443
|
||||||
msgid ""
|
msgid ""
|
||||||
"Importing a code file will replace any loaded cheats. Do you want to "
|
"Importing a code file will replace any loaded cheats. Do you want to "
|
||||||
"continue?"
|
"continue?"
|
||||||
msgstr "コード ファイルを読み込むと、読み込まれたチートが置き換えられます。続行しますか?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:460
|
#: cmdevents.cpp:460
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -150,17 +149,17 @@ msgstr "スナップショットファイルを選択"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
"Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots"
|
||||||
" (*.gsv)|*.gsv"
|
" (*.gsv)|*.gsv"
|
||||||
msgstr "ゲームシャーク & PAC のスナップショット (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots (*.gsv)|*.gsv"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:554
|
#: cmdevents.cpp:554
|
||||||
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
msgid "Game Boy Snapshot (*.gbs)|*.gbs"
|
||||||
msgstr "ゲームボーイのスナップショット(*.gbs)|*.gbs"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:563
|
#: cmdevents.cpp:563
|
||||||
msgid ""
|
msgid ""
|
||||||
"Importing a snapshot file will erase any saved games (permanently after the "
|
"Importing a snapshot file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "スナップショット ファイルをインポートすると、保存されたゲームはすべて消去されます (次回の書き込み後には永久に消去されます)。続行しますか?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:588
|
#: cmdevents.cpp:588
|
||||||
#, c-format
|
#, c-format
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
# Mateus, 2020
|
# Mateus, 2020
|
||||||
# Mateus Santos <sonicheats@gmail.com>, 2017
|
# Mateus Santos <sonicheats@gmail.com>, 2017
|
||||||
# Mateus, 2020
|
# Mateus, 2020
|
||||||
# Mauro Sokrates, 2025
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VBA-M\n"
|
"Project-Id-Version: VBA-M\n"
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# Alexey Ter <lexalamer@mail.ru>, 2016
|
# Alexey Ter <lexalamer@mail.ru>, 2016
|
||||||
# Anton Fedenko <gang296@mail.ru>, 2015
|
# Anton Fedenko <gang296@mail.ru>, 2015
|
||||||
# Artem Abramov <aabramovrussia@yandex.com>, 2015
|
# Artem Abramov <aabramovrussia@yandex.com>, 2015
|
||||||
# aa26bd9ab58eaf66f2dd8a133c45eb7b_740a4a0 <e0546a0601f08ad77df0edd7ee27c670_658246>, 2017
|
# George Matsune <georg29387878@gmail.com>, 2017
|
||||||
# Irina Fedulova <istartlin@gmail.com>, 2020
|
# Irina Fedulova <istartlin@gmail.com>, 2020
|
||||||
# Koshak Magnificent <coschack@mail.ru>, 2020
|
# Koshak Magnificent <coschack@mail.ru>, 2020
|
||||||
# Matvey Nazarov, 2022
|
# Matvey Nazarov, 2022
|
||||||
|
205
po/wxvbam/sv.po
205
po/wxvbam/sv.po
@@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
# Translators:
|
# Translators:
|
||||||
# Claes-Göran Nydahl <goldug@gmail.com>, 2019
|
# Claes-Göran Nydahl <goldug@gmail.com>, 2019
|
||||||
# Daniel Nylander <po@danielnylander.se>, 2025
|
|
||||||
# 59031d6847a58cccc64d8da23d16ff59_48f0fae, 2015
|
# 59031d6847a58cccc64d8da23d16ff59_48f0fae, 2015
|
||||||
# [deleted], 2015
|
# [deleted], 2015
|
||||||
# Sebastian Rasmussen <sebras@gmail.com>, 2020,2022
|
# Sebastian Rasmussen <sebras@gmail.com>, 2020,2022
|
||||||
@@ -18,7 +17,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: Daniel Nylander <po@danielnylander.se>, 2025\n"
|
"Last-Translator: Sebastian Rasmussen <sebras@gmail.com>, 2020,2022\n"
|
||||||
"Language-Team: Swedish (http://app.transifex.com/bgk/vba-m/language/sv/)\n"
|
"Language-Team: Swedish (http://app.transifex.com/bgk/vba-m/language/sv/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -28,7 +27,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: audio/internal/openal.cpp:188
|
#: audio/internal/openal.cpp:188
|
||||||
msgid "OpenAL: Failed to open audio device"
|
msgid "OpenAL: Failed to open audio device"
|
||||||
msgstr "OpenAL: Misslyckades med att öppna ljudenhet"
|
msgstr ""
|
||||||
|
|
||||||
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
#: audio/internal/openal.cpp:386 audio/internal/faudio.cpp:492
|
||||||
#: audio/internal/xaudio2.cpp:577
|
#: audio/internal/xaudio2.cpp:577
|
||||||
@@ -41,39 +40,39 @@ msgid ""
|
|||||||
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
"(*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game"
|
||||||
" Boy Files "
|
" Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Game Boy Advance-filer (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|*.agb;*.gba;*.bin;*.elf;*.mb;*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;*.zip;*.7z;*.rar|Game Boy-filer (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:144
|
#: cmdevents.cpp:144
|
||||||
msgid "Open ROM file"
|
msgid "Open ROM file"
|
||||||
msgstr "Öppna ROM-fil"
|
msgstr "Öppna ROM fil"
|
||||||
|
|
||||||
#: cmdevents.cpp:165
|
#: cmdevents.cpp:165
|
||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Files "
|
"Game Boy Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Game Boy-filer (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:171
|
#: cmdevents.cpp:171
|
||||||
msgid "Open GB ROM file"
|
msgid "Open GB ROM file"
|
||||||
msgstr "Öppna GB ROM-fil"
|
msgstr "Öppna GB ROM fil"
|
||||||
|
|
||||||
#: cmdevents.cpp:192
|
#: cmdevents.cpp:192
|
||||||
msgid ""
|
msgid ""
|
||||||
"Game Boy Color Files "
|
"Game Boy Color Files "
|
||||||
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
"(*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
||||||
msgstr "Game Boy Color-filer (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;*.zip;*.7z;*.rar|"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:198
|
#: cmdevents.cpp:198
|
||||||
msgid "Open GBC ROM file"
|
msgid "Open GBC ROM file"
|
||||||
msgstr "Öppna GBC ROM-fil"
|
msgstr "Öppna GBC ROM fil"
|
||||||
|
|
||||||
#: cmdevents.cpp:363 cmdevents.cpp:385
|
#: cmdevents.cpp:363 cmdevents.cpp:385
|
||||||
msgid "Select Dot Code file"
|
msgid "Select Dot Code file"
|
||||||
msgstr "Välj Dot Code-fil"
|
msgstr "Välj Dot Code fil"
|
||||||
|
|
||||||
#: cmdevents.cpp:365 cmdevents.cpp:387
|
#: cmdevents.cpp:365 cmdevents.cpp:387
|
||||||
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
msgid "E-Reader Dot Code (*.bin;*.raw)|*.bin;*.raw"
|
||||||
msgstr "E-Reader-punktkod (*.bin;*.raw)|*.bin;*.raw"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:406 cmdevents.cpp:601
|
#: cmdevents.cpp:406 cmdevents.cpp:601
|
||||||
msgid "Select battery file"
|
msgid "Select battery file"
|
||||||
@@ -87,7 +86,7 @@ msgstr "Batterifil (*.sav)|*.sav|Flash save (*.dat)|*.dat"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Importing a battery file will erase any saved games (permanently after the "
|
"Importing a battery file will erase any saved games (permanently after the "
|
||||||
"next write). Do you want to continue?"
|
"next write). Do you want to continue?"
|
||||||
msgstr "Om du importerar en batterifil raderas alla sparade spel (permanent efter nästa skrivning). Vill du fortsätta?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
#: cmdevents.cpp:416 cmdevents.cpp:444 cmdevents.cpp:564
|
||||||
msgid "Confirm import"
|
msgid "Confirm import"
|
||||||
@@ -96,12 +95,12 @@ msgstr "Bekräfta import"
|
|||||||
#: cmdevents.cpp:422 panel.cpp:493
|
#: cmdevents.cpp:422 panel.cpp:493
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Loaded battery %s"
|
msgid "Loaded battery %s"
|
||||||
msgstr "Läste in batteri %s"
|
msgstr "Laddade batteri %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:424
|
#: cmdevents.cpp:424
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error loading battery %s"
|
msgid "Error loading battery %s"
|
||||||
msgstr "Fel vid inläsning av batteri %s"
|
msgstr "Fel vid laddning av batteri %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:433
|
#: cmdevents.cpp:433
|
||||||
msgid "Select code file"
|
msgid "Select code file"
|
||||||
@@ -109,22 +108,22 @@ msgstr "Välj kodfil"
|
|||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
msgid "Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc"
|
||||||
msgstr "Game Shark-kodfil (*.spc;*.xpc)|*.spc;*.xpc"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:434
|
#: cmdevents.cpp:434
|
||||||
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
msgid "Game Shark Code File (*.gcf)|*.gcf"
|
||||||
msgstr "Game Shark-kodfil (*.gcf)|*.gcf"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:443
|
#: cmdevents.cpp:443
|
||||||
msgid ""
|
msgid ""
|
||||||
"Importing a code file will replace any loaded cheats. Do you want to "
|
"Importing a code file will replace any loaded cheats. Do you want to "
|
||||||
"continue?"
|
"continue?"
|
||||||
msgstr "Att importera en kodfil kommer att ersätta alla inlästa fusk. Vill du fortsätta?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:460
|
#: cmdevents.cpp:460
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Cannot open file %s"
|
msgid "Cannot open file %s"
|
||||||
msgstr "Kan inte öppna filen %s"
|
msgstr "Kan inte öppna fil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:470
|
#: cmdevents.cpp:470
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -134,12 +133,12 @@ msgstr "Kodfilen stöds inte %s"
|
|||||||
#: cmdevents.cpp:540
|
#: cmdevents.cpp:540
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Loaded code file %s"
|
msgid "Loaded code file %s"
|
||||||
msgstr "Läste in kodfilen %s"
|
msgstr "Laddade kodfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:542
|
#: cmdevents.cpp:542
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error loading code file %s"
|
msgid "Error loading code file %s"
|
||||||
msgstr "Fel vid inläsning av kodfilen %s"
|
msgstr "Fel vid laddning av kodfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:553 cmdevents.cpp:629
|
#: cmdevents.cpp:553 cmdevents.cpp:629
|
||||||
msgid "Select snapshot file"
|
msgid "Select snapshot file"
|
||||||
@@ -164,12 +163,12 @@ msgstr ""
|
|||||||
#: cmdevents.cpp:588
|
#: cmdevents.cpp:588
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Loaded snapshot file %s"
|
msgid "Loaded snapshot file %s"
|
||||||
msgstr "Läste in ögonblicksfilen %s"
|
msgstr "Laddade ögonblicksfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:590
|
#: cmdevents.cpp:590
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error loading snapshot file %s"
|
msgid "Error loading snapshot file %s"
|
||||||
msgstr "Fel vid inläsning av ögonblicksfilen %s"
|
msgstr "Fel vid laddning av ögonblicksfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:613
|
#: cmdevents.cpp:613
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -191,17 +190,17 @@ msgstr ""
|
|||||||
|
|
||||||
#: cmdevents.cpp:644
|
#: cmdevents.cpp:644
|
||||||
msgid "Exported from Visual Boy Advance-M"
|
msgid "Exported from Visual Boy Advance-M"
|
||||||
msgstr "Exporterad från Visual Boy Advance-M"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:656
|
#: cmdevents.cpp:656
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Saved snapshot file %s"
|
msgid "Saved snapshot file %s"
|
||||||
msgstr "Sparade ögonblicksfilen %s"
|
msgstr "Sparade ögonblicksfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:658
|
#: cmdevents.cpp:658
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Error saving snapshot file %s"
|
msgid "Error saving snapshot file %s"
|
||||||
msgstr "Fel vid sparandet av ögonblicksfilen %s"
|
msgstr "Fel vid sparandet av ögonblicksfil%s"
|
||||||
|
|
||||||
#: cmdevents.cpp:674 cmdevents.cpp:752 cmdevents.cpp:822 cmdevents.cpp:891
|
#: cmdevents.cpp:674 cmdevents.cpp:752 cmdevents.cpp:822 cmdevents.cpp:891
|
||||||
#: gfxviewers.cpp:1662 gfxviewers.cpp:1807 viewers.cpp:588 viewers.cpp:802
|
#: gfxviewers.cpp:1662 gfxviewers.cpp:1807 viewers.cpp:588 viewers.cpp:802
|
||||||
@@ -211,12 +210,12 @@ msgstr "Välj utdatafil"
|
|||||||
|
|
||||||
#: cmdevents.cpp:675 gfxviewers.cpp:1663 gfxviewers.cpp:1808 viewsupt.cpp:1200
|
#: cmdevents.cpp:675 gfxviewers.cpp:1663 gfxviewers.cpp:1808 viewsupt.cpp:1200
|
||||||
msgid "PNG images|*.png|BMP images|*.bmp"
|
msgid "PNG images|*.png|BMP images|*.bmp"
|
||||||
msgstr "PNG bilder|*.png|BMP-bilder|*.bmp"
|
msgstr "PNG bilder|*.png|BMP bilder|*.bmp"
|
||||||
|
|
||||||
#: cmdevents.cpp:699 sys.cpp:579
|
#: cmdevents.cpp:699 sys.cpp:579
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Wrote snapshot %s"
|
msgid "Wrote snapshot %s"
|
||||||
msgstr "Skrev ögonblicksfilen %s"
|
msgstr "Skrev ögonblicksfil %s"
|
||||||
|
|
||||||
#: cmdevents.cpp:720 cmdevents.cpp:790 cmdevents.cpp:859 cmdevents.cpp:925
|
#: cmdevents.cpp:720 cmdevents.cpp:790 cmdevents.cpp:859 cmdevents.cpp:925
|
||||||
msgid " files ("
|
msgid " files ("
|
||||||
@@ -261,7 +260,7 @@ msgstr "Port att vänta på anslutning vid:"
|
|||||||
|
|
||||||
#: cmdevents.cpp:1763
|
#: cmdevents.cpp:1763
|
||||||
msgid "GDB Connection"
|
msgid "GDB Connection"
|
||||||
msgstr "GDB-anslutning"
|
msgstr "GDB anslutning"
|
||||||
|
|
||||||
#: cmdevents.cpp:1815
|
#: cmdevents.cpp:1815
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -282,15 +281,15 @@ msgid ""
|
|||||||
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
"YOUR CONFIGURATION WILL BE DELETED!\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Are you sure?"
|
"Are you sure?"
|
||||||
msgstr "DIN KONFIGURATION KOMMER ATT TAS BORT!\n\nÄr du säker?"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2201
|
#: cmdevents.cpp:2201
|
||||||
msgid "FACTORY RESET"
|
msgid "FACTORY RESET"
|
||||||
msgstr "FABRIKSÅTERSTÄLLNING"
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2236
|
#: cmdevents.cpp:2236
|
||||||
msgid "Nintendo Game Boy / Color / Advance emulator."
|
msgid "Nintendo Game Boy / Color / Advance emulator."
|
||||||
msgstr "Nintendo Game Boy / Color / Advance-emulator."
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2237
|
#: cmdevents.cpp:2237
|
||||||
msgid ""
|
msgid ""
|
||||||
@@ -313,7 +312,7 @@ msgid ""
|
|||||||
"\n"
|
"\n"
|
||||||
"You should have received a copy of the GNU General Public License\n"
|
"You should have received a copy of the GNU General Public License\n"
|
||||||
"along with this program. If not, see http://www.gnu.org/licenses ."
|
"along with this program. If not, see http://www.gnu.org/licenses ."
|
||||||
msgstr "Detta program är fri programvara: du kan vidaredistribuera det och / eller ändra det enligt villkoren i GNU General Public License som publiceras av Free Software Foundation, antingen version 2 av licensen eller (efter eget val) någon senare version.\n\nDetta program distribueras i hopp om att det kommer att vara användbart, men UTAN NÅGON GARANTI; utan ens den underförstådda garantin om SÄLJBARHET eller LÄMPLIGHET FÖR ETT BESTÄMT SYFTE. Se GNU General Public License för mer information.\n\nDu bör ha fått en kopia av GNU General Public License tillsammans med detta program. Om inte, se http://www.gnu.org/licenses ."
|
msgstr ""
|
||||||
|
|
||||||
#: cmdevents.cpp:2424
|
#: cmdevents.cpp:2424
|
||||||
msgid "Cannot use Game Boy BIOS when Colorizer Hack is enabled."
|
msgid "Cannot use Game Boy BIOS when Colorizer Hack is enabled."
|
||||||
@@ -390,7 +389,7 @@ msgstr "Okänd"
|
|||||||
|
|
||||||
#: dialogs/game-maker.cpp:235
|
#: dialogs/game-maker.cpp:235
|
||||||
msgid "Invalid"
|
msgid "Invalid"
|
||||||
msgstr "Ogiltig"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:22
|
#: dialogs/gb-rom-info.cpp:22
|
||||||
msgid "No mapper"
|
msgid "No mapper"
|
||||||
@@ -402,15 +401,15 @@ msgstr ""
|
|||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:68
|
#: dialogs/gb-rom-info.cpp:68
|
||||||
msgid " + RAM"
|
msgid " + RAM"
|
||||||
msgstr " + RAM"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:69
|
#: dialogs/gb-rom-info.cpp:69
|
||||||
msgid " + RTC"
|
msgid " + RTC"
|
||||||
msgstr " + RTC"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:70
|
#: dialogs/gb-rom-info.cpp:70
|
||||||
msgid " + Battery"
|
msgid " + Battery"
|
||||||
msgstr " + Batteri"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:71
|
#: dialogs/gb-rom-info.cpp:71
|
||||||
msgid " + Rumble"
|
msgid " + Rumble"
|
||||||
@@ -423,122 +422,122 @@ msgstr ""
|
|||||||
#: dialogs/gb-rom-info.cpp:74
|
#: dialogs/gb-rom-info.cpp:74
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (%s%s%s%s%s%s)"
|
msgid "%02X (%s%s%s%s%s%s)"
|
||||||
msgstr "%02X (%s%s%s%s%s%s)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:81 dialogs/gb-rom-info.cpp:93
|
#: dialogs/gb-rom-info.cpp:81 dialogs/gb-rom-info.cpp:93
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Supported)"
|
msgid "%02X (Supported)"
|
||||||
msgstr "%02X (stöds)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:83 dialogs/gb-rom-info.cpp:91
|
#: dialogs/gb-rom-info.cpp:83 dialogs/gb-rom-info.cpp:91
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Not supported)"
|
msgid "%02X (Not supported)"
|
||||||
msgstr "%02X (stöds inte)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:95
|
#: dialogs/gb-rom-info.cpp:95
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Required)"
|
msgid "%02X (Required)"
|
||||||
msgstr "%02X (krävs)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:107 dialogs/gb-rom-info.cpp:141
|
#: dialogs/gb-rom-info.cpp:107 dialogs/gb-rom-info.cpp:141
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (32 KiB)"
|
msgid "%02X (32 KiB)"
|
||||||
msgstr "%02X (32 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:109 dialogs/gb-rom-info.cpp:145
|
#: dialogs/gb-rom-info.cpp:109 dialogs/gb-rom-info.cpp:145
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (64 KiB)"
|
msgid "%02X (64 KiB)"
|
||||||
msgstr "%02X (64 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:111 dialogs/gb-rom-info.cpp:143
|
#: dialogs/gb-rom-info.cpp:111 dialogs/gb-rom-info.cpp:143
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (128 KiB)"
|
msgid "%02X (128 KiB)"
|
||||||
msgstr "%02X (128 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:113
|
#: dialogs/gb-rom-info.cpp:113
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (256 KiB)"
|
msgid "%02X (256 KiB)"
|
||||||
msgstr "%02X (256 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:115
|
#: dialogs/gb-rom-info.cpp:115
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (512 KiB)"
|
msgid "%02X (512 KiB)"
|
||||||
msgstr "%02X (512 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:117
|
#: dialogs/gb-rom-info.cpp:117
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (1 MiB)"
|
msgid "%02X (1 MiB)"
|
||||||
msgstr "%02X (1 MiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:119
|
#: dialogs/gb-rom-info.cpp:119
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (2 MiB)"
|
msgid "%02X (2 MiB)"
|
||||||
msgstr "%02X (2 MiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:121
|
#: dialogs/gb-rom-info.cpp:121
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (4 MiB)"
|
msgid "%02X (4 MiB)"
|
||||||
msgstr "%02X (4 MiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:123 dialogs/gb-rom-info.cpp:147
|
#: dialogs/gb-rom-info.cpp:123 dialogs/gb-rom-info.cpp:147
|
||||||
#: dialogs/gb-rom-info.cpp:159
|
#: dialogs/gb-rom-info.cpp:159
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Unknown)"
|
msgid "%02X (Unknown)"
|
||||||
msgstr "%02X (okänt)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:131
|
#: dialogs/gb-rom-info.cpp:131
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (None)"
|
msgid "%02X (None)"
|
||||||
msgstr "%02X (ingen)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:133
|
#: dialogs/gb-rom-info.cpp:133
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (256 B)"
|
msgid "%02X (256 B)"
|
||||||
msgstr "%02X (256 B)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:135
|
#: dialogs/gb-rom-info.cpp:135
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (512 B)"
|
msgid "%02X (512 B)"
|
||||||
msgstr "%02X (512 B)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:137
|
#: dialogs/gb-rom-info.cpp:137
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (2 KiB)"
|
msgid "%02X (2 KiB)"
|
||||||
msgstr "%02X (2 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:139
|
#: dialogs/gb-rom-info.cpp:139
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (8 KiB)"
|
msgid "%02X (8 KiB)"
|
||||||
msgstr "%02X (8 KiB)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:155
|
#: dialogs/gb-rom-info.cpp:155
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Japan)"
|
msgid "%02X (Japan)"
|
||||||
msgstr "%02X (Japan)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:157
|
#: dialogs/gb-rom-info.cpp:157
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (World)"
|
msgid "%02X (World)"
|
||||||
msgstr "%02X (Världen)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:201
|
#: dialogs/gb-rom-info.cpp:201
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%02X (Actual: %02X)"
|
msgid "%02X (Actual: %02X)"
|
||||||
msgstr "%02X (Faktisk: %02X)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/gb-rom-info.cpp:204
|
#: dialogs/gb-rom-info.cpp:204
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%04X (Actual: %04X)"
|
msgid "%04X (Actual: %04X)"
|
||||||
msgstr "%04X (Faktisk: %04X)"
|
msgstr ""
|
||||||
|
|
||||||
#: dialogs/sound-config.cpp:251
|
#: dialogs/sound-config.cpp:251
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%d frame = %.2f ms"
|
msgid "%d frame = %.2f ms"
|
||||||
msgstr "%d bildruta = %.2f ms"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:13
|
#: extra-translations.cpp:13
|
||||||
msgid "&Apply"
|
msgid "&Apply"
|
||||||
msgstr "&Tillämpa"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:14
|
#: extra-translations.cpp:14
|
||||||
msgid "Artists"
|
msgid "Artists"
|
||||||
@@ -546,23 +545,23 @@ msgstr ""
|
|||||||
|
|
||||||
#: extra-translations.cpp:15
|
#: extra-translations.cpp:15
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr "Avbryt"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:16
|
#: extra-translations.cpp:16
|
||||||
msgid "Close"
|
msgid "Close"
|
||||||
msgstr "Stäng"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:17
|
#: extra-translations.cpp:17
|
||||||
msgid "Developers"
|
msgid "Developers"
|
||||||
msgstr "Utvecklare"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:18
|
#: extra-translations.cpp:18
|
||||||
msgid "License"
|
msgid "License"
|
||||||
msgstr "Licens"
|
msgstr ""
|
||||||
|
|
||||||
#: extra-translations.cpp:19
|
#: extra-translations.cpp:19
|
||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr "Ok"
|
msgstr ""
|
||||||
|
|
||||||
#: gfxviewers.cpp:1202
|
#: gfxviewers.cpp:1202
|
||||||
msgid "Select output file and type"
|
msgid "Select output file and type"
|
||||||
@@ -597,7 +596,7 @@ msgstr "Väntar på klienter..."
|
|||||||
#: guiinit.cpp:147
|
#: guiinit.cpp:147
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Server IP address is: %s\n"
|
msgid "Server IP address is: %s\n"
|
||||||
msgstr "Serverns IP-adress är: %s\n"
|
msgstr "Serverns IP adress är: %s\n"
|
||||||
|
|
||||||
#: guiinit.cpp:149
|
#: guiinit.cpp:149
|
||||||
msgid "Waiting for connection..."
|
msgid "Waiting for connection..."
|
||||||
@@ -809,7 +808,7 @@ msgstr ""
|
|||||||
#: panel.cpp:1022
|
#: panel.cpp:1022
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Valid mode: %d x %d - %d @ %d"
|
msgid "Valid mode: %d x %d - %d @ %d"
|
||||||
msgstr "Giltigt läge: %d x %d - %d @ %d"
|
msgstr ""
|
||||||
|
|
||||||
#: panel.cpp:1030
|
#: panel.cpp:1030
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -920,7 +919,7 @@ msgstr "Fel i videoinspelning (%s); avbryter"
|
|||||||
#: panel.cpp:2698
|
#: panel.cpp:2698
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Volume: %d %%"
|
msgid "Volume: %d %%"
|
||||||
msgstr "Volym: %d %%"
|
msgstr ""
|
||||||
|
|
||||||
#: sys.cpp:205 sys.cpp:266
|
#: sys.cpp:205 sys.cpp:266
|
||||||
msgid "No game in progress to record"
|
msgid "No game in progress to record"
|
||||||
@@ -955,7 +954,7 @@ msgstr "Uppspelning slutade"
|
|||||||
#: sys.cpp:458
|
#: sys.cpp:458
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%d %% (%d, %d fps)"
|
msgid "%d %% (%d, %d fps)"
|
||||||
msgstr "%d %% (%d, %d bilder/s)"
|
msgstr ""
|
||||||
|
|
||||||
#: sys.cpp:899 xrc/GBPrinter.xrc:65
|
#: sys.cpp:899 xrc/GBPrinter.xrc:65
|
||||||
msgid "&Discard"
|
msgid "&Discard"
|
||||||
@@ -1006,15 +1005,15 @@ msgstr "Välj minnesdumpsfil"
|
|||||||
|
|
||||||
#: viewsupt.cpp:789
|
#: viewsupt.cpp:789
|
||||||
msgid "Red:"
|
msgid "Red:"
|
||||||
msgstr "Röd:"
|
msgstr ""
|
||||||
|
|
||||||
#: viewsupt.cpp:798
|
#: viewsupt.cpp:798
|
||||||
msgid "Green:"
|
msgid "Green:"
|
||||||
msgstr "Grön:"
|
msgstr ""
|
||||||
|
|
||||||
#: viewsupt.cpp:807
|
#: viewsupt.cpp:807
|
||||||
msgid "Blue:"
|
msgid "Blue:"
|
||||||
msgstr "Blå:"
|
msgstr ""
|
||||||
|
|
||||||
#: viewsupt.h:63
|
#: viewsupt.h:63
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1211,7 +1210,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/command.cpp:33
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/command.cpp:33
|
||||||
msgid "GameShark"
|
msgid "GameShark"
|
||||||
msgstr "GameShark"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/command.cpp:107
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/command.cpp:107
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1379,7 +1378,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:461
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:461
|
||||||
msgid "Enable status bar"
|
msgid "Enable status bar"
|
||||||
msgstr "Aktivera statusrad"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:462
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:462
|
||||||
msgid "INI file version (DO NOT MODIFY)"
|
msgid "INI file version (DO NOT MODIFY)"
|
||||||
@@ -1602,7 +1601,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:563
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:563
|
||||||
msgid "Number of sound buffers"
|
msgid "Number of sound buffers"
|
||||||
msgstr "Antal ljudbuffertar"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:564
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:564
|
||||||
msgid "Bit mask of sound channels to enable"
|
msgid "Bit mask of sound channels to enable"
|
||||||
@@ -1650,7 +1649,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:576
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:576
|
||||||
msgid "Sound volume (%)"
|
msgid "Sound volume (%)"
|
||||||
msgstr "Ljudvolym (%)"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:645
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:645
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:665
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:665
|
||||||
@@ -1782,31 +1781,31 @@ msgstr ""
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:54
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:54
|
||||||
msgid "Volume Mute"
|
msgid "Volume Mute"
|
||||||
msgstr "Volym tyst"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:55
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:55
|
||||||
msgid "Volume Down"
|
msgid "Volume Down"
|
||||||
msgstr "Sänk volym"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:56
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:56
|
||||||
msgid "Volume Up"
|
msgid "Volume Up"
|
||||||
msgstr "Höj volym"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:57
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:57
|
||||||
msgid "Next Track"
|
msgid "Next Track"
|
||||||
msgstr "Nästa spår"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:58
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:58
|
||||||
msgid "Previous Track"
|
msgid "Previous Track"
|
||||||
msgstr "Föregående spår"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:59
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:59
|
||||||
msgid "Stop"
|
msgid "Stop"
|
||||||
msgstr "Stoppa"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:60
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:60
|
||||||
msgid "Play/Pause"
|
msgid "Play/Pause"
|
||||||
msgstr "Spela upp/Paus"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:93
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:93
|
||||||
msgid "Alt+"
|
msgid "Alt+"
|
||||||
@@ -1846,7 +1845,7 @@ msgstr ""
|
|||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:272
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:272
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s: Button %d"
|
msgid "%s: Button %d"
|
||||||
msgstr "%s: Knapp %d"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:274
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/user-input.cpp:274
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1976,7 +1975,7 @@ msgstr ""
|
|||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1678
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1678
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1711
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1711
|
||||||
msgid "Network error."
|
msgid "Network error."
|
||||||
msgstr "Nätverksfel."
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1110
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1110
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1687
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1687
|
||||||
@@ -1987,7 +1986,7 @@ msgstr ""
|
|||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1124
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1124
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1701
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1701
|
||||||
msgid "All players connected"
|
msgid "All players connected"
|
||||||
msgstr "Alla spelare anslutna"
|
msgstr ""
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1145
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1145
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1723
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/core/gba/gbaLink.cpp:1723
|
||||||
@@ -2478,7 +2477,7 @@ msgstr "ROM-information"
|
|||||||
|
|
||||||
#: xrc/GBColorPrefPanel.xrc:9
|
#: xrc/GBColorPrefPanel.xrc:9
|
||||||
msgid "Custom"
|
msgid "Custom"
|
||||||
msgstr "Anpassad"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GBColorPrefPanel.xrc:10 xrc/JoyPanel.xrc:247
|
#: xrc/GBColorPrefPanel.xrc:10 xrc/JoyPanel.xrc:247
|
||||||
msgid "Standard"
|
msgid "Standard"
|
||||||
@@ -2732,11 +2731,11 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:49 xrc/GameBoyAdvanceConfig.xrc:221
|
#: xrc/GameBoyAdvanceConfig.xrc:49 xrc/GameBoyAdvanceConfig.xrc:221
|
||||||
msgid "64 K"
|
msgid "64 K"
|
||||||
msgstr "64 K"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:50 xrc/GameBoyAdvanceConfig.xrc:222
|
#: xrc/GameBoyAdvanceConfig.xrc:50 xrc/GameBoyAdvanceConfig.xrc:222
|
||||||
msgid "128 K"
|
msgid "128 K"
|
||||||
msgstr "128 K"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:64
|
#: xrc/GameBoyAdvanceConfig.xrc:64
|
||||||
msgid "Detect Now"
|
msgid "Detect Now"
|
||||||
@@ -2752,7 +2751,7 @@ msgstr "Sparningstyp"
|
|||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:92
|
#: xrc/GameBoyAdvanceConfig.xrc:92
|
||||||
msgid "BIOS file:"
|
msgid "BIOS file:"
|
||||||
msgstr "BIOS-fil:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/GameBoyAdvanceConfig.xrc:115
|
#: xrc/GameBoyAdvanceConfig.xrc:115
|
||||||
msgid "Current BIOS file:"
|
msgid "Current BIOS file:"
|
||||||
@@ -3089,7 +3088,7 @@ msgstr "&Läs automatiskt in senaste"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:89
|
#: xrc/MainMenu.xrc:89
|
||||||
msgid "From &File..."
|
msgid "From &File..."
|
||||||
msgstr "Från &fil..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:93
|
#: xrc/MainMenu.xrc:93
|
||||||
msgid "Do not change &battery save"
|
msgid "Do not change &battery save"
|
||||||
@@ -3153,7 +3152,7 @@ msgstr "1&0"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:145
|
#: xrc/MainMenu.xrc:145
|
||||||
msgid "To &File..."
|
msgid "To &File..."
|
||||||
msgstr "Till &fil..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:147
|
#: xrc/MainMenu.xrc:147
|
||||||
msgid "&Save state"
|
msgid "&Save state"
|
||||||
@@ -3293,7 +3292,7 @@ msgstr "&Länk"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:272
|
#: xrc/MainMenu.xrc:272
|
||||||
msgid "Start &Network Link..."
|
msgid "Start &Network Link..."
|
||||||
msgstr "Starta &nätverkslänk..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:277
|
#: xrc/MainMenu.xrc:277
|
||||||
msgid "&Nothing"
|
msgid "&Nothing"
|
||||||
@@ -3322,7 +3321,7 @@ msgstr "&Hastighetshack"
|
|||||||
#: xrc/MainMenu.xrc:310 xrc/MainMenu.xrc:316 xrc/MainMenu.xrc:383
|
#: xrc/MainMenu.xrc:310 xrc/MainMenu.xrc:316 xrc/MainMenu.xrc:383
|
||||||
#: xrc/MainMenu.xrc:417
|
#: xrc/MainMenu.xrc:417
|
||||||
msgid "&Configure..."
|
msgid "&Configure..."
|
||||||
msgstr "&Konfigurera..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:314
|
#: xrc/MainMenu.xrc:314
|
||||||
msgid "&Video"
|
msgid "&Video"
|
||||||
@@ -3458,7 +3457,7 @@ msgstr "&R"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:494 xrc/MainMenu.xrc:517
|
#: xrc/MainMenu.xrc:494 xrc/MainMenu.xrc:517
|
||||||
msgid "Configure..."
|
msgid "Configure..."
|
||||||
msgstr "Konfigurera..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:498
|
#: xrc/MainMenu.xrc:498
|
||||||
msgid "&Real-time clock"
|
msgid "&Real-time clock"
|
||||||
@@ -3506,7 +3505,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:555
|
#: xrc/MainMenu.xrc:555
|
||||||
msgid "&General..."
|
msgid "&General..."
|
||||||
msgstr "A&llmänt..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:558
|
#: xrc/MainMenu.xrc:558
|
||||||
msgid "&Speedup / Turbo..."
|
msgid "&Speedup / Turbo..."
|
||||||
@@ -3514,7 +3513,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:561
|
#: xrc/MainMenu.xrc:561
|
||||||
msgid "D&irectories..."
|
msgid "D&irectories..."
|
||||||
msgstr "Ka&taloger..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:564
|
#: xrc/MainMenu.xrc:564
|
||||||
msgid "&Key Shortcuts..."
|
msgid "&Key Shortcuts..."
|
||||||
@@ -3522,7 +3521,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:567
|
#: xrc/MainMenu.xrc:567
|
||||||
msgid "UI Settings"
|
msgid "UI Settings"
|
||||||
msgstr "Gränssnittsinställningar"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:569
|
#: xrc/MainMenu.xrc:569
|
||||||
msgid "Enable &Status bar"
|
msgid "Enable &Status bar"
|
||||||
@@ -3546,11 +3545,11 @@ msgstr "&Fusk"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:587
|
#: xrc/MainMenu.xrc:587
|
||||||
msgid "List &cheats..."
|
msgid "List &cheats..."
|
||||||
msgstr "Lista fu&sk..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:590
|
#: xrc/MainMenu.xrc:590
|
||||||
msgid "Find c&heat..."
|
msgid "Find c&heat..."
|
||||||
msgstr "Hitta f&usk..."
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:594
|
#: xrc/MainMenu.xrc:594
|
||||||
msgid "A&utomatically save / load cheats"
|
msgid "A&utomatically save / load cheats"
|
||||||
@@ -3758,7 +3757,7 @@ msgstr "Spelare:"
|
|||||||
|
|
||||||
#: xrc/NetLink.xrc:83
|
#: xrc/NetLink.xrc:83
|
||||||
msgid "2"
|
msgid "2"
|
||||||
msgstr "2"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/NetLink.xrc:107
|
#: xrc/NetLink.xrc:107
|
||||||
msgid "Server:"
|
msgid "Server:"
|
||||||
@@ -3790,7 +3789,7 @@ msgstr "Ljudinställningar"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:18
|
#: xrc/SoundConfig.xrc:18
|
||||||
msgid "Volume:"
|
msgid "Volume:"
|
||||||
msgstr "Volym:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:36
|
#: xrc/SoundConfig.xrc:36
|
||||||
msgid "Mute"
|
msgid "Mute"
|
||||||
@@ -3802,7 +3801,7 @@ msgstr "Maximal"
|
|||||||
|
|
||||||
#: xrc/SoundConfig.xrc:73
|
#: xrc/SoundConfig.xrc:73
|
||||||
msgid "Sample rate:"
|
msgid "Sample rate:"
|
||||||
msgstr "Samplingsfrekvens:"
|
msgstr ""
|
||||||
|
|
||||||
#: xrc/SoundConfig.xrc:79
|
#: xrc/SoundConfig.xrc:79
|
||||||
msgid "48 KHz"
|
msgid "48 KHz"
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
# Translators:
|
# Translators:
|
||||||
# abc Def <hdogan1974@gmail.com>, 2020
|
# abc Def <hdogan1974@gmail.com>, 2020
|
||||||
# adalet Mustafa, 2025
|
|
||||||
# Ali Ozderya <ozozderya@gmail.com>, 2015,2017
|
# Ali Ozderya <ozozderya@gmail.com>, 2015,2017
|
||||||
# boran roni, 2021
|
# boran roni, 2021
|
||||||
# Justice League <denizden788@gmail.com>, 2020
|
# Justice League <denizden788@gmail.com>, 2020
|
||||||
@@ -19,7 +18,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: adalet Mustafa, 2025\n"
|
"Last-Translator: Sinan H., 2016,2018,2022,2024\n"
|
||||||
"Language-Team: Turkish (http://app.transifex.com/bgk/vba-m/language/tr/)\n"
|
"Language-Team: Turkish (http://app.transifex.com/bgk/vba-m/language/tr/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
3897
po/wxvbam/zh-Hans.po
Normal file
3897
po/wxvbam/zh-Hans.po
Normal file
File diff suppressed because it is too large
Load Diff
3706
po/wxvbam/zh.po
Normal file
3706
po/wxvbam/zh.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
# horcus Yuan <1257425379@qq.com>, 2019
|
# horcus Yuan <1257425379@qq.com>, 2019
|
||||||
# pngai <pngai@ymail.com>, 2016
|
# pngai <pngai@ymail.com>, 2016
|
||||||
# Rythm Tse <ksusix@gmail.com>, 2016
|
# Rythm Tse <ksusix@gmail.com>, 2016
|
||||||
# Weiran Wu <wwrustc@mail.ustc.edu.cn>, 2024-2025
|
# Weiran Wu <wwrustc@mail.ustc.edu.cn>, 2024
|
||||||
# wr superboy, 2023
|
# wr superboy, 2023
|
||||||
# Xuan Zheng, 2024
|
# Xuan Zheng, 2024
|
||||||
# Xuntao Chi <1139954766@qq.com>, 2019
|
# Xuntao Chi <1139954766@qq.com>, 2019
|
||||||
@@ -26,7 +26,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
"POT-Creation-Date: 2024-07-05 20:00+0000\n"
|
||||||
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
"PO-Revision-Date: 2011-12-03 19:42+0000\n"
|
||||||
"Last-Translator: Weiran Wu <wwrustc@mail.ustc.edu.cn>, 2024-2025\n"
|
"Last-Translator: 王晨旭 <wcxu21@126.com>, 2021\n"
|
||||||
"Language-Team: Chinese (China) (http://app.transifex.com/bgk/vba-m/language/zh_CN/)\n"
|
"Language-Team: Chinese (China) (http://app.transifex.com/bgk/vba-m/language/zh_CN/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -1526,19 +1526,19 @@ msgstr "加载状态时不覆盖原生 (电池) 存档"
|
|||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:526
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:526
|
||||||
msgid "Throttle game speed, even when accelerated (0-450 %, 0 = no throttle)"
|
msgid "Throttle game speed, even when accelerated (0-450 %, 0 = no throttle)"
|
||||||
msgstr "限制游戏速度,包括加速后的(0-450 %,0 = 无限制)"
|
msgstr "阀门加快游戏速度,即使已经在加速时(0-450 %,0 = 无阀门)"
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:529
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:529
|
||||||
msgid "Set throttle for speedup key (0-3000 %, 0 = no throttle)"
|
msgid "Set throttle for speedup key (0-3000 %, 0 = no throttle)"
|
||||||
msgstr "设置加速键的限制(0-3000 %,0 = 无限制)"
|
msgstr "设置加速键的阀门值(0-3000 %,0 = 无阀门)"
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:531
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:531
|
||||||
msgid "Number of frames to skip with speedup (instead of speedup throttle)"
|
msgid "Number of frames to skip with speedup (instead of speedup throttle)"
|
||||||
msgstr "加速时跳过的帧数(而不是加速限制)"
|
msgstr "加速时跳过的帧数(而不是阀门加速)"
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:534
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:534
|
||||||
msgid "Use frame skip for speedup throttle"
|
msgid "Use frame skip for speedup throttle"
|
||||||
msgstr "使用跳帧来限制加速"
|
msgstr "使用跳帧来阀门加速"
|
||||||
|
|
||||||
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:536
|
#: /home/rkitover/source/repos/vbam-tx-pulls/src/wx/config/internal/option-internal.cpp:536
|
||||||
msgid "Mute sound during speedup"
|
msgid "Mute sound during speedup"
|
||||||
@@ -2898,7 +2898,7 @@ msgstr "秒 (0-600); 0 = 禁用"
|
|||||||
|
|
||||||
#: xrc/GeneralConfig.xrc:78
|
#: xrc/GeneralConfig.xrc:78
|
||||||
msgid "&Throttle"
|
msgid "&Throttle"
|
||||||
msgstr "限速(&T)"
|
msgstr "阀门(&T)"
|
||||||
|
|
||||||
#: xrc/GeneralConfig.xrc:96 xrc/SpeedupConfig.xrc:27
|
#: xrc/GeneralConfig.xrc:96 xrc/SpeedupConfig.xrc:27
|
||||||
msgid "Percent of normal:"
|
msgid "Percent of normal:"
|
||||||
@@ -2906,7 +2906,7 @@ msgstr "正常百分比:"
|
|||||||
|
|
||||||
#: xrc/GeneralConfig.xrc:106
|
#: xrc/GeneralConfig.xrc:106
|
||||||
msgid "0 = no throttle"
|
msgid "0 = no throttle"
|
||||||
msgstr "0 = 无限制"
|
msgstr "0 = 无阀门"
|
||||||
|
|
||||||
#: xrc/GeneralConfig.xrc:114
|
#: xrc/GeneralConfig.xrc:114
|
||||||
msgid "Unlimited"
|
msgid "Unlimited"
|
||||||
@@ -3085,7 +3085,7 @@ msgstr "保存点代码(&S)..."
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:47
|
#: xrc/MainMenu.xrc:47
|
||||||
msgid "Most &recent"
|
msgid "Most &recent"
|
||||||
msgstr "最常用(&R)"
|
msgstr "最常用"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:50
|
#: xrc/MainMenu.xrc:50
|
||||||
msgid "Load current state slot"
|
msgid "Load current state slot"
|
||||||
@@ -3285,7 +3285,7 @@ msgstr "自动 IPS/UPS/IPF 补丁(&A)"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:259
|
#: xrc/MainMenu.xrc:259
|
||||||
msgid "&Pause when inactive"
|
msgid "&Pause when inactive"
|
||||||
msgstr "非活动状态时暂停(&P)"
|
msgstr "非激活状态时暂停(&P)"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:264
|
#: xrc/MainMenu.xrc:264
|
||||||
msgid "&Reset"
|
msgid "&Reset"
|
||||||
@@ -3570,7 +3570,7 @@ msgstr "启用金手指(&E)"
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:605
|
#: xrc/MainMenu.xrc:605
|
||||||
msgid "&Break into GDB"
|
msgid "&Break into GDB"
|
||||||
msgstr "中断进入 GDB(&B)"
|
msgstr "切入 GDB(&B)"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:609
|
#: xrc/MainMenu.xrc:609
|
||||||
msgid "&Configure port..."
|
msgid "&Configure port..."
|
||||||
@@ -3578,7 +3578,7 @@ msgstr "配置端口(&C)..."
|
|||||||
|
|
||||||
#: xrc/MainMenu.xrc:612
|
#: xrc/MainMenu.xrc:612
|
||||||
msgid "&Break on load"
|
msgid "&Break on load"
|
||||||
msgstr "加载时中断(&B)"
|
msgstr "加载时切入(&B)"
|
||||||
|
|
||||||
#: xrc/MainMenu.xrc:617
|
#: xrc/MainMenu.xrc:617
|
||||||
msgid "&Disconnect"
|
msgid "&Disconnect"
|
||||||
@@ -3878,7 +3878,7 @@ msgstr "声音过滤"
|
|||||||
|
|
||||||
#: xrc/TileViewer.xrc:4
|
#: xrc/TileViewer.xrc:4
|
||||||
msgid "Tile Viewer"
|
msgid "Tile Viewer"
|
||||||
msgstr "瓦片查看器"
|
msgstr "碎片查看器"
|
||||||
|
|
||||||
#: xrc/TileViewer.xrc:24
|
#: xrc/TileViewer.xrc:24
|
||||||
msgid "Colors"
|
msgid "Colors"
|
||||||
@@ -3890,7 +3890,7 @@ msgstr "加速/超频设置"
|
|||||||
|
|
||||||
#: xrc/SpeedupConfig.xrc:9
|
#: xrc/SpeedupConfig.xrc:9
|
||||||
msgid "Speedup Throttle"
|
msgid "Speedup Throttle"
|
||||||
msgstr "加速限制"
|
msgstr "阀门加速"
|
||||||
|
|
||||||
#: xrc/SpeedupConfig.xrc:54
|
#: xrc/SpeedupConfig.xrc:54
|
||||||
msgid "Frame skip"
|
msgid "Frame skip"
|
||||||
|
@@ -19,6 +19,8 @@ parts:
|
|||||||
cmake-generator: Ninja
|
cmake-generator: Ninja
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- libsdl2-2.0-0
|
- libsdl2-2.0-0
|
||||||
|
- libsfml-network2.5
|
||||||
|
- libsfml-system2.5
|
||||||
- libnotify4
|
- libnotify4
|
||||||
- libsm6
|
- libsm6
|
||||||
- libopenal1
|
- libopenal1
|
||||||
@@ -44,6 +46,7 @@ parts:
|
|||||||
- zip
|
- zip
|
||||||
- libnotify-dev
|
- libnotify-dev
|
||||||
- libsdl2-dev
|
- libsdl2-dev
|
||||||
|
- libsfml-dev
|
||||||
- libgtk-3-dev
|
- libgtk-3-dev
|
||||||
- libopenal-dev
|
- libopenal-dev
|
||||||
- libwxgtk3.0-gtk3-dev
|
- libwxgtk3.0-gtk3-dev
|
||||||
|
@@ -16,3 +16,5 @@ target_include_directories(vbam-components-av-recording
|
|||||||
target_link_libraries(vbam-components-av-recording
|
target_link_libraries(vbam-components-av-recording
|
||||||
PUBLIC ${FFMPEG_LIBRARIES}
|
PUBLIC ${FFMPEG_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-av-recording)
|
||||||
|
@@ -8,3 +8,5 @@ target_sources(vbam-components-draw-text
|
|||||||
target_link_libraries(vbam-components-draw-text
|
target_link_libraries(vbam-components-draw-text
|
||||||
PRIVATE vbam-core-base
|
PRIVATE vbam-core-base
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-draw-text)
|
||||||
|
@@ -1,13 +1,5 @@
|
|||||||
add_library(vbam-components-filters OBJECT)
|
add_library(vbam-components-filters OBJECT)
|
||||||
|
|
||||||
unset(extra_src)
|
|
||||||
if(WINXP)
|
|
||||||
list(APPEND extra_src
|
|
||||||
${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt/quake3-sqrt.h
|
|
||||||
)
|
|
||||||
target_include_directories(vbam-components-filters PRIVATE ${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(vbam-components-filters
|
target_sources(vbam-components-filters
|
||||||
PRIVATE
|
PRIVATE
|
||||||
internal/2xSaI.cpp
|
internal/2xSaI.cpp
|
||||||
@@ -25,7 +17,6 @@ target_sources(vbam-components-filters
|
|||||||
internal/xBRZ/xbrz_config.h
|
internal/xBRZ/xbrz_config.h
|
||||||
internal/xBRZ/xbrz_tools.h
|
internal/xBRZ/xbrz_tools.h
|
||||||
internal/xbrzfilter.cpp
|
internal/xbrzfilter.cpp
|
||||||
${extra_src}
|
|
||||||
|
|
||||||
PUBLIC
|
PUBLIC
|
||||||
filters.h
|
filters.h
|
||||||
@@ -54,3 +45,5 @@ else()
|
|||||||
internal/hq/c/hq_shared.h
|
internal/hq/c/hq_shared.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-filters)
|
||||||
|
@@ -21,10 +21,6 @@
|
|||||||
#include <cmath> //std::sqrt
|
#include <cmath> //std::sqrt
|
||||||
#include "xbrz_tools.h"
|
#include "xbrz_tools.h"
|
||||||
|
|
||||||
#ifdef WINXP
|
|
||||||
#include "quake3-sqrt.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// some gcc versions lie about having this C++17 feature
|
// some gcc versions lie about having this C++17 feature
|
||||||
#define static_assert(x) static_assert(x, "assertion failed")
|
#define static_assert(x) static_assert(x, "assertion failed")
|
||||||
|
|
||||||
@@ -70,9 +66,7 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
|
|||||||
|
|
||||||
inline double fastSqrt(double n)
|
inline double fastSqrt(double n)
|
||||||
{
|
{
|
||||||
#ifdef WINXP
|
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
||||||
return quake3_sqrt((float)n);
|
|
||||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
|
||||||
__asm__ ("fsqrt" : "+t" (n));
|
__asm__ ("fsqrt" : "+t" (n));
|
||||||
return n;
|
return n;
|
||||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||||
|
@@ -4,3 +4,5 @@ target_sources(vbam-components-filters-agb
|
|||||||
PRIVATE filters_agb.cpp
|
PRIVATE filters_agb.cpp
|
||||||
PUBLIC filters_agb.h
|
PUBLIC filters_agb.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-filters-agb)
|
||||||
|
@@ -4,3 +4,5 @@ target_sources(vbam-components-filters-interframe
|
|||||||
PRIVATE interframe.cpp
|
PRIVATE interframe.cpp
|
||||||
PUBLIC interframe.h
|
PUBLIC interframe.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-filters-interframe)
|
||||||
|
@@ -4,3 +4,5 @@ target_sources(vbam-components-user-config
|
|||||||
PRIVATE user_config.cpp
|
PRIVATE user_config.cpp
|
||||||
PUBLIC user_config.h
|
PUBLIC user_config.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-components-user-config)
|
||||||
|
@@ -137,4 +137,6 @@ if(ENABLE_LINK)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-core)
|
||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
@@ -22,3 +22,5 @@ target_sources(vbam-core-apu
|
|||||||
Gb_Oscs.h
|
Gb_Oscs.h
|
||||||
Multi_Buffer.h
|
Multi_Buffer.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-core-apu)
|
||||||
|
@@ -61,4 +61,6 @@ target_link_libraries(vbam-core-base
|
|||||||
PUBLIC ${ZLIB_LIBRARY}
|
PUBLIC ${ZLIB_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-core-base)
|
||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
@@ -10,3 +10,6 @@ add_library(vbam-core-base-test
|
|||||||
|
|
||||||
target_link_libraries(vbam-core-base-test
|
target_link_libraries(vbam-core-base-test
|
||||||
INTERFACE GTest::gtest)
|
INTERFACE GTest::gtest)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-core-base-test)
|
||||||
|
|
||||||
|
@@ -71,3 +71,5 @@ target_include_directories(vbam-fex
|
|||||||
target_link_libraries(vbam-fex
|
target_link_libraries(vbam-fex
|
||||||
PRIVATE ${ZLIB_LIBRARY}
|
PRIVATE ${ZLIB_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-fex)
|
||||||
|
@@ -481,7 +481,7 @@ void gbaUpdateRomSize(int size)
|
|||||||
if (size > romSize) {
|
if (size > romSize) {
|
||||||
romSize = size;
|
romSize = size;
|
||||||
|
|
||||||
uint8_t* tmp = (uint8_t*)realloc(g_rom, romSize);
|
uint8_t* tmp = (uint8_t*)realloc(g_rom, SIZE_ROM);
|
||||||
g_rom = tmp;
|
g_rom = tmp;
|
||||||
|
|
||||||
uint16_t* temp = (uint16_t*)(g_rom + ((romSize + 1) & ~1));
|
uint16_t* temp = (uint16_t*)(g_rom + ((romSize + 1) & ~1));
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "SFML/Network.hpp"
|
#include <SFML/Network.hpp>
|
||||||
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#define _(x) gettext(x)
|
#define _(x) gettext(x)
|
||||||
@@ -41,22 +41,17 @@
|
|||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UPDATE_REG
|
|
||||||
#undef UPDATE_REG
|
|
||||||
#endif
|
|
||||||
#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&g_ioMem[address]), value)
|
#define UPDATE_REG(address, value) WRITE16LE(((uint16_t*)&g_ioMem[address]), value)
|
||||||
|
|
||||||
static int vbaid = 0;
|
static int vbaid = 0;
|
||||||
const char* MakeInstanceFilename(const char* Input)
|
const char* MakeInstanceFilename(const char* Input)
|
||||||
{
|
{
|
||||||
if (vbaid == 0) {
|
if (vbaid == 0)
|
||||||
return Input;
|
return Input;
|
||||||
}
|
|
||||||
|
|
||||||
static char* result = NULL;
|
static char* result = NULL;
|
||||||
if (result != NULL) {
|
if (result != NULL)
|
||||||
free(result);
|
free(result);
|
||||||
}
|
|
||||||
|
|
||||||
result = (char*)malloc(strlen(Input) + 3);
|
result = (char*)malloc(strlen(Input) + 3);
|
||||||
char* p = strrchr((char*)Input, '.');
|
char* p = strrchr((char*)Input, '.');
|
||||||
@@ -275,7 +270,7 @@ class RFUServer {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
sf::TcpSocket tcpsocket[5];
|
sf::TcpSocket tcpsocket[5];
|
||||||
sf::IpAddress udpaddr[5] = { sf::IpAddress{0}, sf::IpAddress{0}, sf::IpAddress{0}, sf::IpAddress{0}, sf::IpAddress{0} };
|
sf::IpAddress udpaddr[5];
|
||||||
RFUServer(void);
|
RFUServer(void);
|
||||||
sf::Packet& Serialize(sf::Packet& packet, int slave);
|
sf::Packet& Serialize(sf::Packet& packet, int slave);
|
||||||
void DeSerialize(sf::Packet& packet, int slave);
|
void DeSerialize(sf::Packet& packet, int slave);
|
||||||
@@ -288,7 +283,7 @@ class RFUClient {
|
|||||||
int numbytes;
|
int numbytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sf::IpAddress serveraddr{0};
|
sf::IpAddress serveraddr;
|
||||||
unsigned short serverport;
|
unsigned short serverport;
|
||||||
bool transferring;
|
bool transferring;
|
||||||
RFUClient(void);
|
RFUClient(void);
|
||||||
@@ -397,7 +392,7 @@ enum {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
sf::TcpSocket tcpsocket;
|
sf::TcpSocket tcpsocket;
|
||||||
sf::TcpListener tcplistener;
|
sf::TcpListener tcplistener;
|
||||||
uint16_t numslaves;
|
int numslaves;
|
||||||
int connectedSlaves;
|
int connectedSlaves;
|
||||||
int type;
|
int type;
|
||||||
bool server;
|
bool server;
|
||||||
@@ -417,7 +412,7 @@ class CableServer {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
sf::TcpSocket tcpsocket[4];
|
sf::TcpSocket tcpsocket[4];
|
||||||
sf::IpAddress udpaddr[4] = { sf::IpAddress{0}, sf::IpAddress{0}, sf::IpAddress{0}, sf::IpAddress{0} };
|
sf::IpAddress udpaddr[4];
|
||||||
CableServer(void);
|
CableServer(void);
|
||||||
void Send(void);
|
void Send(void);
|
||||||
void Recv(void);
|
void Recv(void);
|
||||||
@@ -435,7 +430,7 @@ class CableClient {
|
|||||||
int numbytes;
|
int numbytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sf::IpAddress serveraddr{0};
|
sf::IpAddress serveraddr;
|
||||||
unsigned short serverport;
|
unsigned short serverport;
|
||||||
bool transferring;
|
bool transferring;
|
||||||
CableClient(void);
|
CableClient(void);
|
||||||
@@ -525,48 +520,33 @@ LinkMode GetLinkMode()
|
|||||||
return LINK_DISCONNECTED;
|
return LINK_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetLinkServerHost(char* const host, size_t size)
|
void GetLinkServerHost(char* const host, size_t size)
|
||||||
{
|
{
|
||||||
if (host == NULL || size == 0) {
|
if (host == NULL || size == 0)
|
||||||
return false;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
host[0] = '\0';
|
host[0] = '\0';
|
||||||
|
|
||||||
if (linkDriver && linkDriver->mode == LINK_GAMECUBE_DOLPHIN) {
|
if (linkDriver && linkDriver->mode == LINK_GAMECUBE_DOLPHIN)
|
||||||
strncpy(host, joybusHostAddr.toString().c_str(), size);
|
strncpy(host, joybusHostAddr.toString().c_str(), size);
|
||||||
} else if (lanlink.server) {
|
else if (lanlink.server) {
|
||||||
if (IP_LINK_BIND_ADDRESS == "*") {
|
if (IP_LINK_BIND_ADDRESS == "*")
|
||||||
auto local_addr = sf::IpAddress::getLocalAddress();
|
strncpy(host, sf::IpAddress::getLocalAddress().toString().c_str(), size);
|
||||||
if (local_addr) {
|
else
|
||||||
strncpy(host, local_addr.value().toString().c_str(), size);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
strncpy(host, IP_LINK_BIND_ADDRESS.c_str(), size);
|
strncpy(host, IP_LINK_BIND_ADDRESS.c_str(), size);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
strncpy(host, lc.serveraddr.toString().c_str(), size);
|
strncpy(host, lc.serveraddr.toString().c_str(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SetLinkServerHost(const char* host)
|
bool SetLinkServerHost(const char* host)
|
||||||
{
|
{
|
||||||
sf::IpAddress addr{0};
|
sf::IpAddress addr = sf::IpAddress(host);
|
||||||
|
|
||||||
auto resolved = sf::IpAddress::resolve(host);
|
|
||||||
if (!resolved) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
addr = resolved.value();
|
|
||||||
lc.serveraddr = addr;
|
lc.serveraddr = addr;
|
||||||
joybusHostAddr = addr;
|
joybusHostAddr = addr;
|
||||||
|
|
||||||
return true;
|
return addr != sf::IpAddress::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLinkPlayerId()
|
int GetLinkPlayerId()
|
||||||
@@ -1064,13 +1044,11 @@ static ConnectionState InitSocket()
|
|||||||
{
|
{
|
||||||
linkid = 0;
|
linkid = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++)
|
||||||
cable_data[i] = 0xffff;
|
cable_data[i] = 0xffff;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++)
|
||||||
cable_gb_data[i] = 0xff;
|
cable_gb_data[i] = 0xff;
|
||||||
}
|
|
||||||
|
|
||||||
if (lanlink.server) {
|
if (lanlink.server) {
|
||||||
lanlink.connectedSlaves = 0;
|
lanlink.connectedSlaves = 0;
|
||||||
@@ -1079,32 +1057,25 @@ static ConnectionState InitSocket()
|
|||||||
|
|
||||||
// too bad Listen() doesn't take an address as well
|
// too bad Listen() doesn't take an address as well
|
||||||
// then again, old code used INADDR_ANY anyway
|
// then again, old code used INADDR_ANY anyway
|
||||||
sf::IpAddress bind_ip{0};
|
sf::IpAddress bind_ip = IP_LINK_BIND_ADDRESS == "*" ? sf::IpAddress::Any : IP_LINK_BIND_ADDRESS;
|
||||||
|
|
||||||
if (IP_LINK_BIND_ADDRESS != "*") {
|
if (lanlink.tcplistener.listen(IP_LINK_PORT, bind_ip) == sf::Socket::Error)
|
||||||
auto resolved = sf::IpAddress::resolve(IP_LINK_BIND_ADDRESS);
|
|
||||||
if (resolved) {
|
|
||||||
bind_ip = resolved.value();
|
|
||||||
} else {
|
|
||||||
return LINK_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lanlink.tcplistener.listen(IP_LINK_PORT, bind_ip) == sf::Socket::Status::Error) {
|
|
||||||
// Note: old code closed socket & retried once on bind failure
|
// Note: old code closed socket & retried once on bind failure
|
||||||
return LINK_ERROR; // FIXME: error code?
|
return LINK_ERROR; // FIXME: error code?
|
||||||
} else {
|
else
|
||||||
return LINK_NEEDS_UPDATE;
|
return LINK_NEEDS_UPDATE;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
lc.serverport = IP_LINK_PORT;
|
lc.serverport = IP_LINK_PORT;
|
||||||
|
|
||||||
|
if (lc.serveraddr == sf::IpAddress::None) {
|
||||||
|
return LINK_ERROR;
|
||||||
|
} else {
|
||||||
lanlink.tcpsocket.setBlocking(false);
|
lanlink.tcpsocket.setBlocking(false);
|
||||||
sf::Socket::Status status = lanlink.tcpsocket.connect(lc.serveraddr, lc.serverport);
|
sf::Socket::Status status = lanlink.tcpsocket.connect(lc.serveraddr, lc.serverport);
|
||||||
|
|
||||||
if (status == sf::Socket::Status::Error || status == sf::Socket::Status::Disconnected) {
|
if (status == sf::Socket::Error || status == sf::Socket::Disconnected)
|
||||||
return LINK_ERROR;
|
return LINK_ERROR;
|
||||||
} else {
|
else
|
||||||
return LINK_NEEDS_UPDATE;
|
return LINK_NEEDS_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1119,11 +1090,11 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||||||
fdset.add(lanlink.tcplistener);
|
fdset.add(lanlink.tcplistener);
|
||||||
|
|
||||||
if (fdset.wait(sf::milliseconds(150))) {
|
if (fdset.wait(sf::milliseconds(150))) {
|
||||||
uint16_t nextSlave = lanlink.connectedSlaves + 1;
|
int nextSlave = lanlink.connectedSlaves + 1;
|
||||||
|
|
||||||
sf::Socket::Status st = lanlink.tcplistener.accept(ls.tcpsocket[nextSlave]);
|
sf::Socket::Status st = lanlink.tcplistener.accept(ls.tcpsocket[nextSlave]);
|
||||||
|
|
||||||
if (st == sf::Socket::Status::Error) {
|
if (st == sf::Socket::Error) {
|
||||||
for (int j = 1; j < nextSlave; j++)
|
for (int j = 1; j < nextSlave; j++)
|
||||||
ls.tcpsocket[j].disconnect();
|
ls.tcpsocket[j].disconnect();
|
||||||
|
|
||||||
@@ -1131,7 +1102,8 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||||||
newState = LINK_ERROR;
|
newState = LINK_ERROR;
|
||||||
} else {
|
} else {
|
||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
packet << nextSlave << lanlink.numslaves;
|
packet << static_cast<sf::Uint16>(nextSlave)
|
||||||
|
<< static_cast<sf::Uint16>(lanlink.numslaves);
|
||||||
|
|
||||||
ls.tcpsocket[nextSlave].send(packet);
|
ls.tcpsocket[nextSlave].send(packet);
|
||||||
|
|
||||||
@@ -1157,13 +1129,13 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
||||||
|
|
||||||
if (status == sf::Socket::Status::Error || status == sf::Socket::Status::Disconnected) {
|
if (status == sf::Socket::Error || status == sf::Socket::Disconnected) {
|
||||||
snprintf(message, size, N_("Network error."));
|
snprintf(message, size, N_("Network error."));
|
||||||
newState = LINK_ERROR;
|
newState = LINK_ERROR;
|
||||||
} else if (status == sf::Socket::Status::Done) {
|
} else if (status == sf::Socket::Done) {
|
||||||
|
|
||||||
if (linkid == 0) {
|
if (linkid == 0) {
|
||||||
uint16_t receivedId, receivedSlaves;
|
sf::Uint16 receivedId, receivedSlaves;
|
||||||
packet >> receivedId >> receivedSlaves;
|
packet >> receivedId >> receivedSlaves;
|
||||||
|
|
||||||
if (packet) {
|
if (packet) {
|
||||||
@@ -1568,7 +1540,7 @@ void RFUServer::Recv(void)
|
|||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
tcpsocket[i + 1].setBlocking(false);
|
tcpsocket[i + 1].setBlocking(false);
|
||||||
sf::Socket::Status status = tcpsocket[i + 1].receive(packet);
|
sf::Socket::Status status = tcpsocket[i + 1].receive(packet);
|
||||||
if (status == sf::Socket::Status::Disconnected) {
|
if (status == sf::Socket::Disconnected) {
|
||||||
char message[30];
|
char message[30];
|
||||||
sprintf(message, _("Player %d disconnected."), i + 1);
|
sprintf(message, _("Player %d disconnected."), i + 1);
|
||||||
systemScreenMessage(message);
|
systemScreenMessage(message);
|
||||||
@@ -1678,7 +1650,7 @@ void RFUClient::Recv(void)
|
|||||||
}
|
}
|
||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
||||||
if (status == sf::Socket::Status::Disconnected) {
|
if (status == sf::Socket::Disconnected) {
|
||||||
systemScreenMessage(_("Server disconnected."));
|
systemScreenMessage(_("Server disconnected."));
|
||||||
CloseLink();
|
CloseLink();
|
||||||
return;
|
return;
|
||||||
@@ -1699,7 +1671,7 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||||||
|
|
||||||
sf::Socket::Status st = lanlink.tcplistener.accept(rfu_server.tcpsocket[nextSlave]);
|
sf::Socket::Status st = lanlink.tcplistener.accept(rfu_server.tcpsocket[nextSlave]);
|
||||||
|
|
||||||
if (st == sf::Socket::Status::Error) {
|
if (st == sf::Socket::Error) {
|
||||||
for (int j = 1; j < nextSlave; j++)
|
for (int j = 1; j < nextSlave; j++)
|
||||||
rfu_server.tcpsocket[j].disconnect();
|
rfu_server.tcpsocket[j].disconnect();
|
||||||
|
|
||||||
@@ -1707,7 +1679,8 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||||||
newState = LINK_ERROR;
|
newState = LINK_ERROR;
|
||||||
} else {
|
} else {
|
||||||
sf::Packet packet;
|
sf::Packet packet;
|
||||||
packet << nextSlave << lanlink.numslaves;
|
packet << static_cast<sf::Uint16>(nextSlave)
|
||||||
|
<< static_cast<sf::Uint16>(lanlink.numslaves);
|
||||||
|
|
||||||
rfu_server.tcpsocket[nextSlave].send(packet);
|
rfu_server.tcpsocket[nextSlave].send(packet);
|
||||||
|
|
||||||
@@ -1734,13 +1707,13 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||||||
lanlink.tcpsocket.setBlocking(false);
|
lanlink.tcpsocket.setBlocking(false);
|
||||||
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
sf::Socket::Status status = lanlink.tcpsocket.receive(packet);
|
||||||
|
|
||||||
if (status == sf::Socket::Status::Error || status == sf::Socket::Status::Disconnected) {
|
if (status == sf::Socket::Error || status == sf::Socket::Disconnected) {
|
||||||
snprintf(message, size, N_("Network error."));
|
snprintf(message, size, N_("Network error."));
|
||||||
newState = LINK_ERROR;
|
newState = LINK_ERROR;
|
||||||
} else if (status == sf::Socket::Status::Done) {
|
} else if (status == sf::Socket::Done) {
|
||||||
|
|
||||||
if (linkid == 0) {
|
if (linkid == 0) {
|
||||||
uint16_t receivedId, receivedSlaves;
|
sf::Uint16 receivedId, receivedSlaves;
|
||||||
packet >> receivedId >> receivedSlaves;
|
packet >> receivedId >> receivedSlaves;
|
||||||
|
|
||||||
if (packet) {
|
if (packet) {
|
||||||
|
@@ -86,9 +86,8 @@ extern bool SetLinkServerHost(const char* host);
|
|||||||
* If in lan client mode, returns the IP adress of the host to connect to
|
* If in lan client mode, returns the IP adress of the host to connect to
|
||||||
* If in gamecube mode, returns the IP adress of the dolphin host
|
* If in gamecube mode, returns the IP adress of the dolphin host
|
||||||
*
|
*
|
||||||
* @return false on error
|
|
||||||
*/
|
*/
|
||||||
extern bool GetLinkServerHost(char* const host, size_t size);
|
extern void GetLinkServerHost(char* const host, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value in milliseconds of the timeout after which a connection is
|
* Set the value in milliseconds of the timeout after which a connection is
|
||||||
|
@@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
GBASockClient::GBASockClient(sf::IpAddress _server_addr)
|
GBASockClient::GBASockClient(sf::IpAddress _server_addr)
|
||||||
{
|
{
|
||||||
|
if (_server_addr == sf::IpAddress::None)
|
||||||
|
server_addr = sf::IpAddress::getPublicAddress();
|
||||||
|
else
|
||||||
server_addr = _server_addr;
|
server_addr = _server_addr;
|
||||||
|
|
||||||
client.connect(server_addr, 0xd6ba);
|
client.connect(server_addr, 0xd6ba);
|
||||||
@@ -41,9 +44,8 @@ void GBASockClient::Send(std::vector<char> data)
|
|||||||
// Returns cmd for convenience
|
// Returns cmd for convenience
|
||||||
char GBASockClient::ReceiveCmd(char* data_in, bool block)
|
char GBASockClient::ReceiveCmd(char* data_in, bool block)
|
||||||
{
|
{
|
||||||
if (IsDisconnected()) {
|
if (IsDisconnected())
|
||||||
return data_in[0];
|
return data_in[0];
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t num_received = 0;
|
std::size_t num_received = 0;
|
||||||
if (block || clock_sync == 0) {
|
if (block || clock_sync == 0) {
|
||||||
@@ -51,9 +53,8 @@ char GBASockClient::ReceiveCmd(char* data_in, bool block)
|
|||||||
Selector.add(client);
|
Selector.add(client);
|
||||||
Selector.wait(sf::seconds(6));
|
Selector.wait(sf::seconds(6));
|
||||||
}
|
}
|
||||||
if (client.receive(data_in, 5, num_received) == sf::Socket::Status::Disconnected) {
|
if (client.receive(data_in, 5, num_received) == sf::Socket::Disconnected)
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
|
||||||
|
|
||||||
return data_in[0];
|
return data_in[0];
|
||||||
}
|
}
|
||||||
@@ -66,15 +67,13 @@ void GBASockClient::ReceiveClock(bool block)
|
|||||||
|
|
||||||
char sync_ticks[4] = { 0, 0, 0, 0 };
|
char sync_ticks[4] = { 0, 0, 0, 0 };
|
||||||
std::size_t num_received = 0;
|
std::size_t num_received = 0;
|
||||||
if (clock_client.receive(sync_ticks, 4, num_received) == sf::Socket::Status::Disconnected) {
|
if (clock_client.receive(sync_ticks, 4, num_received) == sf::Socket::Disconnected)
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
|
||||||
|
|
||||||
if (num_received == 4) {
|
if (num_received == 4) {
|
||||||
clock_sync_ticks = 0;
|
clock_sync_ticks = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++)
|
||||||
clock_sync_ticks |= (uint8_t)(sync_ticks[i]) << ((3 - i) * 8);
|
clock_sync_ticks |= (uint8_t)(sync_ticks[i]) << ((3 - i) * 8);
|
||||||
}
|
|
||||||
clock_sync += clock_sync_ticks;
|
clock_sync += clock_sync_ticks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "SFML/Network.hpp"
|
#include <SFML/Network.hpp>
|
||||||
|
|
||||||
class GBASockClient {
|
class GBASockClient {
|
||||||
public:
|
public:
|
||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
bool IsDisconnected();
|
bool IsDisconnected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sf::IpAddress server_addr{0};
|
sf::IpAddress server_addr;
|
||||||
sf::TcpSocket client;
|
sf::TcpSocket client;
|
||||||
sf::TcpSocket clock_client;
|
sf::TcpSocket clock_client;
|
||||||
|
|
||||||
|
@@ -11,3 +11,5 @@ target_sources(vbam-core-fake
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
fake_core.cpp
|
fake_core.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_vbam_target(vbam-core-fake)
|
||||||
|
@@ -79,7 +79,7 @@ else ifeq ($(platform), classic_armv7_a7)
|
|||||||
TARGET := $(TARGET_NAME)_libretro.so
|
TARGET := $(TARGET_NAME)_libretro.so
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared -Wl,--no-undefined -fPIC
|
SHARED := -shared -Wl,--no-undefined -fPIC
|
||||||
CFLAGS += -O3 -ffast-math \
|
CFLAGS += -Ofast \
|
||||||
-flto=4 -fwhole-program -fuse-linker-plugin \
|
-flto=4 -fwhole-program -fuse-linker-plugin \
|
||||||
-fdata-sections -ffunction-sections -Wl,--gc-sections \
|
-fdata-sections -ffunction-sections -Wl,--gc-sections \
|
||||||
-fno-stack-protector -fno-ident -fomit-frame-pointer \
|
-fno-stack-protector -fno-ident -fomit-frame-pointer \
|
||||||
@@ -112,7 +112,7 @@ else ifeq ($(platform), classic_armv8_a35)
|
|||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared
|
SHARED := -shared
|
||||||
TILED_RENDERING=1
|
TILED_RENDERING=1
|
||||||
CFLAGS += -O3 -ffast-math \
|
CFLAGS += -Ofast \
|
||||||
-flto=4 -fwhole-program -fuse-linker-plugin \
|
-flto=4 -fwhole-program -fuse-linker-plugin \
|
||||||
-fdata-sections -ffunction-sections -Wl,--gc-sections \
|
-fdata-sections -ffunction-sections -Wl,--gc-sections \
|
||||||
-fno-stack-protector -fno-ident -fomit-frame-pointer \
|
-fno-stack-protector -fno-ident -fomit-frame-pointer \
|
||||||
|
@@ -68,6 +68,8 @@ if(WIN32)
|
|||||||
target_link_libraries(vbam wsock32 ws2_32 winmm version imm32 ${SDL2MAIN_LIBRARY})
|
target_link_libraries(vbam wsock32 ws2_32 winmm version imm32 ${SDL2MAIN_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
configure_vbam_target(vbam)
|
||||||
|
|
||||||
# Installation scripts.
|
# Installation scripts.
|
||||||
install(
|
install(
|
||||||
PROGRAMS ${PROJECT_BINARY_DIR}/vbam${CMAKE_EXECUTABLE_SUFFIX}
|
PROGRAMS ${PROJECT_BINARY_DIR}/vbam${CMAKE_EXECUTABLE_SUFFIX}
|
||||||
|
@@ -153,41 +153,11 @@ unset(wx_find_extra)
|
|||||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||||
set(wx_find_extra NO_DEFAULT_PATH)
|
set(wx_find_extra NO_DEFAULT_PATH)
|
||||||
set(wxWidgets_DIR "${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/share/wxwidgets")
|
set(wxWidgets_DIR "${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/share/wxwidgets")
|
||||||
find_package(nanosvg)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ENABLE_OPENGL TRUE)
|
|
||||||
find_package(wxWidgets COMPONENTS xrc xml html adv net core base gl ${wx_find_extra})
|
|
||||||
|
|
||||||
if(NOT wxWidgets_FOUND)
|
|
||||||
find_package(wxWidgets COMPONENTS xrc xml html adv net core base ${wx_find_extra} REQUIRED)
|
|
||||||
set(ENABLE_OPENGL FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Fixup wxWidgets paths for vcpkg debug builds.
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
|
||||||
set(wxWidgets_ROOT_DIR "${wxWidgets_ROOT_DIR}/debug" CACHE INTERNAL "wxWidgets root directory" FORCE)
|
|
||||||
string(REGEX REPLACE "/lib$" "/debug/lib" wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}")
|
|
||||||
set(wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "wxWidgets library directory" FORCE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find OpenAL (required).
|
# Find OpenAL (required).
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
|
|
||||||
# Workaround of static liblzma not being found on MSYS2.
|
|
||||||
if(VBAM_STATIC AND MSYS)
|
|
||||||
unset(cleaned_up_wx_libs)
|
|
||||||
foreach(lib ${wxWidgets_LIBRARIES})
|
|
||||||
if(lib STREQUAL "-llzma")
|
|
||||||
set(lib "liblzma.a")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND cleaned_up_wx_libs "${lib}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(wxWidgets_LIBRARIES "${cleaned_up_wx_libs}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${wxWidgets_LIBRARIES})
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${wxWidgets_LIBRARIES})
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${wxWidgets_INCLUDE_DIRS})
|
list(APPEND CMAKE_REQUIRED_INCLUDES ${wxWidgets_INCLUDE_DIRS})
|
||||||
list(APPEND CMAKE_REQUIRED_FLAGS ${wxWidgets_CXX_FLAGS})
|
list(APPEND CMAKE_REQUIRED_FLAGS ${wxWidgets_CXX_FLAGS})
|
||||||
@@ -198,6 +168,7 @@ endforeach()
|
|||||||
# Configure common settings for wx-based targets, like linking, include
|
# Configure common settings for wx-based targets, like linking, include
|
||||||
# directories, compile options, and definitions.
|
# directories, compile options, and definitions.
|
||||||
function(configure_wx_target target)
|
function(configure_wx_target target)
|
||||||
|
configure_vbam_target(${target})
|
||||||
get_target_property(target_type ${target} TYPE)
|
get_target_property(target_type ${target} TYPE)
|
||||||
if(target_type STREQUAL "EXECUTABLE")
|
if(target_type STREQUAL "EXECUTABLE")
|
||||||
set(target_is_executable TRUE)
|
set(target_is_executable TRUE)
|
||||||
@@ -256,10 +227,6 @@ function(configure_wx_target target)
|
|||||||
# OpenAL.
|
# OpenAL.
|
||||||
if(OPENAL_STATIC)
|
if(OPENAL_STATIC)
|
||||||
_add_compile_definitions(AL_LIBTYPE_STATIC)
|
_add_compile_definitions(AL_LIBTYPE_STATIC)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
list(APPEND OPENAL_LIBRARY avrt)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
_add_include_directories(${OPENAL_INCLUDE_DIR})
|
_add_include_directories(${OPENAL_INCLUDE_DIR})
|
||||||
_add_link_libraries(${OPENAL_LIBRARY})
|
_add_link_libraries(${OPENAL_LIBRARY})
|
||||||
@@ -297,12 +264,7 @@ function(configure_wx_target target)
|
|||||||
_add_link_libraries(${VBAM_SDL2_LIBS})
|
_add_link_libraries(${VBAM_SDL2_LIBS})
|
||||||
|
|
||||||
# OpenGL.
|
# OpenGL.
|
||||||
if(ENABLE_OPENGL)
|
|
||||||
_add_link_libraries(${OPENGL_LIBRARIES})
|
_add_link_libraries(${OPENGL_LIBRARIES})
|
||||||
else()
|
|
||||||
_add_compile_definitions(NO_OGL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Sub-projects.
|
# Sub-projects.
|
||||||
@@ -405,9 +367,6 @@ if(APPLE)
|
|||||||
target_sources(visualboyadvance-m PRIVATE
|
target_sources(visualboyadvance-m PRIVATE
|
||||||
macsupport.mm
|
macsupport.mm
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(visualboyadvance-m
|
|
||||||
tiff zstd deflate)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# link libgcc/libstdc++ statically on mingw
|
# link libgcc/libstdc++ statically on mingw
|
||||||
@@ -904,7 +863,7 @@ if(APPLE)
|
|||||||
if(CMAKE_BUILD_TYPE MATCHES "^(Release|MinSizeRel)$")
|
if(CMAKE_BUILD_TYPE MATCHES "^(Release|MinSizeRel)$")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET visualboyadvance-m POST_BUILD
|
TARGET visualboyadvance-m POST_BUILD
|
||||||
COMMAND bash ${CMAKE_SOURCE_DIR}/tools/macOS/third_party_libs_tool ./visualboyadvance-m.app
|
COMMAND ${CMAKE_SOURCE_DIR}/tools/macOS/third_party_libs_tool ./visualboyadvance-m.app
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -59,17 +59,6 @@ int FAGetDev(FAudio* fa) {
|
|||||||
|
|
||||||
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
||||||
public:
|
public:
|
||||||
FAudio_BufferNotify() {
|
|
||||||
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
|
|
||||||
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
|
|
||||||
OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd;
|
|
||||||
OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd;
|
|
||||||
OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart;
|
|
||||||
OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd;
|
|
||||||
OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError;
|
|
||||||
}
|
|
||||||
~FAudio_BufferNotify() = default;
|
|
||||||
|
|
||||||
// Waits for the buffer end event to be signaled for 10 seconds.
|
// Waits for the buffer end event to be signaled for 10 seconds.
|
||||||
// Returns true if the buffer end event was signaled, false if the wait timed out.
|
// Returns true if the buffer end event was signaled, false if the wait timed out.
|
||||||
bool WaitForSignal() {
|
bool WaitForSignal() {
|
||||||
@@ -82,6 +71,17 @@ public:
|
|||||||
return was_signaled;
|
return was_signaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FAudio_BufferNotify() {
|
||||||
|
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
|
||||||
|
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
|
||||||
|
OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd;
|
||||||
|
OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd;
|
||||||
|
OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart;
|
||||||
|
OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd;
|
||||||
|
OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError;
|
||||||
|
}
|
||||||
|
~FAudio_BufferNotify() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Signals that the buffer end event has occurred.
|
// Signals that the buffer end event has occurred.
|
||||||
void SignalBufferEnd() {
|
void SignalBufferEnd() {
|
||||||
@@ -157,7 +157,6 @@ FAudio_Output::FAudio_Output() : buffer_count_(OPTION(kSoundBuffers)) {
|
|||||||
playing = false;
|
playing = false;
|
||||||
freq_ = 0;
|
freq_ = 0;
|
||||||
currentBuffer = 0;
|
currentBuffer = 0;
|
||||||
sound_buffer_len_ = 0;
|
|
||||||
device_changed = false;
|
device_changed = false;
|
||||||
faud = nullptr;
|
faud = nullptr;
|
||||||
mVoice = nullptr;
|
mVoice = nullptr;
|
||||||
@@ -392,7 +391,7 @@ void FAudio_Output::write(uint16_t* finalWave, int) {
|
|||||||
// the maximum number of buffers is currently queued
|
// the maximum number of buffers is currently queued
|
||||||
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
||||||
// wait for one buffer to finish playing
|
// wait for one buffer to finish playing
|
||||||
if (!notify.WaitForSignal()) {
|
if (notify.WaitForSignal()) {
|
||||||
device_changed = true;
|
device_changed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -137,11 +137,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||||||
Interframe interframe = Interframe::kNone;
|
Interframe interframe = Interframe::kNone;
|
||||||
bool keep_on_top = false;
|
bool keep_on_top = false;
|
||||||
int32_t max_threads = 0;
|
int32_t max_threads = 0;
|
||||||
#if defined(NO_OGL)
|
|
||||||
RenderMethod render_method = RenderMethod::kSimple;
|
|
||||||
#else
|
|
||||||
RenderMethod render_method = RenderMethod::kOpenGL;
|
RenderMethod render_method = RenderMethod::kOpenGL;
|
||||||
#endif
|
|
||||||
double video_scale = 3;
|
double video_scale = 3;
|
||||||
bool retain_aspect = true;
|
bool retain_aspect = true;
|
||||||
|
|
||||||
|
@@ -263,9 +263,7 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
|
|||||||
GetValidatedChild("OutputQuartz2D")->Hide();
|
GetValidatedChild("OutputQuartz2D")->Hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_OGL
|
#if defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
||||||
GetValidatedChild("OutputOpenGL")->Hide();
|
|
||||||
#elif defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
|
||||||
// wxGLCanvas segfaults on Wayland before wx 3.2.
|
// wxGLCanvas segfaults on Wayland before wx 3.2.
|
||||||
if (IsWayland()) {
|
if (IsWayland()) {
|
||||||
GetValidatedChild("OutputOpenGL")->Hide();
|
GetValidatedChild("OutputOpenGL")->Hide();
|
||||||
@@ -276,7 +274,7 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
|
|||||||
#else
|
#else
|
||||||
GetValidatedChild("OutputOpenGL")
|
GetValidatedChild("OutputOpenGL")
|
||||||
->SetValidator(RenderValidator(config::RenderMethod::kOpenGL));
|
->SetValidator(RenderValidator(config::RenderMethod::kOpenGL));
|
||||||
#endif // NO_OGL
|
#endif // defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||||
// Enable the Direct3D option on Windows.
|
// Enable the Direct3D option on Windows.
|
||||||
|
@@ -12,12 +12,6 @@ protected:
|
|||||||
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
||||||
};
|
};
|
||||||
|
|
||||||
// wx <= 2.8 may not be compiled with opengl support
|
|
||||||
#if !wxCHECK_VERSION(2, 9, 0) && !wxUSE_GLCANVAS
|
|
||||||
#define NO_OGL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_OGL
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
|
|
||||||
// shuffled parms for 2.9 indicates non-auto glcontext
|
// shuffled parms for 2.9 indicates non-auto glcontext
|
||||||
@@ -65,6 +59,5 @@ public:
|
|||||||
Quartz2DDrawingPanel(wxWindow* parent, int _width, int _height);
|
Quartz2DDrawingPanel(wxWindow* parent, int _width, int _height);
|
||||||
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // VBAM_WX_DRAWING_H_
|
#endif // VBAM_WX_DRAWING_H_
|
||||||
|
@@ -142,10 +142,7 @@ public:
|
|||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
char host[length];
|
char host[length];
|
||||||
if (!GetLinkServerHost(host, length)) {
|
GetLinkServerHost(host, length);
|
||||||
wxMessageBox(_("You must enter a valid host name"),
|
|
||||||
_("Host name invalid"), wxICON_ERROR | wxOK);
|
|
||||||
}
|
|
||||||
title.Printf(_("Waiting for clients..."));
|
title.Printf(_("Waiting for clients..."));
|
||||||
connmsg.Printf(_("Server IP address is: %s\n"), wxString(host, wxConvLibc).c_str());
|
connmsg.Printf(_("Server IP address is: %s\n"), wxString(host, wxConvLibc).c_str());
|
||||||
} else {
|
} else {
|
||||||
@@ -1828,10 +1825,10 @@ bool MainFrame::BindControls()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// Remove hide menubar in the UI Config submenu on macOS, because it is meaningless there.
|
// Remove UI Config menu item, because it only has an option that does nothing on mac.
|
||||||
wxMenuItem* hide_menu_bar = XRCITEM("HideMenuBar");
|
wxMenuItem* ui_config_mi = XRCITEM("UIConfigure");
|
||||||
hide_menu_bar->GetMenu()->Remove(hide_menu_bar);
|
ui_config_mi->GetMenu()->Remove(ui_config_mi);
|
||||||
hide_menu_bar = nullptr;
|
ui_config_mi = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -437,9 +437,6 @@ void GameArea::LoadGame(const wxString& name)
|
|||||||
emusys = &GBASystem;
|
emusys = &GBASystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sound volume.
|
|
||||||
soundSetVolume((float)OPTION(kSoundVolume) / 100.0);
|
|
||||||
|
|
||||||
if (OPTION(kGeomFullScreen)) {
|
if (OPTION(kGeomFullScreen)) {
|
||||||
GameArea::ShowFullScreen(true);
|
GameArea::ShowFullScreen(true);
|
||||||
}
|
}
|
||||||
@@ -1170,11 +1167,9 @@ void GameArea::OnIdle(wxIdleEvent& event)
|
|||||||
new Quartz2DDrawingPanel(this, basic_width, basic_height);
|
new Quartz2DDrawingPanel(this, basic_width, basic_height);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_OGL
|
|
||||||
case config::RenderMethod::kOpenGL:
|
case config::RenderMethod::kOpenGL:
|
||||||
panel = new GLDrawingPanel(this, basic_width, basic_height);
|
panel = new GLDrawingPanel(this, basic_width, basic_height);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||||
case config::RenderMethod::kDirect3d:
|
case config::RenderMethod::kDirect3d:
|
||||||
panel = new DXDrawingPanel(this, basic_width, basic_height);
|
panel = new DXDrawingPanel(this, basic_width, basic_height);
|
||||||
@@ -2150,17 +2145,18 @@ void BasicDrawingPanel::DrawImage(wxWindowDC& dc, wxImage* im)
|
|||||||
dc.DrawBitmap(bm, 0, 0);
|
dc.DrawBitmap(bm, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_OGL
|
|
||||||
// following 3 for vsync
|
// following 3 for vsync
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXGTK__ // should actually check for X11, but GTK implies X11
|
#ifdef __WXGTK__ // should actually check for X11, but GTK implies X11
|
||||||
#ifndef Status
|
#ifndef Status
|
||||||
#define Status int
|
#define Status int
|
||||||
#endif
|
#endif
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
@@ -2418,8 +2414,6 @@ void GLDrawingPanel::DrawArea(wxWindowDC& dc)
|
|||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GL support
|
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||||
#define DIRECT3D_VERSION 0x0900
|
#define DIRECT3D_VERSION 0x0900
|
||||||
#include <d3d9.h> // main include file
|
#include <d3d9.h> // main include file
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component type="desktop-application">
|
<component type="desktop">
|
||||||
<id>org.visualboyadvance_m.visualboyadvance_m</id>
|
<id>org.visualboyadvance_m.visualboyadvance_m</id>
|
||||||
<metadata_license>CC-BY-SA-3.0</metadata_license>
|
<metadata_license>CC-BY-SA-3.0</metadata_license>
|
||||||
<project_license>GPL-2.0</project_license>
|
<project_license>GPL-2.0</project_license>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<name>VisualBoyAdvance-M</name>
|
<name>VisualBoyAdvance-M</name>
|
||||||
<developer id="org.visualboyadvance-m">
|
|
||||||
<name>VisualBoyAdvance-M</name>
|
|
||||||
</developer>
|
|
||||||
<summary>VisualBoyAdvance-M, a high compatibility Gameboy Advance Emulator</summary>
|
<summary>VisualBoyAdvance-M, a high compatibility Gameboy Advance Emulator</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>
|
<p>
|
||||||
|
@@ -30,7 +30,6 @@ using std::int8_t;
|
|||||||
using std::int16_t;
|
using std::int16_t;
|
||||||
using std::int32_t;
|
using std::int32_t;
|
||||||
|
|
||||||
#ifndef NO_OGL
|
|
||||||
// glcanvas must be included before SFML for MacOSX
|
// glcanvas must be included before SFML for MacOSX
|
||||||
// originally, this was confined to drawing.h.
|
// originally, this was confined to drawing.h.
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
@@ -41,7 +40,6 @@ using std::int32_t;
|
|||||||
#ifdef BadRequest
|
#ifdef BadRequest
|
||||||
#undef BadRequest
|
#undef BadRequest
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// compatibility with wx-2.9
|
// compatibility with wx-2.9
|
||||||
// The only reason I use wxTRANSLATE at all is to get wxT as a side effect.
|
// The only reason I use wxTRANSLATE at all is to get wxT as a side effect.
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include <wx/progdlg.h>
|
#include <wx/progdlg.h>
|
||||||
#include <wx/protocol/http.h>
|
#include <wx/protocol/http.h>
|
||||||
#include <wx/regex.h>
|
#include <wx/regex.h>
|
||||||
#include <wx/spinctrl.h>
|
|
||||||
#include <wx/sstream.h>
|
#include <wx/sstream.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
@@ -1410,23 +1409,3 @@ int wxvbamApp::FilterEvent(wxEvent& event)
|
|||||||
|
|
||||||
return user_input_event.FilterProcessedInput(user_input.value());
|
return user_input_event.FilterProcessedInput(user_input.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxvbamApp::ProcessEvent(wxEvent& event) {
|
|
||||||
if (event.GetEventType() == wxEVT_KEY_DOWN) {
|
|
||||||
// First, figure out if the focused window can process the key down event.
|
|
||||||
wxWindow* focused_window = wxWindow::FindFocus();
|
|
||||||
wxTextCtrl* text_ctrl = wxDynamicCast(focused_window, wxTextCtrl);
|
|
||||||
if (text_ctrl) {
|
|
||||||
return wxApp::ProcessEvent(event);
|
|
||||||
}
|
|
||||||
wxSpinCtrl* spin_ctrl = wxDynamicCast(focused_window, wxSpinCtrl);
|
|
||||||
if (spin_ctrl) {
|
|
||||||
return wxApp::ProcessEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark the event as processed. This prevents wxWidgets from firing alerts on macOS.
|
|
||||||
// See https://github.com/wxWidgets/wxWidgets/issues/25262 for details.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return wxApp::ProcessEvent(event);
|
|
||||||
}
|
|
||||||
|
@@ -84,7 +84,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool ProcessEvent(wxEvent& event) final;
|
|
||||||
|
|
||||||
wxString GetConfigDir();
|
wxString GetConfigDir();
|
||||||
wxString GetDataDir();
|
wxString GetDataDir();
|
||||||
|
6075
third_party/include/ghc/filesystem.hpp
vendored
6075
third_party/include/ghc/filesystem.hpp
vendored
File diff suppressed because it is too large
Load Diff
38
third_party/include/ghc/fs_fwd.hpp
vendored
38
third_party/include/ghc/fs_fwd.hpp
vendored
@@ -1,38 +0,0 @@
|
|||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
// fs_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
|
||||||
// ghc::filesystem.
|
|
||||||
// This file can be include at any place, where ghc::filesystem api is needed while
|
|
||||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
|
||||||
// as long as one cpp includes fs_impl.hpp to deliver the matching implementations.
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
#ifndef GHC_FILESYSTEM_FWD_H
|
|
||||||
#define GHC_FILESYSTEM_FWD_H
|
|
||||||
#define GHC_FILESYSTEM_FWD
|
|
||||||
#include "filesystem.hpp"
|
|
||||||
#endif // GHC_FILESYSTEM_FWD_H
|
|
35
third_party/include/ghc/fs_impl.hpp
vendored
35
third_party/include/ghc/fs_impl.hpp
vendored
@@ -1,35 +0,0 @@
|
|||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
// fs_impl.hpp - The implementation header for the header/implementation separated usage of
|
|
||||||
// ghc::filesystem.
|
|
||||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
|
||||||
// The cpp has to include this before including fs_fwd.hpp directly or via a different
|
|
||||||
// header to work.
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
#define GHC_FILESYSTEM_IMPLEMENTATION
|
|
||||||
#include "filesystem.hpp"
|
|
77
third_party/include/ghc/fs_std.hpp
vendored
77
third_party/include/ghc/fs_std.hpp
vendored
@@ -1,77 +0,0 @@
|
|||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
// fs_std.hpp - The dynamic switching header that includes std::filesystem if detected
|
|
||||||
// or ghc::filesystem if not, and makes the resulting API available in the
|
|
||||||
// namespace fs.
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
#ifndef GHC_FILESYSTEM_STD_H
|
|
||||||
#define GHC_FILESYSTEM_STD_H
|
|
||||||
|
|
||||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
|
||||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
|
||||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
|
||||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
|
||||||
#define GHC_USE_STD_FS
|
|
||||||
|
|
||||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
|
||||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
|
||||||
// and watchOS 6.0.
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <Availability.h>
|
|
||||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
|
||||||
// released after std::filesystem, where std::filesystem is always available.
|
|
||||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
|
||||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
|
||||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
|
||||||
#undef GHC_USE_STD_FS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GHC_USE_STD_FS
|
|
||||||
#include <filesystem>
|
|
||||||
namespace fs {
|
|
||||||
using namespace std::filesystem;
|
|
||||||
using ifstream = std::ifstream;
|
|
||||||
using ofstream = std::ofstream;
|
|
||||||
using fstream = std::fstream;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#include "filesystem.hpp"
|
|
||||||
namespace fs {
|
|
||||||
using namespace ghc::filesystem;
|
|
||||||
using ifstream = ghc::filesystem::ifstream;
|
|
||||||
using ofstream = ghc::filesystem::ofstream;
|
|
||||||
using fstream = ghc::filesystem::fstream;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GHC_FILESYSTEM_STD_H
|
|
79
third_party/include/ghc/fs_std_fwd.hpp
vendored
79
third_party/include/ghc/fs_std_fwd.hpp
vendored
@@ -1,79 +0,0 @@
|
|||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
// fs_std_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
|
||||||
// ghc::filesystem that uses std::filesystem if it detects it.
|
|
||||||
// This file can be include at any place, where fs::filesystem api is needed while
|
|
||||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
|
||||||
// as long as one cpp includes fs_std_impl.hpp to deliver the matching implementations.
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
#ifndef GHC_FILESYSTEM_STD_FWD_H
|
|
||||||
#define GHC_FILESYSTEM_STD_FWD_H
|
|
||||||
|
|
||||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
|
||||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
|
||||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
|
||||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
|
||||||
#define GHC_USE_STD_FS
|
|
||||||
|
|
||||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
|
||||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
|
||||||
// and watchOS 6.0.
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <Availability.h>
|
|
||||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
|
||||||
// released after std::filesystem, where std::filesystem is always available.
|
|
||||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
|
||||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
|
||||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
|
||||||
#undef GHC_USE_STD_FS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GHC_USE_STD_FS
|
|
||||||
#include <filesystem>
|
|
||||||
namespace fs {
|
|
||||||
using namespace std::filesystem;
|
|
||||||
using ifstream = std::ifstream;
|
|
||||||
using ofstream = std::ofstream;
|
|
||||||
using fstream = std::fstream;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#include "fs_fwd.hpp"
|
|
||||||
namespace fs {
|
|
||||||
using namespace ghc::filesystem;
|
|
||||||
using ifstream = ghc::filesystem::ifstream;
|
|
||||||
using ofstream = ghc::filesystem::ofstream;
|
|
||||||
using fstream = ghc::filesystem::fstream;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GHC_FILESYSTEM_STD_FWD_H
|
|
60
third_party/include/ghc/fs_std_impl.hpp
vendored
60
third_party/include/ghc/fs_std_impl.hpp
vendored
@@ -1,60 +0,0 @@
|
|||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
// fs_std_impl.hpp - The implementation header for the header/implementation separated usage of
|
|
||||||
// ghc::filesystem that does nothing if std::filesystem is detected.
|
|
||||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
|
||||||
// The cpp has to include this before including fs_std_fwd.hpp directly or via a different
|
|
||||||
// header to work.
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
|
||||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
|
||||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
|
||||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
|
||||||
#define GHC_USE_STD_FS
|
|
||||||
|
|
||||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
|
||||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
|
||||||
// and watchOS 6.0.
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <Availability.h>
|
|
||||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
|
||||||
// released after std::filesystem, where std::filesystem is always available.
|
|
||||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
|
||||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
|
||||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
|
||||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
|
||||||
#undef GHC_USE_STD_FS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GHC_USE_STD_FS
|
|
||||||
#include "fs_impl.hpp"
|
|
||||||
#endif
|
|
22
third_party/include/nonstd/optional.hpp
vendored
22
third_party/include/nonstd/optional.hpp
vendored
@@ -12,7 +12,7 @@
|
|||||||
#define NONSTD_OPTIONAL_LITE_HPP
|
#define NONSTD_OPTIONAL_LITE_HPP
|
||||||
|
|
||||||
#define optional_lite_MAJOR 3
|
#define optional_lite_MAJOR 3
|
||||||
#define optional_lite_MINOR 6
|
#define optional_lite_MINOR 5
|
||||||
#define optional_lite_PATCH 0
|
#define optional_lite_PATCH 0
|
||||||
|
|
||||||
#define optional_lite_VERSION optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH)
|
#define optional_lite_VERSION optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH)
|
||||||
@@ -50,14 +50,6 @@
|
|||||||
#define optional_CONFIG_NO_EXTENSIONS 0
|
#define optional_CONFIG_NO_EXTENSIONS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Control marking class bad_optional_access and several methods with [[nodiscard]]]:
|
|
||||||
|
|
||||||
#if !defined(optional_CONFIG_NO_NODISCARD)
|
|
||||||
# define optional_CONFIG_NO_NODISCARD 0
|
|
||||||
#else
|
|
||||||
# define optional_CONFIG_NO_NODISCARD 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Control presence of exception handling (try and auto discover):
|
// Control presence of exception handling (try and auto discover):
|
||||||
|
|
||||||
#ifndef optional_CONFIG_NO_EXCEPTIONS
|
#ifndef optional_CONFIG_NO_EXCEPTIONS
|
||||||
@@ -394,7 +386,7 @@ namespace nonstd {
|
|||||||
# define optional_constexpr14 /*constexpr*/
|
# define optional_constexpr14 /*constexpr*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if optional_HAVE( NODISCARD ) && !optional_CONFIG_NO_NODISCARD
|
#if optional_HAVE( NODISCARD )
|
||||||
# define optional_nodiscard [[nodiscard]]
|
# define optional_nodiscard [[nodiscard]]
|
||||||
#else
|
#else
|
||||||
# define optional_nodiscard /*[[nodiscard]]*/
|
# define optional_nodiscard /*[[nodiscard]]*/
|
||||||
@@ -797,7 +789,7 @@ union storage_t
|
|||||||
|
|
||||||
void construct_value( value_type && v )
|
void construct_value( value_type && v )
|
||||||
{
|
{
|
||||||
::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( std::move( v ) );
|
::new( value_ptr() ) value_type( std::move( v ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class... Args >
|
template< class... Args >
|
||||||
@@ -809,13 +801,13 @@ union storage_t
|
|||||||
template< class... Args >
|
template< class... Args >
|
||||||
void emplace( Args&&... args )
|
void emplace( Args&&... args )
|
||||||
{
|
{
|
||||||
::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( std::forward<Args>(args)... );
|
::new( value_ptr() ) value_type( std::forward<Args>(args)... );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class U, class... Args >
|
template< class U, class... Args >
|
||||||
void emplace( std::initializer_list<U> il, Args&&... args )
|
void emplace( std::initializer_list<U> il, Args&&... args )
|
||||||
{
|
{
|
||||||
::new( const_cast<void *>(static_cast<const volatile void *>(value_ptr())) ) value_type( il, std::forward<Args>(args)... );
|
::new( value_ptr() ) value_type( il, std::forward<Args>(args)... );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -925,7 +917,7 @@ const nullopt_t nullopt(( nullopt_t::init() ));
|
|||||||
|
|
||||||
#if ! optional_CONFIG_NO_EXCEPTIONS
|
#if ! optional_CONFIG_NO_EXCEPTIONS
|
||||||
|
|
||||||
class optional_nodiscard bad_optional_access : public std::logic_error
|
class bad_optional_access : public std::logic_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit bad_optional_access()
|
explicit bad_optional_access()
|
||||||
@@ -1563,7 +1555,7 @@ private:
|
|||||||
void initialize( V && value )
|
void initialize( V && value )
|
||||||
{
|
{
|
||||||
assert( ! has_value() );
|
assert( ! has_value() );
|
||||||
contained.construct_value( std::forward<V>( value ) );
|
contained.construct_value( std::move( value ) );
|
||||||
has_value_ = true;
|
has_value_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
third_party/include/nonstd/variant.hpp
vendored
18
third_party/include/nonstd/variant.hpp
vendored
@@ -47,14 +47,6 @@
|
|||||||
# define variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 0
|
# define variant_CONFIG_OMIT_VARIANT_ALTERNATIVE_T_MACRO 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Control marking class bad_variant_access with [[nodiscard]]]:
|
|
||||||
|
|
||||||
#if !defined(variant_CONFIG_NO_NODISCARD)
|
|
||||||
# define variant_CONFIG_NO_NODISCARD 0
|
|
||||||
#else
|
|
||||||
# define variant_CONFIG_NO_NODISCARD 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Control presence of exception handling (try and auto discover):
|
// Control presence of exception handling (try and auto discover):
|
||||||
|
|
||||||
#ifndef variant_CONFIG_NO_EXCEPTIONS
|
#ifndef variant_CONFIG_NO_EXCEPTIONS
|
||||||
@@ -372,7 +364,7 @@ namespace nonstd {
|
|||||||
|
|
||||||
// Presence of C++17 language features:
|
// Presence of C++17 language features:
|
||||||
|
|
||||||
#define variant_HAVE_NODISCARD variant_CPP17_000
|
// no flag
|
||||||
|
|
||||||
// Presence of C++ library features:
|
// Presence of C++ library features:
|
||||||
|
|
||||||
@@ -412,12 +404,6 @@ namespace nonstd {
|
|||||||
# define variant_nullptr NULL
|
# define variant_nullptr NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if variant_HAVE_NODISCARD && !variant_CONFIG_NO_NODISCARD
|
|
||||||
# define variant_nodiscard [[nodiscard]]
|
|
||||||
#else
|
|
||||||
# define variant_nodiscard /*[[nodiscard]]*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if variant_HAVE_OVERRIDE
|
#if variant_HAVE_OVERRIDE
|
||||||
# define variant_override override
|
# define variant_override override
|
||||||
#else
|
#else
|
||||||
@@ -1280,7 +1266,7 @@ static const std::size_t variant_npos = static_cast<std::size_t>( -1 );
|
|||||||
|
|
||||||
// 19.7.11 Class bad_variant_access
|
// 19.7.11 Class bad_variant_access
|
||||||
|
|
||||||
class variant_nodiscard bad_variant_access : public std::exception
|
class bad_variant_access : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if variant_CPP11_OR_GREATER
|
#if variant_CPP11_OR_GREATER
|
||||||
|
12
third_party/quake3-sqrt/quake3-sqrt.h
vendored
12
third_party/quake3-sqrt/quake3-sqrt.h
vendored
@@ -1,12 +0,0 @@
|
|||||||
// From Quake 3 Arena.
|
|
||||||
|
|
||||||
#include <immintrin.h>
|
|
||||||
|
|
||||||
inline float quake3_sqrt(float x) {
|
|
||||||
__m128 y = _mm_set_ss(x);
|
|
||||||
__m128 approx = _mm_rsqrt_ss(y);
|
|
||||||
__m128 half_x = _mm_mul_ss(y, _mm_set_ss(0.5f));
|
|
||||||
__m128 three_half = _mm_set_ss(1.5f);
|
|
||||||
__m128 refined = _mm_mul_ss(approx, _mm_sub_ss(three_half, _mm_mul_ss(half_x, _mm_mul_ss(approx, approx))));
|
|
||||||
return _mm_cvtss_f32(_mm_mul_ss(refined, y));
|
|
||||||
}
|
|
164
third_party/sfml/include/SFML/Config.hpp
vendored
164
third_party/sfml/include/SFML/Config.hpp
vendored
@@ -1,164 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// SFML version
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#define SFML_VERSION_MAJOR 3
|
|
||||||
#define SFML_VERSION_MINOR 1
|
|
||||||
#define SFML_VERSION_PATCH 0
|
|
||||||
#define SFML_VERSION_IS_RELEASE false
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Identify the operating system
|
|
||||||
// see https://sourceforge.net/p/predef/wiki/Home/
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if defined(_WIN32)
|
|
||||||
|
|
||||||
// Windows
|
|
||||||
#define SFML_SYSTEM_WINDOWS
|
|
||||||
#ifndef NOMINMAX
|
|
||||||
#define NOMINMAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
|
||||||
|
|
||||||
// Apple platform, see which one it is
|
|
||||||
#include "TargetConditionals.h"
|
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
|
||||||
|
|
||||||
// iOS
|
|
||||||
#define SFML_SYSTEM_IOS
|
|
||||||
|
|
||||||
#elif TARGET_OS_MAC
|
|
||||||
|
|
||||||
// macOS
|
|
||||||
#define SFML_SYSTEM_MACOS
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Unsupported Apple system
|
|
||||||
#error This Apple operating system is not supported by SFML library
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__unix__)
|
|
||||||
|
|
||||||
// UNIX system, see which one it is
|
|
||||||
#if defined(__ANDROID__)
|
|
||||||
|
|
||||||
// Android
|
|
||||||
#define SFML_SYSTEM_ANDROID
|
|
||||||
|
|
||||||
#elif defined(__linux__)
|
|
||||||
|
|
||||||
// Linux
|
|
||||||
#define SFML_SYSTEM_LINUX
|
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
||||||
|
|
||||||
// FreeBSD
|
|
||||||
#define SFML_SYSTEM_FREEBSD
|
|
||||||
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
|
|
||||||
// OpenBSD
|
|
||||||
#define SFML_SYSTEM_OPENBSD
|
|
||||||
|
|
||||||
#elif defined(__NetBSD__)
|
|
||||||
|
|
||||||
// NetBSD
|
|
||||||
#define SFML_SYSTEM_NETBSD
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Unsupported UNIX system
|
|
||||||
#error This UNIX operating system is not supported by SFML library
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Unsupported system
|
|
||||||
#error This operating system is not supported by SFML library
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Ensure minimum C++ language standard version is met
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//#if (defined(_MSVC_LANG) && _MSVC_LANG < 201703L) || (!defined(_MSVC_LANG) && __cplusplus < 201703L)
|
|
||||||
//#error "Enable C++17 or newer for your compiler (e.g. -std=c++17 for GCC/Clang or /std:c++17 for MSVC)"
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Portable debug macro
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if !defined(NDEBUG)
|
|
||||||
|
|
||||||
#define SFML_DEBUG
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Helpers to create portable import / export macros for each module
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if !defined(SFML_STATIC)
|
|
||||||
|
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
|
||||||
|
|
||||||
// Windows compilers need specific (and different) keywords for export and import
|
|
||||||
#define SFML_API_EXPORT __declspec(dllexport)
|
|
||||||
#define SFML_API_IMPORT __declspec(dllimport)
|
|
||||||
|
|
||||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 & C4275 warning
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
|
||||||
#pragma warning(disable : 4251) // Using standard library types in our own exported types is okay
|
|
||||||
#pragma warning(disable : 4275) // Exporting types derived from the standard library is okay
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // Linux, FreeBSD, macOS
|
|
||||||
|
|
||||||
#define SFML_API_EXPORT __attribute__((__visibility__("default")))
|
|
||||||
#define SFML_API_IMPORT __attribute__((__visibility__("default")))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Static build doesn't need import/export macros
|
|
||||||
#define SFML_API_EXPORT
|
|
||||||
#define SFML_API_IMPORT
|
|
||||||
|
|
||||||
#endif
|
|
51
third_party/sfml/include/SFML/Network.hpp
vendored
51
third_party/sfml/include/SFML/Network.hpp
vendored
@@ -1,51 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <SFML/Network/Ftp.hpp>
|
|
||||||
#include <SFML/Network/Http.hpp>
|
|
||||||
#include <SFML/Network/IpAddress.hpp>
|
|
||||||
#include <SFML/Network/Packet.hpp>
|
|
||||||
#include <SFML/Network/Socket.hpp>
|
|
||||||
#include <SFML/Network/SocketHandle.hpp>
|
|
||||||
#include <SFML/Network/SocketSelector.hpp>
|
|
||||||
#include <SFML/Network/TcpListener.hpp>
|
|
||||||
#include <SFML/Network/TcpSocket.hpp>
|
|
||||||
#include <SFML/Network/UdpSocket.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \defgroup network Network module
|
|
||||||
///
|
|
||||||
/// Socket-based communication, utilities and higher-level
|
|
||||||
/// network protocols (HTTP, FTP).
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
44
third_party/sfml/include/SFML/Network/Export.hpp
vendored
44
third_party/sfml/include/SFML/Network/Export.hpp
vendored
@@ -1,44 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Portable import / export macros
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if defined(SFML_NETWORK_EXPORTS)
|
|
||||||
|
|
||||||
#define SFML_NETWORK_API SFML_API_EXPORT
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define SFML_NETWORK_API SFML_API_IMPORT
|
|
||||||
|
|
||||||
#endif
|
|
629
third_party/sfml/include/SFML/Network/Ftp.hpp
vendored
629
third_party/sfml/include/SFML/Network/Ftp.hpp
vendored
@@ -1,629 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/TcpSocket.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
|
|
||||||
#include "filesystem.hpp"
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class IpAddress;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief A FTP client
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Ftp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Enumeration of transfer modes
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class TransferMode
|
|
||||||
{
|
|
||||||
Binary, //!< Binary mode (file is transferred as a sequence of bytes)
|
|
||||||
Ascii, //!< Text mode using ASCII encoding
|
|
||||||
Ebcdic //!< Text mode using EBCDIC encoding
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief FTP response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Response
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Status codes possibly returned by a FTP response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class Status
|
|
||||||
{
|
|
||||||
// 1xx: the requested action is being initiated,
|
|
||||||
// expect another reply before proceeding with a new command
|
|
||||||
RestartMarkerReply = 110, //!< Restart marker reply
|
|
||||||
ServiceReadySoon = 120, //!< Service ready in N minutes
|
|
||||||
DataConnectionAlreadyOpened = 125, //!< Data connection already opened, transfer starting
|
|
||||||
OpeningDataConnection = 150, //!< File status ok, about to open data connection
|
|
||||||
|
|
||||||
// 2xx: the requested action has been successfully completed
|
|
||||||
Ok = 200, //!< Command ok
|
|
||||||
PointlessCommand = 202, //!< Command not implemented
|
|
||||||
SystemStatus = 211, //!< System status, or system help reply
|
|
||||||
DirectoryStatus = 212, //!< Directory status
|
|
||||||
FileStatus = 213, //!< File status
|
|
||||||
HelpMessage = 214, //!< Help message
|
|
||||||
SystemType = 215, //!< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
|
||||||
ServiceReady = 220, //!< Service ready for new user
|
|
||||||
ClosingConnection = 221, //!< Service closing control connection
|
|
||||||
DataConnectionOpened = 225, //!< Data connection open, no transfer in progress
|
|
||||||
ClosingDataConnection = 226, //!< Closing data connection, requested file action successful
|
|
||||||
EnteringPassiveMode = 227, //!< Entering passive mode
|
|
||||||
LoggedIn = 230, //!< User logged in, proceed. Logged out if appropriate
|
|
||||||
FileActionOk = 250, //!< Requested file action ok
|
|
||||||
DirectoryOk = 257, //!< PATHNAME created
|
|
||||||
|
|
||||||
// 3xx: the command has been accepted, but the requested action
|
|
||||||
// is dormant, pending receipt of further information
|
|
||||||
NeedPassword = 331, //!< User name ok, need password
|
|
||||||
NeedAccountToLogIn = 332, //!< Need account for login
|
|
||||||
NeedInformation = 350, //!< Requested file action pending further information
|
|
||||||
|
|
||||||
// 4xx: the command was not accepted and the requested action did not take place,
|
|
||||||
// but the error condition is temporary and the action may be requested again
|
|
||||||
ServiceUnavailable = 421, //!< Service not available, closing control connection
|
|
||||||
DataConnectionUnavailable = 425, //!< Can't open data connection
|
|
||||||
TransferAborted = 426, //!< Connection closed, transfer aborted
|
|
||||||
FileActionAborted = 450, //!< Requested file action not taken
|
|
||||||
LocalError = 451, //!< Requested action aborted, local error in processing
|
|
||||||
InsufficientStorageSpace = 452, //!< Requested action not taken; insufficient storage space in system, file unavailable
|
|
||||||
|
|
||||||
// 5xx: the command was not accepted and
|
|
||||||
// the requested action did not take place
|
|
||||||
CommandUnknown = 500, //!< Syntax error, command unrecognized
|
|
||||||
ParametersUnknown = 501, //!< Syntax error in parameters or arguments
|
|
||||||
CommandNotImplemented = 502, //!< Command not implemented
|
|
||||||
BadCommandSequence = 503, //!< Bad sequence of commands
|
|
||||||
ParameterNotImplemented = 504, //!< Command not implemented for that parameter
|
|
||||||
NotLoggedIn = 530, //!< Not logged in
|
|
||||||
NeedAccountToStore = 532, //!< Need account for storing files
|
|
||||||
FileUnavailable = 550, //!< Requested action not taken, file unavailable
|
|
||||||
PageTypeUnknown = 551, //!< Requested action aborted, page type unknown
|
|
||||||
NotEnoughMemory = 552, //!< Requested file action aborted, exceeded storage allocation
|
|
||||||
FilenameNotAllowed = 553, //!< Requested action not taken, file name not allowed
|
|
||||||
|
|
||||||
// 10xx: SFML custom codes
|
|
||||||
InvalidResponse = 1000, //!< Not part of the FTP standard, generated by SFML when a received response cannot be parsed
|
|
||||||
ConnectionFailed = 1001, //!< Not part of the FTP standard, generated by SFML when the low-level socket connection with the server fails
|
|
||||||
ConnectionClosed = 1002, //!< Not part of the FTP standard, generated by SFML when the low-level socket connection is unexpectedly closed
|
|
||||||
InvalidFile = 1003 //!< Not part of the FTP standard, generated by SFML when a local file cannot be read or written
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// This constructor is used by the FTP client to build
|
|
||||||
/// the response.
|
|
||||||
///
|
|
||||||
/// \param code Response status code
|
|
||||||
/// \param message Response message
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
explicit Response(Status code = Status::InvalidResponse, std::string message = "");
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Check if the status code means a success
|
|
||||||
///
|
|
||||||
/// This function is defined for convenience, it is
|
|
||||||
/// equivalent to testing if the status code is < 400.
|
|
||||||
///
|
|
||||||
/// \return `true` if the status is a success, `false` if it is a failure
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool isOk() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the status code of the response
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status getStatus() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the full message contained in the response
|
|
||||||
///
|
|
||||||
/// \return The response message
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const std::string& getMessage() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Status m_status; //!< Status code returned from the server
|
|
||||||
std::string m_message; //!< Last message received from the server
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Specialization of FTP response returning a directory
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API DirectoryResponse : public Response
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// \param response Source response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
DirectoryResponse(const Response& response);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the directory returned in the response
|
|
||||||
///
|
|
||||||
/// \return Directory name
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const ghc::filesystem::path& getDirectory() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ghc::filesystem::path m_directory; //!< Directory extracted from the response message
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Specialization of FTP response returning a
|
|
||||||
/// file name listing
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API ListingResponse : public Response
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// \param response Source response
|
|
||||||
/// \param data Data containing the raw listing
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ListingResponse(const Response& response, const std::string& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the array of directory/file names
|
|
||||||
///
|
|
||||||
/// \return Array containing the requested listing
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const std::vector<std::string>& getListing() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::vector<std::string> m_listing; //!< Directory/file names extracted from the data
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Ftp() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Destructor
|
|
||||||
///
|
|
||||||
/// Automatically closes the connection with the server if
|
|
||||||
/// it is still opened.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
~Ftp();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Ftp(const Ftp&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Ftp& operator=(const Ftp&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Connect to the specified FTP server
|
|
||||||
///
|
|
||||||
/// The port has a default value of 21, which is the standard
|
|
||||||
/// port used by the FTP protocol. You shouldn't use a different
|
|
||||||
/// value, unless you really know what you do.
|
|
||||||
/// This function tries to connect to the server so it may take
|
|
||||||
/// a while to complete, especially if the server is not
|
|
||||||
/// reachable. To avoid blocking your application for too long,
|
|
||||||
/// you can use a timeout. The default value, `Time::Zero`, means that the
|
|
||||||
/// system timeout will be used (which is usually pretty long).
|
|
||||||
///
|
|
||||||
/// \param server Name or address of the FTP server to connect to
|
|
||||||
/// \param port Port used for the connection
|
|
||||||
/// \param timeout Maximum time to wait
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `disconnect`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response connect(IpAddress server, unsigned short port = 21, Time timeout = Time::Zero);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Close the connection with the server
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `connect`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response disconnect();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Log in using an anonymous account
|
|
||||||
///
|
|
||||||
/// Logging in is mandatory after connecting to the server.
|
|
||||||
/// Users that are not logged in cannot perform any operation.
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response login();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Log in using a username and a password
|
|
||||||
///
|
|
||||||
/// Logging in is mandatory after connecting to the server.
|
|
||||||
/// Users that are not logged in cannot perform any operation.
|
|
||||||
///
|
|
||||||
/// \param name User name
|
|
||||||
/// \param password Password
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response login(const std::string& name, const std::string& password);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send a null command to keep the connection alive
|
|
||||||
///
|
|
||||||
/// This command is useful because the server may close the
|
|
||||||
/// connection automatically if no command is sent.
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response keepAlive();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the current working directory
|
|
||||||
///
|
|
||||||
/// The working directory is the root path for subsequent
|
|
||||||
/// operations involving directories and/or filenames.
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `getDirectoryListing`, `changeDirectory`, `parentDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] DirectoryResponse getWorkingDirectory();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the contents of the given directory
|
|
||||||
///
|
|
||||||
/// This function retrieves the sub-directories and files
|
|
||||||
/// contained in the given directory. It is not recursive.
|
|
||||||
/// The `directory` parameter is relative to the current
|
|
||||||
/// working directory.
|
|
||||||
///
|
|
||||||
/// \param directory Directory to list
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `getWorkingDirectory`, `changeDirectory`, `parentDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] ListingResponse getDirectoryListing(const std::string& directory = "");
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Change the current working directory
|
|
||||||
///
|
|
||||||
/// The new directory must be relative to the current one.
|
|
||||||
///
|
|
||||||
/// \param directory New working directory
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `getWorkingDirectory`, `getDirectoryListing`, `parentDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response changeDirectory(const std::string& directory);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Go to the parent directory of the current one
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `getWorkingDirectory`, `getDirectoryListing`, `changeDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response parentDirectory();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a new directory
|
|
||||||
///
|
|
||||||
/// The new directory is created as a child of the current
|
|
||||||
/// working directory.
|
|
||||||
///
|
|
||||||
/// \param name Name of the directory to create
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `deleteDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response createDirectory(const std::string& name);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Remove an existing directory
|
|
||||||
///
|
|
||||||
/// The directory to remove must be relative to the
|
|
||||||
/// current working directory.
|
|
||||||
/// Use this function with caution, the directory will
|
|
||||||
/// be removed permanently!
|
|
||||||
///
|
|
||||||
/// \param name Name of the directory to remove
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `createDirectory`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response deleteDirectory(const std::string& name);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Rename an existing file
|
|
||||||
///
|
|
||||||
/// The file names must be relative to the current working
|
|
||||||
/// directory.
|
|
||||||
///
|
|
||||||
/// \param file File to rename
|
|
||||||
/// \param newName New name of the file
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `deleteFile`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response renameFile(const ghc::filesystem::path& file, const ghc::filesystem::path& newName);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Remove an existing file
|
|
||||||
///
|
|
||||||
/// The file name must be relative to the current working
|
|
||||||
/// directory.
|
|
||||||
/// Use this function with caution, the file will be
|
|
||||||
/// removed permanently!
|
|
||||||
///
|
|
||||||
/// \param name File to remove
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `renameFile`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response deleteFile(const ghc::filesystem::path& name);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Download a file from the server
|
|
||||||
///
|
|
||||||
/// The file name of the distant file is relative to the
|
|
||||||
/// current working directory of the server, and the local
|
|
||||||
/// destination path is relative to the current directory
|
|
||||||
/// of your application.
|
|
||||||
/// If a file with the same file name as the distant file
|
|
||||||
/// already exists in the local destination path, it will
|
|
||||||
/// be overwritten.
|
|
||||||
///
|
|
||||||
/// \param remoteFile File name of the distant file to download
|
|
||||||
/// \param localPath The directory in which to put the file on the local computer
|
|
||||||
/// \param mode Transfer mode
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `upload`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response download(const ghc::filesystem::path& remoteFile,
|
|
||||||
const ghc::filesystem::path& localPath,
|
|
||||||
TransferMode mode = TransferMode::Binary);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Upload a file to the server
|
|
||||||
///
|
|
||||||
/// The name of the local file is relative to the current
|
|
||||||
/// working directory of your application, and the
|
|
||||||
/// remote path is relative to the current directory of the
|
|
||||||
/// FTP server.
|
|
||||||
///
|
|
||||||
/// The append parameter controls whether the remote file is
|
|
||||||
/// appended to or overwritten if it already exists.
|
|
||||||
///
|
|
||||||
/// \param localFile Path of the local file to upload
|
|
||||||
/// \param remotePath The directory in which to put the file on the server
|
|
||||||
/// \param mode Transfer mode
|
|
||||||
/// \param append Pass `true` to append to or `false` to overwrite the remote file if it already exists
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
/// \see `download`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response upload(const ghc::filesystem::path& localFile,
|
|
||||||
const ghc::filesystem::path& remotePath,
|
|
||||||
TransferMode mode = TransferMode::Binary,
|
|
||||||
bool append = false);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send a command to the FTP server
|
|
||||||
///
|
|
||||||
/// While the most often used commands are provided as member
|
|
||||||
/// functions in the `Ftp` class, this method can be used
|
|
||||||
/// to send any FTP command to the server. If the command
|
|
||||||
/// requires one or more parameters, they can be specified
|
|
||||||
/// in `parameter`. If the server returns information, you
|
|
||||||
/// can extract it from the response using `Response::getMessage()`.
|
|
||||||
///
|
|
||||||
/// \param command Command to send
|
|
||||||
/// \param parameter Command parameter
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response sendCommand(const std::string& command, const std::string& parameter = "");
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Receive a response from the server
|
|
||||||
///
|
|
||||||
/// This function must be called after each call to
|
|
||||||
/// `sendCommand` that expects a response.
|
|
||||||
///
|
|
||||||
/// \return Server response to the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Response getResponse();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Utility class for exchanging data with the server
|
|
||||||
/// on the data channel
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class DataChannel;
|
|
||||||
|
|
||||||
friend class DataChannel;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
TcpSocket m_commandSocket; //!< Socket holding the control connection with the server
|
|
||||||
std::string m_receiveBuffer; //!< Received command data that is yet to be processed
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Ftp
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// `Ftp` is a very simple FTP client that allows you
|
|
||||||
/// to communicate with a FTP server. The FTP protocol allows
|
|
||||||
/// you to manipulate a remote file system (list files,
|
|
||||||
/// upload, download, create, remove, ...).
|
|
||||||
///
|
|
||||||
/// Using the FTP client consists of 4 parts:
|
|
||||||
/// \li Connecting to the FTP server
|
|
||||||
/// \li Logging in (either as a registered user or anonymously)
|
|
||||||
/// \li Sending commands to the server
|
|
||||||
/// \li Disconnecting (this part can be done implicitly by the destructor)
|
|
||||||
///
|
|
||||||
/// Every command returns a FTP response, which contains the
|
|
||||||
/// status code as well as a message from the server. Some
|
|
||||||
/// commands such as `getWorkingDirectory()` and `getDirectoryListing()`
|
|
||||||
/// return additional data, and use a class derived from
|
|
||||||
/// `Ftp::Response` to provide this data. The most often used
|
|
||||||
/// commands are directly provided as member functions, but it is
|
|
||||||
/// also possible to use specific commands with the `sendCommand()` function.
|
|
||||||
///
|
|
||||||
/// Note that response statuses >= 1000 are not part of the FTP standard,
|
|
||||||
/// they are generated by SFML when an internal error occurs.
|
|
||||||
///
|
|
||||||
/// All commands, especially upload and download, may take some
|
|
||||||
/// time to complete. This is important to know if you don't want
|
|
||||||
/// to block your application while the server is completing
|
|
||||||
/// the task.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // Create a new FTP client
|
|
||||||
/// Ftp ftp;
|
|
||||||
///
|
|
||||||
/// // Connect to the server
|
|
||||||
/// Ftp::Response response = ftp.connect("ftp://ftp.myserver.com");
|
|
||||||
/// if (response.isOk())
|
|
||||||
/// std::cout << "Connected" << std::endl;
|
|
||||||
///
|
|
||||||
/// // Log in
|
|
||||||
/// response = ftp.login("laurent", "dF6Zm89D");
|
|
||||||
/// if (response.isOk())
|
|
||||||
/// std::cout << "Logged in" << std::endl;
|
|
||||||
///
|
|
||||||
/// // Print the working directory
|
|
||||||
/// Ftp::DirectoryResponse directory = ftp.getWorkingDirectory();
|
|
||||||
/// if (directory.isOk())
|
|
||||||
/// std::cout << "Working directory: " << directory.getDirectory() << std::endl;
|
|
||||||
///
|
|
||||||
/// // Create a new directory
|
|
||||||
/// response = ftp.createDirectory("files");
|
|
||||||
/// if (response.isOk())
|
|
||||||
/// std::cout << "Created new directory" << std::endl;
|
|
||||||
///
|
|
||||||
/// // Upload a file to this new directory
|
|
||||||
/// response = ftp.upload("local-path/file.txt", "files", Ftp::TransferMode::Ascii);
|
|
||||||
/// if (response.isOk())
|
|
||||||
/// std::cout << "File uploaded" << std::endl;
|
|
||||||
///
|
|
||||||
/// // Send specific commands (here: FEAT to list supported FTP features)
|
|
||||||
/// response = ftp.sendCommand("FEAT");
|
|
||||||
/// if (response.isOk())
|
|
||||||
/// std::cout << "Feature list:\n" << response.getMessage() << std::endl;
|
|
||||||
///
|
|
||||||
/// // Disconnect from the server (optional)
|
|
||||||
/// ftp.disconnect();
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
480
third_party/sfml/include/SFML/Network/Http.hpp
vendored
480
third_party/sfml/include/SFML/Network/Http.hpp
vendored
@@ -1,480 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/IpAddress.hpp>
|
|
||||||
#include <SFML/Network/TcpSocket.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <map>
|
|
||||||
#include <optional.hpp>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief A HTTP client
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Http
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief HTTP request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Request
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Enumerate the available HTTP methods for a request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class Method
|
|
||||||
{
|
|
||||||
Get, //!< Request in get mode, standard method to retrieve a page
|
|
||||||
Post, //!< Request in post mode, usually to send data to a page
|
|
||||||
Head, //!< Request a page's header only
|
|
||||||
Put, //!< Request in put mode, useful for a REST API
|
|
||||||
Delete //!< Request in delete mode, useful for a REST API
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// This constructor creates a GET request, with the root
|
|
||||||
/// URI ("/") and an empty body.
|
|
||||||
///
|
|
||||||
/// \param uri Target URI
|
|
||||||
/// \param method Method to use for the request
|
|
||||||
/// \param body Content of the request's body
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Request(const std::string& uri = "/", Method method = Method::Get, const std::string& body = "");
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the value of a field
|
|
||||||
///
|
|
||||||
/// The field is created if it doesn't exist. The name of
|
|
||||||
/// the field is case-insensitive.
|
|
||||||
/// By default, a request doesn't contain any field (but the
|
|
||||||
/// mandatory fields are added later by the HTTP client when
|
|
||||||
/// sending the request).
|
|
||||||
///
|
|
||||||
/// \param field Name of the field to set
|
|
||||||
/// \param value Value of the field
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setField(const std::string& field, const std::string& value);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the request method
|
|
||||||
///
|
|
||||||
/// See the Method enumeration for a complete list of all
|
|
||||||
/// the available methods.
|
|
||||||
/// The method is `Http::Request::Method::Get` by default.
|
|
||||||
///
|
|
||||||
/// \param method Method to use for the request
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setMethod(Method method);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the requested URI
|
|
||||||
///
|
|
||||||
/// The URI is the resource (usually a web page or a file)
|
|
||||||
/// that you want to get or post.
|
|
||||||
/// The URI is "/" (the root page) by default.
|
|
||||||
///
|
|
||||||
/// \param uri URI to request, relative to the host
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setUri(const std::string& uri);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the HTTP version for the request
|
|
||||||
///
|
|
||||||
/// The HTTP version is 1.0 by default.
|
|
||||||
///
|
|
||||||
/// \param major Major HTTP version number
|
|
||||||
/// \param minor Minor HTTP version number
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setHttpVersion(unsigned int major, unsigned int minor);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the body of the request
|
|
||||||
///
|
|
||||||
/// The body of a request is optional and only makes sense
|
|
||||||
/// for POST requests. It is ignored for all other methods.
|
|
||||||
/// The body is empty by default.
|
|
||||||
///
|
|
||||||
/// \param body Content of the body
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setBody(const std::string& body);
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Http;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Prepare the final request to send to the server
|
|
||||||
///
|
|
||||||
/// This is used internally by Http before sending the
|
|
||||||
/// request to the web server.
|
|
||||||
///
|
|
||||||
/// \return String containing the request, ready to be sent
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::string prepare() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Check if the request defines a field
|
|
||||||
///
|
|
||||||
/// This function uses case-insensitive comparisons.
|
|
||||||
///
|
|
||||||
/// \param field Name of the field to test
|
|
||||||
///
|
|
||||||
/// \return `true` if the field exists, `false` otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool hasField(const std::string& field) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Types
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
using FieldTable = std::map<std::string, std::string>; // Use an ordered map for predictable payloads
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FieldTable m_fields; //!< Fields of the header associated to their value
|
|
||||||
Method m_method; //!< Method to use for the request
|
|
||||||
std::string m_uri; //!< Target URI of the request
|
|
||||||
unsigned int m_majorVersion{1}; //!< Major HTTP version
|
|
||||||
unsigned int m_minorVersion{}; //!< Minor HTTP version
|
|
||||||
std::string m_body; //!< Body of the request
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief HTTP response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Response
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Enumerate all the valid status codes for a response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class Status
|
|
||||||
{
|
|
||||||
// 2xx: success
|
|
||||||
Ok = 200, //!< Most common code returned when operation was successful
|
|
||||||
Created = 201, //!< The resource has successfully been created
|
|
||||||
Accepted = 202, //!< The request has been accepted, but will be processed later by the server
|
|
||||||
NoContent = 204, //!< The server didn't send any data in return
|
|
||||||
ResetContent = 205, //!< The server informs the client that it should clear the view (form) that caused the request to be sent
|
|
||||||
PartialContent = 206, //!< The server has sent a part of the resource, as a response to a partial GET request
|
|
||||||
|
|
||||||
// 3xx: redirection
|
|
||||||
MultipleChoices = 300, //!< The requested page can be accessed from several locations
|
|
||||||
MovedPermanently = 301, //!< The requested page has permanently moved to a new location
|
|
||||||
MovedTemporarily = 302, //!< The requested page has temporarily moved to a new location
|
|
||||||
NotModified = 304, //!< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
|
|
||||||
|
|
||||||
// 4xx: client error
|
|
||||||
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
|
|
||||||
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
|
|
||||||
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
|
|
||||||
NotFound = 404, //!< The requested page doesn't exist
|
|
||||||
RangeNotSatisfiable = 407, //!< The server can't satisfy the partial GET request (with a "Range" header field)
|
|
||||||
|
|
||||||
// 5xx: server error
|
|
||||||
InternalServerError = 500, //!< The server encountered an unexpected error
|
|
||||||
NotImplemented = 501, //!< The server doesn't implement a requested feature
|
|
||||||
BadGateway = 502, //!< The gateway server has received an error from the source server
|
|
||||||
ServiceNotAvailable = 503, //!< The server is temporarily unavailable (overloaded, in maintenance, ...)
|
|
||||||
GatewayTimeout = 504, //!< The gateway server couldn't receive a response from the source server
|
|
||||||
VersionNotSupported = 505, //!< The server doesn't support the requested HTTP version
|
|
||||||
|
|
||||||
// 10xx: SFML custom codes
|
|
||||||
InvalidResponse = 1000, //!< Response is not a valid HTTP one
|
|
||||||
ConnectionFailed = 1001 //!< Connection with server failed
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the value of a field
|
|
||||||
///
|
|
||||||
/// If the field `field` is not found in the response header,
|
|
||||||
/// the empty string is returned. This function uses
|
|
||||||
/// case-insensitive comparisons.
|
|
||||||
///
|
|
||||||
/// \param field Name of the field to get
|
|
||||||
///
|
|
||||||
/// \return Value of the field, or empty string if not found
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const std::string& getField(const std::string& field) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the response status code
|
|
||||||
///
|
|
||||||
/// The status code should be the first thing to be checked
|
|
||||||
/// after receiving a response, it defines whether it is a
|
|
||||||
/// success, a failure or anything else (see the Status
|
|
||||||
/// enumeration).
|
|
||||||
///
|
|
||||||
/// \return Status code of the response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status getStatus() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the major HTTP version number of the response
|
|
||||||
///
|
|
||||||
/// \return Major HTTP version number
|
|
||||||
///
|
|
||||||
/// \see `getMinorHttpVersion`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned int getMajorHttpVersion() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the minor HTTP version number of the response
|
|
||||||
///
|
|
||||||
/// \return Minor HTTP version number
|
|
||||||
///
|
|
||||||
/// \see `getMajorHttpVersion`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned int getMinorHttpVersion() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the body of the response
|
|
||||||
///
|
|
||||||
/// The body of a response may contain:
|
|
||||||
/// \li the requested page (for GET requests)
|
|
||||||
/// \li a response from the server (for POST requests)
|
|
||||||
/// \li nothing (for HEAD requests)
|
|
||||||
/// \li an error message (in case of an error)
|
|
||||||
///
|
|
||||||
/// \return The response body
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const std::string& getBody() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Http;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the header from a response string
|
|
||||||
///
|
|
||||||
/// This function is used by `Http` to build the response
|
|
||||||
/// of a request.
|
|
||||||
///
|
|
||||||
/// \param data Content of the response to parse
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void parse(const std::string& data);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Read values passed in the answer header
|
|
||||||
///
|
|
||||||
/// This function is used by `Http` to extract values passed
|
|
||||||
/// in the response.
|
|
||||||
///
|
|
||||||
/// \param in String stream containing the header values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void parseFields(std::istream& in);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Types
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
using FieldTable = std::map<std::string, std::string>; // Use an ordered map for predictable payloads
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FieldTable m_fields; //!< Fields of the header
|
|
||||||
Status m_status{Status::ConnectionFailed}; //!< Status code
|
|
||||||
unsigned int m_majorVersion{}; //!< Major HTTP version
|
|
||||||
unsigned int m_minorVersion{}; //!< Minor HTTP version
|
|
||||||
std::string m_body; //!< Body of the response
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Http() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the HTTP client with the target host
|
|
||||||
///
|
|
||||||
/// This is equivalent to calling `setHost(host, port)`.
|
|
||||||
/// The port has a default value of 0, which means that the
|
|
||||||
/// HTTP client will use the right port according to the
|
|
||||||
/// protocol used (80 for HTTP). You should leave it like
|
|
||||||
/// this unless you really need a port other than the
|
|
||||||
/// standard one, or use an unknown protocol.
|
|
||||||
///
|
|
||||||
/// \param host Web server to connect to
|
|
||||||
/// \param port Port to use for connection
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Http(const std::string& host, unsigned short port = 0);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Http(const Http&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Http& operator=(const Http&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the target host
|
|
||||||
///
|
|
||||||
/// This function just stores the host address and port, it
|
|
||||||
/// doesn't actually connect to it until you send a request.
|
|
||||||
/// The port has a default value of 0, which means that the
|
|
||||||
/// HTTP client will use the right port according to the
|
|
||||||
/// protocol used (80 for HTTP). You should leave it like
|
|
||||||
/// this unless you really need a port other than the
|
|
||||||
/// standard one, or use an unknown protocol.
|
|
||||||
///
|
|
||||||
/// \param host Web server to connect to
|
|
||||||
/// \param port Port to use for connection
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setHost(const std::string& host, unsigned short port = 0);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send a HTTP request and return the server's response.
|
|
||||||
///
|
|
||||||
/// You must have a valid host before sending a request (see `setHost`).
|
|
||||||
/// Any missing mandatory header field in the request will be added
|
|
||||||
/// with an appropriate value.
|
|
||||||
/// Warning: this function waits for the server's response and may
|
|
||||||
/// not return instantly; use a thread if you don't want to block your
|
|
||||||
/// application, or use a timeout to limit the time to wait. A value
|
|
||||||
/// of `Time::Zero` means that the client will use the system default timeout
|
|
||||||
/// (which is usually pretty long).
|
|
||||||
///
|
|
||||||
/// \param request Request to send
|
|
||||||
/// \param timeout Maximum time to wait
|
|
||||||
///
|
|
||||||
/// \return Server's response
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Response sendRequest(const Request& request, Time timeout = Time::Zero);
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
TcpSocket m_connection; //!< Connection to the host
|
|
||||||
nonstd::optional<IpAddress> m_host; //!< Web host address
|
|
||||||
std::string m_hostName; //!< Web host name
|
|
||||||
unsigned short m_port{}; //!< Port used for connection with host
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Http
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// `Http` is a very simple HTTP client that allows you
|
|
||||||
/// to communicate with a web server. You can retrieve
|
|
||||||
/// web pages, send data to an interactive resource,
|
|
||||||
/// download a remote file, etc. The HTTPS protocol is
|
|
||||||
/// not supported.
|
|
||||||
///
|
|
||||||
/// The HTTP client is split into 3 classes:
|
|
||||||
/// \li `Http::Request`
|
|
||||||
/// \li `Http::Response`
|
|
||||||
/// \li `Http`
|
|
||||||
///
|
|
||||||
/// `Http::Request` builds the request that will be
|
|
||||||
/// sent to the server. A request is made of:
|
|
||||||
/// \li a method (what you want to do)
|
|
||||||
/// \li a target URI (usually the name of the web page or file)
|
|
||||||
/// \li one or more header fields (options that you can pass to the server)
|
|
||||||
/// \li an optional body (for POST requests)
|
|
||||||
///
|
|
||||||
/// `Http::Response` parse the response from the web server
|
|
||||||
/// and provides getters to read them. The response contains:
|
|
||||||
/// \li a status code
|
|
||||||
/// \li header fields (that may be answers to the ones that you requested)
|
|
||||||
/// \li a body, which contains the contents of the requested resource
|
|
||||||
///
|
|
||||||
/// `Http` provides a simple function, SendRequest, to send a
|
|
||||||
/// `Http::Request` and return the corresponding `Http::Response`
|
|
||||||
/// from the server.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // Create a new HTTP client
|
|
||||||
/// Http http;
|
|
||||||
///
|
|
||||||
/// // We'll work on http://www.sfml-dev.org
|
|
||||||
/// http.setHost("http://www.sfml-dev.org");
|
|
||||||
///
|
|
||||||
/// // Prepare a request to get the 'features.php' page
|
|
||||||
/// Http::Request request("features.php");
|
|
||||||
///
|
|
||||||
/// // Send the request
|
|
||||||
/// Http::Response response = http.sendRequest(request);
|
|
||||||
///
|
|
||||||
/// // Check the status code and display the result
|
|
||||||
/// Http::Response::Status status = response.getStatus();
|
|
||||||
/// if (status == Http::Response::Status::Ok)
|
|
||||||
/// {
|
|
||||||
/// std::cout << response.getBody() << std::endl;
|
|
||||||
/// }
|
|
||||||
/// else
|
|
||||||
/// {
|
|
||||||
/// std::cout << "Error " << status << std::endl;
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
296
third_party/sfml/include/SFML/Network/IpAddress.hpp
vendored
296
third_party/sfml/include/SFML/Network/IpAddress.hpp
vendored
@@ -1,296 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <optional.hpp>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Encapsulate an IPv4 network address
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API IpAddress
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the address from a null-terminated string view
|
|
||||||
///
|
|
||||||
/// Here \a address can be either a decimal address
|
|
||||||
/// (ex: "192.168.1.56") or a network name (ex: "localhost").
|
|
||||||
///
|
|
||||||
/// \param address IP address or network name
|
|
||||||
///
|
|
||||||
/// \return Address if provided argument was valid, otherwise `nonstd::nullopt`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] static nonstd::optional<IpAddress> resolve(std::string address);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the address from 4 bytes
|
|
||||||
///
|
|
||||||
/// Calling `IpAddress(a, b, c, d)` is equivalent to calling
|
|
||||||
/// `IpAddress::resolve("a.b.c.d")`, but safer as it doesn't
|
|
||||||
/// have to parse a string to get the address components.
|
|
||||||
///
|
|
||||||
/// \param byte0 First byte of the address
|
|
||||||
/// \param byte1 Second byte of the address
|
|
||||||
/// \param byte2 Third byte of the address
|
|
||||||
/// \param byte3 Fourth byte of the address
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
IpAddress(std::uint8_t byte0, std::uint8_t byte1, std::uint8_t byte2, std::uint8_t byte3);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the address from a 32-bits integer
|
|
||||||
///
|
|
||||||
/// This constructor uses the internal representation of
|
|
||||||
/// the address directly. It should be used for optimization
|
|
||||||
/// purposes, and only if you got that representation from
|
|
||||||
/// `IpAddress::toInteger()`.
|
|
||||||
///
|
|
||||||
/// \param address 4 bytes of the address packed into a 32-bits integer
|
|
||||||
///
|
|
||||||
/// \see `toInteger`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
explicit IpAddress(std::uint32_t address);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get a string representation of the address
|
|
||||||
///
|
|
||||||
/// The returned string is the decimal representation of the
|
|
||||||
/// IP address (like "192.168.1.56"), even if it was constructed
|
|
||||||
/// from a host name.
|
|
||||||
///
|
|
||||||
/// \return String representation of the address
|
|
||||||
///
|
|
||||||
/// \see `toInteger`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::string toString() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get an integer representation of the address
|
|
||||||
///
|
|
||||||
/// The returned number is the internal representation of the
|
|
||||||
/// address, and should be used for optimization purposes only
|
|
||||||
/// (like sending the address through a socket).
|
|
||||||
/// The integer produced by this function can then be converted
|
|
||||||
/// back to a `IpAddress` with the proper constructor.
|
|
||||||
///
|
|
||||||
/// \return 32-bits unsigned integer representation of the address
|
|
||||||
///
|
|
||||||
/// \see `toString`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::uint32_t toInteger() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the computer's local address
|
|
||||||
///
|
|
||||||
/// The local address is the address of the computer from the
|
|
||||||
/// LAN point of view, i.e. something like 192.168.1.56. It is
|
|
||||||
/// meaningful only for communications over the local network.
|
|
||||||
/// Unlike getPublicAddress, this function is fast and may be
|
|
||||||
/// used safely anywhere.
|
|
||||||
///
|
|
||||||
/// \return Local IP address of the computer on success, `nonstd::nullopt` otherwise
|
|
||||||
///
|
|
||||||
/// \see `getPublicAddress`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] static nonstd::optional<IpAddress> getLocalAddress();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the computer's public address
|
|
||||||
///
|
|
||||||
/// The public address is the address of the computer from the
|
|
||||||
/// internet point of view, i.e. something like 89.54.1.169.
|
|
||||||
/// It is necessary for communications over the world wide web.
|
|
||||||
/// The only way to get a public address is to ask it to a
|
|
||||||
/// distant website; as a consequence, this function depends on
|
|
||||||
/// both your network connection and the server, and may be
|
|
||||||
/// very slow. You should use it as few as possible. Because
|
|
||||||
/// this function depends on the network connection and on a distant
|
|
||||||
/// server, you may use a time limit if you don't want your program
|
|
||||||
/// to be possibly stuck waiting in case there is a problem; this
|
|
||||||
/// limit is deactivated by default.
|
|
||||||
///
|
|
||||||
/// \param timeout Maximum time to wait
|
|
||||||
///
|
|
||||||
/// \return Public IP address of the computer on success, `nonstd::nullopt` otherwise
|
|
||||||
///
|
|
||||||
/// \see `getLocalAddress`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] static nonstd::optional<IpAddress> getPublicAddress(Time timeout = Time::Zero);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTBEGIN(readability-identifier-naming)
|
|
||||||
static const IpAddress Any; //!< Value representing any address (0.0.0.0)
|
|
||||||
static const IpAddress LocalHost; //!< The "localhost" address (for connecting a computer to itself locally)
|
|
||||||
static const IpAddress Broadcast; //!< The "broadcast" address (for sending UDP messages to everyone on a local network)
|
|
||||||
// NOLINTEND(readability-identifier-naming)
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend SFML_NETWORK_API bool operator<(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::uint32_t m_address; //!< Address stored as an unsigned 32 bit integer
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator==` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if both addresses are equal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator==(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator!=` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if both addresses are different
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator!=(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator<` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lesser than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator<(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator>` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is greater than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator>(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator<=` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if \a left is lesser or equal than \a right
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator<=(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator>=` to compare two IP addresses
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a IP address)
|
|
||||||
/// \param right Right operand (a IP address)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is greater or equal than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_NETWORK_API bool operator>=(IpAddress left, IpAddress right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator>>` to extract an IP address from an input stream
|
|
||||||
///
|
|
||||||
/// \param stream Input stream
|
|
||||||
/// \param address IP address to extract
|
|
||||||
///
|
|
||||||
/// \return Reference to the input stream
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SFML_NETWORK_API std::istream& operator>>(std::istream& stream, nonstd::optional<IpAddress>& address);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator<<` to print an IP address to an output stream
|
|
||||||
///
|
|
||||||
/// \param stream Output stream
|
|
||||||
/// \param address IP address to print
|
|
||||||
///
|
|
||||||
/// \return Reference to the output stream
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SFML_NETWORK_API std::ostream& operator<<(std::ostream& stream, IpAddress address);
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class IpAddress
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// `IpAddress` is a utility class for manipulating network
|
|
||||||
/// addresses. It provides a set a implicit constructors and
|
|
||||||
/// conversion functions to easily build or transform an IP
|
|
||||||
/// address from/to various representations.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// auto a2 = IpAddress::resolve("127.0.0.1"); // the local host address
|
|
||||||
/// auto a3 = IpAddress::Broadcast; // the broadcast address
|
|
||||||
/// IpAddress a4(192, 168, 1, 56); // a local address
|
|
||||||
/// auto a5 = IpAddress::resolve("my_computer"); // a local address created from a network name
|
|
||||||
/// auto a6 = IpAddress::resolve("89.54.1.169"); // a distant address
|
|
||||||
/// auto a7 = IpAddress::resolve("www.google.com"); // a distant address created from a network name
|
|
||||||
/// auto a8 = IpAddress::getLocalAddress(); // my address on the local network
|
|
||||||
/// auto a9 = IpAddress::getPublicAddress(); // my address on the internet
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// Note that `IpAddress` currently doesn't support IPv6
|
|
||||||
/// nor other types of network addresses.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
552
third_party/sfml/include/SFML/Network/Packet.hpp
vendored
552
third_party/sfml/include/SFML/Network/Packet.hpp
vendored
@@ -1,552 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class String;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Utility class to build blocks of data to transfer
|
|
||||||
/// over the network
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Packet
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// Creates an empty packet.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Virtual destructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual ~Packet() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Copy constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet(const Packet&) = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Copy assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator=(const Packet&) = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet(Packet&&) noexcept = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator=(Packet&&) noexcept = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Append data to the end of the packet
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the sequence of bytes to append
|
|
||||||
/// \param sizeInBytes Number of bytes to append
|
|
||||||
///
|
|
||||||
/// \see `clear`
|
|
||||||
/// \see `getReadPosition`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void append(const void* data, std::size_t sizeInBytes);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the current reading position in the packet
|
|
||||||
///
|
|
||||||
/// The next read operation will read data from this position
|
|
||||||
///
|
|
||||||
/// \return The byte offset of the current read position
|
|
||||||
///
|
|
||||||
/// \see `append`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::size_t getReadPosition() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Clear the packet
|
|
||||||
///
|
|
||||||
/// After calling Clear, the packet is empty.
|
|
||||||
///
|
|
||||||
/// \see `append`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get a pointer to the data contained in the packet
|
|
||||||
///
|
|
||||||
/// Warning: the returned pointer may become invalid after
|
|
||||||
/// you append data to the packet, therefore it should never
|
|
||||||
/// be stored.
|
|
||||||
/// The return pointer is a `nullptr` if the packet is empty.
|
|
||||||
///
|
|
||||||
/// \return Pointer to the data
|
|
||||||
///
|
|
||||||
/// \see `getDataSize`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const void* getData() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the size of the data contained in the packet
|
|
||||||
///
|
|
||||||
/// This function returns the number of bytes pointed to by
|
|
||||||
/// what `getData` returns.
|
|
||||||
///
|
|
||||||
/// \return Data size, in bytes
|
|
||||||
///
|
|
||||||
/// \see `getData`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::size_t getDataSize() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Tell if the reading position has reached the
|
|
||||||
/// end of the packet
|
|
||||||
///
|
|
||||||
/// This function is useful to know if there is some data
|
|
||||||
/// left to be read, without actually reading it.
|
|
||||||
///
|
|
||||||
/// \return `true` if all data was read, `false` otherwise
|
|
||||||
///
|
|
||||||
/// \see `operator` bool
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool endOfPacket() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Test the validity of the packet, for reading
|
|
||||||
///
|
|
||||||
/// This operator allows to test the packet as a boolean
|
|
||||||
/// variable, to check if a reading operation was successful.
|
|
||||||
///
|
|
||||||
/// A packet will be in an invalid state if it has no more
|
|
||||||
/// data to read.
|
|
||||||
///
|
|
||||||
/// This behavior is the same as standard C++ streams.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// float x;
|
|
||||||
/// packet >> x;
|
|
||||||
/// if (packet)
|
|
||||||
/// {
|
|
||||||
/// // ok, x was extracted successfully
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// // -- or --
|
|
||||||
///
|
|
||||||
/// float x;
|
|
||||||
/// if (packet >> x)
|
|
||||||
/// {
|
|
||||||
/// // ok, x was extracted successfully
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// Don't focus on the return type, it's equivalent to bool but
|
|
||||||
/// it disallows unwanted implicit conversions to integer or
|
|
||||||
/// pointer types.
|
|
||||||
///
|
|
||||||
/// \return `true` if last data extraction from packet was successful
|
|
||||||
///
|
|
||||||
/// \see `endOfPacket`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
explicit operator bool() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Overload of `operator>>` to read data from the packet
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(bool& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::int8_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::uint8_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::int16_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::uint16_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::int32_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::uint32_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::int64_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::uint64_t& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(float& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(double& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(char* data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::string& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(wchar_t* data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(std::wstring& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator>>(String& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Overload of `operator<<` to write data into the packet
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(bool data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::int8_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::uint8_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::int16_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::uint16_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::int32_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::uint32_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::int64_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(std::uint64_t data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(float data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(double data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(const char* data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(const std::string& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(const wchar_t* data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(const std::wstring& data);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \overload
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Packet& operator<<(const String& data);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
friend class TcpSocket;
|
|
||||||
friend class UdpSocket;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Called before the packet is sent over the network
|
|
||||||
///
|
|
||||||
/// This function can be defined by derived classes to
|
|
||||||
/// transform the data before it is sent; this can be
|
|
||||||
/// used for compression, encryption, etc.
|
|
||||||
/// The function must return a pointer to the modified data,
|
|
||||||
/// as well as the number of bytes pointed.
|
|
||||||
/// The default implementation provides the packet's data
|
|
||||||
/// without transforming it.
|
|
||||||
///
|
|
||||||
/// \param size Variable to fill with the size of data to send
|
|
||||||
///
|
|
||||||
/// \return Pointer to the array of bytes to send
|
|
||||||
///
|
|
||||||
/// \see `onReceive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual const void* onSend(std::size_t& size);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Called after the packet is received over the network
|
|
||||||
///
|
|
||||||
/// This function can be defined by derived classes to
|
|
||||||
/// transform the data after it is received; this can be
|
|
||||||
/// used for decompression, decryption, etc.
|
|
||||||
/// The function receives a pointer to the received data,
|
|
||||||
/// and must fill the packet with the transformed bytes.
|
|
||||||
/// The default implementation fills the packet directly
|
|
||||||
/// without transforming the data.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the received bytes
|
|
||||||
/// \param size Number of bytes
|
|
||||||
///
|
|
||||||
/// \see `onSend`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual void onReceive(const void* data, std::size_t size);
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Check if the packet can extract a given number of bytes
|
|
||||||
///
|
|
||||||
/// This function updates accordingly the state of the packet.
|
|
||||||
///
|
|
||||||
/// \param size Size to check
|
|
||||||
///
|
|
||||||
/// \return `true` if \a size bytes can be read from the packet
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool checkSize(std::size_t size);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::vector<unsigned char> m_data; //!< Data stored in the packet
|
|
||||||
std::size_t m_readPos{}; //!< Current reading position in the packet
|
|
||||||
std::size_t m_sendPos{}; //!< Current send position in the packet (for handling partial sends)
|
|
||||||
bool m_isValid{true}; //!< Reading state of the packet
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Packet
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// Packets provide a safe and easy way to serialize data,
|
|
||||||
/// in order to send it over the network using sockets
|
|
||||||
/// (`TcpSocket`, `UdpSocket`).
|
|
||||||
///
|
|
||||||
/// Packets solve 2 fundamental problems that arise when
|
|
||||||
/// transferring data over the network:
|
|
||||||
/// \li data is interpreted correctly according to the endianness
|
|
||||||
/// \li the bounds of the packet are preserved (one send == one receive)
|
|
||||||
///
|
|
||||||
/// The `Packet` class provides both input and output modes.
|
|
||||||
/// It is designed to follow the behavior of standard C++ streams,
|
|
||||||
/// using operators >> and << to extract and insert data.
|
|
||||||
///
|
|
||||||
/// It is recommended to use only fixed-size types (like `std::int32_t`, etc.),
|
|
||||||
/// to avoid possible differences between the sender and the receiver.
|
|
||||||
/// Indeed, the native C++ types may have different sizes on two platforms
|
|
||||||
/// and your data may be corrupted if that happens.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// std::uint32_t x = 24;
|
|
||||||
/// std::string s = "hello";
|
|
||||||
/// double d = 5.89;
|
|
||||||
///
|
|
||||||
/// // Group the variables to send into a packet
|
|
||||||
/// Packet packet;
|
|
||||||
/// packet << x << s << d;
|
|
||||||
///
|
|
||||||
/// // Send it over the network (socket is a valid TcpSocket)
|
|
||||||
/// socket.send(packet);
|
|
||||||
///
|
|
||||||
/// -----------------------------------------------------------------
|
|
||||||
///
|
|
||||||
/// // Receive the packet at the other end
|
|
||||||
/// Packet packet;
|
|
||||||
/// socket.receive(packet);
|
|
||||||
///
|
|
||||||
/// // Extract the variables contained in the packet
|
|
||||||
/// std::uint32_t x;
|
|
||||||
/// std::string s;
|
|
||||||
/// double d;
|
|
||||||
/// if (packet >> x >> s >> d)
|
|
||||||
/// {
|
|
||||||
/// // Data extracted successfully...
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// Packets have built-in `operator>>` and << overloads for
|
|
||||||
/// standard types:
|
|
||||||
/// \li `bool`
|
|
||||||
/// \li fixed-size integer types (`int[8|16|32]_t`, `uint[8|16|32]_t`)
|
|
||||||
/// \li floating point numbers (`float`, `double`)
|
|
||||||
/// \li string types (`char*`, `wchar_t*`, `std::string`, `std::wstring`, `String`)
|
|
||||||
///
|
|
||||||
/// Like standard streams, it is also possible to define your own
|
|
||||||
/// overloads of operators >> and << in order to handle your
|
|
||||||
/// custom types.
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// struct MyStruct
|
|
||||||
/// {
|
|
||||||
/// float number{};
|
|
||||||
/// std::int8_t integer{};
|
|
||||||
/// std::string str;
|
|
||||||
/// };
|
|
||||||
///
|
|
||||||
/// Packet& operator <<(Packet& packet, const MyStruct& m)
|
|
||||||
/// {
|
|
||||||
/// return packet << m.number << m.integer << m.str;
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Packet& operator >>(Packet& packet, MyStruct& m)
|
|
||||||
/// {
|
|
||||||
/// return packet >> m.number >> m.integer >> m.str;
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// Packets also provide an extra feature that allows to apply
|
|
||||||
/// custom transformations to the data before it is sent,
|
|
||||||
/// and after it is received. This is typically used to
|
|
||||||
/// handle automatic compression or encryption of the data.
|
|
||||||
/// This is achieved by inheriting from `Packet`, and overriding
|
|
||||||
/// the onSend and onReceive functions.
|
|
||||||
///
|
|
||||||
/// Here is an example:
|
|
||||||
/// \code
|
|
||||||
/// class ZipPacket : public Packet
|
|
||||||
/// {
|
|
||||||
/// const void* onSend(std::size_t& size) override
|
|
||||||
/// {
|
|
||||||
/// const void* srcData = getData();
|
|
||||||
/// std::size_t srcSize = getDataSize();
|
|
||||||
///
|
|
||||||
/// return MySuperZipFunction(srcData, srcSize, &size);
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// void onReceive(const void* data, std::size_t size) override
|
|
||||||
/// {
|
|
||||||
/// std::size_t dstSize;
|
|
||||||
/// const void* dstData = MySuperUnzipFunction(data, size, &dstSize);
|
|
||||||
///
|
|
||||||
/// append(dstData, dstSize);
|
|
||||||
/// }
|
|
||||||
/// };
|
|
||||||
///
|
|
||||||
/// // Use like regular packets:
|
|
||||||
/// ZipPacket packet;
|
|
||||||
/// packet << x << s << d;
|
|
||||||
/// ...
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `TcpSocket`, `UdpSocket`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
229
third_party/sfml/include/SFML/Network/Socket.hpp
vendored
229
third_party/sfml/include/SFML/Network/Socket.hpp
vendored
@@ -1,229 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/SocketHandle.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Base class for all the socket types
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API Socket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Status codes that may be returned by socket functions
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class Status
|
|
||||||
{
|
|
||||||
Done, //!< The socket has sent / received the data
|
|
||||||
NotReady, //!< The socket is not ready to send / receive data yet
|
|
||||||
Partial, //!< The socket sent a part of the data
|
|
||||||
Disconnected, //!< The TCP socket has been disconnected
|
|
||||||
Error //!< An unexpected error happened
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Some special values used by sockets
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
||||||
static constexpr unsigned short AnyPort{0}; //!< Special value that tells the system to pick any available port
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Destructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual ~Socket();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Socket(const Socket&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Socket& operator=(const Socket&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Socket(Socket&& socket) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Socket& operator=(Socket&& socket) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Set the blocking state of the socket
|
|
||||||
///
|
|
||||||
/// In blocking mode, calls will not return until they have
|
|
||||||
/// completed their task. For example, a call to Receive in
|
|
||||||
/// blocking mode won't return until some data was actually
|
|
||||||
/// received.
|
|
||||||
/// In non-blocking mode, calls will always return immediately,
|
|
||||||
/// using the return code to signal whether there was data
|
|
||||||
/// available or not.
|
|
||||||
/// By default, all sockets are blocking.
|
|
||||||
///
|
|
||||||
/// \param blocking `true` to set the socket as blocking, `false` for non-blocking
|
|
||||||
///
|
|
||||||
/// \see `isBlocking`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void setBlocking(bool blocking);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Tell whether the socket is in blocking or non-blocking mode
|
|
||||||
///
|
|
||||||
/// \return `true` if the socket is blocking, `false` otherwise
|
|
||||||
///
|
|
||||||
/// \see `setBlocking`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool isBlocking() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Types of protocols that the socket can use
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
enum class Type
|
|
||||||
{
|
|
||||||
Tcp, //!< TCP protocol
|
|
||||||
Udp //!< UDP protocol
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// This constructor can only be accessed by derived classes.
|
|
||||||
///
|
|
||||||
/// \param type Type of the socket (TCP or UDP)
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
explicit Socket(Type type);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the internal handle of the socket
|
|
||||||
///
|
|
||||||
/// The returned handle may be invalid if the socket
|
|
||||||
/// was not created yet (or already destroyed).
|
|
||||||
/// This function can only be accessed by derived classes.
|
|
||||||
///
|
|
||||||
/// \return The internal (OS-specific) handle of the socket
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SocketHandle getNativeHandle() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create the internal representation of the socket
|
|
||||||
///
|
|
||||||
/// This function can only be accessed by derived classes.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void create();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create the internal representation of the socket
|
|
||||||
/// from a socket handle
|
|
||||||
///
|
|
||||||
/// This function can only be accessed by derived classes.
|
|
||||||
///
|
|
||||||
/// \param handle OS-specific handle of the socket to wrap
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void create(SocketHandle handle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Close the socket gracefully
|
|
||||||
///
|
|
||||||
/// This function can only be accessed by derived classes.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class SocketSelector;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Type m_type; //!< Type of the socket (TCP or UDP)
|
|
||||||
SocketHandle m_socket; //!< Socket descriptor
|
|
||||||
bool m_isBlocking{true}; //!< Current blocking mode of the socket
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Socket
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// This class mainly defines internal stuff to be used by
|
|
||||||
/// derived classes.
|
|
||||||
///
|
|
||||||
/// The only public features that it defines, and which
|
|
||||||
/// is therefore common to all the socket classes, is the
|
|
||||||
/// blocking state. All sockets can be set as blocking or
|
|
||||||
/// non-blocking.
|
|
||||||
///
|
|
||||||
/// In blocking mode, socket functions will hang until
|
|
||||||
/// the operation completes, which means that the entire
|
|
||||||
/// program (well, in fact the current thread if you use
|
|
||||||
/// multiple ones) will be stuck waiting for your socket
|
|
||||||
/// operation to complete.
|
|
||||||
///
|
|
||||||
/// In non-blocking mode, all the socket functions will
|
|
||||||
/// return immediately. If the socket is not ready to complete
|
|
||||||
/// the requested operation, the function simply returns
|
|
||||||
/// the proper status code (`Socket::Status::NotReady`).
|
|
||||||
///
|
|
||||||
/// The default mode, which is blocking, is the one that is
|
|
||||||
/// generally used, in combination with threads or selectors.
|
|
||||||
/// The non-blocking mode is rather used in real-time
|
|
||||||
/// applications that run an endless loop that can poll
|
|
||||||
/// the socket often enough, and cannot afford blocking
|
|
||||||
/// this loop.
|
|
||||||
///
|
|
||||||
/// \see `TcpListener`, `TcpSocket`, `UdpSocket`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
@@ -1,52 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
|
||||||
#include <basetsd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Low-level socket handle type, specific to each platform
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
|
||||||
|
|
||||||
using SocketHandle = UINT_PTR;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
using SocketHandle = int;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace sf
|
|
@@ -1,273 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class Socket;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Multiplexer that allows to read from multiple sockets
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API SocketSelector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SocketSelector();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Destructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
~SocketSelector();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Copy constructor
|
|
||||||
///
|
|
||||||
/// \param copy Instance to copy
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SocketSelector(const SocketSelector& copy);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of assignment operator
|
|
||||||
///
|
|
||||||
/// \param right Instance to assign
|
|
||||||
///
|
|
||||||
/// \return Reference to self
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SocketSelector& operator=(const SocketSelector& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SocketSelector(SocketSelector&&) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
SocketSelector& operator=(SocketSelector&&) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Add a new socket to the selector
|
|
||||||
///
|
|
||||||
/// This function keeps a weak reference to the socket,
|
|
||||||
/// so you have to make sure that the socket is not destroyed
|
|
||||||
/// while it is stored in the selector.
|
|
||||||
/// This function does nothing if the socket is not valid.
|
|
||||||
///
|
|
||||||
/// \param socket Reference to the socket to add
|
|
||||||
///
|
|
||||||
/// \see `remove`, `clear`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void add(Socket& socket);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Remove a socket from the selector
|
|
||||||
///
|
|
||||||
/// This function doesn't destroy the socket, it simply
|
|
||||||
/// removes the reference that the selector has to it.
|
|
||||||
///
|
|
||||||
/// \param socket Reference to the socket to remove
|
|
||||||
///
|
|
||||||
/// \see `add`, `clear`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void remove(Socket& socket);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Remove all the sockets stored in the selector
|
|
||||||
///
|
|
||||||
/// This function doesn't destroy any instance, it simply
|
|
||||||
/// removes all the references that the selector has to
|
|
||||||
/// external sockets.
|
|
||||||
///
|
|
||||||
/// \see `add`, `remove`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Wait until one or more sockets are ready to receive
|
|
||||||
///
|
|
||||||
/// This function returns as soon as at least one socket has
|
|
||||||
/// some data available to be received. To know which sockets are
|
|
||||||
/// ready, use the `isReady` function.
|
|
||||||
/// If you use a timeout and no socket is ready before the timeout
|
|
||||||
/// is over, the function returns `false`.
|
|
||||||
///
|
|
||||||
/// \param timeout Maximum time to wait, (use Time::Zero for infinity)
|
|
||||||
///
|
|
||||||
/// \return `true` if there are sockets ready, `false` otherwise
|
|
||||||
///
|
|
||||||
/// \see `isReady`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool wait(Time timeout = Time::Zero);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Test a socket to know if it is ready to receive data
|
|
||||||
///
|
|
||||||
/// This function must be used after a call to Wait, to know
|
|
||||||
/// which sockets are ready to receive data. If a socket is
|
|
||||||
/// ready, a call to receive will never block because we know
|
|
||||||
/// that there is data available to read.
|
|
||||||
/// Note that if this function returns `true` for a TcpListener,
|
|
||||||
/// this means that it is ready to accept a new connection.
|
|
||||||
///
|
|
||||||
/// \param socket Socket to test
|
|
||||||
///
|
|
||||||
/// \return `true` if the socket is ready to read, `false` otherwise
|
|
||||||
///
|
|
||||||
/// \see `isReady`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool isReady(Socket& socket) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct SocketSelectorImpl;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::unique_ptr<SocketSelectorImpl> m_impl; //!< Opaque pointer to the implementation (which requires OS-specific types)
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class SocketSelector
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// Socket selectors provide a way to wait until some data is
|
|
||||||
/// available on a set of sockets, instead of just one. This
|
|
||||||
/// is convenient when you have multiple sockets that may
|
|
||||||
/// possibly receive data, but you don't know which one will
|
|
||||||
/// be ready first. In particular, it avoids to use a thread
|
|
||||||
/// for each socket; with selectors, a single thread can handle
|
|
||||||
/// all the sockets.
|
|
||||||
///
|
|
||||||
/// All types of sockets can be used in a selector:
|
|
||||||
/// \li `TcpListener`
|
|
||||||
/// \li `TcpSocket`
|
|
||||||
/// \li `UdpSocket`
|
|
||||||
///
|
|
||||||
/// A selector doesn't store its own copies of the sockets
|
|
||||||
/// (socket classes are not copyable anyway), it simply keeps
|
|
||||||
/// a reference to the original sockets that you pass to the
|
|
||||||
/// "add" function. Therefore, you can't use the selector as a
|
|
||||||
/// socket container, you must store them outside and make sure
|
|
||||||
/// that they are alive as long as they are used in the selector.
|
|
||||||
///
|
|
||||||
/// Using a selector is simple:
|
|
||||||
/// \li populate the selector with all the sockets that you want to observe
|
|
||||||
/// \li make it wait until there is data available on any of the sockets
|
|
||||||
/// \li test each socket to find out which ones are ready
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // Create a socket to listen to new connections
|
|
||||||
/// TcpListener listener;
|
|
||||||
/// if (listener.listen(55001) != Socket::Status::Done)
|
|
||||||
/// {
|
|
||||||
/// // Handle error...
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// // Create a list to store the future clients
|
|
||||||
/// std::vector<TcpSocket> clients;
|
|
||||||
///
|
|
||||||
/// // Create a selector
|
|
||||||
/// SocketSelector selector;
|
|
||||||
///
|
|
||||||
/// // Add the listener to the selector
|
|
||||||
/// selector.add(listener);
|
|
||||||
///
|
|
||||||
/// // Endless loop that waits for new connections
|
|
||||||
/// while (running)
|
|
||||||
/// {
|
|
||||||
/// // Make the selector wait for data on any socket
|
|
||||||
/// if (selector.wait())
|
|
||||||
/// {
|
|
||||||
/// // Test the listener
|
|
||||||
/// if (selector.isReady(listener))
|
|
||||||
/// {
|
|
||||||
/// // The listener is ready: there is a pending connection
|
|
||||||
/// TcpSocket client;
|
|
||||||
/// if (listener.accept(client) == Socket::Status::Done)
|
|
||||||
/// {
|
|
||||||
/// // Add the new client to the selector so that we will
|
|
||||||
/// // be notified when they send something
|
|
||||||
/// selector.add(client);
|
|
||||||
///
|
|
||||||
/// // Add the new client to the clients list
|
|
||||||
/// clients.push_back(std::move(client));
|
|
||||||
/// }
|
|
||||||
/// else
|
|
||||||
/// {
|
|
||||||
/// // Handle error...
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// else
|
|
||||||
/// {
|
|
||||||
/// // The listener socket is not ready, test all other sockets (the clients)
|
|
||||||
/// for (TcpSocket& client : clients)
|
|
||||||
/// {
|
|
||||||
/// if (selector.isReady(client))
|
|
||||||
/// {
|
|
||||||
/// // The client has sent some data, we can receive it
|
|
||||||
/// Packet packet;
|
|
||||||
/// if (client.receive(packet) == Socket::Status::Done)
|
|
||||||
/// {
|
|
||||||
/// ...
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `Socket`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
@@ -1,166 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/IpAddress.hpp>
|
|
||||||
#include <SFML/Network/Socket.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class TcpSocket;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Socket that listens to new TCP connections
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API TcpListener : public Socket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
TcpListener();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the port to which the socket is bound locally
|
|
||||||
///
|
|
||||||
/// If the socket is not listening to a port, this function
|
|
||||||
/// returns 0.
|
|
||||||
///
|
|
||||||
/// \return Port to which the socket is bound
|
|
||||||
///
|
|
||||||
/// \see `listen`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned short getLocalPort() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Start listening for incoming connection attempts
|
|
||||||
///
|
|
||||||
/// This function makes the socket start listening on the
|
|
||||||
/// specified port, waiting for incoming connection attempts.
|
|
||||||
///
|
|
||||||
/// If the socket is already listening on a port when this
|
|
||||||
/// function is called, it will stop listening on the old
|
|
||||||
/// port before starting to listen on the new port.
|
|
||||||
///
|
|
||||||
/// When providing `Socket::AnyPort` as port, the listener
|
|
||||||
/// will request an available port from the system.
|
|
||||||
/// The chosen port can be retrieved by calling `getLocalPort()`.
|
|
||||||
///
|
|
||||||
/// \param port Port to listen on for incoming connection attempts
|
|
||||||
/// \param address Address of the interface to listen on
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `accept`, `close`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status listen(unsigned short port, IpAddress address = IpAddress::Any);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Stop listening and close the socket
|
|
||||||
///
|
|
||||||
/// This function gracefully stops the listener. If the
|
|
||||||
/// socket is not listening, this function has no effect.
|
|
||||||
///
|
|
||||||
/// \see `listen`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void close();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Accept a new connection
|
|
||||||
///
|
|
||||||
/// If the socket is in blocking mode, this function will
|
|
||||||
/// not return until a connection is actually received.
|
|
||||||
///
|
|
||||||
/// \param socket Socket that will hold the new connection
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `listen`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status accept(TcpSocket& socket);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class TcpListener
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// A listener socket is a special type of socket that listens to
|
|
||||||
/// a given port and waits for connections on that port.
|
|
||||||
/// This is all it can do.
|
|
||||||
///
|
|
||||||
/// When a new connection is received, you must call accept and
|
|
||||||
/// the listener returns a new instance of `TcpSocket` that
|
|
||||||
/// is properly initialized and can be used to communicate with
|
|
||||||
/// the new client.
|
|
||||||
///
|
|
||||||
/// Listener sockets are specific to the TCP protocol,
|
|
||||||
/// UDP sockets are connectionless and can therefore communicate
|
|
||||||
/// directly. As a consequence, a listener socket will always
|
|
||||||
/// return the new connections as `TcpSocket` instances.
|
|
||||||
///
|
|
||||||
/// A listener is automatically closed on destruction, like all
|
|
||||||
/// other types of socket. However if you want to stop listening
|
|
||||||
/// before the socket is destroyed, you can call its `close()`
|
|
||||||
/// function.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // Create a listener socket and make it wait for new
|
|
||||||
/// // connections on port 55001
|
|
||||||
/// TcpListener listener;
|
|
||||||
/// listener.listen(55001);
|
|
||||||
///
|
|
||||||
/// // Endless loop that waits for new connections
|
|
||||||
/// while (running)
|
|
||||||
/// {
|
|
||||||
/// TcpSocket client;
|
|
||||||
/// if (listener.accept(client) == Socket::Done)
|
|
||||||
/// {
|
|
||||||
/// // A new client just connected!
|
|
||||||
/// std::cout << "New connection received from " << client.getRemoteAddress().value() << std::endl;
|
|
||||||
/// doSomethingWith(client);
|
|
||||||
/// }
|
|
||||||
/// }
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `TcpSocket`, `Socket`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
317
third_party/sfml/include/SFML/Network/TcpSocket.hpp
vendored
317
third_party/sfml/include/SFML/Network/TcpSocket.hpp
vendored
@@ -1,317 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/Socket.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
|
|
||||||
#include <optional.hpp>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class TcpListener;
|
|
||||||
class IpAddress;
|
|
||||||
class Packet;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Specialized socket using the TCP protocol
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API TcpSocket : public Socket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
TcpSocket();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the port to which the socket is bound locally
|
|
||||||
///
|
|
||||||
/// If the socket is not connected, this function returns 0.
|
|
||||||
///
|
|
||||||
/// \return Port to which the socket is bound
|
|
||||||
///
|
|
||||||
/// \see `connect`, `getRemotePort`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned short getLocalPort() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the address of the connected peer
|
|
||||||
///
|
|
||||||
/// If the socket is not connected, this function returns
|
|
||||||
/// an unset optional.
|
|
||||||
///
|
|
||||||
/// \return Address of the remote peer
|
|
||||||
///
|
|
||||||
/// \see `getRemotePort`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<IpAddress> getRemoteAddress() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the port of the connected peer to which
|
|
||||||
/// the socket is connected
|
|
||||||
///
|
|
||||||
/// If the socket is not connected, this function returns 0.
|
|
||||||
///
|
|
||||||
/// \return Remote port to which the socket is connected
|
|
||||||
///
|
|
||||||
/// \see `getRemoteAddress`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned short getRemotePort() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Connect the socket to a remote peer
|
|
||||||
///
|
|
||||||
/// In blocking mode, this function may take a while, especially
|
|
||||||
/// if the remote peer is not reachable. The last parameter allows
|
|
||||||
/// you to stop trying to connect after a given timeout.
|
|
||||||
/// If the socket is already connected, the connection is
|
|
||||||
/// forcibly disconnected before attempting to connect again.
|
|
||||||
///
|
|
||||||
/// \param remoteAddress Address of the remote peer
|
|
||||||
/// \param remotePort Port of the remote peer
|
|
||||||
/// \param timeout Optional maximum time to wait
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `disconnect`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status connect(IpAddress remoteAddress, unsigned short remotePort, Time timeout = Time::Zero);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Disconnect the socket from its remote peer
|
|
||||||
///
|
|
||||||
/// This function gracefully closes the connection. If the
|
|
||||||
/// socket is not connected, this function has no effect.
|
|
||||||
///
|
|
||||||
/// \see `connect`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void disconnect();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send raw data to the remote peer
|
|
||||||
///
|
|
||||||
/// To be able to handle partial sends over non-blocking
|
|
||||||
/// sockets, use the `send(const void*, std::size_t, std::size_t&)`
|
|
||||||
/// overload instead.
|
|
||||||
/// This function will fail if the socket is not connected.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the sequence of bytes to send
|
|
||||||
/// \param size Number of bytes to send
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `receive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status send(const void* data, std::size_t size);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send raw data to the remote peer
|
|
||||||
///
|
|
||||||
/// This function will fail if the socket is not connected.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the sequence of bytes to send
|
|
||||||
/// \param size Number of bytes to send
|
|
||||||
/// \param sent The number of bytes sent will be written here
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `receive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status send(const void* data, std::size_t size, std::size_t& sent);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Receive raw data from the remote peer
|
|
||||||
///
|
|
||||||
/// In blocking mode, this function will wait until some
|
|
||||||
/// bytes are actually received.
|
|
||||||
/// This function will fail if the socket is not connected.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the array to fill with the received bytes
|
|
||||||
/// \param size Maximum number of bytes that can be received
|
|
||||||
/// \param received This variable is filled with the actual number of bytes received
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `send`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status receive(void* data, std::size_t size, std::size_t& received);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send a formatted packet of data to the remote peer
|
|
||||||
///
|
|
||||||
/// In non-blocking mode, if this function returns `Socket::Status::Partial`,
|
|
||||||
/// you \em must retry sending the same unmodified packet before sending
|
|
||||||
/// anything else in order to guarantee the packet arrives at the remote
|
|
||||||
/// peer uncorrupted.
|
|
||||||
/// This function will fail if the socket is not connected.
|
|
||||||
///
|
|
||||||
/// \param packet Packet to send
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `receive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status send(Packet& packet);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Receive a formatted packet of data from the remote peer
|
|
||||||
///
|
|
||||||
/// In blocking mode, this function will wait until the whole packet
|
|
||||||
/// has been received.
|
|
||||||
/// This function will fail if the socket is not connected.
|
|
||||||
///
|
|
||||||
/// \param packet Packet to fill with the received data
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `send`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status receive(Packet& packet);
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class TcpListener;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Structure holding the data of a pending packet
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
struct PendingPacket
|
|
||||||
{
|
|
||||||
std::uint32_t size{}; //!< Data of packet size
|
|
||||||
std::size_t sizeReceived{}; //!< Number of size bytes received so far
|
|
||||||
std::vector<unsigned char> data; //!< Data of the packet
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
PendingPacket m_pendingPacket; //!< Temporary data of the packet currently being received
|
|
||||||
std::vector<unsigned char> m_blockToSendBuffer; //!< Buffer used to prepare data being sent from the socket
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class TcpSocket
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// TCP is a connected protocol, which means that a TCP
|
|
||||||
/// socket can only communicate with the host it is connected
|
|
||||||
/// to. It can't send or receive anything if it is not connected.
|
|
||||||
///
|
|
||||||
/// The TCP protocol is reliable but adds a slight overhead.
|
|
||||||
/// It ensures that your data will always be received in order
|
|
||||||
/// and without errors (no data corrupted, lost or duplicated).
|
|
||||||
///
|
|
||||||
/// When a socket is connected to a remote host, you can
|
|
||||||
/// retrieve information about this host with the
|
|
||||||
/// `getRemoteAddress` and `getRemotePort` functions. You can
|
|
||||||
/// also get the local port to which the socket is bound
|
|
||||||
/// (which is automatically chosen when the socket is connected),
|
|
||||||
/// with the getLocalPort function.
|
|
||||||
///
|
|
||||||
/// Sending and receiving data can use either the low-level
|
|
||||||
/// or the high-level functions. The low-level functions
|
|
||||||
/// process a raw sequence of bytes, and cannot ensure that
|
|
||||||
/// one call to Send will exactly match one call to Receive
|
|
||||||
/// at the other end of the socket.
|
|
||||||
///
|
|
||||||
/// The high-level interface uses packets (see `Packet`),
|
|
||||||
/// which are easier to use and provide more safety regarding
|
|
||||||
/// the data that is exchanged. You can look at the `Packet`
|
|
||||||
/// class to get more details about how they work.
|
|
||||||
///
|
|
||||||
/// The socket is automatically disconnected when it is destroyed,
|
|
||||||
/// but if you want to explicitly close the connection while
|
|
||||||
/// the socket instance is still alive, you can call disconnect.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // ----- The client -----
|
|
||||||
///
|
|
||||||
/// // Create a socket and connect it to 192.168.1.50 on port 55001
|
|
||||||
/// TcpSocket socket;
|
|
||||||
/// socket.connect("192.168.1.50", 55001);
|
|
||||||
///
|
|
||||||
/// // Send a message to the connected host
|
|
||||||
/// std::string message = "Hi, I am a client";
|
|
||||||
/// socket.send(message.c_str(), message.size() + 1);
|
|
||||||
///
|
|
||||||
/// // Receive an answer from the server
|
|
||||||
/// std::array<char, 1024> buffer;
|
|
||||||
/// std::size_t received = 0;
|
|
||||||
/// socket.receive(buffer.data(), buffer.size(), received);
|
|
||||||
/// std::cout << "The server said: " << buffer.data() << std::endl;
|
|
||||||
///
|
|
||||||
/// // ----- The server -----
|
|
||||||
///
|
|
||||||
/// // Create a listener to wait for incoming connections on port 55001
|
|
||||||
/// TcpListener listener;
|
|
||||||
/// listener.listen(55001);
|
|
||||||
///
|
|
||||||
/// // Wait for a connection
|
|
||||||
/// TcpSocket socket;
|
|
||||||
/// listener.accept(socket);
|
|
||||||
/// std::cout << "New client connected: " << socket.getRemoteAddress().value() << std::endl;
|
|
||||||
///
|
|
||||||
/// // Receive a message from the client
|
|
||||||
/// std::array<char, 1024> buffer;
|
|
||||||
/// std::size_t received = 0;
|
|
||||||
/// socket.receive(buffer.data(), buffer.size(), received);
|
|
||||||
/// std::cout << "The client said: " << buffer.data() << std::endl;
|
|
||||||
///
|
|
||||||
/// // Send an answer
|
|
||||||
/// std::string message = "Welcome, client";
|
|
||||||
/// socket.send(message.c_str(), message.size() + 1);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `Socket`, `UdpSocket`, `Packet`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
293
third_party/sfml/include/SFML/Network/UdpSocket.hpp
vendored
293
third_party/sfml/include/SFML/Network/UdpSocket.hpp
vendored
@@ -1,293 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Network/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/Network/IpAddress.hpp>
|
|
||||||
#include <SFML/Network/Socket.hpp>
|
|
||||||
|
|
||||||
#include <optional.hpp>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class Packet;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Specialized socket using the UDP protocol
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_NETWORK_API UdpSocket : public Socket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Constants
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
||||||
static constexpr std::size_t MaxDatagramSize{65507}; //!< The maximum number of bytes that can be sent in a single UDP datagram
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
UdpSocket();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the port to which the socket is bound locally
|
|
||||||
///
|
|
||||||
/// If the socket is not bound to a port, this function
|
|
||||||
/// returns 0.
|
|
||||||
///
|
|
||||||
/// \return Port to which the socket is bound
|
|
||||||
///
|
|
||||||
/// \see `bind`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] unsigned short getLocalPort() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Bind the socket to a specific port
|
|
||||||
///
|
|
||||||
/// Binding the socket to a port is necessary for being
|
|
||||||
/// able to receive data on that port.
|
|
||||||
///
|
|
||||||
/// When providing `Socket::AnyPort` as port, the listener
|
|
||||||
/// will request an available port from the system.
|
|
||||||
/// The chosen port can be retrieved by calling `getLocalPort()`.
|
|
||||||
///
|
|
||||||
/// Since the socket can only be bound to a single port at
|
|
||||||
/// any given moment, if it is already bound when this
|
|
||||||
/// function is called, it will be unbound from the previous
|
|
||||||
/// port before being bound to the new one.
|
|
||||||
///
|
|
||||||
/// \param port Port to bind the socket to
|
|
||||||
/// \param address Address of the interface to bind to
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `unbind`, `getLocalPort`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status bind(unsigned short port, IpAddress address = IpAddress::Any);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Unbind the socket from the local port to which it is bound
|
|
||||||
///
|
|
||||||
/// The port that the socket was previously bound to is immediately
|
|
||||||
/// made available to the operating system after this function is called.
|
|
||||||
/// This means that a subsequent call to `bind()` will be able to re-bind
|
|
||||||
/// the port if no other process has done so in the mean time.
|
|
||||||
/// If the socket is not bound to a port, this function has no effect.
|
|
||||||
///
|
|
||||||
/// \see `bind`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void unbind();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send raw data to a remote peer
|
|
||||||
///
|
|
||||||
/// Make sure that `size` is not greater than
|
|
||||||
/// `UdpSocket::MaxDatagramSize`, otherwise this function will
|
|
||||||
/// fail and no data will be sent.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the sequence of bytes to send
|
|
||||||
/// \param size Number of bytes to send
|
|
||||||
/// \param remoteAddress Address of the receiver
|
|
||||||
/// \param remotePort Port of the receiver to send the data to
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `receive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status send(const void* data, std::size_t size, IpAddress remoteAddress, unsigned short remotePort);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Receive raw data from a remote peer
|
|
||||||
///
|
|
||||||
/// In blocking mode, this function will wait until some
|
|
||||||
/// bytes are actually received.
|
|
||||||
/// Be careful to use a buffer which is large enough for
|
|
||||||
/// the data that you intend to receive, if it is too small
|
|
||||||
/// then an error will be returned and *all* the data will
|
|
||||||
/// be lost.
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the array to fill with the received bytes
|
|
||||||
/// \param size Maximum number of bytes that can be received
|
|
||||||
/// \param received This variable is filled with the actual number of bytes received
|
|
||||||
/// \param remoteAddress Address of the peer that sent the data
|
|
||||||
/// \param remotePort Port of the peer that sent the data
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `send`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status receive(void* data,
|
|
||||||
std::size_t size,
|
|
||||||
std::size_t& received,
|
|
||||||
nonstd::optional<IpAddress>& remoteAddress,
|
|
||||||
unsigned short& remotePort);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Send a formatted packet of data to a remote peer
|
|
||||||
///
|
|
||||||
/// Make sure that the packet size is not greater than
|
|
||||||
/// `UdpSocket::MaxDatagramSize`, otherwise this function will
|
|
||||||
/// fail and no data will be sent.
|
|
||||||
///
|
|
||||||
/// \param packet Packet to send
|
|
||||||
/// \param remoteAddress Address of the receiver
|
|
||||||
/// \param remotePort Port of the receiver to send the data to
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `receive`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status send(Packet& packet, IpAddress remoteAddress, unsigned short remotePort);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Receive a formatted packet of data from a remote peer
|
|
||||||
///
|
|
||||||
/// In blocking mode, this function will wait until the whole packet
|
|
||||||
/// has been received.
|
|
||||||
///
|
|
||||||
/// \param packet Packet to fill with the received data
|
|
||||||
/// \param remoteAddress Address of the peer that sent the data
|
|
||||||
/// \param remotePort Port of the peer that sent the data
|
|
||||||
///
|
|
||||||
/// \return Status code
|
|
||||||
///
|
|
||||||
/// \see `send`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Status receive(Packet& packet, nonstd::optional<IpAddress>& remoteAddress, unsigned short& remotePort);
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::vector<unsigned char> m_buffer; //!< Temporary buffer holding the received data in Receive(Packet)
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class UdpSocket
|
|
||||||
/// \ingroup network
|
|
||||||
///
|
|
||||||
/// A UDP socket is a connectionless socket. Instead of
|
|
||||||
/// connecting once to a remote host, like TCP sockets,
|
|
||||||
/// it can send to and receive from any host at any time.
|
|
||||||
///
|
|
||||||
/// It is a datagram protocol: bounded blocks of data (datagrams)
|
|
||||||
/// are transferred over the network rather than a continuous
|
|
||||||
/// stream of data (TCP). Therefore, one call to send will always
|
|
||||||
/// match one call to receive (if the datagram is not lost),
|
|
||||||
/// with the same data that was sent.
|
|
||||||
///
|
|
||||||
/// The UDP protocol is lightweight but unreliable. Unreliable
|
|
||||||
/// means that datagrams may be duplicated, be lost or
|
|
||||||
/// arrive reordered. However, if a datagram arrives, its
|
|
||||||
/// data is guaranteed to be valid.
|
|
||||||
///
|
|
||||||
/// UDP is generally used for real-time communication
|
|
||||||
/// (audio or video streaming, real-time games, etc.) where
|
|
||||||
/// speed is crucial and lost data doesn't matter much.
|
|
||||||
///
|
|
||||||
/// Sending and receiving data can use either the low-level
|
|
||||||
/// or the high-level functions. The low-level functions
|
|
||||||
/// process a raw sequence of bytes, whereas the high-level
|
|
||||||
/// interface uses packets (see `Packet`), which are easier
|
|
||||||
/// to use and provide more safety regarding the data that is
|
|
||||||
/// exchanged. You can look at the `Packet` class to get
|
|
||||||
/// more details about how they work.
|
|
||||||
///
|
|
||||||
/// It is important to note that `UdpSocket` is unable to send
|
|
||||||
/// datagrams bigger than `MaxDatagramSize`. In this case, it
|
|
||||||
/// returns an error and doesn't send anything. This applies
|
|
||||||
/// to both raw data and packets. Indeed, even packets are
|
|
||||||
/// unable to split and recompose data, due to the unreliability
|
|
||||||
/// of the protocol (dropped, mixed or duplicated datagrams may
|
|
||||||
/// lead to a big mess when trying to recompose a packet).
|
|
||||||
///
|
|
||||||
/// If the socket is bound to a port, it is automatically
|
|
||||||
/// unbound from it when the socket is destroyed. However,
|
|
||||||
/// you can unbind the socket explicitly with the Unbind
|
|
||||||
/// function if necessary, to stop receiving messages or
|
|
||||||
/// make the port available for other sockets.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // ----- The client -----
|
|
||||||
///
|
|
||||||
/// // Create a socket and bind it to the port 55001
|
|
||||||
/// UdpSocket socket;
|
|
||||||
/// socket.bind(55001);
|
|
||||||
///
|
|
||||||
/// // Send a message to 192.168.1.50 on port 55002
|
|
||||||
/// std::string message = "Hi, I am " + IpAddress::getLocalAddress().toString();
|
|
||||||
/// socket.send(message.c_str(), message.size() + 1, "192.168.1.50", 55002);
|
|
||||||
///
|
|
||||||
/// // Receive an answer (most likely from 192.168.1.50, but could be anyone else)
|
|
||||||
/// std::array<char, 1024> buffer;
|
|
||||||
/// std::size_t received = 0;
|
|
||||||
/// nonstd::optional<IpAddress> sender;
|
|
||||||
/// unsigned short port;
|
|
||||||
/// if (socket.receive(buffer.data(), buffer.size(), received, sender, port) == Socket::Status::Done)
|
|
||||||
/// std::cout << sender->toString() << " said: " << buffer.data() << std::endl;
|
|
||||||
///
|
|
||||||
/// // ----- The server -----
|
|
||||||
///
|
|
||||||
/// // Create a socket and bind it to the port 55002
|
|
||||||
/// UdpSocket socket;
|
|
||||||
/// socket.bind(55002);
|
|
||||||
///
|
|
||||||
/// // Receive a message from anyone
|
|
||||||
/// std::array<char, 1024> buffer;
|
|
||||||
/// std::size_t received = 0;
|
|
||||||
/// nonstd::optional<IpAddress> sender;
|
|
||||||
/// unsigned short port;
|
|
||||||
/// if (socket.receive(buffer.data(), buffer.size(), received, sender, port) == Socket::Status::Done)
|
|
||||||
/// std::cout << sender->toString() << " said: " << buffer.data() << std::endl;
|
|
||||||
///
|
|
||||||
/// // Send an answer
|
|
||||||
/// std::string message = "Welcome " + sender.toString();
|
|
||||||
/// socket.send(message.c_str(), message.size() + 1, sender, port);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `Socket`, `TcpSocket`, `Packet`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
55
third_party/sfml/include/SFML/System.hpp
vendored
55
third_party/sfml/include/SFML/System.hpp
vendored
@@ -1,55 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Angle.hpp>
|
|
||||||
#include <SFML/System/Clock.hpp>
|
|
||||||
#include <SFML/System/Err.hpp>
|
|
||||||
#include <SFML/System/Exception.hpp>
|
|
||||||
#include <SFML/System/FileInputStream.hpp>
|
|
||||||
#include <SFML/System/InputStream.hpp>
|
|
||||||
#include <SFML/System/MemoryInputStream.hpp>
|
|
||||||
#include <SFML/System/Sleep.hpp>
|
|
||||||
#include <SFML/System/String.hpp>
|
|
||||||
#include <SFML/System/Time.hpp>
|
|
||||||
#include <SFML/System/Utf.hpp>
|
|
||||||
#include <SFML/System/Vector2.hpp>
|
|
||||||
#include <SFML/System/Vector3.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \defgroup system System module
|
|
||||||
///
|
|
||||||
/// Base module of SFML, defining various utilities. It provides
|
|
||||||
/// vector classes, Unicode strings and conversion functions,
|
|
||||||
/// threads and mutexes, timing classes.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
511
third_party/sfml/include/SFML/System/Angle.hpp
vendored
511
third_party/sfml/include/SFML/System/Angle.hpp
vendored
@@ -1,511 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Represents an angle value.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class Angle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// Sets the angle value to zero.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the angle's value in degrees
|
|
||||||
///
|
|
||||||
/// \return Angle in degrees
|
|
||||||
///
|
|
||||||
/// \see `asRadians`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr float asDegrees() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the angle's value in radians
|
|
||||||
///
|
|
||||||
/// \return Angle in radians
|
|
||||||
///
|
|
||||||
/// \see `asDegrees`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr float asRadians() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Wrap to a range such that -180° <= angle < 180°
|
|
||||||
///
|
|
||||||
/// Similar to a modulo operation, this returns a copy of the angle
|
|
||||||
/// constrained to the range [-180°, 180°) == [-Pi, Pi).
|
|
||||||
/// The resulting angle represents a rotation which is equivalent to `*this`.
|
|
||||||
///
|
|
||||||
/// The name "signed" originates from the similarity to signed integers:
|
|
||||||
/// <table>
|
|
||||||
/// <tr>
|
|
||||||
/// <th></th>
|
|
||||||
/// <th>signed</th>
|
|
||||||
/// <th>unsigned</th>
|
|
||||||
/// </tr>
|
|
||||||
/// <tr>
|
|
||||||
/// <td>char</td>
|
|
||||||
/// <td>[-128, 128)</td>
|
|
||||||
/// <td>[0, 256)</td>
|
|
||||||
/// </tr>
|
|
||||||
/// <tr>
|
|
||||||
/// <td>Angle</td>
|
|
||||||
/// <td>[-180°, 180°)</td>
|
|
||||||
/// <td>[0°, 360°)</td>
|
|
||||||
/// </tr>
|
|
||||||
/// </table>
|
|
||||||
///
|
|
||||||
/// \return Signed angle, wrapped to [-180°, 180°)
|
|
||||||
///
|
|
||||||
/// \see `wrapUnsigned`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle wrapSigned() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Wrap to a range such that 0° <= angle < 360°
|
|
||||||
///
|
|
||||||
/// Similar to a modulo operation, this returns a copy of the angle
|
|
||||||
/// constrained to the range [0°, 360°) == [0, Tau) == [0, 2*Pi).
|
|
||||||
/// The resulting angle represents a rotation which is equivalent to `*this`.
|
|
||||||
///
|
|
||||||
/// The name "unsigned" originates from the similarity to unsigned integers:
|
|
||||||
/// <table>
|
|
||||||
/// <tr>
|
|
||||||
/// <th></th>
|
|
||||||
/// <th>signed</th>
|
|
||||||
/// <th>unsigned</th>
|
|
||||||
/// </tr>
|
|
||||||
/// <tr>
|
|
||||||
/// <td>char</td>
|
|
||||||
/// <td>[-128, 128)</td>
|
|
||||||
/// <td>[0, 256)</td>
|
|
||||||
/// </tr>
|
|
||||||
/// <tr>
|
|
||||||
/// <td>Angle</td>
|
|
||||||
/// <td>[-180°, 180°)</td>
|
|
||||||
/// <td>[0°, 360°)</td>
|
|
||||||
/// </tr>
|
|
||||||
/// </table>
|
|
||||||
///
|
|
||||||
/// \return Unsigned angle, wrapped to [0°, 360°)
|
|
||||||
///
|
|
||||||
/// \see `wrapSigned`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle wrapUnsigned() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
||||||
static const Angle Zero; //!< Predefined 0 degree angle value
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend constexpr Angle degrees(float angle);
|
|
||||||
friend constexpr Angle radians(float angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from a number of radians
|
|
||||||
///
|
|
||||||
/// This function is internal. To construct angle values,
|
|
||||||
/// use `radians` or `degrees` instead.
|
|
||||||
///
|
|
||||||
/// \param radians Angle in radians
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr explicit Angle(float radians);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
float m_radians{}; //!< Angle value stored as radians
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct an angle value from a number of degrees
|
|
||||||
///
|
|
||||||
/// \param angle Number of degrees
|
|
||||||
///
|
|
||||||
/// \return Angle value constructed from the number of degrees
|
|
||||||
///
|
|
||||||
/// \see `radians`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle degrees(float angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct an angle value from a number of radians
|
|
||||||
///
|
|
||||||
/// \param angle Number of radians
|
|
||||||
///
|
|
||||||
/// \return Angle value constructed from the number of radians
|
|
||||||
///
|
|
||||||
/// \see `degrees`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle radians(float angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator==` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if both angle values are equal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator==(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator!=` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if both angle values are different
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator!=(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator<` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if \a left is less than \a right
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator<(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator>` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if \a left is greater than \a right
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator>(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator<=` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if \a left is less than or equal to \a right
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator<=(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of `operator>=` to compare two angle values
|
|
||||||
/// \note Does not automatically wrap the angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `true` if \a left is greater than or equal to \a right
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator>=(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of unary `operator-` to negate an angle value.
|
|
||||||
///
|
|
||||||
/// Represents a rotation in the opposite direction.
|
|
||||||
///
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return Negative of the angle value
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator-(Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator+` to add two angle values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return Sum of the two angle values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator+(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator+=` to add/assign two angle values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return Sum of the two angle values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator+=(Angle& left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator-` to subtract two angle values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return Difference of the two angle values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator-(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator-=` to subtract/assign two angle values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return Difference of the two angle values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator-=(Angle& left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator*` to scale an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator*(Angle left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator*` to scale an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a number)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator*(float left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator*=` to scale/assign an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator*=(Angle& left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator/` to scale an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator/(Angle left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator/=` to scale/assign an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator/=(Angle& left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator/` to compute the ratio of two angle values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr float operator/(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator%` to compute modulo of an angle value.
|
|
||||||
///
|
|
||||||
/// Right hand angle must be greater than zero.
|
|
||||||
///
|
|
||||||
/// Examples:
|
|
||||||
/// \code
|
|
||||||
/// degrees(90) % degrees(40) // 10 degrees
|
|
||||||
/// degrees(-90) % degrees(40) // 30 degrees (not -10)
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `left` modulo `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator%(Angle left, Angle right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief Overload of binary `operator%=` to compute/assign remainder of an angle value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (an angle)
|
|
||||||
/// \param right Right operand (an angle)
|
|
||||||
///
|
|
||||||
/// \return `left` modulo `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator%=(Angle& left, Angle right);
|
|
||||||
|
|
||||||
namespace Literals
|
|
||||||
{
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief User defined literal for angles in degrees, e.g.\ `10.5_deg`
|
|
||||||
///
|
|
||||||
/// \param angle Angle in degrees
|
|
||||||
///
|
|
||||||
/// \return Angle
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator""_deg(long double angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief User defined literal for angles in degrees, e.g.\ `90_deg`
|
|
||||||
///
|
|
||||||
/// \param angle Angle in degrees
|
|
||||||
///
|
|
||||||
/// \return Angle
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator""_deg(unsigned long long int angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief User defined literal for angles in radians, e.g.\ `0.1_rad`
|
|
||||||
///
|
|
||||||
/// \param angle Angle in radians
|
|
||||||
///
|
|
||||||
/// \return Angle
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator""_rad(long double angle);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Angle
|
|
||||||
/// \brief User defined literal for angles in radians, e.g.\ `2_rad`
|
|
||||||
///
|
|
||||||
/// \param angle Angle in radians
|
|
||||||
///
|
|
||||||
/// \return Angle
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Angle operator""_rad(unsigned long long int angle);
|
|
||||||
|
|
||||||
} // namespace Literals
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
#include <SFML/System/Angle.inl>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Angle
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// `Angle` encapsulates an angle value in a flexible way.
|
|
||||||
/// It allows for defining an angle value either as a number
|
|
||||||
/// of degrees or radians. It also works the other way
|
|
||||||
/// around. You can read an angle value as either a number
|
|
||||||
/// of degrees or radians.
|
|
||||||
///
|
|
||||||
/// By using such a flexible interface, the API doesn't
|
|
||||||
/// impose any fixed type or unit for angle values and lets
|
|
||||||
/// the user choose their own preferred representation.
|
|
||||||
///
|
|
||||||
/// Angle values support the usual mathematical operations.
|
|
||||||
/// You can add or subtract two angles, multiply or divide
|
|
||||||
/// an angle by a number, compare two angles, etc.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// Angle a1 = degrees(90);
|
|
||||||
/// float radians = a1.asRadians(); // 1.5708f
|
|
||||||
///
|
|
||||||
/// Angle a2 = radians(3.141592654f);
|
|
||||||
/// float degrees = a2.asDegrees(); // 180.0f
|
|
||||||
///
|
|
||||||
/// using namespace Literals;
|
|
||||||
/// Angle a3 = 10_deg; // 10 degrees
|
|
||||||
/// Angle a4 = 1.5_deg; // 1.5 degrees
|
|
||||||
/// Angle a5 = 1_rad; // 1 radians
|
|
||||||
/// Angle a6 = 3.14_rad; // 3.14 radians
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
271
third_party/sfml/include/SFML/System/Angle.inl
vendored
271
third_party/sfml/include/SFML/System/Angle.inl
vendored
@@ -1,271 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Angle.hpp> // NOLINT(misc-header-include-cycle)
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
constexpr float pi = 3.141592654f;
|
|
||||||
constexpr float tau = pi * 2.f;
|
|
||||||
|
|
||||||
constexpr float positiveRemainder(float a, float b)
|
|
||||||
{
|
|
||||||
assert(b > 0.f && "Cannot calculate remainder with non-positive divisor");
|
|
||||||
const float val = a - static_cast<float>(static_cast<int>(a / b)) * b;
|
|
||||||
return val >= 0.f ? val : val + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr float Angle::asDegrees() const
|
|
||||||
{
|
|
||||||
return m_radians * (180.f / pi);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr float Angle::asRadians() const
|
|
||||||
{
|
|
||||||
return m_radians;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle Angle::wrapSigned() const
|
|
||||||
{
|
|
||||||
return radians(positiveRemainder(m_radians + pi, tau) - pi);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle Angle::wrapUnsigned() const
|
|
||||||
{
|
|
||||||
return radians(positiveRemainder(m_radians, tau));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle::Angle(float radians) : m_radians(radians)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle degrees(float angle)
|
|
||||||
{
|
|
||||||
return Angle(angle * (pi / 180.f));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle radians(float angle)
|
|
||||||
{
|
|
||||||
return Angle(angle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator==(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() == right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator!=(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() != right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator<(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() < right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator>(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() > right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator<=(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() <= right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator>=(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return left.asRadians() >= right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator-(Angle right)
|
|
||||||
{
|
|
||||||
return radians(-right.asRadians());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator+(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return radians(left.asRadians() + right.asRadians());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator+=(Angle& left, Angle right)
|
|
||||||
{
|
|
||||||
return left = left + right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator-(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
return radians(left.asRadians() - right.asRadians());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator-=(Angle& left, Angle right)
|
|
||||||
{
|
|
||||||
return left = left - right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator*(Angle left, float right)
|
|
||||||
{
|
|
||||||
return radians(left.asRadians() * right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator*(float left, Angle right)
|
|
||||||
{
|
|
||||||
return right * left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator*=(Angle& left, float right)
|
|
||||||
{
|
|
||||||
return left = left * right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator/(Angle left, float right)
|
|
||||||
{
|
|
||||||
assert(right != 0.f && "Angle::operator/ cannot divide by 0");
|
|
||||||
return radians(left.asRadians() / right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator/=(Angle& left, float right)
|
|
||||||
{
|
|
||||||
assert(right != 0.f && "Angle::operator/= cannot divide by 0");
|
|
||||||
return left = left / right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr float operator/(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
assert(right.asRadians() != 0.f && "Angle::operator/ cannot divide by 0");
|
|
||||||
return left.asRadians() / right.asRadians();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator%(Angle left, Angle right)
|
|
||||||
{
|
|
||||||
assert(right.asRadians() != 0.f && "Angle::operator% cannot modulus by 0");
|
|
||||||
return radians(positiveRemainder(left.asRadians(), right.asRadians()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle& operator%=(Angle& left, Angle right)
|
|
||||||
{
|
|
||||||
assert(right.asRadians() != 0.f && "Angle::operator%= cannot modulus by 0");
|
|
||||||
return left = left % right;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Literals
|
|
||||||
{
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator""_deg(long double angle)
|
|
||||||
{
|
|
||||||
return degrees(static_cast<float>(angle));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator""_deg(unsigned long long angle)
|
|
||||||
{
|
|
||||||
return degrees(static_cast<float>(angle));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator""_rad(long double angle)
|
|
||||||
{
|
|
||||||
return radians(static_cast<float>(angle));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Angle operator""_rad(unsigned long long angle)
|
|
||||||
{
|
|
||||||
return radians(static_cast<float>(angle));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Literals
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Note: the 'inline' keyword here is technically not required, but VS2019 fails
|
|
||||||
// to compile with a bogus "multiple definition" error if not explicitly used.
|
|
||||||
constexpr Angle Angle::Zero;
|
|
||||||
|
|
||||||
} // namespace sf
|
|
192
third_party/sfml/include/SFML/System/Clock.hpp
vendored
192
third_party/sfml/include/SFML/System/Clock.hpp
vendored
@@ -1,192 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <ratio>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
|
||||||
#include <SFML/System/SuspendAwareClock.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Chooses a monotonic clock of highest resolution
|
|
||||||
///
|
|
||||||
/// The `high_resolution_clock` is usually an alias for other
|
|
||||||
/// clocks: `steady_clock` or `system_clock`, whichever has a
|
|
||||||
/// higher precision.
|
|
||||||
///
|
|
||||||
/// `Clock`, however, is aimed towards monotonic time
|
|
||||||
/// measurements and so `system_clock` could never be a choice
|
|
||||||
/// as its subject to discontinuous jumps in the system time
|
|
||||||
/// (e.g., if the system administrator manually changes
|
|
||||||
/// the clock), and by the incremental adjustments performed
|
|
||||||
/// by `adjtime` and Network Time Protocol. On the other
|
|
||||||
/// hand, monotonic clocks are unaffected by this behavior.
|
|
||||||
///
|
|
||||||
/// Note: Linux implementation of a monotonic clock that
|
|
||||||
/// takes sleep time into account is represented by
|
|
||||||
/// `CLOCK_BOOTTIME`. Android devices can define the macro:
|
|
||||||
/// `SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK` to use a separate
|
|
||||||
/// implementation of that clock, instead.
|
|
||||||
///
|
|
||||||
/// For more information on Linux clocks visit:
|
|
||||||
/// https://linux.die.net/man/2/clock_gettime
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if defined(SFML_SYSTEM_ANDROID) && defined(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK)
|
|
||||||
using ClockImpl = SuspendAwareClock;
|
|
||||||
#else
|
|
||||||
using ClockImpl = std::conditional_t<std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock>;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static_assert(ClockImpl::is_steady, "Provided implementation is not a monotonic clock");
|
|
||||||
static_assert(std::ratio_less_equal_v<ClockImpl::period, std::micro>,
|
|
||||||
"Clock resolution is too low. Expecting at least a microsecond precision");
|
|
||||||
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Utility class that measures the elapsed time
|
|
||||||
///
|
|
||||||
/// The clock starts automatically after being constructed.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API Clock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the elapsed time
|
|
||||||
///
|
|
||||||
/// This function returns the time elapsed since the last call
|
|
||||||
/// to `restart()` (or the construction of the instance if `restart()`
|
|
||||||
/// has not been called).
|
|
||||||
///
|
|
||||||
/// \return Time elapsed
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Time getElapsedTime() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Check whether the clock is running
|
|
||||||
///
|
|
||||||
/// \return `true` if the clock is running, `false` otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool isRunning() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Start the clock
|
|
||||||
///
|
|
||||||
/// \see `stop`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void start();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Stop the clock
|
|
||||||
///
|
|
||||||
/// \see `start`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Restart the clock
|
|
||||||
///
|
|
||||||
/// This function puts the time counter back to zero, returns
|
|
||||||
/// the elapsed time, and leaves the clock in a running state.
|
|
||||||
///
|
|
||||||
/// \return Time elapsed
|
|
||||||
///
|
|
||||||
/// \see `reset`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Time restart();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Reset the clock
|
|
||||||
///
|
|
||||||
/// This function puts the time counter back to zero, returns
|
|
||||||
/// the elapsed time, and leaves the clock in a paused state.
|
|
||||||
///
|
|
||||||
/// \return Time elapsed
|
|
||||||
///
|
|
||||||
/// \see `restart`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Time reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ClockImpl::time_point m_refPoint{ClockImpl::now()}; //!< Time of last reset
|
|
||||||
ClockImpl::time_point m_stopPoint; //!< Time of last stop
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Clock
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// `Clock` is a lightweight class for measuring time.
|
|
||||||
///
|
|
||||||
/// It provides the most precise time that the underlying
|
|
||||||
/// OS can achieve (generally microseconds or nanoseconds).
|
|
||||||
/// It also ensures monotonicity, which means that the returned
|
|
||||||
/// time can never go backward, even if the system time is
|
|
||||||
/// changed.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// Clock clock;
|
|
||||||
/// ...
|
|
||||||
/// Time time1 = clock.getElapsedTime();
|
|
||||||
/// ...
|
|
||||||
/// Time time2 = clock.restart();
|
|
||||||
/// ...
|
|
||||||
/// Time time3 = clock.reset();
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// The `Time` value returned by the clock can then be
|
|
||||||
/// converted to a number of seconds, milliseconds or even
|
|
||||||
/// microseconds.
|
|
||||||
///
|
|
||||||
/// \see `Time`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
77
third_party/sfml/include/SFML/System/Err.hpp
vendored
77
third_party/sfml/include/SFML/System/Err.hpp
vendored
@@ -1,77 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <iosfwd>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Standard stream used by SFML to output warnings and errors
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API std::ostream& err();
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \fn err
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// By default, `err()` outputs to the same location as `std::cerr`,
|
|
||||||
/// (-> the stderr descriptor) which is the console if there's
|
|
||||||
/// one available.
|
|
||||||
///
|
|
||||||
/// It is a standard `std::ostream` instance, so it supports all the
|
|
||||||
/// insertion operations defined by the STL
|
|
||||||
/// (`operator<<`, manipulators, etc.).
|
|
||||||
///
|
|
||||||
/// `err()` can be redirected to write to another output, independently
|
|
||||||
/// of `std::cerr`, by using the `rdbuf()` function provided by the
|
|
||||||
/// `std::ostream` class.
|
|
||||||
///
|
|
||||||
/// Example:
|
|
||||||
/// \code
|
|
||||||
/// // Redirect to a file
|
|
||||||
/// std::ofstream file("sfml-log.txt");
|
|
||||||
/// std::streambuf* previous = err().rdbuf(file.rdbuf());
|
|
||||||
///
|
|
||||||
/// // Redirect to nothing
|
|
||||||
/// err().rdbuf(nullptr);
|
|
||||||
///
|
|
||||||
/// // Restore the original output
|
|
||||||
/// err().rdbuf(previous);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \return Reference to `std::ostream` representing the SFML error stream
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
@@ -1,46 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Library-specific exception type
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API Exception : public std::runtime_error
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using std::runtime_error::runtime_error;
|
|
||||||
};
|
|
||||||
} // namespace sf
|
|
44
third_party/sfml/include/SFML/System/Export.hpp
vendored
44
third_party/sfml/include/SFML/System/Export.hpp
vendored
@@ -1,44 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Portable import / export macros
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#if defined(SFML_SYSTEM_EXPORTS)
|
|
||||||
|
|
||||||
#define SFML_SYSTEM_API SFML_API_EXPORT
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define SFML_SYSTEM_API SFML_API_IMPORT
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,212 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/InputStream.hpp>
|
|
||||||
|
|
||||||
#include "filesystem.hpp"
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class SFML_SYSTEM_API ResourceStream;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Implementation of input stream based on a file
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API FileInputStream : public InputStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// Construct a file input stream that is not associated
|
|
||||||
/// with a file to read.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FileInputStream();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default destructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
~FileInputStream() override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FileInputStream(const FileInputStream&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted copy assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FileInputStream& operator=(const FileInputStream&) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FileInputStream(FileInputStream&&) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Move assignment
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
FileInputStream& operator=(FileInputStream&&) noexcept;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the stream from a file path
|
|
||||||
///
|
|
||||||
/// \param filename Name of the file to open
|
|
||||||
///
|
|
||||||
/// \throws Exception on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
explicit FileInputStream(const ghc::filesystem::path& filename);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Open the stream from a file path
|
|
||||||
///
|
|
||||||
/// \param filename Name of the file to open
|
|
||||||
///
|
|
||||||
/// \return `true` on success, `false` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool open(const ghc::filesystem::path& filename);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Read data from the stream
|
|
||||||
///
|
|
||||||
/// After reading, the stream's reading position must be
|
|
||||||
/// advanced by the amount of bytes read.
|
|
||||||
///
|
|
||||||
/// \param data Buffer where to copy the read data
|
|
||||||
/// \param size Desired number of bytes to read
|
|
||||||
///
|
|
||||||
/// \return The number of bytes actually read, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> read(void* data, std::size_t size) override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Change the current reading position
|
|
||||||
///
|
|
||||||
/// \param position The position to seek to, from the beginning
|
|
||||||
///
|
|
||||||
/// \return The position actually sought to, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> seek(std::size_t position) override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the current reading position in the stream
|
|
||||||
///
|
|
||||||
/// \return The current position, or `nonstd::nullopt` on error.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> tell() override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the size of the stream
|
|
||||||
///
|
|
||||||
/// \return The total number of bytes available in the stream, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
nonstd::optional<std::size_t> getSize() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleter for stdio file stream that closes the file stream
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
struct FileCloser
|
|
||||||
{
|
|
||||||
void operator()(std::FILE* file);
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
|
||||||
std::unique_ptr<ResourceStream> m_androidFile;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unique_ptr<std::FILE, FileCloser> m_file; //!< stdio file stream
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class FileInputStream
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// This class is a specialization of `InputStream` that
|
|
||||||
/// reads from a file on disk.
|
|
||||||
///
|
|
||||||
/// It wraps a file in the common `InputStream` interface
|
|
||||||
/// and therefore allows to use generic classes or functions
|
|
||||||
/// that accept such a stream, with a file on disk as the data
|
|
||||||
/// source.
|
|
||||||
///
|
|
||||||
/// In addition to the virtual functions inherited from
|
|
||||||
/// `InputStream`, `FileInputStream` adds a function to
|
|
||||||
/// specify the file to open.
|
|
||||||
///
|
|
||||||
/// SFML resource classes can usually be loaded directly from
|
|
||||||
/// a filename, so this class shouldn't be useful to you unless
|
|
||||||
/// you create your own algorithms that operate on an InputStream.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// void process(InputStream& stream);
|
|
||||||
///
|
|
||||||
/// nonstd::optional stream = FileInputStream::open("some_file.dat");
|
|
||||||
/// if (stream)
|
|
||||||
/// process(*stream);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `InputStream`, `MemoryInputStream`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
166
third_party/sfml/include/SFML/System/InputStream.hpp
vendored
166
third_party/sfml/include/SFML/System/InputStream.hpp
vendored
@@ -1,166 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <optional.hpp>
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Abstract class for custom file input streams
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API InputStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Virtual destructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual ~InputStream() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Read data from the stream
|
|
||||||
///
|
|
||||||
/// After reading, the stream's reading position must be
|
|
||||||
/// advanced by the amount of bytes read.
|
|
||||||
///
|
|
||||||
/// \param data Buffer where to copy the read data
|
|
||||||
/// \param size Desired number of bytes to read
|
|
||||||
///
|
|
||||||
/// \return The number of bytes actually read, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] virtual nonstd::optional<std::size_t> read(void* data, std::size_t size) = 0;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Change the current reading position
|
|
||||||
///
|
|
||||||
/// \param position The position to seek to, from the beginning
|
|
||||||
///
|
|
||||||
/// \return The position actually sought to, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] virtual nonstd::optional<std::size_t> seek(std::size_t position) = 0;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the current reading position in the stream
|
|
||||||
///
|
|
||||||
/// \return The current position, or `nonstd::nullopt` on error.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] virtual nonstd::optional<std::size_t> tell() = 0;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the size of the stream
|
|
||||||
///
|
|
||||||
/// \return The total number of bytes available in the stream, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
virtual nonstd::optional<std::size_t> getSize() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class InputStream
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// This class allows users to define their own file input sources
|
|
||||||
/// from which SFML can load resources.
|
|
||||||
///
|
|
||||||
/// SFML resource classes like `Texture` and
|
|
||||||
/// `SoundBuffer` provide `loadFromFile` and `loadFromMemory` functions,
|
|
||||||
/// which read data from conventional sources. However, if you
|
|
||||||
/// have data coming from a different source (over a network,
|
|
||||||
/// embedded, encrypted, compressed, etc) you can derive your
|
|
||||||
/// own class from `InputStream` and load SFML resources with
|
|
||||||
/// their `loadFromStream` function.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// // custom stream class that reads from inside a zip file
|
|
||||||
/// class ZipStream : public InputStream
|
|
||||||
/// {
|
|
||||||
/// public:
|
|
||||||
///
|
|
||||||
/// ZipStream(const std::string& archive);
|
|
||||||
///
|
|
||||||
/// [[nodiscard]] bool open(const ghc::filesystem::path& filename);
|
|
||||||
///
|
|
||||||
/// [[nodiscard]] nonstd::optional<std::size_t> read(void* data, std::size_t size);
|
|
||||||
///
|
|
||||||
/// [[nodiscard]] nonstd::optional<std::size_t> seek(std::size_t position);
|
|
||||||
///
|
|
||||||
/// [[nodiscard]] nonstd::optional<std::size_t> tell();
|
|
||||||
///
|
|
||||||
/// nonstd::optional<std::size_t> getSize();
|
|
||||||
///
|
|
||||||
/// private:
|
|
||||||
///
|
|
||||||
/// ...
|
|
||||||
/// };
|
|
||||||
///
|
|
||||||
/// // now you can load textures...
|
|
||||||
/// ZipStream stream("resources.zip");
|
|
||||||
///
|
|
||||||
/// if (!stream.open("images/img.png"))
|
|
||||||
/// {
|
|
||||||
/// // Handle error...
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// const Texture texture(stream);
|
|
||||||
///
|
|
||||||
/// // musics...
|
|
||||||
/// Music music;
|
|
||||||
/// ZipStream stream("resources.zip");
|
|
||||||
///
|
|
||||||
/// if (!stream.open("musics/msc.ogg"))
|
|
||||||
/// {
|
|
||||||
/// // Handle error...
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// if (!music.openFromStream(stream))
|
|
||||||
/// {
|
|
||||||
/// // Handle error...
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// // etc.
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `FileInputStream`, `MemoryInputStream`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
@@ -1,139 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Config.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/InputStream.hpp>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Implementation of input stream based on a memory chunk
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API MemoryInputStream : public InputStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct the stream from its data
|
|
||||||
///
|
|
||||||
/// \param data Pointer to the data in memory
|
|
||||||
/// \param sizeInBytes Size of the data, in bytes
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
MemoryInputStream(const void* data, std::size_t sizeInBytes);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Read data from the stream
|
|
||||||
///
|
|
||||||
/// After reading, the stream's reading position must be
|
|
||||||
/// advanced by the amount of bytes read.
|
|
||||||
///
|
|
||||||
/// \param data Buffer where to copy the read data
|
|
||||||
/// \param size Desired number of bytes to read
|
|
||||||
///
|
|
||||||
/// \return The number of bytes actually read, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> read(void* data, std::size_t size) override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Change the current reading position
|
|
||||||
///
|
|
||||||
/// \param position The position to seek to, from the beginning
|
|
||||||
///
|
|
||||||
/// \return The position actually sought to, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> seek(std::size_t position) override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the current reading position in the stream
|
|
||||||
///
|
|
||||||
/// \return The current position, or `nonstd::nullopt` on error.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] nonstd::optional<std::size_t> tell() override;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the size of the stream
|
|
||||||
///
|
|
||||||
/// \return The total number of bytes available in the stream, or `nonstd::nullopt` on error
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
nonstd::optional<std::size_t> getSize() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
const unsigned char* m_data{}; //!< Pointer to the data in memory
|
|
||||||
std::size_t m_size{}; //!< Total size of the data
|
|
||||||
std::size_t m_offset{}; //!< Current reading position
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class MemoryInputStream
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// This class is a specialization of `InputStream` that
|
|
||||||
/// reads from data in memory.
|
|
||||||
///
|
|
||||||
/// It wraps a memory chunk in the common `InputStream` interface
|
|
||||||
/// and therefore allows to use generic classes or functions
|
|
||||||
/// that accept such a stream, with content already loaded in memory.
|
|
||||||
///
|
|
||||||
/// In addition to the virtual functions inherited from
|
|
||||||
/// `InputStream`, `MemoryInputStream` adds a function to
|
|
||||||
/// specify the pointer and size of the data in memory.
|
|
||||||
///
|
|
||||||
/// SFML resource classes can usually be loaded directly from
|
|
||||||
/// memory, so this class shouldn't be useful to you unless
|
|
||||||
/// you create your own algorithms that operate on an InputStream.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// void process(InputStream& stream);
|
|
||||||
///
|
|
||||||
/// MemoryInputStream stream(thePtr, theSize);
|
|
||||||
/// process(stream);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `InputStream`, `FileInputStream`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
@@ -1,58 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(SFML_SYSTEM_ANDROID)
|
|
||||||
#error NativeActivity.hpp: This header is Android only.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct ANativeActivity;
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \ingroup system
|
|
||||||
/// \brief Return a pointer to the Android native activity
|
|
||||||
///
|
|
||||||
/// You shouldn't have to use this function, unless you want
|
|
||||||
/// to implement very specific details, that SFML doesn't
|
|
||||||
/// support, or to use a workaround for a known issue.
|
|
||||||
///
|
|
||||||
/// \return Pointer to Android native activity structure
|
|
||||||
///
|
|
||||||
/// \sfplatform{Android,SFML/System/NativeActivity.hpp}
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API ANativeActivity* getNativeActivity();
|
|
||||||
|
|
||||||
} // namespace sf
|
|
57
third_party/sfml/include/SFML/System/Sleep.hpp
vendored
57
third_party/sfml/include/SFML/System/Sleep.hpp
vendored
@@ -1,57 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \ingroup system
|
|
||||||
/// \brief Make the current thread sleep for a given duration
|
|
||||||
///
|
|
||||||
/// `sleep` is the best way to block a program or one of its
|
|
||||||
/// threads, as it doesn't consume any CPU power. Compared to
|
|
||||||
/// the standard `std::this_thread::sleep_for` function, this
|
|
||||||
/// one provides more accurate sleeping time thanks to some
|
|
||||||
/// platform-specific tweaks.
|
|
||||||
///
|
|
||||||
/// `sleep` only guarantees millisecond precision. Sleeping
|
|
||||||
/// for a duration less than 1 millisecond is prone to result
|
|
||||||
/// in the actual sleep duration being less than what is
|
|
||||||
/// requested.
|
|
||||||
///
|
|
||||||
/// \param duration Time to sleep
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void SFML_SYSTEM_API sleep(Time duration);
|
|
||||||
|
|
||||||
} // namespace sf
|
|
700
third_party/sfml/include/SFML/System/String.hpp
vendored
700
third_party/sfml/include/SFML/System/String.hpp
vendored
@@ -1,700 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <SFML/System/Utf.hpp>
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Character traits for `std::uint8_t`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
struct SFML_SYSTEM_API U8StringCharTraits
|
|
||||||
{
|
|
||||||
// NOLINTBEGIN(readability-identifier-naming)
|
|
||||||
using char_type = std::uint8_t;
|
|
||||||
using int_type = std::char_traits<char>::int_type;
|
|
||||||
using off_type = std::char_traits<char>::off_type;
|
|
||||||
using pos_type = std::char_traits<char>::pos_type;
|
|
||||||
using state_type = std::char_traits<char>::state_type;
|
|
||||||
|
|
||||||
static void assign(char_type& c1, char_type c2) noexcept;
|
|
||||||
static char_type* assign(char_type* s, std::size_t n, char_type c);
|
|
||||||
static bool eq(char_type c1, char_type c2) noexcept;
|
|
||||||
static bool lt(char_type c1, char_type c2) noexcept;
|
|
||||||
static char_type* move(char_type* s1, const char_type* s2, std::size_t n);
|
|
||||||
static char_type* copy(char_type* s1, const char_type* s2, std::size_t n);
|
|
||||||
static int compare(const char_type* s1, const char_type* s2, std::size_t n);
|
|
||||||
static std::size_t length(const char_type* s);
|
|
||||||
static const char_type* find(const char_type* s, std::size_t n, const char_type& c);
|
|
||||||
static char_type to_char_type(int_type i) noexcept;
|
|
||||||
static int_type to_int_type(char_type c) noexcept;
|
|
||||||
static bool eq_int_type(int_type i1, int_type i2) noexcept;
|
|
||||||
static int_type eof() noexcept;
|
|
||||||
static int_type not_eof(int_type i) noexcept;
|
|
||||||
// NOLINTEND(readability-identifier-naming)
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Portable replacement for `std::basic_string<std::uint8_t>`
|
|
||||||
///
|
|
||||||
/// While all major C++ implementations happen to define this
|
|
||||||
/// as of early 2024, this specialization is not strictly speaking
|
|
||||||
/// standard C++. Thus we can't depend on its continued existence.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
using U8String = std::basic_string<std::uint8_t, U8StringCharTraits>;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Utility string class that automatically handles
|
|
||||||
/// conversions between types and encodings
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class SFML_SYSTEM_API String
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Types
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
using Iterator = std::u32string::iterator; //!< Iterator type
|
|
||||||
using ConstIterator = std::u32string::const_iterator; //!< Read-only iterator type
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTBEGIN(readability-identifier-naming)
|
|
||||||
/// Represents an invalid position in the string
|
|
||||||
static const std::size_t InvalidPos{std::u32string::npos};
|
|
||||||
// NOLINTEND(readability-identifier-naming)
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// This constructor creates an empty string.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Deleted `std::nullptr_t` constructor
|
|
||||||
///
|
|
||||||
/// Disallow construction from `nullptr` literal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(std::nullptr_t, const std::locale& = {}) = delete;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from a single ANSI character and a locale
|
|
||||||
///
|
|
||||||
/// The source character is converted to UTF-32 according
|
|
||||||
/// to the given locale.
|
|
||||||
///
|
|
||||||
/// \param ansiChar ANSI character to convert
|
|
||||||
/// \param locale Locale to use for conversion
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(char ansiChar, const std::locale& locale = {});
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from single wide character
|
|
||||||
///
|
|
||||||
/// \param wideChar Wide character to convert
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(wchar_t wideChar);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from single UTF-32 character
|
|
||||||
///
|
|
||||||
/// \param utf32Char UTF-32 character to convert
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(char32_t utf32Char);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from a null-terminated C-style ANSI string and a locale
|
|
||||||
///
|
|
||||||
/// The source string is converted to UTF-32 according
|
|
||||||
/// to the given locale.
|
|
||||||
///
|
|
||||||
/// \param ansiString ANSI string to convert
|
|
||||||
/// \param locale Locale to use for conversion
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(const char* ansiString, const std::locale& locale = {});
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from an ANSI string and a locale
|
|
||||||
///
|
|
||||||
/// The source string is converted to UTF-32 according
|
|
||||||
/// to the given locale.
|
|
||||||
///
|
|
||||||
/// \param ansiString ANSI string to convert
|
|
||||||
/// \param locale Locale to use for conversion
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(const std::string& ansiString, const std::locale& locale = {});
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from null-terminated C-style wide string
|
|
||||||
///
|
|
||||||
/// \param wideString Wide string to convert
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(const wchar_t* wideString);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from a wide string
|
|
||||||
///
|
|
||||||
/// \param wideString Wide string to convert
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(const std::wstring& wideString);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from a null-terminated C-style UTF-32 string
|
|
||||||
///
|
|
||||||
/// \param utf32String UTF-32 string to assign
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(const char32_t* utf32String);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from an UTF-32 string
|
|
||||||
///
|
|
||||||
/// \param utf32String UTF-32 string to assign
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String(std::u32string utf32String);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a new `String` from a UTF-8 encoded string
|
|
||||||
///
|
|
||||||
/// \param begin Forward iterator to the beginning of the UTF-8 sequence
|
|
||||||
/// \param end Forward iterator to the end of the UTF-8 sequence
|
|
||||||
///
|
|
||||||
/// \return A `String` containing the source string
|
|
||||||
///
|
|
||||||
/// \see `fromUtf16`, `fromUtf32`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] static String fromUtf8(T begin, T end);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a new `String` from a UTF-16 encoded string
|
|
||||||
///
|
|
||||||
/// \param begin Forward iterator to the beginning of the UTF-16 sequence
|
|
||||||
/// \param end Forward iterator to the end of the UTF-16 sequence
|
|
||||||
///
|
|
||||||
/// \return A `String` containing the source string
|
|
||||||
///
|
|
||||||
/// \see `fromUtf8`, `fromUtf32`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] static String fromUtf16(T begin, T end);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a new `String` from a UTF-32 encoded string
|
|
||||||
///
|
|
||||||
/// This function is provided for consistency, it is equivalent to
|
|
||||||
/// using the constructors that takes a `const char32_t*` or
|
|
||||||
/// a `std::u32string`.
|
|
||||||
///
|
|
||||||
/// \param begin Forward iterator to the beginning of the UTF-32 sequence
|
|
||||||
/// \param end Forward iterator to the end of the UTF-32 sequence
|
|
||||||
///
|
|
||||||
/// \return A `String` containing the source string
|
|
||||||
///
|
|
||||||
/// \see `fromUtf8`, `fromUtf16`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] static String fromUtf32(T begin, T end);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Implicit conversion operator to `std::string` (ANSI string)
|
|
||||||
///
|
|
||||||
/// The current global locale is used for conversion. If you
|
|
||||||
/// want to explicitly specify a locale, see toAnsiString.
|
|
||||||
/// Characters that do not fit in the target encoding are
|
|
||||||
/// discarded from the returned string.
|
|
||||||
/// This operator is defined for convenience, and is equivalent
|
|
||||||
/// to calling `toAnsiString()`.
|
|
||||||
///
|
|
||||||
/// \return Converted ANSI string
|
|
||||||
///
|
|
||||||
/// \see `toAnsiString`, `operator std::wstring`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
operator std::string() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Implicit conversion operator to `std::wstring` (wide string)
|
|
||||||
///
|
|
||||||
/// Characters that do not fit in the target encoding are
|
|
||||||
/// discarded from the returned string.
|
|
||||||
/// This operator is defined for convenience, and is equivalent
|
|
||||||
/// to calling `toWideString()`.
|
|
||||||
///
|
|
||||||
/// \return Converted wide string
|
|
||||||
///
|
|
||||||
/// \see `toWideString`, `operator std::string`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
operator std::wstring() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Convert the Unicode string to an ANSI string
|
|
||||||
///
|
|
||||||
/// The UTF-32 string is converted to an ANSI string in
|
|
||||||
/// the encoding defined by `locale`.
|
|
||||||
/// Characters that do not fit in the target encoding are
|
|
||||||
/// discarded from the returned string.
|
|
||||||
///
|
|
||||||
/// \param locale Locale to use for conversion
|
|
||||||
///
|
|
||||||
/// \return Converted ANSI string
|
|
||||||
///
|
|
||||||
/// \see `toWideString`, `operator std::string`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::string toAnsiString(const std::locale& locale = {}) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Convert the Unicode string to a wide string
|
|
||||||
///
|
|
||||||
/// Characters that do not fit in the target encoding are
|
|
||||||
/// discarded from the returned string.
|
|
||||||
///
|
|
||||||
/// \return Converted wide string
|
|
||||||
///
|
|
||||||
/// \see `toAnsiString`, `operator std::wstring`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::wstring toWideString() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Convert the Unicode string to a UTF-8 string
|
|
||||||
///
|
|
||||||
/// \return Converted UTF-8 string
|
|
||||||
///
|
|
||||||
/// \see `toUtf16`, `toUtf32`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] U8String toUtf8() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Convert the Unicode string to a UTF-16 string
|
|
||||||
///
|
|
||||||
/// \return Converted UTF-16 string
|
|
||||||
///
|
|
||||||
/// \see `toUtf8`, `toUtf32`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::u16string toUtf16() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Convert the Unicode string to a UTF-32 string
|
|
||||||
///
|
|
||||||
/// This function doesn't perform any conversion, since the
|
|
||||||
/// string is already stored as UTF-32 internally.
|
|
||||||
///
|
|
||||||
/// \return Converted UTF-32 string
|
|
||||||
///
|
|
||||||
/// \see `toUtf8`, `toUtf16`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::u32string toUtf32() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator+=` to append an UTF-32 string
|
|
||||||
///
|
|
||||||
/// \param right String to append
|
|
||||||
///
|
|
||||||
/// \return Reference to self
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
String& operator+=(const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator[]` to access a character by its position
|
|
||||||
///
|
|
||||||
/// This function provides read-only access to characters.
|
|
||||||
/// Note: the behavior is undefined if `index` is out of range.
|
|
||||||
///
|
|
||||||
/// \param index Index of the character to get
|
|
||||||
///
|
|
||||||
/// \return Character at position `index`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] char32_t operator[](std::size_t index) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Overload of `operator[]` to access a character by its position
|
|
||||||
///
|
|
||||||
/// This function provides read and write access to characters.
|
|
||||||
/// Note: the behavior is undefined if `index` is out of range.
|
|
||||||
///
|
|
||||||
/// \param index Index of the character to get
|
|
||||||
///
|
|
||||||
/// \return Reference to the character at position `index`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] char32_t& operator[](std::size_t index);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Clear the string
|
|
||||||
///
|
|
||||||
/// This function removes all the characters from the string.
|
|
||||||
///
|
|
||||||
/// \see `isEmpty`, `erase`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the size of the string
|
|
||||||
///
|
|
||||||
/// \return Number of characters in the string
|
|
||||||
///
|
|
||||||
/// \see `isEmpty`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::size_t getSize() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Check whether the string is empty or not
|
|
||||||
///
|
|
||||||
/// \return `true` if the string is empty (i.e. contains no character)
|
|
||||||
///
|
|
||||||
/// \see `clear`, `getSize`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] bool isEmpty() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Erase one or more characters from the string
|
|
||||||
///
|
|
||||||
/// This function removes a sequence of `count` characters
|
|
||||||
/// starting from `position`.
|
|
||||||
///
|
|
||||||
/// \param position Position of the first character to erase
|
|
||||||
/// \param count Number of characters to erase
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void erase(std::size_t position, std::size_t count = 1);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Insert one or more characters into the string
|
|
||||||
///
|
|
||||||
/// This function inserts the characters of `str`
|
|
||||||
/// into the string, starting from `position`.
|
|
||||||
///
|
|
||||||
/// \param position Position of insertion
|
|
||||||
/// \param str Characters to insert
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void insert(std::size_t position, const String& str);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Find a sequence of one or more characters in the string
|
|
||||||
///
|
|
||||||
/// This function searches for the characters of `str`
|
|
||||||
/// in the string, starting from `start`.
|
|
||||||
///
|
|
||||||
/// \param str Characters to find
|
|
||||||
/// \param start Where to begin searching
|
|
||||||
///
|
|
||||||
/// \return Position of `str` in the string, or `String::InvalidPos` if not found
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] std::size_t find(const String& str, std::size_t start = 0) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Replace a substring with another string
|
|
||||||
///
|
|
||||||
/// This function replaces the substring that starts at index `position`
|
|
||||||
/// and spans `length` characters with the string `replaceWith`.
|
|
||||||
///
|
|
||||||
/// \param position Index of the first character to be replaced
|
|
||||||
/// \param length Number of characters to replace. You can pass InvalidPos to
|
|
||||||
/// replace all characters until the end of the string.
|
|
||||||
/// \param replaceWith String that replaces the given substring.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void replace(std::size_t position, std::size_t length, const String& replaceWith);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Replace all occurrences of a substring with a replacement string
|
|
||||||
///
|
|
||||||
/// This function replaces all occurrences of `searchFor` in this string
|
|
||||||
/// with the string `replaceWith`.
|
|
||||||
///
|
|
||||||
/// \param searchFor The value being searched for
|
|
||||||
/// \param replaceWith The value that replaces found `searchFor` values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void replace(const String& searchFor, const String& replaceWith);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return a part of the string
|
|
||||||
///
|
|
||||||
/// This function returns the substring that starts at index `position`
|
|
||||||
/// and spans `length` characters.
|
|
||||||
///
|
|
||||||
/// \param position Index of the first character
|
|
||||||
/// \param length Number of characters to include in the substring (if
|
|
||||||
/// the string is shorter, as many characters as possible
|
|
||||||
/// are included). `InvalidPos` can be used to include all
|
|
||||||
/// characters until the end of the string.
|
|
||||||
///
|
|
||||||
/// \return String object containing a substring of this object
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] String substring(std::size_t position, std::size_t length = InvalidPos) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get a pointer to the C-style array of characters
|
|
||||||
///
|
|
||||||
/// This functions provides a read-only access to a
|
|
||||||
/// null-terminated C-style representation of the string.
|
|
||||||
/// The returned pointer is temporary and is meant only for
|
|
||||||
/// immediate use, thus it is not recommended to store it.
|
|
||||||
///
|
|
||||||
/// \return Read-only pointer to the array of characters
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] const char32_t* getData() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return an iterator to the beginning of the string
|
|
||||||
///
|
|
||||||
/// \return Read-write iterator to the beginning of the string characters
|
|
||||||
///
|
|
||||||
/// \see `end`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Iterator begin();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return an iterator to the beginning of the string
|
|
||||||
///
|
|
||||||
/// \return Read-only iterator to the beginning of the string characters
|
|
||||||
///
|
|
||||||
/// \see `end`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] ConstIterator begin() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return an iterator to the end of the string
|
|
||||||
///
|
|
||||||
/// The end iterator refers to 1 position past the last character;
|
|
||||||
/// thus it represents an invalid character and should never be
|
|
||||||
/// accessed.
|
|
||||||
///
|
|
||||||
/// \return Read-write iterator to the end of the string characters
|
|
||||||
///
|
|
||||||
/// \see `begin`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] Iterator end();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return an iterator to the end of the string
|
|
||||||
///
|
|
||||||
/// The end iterator refers to 1 position past the last character;
|
|
||||||
/// thus it represents an invalid character and should never be
|
|
||||||
/// accessed.
|
|
||||||
///
|
|
||||||
/// \return Read-only iterator to the end of the string characters
|
|
||||||
///
|
|
||||||
/// \see `begin`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] ConstIterator end() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend SFML_SYSTEM_API bool operator==(const String& left, const String& right);
|
|
||||||
friend SFML_SYSTEM_API bool operator<(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::u32string m_string; //!< Internal string of UTF-32 characters
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator==` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if both strings are equal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator==(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator!=` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if both strings are different
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator!=(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator<` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lexicographically before `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator<(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator>` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lexicographically after `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator>(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator<=` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lexicographically before or equivalent to `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator<=(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of `operator>=` to compare two UTF-32 strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lexicographically after or equivalent to `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API bool operator>=(const String& left, const String& right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates String
|
|
||||||
/// \brief Overload of binary `operator+` to concatenate two strings
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a string)
|
|
||||||
/// \param right Right operand (a string)
|
|
||||||
///
|
|
||||||
/// \return Concatenated string
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] SFML_SYSTEM_API String operator+(const String& left, const String& right);
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
#include <SFML/System/String.inl>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class String
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// `String` is a utility string class defined mainly for
|
|
||||||
/// convenience. It is a Unicode string (implemented using
|
|
||||||
/// UTF-32), thus it can store any character in the world
|
|
||||||
/// (European, Chinese, Arabic, Hebrew, etc.).
|
|
||||||
///
|
|
||||||
/// It automatically handles conversions from/to ANSI and
|
|
||||||
/// wide strings, so that you can work with standard string
|
|
||||||
/// classes and still be compatible with functions taking a
|
|
||||||
/// `String`.
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// String s;
|
|
||||||
///
|
|
||||||
/// std::string s1 = s; // automatically converted to ANSI string
|
|
||||||
/// std::wstring s2 = s; // automatically converted to wide string
|
|
||||||
/// s = "hello"; // automatically converted from ANSI string
|
|
||||||
/// s = L"hello"; // automatically converted from wide string
|
|
||||||
/// s += 'a'; // automatically converted from ANSI string
|
|
||||||
/// s += L'a'; // automatically converted from wide string
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// Conversions involving ANSI strings use the default user locale. However
|
|
||||||
/// it is possible to use a custom locale if necessary:
|
|
||||||
/// \code
|
|
||||||
/// std::locale locale;
|
|
||||||
/// String s;
|
|
||||||
/// ...
|
|
||||||
/// std::string s1 = s.toAnsiString(locale);
|
|
||||||
/// s = String("hello", locale);
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// `String` defines the most important functions of the
|
|
||||||
/// standard `std::string` class: removing, random access, iterating,
|
|
||||||
/// appending, comparing, etc. However it is a simple class
|
|
||||||
/// provided for convenience, and you may have to consider using
|
|
||||||
/// a more optimized class if your program requires complex string
|
|
||||||
/// handling. The automatic conversion functions will then take
|
|
||||||
/// care of converting your string to `String` whenever SFML
|
|
||||||
/// requires it.
|
|
||||||
///
|
|
||||||
/// Please note that SFML also defines a low-level, generic
|
|
||||||
/// interface for Unicode handling, see the `Utf` classes.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
64
third_party/sfml/include/SFML/System/String.inl
vendored
64
third_party/sfml/include/SFML/System/String.inl
vendored
@@ -1,64 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/String.hpp> // NOLINT(misc-header-include-cycle)
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
String String::fromUtf8(T begin, T end)
|
|
||||||
{
|
|
||||||
String string;
|
|
||||||
Utf8::toUtf32(begin, end, std::back_inserter(string.m_string));
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
String String::fromUtf16(T begin, T end)
|
|
||||||
{
|
|
||||||
String string;
|
|
||||||
Utf16::toUtf32(begin, end, std::back_inserter(string.m_string));
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename T>
|
|
||||||
String String::fromUtf32(T begin, T end)
|
|
||||||
{
|
|
||||||
String string;
|
|
||||||
string.m_string.assign(begin, end);
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sf
|
|
@@ -1,76 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Export.hpp>
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Android, chrono-compatible, suspend-aware clock
|
|
||||||
///
|
|
||||||
/// Linux steady clock is represented by `CLOCK_MONOTONIC`.
|
|
||||||
/// However, this implementation does not work properly for
|
|
||||||
/// long-running clocks that work in the background when the
|
|
||||||
/// system is suspended.
|
|
||||||
///
|
|
||||||
/// `SuspendAwareClock` uses `CLOCK_BOOTTIME` which is identical
|
|
||||||
/// to `CLOCK_MONOTONIC`, except that it also includes any time
|
|
||||||
/// that the system is suspended.
|
|
||||||
///
|
|
||||||
/// Note: In most cases, `CLOCK_MONOTONIC` is a better choice.
|
|
||||||
/// Make sure this implementation is required for your use case.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
struct SFML_SYSTEM_API SuspendAwareClock
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Type traits and static members
|
|
||||||
///
|
|
||||||
/// These type traits and static members meet the requirements
|
|
||||||
/// of a Clock concept in the C++ Standard. More specifically,
|
|
||||||
/// TrivialClock requirements are met. Thus, naming convention
|
|
||||||
/// has been kept consistent to allow for extended use e.g.
|
|
||||||
/// https://en.cppreference.com/w/cpp/chrono/is_clock
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
using duration = std::chrono::nanoseconds;
|
|
||||||
using rep = duration::rep;
|
|
||||||
using period = duration::period;
|
|
||||||
using time_point = std::chrono::time_point<SuspendAwareClock, duration>;
|
|
||||||
|
|
||||||
static constexpr bool is_steady = true; // NOLINT(readability-identifier-naming)
|
|
||||||
|
|
||||||
static time_point now() noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf
|
|
500
third_party/sfml/include/SFML/System/Time.hpp
vendored
500
third_party/sfml/include/SFML/System/Time.hpp
vendored
@@ -1,500 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Represents a time value
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class Time
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Default constructor
|
|
||||||
///
|
|
||||||
/// Sets the time value to zero.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time() = default;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Construct from `std::chrono::duration`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename Rep, typename Period>
|
|
||||||
constexpr Time(const std::chrono::duration<Rep, Period>& duration);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the time value as a number of seconds
|
|
||||||
///
|
|
||||||
/// \return Time in seconds
|
|
||||||
///
|
|
||||||
/// \see `asMilliseconds`, `asMicroseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr float asSeconds() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the time value as a number of milliseconds
|
|
||||||
///
|
|
||||||
/// \return Time in milliseconds
|
|
||||||
///
|
|
||||||
/// \see `asSeconds`, `asMicroseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr std::int32_t asMilliseconds() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the time value as a number of microseconds
|
|
||||||
///
|
|
||||||
/// \return Time in microseconds
|
|
||||||
///
|
|
||||||
/// \see `asSeconds`, `asMilliseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr std::int64_t asMicroseconds() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the time value as a `std::chrono::duration`
|
|
||||||
///
|
|
||||||
/// \return Time in microseconds
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr std::chrono::microseconds toDuration() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Implicit conversion to `std::chrono::duration`
|
|
||||||
///
|
|
||||||
/// \return Duration in microseconds
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename Rep, typename Period>
|
|
||||||
constexpr operator std::chrono::duration<Rep, Period>() const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
||||||
static const Time Zero; //!< Predefined "zero" time value
|
|
||||||
|
|
||||||
private:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
std::chrono::microseconds m_microseconds{}; //!< Time value stored as microseconds
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Construct a time value from a number of seconds
|
|
||||||
///
|
|
||||||
/// \param amount Number of seconds
|
|
||||||
///
|
|
||||||
/// \return Time value constructed from the amount of seconds
|
|
||||||
///
|
|
||||||
/// \see `milliseconds`, `microseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time seconds(float amount);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Construct a time value from a number of milliseconds
|
|
||||||
///
|
|
||||||
/// \param amount Number of milliseconds
|
|
||||||
///
|
|
||||||
/// \return Time value constructed from the amount of milliseconds
|
|
||||||
///
|
|
||||||
/// \see `seconds`, `microseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time milliseconds(std::int32_t amount);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Construct a time value from a number of microseconds
|
|
||||||
///
|
|
||||||
/// \param amount Number of microseconds
|
|
||||||
///
|
|
||||||
/// \return Time value constructed from the amount of microseconds
|
|
||||||
///
|
|
||||||
/// \see `seconds`, `milliseconds`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time microseconds(std::int64_t amount);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator==` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if both time values are equal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator==(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator!=` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if both time values are different
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator!=(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator<` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lesser than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator<(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator>` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is greater than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator>(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator<=` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is lesser or equal than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator<=(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of `operator>=` to compare two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `true` if `left` is greater or equal than `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr bool operator>=(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of unary `operator-` to negate a time value
|
|
||||||
///
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return Opposite of the time value
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator-(Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator+` to add two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return Sum of the two times values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator+(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator+=` to add/assign two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return Sum of the two times values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator+=(Time& left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator-` to subtract two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return Difference of the two times values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator-(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator-=` to subtract/assign two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return Difference of the two times values
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator-=(Time& left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator*(Time left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator*(Time left, std::int64_t right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a number)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator*(float left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a number)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator*(std::int64_t left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*=` to scale/assign a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator*=(Time& left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator*=` to scale/assign a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` multiplied by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator*=(Time& left, std::int64_t right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator/` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator/(Time left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator/` to scale a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator/(Time left, std::int64_t right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator/=` to scale/assign a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator/=(Time& left, float right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator/=` to scale/assign a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a number)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator/=(Time& left, std::int64_t right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator/` to compute the ratio of two time values
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `left` divided by `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr float operator/(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator%` to compute remainder of a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `left` modulo `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] constexpr Time operator%(Time left, Time right);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \relates Time
|
|
||||||
/// \brief Overload of binary `operator%=` to compute/assign remainder of a time value
|
|
||||||
///
|
|
||||||
/// \param left Left operand (a time)
|
|
||||||
/// \param right Right operand (a time)
|
|
||||||
///
|
|
||||||
/// \return `left` modulo `right`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator%=(Time& left, Time right);
|
|
||||||
|
|
||||||
} // namespace sf
|
|
||||||
|
|
||||||
#include <SFML/System/Time.inl>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \class Time
|
|
||||||
/// \ingroup system
|
|
||||||
///
|
|
||||||
/// `Time` encapsulates a time value in a flexible way.
|
|
||||||
/// It allows to define a time value either as a number of
|
|
||||||
/// seconds, milliseconds or microseconds. It also works the
|
|
||||||
/// other way round: you can read a time value as either
|
|
||||||
/// a number of seconds, milliseconds or microseconds. It
|
|
||||||
/// even interoperates with the `<chrono>` header. You can
|
|
||||||
/// construct an `Time` from a `chrono::duration` and read
|
|
||||||
/// any `Time` as a chrono::duration.
|
|
||||||
///
|
|
||||||
/// By using such a flexible interface, the API doesn't
|
|
||||||
/// impose any fixed type or resolution for time values,
|
|
||||||
/// and let the user choose its own favorite representation.
|
|
||||||
///
|
|
||||||
/// Time values support the usual mathematical operations:
|
|
||||||
/// you can add or subtract two times, multiply or divide
|
|
||||||
/// a time by a number, compare two times, etc.
|
|
||||||
///
|
|
||||||
/// Since they represent a time span and not an absolute time
|
|
||||||
/// value, times can also be negative.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// \code
|
|
||||||
/// Time t1 = seconds(0.1f);
|
|
||||||
/// std::int32_t milli = t1.asMilliseconds(); // 100
|
|
||||||
///
|
|
||||||
/// Time t2 = milliseconds(30);
|
|
||||||
/// std::int64_t micro = t2.asMicroseconds(); // 30'000
|
|
||||||
///
|
|
||||||
/// Time t3 = microseconds(-800'000);
|
|
||||||
/// float sec = t3.asSeconds(); // -0.8
|
|
||||||
///
|
|
||||||
/// Time t4 = std::chrono::milliseconds(250);
|
|
||||||
/// std::chrono::microseconds micro2 = t4.toDuration(); // 250'000us
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// void update(Time elapsed)
|
|
||||||
/// {
|
|
||||||
/// position += speed * elapsed.asSeconds();
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// update(milliseconds(100));
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \see `Clock`
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
284
third_party/sfml/include/SFML/System/Time.inl
vendored
284
third_party/sfml/include/SFML/System/Time.inl
vendored
@@ -1,284 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/System/Time.hpp> // NOLINT(misc-header-include-cycle)
|
|
||||||
|
|
||||||
#include <ratio>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename Rep, typename Period>
|
|
||||||
constexpr Time::Time(const std::chrono::duration<Rep, Period>& duration) : m_microseconds(duration)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr float Time::asSeconds() const
|
|
||||||
{
|
|
||||||
return std::chrono::duration<float>(m_microseconds).count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr std::int32_t Time::asMilliseconds() const
|
|
||||||
{
|
|
||||||
return std::chrono::duration_cast<std::chrono::duration<std::int32_t, std::milli>>(m_microseconds).count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr std::int64_t Time::asMicroseconds() const
|
|
||||||
{
|
|
||||||
return m_microseconds.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr std::chrono::microseconds Time::toDuration() const
|
|
||||||
{
|
|
||||||
return m_microseconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
template <typename Rep, typename Period>
|
|
||||||
constexpr Time::operator std::chrono::duration<Rep, Period>() const
|
|
||||||
{
|
|
||||||
return m_microseconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time seconds(float amount)
|
|
||||||
{
|
|
||||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<float>(amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time milliseconds(std::int32_t amount)
|
|
||||||
{
|
|
||||||
return std::chrono::milliseconds(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time microseconds(std::int64_t amount)
|
|
||||||
{
|
|
||||||
return std::chrono::microseconds(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator==(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() == right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator!=(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() != right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator<(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() < right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator>(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() > right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator<=(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() <= right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr bool operator>=(Time left, Time right)
|
|
||||||
{
|
|
||||||
return left.asMicroseconds() >= right.asMicroseconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator-(Time right)
|
|
||||||
{
|
|
||||||
return microseconds(-right.asMicroseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator+(Time left, Time right)
|
|
||||||
{
|
|
||||||
return microseconds(left.asMicroseconds() + right.asMicroseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator+=(Time& left, Time right)
|
|
||||||
{
|
|
||||||
return left = left + right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator-(Time left, Time right)
|
|
||||||
{
|
|
||||||
return microseconds(left.asMicroseconds() - right.asMicroseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator-=(Time& left, Time right)
|
|
||||||
{
|
|
||||||
return left = left - right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator*(Time left, float right)
|
|
||||||
{
|
|
||||||
return seconds(left.asSeconds() * right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator*(Time left, std::int64_t right)
|
|
||||||
{
|
|
||||||
return microseconds(left.asMicroseconds() * right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator*(float left, Time right)
|
|
||||||
{
|
|
||||||
return right * left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator*(std::int64_t left, Time right)
|
|
||||||
{
|
|
||||||
return right * left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator*=(Time& left, float right)
|
|
||||||
{
|
|
||||||
return left = left * right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator*=(Time& left, std::int64_t right)
|
|
||||||
{
|
|
||||||
return left = left * right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator/(Time left, float right)
|
|
||||||
{
|
|
||||||
assert(right != 0 && "Time::operator/ cannot divide by 0");
|
|
||||||
return seconds(left.asSeconds() / right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator/(Time left, std::int64_t right)
|
|
||||||
{
|
|
||||||
assert(right != 0 && "Time::operator/ cannot divide by 0");
|
|
||||||
return microseconds(left.asMicroseconds() / right);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator/=(Time& left, float right)
|
|
||||||
{
|
|
||||||
assert(right != 0 && "Time::operator/= cannot divide by 0");
|
|
||||||
return left = left / right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator/=(Time& left, std::int64_t right)
|
|
||||||
{
|
|
||||||
assert(right != 0 && "Time::operator/= cannot divide by 0");
|
|
||||||
return left = left / right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr float operator/(Time left, Time right)
|
|
||||||
{
|
|
||||||
assert(right.asMicroseconds() != 0 && "Time::operator/ cannot divide by 0");
|
|
||||||
return left.asSeconds() / right.asSeconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time operator%(Time left, Time right)
|
|
||||||
{
|
|
||||||
assert(right.asMicroseconds() != 0 && "Time::operator% cannot modulus by 0");
|
|
||||||
return microseconds(left.asMicroseconds() % right.asMicroseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
constexpr Time& operator%=(Time& left, Time right)
|
|
||||||
{
|
|
||||||
assert(right.asMicroseconds() != 0 && "Time::operator%= cannot modulus by 0");
|
|
||||||
return left = left % right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Note: the 'inline' keyword here is technically not required, but VS2019 fails
|
|
||||||
// to compile with a bogus "multiple definition" error if not explicitly used.
|
|
||||||
constexpr Time Time::Zero;
|
|
||||||
|
|
||||||
} // namespace sf
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user