mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 15:49:50 -06:00
Compare commits
614 Commits
release-pr
...
2506
Author | SHA1 | Date | |
---|---|---|---|
aed420c95d | |||
1c9389a1fb | |||
58a70db588 | |||
88122ae956 | |||
e2d8e39489 | |||
2849173984 | |||
31d0756808 | |||
2604d73733 | |||
53b54406bd | |||
f5d7b1fb4c | |||
4e8a863d8b | |||
66f181a621 | |||
18a78a9bab | |||
776086fa1c | |||
66b8fa03cb | |||
35d70fd531 | |||
da8610e76f | |||
7c8d53a51d | |||
97d27130ed | |||
260f0225a4 | |||
98b0d1db05 | |||
69af10ef86 | |||
f96e667a5f | |||
f90508ff99 | |||
a6bc251677 | |||
a62449711f | |||
9ba71448cc | |||
f1b7f8a72e | |||
1dc4dc6b6d | |||
d22702a16f | |||
faaf13eaad | |||
dac023af15 | |||
2e22a3cf42 | |||
88005deaeb | |||
f59708a26c | |||
62a926a0f5 | |||
94888d250e | |||
dacb004516 | |||
b6803d00fe | |||
137e50dc25 | |||
88389146d3 | |||
6c5b35f92c | |||
7804c16dbb | |||
3b3bf6a04c | |||
2102108b1a | |||
f1ffcf2b00 | |||
404a7c75b2 | |||
3fecce8723 | |||
e4f71d2513 | |||
9dfcbcecff | |||
bc1af564e2 | |||
7de18efc93 | |||
762555c984 | |||
58c79bc5ed | |||
ffd46cd10c | |||
e83f9fb721 | |||
6315527d21 | |||
fc833f845c | |||
17eb1b1a34 | |||
afb27952ee | |||
a45d00d84d | |||
c211efd84a | |||
5a355083b4 | |||
826f04d06c | |||
059282df6f | |||
a19b1070a0 | |||
79a90b1f42 | |||
57dce8bd7c | |||
c260082cd6 | |||
eeae30e2bb | |||
cf3702cbc8 | |||
c720211542 | |||
832570c658 | |||
f19a33340a | |||
2b376a92ae | |||
cb30862cfb | |||
c5f01902de | |||
b2e5d6df25 | |||
bb77d61967 | |||
0351fd56b1 | |||
463bd86145 | |||
7113bafd94 | |||
b18bca11e8 | |||
7f44509a70 | |||
463686b766 | |||
4a35a8c516 | |||
37f97cabb4 | |||
083ffd5fdb | |||
721175b0d2 | |||
85bbaf6563 | |||
17e57f550c | |||
27d0e0c8fe | |||
a9ab0e979e | |||
d922ba31f7 | |||
a8fb4153d7 | |||
8a9a082c69 | |||
8822479477 | |||
01bb9d1f8c | |||
a52e8ff9bd | |||
d74d1d42d6 | |||
921ffe153d | |||
1c54583ae7 | |||
b8ca3c8d15 | |||
c4616226ab | |||
3e09d10123 | |||
5af5c83428 | |||
684db094c6 | |||
eff334524a | |||
7bb78a1d6e | |||
4efbd35a5e | |||
74a875e9d6 | |||
1f0ff42aa0 | |||
61ab0faab8 | |||
aea5054509 | |||
407218a8b4 | |||
dbc09bfb0d | |||
a85ffc116e | |||
f5dd80bb5b | |||
6a36930c74 | |||
1ac40f25a2 | |||
451e36defc | |||
69f561e76c | |||
85bb066cb0 | |||
599f28045e | |||
c9bdda63dc | |||
210b5cbf66 | |||
2f1d8272a8 | |||
6f25e20c6a | |||
6e22e145a0 | |||
d2db9d9590 | |||
2a3580fda5 | |||
380a9291ad | |||
15ad6e0426 | |||
72fd344dca | |||
3a27646263 | |||
fc0601e55f | |||
1f5abfe365 | |||
6b52336bf7 | |||
5a80105555 | |||
e80ed595ac | |||
95ab6925b1 | |||
a3c7423273 | |||
e0d6ab73b8 | |||
2eeb2fd2b9 | |||
db425ef3a1 | |||
7774dccc9d | |||
78465693ad | |||
c574b651aa | |||
dcc09906e5 | |||
ffd78711be | |||
a736d2ed5f | |||
c1d0a49f35 | |||
1aabae49ed | |||
77744169be | |||
63572f15fc | |||
c8be819711 | |||
6515807685 | |||
6129953666 | |||
06826319c7 | |||
b566e81644 | |||
58d305f75c | |||
4e736d60db | |||
be4b0af971 | |||
0066119e41 | |||
fcb4b04168 | |||
da4f643b9f | |||
1963305bea | |||
757e6aba46 | |||
42f656bf0f | |||
2b568566ac | |||
539a3ed021 | |||
7222779e21 | |||
1bd2570d97 | |||
0bd7cc64c9 | |||
fbb54604b6 | |||
20874124c2 | |||
e4525ca7ee | |||
5ee520133d | |||
6c9138e5a6 | |||
5cfe3760a5 | |||
5c0cf0788f | |||
1633011d2a | |||
c796691d00 | |||
d64c20a67c | |||
0ce929220d | |||
999c7aed98 | |||
0987c03693 | |||
e3f7486ca7 | |||
2e20e24136 | |||
cae82b62f8 | |||
ec940e6a2e | |||
753fe5bed1 | |||
c14101534f | |||
bdb4fd8376 | |||
8e64a02a42 | |||
43e4e8f182 | |||
b5dd545b8e | |||
2049896cab | |||
4899913446 | |||
e8b63fe090 | |||
a149b9d62d | |||
2d9a61bd0e | |||
852bd6df1a | |||
7e2565ae49 | |||
0b0151770a | |||
23a5ea3504 | |||
b49711fefb | |||
d591e3b4e3 | |||
7fa92160a2 | |||
26ae66297d | |||
c32ca0696e | |||
bad78cfed4 | |||
4ec2072beb | |||
37aa65afc4 | |||
e403dee3da | |||
97e696e524 | |||
2e6e7eddd1 | |||
891833d1a1 | |||
552b6da9c4 | |||
8ee64a84c7 | |||
f060baa257 | |||
3ed3fb05af | |||
741ffc3114 | |||
3e5286c1a4 | |||
3a883f28d6 | |||
45b9def42c | |||
d0dc8ae5e1 | |||
9db4067957 | |||
8724daf44e | |||
9c40a7976b | |||
e37a195192 | |||
9868138c22 | |||
066408326c | |||
50ca32352f | |||
805307f432 | |||
fe307a06c6 | |||
a95779add0 | |||
5523b9a01b | |||
50026ab795 | |||
a6290caa2e | |||
80adfc606d | |||
8412a7c336 | |||
f0bacb826a | |||
7c7c179b44 | |||
6c870860ea | |||
05381c5b6d | |||
21d5e3182d | |||
cd77e682ca | |||
512da86b1a | |||
c460cafecf | |||
d517fe25f1 | |||
14fadbbe56 | |||
c7d8afc5a7 | |||
c9bb258e88 | |||
0dd282f626 | |||
ac2fdefcb4 | |||
04c7c1a4a1 | |||
256d9f8702 | |||
bbc11edd7d | |||
4d9dc1e1cd | |||
908094714b | |||
ef8b9a0dcd | |||
8fa725d5e4 | |||
fc0aafca3b | |||
f675048768 | |||
1cea31c75a | |||
3025cd472c | |||
022bc3bf8d | |||
8bb07bf3c4 | |||
879a8889aa | |||
564e7c3320 | |||
467a568f60 | |||
6c751fb722 | |||
03a6fdcd85 | |||
bda1f379b7 | |||
c44418a4d9 | |||
fe657b9759 | |||
d5314cbf48 | |||
9926a9bd7f | |||
947bdea590 | |||
e751235574 | |||
bf554edfe0 | |||
2c54ee94c1 | |||
d9d0082018 | |||
6e6736c89f | |||
8f3483fdd4 | |||
af960651e8 | |||
d04e9e79a6 | |||
968b0cff44 | |||
116bd3a031 | |||
8b610101bc | |||
c4f65febf3 | |||
871073eee2 | |||
31a3de819d | |||
0fd090ce19 | |||
4773a6f323 | |||
826625c7be | |||
00544e4dff | |||
609165b62b | |||
f6d3f448d9 | |||
ac76deaef0 | |||
da84a9f605 | |||
afee9a56e9 | |||
9254a53397 | |||
25fdde4204 | |||
fd8ce3ce80 | |||
12010ebf78 | |||
ecafd8058f | |||
71249dec33 | |||
89873d6238 | |||
d670c21c8e | |||
0f30b59aef | |||
1e8b668793 | |||
1fc6be7f80 | |||
de2826d995 | |||
e468e2359a | |||
8f12512d0d | |||
920a44aec2 | |||
24fdcc1a0e | |||
50a8ae9d90 | |||
427e9c5ad2 | |||
c0c180bdc2 | |||
258fc1b209 | |||
0b2338a5ee | |||
35fa32e254 | |||
89fdc0b9e0 | |||
2238967d93 | |||
660232a12c | |||
2baa09d5b4 | |||
8d94d25203 | |||
71f654cdc4 | |||
494e2c05c2 | |||
0827d9f06d | |||
0109c27ad7 | |||
e40c9b674c | |||
ec9fb08dab | |||
65f42ee2d2 | |||
53b66be47d | |||
0bc33fb6df | |||
dc8865718e | |||
7213cdd439 | |||
ad79a62d22 | |||
82ee77e4e1 | |||
39e535d4aa | |||
a517c9f862 | |||
7236d1539a | |||
bc3c3eb79a | |||
41408076e3 | |||
7e7b75c1e6 | |||
9504916f72 | |||
0a52140145 | |||
45ed4b2be9 | |||
2adf3449f3 | |||
8d7d026da6 | |||
2d1161150b | |||
5dd896a7d9 | |||
07ad189b4f | |||
a1691a4031 | |||
ac3dbe2294 | |||
12dcd6c285 | |||
f78fa2e9f1 | |||
77b4270981 | |||
7123fcd19b | |||
f6ba69f99a | |||
1ae0b23265 | |||
b8e70df413 | |||
3eee52cb6b | |||
49ebdaaae3 | |||
fda8afaf5c | |||
301cc5ee63 | |||
cb20959679 | |||
056b0339be | |||
c55624702c | |||
a96c935c1c | |||
b9a93794ff | |||
ef612912a2 | |||
fa782de15c | |||
f8bf35e6f0 | |||
8bfde300f4 | |||
5af315ec17 | |||
2af276d27e | |||
c4f906bcd9 | |||
3bb925c1c7 | |||
473cb6c3bc | |||
2397a3a915 | |||
883a5cccfa | |||
90a4be4b36 | |||
9caa02493d | |||
36c7e7f3c7 | |||
cab5bc5680 | |||
6ad267017c | |||
2c20d5dcd9 | |||
4f210df86a | |||
bcddd78a89 | |||
d194e69bbd | |||
5285b1168a | |||
03451f2bc9 | |||
87beb7d67b | |||
fc0179c1ea | |||
4aa056dd4d | |||
7ca8dc3767 | |||
01363572cb | |||
91380258a1 | |||
ee27f03a43 | |||
b306d00d5d | |||
f59507c856 | |||
69bdb0535c | |||
ec49ea5be3 | |||
74e752ed9c | |||
2d1671a863 | |||
06afa0036a | |||
edb1db7400 | |||
bee7035322 | |||
e0e53f3235 | |||
7dc27753e2 | |||
e5c8935acc | |||
dadbd2f9fb | |||
af1f07207f | |||
c42dab6388 | |||
61ab662733 | |||
ebc9c8492d | |||
c705e366f0 | |||
ec36fce7c6 | |||
877864c23a | |||
33a7283d3b | |||
01a7732d50 | |||
17c994df2a | |||
4533605c03 | |||
920f940ad0 | |||
1b85da9b85 | |||
7e57834691 | |||
1b87ea83e6 | |||
957265ba52 | |||
9819d66a47 | |||
f00b7d39f0 | |||
efd993f382 | |||
4c727a84c5 | |||
932b4abdcf | |||
7d794897c4 | |||
e0032b3e2c | |||
c7ede8a6b7 | |||
ee22cf9b22 | |||
0a3feb3e42 | |||
3a1a60d4f8 | |||
662cfa38c2 | |||
cb24821dcc | |||
ebd879cb30 | |||
e5608c6ca5 | |||
896b4bb1fa | |||
1ecd6fbc9b | |||
e351f03cdf | |||
849d8b7dae | |||
1981f22228 | |||
d2cc6760a0 | |||
eb84b0fb9b | |||
e34907025d | |||
5d4b884e64 | |||
5a708f0f24 | |||
6d8ba94e4c | |||
0b128badae | |||
9e9faf3be1 | |||
516c1314d2 | |||
ad3650abfc | |||
1515cf6ccd | |||
cef4d8fb76 | |||
f50d2ee86c | |||
28f1beeca8 | |||
178462e10f | |||
9b0471532c | |||
2da255d8cd | |||
e93f0de8a4 | |||
c1990bc687 | |||
8e253518e6 | |||
e18d98d4fc | |||
d03f9032c1 | |||
b0867c1602 | |||
18979129f3 | |||
3bf2de369a | |||
561aee7707 | |||
4b711e1e0a | |||
ba1bf6959e | |||
137d1375d4 | |||
79a1e480ca | |||
a7d1cac8ad | |||
0299540209 | |||
3b8384acf6 | |||
6a90affa38 | |||
42fb43dacf | |||
0afbeae70c | |||
dc4cb7874a | |||
49bee36e6a | |||
9720b1f5f5 | |||
9e513d93e1 | |||
07cec796f4 | |||
c5f89f2de9 | |||
48b2f7d200 | |||
c1dea828ab | |||
452cd1c261 | |||
373a1a5dc0 | |||
f4c37aeb14 | |||
90b6f0d16d | |||
951a84833a | |||
6aff82eda3 | |||
99cde4e269 | |||
1bd3e79fda | |||
e3deb14156 | |||
46e0952e97 | |||
c763961112 | |||
b2ce3fbefc | |||
ddb82a5e8c | |||
225039f742 | |||
049e52ce1c | |||
f2d1918714 | |||
e637a05707 | |||
1f087473aa | |||
b2f8dac739 | |||
541344ef9b | |||
8c7ab286f5 | |||
3fb4084e25 | |||
fd2c6918fa | |||
0615ade725 | |||
01978cfcf7 | |||
2690a62949 | |||
e1745f682f | |||
4d3f247cc3 | |||
f09ba10daa | |||
e82f03b825 | |||
6c158ed590 | |||
63b848ca93 | |||
15372dc835 | |||
ca9b34a6d1 | |||
0e2785a562 | |||
a421d6859f | |||
fdf00050a6 | |||
5b36c13bfb | |||
1b47dbf519 | |||
de997d616f | |||
b7bd0a0836 | |||
67c8d5640f | |||
1698daef66 | |||
a80062f1b1 | |||
9b2ab6e259 | |||
c191ed5321 | |||
5b88c0b90e | |||
de01a790e1 | |||
7f3d8a1ad4 | |||
44423a3656 | |||
7222188cde | |||
c4bd98c626 | |||
9ac9813492 | |||
aa624d8ba8 | |||
9675c90890 | |||
81e842e2aa | |||
fe2d247acb | |||
cf1541a511 | |||
3705c73d55 | |||
ae11ffadf6 | |||
433c6ce0f2 | |||
5ed8b7bc9d | |||
d45e6c6729 | |||
203454a97a | |||
ff4486ee23 | |||
189d09011b | |||
3f73a39dbd | |||
9f43f59c9b | |||
13d966760d | |||
9e23a0a506 | |||
ba40e4abad | |||
1cc6b6c5d8 | |||
f4e6878384 | |||
cbd71f06ba | |||
e4efe011d7 | |||
258ec4f9cd | |||
c9f589faa5 | |||
8b9f92a0af | |||
9f972db4b8 | |||
00e147c722 | |||
62b2b939b5 | |||
1e5e9219cd | |||
87496205aa | |||
e974e48e1f | |||
c18c039089 | |||
fb6c625fed | |||
9b7d494bd4 | |||
d2b4e12f9e | |||
7925240107 | |||
325c1a24b9 | |||
99e686de34 | |||
5ff2af9b6a | |||
5beb136992 | |||
16d75eadb5 | |||
b28dcf3687 | |||
38099f282d | |||
3c5da38177 | |||
ecb0a3e5c7 | |||
e217d6c939 | |||
6dedf11c96 | |||
5d16c51963 | |||
5dd10b9644 | |||
3f92f86de1 | |||
0d0734e083 | |||
1d481a395a | |||
4e460a7968 | |||
359fb51d64 | |||
7abb9e7974 | |||
0a83783fae | |||
97bc28aac4 | |||
5b4d4ca5eb | |||
363155b597 | |||
a3b06b0572 | |||
48a7afa448 | |||
6d44afc7dd | |||
ea7928b3cd | |||
dc6e5e7ff6 |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -84,3 +84,9 @@
|
||||
[submodule "Externals/Vulkan-Headers"]
|
||||
path = Externals/Vulkan-Headers
|
||||
url = https://github.com/KhronosGroup/Vulkan-Headers.git
|
||||
[submodule "Externals/SFML/SFML"]
|
||||
path = Externals/SFML/SFML
|
||||
url = https://github.com/SFML/SFML.git
|
||||
[submodule "Externals/zstd/zstd"]
|
||||
path = Externals/zstd/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
|
@ -57,13 +57,9 @@ DEFAULT_CONFIG = {
|
||||
# SHA checksum to verify the integrity of the app. This doesn't
|
||||
# protect against malicious actors, but it does protect against
|
||||
# running corrupted binaries and allows for access to the extended
|
||||
# permisions needed for ARM builds
|
||||
# permissions needed for ARM builds
|
||||
"codesign_identity": "-",
|
||||
|
||||
# Minimum macOS version for each architecture slice
|
||||
"arm64_mac_os_deployment_target": "11.0.0",
|
||||
"x86_64_mac_os_deployment_target": "10.15.0",
|
||||
|
||||
# CMake Generator to use for building
|
||||
"generator": "Unix Makefiles",
|
||||
"build_type": "Release",
|
||||
@ -77,7 +73,7 @@ DEFAULT_CONFIG = {
|
||||
"distributor": "None"
|
||||
}
|
||||
|
||||
# Architectures to build for. This is explicity left out of the command line
|
||||
# Architectures to build for. This is explicitly left out of the command line
|
||||
# config options for several reasons:
|
||||
# 1) Adding new architectures will generally require more code changes
|
||||
# 2) Single architecture builds should utilize the normal generated cmake
|
||||
@ -146,11 +142,6 @@ def parse_args(conf=DEFAULT_CONFIG):
|
||||
help=f"Install path for {arch} qt5 libraries",
|
||||
default=conf[arch+"_qt5_path"])
|
||||
|
||||
parser.add_argument(
|
||||
f"--{arch}_mac_os_deployment_target",
|
||||
help=f"Deployment architecture for {arch} slice",
|
||||
default=conf[arch+"_mac_os_deployment_target"])
|
||||
|
||||
return vars(parser.parse_args())
|
||||
|
||||
|
||||
@ -297,8 +288,7 @@ def build(config):
|
||||
"-DCMAKE_PREFIX_PATH="+prefix_path,
|
||||
"-DCMAKE_SYSTEM_PROCESSOR="+arch,
|
||||
"-DCMAKE_IGNORE_PATH="+ignore_path,
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET="
|
||||
+ config[arch+"_mac_os_deployment_target"],
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0.0",
|
||||
"-DMACOS_CODE_SIGNING_IDENTITY="
|
||||
+ config["codesign_identity"],
|
||||
'-DMACOS_CODE_SIGNING="ON"',
|
||||
|
@ -11,7 +11,7 @@
|
||||
# FFmpeg_LIBRARIES: aggregate all the paths to the libraries
|
||||
# FFmpeg_FOUND: True if all components have been found
|
||||
#
|
||||
# This module defines the following targets, which are prefered over variables:
|
||||
# This module defines the following targets, which are preferred over variables:
|
||||
#
|
||||
# FFmpeg::<component>: Target to use <component> directly, with include path,
|
||||
# library and dependencies set up. If you are using a static build, you are
|
||||
|
@ -87,9 +87,10 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
||||
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
|
||||
endif()
|
||||
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
|
||||
STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${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 MATCH "#define SFML_VERSION_MAJOR[ \t]+([0-9]+)" SFML_VERSION_MAJOR_MATCH "${SFML_CONFIG_HPP_CONTENTS}")
|
||||
STRING(REGEX MATCH "#define SFML_VERSION_MINOR[ \t]+([0-9]+)" SFML_VERSION_MINOR_MATCH "${SFML_CONFIG_HPP_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SFML_VERSION_MAJOR[ \t]+([0-9]+)" "\\1" SFML_VERSION_MAJOR "${SFML_VERSION_MAJOR_MATCH}")
|
||||
STRING(REGEX REPLACE "#define SFML_VERSION_MINOR[ \t]+([0-9]+)" "\\1" SFML_VERSION_MINOR "${SFML_VERSION_MINOR_MATCH}")
|
||||
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}")
|
||||
|
||||
# if we could extract them, compare with the requested version number
|
||||
@ -102,10 +103,14 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
||||
set(SFML_VERSION_OK FALSE)
|
||||
endif()
|
||||
else()
|
||||
# SFML version is < 2.0
|
||||
if (SFML_REQUESTED_VERSION GREATER 19)
|
||||
# SFML version is < 3.0
|
||||
if (SFML_REQUESTED_VERSION GREATER 29)
|
||||
set(SFML_VERSION_OK FALSE)
|
||||
set(SFML_VERSION_MAJOR 1)
|
||||
if (SFML_REQUESTED_VERSION GREATER 19)
|
||||
set(SFML_VERSION_MAJOR 1)
|
||||
else()
|
||||
set(SFML_VERSION_MAJOR 2)
|
||||
endif()
|
||||
set(SFML_VERSION_MINOR x)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -33,7 +33,7 @@ endif()
|
||||
string(TIMESTAMP DOLPHIN_WC_BUILD_DATE "%Y-%m-%d" UTC)
|
||||
|
||||
# version number
|
||||
set(DOLPHIN_VERSION_MAJOR "2503")
|
||||
set(DOLPHIN_VERSION_MAJOR "2506")
|
||||
set(DOLPHIN_VERSION_MINOR "0")
|
||||
set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})
|
||||
|
||||
|
@ -24,7 +24,7 @@ endif()
|
||||
|
||||
# Minimum OS X version.
|
||||
# This is inserted into the Info.plist as well.
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15.0" CACHE STRING "")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0.0" CACHE STRING "")
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FlagsOverride.cmake")
|
||||
|
||||
@ -44,7 +44,7 @@ endif()
|
||||
|
||||
set(COMPILER ${CMAKE_CXX_COMPILER_ID})
|
||||
if (COMPILER STREQUAL "GNU")
|
||||
set(COMPILER "GCC") # perfer printing GCC instead of GNU
|
||||
set(COMPILER "GCC") # prefer printing GCC instead of GNU
|
||||
endif()
|
||||
|
||||
# Enforce minimum compiler versions that support the c++20 features we use
|
||||
@ -124,6 +124,11 @@ option(OPROFILING "Enable profiling" OFF)
|
||||
# TODO: Add DSPSpy
|
||||
option(DSPTOOL "Build dsptool" OFF)
|
||||
|
||||
# RetroAchievements developer tools require Windows hooks
|
||||
if(WIN32)
|
||||
option(RC_CLIENT_SUPPORTS_RAINTEGRATION "Enables RetroAchievements developer tools" ON)
|
||||
endif()
|
||||
|
||||
# Enable SDL by default on operating systems that aren't Android.
|
||||
if(NOT ANDROID)
|
||||
option(ENABLE_SDL "Enables SDL as a generic controller backend" ON)
|
||||
@ -144,6 +149,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
option(ENABLE_VTUNE "Enable Intel VTune integration for JIT code." OFF)
|
||||
|
||||
if(NOT ANDROID)
|
||||
option(ENABLE_HWDB "Enables the udev hardware database" ON)
|
||||
option(ENABLE_EVDEV "Enables the evdev controller backend" ON)
|
||||
endif()
|
||||
endif()
|
||||
@ -407,7 +413,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
|
||||
# Workaround: the llvm libc++ and versions of clang eariler than 14 have a bug with consteval
|
||||
# Workaround: the llvm libc++ and versions of clang earlier than 14 have a bug with consteval
|
||||
# so we define FMT_CONSTEVAL to blank to just disable consteval in fmt
|
||||
add_definitions(-DFMT_CONSTEVAL=)
|
||||
endif()
|
||||
@ -566,6 +572,16 @@ if(OPROFILING)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_HWDB)
|
||||
find_package(LIBUDEV REQUIRED)
|
||||
if(LIBUDEV_FOUND)
|
||||
message(STATUS "libudev found, enabling hardware database")
|
||||
add_definitions(-DHAVE_LIBUDEV=1)
|
||||
else()
|
||||
message(FATAL_ERROR "Couldn't find libudev. Can't build hardware database.\nDisable ENABLE_HWDB if you wish to build without hardware database support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_EVDEV)
|
||||
find_package(LIBUDEV REQUIRED)
|
||||
find_package(LIBEVDEV REQUIRED)
|
||||
@ -673,7 +689,7 @@ dolphin_make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
|
||||
|
||||
dolphin_find_optional_system_library_pkgconfig(ZSTD libzstd>=1.4.0 zstd::zstd Externals/zstd)
|
||||
|
||||
add_subdirectory(Externals/zlib-ng)
|
||||
dolphin_find_optional_system_library_pkgconfig(ZLIB zlib>=1.3.1 ZLIB::ZLIB Externals/zlib-ng)
|
||||
|
||||
dolphin_find_optional_system_library_pkgconfig(MINIZIP
|
||||
"minizip>=4.0.4" minizip::minizip Externals/minizip-ng
|
||||
@ -696,11 +712,6 @@ if (APPLE OR WIN32)
|
||||
include_directories(Externals/ed25519)
|
||||
endif()
|
||||
|
||||
# Using static soundtouch from Externals
|
||||
# Unable to use system soundtouch library: We require shorts, not floats.
|
||||
add_subdirectory(Externals/soundtouch)
|
||||
include_directories(Externals/soundtouch)
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
dolphin_find_optional_system_library(CUBEB Externals/cubeb)
|
||||
add_definitions(-DHAVE_CUBEB)
|
||||
@ -713,7 +724,7 @@ if(NOT ANDROID)
|
||||
add_definitions(-D__LIBUSB__)
|
||||
endif()
|
||||
|
||||
dolphin_find_optional_system_library(SFML Externals/SFML 2.1 COMPONENTS network system)
|
||||
dolphin_find_optional_system_library(SFML Externals/SFML 3.0 COMPONENTS Network System)
|
||||
|
||||
if(USE_UPNP)
|
||||
dolphin_find_optional_system_library(MINIUPNPC Externals/miniupnpc 1.6)
|
||||
|
@ -39,7 +39,7 @@ This guide is for developers who wish to contribute to the Dolphin codebase. It
|
||||
|
||||
Following this guide and formatting your code as detailed will likely get your pull request merged much faster than if you don't (assuming the code itself has no mistakes).
|
||||
|
||||
This project uses clang-format 13.0 to check for common style issues. In case of conflicts between this guide and clang-format rules, the latter should be followed instead of this guide.
|
||||
This project uses clang-format 19.1 to check for common style issues. In case of conflicts between this guide and clang-format rules, the latter should be followed instead of this guide.
|
||||
|
||||
## <a name="intro-formatting-issues"></a>Checking and fixing formatting issues
|
||||
|
||||
@ -49,7 +49,7 @@ In most cases, clang-format can and **should** be used to automatically reformat
|
||||
|
||||
- To run clang-format on all staged files:
|
||||
```
|
||||
git diff --cached --name-only | egrep '[.](cpp|h|mm)$' | xargs clang-format -i
|
||||
git diff --cached --name-only | grep -E '[.](cpp|h|mm)$' | xargs -I {} clang-format -i {}
|
||||
```
|
||||
|
||||
- Formatting issues can be checked for before committing with a lint script that is included with the codebase. To enable it as a pre-commit hook (assuming you are in the repository root):
|
||||
|
@ -932,10 +932,6 @@
|
||||
"title": "Region Select",
|
||||
"AD12237401ABE9FE4A545AADB5C5AE10355E2076": "RSAPatch"
|
||||
},
|
||||
"RELJAB": {
|
||||
"title": "SegaBoot",
|
||||
"130F3594CAB57B85616F95C7126F4748AAC5867D": "DI Seed Blanker"
|
||||
},
|
||||
"RGQE70": {
|
||||
"title": "Ghostbusters",
|
||||
"5F4CF8D4DA19A0FF74FF9EB925AC0236069BFD59": "crashfix"
|
||||
|
@ -9,9 +9,9 @@ SafeTextureCacheColorSamples = 0
|
||||
|
||||
[Video_Hacks]
|
||||
# Some very early NES releases use a version of the NES emulator that doesn't require EFB2Ram.
|
||||
# All US releases before Feburary 2007 use this version (with all remaining US releases requiring EFB2Ram).
|
||||
# All US releases before February 2007 use this version (with all remaining US releases requiring EFB2Ram).
|
||||
# But in the PAL region the same games don't necessarily have the same emulator version and
|
||||
# only a few of the pre-Feburary 2007 releases don't require EFB2Ram.
|
||||
# only a few of the pre-February 2007 releases don't require EFB2Ram.
|
||||
#
|
||||
# Because of this, Inifiles that override this setting should only be created for the explicit region
|
||||
# that was tested and they should not be merged.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# FAAE01 - Donkey Kong
|
||||
|
||||
[Video_Hacks]
|
||||
# All US NES VC titles released before Feburary 2007 don't need EFB2ram
|
||||
# All US NES VC titles released before February 2007 don't need EFB2ram
|
||||
EFBToTextureEnable =
|
||||
|
@ -1,5 +1,5 @@
|
||||
# FAGE01 - Super Mario Bros.
|
||||
|
||||
[Video_Hacks]
|
||||
# All US NES VC titles released before Feburary 2007 don't need EFB2ram
|
||||
# All US NES VC titles released before February 2007 don't need EFB2ram
|
||||
EFBToTextureEnable =
|
||||
|
11
Data/Sys/GameSettings/G97.ini
Normal file
11
Data/Sys/GameSettings/G97.ini
Normal file
@ -0,0 +1,11 @@
|
||||
# G97E01, G97P01, G97U01 - Interactive Multi Game Demo Disc v3
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
13
Data/Sys/GameSettings/GCA.ini
Normal file
13
Data/Sys/GameSettings/GCA.ini
Normal file
@ -0,0 +1,13 @@
|
||||
# GCAE5H - Cubix Robots for Everyone: Showdown
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
@ -1,18 +1,17 @@
|
||||
# RELJAB - SegaBoot
|
||||
# GFOE78, GFOP78 - The Fairly OddParents: Shadow Showdown
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
$DI Seed Blanker
|
||||
0x80000000:dword:0x00000000
|
||||
0x80000004:dword:0x00000000
|
||||
0x80000008:dword:0x00000000
|
||||
|
||||
[Patches_RetroAchievements_Verified]
|
||||
$DI Seed Blanker
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
17
Data/Sys/GameSettings/GFW.ini
Normal file
17
Data/Sys/GameSettings/GFW.ini
Normal file
@ -0,0 +1,17 @@
|
||||
# GFWE78 - The Fairly OddParents: Breakin' Da Rules
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
@ -1,4 +1,4 @@
|
||||
# GJNE78 - Jimmy Neutron Boy Genius
|
||||
# GJNP78, GJNE78, GJND78 - Jimmy Neutron Boy Genius
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
@ -12,4 +12,7 @@
|
||||
[Video_Settings]
|
||||
|
||||
[Video_Hacks]
|
||||
# Fixes missing splash logo at boot, title screen, and loading screens.
|
||||
EFBAccessEnable = True
|
||||
# Fixes FMVs not showing.
|
||||
ImmediateXFBEnable = False
|
||||
|
14
Data/Sys/GameSettings/GJY.ini
Normal file
14
Data/Sys/GameSettings/GJY.ini
Normal file
@ -0,0 +1,14 @@
|
||||
# GJYE78, GJYP78 - The Adventures of Jimmy Neutron Boy Genius: Attack of the Twonkies
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
@ -11,3 +11,9 @@
|
||||
|
||||
[Video_Hacks]
|
||||
EFBToTextureEnable = False
|
||||
DeferEFBCopies = False
|
||||
|
||||
[Gecko]
|
||||
$Widescreen 16:9 (Region Free)
|
||||
04007B7C 38600001
|
||||
*Renders the game in Widescreen 16:9
|
||||
|
@ -1,8 +1,9 @@
|
||||
# GM2E8P, GM2J8P, GM2P8P - SUPER MONKEY BALL 2
|
||||
# GM2E8P, GM2J8P, GM2P8P - Super Monkey Ball 2
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
FPRF = True
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
@ -3,6 +3,7 @@
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
FPRF = True
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# GNOE78 - Nicktoons Unite!
|
||||
# GNOE78, GNOX78 - Nicktoons Unite!
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
@ -968,7 +968,7 @@ $Minigame: Memory Lane - No Trail [Airsola]
|
||||
204d6a0f 00000000
|
||||
044d699f 0000003f
|
||||
e2000002 80008000
|
||||
*Shy Guy will no longer leave a trail durning the demo in the minigame Memory Lane.
|
||||
*Shy Guy will no longer leave a trail during the demo in the minigame Memory Lane.
|
||||
|
||||
$Minigame: Mole It – All Moles are Worth 3 Points [gamemasterplc]
|
||||
204D57F0 A8A10008
|
||||
|
@ -1164,7 +1164,7 @@ $Mechanics - Use Multiple Orbs in the Same Turn [Ralf]
|
||||
041E3764 3860FFFF
|
||||
*Does not work with CPUs
|
||||
|
||||
$Mechanics - Vaccum Orb Always Steals 5 Coins
|
||||
$Mechanics - Vacuum Orb Always Steals 5 Coins
|
||||
041c8a34 38600005
|
||||
|
||||
$Minigame: Balloonatic - 25 Second Timer [Airsola]
|
||||
|
11
Data/Sys/GameSettings/GPL.ini
Normal file
11
Data/Sys/GameSettings/GPL.ini
Normal file
@ -0,0 +1,11 @@
|
||||
# GPLE9G, GPLP9G, GPLD9G, GPLF9G - Piglet's Big Game
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
@ -12,4 +12,7 @@
|
||||
[Video_Settings]
|
||||
|
||||
[Video_Hacks]
|
||||
# Fixes FMVs tearing
|
||||
EarlyXFBOutput = False
|
||||
# Fixes FMVs not showing
|
||||
ImmediateXFBEnable = False
|
||||
|
@ -10,5 +10,6 @@ MemoryCardSize = 2
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
||||
|
12
Data/Sys/GameSettings/GQN.ini
Normal file
12
Data/Sys/GameSettings/GQN.ini
Normal file
@ -0,0 +1,12 @@
|
||||
# GQNE5D - Mortal Kombat: Deception
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
14
Data/Sys/GameSettings/GQQ.ini
Normal file
14
Data/Sys/GameSettings/GQQ.ini
Normal file
@ -0,0 +1,14 @@
|
||||
# GQQD78, GQQE78, GQQF78, GQQH78, GQQP78 - SpongeBob SquarePants: Lights, Camera, Pants!
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
@ -12,6 +12,7 @@
|
||||
[Video]
|
||||
|
||||
[Video_Settings]
|
||||
SuggestedAspectRatio = 2
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
||||
|
14
Data/Sys/GameSettings/GU6.ini
Normal file
14
Data/Sys/GameSettings/GU6.ini
Normal file
@ -0,0 +1,14 @@
|
||||
# GU6E78 - Nicktoons: Battle for Volcano Island
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Hacks]
|
||||
# Needed for some FMVs.
|
||||
ImmediateXFBEnable = False
|
@ -2,6 +2,7 @@
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
@ -1,12 +1,13 @@
|
||||
# GVSE8P, GVSP8P - Virtua Striker 3 ver. 2002
|
||||
# GVSP8P, GVSE8P, GVSJ8P - Virtua Striker 2002 (GC)
|
||||
# GVSJ8P - Virtua Striker 2002 (Triforce), Virtua Striker 4, Virtua Striker 4 ver. 2006
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
FPRF = True
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
# GVS46E, GVS46J - Virtua Striker 4 ver. 2006
|
||||
# Because Triforce games have weird IDs, properties are inherited from GVS.ini (Virtua Striker 3 ver. 2002)!
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
FPRF = True
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[Video_Settings]
|
||||
|
@ -1,18 +0,0 @@
|
||||
# GVS46E, GVS46J - Virtua Striker 4 ver. 2006
|
||||
# Because Triforce games have weird IDs, properties are inherited from GVS.ini (Virtua Striker 3 ver. 2002)!
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
FPRF = True
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[Video_Settings]
|
||||
|
11
Data/Sys/GameSettings/GWH.ini
Normal file
11
Data/Sys/GameSettings/GWH.ini
Normal file
@ -0,0 +1,11 @@
|
||||
# GWHP41, GWHE41 - Winnie the Pooh's Rumbly Tumbly Adventure
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
@ -9,6 +9,10 @@
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
||||
|
||||
[Video_Hacks]
|
||||
EFBToTextureEnable = False
|
||||
DeferEFBCopies = False
|
||||
|
@ -362,7 +362,7 @@ $Can Walk Ontop of Deep Snow (Twilight Spectre)
|
||||
$Run Normal Speed With Iron Boots On (brkirch)
|
||||
040BB53C 38600000
|
||||
040B2D18 4800004C
|
||||
$Alywas Preform Dive When Jumping (brkirch)
|
||||
$Always Perform Dive When Jumping (brkirch)
|
||||
040B6618 60000000
|
||||
$Can Always Flourish Sword (brkirch)
|
||||
040B9B68 60000000
|
||||
@ -514,7 +514,7 @@ $Mute BG Music (Twilight Spectre)
|
||||
043DC3D0 00000000
|
||||
$BG music muted v2 (Twilight Spectre)
|
||||
044507F4 00000000
|
||||
$Enviornment muted (Twilight Spectre)
|
||||
$Environment muted (Twilight Spectre)
|
||||
04450814 00000000
|
||||
$Link makes no noise (Twilight Spectre)
|
||||
044507FC 00000000
|
||||
|
@ -7,7 +7,7 @@
|
||||
# Add action replay cheats here.
|
||||
$==========The Legend of Zelda==========
|
||||
001D73B0 000000FB
|
||||
$Max/Infinte Health
|
||||
$Max/Infinite Health
|
||||
001D73AF 000000FF
|
||||
001D73B0 000000FB
|
||||
$Max/Infinite Rupees
|
||||
|
5
Data/Sys/GameSettings/R2D.ini
Normal file
5
Data/Sys/GameSettings/R2D.ini
Normal file
@ -0,0 +1,5 @@
|
||||
# R2DJEP, R2DEEB, R2DPJW - Dokapon Kingdom
|
||||
|
||||
[Video_Hacks]
|
||||
# Prevents flickering throughout the game.
|
||||
ImmediateXFBEnable = False
|
@ -9,8 +9,13 @@
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Enhancements]
|
||||
# Fixes FMVs
|
||||
ForceTextureFiltering = False
|
||||
|
||||
[Video_Settings]
|
||||
SafeTextureCacheColorSamples = 512
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
||||
|
||||
[Video_Hacks]
|
||||
EFBToTextureEnable = False
|
||||
|
@ -10,8 +10,13 @@
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Enhancements]
|
||||
# Fixes FMVs
|
||||
ForceTextureFiltering = False
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
||||
|
||||
[Video_Hacks]
|
||||
EFBToTextureEnable = False
|
||||
DeferEFBCopies = False
|
||||
|
@ -10,5 +10,7 @@
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Hacks]
|
||||
# Needed for some FMVs.
|
||||
ImmediateXFBEnable = False
|
||||
EFBToTextureEnable = False
|
||||
DeferEFBCopies = False
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# The JIT cache causes problems with emulated icache invalidation in this game resulting in areas failing to load
|
||||
DisableICache = True
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
17
Data/Sys/GameSettings/RKM.ini
Normal file
17
Data/Sys/GameSettings/RKM.ini
Normal file
@ -0,0 +1,17 @@
|
||||
# RKMP5D, RKME5D - Mortal Kombat: Armageddon
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Hacks]
|
||||
# Fixes shadows at higher resolution.
|
||||
# Option has no effect at 1x IR, so no reason not to enable.
|
||||
VertexRounding = True
|
4
Data/Sys/GameSettings/RKP.ini
Normal file
4
Data/Sys/GameSettings/RKP.ini
Normal file
@ -0,0 +1,4 @@
|
||||
# RKPJ52, RKPE52, RKPY52, RKPK52, RKPV52, RKPP52, RKPX52 - Kung Fu Panda
|
||||
|
||||
[Core]
|
||||
CPUThread = False
|
12
Data/Sys/GameSettings/RL6.ini
Normal file
12
Data/Sys/GameSettings/RL6.ini
Normal file
@ -0,0 +1,12 @@
|
||||
# RL6E69 - NERF N-Strike Elite
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
@ -1,5 +1,5 @@
|
||||
# RLIE64, RLIP64 - Lego Indiana Jones: The Original Adventures
|
||||
|
||||
[Video_Hacks]
|
||||
# Fixes the alpha value of glpyh puzzles; see https://bugs.dolphin-emu.org/issues/12987
|
||||
# Fixes the alpha value of glyph puzzles; see https://bugs.dolphin-emu.org/issues/12987
|
||||
MissingColorValue = 0xFFFFFF82
|
||||
|
@ -542,7 +542,7 @@ de000000 80008180
|
||||
30012d2c 2c000000
|
||||
14012d54 38030000
|
||||
e0000000 80008000
|
||||
*Carry Infinite Boosts instad of 3 in the minigame Cosmic Slalom
|
||||
*Carry Infinite Boosts instead of 3 in the minigame Cosmic Slalom
|
||||
|
||||
$Minigame - Lob to Rob: All Targets Worth 30 Points [gamemasterplc]
|
||||
48000000 800030c8
|
||||
|
@ -11,3 +11,4 @@
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
||||
EFBAccessEnable = True
|
||||
|
18
Data/Sys/GameSettings/RN3.ini
Normal file
18
Data/Sys/GameSettings/RN3.ini
Normal file
@ -0,0 +1,18 @@
|
||||
# RN3J78, RN3E78, RN3P78, RN3X78 - Nicktoons: Attack of the Toybots
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Enhancements]
|
||||
# Fixes FMVs
|
||||
ForceTextureFiltering = False
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
12
Data/Sys/GameSettings/RNK.ini
Normal file
12
Data/Sys/GameSettings/RNK.ini
Normal file
@ -0,0 +1,12 @@
|
||||
# RNKE69, RNKP69 - NERF N-Strike
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
@ -1,4 +1,16 @@
|
||||
# RQ4E78, RQ4J78, RQ4P78 - SpongeBob SquarePants: Creature from the Krusty Krab
|
||||
# RQ4E78, RQ4J78, RQ4P78 - SpongeBob SquarePants: Creature from the Krusty Krab [Wii]
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
SuggestedAspectRatio = 2
|
||||
|
||||
[Video_Hacks]
|
||||
ImmediateXFBEnable = False
|
||||
|
@ -1,4 +1,15 @@
|
||||
# RSAE78, RSAP78 - SpongeBob's Atlantis SquarePantis
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
SuggestedAspectRatio = 2
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 512
|
||||
|
18
Data/Sys/GameSettings/RUS.ini
Normal file
18
Data/Sys/GameSettings/RUS.ini
Normal file
@ -0,0 +1,18 @@
|
||||
# RUSX78, RUSK78, RUSE78, RUSP78, RUSY78 - SpongeBob SquarePants featuring Nicktoons: Globs of Doom
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Enhancements]
|
||||
# Fixes FMVs
|
||||
ForceTextureFiltering = False
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
@ -1,4 +1,14 @@
|
||||
# RVBERS, RVBPRS - Alvin and the Chipmunks
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Settings]
|
||||
SuggestedAspectRatio = 2
|
||||
|
5
Data/Sys/GameSettings/S3C.ini
Normal file
5
Data/Sys/GameSettings/S3C.ini
Normal file
@ -0,0 +1,5 @@
|
||||
# S3CENR - Triple Crown Championship Snowboarding
|
||||
|
||||
[Video_Hacks]
|
||||
# Fixes shadows.
|
||||
EFBToTextureEnable = False
|
35
Data/Sys/GameSettings/SDAE5G.ini
Normal file
35
Data/Sys/GameSettings/SDAE5G.ini
Normal file
@ -0,0 +1,35 @@
|
||||
# SDAE5G - The Daring Game for Girls
|
||||
|
||||
[OnFrame]
|
||||
# The game registers an AX callback function that uses a pointer which is only
|
||||
# initialized afterwards. The race condition depends on AID interrupt timing.
|
||||
# This patch moves the pointer initialization from 0x801C9E5C to 0x801C9DFC,
|
||||
# shifting the instructions in-between down.
|
||||
$Fix startup crash
|
||||
0x801C9DFC:dword:0x93EDBAB0
|
||||
0x801C9E00:dword:0x48030721
|
||||
0x801C9E04:dword:0x48032B8D
|
||||
0x801C9E08:dword:0x48063A89
|
||||
0x801C9E0C:dword:0x5460063F
|
||||
0x801C9E10:dword:0x41820018
|
||||
0x801C9E14:dword:0x2C000001
|
||||
0x801C9E18:dword:0x41820024
|
||||
0x801C9E1C:dword:0x2C000002
|
||||
0x801C9E20:dword:0x41820030
|
||||
0x801C9E24:dword:0x4800003C
|
||||
0x801C9E28:dword:0x38600000
|
||||
0x801C9E2C:dword:0x4802FF85
|
||||
0x801C9E30:dword:0x38600000
|
||||
0x801C9E34:dword:0x48032C9D
|
||||
0x801C9E38:dword:0x48000028
|
||||
0x801C9E3C:dword:0x38600000
|
||||
0x801C9E40:dword:0x4802FF71
|
||||
0x801C9E44:dword:0x38600001
|
||||
0x801C9E48:dword:0x48032C89
|
||||
0x801C9E4C:dword:0x48000014
|
||||
0x801C9E50:dword:0x38600001
|
||||
0x801C9E54:dword:0x4802FF5D
|
||||
0x801C9E58:dword:0x38600002
|
||||
0x801C9E5C:dword:0x48032C75
|
||||
[OnFrame_Enabled]
|
||||
$Fix startup crash
|
@ -10,8 +10,13 @@
|
||||
# Add action replay cheats here.
|
||||
|
||||
[Video_Enhancements]
|
||||
# Fixes FMVs
|
||||
ForceTextureFiltering = False
|
||||
|
||||
[Video_Settings]
|
||||
# Needed for some FMVs.
|
||||
SafeTextureCacheColorSamples = 0
|
||||
|
||||
[Video_Hacks]
|
||||
EFBToTextureEnable = False
|
||||
DeferEFBCopies = False
|
||||
|
5
Data/Sys/GameSettings/SH8.ini
Normal file
5
Data/Sys/GameSettings/SH8.ini
Normal file
@ -0,0 +1,5 @@
|
||||
# SH8E52, SH8P52 - Cabela's Adventure Camp
|
||||
|
||||
[Video_Hacks]
|
||||
# This keeps the in-game bloom effect from becoming brighter and brighter.
|
||||
EFBToTextureEnable = False
|
4
Data/Sys/GameSettings/SK4.ini
Normal file
4
Data/Sys/GameSettings/SK4.ini
Normal file
@ -0,0 +1,4 @@
|
||||
# SK4P52, SK4E52, SK4I52 - Shrek Forever After
|
||||
|
||||
[Core]
|
||||
CPUThread = False
|
12
Data/Sys/GameSettings/SN2.ini
Normal file
12
Data/Sys/GameSettings/SN2.ini
Normal file
@ -0,0 +1,12 @@
|
||||
# SN2E69, SN2P69 - NERF N-Strike Double Blast Bundle
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
# Dual Core mode causes FIFO error
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
||||
[ActionReplay]
|
||||
# Add action replay cheats here.
|
@ -2,6 +2,7 @@
|
||||
|
||||
[Core]
|
||||
# Values set here will override the main Dolphin settings.
|
||||
CPUThread = False
|
||||
|
||||
[OnFrame]
|
||||
# Add memory patches to be applied every frame here.
|
||||
|
5
Data/Sys/GameSettings/SUV.ini
Normal file
5
Data/Sys/GameSettings/SUV.ini
Normal file
@ -0,0 +1,5 @@
|
||||
# SUVE52, SUVP52 - Cabela's Dangerous Hunts 2013
|
||||
|
||||
[Video_Hacks]
|
||||
# This keeps the in-game bloom effect from becoming brighter and brighter.
|
||||
EFBToTextureEnable = False
|
7
Data/Sys/GameSettings/WMOEE9.ini
Normal file
7
Data/Sys/GameSettings/WMOEE9.ini
Normal file
@ -0,0 +1,7 @@
|
||||
# WMOEE9 - Moki Moki
|
||||
|
||||
[OnFrame_Enabled]
|
||||
$Fix startup hang
|
||||
[OnFrame]
|
||||
$Fix startup hang
|
||||
0x8001729C:dword:0x4182FFF8
|
7
Data/Sys/GameSettings/WMOJE9.ini
Normal file
7
Data/Sys/GameSettings/WMOJE9.ini
Normal file
@ -0,0 +1,7 @@
|
||||
# WMOJE9 - Anata ga Mawashite Sukuu Puzzle - Mochi Mochi Q
|
||||
|
||||
[OnFrame_Enabled]
|
||||
$Fix startup hang
|
||||
[OnFrame]
|
||||
$Fix startup hang
|
||||
0x80018894:dword:0x4182FFF8
|
7
Data/Sys/GameSettings/WMOPE9.ini
Normal file
7
Data/Sys/GameSettings/WMOPE9.ini
Normal file
@ -0,0 +1,7 @@
|
||||
# WMOPE9 - Moki Moki
|
||||
|
||||
[OnFrame_Enabled]
|
||||
$Fix startup hang
|
||||
[OnFrame]
|
||||
$Fix startup hang
|
||||
0x8001729C:dword:0x4182FFF8
|
@ -165,7 +165,7 @@
|
||||
|
||||
{
|
||||
"type": "draw_started",
|
||||
"prettyname": "Buttom Prompt Y",
|
||||
"prettyname": "Button Prompt Y",
|
||||
"texture_filename": "tex1_32x32_15f350b2b7f46481_66860824280a89bf_8"
|
||||
},
|
||||
{
|
||||
@ -180,7 +180,7 @@
|
||||
},
|
||||
{
|
||||
"type": "draw_started",
|
||||
"prettyname": "Buttom Prompt B",
|
||||
"prettyname": "Button Prompt B",
|
||||
"texture_filename": "tex1_32x32_ce62786fc1170192_70b585e07941e91c_8"
|
||||
},
|
||||
{
|
||||
@ -195,7 +195,7 @@
|
||||
},
|
||||
{
|
||||
"type": "draw_started",
|
||||
"prettyname": "Buttom Prompt X",
|
||||
"prettyname": "Button Prompt X",
|
||||
"texture_filename": "tex1_32x32_b52817e68be0e2d7_d1b283ce04ce1c7c_8"
|
||||
},
|
||||
{
|
||||
@ -205,7 +205,7 @@
|
||||
},
|
||||
{
|
||||
"type": "draw_started",
|
||||
"prettyname": "Buttom Prompt A",
|
||||
"prettyname": "Button Prompt A",
|
||||
"texture_filename": "tex1_32x32_630cfa888a9d005a_d95570935377e345_8"
|
||||
},
|
||||
{
|
||||
|
BIN
Data/Sys/Resources/Platform_Triforce.png
Normal file
BIN
Data/Sys/Resources/Platform_Triforce.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
Data/Sys/Resources/Platform_Triforce@2x.png
Normal file
BIN
Data/Sys/Resources/Platform_Triforce@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
Data/Sys/Resources/Platform_Triforce@4x.png
Normal file
BIN
Data/Sys/Resources/Platform_Triforce@4x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
@ -106,14 +106,14 @@ void main()
|
||||
// scaling while also being able to use the luminance channel.
|
||||
float4 ictcp_color = LinearRGBToICtCP(color);
|
||||
|
||||
// Scale the color in perceptual space depending on the percieved luminance.
|
||||
// Scale the color in perceptual space depending on the perceived luminance.
|
||||
//
|
||||
// At low luminances, ~0.0, pow(AMPLIFICATION, ~0.0) ~= 1.0, so the
|
||||
// color will appear to be unchanged. This is important as we don't want to
|
||||
// over expose dark colors which would not have otherwise been seen.
|
||||
//
|
||||
// At high luminances, ~1.0, pow(AMPLIFICATION, ~1.0) ~= AMPLIFICATION,
|
||||
// which is equivilant to scaling the color by AMPLIFICATION. This is
|
||||
// which is equivalent to scaling the color by AMPLIFICATION. This is
|
||||
// important as we want to get the most out of the display, and we want to
|
||||
// get bright colors to hit their target brightness.
|
||||
//
|
||||
|
@ -391,7 +391,7 @@ bool supportsSIMD(uint simd_width)
|
||||
#endif
|
||||
}
|
||||
|
||||
// "Error: The AsciiArt shader requires the missing GPU extention KHR_shader_subgroup."
|
||||
// "Error: The AsciiArt shader requires the missing GPU extension KHR_shader_subgroup."
|
||||
const uint missing_subgroup_warning_len = 82;
|
||||
const uint missing_subgroup_warning[missing_subgroup_warning_len] = {
|
||||
37, 82, 82, 79, 82, 26, 95, 52, 72, 69, 95, 33, 83, 67, 73, 73, 33, 82, 84, 95, 83,
|
||||
|
@ -38,6 +38,22 @@ float3 LinearTosRGBGamma(float3 color)
|
||||
return color;
|
||||
}
|
||||
|
||||
float3 Rec709_Luminance = float3(0.2126, 0.7152, 0.0722);
|
||||
|
||||
float Luminance(float3 color, bool native_color_space)
|
||||
{
|
||||
if (native_color_space && OptionEnabled(correct_color_space))
|
||||
{
|
||||
if (game_color_space == 0)
|
||||
color *= from_NTSCM;
|
||||
else if (game_color_space == 1)
|
||||
color *= from_NTSCJ;
|
||||
else if (game_color_space == 2)
|
||||
color *= from_PAL;
|
||||
}
|
||||
return dot(color, Rec709_Luminance);
|
||||
}
|
||||
|
||||
/***** COLOR SAMPLING *****/
|
||||
|
||||
// Non filtered gamma corrected sample (nearest neighbor)
|
||||
@ -89,7 +105,23 @@ float4 BilinearSample(float3 uvw, float gamma)
|
||||
float4 c22 = QuickSampleByPixel(int_pixel + float2(1.5, 1.5), uvw.z, gamma);
|
||||
|
||||
// Blend the 4 samples by their weight
|
||||
return lerp(lerp(c11, c21, frac_pixel.x), lerp(c12, c22, frac_pixel.x), frac_pixel.y);
|
||||
float4 avg_c = lerp(lerp(c11, c21, frac_pixel.x), lerp(c12, c22, frac_pixel.x), frac_pixel.y);
|
||||
|
||||
// Calculate the average of the gamma space luminance, as that can be used to
|
||||
// properly determine the perceptual brightness the color should have.
|
||||
float l11 = pow(Luminance(c11.rgb, true), 1.0 / gamma);
|
||||
float l21 = pow(Luminance(c21.rgb, true), 1.0 / gamma);
|
||||
float l12 = pow(Luminance(c12.rgb, true), 1.0 / gamma);
|
||||
float l22 = pow(Luminance(c22.rgb, true), 1.0 / gamma);
|
||||
float target_avg_c_lum = lerp(lerp(l11, l21, frac_pixel.x), lerp(l12, l22, frac_pixel.x), frac_pixel.y);
|
||||
|
||||
float avg_c_lum = Luminance(avg_c.rgb, true);
|
||||
if (avg_c_lum != 0.0)
|
||||
{
|
||||
avg_c.rgb *= pow(target_avg_c_lum, gamma) / avg_c_lum;
|
||||
}
|
||||
|
||||
return avg_c;
|
||||
}
|
||||
|
||||
/***** Bicubic Interpolation *****/
|
||||
@ -173,7 +205,7 @@ float4 SharpBilinearSample(float3 uvw, float gamma)
|
||||
float2 texel = uvw.xy * source_size;
|
||||
float2 texel_floored = floor(texel);
|
||||
float2 s = fract(texel);
|
||||
float scale = max(floor(max(target_size.x * inverted_source_size.x, target_size.y * inverted_source_size.y)), 1.f);
|
||||
float scale = max(floor(max(target_size.x * inverted_source_size.x, target_size.y * inverted_source_size.y)), 1.0);
|
||||
float region_range = 0.5 - (0.5 / scale);
|
||||
|
||||
// Figure out where in the texel to sample to get correct pre-scaled bilinear.
|
||||
@ -228,15 +260,28 @@ float4 AreaSampling(float3 uvw, float gamma)
|
||||
|
||||
// Initialize the color accumulator.
|
||||
float4 avg_color = float4(0.0, 0.0, 0.0, 0.0);
|
||||
float avg_luminance = 0.0;
|
||||
float4 temp_color;
|
||||
|
||||
float luminance_gamma = gamma; // For now, default to the user selected gamma (alternatively we could fix it to anything between 2.2 and 3.0)
|
||||
float luminance_inv_gamma = 1.0 / luminance_gamma;
|
||||
|
||||
// Prevents rounding errors due to the coordinates flooring above
|
||||
const float2 offset = float2(0.5, 0.5);
|
||||
|
||||
// Accumulate corner pixels.
|
||||
avg_color += area_nw * QuickSampleByPixel(float2(f_beg.x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_ne * QuickSampleByPixel(float2(f_end.x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_sw * QuickSampleByPixel(float2(f_beg.x, f_end.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_se * QuickSampleByPixel(float2(f_end.x, f_end.y) + offset, uvw.z, gamma);
|
||||
temp_color = QuickSampleByPixel(float2(f_beg.x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_nw * temp_color;
|
||||
avg_luminance += area_nw * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
temp_color = QuickSampleByPixel(float2(f_end.x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_ne * temp_color;
|
||||
avg_luminance += area_ne * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
temp_color = QuickSampleByPixel(float2(f_beg.x, f_end.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_sw * temp_color;
|
||||
avg_luminance += area_sw * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
temp_color = QuickSampleByPixel(float2(f_end.x, f_end.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_se * temp_color;
|
||||
avg_luminance += area_se * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
|
||||
// Determine the size of the pixel box.
|
||||
int x_range = int(f_end.x - f_beg.x - 0.5);
|
||||
@ -258,8 +303,12 @@ float4 AreaSampling(float3 uvw, float gamma)
|
||||
if (ix < x_range)
|
||||
{
|
||||
float x = f_beg.x + 1.0 + float(ix);
|
||||
avg_color += area_n * QuickSampleByPixel(float2(x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_s * QuickSampleByPixel(float2(x, f_end.y) + offset, uvw.z, gamma);
|
||||
temp_color = QuickSampleByPixel(float2(x, f_beg.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_n * temp_color;
|
||||
avg_luminance += area_n * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
temp_color = QuickSampleByPixel(float2(x, f_end.y) + offset, uvw.z, gamma);
|
||||
avg_color += area_s * temp_color;
|
||||
avg_luminance += area_s * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,16 +318,22 @@ float4 AreaSampling(float3 uvw, float gamma)
|
||||
if (iy < y_range)
|
||||
{
|
||||
float y = f_beg.y + 1.0 + float(iy);
|
||||
|
||||
avg_color += area_w * QuickSampleByPixel(float2(f_beg.x, y) + offset, uvw.z, gamma);
|
||||
avg_color += area_e * QuickSampleByPixel(float2(f_end.x, y) + offset, uvw.z, gamma);
|
||||
|
||||
temp_color = QuickSampleByPixel(float2(f_beg.x, y) + offset, uvw.z, gamma);
|
||||
avg_color += area_w * temp_color;
|
||||
avg_luminance += area_w * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
temp_color = QuickSampleByPixel(float2(f_end.x, y) + offset, uvw.z, gamma);
|
||||
avg_color += area_e * temp_color;
|
||||
avg_luminance += area_e * pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
|
||||
for (int ix = 0; ix < max_iterations; ++ix)
|
||||
{
|
||||
if (ix < x_range)
|
||||
{
|
||||
float x = f_beg.x + 1.0 + float(ix);
|
||||
avg_color += QuickSampleByPixel(float2(x, y) + offset, uvw.z, gamma);
|
||||
temp_color = QuickSampleByPixel(float2(x, y) + offset, uvw.z, gamma);
|
||||
avg_color += temp_color;
|
||||
avg_luminance += pow(Luminance(temp_color.rgb, true), luminance_inv_gamma);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,9 +343,22 @@ float4 AreaSampling(float3 uvw, float gamma)
|
||||
float area_corners = area_nw + area_ne + area_sw + area_se;
|
||||
float area_edges = float(x_range) * (area_n + area_s) + float(y_range) * (area_w + area_e);
|
||||
float area_center = float(x_range) * float(y_range);
|
||||
|
||||
float4 nrm_color = avg_color / (area_corners + area_edges + area_center);
|
||||
float target_nrm_color_luminance = avg_luminance / (area_corners + area_edges + area_center);
|
||||
|
||||
// Restore the averaged "gamma" space luminance, for better gamma correction.
|
||||
// This retains the best feature of gamma correct sampling (no hue shifts),
|
||||
// while also maintaining the perceptual "brightness" level of blending two colors with an alpha
|
||||
// (in linear space a 0.5 alpha won't produce a color that has a perceptual brightness in the middle point of the two source colors).
|
||||
float nrm_color_luminance = Luminance(nrm_color.rgb, true);
|
||||
if (nrm_color_luminance != 0.0)
|
||||
{
|
||||
nrm_color.rgb *= pow(target_nrm_color_luminance, luminance_gamma) / nrm_color_luminance;
|
||||
}
|
||||
|
||||
// Return the normalized average color.
|
||||
return avg_color / (area_corners + area_edges + area_center);
|
||||
return nrm_color;
|
||||
}
|
||||
|
||||
/***** Main Functions *****/
|
||||
@ -353,7 +421,7 @@ void main()
|
||||
// Doing linear sampling in "gamma space" on linear texture formats isn't correct.
|
||||
// If the source and target resolutions don't match, the GPU will return a color
|
||||
// that is the average of 4 gamma space colors, but gamma space colors can't be blended together,
|
||||
// gamma neeeds to be de-applied first. This makes a big difference if colors change
|
||||
// gamma needs to be de-applied first. This makes a big difference if colors change
|
||||
// drastically between two pixels.
|
||||
|
||||
color = LinearGammaCorrectedSample(game_gamma);
|
||||
@ -401,7 +469,7 @@ void main()
|
||||
// Restore the original gamma without changes
|
||||
else
|
||||
{
|
||||
color.rgb = pow(color.rgb, float3(1.0 / game_gamma));
|
||||
color.rgb = pow(color.rgb, float3(1.0 / game_gamma));
|
||||
}
|
||||
|
||||
SetOutput(color);
|
||||
|
@ -40,7 +40,7 @@ void main()
|
||||
|
||||
/*****inline square root routines*****/
|
||||
// bit of a performance bottleneck.
|
||||
// neccessary to make the darkened area rounded
|
||||
// necessary to make the darkened area rounded
|
||||
// instead of rhombus-shaped.
|
||||
float sqrt = x / 10.0;
|
||||
|
||||
|
@ -50,7 +50,7 @@ void main()
|
||||
|
||||
//****inline square root routines*****/
|
||||
// bit of a performance bottleneck.
|
||||
// neccessary to make the darkened area rounded
|
||||
// necessary to make the darkened area rounded
|
||||
// instead of rhombus-shaped.
|
||||
float sqrt = x / 10.0;
|
||||
while ((sqrt*sqrt) < x)
|
||||
|
10
Data/Sys/triforcetdb-en.txt
Normal file
10
Data/Sys/triforcetdb-en.txt
Normal file
@ -0,0 +1,10 @@
|
||||
TITLES = (type: Triforce language: EN version: 20210908)
|
||||
S000 = Triforce Firmware Update For Compact Flash Box (4.01)
|
||||
SBEY = Virtua Striker 2002
|
||||
SBFX = The Key Of Avalon
|
||||
SBGG = F-Zero AX
|
||||
SBHZ = Virtua Striker 4 (Asia)
|
||||
SBJA = Virtua Striker 4 (Export)
|
||||
SBJN = The Key Of Avalon 2.5: War of the Key
|
||||
SBLK = Virtua Striker 4 Ver.2006 (Japan)
|
||||
SBLL = Virtua Striker 4 Ver.2006 (Export)
|
@ -1,7 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Icon=dolphin-emu
|
||||
Exec=env QT_QPA_PLATFORM=xcb dolphin-emu
|
||||
Exec=dolphin-emu
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;Emulator;
|
||||
|
35
Externals/SFML/CMakeLists.txt
vendored
35
Externals/SFML/CMakeLists.txt
vendored
@ -1,31 +1,34 @@
|
||||
set(SRC_NETWORK
|
||||
src/SFML/Network/Http.cpp
|
||||
src/SFML/Network/IPAddress.cpp
|
||||
src/SFML/Network/Packet.cpp
|
||||
src/SFML/Network/Socket.cpp
|
||||
src/SFML/Network/SocketSelector.cpp
|
||||
src/SFML/Network/TcpListener.cpp
|
||||
src/SFML/Network/TcpSocket.cpp
|
||||
src/SFML/Network/UdpSocket.cpp
|
||||
SFML/src/SFML/Network/Http.cpp
|
||||
SFML/src/SFML/Network/IpAddress.cpp
|
||||
SFML/src/SFML/Network/Packet.cpp
|
||||
SFML/src/SFML/Network/Socket.cpp
|
||||
SFML/src/SFML/Network/SocketSelector.cpp
|
||||
SFML/src/SFML/Network/TcpListener.cpp
|
||||
SFML/src/SFML/Network/TcpSocket.cpp
|
||||
SFML/src/SFML/Network/UdpSocket.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND SRC_NETWORK src/SFML/Network/Win32/SocketImpl.cpp)
|
||||
list(APPEND SRC_NETWORK SFML/src/SFML/Network/Win32/SocketImpl.cpp)
|
||||
else()
|
||||
list(APPEND SRC_NETWORK src/SFML/Network/Unix/SocketImpl.cpp)
|
||||
list(APPEND SRC_NETWORK SFML/src/SFML/Network/Unix/SocketImpl.cpp)
|
||||
endif()
|
||||
|
||||
set(SRC_SYSTEM
|
||||
src/SFML/System/Err.cpp
|
||||
src/SFML/System/String.cpp
|
||||
src/SFML/System/Time.cpp
|
||||
SFML/src/SFML/System/Err.cpp
|
||||
SFML/include/SFML/System/String.hpp
|
||||
SFML/src/SFML/System/String.cpp
|
||||
SFML/src/SFML/System/Utils.cpp
|
||||
)
|
||||
|
||||
add_library(sfml-network STATIC ${SRC_NETWORK})
|
||||
add_library(sfml-system STATIC ${SRC_SYSTEM})
|
||||
target_compile_features(sfml-network PUBLIC cxx_std_17)
|
||||
target_compile_features(sfml-system PUBLIC cxx_std_17)
|
||||
target_compile_definitions(sfml-system PUBLIC SFML_STATIC)
|
||||
target_include_directories(sfml-system PUBLIC include PRIVATE src)
|
||||
target_include_directories(sfml-network PUBLIC include PRIVATE src)
|
||||
target_include_directories(sfml-system PUBLIC SFML/include PRIVATE SFML/src)
|
||||
target_include_directories(sfml-network PUBLIC SFML/include PRIVATE SFML/src)
|
||||
target_link_libraries(sfml-network PUBLIC sfml-system)
|
||||
dolphin_disable_warnings(sfml-network)
|
||||
dolphin_disable_warnings(sfml-system)
|
||||
dolphin_disable_warnings(sfml-system)
|
1
Externals/SFML/SFML
vendored
Submodule
1
Externals/SFML/SFML
vendored
Submodule
Submodule Externals/SFML/SFML added at 7f1162dfea
67
Externals/SFML/SFML.vcxproj
vendored
Normal file
67
Externals/SFML/SFML.vcxproj
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Import Project="..\..\Source\VSProps\Base.Macros.props" />
|
||||
<Import Project="$(VSPropsDir)Base.Targets.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{93D73454-2512-424E-9CDA-4BB357FE13DD}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VSPropsDir)Configuration.StaticLibrary.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
|
||||
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
|
||||
Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VSPropsDir)Base.props" />
|
||||
<Import Project="$(VSPropsDir)ClDisableAllWarnings.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>SFML\include;SFML\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SFML\src\SFML\Network\Http.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\IpAddress.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\Packet.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\Socket.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\SocketSelector.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\TcpListener.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\TcpSocket.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\UdpSocket.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\Network\Win32\SocketImpl.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\System\Err.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\System\String.cpp" />
|
||||
<ClCompile Include="SFML\src\SFML\System\Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SFML\include\SFML\Config.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\Export.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\Http.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\IPAddress.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\Packet.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\Socket.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\SocketHandle.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\SocketSelector.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\TcpListener.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\TcpSocket.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\Network\UdpSocket.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\Err.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\Export.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\NonCopyable.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\String.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\String.inl" />
|
||||
<ClInclude Include="SFML\include\SFML\System\Utf.hpp" />
|
||||
<ClInclude Include="SFML\include\SFML\System\Utf.inl" />
|
||||
<ClInclude Include="SFML\src\SFML\Network\SocketImpl.hpp" />
|
||||
<ClInclude Include="SFML\src\SFML\Network\Win32\SocketImpl.hpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
66
Externals/SFML/build/vc2010/SFML_Network.vcxproj
vendored
66
Externals/SFML/build/vc2010/SFML_Network.vcxproj
vendored
@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Import Project="..\..\..\..\Source\VSProps\Base.Macros.props" />
|
||||
<Import Project="$(VSPropsDir)Base.Targets.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{93D73454-2512-424E-9CDA-4BB357FE13DD}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VSPropsDir)Configuration.StaticLibrary.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VSPropsDir)Base.props" />
|
||||
<Import Project="$(VSPropsDir)ClDisableAllWarnings.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\SFML\Network\Http.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\IPAddress.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Packet.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Socket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\SocketSelector.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\TcpListener.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\TcpSocket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\UdpSocket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Win32\SocketImpl.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\System\Err.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\System\String.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\System\Time.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\SFML\Config.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Export.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Http.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\IPAddress.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Packet.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Socket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\SocketHandle.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\SocketSelector.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\TcpListener.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\TcpSocket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\UdpSocket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Err.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Export.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\NonCopyable.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\String.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\String.inl" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Time.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Utf.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Utf.inl" />
|
||||
<ClInclude Include="..\..\src\SFML\Network\SocketImpl.hpp" />
|
||||
<ClInclude Include="..\..\src\SFML\Network\Win32\SocketImpl.hpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\SFML\Network\Http.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\IPAddress.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Packet.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Socket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\SocketSelector.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\TcpListener.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\TcpSocket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\UdpSocket.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\Network\Win32\SocketImpl.cpp">
|
||||
<Filter>Win32</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\SFML\System\Err.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\System\String.cpp" />
|
||||
<ClCompile Include="..\..\src\SFML\System\Time.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\SFML\Config.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Export.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Http.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\IPAddress.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Packet.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\Socket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\SocketHandle.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\SocketSelector.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\TcpListener.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\TcpSocket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\Network\UdpSocket.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Err.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Export.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\NonCopyable.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\String.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\String.inl" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Time.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Utf.hpp" />
|
||||
<ClInclude Include="..\..\include\SFML\System\Utf.inl" />
|
||||
<ClInclude Include="..\..\src\SFML\Network\SocketImpl.hpp" />
|
||||
<ClInclude Include="..\..\src\SFML\Network\Win32\SocketImpl.hpp">
|
||||
<Filter>Win32</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Win32">
|
||||
<UniqueIdentifier>{8280ecca-24fc-48a2-b7f5-6aca41826b66}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
6
Externals/SFML/exports.props
vendored
6
Externals/SFML/exports.props
vendored
@ -2,13 +2,13 @@
|
||||
<Project>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)SFML\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)SFML\SFML\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(ExternalsDir)SFML\build\vc2010\SFML_Network.vcxproj">
|
||||
<ProjectReference Include="$(ExternalsDir)SFML\SFML.vcxproj">
|
||||
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
236
Externals/SFML/include/SFML/Config.hpp
vendored
236
Externals/SFML/include/SFML/Config.hpp
vendored
@ -1,236 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONFIG_HPP
|
||||
#define SFML_CONFIG_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define the SFML version
|
||||
////////////////////////////////////////////////////////////
|
||||
#define SFML_VERSION_MAJOR 2
|
||||
#define SFML_VERSION_MINOR 5
|
||||
#define SFML_VERSION_PATCH 0
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Identify the operating system
|
||||
// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
|
||||
////////////////////////////////////////////////////////////
|
||||
#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
|
||||
|
||||
#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
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define a portable debug macro
|
||||
////////////////////////////////////////////////////////////
|
||||
#if !defined(NDEBUG)
|
||||
|
||||
#define SFML_DEBUG
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define 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 warning
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#pragma warning(disable: 4251)
|
||||
|
||||
#endif
|
||||
|
||||
#else // Linux, FreeBSD, Mac OS X
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
|
||||
// GCC 4 has special keywords for showing/hidding symbols,
|
||||
// the same keyword is used for both importing and exporting
|
||||
#define SFML_API_EXPORT __attribute__ ((__visibility__ ("default")))
|
||||
#define SFML_API_IMPORT __attribute__ ((__visibility__ ("default")))
|
||||
|
||||
#else
|
||||
|
||||
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
|
||||
#define SFML_API_EXPORT
|
||||
#define SFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Static build doesn't need import/export macros
|
||||
#define SFML_API_EXPORT
|
||||
#define SFML_API_IMPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Cross-platform warning for deprecated functions and classes
|
||||
//
|
||||
// Usage:
|
||||
// class SFML_DEPRECATED MyClass
|
||||
// {
|
||||
// SFML_DEPRECATED void memberFunc();
|
||||
// };
|
||||
//
|
||||
// SFML_DEPRECATED void globalFunc();
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_NO_DEPRECATED_WARNINGS)
|
||||
|
||||
// User explicitly requests to disable deprecation warnings
|
||||
#define SFML_DEPRECATED
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
// Microsoft C++ compiler
|
||||
// Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
|
||||
// trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
|
||||
#define SFML_DEPRECATED __declspec(deprecated)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
// g++ and Clang
|
||||
#define SFML_DEPRECATED __attribute__ ((deprecated))
|
||||
|
||||
#else
|
||||
|
||||
// Other compilers are not supported, leave class or function as-is.
|
||||
// With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
|
||||
#pragma message("SFML_DEPRECATED is not supported for your compiler, please contact the SFML team")
|
||||
#define SFML_DEPRECATED
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define portable fixed-size types
|
||||
////////////////////////////////////////////////////////////
|
||||
namespace sf
|
||||
{
|
||||
// All "common" platforms use the same size for char, short and int
|
||||
// (basically there are 3 types for 3 sizes, so no other match is possible),
|
||||
// we can use them without doing any kind of check
|
||||
|
||||
// 8 bits integer types
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char Uint8;
|
||||
|
||||
// 16 bits integer types
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short Uint16;
|
||||
|
||||
// 32 bits integer types
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int Uint32;
|
||||
|
||||
// 64 bits integer types
|
||||
#if defined(_MSC_VER)
|
||||
typedef signed __int64 Int64;
|
||||
typedef unsigned __int64 Uint64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long Uint64;
|
||||
#endif
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_CONFIG_HPP
|
55
Externals/SFML/include/SFML/Network.hpp
vendored
55
Externals/SFML/include/SFML/Network.hpp
vendored
@ -1,55 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_HPP
|
||||
#define SFML_NETWORK_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.hpp>
|
||||
//#include <SFML/Network/Ftp.hpp>
|
||||
#include <SFML/Network/Http.hpp>
|
||||
|
||||
// This file is "IpAddress.hpp" upstream
|
||||
#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>
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \defgroup network Network module
|
||||
///
|
||||
/// Socket-based communication, utilities and higher-level
|
||||
/// network protocols (HTTP, FTP).
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
48
Externals/SFML/include/SFML/Network/Export.hpp
vendored
48
Externals/SFML/include/SFML/Network/Export.hpp
vendored
@ -1,48 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_EXPORT_HPP
|
||||
#define SFML_NETWORK_EXPORT_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define 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
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_EXPORT_HPP
|
482
Externals/SFML/include/SFML/Network/Http.hpp
vendored
482
Externals/SFML/include/SFML/Network/Http.hpp
vendored
@ -1,482 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_HTTP_HPP
|
||||
#define SFML_HTTP_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/Network/IPAddress.hpp>
|
||||
#include <SFML/Network/TcpSocket.hpp>
|
||||
#include <SFML/System/NonCopyable.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief A HTTP client
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API Http : NonCopyable
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define a HTTP request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API Request
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumerate the available HTTP methods for a request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum 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 = 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 availale methods.
|
||||
/// The method is Http::Request::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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool hasField(const std::string& field) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef std::map<std::string, std::string> FieldTable;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// 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; ///< Major HTTP version
|
||||
unsigned int m_minorVersion; ///< Minor HTTP version
|
||||
std::string m_body; ///< Body of the request
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define a HTTP response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API Response
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumerate all the valid status codes for a response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum 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 Default constructor
|
||||
///
|
||||
/// Constructs an empty response.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the value of a field
|
||||
///
|
||||
/// If the field \a 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status getStatus() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the major HTTP version number of the response
|
||||
///
|
||||
/// \return Major HTTP version number
|
||||
///
|
||||
/// \see getMinorHttpVersion
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int getMajorHttpVersion() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the minor HTTP version number of the response
|
||||
///
|
||||
/// \return Minor HTTP version number
|
||||
///
|
||||
/// \see getMajorHttpVersion
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef std::map<std::string, std::string> FieldTable;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
FieldTable m_fields; ///< Fields of the header
|
||||
Status m_status; ///< 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();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response sendRequest(const Request& request, Time timeout = Time::Zero);
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
TcpSocket m_connection; ///< Connection to the host
|
||||
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
|
||||
|
||||
|
||||
#endif // SFML_HTTP_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Http
|
||||
/// \ingroup network
|
||||
///
|
||||
/// sf::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 sf::Http::Request
|
||||
/// \li sf::Http::Response
|
||||
/// \li sf::Http
|
||||
///
|
||||
/// sf::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)
|
||||
///
|
||||
/// sf::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
|
||||
///
|
||||
/// sf::Http provides a simple function, SendRequest, to send a
|
||||
/// sf::Http::Request and return the corresponding sf::Http::Response
|
||||
/// from the server.
|
||||
///
|
||||
/// Usage example:
|
||||
/// \code
|
||||
/// // Create a new HTTP client
|
||||
/// sf::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
|
||||
/// sf::Http::Request request("features.php");
|
||||
///
|
||||
/// // Send the request
|
||||
/// sf::Http::Response response = http.sendRequest(request);
|
||||
///
|
||||
/// // Check the status code and display the result
|
||||
/// sf::Http::Response::Status status = response.getStatus();
|
||||
/// if (status == sf::Http::Response::Ok)
|
||||
/// {
|
||||
/// std::cout << response.getBody() << std::endl;
|
||||
/// }
|
||||
/// else
|
||||
/// {
|
||||
/// std::cout << "Error " << status << std::endl;
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
328
Externals/SFML/include/SFML/Network/IPAddress.hpp
vendored
328
Externals/SFML/include/SFML/Network/IPAddress.hpp
vendored
@ -1,328 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_IPADDRESS_HPP
|
||||
#define SFML_IPADDRESS_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encapsulate an IPv4 network address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API IpAddress
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// This constructor creates an empty (invalid) address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IpAddress();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the address from a string
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IpAddress(const std::string& address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the address from a string
|
||||
///
|
||||
/// Here \a address can be either a decimal address
|
||||
/// (ex: "192.168.1.56") or a network name (ex: "localhost").
|
||||
/// This is equivalent to the constructor taking a std::string
|
||||
/// parameter, it is defined for convenience so that the
|
||||
/// implicit conversions from literal strings to IpAddress work.
|
||||
///
|
||||
/// \param address IP address or network name
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IpAddress(const char* address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the address from 4 bytes
|
||||
///
|
||||
/// Calling IpAddress(a, b, c, d) is equivalent to calling
|
||||
/// IpAddress("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(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 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(Uint32 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 sf::IpAddress with the proper constructor.
|
||||
///
|
||||
/// \return 32-bits unsigned integer representation of the address
|
||||
///
|
||||
/// \see toString
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 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
|
||||
///
|
||||
/// \see getPublicAddress
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static 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
|
||||
///
|
||||
/// \see getLocalAddress
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static IpAddress getPublicAddress(Time timeout = Time::Zero);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
////////////////////////////////////////////////////////////
|
||||
static const IpAddress None; ///< Value representing an empty/invalid address
|
||||
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)
|
||||
|
||||
private:
|
||||
|
||||
friend SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Resolve the given address string
|
||||
///
|
||||
/// \param address Address string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void resolve(const std::string& address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 m_address; ///< Address stored as an unsigned 32 bits integer
|
||||
bool m_valid; ///< Is the address valid?
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator ==(const IpAddress& left, const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator !=(const IpAddress& left, const 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 than \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator <(const IpAddress& left, const 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 greater than \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator >(const IpAddress& left, const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator <=(const IpAddress& left, const 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 greater or equal than \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_NETWORK_API bool operator >=(const IpAddress& left, const 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, 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, const IpAddress& address);
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_IPADDRESS_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::IpAddress
|
||||
/// \ingroup network
|
||||
///
|
||||
/// sf::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
|
||||
/// sf::IpAddress a0; // an invalid address
|
||||
/// sf::IpAddress a1 = sf::IpAddress::None; // an invalid address (same as a0)
|
||||
/// sf::IpAddress a2("127.0.0.1"); // the local host address
|
||||
/// sf::IpAddress a3 = sf::IpAddress::Broadcast; // the broadcast address
|
||||
/// sf::IpAddress a4(192, 168, 1, 56); // a local address
|
||||
/// sf::IpAddress a5("my_computer"); // a local address created from a network name
|
||||
/// sf::IpAddress a6("89.54.1.169"); // a distant address
|
||||
/// sf::IpAddress a7("www.google.com"); // a distant address created from a network name
|
||||
/// sf::IpAddress a8 = sf::IpAddress::getLocalAddress(); // my address on the local network
|
||||
/// sf::IpAddress a9 = sf::IpAddress::getPublicAddress(); // my address on the internet
|
||||
/// \endcode
|
||||
///
|
||||
/// Note that sf::IpAddress currently doesn't support IPv6
|
||||
/// nor other types of network addresses.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
532
Externals/SFML/include/SFML/Network/Packet.hpp
vendored
532
Externals/SFML/include/SFML/Network/Packet.hpp
vendored
@ -1,532 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_PACKET_HPP
|
||||
#define SFML_PACKET_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class String;
|
||||
class TcpSocket;
|
||||
class UdpSocket;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Utility class to build blocks of data to transfer
|
||||
/// over the network
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API Packet
|
||||
{
|
||||
// A bool-like type that cannot be converted to integer or pointer types
|
||||
typedef bool (Packet::*BoolType)(std::size_t);
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Creates an empty packet.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Virtual destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual ~Packet();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void append(const void* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 NULL if the packet is empty.
|
||||
///
|
||||
/// \return Pointer to the data
|
||||
///
|
||||
/// \see getDataSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool endOfPacket() const;
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
operator BoolType() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Overload of operator >> to read data from the packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(bool& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Int8& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Uint8& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Int16& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Uint16& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Int32& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Uint32& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Int64& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(Uint64& 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 <<(Int8 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Uint8 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Int16 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Uint16 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Int32 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Uint32 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Int64 data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(Uint64 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:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Disallow comparisons between packets
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const Packet& right) const;
|
||||
bool operator !=(const Packet& right) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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<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; ///< Reading state of the packet
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_PACKET_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Packet
|
||||
/// \ingroup network
|
||||
///
|
||||
/// Packets provide a safe and easy way to serialize data,
|
||||
/// in order to send it over the network using sockets
|
||||
/// (sf::TcpSocket, sf::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 sf::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 sf::Int32, 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
|
||||
/// sf::Uint32 x = 24;
|
||||
/// std::string s = "hello";
|
||||
/// double d = 5.89;
|
||||
///
|
||||
/// // Group the variables to send into a packet
|
||||
/// sf::Packet packet;
|
||||
/// packet << x << s << d;
|
||||
///
|
||||
/// // Send it over the network (socket is a valid sf::TcpSocket)
|
||||
/// socket.send(packet);
|
||||
///
|
||||
/// -----------------------------------------------------------------
|
||||
///
|
||||
/// // Receive the packet at the other end
|
||||
/// sf::Packet packet;
|
||||
/// socket.receive(packet);
|
||||
///
|
||||
/// // Extract the variables contained in the packet
|
||||
/// sf::Uint32 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 (sf::Int8/16/32, sf::Uint8/16/32)
|
||||
/// \li floating point numbers (float, double)
|
||||
/// \li string types (char*, wchar_t*, std::string, std::wstring, sf::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;
|
||||
/// sf::Int8 integer;
|
||||
/// std::string str;
|
||||
/// };
|
||||
///
|
||||
/// sf::Packet& operator <<(sf::Packet& packet, const MyStruct& m)
|
||||
/// {
|
||||
/// return packet << m.number << m.integer << m.str;
|
||||
/// }
|
||||
///
|
||||
/// sf::Packet& operator >>(sf::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 sf::Packet, and overriding
|
||||
/// the onSend and onReceive functions.
|
||||
///
|
||||
/// Here is an example:
|
||||
/// \code
|
||||
/// class ZipPacket : public sf::Packet
|
||||
/// {
|
||||
/// virtual const void* onSend(std::size_t& size)
|
||||
/// {
|
||||
/// const void* srcData = getData();
|
||||
/// std::size_t srcSize = getDataSize();
|
||||
///
|
||||
/// return MySuperZipFunction(srcData, srcSize, &size);
|
||||
/// }
|
||||
///
|
||||
/// virtual void onReceive(const void* data, std::size_t size)
|
||||
/// {
|
||||
/// 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 sf::TcpSocket, sf::UdpSocket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
219
Externals/SFML/include/SFML/Network/Socket.hpp
vendored
219
Externals/SFML/include/SFML/Network/Socket.hpp
vendored
@ -1,219 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKET_HPP
|
||||
#define SFML_SOCKET_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/Network/SocketHandle.hpp>
|
||||
#include <SFML/System/NonCopyable.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class SocketSelector;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Base class for all the socket types
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API Socket : NonCopyable
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Status codes that may be returned by socket functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
AnyPort = 0 ///< Special value that tells the system to pick any available port
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual ~Socket();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool isBlocking() const;
|
||||
|
||||
protected:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Types of protocols that the socket can use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum 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)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketHandle getHandle() 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; ///< Current blocking mode of the socket
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_SOCKET_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::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::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 sf::TcpListener, sf::TcpSocket, sf::UdpSocket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
@ -1,57 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETHANDLE_HPP
|
||||
#define SFML_SOCKETHANDLE_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
#include <basetsd.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define the low-level socket handle type, specific to
|
||||
// each platform
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
|
||||
typedef UINT_PTR SocketHandle;
|
||||
|
||||
#else
|
||||
|
||||
typedef int SocketHandle;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_SOCKETHANDLE_HPP
|
@ -1,263 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETSELECTOR_HPP
|
||||
#define SFML_SOCKETSELECTOR_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class Socket;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Multiplexer that allows to read from multiple sockets
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API SocketSelector
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketSelector();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy constructor
|
||||
///
|
||||
/// \param copy Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketSelector(const SocketSelector& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~SocketSelector();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool isReady(Socket& socket) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
///
|
||||
/// \param right Instance to assign
|
||||
///
|
||||
/// \return Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketSelector& operator =(const SocketSelector& right);
|
||||
|
||||
private:
|
||||
|
||||
struct SocketSelectorImpl;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketSelectorImpl* m_impl; ///< Opaque pointer to the implementation (which requires OS-specific types)
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_SOCKETSELECTOR_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::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 sf::TcpListener
|
||||
/// \li sf::TcpSocket
|
||||
/// \li sf::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
|
||||
/// sf::TcpListener listener;
|
||||
/// listener.listen(55001);
|
||||
///
|
||||
/// // Create a list to store the future clients
|
||||
/// std::list<sf::TcpSocket*> clients;
|
||||
///
|
||||
/// // Create a selector
|
||||
/// sf::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
|
||||
/// sf::TcpSocket* client = new sf::TcpSocket;
|
||||
/// if (listener.accept(*client) == sf::Socket::Done)
|
||||
/// {
|
||||
/// // Add the new client to the clients list
|
||||
/// clients.push_back(client);
|
||||
///
|
||||
/// // Add the new client to the selector so that we will
|
||||
/// // be notified when he sends something
|
||||
/// selector.add(*client);
|
||||
/// }
|
||||
/// else
|
||||
/// {
|
||||
/// // Error, we won't get a new connection, delete the socket
|
||||
/// delete client;
|
||||
/// }
|
||||
/// }
|
||||
/// else
|
||||
/// {
|
||||
/// // The listener socket is not ready, test all other sockets (the clients)
|
||||
/// for (std::list<sf::TcpSocket*>::iterator it = clients.begin(); it != clients.end(); ++it)
|
||||
/// {
|
||||
/// sf::TcpSocket& client = **it;
|
||||
/// if (selector.isReady(client))
|
||||
/// {
|
||||
/// // The client has sent some data, we can receive it
|
||||
/// sf::Packet packet;
|
||||
/// if (client.receive(packet) == sf::Socket::Done)
|
||||
/// {
|
||||
/// ...
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
166
Externals/SFML/include/SFML/Network/TcpListener.hpp
vendored
166
Externals/SFML/include/SFML/Network/TcpListener.hpp
vendored
@ -1,166 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPLISTENER_HPP
|
||||
#define SFML_TCPLISTENER_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/Network/Socket.hpp>
|
||||
#include <SFML/Network/IPAddress.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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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.
|
||||
///
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status listen(unsigned short port, const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status accept(TcpSocket& socket);
|
||||
};
|
||||
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_TCPLISTENER_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::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 sf::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 sf::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
|
||||
/// sf::TcpListener listener;
|
||||
/// listener.listen(55001);
|
||||
///
|
||||
/// // Endless loop that waits for new connections
|
||||
/// while (running)
|
||||
/// {
|
||||
/// sf::TcpSocket client;
|
||||
/// if (listener.accept(client) == sf::Socket::Done)
|
||||
/// {
|
||||
/// // A new client just connected!
|
||||
/// std::cout << "New connection received from " << client.getRemoteAddress() << std::endl;
|
||||
/// doSomethingWith(client);
|
||||
/// }
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::TcpSocket, sf::Socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
316
Externals/SFML/include/SFML/Network/TcpSocket.hpp
vendored
316
Externals/SFML/include/SFML/Network/TcpSocket.hpp
vendored
@ -1,316 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPSOCKET_HPP
|
||||
#define SFML_TCPSOCKET_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/Network/Socket.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
|
||||
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short getLocalPort() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of the connected peer
|
||||
///
|
||||
/// It the socket is not connected, this function returns
|
||||
/// sf::IpAddress::None.
|
||||
///
|
||||
/// \return Address of the remote peer
|
||||
///
|
||||
/// \see getRemotePort
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status connect(const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 sf::Socket::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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status receive(Packet& packet);
|
||||
|
||||
private:
|
||||
|
||||
friend class TcpListener;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure holding the data of a pending packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
struct PendingPacket
|
||||
{
|
||||
PendingPacket();
|
||||
|
||||
Uint32 Size; ///< Data of packet size
|
||||
std::size_t SizeReceived; ///< Number of size bytes received so far
|
||||
std::vector<char> Data; ///< Data of the packet
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
PendingPacket m_pendingPacket; ///< Temporary data of the packet currently being received
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_TCPSOCKET_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::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 informations 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 sf::Packet),
|
||||
/// which are easier to use and provide more safety regarding
|
||||
/// the data that is exchanged. You can look at the sf::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
|
||||
/// sf::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
|
||||
/// char buffer[1024];
|
||||
/// std::size_t received = 0;
|
||||
/// socket.receive(buffer, sizeof(buffer), received);
|
||||
/// std::cout << "The server said: " << buffer << std::endl;
|
||||
///
|
||||
/// // ----- The server -----
|
||||
///
|
||||
/// // Create a listener to wait for incoming connections on port 55001
|
||||
/// sf::TcpListener listener;
|
||||
/// listener.listen(55001);
|
||||
///
|
||||
/// // Wait for a connection
|
||||
/// sf::TcpSocket socket;
|
||||
/// listener.accept(socket);
|
||||
/// std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;
|
||||
///
|
||||
/// // Receive a message from the client
|
||||
/// char buffer[1024];
|
||||
/// std::size_t received = 0;
|
||||
/// socket.receive(buffer, sizeof(buffer), received);
|
||||
/// std::cout << "The client said: " << buffer << std::endl;
|
||||
///
|
||||
/// // Send an answer
|
||||
/// std::string message = "Welcome, client";
|
||||
/// socket.send(message.c_str(), message.size() + 1);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Socket, sf::UdpSocket, sf::Packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
291
Externals/SFML/include/SFML/Network/UdpSocket.hpp
vendored
291
Externals/SFML/include/SFML/Network/UdpSocket.hpp
vendored
@ -1,291 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_UDPSOCKET_HPP
|
||||
#define SFML_UDPSOCKET_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Export.hpp>
|
||||
#include <SFML/Network/Socket.hpp>
|
||||
#include <SFML/Network/IPAddress.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class Packet;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Specialized socket using the UDP protocol
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_NETWORK_API UdpSocket : public Socket
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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.
|
||||
/// You can use the special value Socket::AnyPort to tell the
|
||||
/// system to automatically pick an available port, and then
|
||||
/// call getLocalPort to retrieve the chosen port.
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status bind(unsigned short port, const 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 \a 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status send(const void* data, std::size_t size, const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status receive(void* data, std::size_t size, std::size_t& received, 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status send(Packet& packet, const 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Status receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort);
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::vector<char> m_buffer; ///< Temporary buffer holding the received data in Receive(Packet)
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_UDPSOCKET_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::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 transfered 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 sf::Packet), which are easier
|
||||
/// to use and provide more safety regarding the data that is
|
||||
/// exchanged. You can look at the sf::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
|
||||
/// sf::UdpSocket socket;
|
||||
/// socket.bind(55001);
|
||||
///
|
||||
/// // Send a message to 192.168.1.50 on port 55002
|
||||
/// std::string message = "Hi, I am " + sf::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)
|
||||
/// char buffer[1024];
|
||||
/// std::size_t received = 0;
|
||||
/// sf::IpAddress sender;
|
||||
/// unsigned short port;
|
||||
/// socket.receive(buffer, sizeof(buffer), received, sender, port);
|
||||
/// std::cout << sender.ToString() << " said: " << buffer << std::endl;
|
||||
///
|
||||
/// // ----- The server -----
|
||||
///
|
||||
/// // Create a socket and bind it to the port 55002
|
||||
/// sf::UdpSocket socket;
|
||||
/// socket.bind(55002);
|
||||
///
|
||||
/// // Receive a message from anyone
|
||||
/// char buffer[1024];
|
||||
/// std::size_t received = 0;
|
||||
/// sf::IpAddress sender;
|
||||
/// unsigned short port;
|
||||
/// socket.receive(buffer, sizeof(buffer), received, sender, port);
|
||||
/// std::cout << sender.ToString() << " said: " << buffer << std::endl;
|
||||
///
|
||||
/// // Send an answer
|
||||
/// std::string message = "Welcome " + sender.toString();
|
||||
/// socket.send(message.c_str(), message.size() + 1, sender, port);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Socket, sf::TcpSocket, sf::Packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
58
Externals/SFML/include/SFML/System.hpp
vendored
58
Externals/SFML/include/SFML/System.hpp
vendored
@ -1,58 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_HPP
|
||||
#define SFML_SYSTEM_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Config.hpp>
|
||||
//#include <SFML/System/Clock.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
//#include <SFML/System/InputStream.hpp>
|
||||
//#include <SFML/System/Lock.hpp>
|
||||
//#include <SFML/System/Mutex.hpp>
|
||||
//#include <SFML/System/Sleep.hpp>
|
||||
#include <SFML/System/NonCopyable.hpp>
|
||||
#include <SFML/System/String.hpp>
|
||||
//#include <SFML/System/Thread.hpp>
|
||||
//#include <SFML/System/ThreadLocal.hpp>
|
||||
//#include <SFML/System/ThreadLocalPtr.hpp>
|
||||
#include <SFML/System/Time.hpp>
|
||||
#include <SFML/System/Utf.hpp>
|
||||
//#include <SFML/System/Vector2.hpp>
|
||||
//#include <SFML/System/Vector3.hpp>
|
||||
|
||||
#endif // SFML_SYSTEM_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.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
80
Externals/SFML/include/SFML/System/Err.hpp
vendored
80
Externals/SFML/include/SFML/System/Err.hpp
vendored
@ -1,80 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_ERR_HPP
|
||||
#define SFML_ERR_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.hpp>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Standard stream used by SFML to output warnings and errors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_SYSTEM_API std::ostream& err();
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_ERR_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \fn sf::err
|
||||
/// \ingroup system
|
||||
///
|
||||
/// By default, sf::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.).
|
||||
///
|
||||
/// sf::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 = sf::err().rdbuf(file.rdbuf());
|
||||
///
|
||||
/// // Redirect to nothing
|
||||
/// sf::err().rdbuf(NULL);
|
||||
///
|
||||
/// // Restore the original output
|
||||
/// sf::err().rdbuf(previous);
|
||||
/// \endcode
|
||||
///
|
||||
/// \return Reference to std::ostream representing the SFML error stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
48
Externals/SFML/include/SFML/System/Export.hpp
vendored
48
Externals/SFML/include/SFML/System/Export.hpp
vendored
@ -1,48 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_EXPORT_HPP
|
||||
#define SFML_SYSTEM_EXPORT_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define 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
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_EXPORT_HPP
|
129
Externals/SFML/include/SFML/System/NonCopyable.hpp
vendored
129
Externals/SFML/include/SFML/System/NonCopyable.hpp
vendored
@ -1,129 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NONCOPYABLE_HPP
|
||||
#define SFML_NONCOPYABLE_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Utility class that makes any derived
|
||||
/// class non-copyable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_SYSTEM_API NonCopyable
|
||||
{
|
||||
protected:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Because this class has a copy constructor, the compiler
|
||||
/// will not automatically generate the default constructor.
|
||||
/// That's why we must define it explicitly.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
NonCopyable() {}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default destructor
|
||||
///
|
||||
/// By declaring a protected destructor it's impossible to
|
||||
/// call delete on a pointer of sf::NonCopyable, thus
|
||||
/// preventing possible resource leaks.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~NonCopyable() {}
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Disabled copy constructor
|
||||
///
|
||||
/// By making the copy constructor private, the compiler will
|
||||
/// trigger an error if anyone outside tries to use it.
|
||||
/// To prevent NonCopyable or friend classes from using it,
|
||||
/// we also give no definition, so that the linker will
|
||||
/// produce an error if the first protection was inefficient.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
NonCopyable(const NonCopyable&);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Disabled assignment operator
|
||||
///
|
||||
/// By making the assignment operator private, the compiler will
|
||||
/// trigger an error if anyone outside tries to use it.
|
||||
/// To prevent NonCopyable or friend classes from using it,
|
||||
/// we also give no definition, so that the linker will
|
||||
/// produce an error if the first protection was inefficient.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
NonCopyable& operator =(const NonCopyable&);
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_NONCOPYABLE_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::NonCopyable
|
||||
/// \ingroup system
|
||||
///
|
||||
/// This class makes its instances non-copyable, by explicitly
|
||||
/// disabling its copy constructor and its assignment operator.
|
||||
///
|
||||
/// To create a non-copyable class, simply inherit from
|
||||
/// sf::NonCopyable.
|
||||
///
|
||||
/// The type of inheritance (public or private) doesn't matter,
|
||||
/// the copy constructor and assignment operator are declared private
|
||||
/// in sf::NonCopyable so they will end up being inaccessible in both
|
||||
/// cases. Thus you can use a shorter syntax for inheriting from it
|
||||
/// (see below).
|
||||
///
|
||||
/// Usage example:
|
||||
/// \code
|
||||
/// class MyNonCopyableClass : sf::NonCopyable
|
||||
/// {
|
||||
/// ...
|
||||
/// };
|
||||
/// \endcode
|
||||
///
|
||||
/// Deciding whether the instances of a class can be copied
|
||||
/// or not is a very important design choice. You are strongly
|
||||
/// encouraged to think about it before writing a class,
|
||||
/// and to use sf::NonCopyable when necessary to prevent
|
||||
/// many potential future errors when using it. This is also
|
||||
/// a very important indication to users of your class.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
669
Externals/SFML/include/SFML/System/String.hpp
vendored
669
Externals/SFML/include/SFML/System/String.hpp
vendored
@ -1,669 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_STRING_HPP
|
||||
#define SFML_STRING_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.hpp>
|
||||
#include <SFML/System/Utf.hpp>
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Utility string class that automatically handles
|
||||
/// conversions between types and encodings
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_SYSTEM_API String
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef std::basic_string<Uint32>::iterator Iterator; ///< Iterator type
|
||||
typedef std::basic_string<Uint32>::const_iterator ConstIterator; ///< Read-only iterator type
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
////////////////////////////////////////////////////////////
|
||||
static const std::size_t InvalidPos; ///< Represents an invalid position in the string
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// This constructor creates an empty string.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 = std::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(Uint32 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 = std::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 = std::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 Uint32* utf32String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from an UTF-32 string
|
||||
///
|
||||
/// \param utf32String UTF-32 string to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String(const std::basic_string<Uint32>& utf32String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy constructor
|
||||
///
|
||||
/// \param copy Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String(const String& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sf::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 sf::String containing the source string
|
||||
///
|
||||
/// \see fromUtf16, fromUtf32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
static String fromUtf8(T begin, T end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sf::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 sf::String containing the source string
|
||||
///
|
||||
/// \see fromUtf8, fromUtf32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
static String fromUtf16(T begin, T end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sf::String from a UTF-32 encoded string
|
||||
///
|
||||
/// This function is provided for consistency, it is equivalent to
|
||||
/// using the constructors that takes a const sf::Uint32* or
|
||||
/// a std::basic_string<sf::Uint32>.
|
||||
///
|
||||
/// \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 sf::String containing the source string
|
||||
///
|
||||
/// \see fromUtf8, fromUtf16
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
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 \a 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::string toAnsiString(const std::locale& locale = std::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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::wstring toWideString() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert the Unicode string to a UTF-8 string
|
||||
///
|
||||
/// \return Converted UTF-8 string
|
||||
///
|
||||
/// \see toUtf16, toUtf32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint8> toUtf8() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert the Unicode string to a UTF-16 string
|
||||
///
|
||||
/// \return Converted UTF-16 string
|
||||
///
|
||||
/// \see toUtf8, toUtf32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint16> 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint32> toUtf32() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
///
|
||||
/// \param right Instance to assign
|
||||
///
|
||||
/// \return Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String& operator =(const String& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 \a index is out of range.
|
||||
///
|
||||
/// \param index Index of the character to get
|
||||
///
|
||||
/// \return Character at position \a index
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 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 \a index is out of range.
|
||||
///
|
||||
/// \param index Index of the character to get
|
||||
///
|
||||
/// \return Reference to the character at position \a index
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32& 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool isEmpty() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Erase one or more characters from the string
|
||||
///
|
||||
/// This function removes a sequence of \a count characters
|
||||
/// starting from \a 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 \a str
|
||||
/// into the string, starting from \a 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 \a str
|
||||
/// in the string, starting from \a start.
|
||||
///
|
||||
/// \param str Characters to find
|
||||
/// \param start Where to begin searching
|
||||
///
|
||||
/// \return Position of \a str in the string, or String::InvalidPos if not found
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 \a position
|
||||
/// and spans \a length characters with the string \a 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 \a searchFor in this string
|
||||
/// with the string \a replaceWith.
|
||||
///
|
||||
/// \param searchFor The value being searched for
|
||||
/// \param replaceWith The value that replaces found \a 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 \a position
|
||||
/// and spans \a 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). \ref InvalidPos can be used to include all
|
||||
/// characters until the end of the string.
|
||||
///
|
||||
/// \return String object containing a substring of this object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Uint32* 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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::basic_string<Uint32> 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 \a left is lexicographically before \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 \a left is lexicographically after \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 \a left is lexicographically before or equivalent to \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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 \a left is lexicographically after or equivalent to \a right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_SYSTEM_API String operator +(const String& left, const String& right);
|
||||
|
||||
#include <SFML/System/String.inl>
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_STRING_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::String
|
||||
/// \ingroup system
|
||||
///
|
||||
/// sf::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
|
||||
/// sf::String.
|
||||
///
|
||||
/// \code
|
||||
/// sf::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;
|
||||
/// sf::String s;
|
||||
/// ...
|
||||
/// std::string s1 = s.toAnsiString(locale);
|
||||
/// s = sf::String("hello", locale);
|
||||
/// \endcode
|
||||
///
|
||||
/// sf::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 sf::String whenever SFML
|
||||
/// requires it.
|
||||
///
|
||||
/// Please note that SFML also defines a low-level, generic
|
||||
/// interface for Unicode handling, see the sf::Utf classes.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user