mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 09:06:46 +00:00
Compare commits
1539 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d7267cb4e | |||
| 3443d8eb25 | |||
| 1c5f0fba4f | |||
| 5b6f9d3bfb | |||
| 595138679d | |||
| 9e03d76211 | |||
| 94aa271a84 | |||
| 57c1cd0be4 | |||
| d331114f71 | |||
| 5b05987e27 | |||
| ed37715993 | |||
| d079feeb66 | |||
| 880285afa6 | |||
| 6faaff31be | |||
| 465071c2cf | |||
| cf6a9d6b2a | |||
| 782c5ebc75 | |||
| ef39395580 | |||
| 86c9b6b079 | |||
| 4a036116dd | |||
| 2bab945c34 | |||
| 26ed80bdda | |||
| a6c1314e3e | |||
| 979e54daa7 | |||
| b87e355db3 | |||
| 88ed2e64bb | |||
| 2010d1ba83 | |||
| 332a3d6c6a | |||
| 214503617e | |||
| 1a1cce859a | |||
| 0786b1158a | |||
| 4d87216ec6 | |||
| 7dbf24b95d | |||
| e7cf687d2b | |||
| 5544fd0ae5 | |||
| 842a40f76d | |||
| 70f55179b6 | |||
| a2e12667b4 | |||
| 213a496efb | |||
| b0336302ee | |||
| 58725b061e | |||
| 90c18c1dc9 | |||
| 97ee8e59a1 | |||
| 50eededd9f | |||
| ee95a2a0c8 | |||
| 254764c1e6 | |||
| 352e70cf28 | |||
| 0558b1bc48 | |||
| 2b38dbf1fb | |||
| bce92c5e02 | |||
| 653824ae9e | |||
| b61f612fbe | |||
| 028dbc4bda | |||
| 49b90eae76 | |||
| 65acefc6b1 | |||
| c985307057 | |||
| b475f66014 | |||
| eae7183de2 | |||
| 1d088a1ac1 | |||
| 7d0b7560bc | |||
| 7e86337b80 | |||
| ac25d49a62 | |||
| 8a911682bf | |||
| a87bf5681f | |||
| b84b98dd7c | |||
| c487acbf1a | |||
| 72349ddbb6 | |||
| c8389103e3 | |||
| 7a7069959f | |||
| a20615ea11 | |||
| 0e8672562a | |||
| 05ae8c8219 | |||
| add0c4de47 | |||
| 510d8083b3 | |||
| d0e960e64b | |||
| b8a844b9dc | |||
| f46e4f9aa4 | |||
| a828443b46 | |||
| e28ddcff25 | |||
| 80c7643396 | |||
| 66aaa92bd1 | |||
| eb463eef97 | |||
| d43273fd1b | |||
| 2c91d1db6e | |||
| d504397593 | |||
| 95043d637c | |||
| 51a006654a | |||
| dde3f603be | |||
| 4fe6836cf0 | |||
| fdcd39398c | |||
| f7fe10fc98 | |||
| 7d99becca9 | |||
| a53f65d86b | |||
| fb7362c092 | |||
| 714f8172ec | |||
| 9344896238 | |||
| 3081f7b24f | |||
| e594b7eac6 | |||
| 0f3fbc3883 | |||
| 2d20d5858e | |||
| fe57e4d924 | |||
| e4e40505b6 | |||
| 5b5c3a08e6 | |||
| 137d2d723d | |||
| aff481bd37 | |||
| a5a660b828 | |||
| d08b7dafa4 | |||
| 3e1b86a7c3 | |||
| fe68c7bc14 | |||
| 4ee35d7e56 | |||
| dbdad80960 | |||
| 72940b2511 | |||
| 70922975cf | |||
| 135cfd7617 | |||
| d58e88a2f7 | |||
| c29bdd4b1d | |||
| 0643bf9783 | |||
| 386261181e | |||
| d8b704ef7d | |||
| e46e2952e6 | |||
| a339d0d41d | |||
| d62f2d41fc | |||
| 339e921f17 | |||
| 5e963c05af | |||
| 638d43e3cf | |||
| fdef1090c3 | |||
| 89303d9218 | |||
| 341bc0723b | |||
| a6b31017e3 | |||
| ca29cb037e | |||
| d59931dc4d | |||
| 876335bb54 | |||
| 5c87b8152d | |||
| ef487112df | |||
| 49089f7537 | |||
| 736890119b | |||
| 2da70c69da | |||
| ae966e546b | |||
| 0d63c8b9ef | |||
| 8f66527e02 | |||
| 7e7f5f0bd6 | |||
| b3ac1001c9 | |||
| e5e779c064 | |||
| 525db1819d | |||
| bb3c0b41f6 | |||
| 35c4867334 | |||
| 690d8f9155 | |||
| b63923264d | |||
| 5aab187e17 | |||
| ee4a79616f | |||
| b667944612 | |||
| 6fb3c66fe5 | |||
| 66ef95b9c9 | |||
| bb3596d245 | |||
| a5c32b63b7 | |||
| 9e4f728f21 | |||
| 3cb7b362c8 | |||
| 1beb221337 | |||
| 28cb11f521 | |||
| d71e79b306 | |||
| 7edc891605 | |||
| 8e4aff391e | |||
| 1b84905941 | |||
| 06d22fa009 | |||
| 29f89cdfbc | |||
| 6f49a37914 | |||
| 1e316102ea | |||
| 03b2550520 | |||
| e547a1e778 | |||
| 9c69eed211 | |||
| 464c1cb584 | |||
| 4fbe55cc35 | |||
| 008b17aaf2 | |||
| c469571f62 | |||
| 6c2a8edea6 | |||
| 361937d443 | |||
| 4071e1d4d9 | |||
| 46a358abe6 | |||
| fc339cc9d0 | |||
| c87380fa54 | |||
| 959337b592 | |||
| ca0b9bc374 | |||
| 2d459a962e | |||
| f3b2ac6c17 | |||
| 6027a80c14 | |||
| 6934552dd9 | |||
| 0b755cac54 | |||
| 765ee5eeed | |||
| c36a1cd6dc | |||
| a493242c3c | |||
| 97bb50a5c4 | |||
| 27225b6047 | |||
| cbd68ff8c8 | |||
| a32dedeb48 | |||
| 91d3851d76 | |||
| b5e9c0f996 | |||
| de4782368d | |||
| 3e39c0c11a | |||
| d2360753fb | |||
| e747ea851a | |||
| 68d563c72f | |||
| c5e4bb08f4 | |||
| 0b97db9fd2 | |||
| fb8873e77b | |||
| e943771945 | |||
| 05a3c4b2b8 | |||
| 24b396e516 | |||
| cdd0b2de00 | |||
| 4096ee1f1e | |||
| f720e51585 | |||
| c5c93bb2e6 | |||
| 85bafecc93 | |||
| 2ed185aa2c | |||
| 1b2316ad1f | |||
| 80ad3a8940 | |||
| cef4928dd0 | |||
| ab65bb1d57 | |||
| c21293e508 | |||
| 3c794cfc07 | |||
| d71dbd1751 | |||
| 8805021960 | |||
| dd2b12b517 | |||
| 78f3a2aa64 | |||
| 03dbe47546 | |||
| 13ad5e4b46 | |||
| 6716e580f3 | |||
| 5d9c8c8e27 | |||
| 7bd5213be4 | |||
| 93ddf915a2 | |||
| f8ce10472b | |||
| ceb2b287bb | |||
| 8e9fa38197 | |||
| 5763672175 | |||
| 6ed3301110 | |||
| fbe456ed45 | |||
| 518a5e8ab1 | |||
| 008ac97a64 | |||
| 7892fed6d9 | |||
| 6042410b4b | |||
| 26532c03ac | |||
| 0fa5053ad1 | |||
| 39a94dba0d | |||
| a440269c6b | |||
| a7310cba17 | |||
| b82100bcd7 | |||
| e7ce79261d | |||
| d8bbb428d8 | |||
| 7adc93d806 | |||
| 62dcc188d1 | |||
| aa1114c387 | |||
| 462349ad84 | |||
| 19183f958e | |||
| 42d3a7e4f6 | |||
| af02b9f958 | |||
| f67d280845 | |||
| 6d7203ef4b | |||
| 90a9b98ae6 | |||
| 61fb708b73 | |||
| 4629b4f261 | |||
| 865c8562da | |||
| 7fea04c663 | |||
| 8620e1b7c9 | |||
| 9102c1a13a | |||
| 682df81339 | |||
| 40ebee9ff4 | |||
| 26213f9049 | |||
| 680f1f017d | |||
| cee3dc370d | |||
| f91de33e5d | |||
| fc844cefd7 | |||
| a5e65b93c9 | |||
| 92e20d07ae | |||
| c4432bcd7e | |||
| b6fc878aab | |||
| d18fb730ec | |||
| 4cd7d98224 | |||
| 760ba01e6b | |||
| fb2f8327e2 | |||
| 7559d96a0e | |||
| 1471784035 | |||
| 057823e4c1 | |||
| e1f8354905 | |||
| 50cc093250 | |||
| e25499b3f2 | |||
| 14b3525e9c | |||
| c2a35bb2e1 | |||
| 279cd4660d | |||
| 2dad087bbd | |||
| 4b612400da | |||
| 91da1305a4 | |||
| ee581f27c4 | |||
| d90982e63b | |||
| a3dc36ae22 | |||
| b25c5d509d | |||
| 6e1c8c665b | |||
| feafd43fdf | |||
| 7d7b9d0238 | |||
| c2b5820153 | |||
| a6b9cd87ec | |||
| 11092da32d | |||
| dfccb4a2bc | |||
| c1ad00cbc6 | |||
| 6686346473 | |||
| 0356c0a891 | |||
| 8af4730ddf | |||
| 994e2001a0 | |||
| c65864ffb6 | |||
| 8011c48641 | |||
| 97873ff42d | |||
| 9af9deb0f5 | |||
| 477ba3f4b9 | |||
| 9c6dbe699f | |||
| 9cfe6b936b | |||
| 9b4e63fbc7 | |||
| ba1a317119 | |||
| 55f1767001 | |||
| f8b924c262 | |||
| e19b7bd368 | |||
| 3bfa1d68f7 | |||
| aaac2c5a84 | |||
| 29a62dfa85 | |||
| 790304d1f1 | |||
| 7e0e9a037d | |||
| 712fe1f6ec | |||
| b03e9af597 | |||
| 52d31a6846 | |||
| a8427ca610 | |||
| 5880593cb1 | |||
| 6bb3ebc00e | |||
| da163be8db | |||
| e928046a95 | |||
| 3eaa0b4fb1 | |||
| 37bedfe9ba | |||
| df0004c1b0 | |||
| 24e4730204 | |||
| 7d12382333 | |||
| bc348dadad | |||
| ceadb1325d | |||
| 15f7440af2 | |||
| cd748e7d8b | |||
| ed98aa45d2 | |||
| 10477d3795 | |||
| 982c078926 | |||
| a721179aa8 | |||
| 50d5f3785c | |||
| 9856df20fb | |||
| c8b75e982e | |||
| 199dd7d618 | |||
| ab569681b1 | |||
| b10f5d3745 | |||
| 7dd904c8d1 | |||
| 624be70990 | |||
| b9d2c1b9f6 | |||
| 00b2debb32 | |||
| f29fe17496 | |||
| e80f3c87e9 | |||
| a7d0251b77 | |||
| 3bcfcc6308 | |||
| 7d004e1eb0 | |||
| 90f6023f0f | |||
| 4e9c3e19d2 | |||
| 0f1ca0856c | |||
| 2ef5ade596 | |||
| 75e60b7f8e | |||
| 64d39134b9 | |||
| 414cafdbed | |||
| f566cba56a | |||
| 8400994c57 | |||
| 43f459b194 | |||
| e352171efa | |||
| 6c2f554a31 | |||
| bb2a6dce23 | |||
| 288ae4bad3 | |||
| f2c48d4c58 | |||
| f8571a57dd | |||
| 5285e8a163 | |||
| f8a4f2e6bd | |||
| c7ad873581 | |||
| 78759add4a | |||
| 48b674a13d | |||
| 8c9b852586 | |||
| 9634bef7fc | |||
| cbbfae0cfc | |||
| fc7623b690 | |||
| 0cf5a7aec3 | |||
| 59152a9d77 | |||
| e3972cc9e6 | |||
| 2a4d6523b1 | |||
| 6d8b96068d | |||
| e88cd61097 | |||
| b71f3031bc | |||
| 9dd4002337 | |||
| ccdebf0116 | |||
| 1a4aa1692a | |||
| 240f04eda7 | |||
| 7b4c130e0a | |||
| 7e3fdee86c | |||
| 6a79694fa1 | |||
| c52ff4249a | |||
| 4e7870c634 | |||
| 487dcc4459 | |||
| 0ba9b3fedc | |||
| 46561b9cf5 | |||
| 545ac6b420 | |||
| 2146489740 | |||
| 3746128014 | |||
| ca32e35ef6 | |||
| c37e83e235 | |||
| 00604722bb | |||
| 808654743c | |||
| bb2d8f6a4d | |||
| 7a263c032d | |||
| ad7dfc31a9 | |||
| 0663e9cb6f | |||
| b0a3e9205f | |||
| 0e8f6a32b1 | |||
| 17544d4577 | |||
| b22a88eccc | |||
| 563878f20e | |||
| dd8d23be62 | |||
| 4d3dda23f8 | |||
| 718a2c2205 | |||
| ffbee0ad1a | |||
| bb8c6da0b4 | |||
| 575ba28b62 | |||
| 3afee1f841 | |||
| d5699fb68d | |||
| 519c049902 | |||
| 28fca1f8dc | |||
| 935dc7d8fb | |||
| 771c3b175e | |||
| b468945eb7 | |||
| 3554211233 | |||
| 0fc72875b2 | |||
| 2286203123 | |||
| 210655ddc7 | |||
| 034ebab064 | |||
| e32b6c55e4 | |||
| 4f016de277 | |||
| 832c31a41a | |||
| 02b7e3fafb | |||
| ff13f162ce | |||
| 80f1c65e1c | |||
| 7d3f35d48b | |||
| 0b11340c4e | |||
| 898ec8fcf1 | |||
| c4d7fb8724 | |||
| b8c0b2c326 | |||
| 8ec9f36954 | |||
| db0b4045a2 | |||
| b4a234b1c0 | |||
| dcfefee060 | |||
| 6859d92716 | |||
| f6f3060c9d | |||
| 6bf2cf8cb8 | |||
| a0140ff943 | |||
| df1e486df6 | |||
| a0cfba5b3e | |||
| 84b1a719f2 | |||
| 734d79d540 | |||
| 2c388117ad | |||
| 92a678d0b4 | |||
| ed1015fa89 | |||
| 934450b749 | |||
| e025bfdb46 | |||
| 055daddcaf | |||
| 618252882c | |||
| efda99c230 | |||
| 8a50039482 | |||
| 79e825b7c7 | |||
| ec6b74aa7f | |||
| dad6f2ead5 | |||
| 3b1c663e58 | |||
| 0624667572 | |||
| 07c80f9560 | |||
| 947341a5ee | |||
| 44eef6482c | |||
| f534e69a90 | |||
| 03399fe3fd | |||
| 51c9cec35a | |||
| da660b461f | |||
| 69c6879ac9 | |||
| a1ff12d9ab | |||
| 24ab98be4b | |||
| 49d0c308e8 | |||
| edf1cfefd3 | |||
| 601e495da7 | |||
| e84799e15b | |||
| bdc90ac3a7 | |||
| dfdd775519 | |||
| a36b37b1ea | |||
| ceb0fe22f1 | |||
| aa8a2ea41b | |||
| 159fb62898 | |||
| d8bbd85abb | |||
| 57d260f30a | |||
| ef74205503 | |||
| 89bbf05b63 | |||
| 7d5089f5e8 | |||
| ab33148f81 | |||
| c2766db89d | |||
| f97693f8e1 | |||
| 034c076882 | |||
| 12bed1462f | |||
| 79ff4dd944 | |||
| ec77e3a6fd | |||
| 35977b02ed | |||
| 20b6c2f556 | |||
| 7cda4aaa2c | |||
| 07bdb3a632 | |||
| fe8c55ac63 | |||
| a83edb83ba | |||
| 5f1063acb9 | |||
| f917a38e1a | |||
| accc8aee57 | |||
| 0977471201 | |||
| e61e7fd008 | |||
| 596e3b28b5 | |||
| 077ba02004 | |||
| 75ee3b30e2 | |||
| 10a27c2081 | |||
| 78d95cab89 | |||
| 7881d6609a | |||
| b9336bad7e | |||
| 84b3cff936 | |||
| e265f7713c | |||
| 3312d8c05b | |||
| 8b5389e719 | |||
| 6f2de7d31b | |||
| fb208657ea | |||
| eab6bb8314 | |||
| 0b489bc507 | |||
| b2b447516d | |||
| f7cc23d415 | |||
| 6fcd39b4f8 | |||
| 4ed6e20b35 | |||
| 70a74d6615 | |||
| de7e6e8e66 | |||
| b33f2e5989 | |||
| 55c557f227 | |||
| ab5fe1e518 | |||
| 10325fed8b | |||
| 58970282da | |||
| 4d12481822 | |||
| ff005a22a3 | |||
| 92031bbd70 | |||
| d0ef6a5293 | |||
| f9480f2518 | |||
| 56c570fd19 | |||
| 0b647c7ae5 | |||
| 91589eae34 | |||
| 89a5a45d7e | |||
| 06b91a6e01 | |||
| 19bee763bd | |||
| b0710ff8d1 | |||
| 2342caff32 | |||
| e05a45f6c7 | |||
| c7e33eb6b9 | |||
| 6c1efd74cb | |||
| 43204e52f8 | |||
| 2a7a88ff47 | |||
| 6580aad173 | |||
| 574a5e303c | |||
| 5c75a68715 | |||
| ee618f70ab | |||
| 94038ebb75 | |||
| be0374d197 | |||
| c8b20ecb1a | |||
| 45b29aedf3 | |||
| 855796448c | |||
| 0153726755 | |||
| d47daa2857 | |||
| d9a1cf8c7b | |||
| 59a2f0cdde | |||
| a6e2110f3d | |||
| 9296f2bdc5 | |||
| ec00daa5be | |||
| dceb79ad69 | |||
| a41c690a62 | |||
| 62e4169e50 | |||
| 122e71f4a3 | |||
| c6c6d00bad | |||
| ccdeb4d385 | |||
| b7338d5bf0 | |||
| 127f51e758 | |||
| aae1d2f049 | |||
| 9c88dda251 | |||
| 900a5f83da | |||
| 0c532236a5 | |||
| bebab942cc | |||
| 58c15b0287 | |||
| bfae4273c2 | |||
| 7300776a85 | |||
| 3878bd0c76 | |||
| 786e03b0ac | |||
| f8b5637112 | |||
| 2f4944ca21 | |||
| a7c0e82c9e | |||
| 5542107f02 | |||
| 94b5684b42 | |||
| 4a84c311b2 | |||
| 49505a7a45 | |||
| 10b01e62df | |||
| eff8000196 | |||
| c6bb4a6470 | |||
| 3dcc2edceb | |||
| cfd2f8776e | |||
| d11e2410bf | |||
| 83605831ec | |||
| aed1959dbe | |||
| c3c60b331a | |||
| 15606a99fc | |||
| eddc9c9baf | |||
| 7bbc4a6a44 | |||
| 1f39a0cb3e | |||
| 8d680b2222 | |||
| 21ef83bcbe | |||
| 6253162166 | |||
| 1110b284d8 | |||
| 5c6f684808 | |||
| 9b1a449fba | |||
| e4f337edb6 | |||
| 5a9744b429 | |||
| e0237ce526 | |||
| 4d2825d817 | |||
| 09ccd23d0b | |||
| cbbd01b391 | |||
| 539fa8b262 | |||
| 592bbd3180 | |||
| b09792812a | |||
| 9154938827 | |||
| 4f7b8e0934 | |||
| c0f53647b8 | |||
| 3e1b75b814 | |||
| 497170c453 | |||
| 6773412e40 | |||
| 1c8dea909e | |||
| d6ac686a54 | |||
| 5fac13075b | |||
| 6cc774faf4 | |||
| 8f4ec1b960 | |||
| 357be65a69 | |||
| f164833b00 | |||
| 627859ba73 | |||
| a7c239b801 | |||
| 1cabb091e7 | |||
| d0e612b5ff | |||
| 0a8b21d4ab | |||
| b0cef869b5 | |||
| 16cbf9bbf1 | |||
| 70b3a7ba84 | |||
| 8df8d7c3f6 | |||
| 27fd6316f1 | |||
| 4e15364d42 | |||
| 35c194e2eb | |||
| 0c5c6587e5 | |||
| b5a81fbd07 | |||
| 233ce5cf03 | |||
| f79f54920d | |||
| 0a0d4fbb70 | |||
| b29f70ad3f | |||
| c1669299aa | |||
| d62219d0ad | |||
| 59ddf507e6 | |||
| b4837011ea | |||
| 995a4527da | |||
| 4d94d5fe17 | |||
| d64f2e40c5 | |||
| 6575d106de | |||
| 31d8336b4b | |||
| 75d7c40098 | |||
| 7c377e8904 | |||
| c83810be36 | |||
| 4d8f5df261 | |||
| d6890ad76d | |||
| c25a5fa0ba | |||
| decaa1f7b6 | |||
| daced25101 | |||
| fd6387c830 | |||
| c69df29345 | |||
| b793f3d9ca | |||
| 7781dc6ffe | |||
| 962fcc2e8a | |||
| 7189994b78 | |||
| 6bdcfaaa71 | |||
| 5eba112b7a | |||
| 5865948a8b | |||
| 9277665f5f | |||
| 4067397697 | |||
| 28fd766278 | |||
| abeeb80727 | |||
| 82776deb89 | |||
| 6e70d12b0a | |||
| d6b61b9163 | |||
| 0e96e6689a | |||
| fe9fb72dff | |||
| 7e2136a5a8 | |||
| 9f8ad1a32c | |||
| 15d81eee21 | |||
| 84bcb3ac03 | |||
| 04cf511e4f | |||
| 21f02f4ce4 | |||
| c1ee88a90e | |||
| 8435fa269d | |||
| 797c35230f | |||
| 2a97d980b7 | |||
| 9229ca4f79 | |||
| b3d8bcab4a | |||
| 14c9ddf15a | |||
| 3ca8ddbff1 | |||
| baca139f9b | |||
| 34c535ef81 | |||
| 0fd6815f81 | |||
| 682dc35d80 | |||
| cfd1b9a5ee | |||
| 89587970dd | |||
| 4ab420ed99 | |||
| 8d391a7e3f | |||
| 6d59baffaf | |||
| 34549a4bdb | |||
| 757c7f5b00 | |||
| 8a6c37f2d4 | |||
| 78a73cab85 | |||
| 69fd5cd249 | |||
| 051fd1b77b | |||
| 05ee69de55 | |||
| 208918b57f | |||
| 3320207086 | |||
| f75e48b1e7 | |||
| e15f8a2cb6 | |||
| ba9f33cf56 | |||
| 36be32f36f | |||
| 7606ca2a0c | |||
| 3b62cf9fd5 | |||
| 4d39c76c19 | |||
| 77a2a249c2 | |||
| bba646a2c6 | |||
| f2b9c1a247 | |||
| cfd7e9f4d3 | |||
| a834ec92a5 | |||
| 5a88ea6950 | |||
| da974e3b9e | |||
| 94f55d9304 | |||
| 6c6b1dcc98 | |||
| 9841ca233d | |||
| be2d65609b | |||
| 999677d314 | |||
| 7fb3eaed65 | |||
| e0c9b6ded5 | |||
| 633b7e2a6c | |||
| cebda984b6 | |||
| 004c0f7858 | |||
| 7cedbb0b16 | |||
| 1f065d7d3d | |||
| cb8c3595b7 | |||
| 984b50504c | |||
| eec6687083 | |||
| 6596dfeeba | |||
| 989a638693 | |||
| 15f8683530 | |||
| 21d3e5afac | |||
| 1e61252445 | |||
| 53978f0ef9 | |||
| 3098b11080 | |||
| 6b8c39d388 | |||
| 474f59e269 | |||
| fac75b6f16 | |||
| f88a6774a9 | |||
| db64e39651 | |||
| 95a8603a73 | |||
| 1d1ee1ccbf | |||
| a632d60140 | |||
| 478a9d115b | |||
| b5b6145786 | |||
| 08111ac176 | |||
| 080f6c5c3e | |||
| 421b3bb277 | |||
| 18d28ae8d3 | |||
| 11e56e72d0 | |||
| 6ae2ff2b75 | |||
| 58e1d9501d | |||
| d36f1159fb | |||
| b4bab425f5 | |||
| 2030278116 | |||
| f9ecabfdcf | |||
| 09f5174299 | |||
| 5ff271d583 | |||
| 4600844336 | |||
| 75d759fb77 | |||
| 3acd845a79 | |||
| 8509f05f0a | |||
| 9161921bf0 | |||
| e3e6889a30 | |||
| 75950b0f2b | |||
| c3ce0a5df5 | |||
| 281483efc1 | |||
| 5d9a89dcd1 | |||
| 23115ca177 | |||
| 8133de4bb4 | |||
| 13af1bfe6f | |||
| d7dfc18c54 | |||
| e5e801dad5 | |||
| ea50543ffa | |||
| 9750d09635 | |||
| 773932d8f6 | |||
| c5e7b18637 | |||
| 160cd609bf | |||
| 60d2c703b6 | |||
| 484e60f142 | |||
| de52d2f64a | |||
| 52a43a3edb | |||
| 7aa1d243b0 | |||
| 93a6efa95f | |||
| e510608a3f | |||
| 9f199100e5 | |||
| 4666c0c050 | |||
| b5fe975aac | |||
| a801f296b5 | |||
| 9d0308c9bf | |||
| 38e5cdb142 | |||
| c67c303d0a | |||
| f5f2cbc674 | |||
| f1bfd129af | |||
| 34b50e0458 | |||
| af9a34e4e7 | |||
| 01d7a2a0a7 | |||
| 8f9ac2c9ba | |||
| fe8e907b08 | |||
| a06d5fab89 | |||
| 138ad99eea | |||
| d5004dfd55 | |||
| eee8b0bf23 | |||
| d777b1048d | |||
| f931ef7bcb | |||
| 47691c2102 | |||
| bf45a5a44f | |||
| 4b6ce1c19e | |||
| de777fc90f | |||
| 940f3b03e8 | |||
| 05e97f4c64 | |||
| 8febc906a5 | |||
| 7309c11630 | |||
| aa25946dc2 | |||
| 719098a97c | |||
| 9e41795594 | |||
| f77f996c3f | |||
| 8bdefa17b5 | |||
| e8a8647424 | |||
| 1e1de3a48a | |||
| 0ac70c5459 | |||
| cfdbca6f12 | |||
| 9510e8fbe1 | |||
| 803da509ce | |||
| d882c5fbf6 | |||
| f64e1644b1 | |||
| bafb199d24 | |||
| 11e227756d | |||
| 304d41e230 | |||
| 1ae66ce955 | |||
| 13f49fe569 | |||
| 3173c961fa | |||
| 16845c204c | |||
| fa1edee790 | |||
| 94d8db4691 | |||
| 153e587cea | |||
| fbb13ec416 | |||
| e7785d5693 | |||
| 23bc535e23 | |||
| d04d6750a2 | |||
| db210ba70e | |||
| 1ce1073930 | |||
| 2d24237aac | |||
| 750e65f847 | |||
| 31cc6f63d6 | |||
| 81cadf3bb2 | |||
| 54c28117a8 | |||
| 79f9433dfa | |||
| 67a95b59a7 | |||
| 09b9d398e2 | |||
| 3dd0d43e96 | |||
| 8d1fe63e77 | |||
| 3fa72218a4 | |||
| f3f034d948 | |||
| 159706efa9 | |||
| 310d27c0bd | |||
| bd364a4049 | |||
| 41b1634199 | |||
| 0159e1cc72 | |||
| ab372b0f6b | |||
| 14d09485eb | |||
| 8cd6416754 | |||
| 4fad93824b | |||
| fe70834a6b | |||
| 17b5cc1fa5 | |||
| 04ce4f66ed | |||
| 73dc6b090b | |||
| 742806158c | |||
| 5b24cbde5d | |||
| 3555791e1f | |||
| 56fdc6aaac | |||
| 262bcf5c29 | |||
| 226a49cb42 | |||
| bf3d9b2d02 | |||
| 3d229e1da1 | |||
| df5d58f43d | |||
| 37d22e17a3 | |||
| 999650d368 | |||
| 09bbfbcc31 | |||
| d494048ff6 | |||
| f26b7a4adc | |||
| da81b7a76d | |||
| 93dcd34fa0 | |||
| becd7b5c24 | |||
| d559e9da10 | |||
| 2690d8fed8 | |||
| 7d13475bac | |||
| 2ab280bef0 | |||
| 15af28720a | |||
| 5213e4c7d4 | |||
| 12d7f242b4 | |||
| 0b4484b36b | |||
| 25cbdf5f2c | |||
| 66c1fd9369 | |||
| 7ac597270b | |||
| 05ca4669a9 | |||
| a7cbe2f60e | |||
| 52d79f89a9 | |||
| a8a1c3f809 | |||
| 24bae49401 | |||
| bf239f9691 | |||
| 666513c4ab | |||
| 1b2df18cea | |||
| b1be667884 | |||
| 91ae6a6613 | |||
| 303f056075 | |||
| ec9af74dc9 | |||
| a49e3d6471 | |||
| 9ae585dd81 | |||
| 0d1e63c92a | |||
| 0ee3168241 | |||
| 6033f48b47 | |||
| 3fd40e9449 | |||
| c61c275221 | |||
| 7a6d5d46f4 | |||
| 14a5ff399a | |||
| 31907382c8 | |||
| 5c6492bc0f | |||
| 0968ce0d60 | |||
| 171474f1d2 | |||
| 3383f65ff7 | |||
| 7621bf47c8 | |||
| 72ed770037 | |||
| 4e8a03f7b4 | |||
| 602381ebec | |||
| e098836934 | |||
| d402b25d69 | |||
| af097caa52 | |||
| ce3fc0f2c3 | |||
| 9adfe5b9ff | |||
| b423ad0d80 | |||
| 9a157fa028 | |||
| 7db82a3b14 | |||
| 056725b9bd | |||
| 8bbf099636 | |||
| a884639534 | |||
| 8f67df1f4f | |||
| f851b1a3b4 | |||
| b41bb8e179 | |||
| d9633dfee4 | |||
| 46b19e8e6f | |||
| f0f5c41c30 | |||
| 08c2f73e37 | |||
| 9f4604ec3e | |||
| d1447107d3 | |||
| d774de3a1b | |||
| 8177f7d9bb | |||
| 4ec3fda59d | |||
| e3c8b75259 | |||
| d62a449f9c | |||
| d043c38f71 | |||
| 5b8ad902ce | |||
| ef16522473 | |||
| fe21564659 | |||
| e3173d04d4 | |||
| 92d4468326 | |||
| 0f32f780a9 | |||
| 955514c20f | |||
| ed717add29 | |||
| a7b159fe65 | |||
| 38651258fc | |||
| 4605540955 | |||
| c83bc038f3 | |||
| d8d77d88f2 | |||
| ed813363a5 | |||
| d3dff3760a | |||
| 9e49b2ae0f | |||
| a81212e1b4 | |||
| 57d75572b2 | |||
| d1abe4a332 | |||
| cd11d7d1af | |||
| 5fa8ffd3bc | |||
| 204e52c364 | |||
| d05d388b19 | |||
| a255f9f98b | |||
| 0736ce43bd | |||
| 3d1bb6bd08 | |||
| e9c1681e2c | |||
| 5dbbc5f21c | |||
| ef8b4754ea | |||
| a13694c859 | |||
| 51eaf25ea0 | |||
| 592f9a9cb9 | |||
| 409dc3ad35 | |||
| f8f783fa46 | |||
| 1d1382cb12 | |||
| 68680ac9d8 | |||
| df1d499da6 | |||
| a6a056ad0d | |||
| b1f14e1e29 | |||
| 1999982e6a | |||
| b0ad9524bc | |||
| d8519bc270 | |||
| d5bd773a46 | |||
| da9792160d | |||
| dc308e2ecb | |||
| 984a009fbb | |||
| 5d61cf5bcf | |||
| 2db6464d14 | |||
| c17ac67296 | |||
| 37e87e8cef | |||
| e300f82c28 | |||
| 05cb9d56c2 | |||
| ac0cba64f9 | |||
| 0b3b3fdc88 | |||
| 104a0998ce | |||
| cdf0d5deb0 | |||
| 36300d6df1 | |||
| 3d54a4edcb | |||
| 31de6a63cc | |||
| a8699eb40c | |||
| ae78b00a6b | |||
| 7cf1e6955c | |||
| 729e3b4167 | |||
| b6feb258b1 | |||
| e715f5bfa2 | |||
| 73bd88dc62 | |||
| 40edbc3b64 | |||
| ae81ab8a12 | |||
| 7033d9d919 | |||
| 905e3acab3 | |||
| 2c6e11b464 | |||
| cd4d79c02b | |||
| 9aba993888 | |||
| f614c35f6e | |||
| c3f8e06e42 | |||
| 8f21b01b7e | |||
| 591fa003c6 | |||
| f3e09abf22 | |||
| 18e6e5e5e2 | |||
| 698a814fc3 | |||
| fb820f4fec | |||
| 0d84a73e9f | |||
| b92d6c57a1 | |||
| 8c6fefa33e | |||
| e03a90b05d | |||
| c030e1ce8d | |||
| 7e49a21b3b | |||
| 9e824876ba | |||
| b44e991035 | |||
| e1e907e441 | |||
| 01a04a63c3 | |||
| f7eb15bf53 | |||
| f53bdaeb7e | |||
| 28325467da | |||
| 83b51b04d3 | |||
| 1cafd6831d | |||
| 891fa0411c | |||
| a4fda2a951 | |||
| ffdc933ce0 | |||
| e3f15de1f8 | |||
| 6cef5c6beb | |||
| da08a622f1 | |||
| 50a67c76e7 | |||
| 0a4ccb11aa | |||
| f24770489e | |||
| af4a432745 | |||
| df86e644f4 | |||
| 80ff535215 | |||
| 30157a37a2 | |||
| 124728e0c7 | |||
| 08e72bbbdd | |||
| bf563e9c6a | |||
| b7c5de144a | |||
| f6ca59fbc6 | |||
| 2447c38c82 | |||
| f5827174ee | |||
| 1d19bd11d0 | |||
| 0264c0d60a | |||
| b6d79e5af2 | |||
| 6a2be94282 | |||
| 630ea0d3c6 | |||
| 55e78cd8e9 | |||
| a13e32498a | |||
| 18693998b9 | |||
| 908a7061cf | |||
| 648078d76c | |||
| 06279b18a3 | |||
| f53b95d141 | |||
| e680a0f704 | |||
| 019586abbd | |||
| 8f5ba05e75 | |||
| 427fb08561 | |||
| 343c23cc6c | |||
| ac0332c020 | |||
| c1fbfc0f44 | |||
| d305d67279 | |||
| 3cc7d0db63 | |||
| 1b1d8700ae | |||
| 6994157184 | |||
| bf25c65868 | |||
| 6311d82095 | |||
| 491cabfe8b | |||
| fddb6f67ab | |||
| 26985496d1 | |||
| ab0f883191 | |||
| 538ff873ee | |||
| d0e6bb6e07 | |||
| 6cbb4bcf47 | |||
| d99df2540d | |||
| f5a0b994dc | |||
| 246f770e8f | |||
| 95efc3a66c | |||
| baf9336617 | |||
| 0ab0c5c117 | |||
| 48412087e8 | |||
| 7ce382396b | |||
| c482738d79 | |||
| a4c9fa6a65 | |||
| bb8fc17189 | |||
| b61c7d0b14 | |||
| 0d9af27a03 | |||
| 3e50491619 | |||
| de92c277e0 | |||
| ffbc913b9d | |||
| 286bfa7af6 | |||
| b5e324af83 | |||
| d9e0708331 | |||
| a121675161 | |||
| 0db70218e9 | |||
| c77e65c07d | |||
| bbd2796ea4 | |||
| 5a08e0ffd9 | |||
| c86d4be1ae | |||
| 3dec02881a | |||
| 84367e1f77 | |||
| 04c8fe7d2c | |||
| e8d80a436e | |||
| 3447c86562 | |||
| 71e641c882 | |||
| cb1d0a0bef | |||
| 34ffb5b908 | |||
| e7e379c71b | |||
| b3842ba72a | |||
| a3c16ecdbe | |||
| 72e7465e16 | |||
| 4af996e359 | |||
| f07b5d9032 | |||
| 462dea67e1 | |||
| e23fd269d5 | |||
| 3e38055f20 | |||
| bdf6f6da99 | |||
| d83e8b7d8f | |||
| 1ada60b611 | |||
| 06e2f76c05 | |||
| b1f97712f1 | |||
| 53beefd19b | |||
| cbe53951f8 | |||
| 90443891d6 | |||
| 8d729d4ea0 | |||
| d8da52796b | |||
| 66f253553a | |||
| 7f4ce3faf5 | |||
| a29177de9e | |||
| a15df2ec2c | |||
| 7f7a4b0f2d | |||
| f3e2af7e42 | |||
| 0b8b41d91f | |||
| cbb7090615 | |||
| b9fefc95e8 | |||
| 60406ebcc1 | |||
| a6f5571750 | |||
| fab8765c2f | |||
| 1d1df3bf7a | |||
| aabf7b9b5a | |||
| aa56e8aac4 | |||
| db7f0cc977 | |||
| 95064947b6 | |||
| e29ca88a76 | |||
| 714464481f | |||
| 6abed18eb9 | |||
| 752821f22b | |||
| 409bad8108 | |||
| 97999a63b7 | |||
| fe968f83a3 | |||
| 9545684883 | |||
| 6e0cba566f | |||
| 16fa32e65b | |||
| e3e20a947b | |||
| d1f7448b25 | |||
| d62ceaefcc | |||
| ec548874cc | |||
| 9a225bc396 | |||
| 101002d635 | |||
| 04f4fd652b | |||
| 1cb79c8c1f | |||
| 195bc03645 | |||
| 3438247904 | |||
| 9f01d14c64 | |||
| 7071b27183 | |||
| bfd07b1010 | |||
| 960da66b87 | |||
| 8b5dd58e96 | |||
| decaadfe7d | |||
| e29ec16759 | |||
| 16642b7c4c | |||
| 2188be24e4 | |||
| 70b9ff384c | |||
| 56babc1801 | |||
| 3ba199e052 | |||
| 23120bcde6 | |||
| 44b9c99781 | |||
| 8496bf16ff | |||
| e86fca3aff | |||
| 46cbd147b5 | |||
| 05ed623056 | |||
| c90a436db3 | |||
| 1e865a5246 | |||
| 343c41bb18 | |||
| 4ba0aa8e7f | |||
| a5b19d0c0d | |||
| c263c4ef07 | |||
| 7b5ea9e99c | |||
| 013f7cfd21 | |||
| 7a3147a3b3 | |||
| 379ef7eed3 | |||
| a76149c8e3 | |||
| 329c9c8d98 | |||
| 4fa8c89e5c | |||
| f2be05f47f | |||
| 19b6a96063 | |||
| 6079b34a2a | |||
| 95d4e95400 | |||
| 5cad3f62d0 | |||
| 751e61d6e5 | |||
| 4cb7d9a352 | |||
| b04844aa94 | |||
| b15ada974f | |||
| e2587b78f5 | |||
| 06dfba3c81 | |||
| 8aa942cd27 | |||
| a9070b1327 | |||
| 745510ea75 | |||
| f6d721dd72 | |||
| 0503e85fd3 | |||
| 0232f4f672 | |||
| 56d355935b | |||
| d260bb5cd4 | |||
| 4816c1fc9a | |||
| 50469b858b | |||
| 64998a398d | |||
| 9a3af63f65 | |||
| 5679f45f5b | |||
| 66c0da85e6 | |||
| 4246e4f79b | |||
| 90dc7a4e38 | |||
| bf28354301 | |||
| 5f1141dfb1 | |||
| 5b03fba463 | |||
| 0efd0c5f73 | |||
| 2947e3f39f | |||
| 77974c83d7 | |||
| d0bb3047f0 | |||
| 739b1bfaa3 | |||
| fb308eaa01 | |||
| 7c40bcff53 | |||
| ec87656d58 | |||
| 159ba9f487 | |||
| d8fe5124ff | |||
| fa337d441e | |||
| ea1ae1a0a4 | |||
| 95ea61114a | |||
| 585e5830f7 | |||
| bfb77803d8 | |||
| 364ab42c49 | |||
| 89183cf8b7 | |||
| aaa116d97c | |||
| 4360021fc9 | |||
| b7b233d46f | |||
| 5c43f2d80e | |||
| ed9b6db369 | |||
| dd0d15e134 | |||
| 29d6817019 | |||
| 46bb559af1 | |||
| 031a37baa1 | |||
| 62a4ce76b6 | |||
| d85e6ae495 | |||
| 32c4c360bd | |||
| f2a075d432 | |||
| 2dee62c850 | |||
| db380944ac | |||
| 28c5b32624 | |||
| 6db350790e | |||
| 3f8ff1373c | |||
| d6ee505c63 | |||
| e84b2ba224 | |||
| 4de9b2c53e | |||
| 385823461b | |||
| 85c28185a2 | |||
| 25de25a777 | |||
| 357a92dfee | |||
| 35c83db432 | |||
| f7cc1053f1 | |||
| d5864aea3e | |||
| 2b2d6e1ef5 | |||
| f99523dc48 | |||
| 69913c0897 | |||
| 75694e8797 | |||
| 24856b6a2d | |||
| a70291f20f | |||
| 6e1a5eac94 | |||
| 37b87e98f4 | |||
| 55d2e9b842 | |||
| 3afc5d0890 | |||
| f6b6fcc2c5 | |||
| 5039aa07a5 | |||
| 8048239a81 | |||
| ecdc0f7096 | |||
| 2c3107fbe9 | |||
| c2b31bd6e2 | |||
| a8ba563632 | |||
| 4065df7930 | |||
| 0b06044dce | |||
| 93464e3963 | |||
| 8dd18a43a0 | |||
| afe42ccdaf | |||
| f5a7117bdf | |||
| 696c02c0f0 | |||
| 6daf207323 | |||
| f67cd057f3 | |||
| 0789d10d3e | |||
| a07149919d | |||
| f9f3a8f3bd | |||
| 1def512b4c | |||
| b85d5a6d98 | |||
| 94fabc87f0 | |||
| d3afde1aa1 | |||
| 5a0d2b527b | |||
| 3d64878e60 | |||
| 26772b721c | |||
| 3c95545ea3 | |||
| ae5689ffb4 | |||
| e894e96404 | |||
| ed5715ccd9 | |||
| 7f9af238f8 | |||
| fd1e425abc | |||
| 35c1eccbe1 | |||
| 69f06f736c | |||
| 48fb483de6 | |||
| 8ce2921e3d | |||
| f06a9b3dce | |||
| 3efc925264 | |||
| a8db4532d0 | |||
| ab35f8b842 | |||
| ef3cf099b8 | |||
| 00cfe2d25f | |||
| 7a4c9b36a8 | |||
| 488c4941d2 | |||
| 97dc0a84dd | |||
| f01c890966 | |||
| 50de63117d | |||
| 4e4d82857c | |||
| 039e0fbb83 | |||
| e1a02455d8 | |||
| c1c9ec2790 | |||
| e90e141a79 | |||
| 38d3f9b7c0 | |||
| 7d62b208ca | |||
| 27f6826fd3 | |||
| 051f9ffab9 | |||
| bdb083eac7 | |||
| 4b93ef0a98 | |||
| e86d11250b | |||
| e5746c3b2e | |||
| 6a7ea65dd0 | |||
| 68df09a570 | |||
| d53d569020 | |||
| 1d12f92934 | |||
| e89fa01d89 | |||
| 4c49397ef6 | |||
| 8dc8e53218 | |||
| d0fbbed20d | |||
| 33407ee0da | |||
| c81a5e0783 | |||
| 66fec40169 | |||
| 60f2d14caa | |||
| 538d6a2a33 | |||
| f26dce39c3 | |||
| acb5bb3e3e | |||
| 16125c38af | |||
| 69db67efe5 | |||
| 37ecc69088 | |||
| d68a3b191e | |||
| 64cf613189 | |||
| f3da7773d3 | |||
| 7c9bd80c1e | |||
| 2bae779a9b | |||
| e862994716 | |||
| f612f8be42 | |||
| ef2c17748e | |||
| 4c4b0aba0c | |||
| 4decdb3e4d | |||
| 6b3078d0f7 | |||
| 3a4b341ad6 | |||
| 2a2ce6da5d | |||
| 239c478f31 | |||
| f6c62af82e | |||
| 84db0ec2c5 | |||
| 345f3d6301 | |||
| de5170c5cb | |||
| 7674b3a077 | |||
| 11e017ccb9 | |||
| bda4fcfb26 | |||
| a7fd9312d0 | |||
| 3963897fe4 | |||
| f42b0351fd | |||
| 37cb9f00f6 | |||
| 343b781e74 | |||
| f428a8a56a | |||
| cd9a7f1d5d | |||
| 83548ee405 | |||
| 5f588934a9 | |||
| 1f5dcb6965 | |||
| 5f111f159b | |||
| 527ee56fb2 | |||
| 8396f19e85 | |||
| aadc4b5e6b | |||
| ccb5427b45 | |||
| 8983f3c5dc | |||
| 9349d5d473 | |||
| ae6ceddab7 | |||
| 84c90715be | |||
| aeff31ba7a | |||
| f431e820ef | |||
| c41521c310 | |||
| f437232db1 | |||
| 3ed43d50f2 | |||
| 7cd613e5f2 | |||
| 921136c987 | |||
| d4df2e7351 | |||
| 9cf553232d | |||
| 6cb2fdd737 | |||
| bbf4d19de3 | |||
| 02cedce54e | |||
| 871fcd1fc8 | |||
| 7457d832f8 | |||
| a9ff407657 | |||
| 1ba7f0cd65 | |||
| 56fcabc119 | |||
| 402353affa | |||
| bc196f2e50 | |||
| 148eaf7048 | |||
| b44da7c13a | |||
| 4b57f69cba | |||
| 542d454fe0 | |||
| 3d61df253d | |||
| dcd276a5ce | |||
| bacaf6453e | |||
| 860ee81a38 | |||
| bcec9501b7 | |||
| 37b46d1289 | |||
| 54de212214 | |||
| a64343689c | |||
| 3e0af2928b | |||
| a5d79b25db | |||
| cb8843926c | |||
| 59ec184208 | |||
| 9a010a90a9 | |||
| 3d6fe8acba | |||
| 02ec76d2aa | |||
| 8615df0a03 | |||
| 951f3239f1 | |||
| fe630bf7ca | |||
| 1a2537f5d8 | |||
| 7b04b9ef4a | |||
| 30b516e7bd | |||
| c72749790d | |||
| 05780a9316 | |||
| 3889da7301 | |||
| 57ebfd2675 | |||
| b10187f9de | |||
| af99db7287 | |||
| 306ecf003a | |||
| 2b2ebc75b0 | |||
| 83bb10b32b | |||
| d9bdcf2aec | |||
| 3e25a3df5c | |||
| 73e91be281 | |||
| 471d7ec42d | |||
| 1b6974ade3 | |||
| c1a6a23e06 | |||
| 9ec299247c | |||
| 79549ba330 | |||
| 4b15121f70 | |||
| c29219f214 | |||
| 51d8f00418 | |||
| e843f66135 | |||
| 542dc16752 | |||
| 62888170b0 | |||
| ca0b26f89f | |||
| cd8cd90a38 | |||
| ae3c98c692 | |||
| 767dfaef70 | |||
| c07fe35908 | |||
| ea8f81feec | |||
| a38417bf54 | |||
| 0f54984966 | |||
| 6c1af93f58 | |||
| 16895910e4 | |||
| b155a603aa | |||
| ecc9e41ab2 | |||
| 2a74d04635 | |||
| a089820464 | |||
| 579efe83af | |||
| a37a811014 | |||
| 0ecc702612 | |||
| a144ecd21b | |||
| 772fa200ac | |||
| fa10b3b183 | |||
| fac51f2007 |
@@ -33,5 +33,10 @@ Build_32/
|
|||||||
build_32/
|
build_32/
|
||||||
Build_64/
|
Build_64/
|
||||||
build_64/
|
build_64/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
log/
|
log/
|
||||||
logs/
|
logs/
|
||||||
|
vcpkg/
|
||||||
|
|
||||||
|
.idea/*
|
||||||
+23
-20
@@ -1,24 +1,27 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
sudo: false
|
dist: trusty
|
||||||
addons:
|
|
||||||
apt:
|
before_install:
|
||||||
packages:
|
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
- libmysqlclient-dev
|
- sudo apt-get update -qq
|
||||||
- libperl-dev
|
- mkdir $HOME/usr
|
||||||
- libboost-dev
|
- export PATH="$HOME/usr/bin:$PATH"
|
||||||
- liblua5.1-0-dev
|
- wget https://cmake.org/files/v3.11/cmake-3.11.2-Linux-x86_64.sh
|
||||||
- zlib1g-dev
|
- chmod +x cmake-3.11.2-Linux-x86_64.sh
|
||||||
|
- ./cmake-3.11.2-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir --skip-license
|
||||||
|
|
||||||
|
install:
|
||||||
|
- sudo apt-get install -qq g++-7
|
||||||
|
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
|
||||||
|
- sudo apt-get install libmysqlclient-dev
|
||||||
|
- sudo apt-get install libperl-dev
|
||||||
|
- sudo apt-get install libboost-dev
|
||||||
|
- sudo apt-get install liblua5.1-0-dev
|
||||||
|
- sudo apt-get install zlib1g-dev
|
||||||
|
- sudo apt-get install uuid-dev
|
||||||
|
- sudo apt-get install libssl-dev
|
||||||
script:
|
script:
|
||||||
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON
|
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON
|
||||||
- make -j8
|
- make -j2
|
||||||
- ./bin/tests
|
- ./bin/tests
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- stable
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
irc:
|
|
||||||
channels: "irc.eqemulator.net#eqemucoders"
|
|
||||||
os: linux
|
|
||||||
+51
-63
@@ -13,12 +13,6 @@
|
|||||||
#EQEMU_LOG_LEVEL_QUEST
|
#EQEMU_LOG_LEVEL_QUEST
|
||||||
#EQEMU_LOG_LEVEL_COMMANDS
|
#EQEMU_LOG_LEVEL_COMMANDS
|
||||||
#EQEMU_LOG_LEVEL_CRASH
|
#EQEMU_LOG_LEVEL_CRASH
|
||||||
#EQEMU_STREAM_SEND_RATE
|
|
||||||
#EQEMU_STREAM_DECAY_RATE
|
|
||||||
#EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL
|
|
||||||
#EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX
|
|
||||||
#EQEMU_STREAM_AVERAGE_DELTA_MAX
|
|
||||||
#EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS
|
|
||||||
#EQEMU_DEPOP_INVALIDATES_CACHE
|
#EQEMU_DEPOP_INVALIDATES_CACHE
|
||||||
#EQEMU_ENABLE_BOTS
|
#EQEMU_ENABLE_BOTS
|
||||||
#EQEMU_DISABLE_LOGSYS
|
#EQEMU_DISABLE_LOGSYS
|
||||||
@@ -30,10 +24,9 @@
|
|||||||
#EQEMU_BUILD_LUA
|
#EQEMU_BUILD_LUA
|
||||||
#EQEMU_SANITIZE_LUA_LIBS
|
#EQEMU_SANITIZE_LUA_LIBS
|
||||||
#EQEMU_BUILD_CLIENT_FILES
|
#EQEMU_BUILD_CLIENT_FILES
|
||||||
|
#EQEMU_USE_MAP_MMFS
|
||||||
#EQEMU_MAP_DIR
|
#EQEMU_MAP_DIR
|
||||||
|
|
||||||
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
|
|
||||||
#Can change this if you really want but you should upgrade!
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
|
||||||
#FindMySQL is located here so lets make it so CMake can find it
|
#FindMySQL is located here so lets make it so CMake can find it
|
||||||
@@ -47,6 +40,8 @@ IF(NOT CMAKE_BUILD_TYPE)
|
|||||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
SET(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dependencies" "${CMAKE_PREFIX_PATH}")
|
||||||
|
|
||||||
#Add our various windows definitions
|
#Add our various windows definitions
|
||||||
IF(MSVC OR MINGW)
|
IF(MSVC OR MINGW)
|
||||||
ADD_DEFINITIONS(-D_WINDOWS)
|
ADD_DEFINITIONS(-D_WINDOWS)
|
||||||
@@ -58,17 +53,6 @@ IF(MSVC OR MINGW)
|
|||||||
ENDIF(MSVC OR MINGW)
|
ENDIF(MSVC OR MINGW)
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
#Set our default locations for zlib/mysql based on x86/x64
|
|
||||||
IF(CMAKE_CL_64)
|
|
||||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
|
|
||||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
|
|
||||||
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64")
|
|
||||||
ELSE(CMAKE_CL_64)
|
|
||||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
|
|
||||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
|
|
||||||
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x86")
|
|
||||||
ENDIF(CMAKE_CL_64)
|
|
||||||
|
|
||||||
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
|
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
|
||||||
OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON)
|
OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON)
|
||||||
IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
|
IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
|
||||||
@@ -87,23 +71,6 @@ IF(MSVC)
|
|||||||
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
||||||
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
|
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
|
||||||
|
|
||||||
#Disable safe SEH or not?
|
|
||||||
OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF)
|
|
||||||
IF(EQEMU_DISABLE_SAFESEH)
|
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
|
||||||
ENDIF(EQEMU_DISABLE_SAFESEH)
|
|
||||||
|
|
||||||
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
|
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
|
||||||
IF(EQEMU_BUILD_MSVC_MP)
|
IF(EQEMU_BUILD_MSVC_MP)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
@@ -218,14 +185,6 @@ SET(EQEMU_LOG_LEVEL_CRASH 3 CACHE STRING "EQEmu logging level for [Crash]:
|
|||||||
|
|
||||||
MARK_AS_ADVANCED(EQEMU_LOG_LEVEL_STATUS EQEMU_LOG_LEVEL_NORMAL EQEMU_LOG_LEVEL_ERROR EQEMU_LOG_LEVEL_DEBUG EQEMU_LOG_LEVEL_QUEST EQEMU_LOG_LEVEL_COMMANDS EQEMU_LOG_LEVEL_CRASH)
|
MARK_AS_ADVANCED(EQEMU_LOG_LEVEL_STATUS EQEMU_LOG_LEVEL_NORMAL EQEMU_LOG_LEVEL_ERROR EQEMU_LOG_LEVEL_DEBUG EQEMU_LOG_LEVEL_QUEST EQEMU_LOG_LEVEL_COMMANDS EQEMU_LOG_LEVEL_CRASH)
|
||||||
|
|
||||||
SET(EQEMU_STREAM_SEND_RATE 1048576 CACHE STRING "Advanced: Base amount of data stream can send before throttle.")
|
|
||||||
SET(EQEMU_STREAM_DECAY_RATE 78642 CACHE STRING "Advanced: Base amount of data stream recovers per tic.")
|
|
||||||
SET(EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL 3.0 CACHE STRING "Advanced: Multiplier on retransmit timeout.")
|
|
||||||
SET(EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX 5000 CACHE STRING "Advanced: Max in ms for retransmit timeout timer.")
|
|
||||||
SET(EQEMU_STREAM_AVERAGE_DELTA_MAX 2500 CACHE STRING "Advanced: The maximum average delta in ms allowed.")
|
|
||||||
SET(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS TRUE CACHE BOOL "Advanced: Whether or not acked packets can be retransmitted")
|
|
||||||
MARK_AS_ADVANCED(EQEMU_STREAM_SEND_RATE EQEMU_STREAM_DECAY_RATE EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX EQEMU_STREAM_AVERAGE_DELTA_MAX EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
|
||||||
|
|
||||||
#NPC Types Cache Behavior
|
#NPC Types Cache Behavior
|
||||||
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
|
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
|
||||||
|
|
||||||
@@ -253,6 +212,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
|
|||||||
#What to build
|
#What to build
|
||||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||||
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
|
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
|
||||||
|
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
|
||||||
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||||
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||||
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||||
@@ -275,17 +235,17 @@ IF(EQEMU_BUILD_LUA)
|
|||||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||||
ENDIF(EQEMU_BUILD_LUA)
|
ENDIF(EQEMU_BUILD_LUA)
|
||||||
|
|
||||||
|
OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
|
||||||
|
IF(EQEMU_USE_MAP_MMFS)
|
||||||
|
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
||||||
|
ENDIF(EQEMU_USE_MAP_MMFS)
|
||||||
|
|
||||||
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
|
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
|
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
|
||||||
ADD_DEFINITIONS(-DINVERSEXY)
|
ADD_DEFINITIONS(-DINVERSEXY)
|
||||||
ADD_DEFINITIONS(-DFIELD_ITEMS)
|
ADD_DEFINITIONS(-DFIELD_ITEMS)
|
||||||
ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}")
|
ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}")
|
||||||
ADD_DEFINITIONS(-DRATEBASE=${EQEMU_STREAM_SEND_RATE})
|
|
||||||
ADD_DEFINITIONS(-DDECAYBASE=${EQEMU_STREAM_DECAY_RATE})
|
|
||||||
ADD_DEFINITIONS(-DRETRANSMIT_TIMEOUT_MULT=${EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL})
|
|
||||||
ADD_DEFINITIONS(-DRETRANSMIT_TIMEOUT_MAX=${EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX})
|
|
||||||
ADD_DEFINITIONS(-DAVERAGE_DELTA_MAX=${EQEMU_STREAM_AVERAGE_DELTA_MAX})
|
|
||||||
ADD_DEFINITIONS(-DLOG_LEVEL_STATUS=${EQEMU_LOG_LEVEL_STATUS})
|
ADD_DEFINITIONS(-DLOG_LEVEL_STATUS=${EQEMU_LOG_LEVEL_STATUS})
|
||||||
ADD_DEFINITIONS(-DLOG_LEVEL_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
|
ADD_DEFINITIONS(-DLOG_LEVEL_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
|
||||||
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
|
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
|
||||||
@@ -295,12 +255,6 @@ ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
|
|||||||
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
|
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
|
||||||
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
||||||
|
|
||||||
IF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
|
||||||
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=true)
|
|
||||||
ELSE(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
|
||||||
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=false)
|
|
||||||
ENDIF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
|
||||||
|
|
||||||
#Find everything we need
|
#Find everything we need
|
||||||
FIND_PACKAGE(ZLIB REQUIRED)
|
FIND_PACKAGE(ZLIB REQUIRED)
|
||||||
FIND_PACKAGE(MySQL REQUIRED)
|
FIND_PACKAGE(MySQL REQUIRED)
|
||||||
@@ -309,6 +263,30 @@ IF(EQEMU_BUILD_PERL)
|
|||||||
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
|
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
|
||||||
ENDIF(EQEMU_BUILD_PERL)
|
ENDIF(EQEMU_BUILD_PERL)
|
||||||
|
|
||||||
|
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt recast_navigation)
|
||||||
|
|
||||||
|
FIND_PACKAGE(Sodium REQUIRED)
|
||||||
|
IF(SODIUM_FOUND)
|
||||||
|
OPTION(EQEMU_ENABLE_SECURITY "Use Encryption For TCP Connections" ON)
|
||||||
|
IF(EQEMU_ENABLE_SECURITY)
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_INCLUDE_DIRS}")
|
||||||
|
ADD_DEFINITIONS(-DENABLE_SECURITY)
|
||||||
|
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARIES})
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(UNIX)
|
||||||
|
SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread")
|
||||||
|
IF(NOT DARWIN)
|
||||||
|
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
|
||||||
|
ENDIF()
|
||||||
|
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(EQEMU_BUILD_LUA)
|
IF(EQEMU_BUILD_LUA)
|
||||||
FIND_PACKAGE(EQLua51 REQUIRED)
|
FIND_PACKAGE(EQLua51 REQUIRED)
|
||||||
SET(Boost_USE_STATIC_LIBS OFF)
|
SET(Boost_USE_STATIC_LIBS OFF)
|
||||||
@@ -317,7 +295,8 @@ IF(EQEMU_BUILD_LUA)
|
|||||||
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
|
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
|
||||||
|
|
||||||
FIND_PACKAGE(Boost REQUIRED)
|
FIND_PACKAGE(Boost REQUIRED)
|
||||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind")
|
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||||
|
|
||||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||||
IF(EQEMU_SANITIZE_LUA_LIBS)
|
IF(EQEMU_SANITIZE_LUA_LIBS)
|
||||||
@@ -325,15 +304,20 @@ IF(EQEMU_BUILD_LUA)
|
|||||||
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
||||||
ENDIF(EQEMU_BUILD_LUA)
|
ENDIF(EQEMU_BUILD_LUA)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
|
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/cereal")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/include" )
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/src")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/format")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/detour/include")
|
||||||
|
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/recast/include")
|
||||||
|
|
||||||
IF(EQEMU_BUILD_LUA)
|
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||||
ADD_SUBDIRECTORY(luabind)
|
|
||||||
ENDIF(EQEMU_BUILD_LUA)
|
|
||||||
|
|
||||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
|
||||||
ADD_SUBDIRECTORY(common)
|
ADD_SUBDIRECTORY(common)
|
||||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
ADD_SUBDIRECTORY(libs)
|
||||||
|
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||||
IF(EQEMU_BUILD_SERVER)
|
IF(EQEMU_BUILD_SERVER)
|
||||||
ADD_SUBDIRECTORY(shared_memory)
|
ADD_SUBDIRECTORY(shared_memory)
|
||||||
ADD_SUBDIRECTORY(world)
|
ADD_SUBDIRECTORY(world)
|
||||||
@@ -346,6 +330,10 @@ IF(EQEMU_BUILD_LOGIN)
|
|||||||
ADD_SUBDIRECTORY(loginserver)
|
ADD_SUBDIRECTORY(loginserver)
|
||||||
ENDIF(EQEMU_BUILD_LOGIN)
|
ENDIF(EQEMU_BUILD_LOGIN)
|
||||||
|
|
||||||
|
IF(EQEMU_BUILD_HC)
|
||||||
|
ADD_SUBDIRECTORY(hc)
|
||||||
|
ENDIF(EQEMU_BUILD_HC)
|
||||||
|
|
||||||
IF(EQEMU_BUILD_TESTS)
|
IF(EQEMU_BUILD_TESTS)
|
||||||
ADD_SUBDIRECTORY(tests)
|
ADD_SUBDIRECTORY(tests)
|
||||||
ENDIF(EQEMU_BUILD_TESTS)
|
ENDIF(EQEMU_BUILD_TESTS)
|
||||||
|
|||||||
@@ -1,339 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Lesser General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License.
|
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
The server code and utilities are released under GPLv3.
|
|
||||||
|
|
||||||
We also include some small libraries for convienence that may be under different licensing:
|
|
||||||
|
|
||||||
SocketLib - GPL
|
|
||||||
LibXML - ZLib License
|
|
||||||
StackWalker - New BSD License
|
|
||||||
ZLib - ZLib License
|
|
||||||
MySQL - GPL
|
|
||||||
Perl - GPL / ActiveState (under the assumption that this is a free project).
|
|
||||||
CPPUnit - GLP
|
|
||||||
StringUtilities - Apache
|
|
||||||
@@ -1,53 +1,72 @@
|
|||||||
EQEmu
|
# EQEmulator Core Server
|
||||||
===
|
|Travis CI (Linux)|Appveyor w/ Bots (Windows) |Appveyor w/o Bots (Windows) |
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server-87crp/branch/master) |[](https://ci.appveyor.com/project/KimLS/server-w0pq2/branch/master) |
|
||||||
|
|
||||||
[](https://travis-ci.org/EQEmu/Server)
|
***
|
||||||
|
|
||||||
Overview
|
**EQEmulator is a custom completely from-scratch open source server implementation for EverQuest built mostly on C++**
|
||||||
---
|
* MySQL/MariaDB is used as the database engine (over 200+ tables)
|
||||||
|
* Perl and LUA are both supported scripting languages for NPC/Player/Quest oriented events
|
||||||
|
* Open source database (Project EQ) has content up to expansion OoW (included in server installs)
|
||||||
|
* Game server environments and databases can be heavily customized to create all new experiences
|
||||||
|
* Hundreds of Quests/events created and maintained by Project EQ
|
||||||
|
|
||||||
EQEmu is a custom server implementation for EverQuest
|
## Server Installs
|
||||||
|
| |Windows|Linux|
|
||||||
|
|:---:|:---:|:---:|
|
||||||
|
|**Install Count**|||
|
||||||
|
### > Windows
|
||||||
|
* [Install](https://github.com/EQEmu/Server/wiki/Windows-Server)
|
||||||
|
|
||||||
Dependencies
|
### > Debian/Ubuntu/CentOS/Fedora
|
||||||
---
|
* You can use curl or wget to kick off the installer (whichever your OS has)
|
||||||
|
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
||||||
|
|
||||||
For Windows: http://eqemu.github.io
|
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
|
||||||
|
|
||||||
Login Server dependencies for Windows/Linux/OSX: http://eqemu.github.io
|
## Supported Clients
|
||||||
|
|
||||||
For Debian based distros (adjust to your local flavor):
|
|Titanium Edition|Secrets of Faydwer|Seeds of Destruction|Underfoot|Rain of Fear|
|
||||||
|
|:---:|:---:|:---:|:---:|:---:|
|
||||||
|
|<img src="http://i.imgur.com/hrwDxoM.jpg" height="150">|<img src="http://i.imgur.com/cRDW5tn.png" height="150">|<img src="http://i.imgur.com/V48kuVn.jpg" height="150">|<img src="http://i.imgur.com/IJQ0XMa.jpg" height="150">|<img src="http://i.imgur.com/OMpHkKa.png" height="100">|
|
||||||
|
|
||||||
- libmysqlclient-dev
|
## Bug Reports <img src="http://i.imgur.com/daf1Vjw.png" height="20">
|
||||||
- libperl-dev
|
* Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
||||||
- liblua5.1-0-dev (5.2 should work as well)
|
|
||||||
- libboost-dev
|
|
||||||
|
|
||||||
Further instructions on building the source can be found on the
|
|
||||||
[wiki](http://wiki.eqemulator.org/i?M=Wiki).
|
|
||||||
|
|
||||||
Bug reports
|
|
||||||
---
|
|
||||||
|
|
||||||
Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
|
||||||
reports or feature requests.
|
reports or feature requests.
|
||||||
|
* The [EQEmu Forums](http://www.eqemulator.org/forums/) are also a place to submit and get help with bugs.
|
||||||
|
|
||||||
The [EQEmu Forums](http://www.eqemulator.org/forums/) also have forums to submit
|
## Contributions <img src="http://image.flaticon.com/icons/png/512/25/25231.png" width="20">
|
||||||
bugs/get help with bugs.
|
|
||||||
|
|
||||||
Contributions
|
* The preferred way to contribute is to fork the repo and submit a pull request on
|
||||||
---
|
|
||||||
|
|
||||||
The preferred way to contribute is to fork the repo and submit a pull request on
|
|
||||||
GitHub. If you need help with your changes, you can always post on the forums or
|
GitHub. If you need help with your changes, you can always post on the forums or
|
||||||
try IRC. You can also post unified diffs (`git diff` should do the trick) on the
|
try Discord. You can also post unified diffs (`git diff` should do the trick) on the
|
||||||
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
|
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
|
||||||
forum, although pull requests will be much quicker and easier on all parties.
|
forum, although pull requests will be much quicker and easier on all parties.
|
||||||
|
|
||||||
Contact
|
## Contact <img src="http://gamerescape.com/wp-content/uploads/2015/06/discord.png" height="20">
|
||||||
---
|
|
||||||
- **User IRC Channel**: `#eqemu` on `irc.eqemulator.net`
|
|
||||||
- **Developer IRC Channel**: `#eqemucoders` on `irc.eqemulator.net`
|
|
||||||
|
|
||||||
|
- Discord Channel: https://discord.gg/QHsm7CD
|
||||||
|
- **User Discord Channel**: `#general`
|
||||||
|
- **Developer Discord Channel**: `#eqemucoders`
|
||||||
|
|
||||||
|
## Resources
|
||||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||||
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
|
- [EQEmulator Wiki](https://github.com/EQEmu/Server/wiki)
|
||||||
|
|
||||||
|
## Related Repositories
|
||||||
|
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
|
||||||
|
* [Maps](https://github.com/Akkadius/EQEmuMaps)
|
||||||
|
* [Installer Resources](https://github.com/Akkadius/EQEmuInstall)
|
||||||
|
* [Zone Utilities](https://github.com/EQEmu/zone-utilities) - Various utilities and libraries for parsing, rendering and manipulating EQ Zone files.
|
||||||
|
|
||||||
|
## Other License Info
|
||||||
|
|
||||||
|
* The server code and utilities are released under **GPLv3**
|
||||||
|
* We also include some small libraries for convienence that may be under different licensing
|
||||||
|
* SocketLib - GPL LibXML
|
||||||
|
* zlib - zlib license
|
||||||
|
* MariaDB/MySQL - GPL
|
||||||
|
* GPL Perl - GPL / ActiveState (under the assumption that this is a free project)
|
||||||
|
* CPPUnit - GLP StringUtilities - Apache
|
||||||
|
* LUA - MIT
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
version: 1.0.{build}
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
image: Visual Studio 2017
|
||||||
|
configuration: RelWithDebInfo
|
||||||
|
clone_folder: c:\projects\eqemu
|
||||||
|
init:
|
||||||
|
- ps: git config --global core.autocrlf input
|
||||||
|
before_build:
|
||||||
|
- ps: >-
|
||||||
|
$wc = New-Object System.Net.WebClient
|
||||||
|
|
||||||
|
$wc.DownloadFile("https://github.com/EQEmu/eqemu.github.com/blob/master/downloads/appveyor/vcpkg-export.7z?raw=true", "c:\projects\eqemu\vcpkg-export.7z")
|
||||||
|
|
||||||
|
$wc.DownloadFile("http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip", "c:\projects\eqemu\strawberry-perl-5.26.2.1-64bit-portable.zip")
|
||||||
|
|
||||||
|
cd c:\projects\eqemu
|
||||||
|
|
||||||
|
7z x c:/projects/eqemu/vcpkg-export.7z -oc:/projects/eqemu/vcpkg -y
|
||||||
|
|
||||||
|
7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y
|
||||||
|
|
||||||
|
(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
|
||||||
|
cd build
|
||||||
|
|
||||||
|
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=ON -DPERL_EXECUTABLE="C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe" -DPERL_INCLUDE_PATH="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE" -DPERL_LIBRARY="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a" -DCMAKE_TOOLCHAIN_FILE="C:/projects/eqemu/vcpkg/vcpkg-export-20180627-133249/scripts/buildsystems/vcpkg.cmake" ..
|
||||||
|
build:
|
||||||
|
project: C:\projects\eqemu\build\EQEmu.sln
|
||||||
|
parallel: true
|
||||||
|
verbosity: minimal
|
||||||
|
after_build:
|
||||||
|
- cmd: >-
|
||||||
|
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||||
|
|
||||||
|
appveyor PushArtifact build_x64-bots.zip
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
version: 1.0.{build}
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
image: Visual Studio 2017
|
||||||
|
configuration: RelWithDebInfo
|
||||||
|
clone_folder: c:\projects\eqemu
|
||||||
|
init:
|
||||||
|
- ps: git config --global core.autocrlf input
|
||||||
|
before_build:
|
||||||
|
- ps: >-
|
||||||
|
$wc = New-Object System.Net.WebClient
|
||||||
|
|
||||||
|
$wc.DownloadFile("https://github.com/EQEmu/eqemu.github.com/blob/master/downloads/appveyor/vcpkg-export.7z?raw=true", "c:\projects\eqemu\vcpkg-export.7z")
|
||||||
|
|
||||||
|
$wc.DownloadFile("http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip", "c:\projects\eqemu\strawberry-perl-5.26.2.1-64bit-portable.zip")
|
||||||
|
|
||||||
|
cd c:\projects\eqemu
|
||||||
|
|
||||||
|
7z x c:/projects/eqemu/vcpkg-export.7z -oc:/projects/eqemu/vcpkg -y
|
||||||
|
|
||||||
|
7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y
|
||||||
|
|
||||||
|
(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
|
||||||
|
cd build
|
||||||
|
|
||||||
|
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=OFF -DPERL_EXECUTABLE="C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe" -DPERL_INCLUDE_PATH="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE" -DPERL_LIBRARY="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a" -DCMAKE_TOOLCHAIN_FILE="C:/projects/eqemu/vcpkg/vcpkg-export-20180627-133249/scripts/buildsystems/vcpkg.cmake" ..
|
||||||
|
build:
|
||||||
|
project: C:\projects\eqemu\build\EQEmu.sln
|
||||||
|
parallel: true
|
||||||
|
verbosity: minimal
|
||||||
|
after_build:
|
||||||
|
- cmd: >-
|
||||||
|
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||||
|
|
||||||
|
appveyor PushArtifact build_x64-no-bots.zip
|
||||||
+699
-134
File diff suppressed because it is too large
Load Diff
@@ -9,28 +9,8 @@ SET(export_headers
|
|||||||
|
|
||||||
ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||||
|
|
||||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
TARGET_LINK_LIBRARIES(export_client_files ${SERVER_LIBS})
|
||||||
|
|
||||||
IF(MSVC)
|
|
||||||
SET_TARGET_PROPERTIES(export_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "Ws2_32.lib")
|
|
||||||
ENDIF(MSVC)
|
|
||||||
|
|
||||||
IF(MINGW)
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "WS2_32")
|
|
||||||
ENDIF(MINGW)
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "${CMAKE_DL_LIBS}")
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "z")
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "m")
|
|
||||||
IF(NOT DARWIN)
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "rt")
|
|
||||||
ENDIF(NOT DARWIN)
|
|
||||||
TARGET_LINK_LIBRARIES(export_client_files "pthread")
|
|
||||||
ADD_DEFINITIONS(-fPIC)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "../../common/rulesys.h"
|
#include "../../common/rulesys.h"
|
||||||
#include "../../common/string_util.h"
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys LogSys;
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase *db);
|
void ExportSpells(SharedDatabase *db);
|
||||||
void ExportSkillCaps(SharedDatabase *db);
|
void ExportSkillCaps(SharedDatabase *db);
|
||||||
@@ -36,46 +36,46 @@ void ExportDBStrings(SharedDatabase *db);
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||||
Log.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Status, "Client Files Export Utility");
|
Log(Logs::General, Logs::Status, "Client Files Export Utility");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Config = EQEmuConfig::get();
|
auto Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register Log System and Settings */
|
/* Register Log System and Settings */
|
||||||
database.LoadLogSettings(Log.log_settings);
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
Log.StartFileLogs();
|
LogSys.StartFileLogs();
|
||||||
|
|
||||||
ExportSpells(&database);
|
ExportSpells(&database);
|
||||||
ExportSkillCaps(&database);
|
ExportSkillCaps(&database);
|
||||||
ExportBaseData(&database);
|
ExportBaseData(&database);
|
||||||
ExportDBStrings(&database);
|
ExportDBStrings(&database);
|
||||||
|
|
||||||
Log.CloseFileLogs();
|
LogSys.CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase *db) {
|
void ExportSpells(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Exporting Spells...");
|
Log(Logs::General, Logs::Status, "Exporting Spells...");
|
||||||
|
|
||||||
FILE *f = fopen("export/spells_us.txt", "w");
|
FILE *f = fopen("export/spells_us.txt", "w");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,11 +142,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExportSkillCaps(SharedDatabase *db) {
|
void ExportSkillCaps(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
Log(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
||||||
|
|
||||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,11 +171,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExportBaseData(SharedDatabase *db) {
|
void ExportBaseData(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Exporting Base Data...");
|
Log(Logs::General, Logs::Status, "Exporting Base Data...");
|
||||||
|
|
||||||
FILE *f = fopen("export/BaseData.txt", "w");
|
FILE *f = fopen("export/BaseData.txt", "w");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,11 +202,11 @@ void ExportBaseData(SharedDatabase *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExportDBStrings(SharedDatabase *db) {
|
void ExportDBStrings(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Exporting DB Strings...");
|
Log(Logs::General, Logs::Status, "Exporting DB Strings...");
|
||||||
|
|
||||||
FILE *f = fopen("export/dbstr_us.txt", "w");
|
FILE *f = fopen("export/dbstr_us.txt", "w");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,28 +9,8 @@ SET(import_headers
|
|||||||
|
|
||||||
ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||||
|
|
||||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
TARGET_LINK_LIBRARIES(import_client_files ${SERVER_LIBS})
|
||||||
|
|
||||||
IF(MSVC)
|
|
||||||
SET_TARGET_PROPERTIES(import_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "Ws2_32.lib")
|
|
||||||
ENDIF(MSVC)
|
|
||||||
|
|
||||||
IF(MINGW)
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "WS2_32")
|
|
||||||
ENDIF(MINGW)
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "${CMAKE_DL_LIBS}")
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "z")
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "m")
|
|
||||||
IF(NOT DARWIN)
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "rt")
|
|
||||||
ENDIF(NOT DARWIN)
|
|
||||||
TARGET_LINK_LIBRARIES(import_client_files "pthread")
|
|
||||||
ADD_DEFINITIONS(-fPIC)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "../../common/rulesys.h"
|
#include "../../common/rulesys.h"
|
||||||
#include "../../common/string_util.h"
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys LogSys;
|
||||||
|
|
||||||
void ImportSpells(SharedDatabase *db);
|
void ImportSpells(SharedDatabase *db);
|
||||||
void ImportSkillCaps(SharedDatabase *db);
|
void ImportSkillCaps(SharedDatabase *db);
|
||||||
@@ -34,35 +34,35 @@ void ImportDBStrings(SharedDatabase *db);
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
Log.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Status, "Client Files Import Utility");
|
Log(Logs::General, Logs::Status, "Client Files Import Utility");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Config = EQEmuConfig::get();
|
auto Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
database.LoadLogSettings(Log.log_settings);
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
Log.StartFileLogs();
|
LogSys.StartFileLogs();
|
||||||
|
|
||||||
ImportSpells(&database);
|
ImportSpells(&database);
|
||||||
ImportSkillCaps(&database);
|
ImportSkillCaps(&database);
|
||||||
ImportBaseData(&database);
|
ImportBaseData(&database);
|
||||||
ImportDBStrings(&database);
|
ImportDBStrings(&database);
|
||||||
|
|
||||||
Log.CloseFileLogs();
|
LogSys.CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -97,10 +97,10 @@ bool IsStringField(int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImportSpells(SharedDatabase *db) {
|
void ImportSpells(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Importing Spells...");
|
Log(Logs::General, Logs::Status, "Importing Spells...");
|
||||||
FILE *f = fopen("import/spells_us.txt", "r");
|
FILE *f = fopen("import/spells_us.txt", "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,23 +173,23 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
|
|
||||||
spells_imported++;
|
spells_imported++;
|
||||||
if(spells_imported % 1000 == 0) {
|
if(spells_imported % 1000 == 0) {
|
||||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(spells_imported % 1000 != 0) {
|
if(spells_imported % 1000 != 0) {
|
||||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportSkillCaps(SharedDatabase *db) {
|
void ImportSkillCaps(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Importing Skill Caps...");
|
Log(Logs::General, Logs::Status, "Importing Skill Caps...");
|
||||||
|
|
||||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,11 +220,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImportBaseData(SharedDatabase *db) {
|
void ImportBaseData(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Importing Base Data...");
|
Log(Logs::General, Logs::Status, "Importing Base Data...");
|
||||||
|
|
||||||
FILE *f = fopen("import/BaseData.txt", "r");
|
FILE *f = fopen("import/BaseData.txt", "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,11 +265,11 @@ void ImportBaseData(SharedDatabase *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImportDBStrings(SharedDatabase *db) {
|
void ImportDBStrings(SharedDatabase *db) {
|
||||||
Log.Out(Logs::General, Logs::Status, "Importing DB Strings...");
|
Log(Logs::General, Logs::Status, "Importing DB Strings...");
|
||||||
|
|
||||||
FILE *f = fopen("import/dbstr_us.txt", "r");
|
FILE *f = fopen("import/dbstr_us.txt", "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
Log(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
if (NOT MSVC)
|
||||||
|
include(FindPkgConfig)
|
||||||
|
pkg_check_modules(PC_SODIUM "libsodium")
|
||||||
|
if (NOT PC_SODIUM_FOUND)
|
||||||
|
pkg_check_modules(PC_SODIUM "sodium")
|
||||||
|
endif (NOT PC_SODIUM_FOUND)
|
||||||
|
if (PC_SODIUM_FOUND)
|
||||||
|
set(SODIUM_INCLUDE_HINTS ${PC_SODIUM_INCLUDE_DIRS} ${PC_SODIUM_INCLUDE_DIRS}/*)
|
||||||
|
set(SODIUM_LIBRARY_HINTS ${PC_SODIUM_LIBRARY_DIRS} ${PC_SODIUM_LIBRARY_DIRS}/*)
|
||||||
|
endif()
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|
||||||
|
# some libraries install the headers is a subdirectory of the include dir
|
||||||
|
# returned by pkg-config, so use a wildcard match to improve chances of finding
|
||||||
|
# headers and libraries.
|
||||||
|
find_path(
|
||||||
|
SODIUM_INCLUDE_DIRS
|
||||||
|
NAMES sodium.h
|
||||||
|
HINTS ${SODIUM_INCLUDE_HINTS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
SODIUM_LIBRARIES
|
||||||
|
NAMES libsodium sodium
|
||||||
|
HINTS ${SODIUM_LIBRARY_HINTS}
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||||
|
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||||
+114
-92
@@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
|||||||
SET(common_sources
|
SET(common_sources
|
||||||
base_packet.cpp
|
base_packet.cpp
|
||||||
classes.cpp
|
classes.cpp
|
||||||
client_version.cpp
|
compression.cpp
|
||||||
condition.cpp
|
condition.cpp
|
||||||
crash.cpp
|
crash.cpp
|
||||||
crc16.cpp
|
crc16.cpp
|
||||||
@@ -17,8 +17,7 @@ SET(common_sources
|
|||||||
emu_legacy.cpp
|
emu_legacy.cpp
|
||||||
emu_limits.cpp
|
emu_limits.cpp
|
||||||
emu_opcodes.cpp
|
emu_opcodes.cpp
|
||||||
emu_tcp_connection.cpp
|
emu_versions.cpp
|
||||||
emu_tcp_server.cpp
|
|
||||||
eqdb.cpp
|
eqdb.cpp
|
||||||
eqdb_res.cpp
|
eqdb_res.cpp
|
||||||
eqemu_exception.cpp
|
eqemu_exception.cpp
|
||||||
@@ -26,21 +25,23 @@ SET(common_sources
|
|||||||
eqemu_logsys.cpp
|
eqemu_logsys.cpp
|
||||||
eq_limits.cpp
|
eq_limits.cpp
|
||||||
eq_packet.cpp
|
eq_packet.cpp
|
||||||
eq_stream.cpp
|
|
||||||
eq_stream_factory.cpp
|
|
||||||
eq_stream_ident.cpp
|
eq_stream_ident.cpp
|
||||||
eq_stream_proxy.cpp
|
eq_stream_proxy.cpp
|
||||||
eqtime.cpp
|
eqtime.cpp
|
||||||
|
event_sub.cpp
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
faction.cpp
|
faction.cpp
|
||||||
guild_base.cpp
|
guild_base.cpp
|
||||||
guilds.cpp
|
guilds.cpp
|
||||||
inventory_version.cpp
|
inventory_profile.cpp
|
||||||
|
inventory_slot.cpp
|
||||||
ipc_mutex.cpp
|
ipc_mutex.cpp
|
||||||
item.cpp
|
item_data.cpp
|
||||||
item_struct.cpp
|
item_instance.cpp
|
||||||
|
json_config.cpp
|
||||||
light_source.cpp
|
light_source.cpp
|
||||||
md5.cpp
|
md5.cpp
|
||||||
|
memory_buffer.cpp
|
||||||
memory_mapped_file.cpp
|
memory_mapped_file.cpp
|
||||||
misc.cpp
|
misc.cpp
|
||||||
misc_functions.cpp
|
misc_functions.cpp
|
||||||
@@ -66,14 +67,25 @@ SET(common_sources
|
|||||||
spdat.cpp
|
spdat.cpp
|
||||||
string_util.cpp
|
string_util.cpp
|
||||||
struct_strategy.cpp
|
struct_strategy.cpp
|
||||||
tcp_connection.cpp
|
textures.cpp
|
||||||
tcp_server.cpp
|
|
||||||
timeoutmgr.cpp
|
|
||||||
timer.cpp
|
timer.cpp
|
||||||
unix.cpp
|
unix.cpp
|
||||||
worldconn.cpp
|
|
||||||
xml_parser.cpp
|
xml_parser.cpp
|
||||||
platform.cpp
|
platform.cpp
|
||||||
|
event/event_loop.cpp
|
||||||
|
json/jsoncpp.cpp
|
||||||
|
net/console_server.cpp
|
||||||
|
net/console_server_connection.cpp
|
||||||
|
net/crc32.cpp
|
||||||
|
net/daybreak_connection.cpp
|
||||||
|
net/eqstream.cpp
|
||||||
|
net/packet.cpp
|
||||||
|
net/servertalk_client_connection.cpp
|
||||||
|
net/servertalk_legacy_client_connection.cpp
|
||||||
|
net/servertalk_server.cpp
|
||||||
|
net/servertalk_server_connection.cpp
|
||||||
|
net/tcp_connection.cpp
|
||||||
|
net/tcp_server.cpp
|
||||||
patches/patches.cpp
|
patches/patches.cpp
|
||||||
patches/sod.cpp
|
patches/sod.cpp
|
||||||
patches/sod_limits.cpp
|
patches/sod_limits.cpp
|
||||||
@@ -87,22 +99,13 @@ SET(common_sources
|
|||||||
patches/titanium_limits.cpp
|
patches/titanium_limits.cpp
|
||||||
patches/uf.cpp
|
patches/uf.cpp
|
||||||
patches/uf_limits.cpp
|
patches/uf_limits.cpp
|
||||||
SocketLib/Base64.cpp
|
|
||||||
SocketLib/File.cpp
|
|
||||||
SocketLib/HttpdCookies.cpp
|
|
||||||
SocketLib/HttpdForm.cpp
|
|
||||||
SocketLib/HttpdSocket.cpp
|
|
||||||
SocketLib/HTTPSocket.cpp
|
|
||||||
SocketLib/MemFile.cpp
|
|
||||||
SocketLib/Mime.cpp
|
|
||||||
SocketLib/Parse.cpp
|
|
||||||
SocketLib/socket_include.cpp
|
|
||||||
SocketLib/Utility.cpp
|
|
||||||
StackWalker/StackWalker.cpp
|
StackWalker/StackWalker.cpp
|
||||||
tinyxml/tinystr.cpp
|
tinyxml/tinystr.cpp
|
||||||
tinyxml/tinyxml.cpp
|
tinyxml/tinyxml.cpp
|
||||||
tinyxml/tinyxmlerror.cpp
|
tinyxml/tinyxmlerror.cpp
|
||||||
tinyxml/tinyxmlparser.cpp
|
tinyxml/tinyxmlparser.cpp
|
||||||
|
util/directory.cpp
|
||||||
|
util/uuid.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(common_headers
|
SET(common_headers
|
||||||
@@ -111,7 +114,7 @@ SET(common_headers
|
|||||||
base_data.h
|
base_data.h
|
||||||
bodytypes.h
|
bodytypes.h
|
||||||
classes.h
|
classes.h
|
||||||
client_version.h
|
compression.h
|
||||||
condition.h
|
condition.h
|
||||||
crash.h
|
crash.h
|
||||||
crc16.h
|
crc16.h
|
||||||
@@ -125,8 +128,7 @@ SET(common_headers
|
|||||||
emu_limits.h
|
emu_limits.h
|
||||||
emu_opcodes.h
|
emu_opcodes.h
|
||||||
emu_oplist.h
|
emu_oplist.h
|
||||||
emu_tcp_connection.h
|
emu_versions.h
|
||||||
emu_tcp_server.h
|
|
||||||
eq_constants.h
|
eq_constants.h
|
||||||
eq_packet_structs.h
|
eq_packet_structs.h
|
||||||
eqdb.h
|
eqdb.h
|
||||||
@@ -137,15 +139,13 @@ SET(common_headers
|
|||||||
eqemu_logsys.h
|
eqemu_logsys.h
|
||||||
eq_limits.h
|
eq_limits.h
|
||||||
eq_packet.h
|
eq_packet.h
|
||||||
eq_stream.h
|
|
||||||
eq_stream_factory.h
|
|
||||||
eq_stream_ident.h
|
eq_stream_ident.h
|
||||||
eq_stream_intf.h
|
eq_stream_intf.h
|
||||||
eq_stream_locator.h
|
eq_stream_locator.h
|
||||||
eq_stream_proxy.h
|
eq_stream_proxy.h
|
||||||
eq_stream_type.h
|
|
||||||
eqtime.h
|
eqtime.h
|
||||||
errmsg.h
|
errmsg.h
|
||||||
|
event_sub.h
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
features.h
|
features.h
|
||||||
@@ -154,17 +154,20 @@ SET(common_headers
|
|||||||
global_define.h
|
global_define.h
|
||||||
guild_base.h
|
guild_base.h
|
||||||
guilds.h
|
guilds.h
|
||||||
inventory_version.h
|
inventory_profile.h
|
||||||
|
inventory_slot.h
|
||||||
ipc_mutex.h
|
ipc_mutex.h
|
||||||
item.h
|
item_data.h
|
||||||
item_fieldlist.h
|
item_fieldlist.h
|
||||||
item_struct.h
|
item_instance.h
|
||||||
|
json_config.h
|
||||||
languages.h
|
languages.h
|
||||||
light_source.h
|
light_source.h
|
||||||
linked_list.h
|
linked_list.h
|
||||||
loottable.h
|
loottable.h
|
||||||
mail_oplist.h
|
mail_oplist.h
|
||||||
md5.h
|
md5.h
|
||||||
|
memory_buffer.h
|
||||||
memory_mapped_file.h
|
memory_mapped_file.h
|
||||||
misc.h
|
misc.h
|
||||||
misc_functions.h
|
misc_functions.h
|
||||||
@@ -196,105 +199,143 @@ SET(common_headers
|
|||||||
spdat.h
|
spdat.h
|
||||||
string_util.h
|
string_util.h
|
||||||
struct_strategy.h
|
struct_strategy.h
|
||||||
tcp_basic_server.h
|
textures.h
|
||||||
tcp_connection.h
|
|
||||||
tcp_server.h
|
|
||||||
timeoutmgr.h
|
|
||||||
timer.h
|
timer.h
|
||||||
types.h
|
types.h
|
||||||
unix.h
|
unix.h
|
||||||
useperl.h
|
useperl.h
|
||||||
version.h
|
version.h
|
||||||
worldconn.h
|
|
||||||
xml_parser.h
|
xml_parser.h
|
||||||
zone_numbers.h
|
zone_numbers.h
|
||||||
|
event/background_task.h
|
||||||
|
event/event_loop.h
|
||||||
|
event/timer.h
|
||||||
|
json/json.h
|
||||||
|
json/json-forwards.h
|
||||||
|
net/console_server.h
|
||||||
|
net/console_server_connection.h
|
||||||
|
net/crc32.h
|
||||||
|
net/daybreak_connection.h
|
||||||
|
net/daybreak_structs.h
|
||||||
|
net/dns.h
|
||||||
|
net/endian.h
|
||||||
|
net/eqstream.h
|
||||||
|
net/packet.h
|
||||||
|
net/servertalk_client_connection.h
|
||||||
|
net/servertalk_legacy_client_connection.h
|
||||||
|
net/servertalk_common.h
|
||||||
|
net/servertalk_server.h
|
||||||
|
net/servertalk_server_connection.h
|
||||||
|
net/tcp_connection.h
|
||||||
|
net/tcp_server.h
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
patches/sod.h
|
patches/sod.h
|
||||||
# patches/sod_itemfields.h
|
|
||||||
patches/sod_limits.h
|
patches/sod_limits.h
|
||||||
patches/sod_ops.h
|
patches/sod_ops.h
|
||||||
patches/sod_structs.h
|
patches/sod_structs.h
|
||||||
patches/sof.h
|
patches/sof.h
|
||||||
# patches/sof_itemfields.h
|
|
||||||
patches/sof_limits.h
|
patches/sof_limits.h
|
||||||
# patches/sof_opcode_list.h
|
|
||||||
patches/sof_ops.h
|
patches/sof_ops.h
|
||||||
patches/sof_structs.h
|
patches/sof_structs.h
|
||||||
patches/ss_declare.h
|
patches/ss_declare.h
|
||||||
patches/ss_define.h
|
patches/ss_define.h
|
||||||
patches/ss_register.h
|
patches/ss_register.h
|
||||||
patches/rof.h
|
patches/rof.h
|
||||||
# patches/rof_itemfields.h
|
|
||||||
patches/rof_limits.h
|
patches/rof_limits.h
|
||||||
patches/rof_ops.h
|
patches/rof_ops.h
|
||||||
patches/rof_structs.h
|
patches/rof_structs.h
|
||||||
patches/rof2.h
|
patches/rof2.h
|
||||||
# patches/rof2_itemfields.h
|
|
||||||
patches/rof2_limits.h
|
patches/rof2_limits.h
|
||||||
patches/rof2_ops.h
|
patches/rof2_ops.h
|
||||||
patches/rof2_structs.h
|
patches/rof2_structs.h
|
||||||
patches/titanium.h
|
patches/titanium.h
|
||||||
# patches/titanium_itemfields_a.h
|
|
||||||
# patches/titanium_itemfields_b.h
|
|
||||||
patches/titanium_limits.h
|
patches/titanium_limits.h
|
||||||
patches/titanium_ops.h
|
patches/titanium_ops.h
|
||||||
patches/titanium_structs.h
|
patches/titanium_structs.h
|
||||||
patches/uf.h
|
patches/uf.h
|
||||||
# patches/uf_itemfields.h
|
|
||||||
patches/uf_limits.h
|
patches/uf_limits.h
|
||||||
patches/uf_ops.h
|
patches/uf_ops.h
|
||||||
patches/uf_structs.h
|
patches/uf_structs.h
|
||||||
SocketLib/Base64.h
|
|
||||||
SocketLib/File.h
|
|
||||||
SocketLib/HttpdCookies.h
|
|
||||||
SocketLib/HttpdForm.h
|
|
||||||
SocketLib/HttpdSocket.h
|
|
||||||
SocketLib/HTTPSocket.h
|
|
||||||
SocketLib/IFile.h
|
|
||||||
SocketLib/MemFile.h
|
|
||||||
SocketLib/Mime.h
|
|
||||||
SocketLib/Parse.h
|
|
||||||
SocketLib/socket_include.h
|
|
||||||
SocketLib/Utility.h
|
|
||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
tinyxml/tinystr.h
|
tinyxml/tinystr.h
|
||||||
tinyxml/tinyxml.h
|
tinyxml/tinyxml.h
|
||||||
|
util/memory_stream.h
|
||||||
|
util/directory.h
|
||||||
|
util/uuid.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SOURCE_GROUP(Event FILES
|
||||||
|
event/background_task.h
|
||||||
|
event/event_loop.cpp
|
||||||
|
event/event_loop.h
|
||||||
|
event/timer.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SOURCE_GROUP(Json FILES
|
||||||
|
json/json.h
|
||||||
|
json/jsoncpp.cpp
|
||||||
|
json/json-forwards.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SOURCE_GROUP(Net FILES
|
||||||
|
net/console_server.cpp
|
||||||
|
net/console_server.h
|
||||||
|
net/console_server_connection.cpp
|
||||||
|
net/console_server_connection.h
|
||||||
|
net/crc32.cpp
|
||||||
|
net/crc32.h
|
||||||
|
net/daybreak_connection.cpp
|
||||||
|
net/daybreak_connection.h
|
||||||
|
net/daybreak_structs.h
|
||||||
|
net/dns.h
|
||||||
|
net/endian.h
|
||||||
|
net/eqmq.cpp
|
||||||
|
net/eqmq.h
|
||||||
|
net/eqstream.cpp
|
||||||
|
net/eqstream.h
|
||||||
|
net/packet.cpp
|
||||||
|
net/packet.h
|
||||||
|
net/servertalk_client_connection.cpp
|
||||||
|
net/servertalk_client_connection.h
|
||||||
|
net/servertalk_legacy_client_connection.cpp
|
||||||
|
net/servertalk_legacy_client_connection.h
|
||||||
|
net/servertalk_common.h
|
||||||
|
net/servertalk_server.cpp
|
||||||
|
net/servertalk_server.h
|
||||||
|
net/servertalk_server_connection.cpp
|
||||||
|
net/servertalk_server_connection.h
|
||||||
|
net/tcp_connection.cpp
|
||||||
|
net/tcp_connection.h
|
||||||
|
net/tcp_server.cpp
|
||||||
|
net/tcp_server.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Patches FILES
|
SOURCE_GROUP(Patches FILES
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
patches/sod.h
|
patches/sod.h
|
||||||
# patches/sod_itemfields.h
|
|
||||||
patches/sod_limits.h
|
patches/sod_limits.h
|
||||||
patches/sod_ops.h
|
patches/sod_ops.h
|
||||||
patches/sod_structs.h
|
patches/sod_structs.h
|
||||||
patches/sof.h
|
patches/sof.h
|
||||||
# patches/sof_itemfields.h
|
|
||||||
patches/sof_limits.h
|
patches/sof_limits.h
|
||||||
# patches/sof_opcode_list.h
|
|
||||||
patches/sof_ops.h
|
patches/sof_ops.h
|
||||||
patches/sof_structs.h
|
patches/sof_structs.h
|
||||||
patches/ss_declare.h
|
patches/ss_declare.h
|
||||||
patches/ss_define.h
|
patches/ss_define.h
|
||||||
patches/ss_register.h
|
patches/ss_register.h
|
||||||
patches/rof.h
|
patches/rof.h
|
||||||
# patches/rof_itemfields.h
|
|
||||||
patches/rof_limits.h
|
patches/rof_limits.h
|
||||||
patches/rof_ops.h
|
patches/rof_ops.h
|
||||||
patches/rof_structs.h
|
patches/rof_structs.h
|
||||||
patches/rof2.h
|
patches/rof2.h
|
||||||
# patches/rof2_itemfields.h
|
|
||||||
patches/rof2_limits.h
|
patches/rof2_limits.h
|
||||||
patches/rof2_ops.h
|
patches/rof2_ops.h
|
||||||
patches/rof2_structs.h
|
patches/rof2_structs.h
|
||||||
patches/titanium.h
|
patches/titanium.h
|
||||||
# patches/titanium_itemfields_a.h
|
|
||||||
# patches/titanium_itemfields_b.h
|
|
||||||
patches/titanium_limits.h
|
patches/titanium_limits.h
|
||||||
patches/titanium_ops.h
|
patches/titanium_ops.h
|
||||||
patches/titanium_structs.h
|
patches/titanium_structs.h
|
||||||
patches/uf.h
|
patches/uf.h
|
||||||
# patches/uf_itemfields.h
|
|
||||||
patches/uf_limits.h
|
patches/uf_limits.h
|
||||||
patches/uf_ops.h
|
patches/uf_ops.h
|
||||||
patches/uf_structs.h
|
patches/uf_structs.h
|
||||||
@@ -313,32 +354,6 @@ SOURCE_GROUP(Patches FILES
|
|||||||
patches/uf_limits.cpp
|
patches/uf_limits.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(SocketLib FILES
|
|
||||||
SocketLib/Base64.h
|
|
||||||
SocketLib/File.h
|
|
||||||
SocketLib/HttpdCookies.h
|
|
||||||
SocketLib/HttpdForm.h
|
|
||||||
SocketLib/HttpdSocket.h
|
|
||||||
SocketLib/HTTPSocket.h
|
|
||||||
SocketLib/IFile.h
|
|
||||||
SocketLib/MemFile.h
|
|
||||||
SocketLib/Mime.h
|
|
||||||
SocketLib/Parse.h
|
|
||||||
SocketLib/socket_include.h
|
|
||||||
SocketLib/Utility.h
|
|
||||||
SocketLib/Base64.cpp
|
|
||||||
SocketLib/File.cpp
|
|
||||||
SocketLib/HttpdCookies.cpp
|
|
||||||
SocketLib/HttpdForm.cpp
|
|
||||||
SocketLib/HttpdSocket.cpp
|
|
||||||
SocketLib/HTTPSocket.cpp
|
|
||||||
SocketLib/MemFile.cpp
|
|
||||||
SocketLib/Mime.cpp
|
|
||||||
SocketLib/Parse.cpp
|
|
||||||
SocketLib/socket_include.cpp
|
|
||||||
SocketLib/Utility.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
SOURCE_GROUP(StackWalker FILES
|
SOURCE_GROUP(StackWalker FILES
|
||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
StackWalker/StackWalker.cpp
|
StackWalker/StackWalker.cpp
|
||||||
@@ -353,12 +368,19 @@ SOURCE_GROUP(TinyXML FILES
|
|||||||
tinyxml/tinyxmlparser.cpp
|
tinyxml/tinyxmlparser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SOURCE_GROUP(Util FILES
|
||||||
|
util/memory_stream.h
|
||||||
|
util/directory.cpp
|
||||||
|
util/directory.h
|
||||||
|
util/uuid.cpp
|
||||||
|
util/uuid.h
|
||||||
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML)
|
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML)
|
||||||
|
|
||||||
ADD_LIBRARY(common ${common_sources} ${common_headers})
|
ADD_LIBRARY(common ${common_sources} ${common_headers})
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_DEFINITIONS(-fPIC)
|
|
||||||
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
||||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ struct BaseDataStruct
|
|||||||
double base_hp;
|
double base_hp;
|
||||||
double base_mana;
|
double base_mana;
|
||||||
double base_end;
|
double base_end;
|
||||||
double unk1;
|
double hp_regen;
|
||||||
double unk2;
|
double end_regen;
|
||||||
double hp_factor;
|
double hp_factor;
|
||||||
double mana_factor;
|
double mana_factor;
|
||||||
double endurance_factor;
|
double endurance_factor;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ typedef enum {
|
|||||||
BT_Greater_Akheva = 14,
|
BT_Greater_Akheva = 14,
|
||||||
BT_Khati_Sha = 15,
|
BT_Khati_Sha = 15,
|
||||||
BT_Seru = 16, //not confirmed....
|
BT_Seru = 16, //not confirmed....
|
||||||
|
BT_Draz_Nurakk = 18,
|
||||||
BT_Zek = 19,
|
BT_Zek = 19,
|
||||||
BT_Luggald = 20,
|
BT_Luggald = 20,
|
||||||
BT_Animal = 21,
|
BT_Animal = 21,
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "client_version.h"
|
|
||||||
|
|
||||||
|
|
||||||
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
|
|
||||||
{
|
|
||||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
|
|
||||||
{
|
|
||||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
|
||||||
return ClientVersion::Unknown;
|
|
||||||
|
|
||||||
return client_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
|
|
||||||
{
|
|
||||||
switch (client_version) {
|
|
||||||
case ClientVersion::Unknown:
|
|
||||||
return "Unknown Version";
|
|
||||||
case ClientVersion::Client62:
|
|
||||||
return "Client 6.2";
|
|
||||||
case ClientVersion::Titanium:
|
|
||||||
return "Titanium";
|
|
||||||
case ClientVersion::SoF:
|
|
||||||
return "SoF";
|
|
||||||
case ClientVersion::SoD:
|
|
||||||
return "SoD";
|
|
||||||
case ClientVersion::UF:
|
|
||||||
return "UF";
|
|
||||||
case ClientVersion::RoF:
|
|
||||||
return "RoF";
|
|
||||||
case ClientVersion::RoF2:
|
|
||||||
return "RoF2";
|
|
||||||
default:
|
|
||||||
return "Invalid Version";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
|
|
||||||
{
|
|
||||||
switch (client_version) {
|
|
||||||
case ClientVersion::Unknown:
|
|
||||||
case ClientVersion::Client62:
|
|
||||||
return bit_Unknown;
|
|
||||||
case ClientVersion::Titanium:
|
|
||||||
return bit_Titanium;
|
|
||||||
case ClientVersion::SoF:
|
|
||||||
return bit_SoF;
|
|
||||||
case ClientVersion::SoD:
|
|
||||||
return bit_SoD;
|
|
||||||
case ClientVersion::UF:
|
|
||||||
return bit_UF;
|
|
||||||
case ClientVersion::RoF:
|
|
||||||
return bit_RoF;
|
|
||||||
case ClientVersion::RoF2:
|
|
||||||
return bit_RoF2;
|
|
||||||
default:
|
|
||||||
return bit_Unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
|
|
||||||
{
|
|
||||||
switch (client_version_bit) {
|
|
||||||
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
|
|
||||||
return ClientVersion::Unknown;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
|
|
||||||
return ClientVersion::Titanium;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
|
|
||||||
return ClientVersion::SoF;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
|
|
||||||
return ClientVersion::SoD;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
|
|
||||||
return ClientVersion::UF;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
|
|
||||||
return ClientVersion::RoF;
|
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
|
||||||
return ClientVersion::RoF2;
|
|
||||||
default:
|
|
||||||
return ClientVersion::Unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
|
|
||||||
{
|
|
||||||
switch (client_version) {
|
|
||||||
case ClientVersion::Unknown:
|
|
||||||
case ClientVersion::Client62:
|
|
||||||
case ClientVersion::Titanium:
|
|
||||||
return 0x000007FFU;
|
|
||||||
case ClientVersion::SoF:
|
|
||||||
return 0x00007FFFU;
|
|
||||||
case ClientVersion::SoD:
|
|
||||||
return 0x0000FFFFU;
|
|
||||||
case ClientVersion::UF:
|
|
||||||
return 0x0001FFFFU;
|
|
||||||
case ClientVersion::RoF:
|
|
||||||
case ClientVersion::RoF2:
|
|
||||||
return 0x000FFFFFU;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMMON_CLIENT_VERSION_H
|
|
||||||
#define COMMON_CLIENT_VERSION_H
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace EQEmu
|
|
||||||
{
|
|
||||||
namespace versions {
|
|
||||||
enum class ClientVersion {
|
|
||||||
Unknown = 0,
|
|
||||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
|
||||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
|
||||||
SoF, // Build: 'Sep 7 2007 09:11:49'
|
|
||||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
|
||||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
|
||||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
|
||||||
RoF2 // Build: 'May 10 2013 23:30:08'
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ClientVersionBit : uint32 {
|
|
||||||
bit_Unknown = 0,
|
|
||||||
bit_Client62 = 0x00000001, // unsupported (placeholder for scripts)
|
|
||||||
bit_Titanium = 0x00000002,
|
|
||||||
bit_SoF = 0x00000004,
|
|
||||||
bit_SoD = 0x00000008,
|
|
||||||
bit_UF = 0x00000010,
|
|
||||||
bit_RoF = 0x00000020,
|
|
||||||
bit_RoF2 = 0x00000040,
|
|
||||||
bit_TitaniumAndEarlier = 0x00000003,
|
|
||||||
bit_SoFAndEarlier = 0x00000007,
|
|
||||||
bit_SoDAndEarlier = 0x0000000F,
|
|
||||||
bit_UFAndEarlier = 0x0000001F,
|
|
||||||
bit_RoFAndEarlier = 0x0000003F,
|
|
||||||
bit_SoFAndLater = 0xFFFFFFFC,
|
|
||||||
bit_SoDAndLater = 0xFFFFFFF8,
|
|
||||||
bit_UFAndLater = 0xFFFFFFF0,
|
|
||||||
bit_RoFAndLater = 0xFFFFFFE0,
|
|
||||||
bit_RoF2AndLater = 0xFFFFFFC0,
|
|
||||||
bit_AllClients = 0xFFFFFFFF
|
|
||||||
};
|
|
||||||
|
|
||||||
static const ClientVersion LastClientVersion = ClientVersion::RoF2;
|
|
||||||
static const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
|
||||||
|
|
||||||
extern bool IsValidClientVersion(ClientVersion client_version);
|
|
||||||
extern ClientVersion ValidateClientVersion(ClientVersion client_version);
|
|
||||||
extern const char* ClientVersionName(ClientVersion client_version);
|
|
||||||
extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
|
|
||||||
extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
|
|
||||||
extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
|
|
||||||
|
|
||||||
} /*versions*/
|
|
||||||
|
|
||||||
} /*EQEmu*/
|
|
||||||
|
|
||||||
#endif /*COMMON_CLIENT_VERSION_H*/
|
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#include "global_define.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
|
namespace EQEmu
|
||||||
|
{
|
||||||
|
uint32 EstimateDeflateBuffer(uint32 len) {
|
||||||
|
z_stream zstream;
|
||||||
|
memset(&zstream, 0, sizeof(zstream));
|
||||||
|
|
||||||
|
zstream.zalloc = Z_NULL;
|
||||||
|
zstream.zfree = Z_NULL;
|
||||||
|
zstream.opaque = Z_NULL;
|
||||||
|
if (deflateInit(&zstream, Z_FINISH) != Z_OK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return deflateBound(&zstream, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max) {
|
||||||
|
z_stream zstream;
|
||||||
|
memset(&zstream, 0, sizeof(zstream));
|
||||||
|
int zerror;
|
||||||
|
|
||||||
|
zstream.next_in = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>(buffer));
|
||||||
|
zstream.avail_in = len;
|
||||||
|
zstream.zalloc = Z_NULL;
|
||||||
|
zstream.zfree = Z_NULL;
|
||||||
|
zstream.opaque = Z_NULL;
|
||||||
|
deflateInit(&zstream, Z_FINISH);
|
||||||
|
|
||||||
|
zstream.next_out = reinterpret_cast<unsigned char*>(out_buffer);
|
||||||
|
zstream.avail_out = out_len_max;
|
||||||
|
zerror = deflate(&zstream, Z_FINISH);
|
||||||
|
|
||||||
|
if (zerror == Z_STREAM_END)
|
||||||
|
{
|
||||||
|
deflateEnd(&zstream);
|
||||||
|
return (uint32)zstream.total_out;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zerror = deflateEnd(&zstream);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 InflateData(const char* buffer, uint32 len, char* out_buffer, uint32 out_len_max) {
|
||||||
|
z_stream zstream;
|
||||||
|
int zerror = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
zstream.next_in = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>(buffer));
|
||||||
|
zstream.avail_in = len;
|
||||||
|
zstream.next_out = reinterpret_cast<unsigned char*>(out_buffer);;
|
||||||
|
zstream.avail_out = out_len_max;
|
||||||
|
zstream.zalloc = Z_NULL;
|
||||||
|
zstream.zfree = Z_NULL;
|
||||||
|
zstream.opaque = Z_NULL;
|
||||||
|
|
||||||
|
i = inflateInit2(&zstream, 15);
|
||||||
|
if (i != Z_OK) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
zerror = inflate(&zstream, Z_FINISH);
|
||||||
|
if (zerror == Z_STREAM_END) {
|
||||||
|
inflateEnd(&zstream);
|
||||||
|
return zstream.total_out;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (zerror == -4 && zstream.msg == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
zerror = inflateEnd(&zstream);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace EQEmu
|
||||||
|
{
|
||||||
|
uint32 EstimateDeflateBuffer(uint32 len);
|
||||||
|
uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max);
|
||||||
|
uint32 InflateData(const char* buffer, uint32 len, char* out_buffer, uint32 out_len_max);
|
||||||
|
}
|
||||||
+22
-22
@@ -25,7 +25,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Crash, buffer);
|
Log(Logs::General, Logs::Crash, buffer);
|
||||||
StackWalker::OnOutput(szText);
|
StackWalker::OnOutput(szText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
|||||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||||
{
|
{
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_BREAKPOINT:
|
case EXCEPTION_BREAKPOINT:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_OVERFLOW:
|
case EXCEPTION_FLT_OVERFLOW:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_STACK_CHECK:
|
case EXCEPTION_FLT_STACK_CHECK:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_UNDERFLOW:
|
case EXCEPTION_FLT_UNDERFLOW:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_OVERFLOW:
|
case EXCEPTION_INT_OVERFLOW:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INVALID_DISPOSITION:
|
case EXCEPTION_INVALID_DISPOSITION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_PRIV_INSTRUCTION:
|
case EXCEPTION_PRIV_INSTRUCTION:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_SINGLE_STEP:
|
case EXCEPTION_SINGLE_STEP:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_STACK_OVERFLOW:
|
case EXCEPTION_STACK_OVERFLOW:
|
||||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
Log(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.Out(Logs::General, Logs::Crash, "Unknown Exception");
|
Log(Logs::General, Logs::Crash, "Unknown Exception");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-20
@@ -1,5 +1,6 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,36 +14,42 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMMON_DATA_VERIFICATION_H
|
#ifndef COMMON_DATA_VERIFICATION_H
|
||||||
#define COMMON_DATA_VERIFICATION_H
|
#define COMMON_DATA_VERIFICATION_H
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
namespace EQEmu
|
namespace EQEmu
|
||||||
{
|
{
|
||||||
|
template <typename T>
|
||||||
|
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||||
|
return std::max(lower, std::min(value, upper));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
T ClampLower(const T& value, const T& lower) {
|
||||||
return std::max(lower, std::min(value, upper));
|
return std::max(lower, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T ClampLower(const T& value, const T& lower) {
|
T ClampUpper(const T& value, const T& upper) {
|
||||||
return std::max(lower, value);
|
return std::min(value, upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T ClampUpper(const T& value, const T& upper) {
|
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||||
return std::min(value, upper);
|
return value >= lower && value <= upper;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T1, typename T2, typename T3>
|
||||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
bool ValueWithin(const T1& value, const T2& lower, const T3& upper) {
|
||||||
return value >= lower && value <= upper;
|
return value >= (T1)lower && value <= (T1)upper;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} /*EQEmu*/
|
||||||
|
|
||||||
#endif
|
#endif /*COMMON_DATA_VERIFICATION_H*/
|
||||||
|
|||||||
+59
-22
@@ -64,11 +64,11 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
|||||||
uint32 errnum= 0;
|
uint32 errnum= 0;
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port);
|
Log(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta
|
|||||||
else
|
else
|
||||||
query = StringFormat("INSERT INTO account SET name='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name, status, lsaccount_id);
|
query = StringFormat("INSERT INTO account SET name='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name, status, lsaccount_id);
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status);
|
Log(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
@@ -225,7 +225,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta
|
|||||||
|
|
||||||
bool Database::DeleteAccount(const char* name) {
|
bool Database::DeleteAccount(const char* name) {
|
||||||
std::string query = StringFormat("DELETE FROM account WHERE name='%s';",name);
|
std::string query = StringFormat("DELETE FROM account WHERE name='%s';",name);
|
||||||
Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name);
|
Log(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name);
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
@@ -272,7 +272,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
if (row[0] && atoi(row[0]) > 0){
|
if (row[0] && atoi(row[0]) > 0){
|
||||||
Log.Out(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name);
|
Log(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,23 +290,24 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
|||||||
bool Database::DeleteCharacter(char *name) {
|
bool Database::DeleteCharacter(char *name) {
|
||||||
uint32 charid = 0;
|
uint32 charid = 0;
|
||||||
if(!name || !strlen(name)) {
|
if(!name || !strlen(name)) {
|
||||||
Log.Out(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)");
|
Log(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Log.Out(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name);
|
Log(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name);
|
||||||
|
|
||||||
/* Get id from character_data before deleting record so we can clean up the rest of the tables */
|
/* Get id from character_data before deleting record so we can clean up the rest of the tables */
|
||||||
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", name);
|
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", name);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
|
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
|
||||||
if (charid <= 0){
|
if (charid <= 0){
|
||||||
Log.Out(Logs::General, Logs::Error, "Database::DeleteCharacter :: Character (%s) not found, stopping delete...", name);
|
Log(Logs::General, Logs::Error, "Database::DeleteCharacter :: Character (%s) not found, stopping delete...", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
|
query = StringFormat("DELETE FROM `character_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||||
@@ -627,9 +628,9 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
/* Save Bind Points */
|
/* Save Bind Points */
|
||||||
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
|
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
|
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||||
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
|
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||||
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
|
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||||
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
|
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||||
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||||
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||||
@@ -638,6 +639,13 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||||
); results = QueryDatabase(query);
|
); results = QueryDatabase(query);
|
||||||
|
|
||||||
|
/* HoTT Ability */
|
||||||
|
if(RuleB(Character, GrantHoTTOnCreate))
|
||||||
|
{
|
||||||
|
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, rank) VALUES (%u, %i, %i)", character_id, 14, 1);
|
||||||
|
results = QueryDatabase(query);
|
||||||
|
}
|
||||||
|
|
||||||
/* Save Skills */
|
/* Save Skills */
|
||||||
int firstquery = 0;
|
int firstquery = 0;
|
||||||
for (int i = 0; i < MAX_PP_SKILL; i++){
|
for (int i = 0; i < MAX_PP_SKILL; i++){
|
||||||
@@ -672,14 +680,14 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This only for new Character creation storing */
|
/* This only for new Character creation storing */
|
||||||
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) {
|
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
|
||||||
uint32 charid = 0;
|
uint32 charid = 0;
|
||||||
char zone[50];
|
char zone[50];
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
charid = GetCharacterID(pp->name);
|
charid = GetCharacterID(pp->name);
|
||||||
|
|
||||||
if(!charid) {
|
if(!charid) {
|
||||||
Log.Out(Logs::General, Logs::Error, "StoreCharacter: no character id");
|
Log(Logs::General, Logs::Error, "StoreCharacter: no character id");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,7 +709,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
|||||||
/* Insert starting inventory... */
|
/* Insert starting inventory... */
|
||||||
std::string invquery;
|
std::string invquery;
|
||||||
for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) {
|
for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) {
|
||||||
const ItemInst* newinv = inv->GetItem(i);
|
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
|
||||||
if (newinv) {
|
if (newinv) {
|
||||||
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||||
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
||||||
@@ -709,7 +717,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
|||||||
auto results = QueryDatabase(invquery);
|
auto results = QueryDatabase(invquery);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == EQEmu::legacy::SlotCursor) {
|
if (i == EQEmu::inventory::slotCursor) {
|
||||||
i = EQEmu::legacy::GENERAL_BAGS_BEGIN;
|
i = EQEmu::legacy::GENERAL_BAGS_BEGIN;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1492,7 +1500,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
Log.Out(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
Log(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1535,7 +1543,7 @@ uint32 Database::GetGroupID(const char* name){
|
|||||||
if (results.RowCount() == 0)
|
if (results.RowCount() == 0)
|
||||||
{
|
{
|
||||||
// Commenting this out until logging levels can prevent this from going to console
|
// Commenting this out until logging levels can prevent this from going to console
|
||||||
//Log.Out(Logs::General, Logs::None,, "Character not in a group: %s", name);
|
//Log(Logs::General, Logs::None,, "Character not in a group: %s", name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1582,7 +1590,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) {
|
|||||||
result = QueryDatabase(query);
|
result = QueryDatabase(query);
|
||||||
|
|
||||||
if(!result.Success()) {
|
if(!result.Success()) {
|
||||||
Log.Out(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
Log(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1779,7 +1787,7 @@ const char* Database::GetRaidLeaderName(uint32 raid_id)
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
Log.Out(Logs::General, Logs::Debug, "Unable to get Raid Leader Name for Raid ID: %u", raid_id);
|
Log(Logs::General, Logs::Debug, "Unable to get Raid Leader Name for Raid ID: %u", raid_id);
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2048,6 +2056,8 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
|
|||||||
|
|
||||||
void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
||||||
{
|
{
|
||||||
|
// log_settings previously initialized to '0' by EQEmuLogSys::LoadLogSettingsDefaults()
|
||||||
|
|
||||||
std::string query =
|
std::string query =
|
||||||
"SELECT "
|
"SELECT "
|
||||||
"log_category_id, "
|
"log_category_id, "
|
||||||
@@ -2061,10 +2071,13 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
int log_category = 0;
|
int log_category = 0;
|
||||||
Log.file_logs_enabled = false;
|
LogSys.file_logs_enabled = false;
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
log_category = atoi(row[0]);
|
log_category = atoi(row[0]);
|
||||||
|
if (log_category <= Logs::None || log_category >= Logs::MaxCategoryID)
|
||||||
|
continue;
|
||||||
|
|
||||||
log_settings[log_category].log_to_console = atoi(row[2]);
|
log_settings[log_category].log_to_console = atoi(row[2]);
|
||||||
log_settings[log_category].log_to_file = atoi(row[3]);
|
log_settings[log_category].log_to_file = atoi(row[3]);
|
||||||
log_settings[log_category].log_to_gmsay = atoi(row[4]);
|
log_settings[log_category].log_to_gmsay = atoi(row[4]);
|
||||||
@@ -2084,7 +2097,7 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
|||||||
If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
||||||
*/
|
*/
|
||||||
if (log_settings[log_category].log_to_file > 0){
|
if (log_settings[log_category].log_to_file > 0){
|
||||||
Log.file_logs_enabled = true;
|
LogSys.file_logs_enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2106,7 +2119,7 @@ struct TimeOfDay_Struct Database::LoadTime(time_t &realtime)
|
|||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success() || results.RowCount() == 0){
|
if (!results.Success() || results.RowCount() == 0){
|
||||||
Log.Out(Logs::Detail, Logs::World_Server, "Loading EQ time of day failed. Using defaults.");
|
Log(Logs::Detail, Logs::World_Server, "Loading EQ time of day failed. Using defaults.");
|
||||||
eqTime.minute = 0;
|
eqTime.minute = 0;
|
||||||
eqTime.hour = 9;
|
eqTime.hour = 9;
|
||||||
eqTime.day = 1;
|
eqTime.day = 1;
|
||||||
@@ -2136,3 +2149,27 @@ bool Database::SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year
|
|||||||
return results.Success();
|
return results.Success();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Database::GetIPExemption(std::string account_ip) {
|
||||||
|
std::string query = StringFormat("SELECT `exemption_amount` FROM `ip_exemptions` WHERE `exemption_ip` = '%s'", account_ip.c_str());
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
|
if (results.Success() && results.RowCount() > 0) {
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RuleI(World, MaxClientsPerIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
||||||
|
std::string query = StringFormat("SELECT instance_list.id FROM instance_list INNER JOIN instance_list_player ON instance_list.id = instance_list_player.id WHERE instance_list.zone = '%i' AND instance_list_player.charid = '%i'", zone_id, char_id);
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
|
if (results.Success() && results.RowCount() > 0) {
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
+10
-2
@@ -37,10 +37,14 @@
|
|||||||
//atoi is not uint32 or uint32 safe!!!!
|
//atoi is not uint32 or uint32 safe!!!!
|
||||||
#define atoul(str) strtoul(str, nullptr, 10)
|
#define atoul(str) strtoul(str, nullptr, 10)
|
||||||
|
|
||||||
class Inventory;
|
|
||||||
class MySQLRequestResult;
|
class MySQLRequestResult;
|
||||||
class Client;
|
class Client;
|
||||||
|
|
||||||
|
namespace EQEmu
|
||||||
|
{
|
||||||
|
class InventoryProfile;
|
||||||
|
}
|
||||||
|
|
||||||
struct EventLogDetails_Struct {
|
struct EventLogDetails_Struct {
|
||||||
uint32 id;
|
uint32 id;
|
||||||
char accountname[64];
|
char accountname[64];
|
||||||
@@ -109,7 +113,7 @@ public:
|
|||||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
|
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
|
||||||
bool UpdateName(const char* oldname, const char* newname);
|
bool UpdateName(const char* oldname, const char* newname);
|
||||||
|
|
||||||
/* General Information Queries */
|
/* General Information Queries */
|
||||||
@@ -187,6 +191,10 @@ public:
|
|||||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||||
void SetAgreementFlag(uint32 acctid);
|
void SetAgreementFlag(uint32 acctid);
|
||||||
|
|
||||||
|
int GetIPExemption(std::string account_ip);
|
||||||
|
|
||||||
|
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
||||||
|
|
||||||
|
|
||||||
/* Groups */
|
/* Groups */
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ namespace Convert {
|
|||||||
/*002*/ uint32 HP;
|
/*002*/ uint32 HP;
|
||||||
/*006*/ uint32 Mana;
|
/*006*/ uint32 Mana;
|
||||||
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
|
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||||
/*510*/ uint32 Items[EQEmu::legacy::MaterialCount];
|
/*510*/ uint32 Items[EQEmu::textures::materialCount];
|
||||||
/*546*/ char Name[64];
|
/*546*/ char Name[64];
|
||||||
/*610*/
|
/*610*/
|
||||||
};
|
};
|
||||||
@@ -227,9 +227,9 @@ namespace Convert {
|
|||||||
/*0304*/ uint8 ability_time_minutes;
|
/*0304*/ uint8 ability_time_minutes;
|
||||||
/*0305*/ uint8 ability_time_hours; //place holder
|
/*0305*/ uint8 ability_time_hours; //place holder
|
||||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||||
/*0312*/ uint32 item_material[EQEmu::legacy::MaterialCount]; // Item texture/material of worn/held items
|
/*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items
|
||||||
/*0348*/ uint8 unknown0348[44];
|
/*0348*/ uint8 unknown0348[44];
|
||||||
/*0392*/ Convert::Color_Struct item_tint[EQEmu::legacy::MaterialCount];
|
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount];
|
||||||
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
|
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||||
/*2352*/ char servername[32]; // length probably not right
|
/*2352*/ char servername[32]; // length probably not right
|
||||||
@@ -472,31 +472,8 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
CheckDatabaseConvertPPDeblob();
|
CheckDatabaseConvertPPDeblob();
|
||||||
CheckDatabaseConvertCorpseDeblob();
|
CheckDatabaseConvertCorpseDeblob();
|
||||||
|
|
||||||
/* Fetch Automatic Upgrade Script */
|
/* Run EQEmu Server script (Checks for database updates) */
|
||||||
if (!std::ifstream("eqemu_update.pl")){
|
system("perl eqemu_server.pl ran_from_world");
|
||||||
std::cout << "Pulling down automatic database upgrade script..." << std::endl;
|
|
||||||
#ifdef _WIN32
|
|
||||||
system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl'); if ($response->is_success){ open(FILE, '> eqemu_update.pl'); print FILE $response->decoded_content; close(FILE); }\"");
|
|
||||||
#else
|
|
||||||
system("wget --no-check-certificate -O eqemu_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Automatic (Database) Upgrade Script
|
|
||||||
Script: eqemu_update.pl V 1 - the number that world passes to the script will
|
|
||||||
force the script to check for a newer version to update itself with
|
|
||||||
eqemu_update.pl ran_from_world - won't bring up a menu if your database versions match
|
|
||||||
eqemu_update.pl - ran standalone will bring up a menu prompt
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Check for a new version of this script, the arg passed
|
|
||||||
would have to be higher than the copy they have downloaded
|
|
||||||
locally and they will re fetch */
|
|
||||||
system("perl eqemu_update.pl V 14");
|
|
||||||
|
|
||||||
/* Run Automatic Database Upgrade Script */
|
|
||||||
system("perl eqemu_update.pl ran_from_world");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1393,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
|||||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||||
/* Run Material Color Convert */
|
/* Run Material Color Convert */
|
||||||
first_entry = 0; rquery = "";
|
first_entry = 0; rquery = "";
|
||||||
for (i = 0; i < EQEmu::legacy::MaterialCount; i++){
|
for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){
|
||||||
if (pp->item_tint[i].color > 0){
|
if (pp->item_tint[i].color > 0){
|
||||||
if (first_entry != 1){
|
if (first_entry != 1){
|
||||||
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
||||||
|
|||||||
+9
-7
@@ -110,8 +110,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
|||||||
|
|
||||||
/* Implement Logging at the Root */
|
/* Implement Logging at the Root */
|
||||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||||
if (Log.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
||||||
Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||||
@@ -127,12 +127,14 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
|||||||
|
|
||||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||||
|
|
||||||
if (Log.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
||||||
{
|
{
|
||||||
if ((strncasecmp(query, "select", 6) == 0))
|
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||||
Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s");
|
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s");
|
||||||
else
|
}
|
||||||
Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s");
|
else {
|
||||||
|
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return requestResult;
|
return requestResult;
|
||||||
|
|||||||
+3
-2
@@ -49,7 +49,7 @@ namespace EQEmu
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum DeityTypeBit : uint32 {
|
enum DeityTypeBit : uint32 {
|
||||||
bit_DeityAll = 0x00000000,
|
bit_DeityNone = 0x00000000,
|
||||||
bit_DeityAgnostic = 0x00000001,
|
bit_DeityAgnostic = 0x00000001,
|
||||||
bit_DeityBertoxxulous = 0x00000002,
|
bit_DeityBertoxxulous = 0x00000002,
|
||||||
bit_DeityBrellSirilis = 0x00000004,
|
bit_DeityBrellSirilis = 0x00000004,
|
||||||
@@ -66,7 +66,8 @@ namespace EQEmu
|
|||||||
bit_DeitySolusekRo = 0x00002000,
|
bit_DeitySolusekRo = 0x00002000,
|
||||||
bit_DeityTheTribunal = 0x00004000,
|
bit_DeityTheTribunal = 0x00004000,
|
||||||
bit_DeityTunare = 0x00008000,
|
bit_DeityTunare = 0x00008000,
|
||||||
bit_DeityVeeshan = 0x00010000
|
bit_DeityVeeshan = 0x00010000,
|
||||||
|
bit_DeityAll = 0xFFFFFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DeityTypeBit ConvertDeityTypeToDeityTypeBit(DeityType deity_type);
|
extern DeityTypeBit ConvertDeityTypeToDeityTypeBit(DeityType deity_type);
|
||||||
|
|||||||
@@ -18,3 +18,68 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "emu_constants.h"
|
#include "emu_constants.h"
|
||||||
|
|
||||||
|
|
||||||
|
const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) {
|
||||||
|
switch (category_id) {
|
||||||
|
case catVideo:
|
||||||
|
return "Video";
|
||||||
|
case catAudio:
|
||||||
|
return "Audio";
|
||||||
|
case catPathing:
|
||||||
|
return "Pathing";
|
||||||
|
case catQuest:
|
||||||
|
return "Quest";
|
||||||
|
case catTradeskills:
|
||||||
|
return "Tradeskills";
|
||||||
|
case catSpellStacking:
|
||||||
|
return "Spell stacking";
|
||||||
|
case catDoorsPortals:
|
||||||
|
return "Doors/Portals";
|
||||||
|
case catItems:
|
||||||
|
return "Items";
|
||||||
|
case catNPC:
|
||||||
|
return "NPC";
|
||||||
|
case catDialogs:
|
||||||
|
return "Dialogs";
|
||||||
|
case catLoNTCG:
|
||||||
|
return "LoN - TCG";
|
||||||
|
case catMercenaries:
|
||||||
|
return "Mercenaries";
|
||||||
|
case catOther:
|
||||||
|
default:
|
||||||
|
return "Other";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category_name) {
|
||||||
|
if (!category_name)
|
||||||
|
return catOther;
|
||||||
|
|
||||||
|
if (!strcmp(category_name, "Video"))
|
||||||
|
return catVideo;
|
||||||
|
if (!strcmp(category_name, "Audio"))
|
||||||
|
return catAudio;
|
||||||
|
if (!strcmp(category_name, "Pathing"))
|
||||||
|
return catPathing;
|
||||||
|
if (!strcmp(category_name, "Quest"))
|
||||||
|
return catQuest;
|
||||||
|
if (!strcmp(category_name, "Tradeskills"))
|
||||||
|
return catTradeskills;
|
||||||
|
if (!strcmp(category_name, "Spell stacking"))
|
||||||
|
return catSpellStacking;
|
||||||
|
if (!strcmp(category_name, "Doors/Portals"))
|
||||||
|
return catDoorsPortals;
|
||||||
|
if (!strcmp(category_name, "Items"))
|
||||||
|
return catItems;
|
||||||
|
if (!strcmp(category_name, "NPC"))
|
||||||
|
return catNPC;
|
||||||
|
if (!strcmp(category_name, "Dialogs"))
|
||||||
|
return catDialogs;
|
||||||
|
if (!strcmp(category_name, "LoN - TCG"))
|
||||||
|
return catLoNTCG;
|
||||||
|
if (!strcmp(category_name, "Mercenaries"))
|
||||||
|
return catMercenaries;
|
||||||
|
|
||||||
|
return catOther;
|
||||||
|
}
|
||||||
|
|||||||
+145
-4
@@ -22,11 +22,9 @@
|
|||||||
|
|
||||||
#include "eq_limits.h"
|
#include "eq_limits.h"
|
||||||
#include "emu_legacy.h"
|
#include "emu_legacy.h"
|
||||||
#include "inventory_version.h"
|
#include "emu_versions.h"
|
||||||
//#include "deity.h"
|
|
||||||
//#include "say_link.h"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
namespace EQEmu
|
namespace EQEmu
|
||||||
@@ -37,16 +35,159 @@ namespace EQEmu
|
|||||||
//using namespace RoF2::invbag;
|
//using namespace RoF2::invbag;
|
||||||
//using namespace RoF2::invaug;
|
//using namespace RoF2::invaug;
|
||||||
|
|
||||||
|
enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary
|
||||||
|
enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary
|
||||||
|
|
||||||
|
enum PossessionsSlots : int16 { // temporary
|
||||||
|
slotCharm = 0,
|
||||||
|
slotEar1,
|
||||||
|
slotHead,
|
||||||
|
slotFace,
|
||||||
|
slotEar2,
|
||||||
|
slotNeck, // 5
|
||||||
|
slotShoulders,
|
||||||
|
slotArms,
|
||||||
|
slotBack,
|
||||||
|
slotWrist1,
|
||||||
|
slotWrist2, // 10
|
||||||
|
slotRange,
|
||||||
|
slotHands,
|
||||||
|
slotPrimary,
|
||||||
|
slotSecondary,
|
||||||
|
slotFinger1, // 15
|
||||||
|
slotFinger2,
|
||||||
|
slotChest,
|
||||||
|
slotLegs,
|
||||||
|
slotFeet,
|
||||||
|
slotWaist, // 20
|
||||||
|
slotPowerSource = 9999,
|
||||||
|
slotAmmo = 21,
|
||||||
|
slotGeneral1,
|
||||||
|
slotGeneral2,
|
||||||
|
slotGeneral3,
|
||||||
|
slotGeneral4, // 25
|
||||||
|
slotGeneral5,
|
||||||
|
slotGeneral6,
|
||||||
|
slotGeneral7,
|
||||||
|
slotGeneral8,
|
||||||
|
slotCursor, // 30
|
||||||
|
slotCount
|
||||||
|
};
|
||||||
|
|
||||||
|
enum InventoryTypes : int16 { // temporary
|
||||||
|
typePossessions = 0,
|
||||||
|
typeBank,
|
||||||
|
typeSharedBank,
|
||||||
|
typeTrade,
|
||||||
|
typeWorld,
|
||||||
|
typeLimbo, // 5
|
||||||
|
typeTribute,
|
||||||
|
typeTrophyTribute,
|
||||||
|
typeGuildTribute,
|
||||||
|
typeMerchant,
|
||||||
|
typeDeleted, // 10
|
||||||
|
typeCorpse,
|
||||||
|
typeBazaar,
|
||||||
|
typeInspect,
|
||||||
|
typeRealEstate,
|
||||||
|
typeViewMODPC, // 15
|
||||||
|
typeViewMODBank,
|
||||||
|
typeViewMODSharedBank,
|
||||||
|
typeViewMODLimbo,
|
||||||
|
typeAltStorage,
|
||||||
|
typeArchived, // 20
|
||||||
|
typeMail,
|
||||||
|
typeGuildTrophyTribute,
|
||||||
|
typeKrono,
|
||||||
|
typeOther,
|
||||||
|
typeCount
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16 SlotCount(int16 type_index) { return 0; } // temporary
|
||||||
|
|
||||||
|
const int16 ContainerCount = 10; // temporary
|
||||||
|
const int16 SocketCount = 6; // temporary
|
||||||
|
|
||||||
} /*inventory*/
|
} /*inventory*/
|
||||||
|
|
||||||
namespace constants {
|
namespace constants {
|
||||||
const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2;
|
const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2;
|
||||||
const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit;
|
const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit;
|
||||||
|
|
||||||
|
const size_t SayLinkOpenerSize = 1;
|
||||||
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
||||||
|
const size_t SayLinkTextSize = 256; // this may be varied until it breaks something (tested:374) - the others are constant
|
||||||
|
const size_t SayLinkCloserSize = 1;
|
||||||
|
const size_t SayLinkMaximumSize = (SayLinkOpenerSize + SayLinkBodySize + SayLinkTextSize + SayLinkCloserSize);
|
||||||
|
|
||||||
|
const int LongBuffs = RoF2::constants::LongBuffs;
|
||||||
|
const int ShortBuffs = RoF2::constants::ShortBuffs;
|
||||||
|
const int DiscBuffs = RoF2::constants::DiscBuffs;
|
||||||
|
const int TotalBuffs = RoF2::constants::TotalBuffs;
|
||||||
|
const int NPCBuffs = RoF2::constants::NPCBuffs;
|
||||||
|
const int PetBuffs = RoF2::constants::PetBuffs;
|
||||||
|
const int MercBuffs = RoF2::constants::MercBuffs;
|
||||||
|
|
||||||
} /*constants*/
|
} /*constants*/
|
||||||
|
|
||||||
|
namespace bug {
|
||||||
|
enum CategoryID : uint32 {
|
||||||
|
catOther = 0,
|
||||||
|
catVideo,
|
||||||
|
catAudio,
|
||||||
|
catPathing,
|
||||||
|
catQuest,
|
||||||
|
catTradeskills,
|
||||||
|
catSpellStacking,
|
||||||
|
catDoorsPortals,
|
||||||
|
catItems,
|
||||||
|
catNPC,
|
||||||
|
catDialogs,
|
||||||
|
catLoNTCG,
|
||||||
|
catMercenaries
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OptionalInfoFlag : uint32 {
|
||||||
|
infoNoOptionalInfo = 0x0,
|
||||||
|
infoCanDuplicate = 0x1,
|
||||||
|
infoCrashBug = 0x2,
|
||||||
|
infoTargetInfo = 0x4,
|
||||||
|
infoCharacterFlags = 0x8,
|
||||||
|
infoUnknownValue = 0xFFFFFFF0
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* CategoryIDToCategoryName(CategoryID category_id);
|
||||||
|
CategoryID CategoryNameToCategoryID(const char* category_name);
|
||||||
|
|
||||||
|
} // namespace bug
|
||||||
|
|
||||||
|
enum class CastingSlot : uint32 {
|
||||||
|
Gem1 = 0,
|
||||||
|
Gem2 = 1,
|
||||||
|
Gem3 = 2,
|
||||||
|
Gem4 = 3,
|
||||||
|
Gem5 = 4,
|
||||||
|
Gem6 = 5,
|
||||||
|
Gem7 = 6,
|
||||||
|
Gem8 = 7,
|
||||||
|
Gem9 = 8,
|
||||||
|
Gem10 = 9,
|
||||||
|
Gem11 = 10,
|
||||||
|
Gem12 = 11,
|
||||||
|
MaxGems = 12,
|
||||||
|
Ability = 20, // HT/LoH for Tit
|
||||||
|
PotionBelt = 21, // Tit uses a different slot for PB
|
||||||
|
Item = 22,
|
||||||
|
Discipline = 23,
|
||||||
|
AltAbility = 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
} /*EQEmu*/
|
} /*EQEmu*/
|
||||||
|
|
||||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||||
|
|
||||||
|
/* hack list to prevent circular references
|
||||||
|
|
||||||
|
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
+16
-109
@@ -61,8 +61,6 @@ namespace EQEmu
|
|||||||
SLOT_GENERAL_6 = 27,
|
SLOT_GENERAL_6 = 27,
|
||||||
SLOT_GENERAL_7 = 28,
|
SLOT_GENERAL_7 = 28,
|
||||||
SLOT_GENERAL_8 = 29,
|
SLOT_GENERAL_8 = 29,
|
||||||
//SLOT_GENERAL_9 = not supported
|
|
||||||
//SLOT_GENERAL_10 = not supported
|
|
||||||
SLOT_CURSOR = 30,
|
SLOT_CURSOR = 30,
|
||||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||||
SLOT_TRADESKILL = 1000,
|
SLOT_TRADESKILL = 1000,
|
||||||
@@ -80,6 +78,8 @@ namespace EQEmu
|
|||||||
SLOT_CURSOR_BAG_END = 340,
|
SLOT_CURSOR_BAG_END = 340,
|
||||||
SLOT_TRIBUTE_BEGIN = 400,
|
SLOT_TRIBUTE_BEGIN = 400,
|
||||||
SLOT_TRIBUTE_END = 404,
|
SLOT_TRIBUTE_END = 404,
|
||||||
|
SLOT_GUILD_TRIBUTE_BEGIN = 450,
|
||||||
|
SLOT_GUILD_TRIBUTE_END = 451,
|
||||||
SLOT_BANK_BEGIN = 2000,
|
SLOT_BANK_BEGIN = 2000,
|
||||||
SLOT_BANK_END = 2023,
|
SLOT_BANK_END = 2023,
|
||||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||||
@@ -96,89 +96,8 @@ namespace EQEmu
|
|||||||
SLOT_WORLD_END = 4009
|
SLOT_WORLD_END = 4009
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InventoryTypes : int16 {
|
|
||||||
TypePossessions = 0,
|
|
||||||
TypeBank,
|
|
||||||
TypeSharedBank,
|
|
||||||
TypeTrade,
|
|
||||||
TypeWorld,
|
|
||||||
TypeLimbo, // 5
|
|
||||||
TypeTribute,
|
|
||||||
TypeTrophyTribute,
|
|
||||||
TypeGuildTribute,
|
|
||||||
TypeMerchant,
|
|
||||||
TypeDeleted, // 10
|
|
||||||
TypeCorpse,
|
|
||||||
TypeBazaar,
|
|
||||||
TypeInspect,
|
|
||||||
TypeRealEstate,
|
|
||||||
TypeViewMODPC, // 15
|
|
||||||
TypeViewMODBank,
|
|
||||||
TypeViewMODSharedBank,
|
|
||||||
TypeViewMODLimbo,
|
|
||||||
TypeAltStorage,
|
|
||||||
TypeArchived, // 20
|
|
||||||
TypeMail,
|
|
||||||
TypeGuildTrophyTribute,
|
|
||||||
TypeKrono,
|
|
||||||
TypeOther,
|
|
||||||
TypeCount
|
|
||||||
};
|
|
||||||
|
|
||||||
enum PossessionsSlots : int16 {
|
|
||||||
SlotCharm = 0,
|
|
||||||
SlotEar1,
|
|
||||||
SlotHead,
|
|
||||||
SlotFace,
|
|
||||||
SlotEar2,
|
|
||||||
SlotNeck, // 5
|
|
||||||
SlotShoulders,
|
|
||||||
SlotArms,
|
|
||||||
SlotBack,
|
|
||||||
SlotWrist1,
|
|
||||||
SlotWrist2, // 10
|
|
||||||
SlotRange,
|
|
||||||
SlotHands,
|
|
||||||
SlotPrimary,
|
|
||||||
SlotSecondary,
|
|
||||||
SlotFinger1, // 15
|
|
||||||
SlotFinger2,
|
|
||||||
SlotChest,
|
|
||||||
SlotLegs,
|
|
||||||
SlotFeet,
|
|
||||||
SlotWaist, // 20
|
|
||||||
SlotPowerSource = 9999, // temp
|
|
||||||
SlotAmmo = 21, // temp
|
|
||||||
SlotGeneral1,
|
|
||||||
SlotGeneral2,
|
|
||||||
SlotGeneral3,
|
|
||||||
SlotGeneral4, // 25
|
|
||||||
SlotGeneral5,
|
|
||||||
SlotGeneral6,
|
|
||||||
SlotGeneral7,
|
|
||||||
SlotGeneral8,
|
|
||||||
//SlotGeneral9,
|
|
||||||
//SlotGeneral10,
|
|
||||||
SlotCursor, // 30
|
|
||||||
SlotCount
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MaterialSlots : uint8 {
|
|
||||||
MaterialHead = 0,
|
|
||||||
MaterialChest,
|
|
||||||
MaterialArms,
|
|
||||||
MaterialWrist,
|
|
||||||
MaterialHands,
|
|
||||||
MaterialLegs, // 5
|
|
||||||
MaterialFeet,
|
|
||||||
MaterialPrimary,
|
|
||||||
MaterialSecondary,
|
|
||||||
MaterialCount,
|
|
||||||
MaterialInvalid = 255
|
|
||||||
};
|
|
||||||
|
|
||||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||||
static const uint16 TYPE_POSSESSIONS_SIZE = SlotCount;
|
static const uint16 TYPE_POSSESSIONS_SIZE = 31;
|
||||||
static const uint16 TYPE_BANK_SIZE = 24;
|
static const uint16 TYPE_BANK_SIZE = 24;
|
||||||
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
|
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
|
||||||
static const uint16 TYPE_TRADE_SIZE = 8;
|
static const uint16 TYPE_TRADE_SIZE = 8;
|
||||||
@@ -189,14 +108,14 @@ namespace EQEmu
|
|||||||
static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0;
|
static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0;
|
||||||
static const uint16 TYPE_MERCHANT_SIZE = 0;
|
static const uint16 TYPE_MERCHANT_SIZE = 0;
|
||||||
static const uint16 TYPE_DELETED_SIZE = 0;
|
static const uint16 TYPE_DELETED_SIZE = 0;
|
||||||
static const uint16 TYPE_CORPSE_SIZE = SlotCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
static const uint16 TYPE_CORPSE_SIZE = 31; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
||||||
static const uint16 TYPE_BAZAAR_SIZE = 80;
|
static const uint16 TYPE_BAZAAR_SIZE = 80;
|
||||||
static const uint16 TYPE_INSPECT_SIZE = 22;
|
static const uint16 TYPE_INSPECT_SIZE = 22;
|
||||||
static const uint16 TYPE_REAL_ESTATE_SIZE = 0;
|
static const uint16 TYPE_REAL_ESTATE_SIZE = 0;
|
||||||
static const uint16 TYPE_VIEW_MOD_PC_SIZE = 0;//NOT_USED;
|
static const uint16 TYPE_VIEW_MOD_PC_SIZE = 0;
|
||||||
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;//NOT_USED;
|
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;
|
||||||
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;//NOT_USED;
|
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;
|
||||||
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;//NOT_USED;
|
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;
|
||||||
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
|
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
|
||||||
static const uint16 TYPE_ARCHIVED_SIZE = 0;
|
static const uint16 TYPE_ARCHIVED_SIZE = 0;
|
||||||
static const uint16 TYPE_MAIL_SIZE = 0;
|
static const uint16 TYPE_MAIL_SIZE = 0;
|
||||||
@@ -206,12 +125,12 @@ namespace EQEmu
|
|||||||
|
|
||||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||||
static const int16 EQUIPMENT_BEGIN = SlotCharm;
|
static const int16 EQUIPMENT_BEGIN = 0;
|
||||||
static const int16 EQUIPMENT_END = SlotAmmo;
|
static const int16 EQUIPMENT_END = 21;
|
||||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||||
|
|
||||||
static const int16 GENERAL_BEGIN = SlotGeneral1;
|
static const int16 GENERAL_BEGIN = 22;
|
||||||
static const int16 GENERAL_END = SlotGeneral8;
|
static const int16 GENERAL_END = 29;
|
||||||
static const uint16 GENERAL_SIZE = 8;
|
static const uint16 GENERAL_SIZE = 8;
|
||||||
static const int16 GENERAL_BAGS_BEGIN = 251;
|
static const int16 GENERAL_BAGS_BEGIN = 251;
|
||||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||||
@@ -249,27 +168,15 @@ namespace EQEmu
|
|||||||
static const int16 TRIBUTE_SIZE = TYPE_TRIBUTE_SIZE;
|
static const int16 TRIBUTE_SIZE = TYPE_TRIBUTE_SIZE;
|
||||||
|
|
||||||
static const int16 CORPSE_BEGIN = 22;
|
static const int16 CORPSE_BEGIN = 22;
|
||||||
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
|
|
||||||
|
|
||||||
static const int16 MATERIAL_BEGIN = MaterialHead;
|
|
||||||
static const int16 MATERIAL_END = MaterialSecondary;
|
|
||||||
static const int16 MATERIAL_TINT_END = MaterialFeet;
|
|
||||||
static const int16 MATERIAL_SIZE = MaterialCount;
|
|
||||||
|
|
||||||
// items
|
|
||||||
// common and container sizes will not increase until the new 'location' struct is implemented
|
|
||||||
static const uint16 ITEM_COMMON_SIZE = 6;//RoF::consts::ITEM_COMMON_SIZE;
|
|
||||||
static const uint16 ITEM_CONTAINER_SIZE = 10;//Titanium::consts::ITEM_CONTAINER_SIZE;
|
|
||||||
|
|
||||||
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||||
static const size_t BANDOLIERS_SIZE = 20;//RoF2::consts::BANDOLIERS_SIZE; // number of bandolier instances
|
static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances
|
||||||
static const size_t BANDOLIER_ITEM_COUNT = 4;//RoF2::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance
|
static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance
|
||||||
|
|
||||||
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||||
static const size_t POTION_BELT_ITEM_COUNT = 5;//RoF2::consts::POTION_BELT_ITEM_COUNT;
|
static const size_t POTION_BELT_ITEM_COUNT = 5;
|
||||||
|
|
||||||
static const size_t TEXT_LINK_BODY_LENGTH = 56;//RoF2::consts::TEXT_LINK_BODY_LENGTH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* COMMON_EMU_LEGACY_H */
|
#endif /* COMMON_EMU_LEGACY_H */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
are required to give you total support for your newly bought product;
|
are required to give you total support for your newly bought product;
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
|
|||||||
+58
-10
@@ -1,4 +1,4 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
are required to give you total support for your newly bought product;
|
are required to give you total support for your newly bought product;
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
@@ -27,29 +27,77 @@
|
|||||||
|
|
||||||
namespace EntityLimits
|
namespace EntityLimits
|
||||||
{
|
{
|
||||||
namespace npc {
|
namespace NPC {
|
||||||
enum : int { Invalid = -1, Null, Safety };
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
enum : bool { False = false, True = true };
|
enum : bool { False = false, True = true };
|
||||||
}
|
|
||||||
|
|
||||||
namespace merc {
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*NPC*/
|
||||||
|
|
||||||
|
namespace NPCMerchant {
|
||||||
enum : int { Invalid = -1, Null, Safety };
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
enum : bool { False = false, True = true };
|
enum : bool { False = false, True = true };
|
||||||
}
|
|
||||||
|
|
||||||
namespace bot {
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*NPCMerchant*/
|
||||||
|
|
||||||
|
namespace Merc {
|
||||||
enum : int { Invalid = -1, Null, Safety };
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
enum : bool { False = false, True = true };
|
enum : bool { False = false, True = true };
|
||||||
}
|
|
||||||
|
|
||||||
namespace pet {
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*Merc*/
|
||||||
|
|
||||||
|
namespace Bot {
|
||||||
enum : int { Invalid = -1, Null, Safety };
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
enum : bool { False = false, True = true };
|
enum : bool { False = false, True = true };
|
||||||
}
|
|
||||||
|
const size_t InvTypeTradeSize = 8;
|
||||||
|
|
||||||
|
} /*Bot*/
|
||||||
|
|
||||||
|
namespace ClientPet {
|
||||||
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
|
enum : bool { False = false, True = true };
|
||||||
|
|
||||||
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*Pet*/
|
||||||
|
|
||||||
|
namespace NPCPet {
|
||||||
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
|
enum : bool { False = false, True = true };
|
||||||
|
|
||||||
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*Pet*/
|
||||||
|
|
||||||
|
namespace MercPet {
|
||||||
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
|
enum : bool { False = false, True = true };
|
||||||
|
|
||||||
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*Pet*/
|
||||||
|
|
||||||
|
namespace BotPet {
|
||||||
|
enum : int { Invalid = -1, Null, Safety };
|
||||||
|
|
||||||
|
enum : bool { False = false, True = true };
|
||||||
|
|
||||||
|
const size_t InvTypeTradeSize = 4;
|
||||||
|
|
||||||
|
} /*Pet*/
|
||||||
|
|
||||||
}; /*EntityLimits*/
|
}; /*EntityLimits*/
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ N(OP_AcceptNewTask),
|
|||||||
N(OP_AckPacket),
|
N(OP_AckPacket),
|
||||||
N(OP_Action),
|
N(OP_Action),
|
||||||
N(OP_Action2),
|
N(OP_Action2),
|
||||||
|
N(OP_AddNimbusEffect),
|
||||||
N(OP_AdventureData),
|
N(OP_AdventureData),
|
||||||
N(OP_AdventureDetails),
|
N(OP_AdventureDetails),
|
||||||
N(OP_AdventureFinish),
|
N(OP_AdventureFinish),
|
||||||
@@ -25,6 +26,9 @@ N(OP_AdventureRequest),
|
|||||||
N(OP_AdventureStatsReply),
|
N(OP_AdventureStatsReply),
|
||||||
N(OP_AdventureStatsRequest),
|
N(OP_AdventureStatsRequest),
|
||||||
N(OP_AdventureUpdate),
|
N(OP_AdventureUpdate),
|
||||||
|
N(OP_AggroMeterLockTarget),
|
||||||
|
N(OP_AggroMeterTargetInfo),
|
||||||
|
N(OP_AggroMeterUpdate),
|
||||||
N(OP_AltCurrency),
|
N(OP_AltCurrency),
|
||||||
N(OP_AltCurrencyMerchantReply),
|
N(OP_AltCurrencyMerchantReply),
|
||||||
N(OP_AltCurrencyMerchantRequest),
|
N(OP_AltCurrencyMerchantRequest),
|
||||||
@@ -64,6 +68,7 @@ N(OP_BuffRemoveRequest),
|
|||||||
N(OP_Bug),
|
N(OP_Bug),
|
||||||
N(OP_CameraEffect),
|
N(OP_CameraEffect),
|
||||||
N(OP_Camp),
|
N(OP_Camp),
|
||||||
|
N(OP_CancelSneakHide),
|
||||||
N(OP_CancelTask),
|
N(OP_CancelTask),
|
||||||
N(OP_CancelTrade),
|
N(OP_CancelTrade),
|
||||||
N(OP_CastSpell),
|
N(OP_CastSpell),
|
||||||
@@ -288,6 +293,7 @@ N(OP_LFGuild),
|
|||||||
N(OP_LFPCommand),
|
N(OP_LFPCommand),
|
||||||
N(OP_LFPGetMatchesRequest),
|
N(OP_LFPGetMatchesRequest),
|
||||||
N(OP_LFPGetMatchesResponse),
|
N(OP_LFPGetMatchesResponse),
|
||||||
|
N(OP_LinkedReuse),
|
||||||
N(OP_LoadSpellSet),
|
N(OP_LoadSpellSet),
|
||||||
N(OP_LocInfo),
|
N(OP_LocInfo),
|
||||||
N(OP_LockoutTimerInfo),
|
N(OP_LockoutTimerInfo),
|
||||||
@@ -334,6 +340,7 @@ N(OP_MOTD),
|
|||||||
N(OP_MoveCoin),
|
N(OP_MoveCoin),
|
||||||
N(OP_MoveDoor),
|
N(OP_MoveDoor),
|
||||||
N(OP_MoveItem),
|
N(OP_MoveItem),
|
||||||
|
N(OP_MoveMultipleItems),
|
||||||
N(OP_MoveLogDisregard),
|
N(OP_MoveLogDisregard),
|
||||||
N(OP_MoveLogRequest),
|
N(OP_MoveLogRequest),
|
||||||
N(OP_MultiLineMsg),
|
N(OP_MultiLineMsg),
|
||||||
@@ -350,6 +357,7 @@ N(OP_OpenTributeMaster),
|
|||||||
N(OP_PDeletePetition),
|
N(OP_PDeletePetition),
|
||||||
N(OP_PetBuffWindow),
|
N(OP_PetBuffWindow),
|
||||||
N(OP_PetCommands),
|
N(OP_PetCommands),
|
||||||
|
N(OP_PetCommandState),
|
||||||
N(OP_PetHoTT),
|
N(OP_PetHoTT),
|
||||||
N(OP_Petition),
|
N(OP_Petition),
|
||||||
N(OP_PetitionBug),
|
N(OP_PetitionBug),
|
||||||
@@ -385,6 +393,7 @@ N(OP_PVPLeaderBoardReply),
|
|||||||
N(OP_PVPLeaderBoardRequest),
|
N(OP_PVPLeaderBoardRequest),
|
||||||
N(OP_PVPStats),
|
N(OP_PVPStats),
|
||||||
N(OP_QueryResponseThing),
|
N(OP_QueryResponseThing),
|
||||||
|
N(OP_QueryUCSServerStatus),
|
||||||
N(OP_RaidInvite),
|
N(OP_RaidInvite),
|
||||||
N(OP_RaidJoin),
|
N(OP_RaidJoin),
|
||||||
N(OP_RaidUpdate),
|
N(OP_RaidUpdate),
|
||||||
@@ -402,6 +411,7 @@ N(OP_ReloadUI),
|
|||||||
N(OP_RemoveAllDoors),
|
N(OP_RemoveAllDoors),
|
||||||
N(OP_RemoveBlockedBuffs),
|
N(OP_RemoveBlockedBuffs),
|
||||||
N(OP_RemoveNimbusEffect),
|
N(OP_RemoveNimbusEffect),
|
||||||
|
N(OP_RemoveTrap),
|
||||||
N(OP_Report),
|
N(OP_Report),
|
||||||
N(OP_ReqClientSpawn),
|
N(OP_ReqClientSpawn),
|
||||||
N(OP_ReqNewZone),
|
N(OP_ReqNewZone),
|
||||||
@@ -517,6 +527,7 @@ N(OP_TributeToggle),
|
|||||||
N(OP_TributeUpdate),
|
N(OP_TributeUpdate),
|
||||||
N(OP_Untargetable),
|
N(OP_Untargetable),
|
||||||
N(OP_UpdateAA),
|
N(OP_UpdateAA),
|
||||||
|
N(OP_UpdateAura),
|
||||||
N(OP_UpdateLeadershipAA),
|
N(OP_UpdateLeadershipAA),
|
||||||
N(OP_VetClaimReply),
|
N(OP_VetClaimReply),
|
||||||
N(OP_VetClaimRequest),
|
N(OP_VetClaimRequest),
|
||||||
|
|||||||
@@ -1,818 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
There are really two or three different objects shoe-hored into this
|
|
||||||
connection object. Sombody really needs to factor out the relay link
|
|
||||||
crap into its own subclass of this object, it will clean things up
|
|
||||||
tremendously.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../common/global_define.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "emu_tcp_connection.h"
|
|
||||||
#include "emu_tcp_server.h"
|
|
||||||
#include "../common/servertalk.h"
|
|
||||||
|
|
||||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
|
||||||
#define MSG_NOSIGNAL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TCPN_DEBUG 0
|
|
||||||
#define TCPN_DEBUG_Console 0
|
|
||||||
#define TCPN_DEBUG_Memory 0
|
|
||||||
#define TCPN_LOG_PACKETS 0
|
|
||||||
#define TCPN_LOG_RAW_DATA_OUT 0
|
|
||||||
#define TCPN_LOG_RAW_DATA_IN 0
|
|
||||||
|
|
||||||
|
|
||||||
//server side case
|
|
||||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_socket, uint32 irIP, uint16 irPort, bool iOldFormat)
|
|
||||||
: TCPConnection(ID, in_socket, irIP, irPort),
|
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
Server = nullptr;
|
|
||||||
pOldFormat = iOldFormat;
|
|
||||||
#ifdef MINILOGIN
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeLogin;
|
|
||||||
#else
|
|
||||||
if (pOldFormat)
|
|
||||||
TCPMode = modePacket;
|
|
||||||
else
|
|
||||||
TCPMode = modeConsole;
|
|
||||||
PacketMode = packetModeZone;
|
|
||||||
#endif
|
|
||||||
RelayLink = 0;
|
|
||||||
RelayServer = false;
|
|
||||||
RelayCount = 0;
|
|
||||||
RemoteID = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//client outgoing connection case (and client side relay)
|
|
||||||
EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer, eTCPMode iMode)
|
|
||||||
: TCPConnection(),
|
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
|
||||||
{
|
|
||||||
Server = iRelayServer;
|
|
||||||
if (Server)
|
|
||||||
RelayServer = true;
|
|
||||||
else
|
|
||||||
RelayServer = false;
|
|
||||||
RelayLink = 0;
|
|
||||||
RelayCount = 0;
|
|
||||||
RemoteID = 0;
|
|
||||||
pOldFormat = iOldFormat;
|
|
||||||
TCPMode = iMode;
|
|
||||||
PacketMode = packetModeZone;
|
|
||||||
#if TCPN_DEBUG_Memory >= 7
|
|
||||||
std::cout << "Constructor #1 on outgoing TCP# " << GetID() << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//server side relay case
|
|
||||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort)
|
|
||||||
: TCPConnection(ID, 0, irIP, irPort),
|
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
|
||||||
{
|
|
||||||
Server = iServer;
|
|
||||||
RelayLink = iRelayLink;
|
|
||||||
RelayServer = true;
|
|
||||||
RelayCount = 0;
|
|
||||||
RemoteID = iRemoteID;
|
|
||||||
pOldFormat = false;
|
|
||||||
ConnectionType = Incoming;
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeZone;
|
|
||||||
#if TCPN_DEBUG_Memory >= 7
|
|
||||||
std::cout << "Constructor #3 on outgoing TCP# " << GetID() << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
EmuTCPConnection::~EmuTCPConnection() {
|
|
||||||
//the queues free their content right now I believe.
|
|
||||||
}
|
|
||||||
|
|
||||||
EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32 iDestination) {
|
|
||||||
int32 size = sizeof(EmuTCPNetPacket_Struct) + pack->size;
|
|
||||||
if (pack->compressed) {
|
|
||||||
size += 4;
|
|
||||||
}
|
|
||||||
if (iDestination) {
|
|
||||||
size += 4;
|
|
||||||
}
|
|
||||||
EmuTCPNetPacket_Struct* tnps = (EmuTCPNetPacket_Struct*) new uchar[size];
|
|
||||||
tnps->size = size;
|
|
||||||
tnps->opcode = pack->opcode;
|
|
||||||
*((uint8*) &tnps->flags) = 0;
|
|
||||||
uchar* buffer = tnps->buffer;
|
|
||||||
if (pack->compressed) {
|
|
||||||
tnps->flags.compressed = 1;
|
|
||||||
*((int32*) buffer) = pack->InflatedSize;
|
|
||||||
buffer += 4;
|
|
||||||
}
|
|
||||||
if (iDestination) {
|
|
||||||
tnps->flags.destination = 1;
|
|
||||||
*((int32*) buffer) = iDestination;
|
|
||||||
buffer += 4;
|
|
||||||
}
|
|
||||||
memcpy(buffer, pack->pBuffer, pack->size);
|
|
||||||
return tnps;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPackSendQueue* EmuTCPConnection::MakeOldPacket(ServerPacket* pack) {
|
|
||||||
SPackSendQueue* spsq = (SPackSendQueue*) new uchar[sizeof(SPackSendQueue) + pack->size + 4];
|
|
||||||
if (pack->pBuffer != 0 && pack->size != 0)
|
|
||||||
memcpy((char *) &spsq->buffer[4], (char *) pack->pBuffer, pack->size);
|
|
||||||
memcpy((char *) &spsq->buffer[0], (char *) &pack->opcode, 2);
|
|
||||||
spsq->size = pack->size+4;
|
|
||||||
memcpy((char *) &spsq->buffer[2], (char *) &spsq->size, 2);
|
|
||||||
return spsq;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
|
||||||
if (!Connected())
|
|
||||||
return false;
|
|
||||||
eTCPMode tmp = GetMode();
|
|
||||||
if (tmp != modePacket && tmp != modeTransition)
|
|
||||||
return false;
|
|
||||||
LockMutex lock(&MState);
|
|
||||||
if (RemoteID)
|
|
||||||
return RelayLink->SendPacket(pack, RemoteID);
|
|
||||||
else if (pOldFormat) {
|
|
||||||
#if TCPN_LOG_PACKETS >= 1
|
|
||||||
if (pack && pack->opcode != 0) {
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
CoutTimestamp(true);
|
|
||||||
std::cout << ": Logging outgoing TCP OldPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
|
||||||
#if TCPN_LOG_PACKETS == 2
|
|
||||||
if (pack->size >= 32)
|
|
||||||
DumpPacket(pack->pBuffer, 32);
|
|
||||||
else
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
#if TCPN_LOG_PACKETS >= 3
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SPackSendQueue* spsq = MakeOldPacket(pack);
|
|
||||||
ServerSendQueuePushEnd(spsq->buffer, spsq->size);
|
|
||||||
safe_delete_array(spsq);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EmuTCPNetPacket_Struct* tnps = MakePacket(pack, iDestination);
|
|
||||||
if (tmp == modeTransition) {
|
|
||||||
InModeQueuePush(tnps);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if TCPN_LOG_PACKETS >= 1
|
|
||||||
if (pack && pack->opcode != 0) {
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
CoutTimestamp(true);
|
|
||||||
std::cout << ": Logging outgoing TCP packet. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
|
||||||
#if TCPN_LOG_PACKETS == 2
|
|
||||||
if (pack->size >= 32)
|
|
||||||
DumpPacket(pack->pBuffer, 32);
|
|
||||||
else
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
#if TCPN_LOG_PACKETS >= 3
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ServerSendQueuePushEnd((uchar**) &tnps, tnps->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
|
||||||
if (RemoteID)
|
|
||||||
return false;
|
|
||||||
if (!Connected())
|
|
||||||
return false;
|
|
||||||
if (GetMode() != modePacket)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
LockMutex lock(&MState);
|
|
||||||
eTCPMode tmp = GetMode();
|
|
||||||
if (tmp == modeTransition) {
|
|
||||||
EmuTCPNetPacket_Struct* tnps2 = (EmuTCPNetPacket_Struct*) new uchar[tnps->size];
|
|
||||||
memcpy(tnps2, tnps, tnps->size);
|
|
||||||
InModeQueuePush(tnps2);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#if TCPN_LOG_PACKETS >= 1
|
|
||||||
if (tnps && tnps->opcode != 0) {
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
CoutTimestamp(true);
|
|
||||||
std::cout << ": Logging outgoing TCP NetPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << tnps->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << tnps->size << " " << inet_ntoa(in) << ":" << GetrPort();
|
|
||||||
if (pOldFormat)
|
|
||||||
std::cout << " (OldFormat)";
|
|
||||||
std::cout << std::endl;
|
|
||||||
#if TCPN_LOG_PACKETS == 2
|
|
||||||
if (tnps->size >= 32)
|
|
||||||
DumpPacket((uchar*) tnps, 32);
|
|
||||||
else
|
|
||||||
DumpPacket((uchar*) tnps, tnps->size);
|
|
||||||
#endif
|
|
||||||
#if TCPN_LOG_PACKETS >= 3
|
|
||||||
DumpPacket((uchar*) tnps, tnps->size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ServerSendQueuePushEnd((const uchar*) tnps, tnps->size);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerPacket* EmuTCPConnection::PopPacket() {
|
|
||||||
ServerPacket* ret;
|
|
||||||
if (!MOutQueueLock.trylock())
|
|
||||||
return nullptr;
|
|
||||||
ret = OutQueue.pop();
|
|
||||||
MOutQueueLock.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::InModeQueuePush(EmuTCPNetPacket_Struct* tnps) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
InModeQueue.push(tnps);
|
|
||||||
MSendQueue.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::OutQueuePush(ServerPacket* pack) {
|
|
||||||
MOutQueueLock.lock();
|
|
||||||
OutQueue.push(pack);
|
|
||||||
MOutQueueLock.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
|
||||||
#if defined(GOTFRAGS) && 0
|
|
||||||
if (strcmp(line, "**CRASHME**") == 0) {
|
|
||||||
int i = 0;
|
|
||||||
std::cout << (5 / i) << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(line[0] == '*') {
|
|
||||||
if (strcmp(line, "**PACKETMODE**") == 0) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
if (TCPMode == modeConsole)
|
|
||||||
Send((const uchar*) "\0**PACKETMODE**\r", 16);
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeLogin;
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop())) {
|
|
||||||
SendPacket(tnps);
|
|
||||||
safe_delete_array(tnps);
|
|
||||||
}
|
|
||||||
MSendQueue.unlock();
|
|
||||||
safe_delete_array(line);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (strcmp(line, "**PACKETMODEZONE**") == 0) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
if (TCPMode == modeConsole)
|
|
||||||
Send((const uchar*) "\0**PACKETMODEZONE**\r", 20);
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeZone;
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop())) {
|
|
||||||
SendPacket(tnps);
|
|
||||||
safe_delete_array(tnps);
|
|
||||||
}
|
|
||||||
MSendQueue.unlock();
|
|
||||||
safe_delete_array(line);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (strcmp(line, "**PACKETMODELAUNCHER**") == 0) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
if (TCPMode == modeConsole)
|
|
||||||
Send((const uchar*) "\0**PACKETMODELAUNCHER**\r", 24);
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeLauncher;
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop())) {
|
|
||||||
SendPacket(tnps);
|
|
||||||
safe_delete_array(tnps);
|
|
||||||
}
|
|
||||||
MSendQueue.unlock();
|
|
||||||
safe_delete_array(line);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (strcmp(line, "**PACKETMODEUCS**") == 0) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
if (TCPMode == modeConsole)
|
|
||||||
Send((const uchar*) "\0**PACKETMODEUCS**\r", 19);
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeUCS;
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop())) {
|
|
||||||
SendPacket(tnps);
|
|
||||||
safe_delete_array(tnps);
|
|
||||||
}
|
|
||||||
MSendQueue.unlock();
|
|
||||||
safe_delete_array(line);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (strcmp(line, "**PACKETMODEQS**") == 0) {
|
|
||||||
MSendQueue.lock();
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
if (TCPMode == modeConsole)
|
|
||||||
Send((const uchar*) "\0**PACKETMODEQS**\r", 18);
|
|
||||||
TCPMode = modePacket;
|
|
||||||
PacketMode = packetModeQueryServ;
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop())) {
|
|
||||||
SendPacket(tnps);
|
|
||||||
safe_delete_array(tnps);
|
|
||||||
}
|
|
||||||
MSendQueue.unlock();
|
|
||||||
safe_delete_array(line);
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TCPConnection::LineOutQueuePush(line));
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) {
|
|
||||||
TCPConnection::Disconnect();
|
|
||||||
|
|
||||||
if (RelayLink) {
|
|
||||||
RelayLink->RemoveRelay(this, iSendRelayDisconnect);
|
|
||||||
RelayLink = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
|
|
||||||
if(!TCPConnection::ConnectIP(irIP, irPort, errbuf))
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
MSendQueue.lock();
|
|
||||||
#ifdef MINILOGIN
|
|
||||||
TCPMode = modePacket;
|
|
||||||
#else
|
|
||||||
if (pOldFormat) {
|
|
||||||
TCPMode = modePacket;
|
|
||||||
}
|
|
||||||
else if (TCPMode == modePacket || TCPMode == modeTransition) {
|
|
||||||
TCPMode = modeTransition;
|
|
||||||
if(PacketMode == packetModeLauncher) {
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
sendbuf_size = 24;
|
|
||||||
sendbuf_used = sendbuf_size;
|
|
||||||
sendbuf = new uchar[sendbuf_size];
|
|
||||||
memcpy(sendbuf, "\0**PACKETMODELAUNCHER**\r", sendbuf_size);
|
|
||||||
} else if(PacketMode == packetModeLogin) {
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
sendbuf_size = 16;
|
|
||||||
sendbuf_used = sendbuf_size;
|
|
||||||
sendbuf = new uchar[sendbuf_size];
|
|
||||||
memcpy(sendbuf, "\0**PACKETMODE**\r", sendbuf_size);
|
|
||||||
} else if(PacketMode == packetModeUCS) {
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
sendbuf_size = 19;
|
|
||||||
sendbuf_used = sendbuf_size;
|
|
||||||
sendbuf = new uchar[sendbuf_size];
|
|
||||||
memcpy(sendbuf, "\0**PACKETMODEUCS**\r", sendbuf_size);
|
|
||||||
}
|
|
||||||
else if(PacketMode == packetModeQueryServ) {
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
sendbuf_size = 18;
|
|
||||||
sendbuf_used = sendbuf_size;
|
|
||||||
sendbuf = new uchar[sendbuf_size];
|
|
||||||
memcpy(sendbuf, "\0**PACKETMODEQS**\r", sendbuf_size);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//default: packetModeZone
|
|
||||||
safe_delete_array(sendbuf);
|
|
||||||
sendbuf_size = 20;
|
|
||||||
sendbuf_used = sendbuf_size;
|
|
||||||
sendbuf = new uchar[sendbuf_size];
|
|
||||||
memcpy(sendbuf, "\0**PACKETMODEZONE**\r", sendbuf_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
MSendQueue.unlock();
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::ClearBuffers() {
|
|
||||||
TCPConnection::ClearBuffers();
|
|
||||||
|
|
||||||
LockMutex lock2(&MOutQueueLock);
|
|
||||||
ServerPacket* pack = 0;
|
|
||||||
while ((pack = OutQueue.pop()))
|
|
||||||
safe_delete(pack);
|
|
||||||
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
while ((tnps = InModeQueue.pop()))
|
|
||||||
safe_delete(tnps);
|
|
||||||
|
|
||||||
keepalive_timer.Start();
|
|
||||||
timeout_timer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
|
||||||
#if TCPC_DEBUG >= 1
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
std::cout "NetError: '";
|
|
||||||
if (reason)
|
|
||||||
std::cout << reason;
|
|
||||||
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
|
||||||
#endif
|
|
||||||
auto pack = new ServerPacket(0);
|
|
||||||
pack->size = 1;
|
|
||||||
if (reason)
|
|
||||||
pack->size += strlen(reason) + 1;
|
|
||||||
pack->pBuffer = new uchar[pack->size];
|
|
||||||
memset(pack->pBuffer, 0, pack->size);
|
|
||||||
pack->pBuffer[0] = 255;
|
|
||||||
strcpy((char *)&pack->pBuffer[1], reason);
|
|
||||||
SendPacket(pack);
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect) {
|
|
||||||
if (iSendRelayDisconnect) {
|
|
||||||
auto pack = new ServerPacket(0, 5);
|
|
||||||
pack->pBuffer[0] = 3;
|
|
||||||
*((uint32*) &pack->pBuffer[1]) = relay->GetRemoteID();
|
|
||||||
SendPacket(pack);
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
|
||||||
RelayCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool EmuTCPConnection::ProcessReceivedData(char* errbuf) {
|
|
||||||
if (errbuf)
|
|
||||||
errbuf[0] = 0;
|
|
||||||
timeout_timer.Start();
|
|
||||||
if (!recvbuf)
|
|
||||||
return true;
|
|
||||||
if (TCPMode == modePacket) {
|
|
||||||
if (pOldFormat)
|
|
||||||
return ProcessReceivedDataAsOldPackets(errbuf);
|
|
||||||
else
|
|
||||||
return ProcessReceivedDataAsPackets(errbuf);
|
|
||||||
}
|
|
||||||
//else, use the base class's text processing.
|
|
||||||
bool ret = TCPConnection::ProcessReceivedData(errbuf);
|
|
||||||
//see if we made the transition to packet mode...
|
|
||||||
if(ret && TCPMode == modePacket) {
|
|
||||||
return ProcessReceivedDataAsPackets(errbuf);
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
|
||||||
if (errbuf)
|
|
||||||
errbuf[0] = 0;
|
|
||||||
int32 base = 0;
|
|
||||||
int32 size = 7;
|
|
||||||
uchar* buffer;
|
|
||||||
ServerPacket* pack = 0;
|
|
||||||
while ((recvbuf_used - base) >= size) {
|
|
||||||
EmuTCPNetPacket_Struct* tnps = (EmuTCPNetPacket_Struct*) &recvbuf[base];
|
|
||||||
buffer = tnps->buffer;
|
|
||||||
size = tnps->size;
|
|
||||||
if (size >= MaxTCPReceiveBuffferSize) {
|
|
||||||
#if TCPN_DEBUG_Memory >= 1
|
|
||||||
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
|
||||||
DumpPacket(&recvbuf[base], 16);
|
|
||||||
#endif
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((recvbuf_used - base) >= size) {
|
|
||||||
// ok, we got enough data to make this packet!
|
|
||||||
pack = new ServerPacket;
|
|
||||||
pack->size = size - sizeof(EmuTCPNetPacket_Struct);
|
|
||||||
// read headers
|
|
||||||
pack->opcode = tnps->opcode;
|
|
||||||
if (tnps->flags.compressed) {
|
|
||||||
pack->compressed = true;
|
|
||||||
pack->InflatedSize = *((int32*)buffer);
|
|
||||||
pack->size -= 4;
|
|
||||||
buffer += 4;
|
|
||||||
}
|
|
||||||
if (tnps->flags.destination) {
|
|
||||||
pack->destination = *((int32*)buffer);
|
|
||||||
pack->size -= 4;
|
|
||||||
buffer += 4;
|
|
||||||
}
|
|
||||||
// end read headers
|
|
||||||
if (pack->size > 0) {
|
|
||||||
if (tnps->flags.compressed) {
|
|
||||||
// Lets decompress the packet here
|
|
||||||
pack->compressed = false;
|
|
||||||
pack->pBuffer = new uchar[pack->InflatedSize];
|
|
||||||
pack->size = InflatePacket(buffer, pack->size, pack->pBuffer, pack->InflatedSize);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pack->pBuffer = new uchar[pack->size];
|
|
||||||
memcpy(pack->pBuffer, buffer, pack->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pack->opcode == 0) {
|
|
||||||
if (pack->size) {
|
|
||||||
#if TCPN_DEBUG >= 2
|
|
||||||
std::cout << "Received TCP Network layer packet" << std::endl;
|
|
||||||
#endif
|
|
||||||
ProcessNetworkLayerPacket(pack);
|
|
||||||
}
|
|
||||||
#if TCPN_DEBUG >= 5
|
|
||||||
else {
|
|
||||||
std::cout << "Received TCP keepalive packet. (opcode=0)" << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// keepalive, no need to process
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if TCPN_LOG_PACKETS >= 1
|
|
||||||
if (pack && pack->opcode != 0) {
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
CoutTimestamp(true);
|
|
||||||
std::cout << ": Logging incoming TCP packet. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
|
||||||
#if TCPN_LOG_PACKETS == 2
|
|
||||||
if (pack->size >= 32)
|
|
||||||
DumpPacket(pack->pBuffer, 32);
|
|
||||||
else
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
#if TCPN_LOG_PACKETS >= 3
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (RelayServer && Server && pack->destination) {
|
|
||||||
EmuTCPConnection* con = Server->FindConnection(pack->destination);
|
|
||||||
if (!con) {
|
|
||||||
#if TCPN_DEBUG >= 1
|
|
||||||
std::cout << "Error relaying packet: con = 0" << std::endl;
|
|
||||||
#endif
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
con->OutQueuePush(pack);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
OutQueuePush(pack);
|
|
||||||
}
|
|
||||||
base += size;
|
|
||||||
size = 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (base != 0) {
|
|
||||||
if (base >= recvbuf_used) {
|
|
||||||
safe_delete_array(recvbuf);
|
|
||||||
} else {
|
|
||||||
auto tmpbuf = new uchar[recvbuf_size - base];
|
|
||||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
|
||||||
safe_delete_array(recvbuf);
|
|
||||||
recvbuf = tmpbuf;
|
|
||||||
recvbuf_used -= base;
|
|
||||||
recvbuf_size -= base;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
|
||||||
int32 base = 0;
|
|
||||||
int32 size = 4;
|
|
||||||
uchar* buffer;
|
|
||||||
ServerPacket* pack = 0;
|
|
||||||
while ((recvbuf_used - base) >= size) {
|
|
||||||
buffer = &recvbuf[base];
|
|
||||||
memcpy(&size, &buffer[2], 2);
|
|
||||||
if (size >= MaxTCPReceiveBuffferSize) {
|
|
||||||
#if TCPN_DEBUG_Memory >= 1
|
|
||||||
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
|
||||||
#endif
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((recvbuf_used - base) >= size) {
|
|
||||||
// ok, we got enough data to make this packet!
|
|
||||||
pack = new ServerPacket;
|
|
||||||
memcpy(&pack->opcode, &buffer[0], 2);
|
|
||||||
pack->size = size - 4;
|
|
||||||
/* if () { // TODO: Checksum or size check or something similar
|
|
||||||
// Datastream corruption, get the hell outta here!
|
|
||||||
delete pack;
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
if (pack->size > 0) {
|
|
||||||
pack->pBuffer = new uchar[pack->size];
|
|
||||||
memcpy(pack->pBuffer, &buffer[4], pack->size);
|
|
||||||
}
|
|
||||||
if (pack->opcode == 0) {
|
|
||||||
// keepalive, no need to process
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if TCPN_LOG_PACKETS >= 1
|
|
||||||
if (pack && pack->opcode != 0) {
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
CoutTimestamp(true);
|
|
||||||
std::cout << ": Logging incoming TCP OldPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
|
||||||
#if TCPN_LOG_PACKETS == 2
|
|
||||||
if (pack->size >= 32)
|
|
||||||
DumpPacket(pack->pBuffer, 32);
|
|
||||||
else
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
#if TCPN_LOG_PACKETS >= 3
|
|
||||||
DumpPacket(pack);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
OutQueuePush(pack);
|
|
||||||
}
|
|
||||||
base += size;
|
|
||||||
size = 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (base != 0) {
|
|
||||||
if (base >= recvbuf_used) {
|
|
||||||
safe_delete_array(recvbuf);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
auto tmpbuf = new uchar[recvbuf_size - base];
|
|
||||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
|
||||||
safe_delete_array(recvbuf);
|
|
||||||
recvbuf = tmpbuf;
|
|
||||||
recvbuf_used -= base;
|
|
||||||
recvbuf_size -= base;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
|
||||||
uint8 opcode = pack->pBuffer[0];
|
|
||||||
uint8* data = &pack->pBuffer[1];
|
|
||||||
switch (opcode) {
|
|
||||||
case 0: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: { // Switch to RelayServer mode
|
|
||||||
if (pack->size != 1) {
|
|
||||||
SendNetErrorPacket("New RelayClient: wrong size, expected 1");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (RelayServer) {
|
|
||||||
SendNetErrorPacket("Switch to RelayServer mode when already in RelayServer mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (RemoteID) {
|
|
||||||
SendNetErrorPacket("Switch to RelayServer mode by a Relay Client");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ConnectionType != Incoming) {
|
|
||||||
SendNetErrorPacket("Switch to RelayServer mode on outgoing connection");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if TCPC_DEBUG >= 3
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
std::cout << "Switching to RelayServer mode: " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
|
||||||
#endif
|
|
||||||
RelayServer = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: { // New Relay Client
|
|
||||||
if (!RelayServer) {
|
|
||||||
SendNetErrorPacket("New RelayClient when not in RelayServer mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (pack->size != 11) {
|
|
||||||
SendNetErrorPacket("New RelayClient: wrong size, expected 11");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ConnectionType != Incoming) {
|
|
||||||
SendNetErrorPacket("New RelayClient: illegal on outgoing connection");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
auto con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32 *)data),
|
|
||||||
*((uint32 *)&data[4]), *((uint16 *)&data[8]));
|
|
||||||
Server->AddConnection(con);
|
|
||||||
RelayCount++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: { // Delete Relay Client
|
|
||||||
if (!RelayServer) {
|
|
||||||
SendNetErrorPacket("Delete RelayClient when not in RelayServer mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (pack->size != 5) {
|
|
||||||
SendNetErrorPacket("Delete RelayClient: wrong size, expected 5");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
EmuTCPConnection* con = Server->FindConnection(*((uint32*)data));
|
|
||||||
if (con) {
|
|
||||||
if (ConnectionType == Incoming) {
|
|
||||||
if (con->GetRelayLink() != this) {
|
|
||||||
SendNetErrorPacket("Delete RelayClient: RelayLink != this");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
con->Disconnect(false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 255: {
|
|
||||||
#if TCPC_DEBUG >= 1
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = GetrIP();
|
|
||||||
std::cout "Received NetError: '";
|
|
||||||
if (pack->size > 1)
|
|
||||||
std::cout << (char*) data;
|
|
||||||
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
|
||||||
sent_something = false;
|
|
||||||
if(!TCPConnection::SendData(sent_something, errbuf))
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
if(sent_something)
|
|
||||||
keepalive_timer.Start();
|
|
||||||
else if (TCPMode == modePacket && keepalive_timer.Check()) {
|
|
||||||
auto pack = new ServerPacket(0, 0);
|
|
||||||
SendPacket(pack);
|
|
||||||
safe_delete(pack);
|
|
||||||
#if TCPN_DEBUG >= 5
|
|
||||||
std::cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmuTCPConnection::RecvData(char* errbuf) {
|
|
||||||
if(!TCPConnection::RecvData(errbuf)) {
|
|
||||||
if (OutQueue.count())
|
|
||||||
return(true);
|
|
||||||
else
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((TCPMode == modePacket || TCPMode == modeTransition) && timeout_timer.Check()) {
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "TCPConnection::RecvData(): Connection timeout");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
#ifndef EmuTCPCONNECTION_H_
|
|
||||||
#define EmuTCPCONNECTION_H_
|
|
||||||
|
|
||||||
#include "tcp_connection.h"
|
|
||||||
#include "timer.h"
|
|
||||||
|
|
||||||
//moved out of TCPConnection:: to be more exportable
|
|
||||||
#pragma pack(1)
|
|
||||||
struct EmuTCPNetPacket_Struct {
|
|
||||||
uint32 size;
|
|
||||||
struct {
|
|
||||||
uint8
|
|
||||||
compressed : 1,
|
|
||||||
destination : 1,
|
|
||||||
flag3 : 1,
|
|
||||||
flag4 : 1,
|
|
||||||
flag5 : 1,
|
|
||||||
flag6 : 1,
|
|
||||||
flag7 : 1,
|
|
||||||
flag8 : 1;
|
|
||||||
} flags;
|
|
||||||
uint16 opcode;
|
|
||||||
uchar buffer[0];
|
|
||||||
};
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
struct SPackSendQueue;
|
|
||||||
class EmuTCPServer;
|
|
||||||
class ServerPacket;
|
|
||||||
|
|
||||||
class EmuTCPConnection : public TCPConnection {
|
|
||||||
public:
|
|
||||||
enum eTCPMode { modeConsole, modeTransition, modePacket };
|
|
||||||
enum ePacketMode { packetModeZone, packetModeLauncher, packetModeLogin, packetModeUCS, packetModeQueryServ };
|
|
||||||
|
|
||||||
EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET iSock, uint32 irIP, uint16 irPort, bool iOldFormat = false);
|
|
||||||
EmuTCPConnection(bool iOldFormat = false, EmuTCPServer* iRelayServer = 0, eTCPMode iMode = modePacket); // for outgoing connections
|
|
||||||
EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort); // for relay connections
|
|
||||||
virtual ~EmuTCPConnection();
|
|
||||||
|
|
||||||
virtual bool ConnectIP(uint32 irIP, uint16 irPort, char* errbuf = 0);
|
|
||||||
virtual void Disconnect(bool iSendRelayDisconnect = true);
|
|
||||||
|
|
||||||
static EmuTCPNetPacket_Struct* MakePacket(ServerPacket* pack, uint32 iDestination = 0);
|
|
||||||
static SPackSendQueue* MakeOldPacket(ServerPacket* pack);
|
|
||||||
|
|
||||||
virtual bool SendPacket(ServerPacket* pack, uint32 iDestination = 0);
|
|
||||||
virtual bool SendPacket(EmuTCPNetPacket_Struct* tnps);
|
|
||||||
ServerPacket* PopPacket(); // OutQueuePop()
|
|
||||||
void SetPacketMode(ePacketMode mode) { PacketMode = mode; }
|
|
||||||
|
|
||||||
eTCPMode GetMode() const { return TCPMode; }
|
|
||||||
ePacketMode GetPacketMode() const { return(PacketMode); }
|
|
||||||
|
|
||||||
//relay crap:
|
|
||||||
inline bool IsRelayServer() const { return RelayServer; }
|
|
||||||
inline TCPConnection* GetRelayLink() const { return RelayLink; }
|
|
||||||
inline uint32 GetRemoteID() const { return RemoteID; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void OutQueuePush(ServerPacket* pack);
|
|
||||||
void RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect);
|
|
||||||
|
|
||||||
void SendNetErrorPacket(const char* reason = 0);
|
|
||||||
|
|
||||||
virtual bool SendData(bool &sent_something, char* errbuf = 0);
|
|
||||||
virtual bool RecvData(char* errbuf = 0);
|
|
||||||
|
|
||||||
virtual bool ProcessReceivedData(char* errbuf = 0);
|
|
||||||
bool ProcessReceivedDataAsPackets(char* errbuf = 0);
|
|
||||||
bool ProcessReceivedDataAsOldPackets(char* errbuf = 0);
|
|
||||||
void ProcessNetworkLayerPacket(ServerPacket* pack);
|
|
||||||
|
|
||||||
virtual bool LineOutQueuePush(char* line);
|
|
||||||
virtual void ClearBuffers();
|
|
||||||
|
|
||||||
EmuTCPServer* Server;
|
|
||||||
|
|
||||||
eTCPMode TCPMode;
|
|
||||||
ePacketMode PacketMode;
|
|
||||||
bool pOldFormat;
|
|
||||||
|
|
||||||
Timer keepalive_timer;
|
|
||||||
Timer timeout_timer;
|
|
||||||
|
|
||||||
//relay crap:
|
|
||||||
EmuTCPConnection* RelayLink;
|
|
||||||
int32 RelayCount;
|
|
||||||
bool RelayServer;
|
|
||||||
uint32 RemoteID;
|
|
||||||
|
|
||||||
//input queue...
|
|
||||||
void InModeQueuePush(EmuTCPNetPacket_Struct* tnps);
|
|
||||||
MyQueue<EmuTCPNetPacket_Struct> InModeQueue;
|
|
||||||
|
|
||||||
//output queue...
|
|
||||||
MyQueue<ServerPacket> OutQueue;
|
|
||||||
Mutex MOutQueueLock;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*EmuTCPCONNECTION_H_*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#include "global_define.h"
|
|
||||||
#include "emu_tcp_server.h"
|
|
||||||
#include "emu_tcp_connection.h"
|
|
||||||
|
|
||||||
EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat)
|
|
||||||
: TCPServer<EmuTCPConnection>(iPort),
|
|
||||||
pOldFormat(iOldFormat)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EmuTCPServer::~EmuTCPServer() {
|
|
||||||
MInQueue.lock();
|
|
||||||
while(!m_InQueue.empty()) {
|
|
||||||
delete m_InQueue.front();
|
|
||||||
m_InQueue.pop();
|
|
||||||
}
|
|
||||||
MInQueue.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPServer::Process() {
|
|
||||||
CheckInQueue();
|
|
||||||
TCPServer<EmuTCPConnection>::Process();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
|
||||||
{
|
|
||||||
auto conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat);
|
|
||||||
AddConnection(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EmuTCPServer::SendPacket(ServerPacket* pack) {
|
|
||||||
EmuTCPNetPacket_Struct* tnps = EmuTCPConnection::MakePacket(pack);
|
|
||||||
SendPacket(&tnps);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPServer::SendPacket(EmuTCPNetPacket_Struct** tnps) {
|
|
||||||
MInQueue.lock();
|
|
||||||
m_InQueue.push(*tnps);
|
|
||||||
MInQueue.unlock();
|
|
||||||
tnps = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuTCPServer::CheckInQueue() {
|
|
||||||
EmuTCPNetPacket_Struct* tnps = 0;
|
|
||||||
|
|
||||||
while (( tnps = InQueuePop() )) {
|
|
||||||
vitr cur, end;
|
|
||||||
cur = m_list.begin();
|
|
||||||
end = m_list.end();
|
|
||||||
for(; cur != end; cur++) {
|
|
||||||
if ((*cur)->GetMode() != EmuTCPConnection::modeConsole && (*cur)->GetRemoteID() == 0)
|
|
||||||
(*cur)->SendPacket(tnps);
|
|
||||||
}
|
|
||||||
safe_delete(tnps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
|
||||||
EmuTCPNetPacket_Struct* ret = nullptr;
|
|
||||||
MInQueue.lock();
|
|
||||||
if(!m_InQueue.empty()) {
|
|
||||||
ret = m_InQueue.front();
|
|
||||||
m_InQueue.pop();
|
|
||||||
}
|
|
||||||
MInQueue.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
EmuTCPConnection *EmuTCPServer::FindConnection(uint32 iID) {
|
|
||||||
vitr cur, end;
|
|
||||||
cur = m_list.begin();
|
|
||||||
end = m_list.end();
|
|
||||||
for(; cur != end; cur++) {
|
|
||||||
if ((*cur)->GetID() == iID)
|
|
||||||
return *cur;
|
|
||||||
}
|
|
||||||
return(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#ifndef EmuTCPSERVER_H_
|
|
||||||
#define EmuTCPSERVER_H_
|
|
||||||
|
|
||||||
#include "tcp_server.h"
|
|
||||||
|
|
||||||
class EmuTCPConnection;
|
|
||||||
struct EmuTCPNetPacket_Struct;
|
|
||||||
class ServerPacket;
|
|
||||||
|
|
||||||
class EmuTCPServer : public TCPServer<EmuTCPConnection> {
|
|
||||||
public:
|
|
||||||
EmuTCPServer(uint16 iPort = 0, bool iOldFormat = false);
|
|
||||||
virtual ~EmuTCPServer();
|
|
||||||
|
|
||||||
//packet broadcast routines.
|
|
||||||
void SendPacket(ServerPacket* pack);
|
|
||||||
void SendPacket(EmuTCPNetPacket_Struct** tnps);
|
|
||||||
|
|
||||||
//special crap for relay management
|
|
||||||
EmuTCPConnection *FindConnection(uint32 iID);
|
|
||||||
|
|
||||||
//exposed for some crap we pull. Do not call from outside this object.
|
|
||||||
using TCPServer<EmuTCPConnection>::AddConnection;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Process();
|
|
||||||
|
|
||||||
virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort);
|
|
||||||
|
|
||||||
bool pOldFormat;
|
|
||||||
|
|
||||||
//broadcast packet queue..
|
|
||||||
void CheckInQueue();
|
|
||||||
Mutex MInQueue;
|
|
||||||
EmuTCPNetPacket_Struct* InQueuePop(); //returns ownership
|
|
||||||
std::queue<EmuTCPNetPacket_Struct *> m_InQueue;
|
|
||||||
};
|
|
||||||
#endif /*EmuTCPSERVER_H_*/
|
|
||||||
@@ -0,0 +1,370 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
|
are required to give you total support for your newly bought product;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "emu_versions.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
|
||||||
|
return client_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
switch (client_version) {
|
||||||
|
case ClientVersion::Unknown:
|
||||||
|
return "Unknown Version";
|
||||||
|
case ClientVersion::Client62:
|
||||||
|
return "Client 6.2";
|
||||||
|
case ClientVersion::Titanium:
|
||||||
|
return "Titanium";
|
||||||
|
case ClientVersion::SoF:
|
||||||
|
return "SoF";
|
||||||
|
case ClientVersion::SoD:
|
||||||
|
return "SoD";
|
||||||
|
case ClientVersion::UF:
|
||||||
|
return "UF";
|
||||||
|
case ClientVersion::RoF:
|
||||||
|
return "RoF";
|
||||||
|
case ClientVersion::RoF2:
|
||||||
|
return "RoF2";
|
||||||
|
default:
|
||||||
|
return "Invalid Version";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
switch (client_version) {
|
||||||
|
case ClientVersion::Unknown:
|
||||||
|
case ClientVersion::Client62:
|
||||||
|
return bit_Unknown;
|
||||||
|
case ClientVersion::Titanium:
|
||||||
|
return bit_Titanium;
|
||||||
|
case ClientVersion::SoF:
|
||||||
|
return bit_SoF;
|
||||||
|
case ClientVersion::SoD:
|
||||||
|
return bit_SoD;
|
||||||
|
case ClientVersion::UF:
|
||||||
|
return bit_UF;
|
||||||
|
case ClientVersion::RoF:
|
||||||
|
return bit_RoF;
|
||||||
|
case ClientVersion::RoF2:
|
||||||
|
return bit_RoF2;
|
||||||
|
default:
|
||||||
|
return bit_Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
|
||||||
|
{
|
||||||
|
switch (client_version_bit) {
|
||||||
|
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
|
||||||
|
return ClientVersion::Titanium;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
|
||||||
|
return ClientVersion::SoF;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
|
||||||
|
return ClientVersion::SoD;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
|
||||||
|
return ClientVersion::UF;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
|
||||||
|
return ClientVersion::RoF;
|
||||||
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
||||||
|
return ClientVersion::RoF2;
|
||||||
|
default:
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
switch (client_version) {
|
||||||
|
case ClientVersion::Unknown:
|
||||||
|
case ClientVersion::Client62:
|
||||||
|
case ClientVersion::Titanium:
|
||||||
|
return 0x000007FFU;
|
||||||
|
case ClientVersion::SoF:
|
||||||
|
return 0x00007FFFU;
|
||||||
|
case ClientVersion::SoD:
|
||||||
|
return 0x0000FFFFU;
|
||||||
|
case ClientVersion::UF:
|
||||||
|
return 0x0001FFFFU;
|
||||||
|
case ClientVersion::RoF:
|
||||||
|
case ClientVersion::RoF2:
|
||||||
|
return 0x000FFFFFU;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
|
||||||
|
return mob_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
|
||||||
|
return mob_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
|
||||||
|
return mob_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
|
||||||
|
return mob_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
switch (mob_version) {
|
||||||
|
case MobVersion::Unknown:
|
||||||
|
return "Unknown Version";
|
||||||
|
case MobVersion::Client62:
|
||||||
|
return "Client 6.2";
|
||||||
|
case MobVersion::Titanium:
|
||||||
|
return "Titanium";
|
||||||
|
case MobVersion::SoF:
|
||||||
|
return "SoF";
|
||||||
|
case MobVersion::SoD:
|
||||||
|
return "SoD";
|
||||||
|
case MobVersion::UF:
|
||||||
|
return "UF";
|
||||||
|
case MobVersion::RoF:
|
||||||
|
return "RoF";
|
||||||
|
case MobVersion::RoF2:
|
||||||
|
return "RoF2";
|
||||||
|
case MobVersion::NPC:
|
||||||
|
return "NPC";
|
||||||
|
case MobVersion::NPCMerchant:
|
||||||
|
return "NPC Merchant";
|
||||||
|
case MobVersion::Merc:
|
||||||
|
return "Merc";
|
||||||
|
case MobVersion::Bot:
|
||||||
|
return "Bot";
|
||||||
|
case MobVersion::ClientPet:
|
||||||
|
return "Client Pet";
|
||||||
|
case MobVersion::NPCPet:
|
||||||
|
return "NPC Pet";
|
||||||
|
case MobVersion::MercPet:
|
||||||
|
return "Merc Pet";
|
||||||
|
case MobVersion::BotPet:
|
||||||
|
return "Bot Pet";
|
||||||
|
case MobVersion::OfflineTitanium:
|
||||||
|
return "Offline Titanium";
|
||||||
|
case MobVersion::OfflineSoF:
|
||||||
|
return "Offline SoF";
|
||||||
|
case MobVersion::OfflineSoD:
|
||||||
|
return "Offline SoD";
|
||||||
|
case MobVersion::OfflineUF:
|
||||||
|
return "Offline UF";
|
||||||
|
case MobVersion::OfflineRoF:
|
||||||
|
return "Offline RoF";
|
||||||
|
case MobVersion::OfflineRoF2:
|
||||||
|
return "Offline RoF2";
|
||||||
|
default:
|
||||||
|
return "Invalid Version";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
switch (mob_version) {
|
||||||
|
case MobVersion::Unknown:
|
||||||
|
case MobVersion::Client62:
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
case MobVersion::Titanium:
|
||||||
|
return ClientVersion::Titanium;
|
||||||
|
case MobVersion::SoF:
|
||||||
|
return ClientVersion::SoF;
|
||||||
|
case MobVersion::SoD:
|
||||||
|
return ClientVersion::SoD;
|
||||||
|
case MobVersion::UF:
|
||||||
|
return ClientVersion::UF;
|
||||||
|
case MobVersion::RoF:
|
||||||
|
return ClientVersion::RoF;
|
||||||
|
case MobVersion::RoF2:
|
||||||
|
return ClientVersion::RoF2;
|
||||||
|
default:
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
switch (client_version) {
|
||||||
|
case ClientVersion::Unknown:
|
||||||
|
case ClientVersion::Client62:
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
case ClientVersion::Titanium:
|
||||||
|
return MobVersion::Titanium;
|
||||||
|
case ClientVersion::SoF:
|
||||||
|
return MobVersion::SoF;
|
||||||
|
case ClientVersion::SoD:
|
||||||
|
return MobVersion::SoD;
|
||||||
|
case ClientVersion::UF:
|
||||||
|
return MobVersion::UF;
|
||||||
|
case ClientVersion::RoF:
|
||||||
|
return MobVersion::RoF;
|
||||||
|
case ClientVersion::RoF2:
|
||||||
|
return MobVersion::RoF2;
|
||||||
|
default:
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
switch (mob_version) {
|
||||||
|
case MobVersion::Titanium:
|
||||||
|
return MobVersion::OfflineTitanium;
|
||||||
|
case MobVersion::SoF:
|
||||||
|
return MobVersion::OfflineSoF;
|
||||||
|
case MobVersion::SoD:
|
||||||
|
return MobVersion::OfflineSoD;
|
||||||
|
case MobVersion::UF:
|
||||||
|
return MobVersion::OfflineUF;
|
||||||
|
case MobVersion::RoF:
|
||||||
|
return MobVersion::OfflineRoF;
|
||||||
|
case MobVersion::RoF2:
|
||||||
|
return MobVersion::OfflineRoF2;
|
||||||
|
default:
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
switch (mob_version) {
|
||||||
|
case MobVersion::OfflineTitanium:
|
||||||
|
return MobVersion::Titanium;
|
||||||
|
case MobVersion::OfflineSoF:
|
||||||
|
return MobVersion::SoF;
|
||||||
|
case MobVersion::OfflineSoD:
|
||||||
|
return MobVersion::SoD;
|
||||||
|
case MobVersion::OfflineUF:
|
||||||
|
return MobVersion::UF;
|
||||||
|
case MobVersion::OfflineRoF:
|
||||||
|
return MobVersion::RoF;
|
||||||
|
case MobVersion::OfflineRoF2:
|
||||||
|
return MobVersion::RoF2;
|
||||||
|
default:
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
|
||||||
|
{
|
||||||
|
switch (mob_version) {
|
||||||
|
case MobVersion::OfflineTitanium:
|
||||||
|
return ClientVersion::Titanium;
|
||||||
|
case MobVersion::OfflineSoF:
|
||||||
|
return ClientVersion::SoF;
|
||||||
|
case MobVersion::OfflineSoD:
|
||||||
|
return ClientVersion::SoD;
|
||||||
|
case MobVersion::OfflineUF:
|
||||||
|
return ClientVersion::UF;
|
||||||
|
case MobVersion::OfflineRoF:
|
||||||
|
return ClientVersion::RoF;
|
||||||
|
case MobVersion::OfflineRoF2:
|
||||||
|
return ClientVersion::RoF2;
|
||||||
|
default:
|
||||||
|
return ClientVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
|
||||||
|
{
|
||||||
|
switch (client_version) {
|
||||||
|
case ClientVersion::Titanium:
|
||||||
|
return MobVersion::OfflineTitanium;
|
||||||
|
case ClientVersion::SoF:
|
||||||
|
return MobVersion::OfflineSoF;
|
||||||
|
case ClientVersion::SoD:
|
||||||
|
return MobVersion::OfflineSoD;
|
||||||
|
case ClientVersion::UF:
|
||||||
|
return MobVersion::OfflineUF;
|
||||||
|
case ClientVersion::RoF:
|
||||||
|
return MobVersion::OfflineRoF;
|
||||||
|
case ClientVersion::RoF2:
|
||||||
|
return MobVersion::OfflineRoF2;
|
||||||
|
default:
|
||||||
|
return MobVersion::Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
|
are required to give you total support for your newly bought product;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMON_EMU_VERSIONS_H
|
||||||
|
#define COMMON_EMU_VERSIONS_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace EQEmu
|
||||||
|
{
|
||||||
|
namespace versions {
|
||||||
|
enum class ClientVersion : uint32 {
|
||||||
|
Unknown = 0,
|
||||||
|
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||||
|
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||||
|
SoF, // Build: 'Sep 7 2007 09:11:49'
|
||||||
|
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||||
|
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||||
|
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||||
|
RoF2 // Build: 'May 10 2013 23:30:08'
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ClientVersionBit : uint32 {
|
||||||
|
bit_Unknown = 0,
|
||||||
|
bit_Client62 = 0x00000001, // unsupported (placeholder for scripts)
|
||||||
|
bit_Titanium = 0x00000002,
|
||||||
|
bit_SoF = 0x00000004,
|
||||||
|
bit_SoD = 0x00000008,
|
||||||
|
bit_UF = 0x00000010,
|
||||||
|
bit_RoF = 0x00000020,
|
||||||
|
bit_RoF2 = 0x00000040,
|
||||||
|
bit_TitaniumAndEarlier = 0x00000003,
|
||||||
|
bit_SoFAndEarlier = 0x00000007,
|
||||||
|
bit_SoDAndEarlier = 0x0000000F,
|
||||||
|
bit_UFAndEarlier = 0x0000001F,
|
||||||
|
bit_RoFAndEarlier = 0x0000003F,
|
||||||
|
bit_SoFAndLater = 0xFFFFFFFC,
|
||||||
|
bit_SoDAndLater = 0xFFFFFFF8,
|
||||||
|
bit_UFAndLater = 0xFFFFFFF0,
|
||||||
|
bit_RoFAndLater = 0xFFFFFFE0,
|
||||||
|
bit_RoF2AndLater = 0xFFFFFFC0,
|
||||||
|
bit_AllClients = 0xFFFFFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
const ClientVersion LastClientVersion = ClientVersion::RoF2;
|
||||||
|
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
||||||
|
|
||||||
|
bool IsValidClientVersion(ClientVersion client_version);
|
||||||
|
ClientVersion ValidateClientVersion(ClientVersion client_version);
|
||||||
|
const char* ClientVersionName(ClientVersion client_version);
|
||||||
|
uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
|
||||||
|
ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
|
||||||
|
uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
|
||||||
|
|
||||||
|
|
||||||
|
enum class MobVersion : uint32 {
|
||||||
|
Unknown = 0,
|
||||||
|
Client62,
|
||||||
|
Titanium,
|
||||||
|
SoF,
|
||||||
|
SoD,
|
||||||
|
UF,
|
||||||
|
RoF,
|
||||||
|
RoF2,
|
||||||
|
NPC,
|
||||||
|
NPCMerchant,
|
||||||
|
Merc,
|
||||||
|
Bot,
|
||||||
|
ClientPet,
|
||||||
|
NPCPet,
|
||||||
|
MercPet,
|
||||||
|
BotPet,
|
||||||
|
OfflineTitanium,
|
||||||
|
OfflineSoF,
|
||||||
|
OfflineSoD,
|
||||||
|
OfflineUF,
|
||||||
|
OfflineRoF,
|
||||||
|
OfflineRoF2
|
||||||
|
};
|
||||||
|
|
||||||
|
const MobVersion LastMobVersion = MobVersion::OfflineRoF2;
|
||||||
|
const MobVersion LastPCMobVersion = MobVersion::RoF2;
|
||||||
|
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
|
||||||
|
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2;
|
||||||
|
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
|
||||||
|
|
||||||
|
bool IsValidMobVersion(MobVersion mob_version);
|
||||||
|
bool IsValidPCMobVersion(MobVersion mob_version);
|
||||||
|
bool IsValidNonPCMobVersion(MobVersion mob_version);
|
||||||
|
bool IsValidOfflinePCMobVersion(MobVersion mob_version);
|
||||||
|
|
||||||
|
MobVersion ValidateMobVersion(MobVersion mob_version);
|
||||||
|
MobVersion ValidatePCMobVersion(MobVersion mob_version);
|
||||||
|
MobVersion ValidateNonPCMobVersion(MobVersion mob_version);
|
||||||
|
MobVersion ValidateOfflinePCMobVersion(MobVersion mob_version);
|
||||||
|
|
||||||
|
const char* MobVersionName(MobVersion mob_version);
|
||||||
|
ClientVersion ConvertMobVersionToClientVersion(MobVersion mob_version);
|
||||||
|
MobVersion ConvertClientVersionToMobVersion(ClientVersion client_version);
|
||||||
|
MobVersion ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version);
|
||||||
|
MobVersion ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version);
|
||||||
|
ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version);
|
||||||
|
MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version);
|
||||||
|
|
||||||
|
|
||||||
|
enum UCSVersion : char {
|
||||||
|
ucsUnknown = '\0',
|
||||||
|
ucsClient62Chat = 'A',
|
||||||
|
ucsClient62Mail = 'a',
|
||||||
|
ucsTitaniumChat = 'B',
|
||||||
|
ucsTitaniumMail = 'b',
|
||||||
|
ucsSoFCombined = 'C',
|
||||||
|
ucsSoDCombined = 'D',
|
||||||
|
ucsUFCombined = 'E',
|
||||||
|
ucsRoFCombined = 'F',
|
||||||
|
ucsRoF2Combined = 'G'
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*versions*/
|
||||||
|
|
||||||
|
} /*EQEmu*/
|
||||||
|
|
||||||
|
#endif /*COMMON_EMU_VERSIONS_H*/
|
||||||
+22
-27
@@ -27,7 +27,7 @@
|
|||||||
//SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2)
|
//SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2)
|
||||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point (default action)
|
#define AT_Die 0 // this causes the client to keel over and zone to bind point (default action)
|
||||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||||
//#define AT_2 2 // unknown
|
#define AT_HPMax 2 // idk
|
||||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||||
@@ -36,33 +36,37 @@
|
|||||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate
|
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate max 5, see GravityBehavior enum
|
||||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||||
#define AT_GuildID 22
|
#define AT_GuildID 22
|
||||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||||
//#define AT_27 27 // unknown
|
#define AT_Summoned 27 // Unsure
|
||||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on (not showing in SoF+) (client-to-server only)
|
#define AT_Split 28 // 0 = normal, 1 = autosplit on (not showing in SoF+) (client-to-server only)
|
||||||
#define AT_Size 29 // spawn's size (present: SoF, absent: RoF2)
|
#define AT_Size 29 // spawn's size (present: SoF, absent: RoF2)
|
||||||
//#define AT_30 30 // unknown
|
#define AT_SetType 30 // 0 = PC, 1 = NPC, 2 <= = corpse
|
||||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name
|
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name, Trader on RoF2?
|
||||||
//#define AT_32 32 // unknown
|
#define AT_AARank 32 // AA Rank Title ID thingy, does is this the title in /who?
|
||||||
//#define AT_33 33 // unknown
|
#define AT_CancelSneakHide 33 // Turns off Hide and Sneak
|
||||||
//#define AT_34 34 // unknown (present: SoF, absent: RoF2)
|
//#define AT_34 34 // unknown (present: SoF, absent: RoF2)
|
||||||
//#define AT_35 35 // unknown
|
#define AT_AreaHPRegen 35 // guild hall regen pool sets to value * 0.001
|
||||||
//#define AT_36 36 // unknown
|
#define AT_AreaManaRegen 36 // guild hall regen pool sets to value * 0.001
|
||||||
//#define AT_37 37 // unknown
|
#define AT_AreaEndRegen 37 // guild hall regen pool sets to value * 0.001
|
||||||
//#define AT_38 38 // unknown
|
#define AT_FreezeBuffs 38 // Freezes beneficial buff timers
|
||||||
//#define AT_39 39 // unknown
|
#define AT_NpcTintIndex 39 // not 100% sure
|
||||||
|
#define AT_GroupConsent 40 // auto consent group
|
||||||
|
#define AT_RaidConsent 41 // auto consent raid
|
||||||
|
#define AT_GuildConsent 42 // auto consent guild
|
||||||
#define AT_ShowHelm 43 // 0 = hide graphic, 1 = show graphic
|
#define AT_ShowHelm 43 // 0 = hide graphic, 1 = show graphic
|
||||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
#define AT_DamageState 44 // The damage state of a destructible object (0 through 10) plays soundids most only have 2 or 4 states though
|
||||||
//#define AT_46 46 // unknown
|
#define AT_EQPlayers 45 // /eqplayersupdate
|
||||||
//#define AT_48 48 // unknown
|
#define AT_FindBits 46 // set FindBits, whatever those are!
|
||||||
//#define AT_49 49 // unknown
|
#define AT_TextureType 48 // TextureType
|
||||||
//#define AT_52 52 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
#define AT_FacePick 49 // Turns off face pick window? maybe ...
|
||||||
//#define AT_53 53 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
|
||||||
|
#define AT_Offline 53 // Offline mode
|
||||||
|
|
||||||
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
|
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
|
||||||
|
|
||||||
@@ -516,15 +520,6 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define INVALID_INDEX -1
|
#define INVALID_INDEX -1
|
||||||
#define NOT_USED 0
|
|
||||||
#define NO_ITEM 0
|
|
||||||
|
|
||||||
// yes..these are redundant... but, they help to identify and define what is actually being performed
|
|
||||||
// plus, since they're pre-op's, they don't affect the actual binary size
|
|
||||||
#define TYPE_BEGIN 0
|
|
||||||
#define SLOT_BEGIN 0
|
|
||||||
#define SUB_INDEX_BEGIN 0
|
|
||||||
#define AUG_INDEX_BEGIN 0
|
|
||||||
|
|
||||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||||
|
|
||||||
|
|||||||
+935
-473
File diff suppressed because it is too large
Load Diff
+37
-16
@@ -1,4 +1,4 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
are required to give you total support for your newly bought product;
|
are required to give you total support for your newly bought product;
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
@@ -20,9 +20,10 @@
|
|||||||
#ifndef COMMON_EQ_LIMITS_H
|
#ifndef COMMON_EQ_LIMITS_H
|
||||||
#define COMMON_EQ_LIMITS_H
|
#define COMMON_EQ_LIMITS_H
|
||||||
|
|
||||||
|
#include "emu_legacy.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "eq_constants.h"
|
#include "eq_constants.h"
|
||||||
#include "inventory_version.h"
|
#include "emu_versions.h"
|
||||||
#include "../common/patches/titanium_limits.h"
|
#include "../common/patches/titanium_limits.h"
|
||||||
#include "../common/patches/sof_limits.h"
|
#include "../common/patches/sof_limits.h"
|
||||||
#include "../common/patches/sod_limits.h"
|
#include "../common/patches/sod_limits.h"
|
||||||
@@ -34,30 +35,50 @@
|
|||||||
namespace EQEmu
|
namespace EQEmu
|
||||||
{
|
{
|
||||||
namespace constants {
|
namespace constants {
|
||||||
extern size_t CharacterCreationLimit(versions::ClientVersion client_version);
|
class LookupEntry {
|
||||||
|
public:
|
||||||
|
size_t CharacterCreationLimit;
|
||||||
|
int LongBuffs;
|
||||||
|
int ShortBuffs;
|
||||||
|
int DiscBuffs;
|
||||||
|
int TotalBuffs;
|
||||||
|
int NPCBuffs;
|
||||||
|
int PetBuffs;
|
||||||
|
int MercBuffs;
|
||||||
|
};
|
||||||
|
|
||||||
|
const LookupEntry* Lookup(versions::ClientVersion client_version);
|
||||||
|
|
||||||
} /*constants*/
|
} /*constants*/
|
||||||
|
|
||||||
namespace inventory {
|
namespace inventory {
|
||||||
extern uint16 InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type);
|
class LookupEntry {
|
||||||
extern uint64 PossessionsBitmask(versions::InventoryVersion inventory_version);
|
public:
|
||||||
|
size_t InventoryTypeSize[25]; // should reflect EQEmu::inventory::typeCount referenced in emu_constants.h
|
||||||
|
|
||||||
extern bool AllowEmptyBagInBag(versions::InventoryVersion inventory_version);
|
uint64 PossessionsBitmask;
|
||||||
extern bool AllowClickCastFromBag(versions::InventoryVersion inventory_version);
|
size_t ItemBagSize;
|
||||||
|
size_t ItemAugSize;
|
||||||
|
|
||||||
extern uint16 ItemAugSize(versions::InventoryVersion inventory_version);
|
bool AllowEmptyBagInBag;
|
||||||
extern uint16 ItemBagSize(versions::InventoryVersion inventory_version);
|
bool AllowClickCastFromBag;
|
||||||
|
bool ConcatenateInvTypeLimbo;
|
||||||
|
bool AllowOverLevelEquipment;
|
||||||
|
};
|
||||||
|
|
||||||
extern bool ConcatenateInvTypeLimbo(versions::InventoryVersion inventory_version);
|
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||||
|
|
||||||
extern bool AllowOverLevelEquipment(versions::InventoryVersion inventory_version);
|
|
||||||
|
|
||||||
} /*inventory*/
|
} /*inventory*/
|
||||||
|
|
||||||
namespace profile {
|
namespace behavior {
|
||||||
extern bool CoinHasWeight(versions::InventoryVersion inventory_version);
|
class LookupEntry {
|
||||||
|
public:
|
||||||
|
bool CoinHasWeight;
|
||||||
|
};
|
||||||
|
|
||||||
} /*profile*/
|
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||||
|
|
||||||
|
} /*behavior*/
|
||||||
|
|
||||||
} /*EQEmu*/
|
} /*EQEmu*/
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ void EQApplicationPacket::build_header_dump(char *buffer) const
|
|||||||
#ifdef STATIC_OPCODE
|
#ifdef STATIC_OPCODE
|
||||||
sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size);
|
sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size);
|
||||||
#else
|
#else
|
||||||
sprintf(buffer, "[OpCode %s Size=%u]",OpcodeManager::EmuToName(emu_opcode),size);
|
sprintf(buffer, "[OpCode %s(0x%04x) Size=%u]",OpcodeManager::EmuToName(emu_opcode), GetProtocolOpcode(), size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -115,11 +115,14 @@ public:
|
|||||||
virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const;
|
virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||||
virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const;
|
virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||||
|
|
||||||
uint16 GetOpcodeBypass() { return opcode_bypass; }
|
uint16 GetOpcodeBypass() const { return opcode_bypass; }
|
||||||
void SetOpcodeBypass(uint16 v) { opcode_bypass = v; }
|
void SetOpcodeBypass(uint16 v) { opcode_bypass = v; }
|
||||||
|
|
||||||
|
uint16 GetProtocolOpcode() const { return protocol_opcode; }
|
||||||
|
void SetProtocolOpcode(uint16 v) { protocol_opcode = v; }
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
uint16 protocol_opcode;
|
||||||
uint8 app_opcode_size;
|
uint8 app_opcode_size;
|
||||||
uint16 opcode_bypass;
|
uint16 opcode_bypass;
|
||||||
private:
|
private:
|
||||||
|
|||||||
+195
-188
@@ -25,15 +25,17 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "../common/version.h"
|
#include "../common/version.h"
|
||||||
//#include "../common/item_struct.h"
|
#include "emu_constants.h"
|
||||||
|
#include "textures.h"
|
||||||
|
|
||||||
|
|
||||||
static const uint32 BUFF_COUNT = 25;
|
static const uint32 BUFF_COUNT = 25;
|
||||||
|
static const uint32 PET_BUFF_COUNT = 30;
|
||||||
static const uint32 MAX_MERC = 100;
|
static const uint32 MAX_MERC = 100;
|
||||||
static const uint32 MAX_MERC_GRADES = 10;
|
static const uint32 MAX_MERC_GRADES = 10;
|
||||||
static const uint32 MAX_MERC_STANCES = 10;
|
static const uint32 MAX_MERC_STANCES = 10;
|
||||||
static const uint32 BLOCKED_BUFF_COUNT = 20;
|
static const uint32 BLOCKED_BUFF_COUNT = 20;
|
||||||
|
|
||||||
#include "emu_constants.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Compiler override to ensure
|
** Compiler override to ensure
|
||||||
@@ -125,37 +127,7 @@ struct LDoNTrapTemplate
|
|||||||
|
|
||||||
// All clients translate the character select information to some degree
|
// All clients translate the character select information to some degree
|
||||||
|
|
||||||
struct Color_Struct
|
struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {};
|
||||||
{
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
uint8 Blue;
|
|
||||||
uint8 Green;
|
|
||||||
uint8 Red;
|
|
||||||
uint8 UseTint; // if there's a tint this is FF
|
|
||||||
} RGB;
|
|
||||||
uint32 Color;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EquipStruct
|
|
||||||
{
|
|
||||||
uint32 Material;
|
|
||||||
uint32 Unknown1;
|
|
||||||
uint32 EliteMaterial;
|
|
||||||
uint32 HeroForgeModel;
|
|
||||||
uint32 Material2; // Same as material?
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CharSelectEquip
|
|
||||||
{
|
|
||||||
uint32 Material;
|
|
||||||
uint32 Unknown1;
|
|
||||||
uint32 EliteMaterial;
|
|
||||||
uint32 HeroForgeModel;
|
|
||||||
uint32 Material2;
|
|
||||||
Color_Struct Color;
|
|
||||||
};
|
|
||||||
|
|
||||||
// RoF2-based hybrid struct
|
// RoF2-based hybrid struct
|
||||||
struct CharacterSelectEntry_Struct
|
struct CharacterSelectEntry_Struct
|
||||||
@@ -170,7 +142,7 @@ struct CharacterSelectEntry_Struct
|
|||||||
uint16 Instance;
|
uint16 Instance;
|
||||||
uint8 Gender;
|
uint8 Gender;
|
||||||
uint8 Face;
|
uint8 Face;
|
||||||
CharSelectEquip Equip[9];
|
CharSelectEquip Equip[EQEmu::textures::materialCount];
|
||||||
uint8 Unknown15; // Seen FF
|
uint8 Unknown15; // Seen FF
|
||||||
uint8 Unknown19; // Seen FF
|
uint8 Unknown19; // Seen FF
|
||||||
uint32 DrakkinTattoo;
|
uint32 DrakkinTattoo;
|
||||||
@@ -279,22 +251,7 @@ struct Spawn_Struct {
|
|||||||
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
|
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
|
||||||
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
|
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
|
||||||
/*0194*/ uint8 unknown0194[3];
|
/*0194*/ uint8 unknown0194[3];
|
||||||
/*0197*/ union
|
/*0197*/ EQEmu::TextureProfile equipment;
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
/*0000*/ EquipStruct equip_helmet; // Equipment: Helmet visual
|
|
||||||
/*0000*/ EquipStruct equip_chest; // Equipment: Chest visual
|
|
||||||
/*0000*/ EquipStruct equip_arms; // Equipment: Arms visual
|
|
||||||
/*0000*/ EquipStruct equip_bracers; // Equipment: Wrist visual
|
|
||||||
/*0000*/ EquipStruct equip_hands; // Equipment: Hands visual
|
|
||||||
/*0000*/ EquipStruct equip_legs; // Equipment: Legs visual
|
|
||||||
/*0000*/ EquipStruct equip_feet; // Equipment: Boots visual
|
|
||||||
/*0000*/ EquipStruct equip_primary; // Equipment: Main visual
|
|
||||||
/*0000*/ EquipStruct equip_secondary; // Equipment: Off visual
|
|
||||||
} equip;
|
|
||||||
/*0000*/ EquipStruct equipment[EQEmu::legacy::MaterialCount];
|
|
||||||
};
|
|
||||||
/*0233*/ float runspeed; // Speed when running
|
/*0233*/ float runspeed; // Speed when running
|
||||||
/*0036*/ uint8 afk; // 0=no, 1=afk
|
/*0036*/ uint8 afk; // 0=no, 1=afk
|
||||||
/*0238*/ uint32 guildID; // Current guild
|
/*0238*/ uint32 guildID; // Current guild
|
||||||
@@ -323,24 +280,9 @@ union
|
|||||||
// horse: 0=brown, 1=white, 2=black, 3=tan
|
// horse: 0=brown, 1=white, 2=black, 3=tan
|
||||||
};
|
};
|
||||||
/*0340*/ uint32 spawnId; // Spawn Id
|
/*0340*/ uint32 spawnId; // Spawn Id
|
||||||
/*0344*/ uint8 unknown0344[3];
|
/*0344*/ float bounding_radius; // used in melee, overrides calc
|
||||||
/*0347*/ uint8 IsMercenary;
|
/*0347*/ uint8 IsMercenary;
|
||||||
/*0348*/ union
|
/*0348*/ EQEmu::TintProfile equipment_tint;
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
/*0348*/ Color_Struct color_helmet; // Color of helmet item
|
|
||||||
/*0352*/ Color_Struct color_chest; // Color of chest item
|
|
||||||
/*0356*/ Color_Struct color_arms; // Color of arms item
|
|
||||||
/*0360*/ Color_Struct color_bracers; // Color of bracers item
|
|
||||||
/*0364*/ Color_Struct color_hands; // Color of hands item
|
|
||||||
/*0368*/ Color_Struct color_legs; // Color of legs item
|
|
||||||
/*0372*/ Color_Struct color_feet; // Color of feet item
|
|
||||||
/*0376*/ Color_Struct color_primary; // Color of primary item
|
|
||||||
/*0380*/ Color_Struct color_secondary; // Color of secondary item
|
|
||||||
} equipment_colors;
|
|
||||||
/*0348*/ Color_Struct colors[EQEmu::legacy::MaterialCount]; // Array elements correspond to struct equipment_colors above
|
|
||||||
};
|
|
||||||
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
|
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
|
||||||
/*0385*/
|
/*0385*/
|
||||||
|
|
||||||
@@ -363,6 +305,7 @@ union
|
|||||||
uint8 DestructibleUnk8;
|
uint8 DestructibleUnk8;
|
||||||
uint32 DestructibleUnk9;
|
uint32 DestructibleUnk9;
|
||||||
bool targetable_with_hotkey;
|
bool targetable_with_hotkey;
|
||||||
|
bool show_name;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -445,7 +388,19 @@ struct MemorizeSpell_Struct {
|
|||||||
uint32 slot; // Spot in the spell book/memorized slot
|
uint32 slot; // Spot in the spell book/memorized slot
|
||||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||||
uint32 unknown12;
|
uint32 reduction; // lower reuse
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Linked Spell Reuse Timer
|
||||||
|
** Length: 12
|
||||||
|
** Comes before the OP_Memorize
|
||||||
|
** Live (maybe TDS steam) has an extra DWORD after timer_id
|
||||||
|
*/
|
||||||
|
struct LinkedSpellReuseTimer_Struct {
|
||||||
|
uint32 timer_id; // Timer ID of the spell
|
||||||
|
uint32 end_time; // timestamp of when it will be ready
|
||||||
|
uint32 start_time; // timestamp of when it started
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -478,10 +433,11 @@ struct DeleteSpell_Struct
|
|||||||
|
|
||||||
struct ManaChange_Struct
|
struct ManaChange_Struct
|
||||||
{
|
{
|
||||||
uint32 new_mana; // New Mana AMount
|
/*00*/ uint32 new_mana; // New Mana AMount
|
||||||
uint32 stamina;
|
/*04*/ uint32 stamina;
|
||||||
uint32 spell_id;
|
/*08*/ uint32 spell_id;
|
||||||
uint32 unknown12;
|
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
|
||||||
|
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SwapSpell_Struct
|
struct SwapSpell_Struct
|
||||||
@@ -547,30 +503,28 @@ struct SpawnAppearance_Struct
|
|||||||
// this is used inside profile
|
// this is used inside profile
|
||||||
struct SpellBuff_Struct
|
struct SpellBuff_Struct
|
||||||
{
|
{
|
||||||
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
|
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
|
||||||
/*001*/ uint8 level;
|
/*001*/ uint8 level;
|
||||||
/*002*/ uint8 bard_modifier;
|
/*002*/ uint8 bard_modifier;
|
||||||
/*003*/ uint8 effect; //not real
|
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking? -- OSX client calls this "activated"
|
||||||
/*004*/ uint32 spellid;
|
/*004*/ uint32 spellid;
|
||||||
/*008*/ int32 duration;
|
/*008*/ int32 duration;
|
||||||
/*012*/ uint32 counters;
|
/*012*/ uint32 counters; // single book keeping value (counters, rune/vie)
|
||||||
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
|
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
|
||||||
/*020*/
|
// extra stuff for newer packets
|
||||||
|
/*020*/ uint32 num_hits;
|
||||||
|
/*024*/ float y; // referenced by SPA 441
|
||||||
|
/*028*/ float x; // unsure if all buffs get them
|
||||||
|
/*032*/ float z; // as valid data
|
||||||
|
/*036*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpellBuffFade_Struct {
|
struct SpellBuffPacket_Struct {
|
||||||
/*000*/ uint32 entityid;
|
/*000*/ uint32 entityid;
|
||||||
/*004*/ uint8 slot;
|
/*004*/ SpellBuff_Struct buff;
|
||||||
/*005*/ uint8 level;
|
/*040*/ uint32 slotid;
|
||||||
/*006*/ uint8 effect;
|
/*044*/ uint32 bufffade;
|
||||||
/*007*/ uint8 unknown7;
|
/*048*/
|
||||||
/*008*/ uint32 spellid;
|
|
||||||
/*012*/ int32 duration;
|
|
||||||
/*016*/ uint32 num_hits;
|
|
||||||
/*020*/ uint32 unknown020; //prolly global player ID
|
|
||||||
/*024*/ uint32 slotid;
|
|
||||||
/*028*/ uint32 bufffade;
|
|
||||||
/*032*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Underfoot & later struct.
|
// Underfoot & later struct.
|
||||||
@@ -583,8 +537,8 @@ struct BuffRemoveRequest_Struct
|
|||||||
|
|
||||||
struct PetBuff_Struct {
|
struct PetBuff_Struct {
|
||||||
/*000*/ uint32 petid;
|
/*000*/ uint32 petid;
|
||||||
/*004*/ uint32 spellid[BUFF_COUNT+5];
|
/*004*/ uint32 spellid[PET_BUFF_COUNT];
|
||||||
/*124*/ int32 ticsremaining[BUFF_COUNT+5];
|
/*124*/ int32 ticsremaining[PET_BUFF_COUNT];
|
||||||
/*244*/ uint32 buffcount;
|
/*244*/ uint32 buffcount;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -597,6 +551,7 @@ struct BlockedBuffs_Struct
|
|||||||
/*86*/ uint16 Flags;
|
/*86*/ uint16 Flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// same for adding
|
||||||
struct RemoveNimbusEffect_Struct
|
struct RemoveNimbusEffect_Struct
|
||||||
{
|
{
|
||||||
/*00*/ uint32 spawnid; // Spawn ID
|
/*00*/ uint32 spawnid; // Spawn ID
|
||||||
@@ -881,7 +836,7 @@ struct SuspendedMinion_Struct
|
|||||||
/*002*/ uint32 HP;
|
/*002*/ uint32 HP;
|
||||||
/*006*/ uint32 Mana;
|
/*006*/ uint32 Mana;
|
||||||
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
|
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||||
/*510*/ uint32 Items[EQEmu::legacy::MaterialCount];
|
/*510*/ EQEmu::TextureMaterialProfile Items;
|
||||||
/*546*/ char Name[64];
|
/*546*/ char Name[64];
|
||||||
/*610*/
|
/*610*/
|
||||||
};
|
};
|
||||||
@@ -895,11 +850,12 @@ struct SuspendedMinion_Struct
|
|||||||
*/
|
*/
|
||||||
static const uint32 MAX_PP_LANGUAGE = 28;
|
static const uint32 MAX_PP_LANGUAGE = 28;
|
||||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
|
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
|
||||||
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
|
static const uint32 MAX_PP_MEMSPELL = static_cast<uint32>(EQEmu::CastingSlot::MaxGems); // Set to latest client so functions can work right -- 12
|
||||||
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
|
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
|
||||||
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
||||||
|
|
||||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||||
|
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||||
static const uint32 MAX_PP_AA_ARRAY = 240;
|
static const uint32 MAX_PP_AA_ARRAY = 240;
|
||||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||||
static const uint32 MAX_RECAST_TYPES = 20;
|
static const uint32 MAX_RECAST_TYPES = 20;
|
||||||
@@ -976,7 +932,7 @@ struct PlayerProfile_Struct
|
|||||||
/*0245*/ uint8 guildbanker;
|
/*0245*/ uint8 guildbanker;
|
||||||
/*0246*/ uint8 unknown0246[6]; //
|
/*0246*/ uint8 unknown0246[6]; //
|
||||||
/*0252*/ uint32 intoxication;
|
/*0252*/ uint32 intoxication;
|
||||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms
|
||||||
/*0292*/ uint32 abilitySlotRefresh;
|
/*0292*/ uint32 abilitySlotRefresh;
|
||||||
/*0296*/ uint8 haircolor; // Player hair color
|
/*0296*/ uint8 haircolor; // Player hair color
|
||||||
/*0297*/ uint8 beardcolor; // Player beard color
|
/*0297*/ uint8 beardcolor; // Player beard color
|
||||||
@@ -989,9 +945,9 @@ struct PlayerProfile_Struct
|
|||||||
/*0304*/ uint8 ability_time_minutes;
|
/*0304*/ uint8 ability_time_minutes;
|
||||||
/*0305*/ uint8 ability_time_hours; //place holder
|
/*0305*/ uint8 ability_time_hours; //place holder
|
||||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||||
/*0312*/ uint32 item_material[EQEmu::legacy::MaterialCount]; // Item texture/material of worn/held items
|
/*0312*/ EQEmu::TextureMaterialProfile item_material; // Item texture/material of worn/held items
|
||||||
/*0348*/ uint8 unknown0348[44];
|
/*0348*/ uint8 unknown0348[44];
|
||||||
/*0392*/ Color_Struct item_tint[EQEmu::legacy::MaterialCount];
|
/*0392*/ EQEmu::TintProfile item_tint;
|
||||||
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
|
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||||
/*2352*/ char servername[32]; // length probably not right
|
/*2352*/ char servername[32]; // length probably not right
|
||||||
@@ -1017,7 +973,7 @@ struct PlayerProfile_Struct
|
|||||||
/*2580*/ uint8 unknown2616[4];
|
/*2580*/ uint8 unknown2616[4];
|
||||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL];
|
||||||
/*4668*/ uint8 unknown4704[32]; //
|
/*4668*/ uint8 unknown4704[32]; //
|
||||||
/*4700*/ float y; // Player y position
|
/*4700*/ float y; // Player y position
|
||||||
/*4704*/ float x; // Player x position
|
/*4704*/ float x; // Player x position
|
||||||
@@ -1039,7 +995,8 @@ struct PlayerProfile_Struct
|
|||||||
/*4768*/ int32 platinum_shared; // Platinum shared between characters
|
/*4768*/ int32 platinum_shared; // Platinum shared between characters
|
||||||
/*4772*/ uint8 unknown4808[24];
|
/*4772*/ uint8 unknown4808[24];
|
||||||
/*4796*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
/*4796*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||||
/*5196*/ uint8 unknown5132[184];
|
/*5196*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||||
|
/*5296*/ uint8 unknown5132[84];
|
||||||
/*5380*/ uint32 pvp2; //
|
/*5380*/ uint32 pvp2; //
|
||||||
/*5384*/ uint32 unknown5420; //
|
/*5384*/ uint32 unknown5420; //
|
||||||
/*5388*/ uint32 pvptype; //
|
/*5388*/ uint32 pvptype; //
|
||||||
@@ -1163,6 +1120,11 @@ struct PetCommand_Struct {
|
|||||||
/*004*/ uint32 target;
|
/*004*/ uint32 target;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PetCommandState_Struct {
|
||||||
|
/*00*/ uint32 button_id;
|
||||||
|
/*04*/ uint32 state;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Delete Spawn
|
** Delete Spawn
|
||||||
** Length: 4 Bytes
|
** Length: 4 Bytes
|
||||||
@@ -1226,7 +1188,7 @@ struct WearChange_Struct{
|
|||||||
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
|
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
|
||||||
/*014*/ uint32 hero_forge_model; // New to VoA
|
/*014*/ uint32 hero_forge_model; // New to VoA
|
||||||
/*018*/ uint32 unknown18; // New to RoF
|
/*018*/ uint32 unknown18; // New to RoF
|
||||||
/*022*/ Color_Struct color;
|
/*022*/ EQEmu::textures::Tint_Struct color;
|
||||||
/*026*/ uint8 wear_slot_id;
|
/*026*/ uint8 wear_slot_id;
|
||||||
/*027*/
|
/*027*/
|
||||||
};
|
};
|
||||||
@@ -1291,21 +1253,22 @@ struct Action_Struct
|
|||||||
{
|
{
|
||||||
/* 00 */ uint16 target; // id of target
|
/* 00 */ uint16 target; // id of target
|
||||||
/* 02 */ uint16 source; // id of caster
|
/* 02 */ uint16 source; // id of caster
|
||||||
/* 04 */ uint16 level; // level of caster
|
/* 04 */ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||||
/* 06 */ uint16 instrument_mod;
|
/* 06 */ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||||
/* 08 */ uint32 bard_focus_id;
|
/* 10 */ float force;
|
||||||
/* 12 */ uint16 unknown16;
|
/* 14 */ float hit_heading;
|
||||||
// some kind of sequence that's the same in both actions
|
/* 18 */ float hit_pitch;
|
||||||
// as well as the combat damage, to tie em together?
|
/* 22 */ uint8 type; // 231 (0xE7) for spells, skill
|
||||||
/* 14 */ uint32 sequence;
|
/* 23 */ uint16 unknown23; // OSX says min_damage
|
||||||
/* 18 */ uint32 unknown18;
|
/* 25 */ uint16 unknown25; // OSX says tohit
|
||||||
/* 22 */ uint8 type; // 231 (0xE7) for spells
|
|
||||||
/* 23 */ uint32 unknown23;
|
|
||||||
/* 27 */ uint16 spell; // spell id being cast
|
/* 27 */ uint16 spell; // spell id being cast
|
||||||
/* 29 */ uint8 unknown29;
|
/* 29 */ uint8 spell_level;
|
||||||
// this field seems to be some sort of success flag, if it's 4
|
// this field seems to be some sort of success flag, if it's 4
|
||||||
/* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made
|
/* 30 */ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||||
/* 31 */
|
// newer clients have some data for setting LaunchSpellData when effect_flag & 4
|
||||||
|
// /* 31 */ uint8 spell_gem;
|
||||||
|
// /* 32 */ uint32 inventory_slot;
|
||||||
|
// /* 36 */ uint32 item_cast_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is what prints the You have been struck. and the regular
|
// this is what prints the You have been struck. and the regular
|
||||||
@@ -1315,12 +1278,12 @@ struct CombatDamage_Struct
|
|||||||
{
|
{
|
||||||
/* 00 */ uint16 target;
|
/* 00 */ uint16 target;
|
||||||
/* 02 */ uint16 source;
|
/* 02 */ uint16 source;
|
||||||
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells
|
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells, skill
|
||||||
/* 05 */ uint16 spellid;
|
/* 05 */ uint16 spellid;
|
||||||
/* 07 */ uint32 damage;
|
/* 07 */ uint32 damage;
|
||||||
/* 11 */ float force;
|
/* 11 */ float force;
|
||||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||||
/* 19 */ float meleepush_z;
|
/* 19 */ float hit_pitch;
|
||||||
/* 23 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
/* 23 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1522,7 +1485,7 @@ enum ItemPacketType
|
|||||||
ItemPacketLoot = 0x66,
|
ItemPacketLoot = 0x66,
|
||||||
ItemPacketTrade = 0x67,
|
ItemPacketTrade = 0x67,
|
||||||
ItemPacketCharInventory = 0x69,
|
ItemPacketCharInventory = 0x69,
|
||||||
ItemPacketSummonItem = 0x6A,
|
ItemPacketLimbo = 0x6A,
|
||||||
ItemPacketWorldContainer = 0x6B,
|
ItemPacketWorldContainer = 0x6B,
|
||||||
ItemPacketTributeItem = 0x6C,
|
ItemPacketTributeItem = 0x6C,
|
||||||
ItemPacketGuildTribute = 0x6D,
|
ItemPacketGuildTribute = 0x6D,
|
||||||
@@ -1536,15 +1499,15 @@ enum ItemPacketType
|
|||||||
// ItemPacketTradeView = /*101*/ 0x65,
|
// ItemPacketTradeView = /*101*/ 0x65,
|
||||||
// ItemPacketLoot = /*102*/ 0x66,
|
// ItemPacketLoot = /*102*/ 0x66,
|
||||||
// ItemPacketTrade = /*103*/ 0x67,
|
// ItemPacketTrade = /*103*/ 0x67,
|
||||||
// ItemPacketCharInventory = /*105*/ 0x69,
|
// ItemPacketCharInventory = /*105*/ 0x69, // 105 looks like raw item packet (no appearance update) thru shared bank..110, possibly possessions with appearance update
|
||||||
// ItemPacketLimbo = /*106*/ 0x6A, // name change
|
// ItemPacketLimbo = /*106*/ 0x6A,
|
||||||
// ItemPacketWorldContainer = /*107*/ 0x6B,
|
// ItemPacketWorldContainer = /*107*/ 0x6B,
|
||||||
// ItemPacketTributeItem = /*108*/ 0x6C,
|
// ItemPacketTributeItem = /*108*/ 0x6C,
|
||||||
// ItemPacketGuildTribute = /*109*/ 0x6D, // missing from EQEmu
|
// ItemPacketGuildTribute = /*109*/ 0x6D, // missing from EQEmu
|
||||||
// ItemPacket10 = /*110*/ 0x6E,
|
// ItemPacket10 = /*110*/ 0x6E,
|
||||||
// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess)
|
// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess) (appearance (over-level) items?)
|
||||||
// ItemPacket12 = /*112*/ 0x70, // RoF+ (causes stat update) (could be TrophyTribute and GuildTrophyTribute together - two case methodology - is it checking for GuildID?)
|
// ItemPacket12 = /*112*/ 0x70, // RoF+ (causes stat update) (could be TrophyTribute and GuildTrophyTribute together - two case methodology - is it checking for GuildID?)
|
||||||
// ItemPacketRecovery = /*113*/ 0x71, (same handler as merchant..exception: parameter is '1' versus merchant '0' looks like tab id)
|
// ItemPacketMerchantRecovery = /*113*/ 0x71,
|
||||||
// ItemPacket14 = /*115*/ 0x73, (real estate/moving crate?)
|
// ItemPacket14 = /*115*/ 0x73, (real estate/moving crate?)
|
||||||
// ItemPacket__ = /*xxx*/ 0xXX // switch 'default' - all clients
|
// ItemPacket__ = /*xxx*/ 0xXX // switch 'default' - all clients
|
||||||
//};
|
//};
|
||||||
@@ -1690,7 +1653,7 @@ struct LootingItem_Struct {
|
|||||||
/*002*/ uint32 looter;
|
/*002*/ uint32 looter;
|
||||||
/*004*/ uint16 slot_id;
|
/*004*/ uint16 slot_id;
|
||||||
/*006*/ uint8 unknown3[2];
|
/*006*/ uint8 unknown3[2];
|
||||||
/*008*/ uint32 auto_loot;
|
/*008*/ int32 auto_loot;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildManageStatus_Struct{
|
struct GuildManageStatus_Struct{
|
||||||
@@ -1737,6 +1700,7 @@ struct OnLevelMessage_Struct
|
|||||||
uint32 Duration;
|
uint32 Duration;
|
||||||
uint32 PopupID;
|
uint32 PopupID;
|
||||||
uint32 NegativeID;
|
uint32 NegativeID;
|
||||||
|
uint32 SoundControls;
|
||||||
char ButtonName0[25];
|
char ButtonName0[25];
|
||||||
char ButtonName1[25];
|
char ButtonName1[25];
|
||||||
};
|
};
|
||||||
@@ -1981,8 +1945,7 @@ struct Merchant_Sell_Struct {
|
|||||||
/*004*/ uint32 playerid; // Player's entity id
|
/*004*/ uint32 playerid; // Player's entity id
|
||||||
/*008*/ uint32 itemslot;
|
/*008*/ uint32 itemslot;
|
||||||
uint32 unknown12;
|
uint32 unknown12;
|
||||||
/*016*/ uint8 quantity; // Already sold
|
/*016*/ uint32 quantity;
|
||||||
/*017*/ uint8 Unknown016[3];
|
|
||||||
/*020*/ uint32 price;
|
/*020*/ uint32 price;
|
||||||
};
|
};
|
||||||
struct Merchant_Purchase_Struct {
|
struct Merchant_Purchase_Struct {
|
||||||
@@ -2119,7 +2082,7 @@ struct AdventureLeaderboard_Struct
|
|||||||
/*struct Item_Shop_Struct {
|
/*struct Item_Shop_Struct {
|
||||||
uint16 merchantid;
|
uint16 merchantid;
|
||||||
uint8 itemtype;
|
uint8 itemtype;
|
||||||
EQEmu::Item_Struct item;
|
EQEmu::ItemData item;
|
||||||
uint8 iss_unknown001[6];
|
uint8 iss_unknown001[6];
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
@@ -2145,7 +2108,7 @@ struct Illusion_Struct { //size: 256 - SoF
|
|||||||
/*092*/ uint32 drakkin_heritage; //
|
/*092*/ uint32 drakkin_heritage; //
|
||||||
/*096*/ uint32 drakkin_tattoo; //
|
/*096*/ uint32 drakkin_tattoo; //
|
||||||
/*100*/ uint32 drakkin_details; //
|
/*100*/ uint32 drakkin_details; //
|
||||||
/*104*/ uint32 armor_tint[EQEmu::legacy::MaterialCount]; //
|
/*104*/ EQEmu::TintProfile armor_tint; //
|
||||||
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
|
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
|
||||||
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
|
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
|
||||||
/*142*/ uint8 unknown138[114]; //
|
/*142*/ uint8 unknown138[114]; //
|
||||||
@@ -2291,6 +2254,7 @@ struct GroupFollow_Struct { // SoF Follow Struct
|
|||||||
/*0132*/
|
/*0132*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this is generic struct
|
||||||
struct GroupLeaderChange_Struct
|
struct GroupLeaderChange_Struct
|
||||||
{
|
{
|
||||||
/*000*/ char Unknown000[64];
|
/*000*/ char Unknown000[64];
|
||||||
@@ -2543,6 +2507,7 @@ struct BookRequest_Struct {
|
|||||||
uint8 window; // where to display the text (0xFF means new window)
|
uint8 window; // where to display the text (0xFF means new window)
|
||||||
uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others.
|
uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others.
|
||||||
uint32 invslot; // Only used in Sof and later clients;
|
uint32 invslot; // Only used in Sof and later clients;
|
||||||
|
int16 subslot; // The subslot inside of a bag if it is inside one.
|
||||||
char txtfile[20];
|
char txtfile[20];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2556,23 +2521,25 @@ struct BookRequest_Struct {
|
|||||||
*/
|
*/
|
||||||
struct Object_Struct {
|
struct Object_Struct {
|
||||||
/*00*/ uint32 linked_list_addr[2];// They are, get this, prev and next, ala linked list
|
/*00*/ uint32 linked_list_addr[2];// They are, get this, prev and next, ala linked list
|
||||||
/*08*/ uint16 size; //
|
/*08*/ float size; //
|
||||||
/*10*/ uint16 solidtype; //
|
/*10*/ uint16 solidtype; //
|
||||||
/*12*/ uint32 drop_id; // Unique object id for zone
|
/*12*/ uint32 drop_id; // Unique object id for zone
|
||||||
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
|
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
|
||||||
/*18*/ uint16 zone_instance; //
|
/*18*/ uint16 zone_instance; //
|
||||||
/*20*/ uint32 unknown020; //
|
/*20*/ uint32 unknown020; //
|
||||||
/*24*/ uint32 unknown024; //
|
/*24*/ uint32 unknown024; //
|
||||||
/*28*/ float heading; // heading
|
/*28*/ float tilt_x;
|
||||||
/*32*/ float z; // z coord
|
/*32*/ float tilt_y;
|
||||||
/*36*/ float x; // x coord
|
/*36*/ float heading; // heading
|
||||||
/*40*/ float y; // y coord
|
/*40*/ float z; // z coord
|
||||||
/*44*/ char object_name[32]; // Name of object, usually something like IT63_ACTORDEF
|
/*44*/ float x; // x coord
|
||||||
/*76*/ uint32 unknown076; //
|
/*76*/ float y; // y coord
|
||||||
/*80*/ uint32 object_type; // Type of object, not directly translated to OP_OpenObject
|
/*80*/ char object_name[32]; // Name of object, usually something like IT63_ACTORDEF
|
||||||
/*84*/ uint32 unknown084; //set to 0xFF
|
/*84*/ uint32 unknown076; //
|
||||||
/*88*/ uint32 spawn_id; // Spawn Id of client interacting with object
|
/*88*/ uint32 object_type; // Type of object, not directly translated to OP_OpenObject
|
||||||
/*92*/
|
/*92*/ uint32 unknown084; //set to 0xFF
|
||||||
|
uint32 spawn_id; // Spawn Id of client interacting with object
|
||||||
|
|
||||||
};
|
};
|
||||||
// 01 = generic drop, 02 = armor, 19 = weapon
|
// 01 = generic drop, 02 = armor, 19 = weapon
|
||||||
//[13:40] and 0xff seems to be indicative of the tradeskill/openable items that end up returning the old style item type in the OP_OpenObject
|
//[13:40] and 0xff seems to be indicative of the tradeskill/openable items that end up returning the old style item type in the OP_OpenObject
|
||||||
@@ -3357,23 +3324,32 @@ struct GuildMakeLeader{
|
|||||||
char target[64];
|
char target[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BugStruct{
|
struct BugReport_Struct {
|
||||||
/*0000*/ char chartype[64];
|
/*0000*/ uint32 category_id;
|
||||||
/*0064*/ char name[96];
|
/*0004*/ char category_name[64];
|
||||||
/*0160*/ char ui[128];
|
/*0068*/ char reporter_name[64];
|
||||||
/*0288*/ float x;
|
/*0132*/ char unused_0132[32];
|
||||||
/*0292*/ float y;
|
/*0164*/ char ui_path[128];
|
||||||
/*0296*/ float z;
|
/*0292*/ float pos_x;
|
||||||
/*0300*/ float heading;
|
/*0296*/ float pos_y;
|
||||||
/*0304*/ uint32 unknown304;
|
/*0300*/ float pos_z;
|
||||||
/*0308*/ char unknown308[160];
|
/*0304*/ uint32 heading;
|
||||||
/*0468*/ char target_name[64];
|
/*0308*/ uint32 unused_0308;
|
||||||
/*0532*/ uint32 type;
|
/*0312*/ uint32 time_played;
|
||||||
/*0536*/ char unknown536[2052];
|
/*0316*/ char padding_0316[8];
|
||||||
/*2584*/ char bug[2048];
|
/*0324*/ uint32 target_id;
|
||||||
/*4632*/ char unknown4632[6];
|
/*0328*/ char padding_0328[140];
|
||||||
/*4638*/ char system_info[4094];
|
/*0468*/ uint32 unknown_0468; // seems to always be '0'
|
||||||
|
/*0472*/ char target_name[64];
|
||||||
|
/*0536*/ uint32 optional_info_mask;
|
||||||
|
|
||||||
|
// this looks like a butchered 8k buffer with 2 trailing dword fields
|
||||||
|
/*0540*/ char unused_0540[2052];
|
||||||
|
/*2592*/ char bug_report[2050];
|
||||||
|
/*4642*/ char system_info[4098];
|
||||||
|
/*8740*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||||
uint8 level;
|
uint8 level;
|
||||||
uint8 class_;
|
uint8 class_;
|
||||||
@@ -3400,41 +3376,21 @@ struct Ground_Spawn{
|
|||||||
struct Ground_Spawns {
|
struct Ground_Spawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
struct PetitionBug_Struct{
|
|
||||||
uint32 petition_number;
|
|
||||||
uint32 unknown4;
|
|
||||||
char accountname[64];
|
|
||||||
uint32 zoneid;
|
|
||||||
char name[64];
|
|
||||||
uint32 level;
|
|
||||||
uint32 class_;
|
|
||||||
uint32 race;
|
|
||||||
uint32 unknown152[3];
|
|
||||||
uint32 time;
|
|
||||||
uint32 unknown168;
|
|
||||||
char text[1028];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DyeStruct
|
//struct PetitionBug_Struct{
|
||||||
{
|
// uint32 petition_number;
|
||||||
union
|
// uint32 unknown4;
|
||||||
{
|
// char accountname[64];
|
||||||
struct
|
// uint32 zoneid;
|
||||||
{
|
// char name[64];
|
||||||
struct Color_Struct head;
|
// uint32 level;
|
||||||
struct Color_Struct chest;
|
// uint32 class_;
|
||||||
struct Color_Struct arms;
|
// uint32 race;
|
||||||
struct Color_Struct wrists;
|
// uint32 unknown152[3];
|
||||||
struct Color_Struct hands;
|
// uint32 time;
|
||||||
struct Color_Struct legs;
|
// uint32 unknown168;
|
||||||
struct Color_Struct feet;
|
// char text[1028];
|
||||||
struct Color_Struct primary; // you can't actually dye this
|
//};
|
||||||
struct Color_Struct secondary; // or this
|
|
||||||
}
|
|
||||||
dyes;
|
|
||||||
struct Color_Struct dye[EQEmu::legacy::MaterialCount];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ApproveZone_Struct {
|
struct ApproveZone_Struct {
|
||||||
char name[64];
|
char name[64];
|
||||||
@@ -3584,6 +3540,20 @@ struct RecipeAutoCombine_Struct {
|
|||||||
// f5 ff ff ff in 'you dont have all the stuff' reply
|
// f5 ff ff ff in 'you dont have all the stuff' reply
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this is the "value#a" data
|
||||||
|
enum EParticlePoint {
|
||||||
|
eDefault,
|
||||||
|
eChest,
|
||||||
|
eHead,
|
||||||
|
eLeftHand,
|
||||||
|
eRigthHand,
|
||||||
|
eLeftFoot,
|
||||||
|
eRightFood,
|
||||||
|
eLeftEye,
|
||||||
|
eRightEye,
|
||||||
|
eMouth
|
||||||
|
};
|
||||||
|
|
||||||
struct LevelAppearance_Struct { //Sends a little graphic on level up
|
struct LevelAppearance_Struct { //Sends a little graphic on level up
|
||||||
uint32 spawn_id;
|
uint32 spawn_id;
|
||||||
uint32 parm1;
|
uint32 parm1;
|
||||||
@@ -4808,6 +4778,7 @@ struct BuffIconEntry_Struct
|
|||||||
uint32 spell_id;
|
uint32 spell_id;
|
||||||
int32 tics_remaining;
|
int32 tics_remaining;
|
||||||
uint32 num_hits;
|
uint32 num_hits;
|
||||||
|
char caster[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuffIcon_Struct
|
struct BuffIcon_Struct
|
||||||
@@ -4817,6 +4788,7 @@ struct BuffIcon_Struct
|
|||||||
uint16 count;
|
uint16 count;
|
||||||
uint8 type; // 0 = self buff window, 1 = self target window, 4 = group, 5 = PC, 7 = NPC
|
uint8 type; // 0 = self buff window, 1 = self target window, 4 = group, 5 = PC, 7 = NPC
|
||||||
int32 tic_timer;
|
int32 tic_timer;
|
||||||
|
int32 name_lengths; // so ahh we kind of do these packets hacky, this is the total length of all the names to make creating the real packets in the translators easier
|
||||||
BuffIconEntry_Struct entries[0];
|
BuffIconEntry_Struct entries[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5377,6 +5349,41 @@ struct fling_struct {
|
|||||||
/* 28 */
|
/* 28 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// used when action == 0
|
||||||
|
struct AuraCreate_Struct {
|
||||||
|
/* 00 */ uint32 action; // 0 = add, 1 = delete, 2 = reset
|
||||||
|
/* 04 */ uint32 type; // unsure -- normal auras show 1 clicky (ex. Circle of Power) show 0
|
||||||
|
/* 08 */ char aura_name[64];
|
||||||
|
/* 72 */ uint32 entity_id;
|
||||||
|
/* 76 */ uint32 icon;
|
||||||
|
/* 80 */
|
||||||
|
};
|
||||||
|
|
||||||
|
// used when action == 1
|
||||||
|
struct AuraDestory_Struct {
|
||||||
|
/* 00 */ uint32 action; // 0 = add, 1 = delete, 2 = reset
|
||||||
|
/* 04 */ uint32 entity_id;
|
||||||
|
/* 08 */
|
||||||
|
};
|
||||||
|
// I think we can assume it's just action for 2, client doesn't seem to do anything with the rest of the data in that case
|
||||||
|
|
||||||
|
struct SayLinkBodyFrame_Struct {
|
||||||
|
/*000*/ char ActionID[1];
|
||||||
|
/*001*/ char ItemID[5];
|
||||||
|
/*006*/ char Augment1[5];
|
||||||
|
/*011*/ char Augment2[5];
|
||||||
|
/*016*/ char Augment3[5];
|
||||||
|
/*021*/ char Augment4[5];
|
||||||
|
/*026*/ char Augment5[5];
|
||||||
|
/*031*/ char Augment6[5];
|
||||||
|
/*036*/ char IsEvolving[1];
|
||||||
|
/*037*/ char EvolveGroup[4];
|
||||||
|
/*041*/ char EvolveLevel[2];
|
||||||
|
/*043*/ char OrnamentIcon[5];
|
||||||
|
/*048*/ char Hash[8];
|
||||||
|
/*056*/
|
||||||
|
};
|
||||||
|
|
||||||
// Restore structure packing to default
|
// Restore structure packing to default
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|||||||
+119
-119
@@ -84,14 +84,14 @@ void EQStream::init(bool resetSession) {
|
|||||||
|
|
||||||
OpMgr = nullptr;
|
OpMgr = nullptr;
|
||||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
|
EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
|
||||||
{
|
{
|
||||||
EQRawApplicationPacket *ap=nullptr;
|
EQRawApplicationPacket *ap=nullptr;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size);
|
||||||
// _raw(NET__APP_CREATE_HEX, 0xFFFF, p);
|
// _raw(NET__APP_CREATE_HEX, 0xFFFF, p);
|
||||||
ap = p->MakeAppPacket();
|
ap = p->MakeAppPacket();
|
||||||
return ap;
|
return ap;
|
||||||
@@ -100,7 +100,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
|
|||||||
EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len)
|
EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len)
|
||||||
{
|
{
|
||||||
EQRawApplicationPacket *ap=nullptr;
|
EQRawApplicationPacket *ap=nullptr;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len);
|
Log(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len);
|
||||||
ap = new EQRawApplicationPacket(buf, len);
|
ap = new EQRawApplicationPacket(buf, len);
|
||||||
return ap;
|
return ap;
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
|
if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Session not initialized, packet ignored" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Session not initialized, packet ignored" __L);
|
||||||
// _raw(NET__DEBUG, 0xFFFF, p);
|
// _raw(NET__DEBUG, 0xFFFF, p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
while(processed < p->size) {
|
while(processed < p->size) {
|
||||||
subpacket_length=*(p->pBuffer+processed);
|
subpacket_length=*(p->pBuffer+processed);
|
||||||
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length);
|
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length);
|
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length);
|
||||||
// _raw(NET__NET_CREATE_HEX, 0xFFFF, subp);
|
// _raw(NET__NET_CREATE_HEX, 0xFFFF, subp);
|
||||||
subp->copyInfo(p);
|
subp->copyInfo(p);
|
||||||
ProcessPacket(subp);
|
ProcessPacket(subp);
|
||||||
@@ -156,12 +156,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
while(processed<p->size) {
|
while(processed<p->size) {
|
||||||
EQRawApplicationPacket *ap=nullptr;
|
EQRawApplicationPacket *ap=nullptr;
|
||||||
if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) {
|
if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
|
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
|
||||||
ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length);
|
ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length);
|
||||||
processed+=subpacket_length+1;
|
processed+=subpacket_length+1;
|
||||||
} else {
|
} else {
|
||||||
subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1));
|
subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1));
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
|
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
|
||||||
ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length);
|
ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length);
|
||||||
processed+=subpacket_length+3;
|
processed+=subpacket_length+3;
|
||||||
}
|
}
|
||||||
@@ -176,29 +176,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_Packet: {
|
case OP_Packet: {
|
||||||
if(!p->pBuffer || (p->Size() < 4))
|
if(!p->pBuffer || (p->Size() < 4))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Packet that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Packet that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
||||||
SeqOrder check=CompareSequence(NextInSeq,seq);
|
SeqOrder check=CompareSequence(NextInSeq,seq);
|
||||||
if (check == SeqFuture) {
|
if (check == SeqFuture) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
||||||
// _raw(NET__DEBUG, seq, p);
|
// _raw(NET__DEBUG, seq, p);
|
||||||
|
|
||||||
PacketQueue[seq]=p->Copy();
|
PacketQueue[seq]=p->Copy();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
||||||
|
|
||||||
//SendOutOfOrderAck(seq);
|
//SendOutOfOrderAck(seq);
|
||||||
|
|
||||||
} else if (check == SeqPast) {
|
} else if (check == SeqPast) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
||||||
// _raw(NET__DEBUG, seq, p);
|
// _raw(NET__DEBUG, seq, p);
|
||||||
SendOutOfOrderAck(seq); //we already got this packet but it was out of order
|
SendOutOfOrderAck(seq); //we already got this packet but it was out of order
|
||||||
} else {
|
} else {
|
||||||
// In case we did queue one before as well.
|
// In case we did queue one before as well.
|
||||||
EQProtocolPacket *qp=RemoveQueue(seq);
|
EQProtocolPacket *qp=RemoveQueue(seq);
|
||||||
if (qp) {
|
if (qp) {
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq);
|
Log(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq);
|
||||||
delete qp;
|
delete qp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
// Check for an embedded OP_AppCombinded (protocol level 0x19)
|
// Check for an embedded OP_AppCombinded (protocol level 0x19)
|
||||||
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
|
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
|
||||||
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2);
|
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size);
|
Log(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size);
|
||||||
// _raw(NET__NET_CREATE_HEX, seq, subp);
|
// _raw(NET__NET_CREATE_HEX, seq, subp);
|
||||||
subp->copyInfo(p);
|
subp->copyInfo(p);
|
||||||
ProcessPacket(subp);
|
ProcessPacket(subp);
|
||||||
@@ -226,29 +226,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_Fragment: {
|
case OP_Fragment: {
|
||||||
if(!p->pBuffer || (p->Size() < 4))
|
if(!p->pBuffer || (p->Size() < 4))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Fragment that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Fragment that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
||||||
SeqOrder check=CompareSequence(NextInSeq,seq);
|
SeqOrder check=CompareSequence(NextInSeq,seq);
|
||||||
if (check == SeqFuture) {
|
if (check == SeqFuture) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
||||||
// _raw(NET__DEBUG, seq, p);
|
// _raw(NET__DEBUG, seq, p);
|
||||||
|
|
||||||
PacketQueue[seq]=p->Copy();
|
PacketQueue[seq]=p->Copy();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size());
|
Log(Logs::Detail, Logs::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size());
|
||||||
|
|
||||||
//SendOutOfOrderAck(seq);
|
//SendOutOfOrderAck(seq);
|
||||||
|
|
||||||
} else if (check == SeqPast) {
|
} else if (check == SeqPast) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
|
||||||
// _raw(NET__DEBUG, seq, p);
|
// _raw(NET__DEBUG, seq, p);
|
||||||
SendOutOfOrderAck(seq);
|
SendOutOfOrderAck(seq);
|
||||||
} else {
|
} else {
|
||||||
// In case we did queue one before as well.
|
// In case we did queue one before as well.
|
||||||
EQProtocolPacket *qp=RemoveQueue(seq);
|
EQProtocolPacket *qp=RemoveQueue(seq);
|
||||||
if (qp) {
|
if (qp) {
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq);
|
Log(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq);
|
||||||
delete qp;
|
delete qp;
|
||||||
}
|
}
|
||||||
SetNextAckToSend(seq);
|
SetNextAckToSend(seq);
|
||||||
@@ -256,18 +256,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
if (oversize_buffer) {
|
if (oversize_buffer) {
|
||||||
memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2);
|
memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2);
|
||||||
oversize_offset+=p->size-2;
|
oversize_offset+=p->size-2;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length);
|
Log(Logs::Detail, Logs::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length);
|
||||||
if (oversize_offset==oversize_length) {
|
if (oversize_offset==oversize_length) {
|
||||||
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
|
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
|
||||||
EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset);
|
EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size);
|
Log(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size);
|
||||||
//// _raw(NET__NET_CREATE_HEX, subp);
|
//// _raw(NET__NET_CREATE_HEX, subp);
|
||||||
subp->copyInfo(p);
|
subp->copyInfo(p);
|
||||||
ProcessPacket(subp);
|
ProcessPacket(subp);
|
||||||
delete subp;
|
delete subp;
|
||||||
} else {
|
} else {
|
||||||
EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset);
|
EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size);
|
Log(Logs::Detail, Logs::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size);
|
||||||
if (ap) {
|
if (ap) {
|
||||||
ap->copyInfo(p);
|
ap->copyInfo(p);
|
||||||
InboundQueuePush(ap);
|
InboundQueuePush(ap);
|
||||||
@@ -282,20 +282,20 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
oversize_buffer=new unsigned char[oversize_length];
|
oversize_buffer=new unsigned char[oversize_length];
|
||||||
memcpy(oversize_buffer,p->pBuffer+6,p->size-6);
|
memcpy(oversize_buffer,p->pBuffer+6,p->size-6);
|
||||||
oversize_offset=p->size-6;
|
oversize_offset=p->size-6;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length);
|
Log(Logs::Detail, Logs::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_KeepAlive: {
|
case OP_KeepAlive: {
|
||||||
NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size));
|
NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size));
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_Ack: {
|
case OP_Ack: {
|
||||||
if(!p->pBuffer || (p->Size() < 4))
|
if(!p->pBuffer || (p->Size() < 4))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
||||||
@@ -309,11 +309,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_SessionRequest: {
|
case OP_SessionRequest: {
|
||||||
if(p->Size() < sizeof(SessionRequest))
|
if(p->Size() < sizeof(SessionRequest))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (GetState()==ESTABLISHED) {
|
if (GetState()==ESTABLISHED) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts);
|
||||||
|
|
||||||
// client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case
|
// client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case
|
||||||
// streamactive means we identified the opcode for the stream, we cannot re-establish this connection
|
// streamactive means we identified the opcode for the stream, we cannot re-establish this connection
|
||||||
@@ -331,7 +331,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
SessionRequest *Request=(SessionRequest *)p->pBuffer;
|
SessionRequest *Request=(SessionRequest *)p->pBuffer;
|
||||||
Session=ntohl(Request->Session);
|
Session=ntohl(Request->Session);
|
||||||
SetMaxLen(ntohl(Request->MaxLength));
|
SetMaxLen(ntohl(Request->MaxLength));
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen);
|
||||||
SetState(ESTABLISHED);
|
SetState(ESTABLISHED);
|
||||||
Key=0x11223344;
|
Key=0x11223344;
|
||||||
SendSessionResponse();
|
SendSessionResponse();
|
||||||
@@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_SessionResponse: {
|
case OP_SessionResponse: {
|
||||||
if(p->Size() < sizeof(SessionResponse))
|
if(p->Size() < sizeof(SessionResponse))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
compressed=(Response->Format&FLAG_COMPRESSED);
|
compressed=(Response->Format&FLAG_COMPRESSED);
|
||||||
encoded=(Response->Format&FLAG_ENCODED);
|
encoded=(Response->Format&FLAG_ENCODED);
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no");
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no");
|
||||||
|
|
||||||
// Kinda kludgy, but trie for now
|
// Kinda kludgy, but trie for now
|
||||||
if (StreamType==UnknownStream) {
|
if (StreamType==UnknownStream) {
|
||||||
@@ -379,17 +379,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
EQStreamState state = GetState();
|
EQStreamState state = GetState();
|
||||||
if(state == ESTABLISHED) {
|
if(state == ESTABLISHED) {
|
||||||
//client initiated disconnect?
|
//client initiated disconnect?
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L);
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
SetState(CLOSED);
|
SetState(CLOSED);
|
||||||
} else if(state == CLOSING) {
|
} else if(state == CLOSING) {
|
||||||
//we were waiting for this anyways, ignore pending messages, send the reply and be closed.
|
//we were waiting for this anyways, ignore pending messages, send the reply and be closed.
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L);
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
SetState(CLOSED);
|
SetState(CLOSED);
|
||||||
} else {
|
} else {
|
||||||
//we are expecting this (or have already gotten it, but dont care either way)
|
//we are expecting this (or have already gotten it, but dont care either way)
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L);
|
||||||
SetState(CLOSED);
|
SetState(CLOSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,24 +397,24 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_OutOfOrderAck: {
|
case OP_OutOfOrderAck: {
|
||||||
if(!p->pBuffer || (p->Size() < 4))
|
if(!p->pBuffer || (p->Size() < 4))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
|
|
||||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the packet they got out of order is between our last acked packet and the last sent packet, then its valid.
|
//if the packet they got out of order is between our last acked packet and the last sent packet, then its valid.
|
||||||
if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) {
|
if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L,
|
||||||
seq, SequencedBase, SequencedBase+SequencedQueue.size());
|
seq, SequencedBase, SequencedBase+SequencedQueue.size());
|
||||||
|
|
||||||
uint16 sqsize = SequencedQueue.size();
|
uint16 sqsize = SequencedQueue.size();
|
||||||
uint16 index = seq - SequencedBase;
|
uint16 index = seq - SequencedBase;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
|
Log(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
|
||||||
if (index < sqsize) {
|
if (index < sqsize) {
|
||||||
SequencedQueue[index]->acked = true;
|
SequencedQueue[index]->acked = true;
|
||||||
// flag packets for a resend
|
// flag packets for a resend
|
||||||
@@ -423,7 +423,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) {
|
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) {
|
||||||
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) {
|
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) {
|
||||||
(*sitr)->sent_time = 0;
|
(*sitr)->sent_time = 0;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck Flagging packet %d for retransmission" __L, SequencedBase + count);
|
Log(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck Flagging packet %d for retransmission" __L, SequencedBase + count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,11 +432,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
retransmittimer = Timer::GetCurrentTime();
|
retransmittimer = Timer::GetCurrentTime();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOutboundQueue.unlock();
|
MOutboundQueue.unlock();
|
||||||
@@ -445,11 +445,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
case OP_SessionStatRequest: {
|
case OP_SessionStatRequest: {
|
||||||
if(p->Size() < sizeof(ClientSessionStats))
|
if(p->Size() < sizeof(ClientSessionStats))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer;
|
ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L,
|
||||||
(unsigned long)ntohl(ClientStats->packets_received), (unsigned long)ntohl(ClientStats->packets_sent), (unsigned long)ntohl(ClientStats->last_local_delta),
|
(unsigned long)ntohl(ClientStats->packets_received), (unsigned long)ntohl(ClientStats->packets_sent), (unsigned long)ntohl(ClientStats->last_local_delta),
|
||||||
(unsigned long)ntohl(ClientStats->low_delta), (unsigned long)ntohl(ClientStats->average_delta),
|
(unsigned long)ntohl(ClientStats->low_delta), (unsigned long)ntohl(ClientStats->average_delta),
|
||||||
(unsigned long)ntohl(ClientStats->high_delta), (unsigned long)ntohl(ClientStats->last_remote_delta));
|
(unsigned long)ntohl(ClientStats->high_delta), (unsigned long)ntohl(ClientStats->last_remote_delta));
|
||||||
@@ -468,7 +468,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
retransmittimeout += 300;
|
retransmittimeout += 300;
|
||||||
if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX)
|
if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX)
|
||||||
retransmittimeout = RETRANSMIT_TIMEOUT_MAX;
|
retransmittimeout = RETRANSMIT_TIMEOUT_MAX;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout);
|
Log(Logs::Detail, Logs::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,11 +485,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_SessionStatResponse: {
|
case OP_SessionStatResponse: {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_OutOfSession: {
|
case OP_OutOfSession: {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfSession. Ignoring." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfSession. Ignoring." __L);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -520,7 +520,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(OpMgr == nullptr || *OpMgr == nullptr) {
|
if(OpMgr == nullptr || *OpMgr == nullptr) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L);
|
||||||
delete pack;
|
delete pack;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -529,7 +529,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
|
|||||||
if(pack->GetOpcodeBypass() != 0) {
|
if(pack->GetOpcodeBypass() != 0) {
|
||||||
opcode = pack->GetOpcodeBypass();
|
opcode = pack->GetOpcodeBypass();
|
||||||
} else {
|
} else {
|
||||||
opcode = (*OpMgr)->EmuToEQ(pack->emu_opcode);
|
opcode = (*OpMgr)->EmuToEQ(pack->GetOpcode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ack_req) {
|
if (!ack_req) {
|
||||||
@@ -545,32 +545,32 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
|||||||
uint32 chunksize, used;
|
uint32 chunksize, used;
|
||||||
uint32 length;
|
uint32 length;
|
||||||
|
|
||||||
if (Log.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
if (LogSys.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log.Out(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Log.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
if (LogSys.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log.Out(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert the EQApplicationPacket to 1 or more EQProtocolPackets
|
// Convert the EQApplicationPacket to 1 or more EQProtocolPackets
|
||||||
if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2)
|
if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2)
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Making oversized packet, len %d" __L, p->Size());
|
Log(Logs::Detail, Logs::Netcode, _L "Making oversized packet, len %d" __L, p->Size());
|
||||||
|
|
||||||
auto tmpbuff = new unsigned char[p->size + 3];
|
auto tmpbuff = new unsigned char[p->size + 3];
|
||||||
length=p->serialize(opcode, tmpbuff);
|
length=p->serialize(opcode, tmpbuff);
|
||||||
if (length != p->Size())
|
if (length != p->Size())
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Packet adjustment, len %d to %d" __L, p->Size(), length);
|
Log(Logs::Detail, Logs::Netcode, _L "Packet adjustment, len %d to %d" __L, p->Size(), length);
|
||||||
|
|
||||||
auto out = new EQProtocolPacket(OP_Fragment, nullptr, MaxLen - 4);
|
auto out = new EQProtocolPacket(OP_Fragment, nullptr, MaxLen - 4);
|
||||||
*(uint32 *)(out->pBuffer+2)=htonl(length);
|
*(uint32 *)(out->pBuffer+2)=htonl(length);
|
||||||
used=MaxLen-10;
|
used=MaxLen-10;
|
||||||
memcpy(out->pBuffer+6,tmpbuff,used);
|
memcpy(out->pBuffer+6,tmpbuff,used);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "First fragment: used %d/%d. Payload size %d in the packet" __L, used, length, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "First fragment: used %d/%d. Payload size %d in the packet" __L, used, length, p->size);
|
||||||
SequencedPush(out);
|
SequencedPush(out);
|
||||||
|
|
||||||
|
|
||||||
@@ -581,7 +581,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
|||||||
out->size=chunksize+2;
|
out->size=chunksize+2;
|
||||||
SequencedPush(out);
|
SequencedPush(out);
|
||||||
used+=chunksize;
|
used+=chunksize;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, length);
|
Log(Logs::Detail, Logs::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, length);
|
||||||
}
|
}
|
||||||
delete p;
|
delete p;
|
||||||
delete[] tmpbuff;
|
delete[] tmpbuff;
|
||||||
@@ -602,18 +602,18 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
|
|||||||
{
|
{
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
||||||
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L,
|
||||||
NextOutSeq, p->size, SequencedBase);
|
NextOutSeq, p->size, SequencedBase);
|
||||||
*(uint16 *)(p->pBuffer) = htons(NextOutSeq);
|
*(uint16 *)(p->pBuffer) = htons(NextOutSeq);
|
||||||
SequencedQueue.push_back(p);
|
SequencedQueue.push_back(p);
|
||||||
NextOutSeq++;
|
NextOutSeq++;
|
||||||
|
|
||||||
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
||||||
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,7 +623,7 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
|
|||||||
void EQStream::NonSequencedPush(EQProtocolPacket *p)
|
void EQStream::NonSequencedPush(EQProtocolPacket *p)
|
||||||
{
|
{
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size);
|
||||||
NonSequencedQueue.push(p);
|
NonSequencedQueue.push(p);
|
||||||
MOutboundQueue.unlock();
|
MOutboundQueue.unlock();
|
||||||
}
|
}
|
||||||
@@ -631,14 +631,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p)
|
|||||||
void EQStream::SendAck(uint16 seq)
|
void EQStream::SendAck(uint16 seq)
|
||||||
{
|
{
|
||||||
uint16 Seq=htons(seq);
|
uint16 Seq=htons(seq);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending ack with sequence %d" __L, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Sending ack with sequence %d" __L, seq);
|
||||||
SetLastAckSent(seq);
|
SetLastAckSent(seq);
|
||||||
NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16)));
|
NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStream::SendOutOfOrderAck(uint16 seq)
|
void EQStream::SendOutOfOrderAck(uint16 seq)
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending out of order ack with sequence %d" __L, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Sending out of order ack with sequence %d" __L, seq);
|
||||||
uint16 Seq=htons(seq);
|
uint16 Seq=htons(seq);
|
||||||
NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16)));
|
NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16)));
|
||||||
}
|
}
|
||||||
@@ -688,24 +688,24 @@ void EQStream::Write(int eq_fd)
|
|||||||
// If we don't have a packet to try to combine into, use this one as the base
|
// If we don't have a packet to try to combine into, use this one as the base
|
||||||
// And remove it form the queue
|
// And remove it form the queue
|
||||||
p = NonSequencedQueue.front();
|
p = NonSequencedQueue.front();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size);
|
||||||
NonSequencedQueue.pop();
|
NonSequencedQueue.pop();
|
||||||
} else if (!p->combine(NonSequencedQueue.front())) {
|
} else if (!p->combine(NonSequencedQueue.front())) {
|
||||||
// Trying to combine this packet with the base didn't work (too big maybe)
|
// Trying to combine this packet with the base didn't work (too big maybe)
|
||||||
// So just send the base packet (we'll try this packet again later)
|
// So just send the base packet (we'll try this packet again later)
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten+=p->size;
|
BytesWritten+=p->size;
|
||||||
p=nullptr;
|
p=nullptr;
|
||||||
|
|
||||||
if (BytesWritten > threshold) {
|
if (BytesWritten > threshold) {
|
||||||
// Sent enough this round, lets stop to be fair
|
// Sent enough this round, lets stop to be fair
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold);
|
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Combine worked, so just remove this packet and it's spot in the queue
|
// Combine worked, so just remove this packet and it's spot in the queue
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size);
|
||||||
delete NonSequencedQueue.front();
|
delete NonSequencedQueue.front();
|
||||||
NonSequencedQueue.pop();
|
NonSequencedQueue.pop();
|
||||||
}
|
}
|
||||||
@@ -718,7 +718,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
uint16 seq_send = SequencedBase + count; //just for logging...
|
uint16 seq_send = SequencedBase + count; //just for logging...
|
||||||
|
|
||||||
if(SequencedQueue.empty()) {
|
if(SequencedQueue.empty()) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq);
|
||||||
SeqEmpty=true;
|
SeqEmpty=true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -728,35 +728,35 @@ void EQStream::Write(int eq_fd)
|
|||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
if (p) {
|
if (p) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten += p->size;
|
BytesWritten += p->size;
|
||||||
p = nullptr;
|
p = nullptr;
|
||||||
}
|
}
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send);
|
Log(Logs::Detail, Logs::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send);
|
||||||
} else if (!p) {
|
} else if (!p) {
|
||||||
// If we don't have a packet to try to combine into, use this one as the base
|
// If we don't have a packet to try to combine into, use this one as the base
|
||||||
// Copy it first as it will still live until it is acked
|
// Copy it first as it will still live until it is acked
|
||||||
p=(*sitr)->Copy();
|
p=(*sitr)->Copy();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
||||||
(*sitr)->sent_time = Timer::GetCurrentTime();
|
(*sitr)->sent_time = Timer::GetCurrentTime();
|
||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
} else if (!p->combine(*sitr)) {
|
} else if (!p->combine(*sitr)) {
|
||||||
// Trying to combine this packet with the base didn't work (too big maybe)
|
// Trying to combine this packet with the base didn't work (too big maybe)
|
||||||
// So just send the base packet (we'll try this packet again later)
|
// So just send the base packet (we'll try this packet again later)
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send + 1, (*sitr)->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send + 1, (*sitr)->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten+=p->size;
|
BytesWritten+=p->size;
|
||||||
p=nullptr;
|
p=nullptr;
|
||||||
if ((*sitr)->opcode != OP_Fragment && BytesWritten > threshold) {
|
if ((*sitr)->opcode != OP_Fragment && BytesWritten > threshold) {
|
||||||
// Sent enough this round, lets stop to be fair
|
// Sent enough this round, lets stop to be fair
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
|
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Combine worked
|
// Combine worked
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
||||||
(*sitr)->sent_time = Timer::GetCurrentTime();
|
(*sitr)->sent_time = Timer::GetCurrentTime();
|
||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
@@ -766,7 +766,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
if (p) {
|
if (p) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten += p->size;
|
BytesWritten += p->size;
|
||||||
p = nullptr;
|
p = nullptr;
|
||||||
@@ -776,25 +776,25 @@ void EQStream::Write(int eq_fd)
|
|||||||
// Copy it first as it will still live until it is acked
|
// Copy it first as it will still live until it is acked
|
||||||
p=(*sitr)->Copy();
|
p=(*sitr)->Copy();
|
||||||
(*sitr)->sent_time = Timer::GetCurrentTime();
|
(*sitr)->sent_time = Timer::GetCurrentTime();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
} else if (!p->combine(*sitr)) {
|
} else if (!p->combine(*sitr)) {
|
||||||
// Trying to combine this packet with the base didn't work (too big maybe)
|
// Trying to combine this packet with the base didn't work (too big maybe)
|
||||||
// So just send the base packet (we'll try this packet again later)
|
// So just send the base packet (we'll try this packet again later)
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten+=p->size;
|
BytesWritten+=p->size;
|
||||||
p=nullptr;
|
p=nullptr;
|
||||||
|
|
||||||
if (BytesWritten > threshold) {
|
if (BytesWritten > threshold) {
|
||||||
// Sent enough this round, lets stop to be fair
|
// Sent enough this round, lets stop to be fair
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
|
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Combine worked
|
// Combine worked
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yielding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yielding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
||||||
(*sitr)->sent_time = Timer::GetCurrentTime();
|
(*sitr)->sent_time = Timer::GetCurrentTime();
|
||||||
++sitr;
|
++sitr;
|
||||||
++count;
|
++count;
|
||||||
@@ -802,7 +802,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No more sequenced packets
|
// No more sequenced packets
|
||||||
@@ -814,7 +814,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
|
|
||||||
// We have a packet still, must have run out of both seq and non-seq, so send it
|
// We have a packet still, must have run out of both seq and non-seq, so send it
|
||||||
if (p) {
|
if (p) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
|
||||||
ReadyToSend.push(p);
|
ReadyToSend.push(p);
|
||||||
BytesWritten+=p->size;
|
BytesWritten+=p->size;
|
||||||
}
|
}
|
||||||
@@ -831,7 +831,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
if(SeqEmpty && NonSeqEmpty) {
|
if(SeqEmpty && NonSeqEmpty) {
|
||||||
//no more data to send
|
//no more data to send
|
||||||
if(CheckState(CLOSING)) {
|
if(CheckState(CLOSING)) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "All outgoing data flushed, closing stream." __L );
|
Log(Logs::Detail, Logs::Netcode, _L "All outgoing data flushed, closing stream." __L );
|
||||||
//we are waiting for the queues to empty, now we can do our disconnect.
|
//we are waiting for the queues to empty, now we can do our disconnect.
|
||||||
//this packet will not actually go out until the next call to Write().
|
//this packet will not actually go out until the next call to Write().
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
@@ -896,7 +896,7 @@ void EQStream::SendSessionResponse()
|
|||||||
|
|
||||||
out->size=sizeof(SessionResponse);
|
out->size=sizeof(SessionResponse);
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L,
|
||||||
(unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no");
|
(unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no");
|
||||||
|
|
||||||
NonSequencedPush(out);
|
NonSequencedPush(out);
|
||||||
@@ -910,7 +910,7 @@ void EQStream::SendSessionRequest()
|
|||||||
Request->Session=htonl(time(nullptr));
|
Request->Session=htonl(time(nullptr));
|
||||||
Request->MaxLength=htonl(512);
|
Request->MaxLength=htonl(512);
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength));
|
Log(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength));
|
||||||
|
|
||||||
NonSequencedPush(out);
|
NonSequencedPush(out);
|
||||||
}
|
}
|
||||||
@@ -924,7 +924,7 @@ void EQStream::_SendDisconnect()
|
|||||||
*(uint32 *)out->pBuffer=htonl(Session);
|
*(uint32 *)out->pBuffer=htonl(Session);
|
||||||
NonSequencedPush(out);
|
NonSequencedPush(out);
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session);
|
Log(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
|
void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
|
||||||
@@ -950,7 +950,7 @@ EQRawApplicationPacket *p=nullptr;
|
|||||||
if (OpMgr != nullptr && *OpMgr != nullptr) {
|
if (OpMgr != nullptr && *OpMgr != nullptr) {
|
||||||
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
|
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
|
||||||
if (emu_op == OP_Unknown) {
|
if (emu_op == OP_Unknown) {
|
||||||
// Log.Out(Logs::General, Logs::Client_Server_Packet_Unhandled, "Unknown :: [%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->opcode, p->Size(), DumpPacketToString(p).c_str());
|
// Log(Logs::General, Logs::Client_Server_Packet_Unhandled, "Unknown :: [%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->opcode, p->Size(), DumpPacketToString(p).c_str());
|
||||||
}
|
}
|
||||||
p->SetOpcode(emu_op);
|
p->SetOpcode(emu_op);
|
||||||
}
|
}
|
||||||
@@ -976,7 +976,7 @@ EQRawApplicationPacket *p=nullptr;
|
|||||||
if(OpMgr != nullptr && *OpMgr != nullptr) {
|
if(OpMgr != nullptr && *OpMgr != nullptr) {
|
||||||
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
|
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
|
||||||
if(emu_op == OP_Unknown) {
|
if(emu_op == OP_Unknown) {
|
||||||
Log.Out(Logs::General, Logs::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
|
Log(Logs::General, Logs::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->SetOpcode(emu_op);
|
p->SetOpcode(emu_op);
|
||||||
@@ -1004,7 +1004,7 @@ void EQStream::InboundQueueClear()
|
|||||||
{
|
{
|
||||||
EQApplicationPacket *p=nullptr;
|
EQApplicationPacket *p=nullptr;
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing inbound queue" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Clearing inbound queue" __L);
|
||||||
|
|
||||||
MInboundQueue.lock();
|
MInboundQueue.lock();
|
||||||
if (!InboundQueue.empty()) {
|
if (!InboundQueue.empty()) {
|
||||||
@@ -1047,7 +1047,7 @@ void EQStream::OutboundQueueClear()
|
|||||||
{
|
{
|
||||||
EQProtocolPacket *p=nullptr;
|
EQProtocolPacket *p=nullptr;
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing outbound queue" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Clearing outbound queue" __L);
|
||||||
|
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
while(!NonSequencedQueue.empty()) {
|
while(!NonSequencedQueue.empty()) {
|
||||||
@@ -1069,7 +1069,7 @@ void EQStream::PacketQueueClear()
|
|||||||
{
|
{
|
||||||
EQProtocolPacket *p=nullptr;
|
EQProtocolPacket *p=nullptr;
|
||||||
|
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing future packet queue" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Clearing future packet queue" __L);
|
||||||
|
|
||||||
if(!PacketQueue.empty()) {
|
if(!PacketQueue.empty()) {
|
||||||
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
|
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
|
||||||
@@ -1101,7 +1101,7 @@ void EQStream::Process(const unsigned char *buffer, const uint32 length)
|
|||||||
delete p;
|
delete p;
|
||||||
ProcessQueue();
|
ProcessQueue();
|
||||||
} else {
|
} else {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1132,23 +1132,23 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
|
|||||||
SeqOrder ord = CompareSequence(SequencedBase, seq);
|
SeqOrder ord = CompareSequence(SequencedBase, seq);
|
||||||
if(ord == SeqInOrder) {
|
if(ord == SeqInOrder) {
|
||||||
//they are not acking anything new...
|
//they are not acking anything new...
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq);
|
||||||
} else if(ord == SeqPast) {
|
} else if(ord == SeqPast) {
|
||||||
//they are nacking blocks going back before our buffer, wtf?
|
//they are nacking blocks going back before our buffer, wtf?
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase);
|
Log(Logs::Detail, Logs::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase);
|
||||||
} else {
|
} else {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase);
|
Log(Logs::Detail, Logs::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase);
|
||||||
|
|
||||||
|
|
||||||
//this is a good ack, we get to ack some blocks.
|
//this is a good ack, we get to ack some blocks.
|
||||||
seq++; //we stop at the block right after their ack, counting on the wrap of both numbers.
|
seq++; //we stop at the block right after their ack, counting on the wrap of both numbers.
|
||||||
while(SequencedBase != seq) {
|
while(SequencedBase != seq) {
|
||||||
if(SequencedQueue.empty()) {
|
if(SequencedQueue.empty()) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, SequencedQueue.size());
|
Log(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, SequencedQueue.size());
|
||||||
SequencedBase = NextOutSeq;
|
SequencedBase = NextOutSeq;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Removing acked packet with sequence %lu." __L, (unsigned long)SequencedBase);
|
Log(Logs::Detail, Logs::Netcode, _L "Removing acked packet with sequence %lu." __L, (unsigned long)SequencedBase);
|
||||||
//clean out the acked packet
|
//clean out the acked packet
|
||||||
delete SequencedQueue.front();
|
delete SequencedQueue.front();
|
||||||
SequencedQueue.pop_front();
|
SequencedQueue.pop_front();
|
||||||
@@ -1156,7 +1156,7 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
|
|||||||
SequencedBase++;
|
SequencedBase++;
|
||||||
}
|
}
|
||||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1166,7 +1166,7 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
|
|||||||
void EQStream::SetNextAckToSend(uint32 seq)
|
void EQStream::SetNextAckToSend(uint32 seq)
|
||||||
{
|
{
|
||||||
MAcks.lock();
|
MAcks.lock();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq);
|
||||||
NextAckToSend=seq;
|
NextAckToSend=seq;
|
||||||
MAcks.unlock();
|
MAcks.unlock();
|
||||||
}
|
}
|
||||||
@@ -1174,7 +1174,7 @@ void EQStream::SetNextAckToSend(uint32 seq)
|
|||||||
void EQStream::SetLastAckSent(uint32 seq)
|
void EQStream::SetLastAckSent(uint32 seq)
|
||||||
{
|
{
|
||||||
MAcks.lock();
|
MAcks.lock();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq);
|
Log(Logs::Detail, Logs::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq);
|
||||||
LastAckSent=seq;
|
LastAckSent=seq;
|
||||||
MAcks.unlock();
|
MAcks.unlock();
|
||||||
}
|
}
|
||||||
@@ -1187,10 +1187,10 @@ void EQStream::ProcessQueue()
|
|||||||
|
|
||||||
EQProtocolPacket *qp=nullptr;
|
EQProtocolPacket *qp=nullptr;
|
||||||
while((qp=RemoveQueue(NextInSeq))!=nullptr) {
|
while((qp=RemoveQueue(NextInSeq))!=nullptr) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq);
|
Log(Logs::Detail, Logs::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq);
|
||||||
ProcessPacket(qp);
|
ProcessPacket(qp);
|
||||||
delete qp;
|
delete qp;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,21 +1201,21 @@ EQProtocolPacket *qp=nullptr;
|
|||||||
if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) {
|
if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) {
|
||||||
qp=itr->second;
|
qp=itr->second;
|
||||||
PacketQueue.erase(itr);
|
PacketQueue.erase(itr);
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
|
||||||
}
|
}
|
||||||
return qp;
|
return qp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStream::SetStreamType(EQStreamType type)
|
void EQStream::SetStreamType(EQStreamType type)
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type));
|
Log(Logs::Detail, Logs::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type));
|
||||||
StreamType=type;
|
StreamType=type;
|
||||||
switch (StreamType) {
|
switch (StreamType) {
|
||||||
case LoginStream:
|
case LoginStream:
|
||||||
app_opcode_size=1;
|
app_opcode_size=1;
|
||||||
compressed=false;
|
compressed=false;
|
||||||
encoded=false;
|
encoded=false;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size);
|
Log(Logs::Detail, Logs::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size);
|
||||||
break;
|
break;
|
||||||
case ChatOrMailStream:
|
case ChatOrMailStream:
|
||||||
case ChatStream:
|
case ChatStream:
|
||||||
@@ -1223,7 +1223,7 @@ void EQStream::SetStreamType(EQStreamType type)
|
|||||||
app_opcode_size=1;
|
app_opcode_size=1;
|
||||||
compressed=false;
|
compressed=false;
|
||||||
encoded=true;
|
encoded=true;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size);
|
Log(Logs::Detail, Logs::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size);
|
||||||
break;
|
break;
|
||||||
case ZoneStream:
|
case ZoneStream:
|
||||||
case WorldStream:
|
case WorldStream:
|
||||||
@@ -1231,7 +1231,7 @@ void EQStream::SetStreamType(EQStreamType type)
|
|||||||
app_opcode_size=2;
|
app_opcode_size=2;
|
||||||
compressed=true;
|
compressed=true;
|
||||||
encoded=false;
|
encoded=false;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size);
|
Log(Logs::Detail, Logs::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1281,7 +1281,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
|
|||||||
|
|
||||||
void EQStream::SetState(EQStreamState state) {
|
void EQStream::SetState(EQStreamState state) {
|
||||||
MState.lock();
|
MState.lock();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Changing state from %d to %d" __L, State, state);
|
Log(Logs::Detail, Logs::Netcode, _L "Changing state from %d to %d" __L, State, state);
|
||||||
State=state;
|
State=state;
|
||||||
MState.unlock();
|
MState.unlock();
|
||||||
}
|
}
|
||||||
@@ -1293,29 +1293,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
|
|||||||
|
|
||||||
EQStreamState orig_state = GetState();
|
EQStreamState orig_state = GetState();
|
||||||
if (orig_state == CLOSING && !outgoing_data) {
|
if (orig_state == CLOSING && !outgoing_data) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Out of data in closing state, disconnecting." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Out of data in closing state, disconnecting." __L);
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
SetState(DISCONNECTING);
|
SetState(DISCONNECTING);
|
||||||
} else if (LastPacket && (now-LastPacket) > timeout) {
|
} else if (LastPacket && (now-LastPacket) > timeout) {
|
||||||
switch(orig_state) {
|
switch(orig_state) {
|
||||||
case CLOSING:
|
case CLOSING:
|
||||||
//if we time out in the closing state, they are not acking us, just give up
|
//if we time out in the closing state, they are not acking us, just give up
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L);
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
SetState(CLOSED);
|
SetState(CLOSED);
|
||||||
break;
|
break;
|
||||||
case DISCONNECTING:
|
case DISCONNECTING:
|
||||||
//we timed out waiting for them to send us the disconnect reply, just give up.
|
//we timed out waiting for them to send us the disconnect reply, just give up.
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L);
|
||||||
SetState(CLOSED);
|
SetState(CLOSED);
|
||||||
break;
|
break;
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in closed state??" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in closed state??" __L);
|
||||||
break;
|
break;
|
||||||
case ESTABLISHED:
|
case ESTABLISHED:
|
||||||
//we timed out during normal operation. Try to be nice about it.
|
//we timed out during normal operation. Try to be nice about it.
|
||||||
//we will almost certainly time out again waiting for the disconnect reply, but oh well.
|
//we will almost certainly time out again waiting for the disconnect reply, but oh well.
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in established state. Closing connection." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in established state. Closing connection." __L);
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
SetState(DISCONNECTING);
|
SetState(DISCONNECTING);
|
||||||
break;
|
break;
|
||||||
@@ -1342,7 +1342,7 @@ void EQStream::Decay()
|
|||||||
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); ++sitr, count++) {
|
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); ++sitr, count++) {
|
||||||
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) {
|
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) {
|
||||||
(*sitr)->sent_time = 0;
|
(*sitr)->sent_time = 0;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout exceeded for seq %d. Flagging packet for retransmission" __L, SequencedBase + count);
|
Log(Logs::Detail, Logs::Netcode, _L "Timeout exceeded for seq %d. Flagging packet for retransmission" __L, SequencedBase + count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MOutboundQueue.unlock();
|
MOutboundQueue.unlock();
|
||||||
@@ -1359,11 +1359,11 @@ void EQStream::AdjustRates(uint32 average_delta)
|
|||||||
DecayRate=DECAYBASE/average_delta;
|
DecayRate=DECAYBASE/average_delta;
|
||||||
if (BytesWritten > RateThreshold)
|
if (BytesWritten > RateThreshold)
|
||||||
BytesWritten = RateThreshold + DecayRate;
|
BytesWritten = RateThreshold + DecayRate;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
|
||||||
RateThreshold, DecayRate, average_delta);
|
RateThreshold, DecayRate, average_delta);
|
||||||
MRate.unlock();
|
MRate.unlock();
|
||||||
} else {
|
} else {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
|
||||||
average_delta, AVERAGE_DELTA_MAX);
|
average_delta, AVERAGE_DELTA_MAX);
|
||||||
AverageDelta = AVERAGE_DELTA_MAX;
|
AverageDelta = AVERAGE_DELTA_MAX;
|
||||||
}
|
}
|
||||||
@@ -1374,7 +1374,7 @@ void EQStream::AdjustRates(uint32 average_delta)
|
|||||||
BytesWritten = 0;
|
BytesWritten = 0;
|
||||||
RateThreshold=RATEBASE/average_delta;
|
RateThreshold=RATEBASE/average_delta;
|
||||||
DecayRate=DECAYBASE/average_delta;
|
DecayRate=DECAYBASE/average_delta;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
|
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
|
||||||
RateThreshold, DecayRate, average_delta);
|
RateThreshold, DecayRate, average_delta);
|
||||||
MRate.unlock();
|
MRate.unlock();
|
||||||
}
|
}
|
||||||
@@ -1384,12 +1384,12 @@ void EQStream::AdjustRates(uint32 average_delta)
|
|||||||
void EQStream::Close() {
|
void EQStream::Close() {
|
||||||
if(HasOutgoingData()) {
|
if(HasOutgoingData()) {
|
||||||
//there is pending data, wait for it to go out.
|
//there is pending data, wait for it to go out.
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L);
|
||||||
SetState(CLOSING);
|
SetState(CLOSING);
|
||||||
} else {
|
} else {
|
||||||
//otherwise, we are done, we can drop immediately.
|
//otherwise, we are done, we can drop immediately.
|
||||||
_SendDisconnect();
|
_SendDisconnect();
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Stream closing immediate due to Close()" __L);
|
Log(Logs::Detail, Logs::Netcode, _L "Stream closing immediate due to Close()" __L);
|
||||||
SetState(DISCONNECTING);
|
SetState(DISCONNECTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1417,19 +1417,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) {
|
|||||||
} else if(p->opcode == sig->first_eq_opcode) {
|
} else if(p->opcode == sig->first_eq_opcode) {
|
||||||
//opcode matches, check length..
|
//opcode matches, check length..
|
||||||
if(p->size == sig->first_length) {
|
if(p->size == sig->first_length) {
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
|
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
|
||||||
res = MatchSuccessful;
|
res = MatchSuccessful;
|
||||||
} else if(sig->first_length == 0) {
|
} else if(sig->first_length == 0) {
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
|
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
|
||||||
res = MatchSuccessful;
|
res = MatchSuccessful;
|
||||||
} else {
|
} else {
|
||||||
//opcode matched but length did not.
|
//opcode matched but length did not.
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length);
|
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length);
|
||||||
res = MatchFailed;
|
res = MatchFailed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//first opcode did not match..
|
//first opcode did not match..
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode);
|
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode);
|
||||||
res = MatchFailed;
|
res = MatchFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-16
@@ -241,7 +241,7 @@ class EQStream : public EQStreamInterface {
|
|||||||
virtual bool CheckState(EQStreamState state) { return GetState() == state; }
|
virtual bool CheckState(EQStreamState state) { return GetState() == state; }
|
||||||
virtual std::string Describe() const { return("Direct EQStream"); }
|
virtual std::string Describe() const { return("Direct EQStream"); }
|
||||||
|
|
||||||
void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
virtual void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
||||||
|
|
||||||
void CheckTimeout(uint32 now, uint32 timeout=30);
|
void CheckTimeout(uint32 now, uint32 timeout=30);
|
||||||
bool HasOutgoingData();
|
bool HasOutgoingData();
|
||||||
@@ -250,13 +250,13 @@ class EQStream : public EQStreamInterface {
|
|||||||
void Write(int eq_fd);
|
void Write(int eq_fd);
|
||||||
|
|
||||||
// whether or not the stream has been assigned (we passed our stream match)
|
// whether or not the stream has been assigned (we passed our stream match)
|
||||||
void SetActive(bool val) { streamactive = val; }
|
virtual void SetActive(bool val) { streamactive = val; }
|
||||||
|
|
||||||
//
|
//
|
||||||
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
||||||
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
||||||
|
|
||||||
inline EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
virtual EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
||||||
|
|
||||||
static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq);
|
static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq);
|
||||||
|
|
||||||
@@ -306,19 +306,7 @@ class EQStream : public EQStreamInterface {
|
|||||||
const uint64 GetPacketsReceived() { return received_packet_count; }
|
const uint64 GetPacketsReceived() { return received_packet_count; }
|
||||||
|
|
||||||
//used for dynamic stream identification
|
//used for dynamic stream identification
|
||||||
class Signature {
|
virtual MatchState CheckSignature(const Signature *sig);
|
||||||
public:
|
|
||||||
//this object could get more complicated if needed...
|
|
||||||
uint16 ignore_eq_opcode; //0=dont ignore
|
|
||||||
uint16 first_eq_opcode;
|
|
||||||
uint32 first_length; //0=dont check length
|
|
||||||
};
|
|
||||||
typedef enum {
|
|
||||||
MatchNotReady,
|
|
||||||
MatchSuccessful,
|
|
||||||
MatchFailed
|
|
||||||
} MatchState;
|
|
||||||
MatchState CheckSignature(const Signature *sig);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,10 @@
|
|||||||
|
|
||||||
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
||||||
{
|
{
|
||||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fs->ReaderLoop();
|
fs->ReaderLoop();
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
THREAD_RETURN(nullptr);
|
THREAD_RETURN(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,16 +34,8 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
|||||||
{
|
{
|
||||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fs->WriterLoop();
|
fs->WriterLoop();
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
THREAD_RETURN(nullptr);
|
THREAD_RETURN(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -4,7 +4,7 @@
|
|||||||
#include "eqemu_logsys.h"
|
#include "eqemu_logsys.h"
|
||||||
#include "eq_stream_ident.h"
|
#include "eq_stream_ident.h"
|
||||||
#include "eq_stream_proxy.h"
|
#include "eq_stream_proxy.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
EQStreamIdentifier::~EQStreamIdentifier() {
|
EQStreamIdentifier::~EQStreamIdentifier() {
|
||||||
while(!m_identified.empty()) {
|
while(!m_identified.empty()) {
|
||||||
@@ -26,7 +26,7 @@ EQStreamIdentifier::~EQStreamIdentifier() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
void EQStreamIdentifier::RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
||||||
auto p = new Patch;
|
auto p = new Patch;
|
||||||
p->signature = sig;
|
p->signature = sig;
|
||||||
p->name = name;
|
p->name = name;
|
||||||
@@ -46,9 +46,9 @@ void EQStreamIdentifier::Process() {
|
|||||||
|
|
||||||
//first see if this stream has expired
|
//first see if this stream has expired
|
||||||
if(r.expire.Check(false)) {
|
if(r.expire.Check(false)) {
|
||||||
//this stream has failed to match any pattern in our timeframe.
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", r.stream->GetRemoteAddr().c_str(), ntohs(r.stream->GetRemotePort()));
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
r.stream->Close();
|
||||||
r.stream->ReleaseFromUse();
|
|
||||||
cur = m_streams.erase(cur);
|
cur = m_streams.erase(cur);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() {
|
|||||||
}
|
}
|
||||||
if(r.stream->GetState() != ESTABLISHED) {
|
if(r.stream->GetState() != ESTABLISHED) {
|
||||||
//the stream closed before it was identified.
|
//the stream closed before it was identified.
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||||
switch(r.stream->GetState())
|
switch(r.stream->GetState())
|
||||||
{
|
{
|
||||||
case ESTABLISHED:
|
case ESTABLISHED:
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
||||||
break;
|
break;
|
||||||
case CLOSING:
|
case CLOSING:
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
||||||
break;
|
break;
|
||||||
case DISCONNECTING:
|
case DISCONNECTING:
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
||||||
break;
|
break;
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r.stream->ReleaseFromUse();
|
r.stream->ReleaseFromUse();
|
||||||
@@ -98,17 +98,17 @@ void EQStreamIdentifier::Process() {
|
|||||||
Patch *p = *curp;
|
Patch *p = *curp;
|
||||||
|
|
||||||
//ask the stream to see if it matches the supplied signature
|
//ask the stream to see if it matches the supplied signature
|
||||||
EQStream::MatchState res = r.stream->CheckSignature(&p->signature);
|
EQStreamInterface::MatchState res = r.stream->CheckSignature(&p->signature);
|
||||||
switch(res) {
|
switch(res) {
|
||||||
case EQStream::MatchNotReady:
|
case EQStreamInterface::MatchNotReady:
|
||||||
//the stream has not received enough packets to compare with this signature
|
//the stream has not received enough packets to compare with this signature
|
||||||
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||||
all_ready = false;
|
all_ready = false;
|
||||||
break;
|
break;
|
||||||
case EQStream::MatchSuccessful: {
|
case EQStreamInterface::MatchSuccessful: {
|
||||||
//yay, a match.
|
//yay, a match.
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||||
|
|
||||||
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
|
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
|
||||||
r.stream->SetActive(true);
|
r.stream->SetActive(true);
|
||||||
@@ -120,9 +120,9 @@ void EQStreamIdentifier::Process() {
|
|||||||
found_one = true;
|
found_one = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EQStream::MatchFailed:
|
case EQStreamInterface::MatchFailed:
|
||||||
//do nothing...
|
//do nothing...
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ void EQStreamIdentifier::Process() {
|
|||||||
//if we checked all patches and did not find a match.
|
//if we checked all patches and did not find a match.
|
||||||
if(all_ready && !found_one) {
|
if(all_ready && !found_one) {
|
||||||
//the stream cannot be identified.
|
//the stream cannot be identified.
|
||||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||||
r.stream->ReleaseFromUse();
|
r.stream->ReleaseFromUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void EQStreamIdentifier::Process() {
|
|||||||
} //end foreach stream
|
} //end foreach stream
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) {
|
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStreamInterface> eqs) {
|
||||||
m_streams.push_back(Record(eqs));
|
m_streams.push_back(Record(eqs));
|
||||||
eqs = nullptr;
|
eqs = nullptr;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
|
|||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
|
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStreamInterface> s)
|
||||||
: stream(std::move(s)),
|
: stream(std::move(s)),
|
||||||
expire(STREAM_IDENT_WAIT_MS)
|
expire(STREAM_IDENT_WAIT_MS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#ifndef EQSTREAMIDENT_H_
|
#ifndef EQSTREAMIDENT_H_
|
||||||
#define EQSTREAMIDENT_H_
|
#define EQSTREAMIDENT_H_
|
||||||
|
|
||||||
#include "eq_stream.h"
|
#include "eq_stream_intf.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define STREAM_IDENT_WAIT_MS 10000
|
#define STREAM_IDENT_WAIT_MS 30000
|
||||||
|
|
||||||
class OpcodeManager;
|
class OpcodeManager;
|
||||||
class StructStrategy;
|
class StructStrategy;
|
||||||
@@ -18,11 +18,11 @@ public:
|
|||||||
~EQStreamIdentifier();
|
~EQStreamIdentifier();
|
||||||
|
|
||||||
//registration interface.
|
//registration interface.
|
||||||
void RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
void RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
||||||
|
|
||||||
//main processing interface
|
//main processing interface
|
||||||
void Process();
|
void Process();
|
||||||
void AddStream(std::shared_ptr<EQStream> &eqs);
|
void AddStream(std::shared_ptr<EQStreamInterface> eqs);
|
||||||
EQStreamInterface *PopIdentified();
|
EQStreamInterface *PopIdentified();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
class Patch {
|
class Patch {
|
||||||
public:
|
public:
|
||||||
std::string name;
|
std::string name;
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
OpcodeManager ** opcodes;
|
OpcodeManager ** opcodes;
|
||||||
const StructStrategy *structs;
|
const StructStrategy *structs;
|
||||||
};
|
};
|
||||||
@@ -40,8 +40,8 @@ protected:
|
|||||||
//pending streams..
|
//pending streams..
|
||||||
class Record {
|
class Record {
|
||||||
public:
|
public:
|
||||||
Record(std::shared_ptr<EQStream> s);
|
Record(std::shared_ptr<EQStreamInterface> s);
|
||||||
std::shared_ptr<EQStream> stream; //we own this
|
std::shared_ptr<EQStreamInterface> stream; //we own this
|
||||||
Timer expire;
|
Timer expire;
|
||||||
};
|
};
|
||||||
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
||||||
|
|||||||
+21
-1
@@ -4,7 +4,8 @@
|
|||||||
//this is the only part of an EQStream that is seen by the application.
|
//this is the only part of an EQStream that is seen by the application.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "client_version.h" // inv2 watch
|
#include "emu_versions.h"
|
||||||
|
#include "eq_packet.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESTABLISHED,
|
ESTABLISHED,
|
||||||
@@ -15,21 +16,40 @@ typedef enum {
|
|||||||
} EQStreamState;
|
} EQStreamState;
|
||||||
|
|
||||||
class EQApplicationPacket;
|
class EQApplicationPacket;
|
||||||
|
class OpcodeManager;
|
||||||
|
|
||||||
class EQStreamInterface {
|
class EQStreamInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~EQStreamInterface() {}
|
virtual ~EQStreamInterface() {}
|
||||||
|
|
||||||
|
class Signature {
|
||||||
|
public:
|
||||||
|
//this object could get more complicated if needed...
|
||||||
|
uint16 ignore_eq_opcode; //0=dont ignore
|
||||||
|
uint16 first_eq_opcode;
|
||||||
|
uint32 first_length; //0=dont check length
|
||||||
|
};
|
||||||
|
typedef enum {
|
||||||
|
MatchNotReady,
|
||||||
|
MatchSuccessful,
|
||||||
|
MatchFailed
|
||||||
|
} MatchState;
|
||||||
|
|
||||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0;
|
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0;
|
||||||
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0;
|
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0;
|
||||||
virtual EQApplicationPacket *PopPacket() = 0;
|
virtual EQApplicationPacket *PopPacket() = 0;
|
||||||
virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
virtual void ReleaseFromUse() = 0;
|
virtual void ReleaseFromUse() = 0;
|
||||||
virtual void RemoveData() = 0;
|
virtual void RemoveData() = 0;
|
||||||
|
virtual std::string GetRemoteAddr() const = 0;
|
||||||
virtual uint32 GetRemoteIP() const = 0;
|
virtual uint32 GetRemoteIP() const = 0;
|
||||||
virtual uint16 GetRemotePort() const = 0;
|
virtual uint16 GetRemotePort() const = 0;
|
||||||
virtual bool CheckState(EQStreamState state) = 0;
|
virtual bool CheckState(EQStreamState state) = 0;
|
||||||
virtual std::string Describe() const = 0;
|
virtual std::string Describe() const = 0;
|
||||||
|
virtual void SetActive(bool val) { }
|
||||||
|
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
|
||||||
|
virtual EQStreamState GetState() = 0;
|
||||||
|
virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
|
||||||
|
|
||||||
virtual const uint32 GetBytesSent() const { return 0; }
|
virtual const uint32 GetBytesSent() const { return 0; }
|
||||||
virtual const uint32 GetBytesRecieved() const { return 0; }
|
virtual const uint32 GetBytesRecieved() const { return 0; }
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
#include "global_define.h"
|
#include "global_define.h"
|
||||||
#include "eq_stream_proxy.h"
|
#include "eq_stream_proxy.h"
|
||||||
#include "eq_stream.h"
|
|
||||||
#include "struct_strategy.h"
|
#include "struct_strategy.h"
|
||||||
|
#include "eqemu_logsys.h"
|
||||||
|
#include "opcodemgr.h"
|
||||||
|
|
||||||
|
|
||||||
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||||
: m_stream(stream),
|
: m_stream(stream),
|
||||||
m_structs(structs),
|
m_structs(structs),
|
||||||
m_opcodes(opcodes)
|
m_opcodes(opcodes)
|
||||||
@@ -26,10 +27,25 @@ const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
|
|||||||
return m_structs->ClientVersion();
|
return m_structs->ClientVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EQStreamState EQStreamProxy::GetState()
|
||||||
|
{
|
||||||
|
return m_stream->GetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EQStreamProxy::SetOpcodeManager(OpcodeManager **opm)
|
||||||
|
{
|
||||||
|
return m_stream->SetOpcodeManager(opm);
|
||||||
|
}
|
||||||
|
|
||||||
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
||||||
if(p == nullptr)
|
if(p == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (p->GetOpcode() != OP_SpecialMesg) {
|
||||||
|
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
||||||
|
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
EQApplicationPacket *newp = p->Copy();
|
EQApplicationPacket *newp = p->Copy();
|
||||||
FastQueuePacket(&newp, ack_req);
|
FastQueuePacket(&newp, ack_req);
|
||||||
}
|
}
|
||||||
@@ -54,6 +70,10 @@ void EQStreamProxy::Close() {
|
|||||||
m_stream->Close();
|
m_stream->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string EQStreamProxy::GetRemoteAddr() const {
|
||||||
|
return(m_stream->GetRemoteAddr());
|
||||||
|
}
|
||||||
|
|
||||||
uint32 EQStreamProxy::GetRemoteIP() const {
|
uint32 EQStreamProxy::GetRemoteIP() const {
|
||||||
return(m_stream->GetRemoteIP());
|
return(m_stream->GetRemoteIP());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "eq_stream_intf.h"
|
#include "eq_stream_intf.h"
|
||||||
#include "eq_stream.h"
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class StructStrategy;
|
class StructStrategy;
|
||||||
@@ -14,7 +13,7 @@ class EQApplicationPacket;
|
|||||||
class EQStreamProxy : public EQStreamInterface {
|
class EQStreamProxy : public EQStreamInterface {
|
||||||
public:
|
public:
|
||||||
//takes ownership of the stream.
|
//takes ownership of the stream.
|
||||||
EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||||
virtual ~EQStreamProxy();
|
virtual ~EQStreamProxy();
|
||||||
|
|
||||||
//EQStreamInterface:
|
//EQStreamInterface:
|
||||||
@@ -22,6 +21,7 @@ public:
|
|||||||
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true);
|
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true);
|
||||||
virtual EQApplicationPacket *PopPacket();
|
virtual EQApplicationPacket *PopPacket();
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
|
virtual std::string GetRemoteAddr() const;
|
||||||
virtual uint32 GetRemoteIP() const;
|
virtual uint32 GetRemoteIP() const;
|
||||||
virtual uint16 GetRemotePort() const;
|
virtual uint16 GetRemotePort() const;
|
||||||
virtual void ReleaseFromUse();
|
virtual void ReleaseFromUse();
|
||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
virtual bool CheckState(EQStreamState state);
|
virtual bool CheckState(EQStreamState state);
|
||||||
virtual std::string Describe() const;
|
virtual std::string Describe() const;
|
||||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
||||||
|
virtual EQStreamState GetState();
|
||||||
|
virtual void SetOpcodeManager(OpcodeManager **opm);
|
||||||
|
|
||||||
virtual const uint32 GetBytesSent() const;
|
virtual const uint32 GetBytesSent() const;
|
||||||
virtual const uint32 GetBytesRecieved() const;
|
virtual const uint32 GetBytesRecieved() const;
|
||||||
@@ -36,8 +38,8 @@ public:
|
|||||||
virtual const uint32 GetBytesRecvPerSecond() const;
|
virtual const uint32 GetBytesRecvPerSecond() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<EQStream> const m_stream; //we own this stream object.
|
std::shared_ptr<EQStreamInterface> const m_stream; //we own this stream object.
|
||||||
const StructStrategy *const m_structs; //we do not own this object.
|
const StructStrategy *const m_structs; //we do not own this object.
|
||||||
//this is a pointer to a pointer to make it less likely that a packet will
|
//this is a pointer to a pointer to make it less likely that a packet will
|
||||||
//reference an invalid opcode manager when they are being reloaded.
|
//reference an invalid opcode manager when they are being reloaded.
|
||||||
OpcodeManager **const m_opcodes; //we do not own this object.
|
OpcodeManager **const m_opcodes; //we do not own this object.
|
||||||
|
|||||||
+110
-317
@@ -23,330 +23,112 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.xml";
|
std::string EQEmuConfig::ConfigFile = "eqemu_config.json";
|
||||||
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
||||||
|
|
||||||
void EQEmuConfig::do_world(TiXmlElement *ele)
|
void EQEmuConfig::parse_config() {
|
||||||
{
|
|
||||||
const char *text;
|
ShortName = _root["server"]["world"].get("shortname", "").asString();
|
||||||
TiXmlElement * sub_ele;;
|
LongName = _root["server"]["world"].get("longname", "").asString();
|
||||||
text = ParseTextBlock(ele, "shortname");
|
WorldAddress = _root["server"]["world"].get("address", "").asString();
|
||||||
if (text) {
|
LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
|
||||||
ShortName = text;
|
MaxClients = atoi(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
|
||||||
}
|
SharedKey = _root["server"]["world"].get("key", "").asString();
|
||||||
text = ParseTextBlock(ele, "longname");
|
LoginCount = 0;
|
||||||
if (text) {
|
|
||||||
LongName = text;
|
if (_root["server"]["world"]["loginserver"].isObject()) {
|
||||||
}
|
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
|
||||||
text = ParseTextBlock(ele, "address", true);
|
LoginPort = atoi(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
||||||
if (text) {
|
LoginLegacy = false;
|
||||||
WorldAddress = text;
|
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") LoginLegacy = true;
|
||||||
}
|
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
||||||
text = ParseTextBlock(ele, "localaddress", true);
|
LoginPassword = _root["server"]["world"]["loginserver"].get("password", "").asString();
|
||||||
if (text) {
|
|
||||||
LocalAddress = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "maxclients", true);
|
|
||||||
if (text) {
|
|
||||||
MaxClients = atoi(text);
|
|
||||||
}
|
|
||||||
// Get the <key> element
|
|
||||||
text = ParseTextBlock(ele, "key", true);
|
|
||||||
if (text) {
|
|
||||||
SharedKey = text;
|
|
||||||
}
|
|
||||||
// Get the <loginserver> element
|
|
||||||
sub_ele = ele->FirstChildElement("loginserver");
|
|
||||||
if (sub_ele) {
|
|
||||||
text = ParseTextBlock(sub_ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
LoginHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
LoginPort = atoi(text);
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "account", true);
|
|
||||||
if (text) {
|
|
||||||
LoginAccount = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "password", true);
|
|
||||||
if (text) {
|
|
||||||
LoginPassword = text;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
char str[32];
|
char str[32];
|
||||||
|
loginlist.Clear();
|
||||||
do {
|
do {
|
||||||
sprintf(str, "loginserver%i", ++LoginCount);
|
sprintf(str, "loginserver%i", ++LoginCount);
|
||||||
sub_ele = ele->FirstChildElement(str);
|
if (!_root["server"]["world"][str].isObject()) {
|
||||||
if (sub_ele) {
|
break;
|
||||||
auto loginconfig = new LoginConfig;
|
|
||||||
text = ParseTextBlock(sub_ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
loginconfig->LoginHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
loginconfig->LoginPort = atoi(text);
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "account", true);
|
|
||||||
if (text) {
|
|
||||||
loginconfig->LoginAccount = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(sub_ele, "password", true);
|
|
||||||
if (text) {
|
|
||||||
loginconfig->LoginPassword = text;
|
|
||||||
}
|
|
||||||
loginlist.Insert(loginconfig);
|
|
||||||
}
|
}
|
||||||
} while (sub_ele);
|
|
||||||
}
|
auto loginconfig = new LoginConfig;
|
||||||
// Check for locked
|
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
|
||||||
sub_ele = ele->FirstChildElement("locked");
|
loginconfig->LoginPort = atoi(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
||||||
if (sub_ele != nullptr) {
|
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
|
||||||
Locked = true;
|
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
|
||||||
}
|
|
||||||
// Get the <tcp> element
|
loginconfig->LoginLegacy = false;
|
||||||
sub_ele = ele->FirstChildElement("tcp");
|
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") loginconfig->LoginLegacy = true;
|
||||||
if (sub_ele != nullptr) {
|
loginlist.Insert(loginconfig);
|
||||||
text = sub_ele->Attribute("ip");
|
} while (LoginCount < 100);
|
||||||
if (text) {
|
|
||||||
WorldIP = text;
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("port");
|
|
||||||
if (text) {
|
|
||||||
WorldTCPPort = atoi(text);
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("telnet");
|
|
||||||
if (text && !strcasecmp(text, "enabled")) {
|
|
||||||
TelnetEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Get the <http> element
|
|
||||||
sub_ele = ele->FirstChildElement("http");
|
|
||||||
if (sub_ele != nullptr) {
|
|
||||||
// text = sub_ele->Attribute("ip");
|
|
||||||
// if (text)
|
|
||||||
// WorldIP=text;
|
|
||||||
text = sub_ele->Attribute("mimefile");
|
|
||||||
if (text) {
|
|
||||||
WorldHTTPMimeFile = text;
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("port");
|
|
||||||
if (text) {
|
|
||||||
WorldHTTPPort = atoi(text);
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("enabled");
|
|
||||||
if (text && !strcasecmp(text, "true")) {
|
|
||||||
WorldHTTPEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//<locked> from xml converts to json as locked: "", so i default to "false".
|
||||||
|
//The only way to enable locked is by switching to true, meaning this value is always false until manually set true
|
||||||
|
Locked = false;
|
||||||
|
if (_root["server"]["world"].get("locked", "false").asString() == "true") Locked = true;
|
||||||
|
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
||||||
|
WorldTCPPort = atoi(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
||||||
|
|
||||||
|
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||||
|
TelnetTCPPort = atoi(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
||||||
|
TelnetEnabled = false;
|
||||||
|
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") TelnetEnabled = true;
|
||||||
|
|
||||||
|
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
|
||||||
|
WorldHTTPPort = atoi(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
||||||
|
WorldHTTPEnabled = false;
|
||||||
|
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") WorldHTTPEnabled = true;
|
||||||
|
|
||||||
|
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
||||||
|
ChatPort = atoi(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
||||||
|
|
||||||
|
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
||||||
|
MailPort = atoi(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
||||||
|
|
||||||
|
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
|
||||||
|
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
|
||||||
|
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
|
||||||
|
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||||
|
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
||||||
|
|
||||||
|
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
|
||||||
|
QSDatabasePort = atoi(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
||||||
|
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||||
|
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||||
|
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||||
|
|
||||||
|
DefaultStatus = atoi(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
||||||
|
ZonePortLow = atoi(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
||||||
|
ZonePortHigh = atoi(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
||||||
|
|
||||||
|
SpellsFile = _root["server"]["files"].get("spells", "spells_us.txt").asString();
|
||||||
|
OpCodesFile = _root["server"]["files"].get("opcodes", "opcodes.conf").asString();
|
||||||
|
PluginPlFile = _root["server"]["files"].get("plugin.pl", "plugin.pl").asString();
|
||||||
|
|
||||||
|
MapDir = _root["server"]["directories"].get("maps", "Maps/").asString();
|
||||||
|
QuestDir = _root["server"]["directories"].get("quests", "quests/").asString();
|
||||||
|
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
||||||
|
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
||||||
|
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
||||||
|
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||||
|
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||||
|
|
||||||
|
LogPrefix = _root["server"]["launcher"].get("logprefix", "logs/zone-").asString();
|
||||||
|
LogSuffix = _root["server"]["launcher"].get("logsuffix", ".log").asString();
|
||||||
|
RestartWait = atoi(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
|
||||||
|
TerminateWait = atoi(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
|
||||||
|
InitialBootWait = atoi(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
|
||||||
|
ZoneBootInterval = atoi(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str());
|
||||||
|
#ifdef WIN32
|
||||||
|
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
|
||||||
|
#else
|
||||||
|
ZoneExe = _root["server"]["launcher"].get("exe", "./zone").asString();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEmuConfig::do_chatserver(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
ChatHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
ChatPort = atoi(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_mailserver(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
MailHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
MailPort = atoi(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_database(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
DatabaseHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
DatabasePort = atoi(text);
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "username", true);
|
|
||||||
if (text) {
|
|
||||||
DatabaseUsername = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "password", true);
|
|
||||||
if (text) {
|
|
||||||
DatabasePassword = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "db", true);
|
|
||||||
if (text) {
|
|
||||||
DatabaseDB = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EQEmuConfig::do_qsdatabase(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "host", true);
|
|
||||||
if (text) {
|
|
||||||
QSDatabaseHost = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "port", true);
|
|
||||||
if (text) {
|
|
||||||
QSDatabasePort = atoi(text);
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "username", true);
|
|
||||||
if (text) {
|
|
||||||
QSDatabaseUsername = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "password", true);
|
|
||||||
if (text) {
|
|
||||||
QSDatabasePassword = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "db", true);
|
|
||||||
if (text) {
|
|
||||||
QSDatabaseDB = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_zones(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
TiXmlElement *sub_ele;
|
|
||||||
// TiXmlNode *node,*sub_node;
|
|
||||||
text = ParseTextBlock(ele, "defaultstatus", true);
|
|
||||||
if (text) {
|
|
||||||
DefaultStatus = atoi(text);
|
|
||||||
}
|
|
||||||
// Get the <ports> element
|
|
||||||
sub_ele = ele->FirstChildElement("ports");
|
|
||||||
if (sub_ele != nullptr) {
|
|
||||||
text = sub_ele->Attribute("low");
|
|
||||||
if (text) {
|
|
||||||
ZonePortLow = atoi(text);
|
|
||||||
};
|
|
||||||
text = sub_ele->Attribute("high");
|
|
||||||
if (text) {
|
|
||||||
ZonePortHigh = atoi(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_files(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "spells", true);
|
|
||||||
if (text) {
|
|
||||||
SpellsFile = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "opcodes", true);
|
|
||||||
if (text) {
|
|
||||||
OpCodesFile = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "plugin.pl", true);
|
|
||||||
if (text) {
|
|
||||||
PluginPlFile = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
text = ParseTextBlock(ele, "maps", true);
|
|
||||||
if (text) {
|
|
||||||
MapDir = text;
|
|
||||||
if ( MapDir.back() != '/' )
|
|
||||||
MapDir += '/';
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "quests", true);
|
|
||||||
if (text) {
|
|
||||||
QuestDir = text;
|
|
||||||
if ( QuestDir.back() != '/' )
|
|
||||||
QuestDir += '/';
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "plugins", true);
|
|
||||||
if (text) {
|
|
||||||
PluginDir = text;
|
|
||||||
if ( PluginDir.back() != '/' )
|
|
||||||
PluginDir += '/';
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "lua_modules", true);
|
|
||||||
if (text) {
|
|
||||||
LuaModuleDir = text;
|
|
||||||
if ( LuaModuleDir.back() != '/' )
|
|
||||||
LuaModuleDir += '/';
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "patches", true);
|
|
||||||
if (text) {
|
|
||||||
PatchDir = text;
|
|
||||||
if ( PatchDir.back() != '/' )
|
|
||||||
PatchDir += '/';
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "shared_memory", true);
|
|
||||||
if (text) {
|
|
||||||
SharedMemDir = text;
|
|
||||||
if ( SharedMemDir.back() != '/' )
|
|
||||||
SharedMemDir += '/';
|
|
||||||
}
|
|
||||||
//Not Fully Implemented yet LogDir
|
|
||||||
text = ParseTextBlock(ele, "logs", true);
|
|
||||||
if (text) {
|
|
||||||
LogDir = text;
|
|
||||||
if ( LogDir.back() != '/' )
|
|
||||||
LogDir += '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQEmuConfig::do_launcher(TiXmlElement *ele)
|
|
||||||
{
|
|
||||||
const char *text;
|
|
||||||
TiXmlElement *sub_ele;
|
|
||||||
text = ParseTextBlock(ele, "logprefix", true);
|
|
||||||
if (text) {
|
|
||||||
LogPrefix = text;
|
|
||||||
}
|
|
||||||
text = ParseTextBlock(ele, "logsuffix", true);
|
|
||||||
if (text) {
|
|
||||||
LogSuffix = text;
|
|
||||||
}
|
|
||||||
// Get the <exe> element
|
|
||||||
text = ParseTextBlock(ele, "exe", true);
|
|
||||||
if (text) {
|
|
||||||
ZoneExe = text;
|
|
||||||
}
|
|
||||||
// Get the <timers> element
|
|
||||||
sub_ele = ele->FirstChildElement("timers");
|
|
||||||
if (sub_ele != nullptr) {
|
|
||||||
text = sub_ele->Attribute("restart");
|
|
||||||
if (text) {
|
|
||||||
RestartWait = atoi(text);
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("reterminate");
|
|
||||||
if (text) {
|
|
||||||
TerminateWait = atoi(text);
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("initial");
|
|
||||||
if (text) {
|
|
||||||
InitialBootWait = atoi(text);
|
|
||||||
}
|
|
||||||
text = sub_ele->Attribute("interval");
|
|
||||||
if (text) {
|
|
||||||
ZoneBootInterval = atoi(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||||
{
|
{
|
||||||
if (var_name == "ShortName") {
|
if (var_name == "ShortName") {
|
||||||
@@ -370,6 +152,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
|||||||
if (var_name == "LoginPort") {
|
if (var_name == "LoginPort") {
|
||||||
return (itoa(LoginPort));
|
return (itoa(LoginPort));
|
||||||
}
|
}
|
||||||
|
if (var_name == "LoginLegacy") {
|
||||||
|
return (itoa(LoginLegacy ? 1 : 0));
|
||||||
|
}
|
||||||
if (var_name == "Locked") {
|
if (var_name == "Locked") {
|
||||||
return (Locked ? "true" : "false");
|
return (Locked ? "true" : "false");
|
||||||
}
|
}
|
||||||
@@ -379,6 +164,12 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
|||||||
if (var_name == "WorldIP") {
|
if (var_name == "WorldIP") {
|
||||||
return (WorldIP);
|
return (WorldIP);
|
||||||
}
|
}
|
||||||
|
if (var_name == "TelnetTCPPort") {
|
||||||
|
return (itoa(TelnetTCPPort));
|
||||||
|
}
|
||||||
|
if (var_name == "TelnetIP") {
|
||||||
|
return (TelnetIP);
|
||||||
|
}
|
||||||
if (var_name == "TelnetEnabled") {
|
if (var_name == "TelnetEnabled") {
|
||||||
return (TelnetEnabled ? "true" : "false");
|
return (TelnetEnabled ? "true" : "false");
|
||||||
}
|
}
|
||||||
@@ -495,9 +286,12 @@ void EQEmuConfig::Dump() const
|
|||||||
std::cout << "LoginAccount = " << LoginAccount << std::endl;
|
std::cout << "LoginAccount = " << LoginAccount << std::endl;
|
||||||
std::cout << "LoginPassword = " << LoginPassword << std::endl;
|
std::cout << "LoginPassword = " << LoginPassword << std::endl;
|
||||||
std::cout << "LoginPort = " << LoginPort << std::endl;
|
std::cout << "LoginPort = " << LoginPort << std::endl;
|
||||||
|
std::cout << "LoginLegacy = " << LoginLegacy << std::endl;
|
||||||
std::cout << "Locked = " << Locked << std::endl;
|
std::cout << "Locked = " << Locked << std::endl;
|
||||||
std::cout << "WorldTCPPort = " << WorldTCPPort << std::endl;
|
std::cout << "WorldTCPPort = " << WorldTCPPort << std::endl;
|
||||||
std::cout << "WorldIP = " << WorldIP << std::endl;
|
std::cout << "WorldIP = " << WorldIP << std::endl;
|
||||||
|
std::cout << "TelnetTCPPort = " << TelnetTCPPort << std::endl;
|
||||||
|
std::cout << "TelnetIP = " << TelnetIP << std::endl;
|
||||||
std::cout << "TelnetEnabled = " << TelnetEnabled << std::endl;
|
std::cout << "TelnetEnabled = " << TelnetEnabled << std::endl;
|
||||||
std::cout << "WorldHTTPPort = " << WorldHTTPPort << std::endl;
|
std::cout << "WorldHTTPPort = " << WorldHTTPPort << std::endl;
|
||||||
std::cout << "WorldHTTPMimeFile = " << WorldHTTPMimeFile << std::endl;
|
std::cout << "WorldHTTPMimeFile = " << WorldHTTPMimeFile << std::endl;
|
||||||
@@ -531,4 +325,3 @@ void EQEmuConfig::Dump() const
|
|||||||
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
||||||
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
|
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
-80
@@ -18,17 +18,19 @@
|
|||||||
#ifndef __EQEmuConfig_H
|
#ifndef __EQEmuConfig_H
|
||||||
#define __EQEmuConfig_H
|
#define __EQEmuConfig_H
|
||||||
|
|
||||||
#include "xml_parser.h"
|
#include "json/json.h"
|
||||||
#include "linked_list.h"
|
#include "linked_list.h"
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
struct LoginConfig {
|
struct LoginConfig {
|
||||||
std::string LoginHost;
|
std::string LoginHost;
|
||||||
std::string LoginAccount;
|
std::string LoginAccount;
|
||||||
std::string LoginPassword;
|
std::string LoginPassword;
|
||||||
uint16 LoginPort;
|
uint16 LoginPort;
|
||||||
|
bool LoginLegacy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQEmuConfig : public XMLParser
|
class EQEmuConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string GetByName(const std::string &var_name) const;
|
virtual std::string GetByName(const std::string &var_name) const;
|
||||||
@@ -42,11 +44,14 @@ class EQEmuConfig : public XMLParser
|
|||||||
std::string LoginAccount;
|
std::string LoginAccount;
|
||||||
std::string LoginPassword;
|
std::string LoginPassword;
|
||||||
uint16 LoginPort;
|
uint16 LoginPort;
|
||||||
|
bool LoginLegacy;
|
||||||
uint32 LoginCount;
|
uint32 LoginCount;
|
||||||
LinkedList<LoginConfig*> loginlist;
|
LinkedList<LoginConfig*> loginlist;
|
||||||
bool Locked;
|
bool Locked;
|
||||||
uint16 WorldTCPPort;
|
uint16 WorldTCPPort;
|
||||||
std::string WorldIP;
|
std::string WorldIP;
|
||||||
|
uint16 TelnetTCPPort;
|
||||||
|
std::string TelnetIP;
|
||||||
bool TelnetEnabled;
|
bool TelnetEnabled;
|
||||||
int32 MaxClients;
|
int32 MaxClients;
|
||||||
bool WorldHTTPEnabled;
|
bool WorldHTTPEnabled;
|
||||||
@@ -111,85 +116,14 @@ class EQEmuConfig : public XMLParser
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
static EQEmuConfig *_config;
|
static EQEmuConfig *_config;
|
||||||
|
Json::Value _root;
|
||||||
static std::string ConfigFile;
|
static std::string ConfigFile;
|
||||||
|
|
||||||
#define ELEMENT(name) \
|
void parse_config();
|
||||||
void do_##name(TiXmlElement *ele);
|
|
||||||
#include "eqemu_config_elements.h"
|
|
||||||
|
|
||||||
|
|
||||||
EQEmuConfig()
|
EQEmuConfig()
|
||||||
{
|
{
|
||||||
// import the needed handler prototypes
|
|
||||||
#define ELEMENT(name) \
|
|
||||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
|
||||||
#include "eqemu_config_elements.h"
|
|
||||||
// Set sane defaults
|
|
||||||
// Login server
|
|
||||||
LoginHost = "eqemulator.net";
|
|
||||||
LoginPort = 5998;
|
|
||||||
// World
|
|
||||||
Locked = false;
|
|
||||||
WorldTCPPort = 9000;
|
|
||||||
TelnetEnabled = false;
|
|
||||||
WorldHTTPEnabled = false;
|
|
||||||
WorldHTTPPort = 9080;
|
|
||||||
WorldHTTPMimeFile = "mime.types";
|
|
||||||
SharedKey = ""; //blank disables authentication
|
|
||||||
// Mail
|
|
||||||
ChatHost = "eqchat.eqemulator.net";
|
|
||||||
ChatPort = 7778;
|
|
||||||
// Mail
|
|
||||||
MailHost = "eqmail.eqemulator.net";
|
|
||||||
MailPort = 7779;
|
|
||||||
// Mysql
|
|
||||||
DatabaseHost = "localhost";
|
|
||||||
DatabasePort = 3306;
|
|
||||||
DatabaseUsername = "eq";
|
|
||||||
DatabasePassword = "eq";
|
|
||||||
DatabaseDB = "eq";
|
|
||||||
// QueryServ Database
|
|
||||||
QSDatabaseHost = "localhost";
|
|
||||||
QSDatabasePort = 3306;
|
|
||||||
QSDatabaseUsername = "eq";
|
|
||||||
QSDatabasePassword = "eq";
|
|
||||||
QSDatabaseDB = "eq";
|
|
||||||
// Files
|
|
||||||
SpellsFile = "spells_us.txt";
|
|
||||||
OpCodesFile = "opcodes.conf";
|
|
||||||
PluginPlFile = "plugin.pl";
|
|
||||||
// Dirs
|
|
||||||
MapDir = "Maps/";
|
|
||||||
QuestDir = "quests/";
|
|
||||||
PluginDir = "plugins/";
|
|
||||||
LuaModuleDir = "lua_modules/";
|
|
||||||
PatchDir = "./";
|
|
||||||
SharedMemDir = "shared/";
|
|
||||||
LogDir = "logs/";
|
|
||||||
|
|
||||||
// Launcher
|
|
||||||
LogPrefix = "logs/zone-";
|
|
||||||
LogSuffix = ".log";
|
|
||||||
RestartWait = 10000; //milliseconds
|
|
||||||
TerminateWait = 10000; //milliseconds
|
|
||||||
InitialBootWait = 20000; //milliseconds
|
|
||||||
ZoneBootInterval = 2000; //milliseconds
|
|
||||||
#ifdef WIN32
|
|
||||||
ZoneExe = "zone.exe";
|
|
||||||
#else
|
|
||||||
ZoneExe = "./zone";
|
|
||||||
#endif
|
|
||||||
// Zones
|
|
||||||
ZonePortLow = 7000;
|
|
||||||
ZonePortHigh = 7999;
|
|
||||||
DefaultStatus = 0;
|
|
||||||
// For where zones need to connect to.
|
|
||||||
WorldIP = "127.0.0.1";
|
|
||||||
// Dynamics to start
|
|
||||||
//DynamicCount=5;
|
|
||||||
MaxClients = -1;
|
|
||||||
LoginCount = 0;
|
|
||||||
}
|
}
|
||||||
virtual ~EQEmuConfig() {}
|
virtual ~EQEmuConfig() {}
|
||||||
|
|
||||||
@@ -198,9 +132,7 @@ class EQEmuConfig : public XMLParser
|
|||||||
// Produce a const singleton
|
// Produce a const singleton
|
||||||
static const EQEmuConfig *get()
|
static const EQEmuConfig *get()
|
||||||
{
|
{
|
||||||
if (_config == nullptr) {
|
LoadConfig();
|
||||||
LoadConfig();
|
|
||||||
}
|
|
||||||
return (_config);
|
return (_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +146,28 @@ class EQEmuConfig : public XMLParser
|
|||||||
static bool LoadConfig()
|
static bool LoadConfig()
|
||||||
{
|
{
|
||||||
if (_config != nullptr) {
|
if (_config != nullptr) {
|
||||||
delete _config;
|
return true;
|
||||||
}
|
}
|
||||||
_config = new EQEmuConfig;
|
_config = new EQEmuConfig;
|
||||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
|
||||||
|
return parseFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load config file and parse data
|
||||||
|
static bool parseFile() {
|
||||||
|
if (_config == nullptr) {
|
||||||
|
return LoadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ifstream fconfig(EQEmuConfig::ConfigFile, std::ifstream::binary);
|
||||||
|
try {
|
||||||
|
fconfig >> _config->_root;
|
||||||
|
_config->parse_config();
|
||||||
|
}
|
||||||
|
catch (std::exception) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dump() const;
|
void Dump() const;
|
||||||
|
|||||||
+37
-32
@@ -103,6 +103,16 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||||
log_settings[Logs::Login_Server].log_to_console = Logs::General;
|
log_settings[Logs::Login_Server].log_to_console = Logs::General;
|
||||||
|
log_settings[Logs::Headless_Client].log_to_console = Logs::General;
|
||||||
|
|
||||||
|
/* Set Category enabled status on defaults */
|
||||||
|
log_settings[Logs::World_Server].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::Zone_Server].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::QS_Server].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::UCS_Server].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::Crash].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::MySQLError].is_category_enabled = 1;
|
||||||
|
log_settings[Logs::Login_Server].is_category_enabled = 1;
|
||||||
|
|
||||||
/* Declare process file names for log writing
|
/* Declare process file names for log writing
|
||||||
If there is no process_file_name declared, no log file will be written, simply
|
If there is no process_file_name declared, no log file will be written, simply
|
||||||
@@ -119,30 +129,27 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
platform_file_name = "login";
|
platform_file_name = "login";
|
||||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||||
platform_file_name = "launcher";
|
platform_file_name = "launcher";
|
||||||
|
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC)
|
||||||
|
platform_file_name = "hc";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||||
{
|
{
|
||||||
std::string category_string;
|
std::string ret;
|
||||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
ret.push_back('[');
|
||||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
ret.append(Logs::LogCategoryName[log_category]);
|
||||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
ret.push_back(']');
|
||||||
|
ret.push_back(' ');
|
||||||
|
ret.append(in_message);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||||
{
|
{
|
||||||
/* Check if category enabled for process */
|
|
||||||
if (log_settings[log_category].log_to_gmsay == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
||||||
if (log_category == Logs::LogCategory::Netcode)
|
if (log_category == Logs::LogCategory::Netcode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Make sure the message inbound is at a debug level we're set at */
|
|
||||||
if (log_settings[log_category].log_to_gmsay < debug_level)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Check to see if the process that actually ran this is zone */
|
/* Check to see if the process that actually ran this is zone */
|
||||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||||
on_log_gmsay_hook(log_category, message);
|
on_log_gmsay_hook(log_category, message);
|
||||||
@@ -160,14 +167,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const
|
|||||||
crash_log.close();
|
crash_log.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if category enabled for process */
|
|
||||||
if (log_settings[log_category].log_to_file == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Make sure the message inbound is at a debug level we're set at */
|
|
||||||
if (log_settings[log_category].log_to_file < debug_level)
|
|
||||||
return;
|
|
||||||
|
|
||||||
char time_stamp[80];
|
char time_stamp[80];
|
||||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||||
|
|
||||||
@@ -246,13 +245,6 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
|||||||
|
|
||||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||||
{
|
{
|
||||||
/* Check if category enabled for process */
|
|
||||||
if (log_settings[log_category].log_to_console == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Make sure the message inbound is at a debug level we're set at */
|
|
||||||
if (log_settings[log_category].log_to_console < debug_level)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
HANDLE console_handle;
|
HANDLE console_handle;
|
||||||
@@ -273,12 +265,25 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
|
|||||||
|
|
||||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||||
{
|
{
|
||||||
const bool log_to_console = log_settings[log_category].log_to_console > 0;
|
|
||||||
const bool log_to_file = log_settings[log_category].log_to_file > 0;
|
|
||||||
const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0;
|
|
||||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
|
||||||
|
|
||||||
if (nothing_to_log) return;
|
bool log_to_console = true;
|
||||||
|
if (log_settings[log_category].log_to_console < debug_level) {
|
||||||
|
log_to_console = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool log_to_file = true;
|
||||||
|
if (log_settings[log_category].log_to_file < debug_level) {
|
||||||
|
log_to_file = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool log_to_gmsay = true;
|
||||||
|
if (log_settings[log_category].log_to_gmsay < debug_level) {
|
||||||
|
log_to_gmsay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||||
|
if (nothing_to_log)
|
||||||
|
return;
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
|
|||||||
+129
-99
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
@@ -19,11 +20,11 @@
|
|||||||
#ifndef EQEMU_LOGSYS_H
|
#ifndef EQEMU_LOGSYS_H
|
||||||
#define EQEMU_LOGSYS_H
|
#define EQEMU_LOGSYS_H
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
namespace Logs {
|
namespace Logs {
|
||||||
@@ -38,103 +39,125 @@ namespace Logs {
|
|||||||
NOTE: Only add to the bottom of the enum because that is the type ID assignment
|
NOTE: Only add to the bottom of the enum because that is the type ID assignment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum LogCategory {
|
enum LogCategory {
|
||||||
None = 0,
|
None = 0,
|
||||||
AA,
|
AA,
|
||||||
AI,
|
AI,
|
||||||
Aggro,
|
Aggro,
|
||||||
Attack,
|
Attack,
|
||||||
Client_Server_Packet,
|
Client_Server_Packet,
|
||||||
Combat,
|
Combat,
|
||||||
Commands,
|
Commands,
|
||||||
Crash,
|
Crash,
|
||||||
Debug,
|
Debug,
|
||||||
Doors,
|
Doors,
|
||||||
Error,
|
Error,
|
||||||
Guilds,
|
Guilds,
|
||||||
Inventory,
|
Inventory,
|
||||||
Launcher,
|
Launcher,
|
||||||
Netcode,
|
Netcode,
|
||||||
Normal,
|
Normal,
|
||||||
Object,
|
Object,
|
||||||
Pathing,
|
Pathing,
|
||||||
QS_Server,
|
QS_Server,
|
||||||
Quests,
|
Quests,
|
||||||
Rules,
|
Rules,
|
||||||
Skills,
|
Skills,
|
||||||
Spawns,
|
Spawns,
|
||||||
Spells,
|
Spells,
|
||||||
Status,
|
Status,
|
||||||
TCP_Connection,
|
TCP_Connection,
|
||||||
Tasks,
|
Tasks,
|
||||||
Tradeskills,
|
Tradeskills,
|
||||||
Trading,
|
Trading,
|
||||||
Tribute,
|
Tribute,
|
||||||
UCS_Server,
|
UCS_Server,
|
||||||
WebInterface_Server,
|
WebInterface_Server,
|
||||||
World_Server,
|
World_Server,
|
||||||
Zone_Server,
|
Zone_Server,
|
||||||
MySQLError,
|
MySQLError,
|
||||||
MySQLQuery,
|
MySQLQuery,
|
||||||
Mercenaries,
|
Mercenaries,
|
||||||
QuestDebug,
|
QuestDebug,
|
||||||
Server_Client_Packet,
|
Server_Client_Packet,
|
||||||
Client_Server_Packet_Unhandled,
|
Client_Server_Packet_Unhandled,
|
||||||
Server_Client_Packet_With_Dump,
|
Server_Client_Packet_With_Dump,
|
||||||
Client_Server_Packet_With_Dump,
|
Client_Server_Packet_With_Dump,
|
||||||
Login_Server,
|
Login_Server,
|
||||||
MaxCategoryID /* Don't Remove this*/
|
Client_Login,
|
||||||
};
|
Headless_Client,
|
||||||
|
HP_Update,
|
||||||
|
FixZ,
|
||||||
|
Food,
|
||||||
|
Traps,
|
||||||
|
MaxCategoryID /* Don't Remove this*/
|
||||||
|
};
|
||||||
|
|
||||||
/* If you add to this, make sure you update LogCategory */
|
/* If you add to this, make sure you update LogCategory */
|
||||||
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||||
"",
|
"",
|
||||||
"AA",
|
"AA",
|
||||||
"AI",
|
"AI",
|
||||||
"Aggro",
|
"Aggro",
|
||||||
"Attack",
|
"Attack",
|
||||||
"Packet :: Client -> Server",
|
"Packet :: Client -> Server",
|
||||||
"Combat",
|
"Combat",
|
||||||
"Commands",
|
"Commands",
|
||||||
"Crash",
|
"Crash",
|
||||||
"Debug",
|
"Debug",
|
||||||
"Doors",
|
"Doors",
|
||||||
"Error",
|
"Error",
|
||||||
"Guilds",
|
"Guilds",
|
||||||
"Inventory",
|
"Inventory",
|
||||||
"Launcher",
|
"Launcher",
|
||||||
"Netcode",
|
"Netcode",
|
||||||
"Normal",
|
"Normal",
|
||||||
"Object",
|
"Object",
|
||||||
"Pathing",
|
"Pathing",
|
||||||
"QS Server",
|
"QS Server",
|
||||||
"Quests",
|
"Quests",
|
||||||
"Rules",
|
"Rules",
|
||||||
"Skills",
|
"Skills",
|
||||||
"Spawns",
|
"Spawns",
|
||||||
"Spells",
|
"Spells",
|
||||||
"Status",
|
"Status",
|
||||||
"TCP Connection",
|
"TCP Connection",
|
||||||
"Tasks",
|
"Tasks",
|
||||||
"Tradeskills",
|
"Tradeskills",
|
||||||
"Trading",
|
"Trading",
|
||||||
"Tribute",
|
"Tribute",
|
||||||
"UCS Server",
|
"UCS Server",
|
||||||
"WebInterface Server",
|
"WebInterface Server",
|
||||||
"World Server",
|
"World Server",
|
||||||
"Zone Server",
|
"Zone Server",
|
||||||
"MySQL Error",
|
"MySQL Error",
|
||||||
"MySQL Query",
|
"MySQL Query",
|
||||||
"Mercenaries",
|
"Mercenaries",
|
||||||
"Quest Debug",
|
"Quest Debug",
|
||||||
"Packet :: Server -> Client",
|
"Packet :: Server -> Client",
|
||||||
"Packet :: Client -> Server Unhandled",
|
"Packet :: Client -> Server Unhandled",
|
||||||
"Packet :: Server -> Client (Dump)",
|
"Packet :: Server -> Client (Dump)",
|
||||||
"Packet :: Client -> Server (Dump)",
|
"Packet :: Client -> Server (Dump)",
|
||||||
"Login Server"
|
"Login Server",
|
||||||
};
|
"Client Login",
|
||||||
|
"Headless Client",
|
||||||
|
"HP Update",
|
||||||
|
"FixZ",
|
||||||
|
"Food",
|
||||||
|
"Traps"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
|
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||||
|
LogSys.Out(debug_level, log_category, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define LogF(debug_level, log_category, message, ...) do {\
|
||||||
|
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||||
|
LogSys.OutF(debug_level, log_category, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
class EQEmuLogSys {
|
class EQEmuLogSys {
|
||||||
public:
|
public:
|
||||||
EQEmuLogSys();
|
EQEmuLogSys();
|
||||||
@@ -156,6 +179,13 @@ public:
|
|||||||
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
|
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
|
||||||
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
void OutF(Logs::DebugLevel debug_level, uint16 log_category, const char *fmt, const Args&... args)
|
||||||
|
{
|
||||||
|
std::string log_str = fmt::format(fmt, args...);
|
||||||
|
Out(debug_level, log_category, log_str);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LogSettings Struct
|
LogSettings Struct
|
||||||
|
|
||||||
@@ -196,11 +226,11 @@ private:
|
|||||||
|
|
||||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */
|
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */
|
||||||
|
|
||||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessConsoleMessage called via Log.Out */
|
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessConsoleMessage called via Log */
|
||||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessGMSay called via Log.Out */
|
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessGMSay called via Log */
|
||||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log.Out */
|
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EQEmuLogSys Log;
|
extern EQEmuLogSys LogSys;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
#include "../any.h"
|
||||||
|
#include "event_loop.h"
|
||||||
|
|
||||||
|
namespace EQ {
|
||||||
|
class BackgroundTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef std::function<void(EQEmu::Any&)> BackgroundTaskFunction;
|
||||||
|
struct BackgroundTaskBaton
|
||||||
|
{
|
||||||
|
BackgroundTaskFunction fn;
|
||||||
|
BackgroundTaskFunction on_finish;
|
||||||
|
EQEmu::Any data;
|
||||||
|
};
|
||||||
|
|
||||||
|
BackgroundTask(BackgroundTaskFunction fn, BackgroundTaskFunction on_finish, EQEmu::Any data) {
|
||||||
|
uv_work_t *m_work = new uv_work_t;
|
||||||
|
memset(m_work, 0, sizeof(uv_work_t));
|
||||||
|
BackgroundTaskBaton *baton = new BackgroundTaskBaton();
|
||||||
|
baton->fn = fn;
|
||||||
|
baton->on_finish = on_finish;
|
||||||
|
baton->data = data;
|
||||||
|
|
||||||
|
m_work->data = baton;
|
||||||
|
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
|
||||||
|
BackgroundTaskBaton *baton = (BackgroundTaskBaton*)req->data;
|
||||||
|
baton->fn(baton->data);
|
||||||
|
}, [](uv_work_t* req, int status) {
|
||||||
|
BackgroundTaskBaton *baton = (BackgroundTaskBaton*)req->data;
|
||||||
|
baton->on_finish(baton->data);
|
||||||
|
delete baton;
|
||||||
|
delete req;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
~BackgroundTask() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
#include <uv.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace EQ
|
||||||
|
{
|
||||||
|
class EventLoop
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EventLoop &Get() {
|
||||||
|
static EventLoop inst;
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
~EventLoop() {
|
||||||
|
uv_loop_close(&m_loop);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Process() {
|
||||||
|
uv_run(&m_loop, UV_RUN_NOWAIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
uv_loop_t* Handle() { return &m_loop; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventLoop() {
|
||||||
|
memset(&m_loop, 0, sizeof(uv_loop_t));
|
||||||
|
uv_loop_init(&m_loop);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventLoop(const EventLoop&);
|
||||||
|
EventLoop& operator=(const EventLoop&);
|
||||||
|
|
||||||
|
uv_loop_t m_loop;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
#include "event_loop.h"
|
||||||
|
|
||||||
|
namespace EQ {
|
||||||
|
class Timer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Timer(std::function<void(Timer *)> cb)
|
||||||
|
{
|
||||||
|
m_timer = nullptr;
|
||||||
|
m_cb = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer(uint64_t duration_ms, bool repeats, std::function<void(Timer *)> cb)
|
||||||
|
{
|
||||||
|
m_timer = nullptr;
|
||||||
|
m_cb = cb;
|
||||||
|
Start(duration_ms, repeats);
|
||||||
|
}
|
||||||
|
|
||||||
|
~Timer()
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start(uint64_t duration_ms, bool repeats) {
|
||||||
|
auto loop = EventLoop::Get().Handle();
|
||||||
|
if (!m_timer) {
|
||||||
|
m_timer = new uv_timer_t;
|
||||||
|
memset(m_timer, 0, sizeof(uv_timer_t));
|
||||||
|
uv_timer_init(loop, m_timer);
|
||||||
|
m_timer->data = this;
|
||||||
|
|
||||||
|
if (repeats) {
|
||||||
|
uv_timer_start(m_timer, [](uv_timer_t *handle) {
|
||||||
|
Timer *t = (Timer*)handle->data;
|
||||||
|
t->Execute();
|
||||||
|
}, duration_ms, duration_ms);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uv_timer_start(m_timer, [](uv_timer_t *handle) {
|
||||||
|
Timer *t = (Timer*)handle->data;
|
||||||
|
t->Stop();
|
||||||
|
t->Execute();
|
||||||
|
}, duration_ms, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stop() {
|
||||||
|
if (m_timer) {
|
||||||
|
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
|
||||||
|
delete handle;
|
||||||
|
});
|
||||||
|
m_timer = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
void Execute() {
|
||||||
|
m_cb(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
uv_timer_t *m_timer;
|
||||||
|
std::function<void(Timer*)> m_cb;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#include "event_sub.h"
|
||||||
|
|
||||||
|
void EventSubscriptionWatcher::Subscribe(const std::string &event_name)
|
||||||
|
{
|
||||||
|
m_subs[event_name] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventSubscriptionWatcher::Unsubscribe(const std::string &event_name)
|
||||||
|
{
|
||||||
|
m_subs[event_name] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EventSubscriptionWatcher::IsSubscribed(const std::string &event_name) const
|
||||||
|
{
|
||||||
|
auto iter = m_subs.find(event_name);
|
||||||
|
if (iter != m_subs.end()) {
|
||||||
|
return iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class EventSubscriptionWatcher
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~EventSubscriptionWatcher();
|
||||||
|
|
||||||
|
void Subscribe(const std::string &event_name);
|
||||||
|
void Unsubscribe(const std::string &event_name);
|
||||||
|
bool IsSubscribed(const std::string &event_name) const;
|
||||||
|
|
||||||
|
static EventSubscriptionWatcher *Get() {
|
||||||
|
static EventSubscriptionWatcher* inst = nullptr;
|
||||||
|
if(!inst) {
|
||||||
|
inst = new EventSubscriptionWatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
EventSubscriptionWatcher() { }
|
||||||
|
EventSubscriptionWatcher(const EventSubscriptionWatcher&);
|
||||||
|
EventSubscriptionWatcher& operator=(const EventSubscriptionWatcher&);
|
||||||
|
|
||||||
|
std::unordered_map<std::string, bool> m_subs;
|
||||||
|
};
|
||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
#define EXTENDED_PROFILE_H
|
#define EXTENDED_PROFILE_H
|
||||||
|
|
||||||
#include "eq_packet_structs.h"
|
#include "eq_packet_structs.h"
|
||||||
#include "item.h"
|
#include "inventory_profile.h"
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
|
|||||||
uint16 old_pet_hp; /* Not Used */
|
uint16 old_pet_hp; /* Not Used */
|
||||||
uint16 old_pet_mana; /* Not Used */
|
uint16 old_pet_mana; /* Not Used */
|
||||||
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
|
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
|
||||||
uint32 pet_items[EQEmu::legacy::MaterialCount]; /* Not Used */
|
EQEmu::TextureMaterialProfile pet_items; /* Not Used */
|
||||||
char merc_name[64]; /* Used */
|
char merc_name[64]; /* Used */
|
||||||
|
|
||||||
uint32 aa_effects; /* Used */
|
uint32 aa_effects; /* Used */
|
||||||
|
|||||||
+15
-7
@@ -111,9 +111,6 @@ Zone extensions and features
|
|||||||
//path to where sql logs should be placed
|
//path to where sql logs should be placed
|
||||||
#define SQL_LOG_PATH "sql_logs/"
|
#define SQL_LOG_PATH "sql_logs/"
|
||||||
|
|
||||||
//New aggro system to reduce overhead.
|
|
||||||
#define REVERSE_AGGRO
|
|
||||||
|
|
||||||
//The highest you can #setskill / #setallskill
|
//The highest you can #setskill / #setallskill
|
||||||
#define HIGHEST_CAN_SET_SKILL 400
|
#define HIGHEST_CAN_SET_SKILL 400
|
||||||
|
|
||||||
@@ -157,13 +154,13 @@ enum { //timer settings, all in milliseconds
|
|||||||
AIscanarea_delay = 6000,
|
AIscanarea_delay = 6000,
|
||||||
AIfeignremember_delay = 500,
|
AIfeignremember_delay = 500,
|
||||||
AItarget_check_duration = 500,
|
AItarget_check_duration = 500,
|
||||||
AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
AI_scan_door_open_interval = 1000,
|
||||||
|
// AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||||
AIassistcheck_delay = 3000, //now often a fighting NPC will yell for help
|
AIassistcheck_delay = 3000, //now often a fighting NPC will yell for help
|
||||||
AI_check_signal_timer_delay = 500, // How often EVENT_SIGNAL checks are processed
|
AI_check_signal_timer_delay = 500, // How often EVENT_SIGNAL checks are processed
|
||||||
ClientProximity_interval = 150,
|
ClientProximity_interval = 150,
|
||||||
CombatEventTimer_expire = 12000,
|
CombatEventTimer_expire = 12000,
|
||||||
Tribute_duration = 600000,
|
Tribute_duration = 600000,
|
||||||
ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds)
|
|
||||||
FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro.
|
FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro.
|
||||||
EnragedTimer = 360000,
|
EnragedTimer = 360000,
|
||||||
EnragedDurationTimer = 10000
|
EnragedDurationTimer = 10000
|
||||||
@@ -213,8 +210,8 @@ enum { //some random constants
|
|||||||
#define MAX_NPC_FACTIONS 20
|
#define MAX_NPC_FACTIONS 20
|
||||||
|
|
||||||
//individual faction pool
|
//individual faction pool
|
||||||
#define MAX_PERSONAL_FACTION 1200
|
#define MAX_PERSONAL_FACTION 2000
|
||||||
#define MIN_PERSONAL_FACTION -3000
|
#define MIN_PERSONAL_FACTION -2000
|
||||||
|
|
||||||
//The Level Cap:
|
//The Level Cap:
|
||||||
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
|
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
|
||||||
@@ -223,6 +220,9 @@ enum { //some random constants
|
|||||||
//the square of the maximum range at whihc you could possibly use NPC services (shop, tribute, etc)
|
//the square of the maximum range at whihc you could possibly use NPC services (shop, tribute, etc)
|
||||||
#define USE_NPC_RANGE2 200*200 //arbitrary right now
|
#define USE_NPC_RANGE2 200*200 //arbitrary right now
|
||||||
|
|
||||||
|
// Squared range for rampage 75.0 * 75.0 for now
|
||||||
|
#define NPC_RAMPAGE_RANGE2 5625.0f
|
||||||
|
|
||||||
//the formula for experience for killing a mob.
|
//the formula for experience for killing a mob.
|
||||||
//level is the only valid variable to use
|
//level is the only valid variable to use
|
||||||
#define EXP_FORMULA level*level*75*35/10
|
#define EXP_FORMULA level*level*75*35/10
|
||||||
@@ -235,6 +235,9 @@ enum { //some random constants
|
|||||||
|
|
||||||
#define ZONE_CONTROLLER_NPC_ID 10
|
#define ZONE_CONTROLLER_NPC_ID 10
|
||||||
|
|
||||||
|
// Timer to update aggrometer
|
||||||
|
#define AGGRO_METER_UPDATE_MS 1000
|
||||||
|
|
||||||
//Some hard coded statuses from commands and other places:
|
//Some hard coded statuses from commands and other places:
|
||||||
enum {
|
enum {
|
||||||
minStatusToBeGM = 40,
|
minStatusToBeGM = 40,
|
||||||
@@ -277,6 +280,11 @@ enum {
|
|||||||
#define SAYLINK_ITEM_ID 0xFFFFF
|
#define SAYLINK_ITEM_ID 0xFFFFF
|
||||||
|
|
||||||
|
|
||||||
|
// consumption timers for food/drink here instead of rules because the client
|
||||||
|
// uses these. Times in ms.
|
||||||
|
#define CONSUMPTION_TIMER 46000
|
||||||
|
#define CONSUMPTION_MNK_TIMER 92000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Developer configuration
|
Developer configuration
|
||||||
|
|||||||
+35
-2
@@ -1,6 +1,39 @@
|
|||||||
The MIT License
|
================================================================================
|
||||||
|
OpenGL Mathematics (GLM)
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
GLM can be distributed and/or modified under the terms of either
|
||||||
|
a) The Happy Bunny License, or b) the MIT License.
|
||||||
|
|
||||||
Copyright (c) 2005 - 2013 G-Truc Creation
|
================================================================================
|
||||||
|
The Happy Bunny License (Modified MIT License)
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
Restrictions: By making use of the Software for military purposes, you choose
|
||||||
|
to make a Bunny unhappy.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
The MIT License
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
set(NAME glm_dummy)
|
|
||||||
|
|
||||||
file(GLOB ROOT_SOURCE *.cpp)
|
file(GLOB ROOT_SOURCE *.cpp)
|
||||||
file(GLOB ROOT_INLINE *.inl)
|
file(GLOB ROOT_INLINE *.inl)
|
||||||
file(GLOB ROOT_HEADER *.hpp)
|
file(GLOB ROOT_HEADER *.hpp)
|
||||||
file(GLOB ROOT_TEXT ../*.txt)
|
file(GLOB ROOT_TEXT ../*.txt)
|
||||||
|
file(GLOB ROOT_MD ../*.md)
|
||||||
|
file(GLOB ROOT_NAT ../util/glm.natvis)
|
||||||
|
|
||||||
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
|
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
|
||||||
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
|
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
|
||||||
@@ -17,7 +17,11 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
|
|||||||
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
|
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
|
||||||
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
|
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
|
||||||
|
|
||||||
source_group("Text Files" FILES ${ROOT_TEXT})
|
file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp)
|
||||||
|
file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl)
|
||||||
|
file(GLOB_RECURSE SIMD_HEADER ./simd/*.h)
|
||||||
|
|
||||||
|
source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
|
||||||
source_group("Core Files" FILES ${CORE_SOURCE})
|
source_group("Core Files" FILES ${CORE_SOURCE})
|
||||||
source_group("Core Files" FILES ${CORE_INLINE})
|
source_group("Core Files" FILES ${CORE_INLINE})
|
||||||
source_group("Core Files" FILES ${CORE_HEADER})
|
source_group("Core Files" FILES ${CORE_HEADER})
|
||||||
@@ -27,16 +31,37 @@ source_group("GTC Files" FILES ${GTC_HEADER})
|
|||||||
source_group("GTX Files" FILES ${GTX_SOURCE})
|
source_group("GTX Files" FILES ${GTX_SOURCE})
|
||||||
source_group("GTX Files" FILES ${GTX_INLINE})
|
source_group("GTX Files" FILES ${GTX_INLINE})
|
||||||
source_group("GTX Files" FILES ${GTX_HEADER})
|
source_group("GTX Files" FILES ${GTX_HEADER})
|
||||||
|
source_group("SIMD Files" FILES ${SIMD_SOURCE})
|
||||||
|
source_group("SIMD Files" FILES ${SIMD_INLINE})
|
||||||
|
source_group("SIMD Files" FILES ${SIMD_HEADER})
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
|
|
||||||
if(GLM_TEST_ENABLE)
|
if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||||
add_executable(${NAME} ${ROOT_TEXT}
|
if(GLM_STATIC_LIBRARY_ENABLE)
|
||||||
|
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||||
|
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||||
|
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||||
|
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||||
|
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||||
|
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||||
|
endif(GLM_STATIC_LIBRARY_ENABLE)
|
||||||
|
|
||||||
|
if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||||
|
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||||
|
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||||
|
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||||
|
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||||
|
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||||
|
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||||
|
endif(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||||
|
|
||||||
|
else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||||
|
add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||||
endif(GLM_TEST_ENABLE)
|
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||||
|
|
||||||
#add_library(glm STATIC glm.cpp)
|
endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||||
#add_library(glm_shared SHARED glm.cpp)
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/common.hpp
|
/// @file glm/common.hpp
|
||||||
/// @date 2013-12-24 / 2013-12-24
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/_features.hpp
|
/// @file glm/detail/_features.hpp
|
||||||
/// @date 2013-02-20 / 2013-02-20
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -284,7 +255,7 @@
|
|||||||
# define GLM_CXX11_STATIC_ASSERT
|
# define GLM_CXX11_STATIC_ASSERT
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||||
# if(__has_feature(cxx_exceptions))
|
# if(__has_feature(cxx_exceptions))
|
||||||
# define GLM_CXX98_EXCEPTIONS
|
# define GLM_CXX98_EXCEPTIONS
|
||||||
# endif
|
# endif
|
||||||
@@ -425,4 +396,4 @@
|
|||||||
# define GLM_CXX11_VARIADIC_TEMPLATES
|
# define GLM_CXX11_VARIADIC_TEMPLATES
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/_fixes.hpp
|
/// @file glm/detail/_fixes.hpp
|
||||||
/// @date 2011-02-21 / 2011-11-22
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/_noise.hpp
|
/// @file glm/detail/_noise.hpp
|
||||||
/// @date 2013-12-24 / 2013-12-24
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
+529
-565
File diff suppressed because it is too large
Load Diff
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/_swizzle_func.hpp
|
/// @file glm/detail/_swizzle_func.hpp
|
||||||
/// @date 2011-10-16 / 2011-10-16
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/_vectorize.hpp
|
/// @file glm/detail/_vectorize.hpp
|
||||||
/// @date 2011-10-14 / 2011-10-14
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +1,13 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/core/dummy.cpp
|
/// @file glm/core/dummy.cpp
|
||||||
/// @date 2011-01-19 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// GLM is a header only library. There is nothing to compile.
|
/// GLM is a header only library. There is nothing to compile.
|
||||||
/// dummy.cpp exist only a wordaround for CMake file.
|
/// dummy.cpp exist only a wordaround for CMake file.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
/*
|
||||||
#define GLM_MESSAGES
|
#define GLM_MESSAGES
|
||||||
#include "../glm.hpp"
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/ext.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
struct material
|
struct material
|
||||||
@@ -148,6 +121,8 @@ struct intersection
|
|||||||
glm::vec4 position;
|
glm::vec4 position;
|
||||||
glm::vec3 normal;
|
glm::vec3 normal;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Sample 4
|
// Sample 4
|
||||||
@@ -190,7 +165,7 @@ glm::vec3 lighting
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||||
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||||
{
|
{
|
||||||
@@ -210,13 +185,23 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
|
|||||||
{
|
{
|
||||||
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
glm::vec4 v(1);
|
/*
|
||||||
float a = normalizeDotA(v, v);
|
glm::vec1 o(1);
|
||||||
float b = normalizeDotB(v, v);
|
glm::vec2 a(1);
|
||||||
float c = normalizeDotC(v, v);
|
glm::vec3 b(1);
|
||||||
|
glm::vec4 c(1);
|
||||||
|
|
||||||
|
glm::quat q;
|
||||||
|
glm::dualquat p;
|
||||||
|
|
||||||
|
glm::mat4 m(1);
|
||||||
|
|
||||||
|
float a0 = normalizeDotA(a, a);
|
||||||
|
float b0 = normalizeDotB(b, b);
|
||||||
|
float c0 = normalizeDotC(c, c);
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_common.hpp
|
/// @file glm/detail/func_common.hpp
|
||||||
/// @date 2008-03-08 / 2010-01-26
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||||
///
|
///
|
||||||
@@ -35,7 +7,6 @@
|
|||||||
/// @ingroup core
|
/// @ingroup core
|
||||||
///
|
///
|
||||||
/// These all operate component-wise. The description is per component.
|
/// These all operate component-wise. The description is per component.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_common.inl
|
/// @file glm/detail/func_common.inl
|
||||||
/// @date 2008-08-03 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "func_vector_relational.hpp"
|
#include "func_vector_relational.hpp"
|
||||||
#include "type_vec2.hpp"
|
#include "type_vec2.hpp"
|
||||||
@@ -37,142 +8,24 @@
|
|||||||
#include "_vectorize.hpp"
|
#include "_vectorize.hpp"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
namespace detail
|
|
||||||
{
|
{
|
||||||
template <typename genFIType, bool /*signed*/>
|
// min
|
||||||
struct compute_abs
|
template <typename genType>
|
||||||
{};
|
GLM_FUNC_QUALIFIER genType min(genType x, genType y)
|
||||||
|
|
||||||
template <typename genFIType>
|
|
||||||
struct compute_abs<genFIType, true>
|
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'min' only accept floating-point or integer inputs");
|
||||||
{
|
return x < y ? x : y;
|
||||||
GLM_STATIC_ASSERT(
|
}
|
||||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
|
|
||||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
|
||||||
|
|
||||||
return x >= genFIType(0) ? x : -x;
|
// max
|
||||||
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
template <typename genType>
|
||||||
}
|
GLM_FUNC_QUALIFIER genType max(genType x, genType y)
|
||||||
};
|
|
||||||
|
|
||||||
template <typename genFIType>
|
|
||||||
struct compute_abs<genFIType, false>
|
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'max' only accept floating-point or integer inputs");
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(
|
|
||||||
!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer,
|
|
||||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename U, precision P, template <class, precision> class vecType>
|
return x > y ? x : y;
|
||||||
struct compute_mix_vector
|
}
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
|
||||||
|
|
||||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType>
|
|
||||||
struct compute_mix_vector<T, bool, P, vecType>
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
|
|
||||||
{
|
|
||||||
vecType<T, P> Result(uninitialize);
|
|
||||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
|
||||||
Result[i] = a[i] ? y[i] : x[i];
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename U, precision P, template <class, precision> class vecType>
|
|
||||||
struct compute_mix_scalar
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
|
||||||
|
|
||||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType>
|
|
||||||
struct compute_mix_scalar<T, bool, P, vecType>
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, bool const & a)
|
|
||||||
{
|
|
||||||
return a ? y : x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename U>
|
|
||||||
struct compute_mix
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
|
||||||
|
|
||||||
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct compute_mix<T, bool>
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, bool const & a)
|
|
||||||
{
|
|
||||||
return a ? y : x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true, bool isSigned = true>
|
|
||||||
struct compute_sign
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
return vecType<T, P>(glm::lessThan(vecType<T, P>(0), x)) - vecType<T, P>(glm::lessThan(x, vecType<T, P>(0)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType>
|
|
||||||
struct compute_sign<T, P, vecType, false, false>
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
return vecType<T, P>(glm::greaterThan(x , vecType<T, P>(0)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType>
|
|
||||||
struct compute_sign<T, P, vecType, false, true>
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
|
|
||||||
vecType<T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
|
||||||
|
|
||||||
return (x >> Shift) | y;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType, typename genType, bool isFloat = true>
|
|
||||||
struct compute_mod
|
|
||||||
{
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, genType const & b)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
|
||||||
return a - b * floor(a / b);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}//namespace detail
|
|
||||||
|
|
||||||
// abs
|
// abs
|
||||||
template <>
|
template <>
|
||||||
@@ -182,67 +35,6 @@ namespace detail
|
|||||||
return (x ^ y) - y;
|
return (x ^ y) - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename genFIType>
|
|
||||||
GLM_FUNC_QUALIFIER genFIType abs(genFIType x)
|
|
||||||
{
|
|
||||||
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> abs(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
return detail::functor1<T, T, P, vecType>::call(abs, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sign
|
|
||||||
// fast and works for any type
|
|
||||||
template <typename genFIType>
|
|
||||||
GLM_FUNC_QUALIFIER genFIType sign(genFIType x)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(
|
|
||||||
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
|
||||||
"'sign' only accept signed inputs");
|
|
||||||
|
|
||||||
return detail::compute_sign<genFIType, defaultp, tvec1, std::numeric_limits<genFIType>::is_iec559>::call(tvec1<genFIType>(x)).x;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> sign(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(
|
|
||||||
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
|
||||||
"'sign' only accept signed inputs");
|
|
||||||
|
|
||||||
return detail::compute_sign<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// floor
|
|
||||||
using ::std::floor;
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> floor(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
return detail::functor1<T, T, P, vecType>::call(floor, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// trunc
|
|
||||||
# if GLM_HAS_CXX11_STL
|
|
||||||
using ::std::trunc;
|
|
||||||
# else
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
|
||||||
|
|
||||||
return x < static_cast<genType>(0) ? -floor(-x) : floor(x);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> trunc(vecType<T, P> const & x)
|
|
||||||
{
|
|
||||||
return detail::functor1<T, T, P, vecType>::call(trunc, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// round
|
// round
|
||||||
# if GLM_HAS_CXX11_STL
|
# if GLM_HAS_CXX11_STL
|
||||||
using ::std::round;
|
using ::std::round;
|
||||||
@@ -256,10 +48,318 @@ namespace detail
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// trunc
|
||||||
|
# if GLM_HAS_CXX11_STL
|
||||||
|
using ::std::trunc;
|
||||||
|
# else
|
||||||
|
template <typename genType>
|
||||||
|
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||||
|
|
||||||
|
return x < static_cast<genType>(0) ? -std::floor(-x) : std::floor(x);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename genFIType, bool /*signed*/>
|
||||||
|
struct compute_abs
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <typename genFIType>
|
||||||
|
struct compute_abs<genFIType, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed || GLM_UNRESTRICTED_GENTYPE,
|
||||||
|
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||||
|
|
||||||
|
return x >= genFIType(0) ? x : -x;
|
||||||
|
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if GLM_COMPILER & GLM_COMPILER_CUDA
|
||||||
|
template <>
|
||||||
|
struct compute_abs<float, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static float call(float x)
|
||||||
|
{
|
||||||
|
return fabsf(x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename genFIType>
|
||||||
|
struct compute_abs<genFIType, false>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
(!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer) || GLM_UNRESTRICTED_GENTYPE,
|
||||||
|
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_abs_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(abs, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_mix_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||||
|
|
||||||
|
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_mix_vector<T, bool, P, vecType, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
|
||||||
|
{
|
||||||
|
vecType<T, P> Result(uninitialize);
|
||||||
|
for(length_t i = 0; i < x.length(); ++i)
|
||||||
|
Result[i] = a[i] ? y[i] : x[i];
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_mix_scalar
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||||
|
|
||||||
|
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_mix_scalar<T, bool, P, vecType, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, bool const & a)
|
||||||
|
{
|
||||||
|
return a ? y : x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
struct compute_mix
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||||
|
|
||||||
|
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct compute_mix<T, bool>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, bool const & a)
|
||||||
|
{
|
||||||
|
return a ? y : x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool isFloat, bool Aligned>
|
||||||
|
struct compute_sign
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return vecType<T, P>(glm::lessThan(vecType<T, P>(0), x)) - vecType<T, P>(glm::lessThan(x, vecType<T, P>(0)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# if GLM_ARCH == GLM_ARCH_X86
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_sign<T, P, vecType, false, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
|
||||||
|
vecType<T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
||||||
|
|
||||||
|
return (x >> Shift) | y;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
# endif
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_floor
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(std::floor, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_ceil
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(std::ceil, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_fract
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return x - floor(x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_trunc
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(trunc, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_round
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(round, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_mod
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||||
|
return a - b * floor(a / b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_min_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||||
|
{
|
||||||
|
return detail::functor2<T, P, vecType>::call(min, x, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_max_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||||
|
{
|
||||||
|
return detail::functor2<T, P, vecType>::call(max, x, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_clamp_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal)
|
||||||
|
{
|
||||||
|
return min(max(x, minVal), maxVal);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_step_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge, vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, edge));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_smoothstep_vector
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs");
|
||||||
|
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||||
|
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
|
||||||
|
template <typename genFIType>
|
||||||
|
GLM_FUNC_QUALIFIER genFIType abs(genFIType x)
|
||||||
|
{
|
||||||
|
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> abs(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::compute_abs_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// sign
|
||||||
|
// fast and works for any type
|
||||||
|
template <typename genFIType>
|
||||||
|
GLM_FUNC_QUALIFIER genFIType sign(genFIType x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||||
|
"'sign' only accept signed inputs");
|
||||||
|
|
||||||
|
return detail::compute_sign<genFIType, defaultp, tvec1, std::numeric_limits<genFIType>::is_iec559, highp>::call(tvec1<genFIType>(x)).x;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> sign(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||||
|
"'sign' only accept signed inputs");
|
||||||
|
|
||||||
|
return detail::compute_sign<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// floor
|
||||||
|
using ::std::floor;
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> floor(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs.");
|
||||||
|
return detail::compute_floor<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> trunc(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||||
|
return detail::compute_trunc<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> round(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> round(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
return detail::functor1<T, T, P, vecType>::call(round, x);
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs");
|
||||||
|
return detail::compute_round<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -308,6 +408,7 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> roundEven(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> roundEven(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||||
return detail::functor1<T, T, P, vecType>::call(roundEven, x);
|
return detail::functor1<T, T, P, vecType>::call(roundEven, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,41 +417,47 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> ceil(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> ceil(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
return detail::functor1<T, T, P, vecType>::call(ceil, x);
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs");
|
||||||
|
return detail::compute_ceil<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fract
|
// fract
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType fract(genType x)
|
GLM_FUNC_QUALIFIER genType fract(genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fract' only accept floating-point inputs");
|
|
||||||
|
|
||||||
return fract(tvec1<genType>(x)).x;
|
return fract(tvec1<genType>(x)).x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> fract(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> fract(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
return x - floor(x);
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs");
|
||||||
|
return detail::compute_fract<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mod
|
// mod
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType mod(genType x, genType y)
|
GLM_FUNC_QUALIFIER genType mod(genType x, genType y)
|
||||||
{
|
{
|
||||||
return mod(tvec1<genType>(x), y).x;
|
# if GLM_COMPILER & GLM_COMPILER_CUDA
|
||||||
|
// Another Cuda compiler bug https://github.com/g-truc/glm/issues/530
|
||||||
|
tvec1<genType, defaultp> Result(mod(tvec1<genType, defaultp>(x), y));
|
||||||
|
return Result.x;
|
||||||
|
# else
|
||||||
|
return mod(tvec1<genType, defaultp>(x), y).x;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, T y)
|
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, T y)
|
||||||
{
|
{
|
||||||
return detail::compute_mod<T, P, vecType, T, std::numeric_limits<T>::is_iec559>::call(x, y);
|
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y)
|
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||||
{
|
{
|
||||||
return detail::compute_mod<T, P, vecType, vecType<T, P>, std::numeric_limits<T>::is_iec559>::call(x, y);
|
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// modf
|
// modf
|
||||||
@@ -358,7 +465,6 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER genType modf(genType x, genType & i)
|
GLM_FUNC_QUALIFIER genType modf(genType x, genType & i)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'modf' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'modf' only accept floating-point inputs");
|
||||||
|
|
||||||
return std::modf(x, &i);
|
return std::modf(x, &i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,70 +511,53 @@ namespace detail
|
|||||||
//CHAR_BIT - 1)));
|
//CHAR_BIT - 1)));
|
||||||
|
|
||||||
// min
|
// min
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType min(genType x, genType y)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'min' only accept floating-point or integer inputs");
|
|
||||||
|
|
||||||
return x < y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, T b)
|
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, T b)
|
||||||
{
|
{
|
||||||
return detail::functor2_vec_sca<T, P, vecType>::call(min, a, b);
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'min' only accept floating-point inputs for the interpolator a");
|
||||||
|
return detail::compute_min_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, vecType<T, P> const & b)
|
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||||
{
|
{
|
||||||
return detail::functor2<T, P, vecType>::call(min, a, b);
|
return detail::compute_min_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// max
|
// max
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType max(genType x, genType y)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'max' only accept floating-point or integer inputs");
|
|
||||||
|
|
||||||
return x > y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, T b)
|
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, T b)
|
||||||
{
|
{
|
||||||
return detail::functor2_vec_sca<T, P, vecType>::call(max, a, b);
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'max' only accept floating-point inputs for the interpolator a");
|
||||||
|
return detail::compute_max_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, vecType<T, P> const & b)
|
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||||
{
|
{
|
||||||
return detail::functor2<T, P, vecType>::call(max, a, b);
|
return detail::compute_max_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clamp
|
// clamp
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType clamp(genType x, genType minVal, genType maxVal)
|
GLM_FUNC_QUALIFIER genType clamp(genType x, genType minVal, genType maxVal)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return min(max(x, minVal), maxVal);
|
return min(max(x, minVal), maxVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal)
|
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||||
|
return detail::compute_clamp_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(minVal), vecType<T, P>(maxVal));
|
||||||
return min(max(x, minVal), maxVal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal)
|
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||||
|
return detail::compute_clamp_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal);
|
||||||
return min(max(x, minVal), maxVal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename genTypeT, typename genTypeU>
|
template <typename genTypeT, typename genTypeU>
|
||||||
@@ -480,13 +569,13 @@ namespace detail
|
|||||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a)
|
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a)
|
||||||
{
|
{
|
||||||
return detail::compute_mix_scalar<T, U, P, vecType>::call(x, y, a);
|
return detail::compute_mix_scalar<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
||||||
{
|
{
|
||||||
return detail::compute_mix_vector<T, U, P, vecType>::call(x, y, a);
|
return detail::compute_mix_vector<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// step
|
// step
|
||||||
@@ -499,22 +588,20 @@ namespace detail
|
|||||||
template <template <typename, precision> class vecType, typename T, precision P>
|
template <template <typename, precision> class vecType, typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> step(T edge, vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> step(T edge, vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'step' only accept floating-point inputs");
|
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge), x);
|
||||||
|
|
||||||
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, vecType<T, P>(edge)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename, precision> class vecType, typename T, precision P>
|
template <template <typename, precision> class vecType, typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, edge));
|
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// smoothstep
|
// smoothstep
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType smoothstep(genType edge0, genType edge1, genType x)
|
GLM_FUNC_QUALIFIER genType smoothstep(genType edge0, genType edge1, genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
genType const tmp(clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)));
|
genType const tmp(clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)));
|
||||||
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
||||||
@@ -523,19 +610,13 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge0), vecType<T, P>(edge1), x);
|
||||||
|
|
||||||
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
|
||||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x);
|
||||||
|
|
||||||
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
|
||||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if GLM_HAS_CXX11_STL
|
# if GLM_HAS_CXX11_STL
|
||||||
@@ -548,14 +629,16 @@ namespace detail
|
|||||||
|
|
||||||
# if GLM_HAS_CXX11_STL
|
# if GLM_HAS_CXX11_STL
|
||||||
return std::isnan(x);
|
return std::isnan(x);
|
||||||
# elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)
|
# elif GLM_COMPILER & GLM_COMPILER_VC
|
||||||
return _isnan(x) != 0;
|
return _isnan(x) != 0;
|
||||||
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
# elif GLM_COMPILER & GLM_COMPILER_INTEL
|
||||||
# if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L
|
# if GLM_PLATFORM & GLM_PLATFORM_WINDOWS
|
||||||
return _isnan(x) != 0;
|
return _isnan(x) != 0;
|
||||||
# else
|
# else
|
||||||
return std::isnan(x);
|
return ::isnan(x) != 0;
|
||||||
# endif
|
# endif
|
||||||
|
# elif (GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) && (GLM_PLATFORM & GLM_PLATFORM_ANDROID) && __cplusplus < 201103L
|
||||||
|
return _isnan(x) != 0;
|
||||||
# elif GLM_COMPILER & GLM_COMPILER_CUDA
|
# elif GLM_COMPILER & GLM_COMPILER_CUDA
|
||||||
return isnan(x) != 0;
|
return isnan(x) != 0;
|
||||||
# else
|
# else
|
||||||
@@ -583,8 +666,12 @@ namespace detail
|
|||||||
# if GLM_HAS_CXX11_STL
|
# if GLM_HAS_CXX11_STL
|
||||||
return std::isinf(x);
|
return std::isinf(x);
|
||||||
# elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)
|
# elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)
|
||||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
|
||||||
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||||
|
# else
|
||||||
|
return ::isinf(x);
|
||||||
|
# endif
|
||||||
|
# elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
|
||||||
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
|
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
|
||||||
return _isinf(x) != 0;
|
return _isinf(x) != 0;
|
||||||
# else
|
# else
|
||||||
@@ -660,23 +747,23 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType frexp(genType x, int & exp)
|
GLM_FUNC_QUALIFIER genType frexp(genType x, int & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return std::frexp(x, exp);
|
return std::frexp(x, &exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec1<T, P> frexp(tvec1<T, P> const & x, tvec1<int, P> & exp)
|
GLM_FUNC_QUALIFIER tvec1<T, P> frexp(tvec1<T, P> const & x, tvec1<int, P> & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec1<T, P>(std::frexp(x.x, exp.x));
|
return tvec1<T, P>(std::frexp(x.x, &exp.x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, P> frexp(tvec2<T, P> const & x, tvec2<int, P> & exp)
|
GLM_FUNC_QUALIFIER tvec2<T, P> frexp(tvec2<T, P> const & x, tvec2<int, P> & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec2<T, P>(
|
return tvec2<T, P>(
|
||||||
frexp(x.x, exp.x),
|
frexp(x.x, exp.x),
|
||||||
@@ -686,7 +773,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> frexp(tvec3<T, P> const & x, tvec3<int, P> & exp)
|
GLM_FUNC_QUALIFIER tvec3<T, P> frexp(tvec3<T, P> const & x, tvec3<int, P> & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec3<T, P>(
|
return tvec3<T, P>(
|
||||||
frexp(x.x, exp.x),
|
frexp(x.x, exp.x),
|
||||||
@@ -697,7 +784,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> frexp(tvec4<T, P> const & x, tvec4<int, P> & exp)
|
GLM_FUNC_QUALIFIER tvec4<T, P> frexp(tvec4<T, P> const & x, tvec4<int, P> & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec4<T, P>(
|
return tvec4<T, P>(
|
||||||
frexp(x.x, exp.x),
|
frexp(x.x, exp.x),
|
||||||
@@ -706,10 +793,10 @@ namespace detail
|
|||||||
frexp(x.w, exp.w));
|
frexp(x.w, exp.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType, precision P>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
|
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return std::ldexp(x, exp);
|
return std::ldexp(x, exp);
|
||||||
}
|
}
|
||||||
@@ -717,7 +804,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec1<T, P> ldexp(tvec1<T, P> const & x, tvec1<int, P> const & exp)
|
GLM_FUNC_QUALIFIER tvec1<T, P> ldexp(tvec1<T, P> const & x, tvec1<int, P> const & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec1<T, P>(
|
return tvec1<T, P>(
|
||||||
ldexp(x.x, exp.x));
|
ldexp(x.x, exp.x));
|
||||||
@@ -726,7 +813,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, P> ldexp(tvec2<T, P> const & x, tvec2<int, P> const & exp)
|
GLM_FUNC_QUALIFIER tvec2<T, P> ldexp(tvec2<T, P> const & x, tvec2<int, P> const & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec2<T, P>(
|
return tvec2<T, P>(
|
||||||
ldexp(x.x, exp.x),
|
ldexp(x.x, exp.x),
|
||||||
@@ -736,7 +823,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> ldexp(tvec3<T, P> const & x, tvec3<int, P> const & exp)
|
GLM_FUNC_QUALIFIER tvec3<T, P> ldexp(tvec3<T, P> const & x, tvec3<int, P> const & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec3<T, P>(
|
return tvec3<T, P>(
|
||||||
ldexp(x.x, exp.x),
|
ldexp(x.x, exp.x),
|
||||||
@@ -747,7 +834,7 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> ldexp(tvec4<T, P> const & x, tvec4<int, P> const & exp)
|
GLM_FUNC_QUALIFIER tvec4<T, P> ldexp(tvec4<T, P> const & x, tvec4<int, P> const & exp)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
return tvec4<T, P>(
|
return tvec4<T, P>(
|
||||||
ldexp(x.x, exp.x),
|
ldexp(x.x, exp.x),
|
||||||
@@ -756,3 +843,7 @@ namespace detail
|
|||||||
ldexp(x.w, exp.w));
|
ldexp(x.w, exp.w));
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_common_simd.inl"
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,231 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_common_simd.inl
|
||||||
|
|
||||||
|
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
|
|
||||||
|
#include "../simd/common.h"
|
||||||
|
|
||||||
|
#include <immintrin.h>
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <precision P>
|
||||||
|
struct compute_abs_vector<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_abs(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_abs_vector<int, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<int, P> result(uninitialize);
|
||||||
|
result.data = glm_ivec4_abs(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_floor<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_floor(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_ceil<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_ceil(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_fract<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_fract(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_round<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_round(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_mod<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_mod(x.data, y.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_min_vector<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_ps(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_min_vector<int32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<int32, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_epi32(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_min_vector<uint32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<uint32, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_epu32(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_max_vector<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = _mm_max_ps(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_max_vector<int32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<int32, P> result(uninitialize);
|
||||||
|
result.data = _mm_max_epi32(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_max_vector<uint32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
|
||||||
|
{
|
||||||
|
tvec4<uint32, P> result(uninitialize);
|
||||||
|
result.data = _mm_max_epu32(v1.data, v2.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_clamp_vector<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & minVal, tvec4<float, P> const & maxVal)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_ps(_mm_max_ps(x.data, minVal.data), maxVal.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_clamp_vector<int32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & x, tvec4<int32, P> const & minVal, tvec4<int32, P> const & maxVal)
|
||||||
|
{
|
||||||
|
tvec4<int32, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_epi32(_mm_max_epi32(x.data, minVal.data), maxVal.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_clamp_vector<uint32, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & x, tvec4<uint32, P> const & minVal, tvec4<uint32, P> const & maxVal)
|
||||||
|
{
|
||||||
|
tvec4<uint32, P> result(uninitialize);
|
||||||
|
result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_mix_vector<float, bool, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y, tvec4<bool, P> const & a)
|
||||||
|
{
|
||||||
|
__m128i const Load = _mm_set_epi32(-(int)a.w, -(int)a.z, -(int)a.y, -(int)a.x);
|
||||||
|
__m128 const Mask = _mm_castsi128_ps(Load);
|
||||||
|
|
||||||
|
tvec4<float, P> Result(uninitialize);
|
||||||
|
# if 0 && GLM_ARCH & GLM_ARCH_AVX
|
||||||
|
Result.data = _mm_blendv_ps(x.data, y.data, Mask);
|
||||||
|
# else
|
||||||
|
Result.data = _mm_or_ps(_mm_and_ps(Mask, y.data), _mm_andnot_ps(Mask, x.data));
|
||||||
|
# endif
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* FIXME
|
||||||
|
template <precision P>
|
||||||
|
struct compute_step_vector<float, P, tvec4>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge, tvec4<float, P> const& x)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_step(edge.data, x.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
template <precision P>
|
||||||
|
struct compute_smoothstep_vector<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge0, tvec4<float, P> const& edge1, tvec4<float, P> const& x)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_smoothstep(edge0.data, edge1.data, x.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_exponential.hpp
|
/// @file glm/detail/func_exponential.hpp
|
||||||
/// @date 2008-08-08 / 2011-06-14
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||||
///
|
///
|
||||||
@@ -35,7 +7,6 @@
|
|||||||
/// @ingroup core
|
/// @ingroup core
|
||||||
///
|
///
|
||||||
/// These all operate component-wise. The description is per component.
|
/// These all operate component-wise. The description is per component.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_exponential.inl
|
/// @file glm/detail/func_exponential.inl
|
||||||
/// @date 2008-08-03 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "func_vector_relational.hpp"
|
#include "func_vector_relational.hpp"
|
||||||
#include "_vectorize.hpp"
|
#include "_vectorize.hpp"
|
||||||
@@ -49,7 +20,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true>
|
template <typename T, precision P, template <class, precision> class vecType, bool isFloat, bool Aligned>
|
||||||
struct compute_log2
|
struct compute_log2
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
||||||
@@ -58,7 +29,16 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <template <class, precision> class vecType, typename T, precision P>
|
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||||
|
struct compute_sqrt
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
|
{
|
||||||
|
return detail::functor1<T, T, P, vecType>::call(std::sqrt, x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||||
struct compute_inversesqrt
|
struct compute_inversesqrt
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||||
@@ -67,8 +47,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <template <class, precision> class vecType>
|
template <template <class, precision> class vecType, bool Aligned>
|
||||||
struct compute_inversesqrt<vecType, float, lowp>
|
struct compute_inversesqrt<vecType, float, lowp, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x)
|
GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x)
|
||||||
{
|
{
|
||||||
@@ -133,7 +113,7 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sqrt
|
// sqrt
|
||||||
@@ -142,7 +122,7 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||||
return detail::functor1<T, T, P, vecType>::call(sqrt, x);
|
return detail::compute_sqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// inversesqrt
|
// inversesqrt
|
||||||
@@ -156,6 +136,11 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||||
return detail::compute_inversesqrt<vecType, T, P>::call(x);
|
return detail::compute_inversesqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_exponential_simd.inl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_exponential_simd.inl
|
||||||
|
|
||||||
|
#include "../simd/exponential.h"
|
||||||
|
|
||||||
|
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <precision P>
|
||||||
|
struct compute_sqrt<tvec4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = _mm_sqrt_ps(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct compute_sqrt<tvec4, float, aligned_lowp, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, aligned_lowp> call(tvec4<float, aligned_lowp> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, aligned_lowp> result(uninitialize);
|
||||||
|
result.data = glm_vec4_sqrt_lowp(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_geometric.hpp
|
/// @file glm/detail/func_geometric.hpp
|
||||||
/// @date 2008-08-03 / 2011-06-14
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||||
///
|
///
|
||||||
@@ -35,7 +7,6 @@
|
|||||||
/// @ingroup core
|
/// @ingroup core
|
||||||
///
|
///
|
||||||
/// These operate on vectors as vectors, not component-wise.
|
/// These operate on vectors as vectors, not component-wise.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -104,11 +75,11 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||||
template <typename genType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_DECL genType faceforward(
|
GLM_FUNC_DECL vecType<T, P> faceforward(
|
||||||
genType const & N,
|
vecType<T, P> const & N,
|
||||||
genType const & I,
|
vecType<T, P> const & I,
|
||||||
genType const & Nref);
|
vecType<T, P> const & Nref);
|
||||||
|
|
||||||
/// For the incident vector I and surface orientation N,
|
/// For the incident vector I and surface orientation N,
|
||||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_geometric.inl
|
/// @file glm/detail/func_geometric.inl
|
||||||
/// @date 2008-08-03 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "func_exponential.hpp"
|
#include "func_exponential.hpp"
|
||||||
#include "func_common.hpp"
|
#include "func_common.hpp"
|
||||||
@@ -39,11 +10,29 @@
|
|||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <template <class, precision> class vecType, typename T, precision P>
|
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned>
|
||||||
|
struct compute_length
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v)
|
||||||
|
{
|
||||||
|
return sqrt(dot(v, v));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned>
|
||||||
|
struct compute_distance
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||||
|
{
|
||||||
|
return length(p1 - p0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||||
struct compute_dot{};
|
struct compute_dot{};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_dot<tvec1, T, P>
|
struct compute_dot<tvec1, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b)
|
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||||
{
|
{
|
||||||
@@ -51,8 +40,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_dot<tvec2, T, P>
|
struct compute_dot<tvec2, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y)
|
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y)
|
||||||
{
|
{
|
||||||
@@ -61,8 +50,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_dot<tvec3, T, P>
|
struct compute_dot<tvec3, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||||
{
|
{
|
||||||
@@ -71,8 +60,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_dot<tvec4, T, P>
|
struct compute_dot<tvec4, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y)
|
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y)
|
||||||
{
|
{
|
||||||
@@ -80,13 +69,69 @@ namespace detail
|
|||||||
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, bool Aligned>
|
||||||
|
struct compute_cross
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec3<T, P> call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
||||||
|
|
||||||
|
return tvec3<T, P>(
|
||||||
|
x.y * y.z - y.y * x.z,
|
||||||
|
x.z * y.x - y.z * x.x,
|
||||||
|
x.x * y.y - y.x * x.y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_normalize
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||||
|
|
||||||
|
return v * inversesqrt(dot(v, v));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_faceforward
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||||
|
|
||||||
|
return dot(Nref, I) < static_cast<T>(0) ? N : -N;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_reflect
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N)
|
||||||
|
{
|
||||||
|
return I - N * dot(N, I) * static_cast<T>(2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||||
|
struct compute_refract
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
||||||
|
{
|
||||||
|
T const dotValue(dot(N, I));
|
||||||
|
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||||
|
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||||
|
}
|
||||||
|
};
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
|
||||||
// length
|
// length
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType length(genType x)
|
GLM_FUNC_QUALIFIER genType length(genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' accepts only floating-point inputs");
|
||||||
|
|
||||||
return abs(x);
|
return abs(x);
|
||||||
}
|
}
|
||||||
@@ -94,16 +139,16 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v)
|
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs");
|
||||||
|
|
||||||
return sqrt(dot(v, v));
|
return detail::compute_length<vecType, T, P, detail::is_aligned<P>::value>::call(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// distance
|
// distance
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1)
|
GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' accepts only floating-point inputs");
|
||||||
|
|
||||||
return length(p1 - p0);
|
return length(p1 - p0);
|
||||||
}
|
}
|
||||||
@@ -111,41 +156,36 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||||
{
|
{
|
||||||
return length(p1 - p0);
|
return detail::compute_distance<vecType, T, P, detail::is_aligned<P>::value>::call(p0, p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dot
|
// dot
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T dot(T x, T y)
|
GLM_FUNC_QUALIFIER T dot(T x, T y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||||
return x * y;
|
return x * y;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y)
|
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||||
return detail::compute_dot<vecType, T, P>::call(x, y);
|
return detail::compute_dot<vecType, T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cross
|
// cross
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
|
return detail::compute_cross<T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||||
|
|
||||||
return tvec3<T, P>(
|
|
||||||
x.y * y.z - y.y * x.z,
|
|
||||||
x.z * y.x - y.z * x.x,
|
|
||||||
x.x * y.y - y.x * x.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize
|
// normalize
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
|
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||||
|
|
||||||
return x < genType(0) ? genType(-1) : genType(1);
|
return x < genType(0) ? genType(-1) : genType(1);
|
||||||
}
|
}
|
||||||
@@ -153,9 +193,9 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||||
|
|
||||||
return x * inversesqrt(dot(x, x));
|
return detail::compute_normalize<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// faceforward
|
// faceforward
|
||||||
@@ -165,19 +205,30 @@ namespace detail
|
|||||||
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> faceforward(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref)
|
||||||
|
{
|
||||||
|
return detail::compute_faceforward<T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref);
|
||||||
|
}
|
||||||
|
|
||||||
// reflect
|
// reflect
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N)
|
GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N)
|
||||||
{
|
{
|
||||||
return I - N * dot(N, I) * static_cast<genType>(2);
|
return I - N * dot(N, I) * genType(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
|
GLM_FUNC_QUALIFIER vecType<T, P> reflect(vecType<T, P> const & I, vecType<T, P> const & N)
|
||||||
|
{
|
||||||
|
return detail::compute_reflect<T, P, vecType, detail::is_aligned<P>::value>::call(I, N);
|
||||||
}
|
}
|
||||||
|
|
||||||
// refract
|
// refract
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType const & eta)
|
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType eta)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' accepts only floating-point inputs");
|
||||||
|
|
||||||
genType const dotValue(dot(N, I));
|
genType const dotValue(dot(N, I));
|
||||||
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
|
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
|
||||||
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
||||||
@@ -186,10 +237,11 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs");
|
||||||
|
return detail::compute_refract<T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta);
|
||||||
T const dotValue(dot(N, I));
|
|
||||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
|
||||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_geometric_simd.inl"
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_geometric_simd.inl
|
||||||
|
|
||||||
|
#include "../simd/geometric.h"
|
||||||
|
|
||||||
|
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <precision P>
|
||||||
|
struct compute_length<tvec4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
return _mm_cvtss_f32(glm_vec4_length(v.data));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_distance<tvec4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & p0, tvec4<float, P> const & p1)
|
||||||
|
{
|
||||||
|
return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_dot<tvec4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const& x, tvec4<float, P> const& y)
|
||||||
|
{
|
||||||
|
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_cross<float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec3<float, P> call(tvec3<float, P> const & a, tvec3<float, P> const & b)
|
||||||
|
{
|
||||||
|
__m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x);
|
||||||
|
__m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x);
|
||||||
|
__m128 const xpd0 = glm_vec4_cross(set0, set1);
|
||||||
|
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = xpd0;
|
||||||
|
return tvec3<float, P>(result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_normalize<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_normalize(v.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_faceforward<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& N, tvec4<float, P> const& I, tvec4<float, P> const& Nref)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_faceforward(N.data, I.data, Nref.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_reflect<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_reflect(I.data, N.data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_refract<float, P, tvec4, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N, float eta)
|
||||||
|
{
|
||||||
|
tvec4<float, P> result(uninitialize);
|
||||||
|
result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_integer.hpp
|
/// @file glm/detail/func_integer.hpp
|
||||||
/// @date 2010-03-17 / 2011-06-18
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||||
///
|
///
|
||||||
@@ -37,7 +9,6 @@
|
|||||||
/// These all operate component-wise. The description is per component.
|
/// These all operate component-wise. The description is per component.
|
||||||
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
||||||
/// b, inclusive. The lowest-order bit is bit 0.
|
/// b, inclusive. The lowest-order bit is bit 0.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,26 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_integer.inl
|
/// @file glm/detail/func_integer.inl
|
||||||
/// @date 2010-03-17 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "type_vec2.hpp"
|
#include "type_vec2.hpp"
|
||||||
#include "type_vec3.hpp"
|
#include "type_vec3.hpp"
|
||||||
#include "type_vec4.hpp"
|
#include "type_vec4.hpp"
|
||||||
#include "type_int.hpp"
|
#include "type_int.hpp"
|
||||||
#include "_vectorize.hpp"
|
#include "_vectorize.hpp"
|
||||||
#if(GLM_ARCH != GLM_ARCH_PURE)
|
#if(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
|
||||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
# pragma intrinsic(_BitScanReverse)
|
# pragma intrinsic(_BitScanReverse)
|
||||||
#endif//(GLM_COMPILER & GLM_COMPILER_VC)
|
#endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
|
||||||
#endif//(GLM_ARCH != GLM_ARCH_PURE)
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||||
|
# if GLM_COMPILER & GLM_COMPILER_GCC
|
||||||
|
# pragma GCC diagnostic ignored "-Wlong-long"
|
||||||
|
# endif
|
||||||
|
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||||
|
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@@ -52,40 +30,36 @@ namespace detail
|
|||||||
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool EXEC = false>
|
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC>
|
||||||
struct compute_bitfieldReverseStep
|
struct compute_bitfieldReverseStep
|
||||||
{
|
{
|
||||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||||
{
|
{
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned>
|
||||||
struct compute_bitfieldReverseStep<true>
|
struct compute_bitfieldReverseStep<T, P, vecType, Aligned, true>
|
||||||
{
|
{
|
||||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||||
{
|
{
|
||||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool EXEC = false>
|
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC>
|
||||||
struct compute_bitfieldBitCountStep
|
struct compute_bitfieldBitCountStep
|
||||||
{
|
{
|
||||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||||
{
|
{
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned>
|
||||||
struct compute_bitfieldBitCountStep<true>
|
struct compute_bitfieldBitCountStep<T, P, vecType, Aligned, true>
|
||||||
{
|
{
|
||||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
|
||||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||||
{
|
{
|
||||||
return (v & Mask) + ((v >> Shift) & Mask);
|
return (v & Mask) + ((v >> Shift) & Mask);
|
||||||
@@ -173,7 +147,7 @@ namespace detail
|
|||||||
return IsNotNull ? int(Result) : -1;
|
return IsNotNull ? int(Result) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||||
struct compute_findMSB_vec<T, P, vecType, 32>
|
struct compute_findMSB_vec<T, P, vecType, 32>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||||
@@ -208,7 +182,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
|
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
|
||||||
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||||
Carry = Value64 > Max32 ? 1 : 0;
|
Carry = Value64 > Max32 ? 1u : 0u;
|
||||||
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,10 +222,8 @@ namespace detail
|
|||||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||||
|
|
||||||
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
|
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
|
||||||
uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1);
|
msb = static_cast<uint>(Value64 >> static_cast<uint64>(32));
|
||||||
msb = *PointerMSB;
|
lsb = static_cast<uint>(Value64);
|
||||||
uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0);
|
|
||||||
lsb = *PointerLSB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <precision P, template <typename, precision> class vecType>
|
template <precision P, template <typename, precision> class vecType>
|
||||||
@@ -270,10 +242,8 @@ namespace detail
|
|||||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||||
|
|
||||||
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
|
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
|
||||||
int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1);
|
msb = static_cast<int>(Value64 >> static_cast<int64>(32));
|
||||||
msb = *PointerMSB;
|
lsb = static_cast<int>(Value64);
|
||||||
int32* PointerLSB = (reinterpret_cast<int32*>(&Value64));
|
|
||||||
lsb = *PointerLSB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <precision P, template <typename, precision> class vecType>
|
template <precision P, template <typename, precision> class vecType>
|
||||||
@@ -328,12 +298,12 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v)
|
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v)
|
||||||
{
|
{
|
||||||
vecType<T, P> x(v);
|
vecType<T, P> x(v);
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,12 +318,12 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
|
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
|
||||||
{
|
{
|
||||||
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
|
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||||
return vecType<int, P>(x);
|
return vecType<int, P>(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,3 +361,8 @@ namespace detail
|
|||||||
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x);
|
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x);
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_integer_simd.inl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_integer_simd.inl
|
||||||
|
|
||||||
|
#include "../simd/integer.h"
|
||||||
|
|
||||||
|
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <glm::precision P>
|
||||||
|
struct compute_bitfieldReverseStep<uint32, P, tvec4, true, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||||
|
{
|
||||||
|
__m128i const set0 = v.data;
|
||||||
|
|
||||||
|
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||||
|
__m128i const and1 = _mm_and_si128(set0, set1);
|
||||||
|
__m128i const sft1 = _mm_slli_epi32(and1, Shift);
|
||||||
|
|
||||||
|
__m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1));
|
||||||
|
__m128i const and2 = _mm_and_si128(set0, set2);
|
||||||
|
__m128i const sft2 = _mm_srai_epi32(and2, Shift);
|
||||||
|
|
||||||
|
__m128i const or0 = _mm_or_si128(sft1, sft2);
|
||||||
|
|
||||||
|
return or0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <glm::precision P>
|
||||||
|
struct compute_bitfieldBitCountStep<uint32, P, tvec4, true, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||||
|
{
|
||||||
|
__m128i const set0 = v.data;
|
||||||
|
|
||||||
|
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||||
|
__m128i const and0 = _mm_and_si128(set0, set1);
|
||||||
|
__m128i const sft0 = _mm_slli_epi32(set0, Shift);
|
||||||
|
__m128i const and1 = _mm_and_si128(sft0, set1);
|
||||||
|
__m128i const add0 = _mm_add_epi32(and0, and1);
|
||||||
|
|
||||||
|
return add0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
|
||||||
|
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||||
|
template <>
|
||||||
|
GLM_FUNC_QUALIFIER int bitCount(uint32 x)
|
||||||
|
{
|
||||||
|
return _mm_popcnt_u32(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
# if(GLM_MODEL == GLM_MODEL_64)
|
||||||
|
template <>
|
||||||
|
GLM_FUNC_QUALIFIER int bitCount(uint64 x)
|
||||||
|
{
|
||||||
|
return static_cast<int>(_mm_popcnt_u64(x));
|
||||||
|
}
|
||||||
|
# endif//GLM_MODEL
|
||||||
|
# endif//GLM_ARCH
|
||||||
|
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_matrix.hpp
|
/// @file glm/detail/func_matrix.hpp
|
||||||
/// @date 2008-08-03 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
///
|
///
|
||||||
@@ -39,7 +11,6 @@
|
|||||||
/// are single precision, and a double-precision floating version, where all
|
/// are single precision, and a double-precision floating version, where all
|
||||||
/// arguments and return values are double precision. Only the single-precision
|
/// arguments and return values are double precision. Only the single-precision
|
||||||
/// floating point version is shown.
|
/// floating point version is shown.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -72,19 +43,19 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec2, tvec3>
|
struct outerProduct_trait<T, P, tvec2, tvec3>
|
||||||
{
|
{
|
||||||
typedef tmat2x3<T, P> type;
|
typedef tmat3x2<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec2, tvec4>
|
struct outerProduct_trait<T, P, tvec2, tvec4>
|
||||||
{
|
{
|
||||||
typedef tmat2x4<T, P> type;
|
typedef tmat4x2<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec3, tvec2>
|
struct outerProduct_trait<T, P, tvec3, tvec2>
|
||||||
{
|
{
|
||||||
typedef tmat3x2<T, P> type;
|
typedef tmat2x3<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@@ -96,19 +67,19 @@ namespace detail
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec3, tvec4>
|
struct outerProduct_trait<T, P, tvec3, tvec4>
|
||||||
{
|
{
|
||||||
typedef tmat3x4<T, P> type;
|
typedef tmat4x3<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec4, tvec2>
|
struct outerProduct_trait<T, P, tvec4, tvec2>
|
||||||
{
|
{
|
||||||
typedef tmat4x2<T, P> type;
|
typedef tmat2x4<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
struct outerProduct_trait<T, P, tvec4, tvec3>
|
struct outerProduct_trait<T, P, tvec4, tvec3>
|
||||||
{
|
{
|
||||||
typedef tmat4x3<T, P> type;
|
typedef tmat3x4<T, P> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@@ -149,7 +120,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))
|
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
|
||||||
template <typename T, precision P, template <typename, precision> class matType>
|
template <typename T, precision P, template <typename, precision> class matType>
|
||||||
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
|
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_matrix.inl
|
/// @file glm/detail/func_matrix.inl
|
||||||
/// @date 2008-03-08 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "../geometric.hpp"
|
#include "../geometric.hpp"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -36,11 +7,23 @@
|
|||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <template <class, precision> class matType, typename T, precision P>
|
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||||
|
struct compute_matrixCompMult
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static matType<T, P> call(matType<T, P> const& x, matType<T, P> const& y)
|
||||||
|
{
|
||||||
|
matType<T, P> result(uninitialize);
|
||||||
|
for(length_t i = 0; i < result.length(); ++i)
|
||||||
|
result[i] = x[i] * y[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <template <class, precision> class matType, typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose{};
|
struct compute_transpose{};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat2x2, T, P>
|
struct compute_transpose<tmat2x2, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -53,8 +36,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat2x3, T, P>
|
struct compute_transpose<tmat2x3, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat3x2<T, P> call(tmat2x3<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat3x2<T, P> call(tmat2x3<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -69,8 +52,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat2x4, T, P>
|
struct compute_transpose<tmat2x4, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat4x2<T, P> call(tmat2x4<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat4x2<T, P> call(tmat2x4<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -87,8 +70,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat3x2, T, P>
|
struct compute_transpose<tmat3x2, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat2x3<T, P> call(tmat3x2<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat2x3<T, P> call(tmat3x2<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -103,8 +86,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat3x3, T, P>
|
struct compute_transpose<tmat3x3, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -124,8 +107,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat3x4, T, P>
|
struct compute_transpose<tmat3x4, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat4x3<T, P> call(tmat3x4<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat4x3<T, P> call(tmat3x4<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -146,8 +129,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat4x2, T, P>
|
struct compute_transpose<tmat4x2, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat2x4<T, P> call(tmat4x2<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat2x4<T, P> call(tmat4x2<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -164,8 +147,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat4x3, T, P>
|
struct compute_transpose<tmat4x3, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat3x4<T, P> call(tmat4x3<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat3x4<T, P> call(tmat4x3<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -186,8 +169,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_transpose<tmat4x4, T, P>
|
struct compute_transpose<tmat4x4, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const & m)
|
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -215,11 +198,11 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <template <class, precision> class matType, typename T, precision P>
|
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||||
struct compute_determinant{};
|
struct compute_determinant{};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_determinant<tmat2x2, T, P>
|
struct compute_determinant<tmat2x2, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tmat2x2<T, P> const & m)
|
GLM_FUNC_QUALIFIER static T call(tmat2x2<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -227,8 +210,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_determinant<tmat3x3, T, P>
|
struct compute_determinant<tmat3x3, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tmat3x3<T, P> const & m)
|
GLM_FUNC_QUALIFIER static T call(tmat3x3<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -239,8 +222,8 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P, bool Aligned>
|
||||||
struct compute_determinant<tmat4x4, T, P>
|
struct compute_determinant<tmat4x4, T, P, Aligned>
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static T call(tmat4x4<T, P> const & m)
|
GLM_FUNC_QUALIFIER static T call(tmat4x4<T, P> const & m)
|
||||||
{
|
{
|
||||||
@@ -262,26 +245,130 @@ namespace detail
|
|||||||
m[0][2] * DetCof[2] + m[0][3] * DetCof[3];
|
m[0][2] * DetCof[2] + m[0][3] * DetCof[3];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||||
|
struct compute_inverse{};
|
||||||
|
|
||||||
|
template <typename T, precision P, bool Aligned>
|
||||||
|
struct compute_inverse<tmat2x2, T, P, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const& m)
|
||||||
|
{
|
||||||
|
T OneOverDeterminant = static_cast<T>(1) / (
|
||||||
|
+ m[0][0] * m[1][1]
|
||||||
|
- m[1][0] * m[0][1]);
|
||||||
|
|
||||||
|
tmat2x2<T, P> Inverse(
|
||||||
|
+ m[1][1] * OneOverDeterminant,
|
||||||
|
- m[0][1] * OneOverDeterminant,
|
||||||
|
- m[1][0] * OneOverDeterminant,
|
||||||
|
+ m[0][0] * OneOverDeterminant);
|
||||||
|
|
||||||
|
return Inverse;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, bool Aligned>
|
||||||
|
struct compute_inverse<tmat3x3, T, P, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const& m)
|
||||||
|
{
|
||||||
|
T OneOverDeterminant = static_cast<T>(1) / (
|
||||||
|
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||||
|
- m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
|
||||||
|
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]));
|
||||||
|
|
||||||
|
tmat3x3<T, P> Inverse(uninitialize);
|
||||||
|
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDeterminant;
|
||||||
|
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDeterminant;
|
||||||
|
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDeterminant;
|
||||||
|
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDeterminant;
|
||||||
|
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDeterminant;
|
||||||
|
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDeterminant;
|
||||||
|
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDeterminant;
|
||||||
|
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDeterminant;
|
||||||
|
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDeterminant;
|
||||||
|
|
||||||
|
return Inverse;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, precision P, bool Aligned>
|
||||||
|
struct compute_inverse<tmat4x4, T, P, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const& m)
|
||||||
|
{
|
||||||
|
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||||
|
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||||
|
T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
|
||||||
|
|
||||||
|
T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||||
|
T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||||
|
T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
|
||||||
|
|
||||||
|
T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
|
||||||
|
T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
|
||||||
|
T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
|
||||||
|
|
||||||
|
T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
|
||||||
|
T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
|
||||||
|
T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
|
||||||
|
|
||||||
|
T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||||
|
T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
|
||||||
|
T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||||
|
|
||||||
|
T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||||
|
T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
|
||||||
|
T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||||
|
|
||||||
|
tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
|
||||||
|
tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
|
||||||
|
tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
|
||||||
|
tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
|
||||||
|
tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
|
||||||
|
tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
|
||||||
|
|
||||||
|
tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
|
||||||
|
tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
|
||||||
|
tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
|
||||||
|
tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
|
||||||
|
|
||||||
|
tvec4<T, P> Inv0(Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
|
||||||
|
tvec4<T, P> Inv1(Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
|
||||||
|
tvec4<T, P> Inv2(Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
|
||||||
|
tvec4<T, P> Inv3(Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
|
||||||
|
|
||||||
|
tvec4<T, P> SignA(+1, -1, +1, -1);
|
||||||
|
tvec4<T, P> SignB(-1, +1, -1, +1);
|
||||||
|
tmat4x4<T, P> Inverse(Inv0 * SignA, Inv1 * SignB, Inv2 * SignA, Inv3 * SignB);
|
||||||
|
|
||||||
|
tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
||||||
|
|
||||||
|
tvec4<T, P> Dot0(m[0] * Row0);
|
||||||
|
T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
|
||||||
|
|
||||||
|
T OneOverDeterminant = static_cast<T>(1) / Dot1;
|
||||||
|
|
||||||
|
return Inverse * OneOverDeterminant;
|
||||||
|
}
|
||||||
|
};
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class matType>
|
template <typename T, precision P, template <typename, precision> class matType>
|
||||||
GLM_FUNC_QUALIFIER matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y)
|
GLM_FUNC_QUALIFIER matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'matrixCompMult' only accept floating-point inputs");
|
||||||
|
return detail::compute_matrixCompMult<matType, T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||||
matType<T, P> result(uninitialize);
|
|
||||||
for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
|
|
||||||
result[i] = x[i] * y[i];
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
template<typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
||||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
|
||||||
|
|
||||||
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
|
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
|
||||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
for(length_t i = 0; i < m.length(); ++i)
|
||||||
m[i] = c * r[i];
|
m[i] = c * r[i];
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@@ -289,22 +376,26 @@ namespace detail
|
|||||||
template <typename T, precision P, template <typename, precision> class matType>
|
template <typename T, precision P, template <typename, precision> class matType>
|
||||||
GLM_FUNC_QUALIFIER typename matType<T, P>::transpose_type transpose(matType<T, P> const & m)
|
GLM_FUNC_QUALIFIER typename matType<T, P>::transpose_type transpose(matType<T, P> const & m)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'transpose' only accept floating-point inputs");
|
||||||
return detail::compute_transpose<matType, T, P>::call(m);
|
return detail::compute_transpose<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class matType>
|
template <typename T, precision P, template <typename, precision> class matType>
|
||||||
GLM_FUNC_QUALIFIER T determinant(matType<T, P> const & m)
|
GLM_FUNC_QUALIFIER T determinant(matType<T, P> const & m)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'determinant' only accept floating-point inputs");
|
||||||
return detail::compute_determinant<matType, T, P>::call(m);
|
return detail::compute_determinant<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class matType>
|
template <typename T, precision P, template <typename, precision> class matType>
|
||||||
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
|
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'inverse' only accept floating-point inputs");
|
||||||
return detail::compute_inverse(m);
|
return detail::compute_inverse<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_matrix_simd.inl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_matrix_simd.inl
|
||||||
|
|
||||||
|
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||||
|
|
||||||
|
#include "type_mat4x4.hpp"
|
||||||
|
#include "func_geometric.hpp"
|
||||||
|
#include "../simd/matrix.h"
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <precision P>
|
||||||
|
struct compute_matrixCompMult<tmat4x4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(detail::is_aligned<P>::value, "Specialization requires aligned");
|
||||||
|
|
||||||
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & x, tmat4x4<float, P> const & y)
|
||||||
|
{
|
||||||
|
tmat4x4<float, P> result(uninitialize);
|
||||||
|
glm_mat4_matrixCompMult(
|
||||||
|
*(glm_vec4 const (*)[4])&x[0].data,
|
||||||
|
*(glm_vec4 const (*)[4])&y[0].data,
|
||||||
|
*(glm_vec4(*)[4])&result[0].data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_transpose<tmat4x4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & m)
|
||||||
|
{
|
||||||
|
tmat4x4<float, P> result(uninitialize);
|
||||||
|
glm_mat4_transpose(
|
||||||
|
*(glm_vec4 const (*)[4])&m[0].data,
|
||||||
|
*(glm_vec4(*)[4])&result[0].data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_determinant<tmat4x4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static float call(tmat4x4<float, P> const& m)
|
||||||
|
{
|
||||||
|
return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <precision P>
|
||||||
|
struct compute_inverse<tmat4x4, float, P, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const& m)
|
||||||
|
{
|
||||||
|
tmat4x4<float, P> Result(uninitialize);
|
||||||
|
glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data));
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
|
||||||
|
template<>
|
||||||
|
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_lowp> outerProduct<float, aligned_lowp, tvec4, tvec4>(tvec4<float, aligned_lowp> const & c, tvec4<float, aligned_lowp> const & r)
|
||||||
|
{
|
||||||
|
tmat4x4<float, aligned_lowp> m(uninitialize);
|
||||||
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_mediump> outerProduct<float, aligned_mediump, tvec4, tvec4>(tvec4<float, aligned_mediump> const & c, tvec4<float, aligned_mediump> const & r)
|
||||||
|
{
|
||||||
|
tmat4x4<float, aligned_mediump> m(uninitialize);
|
||||||
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_highp> outerProduct<float, aligned_highp, tvec4, tvec4>(tvec4<float, aligned_highp> const & c, tvec4<float, aligned_highp> const & r)
|
||||||
|
{
|
||||||
|
tmat4x4<float, aligned_highp> m(uninitialize);
|
||||||
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
|
||||||
/// @file glm/detail/func_noise.hpp
|
|
||||||
/// @date 2008-08-01 / 2011-06-18
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
|
||||||
///
|
|
||||||
/// @defgroup core_func_noise Noise functions
|
|
||||||
/// @ingroup core
|
|
||||||
///
|
|
||||||
/// Noise functions are stochastic functions that can be used to increase visual
|
|
||||||
/// complexity. Values returned by the following noise functions give the
|
|
||||||
/// appearance of randomness, but are not truly random.
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "type_vec1.hpp"
|
|
||||||
#include "type_vec2.hpp"
|
|
||||||
#include "type_vec3.hpp"
|
|
||||||
#include "setup.hpp"
|
|
||||||
|
|
||||||
namespace glm
|
|
||||||
{
|
|
||||||
/// @addtogroup core_func_noise
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/// Returns a 1D noise value based on the input value x.
|
|
||||||
///
|
|
||||||
/// @tparam genType Floating-point scalar or vector types.
|
|
||||||
///
|
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
|
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_DECL typename genType::value_type noise1(genType const & x);
|
|
||||||
|
|
||||||
/// Returns a 2D noise value based on the input value x.
|
|
||||||
///
|
|
||||||
/// @tparam genType Floating-point scalar or vector types.
|
|
||||||
///
|
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
|
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_DECL tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
|
||||||
|
|
||||||
/// Returns a 3D noise value based on the input value x.
|
|
||||||
///
|
|
||||||
/// @tparam genType Floating-point scalar or vector types.
|
|
||||||
///
|
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
|
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_DECL tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
|
||||||
|
|
||||||
/// Returns a 4D noise value based on the input value x.
|
|
||||||
///
|
|
||||||
/// @tparam genType Floating-point scalar or vector types.
|
|
||||||
///
|
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
|
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_DECL tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
}//namespace glm
|
|
||||||
|
|
||||||
#include "func_noise.inl"
|
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
|
||||||
/// @file glm/detail/func_noise.inl
|
|
||||||
/// @date 2008-08-01 / 2011-09-27
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "../detail/_noise.hpp"
|
|
||||||
#include "./func_common.hpp"
|
|
||||||
|
|
||||||
namespace glm{
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
|
|
||||||
{
|
|
||||||
tvec3<T, P> pXYZ = floor(fract(tvec3<T, P>(j) * tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
|
|
||||||
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), tvec3<T, P>(1));
|
|
||||||
tvec4<T, P> s = tvec4<T, P>(lessThan(tvec4<T, P>(pXYZ, pW), tvec4<T, P>(0.0)));
|
|
||||||
pXYZ = pXYZ + (tvec3<T, P>(s) * T(2) - T(1)) * s.w;
|
|
||||||
return tvec4<T, P>(pXYZ, pW);
|
|
||||||
}
|
|
||||||
}//namespace detail
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER T noise1(T const & x)
|
|
||||||
{
|
|
||||||
return noise1(tvec2<T, defaultp>(x, T(0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, defaultp> noise2(T const & x)
|
|
||||||
{
|
|
||||||
return tvec2<T, defaultp>(
|
|
||||||
noise1(x + T(0.0)),
|
|
||||||
noise1(x + T(1.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, defaultp> noise3(T const & x)
|
|
||||||
{
|
|
||||||
return tvec3<T, defaultp>(
|
|
||||||
noise1(x - T(1.0)),
|
|
||||||
noise1(x + T(0.0)),
|
|
||||||
noise1(x + T(1.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, defaultp> noise4(T const & x)
|
|
||||||
{
|
|
||||||
return tvec4<T, defaultp>(
|
|
||||||
noise1(x - T(1.0)),
|
|
||||||
noise1(x + T(0.0)),
|
|
||||||
noise1(x + T(1.0)),
|
|
||||||
noise1(x + T(2.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER T noise1(tvec2<T, P> const & v)
|
|
||||||
{
|
|
||||||
tvec4<T, P> const C = tvec4<T, P>(
|
|
||||||
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
|
|
||||||
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
|
|
||||||
T(-0.577350269189626), // -1.0 + 2.0 * C.x
|
|
||||||
T( 0.024390243902439)); // 1.0 / 41.0
|
|
||||||
|
|
||||||
// First corner
|
|
||||||
tvec2<T, P> i = floor(v + dot(v, tvec2<T, P>(C[1])));
|
|
||||||
tvec2<T, P> x0 = v - i + dot(i, tvec2<T, P>(C[0]));
|
|
||||||
|
|
||||||
// Other corners
|
|
||||||
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
|
|
||||||
//i1.y = 1.0 - i1.x;
|
|
||||||
tvec2<T, P> i1 = (x0.x > x0.y) ? tvec2<T, P>(1, 0) : tvec2<T, P>(0, 1);
|
|
||||||
|
|
||||||
// x0 = x0 - 0.0 + 0.0 * C.xx ;
|
|
||||||
// x1 = x0 - i1 + 1.0 * C.xx ;
|
|
||||||
// x2 = x0 - 1.0 + 2.0 * C.xx ;
|
|
||||||
tvec4<T, P> x12 = tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + tvec4<T, P>(C.x, C.x, C.z, C.z);
|
|
||||||
x12 = tvec4<T, P>(tvec2<T, P>(x12) - i1, x12.z, x12.w);
|
|
||||||
|
|
||||||
// Permutations
|
|
||||||
i = mod(i, T(289)); // Avoid truncation effects in permutation
|
|
||||||
tvec3<T, P> p = detail::permute(
|
|
||||||
detail::permute(i.y + tvec3<T, P>(T(0), i1.y, T(1))) + i.x + tvec3<T, P>(T(0), i1.x, T(1)));
|
|
||||||
|
|
||||||
tvec3<T, P> m = max(T(0.5) - tvec3<T, P>(
|
|
||||||
dot(x0, x0),
|
|
||||||
dot(tvec2<T, P>(x12.x, x12.y), tvec2<T, P>(x12.x, x12.y)),
|
|
||||||
dot(tvec2<T, P>(x12.z, x12.w), tvec2<T, P>(x12.z, x12.w))), T(0));
|
|
||||||
|
|
||||||
m = m * m;
|
|
||||||
m = m * m;
|
|
||||||
|
|
||||||
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
|
|
||||||
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
|
|
||||||
|
|
||||||
tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
|
|
||||||
tvec3<T, P> h = abs(x) - T(0.5);
|
|
||||||
tvec3<T, P> ox = floor(x + T(0.5));
|
|
||||||
tvec3<T, P> a0 = x - ox;
|
|
||||||
|
|
||||||
// Normalise gradients implicitly by scaling m
|
|
||||||
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
|
|
||||||
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
|
|
||||||
|
|
||||||
// Compute final noise value at P
|
|
||||||
tvec3<T, P> g;
|
|
||||||
g.x = a0.x * x0.x + h.x * x0.y;
|
|
||||||
//g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
||||||
g.y = a0.y * x12.x + h.y * x12.y;
|
|
||||||
g.z = a0.z * x12.z + h.z * x12.w;
|
|
||||||
return T(130) * dot(m, g);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER T noise1(tvec3<T, P> const & v)
|
|
||||||
{
|
|
||||||
tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
|
||||||
tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
|
|
||||||
|
|
||||||
// First corner
|
|
||||||
tvec3<T, P> i(floor(v + dot(v, tvec3<T, P>(C.y))));
|
|
||||||
tvec3<T, P> x0(v - i + dot(i, tvec3<T, P>(C.x)));
|
|
||||||
|
|
||||||
// Other corners
|
|
||||||
tvec3<T, P> g(step(tvec3<T, P>(x0.y, x0.z, x0.x), x0));
|
|
||||||
tvec3<T, P> l(T(1) - g);
|
|
||||||
tvec3<T, P> i1(min(g, tvec3<T, P>(l.z, l.x, l.y)));
|
|
||||||
tvec3<T, P> i2(max(g, tvec3<T, P>(l.z, l.x, l.y)));
|
|
||||||
|
|
||||||
// x0 = x0 - 0.0 + 0.0 * C.xxx;
|
|
||||||
// x1 = x0 - i1 + 1.0 * C.xxx;
|
|
||||||
// x2 = x0 - i2 + 2.0 * C.xxx;
|
|
||||||
// x3 = x0 - 1.0 + 3.0 * C.xxx;
|
|
||||||
tvec3<T, P> x1(x0 - i1 + C.x);
|
|
||||||
tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
|
|
||||||
tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
|
|
||||||
|
|
||||||
// Permutations
|
|
||||||
i = mod289(i);
|
|
||||||
tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
|
|
||||||
i.z + tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
|
|
||||||
i.y + tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
|
|
||||||
i.x + tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
|
|
||||||
|
|
||||||
// Gradients: 7x7 points over a square, mapped onto an octahedron.
|
|
||||||
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
|
|
||||||
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
|
|
||||||
tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
|
|
||||||
|
|
||||||
tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
|
||||||
|
|
||||||
tvec4<T, P> x_(floor(j * ns.z));
|
|
||||||
tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
|
||||||
|
|
||||||
tvec4<T, P> x(x_ * ns.x + ns.y);
|
|
||||||
tvec4<T, P> y(y_ * ns.x + ns.y);
|
|
||||||
tvec4<T, P> h(T(1) - abs(x) - abs(y));
|
|
||||||
|
|
||||||
tvec4<T, P> b0(x.x, x.y, y.x, y.y);
|
|
||||||
tvec4<T, P> b1(x.z, x.w, y.z, y.w);
|
|
||||||
|
|
||||||
// vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
|
|
||||||
// vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
|
|
||||||
tvec4<T, P> s0(floor(b0) * T(2) + T(1));
|
|
||||||
tvec4<T, P> s1(floor(b1) * T(2) + T(1));
|
|
||||||
tvec4<T, P> sh(-step(h, tvec4<T, P>(0.0)));
|
|
||||||
|
|
||||||
tvec4<T, P> a0 = tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
|
|
||||||
tvec4<T, P> a1 = tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
|
|
||||||
|
|
||||||
tvec3<T, P> p0(a0.x, a0.y, h.x);
|
|
||||||
tvec3<T, P> p1(a0.z, a0.w, h.y);
|
|
||||||
tvec3<T, P> p2(a1.x, a1.y, h.z);
|
|
||||||
tvec3<T, P> p3(a1.z, a1.w, h.w);
|
|
||||||
|
|
||||||
// Normalise gradients
|
|
||||||
tvec4<T, P> norm = taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
|
||||||
p0 *= norm.x;
|
|
||||||
p1 *= norm.y;
|
|
||||||
p2 *= norm.z;
|
|
||||||
p3 *= norm.w;
|
|
||||||
|
|
||||||
// Mix final noise value
|
|
||||||
tvec4<T, P> m = max(T(0.6) - tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
|
|
||||||
m = m * m;
|
|
||||||
return T(42) * dot(m * m, tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER T noise1(tvec4<T, P> const & v)
|
|
||||||
{
|
|
||||||
tvec4<T, P> const C(
|
|
||||||
0.138196601125011, // (5 - sqrt(5))/20 G4
|
|
||||||
0.276393202250021, // 2 * G4
|
|
||||||
0.414589803375032, // 3 * G4
|
|
||||||
-0.447213595499958); // -1 + 4 * G4
|
|
||||||
|
|
||||||
// (sqrt(5) - 1)/4 = F4, used once below
|
|
||||||
T const F4 = static_cast<T>(0.309016994374947451);
|
|
||||||
|
|
||||||
// First corner
|
|
||||||
tvec4<T, P> i = floor(v + dot(v, tvec4<T, P>(F4)));
|
|
||||||
tvec4<T, P> x0 = v - i + dot(i, tvec4<T, P>(C.x));
|
|
||||||
|
|
||||||
// Other corners
|
|
||||||
|
|
||||||
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
|
|
||||||
tvec4<T, P> i0;
|
|
||||||
tvec3<T, P> isX = step(tvec3<T, P>(x0.y, x0.z, x0.w), tvec3<T, P>(x0.x));
|
|
||||||
tvec3<T, P> isYZ = step(tvec3<T, P>(x0.z, x0.w, x0.w), tvec3<T, P>(x0.y, x0.y, x0.z));
|
|
||||||
|
|
||||||
// i0.x = dot(isX, vec3(1.0));
|
|
||||||
//i0.x = isX.x + isX.y + isX.z;
|
|
||||||
//i0.yzw = static_cast<T>(1) - isX;
|
|
||||||
i0 = tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
|
|
||||||
|
|
||||||
// i0.y += dot(isYZ.xy, vec2(1.0));
|
|
||||||
i0.y += isYZ.x + isYZ.y;
|
|
||||||
|
|
||||||
//i0.zw += 1.0 - tvec2<T, P>(isYZ.x, isYZ.y);
|
|
||||||
i0.z += static_cast<T>(1) - isYZ.x;
|
|
||||||
i0.w += static_cast<T>(1) - isYZ.y;
|
|
||||||
i0.z += isYZ.z;
|
|
||||||
i0.w += static_cast<T>(1) - isYZ.z;
|
|
||||||
|
|
||||||
// i0 now contains the unique values 0,1,2,3 in each channel
|
|
||||||
tvec4<T, P> i3 = clamp(i0, T(0), T(1));
|
|
||||||
tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
|
|
||||||
tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
|
|
||||||
|
|
||||||
// x0 = x0 - 0.0 + 0.0 * C.xxxx
|
|
||||||
// x1 = x0 - i1 + 0.0 * C.xxxx
|
|
||||||
// x2 = x0 - i2 + 0.0 * C.xxxx
|
|
||||||
// x3 = x0 - i3 + 0.0 * C.xxxx
|
|
||||||
// x4 = x0 - 1.0 + 4.0 * C.xxxx
|
|
||||||
tvec4<T, P> x1 = x0 - i1 + C.x;
|
|
||||||
tvec4<T, P> x2 = x0 - i2 + C.y;
|
|
||||||
tvec4<T, P> x3 = x0 - i3 + C.z;
|
|
||||||
tvec4<T, P> x4 = x0 + C.w;
|
|
||||||
|
|
||||||
// Permutations
|
|
||||||
i = mod(i, T(289));
|
|
||||||
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
|
|
||||||
tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
|
|
||||||
i.w + tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
|
|
||||||
i.z + tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
|
|
||||||
i.y + tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
|
|
||||||
i.x + tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
|
|
||||||
|
|
||||||
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
|
|
||||||
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
|
|
||||||
tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
|
||||||
|
|
||||||
tvec4<T, P> p0 = detail::grad4(j0, ip);
|
|
||||||
tvec4<T, P> p1 = detail::grad4(j1.x, ip);
|
|
||||||
tvec4<T, P> p2 = detail::grad4(j1.y, ip);
|
|
||||||
tvec4<T, P> p3 = detail::grad4(j1.z, ip);
|
|
||||||
tvec4<T, P> p4 = detail::grad4(j1.w, ip);
|
|
||||||
|
|
||||||
// Normalise gradients
|
|
||||||
tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
|
||||||
p0 *= norm.x;
|
|
||||||
p1 *= norm.y;
|
|
||||||
p2 *= norm.z;
|
|
||||||
p3 *= norm.w;
|
|
||||||
p4 *= taylorInvSqrt(dot(p4, p4));
|
|
||||||
|
|
||||||
// Mix contributions from the five corners
|
|
||||||
tvec3<T, P> m0 = max(T(0.6) - tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
|
|
||||||
tvec2<T, P> m1 = max(T(0.6) - tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
|
|
||||||
m0 = m0 * m0;
|
|
||||||
m1 = m1 * m1;
|
|
||||||
|
|
||||||
return T(49) * (
|
|
||||||
dot(m0 * m0, tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
|
||||||
dot(m1 * m1, tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec2<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec2<T, P>(
|
|
||||||
noise1(x + tvec2<T, P>(0.0)),
|
|
||||||
noise1(tvec2<T, P>(0.0) - x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec3<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec2<T, P>(
|
|
||||||
noise1(x + tvec3<T, P>(0.0)),
|
|
||||||
noise1(tvec3<T, P>(0.0) - x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec4<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec2<T, P>(
|
|
||||||
noise1(x + tvec4<T, P>(0)),
|
|
||||||
noise1(tvec4<T, P>(0) - x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec2<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec3<T, P>(
|
|
||||||
noise1(x - tvec2<T, P>(1.0)),
|
|
||||||
noise1(x + tvec2<T, P>(0.0)),
|
|
||||||
noise1(x + tvec2<T, P>(1.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec3<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec3<T, P>(
|
|
||||||
noise1(x - tvec3<T, P>(1.0)),
|
|
||||||
noise1(x + tvec3<T, P>(0.0)),
|
|
||||||
noise1(x + tvec3<T, P>(1.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec4<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec3<T, P>(
|
|
||||||
noise1(x - tvec4<T, P>(1)),
|
|
||||||
noise1(x + tvec4<T, P>(0)),
|
|
||||||
noise1(x + tvec4<T, P>(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec2<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec4<T, P>(
|
|
||||||
noise1(x - tvec2<T, P>(1)),
|
|
||||||
noise1(x + tvec2<T, P>(0)),
|
|
||||||
noise1(x + tvec2<T, P>(1)),
|
|
||||||
noise1(x + tvec2<T, P>(2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec3<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec4<T, P>(
|
|
||||||
noise1(x - tvec3<T, P>(1)),
|
|
||||||
noise1(x + tvec3<T, P>(0)),
|
|
||||||
noise1(x + tvec3<T, P>(1)),
|
|
||||||
noise1(x + tvec3<T, P>(2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, precision P>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec4<T, P> const & x)
|
|
||||||
{
|
|
||||||
return tvec4<T, P>(
|
|
||||||
noise1(x - tvec4<T, P>(1)),
|
|
||||||
noise1(x + tvec4<T, P>(0)),
|
|
||||||
noise1(x + tvec4<T, P>(1)),
|
|
||||||
noise1(x + tvec4<T, P>(2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_packing.hpp
|
/// @file glm/detail/func_packing.hpp
|
||||||
/// @date 2010-03-17 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
/// @see gtc_packing
|
/// @see gtc_packing
|
||||||
@@ -36,7 +8,6 @@
|
|||||||
/// @ingroup core
|
/// @ingroup core
|
||||||
///
|
///
|
||||||
/// These functions do not operate component-wise, rather as described in each case.
|
/// These functions do not operate component-wise, rather as described in each case.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -111,7 +82,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint const & p);
|
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);
|
||||||
|
|
||||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||||
@@ -124,7 +95,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint const & p);
|
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);
|
||||||
|
|
||||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||||
@@ -137,7 +108,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint const & p);
|
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);
|
||||||
|
|
||||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||||
@@ -150,7 +121,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint const & p);
|
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);
|
||||||
|
|
||||||
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
|
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
|
||||||
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
|
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
|
||||||
@@ -169,7 +140,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL uvec2 unpackDouble2x32(double const & v);
|
GLM_FUNC_DECL uvec2 unpackDouble2x32(double v);
|
||||||
|
|
||||||
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
|
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
|
||||||
/// to the 16-bit floating-point representation found in the OpenGL Specification,
|
/// to the 16-bit floating-point representation found in the OpenGL Specification,
|
||||||
@@ -189,7 +160,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||||
GLM_FUNC_DECL vec2 unpackHalf2x16(uint const & v);
|
GLM_FUNC_DECL vec2 unpackHalf2x16(uint v);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_packing.inl
|
/// @file glm/detail/func_packing.inl
|
||||||
/// @date 2010-03-17 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "func_common.hpp"
|
#include "func_common.hpp"
|
||||||
#include "type_half.hpp"
|
#include "type_half.hpp"
|
||||||
@@ -38,87 +9,182 @@ namespace glm
|
|||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
||||||
{
|
{
|
||||||
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
union
|
||||||
// return reinterpret_cast<uint&>(Topack);
|
{
|
||||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
u16 in[2];
|
||||||
return *ptr;
|
uint out;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u16vec2 result(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||||
|
|
||||||
|
u.in[0] = result[0];
|
||||||
|
u.in[1] = result[1];
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
|
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint p)
|
||||||
{
|
{
|
||||||
vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
|
union
|
||||||
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
|
{
|
||||||
|
uint in;
|
||||||
|
u16 out[2];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = p;
|
||||||
|
|
||||||
|
return vec2(u.out[0], u.out[1]) * 1.5259021896696421759365224689097e-5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
||||||
{
|
{
|
||||||
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
union
|
||||||
// return reinterpret_cast<uint32&>(Topack);
|
{
|
||||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
i16 in[2];
|
||||||
return *ptr;
|
uint out;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
i16vec2 result(round(clamp(v, -1.0f, 1.0f) * 32767.0f));
|
||||||
|
|
||||||
|
u.in[0] = result[0];
|
||||||
|
u.in[1] = result[1];
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
|
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint p)
|
||||||
{
|
{
|
||||||
vec2 Unpack(reinterpret_cast<i16vec2 const &>(p));
|
union
|
||||||
return clamp(
|
{
|
||||||
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
uint in;
|
||||||
-1.0f, 1.0f);
|
i16 out[2];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = p;
|
||||||
|
|
||||||
|
return clamp(vec2(u.out[0], u.out[1]) * 3.0518509475997192297128208258309e-5f, -1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
|
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
|
||||||
{
|
{
|
||||||
u8vec4 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
union
|
||||||
return reinterpret_cast<uint&>(Topack);
|
{
|
||||||
|
u8 in[4];
|
||||||
|
uint out;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u8vec4 result(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
||||||
|
|
||||||
|
u.in[0] = result[0];
|
||||||
|
u.in[1] = result[1];
|
||||||
|
u.in[2] = result[2];
|
||||||
|
u.in[3] = result[3];
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p)
|
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint p)
|
||||||
{
|
{
|
||||||
vec4 Unpack(reinterpret_cast<u8vec4 const&>(p));
|
union
|
||||||
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
|
{
|
||||||
|
uint in;
|
||||||
|
u8 out[4];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = p;
|
||||||
|
|
||||||
|
return vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0039215686274509803921568627451f;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
|
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
|
||||||
{
|
{
|
||||||
i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
|
union
|
||||||
return reinterpret_cast<uint&>(Topack);
|
{
|
||||||
|
i8 in[4];
|
||||||
|
uint out;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
i8vec4 result(round(clamp(v, -1.0f, 1.0f) * 127.0f));
|
||||||
|
|
||||||
|
u.in[0] = result[0];
|
||||||
|
u.in[1] = result[1];
|
||||||
|
u.in[2] = result[2];
|
||||||
|
u.in[3] = result[3];
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p)
|
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint p)
|
||||||
{
|
{
|
||||||
vec4 Unpack(reinterpret_cast<i8vec4 const &>(p));
|
union
|
||||||
return clamp(
|
{
|
||||||
Unpack * 0.0078740157480315f, // 1.0f / 127.0f
|
uint in;
|
||||||
-1.0f, 1.0f);
|
i8 out[4];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = p;
|
||||||
|
|
||||||
|
return clamp(vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0078740157480315f, -1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
|
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<double const &>(v);
|
union
|
||||||
|
{
|
||||||
|
uint in[2];
|
||||||
|
double out;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in[0] = v[0];
|
||||||
|
u.in[1] = v[1];
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v)
|
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<uvec2 const &>(v);
|
union
|
||||||
|
{
|
||||||
|
double in;
|
||||||
|
uint out[2];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = v;
|
||||||
|
|
||||||
|
return uvec2(u.out[0], u.out[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
|
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
|
||||||
{
|
{
|
||||||
i16vec2 Unpack(
|
union
|
||||||
detail::toFloat16(v.x),
|
{
|
||||||
detail::toFloat16(v.y));
|
i16 in[2];
|
||||||
|
uint out;
|
||||||
|
} u;
|
||||||
|
|
||||||
uint * Result = reinterpret_cast<uint*>(&Unpack);
|
u.in[0] = detail::toFloat16(v.x);
|
||||||
return *Result;
|
u.in[1] = detail::toFloat16(v.y);
|
||||||
|
|
||||||
|
return u.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
|
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint v)
|
||||||
{
|
{
|
||||||
i16vec2 Unpack(reinterpret_cast<i16vec2 const &>(v));
|
union
|
||||||
|
{
|
||||||
|
uint in;
|
||||||
|
i16 out[2];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.in = v;
|
||||||
|
|
||||||
return vec2(
|
return vec2(
|
||||||
detail::toFloat32(Unpack.x),
|
detail::toFloat32(u.out[0]),
|
||||||
detail::toFloat32(Unpack.y));
|
detail::toFloat32(u.out[1]));
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_packing_simd.inl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/// @ref core
|
||||||
|
/// @file glm/detail/func_packing_simd.inl
|
||||||
|
|
||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
}//namespace detail
|
||||||
|
}//namespace glm
|
||||||
@@ -1,33 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_trigonometric.hpp
|
/// @file glm/detail/func_trigonometric.hpp
|
||||||
/// @date 2008-08-01 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||||
///
|
///
|
||||||
@@ -39,7 +11,6 @@
|
|||||||
/// the divisor of a ratio is 0, then results will be undefined.
|
/// the divisor of a ratio is 0, then results will be undefined.
|
||||||
///
|
///
|
||||||
/// These all operate component-wise. The description is per component.
|
/// These all operate component-wise. The description is per component.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -58,7 +29,7 @@ namespace glm
|
|||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_DECL vecType<T, P> radians(vecType<T, P> const & degrees);
|
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & degrees);
|
||||||
|
|
||||||
/// Converts radians to degrees and returns the result.
|
/// Converts radians to degrees and returns the result.
|
||||||
///
|
///
|
||||||
@@ -67,7 +38,7 @@ namespace glm
|
|||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_DECL vecType<T, P> degrees(vecType<T, P> const & radians);
|
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & radians);
|
||||||
|
|
||||||
/// The standard trigonometric sine function.
|
/// The standard trigonometric sine function.
|
||||||
/// The values returned by this function will range from [-1, 1].
|
/// The values returned by this function will range from [-1, 1].
|
||||||
|
|||||||
@@ -1,34 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// OpenGL Mathematics (glm.g-truc.net)
|
|
||||||
///
|
|
||||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
|
||||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
/// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
/// in the Software without restriction, including without limitation the rights
|
|
||||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
/// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
/// furnished to do so, subject to the following conditions:
|
|
||||||
///
|
|
||||||
/// The above copyright notice and this permission notice shall be included in
|
|
||||||
/// all copies or substantial portions of the Software.
|
|
||||||
///
|
|
||||||
/// Restrictions:
|
|
||||||
/// By making use of the Software for military purposes, you choose to make
|
|
||||||
/// a Bunny unhappy.
|
|
||||||
///
|
|
||||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
/// THE SOFTWARE.
|
|
||||||
///
|
|
||||||
/// @ref core
|
/// @ref core
|
||||||
/// @file glm/detail/func_trigonometric.inl
|
/// @file glm/detail/func_trigonometric.inl
|
||||||
/// @date 2008-08-03 / 2011-06-15
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "_vectorize.hpp"
|
#include "_vectorize.hpp"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -38,7 +9,7 @@ namespace glm
|
|||||||
{
|
{
|
||||||
// radians
|
// radians
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType radians(genType degrees)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||||
|
|
||||||
@@ -46,14 +17,14 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> radians(vecType<T, P> const & v)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & v)
|
||||||
{
|
{
|
||||||
return detail::functor1<T, T, P, vecType>::call(radians, v);
|
return detail::functor1<T, T, P, vecType>::call(radians, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// degrees
|
// degrees
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType degrees(genType radians)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType degrees(genType radians)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||||
|
|
||||||
@@ -61,7 +32,7 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> degrees(vecType<T, P> const & v)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & v)
|
||||||
{
|
{
|
||||||
return detail::functor1<T, T, P, vecType>::call(degrees, v);
|
return detail::functor1<T, T, P, vecType>::call(degrees, v);
|
||||||
}
|
}
|
||||||
@@ -113,7 +84,7 @@ namespace glm
|
|||||||
|
|
||||||
// atan
|
// atan
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType atan(genType const & y, genType const & x)
|
GLM_FUNC_QUALIFIER genType atan(genType y, genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||||
|
|
||||||
@@ -123,7 +94,7 @@ namespace glm
|
|||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
template <typename T, precision P, template <typename, precision> class vecType>
|
||||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b)
|
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||||
{
|
{
|
||||||
return detail::functor2<T, P, vecType>::call(atan2, a, b);
|
return detail::functor2<T, P, vecType>::call(::std::atan2, a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
using std::atan;
|
using std::atan;
|
||||||
@@ -166,11 +137,11 @@ namespace glm
|
|||||||
using std::asinh;
|
using std::asinh;
|
||||||
# else
|
# else
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType asinh(genType const & x)
|
GLM_FUNC_QUALIFIER genType asinh(genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||||
|
|
||||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(std::abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -185,7 +156,7 @@ namespace glm
|
|||||||
using std::acosh;
|
using std::acosh;
|
||||||
# else
|
# else
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType acosh(genType const & x)
|
GLM_FUNC_QUALIFIER genType acosh(genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||||
|
|
||||||
@@ -206,11 +177,11 @@ namespace glm
|
|||||||
using std::atanh;
|
using std::atanh;
|
||||||
# else
|
# else
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType atanh(genType const & x)
|
GLM_FUNC_QUALIFIER genType atanh(genType x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||||
|
|
||||||
if(abs(x) >= static_cast<genType>(1))
|
if(std::abs(x) >= static_cast<genType>(1))
|
||||||
return 0;
|
return 0;
|
||||||
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
|
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
|
||||||
}
|
}
|
||||||
@@ -222,3 +193,8 @@ namespace glm
|
|||||||
return detail::functor1<T, T, P, vecType>::call(atanh, v);
|
return detail::functor1<T, T, P, vecType>::call(atanh, v);
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||||
|
# include "func_trigonometric_simd.inl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user