Compare commits
1096 Commits
v0.3.1
...
windowsize
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e2a77b542 | |||
| 0833630619 | |||
| caa2da2900 | |||
| 33b3c3b1b0 | |||
| e16d50c368 | |||
| 402870048b | |||
| 0597a71a03 | |||
| 85265575ea | |||
| 02eef161e7 | |||
| 8552e07ed8 | |||
| bd3f8f081c | |||
| a9cb954f3a | |||
| 5fb1fd22c5 | |||
| 95d4b3a85b | |||
| 94a7aa76c6 | |||
| c49d6e8b6f | |||
| cb5910142a | |||
| bcc3f03a50 | |||
| 256b21b412 | |||
| 4cd8b8fbf2 | |||
| 3c83f4991f | |||
| 9999213ab4 | |||
| 4cba4661ef | |||
| 5021f9e337 | |||
| e57a956c90 | |||
| 87541dc239 | |||
| 6995cb6ffd | |||
| 084ec42cd2 | |||
| 842bf0f593 | |||
| 407fd84cb2 | |||
| d23f381dfa | |||
| e80898ed2d | |||
| 03403653b2 | |||
| 19631da742 | |||
| bd8b51c95b | |||
| ffd1fca431 | |||
| ce78026df7 | |||
| b4e6659927 | |||
| ece2af6bfe | |||
| e88050af7b | |||
| 5b51437c38 | |||
| 337e0f2160 | |||
| 7e0abdb035 | |||
| c7d0cab3a3 | |||
| 01ebb8ec8d | |||
| 3a2c14a7e7 | |||
| 0ecf762d30 | |||
| 13ab10c262 | |||
| 87babd2c41 | |||
| ce19f1cc2c | |||
| 7985875d7c | |||
| a66fe3bdce | |||
| 768c195f12 | |||
| c45873464c | |||
| 8b869c63c6 | |||
| 1b2215cc02 | |||
| 3290e83966 | |||
| da0a44d26a | |||
| b2716715ec | |||
| 1547fb6617 | |||
| b19771525e | |||
| 697241b9b7 | |||
| 6f6eb62256 | |||
| 5d57d16e2e | |||
| dd10314a13 | |||
| 05c49ca00e | |||
| 2aa4828f6f | |||
| e5b8f30ef4 | |||
| e2407e5886 | |||
| 7b4b7a80ae | |||
| 5ccf15b852 | |||
| c991721faf | |||
| 2679fd41d5 | |||
| dc10430315 | |||
| cbe455c640 | |||
| 9662f7095a | |||
| de77034fa4 | |||
| a955e7b272 | |||
| 6ade361df3 | |||
| aba3676b1e | |||
| 2927d86d49 | |||
| 2af46a43a6 | |||
| 30121f2db7 | |||
| 72d13568fb | |||
| a6d9187e56 | |||
| 939db73b0b | |||
| 7154725520 | |||
| b6ab15de37 | |||
| a38866563b | |||
| 66f5962494 | |||
| 471cce3fdb | |||
| 4276491a37 | |||
| 928a9427a2 | |||
| 903d44f73c | |||
| d577dd4194 | |||
| 5732775246 | |||
| 0b93d54643 | |||
| 604b50eb7d | |||
| 5e6ac33048 | |||
| 470c94df9f | |||
| 5caf80a43d | |||
| 1f82d47c09 | |||
| a9efdf3db9 | |||
| 511f8fdcad | |||
| d9f5921657 | |||
| 72ab4f5a9b | |||
| 19876e14cf | |||
| 9384e2d15c | |||
| d8069293e0 | |||
| 05b905dd67 | |||
| 4eb18e2a60 | |||
| 3c37df1bcf | |||
| 09dc63bf2c | |||
| e2ece3464a | |||
| 0807e18e78 | |||
| f0bc3df818 | |||
| d6f82ba739 | |||
| 5e9ff89a40 | |||
| e1f76e129d | |||
| 39ffbc9fc8 | |||
| 2beead6169 | |||
| df8d8091ed | |||
| 85294ce7ae | |||
| f9f69b2bf1 | |||
| 265ff17068 | |||
| bbc2ac3146 | |||
| 925493f5b5 | |||
| 8682c1a583 | |||
| 9c53a846b8 | |||
| 816bb4c426 | |||
| c119e5f128 | |||
| d64b23bdfe | |||
| b03f118b04 | |||
| d18ac4076f | |||
| 4620c1beb8 | |||
| 55431be957 | |||
| 18946b1d92 | |||
| c517862b3c | |||
| e8d4d6341b | |||
| 2246b6f25b | |||
| cd754fafa9 | |||
| 8660ced35f | |||
| 1c7276b4f8 | |||
| 4b793c4ad4 | |||
| e9dc24d947 | |||
| 51b712a8c9 | |||
| 1ce70fba22 | |||
| 0c06aebf72 | |||
| 12cd56e5f1 | |||
| e9cef9b76b | |||
| 7395e1ed6a | |||
| c22a7560f0 | |||
| 40c8e117c1 | |||
| fb7744625c | |||
| f11eebae9a | |||
| 762e24a110 | |||
| f0a1c1f377 | |||
| 543dde0de2 | |||
| ff5190ac66 | |||
| 410e54f0b2 | |||
| c0c5e0dc8e | |||
| 56fd26ae4f | |||
| 11550cc71a | |||
| 53e0c157f1 | |||
| e57e52c6c8 | |||
| 089160278c | |||
| a3deb185a4 | |||
| 80e813baee | |||
| ff49835b22 | |||
| 1af3e28d83 | |||
| 0dce7ddaf4 | |||
| 0d1fc16a53 | |||
| 9032008a63 | |||
| 4788d643da | |||
| e1db6c24b0 | |||
| 81f98505ca | |||
| 7270e0dfbe | |||
| bc3e3b3f9c | |||
| d7b17cd494 | |||
| e5cd034b4f | |||
| 1c6210f964 | |||
| 9ce1e45d64 | |||
| be738f0cb7 | |||
| e882e0f22c | |||
| f7a1d0f952 | |||
| 6b8990fa1a | |||
| a74cff50f8 | |||
| d4ac45a9c5 | |||
| 32aebfec1a | |||
| aee7da8068 | |||
| 078361e2e6 | |||
| e0cae9c1a9 | |||
| c8d46ee919 | |||
| c5965b3940 | |||
| affb0ee0ee | |||
| dd6ea4f22a | |||
| 006a7c8eff | |||
| 5f10f39ac0 | |||
| 6e1df7fc79 | |||
| 5cab9282e7 | |||
| 1c6d8a6f59 | |||
| c43f43e634 | |||
| 409aac2caa | |||
| 21b187dacc | |||
| a110f48fad | |||
| 1f24d20054 | |||
| 8e61b79ecf | |||
| f459c456de | |||
| 0813a6e3ea | |||
| 606eb976cb | |||
| 443ff545ab | |||
| 3c615c8459 | |||
| 7973b5d151 | |||
| 8f0cd29366 | |||
| b39357efda | |||
| 3e0efac610 | |||
| 595427aa98 | |||
| 62c30a4b4d | |||
| 13f7ede034 | |||
| f89b73cec1 | |||
| 30d1f17329 | |||
| b8ad7d1dce | |||
| 6552aa23ec | |||
| 6d81b8cda3 | |||
| f5de7e8320 | |||
| 0d2b88037f | |||
| ac7b9bce27 | |||
| d87bcc3a21 | |||
| 7261903186 | |||
| 2e6263ea5c | |||
| fa9a288e0a | |||
| 7fced2d3eb | |||
| 9bc56e90ee | |||
| 64d4c41d1d | |||
| c2197b3053 | |||
| 3f7c1584a4 | |||
| 17dc26779e | |||
| edc8c0bb98 | |||
| 5bf5d0ed16 | |||
| 7114338cec | |||
| 64d0a90b82 | |||
| d6b0f024da | |||
| 3b2668977d | |||
| 5aa7ee0fe3 | |||
| f0119ec75d | |||
| 249654a879 | |||
| 950becc1b3 | |||
| b3424f3fc5 | |||
| e0e19824a5 | |||
| b3b8c2d8b1 | |||
| d9cd714c2c | |||
| fb85a42477 | |||
| 1458f3df0b | |||
| ad3973998f | |||
| 8ef1da8e0b | |||
| 06cc95852e | |||
| 44c6c17191 | |||
| fc9a249dd9 | |||
| 648c7fbc26 | |||
| 59fc11c8f4 | |||
| 7d9e34abcf | |||
| d05fa8b91b | |||
| 10bb0b9df2 | |||
| 5311d04957 | |||
| f9de2fe9ef | |||
| 6d77fd7e1e | |||
| 5fc0de6da7 | |||
| 0d114412e6 | |||
| 9a5c151de5 | |||
| 97c58d6e66 | |||
| 4a931f81c4 | |||
| 3c3c0d2b16 | |||
| 39877ae948 | |||
| f9137d3a63 | |||
| ac1274eba4 | |||
| d88db0fb88 | |||
| 9c121ad436 | |||
| 70598b1fcd | |||
| bfd3d078ad | |||
| 7d99159388 | |||
| f77475ee7f | |||
| 048772344b | |||
| 23120150f9 | |||
| 2c32dfd552 | |||
| 1624b1a4cc | |||
| 1db6a578b2 | |||
| acc2c808f5 | |||
| e1bbf66ff1 | |||
| b4a0642122 | |||
| e7906c93a7 | |||
| d5af42a7a5 | |||
| e4cbfc388f | |||
| 572792a1c8 | |||
| 3570200e53 | |||
| e11d1884c8 | |||
| 77a201f52a | |||
| 4416343761 | |||
| 88a6685a6b | |||
| e0def96cb7 | |||
| dfca82520d | |||
| ea9313aa1b | |||
| 9ef92c3578 | |||
| ef3a68f509 | |||
| 2060facc2a | |||
| 474eff65fb | |||
| 6345ec6eb3 | |||
| b65692f12b | |||
| 8615c5efe1 | |||
| ae5813a635 | |||
| 219f74bb8b | |||
| 91b4213044 | |||
| 297968f319 | |||
| a40d1d34f5 | |||
| b964415ac7 | |||
| 4707fe143c | |||
| 66fc3492ca | |||
| 45e0231214 | |||
| b05b0faeea | |||
| 7b4b8c5c90 | |||
| 97bd81c287 | |||
| 3222b962cc | |||
| 37f89b448f | |||
| f91ed8d848 | |||
| 437733c9fd | |||
| 8f6496db86 | |||
| e1cd2f8400 | |||
| 94341526d7 | |||
| e1bc2e4a89 | |||
| 7a28f1df17 | |||
| 4a67f98a3b | |||
| 9908431e0a | |||
| a6dca6618e | |||
| 56ebe38849 | |||
| 32a1a26fcf | |||
| cbdfa2b307 | |||
| 2be09f9e03 | |||
| 51ce612bd9 | |||
| e37bc3faf9 | |||
| 7059a974ed | |||
| 4b17a8a494 | |||
| 428ef7549a | |||
| c0d81fdc9f | |||
| 78a9ae5fe1 | |||
| 80f9fd0234 | |||
| c046984a37 | |||
| 1ec02c59f3 | |||
| 383eab48c8 | |||
| 358cb337dc | |||
| 141aefd81a | |||
| 39a7887b35 | |||
| 653d0f49a3 | |||
| 3e8b3656e7 | |||
| 4d975a731e | |||
| 0dee590f75 | |||
| f5bed2b464 | |||
| 38a78e2627 | |||
| f94ea3b6f8 | |||
| 2af3c8a7f5 | |||
| 92dfc7c4d0 | |||
| 4ff94efa4b | |||
| ef493de942 | |||
| 3067049d5c | |||
| 08be74297f | |||
| 6122d4ff21 | |||
| 27665e7221 | |||
| 6a5d0d6547 | |||
| a2c6a54b90 | |||
| 0c88d6584f | |||
| f0f0795733 | |||
| e32fe57080 | |||
| d536e20da8 | |||
| 4f850136fa | |||
| 612a9192d3 | |||
| 0480872e40 | |||
| 88be43a1b1 | |||
| 808960b1c1 | |||
| 0962c6969f | |||
| c4929d9ac7 | |||
| 85159348a1 | |||
| 3b385d48f9 | |||
| a396b372dd | |||
| f5b0452e77 | |||
| b82dcbac57 | |||
| 964ed7837b | |||
| 5e592ed9c0 | |||
| 018de840ab | |||
| e3086fb6a8 | |||
| 1ed5a39345 | |||
| 7e546b351a | |||
| 4b0cd7562d | |||
| 3b1e5153d3 | |||
| f0d9bbfbbb | |||
| e0925e564b | |||
| 85b4daa005 | |||
| c7dd5a6a29 | |||
| 701d1f9ab7 | |||
| aa32706de0 | |||
| b9a58101f9 | |||
| c0cdfb2db8 | |||
| ffc45e2bce | |||
| 5d078322a7 | |||
| 988c4f030a | |||
| d217d0bae3 | |||
| 6ca31dbb82 | |||
| 5f97be5e94 | |||
| b014fdf424 | |||
| 31110c01f1 | |||
| 9dc250694b | |||
| 80d6d8a07e | |||
| c8d8e2ac71 | |||
| 7e90d59d86 | |||
| 8e02a0ecda | |||
| d468794979 | |||
| 7b4629b1f9 | |||
| 8312b2a299 | |||
| 5fd9b780e5 | |||
| 881e0c9582 | |||
| 82291ce5f0 | |||
| 191c7b1def | |||
| 393a9e40fe | |||
| 4752e1530c | |||
| 847f832aff | |||
| c93f82928f | |||
| c1db77afea | |||
| 667c2d5272 | |||
| fe7abb585a | |||
| c0ebf11420 | |||
| 26b35eb299 | |||
| a2a9ea2648 | |||
| 42fd1827b3 | |||
| 053f9931c4 | |||
| 5e3315b471 | |||
| da1d7fcd2e | |||
| f6039bad01 | |||
| 7aeeb70db2 | |||
| 50ee41435e | |||
| 592994ee87 | |||
| 216284faff | |||
| 6f67e1edd5 | |||
| 2ada580a30 | |||
| 7f02a764ce | |||
| ddaf58c7b6 | |||
| 817ef4535b | |||
| 530a48a30c | |||
| 116eeb35d4 | |||
| b266371fa3 | |||
| d4e6db211c | |||
| 0ec790e61f | |||
| ae5b141d16 | |||
| 66364892f9 | |||
| 5144e1748b | |||
| 6375a30d00 | |||
| 4514b530ab | |||
| c102aa042d | |||
| 0f28fb6d13 | |||
| 4e8ab796ba | |||
| 91feda3427 | |||
| a8e4f058be | |||
| e9168e935d | |||
| 73be38bedc | |||
| 8a69d687ab | |||
| 4f20b94b7a | |||
| 7f4ff9eb54 | |||
| 72b3b4fb75 | |||
| 9b5a7848d3 | |||
| 6ca2cbf297 | |||
| d3d1facadd | |||
| bc723bffb0 | |||
| 8f0299c302 | |||
| abdcb74978 | |||
| 80565331d8 | |||
| 38cabc1ced | |||
| 84fb6243c8 | |||
| 48e21f1450 | |||
| 7c76e8c3ff | |||
| 5a443348cc | |||
| c6480e258c | |||
| 9602aa2ef7 | |||
| a0369def10 | |||
| 7930965ff2 | |||
| 2bea2f07f7 | |||
| b75aea7f26 | |||
| e9f0f427b8 | |||
| a5e685becd | |||
| f3986284ab | |||
| 33650061aa | |||
| 421f1d105a | |||
| b6cbc52cb8 | |||
| 82687d5db3 | |||
| 08eb1e5ba4 | |||
| 83bc8f8c20 | |||
| cb9eb2ddee | |||
| 3e61a72cf1 | |||
| cc75ce55cb | |||
| 1a84d6b7c4 | |||
| 5fd460d4b9 | |||
| fea5ed99f8 | |||
| aa824cc1f7 | |||
| a575eff7ec | |||
| 4eaa2a9b5f | |||
| d406a421e9 | |||
| b6b1e9138c | |||
| 4596d2e6cf | |||
| 4cd4f4c6ea | |||
| 37839b0178 | |||
| 69c24b9131 | |||
| e68483fce2 | |||
| f6b73b86c6 | |||
| 9cae93b9bb | |||
| 63e24586d4 | |||
| dfd0958b21 | |||
| 6e2d29dc60 | |||
| 1b45907ab2 | |||
| 53c0c3310a | |||
| 0a7c1094e7 | |||
| 8a1e4b57cd | |||
| 8fed4db258 | |||
| 9b5cc05b9f | |||
| e112e324f7 | |||
| 51fd8393d8 | |||
| 6fcff85201 | |||
| 240e8d7b39 | |||
| d67187a90a | |||
| 0f6834b196 | |||
| f237d8872c | |||
| d71f65e3b7 | |||
| a51cb04e4d | |||
| 1ade89723d | |||
| 1047b1bd9a | |||
| e90376a800 | |||
| 21272091e1 | |||
| 330c91d024 | |||
| fce18f0ccf | |||
| 3d145e2d71 | |||
| f65a9be6b4 | |||
| 92cd2b90c6 | |||
| acf425611e | |||
| 7604f9789d | |||
| cd36bdbd59 | |||
| acb551d21d | |||
| e17685f906 | |||
| ec60999e02 | |||
| 4b8b453cf8 | |||
| 5c069c7abe | |||
| b3c1b4558f | |||
| 80546108b9 | |||
| b785f93a4e | |||
| c930f6a2c8 | |||
| 147533ea45 | |||
| ce4321dcea | |||
| 41ef46b284 | |||
| cc97608bb7 | |||
| 425dbf4eb5 | |||
| 365752e128 | |||
| f297929e49 | |||
| f85fc5b461 | |||
| fce1c94ade | |||
| 67cf2814c0 | |||
| 247b0c97ce | |||
| efff2e8bdd | |||
| 7ed3ad165a | |||
| b874af19b7 | |||
| d477722da1 | |||
| 6eab08cce5 | |||
| 08bd7580fe | |||
| 70300d1557 | |||
| 71fb623ac9 | |||
| 4d8015daa5 | |||
| 2c438fefbc | |||
| 3203c25495 | |||
| e040c56a26 | |||
| 0d63f9248b | |||
| 9e57d50f6e | |||
| 927e447034 | |||
| d2a59fa18d | |||
| 3160c26c77 | |||
| 0b629a015a | |||
| 0ba52c4483 | |||
| 4af1d47a3a | |||
| d9c754a11b | |||
| f0efdd9142 | |||
| e78b849c7f | |||
| ad22d40769 | |||
| ed43a4bdd8 | |||
| 1fa2c06119 | |||
| 9a1e77c689 | |||
| ea958fe70c | |||
| e76fcd3bd3 | |||
| 487c84c085 | |||
| 87d1413c99 | |||
| 550fb0ebb4 | |||
| 4467c6ba75 | |||
| a8f522d0ab | |||
| b46eb87220 | |||
| 848d852395 | |||
| 26c35c7bb5 | |||
| efaafc0156 | |||
| c4c03c5186 | |||
| b985e6a4bc | |||
| 02713ae1ff | |||
| f01e3e33ab | |||
| 8adc8000a4 | |||
| 30d14ff95f | |||
| a4f993b424 | |||
| 8fd4be7452 | |||
| e576da6cba | |||
| f0405d769e | |||
| fd9623bef8 | |||
| f2e09157db | |||
| 334d7cdd6b | |||
| 525c7a4b60 | |||
| 940344c70c | |||
| 0c2f7a19b6 | |||
| 6acb03e155 | |||
| 9742deb7ac | |||
| a234cb0463 | |||
| 85c1c1af91 | |||
| c81575610c | |||
| f306caa55b | |||
| 5febea43de | |||
| 8ce42a52ce | |||
| 7d9b6175f5 | |||
| ec9f4f9806 | |||
| 82295c8394 | |||
| 6b050464ba | |||
| 1a05e6aec0 | |||
| 49c7db75ba | |||
| e62094efcf | |||
| 4a30160398 | |||
| 478f226cad | |||
| 6746711bc3 | |||
| 7bd9c320ea | |||
| ec197c3ee9 | |||
| 4c000101e3 | |||
| 4107ee598b | |||
| 1b4820c7f7 | |||
| cc398720b6 | |||
| 256d1c512a | |||
| 642e768e92 | |||
| 8660efe2dc | |||
| a47160714a | |||
| 9155faf1d2 | |||
| 042717c3a4 | |||
| 5e0c5bfbb0 | |||
| 08ff5a5ad4 | |||
| b89655e4b3 | |||
| c6cbda856b | |||
| b5b97b187a | |||
| c6ec9c0686 | |||
| eb6dd8068e | |||
| 30993dd73a | |||
| 363131c175 | |||
| 41b510e7c5 | |||
| a6da96cf82 | |||
| dcfcf8bc27 | |||
| 86c240f669 | |||
| 56b14ab54c | |||
| 7dee6c3989 | |||
| b86f520ee7 | |||
| 31ae8cbc57 | |||
| e8f10693c7 | |||
| cb07131fbb | |||
| 3392fe8d62 | |||
| bc7efed0ba | |||
| e80e202f7b | |||
| db9bd5d9ca | |||
| 685aa597c7 | |||
| ed9d9cbc0d | |||
| 3044f406c4 | |||
| 7e596c1509 | |||
| 7e239ae2ae | |||
| 84681fdd0d | |||
| 2d3514de7f | |||
| 768064a2e1 | |||
| df426f12cf | |||
| a0608384d9 | |||
| d94d6ce0a9 | |||
| a6d5a8cfab | |||
| d65b23f49f | |||
| 932b6b6aa2 | |||
| 8dccc6d72e | |||
| b5b596ca5d | |||
| a075ed734b | |||
| 48baa1bed0 | |||
| 4e46452d9b | |||
| 4ff1272403 | |||
| 7c6b2392bc | |||
| ccbd6bc772 | |||
| 0afc565bda | |||
| 81b26274c2 | |||
| 895438d83d | |||
| e943e86447 | |||
| 15014408c1 | |||
| c6b9f5b2a1 | |||
| 3a58264bf6 | |||
| 559cb6ba37 | |||
| 73f97dec3e | |||
| 3c8adb3898 | |||
| 1111e94e17 | |||
| 3158404408 | |||
| 4fc3177c1b | |||
| 3c95a91edb | |||
| 9c5b6f1ec6 | |||
| fdd46b04eb | |||
| a052239ffa | |||
| 7c8f53eced | |||
| 7f55b61721 | |||
| 8d3f2d4d88 | |||
| 5cfe3489a7 | |||
| 5035c53784 | |||
| e68f2b91cd | |||
| dbca21883b | |||
| bbad41b1a9 | |||
| a52073487f | |||
| bd0fe08545 | |||
| b36e8223f9 | |||
| 8af850ba29 | |||
| 51e044e68c | |||
| e6e67058c7 | |||
| ea8e9d6227 | |||
| 23a0e517fb | |||
| 994a87e871 | |||
| 2aa1a5fe80 | |||
| 6fb6fa59ad | |||
| 7713a9ec86 | |||
| 0f7e89dd57 | |||
| b4ad3f89f6 | |||
| 53d6dcbefc | |||
| 671eba964b | |||
| d21e6bb532 | |||
| b6e1737007 | |||
| 30586fa637 | |||
| a0ec85c7af | |||
| 7581316162 | |||
| f0aa87d0bb | |||
| b4c33ceae8 | |||
| 2c146d7f15 | |||
| 005db96f02 | |||
| 4cbecea0c3 | |||
| c70f59d7b6 | |||
| edbce2e415 | |||
| edc92b7b15 | |||
| b994902ed9 | |||
| 79c9ea193c | |||
| a45c3ba7f3 | |||
| 7873de64e0 | |||
| bfb7953c91 | |||
| b0acaaa681 | |||
| 92e26d6980 | |||
| 6624708348 | |||
| a327923ecf | |||
| dd521eac70 | |||
| 180877a518 | |||
| 9039a96fef | |||
| f3f8085d70 | |||
| 4b99d9de67 | |||
| d0928b5124 | |||
| 697b35808c | |||
| 5f2d8ed804 | |||
| 2c92dbeb8e | |||
| 251755a4ba | |||
| ece590e760 | |||
| 9e827f97f2 | |||
| 0e2a1ba3d9 | |||
| e00cfb4226 | |||
| 2d64acdcfe | |||
| 010035d697 | |||
| 37754e5cba | |||
| 4ab78b79c3 | |||
| 6c4ce4fb63 | |||
| c3c4dedebb | |||
| fb640cad8e | |||
| 45cb32b429 | |||
| 6c66268002 | |||
| 1e03d59592 | |||
| 8fbcf92e2d | |||
| 422f7d0801 | |||
| 38b946926a | |||
| 01dbc476b3 | |||
| 558a48f64d | |||
| 79ad4a9b29 | |||
| cc9975bf02 | |||
| 4cfa8fdd29 | |||
| 3a3b17001e | |||
| 295040ed56 | |||
| 54f6723d96 | |||
| 44e5395ed3 | |||
| d499c1a2d4 | |||
| d4a29dd609 | |||
| bc68f99693 | |||
| aa7cfc3969 | |||
| 9f4dfbb146 | |||
| ee76297fc0 | |||
| 0546ea3255 | |||
| df6870c990 | |||
| 07158dadf6 | |||
| 9bbe27e169 | |||
| aa72d3defc | |||
| 5d12991e6e | |||
| 1c5f22c18a | |||
| 7ed0245969 | |||
| ea3830f784 | |||
| 5fdfbf50d7 | |||
| 5d1f17fa0b | |||
| 70623111e7 | |||
| 148eeb7f07 | |||
| a688644a14 | |||
| 76c76b2661 | |||
| 696977ee83 | |||
| 3d076cfacd | |||
| f3df6c4ceb | |||
| d691498642 | |||
| eb8c5469f3 | |||
| 829713066b | |||
| ec6fa2aa36 | |||
| c1643aff28 | |||
| ec4f65ffa0 | |||
| fdbcc928ee | |||
| 75e5e53589 | |||
| 4233d317ac | |||
| 7476c92298 | |||
| e0a5205db5 | |||
| d20d6c4069 | |||
| eecbe5753d | |||
| 8e6853d74e | |||
| c00534d739 | |||
| 2cd2098460 | |||
| edf8dbca70 | |||
| b9dfabf2e6 | |||
| 29bf915919 | |||
| 99036b797f | |||
| 3987f6c9df | |||
| efc8e08c02 | |||
| 369596490f | |||
| 8ad727b33f | |||
| a760cd5412 | |||
| 409a42ec3d | |||
| be21461312 | |||
| 1cf1111a62 | |||
| f2246e3293 | |||
| 2283bd1bb2 | |||
| e69e251c5c | |||
| 16276852b2 | |||
| f4cf856ef5 | |||
| 45cf5a8663 | |||
| 77187d4bde | |||
| 662023c24d | |||
| df68694645 | |||
| c1e0a04dd1 | |||
| 87587426ca | |||
| 4065d12158 | |||
| 7cf3437542 | |||
| 6aff463b10 | |||
| 04ae630418 | |||
| 4bd2af5cc8 | |||
| 1c9dca25f9 | |||
| 86dfb96937 | |||
| 34915876e5 | |||
| ad06ffeeca | |||
| 7ac7bed45a | |||
| af31b8f8ba | |||
| c3528f99cd | |||
| 63906086b4 | |||
| 63441c34aa | |||
| 6a50c09517 | |||
| 7c46d9ef41 | |||
| fd2f0ea18e | |||
| 72574046ed | |||
| e8f0850eb2 | |||
| 44f8db26c7 | |||
| b3664ea00e | |||
| ed9f89a14d | |||
| 427341977c | |||
| a8b4230368 | |||
| 18a42f2363 | |||
| 938f457fea | |||
| d005e24f51 | |||
| 63c8dfd530 | |||
| 6d1da7514c | |||
| 06164d41b1 | |||
| cd54058e1a | |||
| 850ad78d3a | |||
| bf0d24d967 | |||
| 3db473f0df | |||
| d842baa2c5 | |||
| 86db43aab4 | |||
| 4397a0c614 | |||
| 898e1596b3 | |||
| 66e08de2fe | |||
| 7b73254ad2 | |||
| 9bd77efbdb | |||
| aaf42ea8b9 | |||
| 57c5af0f30 | |||
| 43c3e55466 | |||
| ffbd84df82 | |||
| 25ee5f2ca1 | |||
| f223b88803 | |||
| cd56680e38 | |||
| b9e1e230f9 | |||
| eb8294363a | |||
| d9e2ed2b9a | |||
| 81015e086c | |||
| a0e31029d1 | |||
| 53f87d0793 | |||
| 1e6c906300 | |||
| b76023209c | |||
| b4c7821630 | |||
| e86261e2dc | |||
| 7534c5bb3c | |||
| 7d5eec2d41 | |||
| 69b8461a87 | |||
| 32d2a12331 | |||
| ce8de27fb5 | |||
| 9c64d647ad | |||
| 726861dfaa | |||
| 51dea638c9 | |||
| 298a717225 | |||
| 27b2bc8387 | |||
| 6f6310c776 | |||
| e45fcdfb3e | |||
| ea02f68abe | |||
| 65d7d149f1 | |||
| c5f23f8b71 | |||
| ba327ce1c6 | |||
| 583687cfe1 | |||
| 19eda69468 | |||
| 4b3f979a74 | |||
| d171d62609 | |||
| 5ba195d32e | |||
| 950aa60fca | |||
| 3547e9bf53 | |||
| 5dbf6cfb2e | |||
| fb12f6432b | |||
| 5b61f811da | |||
| fe0fa0b527 | |||
| ba371f1349 | |||
| 38ec62c238 | |||
| 942c2ee1b0 | |||
| 2a7d8aa4d2 | |||
| b166eac200 | |||
| c06316f4aa | |||
| 09d96d9e4d | |||
| 66703970b6 | |||
| 0d3314a39b | |||
| 748492cc68 | |||
| e18ad31c53 | |||
| 0dd297f0f8 | |||
| 0da4becd46 | |||
| d284911d4a | |||
| e772eb3906 | |||
| 577ee4c3e0 | |||
| c534df8303 | |||
| a36c8f7de8 | |||
| dfb5f1b687 | |||
| d8eea015fd | |||
| f17b7eb2c9 | |||
| 33146626a9 | |||
| 78e12f774d | |||
| 689d8debb1 | |||
| 8be1ed8af5 | |||
| 0fabdb3f3a | |||
| 7a64e7e479 | |||
| 8c1589d7cd | |||
| 5a74b137f2 | |||
| 52ba182610 | |||
| b07eb79609 | |||
| 4e3915f527 | |||
| 9f620f276d | |||
| e3787b5ccf | |||
| 3d81a052c6 | |||
| 6353be1599 | |||
| bc6ee4877b | |||
| 6b38cc3740 | |||
| 9285fb9fdf | |||
| f5c609413a | |||
| a304f11b1d | |||
| e10ac1086f | |||
| 4533ed61ac | |||
| 235e41653d | |||
| 433479b1c3 | |||
| 2b4736f224 | |||
| 41f1dcf9d2 | |||
| 45b97cf39b | |||
| 95b1225219 | |||
| 70f6c40b26 | |||
| 43bc54fca9 | |||
| a5ec31ffef | |||
| 81cbf82ddc | |||
| 6cea506c6f | |||
| d7d49f261d | |||
| 4692a5c0b7 | |||
| d32ea32f1e | |||
| f5f053cc4e | |||
| bb3c6dc9fc | |||
| 496d4de1de | |||
| 71f8437ecb | |||
| e7767105d6 | |||
| 9cfda8514e | |||
| e0c6700a4d | |||
| 12bf158398 | |||
| ea01c86821 | |||
| 96459432a6 | |||
| 089194c663 | |||
| 7a70227535 | |||
| 7adfb3123b | |||
| 1d28075601 | |||
| af7aa688bb | |||
| beb524f523 | |||
| 18c9c151a8 | |||
| 83820baf79 | |||
| abf50350e7 | |||
| 6588d0d17a | |||
| 648736df48 | |||
| 6278a443df | |||
| 615295f1f9 | |||
| 593135d02b | |||
| 78ea41a2ca | |||
| 105600878e | |||
| 415202e15f | |||
| 618a6f6c9f | |||
| af70f35bf2 | |||
| 43bb0a3a1c | |||
| 8d9f83b1cc | |||
| 7d713afbdd | |||
| 5044ef8ab1 | |||
| 5b4fe5667a | |||
| a4d3efa087 | |||
| 9cb8adce55 | |||
| c061981de0 | |||
| b2f76fc436 | |||
| dc58fbe900 | |||
| 0e80142da1 | |||
| ee77bc7c9b | |||
| b978248c03 | |||
| 85d2b5be5a | |||
| cee35297d6 | |||
| edde08849f | |||
| f649053e00 | |||
| 6c6b4bcd3a | |||
| 1fef816572 | |||
| a6203cf6e9 | |||
| 200bb0f6e3 | |||
| 1dd2fca3db | |||
| 5444f3b807 | |||
| 897d81a188 | |||
| eae18c446a | |||
| fb7402e394 | |||
| 63dc9cbe7c | |||
| ac63f4809f | |||
| 0bdf3ada25 | |||
| aa684b903b | |||
| db0ae36702 | |||
| 3d5e812c6f | |||
| 07f6810835 | |||
| b3e2a43cf8 | |||
| 96f4abbc07 | |||
| d96746c933 | |||
| 4391ebd94a | |||
| 081029e3d1 | |||
| 541724b63c | |||
| 304afbb50d | |||
| 1ba88f48bb | |||
| 8f8c9c35f1 | |||
| 1c07d032ef | |||
| c500a17b1a | |||
| 6d0347b48a | |||
| 83af0ff4af | |||
| 32c13eee1d | |||
| 42597a76f0 | |||
| 7c59a520aa | |||
| 3c124d8519 | |||
| 76282a11da | |||
| 5249bf6a56 | |||
| 12e0dac777 | |||
| b4e3bede3b | |||
| 679731f004 | |||
| 3bbd29916b | |||
| 6516330289 | |||
| 0628ea920b | |||
| 40a4133565 | |||
| b4425fe1be | |||
| 809cbcbc21 | |||
| 2ae2b994a8 | |||
| 8ce36cdc03 | |||
| 3707a86c79 | |||
| eea3ec7f95 | |||
| 4a2c6761fc | |||
| 7a4e179f4c | |||
| 11eaadb739 | |||
| 41b77b54ea | |||
| 22689bd9ee | |||
| 831535c86f | |||
| ce43955784 | |||
| e85f4f4309 | |||
| 00b3f33530 | |||
| 1b0116a0cb |
@@ -3,61 +3,138 @@ name: RMG
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ubuntu-22.04
|
||||
build-linux:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-24.04, features: ON, architecture: x86_64, configuration: Release }
|
||||
- { os: ubuntu-24.04, features: ON, architecture: x86_64, configuration: Debug }
|
||||
- { os: ubuntu-24.04, features: OFF, architecture: x86_64, configuration: Release }
|
||||
- { os: ubuntu-24.04, features: OFF, architecture: x86_64, configuration: Debug }
|
||||
- { os: ubuntu-24.04-arm, features: ON, architecture: aarch64, configuration: Release }
|
||||
- { os: ubuntu-24.04-arm, features: ON, architecture: aarch64, configuration: Debug }
|
||||
- { os: ubuntu-24.04-arm, features: OFF, architecture: aarch64, configuration: Release }
|
||||
- { os: ubuntu-24.04-arm, features: OFF, architecture: aarch64, configuration: Debug }
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: hendrikmuhs/ccache-action@v1.2.5
|
||||
- uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: Linux
|
||||
key: linux-${{ matrix.architecture }}-${{ matrix.features }}-${{ matrix.configuration }}
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get upgrade
|
||||
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev build-essential nasm git zip
|
||||
# remove and disable snap, this fixes long update times
|
||||
# taken from https://github.com/ading2210/gh-actions-remove-snap/blob/main/workflow.sh
|
||||
sudo systemctl disable --now snapd
|
||||
sudo apt-get purge -y snapd
|
||||
echo "Package: snapd" | sudo tee /etc/apt/preferences.d/disable-snap.pref
|
||||
echo "Pin: release a=*" | sudo tee -a /etc/apt/preferences.d/disable-snap.pref
|
||||
echo "Pin-Priority: -10" | sudo tee -a /etc/apt/preferences.d/disable-snap.pref
|
||||
sudo apt-mark hold firefox
|
||||
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install cmake libusb-1.0-0-dev libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libfreetype6-dev \
|
||||
libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev libqt6websockets6-dev libvulkan-dev \
|
||||
build-essential nasm git zip appstream xvfb qt6ct mesa-vulkan-drivers
|
||||
|
||||
# sdl3 dependencies
|
||||
sudo apt-get -y install build-essential git make \
|
||||
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
|
||||
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
|
||||
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
||||
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
|
||||
- name: Build RMG (Portable)
|
||||
run: ./Source/Script/Build.sh Release
|
||||
- name: Build SDL3
|
||||
run: |
|
||||
export sdl_dir="$(pwd)/../SDL3"
|
||||
|
||||
git clone https://github.com/libsdl-org/SDL.git "$sdl_dir" -b release-3.2.28 --depth=1
|
||||
|
||||
mkdir -p "$sdl_dir/build"
|
||||
cmake -S "$sdl_dir" -B "$sdl_dir/build" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib/${{ matrix.architecture }}-linux-gnu" \
|
||||
-DCMAKE_INSTALL_FULL_LIBDIR="/usr/lib/${{ matrix.architecture }}-linux-gnu" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
cmake --build "$sdl_dir/build" --parallel "$(nproc)"
|
||||
sudo cmake --install "$sdl_dir/build" --prefix /usr/
|
||||
- name: Build RMG (AppImage)
|
||||
run: |
|
||||
export src_dir="$(pwd)"
|
||||
export build_dir="$(pwd)/Build/AppImage"
|
||||
export bin_dir="$(pwd)/Bin/AppImage"
|
||||
|
||||
mkdir $build_dir Bin/ -p
|
||||
cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="${{ matrix.configuration }}" \
|
||||
-DNETPLAY=${{ matrix.features }} \
|
||||
-DVRU=${{ matrix.features }} \
|
||||
-DUSE_ANGRYLION=${{ matrix.features }} \
|
||||
-DUPDATER=${{ matrix.features }} \
|
||||
-DAPPIMAGE_UPDATER=${{ matrix.features }} \
|
||||
-DPORTABLE_INSTALL=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="/usr" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
-G "Unix Makefiles"
|
||||
|
||||
cmake --build "$build_dir" --parallel "$(nproc)"
|
||||
cmake --install "$build_dir" --strip --prefix="$bin_dir/usr"
|
||||
shell: bash
|
||||
- name: Upload RMG (Portable)
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Create AppImage
|
||||
if: ${{ matrix.features == 'ON' && matrix.architecture == 'x86_64' && matrix.configuration == 'Release' }}
|
||||
run: |
|
||||
./Package/AppImage/Create.sh
|
||||
shell: bash
|
||||
- name: Upload RMG (AppImage)
|
||||
if: ${{ matrix.features == 'ON' && matrix.architecture == 'x86_64' && matrix.configuration == 'Release' }}
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: RMG-Portable-Linux64-${{ env.GIT_REVISION }}
|
||||
path: Bin/Release/*
|
||||
path: Bin/*.AppImage
|
||||
|
||||
Windows:
|
||||
runs-on: windows-2019
|
||||
build-windows:
|
||||
runs-on: windows-2025
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { features: ON, configuration: Release }
|
||||
- { features: ON, configuration: Debug }
|
||||
- { features: OFF, configuration: Release }
|
||||
- { features: OFF, configuration: Debug }
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: hendrikmuhs/ccache-action@v1.2.5
|
||||
- uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: Windows
|
||||
key: windows-${{ matrix.features }}-${{ matrix.configuration }}
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
path-type: inherit
|
||||
update: true
|
||||
msystem: ucrt64
|
||||
install: >-
|
||||
make
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-hidapi
|
||||
mingw-w64-x86_64-freetype
|
||||
mingw-w64-x86_64-libpng
|
||||
mingw-w64-x86_64-SDL2
|
||||
mingw-w64-x86_64-qt6
|
||||
mingw-w64-x86_64-SDL2
|
||||
mingw-w64-x86_64-hidapi
|
||||
mingw-w64-x86_64-speexdsp
|
||||
mingw-w64-x86_64-libsamplerate
|
||||
mingw-w64-x86_64-nasm
|
||||
mingw-w64-x86_64-minizip
|
||||
mingw-w64-ucrt-x86_64-cmake
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-freetype
|
||||
mingw-w64-ucrt-x86_64-libpng
|
||||
mingw-w64-ucrt-x86_64-sdl3
|
||||
mingw-w64-ucrt-x86_64-qt6
|
||||
mingw-w64-ucrt-x86_64-libusb
|
||||
mingw-w64-ucrt-x86_64-hidapi
|
||||
mingw-w64-ucrt-x86_64-speexdsp
|
||||
mingw-w64-ucrt-x86_64-libsamplerate
|
||||
mingw-w64-ucrt-x86_64-nasm
|
||||
mingw-w64-ucrt-x86_64-minizip
|
||||
mingw-w64-ucrt-x86_64-vulkan-headers
|
||||
git
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
@@ -65,17 +142,38 @@ jobs:
|
||||
echo "GIT_REVISION=$env:revision" >> $env:GITHUB_ENV
|
||||
shell: pwsh
|
||||
- name: Build RMG (Portable)
|
||||
run: ./Source/Script/Build.sh Release
|
||||
run: |
|
||||
export src_dir="$(pwd)"
|
||||
export build_dir="$(pwd)/Build/${{ matrix.configuration }}"
|
||||
|
||||
cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="${{ matrix.configuration }}" \
|
||||
-DNETPLAY=${{ matrix.features }} \
|
||||
-DVRU=${{ matrix.features }} \
|
||||
-DUSE_ANGRYLION=${{ matrix.features }} \
|
||||
-DUPDATER=${{ matrix.features }} \
|
||||
-DPORTABLE_INSTALL=ON \
|
||||
-G "MSYS Makefiles"
|
||||
|
||||
cmake --build "$build_dir" --parallel "$(nproc)"
|
||||
cmake --install "$build_dir" --strip --prefix="$src_dir"
|
||||
cmake --build "$build_dir" --target=bundle_dependencies
|
||||
shell: msys2 {0}
|
||||
- name: Create Installer
|
||||
if: ${{ matrix.features == 'ON' && matrix.configuration == 'Release' }}
|
||||
run: .\Build\Release\Source\Installer\CreateInstaller.bat
|
||||
- name: Configure RMG (Portable)
|
||||
if: ${{ matrix.features == 'ON' && matrix.configuration == 'Release' }}
|
||||
run: touch Bin/Release/portable.txt
|
||||
shell: msys2 {0}
|
||||
- name: Upload RMG (Portable)
|
||||
uses: actions/upload-artifact@v3
|
||||
if: ${{ matrix.features == 'ON' && matrix.configuration == 'Release' }}
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: RMG-Portable-Windows64-${{ env.GIT_REVISION }}
|
||||
path: Bin/Release/*
|
||||
- name: Upload RMG (Installer)
|
||||
uses: actions/upload-artifact@v3
|
||||
if: ${{ matrix.features == 'ON' && matrix.configuration == 'Release' }}
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: RMG-Setup-Windows64-${{ env.GIT_REVISION }}
|
||||
path: Bin/*.exe
|
||||
|
||||
@@ -8,5 +8,18 @@ Package/ArchLinux/pkg/
|
||||
Package/ArchLinux/rmg/
|
||||
Package/ArchLinux/src/
|
||||
Package/ArchLinux/*.pkg.*
|
||||
# Fedora Package
|
||||
Package/Fedora/*.rpm
|
||||
Package/Fedora/*.tar.gz
|
||||
Package/Fedora/results_*/
|
||||
# Clangd compile_commands.json
|
||||
compile_commands.json
|
||||
compile_commands.json
|
||||
# AppImage
|
||||
squashfs-root
|
||||
*.AppImage
|
||||
Package/AppImage/appimagetool
|
||||
Package/AppImage/lib4bin
|
||||
Package/AppImage/sharun
|
||||
# 3rdParty Build
|
||||
Source/3rdParty/mupen64plus-core/src/asm_defines/asm_defines_gas.h
|
||||
Source/3rdParty/mupen64plus-core/src/asm_defines/asm_defines_nasm.h
|
||||
@@ -4,21 +4,34 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
option(PORTABLE_INSTALL "Portable Installation" ON)
|
||||
option(NO_GIT_CLONE "Disables git clone usage for 3rdParty dependencies" OFF)
|
||||
option(UPDATER "Enables updater" ${PORTABLE_INSTALL})
|
||||
option(DISCORD_RPC "Enables Discord Rich Presence" ON)
|
||||
option(UPDATER "Enables updater" ${WIN32})
|
||||
option(APPIMAGE_UPDATER "Enables AppImage updater" OFF)
|
||||
option(KCA_DRAG_DROP "Enables drag and drop using KCoreAddons" OFF) # https://bugreports.qt.io/browse/QTBUG-91357
|
||||
option(NETPLAY "Enables netplay" ON)
|
||||
option(VRU "Enables VRU support in RMG-Input" ON)
|
||||
option(USE_CCACHE "Enables usage of ccache when ccache has been found" ON)
|
||||
option(NO_ASM "Disables the usage of assembly in the mupen64plus-core" OFF)
|
||||
option(USE_ANGRYLION "Enables building angrylion-rdp-plus which uses a non-GPL compliant license" OFF)
|
||||
|
||||
project(RMG)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --always
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
find_package(Git)
|
||||
if (GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --always
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE GIT_RESULT
|
||||
OUTPUT_VARIABLE GIT_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif(GIT_FOUND)
|
||||
if (NOT GIT_FOUND OR NOT ${GIT_RESULT} EQUAL 0)
|
||||
if (NOT ${GIT_RESULT} EQUAL 0)
|
||||
message(WARNING "git failed to retrieve the current revision, falling back to VERSION file!")
|
||||
endif()
|
||||
file(STRINGS "VERSION" GIT_VERSION)
|
||||
endif()
|
||||
|
||||
if (USE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
@@ -29,65 +42,110 @@ if (USE_CCACHE)
|
||||
endif(CCACHE_FOUND)
|
||||
endif(USE_CCACHE)
|
||||
|
||||
if (NOT PORTABLE_INSTALL AND (WIN32 OR MSYS))
|
||||
if (NOT PORTABLE_INSTALL AND WIN32)
|
||||
message(WARNING "Not-Portable build not supported on windows, re-enabling PORTABLE_INSTALL!")
|
||||
set(PORTABLE_INSTALL ON)
|
||||
endif()
|
||||
|
||||
if (NOT PORTABLE_INSTALL AND UPDATER)
|
||||
if (NOT PORTABLE_INSTALL AND UPDATER AND NOT APPIMAGE_UPDATER)
|
||||
message(WARNING "Not-Portable builds don't support the updater, disabling UPDATER")
|
||||
set(UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (APPIMAGE_UPDATER AND WIN32)
|
||||
message(WARNING "AppImage updater not supported on windows, disabling APPIMAGE_UPDATER!")
|
||||
set(APPIMAGE_UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (UPDATER AND NOT WIN32 AND NOT APPIMAGE_UPDATER)
|
||||
message(WARNING "Only AppImage updater is supported on linux, disabling UPDATER!")
|
||||
set(UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (FORCE_XCB AND WIN32)
|
||||
message(WARNING "XCB Qt platform not supported on windows, disabling FORCE_XCB!")
|
||||
set(FORCE_XCB OFF)
|
||||
endif()
|
||||
|
||||
if (PORTABLE_INSTALL)
|
||||
set(CMAKE_INSTALL_PREFIX "")
|
||||
set(INSTALL_PATH "Bin/${CMAKE_BUILD_TYPE}")
|
||||
set(RMG_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(SYSTEM_LIB_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(LIB_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(CORE_INSTALL_PATH "${INSTALL_PATH}/Core")
|
||||
set(PLUGIN_INSTALL_PATH "${INSTALL_PATH}/Plugin")
|
||||
set(DATA_INSTALL_PATH "${INSTALL_PATH}/Data")
|
||||
set(INSTALL_DESKTOP_FILE OFF)
|
||||
else()
|
||||
set(RMG_INSTALL_PATH "bin")
|
||||
set(CORE_INSTALL_PATH "lib/RMG/Core")
|
||||
set(PLUGIN_INSTALL_PATH "lib/RMG/Plugin")
|
||||
set(DATA_INSTALL_PATH "share/RMG")
|
||||
include(GNUInstallDirs)
|
||||
set(RMG_INSTALL_PATH "${CMAKE_INSTALL_BINDIR}")
|
||||
set(SYSTEM_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(LIB_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG")
|
||||
set(CORE_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG/Core")
|
||||
set(PLUGIN_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG/Plugin")
|
||||
set(DATA_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/RMG")
|
||||
set(INSTALL_DESKTOP_FILE ON)
|
||||
set(APPDATA_INSTALL_PATH "share/metainfo/")
|
||||
set(DESKTOP_INSTALL_PATH "share/applications")
|
||||
set(ICON_INSTALL_PATH "share/icons/hicolor/scalable/apps/")
|
||||
set(METAINFO_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/metainfo/")
|
||||
set(DESKTOP_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/applications")
|
||||
set(ICON_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps/")
|
||||
endif()
|
||||
|
||||
add_subdirectory(Source/3rdParty)
|
||||
add_subdirectory(Source/3rdParty/lzma)
|
||||
if (VRU)
|
||||
add_subdirectory(Source/3rdParty/vosk-api)
|
||||
endif(VRU)
|
||||
|
||||
add_subdirectory(Source/RMG-Core)
|
||||
add_subdirectory(Source/RMG)
|
||||
add_subdirectory(Source/RMG-Audio)
|
||||
add_subdirectory(Source/RMG-Input)
|
||||
add_subdirectory(Source/RMG-Input-GCA)
|
||||
install(TARGETS RMG-Core
|
||||
DESTINATION ${SYSTEM_LIB_INSTALL_PATH}
|
||||
)
|
||||
install(TARGETS RMG
|
||||
DESTINATION ${RMG_INSTALL_PATH}
|
||||
)
|
||||
install(TARGETS RMG-Audio
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/Audio
|
||||
)
|
||||
install(TARGETS RMG-Input
|
||||
install(TARGETS RMG-Input RMG-Input-GCA
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
add_subdirectory(Source/Installer)
|
||||
|
||||
|
||||
add_custom_target(bundle_dependencies
|
||||
COMMAND bash "${CMAKE_SOURCE_DIR}/Source/Script/BundleDependencies.sh" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/RMG.exe" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}" "/mingw64/bin"
|
||||
COMMAND bash "${CMAKE_SOURCE_DIR}/Source/Script/BundleDependencies.sh" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/RMG.exe" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}"
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
set(LIB_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
install(FILES ${MUPEN64PLUSCORE_LIB}
|
||||
DESTINATION ${CORE_INSTALL_PATH}
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUSCORE_INI} Data/font.ttf
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
if (VRU)
|
||||
install(FILES ${VOSK_API_LIBRARY}
|
||||
DESTINATION ${LIB_INSTALL_PATH}
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${VOSK_API_MODEL}
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
endif(VRU)
|
||||
install(FILES ${SDL_GAMECONTROLLERDB} ${CMAKE_SOURCE_DIR}/Data/InputProfileDB.json
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
file(GLOB GENERATED_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Generated/*.cht)
|
||||
file(GLOB CUSTOM_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Custom/*.cht)
|
||||
install(FILES ${GENERATED_CHEAT_FILES} ${CUSTOM_CHEAT_FILES}
|
||||
@@ -95,27 +153,36 @@ install(FILES ${GENERATED_CHEAT_FILES} ${CUSTOM_CHEAT_FILES}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_CXD4}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_HLE}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_PARALLEL}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_RAPHNET}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_GCA}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_ANGRYLION}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
)
|
||||
if (USE_ANGRYLION)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_ANGRYLION}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
endif(USE_ANGRYLION)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDEN64}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDEN64_DATA}
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_PARALLEL}
|
||||
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
|
||||
PERMISSIONS ${LIB_PERMISSIONS}
|
||||
)
|
||||
|
||||
if (INSTALL_DESKTOP_FILE)
|
||||
@@ -125,7 +192,7 @@ if (INSTALL_DESKTOP_FILE)
|
||||
install(FILES Package/com.github.Rosalie241.RMG.svg
|
||||
DESTINATION ${ICON_INSTALL_PATH}
|
||||
)
|
||||
install(FILES Package/com.github.Rosalie241.RMG.appdata.xml
|
||||
DESTINATION ${APPDATA_INSTALL_PATH}
|
||||
install(FILES Package/com.github.Rosalie241.RMG.metainfo.xml
|
||||
DESTINATION ${METAINFO_INSTALL_PATH}
|
||||
)
|
||||
endif(INSTALL_DESKTOP_FILE)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
[1FBAF161-2C1C54F1-C:41]
|
||||
Name=1080 Snowboarding (JU) (M2)
|
||||
|
||||
$Enable All Levels & Boarders
|
||||
80255089 00FF
|
||||
8025508B 0005
|
||||
81255096 FCFF
|
||||
80255098 0007
|
||||
|
||||
$Have All\Contest First Place Done
|
||||
80244098 0007
|
||||
|
||||
$Have All\Match Levels Completed
|
||||
8025508A 0005
|
||||
|
||||
$Have All\Trick Attacks Done
|
||||
81255096 FCFF
|
||||
|
||||
$Infinite Damage All Players & Levels
|
||||
803F4C3C 0024
|
||||
807F4C3C 0024
|
||||
|
||||
$Infinite Lives & Continues
|
||||
8026B1CB 0003
|
||||
|
||||
$Always First Place (Player 1)
|
||||
81267B88 2400
|
||||
Note=The game will still show you in 2nd when you are behind. But when you cross the finish line, you will win!
|
||||
|
||||
$Open Level Character Select
|
||||
Note=With these codes, you have to press the buttons listed below when you are viewing a certain boarders stats. Highlight Akari Hayami's stats, and then hold down the C-Left button and then press the A button to be the Crystal Boarder. Highlight Kensuke Kimachi's stats, and then hold down the C-Up button and then press the A button to be the Metal Boarder. Hightlight Rob Haywood's stats, and then hold down the C-Right button and then press the A button to be the Panda Boarder
|
||||
8125508A 00??
|
||||
01 Easy Level
|
||||
02 Easy & Normal Level
|
||||
03 Easy Normal & Hard Levels
|
||||
04 Easy Normal Hard Levels & Crystal Boarder
|
||||
05 Easy Normal Hard Levels & Crystal & Metal Boarders
|
||||
|
||||
$Play As
|
||||
800200E7 00??
|
||||
00 Dion Blaster
|
||||
01 Kensuke Kimachi
|
||||
02 Akari Hayami
|
||||
03 Ricky Winterborn
|
||||
04 Rob Haywood
|
||||
05 Silver Boarder
|
||||
06 Gold Boarder
|
||||
07 Panda Boarder
|
||||
|
||||
$Freeze Timer In\Match Race
|
||||
D1267B20 05E1
|
||||
81267B20 1000
|
||||
|
||||
$Freeze Timer In\Time Attack
|
||||
D12660CC 05E1
|
||||
812660CC 1000
|
||||
|
||||
$Freeze Timer In\Trick Attack
|
||||
D1266138 05E1
|
||||
81266138 1000
|
||||
|
||||
$Freeze Timer In\Contest
|
||||
D126628C 05E1
|
||||
8126628C 1000
|
||||
@@ -0,0 +1,148 @@
|
||||
[34AEB154-A4253B86-C:45]
|
||||
Name=Conker's Bad Fur Day (U) [T+Spa1.1_Blade133bo]
|
||||
|
||||
$$Acceso\Todos los Capítulos, Escenas & Personajes Multijugador
|
||||
50000401 0000
|
||||
800E9D01 00FF
|
||||
|
||||
$$Acceso\Todos los Personajes & Armas en Multi Race
|
||||
810E9D02 ??FF
|
||||
FF Todos los Personajes & Bate de Béisbol
|
||||
FB Todos los Personajes & Sartén
|
||||
F3 Todos los Personajes & Huesos
|
||||
|
||||
$$Seleccionar Velocidad de Conker
|
||||
810CC318 ????
|
||||
3F00 Conker Lento
|
||||
3F80 Conker Normal
|
||||
3FF0 Conker Rápido
|
||||
4030 Conker Superrápido
|
||||
|
||||
$$Infinito\Recuento de Precisión Jugador 1
|
||||
Note=SOLO EN MULTI. Solo pon este código una vez que estés en el juego.
|
||||
800E0B67 0001
|
||||
|
||||
$$Infinito\Bolsas En Heist
|
||||
800E0BE4 00FF
|
||||
|
||||
$$Infinito\Bombas
|
||||
802055CA 0030
|
||||
|
||||
$$Infinito\Recuento de Disparos a la Cabeza Jugador 1
|
||||
Note=SOLO EN MULTI. Solo pon este código una vez que estés en el juego. Una vez que recojas un arma y dispares una vez, acertarás al 100%.
|
||||
800E0B6B 03E7
|
||||
|
||||
$$Infinito\Salud\Jugador 1
|
||||
800CC49A 0006
|
||||
|
||||
$$Infinito\Salud\Jugador 2
|
||||
800CC7C6 270F
|
||||
|
||||
$$Infinito\Salud\Jugador 3
|
||||
800CCAF2 270F
|
||||
|
||||
$$Infinito\Salud\Jugador 4
|
||||
800CCE1E 270F
|
||||
|
||||
$$Infinito\Vidas Jugador 1
|
||||
800D2144 0064
|
||||
|
||||
$$Infinito\Máximo de Muertes Jugador 1
|
||||
800E0B47 03E7
|
||||
|
||||
$$Infinito\Lotes de Dinero
|
||||
810D214A FFFF
|
||||
|
||||
$$Infinito\Tiempo En Multi
|
||||
8108FD7A 7500
|
||||
|
||||
$$Modo Matrix (En Cualquier Momento)
|
||||
Note=Pulsa R para activar y luego C-Derecha para salir.
|
||||
D1042A14 0010
|
||||
800BEA0C 0001
|
||||
D1042A14 0010
|
||||
810BE574 D202
|
||||
D1042A14 0001
|
||||
800BEA0C 0000
|
||||
D1042A14 0001
|
||||
810BE574 0000
|
||||
|
||||
$$Jugar como Opción 1
|
||||
Note=Aquí puedes elegir con quién quieres jugar, pero solo una opción a la vez. La sombra no será visible, excepto cuando juegues como Conker.
|
||||
800D213F 00??
|
||||
01 Comadreja
|
||||
02 Comadreja (Traje negro)
|
||||
03 Tedi
|
||||
04 Ardilla de Combate
|
||||
05 Conker
|
||||
08 Tanque (No se puede mover)
|
||||
09 Dinosaurio (No se puede mover)
|
||||
0B Uga
|
||||
0C Cavernícola Calvo
|
||||
0D Cavernícola
|
||||
0E Cavernícola Mohicano
|
||||
0F Cavernícola Spikey
|
||||
10 Conker Neo
|
||||
11 Aldeano Masculino
|
||||
12 Aldeano Masculino (con gafas)
|
||||
13 Aldeano Masculino (con bigote)
|
||||
14 Aldeano Masculino (con gafas y bigote)
|
||||
15 Aldeano Masculino (con sombrero)
|
||||
16 Aldeano Masculino (con sombrero y gafas)
|
||||
17 Aldeano Masculino (con sombrero y bigote)
|
||||
18 Aldeano Masculino (con sombrero y gafas y bigote)
|
||||
19 Aldeano Masculino (con gorra)
|
||||
1A Aldeano Masculino (con gorra y gafas)
|
||||
1B Aldeano Masculino (con gorra y bigote)
|
||||
1C Aldeano Masculino (con gorra y gafas y bigote)
|
||||
1D Aldeana Femenina
|
||||
1F Aldeana Femenina (con capucha y gafas)
|
||||
21 Zombi Masculino
|
||||
22 Zombi Femenino
|
||||
23 Murciélago Enemigo
|
||||
24 Conker el Murciélago
|
||||
25 Capitán del Ejercito
|
||||
26 Jefe Tedi
|
||||
27 Gregg
|
||||
28 Gregg Huesudo
|
||||
|
||||
$$Pulsa L Para Levitar\Jugador 1
|
||||
Note=Pulsa el Botón L para Levitar y Sueltalo para bajar
|
||||
D0042A15 0020
|
||||
810CC2F0 41CB
|
||||
|
||||
$$Pulsa L Para Levitar\Jugador 2
|
||||
Note=Pulsa el Botón L para Levitar y Sueltalo para bajar
|
||||
D0042A1D 0020
|
||||
810CC61C 41CB
|
||||
|
||||
$$Pulsa L Para Levitar\Jugador 3
|
||||
Note=Pulsa el Botón L para Levitar y Sueltalo para bajar
|
||||
D0042A25 0020
|
||||
810CC948 41CB
|
||||
|
||||
$$Pulsa L Para Levitar\Jugador 4
|
||||
Note=Pulsa el Botón L para Levitar y Sueltalo para bajar
|
||||
D0042A2D 0020
|
||||
810CCC74 41CB
|
||||
|
||||
$$Activador de Animación de Espera
|
||||
800CC5C8 00??
|
||||
00 Por defecto como máximo
|
||||
02 Animaciones de espera deshabilitadas
|
||||
|
||||
$$Selección de Arma en Multi (Al recoger)
|
||||
Note=Selecciona el arma que quieras en el modo multijugador y luego, en una recogida de armas, tendrás el arma de tu elección. (Debes tener un arma ya recogida para cambiar por la próxima.)
|
||||
80180873 00??
|
||||
01 Espada
|
||||
02 Nada
|
||||
03 Motosierra Amarilla
|
||||
04 Cuchillos Arrojadizos
|
||||
05 Rifle
|
||||
06 Revolver con Mira
|
||||
07 Lanzacohetes
|
||||
08 Escopeta
|
||||
0A Rifle Francotirador Con Alcance
|
||||
0C Metralletas Dobles
|
||||
13 Máscara Antigás
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
[3A03E50F-E78D1CA7-C:45]
|
||||
Name=GoldenEye 007 (U) [T+Spa2.0_Sogun&IlDucci]
|
||||
|
||||
$$Modo Depuración
|
||||
Note=Pulsa A o Start para habilitar la opción actualmente seleccionada. Al pulsar Start cuando tengas el control del jugador, abrirá el menú reloj y cerrará el menú de depuración.
|
||||
80036FCB 0001
|
||||
|
||||
$$Tener Todo\64 personajes en multijugador
|
||||
Note=Habilita todos los personajes seleccionables para jugar en multijugador
|
||||
8002B197 0040
|
||||
|
||||
$$Tener Todo\Objetivos Completados
|
||||
80036FD3 0001
|
||||
|
||||
$$Todo Desbloqueado\Guardado 1
|
||||
Note=Esto desbloquea todos los niveles, etapas, personajes en el modo multijugador y elementos del menú de trucos (habilite Invencible en el menú de trucos para tener salud infinita)
|
||||
50002902 0000
|
||||
810699EE FFFF
|
||||
|
||||
$$Todo Desbloqueado\Guardado 2
|
||||
Note=Esto desbloquea todos los niveles, etapas, personajes en el modo multijugador y elementos del menú de trucos (habilite Invencible en el menú de trucos para tener salud infinita)
|
||||
50002902 0000
|
||||
8106992E FFFF
|
||||
|
||||
$$Todo Desbloqueado\Guardado 3
|
||||
Note=Esto desbloquea todos los niveles, etapas, personajes en el modo multijugador y elementos del menú de trucos (habilite Invencible en el menú de trucos para tener salud infinita)
|
||||
50002902 0000
|
||||
81069A4E FFFF
|
||||
|
||||
$$Todo Desbloqueado\Guardado 4
|
||||
Note=Esto desbloquea todos los niveles, etapas, personajes en el modo multijugador y elementos del menú de trucos (habilite Invencible en el menú de trucos para tener salud infinita)
|
||||
50002902 0000
|
||||
8106998E FFFF
|
||||
|
||||
$$Infinito\Munición (Todos los Niveles)
|
||||
80079E3B 0001
|
||||
|
||||
$$Tener\Tiempo Infinito 00:00 (Todos los Niveles)
|
||||
8004837E 0000
|
||||
8004838E 0000
|
||||
80048396 0000
|
||||
80079A22 0000
|
||||
80079F26 0000
|
||||
|
||||
$$Infinito\Salud (Todos los Niveles)
|
||||
8100C0F4 0801
|
||||
8100C0F6 8090
|
||||
8100C0F8 AFA4
|
||||
8100C0FA 0000
|
||||
81060240 0004
|
||||
81060242 7600
|
||||
81060244 3C02
|
||||
81060246 8008
|
||||
81060248 8C42
|
||||
8106024A 9EE0
|
||||
8106024C 3401
|
||||
8106024E 3F80
|
||||
81060250 A441
|
||||
81060252 00DC
|
||||
81060254 0800
|
||||
81060256 303F
|
||||
|
||||
$f
|
||||
80048673 0013
|
||||
81048678 3FC0
|
||||
80048677 00D0
|
||||
8004867F 000D
|
||||
80048683 000A
|
||||
8004868B 0013
|
||||
81048690 3FC0
|
||||
8004868F 00D0
|
||||
80048697 000D
|
||||
8004869B 000A
|
||||
800486A3 0019
|
||||
810486A8 3FC0
|
||||
800486A7 00D3
|
||||
800486AF 0006
|
||||
800486B3 0003
|
||||
800486BB 0019
|
||||
810486C0 3FC0
|
||||
800486BF 00D3
|
||||
800486C7 0006
|
||||
800486CB 0003
|
||||
800486D3 0013
|
||||
810486D8 3FC0
|
||||
800486D7 00D0
|
||||
800486DF 000D
|
||||
800486E3 000A
|
||||
800486EB 0013
|
||||
810486F0 3FC0
|
||||
800486EF 00D0
|
||||
800486F7 000D
|
||||
800486FB 000A
|
||||
80048703 0019
|
||||
81048708 3FC0
|
||||
80048707 00D3
|
||||
8004870F 0006
|
||||
80048713 0003
|
||||
8004871B 0019
|
||||
81048720 3FC0
|
||||
8004871F 00D3
|
||||
80048727 0006
|
||||
8004872B 0003
|
||||
812AEA50 476F
|
||||
812AEA52 6C64
|
||||
812AEA54 656E
|
||||
812AEA56 2047
|
||||
812AEA58 756E
|
||||
812AEA5A 2046
|
||||
812AEA5C 756E
|
||||
802AEA5E 0000
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
[58FD3F25-D92EAA8D-C:50]
|
||||
Name=1080 Snowboarding (E) (M4)
|
||||
|
||||
$Enable All Levels & Boarders
|
||||
80250AB9 00FF
|
||||
80250ABB 0005
|
||||
81250AC6 FCFF
|
||||
80250AC8 0007
|
||||
|
||||
$Infinite Damage All Players and Levels
|
||||
803F4C00 0024
|
||||
807F4C00 0024
|
||||
|
||||
$Infinite Lives & Continues
|
||||
802648A4 0003
|
||||
|
||||
$Open Level Character Select
|
||||
Note=With these codes, you have to press the buttons listed below when you are viewing a certain boarders stats. Highlight Akari Hayami's stats, and then hold down the C-Left button and then press the A button to be the Crystal Boarder. Highlight Kensuke Kimachi's stats, and then hold down the C-Up button and then press the A button to be the Metal Boarder. Hightlight Rob Haywood's stats, and then hold down the C-Right button and then press the A button to be the Panda Boarder
|
||||
8125508A 00??
|
||||
01 Easy Level
|
||||
02 Easy & Normal Level
|
||||
03 Easy Normal & Hard Levels
|
||||
04 Easy Normal Hard Levels & Crystal Boarder
|
||||
05 Easy Normal Hard Levels & Crystal & Metal Boarders
|
||||
|
||||
$Play As
|
||||
8001A0E7 00??
|
||||
00 Dion Blaster
|
||||
01 Kensuke Kimachi
|
||||
02 Akari Hayami
|
||||
03 Ricky Winterborn
|
||||
04 Rob Haywood
|
||||
05 Silver Boarder
|
||||
06 Gold Boarder
|
||||
07 Panda Boarder
|
||||
|
||||
$Always First Place (Player 1)
|
||||
812679BC 2400
|
||||
Note=The game will still show you in 2nd when you are behind. But when you cross the finish line, you will win!
|
||||
|
||||
$Freeze Timer In\Match Race
|
||||
D1267954 05E1
|
||||
81267954 1000
|
||||
|
||||
$Freeze Timer In\Time Attack
|
||||
D1265D4C 05E1
|
||||
81265D4C 1000
|
||||
|
||||
$Freeze Timer In\Trick Attack
|
||||
D1265DB8 05E1
|
||||
81265DB8 1000
|
||||
|
||||
$Freeze Timer In\Contest
|
||||
D1265F48 05E1
|
||||
81265F48 1000
|
||||
@@ -0,0 +1,50 @@
|
||||
[D8C74049-29CDD8C4-C:50]
|
||||
Name=007 - The World is Not Enough (E) [T+Spa1.0.1_IlDucci]
|
||||
|
||||
$$Acceso\Todos los Gadgets e Items
|
||||
801147DD 0001
|
||||
|
||||
$$Acceso\Todas las Armas
|
||||
Note=Viene con munición
|
||||
801147DC 0001
|
||||
|
||||
$$Acceso\Todos los Niveles & Dificultades
|
||||
81103B66 0021
|
||||
50000D01 0000
|
||||
80118F38 0001
|
||||
|
||||
$$Infinito\Oxígeno
|
||||
800E25E4 0004
|
||||
|
||||
$$Infinito\Tiempo
|
||||
81103B82 0000
|
||||
|
||||
$$Invencible
|
||||
811147D8 0101
|
||||
|
||||
$$Multijugador\Acceso a Todos los Personajes Malvados
|
||||
801147EB 0001
|
||||
811147EC 0101
|
||||
801147EE 0001
|
||||
|
||||
$$Multijugador\Acceso a Todas las Arenas
|
||||
50005C0C 0000
|
||||
800C0167 0081
|
||||
|
||||
$$Multijugador\Acceso a Todos los Escenarios
|
||||
801147EF 0001
|
||||
811147F0 0101
|
||||
|
||||
$$Multijugador\Acceso a Todos los Modos de Armamento
|
||||
811147F2 0101
|
||||
801147F4 0001
|
||||
|
||||
$$Multijugador\Acceso a Q Malvado
|
||||
800C06EF 0081
|
||||
|
||||
$$Multijugador\Acceso a Q Bueno
|
||||
800C06EF 0001
|
||||
|
||||
$$Multijugador\Invencible
|
||||
811147D8 0101
|
||||
|
||||
@@ -377,3 +377,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F30F6 0008
|
||||
811E6F06 FFFD
|
||||
D01F30F6 0004
|
||||
811E6F06 0000
|
||||
D01F30F6 0002
|
||||
811E6F06 FFFE
|
||||
|
||||
@@ -421,3 +421,12 @@ D03E6B3A 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FB876 0008
|
||||
811EF686 FFFD
|
||||
D01FB876 0004
|
||||
811EF686 0000
|
||||
D01FB876 0002
|
||||
811EF686 FFFE
|
||||
|
||||
@@ -361,3 +361,12 @@ D03E6FCA 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FBC96 0008
|
||||
811EF726 FFFD
|
||||
D01FBC96 0004
|
||||
811EF726 0000
|
||||
D01FBC96 0002
|
||||
811EF726 FFFE
|
||||
|
||||
@@ -388,3 +388,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F0496 0008
|
||||
811E5496 FFFD
|
||||
D01F0496 0004
|
||||
811E5496 0000
|
||||
D01F0496 0002
|
||||
811E5496 FFFE
|
||||
|
||||
@@ -383,3 +383,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F8836 0008
|
||||
811ED836 FFFD
|
||||
D01F8836 0004
|
||||
811ED836 0000
|
||||
D01F8836 0002
|
||||
811ED836 FFFE
|
||||
|
||||
@@ -418,3 +418,12 @@ D03E4CFA 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F88A0 0008
|
||||
811ED846 FFFD
|
||||
D01F88A0 0004
|
||||
811ED846 0000
|
||||
D01F88A0 0002
|
||||
811ED846 FFFE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[C0F6DB17-80E0D532-C:44]
|
||||
Name=Armorines Project S.
|
||||
Name=Armorines - Project S.W.A.R.M. (G)
|
||||
|
||||
$[Press L For Levitate]
|
||||
D10F7550 0020
|
||||
|
||||
@@ -394,3 +394,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F2D56 0008
|
||||
811E6B66 FFFD
|
||||
D01F2D56 0004
|
||||
811E6B66 0000
|
||||
D01F2D56 0002
|
||||
811E6B66 FFFE
|
||||
|
||||
@@ -361,3 +361,12 @@ D05EC55A 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FBA40 0008
|
||||
811EF476 FFFD
|
||||
D01FBA40 0004
|
||||
811EF476 0000
|
||||
D01FBA40 0002
|
||||
811EF476 FFFE
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
[
|
||||
{
|
||||
"DeviceName": [ "fallback_profile" ],
|
||||
"DeviceType": 4,
|
||||
"A_InputType": "0",
|
||||
"A_Name": "a",
|
||||
"A_Data": "0",
|
||||
"A_ExtraData": "0",
|
||||
"B_InputType": "0",
|
||||
"B_Name": "x",
|
||||
"B_Data": "2",
|
||||
"B_ExtraData": "0",
|
||||
"Start_InputType": "0",
|
||||
"Start_Name": "start",
|
||||
"Start_Data": "6",
|
||||
"Start_ExtraData": "0",
|
||||
"DpadUp_InputType": "0",
|
||||
"DpadUp_Name": "dpup",
|
||||
"DpadUp_Data": "11",
|
||||
"DpadUp_ExtraData": "0",
|
||||
"DpadDown_InputType": "0",
|
||||
"DpadDown_Name": "dpdown",
|
||||
"DpadDown_Data": "12",
|
||||
"DpadDown_ExtraData": "0",
|
||||
"DpadLeft_InputType": "0",
|
||||
"DpadLeft_Name": "dpleft",
|
||||
"DpadLeft_Data": "13",
|
||||
"DpadLeft_ExtraData": "0",
|
||||
"DpadRight_InputType": "0",
|
||||
"DpadRight_Name": "dpright",
|
||||
"DpadRight_Data": "14",
|
||||
"DpadRight_ExtraData": "0",
|
||||
"CButtonUp_InputType": "1",
|
||||
"CButtonUp_Name": "righty-",
|
||||
"CButtonUp_Data": "3",
|
||||
"CButtonUp_ExtraData": "0",
|
||||
"CButtonDown_InputType": "1",
|
||||
"CButtonDown_Name": "righty+",
|
||||
"CButtonDown_Data": "3",
|
||||
"CButtonDown_ExtraData": "1",
|
||||
"CButtonLeft_InputType": "1",
|
||||
"CButtonLeft_Name": "rightx-",
|
||||
"CButtonLeft_Data": "2",
|
||||
"CButtonLeft_ExtraData": "0",
|
||||
"CButtonRight_InputType": "1",
|
||||
"CButtonRight_Name": "rightx+",
|
||||
"CButtonRight_Data": "2",
|
||||
"CButtonRight_ExtraData": "1",
|
||||
"LeftTrigger_InputType": "0",
|
||||
"LeftTrigger_Name": "leftshoulder",
|
||||
"LeftTrigger_Data": "9",
|
||||
"LeftTrigger_ExtraData": "0",
|
||||
"RightTrigger_InputType": "0",
|
||||
"RightTrigger_Name": "rightshoulder",
|
||||
"RightTrigger_Data": "10",
|
||||
"RightTrigger_ExtraData": "0",
|
||||
"ZTrigger_InputType": "1",
|
||||
"ZTrigger_Name": "lefttrigger+",
|
||||
"ZTrigger_Data": "4",
|
||||
"ZTrigger_ExtraData": "1",
|
||||
"AnalogStickUp_InputType": "1",
|
||||
"AnalogStickUp_Name": "lefty-",
|
||||
"AnalogStickUp_Data": "1",
|
||||
"AnalogStickUp_ExtraData": "0",
|
||||
"AnalogStickDown_InputType": "1",
|
||||
"AnalogStickDown_Name": "lefty+",
|
||||
"AnalogStickDown_Data": "1",
|
||||
"AnalogStickDown_ExtraData": "1",
|
||||
"AnalogStickLeft_InputType": "1",
|
||||
"AnalogStickLeft_Name": "leftx-",
|
||||
"AnalogStickLeft_Data": "0",
|
||||
"AnalogStickLeft_ExtraData": "0",
|
||||
"AnalogStickRight_InputType": "1",
|
||||
"AnalogStickRight_Name": "leftx+",
|
||||
"AnalogStickRight_Data": "0",
|
||||
"AnalogStickRight_ExtraData": "1"
|
||||
},
|
||||
{
|
||||
"DeviceName": [ "Nintendo N64 Controller" ],
|
||||
"DeviceType": 4,
|
||||
"A_InputType": "0",
|
||||
"A_Name": "a",
|
||||
"A_Data": "0",
|
||||
"A_ExtraData": "0",
|
||||
"B_InputType": "0",
|
||||
"B_Name": "b",
|
||||
"B_Data": "1",
|
||||
"B_ExtraData": "0",
|
||||
"Start_InputType": "0",
|
||||
"Start_Name": "start",
|
||||
"Start_Data": "6",
|
||||
"Start_ExtraData": "0",
|
||||
"DpadUp_InputType": "0",
|
||||
"DpadUp_Name": "dpup",
|
||||
"DpadUp_Data": "11",
|
||||
"DpadUp_ExtraData": "0",
|
||||
"DpadDown_InputType": "0",
|
||||
"DpadDown_Name": "dpdown",
|
||||
"DpadDown_Data": "12",
|
||||
"DpadDown_ExtraData": "0",
|
||||
"DpadLeft_InputType": "0",
|
||||
"DpadLeft_Name": "dpleft",
|
||||
"DpadLeft_Data": "13",
|
||||
"DpadLeft_ExtraData": "0",
|
||||
"DpadRight_InputType": "0",
|
||||
"DpadRight_Name": "dpright",
|
||||
"DpadRight_Data": "14",
|
||||
"DpadRight_ExtraData": "0",
|
||||
"CButtonUp_InputType": "0",
|
||||
"CButtonUp_Name": "y",
|
||||
"CButtonUp_Data": "3",
|
||||
"CButtonUp_ExtraData": "0",
|
||||
"CButtonDown_InputType": "1",
|
||||
"CButtonDown_Name": "righttrigger+",
|
||||
"CButtonDown_Data": "5",
|
||||
"CButtonDown_ExtraData": "1",
|
||||
"CButtonLeft_InputType": "0",
|
||||
"CButtonLeft_Name": "x",
|
||||
"CButtonLeft_Data": "2",
|
||||
"CButtonLeft_ExtraData": "0",
|
||||
"CButtonRight_InputType": "0",
|
||||
"CButtonRight_Name": "back",
|
||||
"CButtonRight_Data": "4",
|
||||
"CButtonRight_ExtraData": "0",
|
||||
"LeftTrigger_InputType": "0",
|
||||
"LeftTrigger_Name": "leftshoulder",
|
||||
"LeftTrigger_Data": "9",
|
||||
"LeftTrigger_ExtraData": "0",
|
||||
"RightTrigger_InputType": "0",
|
||||
"RightTrigger_Name": "rightshoulder",
|
||||
"RightTrigger_Data": "10",
|
||||
"RightTrigger_ExtraData": "0",
|
||||
"ZTrigger_InputType": "1",
|
||||
"ZTrigger_Name": "lefttrigger+",
|
||||
"ZTrigger_Data": "4",
|
||||
"ZTrigger_ExtraData": "1",
|
||||
"AnalogStickUp_InputType": "1",
|
||||
"AnalogStickUp_Name": "lefty-",
|
||||
"AnalogStickUp_Data": "1",
|
||||
"AnalogStickUp_ExtraData": "0",
|
||||
"AnalogStickDown_InputType": "1",
|
||||
"AnalogStickDown_Name": "lefty+",
|
||||
"AnalogStickDown_Data": "1",
|
||||
"AnalogStickDown_ExtraData": "1",
|
||||
"AnalogStickLeft_InputType": "1",
|
||||
"AnalogStickLeft_Name": "leftx-",
|
||||
"AnalogStickLeft_Data": "0",
|
||||
"AnalogStickLeft_ExtraData": "0",
|
||||
"AnalogStickRight_InputType": "1",
|
||||
"AnalogStickRight_Name": "leftx+",
|
||||
"AnalogStickRight_Data": "0",
|
||||
"AnalogStickRight_ExtraData": "1"
|
||||
},
|
||||
{
|
||||
"DeviceName": [ "Nintendo GameCube Controller" ],
|
||||
"DeviceType": 4,
|
||||
"A_InputType": "0",
|
||||
"A_Name": "a",
|
||||
"A_Data": "0",
|
||||
"A_ExtraData": "0",
|
||||
"B_InputType": "0",
|
||||
"B_Name": "b",
|
||||
"B_Data": "1",
|
||||
"B_ExtraData": "0",
|
||||
"Start_InputType": "0",
|
||||
"Start_Name": "start",
|
||||
"Start_Data": "6",
|
||||
"Start_ExtraData": "0",
|
||||
"DpadUp_InputType": "0",
|
||||
"DpadUp_Name": "dpup",
|
||||
"DpadUp_Data": "11",
|
||||
"DpadUp_ExtraData": "0",
|
||||
"DpadDown_InputType": "0",
|
||||
"DpadDown_Name": "dpdown",
|
||||
"DpadDown_Data": "12",
|
||||
"DpadDown_ExtraData": "0",
|
||||
"DpadLeft_InputType": "0",
|
||||
"DpadLeft_Name": "dpleft",
|
||||
"DpadLeft_Data": "13",
|
||||
"DpadLeft_ExtraData": "0",
|
||||
"DpadRight_InputType": "0",
|
||||
"DpadRight_Name": "dpright",
|
||||
"DpadRight_Data": "14",
|
||||
"DpadRight_ExtraData": "0",
|
||||
"CButtonUp_InputType": "1;0",
|
||||
"CButtonUp_Name": "righty-;y",
|
||||
"CButtonUp_Data": "3;3",
|
||||
"CButtonUp_ExtraData": "0;0",
|
||||
"CButtonDown_InputType": "1",
|
||||
"CButtonDown_Name": "righty+",
|
||||
"CButtonDown_Data": "3",
|
||||
"CButtonDown_ExtraData": "1",
|
||||
"CButtonLeft_InputType": "1",
|
||||
"CButtonLeft_Name": "rightx-",
|
||||
"CButtonLeft_Data": "2",
|
||||
"CButtonLeft_ExtraData": "0",
|
||||
"CButtonRight_InputType": "1;0",
|
||||
"CButtonRight_Name": "rightx+;x",
|
||||
"CButtonRight_Data": "2;2",
|
||||
"CButtonRight_ExtraData": "1;0",
|
||||
"LeftTrigger_InputType": "0",
|
||||
"LeftTrigger_Name": "rightshoulder",
|
||||
"LeftTrigger_Data": "10",
|
||||
"LeftTrigger_ExtraData": "0",
|
||||
"RightTrigger_InputType": "1",
|
||||
"RightTrigger_Name": "righttrigger+",
|
||||
"RightTrigger_Data": "5",
|
||||
"RightTrigger_ExtraData": "1",
|
||||
"ZTrigger_InputType": "1",
|
||||
"ZTrigger_Name": "lefttrigger+",
|
||||
"ZTrigger_Data": "4",
|
||||
"ZTrigger_ExtraData": "1",
|
||||
"AnalogStickUp_InputType": "1",
|
||||
"AnalogStickUp_Name": "lefty-",
|
||||
"AnalogStickUp_Data": "1",
|
||||
"AnalogStickUp_ExtraData": "0",
|
||||
"AnalogStickDown_InputType": "1",
|
||||
"AnalogStickDown_Name": "lefty+",
|
||||
"AnalogStickDown_Data": "1",
|
||||
"AnalogStickDown_ExtraData": "1",
|
||||
"AnalogStickLeft_InputType": "1",
|
||||
"AnalogStickLeft_Name": "leftx-",
|
||||
"AnalogStickLeft_Data": "0",
|
||||
"AnalogStickLeft_ExtraData": "0",
|
||||
"AnalogStickRight_InputType": "1",
|
||||
"AnalogStickRight_Name": "leftx+",
|
||||
"AnalogStickRight_Data": "0",
|
||||
"AnalogStickRight_ExtraData": "1"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env sh
|
||||
[ -f "$APPIMAGE".stylesheet ] && APPIMAGE_QT_THEME="$APPIMAGE.stylesheet"
|
||||
[ -f "$APPIMAGE_QT_THEME" ] && set -- "$@" "-stylesheet" "$APPIMAGE_QT_THEME"
|
||||
cur_dir="$(readlink -f "$(dirname "$0")")"
|
||||
|
||||
exec "$cur_dir/bin/RMG" \
|
||||
--lib-path="$cur_dir/shared/lib/RMG" \
|
||||
--core-path="$cur_dir/shared/lib/RMG/Core" \
|
||||
--plugin-path="$cur_dir/shared/lib/RMG/Plugin" \
|
||||
--shared-data-path="$cur_dir/share/RMG" \
|
||||
"$@"
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
script_dir="$(dirname "$0")"
|
||||
toplvl_dir="$(realpath "$script_dir/../../")"
|
||||
bin_dir="$toplvl_dir/Bin/AppImage" # RMG should be installed here
|
||||
lib_dir="/usr/lib64"
|
||||
arch="$(uname -m)"
|
||||
|
||||
|
||||
XVFB_RUN="xvfb-run -a --"
|
||||
LIB4BIN_URL="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
|
||||
APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$arch.AppImage"
|
||||
SHARUN_URL="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-$arch"
|
||||
|
||||
export ARCH="$arch"
|
||||
export APPIMAGE_EXTRACT_AND_RUN=1
|
||||
export VERSION="$(git describe --tags --always)"
|
||||
export OUTPUT="$bin_dir/../RMG-Portable-Linux64-$VERSION.AppImage"
|
||||
export LD_LIBRARY_PATH="$toplvl_dir/Build/AppImage/Source/RMG-Core" # hack
|
||||
export SHARUN="$script_dir/sharun"
|
||||
|
||||
if [[ ! -f "$script_dir/lib4bin" ]]
|
||||
then
|
||||
curl -L "$LIB4BIN_URL" -o "$script_dir/lib4bin"
|
||||
chmod +x "$script_dir/lib4bin"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$script_dir/appimagetool" ]]
|
||||
then
|
||||
curl -L "$APPIMAGETOOL_URL" -o "$script_dir/appimagetool"
|
||||
chmod +x "$script_dir/appimagetool"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$script_dir/sharun" ]]
|
||||
then
|
||||
curl -L "$SHARUN_URL" -o "$script_dir/sharun"
|
||||
chmod +x "$script_dir/sharun"
|
||||
fi
|
||||
|
||||
if [[ "x$DISPLAY" != "x" ]]
|
||||
then
|
||||
XVFB_RUN=""
|
||||
fi
|
||||
|
||||
if [[ -d "/usr/lib/$arch-linux-gnu/" ]]
|
||||
then
|
||||
lib_dir="/usr/lib/$arch-linux-gnu/"
|
||||
fi
|
||||
|
||||
cp "$bin_dir/usr/share/applications/com.github.Rosalie241.RMG.desktop" "$bin_dir"
|
||||
cp "$bin_dir/usr/share/icons/hicolor/scalable/apps/com.github.Rosalie241.RMG.svg" "$bin_dir"
|
||||
ln -s com.github.Rosalie241.RMG.svg "$bin_dir"/.DirIcon
|
||||
mv "$bin_dir/usr/share" "$bin_dir/share"
|
||||
mv "$bin_dir/usr" "$bin_dir/shared"
|
||||
|
||||
$XVFB_RUN "$script_dir/lib4bin" --dst-dir "$bin_dir" \
|
||||
--hard-links --strip --with-hooks \
|
||||
--strace-mode --with-sharun \
|
||||
"$bin_dir/shared/bin/RMG" \
|
||||
"$lib_dir"/libSDL* \
|
||||
"$lib_dir"/libspeexdsp* \
|
||||
"$lib_dir"/libhidapi-hidraw* \
|
||||
"$lib_dir"/libGL* \
|
||||
"$lib_dir"/libEGL* \
|
||||
"$lib_dir"/libvulkan* \
|
||||
"$lib_dir"/dri/* \
|
||||
"$lib_dir"/libssl.so* \
|
||||
"$lib_dir"/qt6/plugins/iconengines/* \
|
||||
"$lib_dir"/qt6/plugins/imageformats/* \
|
||||
"$lib_dir"/qt6/plugins/platforms/* \
|
||||
"$lib_dir"/qt6/plugins/platformthemes/* \
|
||||
"$lib_dir"/qt6/plugins/styles/* \
|
||||
"$lib_dir"/qt6/plugins/xcbglintegrations/* \
|
||||
"$lib_dir"/qt6/plugins/tls/* \
|
||||
"$lib_dir"/qt6/plugins/wayland-*/*
|
||||
|
||||
# Prepare sharun
|
||||
"$bin_dir/sharun" -g
|
||||
cp "$script_dir/AppRun" "$bin_dir"
|
||||
|
||||
# make appimage
|
||||
"$script_dir/appimagetool" --comp zstd \
|
||||
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
|
||||
-n "$bin_dir" "$OUTPUT"
|
||||
@@ -1,46 +1,35 @@
|
||||
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
|
||||
_pkgname=rmg
|
||||
pkgname=${_pkgname}-git
|
||||
pkgver=git
|
||||
pkgname=rmg
|
||||
pkgver=0.8.8
|
||||
pkgrel=1
|
||||
pkgdesc="Rosalie's Mupen GUI"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/Rosalie241/${_pkgname}"
|
||||
license=('GPLv3')
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://github.com/Rosalie241/$pkgname"
|
||||
license=('GPL3')
|
||||
|
||||
provides=("$_pkgname")
|
||||
conflicts=("$_pkgname")
|
||||
depends=("libusb" "hidapi" "libsamplerate" "speexdsp" "minizip" "sdl3" "zlib" "freetype2" "qt6-base" "qt6-svg" "qt6-websockets")
|
||||
makedepends=("git" "nasm" "cmake" "vulkan-headers")
|
||||
|
||||
depends=("hidapi" "libsamplerate" "minizip" "sdl2" "zlib" "freetype2" "qt6-base" "qt6-svg" "xdg-user-dirs")
|
||||
makedepends=("git" "pkg-config" "nasm" "cmake" "cargo" "ninja")
|
||||
|
||||
source=("git+https://github.com/Rosalie241/${_pkgname}.git")
|
||||
source=("git+https://github.com/Rosalie241/$pkgname.git#tag=v$pkgver")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver()
|
||||
{
|
||||
cd "$_pkgname"
|
||||
|
||||
git describe --tags --always | sed -e 's|^v||;s|-|.|g'
|
||||
}
|
||||
|
||||
prepare()
|
||||
{
|
||||
mkdir -p "$srcdir/${_pkgname}/build"
|
||||
mkdir -p "$srcdir/$pkgname/build"
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
cmake -S "$srcdir/${_pkgname}" -B "$srcdir/${_pkgname}/build" \
|
||||
cmake -S "$srcdir/$pkgname" -B "$srcdir/$pkgname/build" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DPORTABLE_INSTALL="OFF" \
|
||||
-DCMAKE_INSTALL_PREFIX="/usr" \
|
||||
-G "Ninja" \
|
||||
-G "Unix Makefiles"
|
||||
|
||||
cmake --build "$srcdir/${_pkgname}/build"
|
||||
cmake --build "$srcdir/$pkgname/build"
|
||||
}
|
||||
|
||||
package()
|
||||
{
|
||||
cmake --install "$srcdir/${_pkgname}/build" --prefix="$pkgdir/usr"
|
||||
cmake --install "$srcdir/$pkgname/build" --prefix="$pkgdir/usr"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
Name: RMG
|
||||
Version: 0.8.8
|
||||
Release: %autorelease
|
||||
Summary: Rosalie's Mupen GUI
|
||||
|
||||
License: GPL-3.0-only
|
||||
URL: https://github.com/Rosalie241/RMG
|
||||
Source0: https://github.com/Rosalie241/RMG/archive/refs/tags/v%{version}.tar.gz
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: g++
|
||||
BuildRequires: nasm
|
||||
BuildRequires: cmake
|
||||
BuildRequires: libusb1-devel
|
||||
BuildRequires: hidapi-devel
|
||||
BuildRequires: libsamplerate-devel
|
||||
BuildRequires: minizip-compat-devel
|
||||
BuildRequires: SDL3-devel
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: mesa-libGL-devel
|
||||
BuildRequires: mesa-libGLU-devel
|
||||
BuildRequires: zlib-ng-devel
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: speexdsp-devel
|
||||
BuildRequires: qt6-qtbase-devel
|
||||
BuildRequires: qt6-qtsvg-devel
|
||||
BuildRequires: qt6-qtwebsockets-devel
|
||||
BuildRequires: libxkbcommon-devel
|
||||
BuildRequires: libatomic
|
||||
|
||||
Requires: libusb1
|
||||
Requires: hidapi
|
||||
Requires: SDL3
|
||||
Requires: zlib-ng
|
||||
Requires: libsamplerate
|
||||
Requires: speexdsp
|
||||
Requires: qt6-qtbase
|
||||
Requires: qt6-qtsvg
|
||||
Requires: qt6-qtwebsockets
|
||||
Requires: libatomic
|
||||
|
||||
%description
|
||||
Rosalie's Mupen GUI is a free and open-source mupen64plus front-end written in C++
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPORTABLE_INSTALL=OFF
|
||||
%cmake_build
|
||||
|
||||
%install
|
||||
%cmake_install
|
||||
|
||||
%files
|
||||
/usr/bin/RMG
|
||||
/usr/lib64/libRMG-Core.so
|
||||
/usr/lib64/RMG/
|
||||
/usr/share/RMG/
|
||||
/usr/share/applications/com.github.Rosalie241.RMG.desktop
|
||||
/usr/share/icons/hicolor/scalable/apps/com.github.Rosalie241.RMG.svg
|
||||
/usr/share/metainfo/com.github.Rosalie241.RMG.metainfo.xml
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 445 KiB After Width: | Height: | Size: 460 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 47 KiB |
@@ -1,262 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<component type="desktop">
|
||||
<!--Created with jdAppdataEdit 2.1-->
|
||||
<id>com.github.Rosalie241.RMG</id>
|
||||
<name>Rosalie's Mupen GUI</name>
|
||||
<summary>An easy to use & cross-platform mupen64plus front-end written in C++ & Qt</summary>
|
||||
<developer_name>Rosalie</developer_name>
|
||||
<launchable type="desktop-id">com.github.Rosalie241.RMG.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0-only</project_license>
|
||||
<description><p>Rosalie's Mupen GUI is an easy to use yet customizable mupen64plus front-end, allowing you to easily play N64 games.</p></description>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<caption>The Rom Browser</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/RomBrowser.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>During A Game</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/InGame.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>Cheats</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/Cheats.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>Settings</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/Settings.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>Input Settings</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/InputSettings.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<description/>
|
||||
<releases>
|
||||
<release version="v0.3.1" date="2023-02-04" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix taking a screenshot not working in some cases</li>
|
||||
<li>Fix some games being unable to save due to having an illegal character in the save filename</li>
|
||||
<li>Fix OSD tab crash in GLideN64</li>
|
||||
<li>Fix an issue where the graphics plugin would show the 64DD IPL as ROM name in the settings even after booting a cartridge</li>
|
||||
<li>Fix "Refresh ROM List" in Hotkeys tab in settings dialog not reverting back to defaults when clicking on 'restore defaults'</li>
|
||||
<li>Fix "Remove Duplicate Keybindings" in settings dialog not behaving correctly in some cases</li>
|
||||
<li>Fix fallback application icons not respecting system icon theme on linux</li>
|
||||
<li>Add support for ndd/d64 files in zip files</li>
|
||||
<li>Add support for using the basename of the ROM filename for covers</li>
|
||||
<li>Add support for binding multiple inputs in RMG-Input</li>
|
||||
<li>Improve behavior of window when launching RMG with a ROM using the commandline</li>
|
||||
<li>Improve behavior of error message when emulation fails</li>
|
||||
<li>Improve behavior of hotkey buttons in settings dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.0" date="2023-01-23" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix GLideN64 not being able to load texture packs from relative paths</li>
|
||||
<li>Fix "Save State Slot" keybindings not working in fullscreen</li>
|
||||
<li>Fix deadzone percentage being incorrect when set to 0% in RMG-Input</li>
|
||||
<li>Fix low deadzone value not working in RMG-Input (thank you porcino)</li>
|
||||
<li>Fix toolbar being hidden when ending emulation while in fullscreen</li>
|
||||
<li>Fix zip files with japanese characters in the file name not being able to be opened on windows</li>
|
||||
<li>Fix ROM Browser not returning to a maximized state when ending emulation</li>
|
||||
<li>Fix ROM Browser not opening maximized when closing RMG with it maximized</li>
|
||||
<li>Fix window not being able to be maximized during emulation when scaling is enabled</li>
|
||||
<li>Fix read-only ROM files not being able to be opened on linux</li>
|
||||
<li>Remove "Allow Manual Window Resizing" setting due to it being always enabled</li>
|
||||
<li>Remove Styles tab from settings dialog on windows</li>
|
||||
<li>Add "Play Game with Cartridge" to context menu when a 64DD disk is selected in the ROM Browser</li>
|
||||
<li>Add "Open ROM Directory" to context menu in the ROM Browser</li>
|
||||
<li>Add an On-Screen Display (see the OSD tab in the settings dialog for settings)</li>
|
||||
<li>Add Theme setting to settings dialog (see Interface -> Miscellaneous, this is a replacement for the previous Styles settings)</li>
|
||||
<li>Improve error message when opening a zip file fails</li>
|
||||
<li>Improve tab order and naming in settings dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.9" date="2023-01-03" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix wrong 64DD Disk extension being listed in empty ROM browser</li>
|
||||
<li>Fix memory corruption when having 64DD Disk files</li>
|
||||
<li>Fix possible crash when render window wasn't visible yet</li>
|
||||
<li>Fix RMG changing the current directory on non-portable installs</li>
|
||||
<li>Remove Qt warning messages (you can view them by setting RMG_SHOW_DEBUG_QT_MESSAGES to 1)</li>
|
||||
<li>Change "Choose ROM Directory" to "Change ROM Directory"</li>
|
||||
<li>Add -q/--quit-after-emulation commandline option</li>
|
||||
<li>Add 2 more icons to menubar menus/items</li>
|
||||
<li>Add "Current Save State" tab to Hotkeys tab in settings dialog (this allows you to use a hotkey to change save state slots)</li>
|
||||
<li>Improve behavior of Hotkeys tab in settings dialog</li>
|
||||
<li>Improve behavior of window when exiting RMG while in-game</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.8" date="2023-01-01" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix 'Uniform Size (Grid View)' not being disabled during emulation</li>
|
||||
<li>Fix toolbar not respecting the view setting</li>
|
||||
<li>Fix being stuck at the loading screen when having more ROMs than the ROM search limit</li>
|
||||
<li>Improve error message when opening a ROM fails</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.7" date="2022-12-29" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix core error not showing when the statusbar was hidden</li>
|
||||
<li>Fix .ndd/.64d not being in the empty ROM Browser widget</li>
|
||||
<li>Fix .jpg/.jpeg files not working on covers on Windows</li>
|
||||
<li>Fix updater script not copying subdirectories on Windows (for portable installs)</li>
|
||||
<li>Fix 64DD Disks which required the development IPL not working</li>
|
||||
<li>Fix 64DD Disks showing the wrong internal ROM name (this fix requires clearing the ROM cache)</li>
|
||||
<li>Fix cover filenames allowing invalid characters (they will now be replaced by _)</li>
|
||||
<li>Add more icons to View menu in the menu bar</li>
|
||||
<li>Add 'Uniform Size (Grid View)' to View menu in the menu bar</li>
|
||||
<li>Add smooth scrolling to List View and Grid View</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.6" date="2022-12-28" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix default save state/game directory being incorrect on first run (on non-portable installs)</li>
|
||||
<li>Fix angrylion-rdp-plus not loading settings correctly</li>
|
||||
<li>Fix cheat settings not moving over when renaming a cheat</li>
|
||||
<li>Remove fullscreen resolution combobox from GLideN64 because it did nothing</li>
|
||||
<li>Remove File menu from menu bar</li>
|
||||
<li>Implement disk support without requiring a cartridge</li>
|
||||
<li>Add toolbar</li>
|
||||
<li>Add View menu to menu bar</li>
|
||||
<li>Add Grid view to ROM browser</li>
|
||||
<li>Add icons to all menu bar items</li>
|
||||
<li>Add log dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.5" date="2022-12-14" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix incorrect controller being selected in RMG-Input when having 2 controllers with the same name</li>
|
||||
<li>Fix some UI elements being enabled while the 'Controller Is Plugged In' checkbox is disabled in RMG-Input</li>
|
||||
<li>Fix extra padding being added when having a controller selected and opening RMG-Input</li>
|
||||
<li>Fix creating a new profile in GLideN64</li>
|
||||
<li>Add Z-Trigger visualization in RMG-Input</li>
|
||||
<li>Remove Debugger checkbox in the settings dialog because it did nothing</li>
|
||||
<li>Remove About buttons in the plugin tab of the settings dialog because it did nothing</li>
|
||||
<li>Implement close button on all dialogs</li>
|
||||
<li>Implement custom style support (for Windows only)</li>
|
||||
<li>Implement the ability to remove/reset the main profile in RMG-Input</li>
|
||||
<li>Rename Interface tab in settings dialog to User Interface</li>
|
||||
<li>Migrate to Qt6 (currently the flatpak will remain Qt5)</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.4" date="2022-12-08" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix Discord Rich Presence breaking when opening the settings dialog</li>
|
||||
<li>Fix install update window not showing</li>
|
||||
<li>Fix 'Limit FPS' not working with new RMG-Audio (this disables the 'synchronize audio' option)</li>
|
||||
<li>Implement support for Japanese characters in the ROM header</li>
|
||||
<li>Implement dynamic buffer sizes in the ROM browser cache (this reduces the ROM browser cache size)</li>
|
||||
<li>Add more cheats from Gent</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.3" date="2022-12-05" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Add updater for portable installations</li>
|
||||
<li>Add Discord Rich Presence</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.2" date="2022-12-03" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix trivial resampler not being available in RMG-Audio</li>
|
||||
<li>Fix save games/states showing up in multiple patched ROMs based on the same game</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.1" date="2022-12-02" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Improve cheat error handling</li>
|
||||
<li>Improve cheat dialog slightly (ok button is now disabled by default)</li>
|
||||
<li>Improve RMG-Audio by using mupen64plus-audio-sdl as base</li>
|
||||
<li>Add iQue cheats from Gent</li>
|
||||
<li>Add CRLF support in cheat files</li>
|
||||
<li>Add 'Remove Duplicate Keybindings' in settings dialog</li>
|
||||
<li>Change maximum ROM browser cache items to 10000</li>
|
||||
<li>Change default ROM browser limit to 250</li>
|
||||
<li>Fix cheat settings being gone after opening the settings dialog in-game</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.0" date="2022-11-29" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix out of bounds read in ROM browser cache</li>
|
||||
<li>Fix --fullscreen not working like expected</li>
|
||||
<li>Fix crash on windows when exiting</li>
|
||||
<li>Implement octagon simulation in RMG-Input (thank you Jaxon)</li>
|
||||
<li>implement cheat support</li>
|
||||
<li>Add 'Invert Axis Mapped To LRZ' option to RMG-Input</li>
|
||||
<li>Add --disk commandline argument (for opening N64 ROMs with 64DD disk files)</li>
|
||||
<li>Add configuration GUI to angrylion-rdp-plus (thank you GhostlyDark)</li>
|
||||
<li>Remove range setting from RMG-Input </li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.1.9" date="2022-11-19" type="stable"/>
|
||||
<release version="v0.1.8" date="2022-11-17" type="stable"/>
|
||||
<release version="v0.1.7" date="2022-11-14" type="stable"/>
|
||||
<release version="v0.1.6" date="2022-09-12" type="stable"/>
|
||||
<release version="v0.1.5" date="2022-09-10" type="stable"/>
|
||||
<release version="v0.1.4" date="2022-03-13" type="stable"/>
|
||||
<release version="v0.1.3" date="2022-02-14" type="stable"/>
|
||||
<release version="v0.1.2" date="2022-01-21" type="stable"/>
|
||||
<release version="v0.1.1" date="2022-01-19" type="stable"/>
|
||||
<release version="v0.1.0" date="2022-01-07" type="stable"/>
|
||||
<release version="v0.0.9" date="2021-12-25" type="stable"/>
|
||||
<release version="v0.0.8" date="2021-12-24" type="stable"/>
|
||||
<release version="v0.0.7" date="2021-12-23" type="stable"/>
|
||||
<release version="v0.0.6" date="2021-10-18" type="stable"/>
|
||||
<release version="v0.0.5" date="2021-10-17" type="stable"/>
|
||||
<release version="v0.0.4" date="2021-10-06" type="stable"/>
|
||||
<release version="v0.0.3" date="2021-10-04" type="stable"/>
|
||||
<release version="v0.0.2" date="2021-09-26" type="stable"/>
|
||||
</releases>
|
||||
<url type="homepage">https://github.com/Rosalie241/RMG</url>
|
||||
<url type="bugtracker">https://github.com/Rosalie241/RMG/issues</url>
|
||||
<categories>
|
||||
<category>Game</category>
|
||||
<category>Emulator</category>
|
||||
<category>Qt</category>
|
||||
</categories>
|
||||
<recommends>
|
||||
<control>pointing</control>
|
||||
<control>keyboard</control>
|
||||
</recommends>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<keywords>
|
||||
<keyword>mupen64plus</keyword>
|
||||
<keyword>RMG</keyword>
|
||||
</keywords>
|
||||
</component>
|
||||
@@ -1,9 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Rosalie's Mupen GUI
|
||||
Comment=An easy to use & cross-platform mupen64plus front-end written in C++ & Qt
|
||||
Comment=An easy to use & cross-platform mupen64plus front-end written in C++ & Qt
|
||||
Exec=RMG %f
|
||||
TryExec=RMG
|
||||
Icon=com.github.Rosalie241.RMG
|
||||
Terminal=false
|
||||
Categories=Game;Emulator;Qt;
|
||||
MimeType=application/x-n64-rom;
|
||||
Keywords=emulator;mupen64plus;n64;RMG
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
# Rosalie's Mupen GUI
|
||||
|
||||
Rosalie's Mupen GUI is a free and open-source mupen64plus GUI written in C++.
|
||||
Rosalie's Mupen GUI is a free and open-source mupen64plus front-end written in C++.
|
||||
|
||||
It offers a simple-to-use user interface.
|
||||
|
||||
## Download
|
||||
|
||||
#### Windows
|
||||
You can download Rosalie's Mupen GUI on 
|
||||
|
||||
#### Linux
|
||||
You can download Rosalie's Mupen GUI on
|
||||
* [Github Releases (AppImage)](https://github.com/Rosalie241/RMG/releases)
|
||||
* [Flathub (Flatpak)](https://flathub.org/apps/details/com.github.Rosalie241.RMG)
|
||||
* [Arch User Repository](https://aur.archlinux.org/packages/rmg)
|
||||
* [Fedora COPR](https://copr.fedorainfracloud.org/coprs/rosalie/RMG/)
|
||||
|
||||
## Support
|
||||
|
||||
Join the [Rosalie's Mupen GUI Discord Server](https://discord.gg/k9GuyJ2PpF) for support
|
||||
You can ask for help or report issues on
|
||||
* [Github](https://github.com/Rosalie241/RMG/issues/new)
|
||||
* [Discord](https://discord.gg/k9GuyJ2PpF)
|
||||
|
||||
## License
|
||||
|
||||
@@ -24,13 +38,25 @@ Rosalie's Mupen GUI is licensed under the [GNU General Public License v3.0](http
|
||||
* Portable Debian/Ubuntu
|
||||
|
||||
```bash
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev build-essential nasm git zip ninja-build
|
||||
sudo apt-get -y install cmake libusb-1.0-0-dev libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl3-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev qt6-websockets-dev libqt6svg6-dev libvulkan-dev build-essential nasm git zip ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable Fedora
|
||||
```bash
|
||||
sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL2-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel gcc-c++ nasm git ninja-build
|
||||
sudo dnf install libusb1-devel hidapi-devel libsamplerate-devel minizip-compat-devel SDL3-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel pkgconfig zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel qt6-qtwebsockets-devel vulkan-devel gcc-c++ nasm git ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable Arch Linux
|
||||
```bash
|
||||
sudo pacman -S --needed make cmake gcc libusb hidapi freetype2 libpng qt6 sdl3 libsamplerate nasm minizip pkgconf vulkan-headers git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable OpenSUSE Tumbleweed
|
||||
```bash
|
||||
sudo zypper install SDL3-devel cmake freetype2-devel gcc gcc-c++ libusb-1_0-devel libhidapi-devel libhidapi-hidraw0 libpng16-devel libsamplerate-devel make nasm ninja pkgconf-pkg-config speex-devel vulkan-devel zlib-devel qt6-tools-devel qt6-opengl-devel qt6-widgets-devel qt6-svg-devel minizip-devel git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
@@ -47,9 +73,9 @@ cmake --install "$build_dir" --prefix="/usr"
|
||||
```
|
||||
|
||||
#### Windows
|
||||
* Download & Install [MSYS2](https://www.msys2.org/)
|
||||
* Download & Install [MSYS2](https://www.msys2.org/) (UCRT64)
|
||||
```bash
|
||||
pacman -S --needed make mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-hidapi mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-SDL2 mingw-w64-x86_64-qt6 mingw-w64-x86_64-SDL2 mingw-w64-x86_64-hidapi mingw-w64-x86_64-speexdsp mingw-w64-x86_64-libsamplerate mingw-w64-x86_64-nasm mingw-w64-x86_64-minizip git
|
||||
pacman -S --needed make mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-libusb mingw-w64-ucrt-x86_64-hidapi mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-qt6 mingw-w64-ucrt-x86_64-sdl3 mingw-w64-ucrt-x86_64-speexdsp mingw-w64-ucrt-x86_64-libsamplerate mingw-w64-ucrt-x86_64-libusb mingw-w64-ucrt-x86_64-nasm mingw-w64-ucrt-x86_64-minizip mingw-w64-ucrt-x86_64-vulkan-headers git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
|
||||
@@ -3,17 +3,9 @@
|
||||
#
|
||||
include(ExternalProject)
|
||||
|
||||
set(THIRDPARTY_DIR ${CMAKE_BINARY_DIR}/Source/3rdParty)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
find_program(RUST_CARGO cargo)
|
||||
if(${RUST_CARGO} STREQUAL "RUST_CARGO-NOTFOUND")
|
||||
message(WARNING "mupen64plus-input-gca will not be built due to not having cargo installed")
|
||||
set(BUILD_INPUT_GCA OFF)
|
||||
else()
|
||||
set(BUILD_INPUT_GCA ON)
|
||||
endif()
|
||||
|
||||
set(M64P_CORE_DIR ${THIRDPARTY_DIR}/mupen64plus-core)
|
||||
set(M64P_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core)
|
||||
if(WIN32)
|
||||
set(SO_EXT "dll")
|
||||
set(GCA_LIB "mupen64plus_input_gca.${SO_EXT}")
|
||||
@@ -24,7 +16,9 @@ else(WIN32)
|
||||
set(CORE_FILE "libmupen64plus.so")
|
||||
endif(WIN32)
|
||||
|
||||
set(BASE_CMAKE_CONFIGURE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
|
||||
set(BASE_CMAKE_CONFIGURE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})
|
||||
if (USE_CCACHE)
|
||||
set(CMAKE_CONFIGURE_ARGS ${BASE_CMAKE_CONFIGURE_ARGS} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache)
|
||||
set(MAKE_CC_COMPILER "ccache ${CMAKE_C_COMPILER}")
|
||||
@@ -35,227 +29,199 @@ else(USE_CCACHE)
|
||||
set(MAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
|
||||
endif(USE_CCACHE)
|
||||
|
||||
if(NOT NO_GIT_CLONE)
|
||||
set(MUPEN64PLUSCORE_URL "https://github.com/Rosalie241/mupen64plus-core")
|
||||
set(MUPEN64PLUSCORE_TAG "fc8edd980a844d11fde64c719591090d09185264")
|
||||
|
||||
set(MUPEN64PLUS_RSP_CXD4_URL "https://github.com/mupen64plus/mupen64plus-rsp-cxd4")
|
||||
set(MUPEN64PLUS_RSP_CXD4_TAG "39f79201baa15890c4cbae92f2215a634cc3ee6d")
|
||||
|
||||
set(MUPEN64PLUS_RSP_HLE_URL "https://github.com/mupen64plus/mupen64plus-rsp-hle")
|
||||
set(MUPEN64PLUS_RSP_HLE_TAG "88093cb43499eff53d343653cddcae2132af17ef")
|
||||
|
||||
set(MUPEN64PLUS_RSP_PARALLEL_URL "https://github.com/Rosalie241/parallel-rsp")
|
||||
set(MUPEN64PLUS_RSP_PARALLEL_TAG "e67cee3131651c3e48343294d94fa68a6f8ec14c")
|
||||
|
||||
set(MUPEN64PLUS_INPUT_RAPHNET_URL "https://github.com/raphnet/mupen64plus-input-raphnetraw")
|
||||
set(MUPEN64PLUS_INPUT_RAPHNET_TAG "86112413e98a8648edb11d199673cc24d5799af8")
|
||||
|
||||
set(MUPEN64PLUS_INPUT_GCA_URL "https://github.com/amatho/mupen64plus-input-gca")
|
||||
set(MUPEN64PLUS_INPUT_GCA_TAG "21639fb13dfa797a7c0949ffd9bbda9a3456fc69")
|
||||
# use sub-make when available
|
||||
if ("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles" OR
|
||||
"${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles")
|
||||
set(MAKE_CMD "$(MAKE)")
|
||||
else()
|
||||
set(MAKE_CMD "make")
|
||||
endif()
|
||||
|
||||
set(MUPEN64PLUS_GFX_ANGRYLION_URL "https://github.com/Rosalie241/angrylion-rdp-plus")
|
||||
set(MUPEN64PLUS_GFX_ANGRYLION_TAG "158e74d4ec1c818289cd19c3a05e498c3ceff758")
|
||||
if ("${CMAKE_C_FLAGS}" STREQUAL "")
|
||||
set(MAKE_OPTFLAGS "-O3")
|
||||
else()
|
||||
set(MAKE_OPTFLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_URL "https://github.com/gonetz/GLideN64")
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_TAG "263a7bd2ca81759ece98209bd282a6c1173a129f")
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set(MAKE_DEBUG "0")
|
||||
set(MAKE_OPTFLAGS "${MAKE_OPTFLAGS} -g")
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(MAKE_DEBUG "1")
|
||||
else()
|
||||
set(MAKE_DEBUG "0")
|
||||
endif()
|
||||
|
||||
set(MUPEN64PLUS_GFX_PARALLEL_URL "https://github.com/Rosalie241/parallel-rdp-standalone")
|
||||
set(MUPEN64PLUS_GFX_PARALLEL_TAG "48abaa5e082add7848e6f98648111c69c4a71632")
|
||||
|
||||
set(DISCORD_RPC_URL "https://github.com/discord/discord-rpc")
|
||||
set(DISCORD_RPC_TAG "963aa9f3e5ce81a4682c6ca3d136cddda614db33")
|
||||
|
||||
set(IMGUI_URL "https://github.com/ocornut/imgui")
|
||||
set(IMGUI_TAG "d7c8516a4b848c0291e3d75b627c0843f515f591")
|
||||
endif(NOT NO_GIT_CLONE)
|
||||
# TODO: when SDL3_net has made a release,
|
||||
# remove the vendored SDL3_net
|
||||
set(SDL3NET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL_net)
|
||||
set(SDL3NET_SOURCES
|
||||
${SDL3NET_DIR}/src/SDL_net.c
|
||||
)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL3 REQUIRED sdl3)
|
||||
add_library(SDL3_net STATIC ${SDL3NET_SOURCES})
|
||||
target_include_directories(SDL3_net PRIVATE ${SDL3NET_DIR}/include)
|
||||
set(SDL3NET_CFLAGS "-DUSE_SDL3NET -I${SDL3NET_DIR}/include")
|
||||
# for some reason MingW needs SDL3 to be linked after SDL3_net,
|
||||
# else we get a lot of missing symbol errors, should be harmless
|
||||
# on other platforms
|
||||
set(SDL3NET_LDLIBS "$<TARGET_FILE:SDL3_net> -l${SDL3_LIBRARIES}")
|
||||
if (WIN32)
|
||||
set(SDL3NET_LDLIBS "${SDL3NET_LDLIBS} -liphlpapi -lws2_32")
|
||||
endif (WIN32)
|
||||
|
||||
ExternalProject_Add(mupen64plus-core
|
||||
SOURCE_DIR mupen64plus-core/
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUSCORE_URL}
|
||||
GIT_TAG ${MUPEN64PLUSCORE_TAG}
|
||||
|
||||
BUILD_COMMAND make all OSD=0 NEW_DYNAREC=1 TARGET=${CORE_FILE} DEBUG=$<CONFIG:Debug> KEYBINDINGS=0 CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_COMMAND ${MAKE_CMD} all -f ${M64P_CORE_DIR}/projects/unix/Makefile
|
||||
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/src
|
||||
SUBDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/subprojects
|
||||
OSD=0 NEW_DYNAREC=1 NO_ASM=$<BOOL:${NO_ASM}>
|
||||
KEYBINDINGS=0 ACCURATE_FPU=1 VULKAN=0 NETPLAY=$<BOOL:${NETPLAY}>
|
||||
TARGET=${CORE_FILE} DEBUG=${MAKE_DEBUG}
|
||||
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
OPTFLAGS=${MAKE_OPTFLAGS}
|
||||
# TODO: when SDL3_net has made a release,
|
||||
# remove the vendored SDL3_net
|
||||
SDLNET_CFLAGS=${SDL3NET_CFLAGS} SDLNET_LDLIBS=${SDL3NET_LDLIBS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-core
|
||||
|
||||
BINARY_DIR ${M64P_CORE_DIR}/projects/unix
|
||||
|
||||
BUILD_BYPRODUCTS ${M64P_CORE_DIR}/projects/unix/${CORE_FILE}
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-core/${CORE_FILE}
|
||||
DEPENDS SDL3_net
|
||||
)
|
||||
|
||||
set(APIDIR "${CMAKE_BINARY_DIR}/Source/3rdParty/mupen64plus-core/src/api")
|
||||
set(APIDIR "${CMAKE_SOURCE_DIR}/Source/3rdParty/mupen64plus-core/src/api")
|
||||
|
||||
ExternalProject_Add(mupen64plus-rsp-cxd4
|
||||
SOURCE_DIR mupen64plus-rsp-cxd4/
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-cxd4/
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_RSP_CXD4_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_RSP_CXD4_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> POSTFIX= CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_COMMAND ${MAKE_CMD} all -f ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-cxd4/projects/unix/Makefile
|
||||
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-cxd4
|
||||
APIDIR=${APIDIR} DEBUG=${MAKE_DEBUG} POSTFIX=
|
||||
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
OPTFLAGS=${MAKE_OPTFLAGS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-cxd4
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-rsp-cxd4/projects/unix
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-rsp-cxd4/projects/unix/mupen64plus-rsp-cxd4.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-cxd4/mupen64plus-rsp-cxd4.${SO_EXT}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-rsp-hle
|
||||
SOURCE_DIR mupen64plus-rsp-hle/
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-hle/
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_RSP_HLE_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_RSP_HLE_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_COMMAND ${MAKE_CMD} all -f ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-hle/projects/unix/Makefile
|
||||
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-hle/src
|
||||
APIDIR=${APIDIR} DEBUG=${MAKE_DEBUG}
|
||||
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
OPTFLAGS=${MAKE_OPTFLAGS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-hle
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-rsp-hle/projects/unix
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-rsp-hle/projects/unix/mupen64plus-rsp-hle.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-hle/mupen64plus-rsp-hle.${SO_EXT}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-rsp-parallel
|
||||
SOURCE_DIR mupen64plus-rsp-parallel
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_RSP_PARALLEL_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_RSP_PARALLEL_TAG}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-rsp-parallel/
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS ${CMAKE_CONFIGURE_ARGS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
CMAKE_ARGS -DUSE_IPO=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-parallel
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-rsp-parallel/mupen64plus-rsp-parallel.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-rsp-parallel/mupen64plus-rsp-parallel.${SO_EXT}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-input-raphnetraw
|
||||
SOURCE_DIR mupen64plus-input-raphnetraw/
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-input-raphnetraw/
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_INPUT_RAPHNET_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_INPUT_RAPHNET_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_COMMAND ${MAKE_CMD} all -f ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-input-raphnetraw/projects/unix/Makefile
|
||||
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-input-raphnetraw/src
|
||||
APIDIR=${APIDIR} DEBUG=${MAKE_DEBUG}
|
||||
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
OPTFLAGS=${MAKE_OPTFLAGS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-input-raphnetraw
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-input-raphnetraw/projects/unix
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-input-raphnetraw/projects/unix/mupen64plus-input-raphnetraw.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-input-raphnetraw/mupen64plus-input-raphnetraw.${SO_EXT}
|
||||
)
|
||||
|
||||
if (BUILD_INPUT_GCA)
|
||||
ExternalProject_Add(mupen64plus-input-gca
|
||||
SOURCE_DIR mupen64plus-input-gca/
|
||||
set(GLIDEN64_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-video-GLideN64")
|
||||
set(GLIDEN64_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-GLideN64")
|
||||
set(GLIDEN64_CUSTOM_INI "${GLIDEN64_DIR}/ini/GLideN64.custom.ini")
|
||||
# taken from GLideN64's CMakeLists.txt
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR
|
||||
"${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel" OR
|
||||
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set(GLIDEN64_BUILD_TYPE Release)
|
||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(GLIDEN64_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
if (USE_ANGRYLION)
|
||||
ExternalProject_Add(mupen64plus-video-angrylion-plus
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-video-angrylion-plus
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_INPUT_GCA_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_INPUT_GCA_TAG}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
CMAKE_ARGS -DBUILD_MUPEN64PLUS=ON -DBUILD_PROJECT64=OFF -DUSE_QT5=OFF -DUSE_IPO=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-angrylion-plus
|
||||
|
||||
BUILD_COMMAND cargo build --release --features "m64p_compat"
|
||||
BUILD_IN_SOURCE True
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-input-gca/target/release/${GCA_LIB}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-angrylion-plus/mupen64plus-video-angrylion-plus.${SO_EXT}
|
||||
)
|
||||
endif(BUILD_INPUT_GCA)
|
||||
|
||||
set(GLIDEN64_DIR "${THIRDPARTY_DIR}/mupen64plus-video-GLideN64")
|
||||
set(GLIDEN64_BUILD_DIR "${GLIDEN64_DIR}/projects/cmake")
|
||||
set(GLIDEN64_CUSTOM_INI "${GLIDEN64_DIR}/ini/GLideN64.custom.ini")
|
||||
if (WIN32)
|
||||
set(GLIDEN64_LIB "${GLIDEN64_BUILD_DIR}/mupen64plus-video-GLideN64.${SO_EXT}")
|
||||
else(WIN32)
|
||||
set(GLIDEN64_LIB "${GLIDEN64_BUILD_DIR}/plugin/${CMAKE_BUILD_TYPE}/mupen64plus-video-GLideN64.${SO_EXT}")
|
||||
endif(WIN32)
|
||||
|
||||
set(GLIDENUI_TRANSLATIONS_LANGS "de;es;fr;it;ja;pl;pt_BR")
|
||||
foreach(LANG ${GLIDENUI_TRANSLATIONS_LANGS})
|
||||
list(APPEND GLIDENUI_TRANSLATIONS "${GLIDEN64_DIR}/translations/release/gliden64_${LANG}.qm")
|
||||
endforeach()
|
||||
|
||||
ExternalProject_Add(mupen64plus-video-angrylion-plus
|
||||
SOURCE_DIR mupen64plus-video-angrylion-plus
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_GFX_ANGRYLION_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_GFX_ANGRYLION_TAG}
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DBUILD_MUPEN64PLUS=ON -DBUILD_PROJECT64=OFF -DUSE_QT5=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-video-angrylion-plus/mupen64plus-video-angrylion-plus.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
)
|
||||
endif(USE_ANGRYLION)
|
||||
|
||||
ExternalProject_Add(mupen64plus-video-GLideN64
|
||||
SOURCE_DIR mupen64plus-video-GLideN64
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_GFX_GLIDEN64_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_GFX_GLIDEN64_TAG}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-video-GLideN64
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE False
|
||||
CMAKE_ARGS -DMUPENPLUSAPI=ON -DMUPENPLUSAPI_GLIDENUI=ON -DGLIDENUI_QT6=ON -DUSE_SYSTEM_LIBS=ON ${CMAKE_CONFIGURE_ARGS}
|
||||
BUILD_ALWAYS True
|
||||
CMAKE_ARGS -DMUPENPLUSAPI=ON -DMUPENPLUSAPI_GLIDENUI=ON -DGLIDENUI_QT6=ON -DUSE_IPO=OFF -DUSE_SYSTEM_LIBS=ON ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
SOURCE_SUBDIR ./src/
|
||||
BINARY_DIR ${GLIDEN64_BUILD_DIR}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-GLideN64
|
||||
|
||||
BUILD_BYPRODUCTS ${GLIDEN64_LIB}
|
||||
BUILD_BYPRODUCTS ${GLIDEN64_BUILD_DIR}/plugin/${GLIDEN64_BUILD_TYPE}/mupen64plus-video-GLideN64.${SO_EXT}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-video-parallel
|
||||
SOURCE_DIR mupen64plus-video-parallel
|
||||
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_GFX_PARALLEL_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_GFX_PARALLEL_TAG}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-video-parallel
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DUSE_QT5=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
BUILD_IN_SOURCE False
|
||||
BUILD_ALWAYS True
|
||||
CMAKE_ARGS -DCONFIG_GUI=ON -DUSE_IPO=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-parallel
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-video-parallel/mupen64plus-video-parallel.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/mupen64plus-video-parallel/mupen64plus-video-parallel.${SO_EXT}
|
||||
)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
ExternalProject_Add(discord-rpc
|
||||
SOURCE_DIR discord-rpc
|
||||
|
||||
GIT_REPOSITORY ${DISCORD_RPC_URL}
|
||||
GIT_TAG ${DISCORD_RPC_TAG}
|
||||
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DBUILD_EXAMPLES=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/discord-rpc/src/libdiscord-rpc.a
|
||||
)
|
||||
endif(DISCORD_RPC)
|
||||
|
||||
set(IMGUI_DIR ${THIRDPARTY_DIR}/imgui)
|
||||
set(IMGUI_BUILD_DIR ${IMGUI_DIR}/build)
|
||||
set(IMGUI_SOURCES_IN
|
||||
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui)
|
||||
set(IMGUI_SOURCES
|
||||
${IMGUI_DIR}/imgui_draw.cpp
|
||||
${IMGUI_DIR}/imgui_tables.cpp
|
||||
${IMGUI_DIR}/imgui_widgets.cpp
|
||||
@@ -264,26 +230,25 @@ set(IMGUI_SOURCES_IN
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl3.h
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl3_loader.h
|
||||
)
|
||||
set(IMGUI_SOURCES_OUT
|
||||
${IMGUI_BUILD_DIR}/imgui_draw.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_tables.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_widgets.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3.h
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3_loader.h
|
||||
add_library(imgui STATIC ${IMGUI_SOURCES})
|
||||
target_include_directories(imgui PRIVATE ${IMGUI_DIR})
|
||||
|
||||
set(SDL_GAMECONTROLLERDB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL_GameControllerDB)
|
||||
set(SDL_GAMECONTROLLERDB_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/SDL_GameControllerDB)
|
||||
set(SDL_GAMECONTROLLERDB_SOURCES_IN
|
||||
${SDL_GAMECONTROLLERDB_DIR}/gamecontrollerdb.txt
|
||||
)
|
||||
ExternalProject_Add(imgui
|
||||
SOURCE_DIR imgui
|
||||
set(SDL_GAMECONTROLLERDB_SOURCES_OUT
|
||||
${SDL_GAMECONTROLLERDB_BUILD_DIR}/gamecontrollerdb.txt
|
||||
)
|
||||
ExternalProject_Add(SDL_GameControllerDB
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL_GameControllerDB
|
||||
|
||||
GIT_REPOSITORY ${IMGUI_URL}
|
||||
GIT_TAG ${IMGUI_TAG}
|
||||
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory ${IMGUI_BUILD_DIR}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E copy ${IMGUI_SOURCES_IN} ${IMGUI_BUILD_DIR}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory ${SDL_GAMECONTROLLERDB_BUILD_DIR}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E copy ${SDL_GAMECONTROLLERDB_SOURCES_IN} ${SDL_GAMECONTROLLERDB_SOURCES_OUT}
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_BYPRODUCTS ${IMGUI_SOURCES_OUT}
|
||||
BUILD_BYPRODUCTS ${SDL_GAMECONTROLLERDB_SOURCES_OUT}
|
||||
)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-core BUILD_BYPRODUCTS)
|
||||
@@ -302,25 +267,19 @@ set(MUPEN64PLUS_PLUGIN_RSP_PARALLEL ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
ExternalProject_Get_property(mupen64plus-input-raphnetraw BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_INPUT_RAPHNET ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
if (BUILD_INPUT_GCA)
|
||||
ExternalProject_Get_property(mupen64plus-input-gca BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_INPUT_GCA ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
endif(BUILD_INPUT_GCA)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-angrylion-plus BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_ANGRYLION ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
if (USE_ANGRYLION)
|
||||
ExternalProject_Get_property(mupen64plus-video-angrylion-plus BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_ANGRYLION ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
endif(USE_ANGRYLION)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-GLideN64 BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64 ${BUILD_BYPRODUCTS} ${GLIDENUI_TRANSLATIONS} ${GLIDEN64_CUSTOM_INI} PARENT_SCOPE)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64 ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64_DATA ${GLIDEN64_CUSTOM_INI} PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-parallel BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_PARALLEL ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
ExternalProject_Get_property(discord-rpc BUILD_BYPRODUCTS)
|
||||
set(DISCORD_RPC_LIB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
endif(DISCORD_RPC)
|
||||
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(imgui BUILD_BYPRODUCTS)
|
||||
set(IMGUI_SOURCES ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
set(IMGUI_DIR ${THIRDPARTY_DIR}/imgui PARENT_SCOPE)
|
||||
ExternalProject_Get_property(SDL_GameControllerDB BUILD_BYPRODUCTS)
|
||||
set(SDL_GAMECONTROLLERDB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
name: Data check
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
jobs:
|
||||
duplicates:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
python duplicates.py
|
||||
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = git@github.com:/gabomdq/SDL_GameControllerDB.git
|
||||
branch = master
|
||||
commit = 65490d3c39825a84f9c2cb4fa9bc359284f37ca2
|
||||
parent = 8552e07ed8d2d06bf9638aa76ac30c06d58ff147
|
||||
method = merge
|
||||
cmdver = 0.4.9
|
||||
@@ -0,0 +1,18 @@
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# SDL_GameControllerDB
|
||||
|
||||
A community sourced database of game controller mappings to be used with SDL2 and SDL3 Game Controller functionality.
|
||||
|
||||
## Usage
|
||||
Download gamecontrollerdb.txt, place it in your app's directory and load it.
|
||||
|
||||
SDL2:
|
||||
```c
|
||||
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
|
||||
```
|
||||
|
||||
SDL3:
|
||||
```c
|
||||
SDL_AddGamepadMappingsFromFile("gamecontrollerdb.txt");
|
||||
```
|
||||
|
||||
The database is compatible with SDL v2.0.10 and newer.
|
||||
|
||||
## Create New Mappings
|
||||
A mapping looks like this:
|
||||
```
|
||||
030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
```
|
||||
It includes controller GUID (`030000004c050000c405000000010000`), a name (`PS4 Controller`), button / axis mappings (`leftshoulder:b4`) and a platform (`platform:Mac OS X`).
|
||||
|
||||
Please make sure to check that the name is a good description of the controller. If relevant, include the controller's name and model number.
|
||||
|
||||
## Mapping Guide
|
||||
|
||||

|
||||
|
||||
## Mapping Tools
|
||||
There are a few different tools that let you create mappings.
|
||||
|
||||
### [SDL2 Gamepad Tool](http://www.generalarcade.com/gamepadtool/)
|
||||
Third party cross-platform tool with GUI (Windows, macOS and Linux)
|
||||
|
||||
*While convenient, this tool has fallen out of date as SDL has amended and added new features for gamepad support (see [#478](https://github.com/gabomdq/SDL_GameControllerDB/issues/476)). Maps authored with this tool require maintainer scrutiny to ensure they will not break support for explicit mappings the SDL project provides.*
|
||||
|
||||
### [SDL](https://github.com/libsdl-org/SDL/releases/latest)
|
||||
[testcontroller (SDL3)](https://github.com/libsdl-org/SDL/blob/main/test/testcontroller.c) and [controllermap (SDL2)](https://github.com/libsdl-org/SDL/blob/SDL2/test/controllermap.c) utilities are the official tools to create these mappings on all SDL supported platforms (Windows, Mac, Linux, iOS, Android, etc).
|
||||
|
||||
## Contributing
|
||||
|
||||
First, please confirm for yourself
|
||||
- Your device is a gamepad
|
||||
- Your mapping best represents the Xbox layout per the [mapping guide](https://github.com/mdqinc/SDL_GameControllerDB/blob/master/mapping_guide.png)
|
||||
- An acceptable mapping is not [already present in the DB](https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt), searching by platform and GUID
|
||||
- Adding the mapping to the db improves, and does not degrade, the experience of using the gamepad
|
||||
|
||||
Contribute by [opening a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request), or [creating an issue](https://github.com/mdqinc/SDL_GameControllerDB/issues/new)
|
||||
|
||||
## Resources
|
||||
|
||||
### [SDL2](https://wiki.libsdl.org/SDL2/)
|
||||
* [Game Controller Support](https://wiki.libsdl.org/SDL2/CategoryGameController)
|
||||
* [SDL_GameControllerAddMappingsFromFile](https://wiki.libsdl.org/SDL2/SDL_GameControllerAddMappingsFromFile)
|
||||
### [SDL3](https://wiki.libsdl.org/SDL3/)
|
||||
* [Gamepad Support](https://wiki.libsdl.org/SDL3/CategoryGamepad)
|
||||
* [SDL_AddGamepadMappingsFromFile](https://wiki.libsdl.org/SDL3/SDL_AddGamepadMappingsFromFile)
|
||||
@@ -0,0 +1,26 @@
|
||||
# SPDX-License-Identifier: Zlib
|
||||
|
||||
import difflib
|
||||
import sys
|
||||
|
||||
CROSS_PLATFORM=False
|
||||
|
||||
cdict = {}
|
||||
for i, l in enumerate(open("gamecontrollerdb.txt")):
|
||||
l = l.strip()
|
||||
if l.startswith("#") or not l:
|
||||
continue
|
||||
|
||||
c = l.split(",")
|
||||
key = tuple([c[0]]+[ce for ce in c[1:] if "platform:" in ce])
|
||||
if CROSS_PLATFORM:
|
||||
key = c[0]
|
||||
|
||||
if key in cdict:
|
||||
print("Duplicate:", c[1], "at line", i + 1)
|
||||
out = list(difflib.unified_diff(cdict[key], sorted(c), n=0))[3:]
|
||||
out = [o for o in out if not o.startswith("@@")]
|
||||
print("\t", " ".join(out))
|
||||
if not CROSS_PLATFORM:
|
||||
sys.exit(1)
|
||||
cdict[key] = sorted(c)
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,62 @@
|
||||
name: 'Setup ninja'
|
||||
description: 'Download ninja and add it to the PATH environment variable'
|
||||
inputs:
|
||||
version:
|
||||
description: 'Ninja version'
|
||||
default: '1.12.1'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 'Calculate variables'
|
||||
id: calc
|
||||
shell: sh
|
||||
run: |
|
||||
case "${{ runner.os }}-${{ runner.arch }}" in
|
||||
"Linux-X86" | "Linux-X64")
|
||||
archive="ninja-linux.zip"
|
||||
;;
|
||||
"Linux-ARM64")
|
||||
archive="ninja-linux-aarch64.zip"
|
||||
;;
|
||||
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
|
||||
archive="ninja-mac.zip"
|
||||
;;
|
||||
"Windows-X86" | "Windows-X64")
|
||||
archive="ninja-win.zip"
|
||||
;;
|
||||
"Windows-ARM64")
|
||||
archive="ninja-winarm64.zip"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
|
||||
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
|
||||
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
|
||||
id: cache-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
|
||||
key: ${{ steps.calc.outputs.cache-key }}
|
||||
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
|
||||
- name: 'Cache ${{ steps.calc.outputs.archive }}'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
|
||||
key: ${{ steps.calc.outputs.cache-key }}
|
||||
- name: 'Extract ninja'
|
||||
shell: pwsh
|
||||
run: |
|
||||
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
|
||||
- name: 'Set output variables'
|
||||
id: final
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH
|
||||
@@ -0,0 +1,97 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: '${{ matrix.platform.name }}'
|
||||
runs-on: '${{ matrix.platform.os }}'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: 'Linux', os: ubuntu-latest, shell: sh }
|
||||
- { name: 'MacOS', os: macos-latest, shell: sh }
|
||||
# - { name: 'Windows msys2 (mingw32)', os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
|
||||
- { name: 'Windows msys2 (mingw64)', os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
|
||||
# - { name: 'Windows msys2 (clang32)', os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
|
||||
- { name: 'Windows msys2 (clang64)', os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
|
||||
# - { name: 'Windows MSVC (x86)', os: windows-latest, shell: sh, msvc: true, msvc-arch: x86, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/' }
|
||||
- { name: 'Windows MSVC (x64)', os: windows-latest, shell: sh, msvc: true, msvc-arch: x64, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/' }
|
||||
# - { name: 'Windows MSVC (arm32)', os: windows-latest, shell: sh, msvc: true, msvc-arch: amd64_arm, cross: true }
|
||||
# - { name: 'Windows MSVC (arm64)', os: windows-latest, shell: sh, msvc: true, msvc-arch: amd64_arm64, cross: true }
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
steps:
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
if: ${{ matrix.platform.msvc }}
|
||||
with:
|
||||
arch: ${{ matrix.platform.msvc-arch }}
|
||||
- name: Set up MSYS2
|
||||
if: ${{ contains(matrix.platform.shell, 'msys2') }}
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ matrix.platform.msystem }}
|
||||
install: >-
|
||||
${{ matrix.platform.msys-env }}-cc
|
||||
${{ matrix.platform.msys-env }}-cmake
|
||||
${{ matrix.platform.msys-env }}-crt
|
||||
${{ matrix.platform.msys-env }}-ninja
|
||||
${{ matrix.platform.msys-env }}-perl
|
||||
- name: Get SDL3_net sources
|
||||
uses: actions/checkout@v6
|
||||
- name: Install Ninja
|
||||
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
|
||||
uses: aseprite/get-ninja@main
|
||||
- name: Set up SDL3
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
id: sdl
|
||||
with:
|
||||
cmake-generator: Ninja
|
||||
version: 3-head
|
||||
sdl-test: true
|
||||
shell: ${{ matrix.platform.shell }}
|
||||
add-to-environment: true
|
||||
- name: Configure (CMake)
|
||||
run: |
|
||||
cmake -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=prefix \
|
||||
-DSDLNET_WERROR=ON \
|
||||
-DSDLNET_INSTALL_MAN=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=prefix \
|
||||
${{ matrix.platform.cmake }}
|
||||
|
||||
- name: Build (CMake)
|
||||
run: |
|
||||
cmake --build build/ --verbose
|
||||
- name: Install (CMake)
|
||||
if: ${{ matrix.platform.shell == 'sh' || contains(matrix.platform.shell, 'msys2') }}
|
||||
run: |
|
||||
set -eu
|
||||
rm -fr DESTDIR-cmake
|
||||
cmake --install build/ --config Release
|
||||
echo "SDL3_net_ROOT=$(pwd)/prefix" >> $GITHUB_ENV
|
||||
( cd prefix; find . ) | LC_ALL=C sort -u
|
||||
|
||||
- name: Verify exports files
|
||||
if: ${{ matrix.platform.test-exports }}
|
||||
run: |
|
||||
set -e
|
||||
python src/genexports.py
|
||||
git diff --exit-code -- src/SDL_net.sym src/SDL_net.exports
|
||||
- name: Verify CMake configuration files
|
||||
run: |
|
||||
cmake -S cmake/test -B cmake_config_build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE
|
||||
cmake --build cmake_config_build --verbose
|
||||
|
||||
- name: Check that versioning is consistent
|
||||
# We only need to run this once: arbitrarily use the Linux build
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: ./build-scripts/test-versioning.sh
|
||||
@@ -0,0 +1,793 @@
|
||||
name: 'release'
|
||||
run-name: 'Create SDL_net release artifacts for ${{ inputs.commit }}'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit:
|
||||
description: 'Commit of SDL_net'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
|
||||
src:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
project: ${{ steps.releaser.outputs.project }}
|
||||
version: ${{ steps.releaser.outputs.version }}
|
||||
src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
|
||||
src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
|
||||
src-zip: ${{ steps.releaser.outputs.src-zip }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Set up SDL sources'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
path: 'SDL'
|
||||
fetch-depth: 0
|
||||
- name: 'Build Source archive'
|
||||
id: releaser
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions source \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ github.workspace }}/SDL" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store source archives'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace}}/dist'
|
||||
- name: 'Generate summary'
|
||||
run: |
|
||||
echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
linux-verify:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '/tmp'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: zip
|
||||
run: |
|
||||
set -e
|
||||
mkdir /tmp/zipdir
|
||||
cd /tmp/zipdir
|
||||
unzip "/tmp/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
set -e
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "/tmp/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
|
||||
run: |
|
||||
set -e
|
||||
diff "${{ steps.zip.outputs.path }}" "${{ steps.tar.outputs.path }}"
|
||||
- name: 'Test versioning'
|
||||
shell: bash
|
||||
run: |
|
||||
${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Install Linux dependencies'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \
|
||||
libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \
|
||||
libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
||||
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
|
||||
- name: 'Extract dependencies, build and install them'
|
||||
id: deps-build
|
||||
run: |
|
||||
tar -C /tmp -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.tar.gz"
|
||||
cmake -S /tmp/SDL3-${{ steps.deps.outputs.dep-sdl-version }} -B /tmp/SDL-build -DCMAKE_INSTALL_PREFIX=/tmp/deps-prefix
|
||||
cmake --build /tmp/SDL-build
|
||||
cmake --install /tmp/SDL-build
|
||||
echo "path=/tmp/deps-prefix" >>$GITHUB_OUTPUT
|
||||
- name: 'CMake (configure + build)'
|
||||
run: |
|
||||
cmake \
|
||||
-S ${{ steps.tar.outputs.path }} \
|
||||
-B /tmp/build \
|
||||
-DSDL3net_SAMPLES=ON \
|
||||
-DSDL3net_TESTS=ON \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.deps-build.outputs.path }}"
|
||||
cmake --build /tmp/build --verbose
|
||||
# ctest --test-dir /tmp/build --no-tests=error --output-on-failure
|
||||
|
||||
dmg:
|
||||
needs: [src]
|
||||
runs-on: macos-latest
|
||||
outputs:
|
||||
dmg: ${{ steps.releaser.outputs.dmg }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
mkdir -p "${{ github.workspace }}/tardir"
|
||||
tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
# - name: 'Download external dependencies'
|
||||
# run: |
|
||||
# sh "${{ steps.tar.outputs.path }}/external/download.sh" --depth 1
|
||||
- name: 'Build SDL3_net.dmg'
|
||||
id: releaser
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions dmg \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store DMG image file'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: dmg
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
dmg-verify:
|
||||
needs: [dmg, src]
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.src.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Mount dependencies'
|
||||
id: deps-mount
|
||||
run: |
|
||||
hdiutil attach "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.dmg"
|
||||
sdl_mount_pount="/Volumes/SDL3"
|
||||
if [ ! -d "$sdl_mount_pount/SDL3.xcframework" ]; then
|
||||
echo "Cannot find SDL3.xcframework!"
|
||||
exit 1
|
||||
fi
|
||||
echo "path=${sdl_mount_pount}" >>$GITHUB_OUTPUT
|
||||
- name: 'Download ${{ needs.dmg.outputs.dmg }}'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: dmg
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Mount ${{ needs.dmg.outputs.dmg }}'
|
||||
id: mount
|
||||
run: |
|
||||
hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
|
||||
mount_point="/Volumes/${{ needs.src.outputs.project }}"
|
||||
if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then
|
||||
echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!"
|
||||
exit 1
|
||||
fi
|
||||
echo "mount-point=${mount_point}">>$GITHUB_OUTPUT
|
||||
- name: 'CMake (configure + build) Darwin'
|
||||
run: |
|
||||
set -e
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
-DCMAKE_SYSTEM_NAME=Darwin \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-Werror=dev \
|
||||
-B build_darwin
|
||||
cmake --build build_darwin --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }}/SDL3_net.xcframework/macos-arm64_x86_64;${{ steps.deps-mount.outputs.path }}/SDL3.xcframework/macos-arm64_x86_64" \
|
||||
-DCMAKE_SYSTEM_NAME=Darwin \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-B build_darwin2
|
||||
cmake --build build_darwin2 --config Release --verbose
|
||||
|
||||
- name: 'CMake (configure + build) iOS'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-Werror=dev \
|
||||
-B build_ios
|
||||
cmake --build build_ios --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }}/SDL3_net.xcframework/ios-arm64;${{ steps.deps-mount.outputs.path }}/SDL3.xcframework/ios-arm64" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-B build_ios2
|
||||
cmake --build build_ios2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) tvOS'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-Werror=dev \
|
||||
-B build_tvos
|
||||
cmake --build build_tvos --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }}/SDL3_net.xcframework/tvos-arm64;${{ steps.deps-mount.outputs.path }}/SDL3.xcframework/tvos-arm64" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-B build_tvos2
|
||||
cmake --build build_tvos2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) iOS simulator'
|
||||
run: |
|
||||
sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
|
||||
echo "sysroot=$sysroot"
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-Werror=dev \
|
||||
-B build_ios_simulator
|
||||
cmake --build build_ios_simulator --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }}/SDL3_net.xcframework/ios-arm64_x86_64-simulator;${{ steps.deps-mount.outputs.path }}/SDL3.xcframework/ios-arm64_x86_64-simulator" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-B build_ios_simulator2
|
||||
cmake --build build_ios_simulator2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) tvOS simulator'
|
||||
run: |
|
||||
sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
|
||||
echo "sysroot=$sysroot"
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-Werror=dev \
|
||||
-B build_tvos_simulator
|
||||
cmake --build build_tvos_simulator --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }}/SDL3_net.xcframework/tvos-arm64_x86_64-simulator;${{ steps.deps-mount.outputs.path }}/SDL3.xcframework/tvos-arm64_x86_64-simulator" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-B build_tvos_simulator2
|
||||
cmake --build build_tvos_simulator2 --config Release --verbose
|
||||
|
||||
msvc:
|
||||
needs: [src]
|
||||
runs-on: windows-2025
|
||||
outputs:
|
||||
VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
|
||||
VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
|
||||
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: zip
|
||||
run: |
|
||||
New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
|
||||
cd C:\temp
|
||||
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
|
||||
# - name: 'Download external dependencies'
|
||||
# run: |
|
||||
# ${{ steps.zip.outputs.path }}/external/Get-GitModules.ps1
|
||||
- name: 'Build MSVC binary archives'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--actions download msvc `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--root "${{ steps.zip.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
- name: 'Store MSVC archives'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: msvc
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
msvc-verify:
|
||||
needs: [msvc, src]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 'Fetch .github/actions/setup-ninja/action.yml'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: |
|
||||
.github/actions/setup-ninja/action.yml
|
||||
build-scripts/build-release.py
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Set up ninja
|
||||
uses: ./.github/actions/setup-ninja
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/sources'
|
||||
cd '${{ github.workspace }}/sources'
|
||||
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
|
||||
echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--actions download `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--root "${{ steps.src.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
- name: 'Extract dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/deps-vc'
|
||||
cd '${{ github.workspace }}/deps-vc'
|
||||
unzip "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-VC.zip"
|
||||
echo "path=${{ github.workspace }}/deps-vc" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Download MSVC binaries'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: msvc
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
|
||||
id: bin
|
||||
run: |
|
||||
mkdir '${{ github.workspace }}/vc'
|
||||
cd '${{ github.workspace }}/vc'
|
||||
unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
|
||||
echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
|
||||
- name: 'Configure vcvars x86'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64_x86
|
||||
- name: 'CMake (configure + build + tests) x86'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_x86 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_x86 --config Release --verbose
|
||||
- name: 'Configure vcvars x64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
- name: 'CMake (configure + build + tests) x64'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_x64 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_x64 --config Release --verbose
|
||||
- name: 'Configure vcvars arm64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64_arm64
|
||||
- name: 'CMake (configure + build + tests) arm64'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
|
||||
-B build_arm64 `
|
||||
-GNinja `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-Werror=dev `
|
||||
-DTEST_SHARED=TRUE `
|
||||
-DTEST_STATIC=FALSE `
|
||||
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
|
||||
Start-Sleep -Seconds 2
|
||||
cmake --build build_arm64 --config Release --verbose
|
||||
|
||||
mingw:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
|
||||
outputs:
|
||||
mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
|
||||
mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Install Mingw toolchain'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Build MinGW binary archives'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download mingw \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store MinGW archives'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: mingw
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
mingw-verify:
|
||||
needs: [mingw, src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Install Mingw toolchain'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.src.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Untar and install dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
mkdir -p /tmp/deps-mingw/cmake
|
||||
mkdir -p /tmp/deps-mingw/i686-w64-mingw32
|
||||
mkdir -p /tmp/deps-mingw/x86_64-w64-mingw32
|
||||
|
||||
mkdir -p /tmp/deps-mingw-extract/sdl3
|
||||
tar -C /tmp/deps-mingw-extract/sdl3 -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-mingw.tar.gz"
|
||||
make -C /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }} install-all DESTDIR=/tmp/deps-mingw
|
||||
|
||||
# FIXME: this should be fixed in SDL3 releases after 3.1.3
|
||||
mkdir -p /tmp/deps-mingw/cmake
|
||||
cp -rv /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }}/cmake/* /tmp/deps-mingw/cmake
|
||||
- name: 'Download MinGW binaries'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: mingw
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
|
||||
id: bin
|
||||
run: |
|
||||
mkdir -p /tmp/mingw-tardir
|
||||
tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
|
||||
make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} install-all DESTDIR=/tmp/deps-mingw
|
||||
- name: 'CMake (configure + build) i686'
|
||||
run: |
|
||||
set -e
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
|
||||
-Werror=dev \
|
||||
-B build_x86
|
||||
cmake --build build_x86 --config Release --verbose
|
||||
- name: 'CMake (configure + build) x86_64'
|
||||
run: |
|
||||
set -e
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DTEST_SHARED=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
|
||||
-Werror=dev \
|
||||
-B build_x64
|
||||
cmake --build build_x64 --config Release --verbose
|
||||
|
||||
android:
|
||||
needs: [src]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
android-aar: ${{ steps.releaser.outputs.android-aar }}
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
sparse-checkout: 'build-scripts/build-release.py'
|
||||
- name: 'Setup Android NDK'
|
||||
id: setup-ndk
|
||||
uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
local-cache: false
|
||||
ndk-version: r28c
|
||||
- name: 'Setup Java JDK'
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
- name: 'Install ninja'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: tar
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Build Android prefab binary archive(s)'
|
||||
id: releaser
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--actions download android \
|
||||
--android-api 21 \
|
||||
--android-ndk-home "${{ steps.setup-ndk.outputs.ndk-path }}" \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Store Android archive(s)'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: android
|
||||
path: '${{ github.workspace }}/dist'
|
||||
|
||||
android-verify:
|
||||
needs: [android, src]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
- name: 'Download source archives'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: sources
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Download Android .aar archive'
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: android
|
||||
path: '${{ github.workspace }}'
|
||||
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
|
||||
id: src
|
||||
run: |
|
||||
mkdir -p /tmp/tardir
|
||||
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
|
||||
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
|
||||
- name: 'Extract Android SDK from AAR'
|
||||
id: sdk
|
||||
run: |
|
||||
unzip -o "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}"
|
||||
python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3_net-android
|
||||
echo "prefix=/tmp/SDL3_net-android" >>$GITHUB_OUTPUT
|
||||
- name: 'Download dependencies'
|
||||
id: deps
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python "${{ steps.src.outputs.path }}/build-scripts/build-release.py" \
|
||||
--actions download \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--root "${{ steps.src.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
- name: 'Extract dependencies'
|
||||
id: deps-extract
|
||||
run: |
|
||||
unzip -o "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-android.zip"
|
||||
python "SDL3-${{ steps.deps.outputs.dep-sdl-version }}.aar" -o /tmp/SDL3-android
|
||||
echo "sdl3-prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
|
||||
- name: 'Install ninja'
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build
|
||||
- name: 'Verify alignment of libSDL3_net.so (arm64-v8a/x86_64)'
|
||||
run: |
|
||||
set -e
|
||||
${{ steps.src.outputs.path }}/build-scripts/check_elf_alignment.sh ${{ steps.sdk.outputs.prefix }}/lib/arm64-v8a/libSDL3_net.so
|
||||
${{ steps.src.outputs.path }}/build-scripts/check_elf_alignment.sh ${{ steps.sdk.outputs.prefix }}/lib/x86_64/libSDL3_net.so
|
||||
- name: 'CMake (configure + build) x86, x64, arm32, arm64'
|
||||
run: |
|
||||
android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
|
||||
for android_abi in ${android_abis}; do
|
||||
echo "Configuring ${android_abi}..."
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-GNinja \
|
||||
-DTEST_FULL=TRUE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }};${{ steps.deps-extract.outputs.sdl3-prefix }}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-B "${android_abi}"
|
||||
echo "Building ${android_abi}..."
|
||||
cmake --build "${android_abi}" --config Release --verbose
|
||||
done
|
||||
@@ -0,0 +1,77 @@
|
||||
build/
|
||||
buildbot/
|
||||
!build-scripts/
|
||||
/VERSION.txt
|
||||
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.obj
|
||||
*.res
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.dSYM
|
||||
*,e1f
|
||||
*,ff8
|
||||
*.lnk
|
||||
*.err
|
||||
*.exp
|
||||
*.map
|
||||
*.orig
|
||||
*~
|
||||
*.swp
|
||||
*.tmp
|
||||
*.rej
|
||||
|
||||
sdl3-net.pc
|
||||
get-local-addrs
|
||||
resolve-hostnames
|
||||
simple-http-get
|
||||
voipchat
|
||||
|
||||
# for CMake
|
||||
CMakeFiles/
|
||||
CMakeScripts/
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
cmake_uninstall.cmake
|
||||
SDL3_netConfig.cmake
|
||||
SDL3_netConfigVersion.cmake
|
||||
compile_commands.json
|
||||
Makefile
|
||||
.ninja_*
|
||||
*.ninja
|
||||
Debug/
|
||||
Release/
|
||||
RelWithDebInfo/
|
||||
MinSizeRel/
|
||||
dummy.sym
|
||||
|
||||
# for CLion
|
||||
.idea
|
||||
cmake-build-*
|
||||
|
||||
# for Xcode
|
||||
*.mode1*
|
||||
*.perspective*
|
||||
*.pbxuser
|
||||
(^|/)build($|/)
|
||||
.DS_Store
|
||||
xcuserdata
|
||||
*.xcworkspace
|
||||
|
||||
# for Visual C++
|
||||
.vs
|
||||
CMakeSettings.json
|
||||
out/
|
||||
/*.sln
|
||||
/*.vcxproj*
|
||||
*.dir
|
||||
*.user
|
||||
*.ncb
|
||||
*.suo
|
||||
*.sdf
|
||||
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = git@github.com:libsdl-org/SDL_net.git
|
||||
branch = main
|
||||
commit = 4dd85af45d8597f93796815fba0defa5d499be21
|
||||
parent = 02eef161e7f4ac7a4deebd0115574b7a27c5f58f
|
||||
method = merge
|
||||
cmdver = 0.4.9
|
||||
@@ -0,0 +1,22 @@
|
||||
projectfullname = SDL_net
|
||||
projectshortname = SDL_net
|
||||
incsubdir = include/SDL3_net
|
||||
wikisubdir = SDL3_net
|
||||
apiprefixregex = (NET_|SDL_NET_)
|
||||
mainincludefname = SDL3_net/SDL_net.h
|
||||
versionfname = include/SDL3_net/SDL_net.h
|
||||
versionmajorregex = \A\#define\s+SDL_NET_MAJOR_VERSION\s+(\d+)\Z
|
||||
versionminorregex = \A\#define\s+SDL_NET_MINOR_VERSION\s+(\d+)\Z
|
||||
versionmicroregex = \A\#define\s+SDL_NET_MICRO_VERSION\s+(\d+)\Z
|
||||
selectheaderregex = \ASDL_net\.h\Z
|
||||
projecturl = https://libsdl.org/projects/SDL_net
|
||||
wikiurl = https://wiki.libsdl.org/SDL_net
|
||||
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
|
||||
warn_about_missing = 0
|
||||
wikipreamble = (This function is part of SDL_net, a separate library from SDL.)
|
||||
wikiheaderfiletext = Defined in [<SDL3_net/%fname%>](https://github.com/libsdl-org/SDL_net/blob/main/include/SDL3_net/%fname%)
|
||||
manpageheaderfiletext = Defined in SDL3_net/%fname%
|
||||
quickrefenabled = 1
|
||||
quickreftitle = SDL3_net API Quick Reference
|
||||
quickrefurl = https://libsdl.org/
|
||||
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL3_net/QuickReference
|
||||
@@ -0,0 +1,57 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL_net shared library
|
||||
#
|
||||
###########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL3_net
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,,) \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
|
||||
LOCAL_CFLAGS =
|
||||
|
||||
# Warnings we haven't fixed (yet)
|
||||
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script=$(LOCAL_PATH)/src/SDL_net.sym
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
cmd-strip :=
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := SDL3
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL_net static library
|
||||
#
|
||||
###########################
|
||||
|
||||
LOCAL_MODULE := SDL3_net_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libSDL3_net
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
LOCAL_LDFLAGS :=
|
||||
|
||||
LOCAL_EXPORT_LDLIBS :=
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := SDL3
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
@@ -0,0 +1,326 @@
|
||||
cmake_minimum_required(VERSION 3.16...4.0)
|
||||
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set(cmake_build_type_undefined 1)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
# See docs/release_checklist.md
|
||||
set(MAJOR_VERSION 3)
|
||||
set(MINOR_VERSION 0)
|
||||
set(MICRO_VERSION 0)
|
||||
set(SDL_REQUIRED_VERSION 3.0.0)
|
||||
|
||||
project(SDL3_net
|
||||
LANGUAGES C
|
||||
VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}"
|
||||
)
|
||||
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake")
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/PrivateSdlFunctions.cmake")
|
||||
include("${SDL3_net_SOURCE_DIR}/cmake/sdlmanpages.cmake")
|
||||
sdl_calculate_derived_version_variables(${MAJOR_VERSION} ${MINOR_VERSION} ${MICRO_VERSION})
|
||||
|
||||
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDLNET_ROOTPROJECT ON)
|
||||
else()
|
||||
set(SDLNET_ROOTPROJECT OFF)
|
||||
endif()
|
||||
|
||||
# By default, configure in RelWithDebInfo configuration
|
||||
if(SDLNET_ROOTPROJECT)
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
|
||||
if(DEFINED CMAKE_CONFIGURATION_TYPES AND "RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES)
|
||||
list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
|
||||
list(INSERT CMAKE_CONFIGURATION_TYPES 0 "RelWithDebInfo")
|
||||
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "CMake configuration types" FORCE)
|
||||
endif()
|
||||
else()
|
||||
if(cmake_build_type_undefined)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "CMake build type" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SDLNET_SAMPLES_DEFAULT ${SDLNET_ROOTPROJECT})
|
||||
if(ANDROID)
|
||||
set(SDLNET_SAMPLES_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
set(sdl3net_install_enableable ON)
|
||||
if((TARGET SDL3-shared OR TARGET SDL3-static) AND SDL_DISABLE_INSTALL)
|
||||
# Cannot install SDL3_net when SDL3 is built in same built, and is not installed.
|
||||
set(sdl3net_install_enableable OFF)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif()
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(PLATFORM_SUPPORTS_SHARED ON)
|
||||
if(EMSCRIPTEN OR VITA OR PSP OR PS2 OR N3DS OR RISCOS)
|
||||
set(PLATFORM_SUPPORTS_SHARED OFF)
|
||||
endif()
|
||||
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ${PLATFORM_SUPPORTS_SHARED})
|
||||
cmake_dependent_option(BUILD_SHARED_LIBS "Build the library as a shared library" ON PLATFORM_SUPPORTS_SHARED OFF)
|
||||
|
||||
cmake_dependent_option(SDLNET_INSTALL "Enable SDL3_net install target" ${SDLNET_ROOTPROJECT} "${sdl3net_install_enableable}" OFF)
|
||||
cmake_dependent_option(SDLNET_INSTALL_MAN "Install man pages for SDL3_net" OFF "SDLNET_INSTALL" OFF)
|
||||
cmake_dependent_option(SDLNET_RELOCATABLE "Create relocatable SDL_net package" "${MSVC}" SDLNET_INSTALL OFF)
|
||||
option(SDLNET_WERROR "Treat warnings as errors" OFF)
|
||||
|
||||
option(SDLNET_SAMPLES "Build the SDL3_net sample program(s)" ${SDLNET_SAMPLES_DEFAULT})
|
||||
cmake_dependent_option(SDLNET_SAMPLES_INSTALL "Install the SDL3_net sample program(s)" OFF "SDLNET_SAMPLES;SDLNET_INSTALL" OFF)
|
||||
|
||||
# Save BUILD_SHARED_LIBS variable
|
||||
set(SDLNET_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
|
||||
set(sdl_required_components Headers)
|
||||
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
set(sdl3_net_target_name SDL3_net-shared)
|
||||
set(sdl3_target_name SDL3::SDL3-shared)
|
||||
|
||||
list(APPEND sdl_required_components SDL3-shared)
|
||||
else()
|
||||
set(sdl3_net_target_name SDL3_net-static)
|
||||
set(sdl3_target_name SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET SDL3::Headers OR NOT TARGET ${sdl3_target_name})
|
||||
find_package(SDL3 ${SDL_REQUIRED_VERSION} REQUIRED COMPONENTS ${sdl_required_components})
|
||||
endif()
|
||||
|
||||
set(PC_LIBS)
|
||||
set(PC_REQUIRES)
|
||||
|
||||
add_library(${sdl3_net_target_name} src/SDL_net.c)
|
||||
add_library(SDL3_net::${sdl3_net_target_name} ALIAS ${sdl3_net_target_name})
|
||||
set_property(TARGET ${sdl3_net_target_name} PROPERTY C_STANDARD 99)
|
||||
if(NOT TARGET SDL3_net::SDL3_net)
|
||||
add_library(SDL3_net::SDL3_net ALIAS ${sdl3_net_target_name})
|
||||
endif()
|
||||
target_include_directories(${sdl3_net_target_name}
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
target_compile_definitions(${sdl3_net_target_name} PRIVATE
|
||||
BUILD_SDL
|
||||
SDL_BUILD_MAJOR_VERSION=${MAJOR_VERSION}
|
||||
SDL_BUILD_MINOR_VERSION=${MINOR_VERSION}
|
||||
SDL_BUILD_MICRO_VERSION=${MICRO_VERSION}
|
||||
)
|
||||
# Make sure SDL3's include directory comes first
|
||||
target_include_directories(${sdl3_net_target_name} PRIVATE $<TARGET_PROPERTY:SDL3::Headers,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_link_libraries(${sdl3_net_target_name} PUBLIC SDL3::Headers)
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE SDL3::SDL3-shared)
|
||||
endif()
|
||||
sdl_add_warning_options(${sdl3_net_target_name} WARNING_AS_ERROR ${SDLNET_WERROR})
|
||||
if(WIN32)
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
target_sources(${sdl3_net_target_name} PRIVATE
|
||||
src/version.rc
|
||||
)
|
||||
if(MINGW)
|
||||
target_link_options(${sdl3_net_target_name} PRIVATE -static-libgcc)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE iphlpapi ws2_32)
|
||||
list(APPEND PC_LIBS -liphlpapi -lws2_32)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
|
||||
target_link_libraries(${sdl3_net_target_name} PRIVATE network)
|
||||
endif()
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
OUTPUT_NAME "SDL3_net"
|
||||
DEFINE_SYMBOL DLL_EXPORT
|
||||
EXPORT_NAME ${sdl3_net_target_name}
|
||||
C_VISIBILITY_PRESET "hidden"
|
||||
)
|
||||
|
||||
sdl_target_link_option_version_file(${sdl3_net_target_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/SDL_net.sym")
|
||||
|
||||
if(NOT ANDROID)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
SOVERSION "${SO_VERSION_MAJOR}"
|
||||
VERSION "${SO_VERSION}"
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
MACHO_COMPATIBILITY_VERSION "${DYLIB_COMPAT_VERSION}"
|
||||
MACHO_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}"
|
||||
)
|
||||
sdl_no_deprecated_errors(${sdl3_net_target_name})
|
||||
set_property(TARGET ${sdl3_net_target_name} APPEND PROPERTY LINK_DEPENDS
|
||||
"${PROJECT_SOURCE_DIR}/src/SDL_net.exports")
|
||||
target_link_options(${sdl3_net_target_name} PRIVATE
|
||||
"SHELL:-Wl,-exported_symbols_list,${PROJECT_SOURCE_DIR}/src/SDL_net.exports")
|
||||
endif()
|
||||
endif()
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
PREFIX ""
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(MSVC)
|
||||
set_target_properties(${sdl3_net_target_name} PROPERTIES
|
||||
OUTPUT_NAME "SDL3_net-static"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use `Compatible Interface Properties` to ensure a shared SDL3_net is built with a shared SDL3
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
set_property(TARGET ${sdl3_net_target_name} PROPERTY INTERFACE_SDL3_SHARED TRUE)
|
||||
set_property(TARGET ${sdl3_net_target_name} APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED)
|
||||
endif()
|
||||
|
||||
if(SDLNET_BUILD_SHARED_LIBS)
|
||||
sdl_target_link_options_no_undefined(${sdl3_net_target_name})
|
||||
endif()
|
||||
|
||||
if(SDLNET_INSTALL)
|
||||
install(
|
||||
TARGETS ${sdl3_net_target_name}
|
||||
EXPORT SDL3NetExports
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT library
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT library
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/SDL3_net/SDL_net.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3_net" COMPONENT devel
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT "cmake")
|
||||
else()
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake")
|
||||
endif()
|
||||
set(SDLNET_INSTALL_CMAKEDIR_ROOT "${SDLNET_INSTALL_CMAKEDIR_ROOT_DEFAULT}" CACHE STRING "Root folder where to install SDL3_netConfig.cmake related files (SDL3_net subfolder for MSVC projects)")
|
||||
set(SDLNET_PKGCONFIG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(SDLNET_INSTALL_CMAKEDIR "${SDLNET_INSTALL_CMAKEDIR_ROOT}")
|
||||
set(LICENSES_PREFIX "licenses/SDL3_net")
|
||||
else()
|
||||
set(SDLNET_INSTALL_CMAKEDIR "${SDLNET_INSTALL_CMAKEDIR_ROOT}/SDL3_net")
|
||||
set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/SDL3_net")
|
||||
endif()
|
||||
|
||||
configure_package_config_file(cmake/SDL3_netConfig.cmake.in SDL3_netConfig.cmake
|
||||
INSTALL_DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
write_basic_package_version_file("${PROJECT_BINARY_DIR}/SDL3_netConfigVersion.cmake"
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL3_netConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL3_netConfigVersion.cmake"
|
||||
DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
COMPONENT devel
|
||||
)
|
||||
install(EXPORT SDL3NetExports
|
||||
FILE ${sdl3_net_target_name}-targets.cmake
|
||||
NAMESPACE SDL3_net::
|
||||
DESTINATION "${SDLNET_INSTALL_CMAKEDIR}"
|
||||
COMPONENT devel
|
||||
)
|
||||
|
||||
if(SDLNET_RELOCATABLE)
|
||||
file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDLNET_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}")
|
||||
string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
else()
|
||||
set(SDL_PKGCONFIG_PREFIX "${CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
|
||||
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(INCLUDEDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else()
|
||||
set(INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
endif()
|
||||
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(LIBDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_LIBDIR}")
|
||||
else()
|
||||
set(LIBDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
string(JOIN " " PC_REQUIRES ${PC_REQUIRES})
|
||||
string(JOIN " " PC_LIBS ${PC_LIBS})
|
||||
configure_file(cmake/sdl3-net.pc.in sdl3-net.pc @ONLY)
|
||||
|
||||
# Always install sdl3-net.pc file: libraries might be different between config modes
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sdl3-net.pc"
|
||||
DESTINATION "${SDLNET_PKGCONFIG_INSTALLDIR}" COMPONENT devel)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(pdbdir "${CMAKE_INSTALL_BINDIR}")
|
||||
else()
|
||||
set(pdbdir "${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
if(MSVC)
|
||||
SDL_install_pdb("${sdl3_net_target_name}" "${pdbdir}")
|
||||
endif()
|
||||
|
||||
install(FILES "LICENSE.txt"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}"
|
||||
COMPONENT library
|
||||
)
|
||||
|
||||
export(TARGETS ${sdl3_net_target_name} NAMESPACE "SDL3_net::" FILE "${sdl3_net_target_name}-targets.cmake")
|
||||
|
||||
if(SDLNET_INSTALL_MAN)
|
||||
sdl_get_git_revision_hash(SDLNET_REVISION)
|
||||
SDL_generate_manpages(
|
||||
HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/SDL3_net"
|
||||
SYMBOL "NET_Init"
|
||||
WIKIHEADERS_PL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/wikiheaders.pl"
|
||||
REVISION "${SDLNET_REVISION}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDLNET_SAMPLES)
|
||||
function(add_sdl_net_example_executable TARGET)
|
||||
if(ANDROID)
|
||||
add_library(${TARGET} SHARED ${ARGN})
|
||||
else()
|
||||
add_executable(${TARGET} ${ARGN})
|
||||
endif()
|
||||
sdl_add_warning_options(${TARGET} WARNING_AS_ERROR ${SDLTTF_WERROR})
|
||||
sdl_target_link_options_no_undefined(${TARGET})
|
||||
target_link_libraries(${TARGET} PRIVATE SDL3_net::${sdl3_net_target_name})
|
||||
target_link_libraries(${TARGET} PRIVATE ${sdl3_target_name})
|
||||
set_property(TARGET ${TARGET} PROPERTY C_STANDARD 99)
|
||||
set_property(TARGET ${TARGET} PROPERTY C_EXTENSIONS FALSE)
|
||||
|
||||
if(SDLNET_SAMPLES_INSTALL)
|
||||
install(TARGETS ${TARGET}
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL3_net"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
add_sdl_net_example_executable(voipchat examples/voipchat.c)
|
||||
add_sdl_net_example_executable(simple-http-get examples/simple-http-get.c)
|
||||
add_sdl_net_example_executable(resolve-hostnames examples/resolve-hostnames.c)
|
||||
add_sdl_net_example_executable(get-local-addrs examples/get-local-addrs.c)
|
||||
add_sdl_net_example_executable(echo-server examples/echo-server.c)
|
||||
|
||||
# Build at least one example in C90
|
||||
set_property(TARGET get-local-addrs PROPERTY C_STANDARD 90)
|
||||
endif()
|
||||
@@ -0,0 +1,18 @@
|
||||
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.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.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# SDL_net 3.0
|
||||
|
||||
The latest version of this library is available from GitHub:
|
||||
|
||||
https://github.com/libsdl-org/SDL_net/releases
|
||||
|
||||
This is a portable network library for use with SDL. It's goal is to
|
||||
simplify the use of the usual socket interfaces and use SDL infrastructure
|
||||
to handle some portability things (such as threading and reporting
|
||||
errors).
|
||||
|
||||
It is available under the zlib license, found in the file LICENSE.txt.
|
||||
The API can be found in the file SDL_net.h and online at https://wiki.libsdl.org/SDL3_net
|
||||
This library supports most platforms that offer both SDL3 and networking.
|
||||
|
||||
This is a work in progress!
|
||||
|
||||
Enjoy!
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3_net", "SDL_net.vcxproj", "{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get-local-addrs", "examples\get-local-addrs.vcxproj", "{7B1F60CD-2A09-4514-937C-D9DD044428FB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolve-hostnames", "examples\resolve-hostnames.vcxproj", "{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple-http-get", "examples\simple-http-get.vcxproj", "{35F14669-ED09-4105-A035-7984B94FDFBC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voipchat", "examples\voipchat.vcxproj", "{A01E2216-139A-480E-8458-03CB4E90FE61}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echo-server", "examples\echo-server.vcxproj", "{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Debug|x64.Build.0 = Debug|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|Win32.Build.0 = Release|Win32
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.ActiveCfg = Release|x64
|
||||
{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}.Release|x64.Build.0 = Release|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.Build.0 = Debug|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.Build.0 = Release|Win32
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.ActiveCfg = Release|x64
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.Build.0 = Release|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Debug|x64.Build.0 = Debug|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|Win32.Build.0 = Release|Win32
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|x64.ActiveCfg = Release|x64
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}.Release|x64.Build.0 = Release|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Debug|x64.Build.0 = Debug|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|Win32.Build.0 = Release|Win32
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|x64.ActiveCfg = Release|x64
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC}.Release|x64.Build.0 = Release|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Debug|x64.Build.0 = Debug|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|Win32.Build.0 = Release|Win32
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|x64.ActiveCfg = Release|x64
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{7B1F60CD-2A09-4514-937C-D9DD044428FB} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{35F14669-ED09-4105-A035-7984B94FDFBC} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{A01E2216-139A-480E-8458-03CB4E90FE61} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B} = {642C114F-3ABE-4CFE-8C08-8CC5EF0D2324}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F2325A01-6A77-410B-B0DA-E0F6B9313F15}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>SDL3_net</ProjectName>
|
||||
<ProjectGuid>{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}</ProjectGuid>
|
||||
<RootNamespace>SDL_net</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(ProjectDir)..\..\SDL\include;$(ProjectDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL3_net.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\SDL_net.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\SDL3_net/SDL_net.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\version.rc">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Sources">
|
||||
<UniqueIdentifier>{2cc01156-0219-4532-b5cc-4deb572c8d16}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Public Headers">
|
||||
<UniqueIdentifier>{64a63be2-c42b-4b99-a06a-61d4cc4efa21}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\SDL_net.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\SDL3_net/SDL_net.h">
|
||||
<Filter>Public Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\version.rc">
|
||||
<Filter>Sources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
|
||||
rm -rvf Win32 */Win32 x64 */x64
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DFDBDF0E-87C3-4421-B6D1-90B2C5C28C2B}</ProjectGuid>
|
||||
<RootNamespace>echo-server</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\echo-server.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7B1F60CD-2A09-4514-937C-D9DD044428FB}</ProjectGuid>
|
||||
<RootNamespace>get-local-addrs</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\get-local-addrs.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8DAC2820-128D-4FAF-9416-A8AD4C6D7A9A}</ProjectGuid>
|
||||
<RootNamespace>resolve-hostnames</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\resolve-hostnames.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{35F14669-ED09-4105-A035-7984B94FDFBC}</ProjectGuid>
|
||||
<RootNamespace>simple-http-get</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\simple-http-get.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A01E2216-139A-480E-8458-03CB4E90FE61}</ProjectGuid>
|
||||
<RootNamespace>voipchat</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(SolutionDir)..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showinterfaces.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\voipchat.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_net.vcxproj">
|
||||
<Project>{8ab3504f-5e58-4910-afe8-7a1e595ac3f4}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SDL3_net</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libsdl.SDL3-net</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SDL3_net</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.0.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,537 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
F3B38D1E296F730C005DA6D3 /* SDL3_net.xcframework */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = F3B38D1F296F730C005DA6D3 /* Build configuration list for PBXAggregateTarget "SDL3_net.xcframework" */;
|
||||
buildPhases = (
|
||||
F3B38D22296F7329005DA6D3 /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SDL3_net.xcframework;
|
||||
productName = xcFramework;
|
||||
};
|
||||
F3E1F74A2A789BFE00AC76D3 /* SDL3_net.dmg */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = F3E1F74B2A789BFF00AC76D3 /* Build configuration list for PBXAggregateTarget "SDL3_net.dmg" */;
|
||||
buildPhases = (
|
||||
F3E1F74E2A789C1000AC76D3 /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
F3E1F7502A789C2B00AC76D3 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SDL3_net.dmg;
|
||||
productName = "Create DMG";
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
AA92857F2EDB8FB20005200A /* SDL_net.c in Sources */ = {isa = PBXBuildFile; fileRef = AA92857E2EDB8FB20005200A /* SDL_net.c */; };
|
||||
AADBAC89175C6B4C004F8ED2 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007288A60F0DA79800C302A9 /* ApplicationServices.framework */; platformFilters = (macos, ); };
|
||||
AADBAC8A175C6B4F004F8ED2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61F85449145A19BC002CA294 /* Foundation.framework */; };
|
||||
BE1FA71A07AF4C44004B6283 /* SDL_net.h in Headers */ = {isa = PBXBuildFile; fileRef = 1014BAEA010A4B677F000001 /* SDL_net.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F34123C02D41A75D00D6C2B7 /* INSTALL.md in Resources */ = {isa = PBXBuildFile; fileRef = F34123BF2D41A75D00D6C2B7 /* INSTALL.md */; };
|
||||
F34123C42D41A79D00D6C2B7 /* LICENSE.txt in Resources */ = {isa = PBXBuildFile; fileRef = F34123C32D41A79D00D6C2B7 /* LICENSE.txt */; };
|
||||
F34123C62D41A7D800D6C2B7 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = F34123C52D41A7D800D6C2B7 /* README.md */; };
|
||||
F34126942D4B3D6900D6C2B7 /* SDL3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F34126932D4B3D6900D6C2B7 /* SDL3.framework */; };
|
||||
F382070E284EF58C004DD584 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F3820707284EF58C004DD584 /* CMake */; };
|
||||
F3E1AAEB281CBABD00740E39 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */; platformFilters = (ios, tvos, xros, ); };
|
||||
F3E1AAEC281CBB1F00740E39 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */; platformFilters = (ios, tvos, xros, ); };
|
||||
F3E1AAEE281CBD9F00740E39 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAED281CBD9F00740E39 /* UIKit.framework */; platformFilters = (ios, tvos, xros, ); };
|
||||
F3E1AAF0281CBDD100740E39 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */; platformFilters = (ios, tvos, xros, ); };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
F3E1F74F2A789C2B00AC76D3 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = F3B38D1E296F730C005DA6D3;
|
||||
remoteInfo = SDL_net.xcframework;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
007288A60F0DA79800C302A9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
|
||||
1014BAEA010A4B677F000001 /* SDL_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_net.h; path = ../include/SDL3_net/SDL_net.h; sourceTree = SOURCE_ROOT; };
|
||||
61F85449145A19BC002CA294 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
AA92857E2EDB8FB20005200A /* SDL_net.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = SDL_net.c; path = ../src/SDL_net.c; sourceTree = SOURCE_ROOT; };
|
||||
BE1FA72D07AF4C44004B6283 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
|
||||
BE1FA72E07AF4C45004B6283 /* SDL3_net.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3_net.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F34123BF2D41A75D00D6C2B7 /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = "<group>"; };
|
||||
F34123C32D41A79D00D6C2B7 /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.txt; path = ../../../LICENSE.txt; sourceTree = "<group>"; };
|
||||
F34123C52D41A7D800D6C2B7 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../README.md; sourceTree = "<group>"; };
|
||||
F34123C72D41A7F900D6C2B7 /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = "<group>"; };
|
||||
F34126932D4B3D6900D6C2B7 /* SDL3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL3.framework; path = macOS/SDL3.framework; sourceTree = "<group>"; };
|
||||
F3547625282AE1C6007E9EDA /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
|
||||
F3820707284EF58C004DD584 /* CMake */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CMake; sourceTree = "<group>"; };
|
||||
F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
|
||||
F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
F3E1AAED281CBD9F00740E39 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/iOSSupport/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BE1FA72A07AF4C44004B6283 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F34126942D4B3D6900D6C2B7 /* SDL3.framework in Frameworks */,
|
||||
AADBAC89175C6B4C004F8ED2 /* ApplicationServices.framework in Frameworks */,
|
||||
F3E1AAEB281CBABD00740E39 /* CoreGraphics.framework in Frameworks */,
|
||||
AADBAC8A175C6B4F004F8ED2 /* Foundation.framework in Frameworks */,
|
||||
F3E1AAEC281CBB1F00740E39 /* ImageIO.framework in Frameworks */,
|
||||
F3E1AAF0281CBDD100740E39 /* MobileCoreServices.framework in Frameworks */,
|
||||
F3E1AAEE281CBD9F00740E39 /* UIKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0153844A006D81B07F000001 /* Public Headers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1014BAEA010A4B677F000001 /* SDL_net.h */,
|
||||
);
|
||||
name = "Public Headers";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
034768DDFF38A45A11DB9C8B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BE1FA72E07AF4C45004B6283 /* SDL3_net.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D691FE84028FC02AAC07 /* SDL_netFramework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3547625282AE1C6007E9EDA /* config.xcconfig */,
|
||||
F59C70FC00D5CB5801000001 /* pkg-support */,
|
||||
0153844A006D81B07F000001 /* Public Headers */,
|
||||
08FB77ACFE841707C02AAC07 /* Library Source */,
|
||||
BE1FA76107AF72F5004B6283 /* Frameworks */,
|
||||
034768DDFF38A45A11DB9C8B /* Products */,
|
||||
BE1FA72D07AF4C44004B6283 /* Info-Framework.plist */,
|
||||
);
|
||||
name = SDL_netFramework;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB77ACFE841707C02AAC07 /* Library Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA92857E2EDB8FB20005200A /* SDL_net.c */,
|
||||
);
|
||||
name = "Library Source";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE1FA76107AF72F5004B6283 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F34126932D4B3D6900D6C2B7 /* SDL3.framework */,
|
||||
007288A60F0DA79800C302A9 /* ApplicationServices.framework */,
|
||||
F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */,
|
||||
61F85449145A19BC002CA294 /* Foundation.framework */,
|
||||
F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */,
|
||||
F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */,
|
||||
F3E1AAED281CBD9F00740E39 /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F34123BE2D41A71500D6C2B7 /* framework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F34123BF2D41A75D00D6C2B7 /* INSTALL.md */,
|
||||
);
|
||||
path = framework;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F59C70FC00D5CB5801000001 /* pkg-support */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F59C710100D5CB5801000001 /* resources */,
|
||||
);
|
||||
path = "pkg-support";
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
F59C710100D5CB5801000001 /* resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F34123BE2D41A71500D6C2B7 /* framework */,
|
||||
F3820707284EF58C004DD584 /* CMake */,
|
||||
F34123C32D41A79D00D6C2B7 /* LICENSE.txt */,
|
||||
F34123C52D41A7D800D6C2B7 /* README.md */,
|
||||
F34123C72D41A7F900D6C2B7 /* INSTALL.md */,
|
||||
);
|
||||
path = resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
BE1FA71907AF4C44004B6283 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BE1FA71A07AF4C44004B6283 /* SDL_net.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
BE1FA71807AF4C44004B6283 /* SDL3_net */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00B7E3AA097EB73D00826121 /* Build configuration list for PBXNativeTarget "SDL3_net" */;
|
||||
buildPhases = (
|
||||
BE1FA71907AF4C44004B6283 /* Headers */,
|
||||
BE1FA71B07AF4C44004B6283 /* Resources */,
|
||||
BE1FA71C07AF4C44004B6283 /* Sources */,
|
||||
BE1FA72A07AF4C44004B6283 /* Frameworks */,
|
||||
BE1FA72B07AF4C44004B6283 /* Rez */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
comments = "Installed into ~/Library/Frameworks/SDL_net.framework\n\nAdd -framework SDL_net to your linker flags\nAdd ~/Library/Frameworks/SDL_net.framework/Headers to your header search path\nAdd ~/Library/Frameworks to your library search path";
|
||||
dependencies = (
|
||||
);
|
||||
name = SDL3_net;
|
||||
productInstallPath = "@executable_path/../Frameworks";
|
||||
productName = SDL_net;
|
||||
productReference = BE1FA72E07AF4C45004B6283 /* SDL3_net.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0630;
|
||||
TargetAttributes = {
|
||||
F3B38D1E296F730C005DA6D3 = {
|
||||
CreatedOnToolsVersion = 14.2;
|
||||
};
|
||||
F3E1F74A2A789BFE00AC76D3 = {
|
||||
CreatedOnToolsVersion = 14.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 00B7E3B6097EB73D00826121 /* Build configuration list for PBXProject "SDL_net" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* SDL_netFramework */;
|
||||
productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = ..;
|
||||
targets = (
|
||||
BE1FA71807AF4C44004B6283 /* SDL3_net */,
|
||||
F3B38D1E296F730C005DA6D3 /* SDL3_net.xcframework */,
|
||||
F3E1F74A2A789BFE00AC76D3 /* SDL3_net.dmg */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
BE1FA71B07AF4C44004B6283 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F34123C42D41A79D00D6C2B7 /* LICENSE.txt in Resources */,
|
||||
F34123C02D41A75D00D6C2B7 /* INSTALL.md in Resources */,
|
||||
F34123C62D41A7D800D6C2B7 /* README.md in Resources */,
|
||||
F382070E284EF58C004DD584 /* CMake in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXRezBuildPhase section */
|
||||
BE1FA72B07AF4C44004B6283 /* Rez */ = {
|
||||
isa = PBXRezBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXRezBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
F3B38D22296F7329005DA6D3 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n echo \"error: Building an xcframework requires Xcode 11 minimum.\"\n exit 1\nfi\n\nFRAMEWORK_NAME=\"SDL3_net\"\nPROJECT_NAME=\"SDL_net\"\nSCHEME=\"SDL3_net\"\n\nMACOS_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-macosx.xcarchive\"\nIOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nIOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\nTVOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvsimulator.xcarchive\"\nTVOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvos.xcarchive\"\n\nOUTPUT_DIR=\"./build/\"\n\n# macOS\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${MACOS_ARCHIVE_PATH} \\\n -destination 'generic/platform=macOS,name=Any Mac' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n \n# iOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# iOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n -framework \"${MACOS_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${IOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${IOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${TVOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${TVOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n";
|
||||
};
|
||||
F3E1F74E2A789C1000AC76D3 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -ex\n\nPRODUCT_NAME=SDL3_net\nOPTIONAL_FRAMEWORKS=\"\"\n\nmkdir -p build/dmg-tmp/share/cmake/$PRODUCT_NAME\ncp -a build/$PRODUCT_NAME.xcframework build/dmg-tmp/\n\ncp ../LICENSE.txt build/dmg-tmp\ncp ../README.md build/dmg-tmp\ncp pkg-support/resources/INSTALL.md build/dmg-tmp\ncp pkg-support/resources/share/cmake/${PRODUCT_NAME}/${PRODUCT_NAME}Config.cmake build/dmg-tmp/share/cmake/${PRODUCT_NAME}\ncp pkg-support/resources/share/cmake/${PRODUCT_NAME}/${PRODUCT_NAME}ConfigVersion.cmake build/dmg-tmp/share/cmake/${PRODUCT_NAME}\nfor i in $OPTIONAL_FRAMEWORKS; do\n if [ -d build/$i.xcframework ]; then\n mkdir -p build/dmg-tmp/optional\n cp -a build/$i.xcframework build/dmg-tmp/optional/\n fi\ndone\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nrm -rf build/dmg-tmp/.DS_Store\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname $PRODUCT_NAME -srcfolder build/dmg-tmp build/$PRODUCT_NAME.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
BE1FA71C07AF4C44004B6283 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA92857F2EDB8FB20005200A /* SDL_net.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
F3E1F7502A789C2B00AC76D3 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = F3B38D1E296F730C005DA6D3 /* SDL3_net.xcframework */;
|
||||
targetProxy = F3E1F74F2A789C2B00AC76D3 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
007288110F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F3547625282AE1C6007E9EDA /* config.xcconfig */;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 301.0.0;
|
||||
DYLIB_CURRENT_VERSION = 301.0.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=appletv*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=iphone*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = "\"$(PROJECT_DIR)/macOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=xr*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
USE_STBIMAGE,
|
||||
LOAD_BMP,
|
||||
LOAD_GIF,
|
||||
LOAD_JPG,
|
||||
LOAD_LBM,
|
||||
LOAD_PCX,
|
||||
LOAD_PNG,
|
||||
LOAD_PNM,
|
||||
LOAD_QOI,
|
||||
LOAD_SVG,
|
||||
LOAD_TGA,
|
||||
LOAD_XCF,
|
||||
LOAD_XPM,
|
||||
LOAD_XV,
|
||||
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/../include\"",
|
||||
"\"$(SRCROOT)/../external/jpeg\"",
|
||||
"\"$(PROJECT_DIR)/jxl\"",
|
||||
);
|
||||
INFOPLIST_FILE = "Info-Framework.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.3.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL3-net";
|
||||
PRODUCT_NAME = SDL3_net;
|
||||
SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 11.0;
|
||||
XROS_DEPLOYMENT_TARGET = 1.3;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288120F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/../src/SDL_net.exports";
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288150F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F3547625282AE1C6007E9EDA /* config.xcconfig */;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 301.0.0;
|
||||
DYLIB_CURRENT_VERSION = 301.0.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=appletv*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=iphone*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = "\"$(PROJECT_DIR)/macOS\"";
|
||||
"FRAMEWORK_SEARCH_PATHS[sdk=xr*]" = "\"$(PROJECT_DIR)/iOS\"";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
USE_STBIMAGE,
|
||||
LOAD_BMP,
|
||||
LOAD_GIF,
|
||||
LOAD_JPG,
|
||||
LOAD_LBM,
|
||||
LOAD_PCX,
|
||||
LOAD_PNG,
|
||||
LOAD_PNM,
|
||||
LOAD_QOI,
|
||||
LOAD_SVG,
|
||||
LOAD_TGA,
|
||||
LOAD_XCF,
|
||||
LOAD_XPM,
|
||||
LOAD_XV,
|
||||
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/../include\"",
|
||||
"\"$(SRCROOT)/../external/jpeg\"",
|
||||
"\"$(PROJECT_DIR)/jxl\"",
|
||||
);
|
||||
INFOPLIST_FILE = "Info-Framework.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.3.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL3-net";
|
||||
PRODUCT_NAME = SDL3_net;
|
||||
SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 11.0;
|
||||
XROS_DEPLOYMENT_TARGET = 1.3;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
007288160F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXPORTED_SYMBOLS_FILE = "$(SRCROOT)/../src/SDL_net.exports";
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F3B38D20296F730C005DA6D3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F3B38D21296F730C005DA6D3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F3E1F74C2A789BFF00AC76D3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F3E1F74D2A789BFF00AC76D3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
00B7E3AA097EB73D00826121 /* Build configuration list for PBXNativeTarget "SDL3_net" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288160F0DA5C400C302A9 /* Release */,
|
||||
007288120F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
00B7E3B6097EB73D00826121 /* Build configuration list for PBXProject "SDL_net" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288150F0DA5C400C302A9 /* Release */,
|
||||
007288110F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F3B38D1F296F730C005DA6D3 /* Build configuration list for PBXAggregateTarget "SDL3_net.xcframework" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F3B38D20296F730C005DA6D3 /* Release */,
|
||||
F3B38D21296F730C005DA6D3 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F3E1F74B2A789BFF00AC76D3 /* Build configuration list for PBXAggregateTarget "SDL3_net.dmg" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F3E1F74C2A789BFF00AC76D3 /* Release */,
|
||||
F3E1F74D2A789BFF00AC76D3 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// config.xcconfig
|
||||
//
|
||||
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
|
||||
// Include any optional config for this build
|
||||
#include? "build.xcconfig"
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main include header for the SDL library, version 3.3.0
|
||||
*
|
||||
* It is almost always best to include just this one header instead of
|
||||
* picking out individual headers included here. There are exceptions to
|
||||
* this rule--SDL_main.h is special and not included here--but usually
|
||||
* letting SDL.h include the kitchen sink for you is the correct approach.
|
||||
*/
|
||||
|
||||
#ifndef SDL_h_
|
||||
#define SDL_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_assert.h>
|
||||
#include <SDL3/SDL_asyncio.h>
|
||||
#include <SDL3/SDL_atomic.h>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <SDL3/SDL_bits.h>
|
||||
#include <SDL3/SDL_blendmode.h>
|
||||
#include <SDL3/SDL_camera.h>
|
||||
#include <SDL3/SDL_clipboard.h>
|
||||
#include <SDL3/SDL_cpuinfo.h>
|
||||
#include <SDL3/SDL_dialog.h>
|
||||
#include <SDL3/SDL_dlopennote.h>
|
||||
#include <SDL3/SDL_endian.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_gpu.h>
|
||||
#include <SDL3/SDL_guid.h>
|
||||
#include <SDL3/SDL_haptic.h>
|
||||
#include <SDL3/SDL_hidapi.h>
|
||||
#include <SDL3/SDL_hints.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_loadso.h>
|
||||
#include <SDL3/SDL_locale.h>
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <SDL3/SDL_messagebox.h>
|
||||
#include <SDL3/SDL_metal.h>
|
||||
#include <SDL3/SDL_misc.h>
|
||||
#include <SDL3/SDL_mouse.h>
|
||||
#include <SDL3/SDL_mutex.h>
|
||||
#include <SDL3/SDL_pen.h>
|
||||
#include <SDL3/SDL_pixels.h>
|
||||
#include <SDL3/SDL_platform.h>
|
||||
#include <SDL3/SDL_power.h>
|
||||
#include <SDL3/SDL_process.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_render.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#include <SDL3/SDL_sensor.h>
|
||||
#include <SDL3/SDL_storage.h>
|
||||
#include <SDL3/SDL_surface.h>
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <SDL3/SDL_thread.h>
|
||||
#include <SDL3/SDL_time.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <SDL3/SDL_tray.h>
|
||||
#include <SDL3/SDL_touch.h>
|
||||
#include <SDL3/SDL_version.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
#include <SDL3/SDL_oldnames.h>
|
||||
|
||||
#endif /* SDL_h_ */
|
||||
@@ -0,0 +1,659 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryAssert
|
||||
*
|
||||
* A helpful assertion macro!
|
||||
*
|
||||
* SDL assertions operate like your usual `assert` macro, but with some added
|
||||
* features:
|
||||
*
|
||||
* - It uses a trick with the `sizeof` operator, so disabled assertions
|
||||
* vaporize out of the compiled code, but variables only referenced in the
|
||||
* assertion won't trigger compiler warnings about being unused.
|
||||
* - It is safe to use with a dangling-else: `if (x) SDL_assert(y); else
|
||||
* do_something();`
|
||||
* - It works the same everywhere, instead of counting on various platforms'
|
||||
* compiler and C runtime to behave.
|
||||
* - It provides multiple levels of assertion (SDL_assert, SDL_assert_release,
|
||||
* SDL_assert_paranoid) instead of a single all-or-nothing option.
|
||||
* - It offers a variety of responses when an assertion fails (retry, trigger
|
||||
* the debugger, abort the program, ignore the failure once, ignore it for
|
||||
* the rest of the program's run).
|
||||
* - It tries to show the user a dialog by default, if possible, but the app
|
||||
* can provide a callback to handle assertion failures however they like.
|
||||
* - It lets failed assertions be retried. Perhaps you had a network failure
|
||||
* and just want to retry the test after plugging your network cable back
|
||||
* in? You can.
|
||||
* - It lets the user ignore an assertion failure, if there's a harmless
|
||||
* problem that one can continue past.
|
||||
* - It lets the user mark an assertion as ignored for the rest of the
|
||||
* program's run; if there's a harmless problem that keeps popping up.
|
||||
* - It provides statistics and data on all failed assertions to the app.
|
||||
* - It allows the default assertion handler to be controlled with environment
|
||||
* variables, in case an automated script needs to control it.
|
||||
* - It can be used as an aid to Clang's static analysis; it will treat SDL
|
||||
* assertions as universally true (under the assumption that you are serious
|
||||
* about the asserted claims and that your debug builds will detect when
|
||||
* these claims were wrong). This can help the analyzer avoid false
|
||||
* positives.
|
||||
*
|
||||
* To use it: compile a debug build and just sprinkle around tests to check
|
||||
* your code!
|
||||
*/
|
||||
|
||||
#ifndef SDL_assert_h_
|
||||
#define SDL_assert_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* The level of assertion aggressiveness.
|
||||
*
|
||||
* This value changes depending on compiler options and other preprocessor
|
||||
* defines.
|
||||
*
|
||||
* It is currently one of the following values, but future SDL releases might
|
||||
* add more:
|
||||
*
|
||||
* - 0: All SDL assertion macros are disabled.
|
||||
* - 1: Release settings: SDL_assert disabled, SDL_assert_release enabled.
|
||||
* - 2: Debug settings: SDL_assert and SDL_assert_release enabled.
|
||||
* - 3: Paranoid settings: All SDL assertion macros enabled, including
|
||||
* SDL_assert_paranoid.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_ASSERT_LEVEL SomeNumberBasedOnVariousFactors
|
||||
|
||||
#elif !defined(SDL_ASSERT_LEVEL)
|
||||
#ifdef SDL_DEFAULT_ASSERT_LEVEL
|
||||
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
|
||||
#elif defined(_DEBUG) || defined(DEBUG) || \
|
||||
(defined(__GNUC__) && !defined(__OPTIMIZE__))
|
||||
#define SDL_ASSERT_LEVEL 2
|
||||
#else
|
||||
#define SDL_ASSERT_LEVEL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Attempt to tell an attached debugger to pause.
|
||||
*
|
||||
* This allows an app to programmatically halt ("break") the debugger as if it
|
||||
* had hit a breakpoint, allowing the developer to examine program state, etc.
|
||||
*
|
||||
* This is a macro--not a function--so that the debugger breaks on the source
|
||||
* code line that used SDL_TriggerBreakpoint and not in some random guts of
|
||||
* SDL. SDL_assert uses this macro for the same reason.
|
||||
*
|
||||
* If the program is not running under a debugger, SDL_TriggerBreakpoint will
|
||||
* likely terminate the app, possibly without warning. If the current platform
|
||||
* isn't supported, this macro is left undefined.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
|
||||
|
||||
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
|
||||
/* Don't include intrin.h here because it contains C++ code */
|
||||
extern void __cdecl __debugbreak(void);
|
||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
||||
#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
|
||||
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
|
||||
#elif SDL_HAS_BUILTIN(__builtin_trap)
|
||||
#define SDL_TriggerBreakpoint() __builtin_trap()
|
||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
||||
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
|
||||
#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
|
||||
#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
|
||||
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define SDL_TriggerBreakpoint() __builtin_trap() /* older gcc may not support SDL_HAS_BUILTIN(__builtin_trap) above */
|
||||
#elif defined(__386__) && defined(__WATCOMC__)
|
||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
||||
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
|
||||
#include <signal.h>
|
||||
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
|
||||
#else
|
||||
/* SDL_TriggerBreakpoint is intentionally left undefined on unknown platforms. */
|
||||
#endif
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro that reports the current function being compiled.
|
||||
*
|
||||
* If SDL can't figure how the compiler reports this, it will use "???".
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_FUNCTION __FUNCTION__
|
||||
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
||||
# define SDL_FUNCTION __func__
|
||||
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
|
||||
# define SDL_FUNCTION __FUNCTION__
|
||||
#else
|
||||
# define SDL_FUNCTION "???"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A macro that reports the current file being compiled.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_FILE __FILE__
|
||||
|
||||
/**
|
||||
* A macro that reports the current line number of the file being compiled.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_LINE __LINE__
|
||||
|
||||
/*
|
||||
sizeof (x) makes the compiler still parse the expression even without
|
||||
assertions enabled, so the code is always checked at compile time, but
|
||||
doesn't actually generate code for it, so there are no side effects or
|
||||
expensive checks at run time, just the constant size of what x WOULD be,
|
||||
which presumably gets optimized out as unused.
|
||||
This also solves the problem of...
|
||||
|
||||
int somevalue = blah();
|
||||
SDL_assert(somevalue == 1);
|
||||
|
||||
...which would cause compiles to complain that somevalue is unused if we
|
||||
disable assertions.
|
||||
*/
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro for wrapping code in `do {} while (0);` without compiler warnings.
|
||||
*
|
||||
* Visual Studio with really aggressive warnings enabled needs this to avoid
|
||||
* compiler complaints.
|
||||
*
|
||||
* the `do {} while (0);` trick is useful for wrapping code in a macro that
|
||||
* may or may not be a single statement, to avoid various C language
|
||||
* accidents.
|
||||
*
|
||||
* To use:
|
||||
*
|
||||
* ```c
|
||||
* do { SomethingOnce(); } while (SDL_NULL_WHILE_LOOP_CONDITION (0));
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
||||
|
||||
#elif defined(_MSC_VER) /* Avoid /W4 warnings. */
|
||||
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
|
||||
this condition isn't constant. And looks like an owl's face! */
|
||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
|
||||
#else
|
||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The macro used when an assertion is disabled.
|
||||
*
|
||||
* This isn't for direct use by apps, but this is the code that is inserted
|
||||
* when an SDL_assert is disabled (perhaps in a release build).
|
||||
*
|
||||
* The code does nothing, but wraps `condition` in a sizeof operator, which
|
||||
* generates no code and has no side effects, but avoid compiler warnings
|
||||
* about unused variables.
|
||||
*
|
||||
* \param condition the condition to assert (but not actually run here).
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_disabled_assert(condition) \
|
||||
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||
|
||||
/**
|
||||
* Possible outcomes from a triggered assertion.
|
||||
*
|
||||
* When an enabled assertion triggers, it may call the assertion handler
|
||||
* (possibly one provided by the app via SDL_SetAssertionHandler), which will
|
||||
* return one of these values, possibly after asking the user.
|
||||
*
|
||||
* Then SDL will respond based on this outcome (loop around to retry the
|
||||
* condition, try to break in a debugger, kill the program, or ignore the
|
||||
* problem).
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_AssertState
|
||||
{
|
||||
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
|
||||
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
|
||||
SDL_ASSERTION_ABORT, /**< Terminate the program. */
|
||||
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
|
||||
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
||||
} SDL_AssertState;
|
||||
|
||||
/**
|
||||
* Information about an assertion failure.
|
||||
*
|
||||
* This structure is filled in with information about a triggered assertion,
|
||||
* used by the assertion handler, then added to the assertion report. This is
|
||||
* returned as a linked list from SDL_GetAssertionReport().
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_AssertData
|
||||
{
|
||||
bool always_ignore; /**< true if app should always continue when assertion is triggered. */
|
||||
unsigned int trigger_count; /**< Number of times this assertion has been triggered. */
|
||||
const char *condition; /**< A string of this assert's test code. */
|
||||
const char *filename; /**< The source file where this assert lives. */
|
||||
int linenum; /**< The line in `filename` where this assert lives. */
|
||||
const char *function; /**< The name of the function where this assert lives. */
|
||||
const struct SDL_AssertData *next; /**< next item in the linked list. */
|
||||
} SDL_AssertData;
|
||||
|
||||
/**
|
||||
* Never call this directly.
|
||||
*
|
||||
* Use the SDL_assert macros instead.
|
||||
*
|
||||
* \param data assert data structure.
|
||||
* \param func function name.
|
||||
* \param file file name.
|
||||
* \param line line number.
|
||||
* \returns assert state.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data,
|
||||
const char *func,
|
||||
const char *file, int line) SDL_ANALYZER_NORETURN;
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* The macro used when an assertion triggers a breakpoint.
|
||||
*
|
||||
* This isn't for direct use by apps; use SDL_assert or SDL_TriggerBreakpoint
|
||||
* instead.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
|
||||
|
||||
#elif !defined(SDL_AssertBreakpoint)
|
||||
# if defined(ANDROID) && defined(assert)
|
||||
/* Define this as empty in case assert() is defined as SDL_assert */
|
||||
# define SDL_AssertBreakpoint()
|
||||
# else
|
||||
# define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
|
||||
# endif
|
||||
#endif /* !SDL_AssertBreakpoint */
|
||||
|
||||
/**
|
||||
* The macro used when an assertion is enabled.
|
||||
*
|
||||
* This isn't for direct use by apps, but this is the code that is inserted
|
||||
* when an SDL_assert is enabled.
|
||||
*
|
||||
* The `do {} while(0)` avoids dangling else problems:
|
||||
*
|
||||
* ```c
|
||||
* if (x) SDL_assert(y); else blah();
|
||||
* ```
|
||||
*
|
||||
* ... without the do/while, the "else" could attach to this macro's "if". We
|
||||
* try to handle just the minimum we need here in a macro...the loop, the
|
||||
* static vars, and break points. The heavy lifting is handled in
|
||||
* SDL_ReportAssertion().
|
||||
*
|
||||
* \param condition the condition to assert.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_enabled_assert(condition) \
|
||||
do { \
|
||||
while ( !(condition) ) { \
|
||||
static struct SDL_AssertData sdl_assert_data = { false, 0, #condition, NULL, 0, NULL, NULL }; \
|
||||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
|
||||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
|
||||
continue; /* go again. */ \
|
||||
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
|
||||
SDL_AssertBreakpoint(); \
|
||||
} \
|
||||
break; /* not retrying. */ \
|
||||
} \
|
||||
} while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* An assertion test that is normally performed only in debug builds.
|
||||
*
|
||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 2, otherwise it is
|
||||
* disabled. This is meant to only do these tests in debug builds, so they can
|
||||
* tend to be more expensive, and they are meant to bring everything to a halt
|
||||
* when they fail, with the programmer there to assess the problem.
|
||||
*
|
||||
* In short: you can sprinkle these around liberally and assume they will
|
||||
* evaporate out of the build when building for end-users.
|
||||
*
|
||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
||||
* operator, which means any function calls and side effects will not run, but
|
||||
* the compiler will not complain about any otherwise-unused variables that
|
||||
* are only referenced in the assertion.
|
||||
*
|
||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
||||
* behavior, which may be desirable for automation purposes. If your platform
|
||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
||||
* an assertion in a background thread, it might be desirable to set this to
|
||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
||||
*
|
||||
* \param condition boolean value to test.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
|
||||
|
||||
/**
|
||||
* An assertion test that is performed even in release builds.
|
||||
*
|
||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 1, otherwise it is
|
||||
* disabled. This is meant to be for tests that are cheap to make and
|
||||
* extremely unlikely to fail; generally it is frowned upon to have an
|
||||
* assertion failure in a release build, so these assertions generally need to
|
||||
* be of more than life-and-death importance if there's a chance they might
|
||||
* trigger. You should almost always consider handling these cases more
|
||||
* gracefully than an assert allows.
|
||||
*
|
||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
||||
* operator, which means any function calls and side effects will not run, but
|
||||
* the compiler will not complain about any otherwise-unused variables that
|
||||
* are only referenced in the assertion.
|
||||
*
|
||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
||||
* behavior, which may be desirable for automation purposes. If your platform
|
||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
||||
* an assertion in a background thread, it might be desirable to set this to
|
||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
||||
* *
|
||||
*
|
||||
* \param condition boolean value to test.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
||||
|
||||
/**
|
||||
* An assertion test that is performed only when built with paranoid settings.
|
||||
*
|
||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 3, otherwise it is
|
||||
* disabled. This is a higher level than both release and debug, so these
|
||||
* tests are meant to be expensive and only run when specifically looking for
|
||||
* extremely unexpected failure cases in a special build.
|
||||
*
|
||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
||||
* operator, which means any function calls and side effects will not run, but
|
||||
* the compiler will not complain about any otherwise-unused variables that
|
||||
* are only referenced in the assertion.
|
||||
*
|
||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
||||
* behavior, which may be desirable for automation purposes. If your platform
|
||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
||||
* an assertion in a background thread, it might be desirable to set this to
|
||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
||||
*
|
||||
* \param condition boolean value to test.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
|
||||
/* Enable various levels of assertions. */
|
||||
#elif SDL_ASSERT_LEVEL == 0 /* assertions disabled */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 2 /* debug settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
|
||||
#else
|
||||
# error Unknown assertion level.
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An assertion test that is always performed.
|
||||
*
|
||||
* This macro is always enabled no matter what SDL_ASSERT_LEVEL is set to. You
|
||||
* almost never want to use this, as it could trigger on an end-user's system,
|
||||
* crashing your program.
|
||||
*
|
||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
||||
* behavior, which may be desirable for automation purposes. If your platform
|
||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
||||
* an assertion in a background thread, it might be desirable to set this to
|
||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
||||
*
|
||||
* \param condition boolean value to test.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
|
||||
|
||||
|
||||
/**
|
||||
* A callback that fires when an SDL assertion fails.
|
||||
*
|
||||
* \param data a pointer to the SDL_AssertData structure corresponding to the
|
||||
* current assertion.
|
||||
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler().
|
||||
* \returns an SDL_AssertState value indicating how to handle the failure.
|
||||
*
|
||||
* \threadsafety This callback may be called from any thread that triggers an
|
||||
* assert at any time.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
||||
const SDL_AssertData *data, void *userdata);
|
||||
|
||||
/**
|
||||
* Set an application-defined assertion handler.
|
||||
*
|
||||
* This function allows an application to show its own assertion UI and/or
|
||||
* force the response to an assertion failure. If the application doesn't
|
||||
* provide this, SDL will try to do the right thing, popping up a
|
||||
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
|
||||
*
|
||||
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
||||
* it will only fire from one thread at a time.
|
||||
*
|
||||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
||||
*
|
||||
* \param handler the SDL_AssertionHandler function to call when an assertion
|
||||
* fails or NULL for the default handler.
|
||||
* \param userdata a pointer that is passed to `handler`.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAssertionHandler
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||
SDL_AssertionHandler handler,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* Get the default assertion handler.
|
||||
*
|
||||
* This returns the function pointer that is called by default when an
|
||||
* assertion is triggered. This is an internal function provided by SDL, that
|
||||
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
|
||||
* provide a different function.
|
||||
*
|
||||
* \returns the default SDL_AssertionHandler that is called when an assert
|
||||
* triggers.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAssertionHandler
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
|
||||
|
||||
/**
|
||||
* Get the current assertion handler.
|
||||
*
|
||||
* This returns the function pointer that is called when an assertion is
|
||||
* triggered. This is either the value last passed to
|
||||
* SDL_SetAssertionHandler(), or if no application-specified function is set,
|
||||
* is equivalent to calling SDL_GetDefaultAssertionHandler().
|
||||
*
|
||||
* The parameter `puserdata` is a pointer to a void*, which will store the
|
||||
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
|
||||
* will always be NULL for the default handler. If you don't care about this
|
||||
* data, it is safe to pass a NULL pointer to this function to ignore it.
|
||||
*
|
||||
* \param puserdata pointer which is filled with the "userdata" pointer that
|
||||
* was passed to SDL_SetAssertionHandler().
|
||||
* \returns the SDL_AssertionHandler that is called when an assert triggers.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAssertionHandler
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
|
||||
|
||||
/**
|
||||
* Get a list of all assertion failures.
|
||||
*
|
||||
* This function gets all assertions triggered since the last call to
|
||||
* SDL_ResetAssertionReport(), or the start of the program.
|
||||
*
|
||||
* The proper way to examine this data looks something like this:
|
||||
*
|
||||
* ```c
|
||||
* const SDL_AssertData *item = SDL_GetAssertionReport();
|
||||
* while (item) {
|
||||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
|
||||
* item->condition, item->function, item->filename,
|
||||
* item->linenum, item->trigger_count,
|
||||
* item->always_ignore ? "yes" : "no");
|
||||
* item = item->next;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \returns a list of all failed assertions or NULL if the list is empty. This
|
||||
* memory should not be modified or freed by the application. This
|
||||
* pointer remains valid until the next call to SDL_Quit() or
|
||||
* SDL_ResetAssertionReport().
|
||||
*
|
||||
* \threadsafety This function is not thread safe. Other threads calling
|
||||
* SDL_ResetAssertionReport() simultaneously, may render the
|
||||
* returned pointer invalid.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ResetAssertionReport
|
||||
*/
|
||||
extern SDL_DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
||||
|
||||
/**
|
||||
* Clear the list of all assertion failures.
|
||||
*
|
||||
* This function will clear the list of all assertions triggered up to that
|
||||
* point. Immediately following this call, SDL_GetAssertionReport will return
|
||||
* no items. In addition, any previously-triggered assertions will be reset to
|
||||
* a trigger_count of zero, and their always_ignore state will be false.
|
||||
*
|
||||
* \threadsafety This function is not thread safe. Other threads triggering an
|
||||
* assertion, or simultaneously calling this function may cause
|
||||
* memory leaks or crashes.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAssertionReport
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_assert_h_ */
|
||||
@@ -0,0 +1,546 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: AsyncIO */
|
||||
|
||||
/**
|
||||
* # CategoryAsyncIO
|
||||
*
|
||||
* SDL offers a way to perform I/O asynchronously. This allows an app to read
|
||||
* or write files without waiting for data to actually transfer; the functions
|
||||
* that request I/O never block while the request is fulfilled.
|
||||
*
|
||||
* Instead, the data moves in the background and the app can check for results
|
||||
* at their leisure.
|
||||
*
|
||||
* This is more complicated than just reading and writing files in a
|
||||
* synchronous way, but it can allow for more efficiency, and never having
|
||||
* framerate drops as the hard drive catches up, etc.
|
||||
*
|
||||
* The general usage pattern for async I/O is:
|
||||
*
|
||||
* - Create one or more SDL_AsyncIOQueue objects.
|
||||
* - Open files with SDL_AsyncIOFromFile.
|
||||
* - Start I/O tasks to the files with SDL_ReadAsyncIO or SDL_WriteAsyncIO,
|
||||
* putting those tasks into one of the queues.
|
||||
* - Later on, use SDL_GetAsyncIOResult on a queue to see if any task is
|
||||
* finished without blocking. Tasks might finish in any order with success
|
||||
* or failure.
|
||||
* - When all your tasks are done, close the file with SDL_CloseAsyncIO. This
|
||||
* also generates a task, since it might flush data to disk!
|
||||
*
|
||||
* This all works, without blocking, in a single thread, but one can also wait
|
||||
* on a queue in a background thread, sleeping until new results have arrived:
|
||||
*
|
||||
* - Call SDL_WaitAsyncIOResult from one or more threads to efficiently block
|
||||
* until new tasks complete.
|
||||
* - When shutting down, call SDL_SignalAsyncIOQueue to unblock any sleeping
|
||||
* threads despite there being no new tasks completed.
|
||||
*
|
||||
* And, of course, to match the synchronous SDL_LoadFile, we offer
|
||||
* SDL_LoadFileAsync as a convenience function. This will handle allocating a
|
||||
* buffer, slurping in the file data, and null-terminating it; you still check
|
||||
* for results later.
|
||||
*
|
||||
* Behind the scenes, SDL will use newer, efficient APIs on platforms that
|
||||
* support them: Linux's io_uring and Windows 11's IoRing, for example. If
|
||||
* those technologies aren't available, SDL will offload the work to a thread
|
||||
* pool that will manage otherwise-synchronous loads without blocking the app.
|
||||
*
|
||||
* ## Best Practices
|
||||
*
|
||||
* Simple non-blocking I/O--for an app that just wants to pick up data
|
||||
* whenever it's ready without losing framerate waiting on disks to spin--can
|
||||
* use whatever pattern works well for the program. In this case, simply call
|
||||
* SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call
|
||||
* SDL_GetAsyncIOResult to check for any completed tasks and deal with the
|
||||
* data as it arrives.
|
||||
*
|
||||
* If two separate pieces of the same program need their own I/O, it is legal
|
||||
* for each to create their own queue. This will prevent either piece from
|
||||
* accidentally consuming the other's completed tasks. Each queue does require
|
||||
* some amount of resources, but it is not an overwhelming cost. Do not make a
|
||||
* queue for each task, however. It is better to put many tasks into a single
|
||||
* queue. They will be reported in order of completion, not in the order they
|
||||
* were submitted, so it doesn't generally matter what order tasks are
|
||||
* started.
|
||||
*
|
||||
* One async I/O queue can be shared by multiple threads, or one thread can
|
||||
* have more than one queue, but the most efficient way--if ruthless
|
||||
* efficiency is the goal--is to have one queue per thread, with multiple
|
||||
* threads working in parallel, and attempt to keep each queue loaded with
|
||||
* tasks that are both started by and consumed by the same thread. On modern
|
||||
* platforms that can use newer interfaces, this can keep data flowing as
|
||||
* efficiently as possible all the way from storage hardware to the app, with
|
||||
* no contention between threads for access to the same queue.
|
||||
*
|
||||
* Written data is not guaranteed to make it to physical media by the time a
|
||||
* closing task is completed, unless SDL_CloseAsyncIO is called with its
|
||||
* `flush` parameter set to true, which is to say that a successful result
|
||||
* here can still result in lost data during an unfortunately-timed power
|
||||
* outage if not flushed. However, flushing will take longer and may be
|
||||
* unnecessary, depending on the app's needs.
|
||||
*/
|
||||
|
||||
#ifndef SDL_asyncio_h_
|
||||
#define SDL_asyncio_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The asynchronous I/O operation structure.
|
||||
*
|
||||
* This operates as an opaque handle. One can then request read or write
|
||||
* operations on it.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AsyncIOFromFile
|
||||
*/
|
||||
typedef struct SDL_AsyncIO SDL_AsyncIO;
|
||||
|
||||
/**
|
||||
* Types of asynchronous I/O tasks.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_AsyncIOTaskType
|
||||
{
|
||||
SDL_ASYNCIO_TASK_READ, /**< A read operation. */
|
||||
SDL_ASYNCIO_TASK_WRITE, /**< A write operation. */
|
||||
SDL_ASYNCIO_TASK_CLOSE /**< A close operation. */
|
||||
} SDL_AsyncIOTaskType;
|
||||
|
||||
/**
|
||||
* Possible outcomes of an asynchronous I/O task.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_AsyncIOResult
|
||||
{
|
||||
SDL_ASYNCIO_COMPLETE, /**< request was completed without error */
|
||||
SDL_ASYNCIO_FAILURE, /**< request failed for some reason; check SDL_GetError()! */
|
||||
SDL_ASYNCIO_CANCELED /**< request was canceled before completing. */
|
||||
} SDL_AsyncIOResult;
|
||||
|
||||
/**
|
||||
* Information about a completed asynchronous I/O request.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_AsyncIOOutcome
|
||||
{
|
||||
SDL_AsyncIO *asyncio; /**< what generated this task. This pointer will be invalid if it was closed! */
|
||||
SDL_AsyncIOTaskType type; /**< What sort of task was this? Read, write, etc? */
|
||||
SDL_AsyncIOResult result; /**< the result of the work (success, failure, cancellation). */
|
||||
void *buffer; /**< buffer where data was read/written. */
|
||||
Uint64 offset; /**< offset in the SDL_AsyncIO where data was read/written. */
|
||||
Uint64 bytes_requested; /**< number of bytes the task was to read/write. */
|
||||
Uint64 bytes_transferred; /**< actual number of bytes that were read/written. */
|
||||
void *userdata; /**< pointer provided by the app when starting the task */
|
||||
} SDL_AsyncIOOutcome;
|
||||
|
||||
/**
|
||||
* A queue of completed asynchronous I/O tasks.
|
||||
*
|
||||
* When starting an asynchronous operation, you specify a queue for the new
|
||||
* task. A queue can be asked later if any tasks in it have completed,
|
||||
* allowing an app to manage multiple pending tasks in one place, in whatever
|
||||
* order they complete.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CreateAsyncIOQueue
|
||||
* \sa SDL_ReadAsyncIO
|
||||
* \sa SDL_WriteAsyncIO
|
||||
* \sa SDL_GetAsyncIOResult
|
||||
* \sa SDL_WaitAsyncIOResult
|
||||
*/
|
||||
typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue;
|
||||
|
||||
/**
|
||||
* Use this function to create a new SDL_AsyncIO object for reading from
|
||||
* and/or writing to a named file.
|
||||
*
|
||||
* The `mode` string understands the following values:
|
||||
*
|
||||
* - "r": Open a file for reading only. It must exist.
|
||||
* - "w": Open a file for writing only. It will create missing files or
|
||||
* truncate existing ones.
|
||||
* - "r+": Open a file for update both reading and writing. The file must
|
||||
* exist.
|
||||
* - "w+": Create an empty file for both reading and writing. If a file with
|
||||
* the same name already exists its content is erased and the file is
|
||||
* treated as a new empty file.
|
||||
*
|
||||
* There is no "b" mode, as there is only "binary" style I/O, and no "a" mode
|
||||
* for appending, since you specify the position when starting a task.
|
||||
*
|
||||
* This function supports Unicode filenames, but they must be encoded in UTF-8
|
||||
* format, regardless of the underlying operating system.
|
||||
*
|
||||
* This call is _not_ asynchronous; it will open the file before returning,
|
||||
* under the assumption that doing so is generally a fast operation. Future
|
||||
* reads and writes to the opened file will be async, however.
|
||||
*
|
||||
* \param file a UTF-8 string representing the filename to open.
|
||||
* \param mode an ASCII string representing the mode to be used for opening
|
||||
* the file.
|
||||
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CloseAsyncIO
|
||||
* \sa SDL_ReadAsyncIO
|
||||
* \sa SDL_WriteAsyncIO
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_AsyncIO * SDLCALL SDL_AsyncIOFromFile(const char *file, const char *mode);
|
||||
|
||||
/**
|
||||
* Use this function to get the size of the data stream in an SDL_AsyncIO.
|
||||
*
|
||||
* This call is _not_ asynchronous; it assumes that obtaining this info is a
|
||||
* non-blocking operation in most reasonable cases.
|
||||
*
|
||||
* \param asyncio the SDL_AsyncIO to get the size of the data stream from.
|
||||
* \returns the size of the data stream in the SDL_IOStream on success or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
|
||||
|
||||
/**
|
||||
* Start an async read.
|
||||
*
|
||||
* This function reads up to `size` bytes from `offset` position in the data
|
||||
* source to the area pointed at by `ptr`. This function may read less bytes
|
||||
* than requested.
|
||||
*
|
||||
* This function returns as quickly as possible; it does not wait for the read
|
||||
* to complete. On a successful return, this work will continue in the
|
||||
* background. If the work begins, even failure is asynchronous: a failing
|
||||
* return value from this function only means the work couldn't start at all.
|
||||
*
|
||||
* `ptr` must remain available until the work is done, and may be accessed by
|
||||
* the system at any time until then. Do not allocate it on the stack, as this
|
||||
* might take longer than the life of the calling function to complete!
|
||||
*
|
||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
||||
* to it when it completes its work.
|
||||
*
|
||||
* \param asyncio a pointer to an SDL_AsyncIO structure.
|
||||
* \param ptr a pointer to a buffer to read data into.
|
||||
* \param offset the position to start reading in the data source.
|
||||
* \param size the number of bytes to read from the data source.
|
||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
||||
* \param userdata an app-defined pointer that will be provided with the task
|
||||
* results.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_WriteAsyncIO
|
||||
* \sa SDL_CreateAsyncIOQueue
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ReadAsyncIO(SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 size, SDL_AsyncIOQueue *queue, void *userdata);
|
||||
|
||||
/**
|
||||
* Start an async write.
|
||||
*
|
||||
* This function writes `size` bytes from `offset` position in the data source
|
||||
* to the area pointed at by `ptr`.
|
||||
*
|
||||
* This function returns as quickly as possible; it does not wait for the
|
||||
* write to complete. On a successful return, this work will continue in the
|
||||
* background. If the work begins, even failure is asynchronous: a failing
|
||||
* return value from this function only means the work couldn't start at all.
|
||||
*
|
||||
* `ptr` must remain available until the work is done, and may be accessed by
|
||||
* the system at any time until then. Do not allocate it on the stack, as this
|
||||
* might take longer than the life of the calling function to complete!
|
||||
*
|
||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
||||
* to it when it completes its work.
|
||||
*
|
||||
* \param asyncio a pointer to an SDL_AsyncIO structure.
|
||||
* \param ptr a pointer to a buffer to write data from.
|
||||
* \param offset the position to start writing to the data source.
|
||||
* \param size the number of bytes to write to the data source.
|
||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
||||
* \param userdata an app-defined pointer that will be provided with the task
|
||||
* results.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ReadAsyncIO
|
||||
* \sa SDL_CreateAsyncIOQueue
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 size, SDL_AsyncIOQueue *queue, void *userdata);
|
||||
|
||||
/**
|
||||
* Close and free any allocated resources for an async I/O object.
|
||||
*
|
||||
* Closing a file is _also_ an asynchronous task! If a write failure were to
|
||||
* happen during the closing process, for example, the task results will
|
||||
* report it as usual.
|
||||
*
|
||||
* Closing a file that has been written to does not guarantee the data has
|
||||
* made it to physical media; it may remain in the operating system's file
|
||||
* cache, for later writing to disk. This means that a successfully-closed
|
||||
* file can be lost if the system crashes or loses power in this small window.
|
||||
* To prevent this, call this function with the `flush` parameter set to true.
|
||||
* This will make the operation take longer, and perhaps increase system load
|
||||
* in general, but a successful result guarantees that the data has made it to
|
||||
* physical storage. Don't use this for temporary files, caches, and
|
||||
* unimportant data, and definitely use it for crucial irreplaceable files,
|
||||
* like game saves.
|
||||
*
|
||||
* This function guarantees that the close will happen after any other pending
|
||||
* tasks to `asyncio`, so it's safe to open a file, start several operations,
|
||||
* close the file immediately, then check for all results later. This function
|
||||
* will not block until the tasks have completed.
|
||||
*
|
||||
* Once this function returns true, `asyncio` is no longer valid, regardless
|
||||
* of any future outcomes. Any completed tasks might still contain this
|
||||
* pointer in their SDL_AsyncIOOutcome data, in case the app was using this
|
||||
* value to track information, but it should not be used again.
|
||||
*
|
||||
* If this function returns false, the close wasn't started at all, and it's
|
||||
* safe to attempt to close again later.
|
||||
*
|
||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
||||
* to it when it completes its work.
|
||||
*
|
||||
* \param asyncio a pointer to an SDL_AsyncIO structure to close.
|
||||
* \param flush true if data should sync to disk before the task completes.
|
||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
||||
* \param userdata an app-defined pointer that will be provided with the task
|
||||
* results.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, but two
|
||||
* threads should not attempt to close the same object.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata);
|
||||
|
||||
/**
|
||||
* Create a task queue for tracking multiple I/O operations.
|
||||
*
|
||||
* Async I/O operations are assigned to a queue when started. The queue can be
|
||||
* checked for completed tasks thereafter.
|
||||
*
|
||||
* \returns a new task queue object or NULL if there was an error; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DestroyAsyncIOQueue
|
||||
* \sa SDL_GetAsyncIOResult
|
||||
* \sa SDL_WaitAsyncIOResult
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_AsyncIOQueue * SDLCALL SDL_CreateAsyncIOQueue(void);
|
||||
|
||||
/**
|
||||
* Destroy a previously-created async I/O task queue.
|
||||
*
|
||||
* If there are still tasks pending for this queue, this call will block until
|
||||
* those tasks are finished. All those tasks will be deallocated. Their
|
||||
* results will be lost to the app.
|
||||
*
|
||||
* Any pending reads from SDL_LoadFileAsync() that are still in this queue
|
||||
* will have their buffers deallocated by this function, to prevent a memory
|
||||
* leak.
|
||||
*
|
||||
* Once this function is called, the queue is no longer valid and should not
|
||||
* be used, including by other threads that might access it while destruction
|
||||
* is blocking on pending tasks.
|
||||
*
|
||||
* Do not destroy a queue that still has threads waiting on it through
|
||||
* SDL_WaitAsyncIOResult(). You can call SDL_SignalAsyncIOQueue() first to
|
||||
* unblock those threads, and take measures (such as SDL_WaitThread()) to make
|
||||
* sure they have finished their wait and won't wait on the queue again.
|
||||
*
|
||||
* \param queue the task queue to destroy.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, so long as
|
||||
* no other thread is waiting on the queue with
|
||||
* SDL_WaitAsyncIOResult.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue);
|
||||
|
||||
/**
|
||||
* Query an async I/O task queue for completed tasks.
|
||||
*
|
||||
* If a task assigned to this queue has finished, this will return true and
|
||||
* fill in `outcome` with the details of the task. If no task in the queue has
|
||||
* finished, this function will return false. This function does not block.
|
||||
*
|
||||
* If a task has completed, this function will free its resources and the task
|
||||
* pointer will no longer be valid. The task will be removed from the queue.
|
||||
*
|
||||
* It is safe for multiple threads to call this function on the same queue at
|
||||
* once; a completed task will only go to one of the threads.
|
||||
*
|
||||
* \param queue the async I/O task queue to query.
|
||||
* \param outcome details of a finished task will be written here. May not be
|
||||
* NULL.
|
||||
* \returns true if a task has completed, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_WaitAsyncIOResult
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, SDL_AsyncIOOutcome *outcome);
|
||||
|
||||
/**
|
||||
* Block until an async I/O task queue has a completed task.
|
||||
*
|
||||
* This function puts the calling thread to sleep until there a task assigned
|
||||
* to the queue that has finished.
|
||||
*
|
||||
* If a task assigned to the queue has finished, this will return true and
|
||||
* fill in `outcome` with the details of the task. If no task in the queue has
|
||||
* finished, this function will return false.
|
||||
*
|
||||
* If a task has completed, this function will free its resources and the task
|
||||
* pointer will no longer be valid. The task will be removed from the queue.
|
||||
*
|
||||
* It is safe for multiple threads to call this function on the same queue at
|
||||
* once; a completed task will only go to one of the threads.
|
||||
*
|
||||
* Note that by the nature of various platforms, more than one waiting thread
|
||||
* may wake to handle a single task, but only one will obtain it, so
|
||||
* `timeoutMS` is a _maximum_ wait time, and this function may return false
|
||||
* sooner.
|
||||
*
|
||||
* This function may return false if there was a system error, the OS
|
||||
* inadvertently awoke multiple threads, or if SDL_SignalAsyncIOQueue() was
|
||||
* called to wake up all waiting threads without a finished task.
|
||||
*
|
||||
* A timeout can be used to specify a maximum wait time, but rather than
|
||||
* polling, it is possible to have a timeout of -1 to wait forever, and use
|
||||
* SDL_SignalAsyncIOQueue() to wake up the waiting threads later.
|
||||
*
|
||||
* \param queue the async I/O task queue to wait on.
|
||||
* \param outcome details of a finished task will be written here. May not be
|
||||
* NULL.
|
||||
* \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait
|
||||
* indefinitely.
|
||||
* \returns true if task has completed, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SignalAsyncIOQueue
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_WaitAsyncIOResult(SDL_AsyncIOQueue *queue, SDL_AsyncIOOutcome *outcome, Sint32 timeoutMS);
|
||||
|
||||
/**
|
||||
* Wake up any threads that are blocking in SDL_WaitAsyncIOResult().
|
||||
*
|
||||
* This will unblock any threads that are sleeping in a call to
|
||||
* SDL_WaitAsyncIOResult for the specified queue, and cause them to return
|
||||
* from that function.
|
||||
*
|
||||
* This can be useful when destroying a queue to make sure nothing is touching
|
||||
* it indefinitely. In this case, once this call completes, the caller should
|
||||
* take measures to make sure any previously-blocked threads have returned
|
||||
* from their wait and will not touch the queue again (perhaps by setting a
|
||||
* flag to tell the threads to terminate and then using SDL_WaitThread() to
|
||||
* make sure they've done so).
|
||||
*
|
||||
* \param queue the async I/O task queue to signal.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_WaitAsyncIOResult
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue);
|
||||
|
||||
/**
|
||||
* Load all the data from a file path, asynchronously.
|
||||
*
|
||||
* This function returns as quickly as possible; it does not wait for the read
|
||||
* to complete. On a successful return, this work will continue in the
|
||||
* background. If the work begins, even failure is asynchronous: a failing
|
||||
* return value from this function only means the work couldn't start at all.
|
||||
*
|
||||
* The data is allocated with a zero byte at the end (null terminated) for
|
||||
* convenience. This extra byte is not included in SDL_AsyncIOOutcome's
|
||||
* bytes_transferred value.
|
||||
*
|
||||
* This function will allocate the buffer to contain the file. It must be
|
||||
* deallocated by calling SDL_free() on SDL_AsyncIOOutcome's buffer field
|
||||
* after completion.
|
||||
*
|
||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
||||
* to it when it completes its work.
|
||||
*
|
||||
* \param file the path to read all available data from.
|
||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
||||
* \param userdata an app-defined pointer that will be provided with the task
|
||||
* results.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LoadFile_IO
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_LoadFileAsync(const char *file, SDL_AsyncIOQueue *queue, void *userdata);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_asyncio_h_ */
|
||||
@@ -0,0 +1,682 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryAtomic
|
||||
*
|
||||
* Atomic operations.
|
||||
*
|
||||
* IMPORTANT: If you are not an expert in concurrent lockless programming, you
|
||||
* should not be using any functions in this file. You should be protecting
|
||||
* your data structures with full mutexes instead.
|
||||
*
|
||||
* ***Seriously, here be dragons!***
|
||||
*
|
||||
* You can find out a little more about lockless programming and the subtle
|
||||
* issues that can arise here:
|
||||
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming
|
||||
*
|
||||
* There's also lots of good information here:
|
||||
*
|
||||
* - https://www.1024cores.net/home/lock-free-algorithms
|
||||
* - https://preshing.com/
|
||||
*
|
||||
* These operations may or may not actually be implemented using processor
|
||||
* specific atomic operations. When possible they are implemented as true
|
||||
* processor specific atomic operations. When that is not possible the are
|
||||
* implemented using locks that *do* use the available atomic operations.
|
||||
*
|
||||
* All of the atomic operations that modify memory are full memory barriers.
|
||||
*/
|
||||
|
||||
#ifndef SDL_atomic_h_
|
||||
#define SDL_atomic_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_platform_defines.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An atomic spinlock.
|
||||
*
|
||||
* The atomic locks are efficient spinlocks using CPU instructions, but are
|
||||
* vulnerable to starvation and can spin forever if a thread holding a lock
|
||||
* has been terminated. For this reason you should minimize the code executed
|
||||
* inside an atomic lock and never do expensive things like API or system
|
||||
* calls while holding them.
|
||||
*
|
||||
* They are also vulnerable to starvation if the thread holding the lock is
|
||||
* lower priority than other threads and doesn't get scheduled. In general you
|
||||
* should use mutexes instead, since they have better performance and
|
||||
* contention behavior.
|
||||
*
|
||||
* The atomic locks are not safe to lock recursively.
|
||||
*
|
||||
* Porting Note: The spin lock functions and type are required and can not be
|
||||
* emulated because they are used in the atomic emulation code.
|
||||
*/
|
||||
typedef int SDL_SpinLock;
|
||||
|
||||
/**
|
||||
* Try to lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable.
|
||||
* \returns true if the lock succeeded, false if the lock is already held.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LockSpinlock
|
||||
* \sa SDL_UnlockSpinlock
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockSpinlock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* Lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_TryLockSpinlock
|
||||
* \sa SDL_UnlockSpinlock
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LockSpinlock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* Unlock a spin lock by setting it to 0.
|
||||
*
|
||||
* Always returns immediately.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LockSpinlock
|
||||
* \sa SDL_TryLockSpinlock
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock);
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Mark a compiler barrier.
|
||||
*
|
||||
* A compiler barrier prevents the compiler from reordering reads and writes
|
||||
* to globally visible variables across the call.
|
||||
*
|
||||
* This macro only prevents the compiler from reordering reads and writes, it
|
||||
* does not prevent the CPU from reordering reads and writes. However, all of
|
||||
* the atomic operations that modify memory are full memory barriers.
|
||||
*
|
||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
||||
* time, but if you find yourself needing this, you are probably
|
||||
* dealing with some very sensitive code; be careful!
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier()
|
||||
|
||||
#elif defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
|
||||
void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||
#elif (defined(__GNUC__) && !defined(SDL_PLATFORM_EMSCRIPTEN)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
||||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||
#elif defined(__WATCOMC__)
|
||||
extern __inline void SDL_CompilerBarrier(void);
|
||||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
||||
#else
|
||||
#define SDL_CompilerBarrier() \
|
||||
{ SDL_SpinLock _tmp = 0; SDL_LockSpinlock(&_tmp); SDL_UnlockSpinlock(&_tmp); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Insert a memory release barrier (function version).
|
||||
*
|
||||
* Please refer to SDL_MemoryBarrierRelease for details. This is a function
|
||||
* version, which might be useful if you need to use this functionality from a
|
||||
* scripting language, etc. Also, some of the macro versions call this
|
||||
* function behind the scenes, where more heavy lifting can happen inside of
|
||||
* SDL. Generally, though, an app written in C/C++/etc should use the macro
|
||||
* version, as it will be more efficient.
|
||||
*
|
||||
* \threadsafety Obviously this function is safe to use from any thread at any
|
||||
* time, but if you find yourself needing this, you are probably
|
||||
* dealing with some very sensitive code; be careful!
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_MemoryBarrierRelease
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
||||
|
||||
/**
|
||||
* Insert a memory acquire barrier (function version).
|
||||
*
|
||||
* Please refer to SDL_MemoryBarrierRelease for details. This is a function
|
||||
* version, which might be useful if you need to use this functionality from a
|
||||
* scripting language, etc. Also, some of the macro versions call this
|
||||
* function behind the scenes, where more heavy lifting can happen inside of
|
||||
* SDL. Generally, though, an app written in C/C++/etc should use the macro
|
||||
* version, as it will be more efficient.
|
||||
*
|
||||
* \threadsafety Obviously this function is safe to use from any thread at any
|
||||
* time, but if you find yourself needing this, you are probably
|
||||
* dealing with some very sensitive code; be careful!
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_MemoryBarrierAcquire
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Insert a memory release barrier (macro version).
|
||||
*
|
||||
* Memory barriers are designed to prevent reads and writes from being
|
||||
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
||||
*
|
||||
* A typical pattern would be for thread A to write some data and a flag, and
|
||||
* for thread B to read the flag and get the data. In this case you would
|
||||
* insert a release barrier between writing the data and the flag,
|
||||
* guaranteeing that the data write completes no later than the flag is
|
||||
* written, and you would insert an acquire barrier between reading the flag
|
||||
* and reading the data, to ensure that all the reads associated with the flag
|
||||
* have completed.
|
||||
*
|
||||
* In this pattern you should always see a release barrier paired with an
|
||||
* acquire barrier and you should gate the data reads/writes with a single
|
||||
* flag variable.
|
||||
*
|
||||
* For more information on these semantics, take a look at the blog post:
|
||||
* http://preshing.com/20120913/acquire-and-release-semantics
|
||||
*
|
||||
* This is the macro version of this functionality; if possible, SDL will use
|
||||
* compiler intrinsics or inline assembly, but some platforms might need to
|
||||
* call the function version of this, SDL_MemoryBarrierReleaseFunction to do
|
||||
* the heavy lifting. Apps that can use the macro should favor it over the
|
||||
* function.
|
||||
*
|
||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
||||
* time, but if you find yourself needing this, you are probably
|
||||
* dealing with some very sensitive code; be careful!
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_MemoryBarrierAcquire
|
||||
* \sa SDL_MemoryBarrierReleaseFunction
|
||||
*/
|
||||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
|
||||
|
||||
/**
|
||||
* Insert a memory acquire barrier (macro version).
|
||||
*
|
||||
* Please see SDL_MemoryBarrierRelease for the details on what memory barriers
|
||||
* are and when to use them.
|
||||
*
|
||||
* This is the macro version of this functionality; if possible, SDL will use
|
||||
* compiler intrinsics or inline assembly, but some platforms might need to
|
||||
* call the function version of this, SDL_MemoryBarrierAcquireFunction, to do
|
||||
* the heavy lifting. Apps that can use the macro should favor it over the
|
||||
* function.
|
||||
*
|
||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
||||
* time, but if you find yourself needing this, you are probably
|
||||
* dealing with some very sensitive code; be careful!
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_MemoryBarrierRelease
|
||||
* \sa SDL_MemoryBarrierAcquireFunction
|
||||
*/
|
||||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
|
||||
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#elif defined(__GNUC__) && defined(__arm__)
|
||||
#if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */
|
||||
/* Information from:
|
||||
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
|
||||
|
||||
The Linux kernel provides a helper function which provides the right code for a memory barrier,
|
||||
hard-coded at address 0xffff0fa0
|
||||
*/
|
||||
typedef void (*SDL_KernelMemoryBarrierFunc)();
|
||||
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||
#else
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
|
||||
#ifdef __thumb__
|
||||
/* The mcr instruction isn't available in thumb mode, use real functions */
|
||||
#define SDL_MEMORY_BARRIER_USES_FUNCTION
|
||||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
|
||||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#endif /* __thumb__ */
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
|
||||
#endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_ANDROID */
|
||||
#endif /* __GNUC__ && __arm__ */
|
||||
#else
|
||||
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
|
||||
#include <mbarrier.h>
|
||||
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
|
||||
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
|
||||
#else
|
||||
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
|
||||
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
|
||||
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro to insert a CPU-specific "pause" instruction into the program.
|
||||
*
|
||||
* This can be useful in busy-wait loops, as it serves as a hint to the CPU as
|
||||
* to the program's intent; some CPUs can use this to do more efficient
|
||||
* processing. On some platforms, this doesn't do anything, so using this
|
||||
* macro might just be a harmless no-op.
|
||||
*
|
||||
* Note that if you are busy-waiting, there are often more-efficient
|
||||
* approaches with other synchronization primitives: mutexes, semaphores,
|
||||
* condition variables, etc.
|
||||
*
|
||||
* \threadsafety This macro is safe to use from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_CPUPauseInstruction() DoACPUPauseInACompilerAndArchitectureSpecificWay
|
||||
|
||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
|
||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
|
||||
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
|
||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
|
||||
#elif (defined(__powerpc__) || defined(__powerpc64__))
|
||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
|
||||
#elif (defined(__riscv) && __riscv_xlen == 64)
|
||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__(".insn i 0x0F, 0, x0, x0, 0x010");
|
||||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
|
||||
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
|
||||
#define SDL_CPUPauseInstruction() __yield()
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline void SDL_CPUPauseInstruction(void);
|
||||
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
|
||||
#else
|
||||
#define SDL_CPUPauseInstruction()
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* A type representing an atomic integer value.
|
||||
*
|
||||
* This can be used to manage a value that is synchronized across multiple
|
||||
* CPUs without a race condition; when an app sets a value with
|
||||
* SDL_SetAtomicInt all other threads, regardless of the CPU it is running on,
|
||||
* will see that value when retrieved with SDL_GetAtomicInt, regardless of CPU
|
||||
* caches, etc.
|
||||
*
|
||||
* This is also useful for atomic compare-and-swap operations: a thread can
|
||||
* change the value as long as its current value matches expectations. When
|
||||
* done in a loop, one can guarantee data consistency across threads without a
|
||||
* lock (but the usual warnings apply: if you don't know what you're doing, or
|
||||
* you don't do it carefully, you can confidently cause any number of
|
||||
* disasters with this, so in most cases, you _should_ use a mutex instead of
|
||||
* this!).
|
||||
*
|
||||
* This is a struct so people don't accidentally use numeric operations on it
|
||||
* directly. You have to use SDL atomic functions.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CompareAndSwapAtomicInt
|
||||
* \sa SDL_GetAtomicInt
|
||||
* \sa SDL_SetAtomicInt
|
||||
* \sa SDL_AddAtomicInt
|
||||
*/
|
||||
typedef struct SDL_AtomicInt { int value; } SDL_AtomicInt;
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a new value if it is currently an old value.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
||||
* \param oldval the old value.
|
||||
* \param newval the new value.
|
||||
* \returns true if the atomic variable was set, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAtomicInt
|
||||
* \sa SDL_SetAtomicInt
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, int oldval, int newval);
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a value.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
||||
* \param v the desired value.
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAtomicInt
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetAtomicInt(SDL_AtomicInt *a, int v);
|
||||
|
||||
/**
|
||||
* Get the value of an atomic variable.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt variable.
|
||||
* \returns the current value of an atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAtomicInt
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetAtomicInt(SDL_AtomicInt *a);
|
||||
|
||||
/**
|
||||
* Add to an atomic variable.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
||||
* \param v the desired value to add.
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AtomicDecRef
|
||||
* \sa SDL_AtomicIncRef
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v);
|
||||
|
||||
#ifndef SDL_AtomicIncRef
|
||||
|
||||
/**
|
||||
* Increment an atomic variable used as a reference count.
|
||||
*
|
||||
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt to increment.
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AtomicDecRef
|
||||
*/
|
||||
#define SDL_AtomicIncRef(a) SDL_AddAtomicInt(a, 1)
|
||||
#endif
|
||||
|
||||
#ifndef SDL_AtomicDecRef
|
||||
|
||||
/**
|
||||
* Decrement an atomic variable used as a reference count.
|
||||
*
|
||||
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicInt to decrement.
|
||||
* \returns true if the variable reached zero after decrementing, false
|
||||
* otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AtomicIncRef
|
||||
*/
|
||||
#define SDL_AtomicDecRef(a) (SDL_AddAtomicInt(a, -1) == 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A type representing an atomic unsigned 32-bit value.
|
||||
*
|
||||
* This can be used to manage a value that is synchronized across multiple
|
||||
* CPUs without a race condition; when an app sets a value with
|
||||
* SDL_SetAtomicU32 all other threads, regardless of the CPU it is running on,
|
||||
* will see that value when retrieved with SDL_GetAtomicU32, regardless of CPU
|
||||
* caches, etc.
|
||||
*
|
||||
* This is also useful for atomic compare-and-swap operations: a thread can
|
||||
* change the value as long as its current value matches expectations. When
|
||||
* done in a loop, one can guarantee data consistency across threads without a
|
||||
* lock (but the usual warnings apply: if you don't know what you're doing, or
|
||||
* you don't do it carefully, you can confidently cause any number of
|
||||
* disasters with this, so in most cases, you _should_ use a mutex instead of
|
||||
* this!).
|
||||
*
|
||||
* This is a struct so people don't accidentally use numeric operations on it
|
||||
* directly. You have to use SDL atomic functions.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CompareAndSwapAtomicU32
|
||||
* \sa SDL_GetAtomicU32
|
||||
* \sa SDL_SetAtomicU32
|
||||
*/
|
||||
typedef struct SDL_AtomicU32 { Uint32 value; } SDL_AtomicU32;
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a new value if it is currently an old value.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicU32 variable to be modified.
|
||||
* \param oldval the old value.
|
||||
* \param newval the new value.
|
||||
* \returns true if the atomic variable was set, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAtomicU32
|
||||
* \sa SDL_SetAtomicU32
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval);
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a value.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicU32 variable to be modified.
|
||||
* \param v the desired value.
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAtomicU32
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v);
|
||||
|
||||
/**
|
||||
* Get the value of an atomic variable.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicU32 variable.
|
||||
* \returns the current value of an atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAtomicU32
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAtomicU32(SDL_AtomicU32 *a);
|
||||
|
||||
/**
|
||||
* Add to an atomic variable.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_AtomicU32 variable to be modified.
|
||||
* \param v the desired value to add or subtract.
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.4.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_AddAtomicU32(SDL_AtomicU32 *a, int v);
|
||||
|
||||
/**
|
||||
* Set a pointer to a new value if it is currently an old value.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer.
|
||||
* \param oldval the old pointer value.
|
||||
* \param newval the new pointer value.
|
||||
* \returns true if the pointer was set, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CompareAndSwapAtomicInt
|
||||
* \sa SDL_GetAtomicPointer
|
||||
* \sa SDL_SetAtomicPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicPointer(void **a, void *oldval, void *newval);
|
||||
|
||||
/**
|
||||
* Set a pointer to a value atomically.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer.
|
||||
* \param v the desired pointer value.
|
||||
* \returns the previous value of the pointer.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CompareAndSwapAtomicPointer
|
||||
* \sa SDL_GetAtomicPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_SetAtomicPointer(void **a, void *v);
|
||||
|
||||
/**
|
||||
* Get the value of a pointer atomically.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer.
|
||||
* \returns the current value of a pointer.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_CompareAndSwapAtomicPointer
|
||||
* \sa SDL_SetAtomicPointer
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_GetAtomicPointer(void **a);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_atomic_h_ */
|
||||
@@ -0,0 +1,553 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: BeginCode */
|
||||
|
||||
/**
|
||||
* # CategoryBeginCode
|
||||
*
|
||||
* `SDL_begin_code.h` sets things up for C dynamic library function
|
||||
* definitions, static inlined functions, and structures aligned at 4-byte
|
||||
* alignment. If you don't like ugly C preprocessor code, don't look at this
|
||||
* file. :)
|
||||
*
|
||||
* SDL's headers use this; applications generally should not include this
|
||||
* header directly.
|
||||
*/
|
||||
|
||||
/* This shouldn't be nested -- included it around code only. */
|
||||
#ifdef SDL_begin_code_h
|
||||
#error Nested inclusion of SDL_begin_code.h
|
||||
#endif
|
||||
#define SDL_begin_code_h
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro to tag a symbol as deprecated.
|
||||
*
|
||||
* A function is marked deprecated by adding this macro to its declaration:
|
||||
*
|
||||
* ```c
|
||||
* extern SDL_DEPRECATED int ThisFunctionWasABadIdea(void);
|
||||
* ```
|
||||
*
|
||||
* Compilers with deprecation support can give a warning when a deprecated
|
||||
* function is used. This symbol may be used in SDL's headers, but apps are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* SDL, on occasion, might deprecate a function for various reasons. However,
|
||||
* SDL never removes symbols before major versions, so deprecated interfaces
|
||||
* in SDL3 will remain available until SDL4, where it would be expected an app
|
||||
* would have to take steps to migrate anyhow.
|
||||
*
|
||||
* On compilers without a deprecation mechanism, this is defined to nothing,
|
||||
* and using a deprecated function will not generate a warning.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_DEPRECATED __attribute__((deprecated))
|
||||
|
||||
/**
|
||||
* A macro to tag a symbol as a public API.
|
||||
*
|
||||
* SDL uses this macro for all its public functions. On some targets, it is
|
||||
* used to signal to the compiler that this function needs to be exported from
|
||||
* a shared library, but it might have other side effects.
|
||||
*
|
||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_DECLSPEC __attribute__ ((visibility("default")))
|
||||
|
||||
/**
|
||||
* A macro to set a function's calling conventions.
|
||||
*
|
||||
* SDL uses this macro for all its public functions, and any callbacks it
|
||||
* defines. This macro guarantees that calling conventions match between SDL
|
||||
* and the app, even if the two were built with different compilers or
|
||||
* optimization settings.
|
||||
*
|
||||
* When writing a callback function, it is very important for it to be
|
||||
* correctly tagged with SDLCALL, as mismatched calling conventions can cause
|
||||
* strange behaviors and can be difficult to diagnose. Plus, on many
|
||||
* platforms, SDLCALL is defined to nothing, so compilers won't be able to
|
||||
* warn that the tag is missing.
|
||||
*
|
||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDLCALL __cdecl
|
||||
|
||||
/**
|
||||
* A macro to request a function be inlined.
|
||||
*
|
||||
* This is a hint to the compiler to inline a function. The compiler is free
|
||||
* to ignore this request. On compilers without inline support, this is
|
||||
* defined to nothing.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_INLINE __inline
|
||||
|
||||
/**
|
||||
* A macro to demand a function be inlined.
|
||||
*
|
||||
* This is a command to the compiler to inline a function. SDL uses this macro
|
||||
* in its public headers for a handful of simple functions. On compilers
|
||||
* without forceinline support, this is defined to `static SDL_INLINE`, which
|
||||
* is often good enough.
|
||||
*
|
||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_FORCE_INLINE __forceinline
|
||||
|
||||
/**
|
||||
* A macro to tag a function as never-returning.
|
||||
*
|
||||
* This is a hint to the compiler that a function does not return. An example
|
||||
* of a function like this is the C runtime's exit() function.
|
||||
*
|
||||
* This hint can lead to code optimizations, and help analyzers understand
|
||||
* code flow better. On compilers without noreturn support, this is defined to
|
||||
* nothing.
|
||||
*
|
||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_NORETURN __attribute__((noreturn))
|
||||
|
||||
/**
|
||||
* A macro to tag a function as never-returning (for analysis purposes).
|
||||
*
|
||||
* This is almost identical to SDL_NORETURN, except functions marked with this
|
||||
* _can_ actually return. The difference is that this isn't used for code
|
||||
* generation, but rather static analyzers use this information to assume
|
||||
* truths about program state and available code paths. Specifically, this tag
|
||||
* is useful for writing an assertion mechanism. Indeed, SDL_assert uses this
|
||||
* tag behind the scenes. Generally, apps that don't understand the specific
|
||||
* use-case for this tag should avoid using it directly.
|
||||
*
|
||||
* On compilers without analyzer_noreturn support, this is defined to nothing.
|
||||
*
|
||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
||||
|
||||
|
||||
/**
|
||||
* A macro to signal that a case statement without a `break` is intentional.
|
||||
*
|
||||
* C compilers have gotten more aggressive about warning when a switch's
|
||||
* `case` block does not end with a `break` or other flow control statement,
|
||||
* flowing into the next case's code, as this is a common accident that leads
|
||||
* to strange bugs. But sometimes falling through to the next case is the
|
||||
* correct and desired behavior. This symbol lets an app communicate this
|
||||
* intention to the compiler, so it doesn't generate a warning.
|
||||
*
|
||||
* It is used like this:
|
||||
*
|
||||
* ```c
|
||||
* switch (x) {
|
||||
* case 1:
|
||||
* DoSomethingOnlyForOne();
|
||||
* SDL_FALLTHROUGH; // tell the compiler this was intentional.
|
||||
* case 2:
|
||||
* DoSomethingForOneAndTwo();
|
||||
* break;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_FALLTHROUGH [[fallthrough]]
|
||||
|
||||
/**
|
||||
* A macro to tag a function's return value as critical.
|
||||
*
|
||||
* This is a hint to the compiler that a function's return value should not be
|
||||
* ignored.
|
||||
*
|
||||
* If an NODISCARD function's return value is thrown away (the function is
|
||||
* called as if it returns `void`), the compiler will issue a warning.
|
||||
*
|
||||
* While it's generally good practice to check return values for errors, often
|
||||
* times legitimate programs do not for good reasons. Be careful about what
|
||||
* functions are tagged as NODISCARD. It operates best when used on a function
|
||||
* that's failure is surprising and catastrophic; a good example would be a
|
||||
* program that checks the return values of all its file write function calls
|
||||
* but not the call to close the file, which it assumes incorrectly never
|
||||
* fails.
|
||||
*
|
||||
* Function callers that want to throw away a NODISCARD return value can call
|
||||
* the function with a `(void)` cast, which informs the compiler the act is
|
||||
* intentional.
|
||||
*
|
||||
* On compilers without nodiscard support, this is defined to nothing.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_NODISCARD [[nodiscard]]
|
||||
|
||||
/**
|
||||
* A macro to tag a function as an allocator.
|
||||
*
|
||||
* This is a hint to the compiler that a function is an allocator, like
|
||||
* malloc(), with certain rules. A description of how GCC treats this hint is
|
||||
* here:
|
||||
*
|
||||
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute
|
||||
*
|
||||
* On compilers without allocator tag support, this is defined to nothing.
|
||||
*
|
||||
* Most apps don't need to, and should not, use this directly.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
|
||||
|
||||
/**
|
||||
* A macro to tag a function as returning a certain allocation.
|
||||
*
|
||||
* This is a hint to the compiler that a function allocates and returns a
|
||||
* specific amount of memory based on one of its arguments. For example, the C
|
||||
* runtime's malloc() function could use this macro with an argument of 1
|
||||
* (first argument to malloc is the size of the allocation).
|
||||
*
|
||||
* On compilers without alloc_size support, this is defined to nothing.
|
||||
*
|
||||
* Most apps don't need to, and should not, use this directly.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
|
||||
|
||||
/**
|
||||
* A macro to tag a pointer variable, to help with pointer aliasing.
|
||||
*
|
||||
* A good explanation of the restrict keyword is here:
|
||||
*
|
||||
* https://en.wikipedia.org/wiki/Restrict
|
||||
*
|
||||
* On compilers without restrict support, this is defined to nothing.
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*/
|
||||
#define SDL_RESTRICT __restrict
|
||||
|
||||
/**
|
||||
* Check if the compiler supports a given builtin functionality.
|
||||
*
|
||||
* This allows preprocessor checks for things that otherwise might fail to
|
||||
* compile.
|
||||
*
|
||||
* Supported by virtually all clang versions and more-recent GCCs. Use this
|
||||
* instead of checking the clang version if possible.
|
||||
*
|
||||
* On compilers without has_builtin support, this is defined to 0 (always
|
||||
* false).
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_HAS_BUILTIN(x) __has_builtin(x)
|
||||
|
||||
/**
|
||||
* A macro to specify data alignment.
|
||||
*
|
||||
* This informs the compiler that a given datatype or variable must be aligned
|
||||
* to a specific byte count.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* ```c
|
||||
* // make sure this is struct is aligned to 16 bytes for SIMD access.
|
||||
* typedef struct {
|
||||
* float x, y, z, w;
|
||||
* } SDL_ALIGNED(16) MySIMDAlignedData;
|
||||
*
|
||||
* // make sure this one field in a struct is aligned to 16 bytes for SIMD access.
|
||||
* typedef struct {
|
||||
* SomeStuff stuff;
|
||||
* float SDL_ALIGNED(16) position[4];
|
||||
* SomeOtherStuff other_stuff;
|
||||
* } MyStruct;
|
||||
*
|
||||
* // make sure this variable is aligned to 32 bytes.
|
||||
* int SDL_ALIGNED(32) myval = 0;
|
||||
* ```
|
||||
*
|
||||
* Alignment is only guaranteed for things the compiler places: local
|
||||
* variables on the stack and global/static variables. To dynamically allocate
|
||||
* something that respects this alignment, use SDL_aligned_alloc() or some
|
||||
* other mechanism.
|
||||
*
|
||||
* On compilers without alignment support, this macro is defined to an invalid
|
||||
* symbol, to make it clear that the current compiler is likely to generate
|
||||
* incorrect code when it sees this macro.
|
||||
*
|
||||
* \param x the byte count to align to, so the data's address will be a
|
||||
* multiple of this value.
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*/
|
||||
#define SDL_ALIGNED(x) __attribute__((aligned(x)))
|
||||
|
||||
/* end of wiki documentation section. */
|
||||
#endif
|
||||
|
||||
/* `restrict` is from C99, but __restrict works with both Visual Studio and GCC. */
|
||||
#ifndef SDL_RESTRICT
|
||||
# if defined(restrict) || ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
|
||||
# define SDL_RESTRICT restrict
|
||||
# elif defined(_MSC_VER) || defined(__GNUC__) || defined(__clang__)
|
||||
# define SDL_RESTRICT __restrict
|
||||
# else
|
||||
# define SDL_RESTRICT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_HAS_BUILTIN
|
||||
#ifdef __has_builtin
|
||||
#define SDL_HAS_BUILTIN(x) __has_builtin(x)
|
||||
#else
|
||||
#define SDL_HAS_BUILTIN(x) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_DEPRECATED
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
||||
# define SDL_DEPRECATED __attribute__((deprecated))
|
||||
# elif defined(_MSC_VER)
|
||||
# define SDL_DEPRECATED __declspec(deprecated)
|
||||
# else
|
||||
# define SDL_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_UNUSED
|
||||
# ifdef __GNUC__
|
||||
# define SDL_UNUSED __attribute__((unused))
|
||||
# else
|
||||
# define SDL_UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some compilers use a special export keyword */
|
||||
#ifndef SDL_DECLSPEC
|
||||
# if defined(SDL_PLATFORM_WINDOWS)
|
||||
# ifdef DLL_EXPORT
|
||||
# define SDL_DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define SDL_DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define SDL_DECLSPEC __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SDL_DECLSPEC
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* By default SDL uses the C calling convention */
|
||||
#ifndef SDLCALL
|
||||
#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
|
||||
#define SDLCALL __cdecl
|
||||
#else
|
||||
#define SDLCALL
|
||||
#endif
|
||||
#endif /* SDLCALL */
|
||||
|
||||
/* Force structure packing at 4 byte alignment.
|
||||
This is necessary if the header is included in code which has structure
|
||||
packing set to an alternate value, say for loading structures from disk.
|
||||
The packing is reset to the previous value in SDL_close_code.h
|
||||
*/
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wpragma-pack"
|
||||
#endif
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
|
||||
#pragma pack(push,8)
|
||||
#else
|
||||
#pragma pack(push,4)
|
||||
#endif
|
||||
#endif /* Compiler needs structure packing set */
|
||||
|
||||
#ifndef SDL_INLINE
|
||||
#ifdef __GNUC__
|
||||
#define SDL_INLINE __inline__
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
|
||||
defined(__DMC__) || defined(__SC__) || \
|
||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__DECC) || defined(__CC_ARM)
|
||||
#define SDL_INLINE __inline
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#else
|
||||
#define SDL_INLINE inline
|
||||
#ifndef __inline__
|
||||
#define __inline__ inline
|
||||
#endif
|
||||
#endif
|
||||
#endif /* SDL_INLINE not defined */
|
||||
|
||||
#ifndef SDL_FORCE_INLINE
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
#define SDL_FORCE_INLINE __forceinline
|
||||
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
||||
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
|
||||
#else
|
||||
#define SDL_FORCE_INLINE static SDL_INLINE
|
||||
#endif
|
||||
#endif /* SDL_FORCE_INLINE not defined */
|
||||
|
||||
#ifndef SDL_NORETURN
|
||||
#if defined(__GNUC__)
|
||||
#define SDL_NORETURN __attribute__((noreturn))
|
||||
#elif defined(_MSC_VER)
|
||||
#define SDL_NORETURN __declspec(noreturn)
|
||||
#else
|
||||
#define SDL_NORETURN
|
||||
#endif
|
||||
#endif /* SDL_NORETURN not defined */
|
||||
|
||||
#ifdef __clang__
|
||||
#if __has_feature(attribute_analyzer_noreturn)
|
||||
#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_ANALYZER_NORETURN
|
||||
#define SDL_ANALYZER_NORETURN
|
||||
#endif
|
||||
|
||||
/* Apparently this is needed by several Windows compilers */
|
||||
#ifndef __MACH__
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif /* NULL */
|
||||
#endif /* ! macOS - breaks precompiled headers */
|
||||
|
||||
#ifndef SDL_FALLTHROUGH
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
|
||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
|
||||
#define SDL_FALLTHROUGH [[fallthrough]]
|
||||
#else
|
||||
#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
|
||||
#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
|
||||
#else
|
||||
#define SDL_HAS_FALLTHROUGH 0
|
||||
#endif /* __has_attribute */
|
||||
#if SDL_HAS_FALLTHROUGH && \
|
||||
((defined(__GNUC__) && __GNUC__ >= 7) || \
|
||||
(defined(__clang_major__) && __clang_major__ >= 10))
|
||||
#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
|
||||
#else
|
||||
#define SDL_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||
#endif /* SDL_HAS_FALLTHROUGH */
|
||||
#undef SDL_HAS_FALLTHROUGH
|
||||
#endif /* C++17 or C2x */
|
||||
#endif /* SDL_FALLTHROUGH not defined */
|
||||
|
||||
#ifndef SDL_NODISCARD
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
|
||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
|
||||
#define SDL_NODISCARD [[nodiscard]]
|
||||
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
||||
#define SDL_NODISCARD __attribute__((warn_unused_result))
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
|
||||
#define SDL_NODISCARD _Check_return_
|
||||
#else
|
||||
#define SDL_NODISCARD
|
||||
#endif /* C++17 or C23 */
|
||||
#endif /* SDL_NODISCARD not defined */
|
||||
|
||||
#ifndef SDL_MALLOC
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define SDL_MALLOC __attribute__((malloc))
|
||||
/** FIXME
|
||||
#elif defined(_MSC_VER)
|
||||
#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
|
||||
**/
|
||||
#else
|
||||
#define SDL_MALLOC
|
||||
#endif
|
||||
#endif /* SDL_MALLOC not defined */
|
||||
|
||||
#ifndef SDL_ALLOC_SIZE
|
||||
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
||||
#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define SDL_ALLOC_SIZE(p)
|
||||
#else
|
||||
#define SDL_ALLOC_SIZE(p)
|
||||
#endif
|
||||
#endif /* SDL_ALLOC_SIZE not defined */
|
||||
|
||||
#ifndef SDL_ALLOC_SIZE2
|
||||
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
||||
#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define SDL_ALLOC_SIZE2(p1, p2)
|
||||
#else
|
||||
#define SDL_ALLOC_SIZE2(p1, p2)
|
||||
#endif
|
||||
#endif /* SDL_ALLOC_SIZE2 not defined */
|
||||
|
||||
#ifndef SDL_ALIGNED
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#define SDL_ALIGNED(x) __attribute__((aligned(x)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define SDL_ALIGNED(x) __declspec(align(x))
|
||||
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#define SDL_ALIGNED(x) alignas(x)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
#define SDL_ALIGNED(x) _Alignas(x)
|
||||
#else
|
||||
#define SDL_ALIGNED(x) PLEASE_DEFINE_SDL_ALIGNED
|
||||
#endif
|
||||
#endif /* SDL_ALIGNED not defined */
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryBits
|
||||
*
|
||||
* Functions for fiddling with bits and bitmasks.
|
||||
*/
|
||||
|
||||
#ifndef SDL_bits_h_
|
||||
#define SDL_bits_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline int _SDL_bsr_watcom(Uint32);
|
||||
#pragma aux _SDL_bsr_watcom = \
|
||||
"bsr eax, eax" \
|
||||
parm [eax] nomemory \
|
||||
value [eax] \
|
||||
modify exact [eax] nomemory;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the index of the most significant (set) bit in a 32-bit number.
|
||||
*
|
||||
* Result is undefined when called with 0. This operation can also be stated
|
||||
* as "count leading zeroes" and "log base 2".
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the 32-bit value to examine.
|
||||
* \returns the index of the most significant bit, or -1 if the value is 0.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
|
||||
{
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
/* Count Leading Zeroes builtin in GCC.
|
||||
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
||||
*/
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
return 31 - __builtin_clz(x);
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
return _SDL_bsr_watcom(x);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
unsigned long index;
|
||||
if (_BitScanReverse(&index, x)) {
|
||||
return (int)index;
|
||||
}
|
||||
return -1;
|
||||
#else
|
||||
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
||||
* <seander@cs.stanford.edu>, released in the public domain.
|
||||
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
||||
*/
|
||||
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
|
||||
const int S[] = {1, 2, 4, 8, 16};
|
||||
|
||||
int msbIndex = 0;
|
||||
int i;
|
||||
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 4; i >= 0; i--)
|
||||
{
|
||||
if (x & b[i])
|
||||
{
|
||||
x >>= S[i];
|
||||
msbIndex |= S[i];
|
||||
}
|
||||
}
|
||||
|
||||
return msbIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a unsigned 32-bit value has exactly one bit set.
|
||||
*
|
||||
* If there are no bits set (`x` is zero), or more than one bit set, this
|
||||
* returns false. If any one bit is exclusively set, this returns true.
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the 32-bit value to examine.
|
||||
* \returns true if exactly one bit is set in `x`, false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x)
|
||||
{
|
||||
if (x && !(x & (x - 1))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_bits_h_ */
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryBlendmode
|
||||
*
|
||||
* Blend modes decide how two colors will mix together. There are both
|
||||
* standard modes for basic needs and a means to create custom modes,
|
||||
* dictating what sort of math to do on what color components.
|
||||
*/
|
||||
|
||||
#ifndef SDL_blendmode_h_
|
||||
#define SDL_blendmode_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A set of blend modes used in drawing operations.
|
||||
*
|
||||
* These predefined blend modes are supported everywhere.
|
||||
*
|
||||
* Additional values may be obtained from SDL_ComposeCustomBlendMode.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ComposeCustomBlendMode
|
||||
*/
|
||||
typedef Uint32 SDL_BlendMode;
|
||||
|
||||
#define SDL_BLENDMODE_NONE 0x00000000u /**< no blending: dstRGBA = srcRGBA */
|
||||
#define SDL_BLENDMODE_BLEND 0x00000001u /**< alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) */
|
||||
#define SDL_BLENDMODE_BLEND_PREMULTIPLIED 0x00000010u /**< pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) */
|
||||
#define SDL_BLENDMODE_ADD 0x00000002u /**< additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA */
|
||||
#define SDL_BLENDMODE_ADD_PREMULTIPLIED 0x00000020u /**< pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA */
|
||||
#define SDL_BLENDMODE_MOD 0x00000004u /**< color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA */
|
||||
#define SDL_BLENDMODE_MUL 0x00000008u /**< color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA */
|
||||
#define SDL_BLENDMODE_INVALID 0x7FFFFFFFu
|
||||
|
||||
/**
|
||||
* The blend operation used when combining source and destination pixel
|
||||
* components.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_BlendOperation
|
||||
{
|
||||
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
|
||||
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
||||
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
||||
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
||||
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
||||
} SDL_BlendOperation;
|
||||
|
||||
/**
|
||||
* The normalized factor used to multiply pixel components.
|
||||
*
|
||||
* The blend factors are multiplied with the pixels from a drawing operation
|
||||
* (src) and the pixels from the render target (dst) before the blend
|
||||
* operation. The comma-separated factors listed above are always applied in
|
||||
* the component order red, green, blue, and alpha.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_BlendFactor
|
||||
{
|
||||
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
|
||||
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
|
||||
SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
|
||||
SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
|
||||
SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
|
||||
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
|
||||
} SDL_BlendFactor;
|
||||
|
||||
/**
|
||||
* Compose a custom blend mode for renderers.
|
||||
*
|
||||
* The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept
|
||||
* the SDL_BlendMode returned by this function if the renderer supports it.
|
||||
*
|
||||
* A blend mode controls how the pixels from a drawing operation (source) get
|
||||
* combined with the pixels from the render target (destination). First, the
|
||||
* components of the source and destination pixels get multiplied with their
|
||||
* blend factors. Then, the blend operation takes the two products and
|
||||
* calculates the result that will get stored in the render target.
|
||||
*
|
||||
* Expressed in pseudocode, it would look like this:
|
||||
*
|
||||
* ```c
|
||||
* dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor);
|
||||
* dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor);
|
||||
* ```
|
||||
*
|
||||
* Where the functions `colorOperation(src, dst)` and `alphaOperation(src,
|
||||
* dst)` can return one of the following:
|
||||
*
|
||||
* - `src + dst`
|
||||
* - `src - dst`
|
||||
* - `dst - src`
|
||||
* - `min(src, dst)`
|
||||
* - `max(src, dst)`
|
||||
*
|
||||
* The red, green, and blue components are always multiplied with the first,
|
||||
* second, and third components of the SDL_BlendFactor, respectively. The
|
||||
* fourth component is not used.
|
||||
*
|
||||
* The alpha component is always multiplied with the fourth component of the
|
||||
* SDL_BlendFactor. The other components are not used in the alpha
|
||||
* calculation.
|
||||
*
|
||||
* Support for these blend modes varies for each renderer. To check if a
|
||||
* specific SDL_BlendMode is supported, create a renderer and pass it to
|
||||
* either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will
|
||||
* return with an error if the blend mode is not supported.
|
||||
*
|
||||
* This list describes the support of custom blend modes for each renderer.
|
||||
* All renderers support the four blend modes listed in the SDL_BlendMode
|
||||
* enumeration.
|
||||
*
|
||||
* - **direct3d**: Supports all operations with all factors. However, some
|
||||
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
|
||||
* `SDL_BLENDOPERATION_MAXIMUM`.
|
||||
* - **direct3d11**: Same as Direct3D 9.
|
||||
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
||||
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly here.
|
||||
* - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`,
|
||||
* `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT`
|
||||
* operations with all factors.
|
||||
* - **psp**: No custom blend mode support.
|
||||
* - **software**: No custom blend mode support.
|
||||
*
|
||||
* Some renderers do not provide an alpha component for the default render
|
||||
* target. The `SDL_BLENDFACTOR_DST_ALPHA` and
|
||||
* `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this
|
||||
* case.
|
||||
*
|
||||
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
|
||||
* blue components of the source pixels.
|
||||
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
|
||||
* blue components of the destination pixels.
|
||||
* \param colorOperation the SDL_BlendOperation used to combine the red,
|
||||
* green, and blue components of the source and
|
||||
* destination pixels.
|
||||
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
||||
* the source pixels.
|
||||
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
||||
* the destination pixels.
|
||||
* \param alphaOperation the SDL_BlendOperation used to combine the alpha
|
||||
* component of the source and destination pixels.
|
||||
* \returns an SDL_BlendMode that represents the chosen factors and
|
||||
* operations.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetRenderDrawBlendMode
|
||||
* \sa SDL_GetRenderDrawBlendMode
|
||||
* \sa SDL_SetTextureBlendMode
|
||||
* \sa SDL_GetTextureBlendMode
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
|
||||
SDL_BlendFactor dstColorFactor,
|
||||
SDL_BlendOperation colorOperation,
|
||||
SDL_BlendFactor srcAlphaFactor,
|
||||
SDL_BlendFactor dstAlphaFactor,
|
||||
SDL_BlendOperation alphaOperation);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_blendmode_h_ */
|
||||
@@ -0,0 +1,535 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryCamera
|
||||
*
|
||||
* Video capture for the SDL library.
|
||||
*
|
||||
* This API lets apps read input from video sources, like webcams. Camera
|
||||
* devices can be enumerated, queried, and opened. Once opened, it will
|
||||
* provide SDL_Surface objects as new frames of video come in. These surfaces
|
||||
* can be uploaded to an SDL_Texture or processed as pixels in memory.
|
||||
*
|
||||
* Several platforms will alert the user if an app tries to access a camera,
|
||||
* and some will present a UI asking the user if your application should be
|
||||
* allowed to obtain images at all, which they can deny. A successfully opened
|
||||
* camera will not provide images until permission is granted. Applications,
|
||||
* after opening a camera device, can see if they were granted access by
|
||||
* either polling with the SDL_GetCameraPermissionState() function, or waiting
|
||||
* for an SDL_EVENT_CAMERA_DEVICE_APPROVED or SDL_EVENT_CAMERA_DEVICE_DENIED
|
||||
* event. Platforms that don't have any user approval process will report
|
||||
* approval immediately.
|
||||
*
|
||||
* Note that SDL cameras only provide video as individual frames; they will
|
||||
* not provide full-motion video encoded in a movie file format, although an
|
||||
* app is free to encode the acquired frames into any format it likes. It also
|
||||
* does not provide audio from the camera hardware through this API; not only
|
||||
* do many webcams not have microphones at all, many people--from streamers to
|
||||
* people on Zoom calls--will want to use a separate microphone regardless of
|
||||
* the camera. In any case, recorded audio will be available through SDL's
|
||||
* audio API no matter what hardware provides the microphone.
|
||||
*
|
||||
* ## Camera gotchas
|
||||
*
|
||||
* Consumer-level camera hardware tends to take a little while to warm up,
|
||||
* once the device has been opened. Generally most camera apps have some sort
|
||||
* of UI to take a picture (a button to snap a pic while a preview is showing,
|
||||
* some sort of multi-second countdown for the user to pose, like a photo
|
||||
* booth), which puts control in the users' hands, or they are intended to
|
||||
* stay on for long times (Pokemon Go, etc).
|
||||
*
|
||||
* It's not uncommon that a newly-opened camera will provide a couple of
|
||||
* completely black frames, maybe followed by some under-exposed images. If
|
||||
* taking a single frame automatically, or recording video from a camera's
|
||||
* input without the user initiating it from a preview, it could be wise to
|
||||
* drop the first several frames (if not the first several _seconds_ worth of
|
||||
* frames!) before using images from a camera.
|
||||
*/
|
||||
|
||||
#ifndef SDL_camera_h_
|
||||
#define SDL_camera_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_pixels.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_surface.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is a unique ID for a camera device for the time it is connected to the
|
||||
* system, and is never reused for the lifetime of the application.
|
||||
*
|
||||
* If the device is disconnected and reconnected, it will get a new ID.
|
||||
*
|
||||
* The value 0 is an invalid ID.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
*/
|
||||
typedef Uint32 SDL_CameraID;
|
||||
|
||||
/**
|
||||
* The opaque structure used to identify an opened SDL camera.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_Camera SDL_Camera;
|
||||
|
||||
/**
|
||||
* The details of an output format for a camera device.
|
||||
*
|
||||
* Cameras often support multiple formats; each one will be encapsulated in
|
||||
* this struct.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameraSupportedFormats
|
||||
* \sa SDL_GetCameraFormat
|
||||
*/
|
||||
typedef struct SDL_CameraSpec
|
||||
{
|
||||
SDL_PixelFormat format; /**< Frame format */
|
||||
SDL_Colorspace colorspace; /**< Frame colorspace */
|
||||
int width; /**< Frame width */
|
||||
int height; /**< Frame height */
|
||||
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
||||
int framerate_denominator; /**< Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
||||
} SDL_CameraSpec;
|
||||
|
||||
/**
|
||||
* The position of camera in relation to system device.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameraPosition
|
||||
*/
|
||||
typedef enum SDL_CameraPosition
|
||||
{
|
||||
SDL_CAMERA_POSITION_UNKNOWN,
|
||||
SDL_CAMERA_POSITION_FRONT_FACING,
|
||||
SDL_CAMERA_POSITION_BACK_FACING
|
||||
} SDL_CameraPosition;
|
||||
|
||||
/**
|
||||
* The current state of a request for camera access.
|
||||
*
|
||||
* \since This enum is available since SDL 3.4.0.
|
||||
*
|
||||
* \sa SDL_GetCameraPermissionState
|
||||
*/
|
||||
typedef enum SDL_CameraPermissionState
|
||||
{
|
||||
SDL_CAMERA_PERMISSION_STATE_DENIED = -1,
|
||||
SDL_CAMERA_PERMISSION_STATE_PENDING,
|
||||
SDL_CAMERA_PERMISSION_STATE_APPROVED,
|
||||
} SDL_CameraPermissionState;
|
||||
|
||||
|
||||
/**
|
||||
* Use this function to get the number of built-in camera drivers.
|
||||
*
|
||||
* This function returns a hardcoded number. This never returns a negative
|
||||
* value; if there are no drivers compiled into this build of SDL, this
|
||||
* function returns zero. The presence of a driver in this list does not mean
|
||||
* it will function, it just means SDL is capable of interacting with that
|
||||
* interface. For example, a build of SDL might have v4l2 support, but if
|
||||
* there's no kernel support available, SDL's v4l2 driver would fail if used.
|
||||
*
|
||||
* By default, SDL tries all drivers, in its preferred order, until one is
|
||||
* found to be usable.
|
||||
*
|
||||
* \returns the number of built-in camera drivers.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameraDriver
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void);
|
||||
|
||||
/**
|
||||
* Use this function to get the name of a built in camera driver.
|
||||
*
|
||||
* The list of camera drivers is given in the order that they are normally
|
||||
* initialized by default; the drivers that seem more reasonable to choose
|
||||
* first (as far as the SDL developers believe) are earlier in the list.
|
||||
*
|
||||
* The names of drivers are all simple, low-ASCII identifiers, like "v4l2",
|
||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
||||
* meant to be proper names.
|
||||
*
|
||||
* \param index the index of the camera driver; the value ranges from 0 to
|
||||
* SDL_GetNumCameraDrivers() - 1.
|
||||
* \returns the name of the camera driver at the requested index, or NULL if
|
||||
* an invalid index was specified.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetNumCameraDrivers
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index);
|
||||
|
||||
/**
|
||||
* Get the name of the current camera driver.
|
||||
*
|
||||
* The names of drivers are all simple, low-ASCII identifiers, like "v4l2",
|
||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
||||
* meant to be proper names.
|
||||
*
|
||||
* \returns the name of the current camera driver or NULL if no driver has
|
||||
* been initialized.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void);
|
||||
|
||||
/**
|
||||
* Get a list of currently connected camera devices.
|
||||
*
|
||||
* \param count a pointer filled in with the number of cameras returned, may
|
||||
* be NULL.
|
||||
* \returns a 0 terminated array of camera instance IDs or NULL on failure;
|
||||
* call SDL_GetError() for more information. This should be freed
|
||||
* with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
||||
|
||||
/**
|
||||
* Get the list of native formats/sizes a camera supports.
|
||||
*
|
||||
* This returns a list of all formats and frame sizes that a specific camera
|
||||
* can offer. This is useful if your app can accept a variety of image formats
|
||||
* and sizes and so want to find the optimal spec that doesn't require
|
||||
* conversion.
|
||||
*
|
||||
* This function isn't strictly required; if you call SDL_OpenCamera with a
|
||||
* NULL spec, SDL will choose a native format for you, and if you instead
|
||||
* specify a desired format, it will transparently convert to the requested
|
||||
* format on your behalf.
|
||||
*
|
||||
* If `count` is not NULL, it will be filled with the number of elements in
|
||||
* the returned array.
|
||||
*
|
||||
* Note that it's legal for a camera to supply an empty list. This is what
|
||||
* will happen on Emscripten builds, since that platform won't tell _anything_
|
||||
* about available cameras until you've opened one, and won't even tell if
|
||||
* there _is_ a camera until the user has given you permission to check
|
||||
* through a scary warning popup.
|
||||
*
|
||||
* \param instance_id the camera device instance ID.
|
||||
* \param count a pointer filled in with the number of elements in the list,
|
||||
* may be NULL.
|
||||
* \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on
|
||||
* failure; call SDL_GetError() for more information. This is a
|
||||
* single allocation that should be freed with SDL_free() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count);
|
||||
|
||||
/**
|
||||
* Get the human-readable device name for a camera.
|
||||
*
|
||||
* \param instance_id the camera device instance ID.
|
||||
* \returns a human-readable device name or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id);
|
||||
|
||||
/**
|
||||
* Get the position of the camera in relation to the system.
|
||||
*
|
||||
* Most platforms will report UNKNOWN, but mobile devices, like phones, can
|
||||
* often make a distinction between cameras on the front of the device (that
|
||||
* points towards the user, for taking "selfies") and cameras on the back (for
|
||||
* filming in the direction the user is facing).
|
||||
*
|
||||
* \param instance_id the camera device instance ID.
|
||||
* \returns the position of the camera on the system hardware.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_CameraPosition SDLCALL SDL_GetCameraPosition(SDL_CameraID instance_id);
|
||||
|
||||
/**
|
||||
* Open a video recording device (a "camera").
|
||||
*
|
||||
* You can open the device with any reasonable spec, and if the hardware can't
|
||||
* directly support it, it will convert data seamlessly to the requested
|
||||
* format. This might incur overhead, including scaling of image data.
|
||||
*
|
||||
* If you would rather accept whatever format the device offers, you can pass
|
||||
* a NULL spec here and it will choose one for you (and you can use
|
||||
* SDL_Surface's conversion/scaling functions directly if necessary).
|
||||
*
|
||||
* You can call SDL_GetCameraFormat() to get the actual data format if passing
|
||||
* a NULL spec here. You can see the exact specs a device can support without
|
||||
* conversion with SDL_GetCameraSupportedFormats().
|
||||
*
|
||||
* SDL will not attempt to emulate framerate; it will try to set the hardware
|
||||
* to the rate closest to the requested speed, but it won't attempt to limit
|
||||
* or duplicate frames artificially; call SDL_GetCameraFormat() to see the
|
||||
* actual framerate of the opened the device, and check your timestamps if
|
||||
* this is crucial to your app!
|
||||
*
|
||||
* Note that the camera is not usable until the user approves its use! On some
|
||||
* platforms, the operating system will prompt the user to permit access to
|
||||
* the camera, and they can choose Yes or No at that point. Until they do, the
|
||||
* camera will not be usable. The app should either wait for an
|
||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
|
||||
* or poll SDL_GetCameraPermissionState() occasionally until it returns
|
||||
* non-zero. On platforms that don't require explicit user approval (and
|
||||
* perhaps in places where the user previously permitted access), the approval
|
||||
* event might come immediately, but it might come seconds, minutes, or hours
|
||||
* later!
|
||||
*
|
||||
* \param instance_id the camera device instance ID.
|
||||
* \param spec the desired format for data the device will provide. Can be
|
||||
* NULL.
|
||||
* \returns an SDL_Camera object or NULL on failure; call SDL_GetError() for
|
||||
* more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
* \sa SDL_GetCameraFormat
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Camera * SDLCALL SDL_OpenCamera(SDL_CameraID instance_id, const SDL_CameraSpec *spec);
|
||||
|
||||
/**
|
||||
* Query if camera access has been approved by the user.
|
||||
*
|
||||
* Cameras will not function between when the device is opened by the app and
|
||||
* when the user permits access to the hardware. On some platforms, this
|
||||
* presents as a popup dialog where the user has to explicitly approve access;
|
||||
* on others the approval might be implicit and not alert the user at all.
|
||||
*
|
||||
* This function can be used to check the status of that approval. It will
|
||||
* return SDL_CAMERA_PERMISSION_STATE_PENDING if waiting for user response,
|
||||
* SDL_CAMERA_PERMISSION_STATE_APPROVED if the camera is approved for use, and
|
||||
* SDL_CAMERA_PERMISSION_STATE_DENIED if the user denied access.
|
||||
*
|
||||
* Instead of polling with this function, you can wait for a
|
||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event
|
||||
* in the standard SDL event loop, which is guaranteed to be sent once when
|
||||
* permission to use the camera is decided.
|
||||
*
|
||||
* If a camera is declined, there's nothing to be done but call
|
||||
* SDL_CloseCamera() to dispose of it.
|
||||
*
|
||||
* \param camera the opened camera device to query.
|
||||
* \returns an SDL_CameraPermissionState value indicating if access is
|
||||
* granted, or `SDL_CAMERA_PERMISSION_STATE_PENDING` if the decision
|
||||
* is still pending.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
* \sa SDL_CloseCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_CameraPermissionState SDLCALL SDL_GetCameraPermissionState(SDL_Camera *camera);
|
||||
|
||||
/**
|
||||
* Get the instance ID of an opened camera.
|
||||
*
|
||||
* \param camera an SDL_Camera to query.
|
||||
* \returns the instance ID of the specified camera on success or 0 on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_CameraID SDLCALL SDL_GetCameraID(SDL_Camera *camera);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an opened camera.
|
||||
*
|
||||
* \param camera the SDL_Camera obtained from SDL_OpenCamera().
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera *camera);
|
||||
|
||||
/**
|
||||
* Get the spec that a camera is using when generating images.
|
||||
*
|
||||
* Note that this might not be the native format of the hardware, as SDL might
|
||||
* be converting to this format behind the scenes.
|
||||
*
|
||||
* If the system is waiting for the user to approve access to the camera, as
|
||||
* some platforms require, this will return false, but this isn't necessarily
|
||||
* a fatal error; you should either wait for an
|
||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
|
||||
* or poll SDL_GetCameraPermissionState() occasionally until it returns
|
||||
* non-zero.
|
||||
*
|
||||
* \param camera opened camera device.
|
||||
* \param spec the SDL_CameraSpec to be initialized by this function.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
|
||||
|
||||
/**
|
||||
* Acquire a frame.
|
||||
*
|
||||
* The frame is a memory pointer to the image data, whose size and format are
|
||||
* given by the spec requested when opening the device.
|
||||
*
|
||||
* This is a non blocking API. If there is a frame available, a non-NULL
|
||||
* surface is returned, and timestampNS will be filled with a non-zero value.
|
||||
*
|
||||
* Note that an error case can also return NULL, but a NULL by itself is
|
||||
* normal and just signifies that a new frame is not yet available. Note that
|
||||
* even if a camera device fails outright (a USB camera is unplugged while in
|
||||
* use, etc), SDL will send an event separately to notify the app, but
|
||||
* continue to provide blank frames at ongoing intervals until
|
||||
* SDL_CloseCamera() is called, so real failure here is almost always an out
|
||||
* of memory condition.
|
||||
*
|
||||
* After use, the frame should be released with SDL_ReleaseCameraFrame(). If
|
||||
* you don't do this, the system may stop providing more video!
|
||||
*
|
||||
* Do not call SDL_DestroySurface() on the returned surface! It must be given
|
||||
* back to the camera subsystem with SDL_ReleaseCameraFrame!
|
||||
*
|
||||
* If the system is waiting for the user to approve access to the camera, as
|
||||
* some platforms require, this will return NULL (no frames available); you
|
||||
* should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED (or
|
||||
* SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll
|
||||
* SDL_GetCameraPermissionState() occasionally until it returns non-zero.
|
||||
*
|
||||
* \param camera opened camera device.
|
||||
* \param timestampNS a pointer filled in with the frame's timestamp, or 0 on
|
||||
* error. Can be NULL.
|
||||
* \returns a new frame of video on success, NULL if none is currently
|
||||
* available.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ReleaseCameraFrame
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *camera, Uint64 *timestampNS);
|
||||
|
||||
/**
|
||||
* Release a frame of video acquired from a camera.
|
||||
*
|
||||
* Let the back-end re-use the internal buffer for camera.
|
||||
*
|
||||
* This function _must_ be called only on surface objects returned by
|
||||
* SDL_AcquireCameraFrame(). This function should be called as quickly as
|
||||
* possible after acquisition, as SDL keeps a small FIFO queue of surfaces for
|
||||
* video frames; if surfaces aren't released in a timely manner, SDL may drop
|
||||
* upcoming video frames from the camera.
|
||||
*
|
||||
* If the app needs to keep the surface for a significant time, they should
|
||||
* make a copy of it and release the original.
|
||||
*
|
||||
* The app should not use the surface again after calling this function;
|
||||
* assume the surface is freed and the pointer is invalid.
|
||||
*
|
||||
* \param camera opened camera device.
|
||||
* \param frame the video frame surface to release.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AcquireCameraFrame
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
|
||||
|
||||
/**
|
||||
* Use this function to shut down camera processing and close the camera
|
||||
* device.
|
||||
*
|
||||
* \param camera opened camera device.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, but no
|
||||
* thread may reference `device` once this function is called.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_CloseCamera(SDL_Camera *camera);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_camera_h_ */
|
||||
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryClipboard
|
||||
*
|
||||
* SDL provides access to the system clipboard, both for reading information
|
||||
* from other processes and publishing information of its own.
|
||||
*
|
||||
* This is not just text! SDL apps can access and publish data by mimetype.
|
||||
*
|
||||
* ## Basic use (text)
|
||||
*
|
||||
* Obtaining and publishing simple text to the system clipboard is as easy as
|
||||
* calling SDL_GetClipboardText() and SDL_SetClipboardText(), respectively.
|
||||
* These deal with C strings in UTF-8 encoding. Data transmission and encoding
|
||||
* conversion is completely managed by SDL.
|
||||
*
|
||||
* ## Clipboard callbacks (data other than text)
|
||||
*
|
||||
* Things get more complicated when the clipboard contains something other
|
||||
* than text. Not only can the system clipboard contain data of any type, in
|
||||
* some cases it can contain the same data in different formats! For example,
|
||||
* an image painting app might let the user copy a graphic to the clipboard,
|
||||
* and offers it in .BMP, .JPG, or .PNG format for other apps to consume.
|
||||
*
|
||||
* Obtaining clipboard data ("pasting") like this is a matter of calling
|
||||
* SDL_GetClipboardData() and telling it the mimetype of the data you want.
|
||||
* But how does one know if that format is available? SDL_HasClipboardData()
|
||||
* can report if a specific mimetype is offered, and
|
||||
* SDL_GetClipboardMimeTypes() can provide the entire list of mimetypes
|
||||
* available, so the app can decide what to do with the data and what formats
|
||||
* it can support.
|
||||
*
|
||||
* Setting the clipboard ("copying") to arbitrary data is done with
|
||||
* SDL_SetClipboardData. The app does not provide the data in this call, but
|
||||
* rather the mimetypes it is willing to provide and a callback function.
|
||||
* During the callback, the app will generate the data. This allows massive
|
||||
* data sets to be provided to the clipboard, without any data being copied
|
||||
* before it is explicitly requested. More specifically, it allows an app to
|
||||
* offer data in multiple formats without providing a copy of all of them
|
||||
* upfront. If the app has an image that it could provide in PNG or JPG
|
||||
* format, it doesn't have to encode it to either of those unless and until
|
||||
* something tries to paste it.
|
||||
*
|
||||
* ## Primary Selection
|
||||
*
|
||||
* The X11 and Wayland video targets have a concept of the "primary selection"
|
||||
* in addition to the usual clipboard. This is generally highlighted (but not
|
||||
* explicitly copied) text from various apps. SDL offers APIs for this through
|
||||
* SDL_GetPrimarySelectionText() and SDL_SetPrimarySelectionText(). SDL offers
|
||||
* these APIs on platforms without this concept, too, but only so far that it
|
||||
* will keep a copy of a string that the app sets for later retrieval; the
|
||||
* operating system will not ever attempt to change the string externally if
|
||||
* it doesn't support a primary selection.
|
||||
*/
|
||||
|
||||
#ifndef SDL_clipboard_h_
|
||||
#define SDL_clipboard_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Put UTF-8 text into the clipboard.
|
||||
*
|
||||
* \param text the text to store in the clipboard.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetClipboardText
|
||||
* \sa SDL_HasClipboardText
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text);
|
||||
|
||||
/**
|
||||
* Get UTF-8 text from the clipboard.
|
||||
*
|
||||
* This function returns an empty string if there is not enough memory left
|
||||
* for a copy of the clipboard's content.
|
||||
*
|
||||
* \returns the clipboard text on success or an empty string on failure; call
|
||||
* SDL_GetError() for more information. This should be freed with
|
||||
* SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasClipboardText
|
||||
* \sa SDL_SetClipboardText
|
||||
*/
|
||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
||||
|
||||
/**
|
||||
* Query whether the clipboard exists and contains a non-empty text string.
|
||||
*
|
||||
* \returns true if the clipboard has text, or false if it does not.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetClipboardText
|
||||
* \sa SDL_SetClipboardText
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardText(void);
|
||||
|
||||
/**
|
||||
* Put UTF-8 text into the primary selection.
|
||||
*
|
||||
* \param text the text to store in the primary selection.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetPrimarySelectionText
|
||||
* \sa SDL_HasPrimarySelectionText
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
|
||||
|
||||
/**
|
||||
* Get UTF-8 text from the primary selection.
|
||||
*
|
||||
* This function returns an empty string if there is not enough memory left
|
||||
* for a copy of the primary selection's content.
|
||||
*
|
||||
* \returns the primary selection text on success or an empty string on
|
||||
* failure; call SDL_GetError() for more information. This should be
|
||||
* freed with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasPrimarySelectionText
|
||||
* \sa SDL_SetPrimarySelectionText
|
||||
*/
|
||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
|
||||
|
||||
/**
|
||||
* Query whether the primary selection exists and contains a non-empty text
|
||||
* string.
|
||||
*
|
||||
* \returns true if the primary selection has text, or false if it does not.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetPrimarySelectionText
|
||||
* \sa SDL_SetPrimarySelectionText
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
|
||||
|
||||
/**
|
||||
* Callback function that will be called when data for the specified mime-type
|
||||
* is requested by the OS.
|
||||
*
|
||||
* The callback function is called with NULL as the mime_type when the
|
||||
* clipboard is cleared or new data is set. The clipboard is automatically
|
||||
* cleared in SDL_Quit().
|
||||
*
|
||||
* \param userdata a pointer to the provided user data.
|
||||
* \param mime_type the requested mime-type.
|
||||
* \param size a pointer filled in with the length of the returned data.
|
||||
* \returns a pointer to the data for the provided mime-type. Returning NULL
|
||||
* or setting the length to 0 will cause zero length data to be sent
|
||||
* to the "receiver", which should be able to handle this. The
|
||||
* returned data will not be freed, so it needs to be retained and
|
||||
* dealt with internally.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetClipboardData
|
||||
*/
|
||||
typedef const void *(SDLCALL *SDL_ClipboardDataCallback)(void *userdata, const char *mime_type, size_t *size);
|
||||
|
||||
/**
|
||||
* Callback function that will be called when the clipboard is cleared, or
|
||||
* when new data is set.
|
||||
*
|
||||
* \param userdata a pointer to the provided user data.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetClipboardData
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
|
||||
|
||||
/**
|
||||
* Offer clipboard data to the OS.
|
||||
*
|
||||
* Tell the operating system that the application is offering clipboard data
|
||||
* for each of the provided mime-types. Once another application requests the
|
||||
* data the callback function will be called, allowing it to generate and
|
||||
* respond with the data for the requested mime-type.
|
||||
*
|
||||
* The size of text data does not include any terminator, and the text does
|
||||
* not need to be null-terminated (e.g., you can directly copy a portion of a
|
||||
* document).
|
||||
*
|
||||
* \param callback a function pointer to the function that provides the
|
||||
* clipboard data.
|
||||
* \param cleanup a function pointer to the function that cleans up the
|
||||
* clipboard data.
|
||||
* \param userdata an opaque pointer that will be forwarded to the callbacks.
|
||||
* \param mime_types a list of mime-types that are being offered. SDL copies
|
||||
* the given list.
|
||||
* \param num_mime_types the number of mime-types in the mime_types list.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ClearClipboardData
|
||||
* \sa SDL_GetClipboardData
|
||||
* \sa SDL_HasClipboardData
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
|
||||
|
||||
/**
|
||||
* Clear the clipboard data.
|
||||
*
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetClipboardData
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void);
|
||||
|
||||
/**
|
||||
* Get the data from the clipboard for a given mime type.
|
||||
*
|
||||
* The size of text data does not include the terminator, but the text is
|
||||
* guaranteed to be null-terminated.
|
||||
*
|
||||
* \param mime_type the mime type to read from the clipboard.
|
||||
* \param size a pointer filled in with the length of the returned data.
|
||||
* \returns the retrieved data buffer or NULL on failure; call SDL_GetError()
|
||||
* for more information. This should be freed with SDL_free() when it
|
||||
* is no longer needed.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasClipboardData
|
||||
* \sa SDL_SetClipboardData
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size);
|
||||
|
||||
/**
|
||||
* Query whether there is data in the clipboard for the provided mime type.
|
||||
*
|
||||
* \param mime_type the mime type to check for data.
|
||||
* \returns true if data exists in the clipboard for the provided mime type,
|
||||
* false if it does not.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetClipboardData
|
||||
* \sa SDL_GetClipboardData
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type);
|
||||
|
||||
/**
|
||||
* Retrieve the list of mime types available in the clipboard.
|
||||
*
|
||||
* \param num_mime_types a pointer filled with the number of mime types, may
|
||||
* be NULL.
|
||||
* \returns a null-terminated array of strings with mime types, or NULL on
|
||||
* failure; call SDL_GetError() for more information. This should be
|
||||
* freed with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetClipboardData
|
||||
*/
|
||||
extern SDL_DECLSPEC char ** SDLCALL SDL_GetClipboardMimeTypes(size_t *num_mime_types);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_clipboard_h_ */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file reverses the effects of SDL_begin_code.h and should be included
|
||||
* after you finish any function and structure declarations in your headers.
|
||||
*
|
||||
* SDL's headers use this; applications generally should not include this
|
||||
* header directly.
|
||||
*/
|
||||
|
||||
#ifndef SDL_begin_code_h
|
||||
#error SDL_close_code.h included without matching SDL_begin_code.h
|
||||
#endif
|
||||
#undef SDL_begin_code_h
|
||||
|
||||
/* Reset structure packing at previous byte alignment */
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
#endif /* Compiler needs structure packing set */
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* Header file containing SDL's license. */
|
||||
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: CPUInfo */
|
||||
|
||||
/**
|
||||
* # CategoryCPUInfo
|
||||
*
|
||||
* CPU feature detection for SDL.
|
||||
*
|
||||
* These functions are largely concerned with reporting if the system has
|
||||
* access to various SIMD instruction sets, but also has other important info
|
||||
* to share, such as system RAM size and number of logical CPU cores.
|
||||
*
|
||||
* CPU instruction set checks, like SDL_HasSSE() and SDL_HasNEON(), are
|
||||
* available on all platforms, even if they don't make sense (an ARM processor
|
||||
* will never have SSE and an x86 processor will never have NEON, for example,
|
||||
* but these functions still exist and will simply return false in these
|
||||
* cases).
|
||||
*/
|
||||
|
||||
#ifndef SDL_cpuinfo_h_
|
||||
#define SDL_cpuinfo_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A guess for the cacheline size used for padding.
|
||||
*
|
||||
* Most x86 processors have a 64 byte cache line. The 64-bit PowerPC
|
||||
* processors have a 128 byte cache line. We use the larger value to be
|
||||
* generally safe.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_CACHELINE_SIZE 128
|
||||
|
||||
/**
|
||||
* Get the number of logical CPU cores available.
|
||||
*
|
||||
* \returns the total number of logical CPU cores. On CPUs that include
|
||||
* technologies such as hyperthreading, the number of logical cores
|
||||
* may be more than the number of physical cores.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetNumLogicalCPUCores(void);
|
||||
|
||||
/**
|
||||
* Determine the L1 cache line size of the CPU.
|
||||
*
|
||||
* This is useful for determining multi-threaded structure padding or SIMD
|
||||
* prefetch sizes.
|
||||
*
|
||||
* \returns the L1 cache line size of the CPU, in bytes.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AltiVec features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using PowerPC instruction
|
||||
* sets.
|
||||
*
|
||||
* \returns true if the CPU has AltiVec features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAltiVec(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has MMX features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has MMX features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasMMX(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has SSE features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has SSE2 features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE2(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE3 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has SSE3 features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE3(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE4.1 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has SSE4.1 features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE41(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE4.2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has SSE4.2 features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE42(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has AVX features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasAVX512F
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has AVX2 features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX512F
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX2(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX-512F (foundation) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has AVX-512F features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX512F(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has ARM SIMD (ARMv6) features.
|
||||
*
|
||||
* This is different from ARM NEON, which is a different instruction set.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has ARM SIMD features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasNEON
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasARMSIMD(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has NEON (ARM SIMD) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
||||
*
|
||||
* \returns true if the CPU has ARM NEON features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasNEON(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has LSX (LOONGARCH SIMD) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using LOONGARCH instruction
|
||||
* sets.
|
||||
*
|
||||
* \returns true if the CPU has LOONGARCH LSX features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasLSX(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has LASX (LOONGARCH SIMD) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using LOONGARCH instruction
|
||||
* sets.
|
||||
*
|
||||
* \returns true if the CPU has LOONGARCH LASX features or false if not.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasLASX(void);
|
||||
|
||||
/**
|
||||
* Get the amount of RAM configured in the system.
|
||||
*
|
||||
* \returns the amount of RAM configured in the system in MiB.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
|
||||
|
||||
/**
|
||||
* Report the alignment this system needs for SIMD allocations.
|
||||
*
|
||||
* This will return the minimum number of bytes to which a pointer must be
|
||||
* aligned to be compatible with SIMD instructions on the current machine. For
|
||||
* example, if the machine supports SSE only, it will return 16, but if it
|
||||
* supports AVX-512F, it'll return 64 (etc). This only reports values for
|
||||
* instruction sets SDL knows about, so if your SDL build doesn't have
|
||||
* SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
|
||||
* not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
|
||||
* Plan accordingly.
|
||||
*
|
||||
* \returns the alignment in bytes needed for available, known SIMD
|
||||
* instructions.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_aligned_alloc
|
||||
* \sa SDL_aligned_free
|
||||
*/
|
||||
extern SDL_DECLSPEC size_t SDLCALL SDL_GetSIMDAlignment(void);
|
||||
|
||||
/**
|
||||
* Report the size of a page of memory.
|
||||
*
|
||||
* Different platforms might have different memory page sizes. In current
|
||||
* times, 4 kilobytes is not unusual, but newer systems are moving to larger
|
||||
* page sizes, and esoteric platforms might have any unexpected size.
|
||||
*
|
||||
* Note that this function can return 0, which means SDL can't determine the
|
||||
* page size on this platform. It will _not_ set an error string to be
|
||||
* retrieved with SDL_GetError() in this case! In this case, defaulting to
|
||||
* 4096 is often a reasonable option.
|
||||
*
|
||||
* \returns the size of a single page of memory, in bytes, or 0 if SDL can't
|
||||
* determine this information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.4.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSystemPageSize(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_cpuinfo_h_ */
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryDialog
|
||||
*
|
||||
* File dialog support.
|
||||
*
|
||||
* SDL offers file dialogs, to let users select files with native GUI
|
||||
* interfaces. There are "open" dialogs, "save" dialogs, and folder selection
|
||||
* dialogs. The app can control some details, such as filtering to specific
|
||||
* files, or whether multiple files can be selected by the user.
|
||||
*
|
||||
* Note that launching a file dialog is a non-blocking operation; control
|
||||
* returns to the app immediately, and a callback is called later (possibly in
|
||||
* another thread) when the user makes a choice.
|
||||
*/
|
||||
|
||||
#ifndef SDL_dialog_h_
|
||||
#define SDL_dialog_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An entry for filters for file dialogs.
|
||||
*
|
||||
* `name` is a user-readable label for the filter (for example, "Office
|
||||
* document").
|
||||
*
|
||||
* `pattern` is a semicolon-separated list of file extensions (for example,
|
||||
* "doc;docx"). File extensions may only contain alphanumeric characters,
|
||||
* hyphens, underscores and periods. Alternatively, the whole string can be a
|
||||
* single asterisk ("*"), which serves as an "All files" filter.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DialogFileCallback
|
||||
* \sa SDL_ShowOpenFileDialog
|
||||
* \sa SDL_ShowSaveFileDialog
|
||||
* \sa SDL_ShowOpenFolderDialog
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
typedef struct SDL_DialogFileFilter
|
||||
{
|
||||
const char *name;
|
||||
const char *pattern;
|
||||
} SDL_DialogFileFilter;
|
||||
|
||||
/**
|
||||
* Callback used by file dialog functions.
|
||||
*
|
||||
* The specific usage is described in each function.
|
||||
*
|
||||
* If `filelist` is:
|
||||
*
|
||||
* - NULL, an error occurred. Details can be obtained with SDL_GetError().
|
||||
* - A pointer to NULL, the user either didn't choose any file or canceled the
|
||||
* dialog.
|
||||
* - A pointer to non-`NULL`, the user chose one or more files. The argument
|
||||
* is a null-terminated array of pointers to UTF-8 encoded strings, each
|
||||
* containing a path.
|
||||
*
|
||||
* The filelist argument should not be freed; it will automatically be freed
|
||||
* when the callback returns.
|
||||
*
|
||||
* The filter argument is the index of the filter that was selected, or -1 if
|
||||
* no filter was selected or if the platform or method doesn't support
|
||||
* fetching the selected filter.
|
||||
*
|
||||
* In Android, the `filelist` are `content://` URIs. They should be opened
|
||||
* using SDL_IOFromFile() with appropriate modes. This applies both to open
|
||||
* and save file dialog.
|
||||
*
|
||||
* \param userdata an app-provided pointer, for the callback's use.
|
||||
* \param filelist the file(s) chosen by the user.
|
||||
* \param filter index of the selected filter.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DialogFileFilter
|
||||
* \sa SDL_ShowOpenFileDialog
|
||||
* \sa SDL_ShowSaveFileDialog
|
||||
* \sa SDL_ShowOpenFolderDialog
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * const *filelist, int filter);
|
||||
|
||||
/**
|
||||
* Displays a dialog that lets the user select a file on their filesystem.
|
||||
*
|
||||
* This is an asynchronous function; it will return immediately, and the
|
||||
* result will be passed to the callback.
|
||||
*
|
||||
* The callback will be invoked with a null-terminated list of files the user
|
||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
||||
* be NULL if an error occurred.
|
||||
*
|
||||
* Note that the callback may be called from a different thread than the one
|
||||
* the function was invoked on.
|
||||
*
|
||||
* Depending on the platform, the user may be allowed to input paths that
|
||||
* don't yet exist.
|
||||
*
|
||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
||||
* should add a call to SDL_PumpEvents in their main loop.
|
||||
*
|
||||
* \param callback a function pointer to be invoked when the user selects a
|
||||
* file and accepts, or cancels the dialog, or an error
|
||||
* occurs.
|
||||
* \param userdata an optional pointer to pass extra data to the callback when
|
||||
* it will be invoked.
|
||||
* \param window the window that the dialog should be modal for, may be NULL.
|
||||
* Not all platforms support this option.
|
||||
* \param filters a list of filters, may be NULL. See the
|
||||
* [`SDL_DialogFileFilter` documentation for
|
||||
* examples](SDL_DialogFileFilter#code-examples). Not all
|
||||
* platforms support this option, and platforms that do support
|
||||
* it may allow the user to ignore the filters. If non-NULL, it
|
||||
* must remain valid at least until the callback is invoked.
|
||||
* \param nfilters the number of filters. Ignored if filters is NULL.
|
||||
* \param default_location the default folder or file to start the dialog at,
|
||||
* may be NULL. Not all platforms support this option.
|
||||
* \param allow_many if non-zero, the user will be allowed to select multiple
|
||||
* entries. Not all platforms support this option.
|
||||
*
|
||||
* \threadsafety This function should be called only from the main thread. The
|
||||
* callback may be invoked from the same thread or from a
|
||||
* different one, depending on the OS's constraints.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DialogFileCallback
|
||||
* \sa SDL_DialogFileFilter
|
||||
* \sa SDL_ShowSaveFileDialog
|
||||
* \sa SDL_ShowOpenFolderDialog
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many);
|
||||
|
||||
/**
|
||||
* Displays a dialog that lets the user choose a new or existing file on their
|
||||
* filesystem.
|
||||
*
|
||||
* This is an asynchronous function; it will return immediately, and the
|
||||
* result will be passed to the callback.
|
||||
*
|
||||
* The callback will be invoked with a null-terminated list of files the user
|
||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
||||
* be NULL if an error occurred.
|
||||
*
|
||||
* Note that the callback may be called from a different thread than the one
|
||||
* the function was invoked on.
|
||||
*
|
||||
* The chosen file may or may not already exist.
|
||||
*
|
||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
||||
* should add a call to SDL_PumpEvents in their main loop.
|
||||
*
|
||||
* \param callback a function pointer to be invoked when the user selects a
|
||||
* file and accepts, or cancels the dialog, or an error
|
||||
* occurs.
|
||||
* \param userdata an optional pointer to pass extra data to the callback when
|
||||
* it will be invoked.
|
||||
* \param window the window that the dialog should be modal for, may be NULL.
|
||||
* Not all platforms support this option.
|
||||
* \param filters a list of filters, may be NULL. Not all platforms support
|
||||
* this option, and platforms that do support it may allow the
|
||||
* user to ignore the filters. If non-NULL, it must remain
|
||||
* valid at least until the callback is invoked.
|
||||
* \param nfilters the number of filters. Ignored if filters is NULL.
|
||||
* \param default_location the default folder or file to start the dialog at,
|
||||
* may be NULL. Not all platforms support this option.
|
||||
*
|
||||
* \threadsafety This function should be called only from the main thread. The
|
||||
* callback may be invoked from the same thread or from a
|
||||
* different one, depending on the OS's constraints.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DialogFileCallback
|
||||
* \sa SDL_DialogFileFilter
|
||||
* \sa SDL_ShowOpenFileDialog
|
||||
* \sa SDL_ShowOpenFolderDialog
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location);
|
||||
|
||||
/**
|
||||
* Displays a dialog that lets the user select a folder on their filesystem.
|
||||
*
|
||||
* This is an asynchronous function; it will return immediately, and the
|
||||
* result will be passed to the callback.
|
||||
*
|
||||
* The callback will be invoked with a null-terminated list of files the user
|
||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
||||
* be NULL if an error occurred.
|
||||
*
|
||||
* Note that the callback may be called from a different thread than the one
|
||||
* the function was invoked on.
|
||||
*
|
||||
* Depending on the platform, the user may be allowed to input paths that
|
||||
* don't yet exist.
|
||||
*
|
||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
||||
* should add a call to SDL_PumpEvents in their main loop.
|
||||
*
|
||||
* \param callback a function pointer to be invoked when the user selects a
|
||||
* file and accepts, or cancels the dialog, or an error
|
||||
* occurs.
|
||||
* \param userdata an optional pointer to pass extra data to the callback when
|
||||
* it will be invoked.
|
||||
* \param window the window that the dialog should be modal for, may be NULL.
|
||||
* Not all platforms support this option.
|
||||
* \param default_location the default folder or file to start the dialog at,
|
||||
* may be NULL. Not all platforms support this option.
|
||||
* \param allow_many if non-zero, the user will be allowed to select multiple
|
||||
* entries. Not all platforms support this option.
|
||||
*
|
||||
* \threadsafety This function should be called only from the main thread. The
|
||||
* callback may be invoked from the same thread or from a
|
||||
* different one, depending on the OS's constraints.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DialogFileCallback
|
||||
* \sa SDL_ShowOpenFileDialog
|
||||
* \sa SDL_ShowSaveFileDialog
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many);
|
||||
|
||||
/**
|
||||
* Various types of file dialogs.
|
||||
*
|
||||
* This is used by SDL_ShowFileDialogWithProperties() to decide what kind of
|
||||
* dialog to present to the user.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ShowFileDialogWithProperties
|
||||
*/
|
||||
typedef enum SDL_FileDialogType
|
||||
{
|
||||
SDL_FILEDIALOG_OPENFILE,
|
||||
SDL_FILEDIALOG_SAVEFILE,
|
||||
SDL_FILEDIALOG_OPENFOLDER
|
||||
} SDL_FileDialogType;
|
||||
|
||||
/**
|
||||
* Create and launch a file dialog with the specified properties.
|
||||
*
|
||||
* These are the supported properties:
|
||||
*
|
||||
* - `SDL_PROP_FILE_DIALOG_FILTERS_POINTER`: a pointer to a list of
|
||||
* SDL_DialogFileFilter structs, which will be used as filters for
|
||||
* file-based selections. Ignored if the dialog is an "Open Folder" dialog.
|
||||
* If non-NULL, the array of filters must remain valid at least until the
|
||||
* callback is invoked.
|
||||
* - `SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER`: the number of filters in the
|
||||
* array of filters, if it exists.
|
||||
* - `SDL_PROP_FILE_DIALOG_WINDOW_POINTER`: the window that the dialog should
|
||||
* be modal for.
|
||||
* - `SDL_PROP_FILE_DIALOG_LOCATION_STRING`: the default folder or file to
|
||||
* start the dialog at.
|
||||
* - `SDL_PROP_FILE_DIALOG_MANY_BOOLEAN`: true to allow the user to select
|
||||
* more than one entry.
|
||||
* - `SDL_PROP_FILE_DIALOG_TITLE_STRING`: the title for the dialog.
|
||||
* - `SDL_PROP_FILE_DIALOG_ACCEPT_STRING`: the label that the accept button
|
||||
* should have.
|
||||
* - `SDL_PROP_FILE_DIALOG_CANCEL_STRING`: the label that the cancel button
|
||||
* should have.
|
||||
*
|
||||
* Note that each platform may or may not support any of the properties.
|
||||
*
|
||||
* \param type the type of file dialog.
|
||||
* \param callback a function pointer to be invoked when the user selects a
|
||||
* file and accepts, or cancels the dialog, or an error
|
||||
* occurs.
|
||||
* \param userdata an optional pointer to pass extra data to the callback when
|
||||
* it will be invoked.
|
||||
* \param props the properties to use.
|
||||
*
|
||||
* \threadsafety This function should be called only from the main thread. The
|
||||
* callback may be invoked from the same thread or from a
|
||||
* different one, depending on the OS's constraints.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_FileDialogType
|
||||
* \sa SDL_DialogFileCallback
|
||||
* \sa SDL_DialogFileFilter
|
||||
* \sa SDL_ShowOpenFileDialog
|
||||
* \sa SDL_ShowSaveFileDialog
|
||||
* \sa SDL_ShowOpenFolderDialog
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props);
|
||||
|
||||
#define SDL_PROP_FILE_DIALOG_FILTERS_POINTER "SDL.filedialog.filters"
|
||||
#define SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER "SDL.filedialog.nfilters"
|
||||
#define SDL_PROP_FILE_DIALOG_WINDOW_POINTER "SDL.filedialog.window"
|
||||
#define SDL_PROP_FILE_DIALOG_LOCATION_STRING "SDL.filedialog.location"
|
||||
#define SDL_PROP_FILE_DIALOG_MANY_BOOLEAN "SDL.filedialog.many"
|
||||
#define SDL_PROP_FILE_DIALOG_TITLE_STRING "SDL.filedialog.title"
|
||||
#define SDL_PROP_FILE_DIALOG_ACCEPT_STRING "SDL.filedialog.accept"
|
||||
#define SDL_PROP_FILE_DIALOG_CANCEL_STRING "SDL.filedialog.cancel"
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_dialog_h_ */
|
||||
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: DlopenNotes */
|
||||
|
||||
/**
|
||||
* # CategoryDlopenNotes
|
||||
*
|
||||
* This header allows you to annotate your code so external tools know about
|
||||
* dynamic shared library dependencies.
|
||||
*
|
||||
* If you determine that your toolchain doesn't support dlopen notes, you can
|
||||
* disable this feature by defining `SDL_DISABLE_DLOPEN_NOTES`. You can use
|
||||
* this CMake snippet to check for support:
|
||||
*
|
||||
* ```cmake
|
||||
* set(CHECK_ELF_DLNOTES_SRC [==[
|
||||
* #ifndef __ELF__
|
||||
* ELF DL notes is only supported on ELF platforms
|
||||
* #endif
|
||||
* __attribute__ ((used,aligned(4),section(".note.dlopen"))) static const struct {
|
||||
* struct { int a; int b; int c; } hdr; char name[4]; __attribute__((aligned(4))) char json[24];
|
||||
* } dlnote = { { 4, 0x407c0c0aU, 16 }, "FDO", "[\\"a\\":{\\"a\\":\\"1\\",\\"b\\":\\"2\\"}]" };
|
||||
* int main(int argc, char *argv[]) {
|
||||
* return argc + dlnote.hdr.a;
|
||||
* }
|
||||
* ]==])
|
||||
* check_c_source_compiles("${CHECK_ELF_DLNOTES_SRC}" COMPILER_SUPPORTS_ELFNOTES)
|
||||
* if(NOT COMPILER_SUPPORTS_ELFNOTES)
|
||||
* set(SDL_DISABLE_DLOPEN_NOTES TRUE)
|
||||
* endif()
|
||||
* ```
|
||||
*/
|
||||
|
||||
#ifndef SDL_dlopennote_h
|
||||
#define SDL_dlopennote_h
|
||||
|
||||
/**
|
||||
* Use this macro with SDL_ELF_NOTE_DLOPEN() to note that a dynamic shared
|
||||
* library dependency is optional.
|
||||
*
|
||||
* Optional functionality uses the dependency, the binary will work and the
|
||||
* dependency is only needed for full-featured installations.
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*
|
||||
* \sa SDL_ELF_NOTE_DLOPEN
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
|
||||
*/
|
||||
#define SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED "suggested"
|
||||
|
||||
/**
|
||||
* Use this macro with SDL_ELF_NOTE_DLOPEN() to note that a dynamic shared
|
||||
* library dependency is recommended.
|
||||
*
|
||||
* Important functionality needs the dependency, the binary will work but in
|
||||
* most cases the dependency should be provided.
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*
|
||||
* \sa SDL_ELF_NOTE_DLOPEN
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
|
||||
*/
|
||||
#define SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED "recommended"
|
||||
|
||||
/**
|
||||
* Use this macro with SDL_ELF_NOTE_DLOPEN() to note that a dynamic shared
|
||||
* library dependency is required.
|
||||
*
|
||||
* Core functionality needs the dependency, the binary will not work if it
|
||||
* cannot be found.
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*
|
||||
* \sa SDL_ELF_NOTE_DLOPEN
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED
|
||||
*/
|
||||
#define SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED "required"
|
||||
|
||||
|
||||
#if !defined(SDL_PLATFORM_UNIX) || defined(SDL_PLATFORM_ANDROID)
|
||||
/* The dlopen note functionality isn't used on this platform */
|
||||
#ifndef SDL_DISABLE_DLOPEN_NOTES
|
||||
#define SDL_DISABLE_DLOPEN_NOTES
|
||||
#endif
|
||||
#elif defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1))
|
||||
/* gcc < 3.1 too old */
|
||||
#ifndef SDL_DISABLE_DLOPEN_NOTES
|
||||
#define SDL_DISABLE_DLOPEN_NOTES
|
||||
#endif
|
||||
#endif /* SDL_PLATFORM_UNIX || SDL_PLATFORM_ANDROID */
|
||||
|
||||
#if defined(__ELF__) && !defined(SDL_DISABLE_DLOPEN_NOTES)
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#define SDL_ELF_NOTE_DLOPEN_VENDOR "FDO"
|
||||
#define SDL_ELF_NOTE_DLOPEN_TYPE 0x407c0c0aU
|
||||
|
||||
#define SDL_ELF_NOTE_INTERNAL2(json, variable_name) \
|
||||
__attribute__((aligned(4), used, section(".note.dlopen"))) \
|
||||
static const struct { \
|
||||
struct { \
|
||||
Uint32 n_namesz; \
|
||||
Uint32 n_descsz; \
|
||||
Uint32 n_type; \
|
||||
} nhdr; \
|
||||
char name[4]; \
|
||||
__attribute__((aligned(4))) char dlopen_json[sizeof(json)]; \
|
||||
} variable_name = { \
|
||||
{ \
|
||||
sizeof(SDL_ELF_NOTE_DLOPEN_VENDOR), \
|
||||
sizeof(json), \
|
||||
SDL_ELF_NOTE_DLOPEN_TYPE \
|
||||
}, \
|
||||
SDL_ELF_NOTE_DLOPEN_VENDOR, \
|
||||
json \
|
||||
}
|
||||
|
||||
#define SDL_ELF_NOTE_INTERNAL(json, variable_name) \
|
||||
SDL_ELF_NOTE_INTERNAL2(json, variable_name)
|
||||
|
||||
#define SDL_SONAME_ARRAY1(N1) "[\"" N1 "\"]"
|
||||
#define SDL_SONAME_ARRAY2(N1,N2) "[\"" N1 "\",\"" N2 "\"]"
|
||||
#define SDL_SONAME_ARRAY3(N1,N2,N3) "[\"" N1 "\",\"" N2 "\",\"" N3 "\"]"
|
||||
#define SDL_SONAME_ARRAY4(N1,N2,N3,N4) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\"]"
|
||||
#define SDL_SONAME_ARRAY5(N1,N2,N3,N4,N5) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\"]"
|
||||
#define SDL_SONAME_ARRAY6(N1,N2,N3,N4,N5,N6) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\"]"
|
||||
#define SDL_SONAME_ARRAY7(N1,N2,N3,N4,N5,N6,N7) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\"]"
|
||||
#define SDL_SONAME_ARRAY8(N1,N2,N3,N4,N5,N6,N7,N8) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\",\"" N8 "\"]"
|
||||
#define SDL_SONAME_ARRAY_GET(N1,N2,N3,N4,N5,N6,N7,N8,NAME,...) NAME
|
||||
#define SDL_SONAME_ARRAY(...) \
|
||||
SDL_SONAME_ARRAY_GET(__VA_ARGS__, \
|
||||
SDL_SONAME_ARRAY8, \
|
||||
SDL_SONAME_ARRAY7, \
|
||||
SDL_SONAME_ARRAY6, \
|
||||
SDL_SONAME_ARRAY5, \
|
||||
SDL_SONAME_ARRAY4, \
|
||||
SDL_SONAME_ARRAY3, \
|
||||
SDL_SONAME_ARRAY2, \
|
||||
SDL_SONAME_ARRAY1 \
|
||||
)(__VA_ARGS__)
|
||||
|
||||
/* Create "unique" variable name using __LINE__,
|
||||
* so creating elf notes on the same line is not supported
|
||||
*/
|
||||
#define SDL_ELF_NOTE_JOIN2(A,B) A##B
|
||||
#define SDL_ELF_NOTE_JOIN(A,B) SDL_ELF_NOTE_JOIN2(A,B)
|
||||
#define SDL_ELF_NOTE_UNIQUE_NAME SDL_ELF_NOTE_JOIN(s_SDL_dlopen_note_, __LINE__)
|
||||
|
||||
/**
|
||||
* Note that your application has dynamic shared library dependencies.
|
||||
*
|
||||
* You can do this by adding the following to the global scope:
|
||||
*
|
||||
* ```c
|
||||
* SDL_ELF_NOTE_DLOPEN(
|
||||
* "png",
|
||||
* "Support for loading PNG images using libpng (required for APNG)",
|
||||
* SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
|
||||
* "libpng12.so.0"
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* Or if you support multiple versions of a library, you can list them:
|
||||
*
|
||||
* ```c
|
||||
* // Our app supports SDL1, SDL2, and SDL3 by dynamically loading them
|
||||
* SDL_ELF_NOTE_DLOPEN(
|
||||
* "SDL",
|
||||
* "Create windows through SDL video backend",
|
||||
* SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
|
||||
* "libSDL-1.2.so.0", "libSDL2-2.0.so.0", "libSDL3.so.0"
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.4.0.
|
||||
*
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED
|
||||
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
|
||||
*/
|
||||
#define SDL_ELF_NOTE_DLOPEN(feature, description, priority, ...) \
|
||||
SDL_ELF_NOTE_INTERNAL( \
|
||||
"[{\"feature\":\"" feature \
|
||||
"\",\"description\":\"" description \
|
||||
"\",\"priority\":\"" priority \
|
||||
"\",\"soname\":" SDL_SONAME_ARRAY(__VA_ARGS__) "}]", \
|
||||
SDL_ELF_NOTE_UNIQUE_NAME)
|
||||
|
||||
#elif defined(__GNUC__) && __GNUC__ < 3
|
||||
|
||||
#define SDL_ELF_NOTE_DLOPEN(args...)
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER < 1400
|
||||
|
||||
/* Variadic macros are not supported */
|
||||
#define SDL_ELF_NOTE_DLOPEN
|
||||
|
||||
#else
|
||||
|
||||
#define SDL_ELF_NOTE_DLOPEN(...)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* SDL_dlopennote_h */
|
||||
@@ -0,0 +1,645 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryEndian
|
||||
*
|
||||
* Functions converting endian-specific values to different byte orders.
|
||||
*
|
||||
* These functions either unconditionally swap byte order (SDL_Swap16,
|
||||
* SDL_Swap32, SDL_Swap64, SDL_SwapFloat), or they swap to/from the system's
|
||||
* native byte order (SDL_Swap16LE, SDL_Swap16BE, SDL_Swap32LE, SDL_Swap32BE,
|
||||
* SDL_Swap32LE, SDL_Swap32BE, SDL_SwapFloatLE, SDL_SwapFloatBE). In the
|
||||
* latter case, the functionality is provided by macros that become no-ops if
|
||||
* a swap isn't necessary: on an x86 (littleendian) processor, SDL_Swap32LE
|
||||
* does nothing, but SDL_Swap32BE reverses the bytes of the data. On a PowerPC
|
||||
* processor (bigendian), the macros behavior is reversed.
|
||||
*
|
||||
* The swap routines are inline functions, and attempt to use compiler
|
||||
* intrinsics, inline assembly, and other magic to make byteswapping
|
||||
* efficient.
|
||||
*/
|
||||
|
||||
#ifndef SDL_endian_h_
|
||||
#define SDL_endian_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
||||
#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
|
||||
#ifndef __PRFCHWINTRIN_H
|
||||
#define __PRFCHWINTRIN_H
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetch(void *__P)
|
||||
{
|
||||
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
#endif /* __PRFCHWINTRIN_H */
|
||||
#endif /* __clang__ */
|
||||
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name The two types of endianness
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
|
||||
/**
|
||||
* A value to represent littleendian byteorder.
|
||||
*
|
||||
* This is used with the preprocessor macro SDL_BYTEORDER, to determine a
|
||||
* platform's byte ordering:
|
||||
*
|
||||
* ```c
|
||||
* #if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
* SDL_Log("This system is littleendian.");
|
||||
* #endif
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_BYTEORDER
|
||||
* \sa SDL_BIG_ENDIAN
|
||||
*/
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
|
||||
/**
|
||||
* A value to represent bigendian byteorder.
|
||||
*
|
||||
* This is used with the preprocessor macro SDL_BYTEORDER, to determine a
|
||||
* platform's byte ordering:
|
||||
*
|
||||
* ```c
|
||||
* #if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
* SDL_Log("This system is bigendian.");
|
||||
* #endif
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_BYTEORDER
|
||||
* \sa SDL_LIL_ENDIAN
|
||||
*/
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
|
||||
/* @} */
|
||||
|
||||
#ifndef SDL_BYTEORDER
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro that reports the target system's byte order.
|
||||
*
|
||||
* This is set to either SDL_LIL_ENDIAN or SDL_BIG_ENDIAN (and maybe other
|
||||
* values in the future, if something else becomes popular). This can be
|
||||
* tested with the preprocessor, so decisions can be made at compile time.
|
||||
*
|
||||
* ```c
|
||||
* #if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
* SDL_Log("This system is bigendian.");
|
||||
* #endif
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LIL_ENDIAN
|
||||
* \sa SDL_BIG_ENDIAN
|
||||
*/
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
|
||||
#elif defined(SDL_PLATFORM_LINUX) || defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER __BYTE_ORDER
|
||||
#elif defined(SDL_PLATFORM_SOLARIS)
|
||||
#include <sys/byteorder.h>
|
||||
#if defined(_LITTLE_ENDIAN)
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#elif defined(_BIG_ENDIAN)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#error Unsupported endianness
|
||||
#endif
|
||||
#elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
#elif defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD)
|
||||
#include <sys/endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
/* predefs from newer gcc and clang versions: */
|
||||
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
|
||||
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#error Unsupported endianness
|
||||
#endif /**/
|
||||
#else
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
|
||||
defined(__sparc__) || defined(__sparc)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#endif
|
||||
#endif /* SDL_PLATFORM_LINUX */
|
||||
#endif /* !SDL_BYTEORDER */
|
||||
|
||||
#ifndef SDL_FLOATWORDORDER
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro that reports the target system's floating point word order.
|
||||
*
|
||||
* This is set to either SDL_LIL_ENDIAN or SDL_BIG_ENDIAN (and maybe other
|
||||
* values in the future, if something else becomes popular). This can be
|
||||
* tested with the preprocessor, so decisions can be made at compile time.
|
||||
*
|
||||
* ```c
|
||||
* #if SDL_FLOATWORDORDER == SDL_BIG_ENDIAN
|
||||
* SDL_Log("This system's floats are bigendian.");
|
||||
* #endif
|
||||
* ```
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LIL_ENDIAN
|
||||
* \sa SDL_BIG_ENDIAN
|
||||
*/
|
||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
|
||||
/* predefs from newer gcc versions: */
|
||||
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
|
||||
#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
|
||||
#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#error Unsupported endianness
|
||||
#endif /**/
|
||||
#elif defined(__MAVERICK__)
|
||||
/* For Maverick, float words are always little-endian. */
|
||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
|
||||
#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
|
||||
/* For FPA, float words are always big-endian. */
|
||||
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
/* By default, assume that floats words follow the memory system mode. */
|
||||
#define SDL_FLOATWORDORDER SDL_BYTEORDER
|
||||
#endif /* __FLOAT_WORD_ORDER__ */
|
||||
#endif /* !SDL_FLOATWORDORDER */
|
||||
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* various modern compilers may have builtin swap */
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define HAS_BUILTIN_BSWAP16 (SDL_HAS_BUILTIN(__builtin_bswap16)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
||||
# define HAS_BUILTIN_BSWAP32 (SDL_HAS_BUILTIN(__builtin_bswap32)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
# define HAS_BUILTIN_BSWAP64 (SDL_HAS_BUILTIN(__builtin_bswap64)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
|
||||
/* this one is broken */
|
||||
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
|
||||
#else
|
||||
# define HAS_BUILTIN_BSWAP16 0
|
||||
# define HAS_BUILTIN_BSWAP32 0
|
||||
# define HAS_BUILTIN_BSWAP64 0
|
||||
# define HAS_BROKEN_BSWAP 0
|
||||
#endif
|
||||
|
||||
/* Byte swap 16-bit integer. */
|
||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
#if HAS_BUILTIN_BSWAP16
|
||||
#define SDL_Swap16(x) __builtin_bswap16(x)
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
||||
#pragma intrinsic(_byteswap_ushort)
|
||||
#define SDL_Swap16(x) _byteswap_ushort(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
int result;
|
||||
|
||||
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
|
||||
return (Uint16)result;
|
||||
}
|
||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint16 SDL_Swap16(Uint16);
|
||||
#pragma aux SDL_Swap16 = \
|
||||
"xchg al, ah" \
|
||||
parm [ax] \
|
||||
modify [ax];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Byte swap 32-bit integer. */
|
||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
#if HAS_BUILTIN_BSWAP32
|
||||
#define SDL_Swap32(x) __builtin_bswap32(x)
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
||||
#pragma intrinsic(_byteswap_ulong)
|
||||
#define SDL_Swap32(x) _byteswap_ulong(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
Uint32 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
|
||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
|
||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
|
||||
return result;
|
||||
}
|
||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint32 SDL_Swap32(Uint32);
|
||||
#pragma aux SDL_Swap32 = \
|
||||
"bswap eax" \
|
||||
parm [eax] \
|
||||
modify [eax];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
||||
((x >> 8) & 0x0000FF00) | (x >> 24)));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Byte swap 64-bit integer. */
|
||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
#if HAS_BUILTIN_BSWAP64
|
||||
#define SDL_Swap64(x) __builtin_bswap64(x)
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define SDL_Swap64(x) _byteswap_uint64(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
Uint32 a, b;
|
||||
} s;
|
||||
Uint64 u;
|
||||
} v;
|
||||
v.u = x;
|
||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||
: "=r"(v.s.a), "=r"(v.s.b)
|
||||
: "0" (v.s.a), "1"(v.s.b));
|
||||
return v.u;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
__asm__("bswapq %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint64 SDL_Swap64(Uint64);
|
||||
#pragma aux SDL_Swap64 = \
|
||||
"bswap eax" \
|
||||
"bswap edx" \
|
||||
"xchg eax,edx" \
|
||||
parm [eax edx] \
|
||||
modify [eax edx];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
Uint32 hi, lo;
|
||||
|
||||
/* Separate into high and low 32-bit values and swap them */
|
||||
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
||||
x >>= 32;
|
||||
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
||||
x = SDL_Swap32(lo);
|
||||
x <<= 32;
|
||||
x |= SDL_Swap32(hi);
|
||||
return (x);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Byte-swap a floating point number.
|
||||
*
|
||||
* This will always byte-swap the value, whether it's currently in the native
|
||||
* byteorder of the system or not. You should use SDL_SwapFloatLE or
|
||||
* SDL_SwapFloatBE instead, in most cases.
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the value to byte-swap.
|
||||
* \returns x, with its bytes in the opposite endian order.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE float SDL_SwapFloat(float x)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
Uint32 ui32;
|
||||
} swapper;
|
||||
swapper.f = x;
|
||||
swapper.ui32 = SDL_Swap32(swapper.ui32);
|
||||
return swapper.f;
|
||||
}
|
||||
|
||||
/* remove extra macros */
|
||||
#undef HAS_BROKEN_BSWAP
|
||||
#undef HAS_BUILTIN_BSWAP16
|
||||
#undef HAS_BUILTIN_BSWAP32
|
||||
#undef HAS_BUILTIN_BSWAP64
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Byte-swap an unsigned 16-bit number.
|
||||
*
|
||||
* This will always byte-swap the value, whether it's currently in the native
|
||||
* byteorder of the system or not. You should use SDL_Swap16LE or SDL_Swap16BE
|
||||
* instead, in most cases.
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the value to byte-swap.
|
||||
* \returns `x`, with its bytes in the opposite endian order.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return x_but_byteswapped; }
|
||||
|
||||
/**
|
||||
* Byte-swap an unsigned 32-bit number.
|
||||
*
|
||||
* This will always byte-swap the value, whether it's currently in the native
|
||||
* byteorder of the system or not. You should use SDL_Swap32LE or SDL_Swap32BE
|
||||
* instead, in most cases.
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the value to byte-swap.
|
||||
* \returns `x`, with its bytes in the opposite endian order.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; }
|
||||
|
||||
/**
|
||||
* Byte-swap an unsigned 64-bit number.
|
||||
*
|
||||
* This will always byte-swap the value, whether it's currently in the native
|
||||
* byteorder of the system or not. You should use SDL_Swap64LE or SDL_Swap64BE
|
||||
* instead, in most cases.
|
||||
*
|
||||
* Note that this is a forced-inline function in a header, and not a public
|
||||
* API function available in the SDL library (which is to say, the code is
|
||||
* embedded in the calling program and the linker and dynamic loader will not
|
||||
* be able to find this function inside SDL itself).
|
||||
*
|
||||
* \param x the value to byte-swap.
|
||||
* \returns `x`, with its bytes in the opposite endian order.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
|
||||
|
||||
/**
|
||||
* Swap a 16-bit value from littleendian to native byte order.
|
||||
*
|
||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in littleendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap16LE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a 32-bit value from littleendian to native byte order.
|
||||
*
|
||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in littleendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap32LE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a 64-bit value from littleendian to native byte order.
|
||||
*
|
||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in littleendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap64LE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a floating point value from littleendian to native byte order.
|
||||
*
|
||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in littleendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_SwapFloatLE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a 16-bit value from bigendian to native byte order.
|
||||
*
|
||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in bigendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap16BE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a 32-bit value from bigendian to native byte order.
|
||||
*
|
||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in bigendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap32BE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a 64-bit value from bigendian to native byte order.
|
||||
*
|
||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in bigendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Swap64BE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
/**
|
||||
* Swap a floating point value from bigendian to native byte order.
|
||||
*
|
||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
||||
*
|
||||
* This macro never references `x` more than once, avoiding side effects.
|
||||
*
|
||||
* \param x the value to swap, in bigendian byte order.
|
||||
* \returns `x` in native byte order.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_SwapFloatBE(x) SwapOnlyIfNecessary(x)
|
||||
|
||||
#elif SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SDL_Swap16LE(x) (x)
|
||||
#define SDL_Swap32LE(x) (x)
|
||||
#define SDL_Swap64LE(x) (x)
|
||||
#define SDL_SwapFloatLE(x) (x)
|
||||
#define SDL_Swap16BE(x) SDL_Swap16(x)
|
||||
#define SDL_Swap32BE(x) SDL_Swap32(x)
|
||||
#define SDL_Swap64BE(x) SDL_Swap64(x)
|
||||
#define SDL_SwapFloatBE(x) SDL_SwapFloat(x)
|
||||
#else
|
||||
#define SDL_Swap16LE(x) SDL_Swap16(x)
|
||||
#define SDL_Swap32LE(x) SDL_Swap32(x)
|
||||
#define SDL_Swap64LE(x) SDL_Swap64(x)
|
||||
#define SDL_SwapFloatLE(x) SDL_SwapFloat(x)
|
||||
#define SDL_Swap16BE(x) (x)
|
||||
#define SDL_Swap32BE(x) (x)
|
||||
#define SDL_Swap64BE(x) (x)
|
||||
#define SDL_SwapFloatBE(x) (x)
|
||||
#endif
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_endian_h_ */
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryError
|
||||
*
|
||||
* Simple error message routines for SDL.
|
||||
*
|
||||
* Most apps will interface with these APIs in exactly one function: when
|
||||
* almost any SDL function call reports failure, you can get a human-readable
|
||||
* string of the problem from SDL_GetError().
|
||||
*
|
||||
* These strings are maintained per-thread, and apps are welcome to set their
|
||||
* own errors, which is popular when building libraries on top of SDL for
|
||||
* other apps to consume. These strings are set by calling SDL_SetError().
|
||||
*
|
||||
* A common usage pattern is to have a function that returns true for success
|
||||
* and false for failure, and do this when something fails:
|
||||
*
|
||||
* ```c
|
||||
* if (something_went_wrong) {
|
||||
* return SDL_SetError("The thing broke in this specific way: %d", errcode);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* It's also common to just return `false` in this case if the failing thing
|
||||
* is known to call SDL_SetError(), so errors simply propagate through.
|
||||
*/
|
||||
|
||||
#ifndef SDL_error_h_
|
||||
#define SDL_error_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
|
||||
|
||||
/**
|
||||
* Set the SDL error message for the current thread.
|
||||
*
|
||||
* Calling this function will replace any previous error message that was set.
|
||||
*
|
||||
* This function always returns false, since SDL frequently uses false to
|
||||
* signify a failing result, leading to this idiom:
|
||||
*
|
||||
* ```c
|
||||
* if (error_code) {
|
||||
* return SDL_SetError("This operation has failed: %d", error_code);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \param fmt a printf()-style message format string.
|
||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||
* any.
|
||||
* \returns false.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ClearError
|
||||
* \sa SDL_GetError
|
||||
* \sa SDL_SetErrorV
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* Set the SDL error message for the current thread.
|
||||
*
|
||||
* Calling this function will replace any previous error message that was set.
|
||||
*
|
||||
* \param fmt a printf()-style message format string.
|
||||
* \param ap a variable argument list.
|
||||
* \returns false.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ClearError
|
||||
* \sa SDL_GetError
|
||||
* \sa SDL_SetError
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetErrorV(SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(1);
|
||||
|
||||
/**
|
||||
* Set an error indicating that memory allocation failed.
|
||||
*
|
||||
* This function does not do any memory allocation.
|
||||
*
|
||||
* \returns false.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_OutOfMemory(void);
|
||||
|
||||
/**
|
||||
* Retrieve a message about the last error that occurred on the current
|
||||
* thread.
|
||||
*
|
||||
* It is possible for multiple errors to occur before calling SDL_GetError().
|
||||
* Only the last error is returned.
|
||||
*
|
||||
* The message is only applicable when an SDL function has signaled an error.
|
||||
* You must check the return values of SDL function calls to determine when to
|
||||
* appropriately call SDL_GetError(). You should *not* use the results of
|
||||
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
|
||||
* an error string even when reporting success.
|
||||
*
|
||||
* SDL will *not* clear the error string for successful API calls. You *must*
|
||||
* check return values for failure cases before you can assume the error
|
||||
* string applies.
|
||||
*
|
||||
* Error strings are set per-thread, so an error set in a different thread
|
||||
* will not interfere with the current thread's operation.
|
||||
*
|
||||
* The returned value is a thread-local string which will remain valid until
|
||||
* the current thread's error string is changed. The caller should make a copy
|
||||
* if the value is needed after the next SDL API call.
|
||||
*
|
||||
* \returns a message with information about the specific error that occurred,
|
||||
* or an empty string if there hasn't been an error message set since
|
||||
* the last call to SDL_ClearError().
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ClearError
|
||||
* \sa SDL_SetError
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void);
|
||||
|
||||
/**
|
||||
* Clear any previous error message for this thread.
|
||||
*
|
||||
* \returns true.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetError
|
||||
* \sa SDL_SetError
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearError(void);
|
||||
|
||||
/**
|
||||
* \name Internal error functions
|
||||
*
|
||||
* \internal
|
||||
* Private error reporting function - used internally.
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* A macro to standardize error reporting on unsupported operations.
|
||||
*
|
||||
* This simply calls SDL_SetError() with a standardized error string, for
|
||||
* convenience, consistency, and clarity.
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_Unsupported() SDL_SetError("That operation is not supported")
|
||||
|
||||
/**
|
||||
* A macro to standardize error reporting on unsupported operations.
|
||||
*
|
||||
* This simply calls SDL_SetError() with a standardized error string, for
|
||||
* convenience, consistency, and clarity.
|
||||
*
|
||||
* A common usage pattern inside SDL is this:
|
||||
*
|
||||
* ```c
|
||||
* bool MyFunction(const char *str) {
|
||||
* if (!str) {
|
||||
* return SDL_InvalidParamError("str"); // returns false.
|
||||
* }
|
||||
* DoSomething(str);
|
||||
* return true;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \threadsafety It is safe to call this macro from any thread.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
|
||||
|
||||
/* @} *//* Internal error functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_error_h_ */
|
||||
@@ -0,0 +1,531 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryFilesystem
|
||||
*
|
||||
* SDL offers an API for examining and manipulating the system's filesystem.
|
||||
* This covers most things one would need to do with directories, except for
|
||||
* actual file I/O (which is covered by [CategoryIOStream](CategoryIOStream)
|
||||
* and [CategoryAsyncIO](CategoryAsyncIO) instead).
|
||||
*
|
||||
* There are functions to answer necessary path questions:
|
||||
*
|
||||
* - Where is my app's data? SDL_GetBasePath().
|
||||
* - Where can I safely write files? SDL_GetPrefPath().
|
||||
* - Where are paths like Downloads, Desktop, Music? SDL_GetUserFolder().
|
||||
* - What is this thing at this location? SDL_GetPathInfo().
|
||||
* - What items live in this folder? SDL_EnumerateDirectory().
|
||||
* - What items live in this folder by wildcard? SDL_GlobDirectory().
|
||||
* - What is my current working directory? SDL_GetCurrentDirectory().
|
||||
*
|
||||
* SDL also offers functions to manipulate the directory tree: renaming,
|
||||
* removing, copying files.
|
||||
*/
|
||||
|
||||
#ifndef SDL_filesystem_h_
|
||||
#define SDL_filesystem_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the directory where the application was run from.
|
||||
*
|
||||
* SDL caches the result of this call internally, but the first call to this
|
||||
* function is not necessarily fast, so plan accordingly.
|
||||
*
|
||||
* **macOS and iOS Specific Functionality**: If the application is in a ".app"
|
||||
* bundle, this function returns the Resource directory (e.g.
|
||||
* MyApp.app/Contents/Resources/). This behaviour can be overridden by adding
|
||||
* a property to the Info.plist file. Adding a string key with the name
|
||||
* SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the
|
||||
* behaviour.
|
||||
*
|
||||
* Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an
|
||||
* application in /Applications/SDLApp/MyApp.app):
|
||||
*
|
||||
* - `resource`: bundle resource directory (the default). For example:
|
||||
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
|
||||
* - `bundle`: the Bundle directory. For example:
|
||||
* `/Applications/SDLApp/MyApp.app/`
|
||||
* - `parent`: the containing directory of the bundle. For example:
|
||||
* `/Applications/SDLApp/`
|
||||
*
|
||||
* **Nintendo 3DS Specific Functionality**: This function returns "romfs"
|
||||
* directory of the application as it is uncommon to store resources outside
|
||||
* the executable. As such it is not a writable directory.
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* \returns an absolute path in UTF-8 encoding to the application data
|
||||
* directory. NULL will be returned on error or when the platform
|
||||
* doesn't implement this functionality, call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetPrefPath
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void);
|
||||
|
||||
/**
|
||||
* Get the user-and-app-specific path where files can be written.
|
||||
*
|
||||
* Get the "pref dir". This is meant to be where users can write personal
|
||||
* files (preferences and save games, etc) that are specific to your
|
||||
* application. This directory is unique per user, per application.
|
||||
*
|
||||
* This function will decide the appropriate location in the native
|
||||
* filesystem, create the directory if necessary, and return a string of the
|
||||
* absolute path to the directory in UTF-8 encoding.
|
||||
*
|
||||
* On Windows, the string might look like:
|
||||
*
|
||||
* `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`
|
||||
*
|
||||
* On Linux, the string might look like:
|
||||
*
|
||||
* `/home/bob/.local/share/My Program Name/`
|
||||
*
|
||||
* On macOS, the string might look like:
|
||||
*
|
||||
* `/Users/bob/Library/Application Support/My Program Name/`
|
||||
*
|
||||
* You should assume the path returned by this function is the only safe place
|
||||
* to write files (and that SDL_GetBasePath(), while it might be writable, or
|
||||
* even the parent of the returned path, isn't where you should be writing
|
||||
* things).
|
||||
*
|
||||
* Both the org and app strings may become part of a directory name, so please
|
||||
* follow these rules:
|
||||
*
|
||||
* - Try to use the same org string (_including case-sensitivity_) for all
|
||||
* your applications that use this function.
|
||||
* - Always use a unique app string for each one, and make sure it never
|
||||
* changes for an app once you've decided on it.
|
||||
* - Unicode characters are legal, as long as they are UTF-8 encoded, but...
|
||||
* - ...only use letters, numbers, and spaces. Avoid punctuation like "Game
|
||||
* Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
|
||||
*
|
||||
* Due to historical mistakes, `org` is allowed to be NULL or "". In such
|
||||
* cases, SDL will omit the org subdirectory, including on platforms where it
|
||||
* shouldn't, and including on platforms where this would make your app fail
|
||||
* certification for an app store. New apps should definitely specify a real
|
||||
* string for `org`.
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* \param org the name of your organization.
|
||||
* \param app the name of your application.
|
||||
* \returns a UTF-8 string of the user directory in platform-dependent
|
||||
* notation. NULL if there's a problem (creating directory failed,
|
||||
* etc.). This should be freed with SDL_free() when it is no longer
|
||||
* needed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetBasePath
|
||||
*/
|
||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *app);
|
||||
|
||||
/**
|
||||
* The type of the OS-provided default folder for a specific purpose.
|
||||
*
|
||||
* Note that the Trash folder isn't included here, because trashing files
|
||||
* usually involves extra OS-specific functionality to remember the file's
|
||||
* original location.
|
||||
*
|
||||
* The folders supported per platform are:
|
||||
*
|
||||
* | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten |
|
||||
* | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- |
|
||||
* | HOME | X | X | | X | X | X |
|
||||
* | DESKTOP | X | X | | X | X | |
|
||||
* | DOCUMENTS | X | X | | X | | |
|
||||
* | DOWNLOADS | Vista+ | X | | X | | |
|
||||
* | MUSIC | X | X | | X | | |
|
||||
* | PICTURES | X | X | | X | | |
|
||||
* | PUBLICSHARE | | X | | X | | |
|
||||
* | SAVEDGAMES | Vista+ | | | | | |
|
||||
* | SCREENSHOTS | Vista+ | | | | | |
|
||||
* | TEMPLATES | X | X | | X | | |
|
||||
* | VIDEOS | X | X* | | X | | |
|
||||
*
|
||||
* Note that on macOS/iOS, the Videos folder is called "Movies".
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetUserFolder
|
||||
*/
|
||||
typedef enum SDL_Folder
|
||||
{
|
||||
SDL_FOLDER_HOME, /**< The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. */
|
||||
SDL_FOLDER_DESKTOP, /**< The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. */
|
||||
SDL_FOLDER_DOCUMENTS, /**< User document files, possibly application-specific. This is a good place to save a user's projects. */
|
||||
SDL_FOLDER_DOWNLOADS, /**< Standard folder for user files downloaded from the internet. */
|
||||
SDL_FOLDER_MUSIC, /**< Music files that can be played using a standard music player (mp3, ogg...). */
|
||||
SDL_FOLDER_PICTURES, /**< Image files that can be displayed using a standard viewer (png, jpg...). */
|
||||
SDL_FOLDER_PUBLICSHARE, /**< Files that are meant to be shared with other users on the same computer. */
|
||||
SDL_FOLDER_SAVEDGAMES, /**< Save files for games. */
|
||||
SDL_FOLDER_SCREENSHOTS, /**< Application screenshots. */
|
||||
SDL_FOLDER_TEMPLATES, /**< Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. */
|
||||
SDL_FOLDER_VIDEOS, /**< Video files that can be played using a standard video player (mp4, webm...). */
|
||||
SDL_FOLDER_COUNT /**< Total number of types in this enum, not a folder type by itself. */
|
||||
} SDL_Folder;
|
||||
|
||||
/**
|
||||
* Finds the most suitable user folder for a specific purpose.
|
||||
*
|
||||
* Many OSes provide certain standard folders for certain purposes, such as
|
||||
* storing pictures, music or videos for a certain user. This function gives
|
||||
* the path for many of those special locations.
|
||||
*
|
||||
* This function is specifically for _user_ folders, which are meant for the
|
||||
* user to access and manage. For application-specific folders, meant to hold
|
||||
* data for the application to manage, see SDL_GetBasePath() and
|
||||
* SDL_GetPrefPath().
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* If NULL is returned, the error may be obtained with SDL_GetError().
|
||||
*
|
||||
* \param folder the type of folder to find.
|
||||
* \returns either a null-terminated C string containing the full path to the
|
||||
* folder, or NULL if an error happened.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder);
|
||||
|
||||
|
||||
/* Abstract filesystem interface */
|
||||
|
||||
/**
|
||||
* Types of filesystem entries.
|
||||
*
|
||||
* Note that there may be other sorts of items on a filesystem: devices,
|
||||
* symlinks, named pipes, etc. They are currently reported as
|
||||
* SDL_PATHTYPE_OTHER.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_PathInfo
|
||||
*/
|
||||
typedef enum SDL_PathType
|
||||
{
|
||||
SDL_PATHTYPE_NONE, /**< path does not exist */
|
||||
SDL_PATHTYPE_FILE, /**< a normal file */
|
||||
SDL_PATHTYPE_DIRECTORY, /**< a directory */
|
||||
SDL_PATHTYPE_OTHER /**< something completely different like a device node (not a symlink, those are always followed) */
|
||||
} SDL_PathType;
|
||||
|
||||
/**
|
||||
* Information about a path on the filesystem.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetPathInfo
|
||||
* \sa SDL_GetStoragePathInfo
|
||||
*/
|
||||
typedef struct SDL_PathInfo
|
||||
{
|
||||
SDL_PathType type; /**< the path type */
|
||||
Uint64 size; /**< the file size in bytes */
|
||||
SDL_Time create_time; /**< the time when the path was created */
|
||||
SDL_Time modify_time; /**< the last time the path was modified */
|
||||
SDL_Time access_time; /**< the last time the path was read */
|
||||
} SDL_PathInfo;
|
||||
|
||||
/**
|
||||
* Flags for path matching.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GlobDirectory
|
||||
* \sa SDL_GlobStorageDirectory
|
||||
*/
|
||||
typedef Uint32 SDL_GlobFlags;
|
||||
|
||||
#define SDL_GLOB_CASEINSENSITIVE (1u << 0)
|
||||
|
||||
/**
|
||||
* Create a directory, and any missing parent directories.
|
||||
*
|
||||
* This reports success if `path` already exists as a directory.
|
||||
*
|
||||
* If parent directories are missing, it will also create them. Note that if
|
||||
* this fails, it will not remove any parent directories it already made.
|
||||
*
|
||||
* \param path the path of the directory to create.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CreateDirectory(const char *path);
|
||||
|
||||
/**
|
||||
* Possible results from an enumeration callback.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_EnumerateDirectoryCallback
|
||||
*/
|
||||
typedef enum SDL_EnumerationResult
|
||||
{
|
||||
SDL_ENUM_CONTINUE, /**< Value that requests that enumeration continue. */
|
||||
SDL_ENUM_SUCCESS, /**< Value that requests that enumeration stop, successfully. */
|
||||
SDL_ENUM_FAILURE /**< Value that requests that enumeration stop, as a failure. */
|
||||
} SDL_EnumerationResult;
|
||||
|
||||
/**
|
||||
* Callback for directory enumeration.
|
||||
*
|
||||
* Enumeration of directory entries will continue until either all entries
|
||||
* have been provided to the callback, or the callback has requested a stop
|
||||
* through its return value.
|
||||
*
|
||||
* Returning SDL_ENUM_CONTINUE will let enumeration proceed, calling the
|
||||
* callback with further entries. SDL_ENUM_SUCCESS and SDL_ENUM_FAILURE will
|
||||
* terminate the enumeration early, and dictate the return value of the
|
||||
* enumeration function itself.
|
||||
*
|
||||
* `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/'
|
||||
* on most other platforms).
|
||||
*
|
||||
* \param userdata an app-controlled pointer that is passed to the callback.
|
||||
* \param dirname the directory that is being enumerated.
|
||||
* \param fname the next entry in the enumeration.
|
||||
* \returns how the enumeration should proceed.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_EnumerateDirectory
|
||||
*/
|
||||
typedef SDL_EnumerationResult (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char *dirname, const char *fname);
|
||||
|
||||
/**
|
||||
* Enumerate a directory through a callback function.
|
||||
*
|
||||
* This function provides every directory entry through an app-provided
|
||||
* callback, called once for each directory entry, until all results have been
|
||||
* provided or the callback returns either SDL_ENUM_SUCCESS or
|
||||
* SDL_ENUM_FAILURE.
|
||||
*
|
||||
* This will return false if there was a system problem in general, or if a
|
||||
* callback returns SDL_ENUM_FAILURE. A successful return means a callback
|
||||
* returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries
|
||||
* were enumerated.
|
||||
*
|
||||
* \param path the path of the directory to enumerate.
|
||||
* \param callback a function that is called for each entry in the directory.
|
||||
* \param userdata a pointer that is passed to `callback`.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
|
||||
|
||||
/**
|
||||
* Remove a file or an empty directory.
|
||||
*
|
||||
* Directories that are not empty will fail; this function will not recursely
|
||||
* delete directory trees.
|
||||
*
|
||||
* \param path the path to remove from the filesystem.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path);
|
||||
|
||||
/**
|
||||
* Rename a file or directory.
|
||||
*
|
||||
* If the file at `newpath` already exists, it will be replaced.
|
||||
*
|
||||
* Note that this will not copy files across filesystems/drives/volumes, as
|
||||
* that is a much more complicated (and possibly time-consuming) operation.
|
||||
*
|
||||
* Which is to say, if this function fails, SDL_CopyFile() to a temporary file
|
||||
* in the same directory as `newpath`, then SDL_RenamePath() from the
|
||||
* temporary file to `newpath` and SDL_RemovePath() on `oldpath` might work
|
||||
* for files. Renaming a non-empty directory across filesystems is
|
||||
* dramatically more complex, however.
|
||||
*
|
||||
* \param oldpath the old path.
|
||||
* \param newpath the new path.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
|
||||
|
||||
/**
|
||||
* Copy a file.
|
||||
*
|
||||
* If the file at `newpath` already exists, it will be overwritten with the
|
||||
* contents of the file at `oldpath`.
|
||||
*
|
||||
* This function will block until the copy is complete, which might be a
|
||||
* significant time for large files on slow disks. On some platforms, the copy
|
||||
* can be handed off to the OS itself, but on others SDL might just open both
|
||||
* paths, and read from one and write to the other.
|
||||
*
|
||||
* Note that this is not an atomic operation! If something tries to read from
|
||||
* `newpath` while the copy is in progress, it will see an incomplete copy of
|
||||
* the data, and if the calling thread terminates (or the power goes out)
|
||||
* during the copy, `newpath`'s previous contents will be gone, replaced with
|
||||
* an incomplete copy of the data. To avoid this risk, it is recommended that
|
||||
* the app copy to a temporary file in the same directory as `newpath`, and if
|
||||
* the copy is successful, use SDL_RenamePath() to replace `newpath` with the
|
||||
* temporary file. This will ensure that reads of `newpath` will either see a
|
||||
* complete copy of the data, or it will see the pre-copy state of `newpath`.
|
||||
*
|
||||
* This function attempts to synchronize the newly-copied data to disk before
|
||||
* returning, if the platform allows it, so that the renaming trick will not
|
||||
* have a problem in a system crash or power failure, where the file could be
|
||||
* renamed but the contents never made it from the system file cache to the
|
||||
* physical disk.
|
||||
*
|
||||
* If the copy fails for any reason, the state of `newpath` is undefined. It
|
||||
* might be half a copy, it might be the untouched data of what was already
|
||||
* there, or it might be a zero-byte file, etc.
|
||||
*
|
||||
* \param oldpath the old path.
|
||||
* \param newpath the new path.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, but this
|
||||
* operation is not atomic, so the app might need to protect
|
||||
* access to specific paths from other threads if appropriate.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
|
||||
|
||||
/**
|
||||
* Get information about a filesystem path.
|
||||
*
|
||||
* \param path the path to query.
|
||||
* \param info a pointer filled in with information about the path, or NULL to
|
||||
* check for the existence of a file.
|
||||
* \returns true on success or false if the file doesn't exist, or another
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
|
||||
|
||||
/**
|
||||
* Enumerate a directory tree, filtered by pattern, and return a list.
|
||||
*
|
||||
* Files are filtered out if they don't match the string in `pattern`, which
|
||||
* may contain wildcard characters `*` (match everything) and `?` (match one
|
||||
* character). If pattern is NULL, no filtering is done and all results are
|
||||
* returned. Subdirectories are permitted, and are specified with a path
|
||||
* separator of `/`. Wildcard characters `*` and `?` never match a path
|
||||
* separator.
|
||||
*
|
||||
* `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching
|
||||
* case-insensitive.
|
||||
*
|
||||
* The returned array is always NULL-terminated, for your iterating
|
||||
* convenience, but if `count` is non-NULL, on return it will contain the
|
||||
* number of items in the array, not counting the NULL terminator.
|
||||
*
|
||||
* \param path the path of the directory to enumerate.
|
||||
* \param pattern the pattern that files in the directory must match. Can be
|
||||
* NULL.
|
||||
* \param flags `SDL_GLOB_*` bitflags that affect this search.
|
||||
* \param count on return, will be set to the number of items in the returned
|
||||
* array. Can be NULL.
|
||||
* \returns an array of strings on success or NULL on failure; call
|
||||
* SDL_GetError() for more information. This is a single allocation
|
||||
* that should be freed with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count);
|
||||
|
||||
/**
|
||||
* Get what the system believes is the "current working directory."
|
||||
*
|
||||
* For systems without a concept of a current working directory, this will
|
||||
* still attempt to provide something reasonable.
|
||||
*
|
||||
* SDL does not provide a means to _change_ the current working directory; for
|
||||
* platforms without this concept, this would cause surprises with file access
|
||||
* outside of SDL.
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* \returns a UTF-8 string of the current working directory in
|
||||
* platform-dependent notation. NULL if there's a problem. This
|
||||
* should be freed with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetCurrentDirectory(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_filesystem_h_ */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: GUID */
|
||||
|
||||
/**
|
||||
* # CategoryGUID
|
||||
*
|
||||
* A GUID is a 128-bit value that represents something that is uniquely
|
||||
* identifiable by this value: "globally unique."
|
||||
*
|
||||
* SDL provides functions to convert a GUID to/from a string.
|
||||
*/
|
||||
|
||||
#ifndef SDL_guid_h_
|
||||
#define SDL_guid_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An SDL_GUID is a 128-bit identifier for an input device that identifies
|
||||
* that device across runs of SDL programs on the same platform.
|
||||
*
|
||||
* If the device is detached and then re-attached to a different port, or if
|
||||
* the base system is rebooted, the device should still report the same GUID.
|
||||
*
|
||||
* GUIDs are as precise as possible but are not guaranteed to distinguish
|
||||
* physically distinct but equivalent devices. For example, two game
|
||||
* controllers from the same vendor with the same product ID and revision may
|
||||
* have the same GUID.
|
||||
*
|
||||
* GUIDs may be platform-dependent (i.e., the same device may report different
|
||||
* GUIDs on different operating systems).
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_GUID {
|
||||
Uint8 data[16];
|
||||
} SDL_GUID;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Get an ASCII string representation for a given SDL_GUID.
|
||||
*
|
||||
* \param guid the SDL_GUID you wish to convert to string.
|
||||
* \param pszGUID buffer in which to write the ASCII string.
|
||||
* \param cbGUID the size of pszGUID, should be at least 33 bytes.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StringToGUID
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
|
||||
|
||||
/**
|
||||
* Convert a GUID string into a SDL_GUID structure.
|
||||
*
|
||||
* Performs no error checking. If this function is given a string containing
|
||||
* an invalid GUID, the function will silently succeed, but the GUID generated
|
||||
* will not be useful.
|
||||
*
|
||||
* \param pchGUID string containing an ASCII representation of a GUID.
|
||||
* \returns a SDL_GUID structure.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GUIDToString
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_guid_h_ */
|
||||
@@ -0,0 +1,571 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: HIDAPI */
|
||||
|
||||
/**
|
||||
* # CategoryHIDAPI
|
||||
*
|
||||
* Header file for SDL HIDAPI functions.
|
||||
*
|
||||
* This is an adaptation of the original HIDAPI interface by Alan Ott, and
|
||||
* includes source code licensed under the following license:
|
||||
*
|
||||
* ```
|
||||
* HIDAPI - Multi-Platform library for
|
||||
* communication with HID devices.
|
||||
*
|
||||
* Copyright 2009, Alan Ott, Signal 11 Software.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software may be used by anyone for any reason so
|
||||
* long as the copyright notice in the source files
|
||||
* remains intact.
|
||||
* ```
|
||||
*
|
||||
* (Note that this license is the same as item three of SDL's zlib license, so
|
||||
* it adds no new requirements on the user.)
|
||||
*
|
||||
* If you would like a version of SDL without this code, you can build SDL
|
||||
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for
|
||||
* example on iOS or tvOS to avoid a dependency on the CoreBluetooth
|
||||
* framework.
|
||||
*/
|
||||
|
||||
#ifndef SDL_hidapi_h_
|
||||
#define SDL_hidapi_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An opaque handle representing an open HID device.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_hid_device SDL_hid_device;
|
||||
|
||||
/**
|
||||
* HID underlying bus types.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_hid_bus_type {
|
||||
/** Unknown bus type */
|
||||
SDL_HID_API_BUS_UNKNOWN = 0x00,
|
||||
|
||||
/** USB bus
|
||||
Specifications:
|
||||
https://usb.org/hid */
|
||||
SDL_HID_API_BUS_USB = 0x01,
|
||||
|
||||
/** Bluetooth or Bluetooth LE bus
|
||||
Specifications:
|
||||
https://www.bluetooth.com/specifications/specs/human-interface-device-profile-1-1-1/
|
||||
https://www.bluetooth.com/specifications/specs/hid-service-1-0/
|
||||
https://www.bluetooth.com/specifications/specs/hid-over-gatt-profile-1-0/ */
|
||||
SDL_HID_API_BUS_BLUETOOTH = 0x02,
|
||||
|
||||
/** I2C bus
|
||||
Specifications:
|
||||
https://docs.microsoft.com/previous-versions/windows/hardware/design/dn642101(v=vs.85) */
|
||||
SDL_HID_API_BUS_I2C = 0x03,
|
||||
|
||||
/** SPI bus
|
||||
Specifications:
|
||||
https://www.microsoft.com/download/details.aspx?id=103325 */
|
||||
SDL_HID_API_BUS_SPI = 0x04
|
||||
|
||||
} SDL_hid_bus_type;
|
||||
|
||||
/** hidapi info structure */
|
||||
|
||||
/**
|
||||
* Information about a connected HID device
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_hid_device_info
|
||||
{
|
||||
/** Platform-specific device path */
|
||||
char *path;
|
||||
/** Device Vendor ID */
|
||||
unsigned short vendor_id;
|
||||
/** Device Product ID */
|
||||
unsigned short product_id;
|
||||
/** Serial Number */
|
||||
wchar_t *serial_number;
|
||||
/** Device Release Number in binary-coded decimal,
|
||||
also known as Device Version Number */
|
||||
unsigned short release_number;
|
||||
/** Manufacturer String */
|
||||
wchar_t *manufacturer_string;
|
||||
/** Product string */
|
||||
wchar_t *product_string;
|
||||
/** Usage Page for this Device/Interface
|
||||
(Windows/Mac/hidraw only) */
|
||||
unsigned short usage_page;
|
||||
/** Usage for this Device/Interface
|
||||
(Windows/Mac/hidraw only) */
|
||||
unsigned short usage;
|
||||
/** The USB interface which this logical device
|
||||
represents.
|
||||
|
||||
Valid only if the device is a USB HID device.
|
||||
Set to -1 in all other cases.
|
||||
*/
|
||||
int interface_number;
|
||||
|
||||
/** Additional information about the USB interface.
|
||||
Valid on libusb and Android implementations. */
|
||||
int interface_class;
|
||||
int interface_subclass;
|
||||
int interface_protocol;
|
||||
|
||||
/** Underlying bus type */
|
||||
SDL_hid_bus_type bus_type;
|
||||
|
||||
/** Pointer to the next device */
|
||||
struct SDL_hid_device_info *next;
|
||||
|
||||
} SDL_hid_device_info;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the HIDAPI library.
|
||||
*
|
||||
* This function initializes the HIDAPI library. Calling it is not strictly
|
||||
* necessary, as it will be called automatically by SDL_hid_enumerate() and
|
||||
* any of the SDL_hid_open_*() functions if it is needed. This function should
|
||||
* be called at the beginning of execution however, if there is a chance of
|
||||
* HIDAPI handles being opened by different threads simultaneously.
|
||||
*
|
||||
* Each call to this function should have a matching call to SDL_hid_exit()
|
||||
*
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_hid_exit
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_init(void);
|
||||
|
||||
/**
|
||||
* Finalize the HIDAPI library.
|
||||
*
|
||||
* This function frees all of the static data associated with HIDAPI. It
|
||||
* should be called at the end of execution to avoid memory leaks.
|
||||
*
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_hid_init
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_exit(void);
|
||||
|
||||
/**
|
||||
* Check to see if devices may have been added or removed.
|
||||
*
|
||||
* Enumerating the HID devices is an expensive operation, so you can call this
|
||||
* to see if there have been any system device changes since the last call to
|
||||
* this function. A change in the counter returned doesn't necessarily mean
|
||||
* that anything has changed, but you can call SDL_hid_enumerate() to get an
|
||||
* updated device list.
|
||||
*
|
||||
* Calling this function for the first time may cause a thread or other system
|
||||
* resource to be allocated to track device change notifications.
|
||||
*
|
||||
* \returns a change counter that is incremented with each potential device
|
||||
* change, or 0 if device change detection isn't available.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_hid_enumerate
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
|
||||
|
||||
/**
|
||||
* Enumerate the HID Devices.
|
||||
*
|
||||
* This function returns a linked list of all the HID devices attached to the
|
||||
* system which match vendor_id and product_id. If `vendor_id` is set to 0
|
||||
* then any vendor matches. If `product_id` is set to 0 then any product
|
||||
* matches. If `vendor_id` and `product_id` are both set to 0, then all HID
|
||||
* devices will be returned.
|
||||
*
|
||||
* By default SDL will only enumerate controllers, to reduce risk of hanging
|
||||
* or crashing on bad drivers, but SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS
|
||||
* can be set to "0" to enumerate all HID devices.
|
||||
*
|
||||
* \param vendor_id the Vendor ID (VID) of the types of device to open, or 0
|
||||
* to match any vendor.
|
||||
* \param product_id the Product ID (PID) of the types of device to open, or 0
|
||||
* to match any product.
|
||||
* \returns a pointer to a linked list of type SDL_hid_device_info, containing
|
||||
* information about the HID devices attached to the system, or NULL
|
||||
* in the case of failure. Free this linked list by calling
|
||||
* SDL_hid_free_enumeration().
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_hid_device_change_count
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
|
||||
|
||||
/**
|
||||
* Free an enumeration linked list.
|
||||
*
|
||||
* This function frees a linked list created by SDL_hid_enumerate().
|
||||
*
|
||||
* \param devs pointer to a list of struct_device returned from
|
||||
* SDL_hid_enumerate().
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
|
||||
|
||||
/**
|
||||
* Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally
|
||||
* a serial number.
|
||||
*
|
||||
* If `serial_number` is NULL, the first device with the specified VID and PID
|
||||
* is opened.
|
||||
*
|
||||
* \param vendor_id the Vendor ID (VID) of the device to open.
|
||||
* \param product_id the Product ID (PID) of the device to open.
|
||||
* \param serial_number the Serial Number of the device to open (Optionally
|
||||
* NULL).
|
||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
|
||||
|
||||
/**
|
||||
* Open a HID device by its path name.
|
||||
*
|
||||
* The path name be determined by calling SDL_hid_enumerate(), or a
|
||||
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
|
||||
*
|
||||
* \param path the path name of the device to open.
|
||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an SDL_hid_device.
|
||||
*
|
||||
* The following read-only properties are provided by SDL:
|
||||
*
|
||||
* - `SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER`: the libusb_device_handle
|
||||
* associated with the device, if it was opened using libusb.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.4.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_hid_get_properties(SDL_hid_device *dev);
|
||||
|
||||
#define SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER "SDL.hidapi.libusb.device.handle"
|
||||
|
||||
/**
|
||||
* Write an Output report to a HID device.
|
||||
*
|
||||
* The first byte of `data` must contain the Report ID. For devices which only
|
||||
* support a single report, this must be set to 0x0. The remaining bytes
|
||||
* contain the report data. Since the Report ID is mandatory, calls to
|
||||
* SDL_hid_write() will always contain one more byte than the report contains.
|
||||
* For example, if a hid report is 16 bytes long, 17 bytes must be passed to
|
||||
* SDL_hid_write(), the Report ID (or 0x0, for devices with a single report),
|
||||
* followed by the report data (16 bytes). In this example, the length passed
|
||||
* in would be 17.
|
||||
*
|
||||
* SDL_hid_write() will send the data on the first OUT endpoint, if one
|
||||
* exists. If it does not, it will send the data through the Control Endpoint
|
||||
* (Endpoint 0).
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data the data to send, including the report number as the first
|
||||
* byte.
|
||||
* \param length the length in bytes of the data to send.
|
||||
* \returns the actual number of bytes written and -1 on on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Read an Input report from a HID device with timeout.
|
||||
*
|
||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||
* The first byte will contain the Report number if the device uses numbered
|
||||
* reports.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data a buffer to put the read data into.
|
||||
* \param length the number of bytes to read. For devices with multiple
|
||||
* reports, make sure to read an extra byte for the report
|
||||
* number.
|
||||
* \param milliseconds timeout in milliseconds or -1 for blocking wait.
|
||||
* \returns the actual number of bytes read and -1 on on failure; call
|
||||
* SDL_GetError() for more information. If no packet was available to
|
||||
* be read within the timeout period, this function returns 0.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
|
||||
|
||||
/**
|
||||
* Read an Input report from a HID device.
|
||||
*
|
||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||
* The first byte will contain the Report number if the device uses numbered
|
||||
* reports.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data a buffer to put the read data into.
|
||||
* \param length the number of bytes to read. For devices with multiple
|
||||
* reports, make sure to read an extra byte for the report
|
||||
* number.
|
||||
* \returns the actual number of bytes read and -1 on failure; call
|
||||
* SDL_GetError() for more information. If no packet was available to
|
||||
* be read and the handle is in non-blocking mode, this function
|
||||
* returns 0.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Set the device handle to be non-blocking.
|
||||
*
|
||||
* In non-blocking mode calls to SDL_hid_read() will return immediately with a
|
||||
* value of 0 if there is no data to be read. In blocking mode, SDL_hid_read()
|
||||
* will wait (block) until there is data to read before returning.
|
||||
*
|
||||
* Nonblocking can be turned on and off at any time.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param nonblock enable or not the nonblocking reads - 1 to enable
|
||||
* nonblocking - 0 to disable nonblocking.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
|
||||
|
||||
/**
|
||||
* Send a Feature report to the device.
|
||||
*
|
||||
* Feature reports are sent over the Control endpoint as a Set_Report
|
||||
* transfer. The first byte of `data` must contain the Report ID. For devices
|
||||
* which only support a single report, this must be set to 0x0. The remaining
|
||||
* bytes contain the report data. Since the Report ID is mandatory, calls to
|
||||
* SDL_hid_send_feature_report() will always contain one more byte than the
|
||||
* report contains. For example, if a hid report is 16 bytes long, 17 bytes
|
||||
* must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for
|
||||
* devices which do not use numbered reports), followed by the report data (16
|
||||
* bytes). In this example, the length passed in would be 17.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data the data to send, including the report number as the first
|
||||
* byte.
|
||||
* \param length the length in bytes of the data to send, including the report
|
||||
* number.
|
||||
* \returns the actual number of bytes written and -1 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Get a feature report from a HID device.
|
||||
*
|
||||
* Set the first byte of `data` to the Report ID of the report to be read.
|
||||
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
||||
* first byte will still contain the Report ID, and the report data will start
|
||||
* in data[1].
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data a buffer to put the read data into, including the Report ID.
|
||||
* Set the first byte of `data` to the Report ID of the report to
|
||||
* be read, or set it to zero if your device does not use numbered
|
||||
* reports.
|
||||
* \param length the number of bytes to read, including an extra byte for the
|
||||
* report ID. The buffer can be longer than the actual report.
|
||||
* \returns the number of bytes read plus one for the report ID (which is
|
||||
* still in the first byte), or -1 on on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Get an input report from a HID device.
|
||||
*
|
||||
* Set the first byte of `data` to the Report ID of the report to be read.
|
||||
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
||||
* first byte will still contain the Report ID, and the report data will start
|
||||
* in data[1].
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param data a buffer to put the read data into, including the Report ID.
|
||||
* Set the first byte of `data` to the Report ID of the report to
|
||||
* be read, or set it to zero if your device does not use numbered
|
||||
* reports.
|
||||
* \param length the number of bytes to read, including an extra byte for the
|
||||
* report ID. The buffer can be longer than the actual report.
|
||||
* \returns the number of bytes read plus one for the report ID (which is
|
||||
* still in the first byte), or -1 on on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_input_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Close a HID device.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev);
|
||||
|
||||
/**
|
||||
* Get The Manufacturer String from a HID device.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param string a wide string buffer to put the data into.
|
||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get The Product String from a HID device.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param string a wide string buffer to put the data into.
|
||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get The Serial Number String from a HID device.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param string a wide string buffer to put the data into.
|
||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get a string from a HID device, based on its string index.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param string_index the index of the string to get.
|
||||
* \param string a wide string buffer to put the data into.
|
||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get the device info from a HID device.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \returns a pointer to the SDL_hid_device_info for this hid_device or NULL
|
||||
* on failure; call SDL_GetError() for more information. This struct
|
||||
* is valid until the device is closed with SDL_hid_close().
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_get_device_info(SDL_hid_device *dev);
|
||||
|
||||
/**
|
||||
* Get a report descriptor from a HID device.
|
||||
*
|
||||
* User has to provide a preallocated buffer where descriptor will be copied
|
||||
* to. The recommended size for a preallocated buffer is 4096 bytes.
|
||||
*
|
||||
* \param dev a device handle returned from SDL_hid_open().
|
||||
* \param buf the buffer to copy descriptor into.
|
||||
* \param buf_size the size of the buffer in bytes.
|
||||
* \returns the number of bytes actually copied or -1 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *dev, unsigned char *buf, size_t buf_size);
|
||||
|
||||
/**
|
||||
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers.
|
||||
*
|
||||
* \param active true to start the scan, false to stop the scan.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(bool active);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_hidapi_h_ */
|
||||
@@ -0,0 +1,497 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryInit
|
||||
*
|
||||
* All SDL programs need to initialize the library before starting to work
|
||||
* with it.
|
||||
*
|
||||
* Almost everything can simply call SDL_Init() near startup, with a handful
|
||||
* of flags to specify subsystems to touch. These are here to make sure SDL
|
||||
* does not even attempt to touch low-level pieces of the operating system
|
||||
* that you don't intend to use. For example, you might be using SDL for video
|
||||
* and input but chose an external library for audio, and in this case you
|
||||
* would just need to leave off the `SDL_INIT_AUDIO` flag to make sure that
|
||||
* external library has complete control.
|
||||
*
|
||||
* Most apps, when terminating, should call SDL_Quit(). This will clean up
|
||||
* (nearly) everything that SDL might have allocated, and crucially, it'll
|
||||
* make sure that the display's resolution is back to what the user expects if
|
||||
* you had previously changed it for your game.
|
||||
*
|
||||
* SDL3 apps are strongly encouraged to call SDL_SetAppMetadata() at startup
|
||||
* to fill in details about the program. This is completely optional, but it
|
||||
* helps in small ways (we can provide an About dialog box for the macOS menu,
|
||||
* we can name the app in the system's audio mixer, etc). Those that want to
|
||||
* provide a _lot_ of information should look at the more-detailed
|
||||
* SDL_SetAppMetadataProperty().
|
||||
*/
|
||||
|
||||
#ifndef SDL_init_h_
|
||||
#define SDL_init_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_events.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/**
|
||||
* Initialization flags for SDL_Init and/or SDL_InitSubSystem
|
||||
*
|
||||
* These are the flags which may be passed to SDL_Init(). You should specify
|
||||
* the subsystems which you will be using in your application.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_Quit
|
||||
* \sa SDL_InitSubSystem
|
||||
* \sa SDL_QuitSubSystem
|
||||
* \sa SDL_WasInit
|
||||
*/
|
||||
typedef Uint32 SDL_InitFlags;
|
||||
|
||||
#define SDL_INIT_AUDIO 0x00000010u /**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */
|
||||
#define SDL_INIT_VIDEO 0x00000020u /**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread */
|
||||
#define SDL_INIT_JOYSTICK 0x00000200u /**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS` */
|
||||
#define SDL_INIT_HAPTIC 0x00001000u
|
||||
#define SDL_INIT_GAMEPAD 0x00002000u /**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
|
||||
#define SDL_INIT_EVENTS 0x00004000u
|
||||
#define SDL_INIT_SENSOR 0x00008000u /**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
|
||||
#define SDL_INIT_CAMERA 0x00010000u /**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
|
||||
|
||||
/**
|
||||
* Return values for optional main callbacks.
|
||||
*
|
||||
* Returning SDL_APP_SUCCESS or SDL_APP_FAILURE from SDL_AppInit,
|
||||
* SDL_AppEvent, or SDL_AppIterate will terminate the program and report
|
||||
* success/failure to the operating system. What that means is
|
||||
* platform-dependent. On Unix, for example, on success, the process error
|
||||
* code will be zero, and on failure it will be 1. This interface doesn't
|
||||
* allow you to return specific exit codes, just whether there was an error
|
||||
* generally or not.
|
||||
*
|
||||
* Returning SDL_APP_CONTINUE from these functions will let the app continue
|
||||
* to run.
|
||||
*
|
||||
* See
|
||||
* [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README-main-functions#main-callbacks-in-sdl3)
|
||||
* for complete details.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_AppResult
|
||||
{
|
||||
SDL_APP_CONTINUE, /**< Value that requests that the app continue from the main callbacks. */
|
||||
SDL_APP_SUCCESS, /**< Value that requests termination with success from the main callbacks. */
|
||||
SDL_APP_FAILURE /**< Value that requests termination with error from the main callbacks. */
|
||||
} SDL_AppResult;
|
||||
|
||||
/**
|
||||
* Function pointer typedef for SDL_AppInit.
|
||||
*
|
||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
||||
* use this should just implement SDL_AppInit directly.
|
||||
*
|
||||
* \param appstate a place where the app can optionally store a pointer for
|
||||
* future use.
|
||||
* \param argc the standard ANSI C main's argc; number of elements in `argv`.
|
||||
* \param argv the standard ANSI C main's argv; array of command line
|
||||
* arguments.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Function pointer typedef for SDL_AppIterate.
|
||||
*
|
||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
||||
* use this should just implement SDL_AppIterate directly.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
|
||||
|
||||
/**
|
||||
* Function pointer typedef for SDL_AppEvent.
|
||||
*
|
||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
||||
* use this should just implement SDL_AppEvent directly.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \param event the new event for the app to examine.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *event);
|
||||
|
||||
/**
|
||||
* Function pointer typedef for SDL_AppQuit.
|
||||
*
|
||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
||||
* use this should just implement SDL_AppEvent directly.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \param result the result code that terminated the app (success or failure).
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate, SDL_AppResult result);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the SDL library.
|
||||
*
|
||||
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
|
||||
* two may be used interchangeably. Though for readability of your code
|
||||
* SDL_InitSubSystem() might be preferred.
|
||||
*
|
||||
* The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread)
|
||||
* subsystems are initialized by default. Message boxes
|
||||
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
|
||||
* video subsystem, in hopes of being useful in showing an error dialog when
|
||||
* SDL_Init fails. You must specifically initialize other subsystems if you
|
||||
* use them in your application.
|
||||
*
|
||||
* Logging (such as SDL_Log) works without initialization, too.
|
||||
*
|
||||
* `flags` may be any of the following OR'd together:
|
||||
*
|
||||
* - `SDL_INIT_AUDIO`: audio subsystem; automatically initializes the events
|
||||
* subsystem
|
||||
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
|
||||
* subsystem, should be initialized on the main thread.
|
||||
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
|
||||
* events subsystem
|
||||
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
|
||||
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
|
||||
* joystick subsystem
|
||||
* - `SDL_INIT_EVENTS`: events subsystem
|
||||
* - `SDL_INIT_SENSOR`: sensor subsystem; automatically initializes the events
|
||||
* subsystem
|
||||
* - `SDL_INIT_CAMERA`: camera subsystem; automatically initializes the events
|
||||
* subsystem
|
||||
*
|
||||
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
|
||||
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
|
||||
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
|
||||
* this call will increase the ref-count and return.
|
||||
*
|
||||
* Consider reporting some basic metadata about your application before
|
||||
* calling SDL_Init, using either SDL_SetAppMetadata() or
|
||||
* SDL_SetAppMetadataProperty().
|
||||
*
|
||||
* \param flags subsystem initialization flags.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAppMetadata
|
||||
* \sa SDL_SetAppMetadataProperty
|
||||
* \sa SDL_InitSubSystem
|
||||
* \sa SDL_Quit
|
||||
* \sa SDL_SetMainReady
|
||||
* \sa SDL_WasInit
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_Init(SDL_InitFlags flags);
|
||||
|
||||
/**
|
||||
* Compatibility function to initialize the SDL library.
|
||||
*
|
||||
* This function and SDL_Init() are interchangeable.
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_Quit
|
||||
* \sa SDL_QuitSubSystem
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
|
||||
|
||||
/**
|
||||
* Shut down specific SDL subsystems.
|
||||
*
|
||||
* You still need to call SDL_Quit() even if you close all open subsystems
|
||||
* with SDL_QuitSubSystem().
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_InitSubSystem
|
||||
* \sa SDL_Quit
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_QuitSubSystem(SDL_InitFlags flags);
|
||||
|
||||
/**
|
||||
* Get a mask of the specified subsystems which are currently initialized.
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
|
||||
* returns the initialization status of the specified subsystems.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_InitSubSystem
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags);
|
||||
|
||||
/**
|
||||
* Clean up all initialized subsystems.
|
||||
*
|
||||
* You should call this function even if you have already shutdown each
|
||||
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
|
||||
* function even in the case of errors in initialization.
|
||||
*
|
||||
* You can use this function with atexit() to ensure that it is run when your
|
||||
* application is shutdown, but it is not wise to do this from a library or
|
||||
* other dynamically loaded code.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_QuitSubSystem
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
|
||||
|
||||
/**
|
||||
* Return whether this is the main thread.
|
||||
*
|
||||
* On Apple platforms, the main thread is the thread that runs your program's
|
||||
* main() entry point. On other platforms, the main thread is the one that
|
||||
* calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs
|
||||
* your program's main() entry point. If you are using the main callbacks,
|
||||
* SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the
|
||||
* main thread.
|
||||
*
|
||||
* \returns true if this thread is the main thread, or false otherwise.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_RunOnMainThread
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_IsMainThread(void);
|
||||
|
||||
/**
|
||||
* Callback run on the main thread.
|
||||
*
|
||||
* \param userdata an app-controlled pointer that is passed to the callback.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_RunOnMainThread
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_MainThreadCallback)(void *userdata);
|
||||
|
||||
/**
|
||||
* Call a function on the main thread during event processing.
|
||||
*
|
||||
* If this is called on the main thread, the callback is executed immediately.
|
||||
* If this is called on another thread, this callback is queued for execution
|
||||
* on the main thread during event processing.
|
||||
*
|
||||
* Be careful of deadlocks when using this functionality. You should not have
|
||||
* the main thread wait for the current thread while this function is being
|
||||
* called with `wait_complete` true.
|
||||
*
|
||||
* \param callback the callback to call on the main thread.
|
||||
* \param userdata a pointer that is passed to `callback`.
|
||||
* \param wait_complete true to wait for the callback to complete, false to
|
||||
* return immediately.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_IsMainThread
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool wait_complete);
|
||||
|
||||
/**
|
||||
* Specify basic metadata about your app.
|
||||
*
|
||||
* You can optionally provide metadata about your app to SDL. This is not
|
||||
* required, but strongly encouraged.
|
||||
*
|
||||
* There are several locations where SDL can make use of metadata (an "About"
|
||||
* box in the macOS menu bar, the name of the app can be shown on some audio
|
||||
* mixers, etc). Any piece of metadata can be left as NULL, if a specific
|
||||
* detail doesn't make sense for the app.
|
||||
*
|
||||
* This function should be called as early as possible, before SDL_Init.
|
||||
* Multiple calls to this function are allowed, but various state might not
|
||||
* change once it has been set up with a previous call to this function.
|
||||
*
|
||||
* Passing a NULL removes any previous metadata.
|
||||
*
|
||||
* This is a simplified interface for the most important information. You can
|
||||
* supply significantly more detailed metadata with
|
||||
* SDL_SetAppMetadataProperty().
|
||||
*
|
||||
* \param appname The name of the application ("My Game 2: Bad Guy's
|
||||
* Revenge!").
|
||||
* \param appversion The version of the application ("1.0.0beta5" or a git
|
||||
* hash, or whatever makes sense).
|
||||
* \param appidentifier A unique string in reverse-domain format that
|
||||
* identifies this app ("com.example.mygame2").
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAppMetadataProperty
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
|
||||
|
||||
/**
|
||||
* Specify metadata about your app through a set of properties.
|
||||
*
|
||||
* You can optionally provide metadata about your app to SDL. This is not
|
||||
* required, but strongly encouraged.
|
||||
*
|
||||
* There are several locations where SDL can make use of metadata (an "About"
|
||||
* box in the macOS menu bar, the name of the app can be shown on some audio
|
||||
* mixers, etc). Any piece of metadata can be left out, if a specific detail
|
||||
* doesn't make sense for the app.
|
||||
*
|
||||
* This function should be called as early as possible, before SDL_Init.
|
||||
* Multiple calls to this function are allowed, but various state might not
|
||||
* change once it has been set up with a previous call to this function.
|
||||
*
|
||||
* Once set, this metadata can be read using SDL_GetAppMetadataProperty().
|
||||
*
|
||||
* These are the supported properties:
|
||||
*
|
||||
* - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the
|
||||
* application, like "My Game 2: Bad Guy's Revenge!". This will show up
|
||||
* anywhere the OS shows the name of the application separately from window
|
||||
* titles, such as volume control applets, etc. This defaults to "SDL
|
||||
* Application".
|
||||
* - `SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
|
||||
* running; there are no rules on format, so "1.0.3beta2" and "April 22nd,
|
||||
* 2024" and a git hash are all valid options. This has no default.
|
||||
* - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that
|
||||
* identifies this app. This must be in reverse-domain format, like
|
||||
* "com.example.mygame2". This string is used by desktop compositors to
|
||||
* identify and group windows together, as well as match applications with
|
||||
* associated desktop settings and icons. If you plan to package your
|
||||
* application in a container such as Flatpak, the app ID should match the
|
||||
* name of your Flatpak container as well. This has no default.
|
||||
* - `SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
|
||||
* creator/developer/maker of this app, like "MojoWorkshop, LLC"
|
||||
* - `SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
|
||||
* notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this
|
||||
* to one line, don't paste a copy of a whole software license in here. This
|
||||
* has no default.
|
||||
* - `SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
|
||||
* product page, or a storefront, or even a GitHub repository, for user's
|
||||
* further information This has no default.
|
||||
* - `SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
|
||||
* Currently this string can be "game" for a video game, "mediaplayer" for a
|
||||
* media player, or generically "application" if nothing else applies.
|
||||
* Future versions of SDL might add new types. This defaults to
|
||||
* "application".
|
||||
*
|
||||
* \param name the name of the metadata property to set.
|
||||
* \param value the value of the property, or NULL to remove that property.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetAppMetadataProperty
|
||||
* \sa SDL_SetAppMetadata
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
|
||||
|
||||
#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name"
|
||||
#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version"
|
||||
#define SDL_PROP_APP_METADATA_IDENTIFIER_STRING "SDL.app.metadata.identifier"
|
||||
#define SDL_PROP_APP_METADATA_CREATOR_STRING "SDL.app.metadata.creator"
|
||||
#define SDL_PROP_APP_METADATA_COPYRIGHT_STRING "SDL.app.metadata.copyright"
|
||||
#define SDL_PROP_APP_METADATA_URL_STRING "SDL.app.metadata.url"
|
||||
#define SDL_PROP_APP_METADATA_TYPE_STRING "SDL.app.metadata.type"
|
||||
|
||||
/**
|
||||
* Get metadata about your app.
|
||||
*
|
||||
* This returns metadata previously set using SDL_SetAppMetadata() or
|
||||
* SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list
|
||||
* of available properties and their meanings.
|
||||
*
|
||||
* \param name the name of the metadata property to get.
|
||||
* \returns the current value of the metadata property, or the default if it
|
||||
* is not set, NULL for properties with no default.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, although
|
||||
* the string returned is not protected and could potentially be
|
||||
* freed if you call SDL_SetAppMetadataProperty() to set that
|
||||
* property from another thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetAppMetadata
|
||||
* \sa SDL_SetAppMetadataProperty
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetAppMetadataProperty(const char *name);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_init_h_ */
|
||||
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: Intrinsics */
|
||||
|
||||
/**
|
||||
* # CategoryIntrinsics
|
||||
*
|
||||
* SDL does some preprocessor gymnastics to determine if any CPU-specific
|
||||
* compiler intrinsics are available, as this is not necessarily an easy thing
|
||||
* to calculate, and sometimes depends on quirks of a system, versions of
|
||||
* build tools, and other external forces.
|
||||
*
|
||||
* Apps including SDL's headers will be able to check consistent preprocessor
|
||||
* definitions to decide if it's safe to use compiler intrinsics for a
|
||||
* specific CPU architecture. This check only tells you that the compiler is
|
||||
* capable of using those intrinsics; at runtime, you should still check if
|
||||
* they are available on the current system with the
|
||||
* [CPU info functions](https://wiki.libsdl.org/SDL3/CategoryCPUInfo)
|
||||
* , such as SDL_HasSSE() or SDL_HasNEON(). Otherwise, the process might crash
|
||||
* for using an unsupported CPU instruction.
|
||||
*
|
||||
* SDL only sets preprocessor defines for CPU intrinsics if they are
|
||||
* supported, so apps should check with `#ifdef` and not `#if`.
|
||||
*
|
||||
* SDL will also include the appropriate instruction-set-specific support
|
||||
* headers, so if SDL decides to define SDL_SSE2_INTRINSICS, it will also
|
||||
* `#include <emmintrin.h>` as well.
|
||||
*/
|
||||
|
||||
#ifndef SDL_intrin_h_
|
||||
#define SDL_intrin_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Loongarch LSX intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<lsxintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LASX_INTRINSICS
|
||||
*/
|
||||
#define SDL_LSX_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Loongarch LSX intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<lasxintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LASX_INTRINSICS
|
||||
*/
|
||||
#define SDL_LASX_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports ARM NEON intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<armintr.h>`
|
||||
* `<arm_neon.h>`, `<arm64intr.h>`, and `<arm64_neon.h>`, as appropriate.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_NEON_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports PowerPC Altivec intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<altivec.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_ALTIVEC_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel MMX intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<mmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE_INTRINSICS
|
||||
*/
|
||||
#define SDL_MMX_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel SSE intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<xmmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE2_INTRINSICS
|
||||
* \sa SDL_SSE3_INTRINSICS
|
||||
* \sa SDL_SSE4_1_INTRINSICS
|
||||
* \sa SDL_SSE4_2_INTRINSICS
|
||||
*/
|
||||
#define SDL_SSE_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel SSE2 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<emmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE_INTRINSICS
|
||||
* \sa SDL_SSE3_INTRINSICS
|
||||
* \sa SDL_SSE4_1_INTRINSICS
|
||||
* \sa SDL_SSE4_2_INTRINSICS
|
||||
*/
|
||||
#define SDL_SSE2_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel SSE3 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<pmmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE_INTRINSICS
|
||||
* \sa SDL_SSE2_INTRINSICS
|
||||
* \sa SDL_SSE4_1_INTRINSICS
|
||||
* \sa SDL_SSE4_2_INTRINSICS
|
||||
*/
|
||||
#define SDL_SSE3_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel SSE4.1 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<smmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE_INTRINSICS
|
||||
* \sa SDL_SSE2_INTRINSICS
|
||||
* \sa SDL_SSE3_INTRINSICS
|
||||
* \sa SDL_SSE4_2_INTRINSICS
|
||||
*/
|
||||
#define SDL_SSE4_1_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel SSE4.2 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<nmmintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SSE_INTRINSICS
|
||||
* \sa SDL_SSE2_INTRINSICS
|
||||
* \sa SDL_SSE3_INTRINSICS
|
||||
* \sa SDL_SSE4_1_INTRINSICS
|
||||
*/
|
||||
#define SDL_SSE4_2_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel AVX intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AVX2_INTRINSICS
|
||||
* \sa SDL_AVX512F_INTRINSICS
|
||||
*/
|
||||
#define SDL_AVX_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel AVX2 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AVX_INTRINSICS
|
||||
* \sa SDL_AVX512F_INTRINSICS
|
||||
*/
|
||||
#define SDL_AVX2_INTRINSICS 1
|
||||
|
||||
/**
|
||||
* Defined if (and only if) the compiler supports Intel AVX-512F intrinsics.
|
||||
*
|
||||
* AVX-512F is also sometimes referred to as "AVX-512 Foundation."
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AVX_INTRINSICS
|
||||
* \sa SDL_AVX2_INTRINSICS
|
||||
*/
|
||||
#define SDL_AVX512F_INTRINSICS 1
|
||||
#endif
|
||||
|
||||
/* Need to do this here because intrin.h has C++ code in it */
|
||||
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#ifdef __clang__
|
||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
||||
#ifndef __PRFCHWINTRIN_H
|
||||
#define __PRFCHWINTRIN_H
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetch(void *__P)
|
||||
{
|
||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
#endif /* __PRFCHWINTRIN_H */
|
||||
#endif /* __clang__ */
|
||||
#include <intrin.h>
|
||||
|
||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||
#include <intrin.h>
|
||||
#if defined(__ARM_NEON) && !defined(SDL_DISABLE_NEON)
|
||||
# define SDL_NEON_INTRINSICS 1
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC to have it included. */
|
||||
#if defined(__ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC)
|
||||
#define SDL_ALTIVEC_INTRINSICS 1
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
#ifndef SDL_DISABLE_NEON
|
||||
# ifdef __ARM_NEON
|
||||
# define SDL_NEON_INTRINSICS 1
|
||||
# include <arm_neon.h>
|
||||
# elif defined(SDL_PLATFORM_WINDOWS)
|
||||
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
|
||||
# ifdef _M_ARM
|
||||
# define SDL_NEON_INTRINSICS 1
|
||||
# include <armintr.h>
|
||||
# include <arm_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# if defined (_M_ARM64)
|
||||
# define SDL_NEON_INTRINSICS 1
|
||||
# include <arm64intr.h>
|
||||
# include <arm64_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# define __ARM_ARCH 8
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif /* compiler version */
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
/**
|
||||
* A macro to decide if the compiler supports `__attribute__((target))`.
|
||||
*
|
||||
* Even though this is defined in SDL's public headers, it is generally not
|
||||
* used directly by apps. Apps should probably just use SDL_TARGETING
|
||||
* directly, instead.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_TARGETING
|
||||
*/
|
||||
#define SDL_HAS_TARGET_ATTRIBS
|
||||
|
||||
#elif defined(__clang__) && defined(__has_attribute)
|
||||
# if __has_attribute(target)
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
# endif
|
||||
#elif defined(__GNUC__) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
#elif defined(__ICC) && __ICC >= 1600
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro to tag a function as targeting a specific CPU architecture.
|
||||
*
|
||||
* This is a hint to the compiler that a function should be built with support
|
||||
* for a CPU instruction set that might be different than the rest of the
|
||||
* program.
|
||||
*
|
||||
* The particulars of this are explained in the GCC documentation:
|
||||
*
|
||||
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-target-function-attribute
|
||||
*
|
||||
* An example of using this feature is to turn on SSE2 support for a specific
|
||||
* function, even if the rest of the source code is not compiled to use SSE2
|
||||
* code:
|
||||
*
|
||||
* ```c
|
||||
* #ifdef SDL_SSE2_INTRINSICS
|
||||
* static void SDL_TARGETING("sse2") DoSomethingWithSSE2(char *x) {
|
||||
* ...use SSE2 intrinsic functions, etc...
|
||||
* }
|
||||
* #endif
|
||||
*
|
||||
* // later...
|
||||
* #ifdef SDL_SSE2_INTRINSICS
|
||||
* if (SDL_HasSSE2()) {
|
||||
* DoSomethingWithSSE2(str);
|
||||
* }
|
||||
* #endif
|
||||
* ```
|
||||
*
|
||||
* The application is, on a whole, built without SSE2 instructions, so it will
|
||||
* run on Intel machines that don't support SSE2. But then at runtime, it
|
||||
* checks if the system supports the instructions, and then calls into a
|
||||
* function that uses SSE2 opcodes. The ifdefs make sure that this code isn't
|
||||
* used on platforms that don't have SSE2 at all.
|
||||
*
|
||||
* On compilers without target support, this is defined to nothing.
|
||||
*
|
||||
* This symbol is used by SDL internally, but apps and other libraries are
|
||||
* welcome to use it for their own interfaces as well.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_TARGETING(x) __attribute__((target(x)))
|
||||
|
||||
#elif defined(SDL_HAS_TARGET_ATTRIBS)
|
||||
# define SDL_TARGETING(x) __attribute__((target(x)))
|
||||
#else
|
||||
# define SDL_TARGETING(x)
|
||||
#endif
|
||||
|
||||
#ifdef __loongarch64
|
||||
# ifndef SDL_DISABLE_LSX
|
||||
# define SDL_LSX_INTRINSICS 1
|
||||
# include <lsxintrin.h>
|
||||
# endif
|
||||
# ifndef SDL_DISABLE_LASX
|
||||
# define SDL_LASX_INTRINSICS 1
|
||||
# include <lasxintrin.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
|
||||
# if ((defined(_MSC_VER) && !defined(_M_X64)) || defined(__MMX__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_MMX)
|
||||
# define SDL_MMX_INTRINSICS 1
|
||||
# include <mmintrin.h>
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__SSE__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE)
|
||||
# define SDL_SSE_INTRINSICS 1
|
||||
# include <xmmintrin.h>
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__SSE2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE2)
|
||||
# define SDL_SSE2_INTRINSICS 1
|
||||
# include <emmintrin.h>
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__SSE3__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE3)
|
||||
# define SDL_SSE3_INTRINSICS 1
|
||||
# include <pmmintrin.h>
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__SSE4_1__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE4_1)
|
||||
# define SDL_SSE4_1_INTRINSICS 1
|
||||
# include <smmintrin.h>
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__SSE4_2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE4_2)
|
||||
# define SDL_SSE4_2_INTRINSICS 1
|
||||
# include <nmmintrin.h>
|
||||
# endif
|
||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX__) && !defined(SDL_DISABLE_AVX)
|
||||
# define SDL_DISABLE_AVX /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__AVX__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX)
|
||||
# define SDL_AVX_INTRINSICS 1
|
||||
# include <immintrin.h>
|
||||
# endif
|
||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX2__) && !defined(SDL_DISABLE_AVX2)
|
||||
# define SDL_DISABLE_AVX2 /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__AVX2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX2)
|
||||
# define SDL_AVX2_INTRINSICS 1
|
||||
# include <immintrin.h>
|
||||
# endif
|
||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX512F__) && !defined(SDL_DISABLE_AVX512F)
|
||||
# define SDL_DISABLE_AVX512F /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
||||
# endif
|
||||
# if (defined(_MSC_VER) || defined(__AVX512F__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX512F)
|
||||
# define SDL_AVX512F_INTRINSICS 1
|
||||
# include <immintrin.h>
|
||||
# endif
|
||||
#endif /* defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) */
|
||||
|
||||
#endif /* SDL_intrin_h_ */
|
||||
@@ -0,0 +1,608 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryKeyboard
|
||||
*
|
||||
* SDL keyboard management.
|
||||
*
|
||||
* Please refer to the Best Keyboard Practices document for details on how
|
||||
* best to accept keyboard input in various types of programs:
|
||||
*
|
||||
* https://wiki.libsdl.org/SDL3/BestKeyboardPractices
|
||||
*/
|
||||
|
||||
#ifndef SDL_keyboard_h_
|
||||
#define SDL_keyboard_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is a unique ID for a keyboard for the time it is connected to the
|
||||
* system, and is never reused for the lifetime of the application.
|
||||
*
|
||||
* If the keyboard is disconnected and reconnected, it will get a new ID.
|
||||
*
|
||||
* The value 0 is an invalid ID.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef Uint32 SDL_KeyboardID;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Return whether a keyboard is currently connected.
|
||||
*
|
||||
* \returns true if a keyboard is connected, false otherwise.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboards
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasKeyboard(void);
|
||||
|
||||
/**
|
||||
* Get a list of currently connected keyboards.
|
||||
*
|
||||
* Note that this will include any device or virtual driver that includes
|
||||
* keyboard functionality, including some mice, KVM switches, motherboard
|
||||
* power buttons, etc. You should wait for input from a device before you
|
||||
* consider it actively in use.
|
||||
*
|
||||
* \param count a pointer filled in with the number of keyboards returned, may
|
||||
* be NULL.
|
||||
* \returns a 0 terminated array of keyboards instance IDs or NULL on failure;
|
||||
* call SDL_GetError() for more information. This should be freed
|
||||
* with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboardNameForID
|
||||
* \sa SDL_HasKeyboard
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count);
|
||||
|
||||
/**
|
||||
* Get the name of a keyboard.
|
||||
*
|
||||
* This function returns "" if the keyboard doesn't have a name.
|
||||
*
|
||||
* \param instance_id the keyboard instance ID.
|
||||
* \returns the name of the selected keyboard or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboards
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id);
|
||||
|
||||
/**
|
||||
* Query the window which currently has keyboard focus.
|
||||
*
|
||||
* \returns the window with keyboard focus.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
||||
|
||||
/**
|
||||
* Get a snapshot of the current state of the keyboard.
|
||||
*
|
||||
* The pointer returned is a pointer to an internal SDL array. It will be
|
||||
* valid for the whole lifetime of the application and should not be freed by
|
||||
* the caller.
|
||||
*
|
||||
* A array element with a value of true means that the key is pressed and a
|
||||
* value of false means that it is not. Indexes into this array are obtained
|
||||
* by using SDL_Scancode values.
|
||||
*
|
||||
* Use SDL_PumpEvents() to update the state array.
|
||||
*
|
||||
* This function gives you the current state after all events have been
|
||||
* processed, so if a key or button has been pressed and released before you
|
||||
* process events, then the pressed state will never show up in the
|
||||
* SDL_GetKeyboardState() calls.
|
||||
*
|
||||
* Note: This function doesn't take into account whether shift has been
|
||||
* pressed or not.
|
||||
*
|
||||
* \param numkeys if non-NULL, receives the length of the returned array.
|
||||
* \returns a pointer to an array of key states.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_PumpEvents
|
||||
* \sa SDL_ResetKeyboard
|
||||
*/
|
||||
extern SDL_DECLSPEC const bool * SDLCALL SDL_GetKeyboardState(int *numkeys);
|
||||
|
||||
/**
|
||||
* Clear the state of the keyboard.
|
||||
*
|
||||
* This function will generate key up events for all pressed keys.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboardState
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ResetKeyboard(void);
|
||||
|
||||
/**
|
||||
* Get the current key modifier state for the keyboard.
|
||||
*
|
||||
* \returns an OR'd combination of the modifier keys for the keyboard.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboardState
|
||||
* \sa SDL_SetModState
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
||||
|
||||
/**
|
||||
* Set the current key modifier state for the keyboard.
|
||||
*
|
||||
* The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose
|
||||
* modifier key states on your application. Simply pass your desired modifier
|
||||
* states into `modstate`. This value may be a bitwise, OR'd combination of
|
||||
* SDL_Keymod values.
|
||||
*
|
||||
* This does not change the keyboard state, only the key modifier flags that
|
||||
* SDL reports.
|
||||
*
|
||||
* \param modstate the desired SDL_Keymod for the keyboard.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetModState
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
||||
|
||||
/**
|
||||
* Get the key code corresponding to the given scancode according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
* If you want to get the keycode as it would be delivered in key events,
|
||||
* including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
|
||||
* pass `key_event` as true. Otherwise this function simply translates the
|
||||
* scancode based on the given modifier state.
|
||||
*
|
||||
* \param scancode the desired SDL_Scancode to query.
|
||||
* \param modstate the modifier state to use when translating the scancode to
|
||||
* a keycode.
|
||||
* \param key_event true if the keycode will be used in key events.
|
||||
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyName
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event);
|
||||
|
||||
/**
|
||||
* Get the scancode corresponding to the given key code according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
* Note that there may be multiple scancode+modifier states that can generate
|
||||
* this keycode, this will just return the first one found.
|
||||
*
|
||||
* \param key the desired SDL_Keycode to query.
|
||||
* \param modstate a pointer to the modifier state that would be used when the
|
||||
* scancode generates this key, may be NULL.
|
||||
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetScancodeName
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate);
|
||||
|
||||
/**
|
||||
* Set a human-readable name for a scancode.
|
||||
*
|
||||
* \param scancode the desired SDL_Scancode.
|
||||
* \param name the name to use for the scancode, encoded as UTF-8. The string
|
||||
* is not copied, so the pointer given to this function must stay
|
||||
* valid while SDL is being used.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetScancodeName
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
|
||||
|
||||
/**
|
||||
* Get a human-readable name for a scancode.
|
||||
*
|
||||
* **Warning**: The returned name is by design not stable across platforms,
|
||||
* e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left
|
||||
* Windows" under Microsoft Windows, and some scancodes like
|
||||
* `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even
|
||||
* scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and
|
||||
* `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore
|
||||
* unsuitable for creating a stable cross-platform two-way mapping between
|
||||
* strings and scancodes.
|
||||
*
|
||||
* \param scancode the desired SDL_Scancode to query.
|
||||
* \returns a pointer to the name for the scancode. If the scancode doesn't
|
||||
* have a name this function returns an empty string ("").
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
* \sa SDL_GetScancodeFromName
|
||||
* \sa SDL_SetScancodeName
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
|
||||
|
||||
/**
|
||||
* Get a scancode from a human-readable name.
|
||||
*
|
||||
* \param name the human-readable scancode name.
|
||||
* \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't
|
||||
* recognized; call SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromName
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
* \sa SDL_GetScancodeName
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
||||
|
||||
/**
|
||||
* Get a human-readable name for a key.
|
||||
*
|
||||
* If the key doesn't have a name, this function returns an empty string ("").
|
||||
*
|
||||
* Letters will be presented in their uppercase form, if applicable.
|
||||
*
|
||||
* \param key the desired SDL_Keycode to query.
|
||||
* \returns a UTF-8 encoded string of the key name.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromName
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* Get a key code from a human-readable name.
|
||||
*
|
||||
* \param name the human-readable key name.
|
||||
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetKeyName
|
||||
* \sa SDL_GetScancodeFromName
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
||||
|
||||
/**
|
||||
* Start accepting Unicode text input events in a window.
|
||||
*
|
||||
* This function will enable text input (SDL_EVENT_TEXT_INPUT and
|
||||
* SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this
|
||||
* function paired with SDL_StopTextInput().
|
||||
*
|
||||
* Text input events are not received by default.
|
||||
*
|
||||
* On some platforms using this function shows the screen keyboard and/or
|
||||
* activates an IME, which can prevent some key press events from being passed
|
||||
* through.
|
||||
*
|
||||
* \param window the window to enable text input.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetTextInputArea
|
||||
* \sa SDL_StartTextInputWithProperties
|
||||
* \sa SDL_StopTextInput
|
||||
* \sa SDL_TextInputActive
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInput(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Text input type.
|
||||
*
|
||||
* These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every
|
||||
* value is valid on every platform, but where a value isn't supported, a
|
||||
* reasonable fallback will be used.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInputWithProperties
|
||||
*/
|
||||
typedef enum SDL_TextInputType
|
||||
{
|
||||
SDL_TEXTINPUT_TYPE_TEXT, /**< The input is text */
|
||||
SDL_TEXTINPUT_TYPE_TEXT_NAME, /**< The input is a person's name */
|
||||
SDL_TEXTINPUT_TYPE_TEXT_EMAIL, /**< The input is an e-mail address */
|
||||
SDL_TEXTINPUT_TYPE_TEXT_USERNAME, /**< The input is a username */
|
||||
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN, /**< The input is a secure password that is hidden */
|
||||
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE, /**< The input is a secure password that is visible */
|
||||
SDL_TEXTINPUT_TYPE_NUMBER, /**< The input is a number */
|
||||
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN, /**< The input is a secure PIN that is hidden */
|
||||
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE /**< The input is a secure PIN that is visible */
|
||||
} SDL_TextInputType;
|
||||
|
||||
/**
|
||||
* Auto capitalization type.
|
||||
*
|
||||
* These are the valid values for SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER.
|
||||
* Not every value is valid on every platform, but where a value isn't
|
||||
* supported, a reasonable fallback will be used.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInputWithProperties
|
||||
*/
|
||||
typedef enum SDL_Capitalization
|
||||
{
|
||||
SDL_CAPITALIZE_NONE, /**< No auto-capitalization will be done */
|
||||
SDL_CAPITALIZE_SENTENCES, /**< The first letter of sentences will be capitalized */
|
||||
SDL_CAPITALIZE_WORDS, /**< The first letter of words will be capitalized */
|
||||
SDL_CAPITALIZE_LETTERS /**< All letters will be capitalized */
|
||||
} SDL_Capitalization;
|
||||
|
||||
/**
|
||||
* Start accepting Unicode text input events in a window, with properties
|
||||
* describing the input.
|
||||
*
|
||||
* This function will enable text input (SDL_EVENT_TEXT_INPUT and
|
||||
* SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this
|
||||
* function paired with SDL_StopTextInput().
|
||||
*
|
||||
* Text input events are not received by default.
|
||||
*
|
||||
* On some platforms using this function shows the screen keyboard and/or
|
||||
* activates an IME, which can prevent some key press events from being passed
|
||||
* through.
|
||||
*
|
||||
* These are the supported properties:
|
||||
*
|
||||
* - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that
|
||||
* describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT.
|
||||
* - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value
|
||||
* that describes how text should be capitalized, defaults to
|
||||
* SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for
|
||||
* SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail
|
||||
* addresses, usernames, and passwords.
|
||||
* - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion
|
||||
* and auto correction, defaults to true.
|
||||
* - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text
|
||||
* are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is
|
||||
* "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME
|
||||
* is "1".
|
||||
*
|
||||
* On Android you can directly specify the input type:
|
||||
*
|
||||
* - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to
|
||||
* use, overriding other properties. This is documented at
|
||||
* https://developer.android.com/reference/android/text/InputType
|
||||
*
|
||||
* \param window the window to enable text input.
|
||||
* \param props the properties to use.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetTextInputArea
|
||||
* \sa SDL_StartTextInput
|
||||
* \sa SDL_StopTextInput
|
||||
* \sa SDL_TextInputActive
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
|
||||
|
||||
#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type"
|
||||
#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization"
|
||||
#define SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN "SDL.textinput.autocorrect"
|
||||
#define SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN "SDL.textinput.multiline"
|
||||
#define SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER "SDL.textinput.android.inputtype"
|
||||
|
||||
/**
|
||||
* Check whether or not Unicode text input events are enabled for a window.
|
||||
*
|
||||
* \param window the window to check.
|
||||
* \returns true if text input events are enabled else false.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_TextInputActive(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Stop receiving any text input events in a window.
|
||||
*
|
||||
* If SDL_StartTextInput() showed the screen keyboard, this function will hide
|
||||
* it.
|
||||
*
|
||||
* \param window the window to disable text input.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_StopTextInput(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Dismiss the composition window/IME without disabling the subsystem.
|
||||
*
|
||||
* \param window the window to affect.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
* \sa SDL_StopTextInput
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearComposition(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Set the area used to type Unicode text input.
|
||||
*
|
||||
* Native input methods may place a window with word suggestions near the
|
||||
* cursor, without covering the text being entered.
|
||||
*
|
||||
* \param window the window for which to set the text input area.
|
||||
* \param rect the SDL_Rect representing the text input area, in window
|
||||
* coordinates, or NULL to clear it.
|
||||
* \param cursor the offset of the current cursor location relative to
|
||||
* `rect->x`, in window coordinates.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetTextInputArea
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
|
||||
|
||||
/**
|
||||
* Get the area used to type Unicode text input.
|
||||
*
|
||||
* This returns the values previously set by SDL_SetTextInputArea().
|
||||
*
|
||||
* \param window the window for which to query the text input area.
|
||||
* \param rect a pointer to an SDL_Rect filled in with the text input area,
|
||||
* may be NULL.
|
||||
* \param cursor a pointer to the offset of the current cursor location
|
||||
* relative to `rect->x`, may be NULL.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetTextInputArea
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
|
||||
|
||||
/**
|
||||
* Check whether the platform has screen keyboard support.
|
||||
*
|
||||
* \returns true if the platform has some screen keyboard support or false if
|
||||
* not.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
* \sa SDL_ScreenKeyboardShown
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasScreenKeyboardSupport(void);
|
||||
|
||||
/**
|
||||
* Check whether the screen keyboard is shown for given window.
|
||||
*
|
||||
* \param window the window for which screen keyboard should be queried.
|
||||
* \returns true if screen keyboard is shown or false if not.
|
||||
*
|
||||
* \threadsafety This function should only be called on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HasScreenKeyboardSupport
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ScreenKeyboardShown(SDL_Window *window);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_keyboard_h_ */
|
||||
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryKeycode
|
||||
*
|
||||
* Defines constants which identify keyboard keys and modifiers.
|
||||
*
|
||||
* Please refer to the Best Keyboard Practices document for details on what
|
||||
* this information means and how best to use it.
|
||||
*
|
||||
* https://wiki.libsdl.org/SDL3/BestKeyboardPractices
|
||||
*/
|
||||
|
||||
#ifndef SDL_keycode_h_
|
||||
#define SDL_keycode_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_scancode.h>
|
||||
|
||||
/**
|
||||
* The SDL virtual key representation.
|
||||
*
|
||||
* Values of this type are used to represent keyboard keys using the current
|
||||
* layout of the keyboard. These values include Unicode values representing
|
||||
* the unmodified character that would be generated by pressing the key, or an
|
||||
* `SDLK_*` constant for those keys that do not generate characters.
|
||||
*
|
||||
* A special exception is the number keys at the top of the keyboard which map
|
||||
* to SDLK_0...SDLK_9 on AZERTY layouts.
|
||||
*
|
||||
* Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or
|
||||
* unicode code point.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_HINT_KEYCODE_OPTIONS
|
||||
*/
|
||||
typedef Uint32 SDL_Keycode;
|
||||
|
||||
#define SDLK_EXTENDED_MASK (1u << 29)
|
||||
#define SDLK_SCANCODE_MASK (1u << 30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
#define SDLK_UNKNOWN 0x00000000u /**< 0 */
|
||||
#define SDLK_RETURN 0x0000000du /**< '\r' */
|
||||
#define SDLK_ESCAPE 0x0000001bu /**< '\x1B' */
|
||||
#define SDLK_BACKSPACE 0x00000008u /**< '\b' */
|
||||
#define SDLK_TAB 0x00000009u /**< '\t' */
|
||||
#define SDLK_SPACE 0x00000020u /**< ' ' */
|
||||
#define SDLK_EXCLAIM 0x00000021u /**< '!' */
|
||||
#define SDLK_DBLAPOSTROPHE 0x00000022u /**< '"' */
|
||||
#define SDLK_HASH 0x00000023u /**< '#' */
|
||||
#define SDLK_DOLLAR 0x00000024u /**< '$' */
|
||||
#define SDLK_PERCENT 0x00000025u /**< '%' */
|
||||
#define SDLK_AMPERSAND 0x00000026u /**< '&' */
|
||||
#define SDLK_APOSTROPHE 0x00000027u /**< '\'' */
|
||||
#define SDLK_LEFTPAREN 0x00000028u /**< '(' */
|
||||
#define SDLK_RIGHTPAREN 0x00000029u /**< ')' */
|
||||
#define SDLK_ASTERISK 0x0000002au /**< '*' */
|
||||
#define SDLK_PLUS 0x0000002bu /**< '+' */
|
||||
#define SDLK_COMMA 0x0000002cu /**< ',' */
|
||||
#define SDLK_MINUS 0x0000002du /**< '-' */
|
||||
#define SDLK_PERIOD 0x0000002eu /**< '.' */
|
||||
#define SDLK_SLASH 0x0000002fu /**< '/' */
|
||||
#define SDLK_0 0x00000030u /**< '0' */
|
||||
#define SDLK_1 0x00000031u /**< '1' */
|
||||
#define SDLK_2 0x00000032u /**< '2' */
|
||||
#define SDLK_3 0x00000033u /**< '3' */
|
||||
#define SDLK_4 0x00000034u /**< '4' */
|
||||
#define SDLK_5 0x00000035u /**< '5' */
|
||||
#define SDLK_6 0x00000036u /**< '6' */
|
||||
#define SDLK_7 0x00000037u /**< '7' */
|
||||
#define SDLK_8 0x00000038u /**< '8' */
|
||||
#define SDLK_9 0x00000039u /**< '9' */
|
||||
#define SDLK_COLON 0x0000003au /**< ':' */
|
||||
#define SDLK_SEMICOLON 0x0000003bu /**< ';' */
|
||||
#define SDLK_LESS 0x0000003cu /**< '<' */
|
||||
#define SDLK_EQUALS 0x0000003du /**< '=' */
|
||||
#define SDLK_GREATER 0x0000003eu /**< '>' */
|
||||
#define SDLK_QUESTION 0x0000003fu /**< '?' */
|
||||
#define SDLK_AT 0x00000040u /**< '@' */
|
||||
#define SDLK_LEFTBRACKET 0x0000005bu /**< '[' */
|
||||
#define SDLK_BACKSLASH 0x0000005cu /**< '\\' */
|
||||
#define SDLK_RIGHTBRACKET 0x0000005du /**< ']' */
|
||||
#define SDLK_CARET 0x0000005eu /**< '^' */
|
||||
#define SDLK_UNDERSCORE 0x0000005fu /**< '_' */
|
||||
#define SDLK_GRAVE 0x00000060u /**< '`' */
|
||||
#define SDLK_A 0x00000061u /**< 'a' */
|
||||
#define SDLK_B 0x00000062u /**< 'b' */
|
||||
#define SDLK_C 0x00000063u /**< 'c' */
|
||||
#define SDLK_D 0x00000064u /**< 'd' */
|
||||
#define SDLK_E 0x00000065u /**< 'e' */
|
||||
#define SDLK_F 0x00000066u /**< 'f' */
|
||||
#define SDLK_G 0x00000067u /**< 'g' */
|
||||
#define SDLK_H 0x00000068u /**< 'h' */
|
||||
#define SDLK_I 0x00000069u /**< 'i' */
|
||||
#define SDLK_J 0x0000006au /**< 'j' */
|
||||
#define SDLK_K 0x0000006bu /**< 'k' */
|
||||
#define SDLK_L 0x0000006cu /**< 'l' */
|
||||
#define SDLK_M 0x0000006du /**< 'm' */
|
||||
#define SDLK_N 0x0000006eu /**< 'n' */
|
||||
#define SDLK_O 0x0000006fu /**< 'o' */
|
||||
#define SDLK_P 0x00000070u /**< 'p' */
|
||||
#define SDLK_Q 0x00000071u /**< 'q' */
|
||||
#define SDLK_R 0x00000072u /**< 'r' */
|
||||
#define SDLK_S 0x00000073u /**< 's' */
|
||||
#define SDLK_T 0x00000074u /**< 't' */
|
||||
#define SDLK_U 0x00000075u /**< 'u' */
|
||||
#define SDLK_V 0x00000076u /**< 'v' */
|
||||
#define SDLK_W 0x00000077u /**< 'w' */
|
||||
#define SDLK_X 0x00000078u /**< 'x' */
|
||||
#define SDLK_Y 0x00000079u /**< 'y' */
|
||||
#define SDLK_Z 0x0000007au /**< 'z' */
|
||||
#define SDLK_LEFTBRACE 0x0000007bu /**< '{' */
|
||||
#define SDLK_PIPE 0x0000007cu /**< '|' */
|
||||
#define SDLK_RIGHTBRACE 0x0000007du /**< '}' */
|
||||
#define SDLK_TILDE 0x0000007eu /**< '~' */
|
||||
#define SDLK_DELETE 0x0000007fu /**< '\x7F' */
|
||||
#define SDLK_PLUSMINUS 0x000000b1u /**< '\xB1' */
|
||||
#define SDLK_CAPSLOCK 0x40000039u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK) */
|
||||
#define SDLK_F1 0x4000003au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1) */
|
||||
#define SDLK_F2 0x4000003bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2) */
|
||||
#define SDLK_F3 0x4000003cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3) */
|
||||
#define SDLK_F4 0x4000003du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4) */
|
||||
#define SDLK_F5 0x4000003eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5) */
|
||||
#define SDLK_F6 0x4000003fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6) */
|
||||
#define SDLK_F7 0x40000040u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7) */
|
||||
#define SDLK_F8 0x40000041u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8) */
|
||||
#define SDLK_F9 0x40000042u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9) */
|
||||
#define SDLK_F10 0x40000043u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10) */
|
||||
#define SDLK_F11 0x40000044u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11) */
|
||||
#define SDLK_F12 0x40000045u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12) */
|
||||
#define SDLK_PRINTSCREEN 0x40000046u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN) */
|
||||
#define SDLK_SCROLLLOCK 0x40000047u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK) */
|
||||
#define SDLK_PAUSE 0x40000048u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE) */
|
||||
#define SDLK_INSERT 0x40000049u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT) */
|
||||
#define SDLK_HOME 0x4000004au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME) */
|
||||
#define SDLK_PAGEUP 0x4000004bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP) */
|
||||
#define SDLK_END 0x4000004du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END) */
|
||||
#define SDLK_PAGEDOWN 0x4000004eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN) */
|
||||
#define SDLK_RIGHT 0x4000004fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT) */
|
||||
#define SDLK_LEFT 0x40000050u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT) */
|
||||
#define SDLK_DOWN 0x40000051u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN) */
|
||||
#define SDLK_UP 0x40000052u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP) */
|
||||
#define SDLK_NUMLOCKCLEAR 0x40000053u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR) */
|
||||
#define SDLK_KP_DIVIDE 0x40000054u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE) */
|
||||
#define SDLK_KP_MULTIPLY 0x40000055u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY) */
|
||||
#define SDLK_KP_MINUS 0x40000056u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS) */
|
||||
#define SDLK_KP_PLUS 0x40000057u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS) */
|
||||
#define SDLK_KP_ENTER 0x40000058u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER) */
|
||||
#define SDLK_KP_1 0x40000059u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1) */
|
||||
#define SDLK_KP_2 0x4000005au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2) */
|
||||
#define SDLK_KP_3 0x4000005bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3) */
|
||||
#define SDLK_KP_4 0x4000005cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4) */
|
||||
#define SDLK_KP_5 0x4000005du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5) */
|
||||
#define SDLK_KP_6 0x4000005eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6) */
|
||||
#define SDLK_KP_7 0x4000005fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7) */
|
||||
#define SDLK_KP_8 0x40000060u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8) */
|
||||
#define SDLK_KP_9 0x40000061u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9) */
|
||||
#define SDLK_KP_0 0x40000062u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0) */
|
||||
#define SDLK_KP_PERIOD 0x40000063u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD) */
|
||||
#define SDLK_APPLICATION 0x40000065u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION) */
|
||||
#define SDLK_POWER 0x40000066u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER) */
|
||||
#define SDLK_KP_EQUALS 0x40000067u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS) */
|
||||
#define SDLK_F13 0x40000068u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13) */
|
||||
#define SDLK_F14 0x40000069u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14) */
|
||||
#define SDLK_F15 0x4000006au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15) */
|
||||
#define SDLK_F16 0x4000006bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16) */
|
||||
#define SDLK_F17 0x4000006cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17) */
|
||||
#define SDLK_F18 0x4000006du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18) */
|
||||
#define SDLK_F19 0x4000006eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19) */
|
||||
#define SDLK_F20 0x4000006fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20) */
|
||||
#define SDLK_F21 0x40000070u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21) */
|
||||
#define SDLK_F22 0x40000071u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22) */
|
||||
#define SDLK_F23 0x40000072u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23) */
|
||||
#define SDLK_F24 0x40000073u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24) */
|
||||
#define SDLK_EXECUTE 0x40000074u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE) */
|
||||
#define SDLK_HELP 0x40000075u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP) */
|
||||
#define SDLK_MENU 0x40000076u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU) */
|
||||
#define SDLK_SELECT 0x40000077u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT) */
|
||||
#define SDLK_STOP 0x40000078u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP) */
|
||||
#define SDLK_AGAIN 0x40000079u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN) */
|
||||
#define SDLK_UNDO 0x4000007au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO) */
|
||||
#define SDLK_CUT 0x4000007bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT) */
|
||||
#define SDLK_COPY 0x4000007cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY) */
|
||||
#define SDLK_PASTE 0x4000007du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE) */
|
||||
#define SDLK_FIND 0x4000007eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND) */
|
||||
#define SDLK_MUTE 0x4000007fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE) */
|
||||
#define SDLK_VOLUMEUP 0x40000080u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP) */
|
||||
#define SDLK_VOLUMEDOWN 0x40000081u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN) */
|
||||
#define SDLK_KP_COMMA 0x40000085u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA) */
|
||||
#define SDLK_KP_EQUALSAS400 0x40000086u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400) */
|
||||
#define SDLK_ALTERASE 0x40000099u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE) */
|
||||
#define SDLK_SYSREQ 0x4000009au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ) */
|
||||
#define SDLK_CANCEL 0x4000009bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL) */
|
||||
#define SDLK_CLEAR 0x4000009cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR) */
|
||||
#define SDLK_PRIOR 0x4000009du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR) */
|
||||
#define SDLK_RETURN2 0x4000009eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2) */
|
||||
#define SDLK_SEPARATOR 0x4000009fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR) */
|
||||
#define SDLK_OUT 0x400000a0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT) */
|
||||
#define SDLK_OPER 0x400000a1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER) */
|
||||
#define SDLK_CLEARAGAIN 0x400000a2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN) */
|
||||
#define SDLK_CRSEL 0x400000a3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL) */
|
||||
#define SDLK_EXSEL 0x400000a4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL) */
|
||||
#define SDLK_KP_00 0x400000b0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00) */
|
||||
#define SDLK_KP_000 0x400000b1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000) */
|
||||
#define SDLK_THOUSANDSSEPARATOR 0x400000b2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR) */
|
||||
#define SDLK_DECIMALSEPARATOR 0x400000b3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR) */
|
||||
#define SDLK_CURRENCYUNIT 0x400000b4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT) */
|
||||
#define SDLK_CURRENCYSUBUNIT 0x400000b5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT) */
|
||||
#define SDLK_KP_LEFTPAREN 0x400000b6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN) */
|
||||
#define SDLK_KP_RIGHTPAREN 0x400000b7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN) */
|
||||
#define SDLK_KP_LEFTBRACE 0x400000b8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE) */
|
||||
#define SDLK_KP_RIGHTBRACE 0x400000b9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE) */
|
||||
#define SDLK_KP_TAB 0x400000bau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB) */
|
||||
#define SDLK_KP_BACKSPACE 0x400000bbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE) */
|
||||
#define SDLK_KP_A 0x400000bcu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A) */
|
||||
#define SDLK_KP_B 0x400000bdu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B) */
|
||||
#define SDLK_KP_C 0x400000beu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C) */
|
||||
#define SDLK_KP_D 0x400000bfu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D) */
|
||||
#define SDLK_KP_E 0x400000c0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E) */
|
||||
#define SDLK_KP_F 0x400000c1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F) */
|
||||
#define SDLK_KP_XOR 0x400000c2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR) */
|
||||
#define SDLK_KP_POWER 0x400000c3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER) */
|
||||
#define SDLK_KP_PERCENT 0x400000c4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT) */
|
||||
#define SDLK_KP_LESS 0x400000c5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS) */
|
||||
#define SDLK_KP_GREATER 0x400000c6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER) */
|
||||
#define SDLK_KP_AMPERSAND 0x400000c7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND) */
|
||||
#define SDLK_KP_DBLAMPERSAND 0x400000c8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND) */
|
||||
#define SDLK_KP_VERTICALBAR 0x400000c9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR) */
|
||||
#define SDLK_KP_DBLVERTICALBAR 0x400000cau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR) */
|
||||
#define SDLK_KP_COLON 0x400000cbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON) */
|
||||
#define SDLK_KP_HASH 0x400000ccu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH) */
|
||||
#define SDLK_KP_SPACE 0x400000cdu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE) */
|
||||
#define SDLK_KP_AT 0x400000ceu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT) */
|
||||
#define SDLK_KP_EXCLAM 0x400000cfu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM) */
|
||||
#define SDLK_KP_MEMSTORE 0x400000d0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE) */
|
||||
#define SDLK_KP_MEMRECALL 0x400000d1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL) */
|
||||
#define SDLK_KP_MEMCLEAR 0x400000d2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR) */
|
||||
#define SDLK_KP_MEMADD 0x400000d3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD) */
|
||||
#define SDLK_KP_MEMSUBTRACT 0x400000d4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT) */
|
||||
#define SDLK_KP_MEMMULTIPLY 0x400000d5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY) */
|
||||
#define SDLK_KP_MEMDIVIDE 0x400000d6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE) */
|
||||
#define SDLK_KP_PLUSMINUS 0x400000d7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS) */
|
||||
#define SDLK_KP_CLEAR 0x400000d8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR) */
|
||||
#define SDLK_KP_CLEARENTRY 0x400000d9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY) */
|
||||
#define SDLK_KP_BINARY 0x400000dau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY) */
|
||||
#define SDLK_KP_OCTAL 0x400000dbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL) */
|
||||
#define SDLK_KP_DECIMAL 0x400000dcu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL) */
|
||||
#define SDLK_KP_HEXADECIMAL 0x400000ddu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL) */
|
||||
#define SDLK_LCTRL 0x400000e0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL) */
|
||||
#define SDLK_LSHIFT 0x400000e1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT) */
|
||||
#define SDLK_LALT 0x400000e2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT) */
|
||||
#define SDLK_LGUI 0x400000e3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI) */
|
||||
#define SDLK_RCTRL 0x400000e4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL) */
|
||||
#define SDLK_RSHIFT 0x400000e5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT) */
|
||||
#define SDLK_RALT 0x400000e6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT) */
|
||||
#define SDLK_RGUI 0x400000e7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI) */
|
||||
#define SDLK_MODE 0x40000101u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE) */
|
||||
#define SDLK_SLEEP 0x40000102u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) */
|
||||
#define SDLK_WAKE 0x40000103u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WAKE) */
|
||||
#define SDLK_CHANNEL_INCREMENT 0x40000104u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_INCREMENT) */
|
||||
#define SDLK_CHANNEL_DECREMENT 0x40000105u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_DECREMENT) */
|
||||
#define SDLK_MEDIA_PLAY 0x40000106u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY) */
|
||||
#define SDLK_MEDIA_PAUSE 0x40000107u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PAUSE) */
|
||||
#define SDLK_MEDIA_RECORD 0x40000108u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_RECORD) */
|
||||
#define SDLK_MEDIA_FAST_FORWARD 0x40000109u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_FAST_FORWARD) */
|
||||
#define SDLK_MEDIA_REWIND 0x4000010au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_REWIND) */
|
||||
#define SDLK_MEDIA_NEXT_TRACK 0x4000010bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_NEXT_TRACK) */
|
||||
#define SDLK_MEDIA_PREVIOUS_TRACK 0x4000010cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PREVIOUS_TRACK) */
|
||||
#define SDLK_MEDIA_STOP 0x4000010du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_STOP) */
|
||||
#define SDLK_MEDIA_EJECT 0x4000010eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_EJECT) */
|
||||
#define SDLK_MEDIA_PLAY_PAUSE 0x4000010fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY_PAUSE) */
|
||||
#define SDLK_MEDIA_SELECT 0x40000110u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_SELECT) */
|
||||
#define SDLK_AC_NEW 0x40000111u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_NEW) */
|
||||
#define SDLK_AC_OPEN 0x40000112u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_OPEN) */
|
||||
#define SDLK_AC_CLOSE 0x40000113u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_CLOSE) */
|
||||
#define SDLK_AC_EXIT 0x40000114u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_EXIT) */
|
||||
#define SDLK_AC_SAVE 0x40000115u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SAVE) */
|
||||
#define SDLK_AC_PRINT 0x40000116u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PRINT) */
|
||||
#define SDLK_AC_PROPERTIES 0x40000117u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PROPERTIES) */
|
||||
#define SDLK_AC_SEARCH 0x40000118u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH) */
|
||||
#define SDLK_AC_HOME 0x40000119u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME) */
|
||||
#define SDLK_AC_BACK 0x4000011au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK) */
|
||||
#define SDLK_AC_FORWARD 0x4000011bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD) */
|
||||
#define SDLK_AC_STOP 0x4000011cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP) */
|
||||
#define SDLK_AC_REFRESH 0x4000011du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH) */
|
||||
#define SDLK_AC_BOOKMARKS 0x4000011eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS) */
|
||||
#define SDLK_SOFTLEFT 0x4000011fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT) */
|
||||
#define SDLK_SOFTRIGHT 0x40000120u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT) */
|
||||
#define SDLK_CALL 0x40000121u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL) */
|
||||
#define SDLK_ENDCALL 0x40000122u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) */
|
||||
#define SDLK_LEFT_TAB 0x20000001u /**< Extended key Left Tab */
|
||||
#define SDLK_LEVEL5_SHIFT 0x20000002u /**< Extended key Level 5 Shift */
|
||||
#define SDLK_MULTI_KEY_COMPOSE 0x20000003u /**< Extended key Multi-key Compose */
|
||||
#define SDLK_LMETA 0x20000004u /**< Extended key Left Meta */
|
||||
#define SDLK_RMETA 0x20000005u /**< Extended key Right Meta */
|
||||
#define SDLK_LHYPER 0x20000006u /**< Extended key Left Hyper */
|
||||
#define SDLK_RHYPER 0x20000007u /**< Extended key Right Hyper */
|
||||
|
||||
/**
|
||||
* Valid key modifiers (possibly OR'd together).
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef Uint16 SDL_Keymod;
|
||||
|
||||
#define SDL_KMOD_NONE 0x0000u /**< no modifier is applicable. */
|
||||
#define SDL_KMOD_LSHIFT 0x0001u /**< the left Shift key is down. */
|
||||
#define SDL_KMOD_RSHIFT 0x0002u /**< the right Shift key is down. */
|
||||
#define SDL_KMOD_LEVEL5 0x0004u /**< the Level 5 Shift key is down. */
|
||||
#define SDL_KMOD_LCTRL 0x0040u /**< the left Ctrl (Control) key is down. */
|
||||
#define SDL_KMOD_RCTRL 0x0080u /**< the right Ctrl (Control) key is down. */
|
||||
#define SDL_KMOD_LALT 0x0100u /**< the left Alt key is down. */
|
||||
#define SDL_KMOD_RALT 0x0200u /**< the right Alt key is down. */
|
||||
#define SDL_KMOD_LGUI 0x0400u /**< the left GUI key (often the Windows key) is down. */
|
||||
#define SDL_KMOD_RGUI 0x0800u /**< the right GUI key (often the Windows key) is down. */
|
||||
#define SDL_KMOD_NUM 0x1000u /**< the Num Lock key (may be located on an extended keypad) is down. */
|
||||
#define SDL_KMOD_CAPS 0x2000u /**< the Caps Lock key is down. */
|
||||
#define SDL_KMOD_MODE 0x4000u /**< the !AltGr key is down. */
|
||||
#define SDL_KMOD_SCROLL 0x8000u /**< the Scroll Lock key is down. */
|
||||
#define SDL_KMOD_CTRL (SDL_KMOD_LCTRL | SDL_KMOD_RCTRL) /**< Any Ctrl key is down. */
|
||||
#define SDL_KMOD_SHIFT (SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT) /**< Any Shift key is down. */
|
||||
#define SDL_KMOD_ALT (SDL_KMOD_LALT | SDL_KMOD_RALT) /**< Any Alt key is down. */
|
||||
#define SDL_KMOD_GUI (SDL_KMOD_LGUI | SDL_KMOD_RGUI) /**< Any GUI key is down. */
|
||||
|
||||
#endif /* SDL_keycode_h_ */
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: SharedObject */
|
||||
|
||||
/**
|
||||
* # CategorySharedObject
|
||||
*
|
||||
* System-dependent library loading routines.
|
||||
*
|
||||
* Shared objects are code that is programmatically loadable at runtime.
|
||||
* Windows calls these "DLLs", Linux calls them "shared libraries", etc.
|
||||
*
|
||||
* To use them, build such a library, then call SDL_LoadObject() on it. Once
|
||||
* loaded, you can use SDL_LoadFunction() on that object to find the address
|
||||
* of its exported symbols. When done with the object, call SDL_UnloadObject()
|
||||
* to dispose of it.
|
||||
*
|
||||
* Some things to keep in mind:
|
||||
*
|
||||
* - These functions only work on C function names. Other languages may have
|
||||
* name mangling and intrinsic language support that varies from compiler to
|
||||
* compiler.
|
||||
* - Make sure you declare your function pointers with the same calling
|
||||
* convention as the actual library function. Your code will crash
|
||||
* mysteriously if you do not do this.
|
||||
* - Avoid namespace collisions. If you load a symbol from the library, it is
|
||||
* not defined whether or not it goes into the global symbol namespace for
|
||||
* the application. If it does and it conflicts with symbols in your code or
|
||||
* other shared libraries, you will not get the results you expect. :)
|
||||
* - Once a library is unloaded, all pointers into it obtained through
|
||||
* SDL_LoadFunction() become invalid, even if the library is later reloaded.
|
||||
* Don't unload a library if you plan to use these pointers in the future.
|
||||
* Notably: beware of giving one of these pointers to atexit(), since it may
|
||||
* call that pointer after the library unloads.
|
||||
*/
|
||||
|
||||
#ifndef SDL_loadso_h_
|
||||
#define SDL_loadso_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An opaque datatype that represents a loaded shared object.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
typedef struct SDL_SharedObject SDL_SharedObject;
|
||||
|
||||
/**
|
||||
* Dynamically load a shared object.
|
||||
*
|
||||
* \param sofile a system-dependent name of the object file.
|
||||
* \returns an opaque pointer to the object handle or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_SharedObject * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
|
||||
/**
|
||||
* Look up the address of the named function in a shared object.
|
||||
*
|
||||
* This function pointer is no longer valid after calling SDL_UnloadObject().
|
||||
*
|
||||
* This function can only look up C function names. Other languages may have
|
||||
* name mangling and intrinsic language support that varies from compiler to
|
||||
* compiler.
|
||||
*
|
||||
* Make sure you declare your function pointers with the same calling
|
||||
* convention as the actual library function. Your code will crash
|
||||
* mysteriously if you do not do this.
|
||||
*
|
||||
* If the requested function doesn't exist, NULL is returned.
|
||||
*
|
||||
* \param handle a valid shared object handle returned by SDL_LoadObject().
|
||||
* \param name the name of the function to look up.
|
||||
* \returns a pointer to the function or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject *handle, const char *name);
|
||||
|
||||
/**
|
||||
* Unload a shared object from memory.
|
||||
*
|
||||
* Note that any pointers from this object looked up through
|
||||
* SDL_LoadFunction() will no longer be valid.
|
||||
*
|
||||
* \param handle a valid shared object handle returned by SDL_LoadObject().
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(SDL_SharedObject *handle);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_loadso_h_ */
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryLocale
|
||||
*
|
||||
* SDL locale services.
|
||||
*
|
||||
* This provides a way to get a list of preferred locales (language plus
|
||||
* country) for the user. There is exactly one function:
|
||||
* SDL_GetPreferredLocales(), which handles all the heavy lifting, and offers
|
||||
* documentation on all the strange ways humans might have configured their
|
||||
* language settings.
|
||||
*/
|
||||
|
||||
#ifndef SDL_locale_h
|
||||
#define SDL_locale_h
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A struct to provide locale data.
|
||||
*
|
||||
* Locale data is split into a spoken language, like English, and an optional
|
||||
* country, like Canada. The language will be in ISO-639 format (so English
|
||||
* would be "en"), and the country, if not NULL, will be an ISO-3166 country
|
||||
* code (so Canada would be "CA").
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetPreferredLocales
|
||||
*/
|
||||
typedef struct SDL_Locale
|
||||
{
|
||||
const char *language; /**< A language name, like "en" for English. */
|
||||
const char *country; /**< A country, like "US" for America. Can be NULL. */
|
||||
} SDL_Locale;
|
||||
|
||||
/**
|
||||
* Report the user's preferred locale.
|
||||
*
|
||||
* Returned language strings are in the format xx, where 'xx' is an ISO-639
|
||||
* language specifier (such as "en" for English, "de" for German, etc).
|
||||
* Country strings are in the format YY, where "YY" is an ISO-3166 country
|
||||
* code (such as "US" for the United States, "CA" for Canada, etc). Country
|
||||
* might be NULL if there's no specific guidance on them (so you might get {
|
||||
* "en", "US" } for American English, but { "en", NULL } means "English
|
||||
* language, generically"). Language strings are never NULL, except to
|
||||
* terminate the array.
|
||||
*
|
||||
* Please note that not all of these strings are 2 characters; some are three
|
||||
* or more.
|
||||
*
|
||||
* The returned list of locales are in the order of the user's preference. For
|
||||
* example, a German citizen that is fluent in US English and knows enough
|
||||
* Japanese to navigate around Tokyo might have a list like: { "de", "en_US",
|
||||
* "jp", NULL }. Someone from England might prefer British English (where
|
||||
* "color" is spelled "colour", etc), but will settle for anything like it: {
|
||||
* "en_GB", "en", NULL }.
|
||||
*
|
||||
* This function returns NULL on error, including when the platform does not
|
||||
* supply this information at all.
|
||||
*
|
||||
* This might be a "slow" call that has to query the operating system. It's
|
||||
* best to ask for this once and save the results. However, this list can
|
||||
* change, usually because the user has changed a system preference outside of
|
||||
* your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case,
|
||||
* if possible, and you can call this function again to get an updated copy of
|
||||
* preferred locales.
|
||||
*
|
||||
* \param count a pointer filled in with the number of locales returned, may
|
||||
* be NULL.
|
||||
* \returns a NULL terminated array of locale pointers, or NULL on failure;
|
||||
* call SDL_GetError() for more information. This is a single
|
||||
* allocation that should be freed with SDL_free() when it is no
|
||||
* longer needed.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_locale_h */
|
||||
@@ -0,0 +1,540 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryLog
|
||||
*
|
||||
* Simple log messages with priorities and categories. A message's
|
||||
* SDL_LogPriority signifies how important the message is. A message's
|
||||
* SDL_LogCategory signifies from what domain it belongs to. Every category
|
||||
* has a minimum priority specified: when a message belongs to that category,
|
||||
* it will only be sent out if it has that minimum priority or higher.
|
||||
*
|
||||
* SDL's own logs are sent below the default priority threshold, so they are
|
||||
* quiet by default.
|
||||
*
|
||||
* You can change the log verbosity programmatically using
|
||||
* SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with
|
||||
* the "SDL_LOGGING" environment variable. This variable is a comma separated
|
||||
* set of category=level tokens that define the default logging levels for SDL
|
||||
* applications.
|
||||
*
|
||||
* The category can be a numeric category, one of "app", "error", "assert",
|
||||
* "system", "audio", "video", "render", "input", "test", or `*` for any
|
||||
* unspecified category.
|
||||
*
|
||||
* The level can be a numeric level, one of "trace", "verbose", "debug",
|
||||
* "info", "warn", "error", "critical", or "quiet" to disable that category.
|
||||
*
|
||||
* You can omit the category if you want to set the logging level for all
|
||||
* categories.
|
||||
*
|
||||
* If this hint isn't set, the default log levels are equivalent to:
|
||||
*
|
||||
* `app=info,assert=warn,test=verbose,*=error`
|
||||
*
|
||||
* Here's where the messages go on different platforms:
|
||||
*
|
||||
* - Windows: debug output stream
|
||||
* - Android: log output
|
||||
* - Others: standard error output (stderr)
|
||||
*
|
||||
* You don't need to have a newline (`\n`) on the end of messages, the
|
||||
* functions will do that for you. For consistent behavior cross-platform, you
|
||||
* shouldn't have any newlines in messages, such as to log multiple lines in
|
||||
* one call; unusual platform-specific behavior can be observed in such usage.
|
||||
* Do one log call per line instead, with no newlines in messages.
|
||||
*
|
||||
* Each log call is atomic, so you won't see log messages cut off one another
|
||||
* when logging from multiple threads.
|
||||
*/
|
||||
|
||||
#ifndef SDL_log_h_
|
||||
#define SDL_log_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The predefined log categories
|
||||
*
|
||||
* By default the application and gpu categories are enabled at the INFO
|
||||
* level, the assert category is enabled at the WARN level, test is enabled at
|
||||
* the VERBOSE level and all other categories are enabled at the ERROR level.
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_LogCategory
|
||||
{
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
SDL_LOG_CATEGORY_ERROR,
|
||||
SDL_LOG_CATEGORY_ASSERT,
|
||||
SDL_LOG_CATEGORY_SYSTEM,
|
||||
SDL_LOG_CATEGORY_AUDIO,
|
||||
SDL_LOG_CATEGORY_VIDEO,
|
||||
SDL_LOG_CATEGORY_RENDER,
|
||||
SDL_LOG_CATEGORY_INPUT,
|
||||
SDL_LOG_CATEGORY_TEST,
|
||||
SDL_LOG_CATEGORY_GPU,
|
||||
|
||||
/* Reserved for future SDL library use */
|
||||
SDL_LOG_CATEGORY_RESERVED2,
|
||||
SDL_LOG_CATEGORY_RESERVED3,
|
||||
SDL_LOG_CATEGORY_RESERVED4,
|
||||
SDL_LOG_CATEGORY_RESERVED5,
|
||||
SDL_LOG_CATEGORY_RESERVED6,
|
||||
SDL_LOG_CATEGORY_RESERVED7,
|
||||
SDL_LOG_CATEGORY_RESERVED8,
|
||||
SDL_LOG_CATEGORY_RESERVED9,
|
||||
SDL_LOG_CATEGORY_RESERVED10,
|
||||
|
||||
/* Beyond this point is reserved for application use, e.g.
|
||||
enum {
|
||||
MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
|
||||
MYAPP_CATEGORY_AWESOME2,
|
||||
MYAPP_CATEGORY_AWESOME3,
|
||||
...
|
||||
};
|
||||
*/
|
||||
SDL_LOG_CATEGORY_CUSTOM
|
||||
} SDL_LogCategory;
|
||||
|
||||
/**
|
||||
* The predefined log priorities
|
||||
*
|
||||
* \since This enum is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef enum SDL_LogPriority
|
||||
{
|
||||
SDL_LOG_PRIORITY_INVALID,
|
||||
SDL_LOG_PRIORITY_TRACE,
|
||||
SDL_LOG_PRIORITY_VERBOSE,
|
||||
SDL_LOG_PRIORITY_DEBUG,
|
||||
SDL_LOG_PRIORITY_INFO,
|
||||
SDL_LOG_PRIORITY_WARN,
|
||||
SDL_LOG_PRIORITY_ERROR,
|
||||
SDL_LOG_PRIORITY_CRITICAL,
|
||||
SDL_LOG_PRIORITY_COUNT
|
||||
} SDL_LogPriority;
|
||||
|
||||
|
||||
/**
|
||||
* Set the priority of all log categories.
|
||||
*
|
||||
* \param priority the SDL_LogPriority to assign.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ResetLogPriorities
|
||||
* \sa SDL_SetLogPriority
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriorities(SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* Set the priority of a particular log category.
|
||||
*
|
||||
* \param category the category to assign a priority to.
|
||||
* \param priority the SDL_LogPriority to assign.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetLogPriority
|
||||
* \sa SDL_ResetLogPriorities
|
||||
* \sa SDL_SetLogPriorities
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* Get the priority of a particular log category.
|
||||
*
|
||||
* \param category the category to query.
|
||||
* \returns the SDL_LogPriority for the requested category.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetLogPriority
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category);
|
||||
|
||||
/**
|
||||
* Reset all priorities to default.
|
||||
*
|
||||
* This is called by SDL_Quit().
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetLogPriorities
|
||||
* \sa SDL_SetLogPriority
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void);
|
||||
|
||||
/**
|
||||
* Set the text prepended to log messages of a given priority.
|
||||
*
|
||||
* By default SDL_LOG_PRIORITY_INFO and below have no prefix, and
|
||||
* SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g.
|
||||
* "WARNING: ".
|
||||
*
|
||||
* This function makes a copy of its string argument, **prefix**, so it is not
|
||||
* necessary to keep the value of **prefix** alive after the call returns.
|
||||
*
|
||||
* \param priority the SDL_LogPriority to modify.
|
||||
* \param prefix the prefix to use for that log priority, or NULL to use no
|
||||
* prefix.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetLogPriorities
|
||||
* \sa SDL_SetLogPriority
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.
|
||||
*
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||
* any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_TRACE.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogTrace(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_VERBOSE.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_DEBUG.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_INFO.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_WARN.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_ERROR.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_CRITICAL.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with the specified category and priority.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param priority the priority of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogMessage(int category,
|
||||
SDL_LogPriority priority,
|
||||
SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
|
||||
|
||||
/**
|
||||
* Log a message with the specified category and priority.
|
||||
*
|
||||
* \param category the category of the message.
|
||||
* \param priority the priority of the message.
|
||||
* \param fmt a printf() style message format string.
|
||||
* \param ap a variable argument list.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogTrace
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_LogMessageV(int category,
|
||||
SDL_LogPriority priority,
|
||||
SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3);
|
||||
|
||||
/**
|
||||
* The prototype for the log output callback function.
|
||||
*
|
||||
* This function is called by SDL when there is new text to be logged. A mutex
|
||||
* is held so that this function is never called by more than one thread at
|
||||
* once.
|
||||
*
|
||||
* \param userdata what was passed as `userdata` to
|
||||
* SDL_SetLogOutputFunction().
|
||||
* \param category the category of the message.
|
||||
* \param priority the priority of the message.
|
||||
* \param message the message being output.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
|
||||
|
||||
/**
|
||||
* Get the default log output function.
|
||||
*
|
||||
* \returns the default log output callback.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_SetLogOutputFunction
|
||||
* \sa SDL_GetLogOutputFunction
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_LogOutputFunction SDLCALL SDL_GetDefaultLogOutputFunction(void);
|
||||
|
||||
/**
|
||||
* Get the current log output function.
|
||||
*
|
||||
* \param callback an SDL_LogOutputFunction filled in with the current log
|
||||
* callback.
|
||||
* \param userdata a pointer filled in with the pointer that is passed to
|
||||
* `callback`.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetDefaultLogOutputFunction
|
||||
* \sa SDL_SetLogOutputFunction
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
|
||||
|
||||
/**
|
||||
* Replace the default log output function with one of your own.
|
||||
*
|
||||
* \param callback an SDL_LogOutputFunction to call instead of the default.
|
||||
* \param userdata a pointer that is passed to `callback`.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_GetDefaultLogOutputFunction
|
||||
* \sa SDL_GetLogOutputFunction
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_log_h_ */
|
||||
@@ -0,0 +1,676 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryMain
|
||||
*
|
||||
* Redefine main() if necessary so that it is called by SDL.
|
||||
*
|
||||
* In order to make this consistent on all platforms, the application's main()
|
||||
* should look like this:
|
||||
*
|
||||
* ```c
|
||||
* #include <SDL3/SDL.h>
|
||||
* #include <SDL3/SDL_main.h>
|
||||
*
|
||||
* int main(int argc, char *argv[])
|
||||
* {
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* SDL will take care of platform specific details on how it gets called.
|
||||
*
|
||||
* This is also where an app can be configured to use the main callbacks, via
|
||||
* the SDL_MAIN_USE_CALLBACKS macro.
|
||||
*
|
||||
* SDL_main.h is a "single-header library," which is to say that including
|
||||
* this header inserts code into your program, and you should only include it
|
||||
* once in most cases. SDL.h does not include this header automatically.
|
||||
*
|
||||
* For more information, see:
|
||||
*
|
||||
* https://wiki.libsdl.org/SDL3/README-main-functions
|
||||
*/
|
||||
|
||||
#ifndef SDL_main_h_
|
||||
#define SDL_main_h_
|
||||
|
||||
#include <SDL3/SDL_platform_defines.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_events.h>
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* Inform SDL that the app is providing an entry point instead of SDL.
|
||||
*
|
||||
* SDL does not define this macro, but will check if it is defined when
|
||||
* including `SDL_main.h`. If defined, SDL will expect the app to provide the
|
||||
* proper entry point for the platform, and all the other magic details
|
||||
* needed, like manually calling SDL_SetMainReady.
|
||||
*
|
||||
* Please see [README-main-functions](README-main-functions), (or
|
||||
* docs/README-main-functions.md in the source tree) for a more detailed
|
||||
* explanation.
|
||||
*
|
||||
* \since This macro is used by the headers since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MAIN_HANDLED 1
|
||||
|
||||
/**
|
||||
* Inform SDL to use the main callbacks instead of main.
|
||||
*
|
||||
* SDL does not define this macro, but will check if it is defined when
|
||||
* including `SDL_main.h`. If defined, SDL will expect the app to provide
|
||||
* several functions: SDL_AppInit, SDL_AppEvent, SDL_AppIterate, and
|
||||
* SDL_AppQuit. The app should not provide a `main` function in this case, and
|
||||
* doing so will likely cause the build to fail.
|
||||
*
|
||||
* Please see [README-main-functions](README-main-functions), (or
|
||||
* docs/README-main-functions.md in the source tree) for a more detailed
|
||||
* explanation.
|
||||
*
|
||||
* \since This macro is used by the headers since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AppInit
|
||||
* \sa SDL_AppEvent
|
||||
* \sa SDL_AppIterate
|
||||
* \sa SDL_AppQuit
|
||||
*/
|
||||
#define SDL_MAIN_USE_CALLBACKS 1
|
||||
|
||||
/**
|
||||
* Defined if the target platform offers a special mainline through SDL.
|
||||
*
|
||||
* This won't be defined otherwise. If defined, SDL's headers will redefine
|
||||
* `main` to `SDL_main`.
|
||||
*
|
||||
* This macro is defined by `SDL_main.h`, which is not automatically included
|
||||
* by `SDL.h`.
|
||||
*
|
||||
* Even if available, an app can define SDL_MAIN_HANDLED and provide their
|
||||
* own, if they know what they're doing.
|
||||
*
|
||||
* This macro is used internally by SDL, and apps probably shouldn't rely on it.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
/**
|
||||
* Defined if the target platform _requires_ a special mainline through SDL.
|
||||
*
|
||||
* This won't be defined otherwise. If defined, SDL's headers will redefine
|
||||
* `main` to `SDL_main`.
|
||||
*
|
||||
* This macro is defined by `SDL_main.h`, which is not automatically included
|
||||
* by `SDL.h`.
|
||||
*
|
||||
* Even if required, an app can define SDL_MAIN_HANDLED and provide their
|
||||
* own, if they know what they're doing.
|
||||
*
|
||||
* This macro is used internally by SDL, and apps probably shouldn't rely on it.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__has_include)
|
||||
#if __has_include("SDL_main_private.h") && __has_include("SDL_main_impl_private.h")
|
||||
#define SDL_PLATFORM_PRIVATE_MAIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#if defined(SDL_PLATFORM_PRIVATE_MAIN)
|
||||
/* Private platforms may have their own ideas about entry points. */
|
||||
#include "SDL_main_private.h"
|
||||
|
||||
#elif defined(SDL_PLATFORM_WIN32)
|
||||
/* On Windows SDL provides WinMain(), which parses the command line and passes
|
||||
the arguments to your main function.
|
||||
|
||||
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#elif defined(SDL_PLATFORM_GDK)
|
||||
/* On GDK, SDL provides a main function that initializes the game runtime.
|
||||
|
||||
If you prefer to write your own WinMain-function instead of having SDL
|
||||
provide one that calls your main() function,
|
||||
#define SDL_MAIN_HANDLED before #include'ing SDL_main.h
|
||||
and call the SDL_RunApp function from your entry point.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(SDL_PLATFORM_IOS)
|
||||
/* On iOS SDL provides a main function that creates an application delegate
|
||||
and starts the iOS application run loop.
|
||||
|
||||
To use it, just #include SDL_main.h in the source file that contains your
|
||||
main() function.
|
||||
|
||||
See src/video/uikit/SDL_uikitappdelegate.m for more details.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(SDL_PLATFORM_ANDROID)
|
||||
/* On Android SDL provides a Java class in SDLActivity.java that is the
|
||||
main activity entry point.
|
||||
|
||||
See docs/README-android.md for more details on extending that class.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
/* As this is launched from Java, the real entry point (main() function)
|
||||
is outside of the the binary built from this code.
|
||||
This define makes sure that, unlike on other platforms, SDL_main.h
|
||||
and SDL_main_impl.h export an `SDL_main()` function (to be called
|
||||
from Java), but don't implement a native `int main(int argc, char* argv[])`
|
||||
or similar.
|
||||
*/
|
||||
#define SDL_MAIN_EXPORTED
|
||||
|
||||
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
|
||||
/* On Emscripten, SDL provides a main function that converts URL
|
||||
parameters that start with "SDL_" to environment variables, so
|
||||
they can be used as SDL hints, etc.
|
||||
|
||||
This is 100% optional, so if you don't want this to happen, you may
|
||||
define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#elif defined(SDL_PLATFORM_PSP)
|
||||
/* On PSP SDL provides a main function that sets the module info,
|
||||
activates the GPU and starts the thread required to be able to exit
|
||||
the software.
|
||||
|
||||
If you provide this yourself, you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#elif defined(SDL_PLATFORM_PS2)
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#define SDL_PS2_SKIP_IOP_RESET() \
|
||||
void reset_IOP(); \
|
||||
void reset_IOP() {}
|
||||
|
||||
#elif defined(SDL_PLATFORM_3DS)
|
||||
/*
|
||||
On N3DS, SDL provides a main function that sets up the screens
|
||||
and storage.
|
||||
|
||||
If you provide this yourself, you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#endif
|
||||
#endif /* SDL_MAIN_HANDLED */
|
||||
|
||||
|
||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
||||
|
||||
/**
|
||||
* A macro to tag a main entry point function as exported.
|
||||
*
|
||||
* Most platforms don't need this, and the macro will be defined to nothing.
|
||||
* Some, like Android, keep the entry points in a shared library and need to
|
||||
* explicitly export the symbols.
|
||||
*
|
||||
* External code rarely needs this, and if it needs something, it's almost
|
||||
* always SDL_DECLSPEC instead.
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_DECLSPEC
|
||||
*/
|
||||
#define SDLMAIN_DECLSPEC
|
||||
|
||||
#elif defined(SDL_MAIN_EXPORTED)
|
||||
/* We need to export SDL_main so it can be launched from external code,
|
||||
like SDLActivity.java on Android */
|
||||
#define SDLMAIN_DECLSPEC SDL_DECLSPEC
|
||||
#else
|
||||
/* usually this is empty */
|
||||
#define SDLMAIN_DECLSPEC
|
||||
#endif /* SDL_MAIN_EXPORTED */
|
||||
|
||||
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) || defined(SDL_MAIN_USE_CALLBACKS)
|
||||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* You can (optionally!) define SDL_MAIN_USE_CALLBACKS before including
|
||||
* SDL_main.h, and then your application will _not_ have a standard
|
||||
* "main" entry point. Instead, it will operate as a collection of
|
||||
* functions that are called as necessary by the system. On some
|
||||
* platforms, this is just a layer where SDL drives your program
|
||||
* instead of your program driving SDL, on other platforms this might
|
||||
* hook into the OS to manage the lifecycle. Programs on most platforms
|
||||
* can use whichever approach they prefer, but the decision boils down
|
||||
* to:
|
||||
*
|
||||
* - Using a standard "main" function: this works like it always has for
|
||||
* the past 50+ years in C programming, and your app is in control.
|
||||
* - Using the callback functions: this might clean up some code,
|
||||
* avoid some #ifdef blocks in your program for some platforms, be more
|
||||
* resource-friendly to the system, and possibly be the primary way to
|
||||
* access some future platforms (but none require this at the moment).
|
||||
*
|
||||
* This is up to the app; both approaches are considered valid and supported
|
||||
* ways to write SDL apps.
|
||||
*
|
||||
* If using the callbacks, don't define a "main" function. Instead, implement
|
||||
* the functions listed below in your program.
|
||||
*/
|
||||
#ifdef SDL_MAIN_USE_CALLBACKS
|
||||
|
||||
/**
|
||||
* App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps.
|
||||
*
|
||||
* Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
|
||||
* standard "main" function, you should not supply this.
|
||||
*
|
||||
* This function is called by SDL once, at startup. The function should
|
||||
* initialize whatever is necessary, possibly create windows and open audio
|
||||
* devices, etc. The `argc` and `argv` parameters work like they would with a
|
||||
* standard "main" function.
|
||||
*
|
||||
* This function should not go into an infinite mainloop; it should do any
|
||||
* one-time setup it requires and then return.
|
||||
*
|
||||
* The app may optionally assign a pointer to `*appstate`. This pointer will
|
||||
* be provided on every future call to the other entry points, to allow
|
||||
* application state to be preserved between functions without the app needing
|
||||
* to use a global variable. If this isn't set, the pointer will be NULL in
|
||||
* future entry points.
|
||||
*
|
||||
* If this function returns SDL_APP_CONTINUE, the app will proceed to normal
|
||||
* operation, and will begin receiving repeated calls to SDL_AppIterate and
|
||||
* SDL_AppEvent for the life of the program. If this function returns
|
||||
* SDL_APP_FAILURE, SDL will call SDL_AppQuit and terminate the process with
|
||||
* an exit code that reports an error to the platform. If it returns
|
||||
* SDL_APP_SUCCESS, SDL calls SDL_AppQuit and terminates with an exit code
|
||||
* that reports success to the platform.
|
||||
*
|
||||
* This function is called by SDL on the main thread.
|
||||
*
|
||||
* \param appstate a place where the app can optionally store a pointer for
|
||||
* future use.
|
||||
* \param argc the standard ANSI C main's argc; number of elements in `argv`.
|
||||
* \param argv the standard ANSI C main's argv; array of command line
|
||||
* arguments.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AppIterate
|
||||
* \sa SDL_AppEvent
|
||||
* \sa SDL_AppQuit
|
||||
*/
|
||||
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppInit(void **appstate, int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* App-implemented iteration entry point for SDL_MAIN_USE_CALLBACKS apps.
|
||||
*
|
||||
* Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
|
||||
* standard "main" function, you should not supply this.
|
||||
*
|
||||
* This function is called repeatedly by SDL after SDL_AppInit returns
|
||||
* SDL_APP_CONTINUE. The function should operate as a single iteration the
|
||||
* program's primary loop; it should update whatever state it needs and draw a
|
||||
* new frame of video, usually.
|
||||
*
|
||||
* On some platforms, this function will be called at the refresh rate of the
|
||||
* display (which might change during the life of your app!). There are no
|
||||
* promises made about what frequency this function might run at. You should
|
||||
* use SDL's timer functions if you need to see how much time has passed since
|
||||
* the last iteration.
|
||||
*
|
||||
* There is no need to process the SDL event queue during this function; SDL
|
||||
* will send events as they arrive in SDL_AppEvent, and in most cases the
|
||||
* event queue will be empty when this function runs anyhow.
|
||||
*
|
||||
* This function should not go into an infinite mainloop; it should do one
|
||||
* iteration of whatever the program does and return.
|
||||
*
|
||||
* The `appstate` parameter is an optional pointer provided by the app during
|
||||
* SDL_AppInit(). If the app never provided a pointer, this will be NULL.
|
||||
*
|
||||
* If this function returns SDL_APP_CONTINUE, the app will continue normal
|
||||
* operation, receiving repeated calls to SDL_AppIterate and SDL_AppEvent for
|
||||
* the life of the program. If this function returns SDL_APP_FAILURE, SDL will
|
||||
* call SDL_AppQuit and terminate the process with an exit code that reports
|
||||
* an error to the platform. If it returns SDL_APP_SUCCESS, SDL calls
|
||||
* SDL_AppQuit and terminates with an exit code that reports success to the
|
||||
* platform.
|
||||
*
|
||||
* This function is called by SDL on the main thread.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \threadsafety This function may get called concurrently with SDL_AppEvent()
|
||||
* for events not pushed on the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AppInit
|
||||
* \sa SDL_AppEvent
|
||||
*/
|
||||
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate);
|
||||
|
||||
/**
|
||||
* App-implemented event entry point for SDL_MAIN_USE_CALLBACKS apps.
|
||||
*
|
||||
* Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
|
||||
* standard "main" function, you should not supply this.
|
||||
*
|
||||
* This function is called as needed by SDL after SDL_AppInit returns
|
||||
* SDL_APP_CONTINUE. It is called once for each new event.
|
||||
*
|
||||
* There is (currently) no guarantee about what thread this will be called
|
||||
* from; whatever thread pushes an event onto SDL's queue will trigger this
|
||||
* function. SDL is responsible for pumping the event queue between each call
|
||||
* to SDL_AppIterate, so in normal operation one should only get events in a
|
||||
* serial fashion, but be careful if you have a thread that explicitly calls
|
||||
* SDL_PushEvent. SDL itself will push events to the queue on the main thread.
|
||||
*
|
||||
* Events sent to this function are not owned by the app; if you need to save
|
||||
* the data, you should copy it.
|
||||
*
|
||||
* This function should not go into an infinite mainloop; it should handle the
|
||||
* provided event appropriately and return.
|
||||
*
|
||||
* The `appstate` parameter is an optional pointer provided by the app during
|
||||
* SDL_AppInit(). If the app never provided a pointer, this will be NULL.
|
||||
*
|
||||
* If this function returns SDL_APP_CONTINUE, the app will continue normal
|
||||
* operation, receiving repeated calls to SDL_AppIterate and SDL_AppEvent for
|
||||
* the life of the program. If this function returns SDL_APP_FAILURE, SDL will
|
||||
* call SDL_AppQuit and terminate the process with an exit code that reports
|
||||
* an error to the platform. If it returns SDL_APP_SUCCESS, SDL calls
|
||||
* SDL_AppQuit and terminates with an exit code that reports success to the
|
||||
* platform.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \param event the new event for the app to examine.
|
||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
||||
*
|
||||
* \threadsafety This function may get called concurrently with
|
||||
* SDL_AppIterate() or SDL_AppQuit() for events not pushed from
|
||||
* the main thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AppInit
|
||||
* \sa SDL_AppIterate
|
||||
*/
|
||||
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event);
|
||||
|
||||
/**
|
||||
* App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps.
|
||||
*
|
||||
* Apps implement this function when using SDL_MAIN_USE_CALLBACKS. If using a
|
||||
* standard "main" function, you should not supply this.
|
||||
*
|
||||
* This function is called once by SDL before terminating the program.
|
||||
*
|
||||
* This function will be called in all cases, even if SDL_AppInit requests
|
||||
* termination at startup.
|
||||
*
|
||||
* This function should not go into an infinite mainloop; it should
|
||||
* deinitialize any resources necessary, perform whatever shutdown activities,
|
||||
* and return.
|
||||
*
|
||||
* You do not need to call SDL_Quit() in this function, as SDL will call it
|
||||
* after this function returns and before the process terminates, but it is
|
||||
* safe to do so.
|
||||
*
|
||||
* The `appstate` parameter is an optional pointer provided by the app during
|
||||
* SDL_AppInit(). If the app never provided a pointer, this will be NULL. This
|
||||
* function call is the last time this pointer will be provided, so any
|
||||
* resources to it should be cleaned up here.
|
||||
*
|
||||
* This function is called by SDL on the main thread.
|
||||
*
|
||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
||||
* \param result the result code that terminated the app (success or failure).
|
||||
*
|
||||
* \threadsafety SDL_AppEvent() may get called concurrently with this function
|
||||
* if other threads that push events are still active.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_AppInit
|
||||
*/
|
||||
extern SDLMAIN_DECLSPEC void SDLCALL SDL_AppQuit(void *appstate, SDL_AppResult result);
|
||||
|
||||
#endif /* SDL_MAIN_USE_CALLBACKS */
|
||||
|
||||
|
||||
/**
|
||||
* The prototype for the application's main() function
|
||||
*
|
||||
* \param argc an ANSI-C style main function's argc.
|
||||
* \param argv an ANSI-C style main function's argv.
|
||||
* \returns an ANSI-C main return code; generally 0 is considered successful
|
||||
* program completion, and small non-zero values are considered
|
||||
* errors.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef int (SDLCALL *SDL_main_func)(int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* An app-supplied function for program entry.
|
||||
*
|
||||
* Apps do not directly create this function; they should create a standard
|
||||
* ANSI-C `main` function instead. If SDL needs to insert some startup code
|
||||
* before `main` runs, or the platform doesn't actually _use_ a function
|
||||
* called "main", SDL will do some macro magic to redefine `main` to
|
||||
* `SDL_main` and provide its own `main`.
|
||||
*
|
||||
* Apps should include `SDL_main.h` in the same file as their `main` function,
|
||||
* and they should not use that symbol for anything else in that file, as it
|
||||
* might get redefined.
|
||||
*
|
||||
* This function is only provided by the app if it isn't using
|
||||
* SDL_MAIN_USE_CALLBACKS.
|
||||
*
|
||||
* Program startup is a surprisingly complex topic. Please see
|
||||
* [README-main-functions](README-main-functions), (or
|
||||
* docs/README-main-functions.md in the source tree) for a more detailed
|
||||
* explanation.
|
||||
*
|
||||
* \param argc an ANSI-C style main function's argc.
|
||||
* \param argv an ANSI-C style main function's argv.
|
||||
* \returns an ANSI-C main return code; generally 0 is considered successful
|
||||
* program completion, and small non-zero values are considered
|
||||
* errors.
|
||||
*
|
||||
* \threadsafety This is the program entry point.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDLMAIN_DECLSPEC int SDLCALL SDL_main(int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Circumvent failure of SDL_Init() when not using SDL_main() as an entry
|
||||
* point.
|
||||
*
|
||||
* This function is defined in SDL_main.h, along with the preprocessor rule to
|
||||
* redefine main() as SDL_main(). Thus to ensure that your main() function
|
||||
* will not be changed it is necessary to define SDL_MAIN_HANDLED before
|
||||
* including SDL.h.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
||||
|
||||
/**
|
||||
* Initializes and launches an SDL application, by doing platform-specific
|
||||
* initialization before calling your mainFunction and cleanups after it
|
||||
* returns, if that is needed for a specific platform, otherwise it just calls
|
||||
* mainFunction.
|
||||
*
|
||||
* You can use this if you want to use your own main() implementation without
|
||||
* using SDL_main (like when using SDL_MAIN_HANDLED). When using this, you do
|
||||
* *not* need SDL_SetMainReady().
|
||||
*
|
||||
* \param argc the argc parameter from the application's main() function, or 0
|
||||
* if the platform's main-equivalent has no argc.
|
||||
* \param argv the argv parameter from the application's main() function, or
|
||||
* NULL if the platform's main-equivalent has no argv.
|
||||
* \param mainFunction your SDL app's C-style main(). NOT the function you're
|
||||
* calling this from! Its name doesn't matter; it doesn't
|
||||
* literally have to be `main`.
|
||||
* \param reserved should be NULL (reserved for future use, will probably be
|
||||
* platform-specific then).
|
||||
* \returns the return value from mainFunction: 0 on success, otherwise
|
||||
* failure; SDL_GetError() might have more information on the
|
||||
* failure.
|
||||
*
|
||||
* \threadsafety Generally this is called once, near startup, from the
|
||||
* process's initial thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void *reserved);
|
||||
|
||||
/**
|
||||
* An entry point for SDL's use in SDL_MAIN_USE_CALLBACKS.
|
||||
*
|
||||
* Generally, you should not call this function directly. This only exists to
|
||||
* hand off work into SDL as soon as possible, where it has a lot more control
|
||||
* and functionality available, and make the inline code in SDL_main.h as
|
||||
* small as possible.
|
||||
*
|
||||
* Not all platforms use this, it's actual use is hidden in a magic
|
||||
* header-only library, and you should not call this directly unless you
|
||||
* _really_ know what you're doing.
|
||||
*
|
||||
* \param argc standard Unix main argc.
|
||||
* \param argv standard Unix main argv.
|
||||
* \param appinit the application's SDL_AppInit function.
|
||||
* \param appiter the application's SDL_AppIterate function.
|
||||
* \param appevent the application's SDL_AppEvent function.
|
||||
* \param appquit the application's SDL_AppQuit function.
|
||||
* \returns standard Unix main return value.
|
||||
*
|
||||
* \threadsafety It is not safe to call this anywhere except as the only
|
||||
* function call in SDL_main.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit);
|
||||
|
||||
|
||||
#if defined(SDL_PLATFORM_WINDOWS)
|
||||
|
||||
/**
|
||||
* Register a win32 window class for SDL's use.
|
||||
*
|
||||
* This can be called to set the application window class at startup. It is
|
||||
* safe to call this multiple times, as long as every call is eventually
|
||||
* paired with a call to SDL_UnregisterApp, but a second registration attempt
|
||||
* while a previous registration is still active will be ignored, other than
|
||||
* to increment a counter.
|
||||
*
|
||||
* Most applications do not need to, and should not, call this directly; SDL
|
||||
* will call it when initializing the video subsystem.
|
||||
*
|
||||
* If `name` is NULL, SDL currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` for
|
||||
* the style, regardless of what is specified here.
|
||||
*
|
||||
* \param name the window class name, in UTF-8 encoding. If NULL, SDL
|
||||
* currently uses "SDL_app" but this isn't guaranteed.
|
||||
* \param style the value to use in WNDCLASSEX::style.
|
||||
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
|
||||
* will use `GetModuleHandle(NULL)` instead.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
|
||||
|
||||
/**
|
||||
* Deregister the win32 window class from an SDL_RegisterApp call.
|
||||
*
|
||||
* This can be called to undo the effects of SDL_RegisterApp.
|
||||
*
|
||||
* Most applications do not need to, and should not, call this directly; SDL
|
||||
* will call it when deinitializing the video subsystem.
|
||||
*
|
||||
* It is safe to call this multiple times, as long as every call is eventually
|
||||
* paired with a prior call to SDL_RegisterApp. The window class will only be
|
||||
* deregistered when the registration counter in SDL_RegisterApp decrements to
|
||||
* zero through calls to this function.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||
|
||||
#endif /* defined(SDL_PLATFORM_WINDOWS) */
|
||||
|
||||
/**
|
||||
* Callback from the application to let the suspend continue.
|
||||
*
|
||||
* This function is only needed for Xbox GDK support; all other platforms will
|
||||
* do nothing and set an "unsupported" error message.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
|
||||
/* include header-only SDL_main implementations */
|
||||
#if defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
|
||||
/* platforms which main (-equivalent) can be implemented in plain C */
|
||||
#include <SDL3/SDL_main_impl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* SDL_main_h_ */
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/* WIKI CATEGORY: Main */
|
||||
|
||||
#ifndef SDL_main_impl_h_
|
||||
#define SDL_main_impl_h_
|
||||
|
||||
#ifndef SDL_main_h_
|
||||
#error "This header should not be included directly, but only via SDL_main.h!"
|
||||
#endif
|
||||
|
||||
/* if someone wants to include SDL_main.h but doesn't want the main handing magic,
|
||||
(maybe to call SDL_RegisterApp()) they can #define SDL_MAIN_HANDLED first.
|
||||
SDL_MAIN_NOIMPL is for SDL-internal usage (only affects implementation,
|
||||
not definition of SDL_MAIN_AVAILABLE etc in SDL_main.h) and if the user wants
|
||||
to have the SDL_main implementation (from this header) in another source file
|
||||
than their main() function, for example if SDL_main requires C++
|
||||
and main() is implemented in plain C */
|
||||
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
|
||||
|
||||
/* the implementations below must be able to use the implement real main(), nothing renamed
|
||||
(the user's main() will be renamed to SDL_main so it can be called from here) */
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
#ifdef SDL_MAIN_USE_CALLBACKS
|
||||
|
||||
#if 0
|
||||
/* currently there are no platforms that _need_ a magic entry point here
|
||||
for callbacks, but if one shows up, implement it here. */
|
||||
|
||||
#else /* use a standard SDL_main, which the app SHOULD NOT ALSO SUPPLY. */
|
||||
|
||||
/* this define makes the normal SDL_main entry point stuff work...we just provide SDL_main() instead of the app. */
|
||||
#define SDL_MAIN_CALLBACK_STANDARD 1
|
||||
|
||||
int SDL_main(int argc, char **argv)
|
||||
{
|
||||
return SDL_EnterAppMainCallbacks(argc, argv, SDL_AppInit, SDL_AppIterate, SDL_AppEvent, SDL_AppQuit);
|
||||
}
|
||||
|
||||
#endif /* platform-specific tests */
|
||||
|
||||
#endif /* SDL_MAIN_USE_CALLBACKS */
|
||||
|
||||
|
||||
/* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point,
|
||||
unless the real entry point needs to be somewhere else entirely, like Android where it's in Java code */
|
||||
#if (!defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD)) && !defined(SDL_MAIN_EXPORTED)
|
||||
|
||||
#if defined(SDL_PLATFORM_PRIVATE_MAIN)
|
||||
/* Private platforms may have their own ideas about entry points. */
|
||||
#include "SDL_main_impl_private.h"
|
||||
|
||||
#elif defined(SDL_PLATFORM_WINDOWS)
|
||||
|
||||
/* these defines/typedefs are needed for the WinMain() definition */
|
||||
#ifndef WINAPI
|
||||
#define WINAPI __stdcall
|
||||
#endif
|
||||
|
||||
typedef struct HINSTANCE__ * HINSTANCE;
|
||||
typedef char *LPSTR;
|
||||
typedef wchar_t *PWSTR;
|
||||
|
||||
/* The VC++ compiler needs main/wmain defined, but not for GDK */
|
||||
#if defined(_MSC_VER) && !defined(SDL_PLATFORM_GDK)
|
||||
|
||||
/* This is where execution begins [console apps] */
|
||||
#if defined(UNICODE) && UNICODE
|
||||
int wmain(int argc, wchar_t *wargv[], wchar_t *wenvp)
|
||||
{
|
||||
(void)argc;
|
||||
(void)wargv;
|
||||
(void)wenvp;
|
||||
return SDL_RunApp(0, NULL, SDL_main, NULL);
|
||||
}
|
||||
#else /* ANSI */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
return SDL_RunApp(0, NULL, SDL_main, NULL);
|
||||
}
|
||||
#endif /* UNICODE */
|
||||
|
||||
#endif /* _MSC_VER && ! SDL_PLATFORM_GDK */
|
||||
|
||||
/* This is where execution begins [windowed apps and GDK] */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(UNICODE) && UNICODE
|
||||
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR szCmdLine, int sw)
|
||||
#else /* ANSI */
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
#endif
|
||||
{
|
||||
(void)hInst;
|
||||
(void)hPrev;
|
||||
(void)szCmdLine;
|
||||
(void)sw;
|
||||
return SDL_RunApp(0, NULL, SDL_main, NULL);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
/* end of SDL_PLATFORM_WINDOWS impls */
|
||||
|
||||
#else /* platforms that use a standard main() and just call SDL_RunApp(), like iOS and 3DS */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return SDL_RunApp(argc, argv, SDL_main, NULL);
|
||||
}
|
||||
|
||||
/* end of impls for standard-conforming platforms */
|
||||
|
||||
#endif /* SDL_PLATFORM_WIN32 etc */
|
||||
|
||||
#endif /* !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) */
|
||||
|
||||
/* rename users main() function to SDL_main() so it can be called from the wrappers above */
|
||||
#define main SDL_main
|
||||
|
||||
#endif /* SDL_MAIN_HANDLED */
|
||||
|
||||
#endif /* SDL_main_impl_h_ */
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryMessagebox
|
||||
*
|
||||
* SDL offers a simple message box API, which is useful for simple alerts,
|
||||
* such as informing the user when something fatal happens at startup without
|
||||
* the need to build a UI for it (or informing the user _before_ your UI is
|
||||
* ready).
|
||||
*
|
||||
* These message boxes are native system dialogs where possible.
|
||||
*
|
||||
* There is both a customizable function (SDL_ShowMessageBox()) that offers
|
||||
* lots of options for what to display and reports on what choice the user
|
||||
* made, and also a much-simplified version (SDL_ShowSimpleMessageBox()),
|
||||
* merely takes a text message and title, and waits until the user presses a
|
||||
* single "OK" UI button. Often, this is all that is necessary.
|
||||
*/
|
||||
|
||||
#ifndef SDL_messagebox_h_
|
||||
#define SDL_messagebox_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_video.h> /* For SDL_Window */
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Message box flags.
|
||||
*
|
||||
* If supported will display warning icon, etc.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef Uint32 SDL_MessageBoxFlags;
|
||||
|
||||
#define SDL_MESSAGEBOX_ERROR 0x00000010u /**< error dialog */
|
||||
#define SDL_MESSAGEBOX_WARNING 0x00000020u /**< warning dialog */
|
||||
#define SDL_MESSAGEBOX_INFORMATION 0x00000040u /**< informational dialog */
|
||||
#define SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT 0x00000080u /**< buttons placed left to right */
|
||||
#define SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT 0x00000100u /**< buttons placed right to left */
|
||||
|
||||
/**
|
||||
* SDL_MessageBoxButtonData flags.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef Uint32 SDL_MessageBoxButtonFlags;
|
||||
|
||||
#define SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT 0x00000001u /**< Marks the default button when return is hit */
|
||||
#define SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT 0x00000002u /**< Marks the default button when escape is hit */
|
||||
|
||||
/**
|
||||
* Individual button data.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_MessageBoxButtonData
|
||||
{
|
||||
SDL_MessageBoxButtonFlags flags;
|
||||
int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */
|
||||
const char *text; /**< The UTF-8 button text */
|
||||
} SDL_MessageBoxButtonData;
|
||||
|
||||
/**
|
||||
* RGB value used in a message box color scheme
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_MessageBoxColor
|
||||
{
|
||||
Uint8 r, g, b;
|
||||
} SDL_MessageBoxColor;
|
||||
|
||||
/**
|
||||
* An enumeration of indices inside the colors array of
|
||||
* SDL_MessageBoxColorScheme.
|
||||
*/
|
||||
typedef enum SDL_MessageBoxColorType
|
||||
{
|
||||
SDL_MESSAGEBOX_COLOR_BACKGROUND,
|
||||
SDL_MESSAGEBOX_COLOR_TEXT,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
|
||||
SDL_MESSAGEBOX_COLOR_COUNT /**< Size of the colors array of SDL_MessageBoxColorScheme. */
|
||||
} SDL_MessageBoxColorType;
|
||||
|
||||
/**
|
||||
* A set of colors to use for message box dialogs
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_MessageBoxColorScheme
|
||||
{
|
||||
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_COUNT];
|
||||
} SDL_MessageBoxColorScheme;
|
||||
|
||||
/**
|
||||
* MessageBox structure containing title, text, window, etc.
|
||||
*
|
||||
* \since This struct is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef struct SDL_MessageBoxData
|
||||
{
|
||||
SDL_MessageBoxFlags flags;
|
||||
SDL_Window *window; /**< Parent window, can be NULL */
|
||||
const char *title; /**< UTF-8 title */
|
||||
const char *message; /**< UTF-8 message text */
|
||||
|
||||
int numbuttons;
|
||||
const SDL_MessageBoxButtonData *buttons;
|
||||
|
||||
const SDL_MessageBoxColorScheme *colorScheme; /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */
|
||||
} SDL_MessageBoxData;
|
||||
|
||||
/**
|
||||
* Create a modal message box.
|
||||
*
|
||||
* If your needs aren't complex, it might be easier to use
|
||||
* SDL_ShowSimpleMessageBox.
|
||||
*
|
||||
* This function should be called on the thread that created the parent
|
||||
* window, or on the main thread if the messagebox has no parent. It will
|
||||
* block execution of that thread until the user clicks a button or closes the
|
||||
* messagebox.
|
||||
*
|
||||
* This function may be called at any time, even before SDL_Init(). This makes
|
||||
* it useful for reporting errors like a failure to create a renderer or
|
||||
* OpenGL context.
|
||||
*
|
||||
* On X11, SDL rolls its own dialog box with X11 primitives instead of a
|
||||
* formal toolkit like GTK+ or Qt.
|
||||
*
|
||||
* Note that if SDL_Init() would fail because there isn't any available video
|
||||
* target, this function is likely to fail for the same reasons. If this is a
|
||||
* concern, check the return value from this function and fall back to writing
|
||||
* to stderr if you can.
|
||||
*
|
||||
* \param messageboxdata the SDL_MessageBoxData structure with title, text and
|
||||
* other options.
|
||||
* \param buttonid the pointer to which user id of hit button should be
|
||||
* copied.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ShowSimpleMessageBox
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
|
||||
/**
|
||||
* Display a simple modal message box.
|
||||
*
|
||||
* If your needs aren't complex, this function is preferred over
|
||||
* SDL_ShowMessageBox.
|
||||
*
|
||||
* `flags` may be any of the following:
|
||||
*
|
||||
* - `SDL_MESSAGEBOX_ERROR`: error dialog
|
||||
* - `SDL_MESSAGEBOX_WARNING`: warning dialog
|
||||
* - `SDL_MESSAGEBOX_INFORMATION`: informational dialog
|
||||
*
|
||||
* This function should be called on the thread that created the parent
|
||||
* window, or on the main thread if the messagebox has no parent. It will
|
||||
* block execution of that thread until the user clicks a button or closes the
|
||||
* messagebox.
|
||||
*
|
||||
* This function may be called at any time, even before SDL_Init(). This makes
|
||||
* it useful for reporting errors like a failure to create a renderer or
|
||||
* OpenGL context.
|
||||
*
|
||||
* On X11, SDL rolls its own dialog box with X11 primitives instead of a
|
||||
* formal toolkit like GTK+ or Qt.
|
||||
*
|
||||
* Note that if SDL_Init() would fail because there isn't any available video
|
||||
* target, this function is likely to fail for the same reasons. If this is a
|
||||
* concern, check the return value from this function and fall back to writing
|
||||
* to stderr if you can.
|
||||
*
|
||||
* \param flags an SDL_MessageBoxFlags value.
|
||||
* \param title UTF-8 title text.
|
||||
* \param message UTF-8 message text.
|
||||
* \param window the parent window, or NULL for no parent.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_ShowMessageBox
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_messagebox_h_ */
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* # CategoryMetal
|
||||
*
|
||||
* Functions to creating Metal layers and views on SDL windows.
|
||||
*
|
||||
* This provides some platform-specific glue for Apple platforms. Most macOS
|
||||
* and iOS apps can use SDL without these functions, but this API they can be
|
||||
* useful for specific OS-level integration tasks.
|
||||
*/
|
||||
|
||||
#ifndef SDL_metal_h_
|
||||
#define SDL_metal_h_
|
||||
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
|
||||
*
|
||||
* \since This datatype is available since SDL 3.2.0.
|
||||
*/
|
||||
typedef void *SDL_MetalView;
|
||||
|
||||
/**
|
||||
* \name Metal support functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
|
||||
* window.
|
||||
*
|
||||
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on
|
||||
* its own. It is up to user code to do that.
|
||||
*
|
||||
* The returned handle can be casted directly to a NSView or UIView. To access
|
||||
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
||||
*
|
||||
* \param window the window.
|
||||
* \returns handle NSView or UIView.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Metal_DestroyView
|
||||
* \sa SDL_Metal_GetLayer
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Destroy an existing SDL_MetalView object.
|
||||
*
|
||||
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
||||
* called after SDL_CreateWindow.
|
||||
*
|
||||
* \param view the SDL_MetalView object.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
* \sa SDL_Metal_CreateView
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* Get a pointer to the backing CAMetalLayer for the given view.
|
||||
*
|
||||
* \param view the SDL_MetalView object.
|
||||
* \returns a pointer.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
||||
|
||||
/* @} *//* Metal support functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif /* SDL_metal_h_ */
|
||||