mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-16 01:28:22 +00:00
Compare commits
1813 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9733f04c9c | |||
| 7140a2054f | |||
| 1049e48aca | |||
| 33b79a3588 | |||
| f82699c39b | |||
| 15eaf4e6d1 | |||
| 7621882b4e | |||
| 9b70b73759 | |||
| 8e43134bda | |||
| d26782b093 | |||
| a2368b4ea7 | |||
| 3d6bb964df | |||
| 347ae1bc34 | |||
| 64f5bfd5ce | |||
| 86c1420f6e | |||
| 364ed921ce | |||
| 85e1518856 | |||
| 11ce399e0d | |||
| ec0989454d | |||
| e9f6031936 | |||
| 03485ef1e0 | |||
| e256175ce6 | |||
| 0f662bf70c | |||
| 4c959159c2 | |||
| d51241720a | |||
| 873d343529 | |||
| 95969ce67b | |||
| bd5cdf502e | |||
| c6a7d5a96c | |||
| 6bc4ecf390 | |||
| c94ceb5b1d | |||
| bb702335e8 | |||
| 863c0c5b58 | |||
| 76e280da4e | |||
| bcca35b7b7 | |||
| 65abaade88 | |||
| 8020e921aa | |||
| f2f5b4c1ad | |||
| 5c6f9fcdc4 | |||
| 9e243a2426 | |||
| 9a889802d3 | |||
| 1420987c4c | |||
| ed4d954ba8 | |||
| 881f937a35 | |||
| ed4e762f03 | |||
| fa1e33783a | |||
| 2fa31799f6 | |||
| 6c3d5c713c | |||
| f16beddf6e | |||
| 506b3ca4a0 | |||
| 80242bd250 | |||
| 7f7f99cbe3 | |||
| 579294fbf0 | |||
| a3b54e5cae | |||
| b392d16808 | |||
| 616e13acac | |||
| b50f660339 | |||
| 84310ec8f0 | |||
| ffed5a9e22 | |||
| 92c9ff6e53 | |||
| 986a424322 | |||
| c3e7c48939 | |||
| b2aa3262a9 | |||
| b1587f0326 | |||
| 281b321237 | |||
| ba0e4bfc1d | |||
| 3cda62acf4 | |||
| 2ef43212e1 | |||
| f69eccc42b | |||
| a1e425f936 | |||
| 6186c3d866 | |||
| 1d0a6bdc71 | |||
| da121137e5 | |||
| c953f1dee1 | |||
| 32b595afb4 | |||
| 399bf96a0c | |||
| b7c409e11b | |||
| fd08e9f2ad | |||
| 37d3daaf9a | |||
| 9a4d01da8f | |||
| 81cf748b2b | |||
| 22742b6a25 | |||
| 7d8d96c049 | |||
| f5e49441b6 | |||
| 610f3ed37f | |||
| f215874486 | |||
| 8e529105cf | |||
| 891952eb79 | |||
| e6a0b01f37 | |||
| 64c324a42b | |||
| f909e76260 | |||
| b7dfdc5060 | |||
| e25239a50d | |||
| 76d3edc534 | |||
| 7301182b3e | |||
| 832e5e90d1 | |||
| 7ddaabee30 | |||
| 41d57ddab6 | |||
| 8dd00f5288 | |||
| 15f217b594 | |||
| 8422178233 | |||
| eebe902917 | |||
| 04dc593df9 | |||
| 11ed698642 | |||
| 0996570b78 | |||
| ca84040a39 | |||
| 467afc86af | |||
| 19271f90a4 | |||
| 0a9732a267 | |||
| 1bc06c9c24 | |||
| e0acc937b3 | |||
| 3a10a0129a | |||
| 18dbcf16cc | |||
| bed8dc7d34 | |||
| a0fc9844fd | |||
| 9d6dc47cf4 | |||
| d42d77d3ef | |||
| 9041891557 | |||
| dedd1fc70d | |||
| 9ddb56088e | |||
| 9f4167a65c | |||
| 085b021587 | |||
| 5a65fd4207 | |||
| 0f321b3a69 | |||
| 53c7b789f2 | |||
| 850ea7789e | |||
| c3a3dc19a7 | |||
| 2606592f32 | |||
| 5c3791631a | |||
| 4c9108a906 | |||
| efbcaf6f64 | |||
| 18a4f831be | |||
| 6597967acd | |||
| 24825677dc | |||
| 70d5983562 | |||
| d4a9fed45e | |||
| a6b923a22e | |||
| 1e87086471 | |||
| c3fdbfe904 | |||
| 00852063c2 | |||
| 44dcf7af7d | |||
| d525d040fe | |||
| 67a774dd9b | |||
| ff7ff658e0 | |||
| 6100da75c5 | |||
| a612c3c006 | |||
| 412835d7fa | |||
| 6a4f7466f0 | |||
| b3ea7ecd0d | |||
| 50e6d0d256 | |||
| f948786f6a | |||
| 4d0179d525 | |||
| c851cd3f12 | |||
| b6875564d4 | |||
| 0240c61952 | |||
| 7864a5285d | |||
| 538921701c | |||
| 3cf4d4af1b | |||
| c70c7e13ec | |||
| 9980dfe80e | |||
| 42a51eb373 | |||
| 932dd836d0 | |||
| adf36bf912 | |||
| e7ef4b5484 | |||
| 3d1521857e | |||
| 9707b53df2 | |||
| 5d6d489889 | |||
| 8f4e2e99db | |||
| 377c6a87a2 | |||
| b36cc3ab08 | |||
| 339b8e37a6 | |||
| 8f3e9b4a7a | |||
| 633583c266 | |||
| 3b048ee8a2 | |||
| 52ae78709b | |||
| dec290ba96 | |||
| cef1dfd0c0 | |||
| 3262bee6c5 | |||
| 2dbd616725 | |||
| eb98563fa1 | |||
| 7f92e96ae7 | |||
| a48138dfd6 | |||
| 0b486b3f76 | |||
| 46980e5260 | |||
| 44f9e5495e | |||
| 97f59282cf | |||
| b112dfe860 | |||
| 2a4a5b1beb | |||
| 232d61b983 | |||
| 4e10b77980 | |||
| c1469a3a8e | |||
| 9d5f427f57 | |||
| cdd1e17348 | |||
| 20e978b676 | |||
| 163906e0f0 | |||
| c9bd662b57 | |||
| 8529384b00 | |||
| 7f89191ffc | |||
| aaf5f8c930 | |||
| 2bdc44dfb2 | |||
| 6e7136ea18 | |||
| 7a507e8d1e | |||
| 76fdfa87c1 | |||
| 19486bac0d | |||
| de47755320 | |||
| 6b90f883cd | |||
| 5c640b2d40 | |||
| a568a6f194 | |||
| 85df09b3f2 | |||
| 16d47a2c47 | |||
| 9a5d2d2bc5 | |||
| 3b16c86007 | |||
| 7c451f8170 | |||
| 2e1b75e95b | |||
| 1cd5970649 | |||
| 1bccdf57ee | |||
| d03232ce1b | |||
| ba6a3ac94b | |||
| 85bd837a66 | |||
| 264024e8fc | |||
| 0d09f5d536 | |||
| 840f936c2f | |||
| ca380edfc8 | |||
| 389fa922e5 | |||
| f9423b018c | |||
| 05ccab87f3 | |||
| 27dec16551 | |||
| 07a2cbe9a5 | |||
| 4821ed79fb | |||
| 5bf49d2ef9 | |||
| cd0824ee71 | |||
| 8394cc9e2b | |||
| 504a8b19ce | |||
| 0b63eaa25d | |||
| 7fc21b9e3a | |||
| 8369570b50 | |||
| e429260763 | |||
| 06f18225ce | |||
| 9ff0c414c1 | |||
| 850d1e7c28 | |||
| 2df823d2db | |||
| 2e84781594 | |||
| 405884f47d | |||
| 6457c00548 | |||
| 2e80e56af1 | |||
| 0ad4ffe33f | |||
| 833227f7f6 | |||
| e731cfd48d | |||
| cf7574d9b8 | |||
| 16f112a281 | |||
| 69944d907d | |||
| 663dbf9fc2 | |||
| a4a8a1aba5 | |||
| fb84f7f84f | |||
| 1c295453da | |||
| 8199821343 | |||
| b59e856b33 | |||
| f81acf23a7 | |||
| 27eba2e6e9 | |||
| 10d384f131 | |||
| 00b8c8ce47 | |||
| cab43f41be | |||
| fc0d589f12 | |||
| 743175d4ff | |||
| b497b07fed | |||
| aab5ed2267 | |||
| 46c9fe46e9 | |||
| e8c92c6fcc | |||
| 765eaf7f4f | |||
| 699c8cc1eb | |||
| 5839921e08 | |||
| a3bde6e1f1 | |||
| 0ece5bf178 | |||
| fbefad9eaf | |||
| 351a7a52fe | |||
| 8441ffda31 | |||
| 8b19c76e89 | |||
| e79747c919 | |||
| 8525d819c1 | |||
| fe600bb084 | |||
| babaff1985 | |||
| 909ca5440d | |||
| e25f64d03b | |||
| 2df66bd625 | |||
| 2028a5846c | |||
| 2fd2cd4cec | |||
| 17b175daa4 | |||
| 5cabe109da | |||
| c6e82448b6 | |||
| 8384ab9d2f | |||
| b846d89b5d | |||
| d5a5635a14 | |||
| f8dc8be6e6 | |||
| 5f9676d1a5 | |||
| 964c4c83df | |||
| 322cea7342 | |||
| 205e1d404e | |||
| 9769a96ebd | |||
| 74d3192c2e | |||
| 41769a3fa8 | |||
| a7efa9d4e4 | |||
| 9ed69999a5 | |||
| e19a59b269 | |||
| d234016224 | |||
| c160d6d929 | |||
| 62ad60b4ad | |||
| d44d7c6bbd | |||
| efd97bad14 | |||
| bc884f5daf | |||
| 0f47b73a64 | |||
| e9c6e96452 | |||
| 09713311f6 | |||
| c666d9c553 | |||
| 3777e8d1ce | |||
| e60658c684 | |||
| 046da9efae | |||
| 09332f6c26 | |||
| ce507d891a | |||
| 96f122f901 | |||
| 3479525f39 | |||
| 4f9d4b0023 | |||
| bcdfd32bc0 | |||
| 693dde04e3 | |||
| f1bb019933 | |||
| 5a6373c429 | |||
| 19e04a1875 | |||
| 029314ec7f | |||
| cee4a3f475 | |||
| 2bc58a97bc | |||
| 2eb270376f | |||
| 5e858678e9 | |||
| 12a59853b5 | |||
| 971c3f633f | |||
| 826f7d0efd | |||
| 5da5e9b5de | |||
| 7a3c05a41f | |||
| 01382e87a0 | |||
| f0abaad84f | |||
| 5946af88a6 | |||
| fe718a81f3 | |||
| 2f30488cd5 | |||
| 8b69de46e9 | |||
| c466317082 | |||
| 06b0bd6da4 | |||
| 334e29a6d6 | |||
| cab0beb77f | |||
| 5f2db0d1cb | |||
| b654729383 | |||
| 5fec840f06 | |||
| 1b6ccca709 | |||
| 957671e649 | |||
| 79a9e393d2 | |||
| 50c186b608 | |||
| 9054b93338 | |||
| cf1f03fd5b | |||
| 7742273237 | |||
| 536773db44 | |||
| cf4145dad4 | |||
| bc90ab795b | |||
| 21ba9953f8 | |||
| 1c87a6069a | |||
| 9867fdd4d2 | |||
| 64cd589ca3 | |||
| 110d22e775 | |||
| 3bc582885b | |||
| e33e8b713e | |||
| 4214cf47c2 | |||
| 68115505f8 | |||
| d87c95c1f8 | |||
| cec990716f | |||
| f22b26f80f | |||
| 236d227319 | |||
| a5020a68f0 | |||
| c613f362a7 | |||
| 977b28cb9c | |||
| 8b89beb02e | |||
| 748748dda9 | |||
| 6364d2c31d | |||
| e618fe87bd | |||
| 4e71330508 | |||
| c6091c4f27 | |||
| 49d231f5dd | |||
| e907ab4f3e | |||
| 9814a6e5a2 | |||
| 65e865a550 | |||
| 9cdf0a7a83 | |||
| 43326c1804 | |||
| e2d85337d0 | |||
| c4f1f57f74 | |||
| ab70427b7d | |||
| 0af394fb96 | |||
| e4320f98f8 | |||
| b5a46735df | |||
| 352d46d2ee | |||
| b672475166 | |||
| 7692793289 | |||
| 8d909ea8e2 | |||
| f7781e6d1d | |||
| 810553de2a | |||
| c6b2b1da4e | |||
| 5234eb6fc8 | |||
| d8856a7bae | |||
| 6ca5fb19f4 | |||
| 4d83397506 | |||
| 3720d9e50f | |||
| d73449104a | |||
| 580f32c190 | |||
| 65cc3a4b0a | |||
| 52344bfe24 | |||
| 7b33ef67f2 | |||
| 9270c45a5e | |||
| 34f051ab9a | |||
| a2280d1fe5 | |||
| 042613d234 | |||
| 8b05eff179 | |||
| fcb022b8ae | |||
| 41182de4f2 | |||
| 37b45be6d8 | |||
| dd044ca453 | |||
| b234c67622 | |||
| 529408fca0 | |||
| 84e95d9a28 | |||
| b439881f37 | |||
| a75b53f9b0 | |||
| 85ebb32176 | |||
| 6450b08fd6 | |||
| 0353dcb28c | |||
| 230296e777 | |||
| ad987c5531 | |||
| 503a2c0d04 | |||
| b7bcd13cbd | |||
| 446da590d8 | |||
| 24732eff88 | |||
| b98f8c6262 | |||
| 11c327e1d7 | |||
| 1253fa2a25 | |||
| f052c6004a | |||
| 3cde8d9af8 | |||
| cbed61db7e | |||
| e360ba5209 | |||
| fd8dc1214c | |||
| 327fa38232 | |||
| 845ed720b3 | |||
| ea0c8f86fe | |||
| 76f727b7ff | |||
| 449d5f9358 | |||
| b2ca66267e | |||
| f292cbc3e7 | |||
| df705e34ad | |||
| 364f133ffd | |||
| c7e2d3b355 | |||
| 553d12412b | |||
| a701541fce | |||
| dd06ecf99b | |||
| 9e5fdc50d9 | |||
| 80cc6e4ef3 | |||
| 34a56f75cf | |||
| 941f1cc395 | |||
| 9eec8f37f5 | |||
| 1734641d12 | |||
| 3856f7f1e5 | |||
| 94110dbe52 | |||
| 8a44271b2f | |||
| cca9ddab43 | |||
| 7b440bbd9f | |||
| a2d4376763 | |||
| a91b6a0db8 | |||
| 22367622be | |||
| 87efd22394 | |||
| 69b7d500d8 | |||
| 00321126f1 | |||
| 9e1549b61b | |||
| a85bb6aca6 | |||
| 9207220238 | |||
| 539c09adc5 | |||
| 8ef17f2ccd | |||
| 8b08f19628 | |||
| adc801a069 | |||
| 0f5214f481 | |||
| eb609f2ea4 | |||
| a3069b63df | |||
| f7bb763aac | |||
| bce3b1b961 | |||
| e2874b2cc6 | |||
| dc6e6fd05f | |||
| c2282ced0e | |||
| 6badd7e00e | |||
| 12b9531d8a | |||
| 1ba4b6fc31 | |||
| cb3fa2d4a3 | |||
| cfd6364999 | |||
| f1b8908c9a | |||
| 11abc45e3f | |||
| 321cf17eac | |||
| 091047d08b | |||
| f0c46664d2 | |||
| 8b2dba9715 | |||
| 26ff1ae941 | |||
| 12ded4b506 | |||
| 2b66af2d91 | |||
| 8940e987c1 | |||
| c02cb2c343 | |||
| 99b25f42e4 | |||
| a327a0028d | |||
| 478eb35a3b | |||
| d7eb28c7f8 | |||
| e1996e62b0 | |||
| bb9f440882 | |||
| b7be8fb625 | |||
| 2aec190afc | |||
| f0496a6f59 | |||
| aab3cac29c | |||
| 9561f841c4 | |||
| 32243aa383 | |||
| 13f3c13c0e | |||
| 92a1abbbee | |||
| 4b7fa0654c | |||
| f3710856ad | |||
| ef982b9ce2 | |||
| 52d92b7181 | |||
| e0e473ce06 | |||
| 9c92c5dbe4 | |||
| b65d3c85b6 | |||
| 71b7fc57f6 | |||
| 454f2520c3 | |||
| e1e219ae97 | |||
| af57ca3b05 | |||
| a98eeb7be6 | |||
| cc0f2ac37a | |||
| 842f1fb9c7 | |||
| 8b14c21a24 | |||
| 0f6ce6a1f4 | |||
| 7aaf9ae00d | |||
| e902373ce7 | |||
| 0ad7c4470b | |||
| 36a2d52f1c | |||
| d0756ff2af | |||
| 9fcea56fbf | |||
| 1b239b7119 | |||
| 83f94da43b | |||
| 0d5a0525cd | |||
| 4f07be2343 | |||
| 152a7410b6 | |||
| 9e4a21d934 | |||
| 6b107d4197 | |||
| d99f9c1c09 | |||
| 089360a3a5 | |||
| d7c2d6108f | |||
| b7e36feeeb | |||
| 658bf04d0b | |||
| b43ab783b0 | |||
| be90b4e0cc | |||
| b3895f717a | |||
| 77a5d82de4 | |||
| a7ac4b8deb | |||
| 9cd2225f8c | |||
| f2e7f8ec64 | |||
| 899c34ff63 | |||
| 79819a85d6 | |||
| e66b4e4a3d | |||
| 48c24186d1 | |||
| 965bb039be | |||
| d606d8f4f2 | |||
| a862d9a06d | |||
| c4d9e543e3 | |||
| 5104b507bb | |||
| cb5cecd0c2 | |||
| 77c793166c | |||
| e08533c634 | |||
| 39196efcb3 | |||
| cc9bef9706 | |||
| 9d38c6d44e | |||
| fb213e6ee5 | |||
| aafc681034 | |||
| 11dc235121 | |||
| cb510e13d1 | |||
| 784b16bd43 | |||
| c6c47aba22 | |||
| 3581b0bf1a | |||
| b5f5dae9e8 | |||
| d68fca8e51 | |||
| dc6e5bc48e | |||
| 12c15c6db0 | |||
| d21c4a58b4 | |||
| 652b158ca4 | |||
| 71da40c757 | |||
| 3cf9c71c27 | |||
| c1b69594e5 | |||
| 8e8a21349f | |||
| b7fb8fa434 | |||
| e3d02cdf40 | |||
| 3b18c4891c | |||
| 0862feeba8 | |||
| 34a7b46163 | |||
| 538979716d | |||
| ed21229bba | |||
| 1ec7da0f36 | |||
| 61732658f2 | |||
| 474d5d1340 | |||
| fdb4e54ff6 | |||
| bde62709b5 | |||
| d4aaa93047 | |||
| 4ce7081ace | |||
| 6f8e7fc720 | |||
| 422f3b1ce9 | |||
| 397e3998ff | |||
| cff96b23a8 | |||
| 40798d38c5 | |||
| 09ede557b1 | |||
| 1f15f7ff9a | |||
| a96784aa18 | |||
| 3a2ceab58a | |||
| 84499e43dd | |||
| 2e8ff36ef7 | |||
| 6430a62c86 | |||
| ec47f8644c | |||
| 8b3afbdf10 | |||
| 57b11629ce | |||
| 396eced36e | |||
| 66070e9bf6 | |||
| 97588fbcf4 | |||
| d7a98e7655 | |||
| 4804cca0ab | |||
| 0850b1edad | |||
| c2e5875f02 | |||
| 56de9072c0 | |||
| 341121da32 | |||
| 869c041846 | |||
| 879ab418fd | |||
| 2ffc77be3d | |||
| 2f8cc6e57b | |||
| a64ef36d06 | |||
| 85895d01eb | |||
| fa3d8c9720 | |||
| 80a8a1fde3 | |||
| bf5ce11ff1 | |||
| 4a10bdb91a | |||
| 74b73e6f39 | |||
| d287d9731e | |||
| 95c072f692 | |||
| 41f453d5a4 | |||
| ddcaf855fe | |||
| d943183994 | |||
| 2424b1d3f1 | |||
| a036200369 | |||
| 0ddceb78ba | |||
| b23fb0e635 | |||
| 98ebbd50a1 | |||
| c39eb3ca86 | |||
| 2278ec023f | |||
| 2afd05de98 | |||
| 1655050730 | |||
| 9a30c24654 | |||
| 727d8a2bf8 | |||
| cdcb5e0692 | |||
| 01991f4beb | |||
| 28212ab8f8 | |||
| 22d06bc3d1 | |||
| 167ce7829c | |||
| bb2dc991eb | |||
| 989b5d96c5 | |||
| 0ea1010e3f | |||
| 4f4f9e8eb3 | |||
| d32f16fef5 | |||
| 41660240fb | |||
| c160059612 | |||
| c055b20b93 | |||
| e1b251ee8f | |||
| e60117cabb | |||
| 3449f5e11c | |||
| 010bc76440 | |||
| 4b647602b3 | |||
| 9abdf5f4b3 | |||
| 903a3a9060 | |||
| 4541bd5369 | |||
| 94e4da9456 | |||
| 2f3c1ed169 | |||
| 3db115b52f | |||
| 96c4b283fa | |||
| 7dce9d6c8e | |||
| bc46b1371d | |||
| 4a09b9b1a0 | |||
| a08c6c9a00 | |||
| 9b4491df57 | |||
| e81e47e9c5 | |||
| 34739b71b3 | |||
| c80f803ba7 | |||
| 6132fa0cb9 | |||
| 586e177f98 | |||
| 695e6f2026 | |||
| 9bbde71964 | |||
| 7a5afd8597 | |||
| c6f707d95c | |||
| b0612f8cdf | |||
| ceccf2b1ca | |||
| 137b624008 | |||
| 632b9b9c27 | |||
| 819de185ef | |||
| 61abdeb3f7 | |||
| cc9267707a | |||
| c82ce7cecc | |||
| 00db7e5c93 | |||
| f0106c90a8 | |||
| edf24308fb | |||
| 705ffa89bc | |||
| 8cdcd189f5 | |||
| 9e26ebb9e5 | |||
| 7b085c8018 | |||
| 41d3b177ea | |||
| effe2149da | |||
| 9af74e6468 | |||
| ede9d557a3 | |||
| 0be08b7899 | |||
| 2b204fa756 | |||
| 2c78a47a94 | |||
| e599820383 | |||
| cc69e81dab | |||
| 7048fcc358 | |||
| b169dbd09d | |||
| f7c637a0d9 | |||
| a054b83b92 | |||
| 4eea1e0468 | |||
| 853f1b56e5 | |||
| bf2d65d7e9 | |||
| 7b551f0399 | |||
| fdbb166076 | |||
| 2fe133fa0e | |||
| 6a59b83d43 | |||
| 9a634a2056 | |||
| d0416d5f35 | |||
| 3e0f6b8520 | |||
| 6877e40b38 | |||
| 1cd20c65e2 | |||
| 4672f223c1 | |||
| 042f6f3789 | |||
| 718ba3edbf | |||
| 32d20f22ef | |||
| d3ce9792b5 | |||
| 2afa08e361 | |||
| 25c20f0629 | |||
| 786b8c80fd | |||
| 6c4e69a71d | |||
| ef79a0607b | |||
| fbdc104c12 | |||
| 34bbb9236e | |||
| 54d1cff546 | |||
| 4684d92758 | |||
| 75fb34934d | |||
| a1f2e1c8fd | |||
| dc6154f71f | |||
| b7cc19f983 | |||
| ee6a4bd244 | |||
| e7051d0289 | |||
| 9680f39203 | |||
| 11918fccbf | |||
| 53fb53e822 | |||
| ad31de5f78 | |||
| 6821dc27f5 | |||
| ef7e107443 | |||
| 60dcdbd181 | |||
| b732133184 | |||
| 611f0e2aba | |||
| 5a4f80621b | |||
| 606bd86e3a | |||
| 3253f7494e | |||
| 31a774a92a | |||
| a0d5e5ad72 | |||
| cf8cfd8b17 | |||
| e607f5c079 | |||
| 397f7050ef | |||
| e20e5e59b8 | |||
| 20e40a9a9c | |||
| da2673d35e | |||
| 5c8cd19477 | |||
| 2a19a3ced4 | |||
| 24d08857e8 | |||
| 329fcc8302 | |||
| 91c8233a71 | |||
| ee696c2122 | |||
| 3dfff739fa | |||
| 6d6746f5a4 | |||
| 74d65f6fda | |||
| 87cb659dc2 | |||
| 4e25f4b68c | |||
| 5ef05d1bb6 | |||
| 20e80ebb92 | |||
| 9c6b538176 | |||
| 5e629a3e5c | |||
| 0aacecbee5 | |||
| 3aacf7df6a | |||
| 3cb7d9e3fe | |||
| 02b1b5ac0c | |||
| e3de570f29 | |||
| 2e7f7ad477 | |||
| ed6db3e7b0 | |||
| 0ab8c2481b | |||
| 95c82d9968 | |||
| 1bfdeeeb16 | |||
| 418e4ffee8 | |||
| cbf49b303b | |||
| 7f135d6e55 | |||
| 02f21ad7c9 | |||
| e6023a7013 | |||
| 699b27cecc | |||
| 4707e0f858 | |||
| fc721b8ec8 | |||
| 2918f6bc07 | |||
| b27ff80c75 | |||
| 0e0dee3d3d | |||
| d22d0a8145 | |||
| c175369ff6 | |||
| 923adc3ea5 | |||
| 0e438942e4 | |||
| 44aa1285ee | |||
| 122d180f02 | |||
| f3340343ad | |||
| d514eef59b | |||
| 3a4e72e3e7 | |||
| 58d585e2a6 | |||
| 9a76df62dd | |||
| fe5416958a | |||
| 3b9e9ae0fd | |||
| 773ab21085 | |||
| eb62481766 | |||
| 6197fb07e1 | |||
| c9830dff57 | |||
| 192f9f0cb5 | |||
| e599555ddb | |||
| 328cce33b9 | |||
| 127682cc84 | |||
| 065db3b396 | |||
| c645b81890 | |||
| 2734307ba2 | |||
| 53fd5e0a5c | |||
| 5a30d3ed03 | |||
| 28493488ac | |||
| 0d2127f874 | |||
| ee741048e9 | |||
| 90f74d6847 | |||
| a92b4c04e9 | |||
| 8453d5bc48 | |||
| 542c0913d6 | |||
| 35e72692c1 | |||
| 4a49a11e73 | |||
| ee6d7ae6ba | |||
| bd86e70766 | |||
| 5d85a26be1 | |||
| ede7f9899c | |||
| 3b8993a302 | |||
| c412038db8 | |||
| 2ef6d3f93e | |||
| 5e7d2fd07d | |||
| 8edb73dc3a | |||
| 93900086e1 | |||
| 70f10782b0 | |||
| 8a92fada5a | |||
| ce2a79b63e | |||
| 2fb95b00a5 | |||
| 1867088e1a | |||
| a573e840db | |||
| 87e7b9c3f0 | |||
| ec35c0d933 | |||
| 2a48b199d2 | |||
| 02e780025d | |||
| 677ba36d55 | |||
| b23af6d436 | |||
| db798ea4f4 | |||
| 6ef11777e3 | |||
| a4fe14a3d3 | |||
| 660db94607 | |||
| aa8195565d | |||
| a6589e283b | |||
| 58175a5442 | |||
| 41b190930f | |||
| f28a392f71 | |||
| 8ad9ad578c | |||
| a4769239fa | |||
| c20f35b3e8 | |||
| 5a14a85f52 | |||
| 3054a4c307 | |||
| 70476bfb06 | |||
| b3292e1d22 | |||
| a34a69b4c4 | |||
| aa6af15cb5 | |||
| da70a45d22 | |||
| 57a216cb44 | |||
| 308562f939 | |||
| 64784be57e | |||
| f0e8d88178 | |||
| 5137b84ba8 | |||
| 216113e14b | |||
| a1adda36fa | |||
| 5d074ea998 | |||
| e9c4613368 | |||
| 3690f93302 | |||
| 97e1963674 | |||
| dd73b82ec2 | |||
| 8a5405060f | |||
| 83270d0983 | |||
| fd4343702f | |||
| 0483e8bd1b | |||
| 39cbdbd5c2 | |||
| 5af47c5951 | |||
| c447c251cd | |||
| 3a2ccd7521 | |||
| 8c92271804 | |||
| cd7b5e4dce | |||
| ecc3459d93 | |||
| cc6dce25ad | |||
| 87ecdd38e5 | |||
| fc79521dd3 | |||
| 7d8f1bef87 | |||
| 10c43bfa51 | |||
| f50b83b293 | |||
| f89357f3c8 | |||
| 1f43e69b4c | |||
| 670c5e2e1a | |||
| e097722ec6 | |||
| b54c50ba7a | |||
| 7b1a084d39 | |||
| 6477de8c4f | |||
| 5c0a75071c | |||
| 391eee4289 | |||
| 2d6670cfe5 | |||
| 2cf546accd | |||
| ffa8e5ff62 | |||
| 84f99b6d6b | |||
| eb33e8ae11 | |||
| 5af0cb2844 | |||
| 26255b79db | |||
| f6e6f10716 | |||
| b5ca3219a1 | |||
| fb1d4109a9 | |||
| a2e86ebec5 | |||
| c6b637e5a5 | |||
| 0c9d640683 | |||
| db63c947b8 | |||
| 649f363917 | |||
| 6ad4a95cc6 | |||
| d652cc8ea4 | |||
| 989bffee81 | |||
| cd9cf9f52f | |||
| d3a9d509a8 | |||
| 380cf8691a | |||
| 62e48e7701 | |||
| 5e81848445 | |||
| e047d99a6c | |||
| d8ad337c0e | |||
| 391b6ed515 | |||
| d64f762277 | |||
| 4d3ba5087d | |||
| aba1acea9c | |||
| 9502f0aadf | |||
| 564c31c54d | |||
| 6aa0c9d694 | |||
| e726a82cc3 | |||
| dd1f5f6a11 | |||
| f08799f7ff | |||
| dffee38dc6 | |||
| fe542deb89 | |||
| 8aa13b51f4 | |||
| c16fe3c810 | |||
| 635d28cd65 | |||
| f915eed0f4 | |||
| 87994ebfba | |||
| 0b2281967b | |||
| fc9e7a3a3b | |||
| 884b0291f7 | |||
| 8d8b3241d1 | |||
| 272bbdb4d2 | |||
| 168183201a | |||
| aedd70f5fa | |||
| f9b46b46b1 | |||
| 983c7a9c91 | |||
| 48a9f05efb | |||
| f0a0f0677f | |||
| 35cd98c7a7 | |||
| 8b2f325cd0 | |||
| 4d70cb20e7 | |||
| 8e55b6618e | |||
| 7e75f7559a | |||
| 8ad1c1d8a9 | |||
| fb03db8980 | |||
| 11d5e4b6ca | |||
| 8db6060089 | |||
| 07625336fd | |||
| 35fad4d5a7 | |||
| 0f67e93a0f | |||
| 628a5764cc | |||
| 7cfc5b085e | |||
| fb3c6365e1 | |||
| 2c69dd7c93 | |||
| 1d6e947387 | |||
| c26637de53 | |||
| d1ecb32652 | |||
| 4b14ec53f1 | |||
| f6046477b4 | |||
| 2cdd50b9e9 | |||
| bb541eeb60 | |||
| 8866b3170e | |||
| 174cb1876a | |||
| 955f164efb | |||
| d939820918 | |||
| 12f8357373 | |||
| cbe0e94ca7 | |||
| 079d1ca870 | |||
| 41903e8f09 | |||
| 6906125725 | |||
| 11fbb86f8b | |||
| cfdd48b2a3 | |||
| 2cef299775 | |||
| 02e291d4e8 | |||
| 02d6471c88 | |||
| 02633d4b01 | |||
| 95176fc813 | |||
| 8571c35e77 | |||
| a84862897a | |||
| 2781f82d29 | |||
| f809f503c9 | |||
| 4170434b96 | |||
| 65e8c2ffde | |||
| c239964427 | |||
| 21bdc8c5b6 | |||
| 39abb4f50c | |||
| 93105966b6 | |||
| 2e4b4b94ed | |||
| bad963ddbc | |||
| 9ecf98195c | |||
| 1476ebdfe6 | |||
| e25fd47828 | |||
| d559a9ac0d | |||
| e8394c2b01 | |||
| 3ec1c894ee | |||
| fb3e3c8447 | |||
| 496f8151c9 | |||
| 55f5d4affa | |||
| d22c8832f7 | |||
| d8138d2c56 | |||
| 6c00eb9344 | |||
| b0e24b346e | |||
| 822a1b1003 | |||
| 3d5f99e14a | |||
| 0e8f62b480 | |||
| d70c4d7bbe | |||
| 05df6c5b21 | |||
| 3f6036a512 | |||
| 58f42f1af1 | |||
| 0ef95d8fe6 | |||
| ea677389ad | |||
| 057e4603db | |||
| a67aed9538 | |||
| 00068158c1 | |||
| 9e4cf19e0c | |||
| 84c85a4605 | |||
| c02ba17845 | |||
| f4b30c5861 | |||
| 5d9e400e86 | |||
| 39914c8eb4 | |||
| 7133357b1a | |||
| 629f9863ae | |||
| be57c66256 | |||
| e0edd7a290 | |||
| d46912fcdf | |||
| 5c7484cea2 | |||
| d525d23217 | |||
| c030cfe0ad | |||
| cb633e4b6a | |||
| 16afa277de | |||
| c18e9d9503 | |||
| a490b2ff22 | |||
| f32a30fb9a | |||
| 0f60fb06e3 | |||
| 01bd8bd9fa | |||
| 489a6ffd16 | |||
| f89d783308 | |||
| 1d6bd3cc5e | |||
| ea31a29f8a | |||
| 205dd8a1e5 | |||
| 8caac162b2 | |||
| 970b30b467 | |||
| 746569b471 | |||
| 20869a0aec | |||
| 88ec04e5ca | |||
| 33a8a398fe | |||
| d887c77a1b | |||
| 60c280a521 | |||
| 837c02ffd6 | |||
| 6b94e08404 | |||
| 1f471aa9f9 | |||
| 951c321ba6 | |||
| eabea6ea16 | |||
| 14649ce611 | |||
| c6377b93d5 | |||
| 5a6c25887a | |||
| 0e44a3625c | |||
| 476dc6e783 | |||
| 4ad2e5f9b5 | |||
| 2a28e88bcf | |||
| 44c833fbe6 | |||
| 026f019f58 | |||
| 451d422b8a | |||
| 808977f69a | |||
| 402a10c488 | |||
| 0caa1fd40b | |||
| 754d70d513 | |||
| eb3a11b49a | |||
| 916b33f714 | |||
| 58c5003ad5 | |||
| 0ca01641ff | |||
| 0fc7dade47 | |||
| ab4c9581ad | |||
| 6e474f22a2 | |||
| 068bd57fbc | |||
| d7f9cdf6b6 | |||
| a503c1af97 | |||
| 53a14381ba | |||
| 169b9161b9 | |||
| 85f2b46fe9 | |||
| 0dfa1e192d | |||
| 88eb0dcdfc | |||
| bb8a82030f | |||
| 16a6fc7d2c | |||
| 1ebf88abbb | |||
| 93e9f29c77 | |||
| 1b7271359e | |||
| 49df0a5d33 | |||
| 46f8723314 | |||
| 5f02de1c95 | |||
| 9d938cdd58 | |||
| e5fd0f5d75 | |||
| a3f9d5e707 | |||
| 5344679c7c | |||
| e09adbd13d | |||
| 275f9d6aaf | |||
| 9461067fdb | |||
| 7623770613 | |||
| 584278bf20 | |||
| 1ec0add76f | |||
| 51dff22b93 | |||
| c85c4a969d | |||
| 6a8a6e530b | |||
| ce4f4995b5 | |||
| a4260e54fe | |||
| f074ead7f6 | |||
| b819137e35 | |||
| 4d653caca3 | |||
| 75663774fe | |||
| 5ec5b398ac | |||
| 24c70a04ca | |||
| a602f70bf4 | |||
| 5733124c40 | |||
| 5216532e96 | |||
| c8bead6bdd | |||
| 72cec5608d | |||
| 8b1262b198 | |||
| 6e0a214bcc | |||
| 1ab19920f4 | |||
| 751d51c4d0 | |||
| 4a54e262f6 | |||
| bd0c325762 | |||
| de55f99174 | |||
| 044cf8da1a | |||
| aa57642103 | |||
| d98ed8f419 | |||
| 4b07f4ffc5 | |||
| 5a526a89aa | |||
| 3dbf863255 | |||
| 17f0cffca6 | |||
| d51e60cf8b | |||
| 85d6db1de1 | |||
| 1bf794c29f | |||
| 0e8f7a4542 | |||
| b72fe81e28 | |||
| a76889959f | |||
| 0166486e07 | |||
| bb793e5582 | |||
| a55c095d1b | |||
| 3d47d912fd | |||
| cc02d94bdf | |||
| 5121cc25a4 | |||
| e78d91104c | |||
| 38c5c79218 | |||
| b065f973c4 | |||
| 13609c4f09 | |||
| a93116aa19 | |||
| 95a5c7d4cc | |||
| 5d0136a4b6 | |||
| 2c74b4f1ac | |||
| 6bb8d87225 | |||
| 935ce8f968 | |||
| 70f994cda5 | |||
| 3970bb5955 | |||
| 3159453e75 | |||
| a1cb8d7ae7 | |||
| 4191c195c1 | |||
| b16ce6f809 | |||
| 88ba962a4c | |||
| 0315d15ce8 | |||
| 12681f4623 | |||
| a7a4f9373d | |||
| d2e66214f4 | |||
| 0a6d98b5e1 | |||
| 497c10e513 | |||
| 53765ebc62 | |||
| 4216627604 | |||
| 47c33f3b31 | |||
| 32359da1cc | |||
| f4e085c121 | |||
| 7972937072 | |||
| 5a6f2467f8 | |||
| 1822347a46 | |||
| 821ba8b701 | |||
| fdced53be1 | |||
| a394bf25b2 | |||
| f2c1c9f70e | |||
| 5199364091 | |||
| 50caef0086 | |||
| 8a04d8e2b7 | |||
| e7032bc2c2 | |||
| d128ef1b97 | |||
| 0645908762 | |||
| abbd0558a0 | |||
| c725ee84bb | |||
| a9b4e7819f | |||
| ae68deb4f8 | |||
| e4108d089f | |||
| 4d9d50c9ac | |||
| b727cbbfe9 | |||
| 864338a881 | |||
| 6dc444d2d1 | |||
| 13fcccefd5 | |||
| 30e8eac46e | |||
| 646e1f541c | |||
| a7c15ef598 | |||
| bddb03ba3b | |||
| 2ac1f37b02 | |||
| a96f10b6aa | |||
| ccf6b5ff68 | |||
| 0d661204ed | |||
| b0e50f13c9 | |||
| d3ad253b51 | |||
| 5ac23a2f8f | |||
| 9fff694382 | |||
| 4512326fe8 | |||
| bfb17a2fb5 | |||
| 53c124526c | |||
| 8007097aae | |||
| 32e5ed5ad8 | |||
| 65afbd4147 | |||
| 81e04ee185 | |||
| 52722dc0c8 | |||
| b9c270fab6 | |||
| 48db481fbb | |||
| 37cacd27b1 | |||
| 466f541798 | |||
| 9781af5696 | |||
| f6d5e8031f | |||
| c70ea4a621 | |||
| 76ec6e4da2 | |||
| cd2825288d | |||
| d95fdda30f | |||
| 4fdcf604f2 | |||
| 02c9007765 | |||
| 0f54830bc5 | |||
| d329fe0c12 | |||
| a7ce852ca5 | |||
| b4fce37c14 | |||
| 51181c8c8b | |||
| 1c07ae9172 | |||
| 2f8cbb3a9d | |||
| 093af6af0b | |||
| 0567073ca0 | |||
| e33eb9d7b0 | |||
| fd10ddf86d | |||
| edd4d47929 | |||
| f31b9ad98b | |||
| 10ee3ea346 | |||
| 62b7eda9e9 | |||
| 8b7984cf7d | |||
| 4a0e07a54c | |||
| 6e520c8476 | |||
| 917a8ed389 | |||
| 86bba4ff0e | |||
| 300799fdc8 | |||
| 65e36e02fb | |||
| 09dd3c1b37 | |||
| 36233538fd | |||
| 3d5b3d1e8c | |||
| 3c2ae8250f | |||
| 6a95abb01f | |||
| 4c6fce5d5c | |||
| 08b5225a13 | |||
| 765b5ee826 | |||
| a40a34d2e8 | |||
| 983ee2d39b | |||
| e1255af708 | |||
| b99d476754 | |||
| 23ab896dfc | |||
| d094a09ded | |||
| 3f8ee533d3 | |||
| 0c3c84d711 | |||
| 79c53a41a8 | |||
| 2ffa13c993 | |||
| 8af48bbe48 | |||
| 65c0772d37 | |||
| 78ab347171 | |||
| d83b94d231 | |||
| ed6c46f7ff | |||
| 925e19b15c | |||
| 2be71fc2ec | |||
| bc2ee8dce8 | |||
| 1deef77f07 | |||
| e00c57bc47 | |||
| da3ba12560 | |||
| f68b89b7d9 | |||
| c944aafb39 | |||
| 0e6c9820cd | |||
| b8d1838dcc | |||
| aba535b589 | |||
| cf117b1a4d | |||
| 1bae570b68 | |||
| 1f0e263b6e | |||
| 08706055af | |||
| 28bcf074fc | |||
| 1c8aaf97bc | |||
| a891597f4c | |||
| e3805d5920 | |||
| 3e6be197e6 | |||
| 0d5fc26841 | |||
| df47e17c8e | |||
| e53fa1d873 | |||
| d5152a0e59 | |||
| 78e04dee99 | |||
| b3d117f8c1 | |||
| cab77e83da | |||
| b4068823ed | |||
| a694cf3079 | |||
| 3c09613d01 | |||
| 36d336e69c | |||
| 4270d77692 | |||
| ec6c5519a5 | |||
| a06fe1d02e | |||
| 56ba87577b | |||
| cdb29be4f3 | |||
| 4ef9732e37 | |||
| f2f4e55818 | |||
| 403ac53a9e | |||
| cdcda943be | |||
| 2c25241763 | |||
| 17729365db | |||
| 5d5dc1b544 | |||
| 244c7e019c | |||
| a7fea4fc69 | |||
| 809925dc3e | |||
| 98c835e470 | |||
| 8ac4845930 | |||
| 765f23febc | |||
| f1b70b3340 | |||
| 549dfc9781 | |||
| 2019379a42 | |||
| 15335509c2 | |||
| da401acdb2 | |||
| 8327f22f6f | |||
| 6154cfce99 | |||
| c13c039721 | |||
| 7ee417ab05 | |||
| 3a95f81196 | |||
| 9a19a00bdc | |||
| 24308aec6c | |||
| 6b4b259753 | |||
| bf77bc47d1 | |||
| 2bde0b40bb | |||
| 478f7b8e49 | |||
| f289dffc48 | |||
| d119ed058b | |||
| fdb6f0fe84 | |||
| bef02b3511 | |||
| fcd9b525a8 | |||
| 590d8f4043 | |||
| 406e2f84eb | |||
| 926e2f7939 | |||
| b92a009539 | |||
| cfab1c4649 | |||
| fc03ee94e2 | |||
| 936c8cce4b | |||
| 1f2145a45d | |||
| 2331678312 | |||
| c216ece72c | |||
| 36e12110d5 | |||
| aa5ac1518b | |||
| d472c05f5d | |||
| 485fc2b2b7 | |||
| bdc83f4f37 | |||
| da178c9fba | |||
| a1dc390f49 | |||
| dfe63f87c3 | |||
| 239d4afb13 | |||
| ab2c184b54 | |||
| 31ede315f2 | |||
| 3992ac02bb | |||
| e6ad26f03c | |||
| 2f335372a0 | |||
| 63d678ce29 | |||
| 0c675c33e2 | |||
| 3c8d83f2a8 | |||
| b11ed32bcf | |||
| 9a63ee65c9 | |||
| 8b8742b242 | |||
| bccbc0f064 | |||
| b7fcd5b02a | |||
| 56b9dda60b | |||
| 1868d0e7a3 | |||
| 38b3433406 | |||
| 6d21823959 | |||
| 02eb56a696 | |||
| 6fe5c06fa0 | |||
| 2c68e813e9 | |||
| e42c7a38a5 | |||
| 7b5b1b2583 | |||
| 0578f45490 | |||
| f46f7bd528 | |||
| 945cc2117f | |||
| a5db4310c6 | |||
| d25205d9d3 | |||
| d12c700bbf | |||
| db70ad37dd | |||
| 9e1115f899 | |||
| 82f4b4ee53 | |||
| 4ff2efea43 | |||
| d2a3c051e5 | |||
| 16d3825df4 | |||
| 602b17f0e8 | |||
| 488b2888a8 | |||
| 1480b8911f | |||
| 72ef7f6557 | |||
| f35afed89a | |||
| ffe6494147 | |||
| 342a4c1b17 | |||
| b904689a98 | |||
| 0dc66b3dd7 | |||
| bb1282de30 | |||
| c5e4cf35c0 | |||
| 2529a7700e | |||
| 7e2806119b | |||
| 536e31d771 | |||
| 2a39449f6e | |||
| 7af04798fb | |||
| 76e25f75fa | |||
| 7b894a7c61 | |||
| d8a1d84a49 | |||
| bb8d11a57b | |||
| e811e3975b | |||
| 68261e0308 | |||
| d03e8d05ec | |||
| 3f2815e30c | |||
| 91b01c2fcc | |||
| 179063c863 | |||
| 28eb80e27f | |||
| c0d37b2e04 | |||
| 0dbd0478c0 | |||
| 56b41c882b | |||
| 8c3cce822a | |||
| b87d4a3e5f | |||
| cec60feba9 | |||
| 29c0c4801c | |||
| a3738dc131 | |||
| 6d0c0aee7d | |||
| 1b290b577d | |||
| 85c7e1b059 | |||
| a8de7e9ffc | |||
| bc82bff4b4 | |||
| ff091e940c | |||
| 55a964267e | |||
| d14608356d | |||
| 7fca5a7a89 | |||
| ac5926bdfe | |||
| b16cf57510 | |||
| 851c842529 | |||
| a1080fdb2d | |||
| 344feb7484 | |||
| 567c17cc9e | |||
| 0ee54f1117 | |||
| 69f1187722 | |||
| 39426789f4 | |||
| 49c3a81e18 | |||
| fa0196b987 | |||
| 44477a0d47 | |||
| 510ce16f0e | |||
| 1e7c5bb9b7 | |||
| 850fa5aecc | |||
| 79a9d2112a | |||
| d25d8187b6 | |||
| e47de5deed | |||
| 52b8c0e078 | |||
| 3c7f7beb6d | |||
| ee7d7c6f24 | |||
| a66ef1b778 | |||
| b47597b813 | |||
| d6ff01d63c | |||
| a3e24b6854 | |||
| fcb769e353 | |||
| ce63503bab | |||
| 815c3dc73f | |||
| efe7092995 | |||
| 12ddd30f67 | |||
| 879ddb208b | |||
| 70dab7d920 | |||
| 2840e32853 | |||
| 320494c83d | |||
| e6fba5ba82 | |||
| 5255c236c3 | |||
| e5d4b35a32 | |||
| b4e65a8840 | |||
| ac78841e55 | |||
| 54914a970e | |||
| ea2a1651d5 | |||
| 5c6e95f921 | |||
| 555e21c3c7 | |||
| 0fdfe025cb | |||
| 930fda07c9 | |||
| 41dcd5bc29 | |||
| d7546e09ee | |||
| e9577db9c2 | |||
| cdc7b2a000 | |||
| a7084b4d6c | |||
| 64212176ec | |||
| 70eb226fea | |||
| c18d868d03 | |||
| 9002bfb9a0 | |||
| 26143750f3 | |||
| 3c11f8f26b | |||
| dcec112b91 | |||
| 7b0de551e1 | |||
| d41331d948 | |||
| 1e5d6b0e34 | |||
| 1363d5d209 | |||
| f1a487f606 | |||
| fca9c1458b | |||
| 69bad31019 | |||
| 17954dd8fe | |||
| 7b21e3be72 | |||
| 7adcf6d3e5 | |||
| bec6acc01e | |||
| 1b9647f57e | |||
| 2d1805c983 | |||
| 1f265af1e7 | |||
| 3ddc61420b | |||
| b10de6f4e7 | |||
| 7185ff25be | |||
| f2e0f9cca5 | |||
| 55c66022eb | |||
| b26df187e6 | |||
| 312100e1c6 | |||
| f51f6e00c4 | |||
| 9e13a2271c | |||
| 6887ae18ae | |||
| 2336aa0e4f | |||
| 3cc1065873 | |||
| 38521e0009 | |||
| 20fc585b5e | |||
| 7b23c8dc75 | |||
| b0fb8aa4be | |||
| b9a32185d7 | |||
| 0f880177e4 | |||
| 7683252896 | |||
| ca9a1de44c | |||
| 2445576ae8 | |||
| 7648f071f1 | |||
| 60c93595f5 | |||
| 70998d25e3 | |||
| fa908040ca | |||
| 73a4e87379 | |||
| 3a31ad55fb | |||
| d1f7935ee2 | |||
| b19755a313 | |||
| 9a139a7604 | |||
| 373ff66240 | |||
| babd3949f6 | |||
| 3521472942 | |||
| dc045591e4 | |||
| 9ea71dd94f | |||
| 7a4cac84ac | |||
| 43d0350870 | |||
| c98c115cb6 | |||
| 0e4ac63b6b | |||
| 4bdd8b2502 | |||
| ffcff4aea1 | |||
| 56b15f558c | |||
| 6ea9c9218d | |||
| b6c0e7c302 | |||
| bdcb9d0c00 | |||
| 7a93966158 | |||
| b8adbee4ee | |||
| feae79b417 | |||
| bcf9546b2d | |||
| 273cb928bf | |||
| 7735639e57 | |||
| 23c524812d | |||
| c6ca89907c | |||
| 87a75c6100 | |||
| f6100ed834 | |||
| 21a9434f89 | |||
| ea6e239d58 | |||
| 4ee4992330 | |||
| 059ecdb50b | |||
| 0838d4507a | |||
| 5cda797531 | |||
| 308a21e0e2 | |||
| a0a92587b4 | |||
| 8e49ab9179 | |||
| ac1d931b5e | |||
| 90c7fab452 | |||
| a4b985cd96 | |||
| 6e9e81a890 | |||
| d7dff7d7a6 | |||
| 37b7a49faf | |||
| 05d7c12d38 | |||
| f983d19e01 | |||
| 4a0749f811 | |||
| e2fd78b510 | |||
| 7560b6b0a7 | |||
| 824b101831 | |||
| e1c2657b11 | |||
| d3588d2c95 | |||
| c5c945f0c3 | |||
| 022713996a | |||
| d2c7f23ec9 | |||
| 232d1e2ca8 | |||
| 401e897019 | |||
| 61f7009378 | |||
| 43b91b5938 | |||
| e2f25d1c92 | |||
| 56490400ca | |||
| b15cb08f54 | |||
| 9b015a2975 | |||
| b09a3840eb | |||
| 495510a02e | |||
| ea606ef80d | |||
| 27493c3d75 | |||
| cc07d511a5 | |||
| 5b3ec4fb7c | |||
| 18da8fe44d | |||
| 211248b50e | |||
| 969f0c535e | |||
| a7ce66856b | |||
| 3b42f295d6 | |||
| b8febdd440 | |||
| f8795bcd72 | |||
| 53301289f5 | |||
| 51896050ed | |||
| 81ca7a1bfd | |||
| 91c817d9dd | |||
| 88b9f96b91 | |||
| b2d5ad6904 | |||
| 20f086dc37 | |||
| 6fa93f243f | |||
| 15e31d1c03 | |||
| a787a7ce72 | |||
| 989d132423 | |||
| 757fc01b78 | |||
| 353d7cede0 | |||
| fb0add070b | |||
| 96b42ed86f | |||
| 2dde4dce12 | |||
| c7ff207017 | |||
| 23820a369e | |||
| 24d4eaf65d | |||
| e0b05e573e | |||
| e2b9efaf49 | |||
| 349eb371c6 | |||
| afe3ba40cf | |||
| 5e618a1ca4 | |||
| d011332647 | |||
| bc73e9c4e3 | |||
| e609ec1df6 | |||
| 2073ca8d38 | |||
| a6f2c1be8a | |||
| 18e9714273 | |||
| fa18991917 | |||
| b0b342a020 | |||
| 8e604fd3db | |||
| abaad22eb4 | |||
| ac040b5197 | |||
| 9b1a18d9a3 | |||
| a20c7735e8 | |||
| c94822a2a1 | |||
| 2124b63982 | |||
| 886c7bf634 | |||
| 56825e9ed0 | |||
| 925ba2199e | |||
| fd8650b8a0 | |||
| 549455b3df | |||
| f90a5b5b71 | |||
| 5c76297e5f | |||
| cabf8631d4 | |||
| 6ae8fbc0e4 | |||
| f32a277643 | |||
| 09df77b56e | |||
| f5e58e0125 | |||
| 660ab53476 | |||
| 5c9f2c0d50 | |||
| d036afee5b | |||
| 4ab7786828 | |||
| 981cabe857 | |||
| 8eef122cec | |||
| 1dc1655891 | |||
| 0bc942f4d5 | |||
| 9fbf9abd47 | |||
| b8170df498 | |||
| d76a8bd34a | |||
| 021faf68b3 | |||
| 7c264ad097 | |||
| 810fdf3cca | |||
| c301b30c3a | |||
| 735b4181fa | |||
| a14fecaf78 | |||
| e12b06a9ad | |||
| 9a82875ad4 | |||
| 0b0ee921a5 | |||
| 7109a40637 | |||
| 0a805feeec | |||
| 9fdb6862f8 | |||
| e53ae5f6d5 | |||
| 0ad1044b2e | |||
| 64c53fe37b | |||
| faa93c3739 | |||
| 0e6272e6d8 | |||
| c363261d00 | |||
| a2500ff814 | |||
| 2af6e8cd16 | |||
| eb1e88b38c | |||
| c81549a441 | |||
| adf42c8750 | |||
| 2ee8e17ac0 | |||
| f7469412f1 | |||
| 55a72c86cf | |||
| a80eb397d5 | |||
| 7926362ab5 | |||
| 7af51ff346 | |||
| c8ca362eba | |||
| 4964c17abb | |||
| 0c6eee6d81 | |||
| 950f00fae6 | |||
| d8628170b5 | |||
| 68338dace1 | |||
| af1f87a00f | |||
| 9a47e79e8e | |||
| aceaba0fb0 | |||
| e0887d81aa | |||
| ff9e4e0780 | |||
| 6a4f61d3a3 | |||
| c8da17c664 | |||
| 7c34a89ec5 | |||
| da4cddf1ef | |||
| 9262c0895f | |||
| b5405c35e2 | |||
| 0137a271cc | |||
| 5d8af58e57 | |||
| c054cb3dd0 | |||
| 8640a89323 | |||
| ea72975e69 | |||
| 7237c1f54c | |||
| 92ed7e694f | |||
| ffe24cdfaa | |||
| 04dfe4512f | |||
| a95205905e | |||
| 55347aeab6 | |||
| 945db17cb8 | |||
| e48d59b07b | |||
| aff4d53d7e | |||
| 5bb604248f | |||
| 7e63135a3d | |||
| 3092286604 | |||
| d42ff6ce19 | |||
| 26f965e251 | |||
| 34a4b2ab37 | |||
| 9c1159837a | |||
| 147c96970c | |||
| e7e1b46b36 | |||
| 299dc525d0 | |||
| 5a69f41f4d | |||
| c31b2b65c1 | |||
| 8937c5be86 | |||
| 54883b0795 | |||
| 39a77a855e | |||
| 4c10d4dd2f | |||
| f32048808a | |||
| 86c8b11102 | |||
| 8c425ff9d8 | |||
| 9eaa98675b | |||
| 6f13d0cfbc | |||
| 543ef3fb32 | |||
| 3e9c2a06a3 | |||
| 0115b18e67 | |||
| ef9498b03a | |||
| 8eb7d0aaa8 | |||
| 12bde7434a | |||
| 23dbd00d40 | |||
| f8bae86082 | |||
| acecff23f4 | |||
| 7ce6f4de0d | |||
| 78b2385785 | |||
| d4dbf0042e | |||
| 0d16361a40 | |||
| 70543c2b8a | |||
| a5ad05f274 | |||
| 53d6e4000c | |||
| a192e726d4 | |||
| 886fe5cc31 | |||
| c734708809 | |||
| 1c0f35a945 | |||
| 06a3873c9b | |||
| 7a2be102aa |
+16
@@ -0,0 +1,16 @@
|
|||||||
|
language: cpp
|
||||||
|
compiler: gcc
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -y libmysqlclient-dev libperl-dev libboost-dev liblua5.1-0-dev zlib1g-dev
|
||||||
|
script:
|
||||||
|
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON
|
||||||
|
- make
|
||||||
|
- ./bin/tests
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
irc:
|
||||||
|
channels: "irc.eqemulator.net#eqemucoders"
|
||||||
|
os: linux
|
||||||
+287
-101
@@ -1,4 +1,36 @@
|
|||||||
#EQEmu Cmake
|
#EQEmu CMake
|
||||||
|
#Variables used:
|
||||||
|
#EQEMU_DISABLE_CRT_SECURE_WARNINGS
|
||||||
|
#EQEMU_FAST_FLOATINGPOINT
|
||||||
|
#EQEMU_ENABLE_CRASH_LOGGING
|
||||||
|
#EQEMU_DISABLE_SAFESEH
|
||||||
|
#EQEMU_BUILD_MSVC_MP
|
||||||
|
#EQEMU_DEBUG_LEVEL
|
||||||
|
#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
|
||||||
|
#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_ENABLE_BOTS
|
||||||
|
#EQEMU_DISABLE_LOGSYS
|
||||||
|
#EQEMU_COMMANDS_LOGGING
|
||||||
|
#EQEMU_BUILD_SERVER
|
||||||
|
#EQEMU_BUILD_LOGIN
|
||||||
|
#EQEMU_BUILD_TESTS
|
||||||
|
#EQEMU_BUILD_PERL
|
||||||
|
#EQEMU_BUILD_LUA
|
||||||
|
#EQEMU_SANITIZE_LUA_LIBS
|
||||||
|
#EQEMU_BUILD_CLIENT_FILES
|
||||||
|
#EQEMU_MAP_DIR
|
||||||
|
|
||||||
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
|
#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!
|
#Can change this if you really want but you should upgrade!
|
||||||
@@ -7,158 +39,312 @@ 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
|
||||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
#For checking includes
|
|
||||||
INCLUDE (CheckIncludeFiles)
|
|
||||||
|
|
||||||
#Our project name is EQEmu
|
#Our project name is EQEmu
|
||||||
PROJECT(EQEmu)
|
PROJECT(EQEmu)
|
||||||
|
|
||||||
#Default build type is set to RelWithDebInfo for generators that honor that like makefiles
|
#Default build type is set to RelWithDebInfo for generators that honor that like makefiles
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
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)
|
||||||
|
|
||||||
#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)
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
ADD_DEFINITIONS(-DWIN64)
|
ADD_DEFINITIONS(-DWIN64)
|
||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
ADD_DEFINITIONS(-DWIN32)
|
ADD_DEFINITIONS(-DWIN32)
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
ENDIF(MSVC OR MINGW)
|
ENDIF(MSVC OR MINGW)
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
#Set our default locations for zlib/mysql based on x86/x64
|
#Set our default locations for zlib/mysql based on x86/x64
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
|
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
|
||||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
|
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
|
||||||
ELSE(CMAKE_CL_64)
|
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64")
|
||||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
|
ELSE(CMAKE_CL_64)
|
||||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
|
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
|
||||||
ENDIF(CMAKE_CL_64)
|
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)
|
||||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
|
ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
|
||||||
|
|
||||||
#fast FP if you'd like it
|
#fast FP if you'd like it
|
||||||
OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON)
|
OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON)
|
||||||
IF(EQEMU_FAST_FLOATINGPOINT)
|
IF(EQEMU_FAST_FLOATINGPOINT)
|
||||||
ADD_DEFINITIONS(/fp:fast)
|
ADD_DEFINITIONS(/fp:fast)
|
||||||
ENDIF(EQEMU_FAST_FLOATINGPOINT)
|
ENDIF(EQEMU_FAST_FLOATINGPOINT)
|
||||||
|
|
||||||
#crash logging currently only works on windows x86/x64
|
#crash logging currently only works on windows x86/x64
|
||||||
OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON)
|
OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON)
|
||||||
IF(EQEMU_ENABLE_CRASH_LOGGING)
|
IF(EQEMU_ENABLE_CRASH_LOGGING)
|
||||||
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
||||||
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
|
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
|
||||||
|
|
||||||
#Disable safe SEH or not?
|
#Disable safe SEH or not?
|
||||||
OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF)
|
OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF)
|
||||||
IF(EQEMU_DISABLE_SAFESEH)
|
IF(EQEMU_DISABLE_SAFESEH)
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
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_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_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /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_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_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_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /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_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_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_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
||||||
ENDIF(EQEMU_DISABLE_SAFESEH)
|
ENDIF(EQEMU_DISABLE_SAFESEH)
|
||||||
|
|
||||||
#We want to compile /MT not /MD so we change that
|
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
|
||||||
FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
IF(EQEMU_BUILD_MSVC_MP)
|
||||||
IF(${flag_var} MATCHES "/MD")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
ENDIF(EQEMU_BUILD_MSVC_MP)
|
||||||
ENDIF(${flag_var} MATCHES "/MD")
|
|
||||||
ENDFOREACH(flag_var)
|
#We want to compile /MT not /MD so we change that
|
||||||
|
FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
IF(${flag_var} MATCHES "/MD")
|
||||||
|
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||||
|
ENDIF(${flag_var} MATCHES "/MD")
|
||||||
|
ENDFOREACH(flag_var)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DNOMINMAX)
|
||||||
ELSE(MSVC)
|
ELSE(MSVC)
|
||||||
#Normally set by perl but we don't use the perl flags anymore so we set it.
|
#Normally set by perl but we don't use the perl flags anymore so we set it.
|
||||||
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
|
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
||||||
#use stdint.h types if they exist for this platform (we have to guess otherwise)
|
#FreeBSD support
|
||||||
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
|
IF(UNIX)
|
||||||
IF(HAVE_STDINT_H)
|
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
ADD_DEFINITIONS(-DEQEMU_USE_STDINT)
|
ADD_DEFINITIONS(-DFREEBSD)
|
||||||
ENDIF(HAVE_STDINT_H)
|
SET(FREEBSD TRUE)
|
||||||
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
|
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
ADD_DEFINITIONS(-DDARWIN)
|
||||||
|
SET(DARWIN TRUE)
|
||||||
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
ENDIF(UNIX)
|
||||||
|
|
||||||
#debug level, 5 is default. Most people wont ever change this but it's there if you want to
|
#debug level, 5 is default. Most people wont ever change this but it's there if you want to
|
||||||
SET(EQEMU_DEBUG_LEVEL 5 CACHE STRING "EQEmu debug level:
|
SET(EQEMU_DEBUG_LEVEL 5 CACHE STRING "EQEmu debug level:
|
||||||
0 - Quiet mode Errors to file Status and Normal ignored
|
0 - Quiet mode Errors to file Status and Normal ignored
|
||||||
1 - Status and Normal to console, Errors to logfile
|
1 - Status and Normal to console, Errors to logfile
|
||||||
2 - Status, Normal, and Error to console and logfile
|
2 - Status, Normal, and Error to console and logfile
|
||||||
3 - Light debug release errors and status
|
3 - Light debug release errors and status
|
||||||
4 - Moderate debug release errors and status
|
4 - Moderate debug release errors and status
|
||||||
5 - Maximum debug release errors and status
|
5 - Maximum debug release errors and status
|
||||||
10 - More errors than you ever wanted to see"
|
10 - More errors than you ever wanted to see"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_STATUS 2 CACHE STRING "EQEmu logging level for [Status]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_NORMAL 3 CACHE STRING "EQEmu logging level for [Normal]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_ERROR 2 CACHE STRING "EQEmu logging level for [Error]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_DEBUG 3 CACHE STRING "EQEmu logging level for [Debug]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_QUEST 2 CACHE STRING "EQEmu logging level for [Quest]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_COMMANDS 1 CACHE STRING "EQEmu logging level for [Commands]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EQEMU_LOG_LEVEL_CRASH 3 CACHE STRING "EQEmu logging level for [Crash]:
|
||||||
|
0 - Disabled
|
||||||
|
1 - Ouput to File Enabled
|
||||||
|
2 - Output to stdout Enabled
|
||||||
|
3 - Output to File and stdout Enabled
|
||||||
|
8 - Output to stderr Enabled
|
||||||
|
9 - Output to File and stderr Enabled
|
||||||
|
11 - Output to File, stdout and stderr Enabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
|
||||||
|
|
||||||
#Bots are a compile time option so on/off
|
#Bots are a compile time option so on/off
|
||||||
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
|
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
|
||||||
|
|
||||||
|
#Disable entire _mlog system (excludes trade/command logs)
|
||||||
|
OPTION(EQEMU_DISABLE_LOGSYS "Disable Logging INI System" ON)
|
||||||
|
|
||||||
|
#Enable GM Command log system
|
||||||
|
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
|
||||||
|
|
||||||
|
IF(EQEMU_COMMANDS_LOGGING)
|
||||||
|
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
||||||
|
ENDIF(EQEMU_COMMANDS_LOGGING)
|
||||||
|
|
||||||
|
IF(EQEMU_DISABLE_LOGSYS)
|
||||||
|
ADD_DEFINITIONS(-DDISABLE_LOGSYS)
|
||||||
|
ENDIF(EQEMU_DISABLE_LOGSYS)
|
||||||
|
|
||||||
IF(EQEMU_ENABLE_BOTS)
|
IF(EQEMU_ENABLE_BOTS)
|
||||||
ADD_DEFINITIONS(-DBOTS)
|
ADD_DEFINITIONS(-DBOTS)
|
||||||
ENDIF(EQEMU_ENABLE_BOTS)
|
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_AZONE "Build azone utility." 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_LUA "Build Lua parser." ON)
|
||||||
|
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||||
|
|
||||||
IF(UNIX)
|
#C++11 stuff
|
||||||
#Whether to build cleanipc or not (probably a good idea if you build server)
|
IF(NOT MSVC)
|
||||||
OPTION(EQEMU_BUILD_CLEANIPC "Build cleanipc." ON)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
|
ENDIF(NOT MSVC)
|
||||||
#Use C++11 stuff, support for this is still it infancy
|
|
||||||
OPTION(EQEMU_CPP_ELEVEN "Enable C++11 extentions in g++" OFF)
|
|
||||||
IF(EQEMU_CPP_ELEVEN)
|
|
||||||
ADD_DEFINITIONS(-std=c++0x)
|
|
||||||
ENDIF(EQEMU_CPP_ELEVEN)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
#Various definitions
|
#Various definitions
|
||||||
ADD_DEFINITIONS(-DEMBPERL)
|
IF(EQEMU_BUILD_PERL)
|
||||||
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
|
ADD_DEFINITIONS(-DEMBPERL)
|
||||||
|
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
|
||||||
|
ENDIF(EQEMU_BUILD_PERL)
|
||||||
|
IF(EQEMU_BUILD_LUA)
|
||||||
|
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||||
|
ENDIF(EQEMU_BUILD_LUA)
|
||||||
|
|
||||||
|
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(-DSHAREMEM)
|
|
||||||
ADD_DEFINITIONS(-DINVERSEXY)
|
ADD_DEFINITIONS(-DINVERSEXY)
|
||||||
ADD_DEFINITIONS(-DFIELD_ITEMS)
|
ADD_DEFINITIONS(-DFIELD_ITEMS)
|
||||||
ADD_DEFINITIONS(-DMAP_DIR="./Maps")
|
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_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
|
||||||
|
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
|
||||||
|
ADD_DEFINITIONS(-DLOG_LEVEL_DEBUG=${EQEMU_LOG_LEVEL_DEBUG})
|
||||||
|
ADD_DEFINITIONS(-DLOG_LEVEL_QUEST=${EQEMU_LOG_LEVEL_QUEST})
|
||||||
|
ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
|
||||||
|
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
|
||||||
|
|
||||||
|
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)
|
||||||
FIND_PACKAGE(PerlLibs REQUIRED)
|
IF(EQEMU_BUILD_PERL)
|
||||||
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${PERL_INCLUDE_PATH}" "${MySQL_INCLUDE_DIR}")
|
FIND_PACKAGE(PerlLibs REQUIRED)
|
||||||
|
INCLUDE_DIRECTORIES("${PERL_INCLUDE_PATH}")
|
||||||
|
ENDIF(EQEMU_BUILD_PERL)
|
||||||
|
|
||||||
|
IF(EQEMU_BUILD_LUA)
|
||||||
|
FIND_PACKAGE(EQLua51 REQUIRED)
|
||||||
|
SET(Boost_USE_STATIC_LIBS OFF)
|
||||||
|
SET(Boost_USE_MULTITHREADED ON)
|
||||||
|
SET(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
|
||||||
|
|
||||||
|
FIND_PACKAGE(Boost REQUIRED)
|
||||||
|
INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind")
|
||||||
|
|
||||||
|
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)
|
||||||
|
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
|
||||||
|
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
||||||
|
ENDIF(EQEMU_BUILD_LUA)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm")
|
||||||
|
|
||||||
|
IF(EQEMU_BUILD_LUA)
|
||||||
|
ADD_SUBDIRECTORY(luabind)
|
||||||
|
ENDIF(EQEMU_BUILD_LUA)
|
||||||
|
|
||||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
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)
|
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||||
IF(EQEMU_BUILD_SERVER)
|
IF(EQEMU_BUILD_SERVER)
|
||||||
ADD_SUBDIRECTORY(EMuShareMem)
|
ADD_SUBDIRECTORY(shared_memory)
|
||||||
ADD_SUBDIRECTORY(world)
|
ADD_SUBDIRECTORY(world)
|
||||||
ADD_SUBDIRECTORY(zone)
|
ADD_SUBDIRECTORY(zone)
|
||||||
ADD_SUBDIRECTORY(ucs)
|
ADD_SUBDIRECTORY(ucs)
|
||||||
ADD_SUBDIRECTORY(queryserv)
|
ADD_SUBDIRECTORY(queryserv)
|
||||||
ADD_SUBDIRECTORY(eqlaunch)
|
ADD_SUBDIRECTORY(eqlaunch)
|
||||||
ENDIF(EQEMU_BUILD_SERVER)
|
ENDIF(EQEMU_BUILD_SERVER)
|
||||||
IF(EQEMU_BUILD_LOGIN)
|
IF(EQEMU_BUILD_LOGIN)
|
||||||
ADD_SUBDIRECTORY(loginserver)
|
ADD_SUBDIRECTORY(loginserver)
|
||||||
ENDIF(EQEMU_BUILD_LOGIN)
|
ENDIF(EQEMU_BUILD_LOGIN)
|
||||||
|
|
||||||
IF(EQEMU_BUILD_AZONE OR EQEMU_BUILD_CLEANIPC)
|
|
||||||
ADD_SUBDIRECTORY(utils)
|
|
||||||
ENDIF(EQEMU_BUILD_AZONE OR EQEMU_BUILD_CLEANIPC)
|
|
||||||
|
|
||||||
IF(EQEMU_BUILD_TESTS)
|
IF(EQEMU_BUILD_TESTS)
|
||||||
# Testing framework not quite ready for prime time.
|
ADD_SUBDIRECTORY(tests)
|
||||||
# ADD_SUBDIRECTORY(tests)
|
|
||||||
ENDIF(EQEMU_BUILD_TESTS)
|
ENDIF(EQEMU_BUILD_TESTS)
|
||||||
|
|
||||||
|
IF(EQEMU_BUILD_CLIENT_FILES)
|
||||||
|
ADD_SUBDIRECTORY(client_files)
|
||||||
|
ENDIF(EQEMU_BUILD_CLIENT_FILES)
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
|
||||||
|
|
||||||
SET(sharedmem_src
|
|
||||||
DLLMain.cpp
|
|
||||||
Doors.cpp
|
|
||||||
Items.cpp
|
|
||||||
Loot.cpp
|
|
||||||
MMF.cpp
|
|
||||||
MMFMutex.cpp
|
|
||||||
NPCFactionLists.cpp
|
|
||||||
Opcodes.cpp
|
|
||||||
SkillCaps.cpp
|
|
||||||
Spells.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(sharedmem_headers
|
|
||||||
Doors.h
|
|
||||||
Items.h
|
|
||||||
Loot.h
|
|
||||||
MMF.h
|
|
||||||
MMFMutex.h
|
|
||||||
NPCFactionLists.h
|
|
||||||
Opcodes.h
|
|
||||||
SkillCaps.h
|
|
||||||
Spells.h
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(EQEMU_MAX_ITEMS 300000 CACHE STRING "Maxium number of items to load into memory. Make sure this is bigger than the total number of items in the server database")
|
|
||||||
SET(EQEMU_MAX_DOORS 30000 CACHE STRING "Maxium number of doors to load into memory. Make sure this is bigger than the total number of doors in the server database")
|
|
||||||
SET(EQEMU_MAX_FACTIONLIST_IDS 50000 CACHE STRING "Maxium number of FactionList IDs to load into memory. Make sure this is bigger than the total number of FactionList IDs in the server database")
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DMMF_EQMAX_ITEMS=${EQEMU_MAX_ITEMS})
|
|
||||||
ADD_DEFINITIONS(-DMMF_MAX_Door_ID=${EQEMU_MAX_DOORS})
|
|
||||||
ADD_DEFINITIONS(-DMMF_MAX_NPCFactionList_ID=${EQEMU_MAX_FACTIONLIST_IDS})
|
|
||||||
|
|
||||||
ADD_LIBRARY(EMuShareMem SHARED ${sharedmem_src} ${sharedmem_headers})
|
|
||||||
TARGET_LINK_LIBRARIES(EMuShareMem Common)
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(EMuShareMem "dl")
|
|
||||||
TARGET_LINK_LIBRARIES(EMuShareMem "m")
|
|
||||||
TARGET_LINK_LIBRARIES(EMuShareMem "rt")
|
|
||||||
TARGET_LINK_LIBRARIES(EMuShareMem "pthread")
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ../Bin)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
EMuShareMem.dll
|
|
||||||
by Quagmire
|
|
||||||
Released under GPL
|
|
||||||
|
|
||||||
This DLL's purpose it to hold a single shared copy of items, npctypes, spells, and other
|
|
||||||
stuff that's normally cached in memory, thus allowing all processes on the server to share
|
|
||||||
one copy of the data, greatly reducing the amount of RAM used.
|
|
||||||
*/
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
void CloseMemShare();
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(
|
|
||||||
HINSTANCE hinstDLL, // handle to DLL module
|
|
||||||
DWORD fdwReason, // reason for calling function
|
|
||||||
LPVOID lpReserved ) // reserved
|
|
||||||
{
|
|
||||||
// Perform actions based on the reason for calling.
|
|
||||||
switch( fdwReason )
|
|
||||||
{
|
|
||||||
case DLL_PROCESS_ATTACH:
|
|
||||||
case DLL_THREAD_ATTACH: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DLL_THREAD_DETACH: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DLL_PROCESS_DETACH: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //WIN32
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "Doors.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF DoorsMMF;
|
|
||||||
const MMFDoors_Struct* MMFDoorsData = 0;
|
|
||||||
MMFDoors_Struct* MMFDoorsData_Writable = 0;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
extern "C" __declspec(dllexport) const Door* GetDoor(uint32 id) {
|
|
||||||
return pGetDoor(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool AddDoor(uint32 id, const Door* door) {
|
|
||||||
return pAddDoor(id, door);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool DLLLoadDoors(CALLBACK_DBLoadDoors cbDBLoadDoors, uint32 iDoorstructSize, int32* iDoorsCount, uint32* iMaxDoorID) {
|
|
||||||
return pDLLLoadDoors(cbDBLoadDoors, iDoorstructSize, iDoorsCount, iMaxDoorID);
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
extern "C" const Door* GetDoor(uint32 id) {
|
|
||||||
return pGetDoor(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool AddDoor(uint32 id, const Door* door) {
|
|
||||||
return pAddDoor(id, door);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool DLLLoadDoors(CALLBACK_DBLoadDoors cbDBLoadDoors, uint32 iDoorstructSize, int32* iDoorsCount, uint32* iMaxDoorID) {
|
|
||||||
return pDLLLoadDoors(cbDBLoadDoors, iDoorstructSize, iDoorsCount, iMaxDoorID);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool pAddDoor(uint32 id, const Door* door) {
|
|
||||||
if (!MMFDoorsData_Writable)
|
|
||||||
return false;
|
|
||||||
if (id > MMF_MAX_Door_ID || MMFDoorsData_Writable->NextFreeIndex >= MMFDoorsData_Writable->DoorCount)
|
|
||||||
return false;
|
|
||||||
if (MMFDoorsData_Writable->DoorIndex[id] != 0xFFFFFFFF)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MMFDoorsData_Writable->DoorIndex[id] = MMFDoorsData_Writable->NextFreeIndex++;
|
|
||||||
memcpy(&MMFDoorsData_Writable->Doors[MMFDoorsData_Writable->DoorIndex[id]], door, sizeof(Door));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pDLLLoadDoors(CALLBACK_DBLoadDoors cbDBLoadDoors, uint32 iDoorstructSize, int32* iDoorsCount, uint32* iMaxDoorID) {
|
|
||||||
if (iDoorstructSize != sizeof(Door)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: iDoorstructSize != sizeof(Door)" << endl;
|
|
||||||
cout << "Door struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (*iMaxDoorID > MMF_MAX_Door_ID) {
|
|
||||||
cout << "Error: EMuShareMem: pDLLLoadDoors: iMaxDoorID > MMF_MAX_Door_ID" << endl;
|
|
||||||
cout << "You need to increase the define in Doors.h." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 tmpMemSize = sizeof(MMFDoors_Struct) + 256 + (sizeof(Door) * (*iDoorsCount));
|
|
||||||
if (DoorsMMF.Open("EQEMuDoors", tmpMemSize)) {
|
|
||||||
if (DoorsMMF.CanWrite()) {
|
|
||||||
MMFDoorsData_Writable = (MMFDoors_Struct*) DoorsMMF.GetWriteableHandle();
|
|
||||||
if (!MMFDoorsData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: !MMFDoorsData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFDoorsData_Writable, 0, tmpMemSize);
|
|
||||||
for(int i=0; i<MMF_MAX_Door_ID; i++)
|
|
||||||
MMFDoorsData_Writable->DoorIndex[i] = 0xFFFFFFFF;
|
|
||||||
MMFDoorsData_Writable->MaxDoorID = *iMaxDoorID;
|
|
||||||
MMFDoorsData_Writable->DoorCount = *iDoorsCount;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadDoors(*iDoorsCount, *iMaxDoorID)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: !cbDBLoadDoors" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFDoorsData_Writable = 0;
|
|
||||||
DoorsMMF.SetLoaded();
|
|
||||||
MMFDoorsData = (const MMFDoors_Struct*) DoorsMMF.GetHandle();
|
|
||||||
if (!MMFDoorsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: !MMFDoorsData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!DoorsMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!DoorsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(10);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!DoorsMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: !DoorsMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFDoorsData = (const MMFDoors_Struct*) DoorsMMF.GetHandle();
|
|
||||||
if (!MMFDoorsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadDoors: !MMFDoorsData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*iMaxDoorID = MMFDoorsData->MaxDoorID;
|
|
||||||
*iDoorsCount = MMFDoorsData->DoorCount;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading Doors: Doors.cpp: pDLLLoadDoors: ret == 0" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Door* pGetDoor(uint32 id) {
|
|
||||||
if (MMFDoorsData == 0 || (!DoorsMMF.IsLoaded()) || id > MMF_MAX_Door_ID || MMFDoorsData->DoorIndex[id] == 0xFFFFFFFF)
|
|
||||||
return 0;
|
|
||||||
return &MMFDoorsData->Doors[MMFDoorsData->DoorIndex[id]];
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../zone/zonedump.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
// MMF_MAX_Door_ID: Make sure this is bigger than the highest Door ID#
|
|
||||||
#ifndef MMF_MAX_Door_ID
|
|
||||||
#define MMF_MAX_Door_ID 30000
|
|
||||||
#endif
|
|
||||||
// MMF_MAX_Door_MEM: Maxium number of Doors to load into memory. Make sure this is bigger
|
|
||||||
// than the total number of Doors in the server's database!
|
|
||||||
|
|
||||||
struct MMFDoors_Struct {
|
|
||||||
uint32 MaxDoorID;
|
|
||||||
uint32 NextFreeIndex;
|
|
||||||
uint32 DoorCount;
|
|
||||||
uint32 DoorIndex[MMF_MAX_Door_ID+1];
|
|
||||||
Door Doors[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
bool pDLLLoadDoors(CALLBACK_DBLoadDoors cbDBLoadDoors, uint32 iDoorstructSize, int32* iDoorsCount, uint32* iMaxDoorID);
|
|
||||||
bool pAddDoor(uint32 id, const Door* door);
|
|
||||||
const Door* pGetDoor(uint32 id);
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
/*
|
|
||||||
Note: Do NOT change this to load items on an as-needed basis. Since this memory is
|
|
||||||
accessed from multiple threads, you'd need mutex's all over the place if it was
|
|
||||||
ever to be modified/updated/added to. The overhead of the mutexes would be alot more
|
|
||||||
in the long run than the delay in loading.
|
|
||||||
|
|
||||||
-Quagmire
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "Items.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF ItemsMMF;
|
|
||||||
const MMFItems_Struct* MMFItemsData = 0;
|
|
||||||
MMFItems_Struct* MMFItemsData_Writable = 0;
|
|
||||||
|
|
||||||
DLLFUNC bool AddItem(uint32 id, const Item_Struct* item) {
|
|
||||||
if (!MMFItemsData_Writable) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (id > MMF_EQMAX_ITEMS || MMFItemsData_Writable->NextFreeIndex >= MMFItemsData_Writable->ItemCount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (MMFItemsData_Writable->ItemIndex[id] != 0xFFFF) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 nextid = MMFItemsData_Writable->NextFreeIndex++;
|
|
||||||
MMFItemsData_Writable->ItemIndex[id] = nextid;
|
|
||||||
memcpy(&MMFItemsData_Writable->Items[nextid], item, sizeof(Item_Struct));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC bool DLLLoadItems(CALLBACK_DBLoadItems cbDBLoadItems, uint32 iItemStructSize, int32* iItemCount, uint32* iMaxItemID) {
|
|
||||||
if (iItemStructSize != sizeof(Item_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: iItemStructSize != sizeof(Item_Struct)" << endl;
|
|
||||||
cout << "Item_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (*iMaxItemID > MMF_EQMAX_ITEMS) {
|
|
||||||
cout << "Error: EMuShareMem: pDLLLoadItems: iMaxItemID > MMF_EQMAX_ITEMS" << endl;
|
|
||||||
cout << "You need to increase the define in Items.h." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFItemsData_Writable = 0;
|
|
||||||
//Allocate the shared memory for the item structures
|
|
||||||
uint32 tmpMemSize = sizeof(MMFItems_Struct) + 256 + (sizeof(Item_Struct) * (*iItemCount));
|
|
||||||
//cout << tmpMemSize << endl;
|
|
||||||
if (ItemsMMF.Open("EQEMuItems", tmpMemSize)) {
|
|
||||||
if (ItemsMMF.CanWrite()) {
|
|
||||||
MMFItemsData_Writable = (MMFItems_Struct*) ItemsMMF.GetWriteableHandle();
|
|
||||||
if (!MMFItemsData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !MMFItemsData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFItemsData_Writable, 0, tmpMemSize);
|
|
||||||
for(int i=0; i<MMF_EQMAX_ITEMS; i++)
|
|
||||||
MMFItemsData_Writable->ItemIndex[i] = 0xFFFF;
|
|
||||||
MMFItemsData_Writable->MaxItemID = *iMaxItemID;
|
|
||||||
MMFItemsData_Writable->ItemCount = *iItemCount;
|
|
||||||
//the writable handle has been created, do the load below after we have the
|
|
||||||
//serialization handle as well.
|
|
||||||
} else {
|
|
||||||
if (!ItemsMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!ItemsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(10);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!ItemsMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !ItemsMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFItemsData = (const MMFItems_Struct*) ItemsMMF.GetHandle();
|
|
||||||
if (!MMFItemsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !MMFItemsData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*iMaxItemID = MMFItemsData->MaxItemID;
|
|
||||||
*iItemCount = MMFItemsData->ItemCount;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cout << "Error Loading Items: Items.cpp: pDLLLoadItems: Open() == false" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadItems(*iItemCount, *iMaxItemID)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !cbDBLoadItems" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadItems(*iItemCount, *iMaxItemID)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !cbDBLoadItems" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Now, Disable the write handle and get the read handle.
|
|
||||||
//do this for both item struct and serialization data
|
|
||||||
|
|
||||||
MMFItemsData_Writable = 0;
|
|
||||||
ItemsMMF.SetLoaded();
|
|
||||||
MMFItemsData = (const MMFItems_Struct*) ItemsMMF.GetHandle();
|
|
||||||
if (!MMFItemsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadItems: !MMFItemsData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
DLLFUNC const Item_Struct* GetItem(uint32 id) {
|
|
||||||
if (MMFItemsData == 0 || (!ItemsMMF.IsLoaded()) || id > MMF_EQMAX_ITEMS || MMFItemsData->ItemIndex[id] == 0xFFFF)
|
|
||||||
return 0;
|
|
||||||
return &MMFItemsData->Items[MMFItemsData->ItemIndex[id]];
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC const Item_Struct* IterateItems(uint32* NextIndex) {
|
|
||||||
if (MMFItemsData == 0 || (!ItemsMMF.IsLoaded()) || (*NextIndex) > MMF_EQMAX_ITEMS)
|
|
||||||
return 0;
|
|
||||||
do {
|
|
||||||
if (MMFItemsData->ItemIndex[*NextIndex] != 0xFFFF)
|
|
||||||
return &MMFItemsData->Items[MMFItemsData->ItemIndex[(*NextIndex)++]];
|
|
||||||
} while (++(*NextIndex) < MMF_EQMAX_ITEMS);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../common/eq_packet_structs.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
// MMF_EQMAX_ITEMS: Make sure this is bigger than the highest item ID#
|
|
||||||
#ifndef MMF_EQMAX_ITEMS
|
|
||||||
#define MMF_EQMAX_ITEMS 300000
|
|
||||||
#endif
|
|
||||||
// MMF_MEMMAX_ITEMS: Maxium number of items to load into memory. Make sure this is bigger
|
|
||||||
// than the total number of items in the server's database!
|
|
||||||
|
|
||||||
struct MMFItems_Struct {
|
|
||||||
uint32 MaxItemID;
|
|
||||||
uint32 NextFreeIndex;
|
|
||||||
uint32 ItemCount;
|
|
||||||
uint32 ItemIndex[MMF_EQMAX_ITEMS+1];
|
|
||||||
Item_Struct Items[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
//#define MMF_MAX_ITEMS_MEMSIZE sizeof(MMFItems_Struct) + 256
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "Loot.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF LootMMF;
|
|
||||||
const MMFLoot_Struct* MMFLootData = 0;
|
|
||||||
MMFLoot_Struct* MMFLootData_Writable = 0;
|
|
||||||
uint32* LootTable;
|
|
||||||
uint32* LootDrop;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define exportfunc extern "C" __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define exportfunc extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exportfunc const LootTable_Struct* GetLootTable(uint32 id) {
|
|
||||||
return pGetLootTable(id);
|
|
||||||
};
|
|
||||||
exportfunc const LootDrop_Struct* GetLootDrop(uint32 id) {
|
|
||||||
return pGetLootDrop(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
exportfunc bool AddLootTable(uint32 id, const LootTable_Struct* lts) {
|
|
||||||
return pAddLootTable(id, lts);
|
|
||||||
};
|
|
||||||
exportfunc bool AddLootDrop(uint32 id, const LootDrop_Struct* lds) {
|
|
||||||
return pAddLootDrop(id, lds);
|
|
||||||
};
|
|
||||||
|
|
||||||
exportfunc bool DLLLoadLoot(CALLBACK_DBLoadLoot cbDBLoadLoot,
|
|
||||||
uint32 iLootTableStructsize, uint32 iLootTableCount, uint32 iMaxLootTable,
|
|
||||||
uint32 iLootTableEntryStructsize, uint32 iLootTableEntryCount,
|
|
||||||
uint32 iLootDropStructsize, uint32 iLootDropCount, uint32 iMaxLootDrop,
|
|
||||||
uint32 iLootDropEntryStructsize, uint32 iLootDropEntryCount
|
|
||||||
) {
|
|
||||||
return pDLLLoadLoot(cbDBLoadLoot,
|
|
||||||
iLootTableStructsize, iLootTableCount, iMaxLootTable,
|
|
||||||
iLootTableEntryStructsize, iLootTableEntryCount,
|
|
||||||
iLootDropStructsize, iLootDropCount, iMaxLootDrop,
|
|
||||||
iLootDropEntryStructsize, iLootDropEntryCount);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
bool pAddLootTable(uint32 id, const LootTable_Struct* lts) {
|
|
||||||
if (!MMFLootData_Writable)
|
|
||||||
return false;
|
|
||||||
if (id > MMFLootData_Writable->MaxLootTableID)
|
|
||||||
return false;
|
|
||||||
if (!LootTable || LootTable[id] != 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 tmp = sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * lts->NumEntries);
|
|
||||||
if (MMFLootData_Writable->dataindex + tmp >= MMFLootData_Writable->datamax)
|
|
||||||
return false;
|
|
||||||
LootTable[id] = MMFLootData_Writable->dataindex;
|
|
||||||
memcpy(&MMFLootData_Writable->data[MMFLootData_Writable->dataindex], lts, tmp);
|
|
||||||
MMFLootData_Writable->dataindex += tmp;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pAddLootDrop(uint32 id, const LootDrop_Struct* lds) {
|
|
||||||
if (!MMFLootData_Writable)
|
|
||||||
return false;
|
|
||||||
if (id > MMFLootData_Writable->MaxLootDropID)
|
|
||||||
return false;
|
|
||||||
if (!LootDrop || LootDrop[id] != 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 tmp = sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * lds->NumEntries);
|
|
||||||
if (MMFLootData_Writable->dataindex + tmp >= MMFLootData_Writable->datamax)
|
|
||||||
return false;
|
|
||||||
LootDrop[id] = MMFLootData_Writable->dataindex;
|
|
||||||
memcpy(&MMFLootData_Writable->data[MMFLootData_Writable->dataindex], lds, tmp);
|
|
||||||
MMFLootData_Writable->dataindex += tmp;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pDLLLoadLoot(CALLBACK_DBLoadLoot cbDBLoadLoot,
|
|
||||||
uint32 iLootTableStructsize, uint32 iLootTableCount, uint32 iMaxLootTable,
|
|
||||||
uint32 iLootTableEntryStructsize, uint32 iLootTableEntryCount,
|
|
||||||
uint32 iLootDropStructsize, uint32 iLootDropCount, uint32 iMaxLootDrop,
|
|
||||||
uint32 iLootDropEntryStructsize, uint32 iLootDropEntryCount
|
|
||||||
) {
|
|
||||||
#if 0
|
|
||||||
cout << "iLootTableCount: " << iLootTableCount << endl;
|
|
||||||
cout << "iMaxLootTable: " << iMaxLootTable << endl;
|
|
||||||
cout << "iLootTableEntryCount: " << iLootTableEntryCount << endl;
|
|
||||||
cout << "iLootDropCount: " << iLootDropCount << endl;
|
|
||||||
cout << "iMaxLootDrop: " << iMaxLootDrop << endl;
|
|
||||||
cout << "iLootDropEntryCount: " << iLootDropEntryCount << endl;
|
|
||||||
#endif
|
|
||||||
if (iLootTableStructsize != sizeof(LootTable_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: iLootTableStructsize != sizeof(LootTable_Struct)" << endl;
|
|
||||||
cout << "Item_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (iLootTableEntryStructsize != sizeof(LootTableEntries_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: iLootTableEntryStructsize != sizeof(LootTableEntries_Struct)" << endl;
|
|
||||||
cout << "Item_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (iLootDropStructsize != sizeof(LootDrop_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: iLootDropStructsize != sizeof(LootDrop_Struct)" << endl;
|
|
||||||
cout << "Item_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (iLootDropEntryStructsize != sizeof(LootDropEntries_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: iLootDropEntryStructsize != sizeof(LootDropEntries_Struct)" << endl;
|
|
||||||
cout << "Item_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 tmpMemSize = sizeof(MMFLoot_Struct) + 256
|
|
||||||
+ (sizeof(uint32) * (iMaxLootTable+1))
|
|
||||||
+ (sizeof(LootTable_Struct) * iLootTableCount) + (sizeof(LootTableEntries_Struct) * iLootTableEntryCount)
|
|
||||||
+ (sizeof(uint32) * (iMaxLootDrop+1))
|
|
||||||
+ (sizeof(LootDrop_Struct) * iLootDropCount) + (sizeof(LootDropEntries_Struct) * iLootDropEntryCount)
|
|
||||||
;
|
|
||||||
if (LootMMF.Open("EQEMuLoot", tmpMemSize)) {
|
|
||||||
if (LootMMF.CanWrite()) {
|
|
||||||
MMFLootData_Writable = (MMFLoot_Struct*) LootMMF.GetWriteableHandle();
|
|
||||||
if (!MMFLootData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: !MMFLootData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFLootData_Writable, 0, tmpMemSize);
|
|
||||||
MMFLootData_Writable->LootTableCount = iLootTableCount;
|
|
||||||
MMFLootData_Writable->MaxLootTableID = iMaxLootTable;
|
|
||||||
MMFLootData_Writable->LootDropCount = iLootDropCount;
|
|
||||||
MMFLootData_Writable->MaxLootDropID = iMaxLootDrop;
|
|
||||||
MMFLootData_Writable->datamax = tmpMemSize - sizeof(MMFLoot_Struct);
|
|
||||||
|
|
||||||
MMFLootData_Writable->dataindex = 0;
|
|
||||||
MMFLootData_Writable->LootTableOffset = MMFLootData_Writable->dataindex;
|
|
||||||
MMFLootData_Writable->dataindex += (sizeof(uint32) * (iMaxLootTable+1));
|
|
||||||
MMFLootData_Writable->LootDropOffset = MMFLootData_Writable->dataindex;
|
|
||||||
MMFLootData_Writable->dataindex += (sizeof(uint32) * (iMaxLootDrop+1));
|
|
||||||
|
|
||||||
LootTable = (uint32*) &MMFLootData_Writable->data[MMFLootData_Writable->LootTableOffset];
|
|
||||||
LootDrop = (uint32*) &MMFLootData_Writable->data[MMFLootData_Writable->LootDropOffset];
|
|
||||||
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadLoot()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: !cbDBLoadLoot" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFLootData_Writable = 0;
|
|
||||||
LootMMF.SetLoaded();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!LootMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!LootMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(10);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!LootMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: !LootMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading Loot: Loot.cpp: pDLLLoadLoot: Open() == false" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
MMFLootData = (const MMFLoot_Struct*) LootMMF.GetHandle();
|
|
||||||
if (!MMFLootData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: !MMFLootData" << endl;
|
|
||||||
MMFLootData = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (MMFLootData->LootTableCount != iLootTableCount
|
|
||||||
|| MMFLootData->MaxLootTableID != iMaxLootTable
|
|
||||||
|| MMFLootData->LootDropCount != iLootDropCount
|
|
||||||
|| MMFLootData->MaxLootDropID != iMaxLootDrop) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadLoot: Count/Max mismatch" << endl;
|
|
||||||
MMFLootData = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
LootTable = (uint32*) &MMFLootData->data[MMFLootData->LootTableOffset];
|
|
||||||
LootDrop = (uint32*) &MMFLootData->data[MMFLootData->LootDropOffset];
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const LootTable_Struct* pGetLootTable(uint32 id) {
|
|
||||||
if (MMFLootData == 0 || !LootMMF.IsLoaded())
|
|
||||||
return 0;
|
|
||||||
if (id > MMFLootData->MaxLootTableID || LootTable[id] == 0)
|
|
||||||
return 0;
|
|
||||||
return (LootTable_Struct*) &MMFLootData->data[LootTable[id]];
|
|
||||||
}
|
|
||||||
|
|
||||||
const LootDrop_Struct* pGetLootDrop(uint32 id) {
|
|
||||||
if (MMFLootData == 0 || !LootMMF.IsLoaded())
|
|
||||||
return 0;
|
|
||||||
if (id > MMFLootData->MaxLootDropID || LootDrop[id] == 0)
|
|
||||||
return 0;
|
|
||||||
return (LootDrop_Struct*) &MMFLootData->data[LootDrop[id]];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../common/eq_packet_structs.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
#pragma pack(1)
|
|
||||||
struct MMFLoot_Struct {
|
|
||||||
bool Loaded;
|
|
||||||
uint32 MaxLootTableID;
|
|
||||||
uint32 LootTableCount;
|
|
||||||
uint32 LootTableOffset;
|
|
||||||
uint32 MaxLootDropID;
|
|
||||||
uint32 LootDropCount;
|
|
||||||
uint32 LootDropOffset;
|
|
||||||
uint32 datamax;
|
|
||||||
uint32 dataindex;
|
|
||||||
uint8 data[0];
|
|
||||||
};
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
bool pDLLLoadLoot(CALLBACK_DBLoadLoot cbDBLoadLoot,
|
|
||||||
uint32 iLootTableStructsize, uint32 iLootTableCount, uint32 iMaxLootTable,
|
|
||||||
uint32 iLootTableEntryStructsize, uint32 iLootTableEntryCount,
|
|
||||||
uint32 iLootDropStructsize, uint32 iLootDropCount, uint32 iMaxLootDrop,
|
|
||||||
uint32 iLootDropEntryStructsize, uint32 iLootDropEntryCount
|
|
||||||
);
|
|
||||||
bool pAddLootTable(uint32 id, const LootTable_Struct* lts);
|
|
||||||
bool pAddLootDrop(uint32, const LootDrop_Struct* lds);
|
|
||||||
const LootTable_Struct* pGetLootTable(uint32 id);
|
|
||||||
const LootDrop_Struct* pGetLootDrop(uint32 id);
|
|
||||||
@@ -1,353 +0,0 @@
|
|||||||
// start mingw
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define __try
|
|
||||||
#define __finally
|
|
||||||
#endif
|
|
||||||
// end mingw
|
|
||||||
|
|
||||||
#include "MMF.h"
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
#else
|
|
||||||
#include "MMFMutex.h"
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MMF::MMF() {
|
|
||||||
SharedMemory = 0;
|
|
||||||
pCanWrite = false;
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
hMapObject = NULL;
|
|
||||||
lpvMem = 0;
|
|
||||||
#else
|
|
||||||
lpvMem = 0;
|
|
||||||
pMMFMutex = 0;
|
|
||||||
m_alloc = false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
MMF::~MMF() {
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MMF::Open(const char* iName, uint32 iSize) {
|
|
||||||
if (iSize < 1) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: iSize < 1" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (strlen(iName) < 2) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: strlen(iName) < 2" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
char MMFname[200];
|
|
||||||
memset(MMFname, 0, sizeof(MMFname));
|
|
||||||
snprintf(MMFname, sizeof(MMFname), "memfilemap_%s", iName);
|
|
||||||
uint32 tmpSize = sizeof(MMF_Struct) + iSize;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
char MMFMutexName[200];
|
|
||||||
memset(MMFMutexName, 0, sizeof(MMFMutexName));
|
|
||||||
snprintf(MMFMutexName, sizeof(MMFMutexName), "MutexToProtectOpenMMF_%s", iName);
|
|
||||||
|
|
||||||
HANDLE hMutex;
|
|
||||||
hMutex = CreateMutex(
|
|
||||||
NULL, // no security attributes
|
|
||||||
FALSE, // initially not owned
|
|
||||||
MMFMutexName); // name of mutex
|
|
||||||
|
|
||||||
if (hMutex == NULL) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: hMutex == Null" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD dwWaitResult;
|
|
||||||
// Request ownership of mutex.
|
|
||||||
dwWaitResult = WaitForSingleObject(
|
|
||||||
hMutex, // handle to mutex
|
|
||||||
2000L); // two-second time-out interval
|
|
||||||
|
|
||||||
if (dwWaitResult != WAIT_OBJECT_0) {
|
|
||||||
// Mutex not aquired, crap out
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: dwWaitResult != WAIT_OBJECT_0" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, ready to rock.
|
|
||||||
bool fInit = false;
|
|
||||||
__try {
|
|
||||||
hMapObject = CreateFileMapping(
|
|
||||||
INVALID_HANDLE_VALUE, // use paging file
|
|
||||||
NULL, // default security attributes
|
|
||||||
PAGE_READWRITE, // read/write access
|
|
||||||
0, // size: high 32-bits
|
|
||||||
tmpSize, // size: low 32-bits
|
|
||||||
MMFname); // name of map object
|
|
||||||
if (hMapObject == NULL) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: hMapObject == Null" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The first process to attach initializes memory.
|
|
||||||
|
|
||||||
fInit = (bool) (GetLastError() != ERROR_ALREADY_EXISTS);
|
|
||||||
|
|
||||||
// Get a pointer to the file-mapped shared memory.
|
|
||||||
|
|
||||||
lpvMem = MapViewOfFile(
|
|
||||||
hMapObject, // object to map view of
|
|
||||||
FILE_MAP_WRITE, // read/write access
|
|
||||||
0, // high offset: map from
|
|
||||||
0, // low offset: beginning
|
|
||||||
0); // default: map entire file
|
|
||||||
if (lpvMem == NULL) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: lpvMem == Null" << endl;
|
|
||||||
Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
// Initialize memory if this is the first process.
|
|
||||||
if (fInit) {
|
|
||||||
memset(lpvMem, 0, sizeof(MMF_Struct));
|
|
||||||
pCanWrite = true;
|
|
||||||
SharedMemory->Loaded = false;
|
|
||||||
SharedMemory->datasize = iSize;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pCanWrite = false;
|
|
||||||
if (SharedMemory->datasize != iSize) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: SharedMemory->datasize != iSize" << endl;
|
|
||||||
Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end of try block
|
|
||||||
|
|
||||||
__finally {
|
|
||||||
// Clean up the Mutex stuff
|
|
||||||
if (!ReleaseMutex(hMutex)) {
|
|
||||||
cout << "Error Loading MMF: " << __FILE__ << ":" << __LINE__ << " OpenMMF: !ReleaseMutex(hMutex)" << endl;
|
|
||||||
Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CloseHandle(hMutex);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#else //else, NOT WINDOWS
|
|
||||||
int load_share;
|
|
||||||
//int max_share = 7;
|
|
||||||
key_t share_key;
|
|
||||||
switch (MMFname[16]) {
|
|
||||||
case 'I': load_share = 0; break;
|
|
||||||
case 'N': load_share = 1; break;
|
|
||||||
case 'D': load_share = 2; break;
|
|
||||||
case 'S': load_share = 3; break;
|
|
||||||
case 'F': load_share = 4; break;
|
|
||||||
case 'L': load_share = 5; break;
|
|
||||||
case 'M': load_share = 6; break;
|
|
||||||
case 'O': load_share = 7; break;
|
|
||||||
case 'Z': load_share = 8; break;
|
|
||||||
case 'K': load_share = 9; break;
|
|
||||||
#ifdef CATCH_CRASH
|
|
||||||
default:
|
|
||||||
cerr<<"Failed to load shared memory segment="<<MMFname<<" ("<<MMFname[16]<<")"<<endl;
|
|
||||||
// malloc some memory here or something fancy
|
|
||||||
return false; // and make this return true
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
default: cerr<<"FATAL="<<(char)MMFname[16]<<endl; return false; break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
switch (load_share) {
|
|
||||||
// Item
|
|
||||||
case 0: share_key = ftok(".", 'I'); break;
|
|
||||||
// Npctype
|
|
||||||
case 1: share_key = ftok(".", 'N'); break;
|
|
||||||
// Door
|
|
||||||
case 2: share_key = ftok(".", 'D'); break;
|
|
||||||
// Spell
|
|
||||||
case 3: share_key = ftok(".", 'S'); break;
|
|
||||||
// Faction
|
|
||||||
case 4: share_key = ftok(".", 'F'); break;
|
|
||||||
// Loot
|
|
||||||
case 5: share_key = ftok(".", 'L'); break;
|
|
||||||
// ??
|
|
||||||
case 6: share_key = ftok(".", 'M'); break;
|
|
||||||
// Opcodes
|
|
||||||
case 7: share_key = ftok(".", 'O'); break;
|
|
||||||
// Item Serialization
|
|
||||||
case 8: share_key = ftok(".", 'Z'); break;
|
|
||||||
// Skills
|
|
||||||
case 9: share_key = ftok(".", 'K'); break;
|
|
||||||
// ERROR Fatal
|
|
||||||
default: cerr<<"Opps!"<<endl; share_key = 0xFF; break;
|
|
||||||
}
|
|
||||||
pMMFMutex = new MMFMutex(share_key);
|
|
||||||
if (!pMMFMutex){
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
//if (!tmpSize) {
|
|
||||||
int share_id = shmget(share_key, tmpSize, IPC_CREAT|IPC_EXCL|SHM_R|SHM_W);
|
|
||||||
if ( share_id <= 0) {
|
|
||||||
share_id = shmget(share_key, tmpSize, IPC_CREAT|IPC_NOWAIT);
|
|
||||||
if (share_id <= 0) {
|
|
||||||
shmid_ds mem_size;
|
|
||||||
share_id = shmget(share_key, 1, IPC_CREAT|IPC_NOWAIT|SHM_R|SHM_W);
|
|
||||||
if(share_id == -1) {
|
|
||||||
cerr << "failed to get 0-length shared mem: " << strerror(errno) << endl;
|
|
||||||
}
|
|
||||||
if ((lpvMem = shmat(share_id, NULL,SHM_RDONLY)) == (void *)-1) {
|
|
||||||
cerr << "shmat failed! " << strerror(errno) << endl;
|
|
||||||
}
|
|
||||||
if( (shmctl(share_id, IPC_STAT, &mem_size)) == 0){
|
|
||||||
if (mem_size.shm_segsz != int(tmpSize)){ //comparison between signed and unsigned integer expressions
|
|
||||||
cout<<"[Warning] requested shared memory of size:"<<tmpSize<<" but that Key is already in use with size:"<< mem_size.shm_segsz<<endl;
|
|
||||||
shmid_ds mem_users;
|
|
||||||
if( (shmctl(share_id, IPC_STAT, &mem_users)) == 0 && mem_users.shm_nattch == 1){
|
|
||||||
cout<<"[Warning] Attempting resize"<<endl;
|
|
||||||
shmctl(share_id, IPC_RMID, 0);
|
|
||||||
shmdt(lpvMem);
|
|
||||||
if ((share_id = shmget(share_key, tmpSize, IPC_CREAT|IPC_EXCL|SHM_R|SHM_W)) <= 0) {
|
|
||||||
// Failed proceed on malloc
|
|
||||||
cerr<<"[Error] Failed to resize" << strerror(errno) <<endl;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
cerr<<"[Error] Resize successful." << endl;
|
|
||||||
// Success
|
|
||||||
lpvMem = shmat(share_id, NULL, SHM_R|SHM_W);
|
|
||||||
memset(lpvMem, 0, sizeof(MMF_Struct));
|
|
||||||
pCanWrite = true;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
SharedMemory->Loaded = false;
|
|
||||||
SharedMemory->datasize = iSize;
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
cout<<"[Warning] Resize not possible"<<endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Can not attatch to shared memory we'll malloc it here
|
|
||||||
if ((lpvMem == 0 || lpvMem == (void *)-1) && (lpvMem = malloc(tmpSize))) {
|
|
||||||
cout<<"[Warning] Could not attach to shared memory proceeding on isolated memory (share_id <= 0)"<<endl;
|
|
||||||
// Success!
|
|
||||||
m_alloc = true;
|
|
||||||
memset(lpvMem, 0, sizeof(MMF_Struct));
|
|
||||||
pCanWrite = true;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
SharedMemory->datasize = iSize;
|
|
||||||
SharedMemory->Loaded = false;
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
} else if (!lpvMem){
|
|
||||||
//LogFile->write(EQEMuLog::Error, "Could not connect to shared memory and allocation of isolated memory failed.");
|
|
||||||
cout<<"Could not connect to shared memory and allocation of isolated memory failed."<<endl;
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
pCanWrite = false;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
if (SharedMemory->datasize != iSize) {
|
|
||||||
cerr<<"SharedMemory->datasize("<<SharedMemory->datasize<<") != iSize("<<iSize<<"), We can rebuild him faster better STRONGER!"<<endl;
|
|
||||||
cerr<<"Or not.. restart all servers on this machine"<<endl;
|
|
||||||
shmctl(share_id, IPC_RMID, 0);
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
shmid_ds mem_users;
|
|
||||||
if ((shmctl(share_id, IPC_STAT, &mem_users)) != 0) {
|
|
||||||
if ((lpvMem = malloc(tmpSize))) {
|
|
||||||
// Success!
|
|
||||||
cout<<"[Warning] Could not attach to shared memory proceeding on isolated memory"<<endl;
|
|
||||||
m_alloc = true;
|
|
||||||
memset(lpvMem, 0, sizeof(MMF_Struct));
|
|
||||||
pCanWrite = true;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
SharedMemory->datasize = iSize;
|
|
||||||
SharedMemory->Loaded = false;
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
//LogFile->write(EQEMuLog::Error, "Could not connect to shared memory and allocation of isolated memory failed.");
|
|
||||||
cout<<"Could not connect to shared memory and allocation of isolated memory failed."<<endl;
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lpvMem = shmat(share_id, NULL,SHM_RDONLY);
|
|
||||||
pCanWrite = false;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
//cerr << "lpvMem=" << (int)lpvMem << endl;
|
|
||||||
if (lpvMem==(void *)-1 || SharedMemory->datasize != iSize) {
|
|
||||||
cerr<<"SharedMemory->datasize("<<SharedMemory->datasize<<") != iSize("<<iSize<<"), or "<<((void *)lpvMem)<<"==-1, We can rebuild him faster better STRONGER!"<<endl;
|
|
||||||
cerr<<"Or not.. restart all servers on this machine"<<endl;
|
|
||||||
shmctl(share_id, IPC_RMID, 0);
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
lpvMem = shmat(share_id, NULL, SHM_R|SHM_W);
|
|
||||||
memset(lpvMem, 0, sizeof(MMF_Struct));
|
|
||||||
pCanWrite = true;
|
|
||||||
SharedMemory = (MMF_Struct*) lpvMem;
|
|
||||||
SharedMemory->Loaded = false;
|
|
||||||
SharedMemory->datasize = iSize;
|
|
||||||
//}
|
|
||||||
pMMFMutex->Release(this);
|
|
||||||
delete pMMFMutex;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
#endif //end NOT WINDOWS
|
|
||||||
}
|
|
||||||
|
|
||||||
void MMF::Close() {
|
|
||||||
SharedMemory = 0;
|
|
||||||
pCanWrite = false;
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
if (lpvMem) {
|
|
||||||
// Unmap shared memory from the process's address space.
|
|
||||||
UnmapViewOfFile(lpvMem);
|
|
||||||
lpvMem = 0;
|
|
||||||
}
|
|
||||||
if (hMapObject) {
|
|
||||||
// Close the process's handle to the file-mapping object.
|
|
||||||
CloseHandle(hMapObject);
|
|
||||||
hMapObject = NULL;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (lpvMem) {
|
|
||||||
if (m_alloc == true)
|
|
||||||
free(lpvMem);
|
|
||||||
else
|
|
||||||
if (shmdt(lpvMem) == -1)
|
|
||||||
//LogFile->write(EQEMuLog::Error, "Warning something odd happened freeing shared memory");
|
|
||||||
cout<<"Warning something odd happened freeing shared memory"<<endl;
|
|
||||||
lpvMem = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef MMF_H
|
|
||||||
#define MMF_H
|
|
||||||
#include "../common/types.h"
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
//#include "MMFMutex.h"
|
|
||||||
class MMFMutex;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MMF {
|
|
||||||
public:
|
|
||||||
struct MMF_Struct {
|
|
||||||
bool Loaded;
|
|
||||||
uint32 datasize;
|
|
||||||
uint8 data[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
MMF();
|
|
||||||
virtual ~MMF();
|
|
||||||
|
|
||||||
bool Open(const char* iName, uint32 iSize);
|
|
||||||
void Close();
|
|
||||||
const void* GetHandle() { if (IsLoaded()) { return SharedMemory->data; } return 0; }
|
|
||||||
void* GetWriteableHandle() { if (!IsLoaded() && CanWrite()) { return SharedMemory->data; } return 0; }
|
|
||||||
|
|
||||||
inline bool IsOpen() { return (bool) (SharedMemory != 0); }
|
|
||||||
inline bool IsLoaded() { if (SharedMemory) { return SharedMemory->Loaded; } return false; }
|
|
||||||
bool SetLoaded() { if (SharedMemory && CanWrite()) { SharedMemory->Loaded = true; return true; } return false; }
|
|
||||||
inline bool CanWrite() { if (SharedMemory) { return pCanWrite; } return false; }
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
bool m_alloc;
|
|
||||||
#endif
|
|
||||||
private:
|
|
||||||
bool pCanWrite;
|
|
||||||
MMF_Struct* SharedMemory;
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
HANDLE hMapObject;
|
|
||||||
LPVOID lpvMem;
|
|
||||||
#else
|
|
||||||
void* lpvMem;
|
|
||||||
MMFMutex* pMMFMutex;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
#include "MMFMutex.h"
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
|
|
||||||
MMFMutex::MMFMutex( int key )
|
|
||||||
{
|
|
||||||
m_key = key;
|
|
||||||
|
|
||||||
if( m_key == 0 )
|
|
||||||
{
|
|
||||||
// initialize POSIX semaphore
|
|
||||||
sem_init( &m_semaphore, 0, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// currently, this thread does not own the semaphore
|
|
||||||
m_owner = 0;
|
|
||||||
m_recursive_count = 0;
|
|
||||||
|
|
||||||
// try to get an existing semaphore. the access permissions are "full access for everyone"
|
|
||||||
m_id = semget(m_key, 1, 0x1b6);
|
|
||||||
if( m_id == -1 )
|
|
||||||
{
|
|
||||||
// it doesn't exist yet, try to create a new one
|
|
||||||
m_id = semget(m_key, 1, IPC_CREAT | 0x1b6);
|
|
||||||
if( m_id != -1 )
|
|
||||||
{
|
|
||||||
// initialize it to 1
|
|
||||||
semun data;
|
|
||||||
data.val = 1;
|
|
||||||
semctl(m_id, 0, SETVAL, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFMutex::~MMFMutex()
|
|
||||||
{
|
|
||||||
if( m_key == 0 )
|
|
||||||
{
|
|
||||||
sem_destroy(&m_semaphore);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
semctl(m_id, 0, IPC_RMID, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MMFMutex::Lock( uint32 dwTimeout )
|
|
||||||
{
|
|
||||||
if( m_owner == pthread_self() )
|
|
||||||
{
|
|
||||||
m_recursive_count++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
bool bUseTimeout = (dwTimeout != 0);
|
|
||||||
while(true) {
|
|
||||||
bool bGotSemaphore = false;
|
|
||||||
if( m_key == 0 )
|
|
||||||
{
|
|
||||||
bGotSemaphore = (sem_trywait(&m_semaphore) == 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct sembuf operations[1];
|
|
||||||
operations[0].sem_num = 0;
|
|
||||||
operations[0].sem_op = -1;
|
|
||||||
operations[0].sem_flg = SEM_UNDO|IPC_NOWAIT;
|
|
||||||
bGotSemaphore = (semop(m_id, operations, 1) >= 0);
|
|
||||||
}
|
|
||||||
if( bGotSemaphore )
|
|
||||||
{
|
|
||||||
m_owner = pthread_self();
|
|
||||||
m_recursive_count = 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
sleep(1);
|
|
||||||
if( bUseTimeout )
|
|
||||||
{
|
|
||||||
if( dwTimeout > 1000 )
|
|
||||||
dwTimeout -= 1000;
|
|
||||||
else
|
|
||||||
dwTimeout = 0;
|
|
||||||
|
|
||||||
if( dwTimeout == 0 )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void MMFMutex::Release(const MMF* pMMF)
|
|
||||||
{
|
|
||||||
if( m_owner != pthread_self() && pMMF->m_alloc != true )
|
|
||||||
{
|
|
||||||
//We're supposed to explode here with an assert
|
|
||||||
//assert(false);
|
|
||||||
}
|
|
||||||
else if ( pMMF->m_alloc == true ){
|
|
||||||
// Just do it nothing is useing but us
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if( m_recursive_count > 1 )
|
|
||||||
{
|
|
||||||
m_recursive_count--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_key == 0 )
|
|
||||||
{
|
|
||||||
sem_post(&m_semaphore);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct sembuf operations[1];
|
|
||||||
operations[0].sem_num = 0;
|
|
||||||
operations[0].sem_op = 1;
|
|
||||||
operations[0].sem_flg = SEM_UNDO;
|
|
||||||
semop(m_id, operations, 1);
|
|
||||||
}
|
|
||||||
m_recursive_count = 0;
|
|
||||||
m_owner = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif //!WIN32
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#ifndef MMFMUTEX_H
|
|
||||||
#define MMFMUTEX_H
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <sys/types.h> // moved before sys/shm.h for freeBSD
|
|
||||||
#include <sys/shm.h>
|
|
||||||
#include <sys/ipc.h>
|
|
||||||
#include <sys/sem.h>
|
|
||||||
#include <semaphore.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include "../common/types.h"
|
|
||||||
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
// the manuals say you have to define this struct your self.
|
|
||||||
#if !defined FREEBSD || defined __NetBSD__ // for BSDs
|
|
||||||
union semun
|
|
||||||
{
|
|
||||||
int val;
|
|
||||||
struct semid_ds* buf;
|
|
||||||
unsigned short int *array;
|
|
||||||
struct seminfo *__buf;
|
|
||||||
};
|
|
||||||
#endif // for freeBSD
|
|
||||||
|
|
||||||
class MMFMutex
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MMFMutex(int iIndex);
|
|
||||||
virtual ~MMFMutex();
|
|
||||||
bool Lock( uint32 dwTimeout = 0 );
|
|
||||||
void Release(const MMF*);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_id;
|
|
||||||
key_t m_key;
|
|
||||||
pthread_t m_owner;
|
|
||||||
sem_t m_semaphore;
|
|
||||||
int m_recursive_count;
|
|
||||||
};
|
|
||||||
#endif //!WIN32
|
|
||||||
#endif
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "NPCFactionLists.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF NPCFactionListsMMF;
|
|
||||||
const MMFNPCFactionLists_Struct* MMFNPCFactionListsData = 0;
|
|
||||||
MMFNPCFactionLists_Struct* MMFNPCFactionListsData_Writable = 0;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
extern "C" __declspec(dllexport) const NPCFactionList* GetNPCFactionList(uint32 id) {
|
|
||||||
return pGetNPCFactionList(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool AddNPCFactionList(uint32 id, const NPCFactionList* nfl) {
|
|
||||||
return pAddNPCFactionList(id, nfl);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool DLLLoadNPCFactionLists(CALLBACK_DBLoadNPCFactionLists cbDBLoadNPCFactionLists, uint32 iNPCFactionListStructSize, int32* iNPCFactionListsCount, uint32* iMaxNPCFactionListID, uint8 iMaxNPCFactions) {
|
|
||||||
return pDLLLoadNPCFactionLists(cbDBLoadNPCFactionLists, iNPCFactionListStructSize, iNPCFactionListsCount, iMaxNPCFactionListID, iMaxNPCFactions);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool SetNPCFaction(uint32 id, uint32* factionid, int32* factionvalue, int8 *factionnpcvalue, uint8 *factiontemp) {
|
|
||||||
return pSetNPCFaction(id, factionid, factionvalue, factionnpcvalue, factiontemp);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern "C" const NPCFactionList* GetNPCFactionList(uint32 id) {
|
|
||||||
return pGetNPCFactionList(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool AddNPCFactionList(uint32 id, const NPCFactionList* nfl) {
|
|
||||||
return pAddNPCFactionList(id, nfl);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool DLLLoadNPCFactionLists(CALLBACK_DBLoadNPCFactionLists cbDBLoadNPCFactionLists, uint32 iNPCFactionListStructSize, int32* iNPCFactionListsCount, uint32* iMaxNPCFactionListID, uint8 iMaxNPCFactions) {
|
|
||||||
return pDLLLoadNPCFactionLists(cbDBLoadNPCFactionLists, iNPCFactionListStructSize, iNPCFactionListsCount, iMaxNPCFactionListID, iMaxNPCFactions);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool SetNPCFaction(uint32 id, uint32* factionid, int32* factionvalue, int8 *factionnpcvalue, uint8 *factiontemp) {
|
|
||||||
return pSetNPCFaction(id, factionid, factionvalue, factionnpcvalue, factiontemp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool pAddNPCFactionList(uint32 id, const NPCFactionList* nfl) {
|
|
||||||
if (!MMFNPCFactionListsData_Writable){
|
|
||||||
if (EQDEBUG>=1) cout<<"[Debug] !MMFNPCFactionListsData_Writable"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (id > MMF_MAX_NPCFactionList_ID || MMFNPCFactionListsData_Writable->NextFreeIndex >= MMFNPCFactionListsData_Writable->NPCFactionListCount){
|
|
||||||
if (EQDEBUG>=1) cout<<"[Debug] id > MMF_MAX_NPCFactionList_ID || MMFNPCFactionListsData_Writable->NextFreeIndex >= MMFNPCFactionListsData_Writable->NPCFactionListCount"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (MMFNPCFactionListsData_Writable->NPCFactionListIndex[id] != 0xFFFFFFFF){
|
|
||||||
if (EQDEBUG>=1) cout<<"[Debug] MMFNPCFactionListsData_Writable->NPCFactionListIndex[id] != 0xFFFFFFFF"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionListIndex[id] = MMFNPCFactionListsData_Writable->NextFreeIndex++;
|
|
||||||
memcpy(&MMFNPCFactionListsData_Writable->NPCFactionLists[MMFNPCFactionListsData_Writable->NPCFactionListIndex[id]], nfl, sizeof(NPCFactionList));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pSetNPCFaction(uint32 id, uint32* factionid, int32* factionvalue, int8 *factionnpcvalue, uint8 *factiontemp) {
|
|
||||||
if (!MMFNPCFactionListsData_Writable) {
|
|
||||||
if(EQDEBUG>=1) cout<<"[Debug] !MMFNPCFactionListsData_Writable"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (id > MMF_MAX_NPCFactionList_ID) {
|
|
||||||
if(EQDEBUG>=1) cout<<"[Debug] id > MMF_MAX_NPCFactionList_ID"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (MMFNPCFactionListsData_Writable->NPCFactionListIndex[id] == 0xFFFFFFFF) {
|
|
||||||
if(EQDEBUG>=1) cout<<"[Debug] MMFNPCFactionListsData_Writable->NPCFactionListIndex[id="<<id<<"] == 0xFFFFFFFF"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<MAX_NPC_FACTIONS; i++) {
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionLists[MMFNPCFactionListsData_Writable->NPCFactionListIndex[id]].factionid[i] = factionid[i];
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionLists[MMFNPCFactionListsData_Writable->NPCFactionListIndex[id]].factionvalue[i] = factionvalue[i];
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionLists[MMFNPCFactionListsData_Writable->NPCFactionListIndex[id]].factionnpcvalue[i] = factionnpcvalue[i];
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionLists[MMFNPCFactionListsData_Writable->NPCFactionListIndex[id]].factiontemp[i] = factiontemp[i];
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pDLLLoadNPCFactionLists(CALLBACK_DBLoadNPCFactionLists cbDBLoadNPCFactionLists, uint32 iNPCFactionListStructSize, int32* iNPCFactionListsCount, uint32* iMaxNPCFactionListID, uint8 iMaxNPCFactions) {
|
|
||||||
if (iNPCFactionListStructSize != sizeof(NPCFactionList)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: iNPCFactionListStructSize != sizeof(NPCFactionList)" << endl;
|
|
||||||
cout << "NPCFactionList struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (iMaxNPCFactions != MAX_NPC_FACTIONS) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: iMaxNPCFactions != MAX_NPC_FACTIONS" << endl;
|
|
||||||
cout << "NPCFactionList struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (*iMaxNPCFactionListID > MMF_MAX_NPCFactionList_ID) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: iMaxNPCFactions > MMF_MAX_NPCFactionList_ID" << endl;
|
|
||||||
cout << "You need to increase the define in NPCFactionList.h." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 tmpMemSize = sizeof(MMFNPCFactionLists_Struct) + 256 + (sizeof(NPCFactionList) * (*iNPCFactionListsCount));
|
|
||||||
if (NPCFactionListsMMF.Open("EQEMuFactionLists", tmpMemSize)) {
|
|
||||||
// MMFNPCFactionListsData = (const MMFNPCFactionLists_Struct*) NPCFactionListsMMF.GetHandle();
|
|
||||||
if (NPCFactionListsMMF.CanWrite()) {
|
|
||||||
MMFNPCFactionListsData_Writable = (MMFNPCFactionLists_Struct*) NPCFactionListsMMF.GetWriteableHandle();
|
|
||||||
if (!MMFNPCFactionListsData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: !MMFNPCFactionListsData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFNPCFactionListsData_Writable, 0, tmpMemSize);
|
|
||||||
for(int i=0; i<MMF_MAX_NPCFactionList_ID; i++)
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionListIndex[i] = 0xFFFFFFFF;
|
|
||||||
MMFNPCFactionListsData_Writable->MaxNPCFactionListID = *iMaxNPCFactionListID;
|
|
||||||
MMFNPCFactionListsData_Writable->NPCFactionListCount = *iNPCFactionListsCount;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadNPCFactionLists(MMFNPCFactionListsData_Writable->NPCFactionListCount, MMFNPCFactionListsData_Writable->MaxNPCFactionListID)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: !cbDBLoadNPCFactionLists" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFNPCFactionListsData_Writable = 0;
|
|
||||||
NPCFactionListsMMF.SetLoaded();
|
|
||||||
MMFNPCFactionListsData = (const MMFNPCFactionLists_Struct*) NPCFactionListsMMF.GetHandle();
|
|
||||||
if (!MMFNPCFactionListsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: !MMFNPCFactionListsData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!NPCFactionListsMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!NPCFactionListsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(100);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!NPCFactionListsMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: !NPCFactionListsMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFNPCFactionListsData = (const MMFNPCFactionLists_Struct*) NPCFactionListsMMF.GetHandle();
|
|
||||||
if (!MMFNPCFactionListsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCFactionLists: !MMFNPCFactionListsData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*iMaxNPCFactionListID = MMFNPCFactionListsData->MaxNPCFactionListID;
|
|
||||||
*iNPCFactionListsCount = MMFNPCFactionListsData->NPCFactionListCount;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading NPCFactionLists: NPCFactionLists.cpp: pDLLLoadNPCFactionLists: Open() == false" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const NPCFactionList* pGetNPCFactionList(uint32 id) {
|
|
||||||
if (MMFNPCFactionListsData == 0 || (!NPCFactionListsMMF.IsLoaded()) || id > MMF_MAX_NPCFactionList_ID || MMFNPCFactionListsData->NPCFactionListIndex[id] == 0xFFFFFFFF)
|
|
||||||
return 0;
|
|
||||||
return &MMFNPCFactionListsData->NPCFactionLists[MMFNPCFactionListsData->NPCFactionListIndex[id]];
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../zone/features.h"
|
|
||||||
#include "../zone/faction.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
// MMF_MAX_NPCFactionList_ID: Make sure this is bigger than the highest NPCFactionList ID#
|
|
||||||
#ifndef MMF_MAX_NPCFactionList_ID
|
|
||||||
#define MMF_MAX_NPCFactionList_ID 50000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct MMFNPCFactionLists_Struct {
|
|
||||||
uint32 MaxNPCFactionListID;
|
|
||||||
uint32 NextFreeIndex;
|
|
||||||
uint32 NPCFactionListCount;
|
|
||||||
uint32 NPCFactionListIndex[MMF_MAX_NPCFactionList_ID+1];
|
|
||||||
NPCFactionList NPCFactionLists[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
bool pDLLLoadNPCFactionLists(CALLBACK_DBLoadNPCFactionLists cbDBLoadNPCFactionLists, uint32 iNPCFactionListStructSize, int32* iNPCFactionListCount, uint32* iMaxNPCFactionListID, uint8 iMaxNPCFactions);
|
|
||||||
bool pAddNPCFactionList(uint32 id, const NPCFactionList* nfl);
|
|
||||||
bool pSetNPCFaction(uint32 id, uint32* factionid, int32* factionvalue, int8 *factionnpcvalue, uint8 *factiontemp);
|
|
||||||
const NPCFactionList* pGetNPCFactionList(uint32 id);
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "NPCTypes.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF NPCTypesMMF;
|
|
||||||
const MMFNPCTypes_Struct* MMFNPCTypesData = 0;
|
|
||||||
MMFNPCTypes_Struct* MMFNPCTypesData_Writable = 0;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
extern "C" __declspec(dllexport) const NPCType* GetNPCType(uint32 id) {
|
|
||||||
return pGetNPCType(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) bool AddNPCType(uint32 id, const NPCType* npctype) {
|
|
||||||
return pAddNPCType(id, npctype);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*extern "C" __declspec(dllexport) bool DLLLoadNPCTypes(CALLBACK_DBLoadNPCTypes cbDBLoadNPCTypes, uint32 iNPCTypeStructSize, int32* iNPCTypesCount, uint32* iMaxNPCTypeID) {
|
|
||||||
return pDLLLoadNPCTypes(cbDBLoadNPCTypes, iNPCTypeStructSize, iNPCTypesCount, iMaxNPCTypeID);
|
|
||||||
};*/
|
|
||||||
|
|
||||||
#else
|
|
||||||
extern "C" const NPCType* GetNPCType(uint32 id) {
|
|
||||||
return pGetNPCType(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool AddNPCType(uint32 id, const NPCType* npctype) {
|
|
||||||
return pAddNPCType(id, npctype);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" bool DLLLoadNPCTypes(CALLBACK_DBLoadNPCTypes cbDBLoadNPCTypes, uint32 iNPCTypeStructSize, int32* iNPCTypesCount, uint32* iMaxNPCTypeID) {
|
|
||||||
return pDLLLoadNPCTypes(cbDBLoadNPCTypes, iNPCTypeStructSize, iNPCTypesCount, iMaxNPCTypeID);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool pAddNPCType(uint32 id, const NPCType* npctype) {
|
|
||||||
if (!MMFNPCTypesData_Writable)
|
|
||||||
return false;
|
|
||||||
if (id > MMF_MAX_NPCTYPE_ID || MMFNPCTypesData_Writable->NextFreeIndex >= MMFNPCTypesData_Writable->NPCTypeCount)
|
|
||||||
return false;
|
|
||||||
if (MMFNPCTypesData_Writable->NPCTypeIndex[id] != 0xFFFFFFFF)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MMFNPCTypesData_Writable->NPCTypeIndex[id] = MMFNPCTypesData_Writable->NextFreeIndex++;
|
|
||||||
memcpy(&MMFNPCTypesData_Writable->NPCTypes[MMFNPCTypesData_Writable->NPCTypeIndex[id]], npctype, sizeof(NPCType));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*bool pDLLLoadNPCTypes(CALLBACK_DBLoadNPCTypes cbDBLoadNPCTypes, uint32 iNPCTypeStructSize, int32* iNPCTypesCount, uint32* iMaxNPCTypeID) {
|
|
||||||
if (iNPCTypeStructSize != sizeof(NPCType)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: iNPCTypeStructSize != sizeof(NPCType)" << endl;
|
|
||||||
cout << "NPCType struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (*iMaxNPCTypeID > MMF_MAX_NPCTYPE_ID) {
|
|
||||||
cout << "Error: EMuShareMem: pDLLLoadNPCTypes: iMaxNPCTypeID > MMF_MAX_NPCTYPE_ID" << endl;
|
|
||||||
cout << "You need to increase the define in NPCTypes.h." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 tmpMemSize = sizeof(MMFNPCTypes_Struct) + 256 + (sizeof(NPCType) * (*iNPCTypesCount));
|
|
||||||
if (NPCTypesMMF.Open("EQEMuNPCTypes", tmpMemSize)) {
|
|
||||||
// MMFNPCTypesData = (const MMFNPCTypes_Struct*) NPCTypesMMF.GetHandle();
|
|
||||||
if (NPCTypesMMF.CanWrite()) {
|
|
||||||
MMFNPCTypesData_Writable = (MMFNPCTypes_Struct*) NPCTypesMMF.GetWriteableHandle();
|
|
||||||
if (!MMFNPCTypesData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: !MMFNPCTypesData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFNPCTypesData_Writable, 0, tmpMemSize);
|
|
||||||
for(int i=0; i<MMF_MAX_NPCTYPE_ID; i++)
|
|
||||||
MMFNPCTypesData_Writable->NPCTypeIndex[i] = 0xFFFFFFFF;
|
|
||||||
MMFNPCTypesData_Writable->MaxNPCTypeID = *iMaxNPCTypeID;
|
|
||||||
MMFNPCTypesData_Writable->NPCTypeCount = *iNPCTypesCount;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cbDBLoadNPCTypes(MMFNPCTypesData_Writable->NPCTypeCount, MMFNPCTypesData_Writable->MaxNPCTypeID)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: !cbDBLoadNPCTypes" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFNPCTypesData_Writable = 0;
|
|
||||||
NPCTypesMMF.SetLoaded();
|
|
||||||
MMFNPCTypesData = (const MMFNPCTypes_Struct*) NPCTypesMMF.GetHandle();
|
|
||||||
if (!MMFNPCTypesData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: !MMFNPCTypesData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!NPCTypesMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!NPCTypesMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(100);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!NPCTypesMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: !NPCTypesMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFNPCTypesData = (const MMFNPCTypes_Struct*) NPCTypesMMF.GetHandle();
|
|
||||||
if (!MMFNPCTypesData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadNPCTypes: !MMFNPCTypesData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*iMaxNPCTypeID = MMFNPCTypesData->MaxNPCTypeID;
|
|
||||||
*iNPCTypesCount = MMFNPCTypesData->NPCTypeCount;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading NPCTypes: NPCTypes.cpp: pDLLLoadNPCTypes: Open() == false" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};*/
|
|
||||||
|
|
||||||
const NPCType* pGetNPCType(uint32 id) {
|
|
||||||
if (MMFNPCTypesData == 0 || (!NPCTypesMMF.IsLoaded()) || id > MMF_MAX_NPCTYPE_ID || MMFNPCTypesData->NPCTypeIndex[id] == 0xFFFFFFFF)
|
|
||||||
return 0;
|
|
||||||
return &MMFNPCTypesData->NPCTypes[MMFNPCTypesData->NPCTypeIndex[id]];
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../zone/zonedump.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
// MMF_MAX_NPCTYPE_ID: Make sure this is bigger than the highest NPCType ID#
|
|
||||||
#define MMF_MAX_NPCTYPE_ID 400000
|
|
||||||
|
|
||||||
struct MMFNPCTypes_Struct {
|
|
||||||
uint32 MaxNPCTypeID;
|
|
||||||
uint32 NextFreeIndex;
|
|
||||||
uint32 NPCTypeCount;
|
|
||||||
uint32 NPCTypeIndex[MMF_MAX_NPCTYPE_ID+1];
|
|
||||||
NPCType NPCTypes[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
//bool pDLLLoadNPCTypes(CALLBACK_DBLoadNPCTypes cbDBLoadNPCTypes, uint32 iNPCTypeStructSize, int32* iNPCTypesCount, uint32* iMaxNPCTypeID);
|
|
||||||
bool pAddNPCType(uint32 id, const NPCType* npctype);
|
|
||||||
const NPCType* pGetNPCType(uint32 id);
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "Opcodes.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF OpcodesMMF;
|
|
||||||
const MMFOpcodes_Struct* MMFOpcodesData = 0;
|
|
||||||
MMFOpcodes_Struct* MMFOpcodesData_Writable = 0;
|
|
||||||
const uint16 *MMFOpcodesData_emu_to_eq = NULL;
|
|
||||||
uint16 *MMFOpcodesData_emu_to_eq_write = NULL;
|
|
||||||
|
|
||||||
//we choose to store all opcodes as 16 bits, so if they are a different
|
|
||||||
//size in emu, they are gunna get casted to 16 bits... prolly will never
|
|
||||||
//be a problem, but I figured it was noteworthy
|
|
||||||
|
|
||||||
|
|
||||||
DLLFUNC uint16 GetEQOpcode(uint16 emu_op) {
|
|
||||||
if (MMFOpcodesData == 0 || (!OpcodesMMF.IsLoaded()) || emu_op >= MMFOpcodesData->EmuOpcodeCount )
|
|
||||||
return 0;
|
|
||||||
return MMFOpcodesData_emu_to_eq[emu_op];
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC uint16 GetEmuOpcode(uint16 eq_op) {
|
|
||||||
if (MMFOpcodesData == 0 || (!OpcodesMMF.IsLoaded()) || eq_op >= MMFOpcodesData->EQOpcodeCount )
|
|
||||||
return 0;
|
|
||||||
return MMFOpcodesData->eq_to_emu[eq_op];
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC bool SetOpcodePair(uint16 emu_op, uint16 eq_op) {
|
|
||||||
if (!MMFOpcodesData_Writable || !MMFOpcodesData_emu_to_eq_write)
|
|
||||||
return false;
|
|
||||||
if (emu_op >= MMFOpcodesData_Writable->EmuOpcodeCount || eq_op >= MMFOpcodesData_Writable->EQOpcodeCount)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MMFOpcodesData_emu_to_eq_write[emu_op] = eq_op;
|
|
||||||
MMFOpcodesData_Writable->eq_to_emu[eq_op] = emu_op;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC void ClearEQOpcodes() {
|
|
||||||
if (!MMFOpcodesData_Writable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset(MMFOpcodesData_Writable->eq_to_emu, 0, sizeof(uint16)*MMFOpcodesData->EQOpcodeCount);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC bool DLLLoadOpcodes(CALLBACK_DBLoadOpcodes cb, uint32 opsize, uint32 eq_count, uint32 emu_count, const char *filename) {
|
|
||||||
if(opsize != sizeof(uint16)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: opsize != sizeof(uint16)" << endl;
|
|
||||||
cout << "Opcode size has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 tmpMemSize = sizeof(MMFOpcodes_Struct) + opsize * (eq_count+emu_count);
|
|
||||||
if (OpcodesMMF.Open("EQEMuOpcodes", tmpMemSize)) {
|
|
||||||
if (OpcodesMMF.CanWrite()) {
|
|
||||||
MMFOpcodesData_Writable = (MMFOpcodes_Struct*) OpcodesMMF.GetWriteableHandle();
|
|
||||||
if (!MMFOpcodesData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//emu_to_eq is right after eq_to_emu
|
|
||||||
MMFOpcodesData_emu_to_eq = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
|
||||||
MMFOpcodesData_emu_to_eq_write = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
|
||||||
|
|
||||||
//we need to memset the eq opcodes
|
|
||||||
memset(MMFOpcodesData_Writable->eq_to_emu, 0, sizeof(uint16)*eq_count);
|
|
||||||
|
|
||||||
MMFOpcodesData_Writable->EQOpcodeCount = eq_count;
|
|
||||||
MMFOpcodesData_Writable->EmuOpcodeCount = emu_count;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cb(filename)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !cbDBLoadOpcodes" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//we dont disable the write handle here, so we can reload them
|
|
||||||
//MMFOpcodesData_Writable = 0;
|
|
||||||
|
|
||||||
OpcodesMMF.SetLoaded();
|
|
||||||
MMFOpcodesData = (const MMFOpcodes_Struct*) OpcodesMMF.GetHandle();
|
|
||||||
if (!MMFOpcodesData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (!OpcodesMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!OpcodesMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(10);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!OpcodesMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !OpcodesMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFOpcodesData = (const MMFOpcodes_Struct*) OpcodesMMF.GetHandle();
|
|
||||||
if (!MMFOpcodesData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadOpcodes: !MMFOpcodesData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//emu_to_eq is right after eq_to_emu
|
|
||||||
MMFOpcodesData_emu_to_eq = MMFOpcodesData->eq_to_emu + MMFOpcodesData->EQOpcodeCount;
|
|
||||||
|
|
||||||
//cheat a little so we can retain writeable handles for reloading
|
|
||||||
MMFOpcodesData_Writable = const_cast<MMFOpcodes_Struct*>(MMFOpcodesData);
|
|
||||||
MMFOpcodesData_emu_to_eq_write = MMFOpcodesData_Writable->eq_to_emu + eq_count;
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading Opcodes: Opcodes.cpp: pDLLLoadOpcodes: ret == 0, size = " << tmpMemSize << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
struct MMFOpcodes_Struct {
|
|
||||||
uint32 EQOpcodeCount;
|
|
||||||
uint32 EmuOpcodeCount;
|
|
||||||
uint16 eq_to_emu[0];
|
|
||||||
//uint16 emu_to_eq[0]; //logical, not really here... EQOpcodeCount indexes in
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "SkillCaps.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF SkillCapsMMF;
|
|
||||||
const MMFSkillCaps_Struct* MMFSkillCapsData = 0;
|
|
||||||
MMFSkillCaps_Struct* MMFSkillCapsData_Writable = 0;
|
|
||||||
|
|
||||||
|
|
||||||
DLLFUNC uint16 GetSkillCap(uint8 Class_, uint8 Skill, uint8 Level) {
|
|
||||||
if (MMFSkillCapsData == 0 || (!SkillCapsMMF.IsLoaded()))
|
|
||||||
return 0;
|
|
||||||
if (Class_ >= MMFSkillCapsData->ClassCount || Skill >= MMFSkillCapsData->SkillCount || Level >= MMFSkillCapsData->LevelCount)
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
uint32 index =
|
|
||||||
(((Class_ * MMFSkillCapsData->SkillCount) + Skill) * MMFSkillCapsData->LevelCount)
|
|
||||||
+ Level;
|
|
||||||
|
|
||||||
return MMFSkillCapsData->caps[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC bool SetSkillCap(uint8 Class_, uint8 Skill, uint8 Level, uint16 cap) {
|
|
||||||
if (!MMFSkillCapsData_Writable)
|
|
||||||
return false;
|
|
||||||
if (Class_ >= MMFSkillCapsData_Writable->ClassCount || Skill >= MMFSkillCapsData_Writable->SkillCount || Level >= MMFSkillCapsData_Writable->LevelCount)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 index =
|
|
||||||
(((Class_ * MMFSkillCapsData_Writable->SkillCount) + Skill) * MMFSkillCapsData_Writable->LevelCount)
|
|
||||||
+ Level;
|
|
||||||
|
|
||||||
MMFSkillCapsData_Writable->caps[index] = cap;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC uint8 GetTrainLevel(uint8 Class_, uint8 Skill, uint8 Level){
|
|
||||||
if (MMFSkillCapsData == 0 || (!SkillCapsMMF.IsLoaded()))
|
|
||||||
return 0;
|
|
||||||
if (Class_ >= MMFSkillCapsData->ClassCount || Skill >= MMFSkillCapsData->SkillCount || Level >= MMFSkillCapsData->LevelCount)
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
uint32 index = (((Class_ * MMFSkillCapsData->SkillCount) + Skill) * MMFSkillCapsData->LevelCount);
|
|
||||||
|
|
||||||
for(int x = 0; x < Level; x++){
|
|
||||||
if(MMFSkillCapsData->caps[index + x]){
|
|
||||||
return (x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC void ClearSkillCaps() {
|
|
||||||
if (!MMFSkillCapsData_Writable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset(MMFSkillCapsData_Writable->caps, 0,
|
|
||||||
sizeof(uint16)*(MMFSkillCapsData->ClassCount*MMFSkillCapsData->SkillCount*MMFSkillCapsData->LevelCount));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DLLFUNC bool LoadSkillCaps(CALLBACK_DBLoadSkillCaps cb, uint32 opsize, uint8 ClassCount, uint8 SkillCount, uint8 LevelCount) {
|
|
||||||
if(opsize != sizeof(uint16)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: opsize != sizeof(uint16)" << endl;
|
|
||||||
cout << "SkillCap size has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32 tmpMemSize = sizeof(MMFSkillCaps_Struct) + opsize * (ClassCount*SkillCount*LevelCount);
|
|
||||||
if (SkillCapsMMF.Open("EQEMuKSkillCaps", tmpMemSize)) {
|
|
||||||
if (SkillCapsMMF.CanWrite()) {
|
|
||||||
MMFSkillCapsData_Writable = (MMFSkillCaps_Struct*) SkillCapsMMF.GetWriteableHandle();
|
|
||||||
if (!MMFSkillCapsData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//we need to memset the eq SkillCaps
|
|
||||||
memset(MMFSkillCapsData_Writable->caps, 0, sizeof(uint16)*(ClassCount*SkillCount*LevelCount));
|
|
||||||
|
|
||||||
MMFSkillCapsData_Writable->ClassCount = ClassCount;
|
|
||||||
MMFSkillCapsData_Writable->SkillCount = SkillCount;
|
|
||||||
MMFSkillCapsData_Writable->LevelCount = LevelCount;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (!cb()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !cbDBLoadSkillCaps" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MMFSkillCapsData_Writable = 0;
|
|
||||||
|
|
||||||
SkillCapsMMF.SetLoaded();
|
|
||||||
MMFSkillCapsData = (const MMFSkillCaps_Struct*) SkillCapsMMF.GetHandle();
|
|
||||||
if (!MMFSkillCapsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (!SkillCapsMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!SkillCapsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(10);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!SkillCapsMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !SkillCapsMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFSkillCapsData = (const MMFSkillCaps_Struct*) SkillCapsMMF.GetHandle();
|
|
||||||
if (!MMFSkillCapsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSkillCaps: !MMFSkillCapsData (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading SkillCaps: SkillCaps.cpp: pDLLLoadSkillCaps: ret == 0, size = " << tmpMemSize << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#include "../common/types.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
struct MMFSkillCaps_Struct {
|
|
||||||
uint8 ClassCount;
|
|
||||||
uint8 SkillCount;
|
|
||||||
uint8 LevelCount;
|
|
||||||
uint16 caps[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
#include "../common/debug.h"
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "Spells.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
//#include "../zone/masterentity.h"
|
|
||||||
#include "MMF.h"
|
|
||||||
|
|
||||||
MMF SpellsMMF;
|
|
||||||
const MMFSpells_Struct* MMFSpellsData = 0;
|
|
||||||
MMFSpells_Struct* MMFSpellsData_Writable = 0;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
extern "C" __declspec(dllexport) bool DLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
|
||||||
return pDLLLoadSPDat(cbFileLoadSPDat, oSpellsPointer, oSPDAT_RECORDS, iSPDat_Struct_Size);
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
extern "C" bool DLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
|
||||||
return pDLLLoadSPDat(cbFileLoadSPDat, oSpellsPointer, oSPDAT_RECORDS, iSPDat_Struct_Size);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool pDLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size) {
|
|
||||||
if (iSPDat_Struct_Size != sizeof(SPDat_Spell_Struct)) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSPDat: iSPDat_Struct_Size != sizeof(SPDat_Spell_Struct)" << endl;
|
|
||||||
cout << "SPDat_Spell_Struct has changed, EMuShareMem.dll needs to be recompiled." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 tmpMemSize = sizeof(MMFSpells_Struct) + 256 + (sizeof(SPDat_Spell_Struct) * (*oSPDAT_RECORDS));
|
|
||||||
if (SpellsMMF.Open("EQEMuSpells", tmpMemSize)) {
|
|
||||||
if (SpellsMMF.CanWrite()) {
|
|
||||||
MMFSpellsData_Writable = (MMFSpells_Struct*) SpellsMMF.GetWriteableHandle();
|
|
||||||
if (!MMFSpellsData_Writable) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !MMFSpellsData_Writable" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(MMFSpellsData_Writable, 0, tmpMemSize);
|
|
||||||
MMFSpellsData_Writable->SPDAT_RECORDS = *oSPDAT_RECORDS;
|
|
||||||
// use a callback so the DB functions are done in the main exe
|
|
||||||
// this way the DLL doesnt have to open a connection to mysql
|
|
||||||
if (MMFSpellsData_Writable->SPDAT_RECORDS > 0) {
|
|
||||||
cbFileLoadSPDat(&MMFSpellsData_Writable->spells[0], MMFSpellsData_Writable->SPDAT_RECORDS-1);
|
|
||||||
*oSpellsPointer = &MMFSpellsData_Writable->spells[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*oSpellsPointer = 0;
|
|
||||||
|
|
||||||
MMFSpellsData_Writable = 0;
|
|
||||||
SpellsMMF.SetLoaded();
|
|
||||||
MMFSpellsData = (const MMFSpells_Struct*) SpellsMMF.GetHandle();
|
|
||||||
if (!MMFSpellsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !MMFSpellsData (CanWrite=true)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!SpellsMMF.IsLoaded()) {
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
uint32 starttime = Timer::GetCurrentTime();
|
|
||||||
while ((!SpellsMMF.IsLoaded()) && ((Timer::GetCurrentTime() - starttime) < 300000)) {
|
|
||||||
Sleep(100);
|
|
||||||
Timer::SetCurrentTime();
|
|
||||||
}
|
|
||||||
if (!SpellsMMF.IsLoaded()) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !SpellsMMF.IsLoaded() (timeout)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MMFSpellsData = (const MMFSpells_Struct*) SpellsMMF.GetHandle();
|
|
||||||
if (!MMFSpellsData) {
|
|
||||||
cout << "Error: EMuShareMem: DLLLoadSPDat: !SpellsMMF (CanWrite=false)" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*oSPDAT_RECORDS = MMFSpellsData->SPDAT_RECORDS;
|
|
||||||
if (MMFSpellsData->SPDAT_RECORDS > 0)
|
|
||||||
*oSpellsPointer = &MMFSpellsData->spells[0];
|
|
||||||
else
|
|
||||||
*oSpellsPointer = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "Error Loading SPDat: Spells.cpp: pDLLLoadSPDat: Open() == false" << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#ifndef MEMSHARE_SPELLS_H
|
|
||||||
#define MEMSHARE_SPELLS_H
|
|
||||||
|
|
||||||
#include "../common/types.h"
|
|
||||||
#include "../zone/spdat.h"
|
|
||||||
#include "../common/EMuShareMem.h"
|
|
||||||
|
|
||||||
struct MMFSpells_Struct {
|
|
||||||
uint32 SPDAT_RECORDS; // maxspellid + 1, size of array
|
|
||||||
SPDat_Spell_Struct spells[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
bool pDLLLoadSPDat(const CALLBACK_FileLoadSPDat cbFileLoadSPDat, const void** oSpellsPointer, int32* oSPDAT_RECORDS, uint32 iSPDat_Struct_Size);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
The server code and utilities are released under GPL.
|
The server code and utilities are released under GPLv3.
|
||||||
|
|
||||||
We also include some small libraries for convienence that may be under different licensing:
|
We also include some small libraries for convienence that may be under different licensing:
|
||||||
|
|
||||||
@@ -8,3 +8,5 @@ StackWalker - New BSD License
|
|||||||
ZLib - ZLib License
|
ZLib - ZLib License
|
||||||
MySQL - GPL
|
MySQL - GPL
|
||||||
Perl - GPL / ActiveState (under the assumption that this is a free project).
|
Perl - GPL / ActiveState (under the assumption that this is a free project).
|
||||||
|
CPPUnit - GLP
|
||||||
|
StringUtilities - Apache
|
||||||
@@ -1,2 +1,53 @@
|
|||||||
EQEmu - Custom Game Implementation for EverQuest
|
EQEmu
|
||||||
|
===
|
||||||
|
|
||||||
|
[](https://travis-ci.org/EQEmu/Server)
|
||||||
|
|
||||||
|
Overview
|
||||||
|
---
|
||||||
|
|
||||||
|
EQEmu is a custom server implementation for EverQuest
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
---
|
||||||
|
|
||||||
|
For Windows: http://eqemu.github.io
|
||||||
|
|
||||||
|
Login Server dependencies for Windows/Linux/OSX: http://eqemu.github.io
|
||||||
|
|
||||||
|
For Debian based distros (adjust to your local flavor):
|
||||||
|
|
||||||
|
- libmysqlclient-dev
|
||||||
|
- libperl-dev
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
The [EQEmu Forums](http://www.eqemulator.org/forums/) also have forums to submit
|
||||||
|
bugs/get help with bugs.
|
||||||
|
|
||||||
|
Contributions
|
||||||
|
---
|
||||||
|
|
||||||
|
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
|
||||||
|
try IRC. 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)
|
||||||
|
forum, although pull requests will be much quicker and easier on all parties.
|
||||||
|
|
||||||
|
Contact
|
||||||
|
---
|
||||||
|
- **User IRC Channel**: `#eqemu` on `irc.eqemulator.net`
|
||||||
|
- **Developer IRC Channel**: `#eqemucoders` on `irc.eqemulator.net`
|
||||||
|
|
||||||
|
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||||
|
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
|
||||||
|
|
||||||
|
|||||||
+1158
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
|||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
|
||||||
|
add_subdirectory(import)
|
||||||
|
add_subdirectory(export)
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
|
||||||
|
SET(export_sources
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(export_headers
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||||
|
|
||||||
|
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(export_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
|
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)
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
Copyright (C) 2001-2013 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 <stdio.h>
|
||||||
|
#include "../../common/debug.h"
|
||||||
|
#include "../../common/shareddb.h"
|
||||||
|
#include "../../common/eqemu_config.h"
|
||||||
|
#include "../../common/platform.h"
|
||||||
|
#include "../../common/crash.h"
|
||||||
|
#include "../../common/rulesys.h"
|
||||||
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
|
void ExportSpells(SharedDatabase *db);
|
||||||
|
void ExportSkillCaps(SharedDatabase *db);
|
||||||
|
void ExportBaseData(SharedDatabase *db);
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||||
|
set_exception_handler();
|
||||||
|
|
||||||
|
LogFile->write(EQEMuLog::Status, "Client Files Export Utility");
|
||||||
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EQEmuConfig *config = EQEmuConfig::get();
|
||||||
|
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedDatabase database;
|
||||||
|
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||||
|
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||||
|
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
|
"database connection");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportSpells(&database);
|
||||||
|
ExportSkillCaps(&database);
|
||||||
|
ExportBaseData(&database);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExportSpells(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Exporting Spells...");
|
||||||
|
|
||||||
|
FILE *f = fopen("export/spells_us.txt", "w");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string query = "SELECT * FROM spells_new ORDER BY id";
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
|
||||||
|
if(results.Success()) {
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
std::string line;
|
||||||
|
unsigned int fields = results.ColumnCount();
|
||||||
|
for(unsigned int i = 0; i < fields; ++i) {
|
||||||
|
if(i != 0) {
|
||||||
|
line.push_back('^');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(row[i] != nullptr) {
|
||||||
|
line += row[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "%s\n", line.c_str());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||||
|
|
||||||
|
bool res = false;
|
||||||
|
|
||||||
|
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
|
||||||
|
class_id, skill_id);
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
if(!results.Success()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.RowCount() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
if(row[0] && atoi(row[0]) > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||||
|
|
||||||
|
std::string query = StringFormat("SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
|
||||||
|
class_id, skill_id, level);
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
if (!results.Success()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.RowCount() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExportSkillCaps(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Exporting Skill Caps...");
|
||||||
|
|
||||||
|
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int cl = 1; cl <= 16; ++cl) {
|
||||||
|
for(int skill = 0; skill <= 77; ++skill) {
|
||||||
|
if(SkillUsable(db, skill, cl)) {
|
||||||
|
int previous_cap = 0;
|
||||||
|
for(int level = 1; level <= 100; ++level) {
|
||||||
|
int cap = GetSkill(db, skill, cl, level);
|
||||||
|
if(cap < previous_cap) {
|
||||||
|
cap = previous_cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "%d^%d^%d^%d^0\n", cl, skill, level, cap);
|
||||||
|
previous_cap = cap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExportBaseData(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Exporting Base Data...");
|
||||||
|
|
||||||
|
FILE *f = fopen("export/BaseData.txt", "w");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
if(results.Success()) {
|
||||||
|
for (auto row = results.begin();row != results.end();++row) {
|
||||||
|
std::string line;
|
||||||
|
unsigned int fields = results.ColumnCount();
|
||||||
|
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||||
|
if(rowIndex != 0)
|
||||||
|
line.push_back('^');
|
||||||
|
|
||||||
|
if(row[rowIndex] != nullptr) {
|
||||||
|
line += row[rowIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "%s\n", line.c_str());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
|
||||||
|
SET(import_sources
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(import_headers
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||||
|
|
||||||
|
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(import_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
|
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)
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
Copyright (C) 2001-2013 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 "../../common/debug.h"
|
||||||
|
#include "../../common/shareddb.h"
|
||||||
|
#include "../../common/eqemu_config.h"
|
||||||
|
#include "../../common/platform.h"
|
||||||
|
#include "../../common/crash.h"
|
||||||
|
#include "../../common/rulesys.h"
|
||||||
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
|
void ImportSpells(SharedDatabase *db);
|
||||||
|
void ImportSkillCaps(SharedDatabase *db);
|
||||||
|
void ImportBaseData(SharedDatabase *db);
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
|
set_exception_handler();
|
||||||
|
|
||||||
|
LogFile->write(EQEMuLog::Status, "Client Files Import Utility");
|
||||||
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EQEmuConfig *config = EQEmuConfig::get();
|
||||||
|
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedDatabase database;
|
||||||
|
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||||
|
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||||
|
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
|
"database connection");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportSpells(&database);
|
||||||
|
ImportSkillCaps(&database);
|
||||||
|
ImportBaseData(&database);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetSpellColumns(SharedDatabase *db) {
|
||||||
|
|
||||||
|
const std::string query = "DESCRIBE spells_new";
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
if(!results.Success()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return results.RowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportSpells(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Importing Spells...");
|
||||||
|
FILE *f = fopen("import/spells_us.txt", "r");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string query = "DELETE FROM spells_new";
|
||||||
|
db->QueryDatabase(query);
|
||||||
|
|
||||||
|
int columns = GetSpellColumns(db);
|
||||||
|
int spells_imported = 0;
|
||||||
|
|
||||||
|
char buffer[2048];
|
||||||
|
while(fgets(buffer, 2048, f)) {
|
||||||
|
for(int i = 0; i < 2048; ++i) {
|
||||||
|
if(buffer[i] == '\n') {
|
||||||
|
buffer[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string escaped = ::EscapeString(buffer);
|
||||||
|
auto split = SplitString(escaped, '^');
|
||||||
|
int line_columns = (int)split.size();
|
||||||
|
|
||||||
|
std::string sql;
|
||||||
|
if(line_columns >= columns) {
|
||||||
|
sql = "INSERT INTO spells_new VALUES(";
|
||||||
|
for(int i = 0; i < columns; ++i) {
|
||||||
|
if(i != 0) {
|
||||||
|
sql += ", '";
|
||||||
|
} else {
|
||||||
|
sql += "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql += split[i];
|
||||||
|
sql += "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql += ");";
|
||||||
|
} else {
|
||||||
|
int i = 0;
|
||||||
|
sql = "INSERT INTO spells_new VALUES(";
|
||||||
|
for(; i < line_columns; ++i) {
|
||||||
|
if(i != 0) {
|
||||||
|
sql += ", '";
|
||||||
|
} else {
|
||||||
|
sql += "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql += split[i];
|
||||||
|
sql += "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; i < columns; ++i) {
|
||||||
|
sql += ", '0'";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql += ");";
|
||||||
|
}
|
||||||
|
|
||||||
|
db->QueryDatabase(sql);
|
||||||
|
|
||||||
|
spells_imported++;
|
||||||
|
if(spells_imported % 1000 == 0) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(spells_imported % 1000 != 0) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportSkillCaps(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Importing Skill Caps...");
|
||||||
|
|
||||||
|
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string delete_sql = "DELETE FROM skill_caps";
|
||||||
|
db->QueryDatabase(delete_sql);
|
||||||
|
|
||||||
|
char buffer[2048];
|
||||||
|
while(fgets(buffer, 2048, f)) {
|
||||||
|
auto split = SplitString(buffer, '^');
|
||||||
|
|
||||||
|
if(split.size() < 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int class_id, skill_id, level, cap;
|
||||||
|
class_id = atoi(split[0].c_str());
|
||||||
|
skill_id = atoi(split[1].c_str());
|
||||||
|
level = atoi(split[2].c_str());
|
||||||
|
cap = atoi(split[3].c_str());
|
||||||
|
|
||||||
|
std::string sql = StringFormat("INSERT INTO skill_caps(class, skillID, level, cap) VALUES(%d, %d, %d, %d)",
|
||||||
|
class_id, skill_id, level, cap);
|
||||||
|
|
||||||
|
db->QueryDatabase(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportBaseData(SharedDatabase *db) {
|
||||||
|
LogFile->write(EQEMuLog::Status, "Importing Base Data...");
|
||||||
|
|
||||||
|
FILE *f = fopen("import/BaseData.txt", "r");
|
||||||
|
if(!f) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string delete_sql = "DELETE FROM base_data";
|
||||||
|
db->QueryDatabase(delete_sql);
|
||||||
|
|
||||||
|
char buffer[2048];
|
||||||
|
while(fgets(buffer, 2048, f)) {
|
||||||
|
auto split = SplitString(buffer, '^');
|
||||||
|
|
||||||
|
if(split.size() < 10) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sql;
|
||||||
|
int level, class_id;
|
||||||
|
double hp, mana, end, unk1, unk2, hp_fac, mana_fac, end_fac;
|
||||||
|
|
||||||
|
level = atoi(split[0].c_str());
|
||||||
|
class_id = atoi(split[1].c_str());
|
||||||
|
hp = atof(split[2].c_str());
|
||||||
|
mana = atof(split[3].c_str());
|
||||||
|
end = atof(split[4].c_str());
|
||||||
|
unk1 = atof(split[5].c_str());
|
||||||
|
unk2 = atof(split[6].c_str());
|
||||||
|
hp_fac = atof(split[7].c_str());
|
||||||
|
mana_fac = atof(split[8].c_str());
|
||||||
|
end_fac = atof(split[9].c_str());
|
||||||
|
|
||||||
|
sql = StringFormat("INSERT INTO base_data(level, class, hp, mana, end, unk1, unk2, hp_fac, "
|
||||||
|
"mana_fac, end_fac) VALUES(%d, %d, %f, %f, %f, %f, %f, %f, %f, %f)",
|
||||||
|
level, class_id, hp, mana, end, unk1, unk2, hp_fac, mana_fac, end_fac);
|
||||||
|
|
||||||
|
db->QueryDatabase(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
#CMake - Cross Platform Makefile Generator
|
||||||
|
#Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
|
||||||
|
#All rights reserved.
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without
|
||||||
|
#modification, are permitted provided that the following conditions
|
||||||
|
#are met:
|
||||||
|
#
|
||||||
|
#* Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
#* Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#* Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||||
|
# nor the names of their contributors may be used to endorse or promote
|
||||||
|
# products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
#HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# This module defines
|
||||||
|
# LUA51_FOUND, if false, do not try to link to Lua
|
||||||
|
# LUA_LIBRARIES
|
||||||
|
# LUA_INCLUDE_DIR, where to find lua.h
|
||||||
|
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||||
|
|
||||||
|
IF(LUA_ROOT)
|
||||||
|
FIND_PATH(LUA_INCLUDE_DIR
|
||||||
|
NAMES lua.h
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATHS
|
||||||
|
${LUA_ROOT}
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include src
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LUA_LIBRARY
|
||||||
|
NAMES lua51 lua5.1 lua-5.1 lua
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATHS
|
||||||
|
${LUA_ROOT}
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
PATH_SUFFIXES lib bin
|
||||||
|
)
|
||||||
|
ELSE(LUA_ROOT)
|
||||||
|
FIND_PATH(LUA_INCLUDE_DIR
|
||||||
|
NAMES lua.h
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LUA_LIBRARY
|
||||||
|
NAMES lua51 lua5.1 lua-5.1 lua
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
PATH_SUFFIXES lib bin
|
||||||
|
)
|
||||||
|
ENDIF(LUA_ROOT)
|
||||||
|
|
||||||
|
IF(LUA_LIBRARY)
|
||||||
|
# include the math library for Unix
|
||||||
|
IF(UNIX AND NOT APPLE)
|
||||||
|
FIND_LIBRARY(LUA_MATH_LIBRARY m)
|
||||||
|
SET(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
# For Windows and Mac, don't need to explicitly include the math library
|
||||||
|
ELSE()
|
||||||
|
SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||||
|
FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||||
|
|
||||||
|
STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||||
|
UNSET(lua_version_str)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
|
||||||
|
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||||
|
VERSION_VAR LUA_VERSION_STRING)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
+46
-47
@@ -4,65 +4,65 @@
|
|||||||
#
|
#
|
||||||
# Find the native MySQL includes and library
|
# Find the native MySQL includes and library
|
||||||
#
|
#
|
||||||
# MySQL_INCLUDE_DIR - where to find mysql.h, etc.
|
# MySQL_INCLUDE_DIR - where to find mysql.h, etc.
|
||||||
# MySQL_LIBRARIES - List of libraries when using MySQL.
|
# MySQL_LIBRARIES - List of libraries when using MySQL.
|
||||||
# MySQL_FOUND - True if MySQL found.
|
# MySQL_FOUND - True if MySQL found.
|
||||||
# The following can be used as a hint as to where to search:
|
# The following can be used as a hint as to where to search:
|
||||||
# MYSQL_ROOT
|
# MYSQL_ROOT
|
||||||
|
|
||||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
SET(MySQL_FIND_QUIETLY TRUE)
|
SET(MySQL_FIND_QUIETLY TRUE)
|
||||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
||||||
|
|
||||||
# Include dir
|
# Include dir
|
||||||
IF(MYSQL_ROOT)
|
IF(MYSQL_ROOT)
|
||||||
FIND_PATH(MySQL_INCLUDE_DIR
|
FIND_PATH(MySQL_INCLUDE_DIR
|
||||||
NAMES mysql.h
|
NAMES mysql.h
|
||||||
PATHS ${MYSQL_ROOT}/include
|
PATHS ${MYSQL_ROOT}/include
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
ELSE(MYSQL_ROOT)
|
ELSE(MYSQL_ROOT)
|
||||||
FIND_PATH(MySQL_INCLUDE_DIR
|
FIND_PATH(MySQL_INCLUDE_DIR
|
||||||
NAMES mysql.h
|
NAMES mysql.h
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
ENDIF(MYSQL_ROOT)
|
ENDIF(MYSQL_ROOT)
|
||||||
|
|
||||||
# Library
|
# Library
|
||||||
SET(MySQL_NAMES mysqlclient_r mysqlclient)
|
SET(MySQL_NAMES mysqlclient_r mysqlclient)
|
||||||
IF(MYSQL_ROOT)
|
IF(MYSQL_ROOT)
|
||||||
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
||||||
NAMES ${MySQL_NAMES}
|
NAMES ${MySQL_NAMES}
|
||||||
PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
||||||
NAMES ${MySQL_NAMES}
|
NAMES ${MySQL_NAMES}
|
||||||
PATHS ${MYSQL_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
PATHS ${MYSQL_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
ELSE(MYSQL_ROOT)
|
ELSE(MYSQL_ROOT)
|
||||||
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
||||||
NAMES ${MySQL_NAMES}
|
NAMES ${MySQL_NAMES}
|
||||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
||||||
NAMES ${MySQL_NAMES}
|
NAMES ${MySQL_NAMES}
|
||||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||||
PATH_SUFFIXES mysql
|
PATH_SUFFIXES mysql
|
||||||
)
|
)
|
||||||
ENDIF(MYSQL_ROOT)
|
ENDIF(MYSQL_ROOT)
|
||||||
|
|
||||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||||
SET(MySQL_FOUND TRUE)
|
SET(MySQL_FOUND TRUE)
|
||||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
||||||
ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||||
SET(MySQL_FOUND FALSE)
|
SET(MySQL_FOUND FALSE)
|
||||||
SET( MySQL_LIBRARIES )
|
SET( MySQL_LIBRARIES )
|
||||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||||
|
|
||||||
|
|
||||||
@@ -72,14 +72,13 @@ INCLUDE(FindPackageHandleStandardArgs)
|
|||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY_DEBUG MySQL_LIBRARY_RELEASE MySQL_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY_DEBUG MySQL_LIBRARY_RELEASE MySQL_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(MySQL_FOUND)
|
IF(MySQL_FOUND)
|
||||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
||||||
ELSE(MySQL_FOUND)
|
ELSE(MySQL_FOUND)
|
||||||
SET( MySQL_LIBRARIES )
|
SET( MySQL_LIBRARIES )
|
||||||
ENDIF(MySQL_FOUND)
|
ENDIF(MySQL_FOUND)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
MySQL_LIBRARY_DEBUG
|
MySQL_LIBRARY_DEBUG
|
||||||
MySQL_LIBRARY_RELEASE
|
MySQL_LIBRARY_RELEASE
|
||||||
MySQL_INCLUDE_DIR
|
MySQL_INCLUDE_DIR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+314
-287
@@ -1,313 +1,340 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
|
||||||
SET(common_sources
|
SET(common_sources
|
||||||
BasePacket.cpp
|
base_packet.cpp
|
||||||
classes.cpp
|
classes.cpp
|
||||||
Condition.cpp
|
condition.cpp
|
||||||
crash.cpp
|
crash.cpp
|
||||||
CRC16.cpp
|
crc16.cpp
|
||||||
crc32.cpp
|
crc32.cpp
|
||||||
database.cpp
|
database.cpp
|
||||||
dbasync.cpp
|
dbasync.cpp
|
||||||
dbcore.cpp
|
dbcore.cpp
|
||||||
DBMemLeak.cpp
|
debug.cpp
|
||||||
debug.cpp
|
emu_opcodes.cpp
|
||||||
emu_opcodes.cpp
|
emu_tcp_connection.cpp
|
||||||
EMuShareMem.cpp
|
emu_tcp_server.cpp
|
||||||
EmuTCPConnection.cpp
|
eq_dictionary.cpp
|
||||||
EmuTCPServer.cpp
|
eqdb.cpp
|
||||||
EQDB.cpp
|
eqdb_res.cpp
|
||||||
EQDBRes.cpp
|
eqemu_exception.cpp
|
||||||
EQEmuConfig.cpp
|
eqemu_config.cpp
|
||||||
EQEMuError.cpp
|
eqemu_error.cpp
|
||||||
EQPacket.cpp
|
eq_packet.cpp
|
||||||
EQStream.cpp
|
eq_stream.cpp
|
||||||
EQStreamFactory.cpp
|
eq_stream_factory.cpp
|
||||||
EQStreamIdent.cpp
|
eq_stream_ident.cpp
|
||||||
EQStreamProxy.cpp
|
eq_stream_proxy.cpp
|
||||||
eqtime.cpp
|
eqtime.cpp
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
guild_base.cpp
|
faction.cpp
|
||||||
guilds.cpp
|
guild_base.cpp
|
||||||
Item.cpp
|
guilds.cpp
|
||||||
logsys.cpp
|
ipc_mutex.cpp
|
||||||
logsys_eqemu.cpp
|
item.cpp
|
||||||
md5.cpp
|
logsys.cpp
|
||||||
misc.cpp
|
logsys_eqemu.cpp
|
||||||
MiscFunctions.cpp
|
md5.cpp
|
||||||
moremath.cpp
|
memory_mapped_file.cpp
|
||||||
Mutex.cpp
|
misc.cpp
|
||||||
opcode_map.cpp
|
misc_functions.cpp
|
||||||
opcodemgr.cpp
|
moremath.cpp
|
||||||
packet_dump.cpp
|
mutex.cpp
|
||||||
packet_dump_file.cpp
|
mysql_request_result.cpp
|
||||||
packet_functions.cpp
|
mysql_request_row.cpp
|
||||||
perl_EQDB.cpp
|
opcode_map.cpp
|
||||||
perl_EQDBRes.cpp
|
opcodemgr.cpp
|
||||||
ProcLauncher.cpp
|
packet_dump.cpp
|
||||||
ptimer.cpp
|
packet_dump_file.cpp
|
||||||
races.cpp
|
packet_functions.cpp
|
||||||
rdtsc.cpp
|
perl_eqdb.cpp
|
||||||
rulesys.cpp
|
perl_eqdb_res.cpp
|
||||||
serverinfo.cpp
|
proc_launcher.cpp
|
||||||
shareddb.cpp
|
ptimer.cpp
|
||||||
SharedLibrary.cpp
|
races.cpp
|
||||||
StructStrategy.cpp
|
rdtsc.cpp
|
||||||
TCPConnection.cpp
|
rulesys.cpp
|
||||||
TCPServer.cpp
|
serverinfo.cpp
|
||||||
timeoutmgr.cpp
|
shareddb.cpp
|
||||||
timer.cpp
|
spdat.cpp
|
||||||
unix.cpp
|
string_util.cpp
|
||||||
worldconn.cpp
|
struct_strategy.cpp
|
||||||
XMLParser.cpp
|
tcp_connection.cpp
|
||||||
platform.cpp
|
tcp_server.cpp
|
||||||
patches/Client62.cpp
|
timeoutmgr.cpp
|
||||||
patches/patches.cpp
|
timer.cpp
|
||||||
patches/SoD.cpp
|
unix.cpp
|
||||||
patches/SoF.cpp
|
worldconn.cpp
|
||||||
patches/RoF.cpp
|
xml_parser.cpp
|
||||||
patches/Titanium.cpp
|
platform.cpp
|
||||||
patches/Underfoot.cpp
|
patches/client62.cpp
|
||||||
SocketLib/Base64.cpp
|
patches/patches.cpp
|
||||||
SocketLib/File.cpp
|
patches/sod.cpp
|
||||||
SocketLib/HttpdCookies.cpp
|
patches/sof.cpp
|
||||||
SocketLib/HttpdForm.cpp
|
patches/rof.cpp
|
||||||
SocketLib/HttpdSocket.cpp
|
patches/titanium.cpp
|
||||||
SocketLib/HTTPSocket.cpp
|
patches/underfoot.cpp
|
||||||
SocketLib/MemFile.cpp
|
SocketLib/Base64.cpp
|
||||||
SocketLib/Mime.cpp
|
SocketLib/File.cpp
|
||||||
SocketLib/Parse.cpp
|
SocketLib/HttpdCookies.cpp
|
||||||
SocketLib/socket_include.cpp
|
SocketLib/HttpdForm.cpp
|
||||||
SocketLib/Utility.cpp
|
SocketLib/HttpdSocket.cpp
|
||||||
StackWalker/StackWalker.cpp
|
SocketLib/HTTPSocket.cpp
|
||||||
tinyxml/tinystr.cpp
|
SocketLib/MemFile.cpp
|
||||||
tinyxml/tinyxml.cpp
|
SocketLib/Mime.cpp
|
||||||
tinyxml/tinyxmlerror.cpp
|
SocketLib/Parse.cpp
|
||||||
tinyxml/tinyxmlparser.cpp
|
SocketLib/socket_include.cpp
|
||||||
|
SocketLib/Utility.cpp
|
||||||
|
StackWalker/StackWalker.cpp
|
||||||
|
tinyxml/tinystr.cpp
|
||||||
|
tinyxml/tinyxml.cpp
|
||||||
|
tinyxml/tinyxmlerror.cpp
|
||||||
|
tinyxml/tinyxmlparser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(common_headers
|
SET(common_headers
|
||||||
BasePacket.h
|
any.h
|
||||||
bodytypes.h
|
base_packet.h
|
||||||
breakdowns.h
|
base_data.h
|
||||||
classes.h
|
bodytypes.h
|
||||||
common_profile.h
|
breakdowns.h
|
||||||
Condition.h
|
classes.h
|
||||||
crash.h
|
condition.h
|
||||||
CRC16.h
|
crash.h
|
||||||
crc32.h
|
crc16.h
|
||||||
database.h
|
crc32.h
|
||||||
dbasync.h
|
database.h
|
||||||
dbcore.h
|
dbasync.h
|
||||||
DBMemLeak.h
|
dbcore.h
|
||||||
debug.h
|
debug.h
|
||||||
deity.h
|
deity.h
|
||||||
emu_opcodes.h
|
emu_opcodes.h
|
||||||
emu_oplist.h
|
emu_oplist.h
|
||||||
EMuShareMem.h
|
emu_tcp_connection.h
|
||||||
EmuTCPConnection.h
|
emu_tcp_server.h
|
||||||
EmuTCPServer.h
|
eq_constants.h
|
||||||
eq_constants.h
|
eq_dictionary.h
|
||||||
eq_opcodes.h
|
eq_packet_structs.h
|
||||||
eq_packet_structs.h
|
eqdb.h
|
||||||
EQDB.h
|
eqdb_res.h
|
||||||
EQDBRes.h
|
eqemu_exception.h
|
||||||
EQEmuConfig.h
|
eqemu_config.h
|
||||||
EQEmuConfig_elements.h
|
eqemu_config_elements.h
|
||||||
EQEMuError.h
|
eqemu_error.h
|
||||||
EQPacket.h
|
eq_packet.h
|
||||||
EQStream.h
|
eq_stream.h
|
||||||
EQStreamFactory.h
|
eq_stream_factory.h
|
||||||
EQStreamIdent.h
|
eq_stream_ident.h
|
||||||
EQStreamIntf.h
|
eq_stream_intf.h
|
||||||
EQStreamLocator.h
|
eq_stream_locator.h
|
||||||
EQStreamProxy.h
|
eq_stream_proxy.h
|
||||||
EQStreamType.h
|
eq_stream_type.h
|
||||||
eqtime.h
|
eqtime.h
|
||||||
errmsg.h
|
errmsg.h
|
||||||
extprofile.h
|
extprofile.h
|
||||||
guild_base.h
|
faction.h
|
||||||
guilds.h
|
features.h
|
||||||
Item.h
|
fixed_memory_hash_set.h
|
||||||
item_fieldlist.h
|
fixed_memory_variable_hash_set.h
|
||||||
item_struct.h
|
guild_base.h
|
||||||
languages.h
|
guilds.h
|
||||||
linked_list.h
|
ipc_mutex.h
|
||||||
logsys.h
|
item.h
|
||||||
logtypes.h
|
item_fieldlist.h
|
||||||
mail_oplist.h
|
item_struct.h
|
||||||
md5.h
|
languages.h
|
||||||
misc.h
|
linked_list.h
|
||||||
MiscFunctions.h
|
logsys.h
|
||||||
moremath.h
|
logtypes.h
|
||||||
Mutex.h
|
loottable.h
|
||||||
op_codes.h
|
mail_oplist.h
|
||||||
opcode_dispatch.h
|
md5.h
|
||||||
opcodemgr.h
|
memory_mapped_file.h
|
||||||
packet_dump.h
|
misc.h
|
||||||
packet_dump_file.h
|
misc_functions.h
|
||||||
packet_functions.h
|
moremath.h
|
||||||
ProcLauncher.h
|
mutex.h
|
||||||
profiler.h
|
mysql_request_result.h
|
||||||
ptimer.h
|
mysql_request_row.h
|
||||||
queue.h
|
op_codes.h
|
||||||
races.h
|
opcode_dispatch.h
|
||||||
rdtsc.h
|
opcodemgr.h
|
||||||
rulesys.h
|
packet_dump.h
|
||||||
ruletypes.h
|
packet_dump_file.h
|
||||||
seperator.h
|
packet_functions.h
|
||||||
serverinfo.h
|
platform.h
|
||||||
servertalk.h
|
proc_launcher.h
|
||||||
shareddb.h
|
profiler.h
|
||||||
SharedLibrary.h
|
ptimer.h
|
||||||
skills.h
|
queue.h
|
||||||
StructStrategy.h
|
races.h
|
||||||
TCPBasicServer.h
|
rdtsc.h
|
||||||
TCPConnection.h
|
rulesys.h
|
||||||
TCPServer.h
|
ruletypes.h
|
||||||
timeoutmgr.h
|
seperator.h
|
||||||
timer.h
|
serverinfo.h
|
||||||
types.h
|
servertalk.h
|
||||||
unix.h
|
shareddb.h
|
||||||
useperl.h
|
skills.h
|
||||||
version.h
|
spdat.h
|
||||||
worldconn.h
|
string_util.h
|
||||||
XMLParser.h
|
struct_strategy.h
|
||||||
ZoneNumbers.h
|
tcp_basic_server.h
|
||||||
platform.h
|
tcp_connection.h
|
||||||
patches/Client62.h
|
tcp_server.h
|
||||||
patches/Client62_itemfields.h
|
timeoutmgr.h
|
||||||
patches/Client62_ops.h
|
timer.h
|
||||||
patches/Client62_structs.h
|
types.h
|
||||||
patches/patches.h
|
unix.h
|
||||||
patches/SoD.h
|
useperl.h
|
||||||
patches/SoD_itemfields.h
|
version.h
|
||||||
patches/SoD_ops.h
|
worldconn.h
|
||||||
patches/SoD_structs.h
|
xml_parser.h
|
||||||
patches/SoF.h
|
zone_numbers.h
|
||||||
patches/SoF_itemfields.h
|
patches/client62.h
|
||||||
patches/SoF_opcode_list.h
|
patches/client62_constants.h
|
||||||
patches/SoF_ops.h
|
patches/client62_itemfields.h
|
||||||
patches/SoF_structs.h
|
patches/client62_ops.h
|
||||||
patches/SSDeclare.h
|
patches/client62_structs.h
|
||||||
patches/SSDefine.h
|
patches/patches.h
|
||||||
patches/SSRegister.h
|
patches/sod.h
|
||||||
patches/RoF.h
|
patches/sod_constants.h
|
||||||
patches/RoF_itemfields.h
|
patches/sod_itemfields.h
|
||||||
patches/RoF_ops.h
|
patches/sod_ops.h
|
||||||
patches/RoF_structs.h
|
patches/sod_structs.h
|
||||||
patches/Titanium.h
|
patches/sof.h
|
||||||
patches/Titanium_itemfields.h
|
patches/sof_constants.h
|
||||||
patches/Titanium_ops.h
|
patches/sof_itemfields.h
|
||||||
patches/Titanium_structs.h
|
patches/sof_opcode_list.h
|
||||||
patches/Underfoot.h
|
patches/sof_ops.h
|
||||||
patches/Underfoot_itemfields.h
|
patches/sof_structs.h
|
||||||
patches/Underfoot_ops.h
|
patches/ss_declare.h
|
||||||
patches/Underfoot_structs.h
|
patches/ss_define.h
|
||||||
SocketLib/Base64.h
|
patches/ss_register.h
|
||||||
SocketLib/File.h
|
patches/rof.h
|
||||||
SocketLib/HttpdCookies.h
|
patches/rof_constants.h
|
||||||
SocketLib/HttpdForm.h
|
patches/rof_itemfields.h
|
||||||
SocketLib/HttpdSocket.h
|
patches/rof_ops.h
|
||||||
SocketLib/HTTPSocket.h
|
patches/rof_structs.h
|
||||||
SocketLib/IFile.h
|
patches/titanium.h
|
||||||
SocketLib/MemFile.h
|
patches/titanium_constants.h
|
||||||
SocketLib/Mime.h
|
patches/titanium_itemfields.h
|
||||||
SocketLib/Parse.h
|
patches/titanium_ops.h
|
||||||
SocketLib/socket_include.h
|
patches/titanium_structs.h
|
||||||
SocketLib/Utility.h
|
patches/underfoot.h
|
||||||
StackWalker/StackWalker.h
|
patches/underfoot_constants.h
|
||||||
tinyxml/tinystr.h
|
patches/underfoot_itemfields.h
|
||||||
tinyxml/tinyxml.h
|
patches/underfoot_ops.h
|
||||||
|
patches/underfoot_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
|
||||||
|
tinyxml/tinystr.h
|
||||||
|
tinyxml/tinyxml.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Patches FILES
|
SOURCE_GROUP(Patches FILES
|
||||||
patches/Client62.h
|
patches/client62.h
|
||||||
patches/Client62_itemfields.h
|
patches/client62_itemfields.h
|
||||||
patches/Client62_ops.h
|
patches/client62_ops.h
|
||||||
patches/Client62_structs.h
|
patches/client62_constants.h
|
||||||
patches/patches.h
|
patches/client62_structs.h
|
||||||
patches/SoD.h
|
patches/patches.h
|
||||||
patches/SoD_itemfields.h
|
patches/sod.h
|
||||||
patches/SoD_ops.h
|
patches/sod_itemfields.h
|
||||||
patches/SoD_structs.h
|
patches/sod_ops.h
|
||||||
patches/SoF.h
|
patches/sod_constants.h
|
||||||
patches/SoF_itemfields.h
|
patches/sod_structs.h
|
||||||
patches/SoF_opcode_list.h
|
patches/sof.h
|
||||||
patches/SoF_ops.h
|
patches/sof_itemfields.h
|
||||||
patches/SoF_structs.h
|
patches/sof_opcode_list.h
|
||||||
patches/SSDeclare.h
|
patches/sof_ops.h
|
||||||
patches/SSDefine.h
|
patches/sof_constants.h
|
||||||
patches/SSRegister.h
|
patches/sof_structs.h
|
||||||
patches/RoF.h
|
patches/ss_declare.h
|
||||||
patches/RoF_itemfields.h
|
patches/ss_define.h
|
||||||
patches/RoF_ops.h
|
patches/ss_register.h
|
||||||
patches/RoF_structs.h
|
patches/rof.h
|
||||||
patches/Titanium.h
|
patches/rof_itemfields.h
|
||||||
patches/Titanium_itemfields.h
|
patches/rof_ops.h
|
||||||
patches/Titanium_ops.h
|
patches/rof_constants.h
|
||||||
patches/Titanium_structs.h
|
patches/rof_structs.h
|
||||||
patches/Underfoot.h
|
patches/titanium.h
|
||||||
patches/Underfoot_itemfields.h
|
patches/titanium_itemfields.h
|
||||||
patches/Underfoot_ops.h
|
patches/titanium_ops.h
|
||||||
patches/Underfoot_structs.h
|
patches/titanium_constants.h
|
||||||
patches/Client62.cpp
|
patches/titanium_structs.h
|
||||||
patches/patches.cpp
|
patches/underfoot.h
|
||||||
patches/SoD.cpp
|
patches/underfoot_itemfields.h
|
||||||
patches/SoF.cpp
|
patches/underfoot_ops.h
|
||||||
patches/RoF.cpp
|
patches/underfoot_constants.h
|
||||||
patches/Titanium.cpp
|
patches/underfoot_structs.h
|
||||||
patches/Underfoot.cpp
|
patches/client62.cpp
|
||||||
|
patches/patches.cpp
|
||||||
|
patches/sod.cpp
|
||||||
|
patches/sof.cpp
|
||||||
|
patches/rof.cpp
|
||||||
|
patches/titanium.cpp
|
||||||
|
patches/underfoot.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(SocketLib FILES
|
SOURCE_GROUP(SocketLib FILES
|
||||||
SocketLib/Base64.h
|
SocketLib/Base64.h
|
||||||
SocketLib/File.h
|
SocketLib/File.h
|
||||||
SocketLib/HttpdCookies.h
|
SocketLib/HttpdCookies.h
|
||||||
SocketLib/HttpdForm.h
|
SocketLib/HttpdForm.h
|
||||||
SocketLib/HttpdSocket.h
|
SocketLib/HttpdSocket.h
|
||||||
SocketLib/HTTPSocket.h
|
SocketLib/HTTPSocket.h
|
||||||
SocketLib/IFile.h
|
SocketLib/IFile.h
|
||||||
SocketLib/MemFile.h
|
SocketLib/MemFile.h
|
||||||
SocketLib/Mime.h
|
SocketLib/Mime.h
|
||||||
SocketLib/Parse.h
|
SocketLib/Parse.h
|
||||||
SocketLib/socket_include.h
|
SocketLib/socket_include.h
|
||||||
SocketLib/Utility.h
|
SocketLib/Utility.h
|
||||||
SocketLib/Base64.cpp
|
SocketLib/Base64.cpp
|
||||||
SocketLib/File.cpp
|
SocketLib/File.cpp
|
||||||
SocketLib/HttpdCookies.cpp
|
SocketLib/HttpdCookies.cpp
|
||||||
SocketLib/HttpdForm.cpp
|
SocketLib/HttpdForm.cpp
|
||||||
SocketLib/HttpdSocket.cpp
|
SocketLib/HttpdSocket.cpp
|
||||||
SocketLib/HTTPSocket.cpp
|
SocketLib/HTTPSocket.cpp
|
||||||
SocketLib/MemFile.cpp
|
SocketLib/MemFile.cpp
|
||||||
SocketLib/Mime.cpp
|
SocketLib/Mime.cpp
|
||||||
SocketLib/Parse.cpp
|
SocketLib/Parse.cpp
|
||||||
SocketLib/socket_include.cpp
|
SocketLib/socket_include.cpp
|
||||||
SocketLib/Utility.cpp
|
SocketLib/Utility.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(StackWalker FILES
|
SOURCE_GROUP(StackWalker FILES
|
||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
StackWalker/StackWalker.cpp
|
StackWalker/StackWalker.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(TinyXML FILES
|
SOURCE_GROUP(TinyXML FILES
|
||||||
tinyxml/tinystr.h
|
tinyxml/tinystr.h
|
||||||
tinyxml/tinyxml.h
|
tinyxml/tinyxml.h
|
||||||
tinyxml/tinystr.cpp
|
tinyxml/tinystr.cpp
|
||||||
tinyxml/tinyxml.cpp
|
tinyxml/tinyxml.cpp
|
||||||
tinyxml/tinyxmlerror.cpp
|
tinyxml/tinyxmlerror.cpp
|
||||||
tinyxml/tinyxmlparser.cpp
|
tinyxml/tinyxmlparser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
ADD_DEFINITIONS(-fPIC)
|
||||||
SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ../Bin)
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@@ -1,346 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
unsigned long IntArray[]={
|
|
||||||
0x00000000,
|
|
||||||
0x77073096,
|
|
||||||
0xEE0E612C,
|
|
||||||
0x990951BA,
|
|
||||||
0x076DC419,
|
|
||||||
0x706AF48F,
|
|
||||||
0xE963A535,
|
|
||||||
0x9E6495A3,
|
|
||||||
0x0EDB8832,
|
|
||||||
0x79DCB8A4,
|
|
||||||
0xE0D5E91E,
|
|
||||||
0x97D2D988,
|
|
||||||
0x09B64C2B,
|
|
||||||
0x7EB17CBD,
|
|
||||||
0xE7B82D07,
|
|
||||||
0x90BF1D91,
|
|
||||||
0x1DB71064,
|
|
||||||
0x6AB020F2,
|
|
||||||
0xF3B97148,
|
|
||||||
0x84BE41DE,
|
|
||||||
0x1ADAD47D,
|
|
||||||
0x6DDDE4EB,
|
|
||||||
0xF4D4B551,
|
|
||||||
0x83D385C7,
|
|
||||||
0x136C9856,
|
|
||||||
0x646BA8C0,
|
|
||||||
0xFD62F97A,
|
|
||||||
0x8A65C9EC,
|
|
||||||
0x14015C4F,
|
|
||||||
0x63066CD9,
|
|
||||||
0xFA0F3D63,
|
|
||||||
0x8D080DF5,
|
|
||||||
0x3B6E20C8,
|
|
||||||
0x4C69105E,
|
|
||||||
0xD56041E4,
|
|
||||||
0xA2677172,
|
|
||||||
0x3C03E4D1,
|
|
||||||
0x4B04D447,
|
|
||||||
0xD20D85FD,
|
|
||||||
0xA50AB56B,
|
|
||||||
0x35B5A8FA,
|
|
||||||
0x42B2986C,
|
|
||||||
0xDBBBC9D6,
|
|
||||||
0xACBCF940,
|
|
||||||
0x32D86CE3,
|
|
||||||
0x45DF5C75,
|
|
||||||
0xDCD60DCF,
|
|
||||||
0xABD13D59,
|
|
||||||
0x26D930AC,
|
|
||||||
0x51DE003A,
|
|
||||||
0xC8D75180,
|
|
||||||
0xBFD06116,
|
|
||||||
0x21B4F4B5,
|
|
||||||
0x56B3C423,
|
|
||||||
0xCFBA9599,
|
|
||||||
0xB8BDA50F,
|
|
||||||
0x2802B89E,
|
|
||||||
0x5F058808,
|
|
||||||
0xC60CD9B2,
|
|
||||||
0xB10BE924,
|
|
||||||
0x2F6F7C87,
|
|
||||||
0x58684C11,
|
|
||||||
0xC1611DAB,
|
|
||||||
0xB6662D3D,
|
|
||||||
0x76DC4190,
|
|
||||||
0x01DB7106,
|
|
||||||
0x98D220BC,
|
|
||||||
0xEFD5102A,
|
|
||||||
0x71B18589,
|
|
||||||
0x06B6B51F,
|
|
||||||
0x9FBFE4A5,
|
|
||||||
0xE8B8D433,
|
|
||||||
0x7807C9A2,
|
|
||||||
0x0F00F934,
|
|
||||||
0x9609A88E,
|
|
||||||
0xE10E9818,
|
|
||||||
0x7F6A0DBB,
|
|
||||||
0x086D3D2D,
|
|
||||||
0x91646C97,
|
|
||||||
0xE6635C01,
|
|
||||||
0x6B6B51F4,
|
|
||||||
0x1C6C6162,
|
|
||||||
0x856530D8,
|
|
||||||
0xF262004E,
|
|
||||||
0x6C0695ED,
|
|
||||||
0x1B01A57B,
|
|
||||||
0x8208F4C1,
|
|
||||||
0xF50FC457,
|
|
||||||
0x65B0D9C6,
|
|
||||||
0x12B7E950,
|
|
||||||
0x8BBEB8EA,
|
|
||||||
0xFCB9887C,
|
|
||||||
0x62DD1DDF,
|
|
||||||
0x15DA2D49,
|
|
||||||
0x8CD37CF3,
|
|
||||||
0xFBD44C65,
|
|
||||||
0x4DB26158,
|
|
||||||
0x3AB551CE,
|
|
||||||
0xA3BC0074,
|
|
||||||
0xD4BB30E2,
|
|
||||||
0x4ADFA541,
|
|
||||||
0x3DD895D7,
|
|
||||||
0xA4D1C46D,
|
|
||||||
0xD3D6F4FB,
|
|
||||||
0x4369E96A,
|
|
||||||
0x346ED9FC,
|
|
||||||
0xAD678846,
|
|
||||||
0xDA60B8D0,
|
|
||||||
0x44042D73,
|
|
||||||
0x33031DE5,
|
|
||||||
0xAA0A4C5F,
|
|
||||||
0xDD0D7CC9,
|
|
||||||
0x5005713C,
|
|
||||||
0x270241AA,
|
|
||||||
0xBE0B1010,
|
|
||||||
0xC90C2086,
|
|
||||||
0x5768B525,
|
|
||||||
0x206F85B3,
|
|
||||||
0xB966D409,
|
|
||||||
0xCE61E49F,
|
|
||||||
0x5EDEF90E,
|
|
||||||
0x29D9C998,
|
|
||||||
0xB0D09822,
|
|
||||||
0xC7D7A8B4,
|
|
||||||
0x59B33D17,
|
|
||||||
0x2EB40D81,
|
|
||||||
0xB7BD5C3B,
|
|
||||||
0xC0BA6CAD,
|
|
||||||
0xEDB88320,
|
|
||||||
0x9ABFB3B6,
|
|
||||||
0x03B6E20C,
|
|
||||||
0x74B1D29A,
|
|
||||||
0xEAD54739,
|
|
||||||
0x9DD277AF,
|
|
||||||
0x04DB2615,
|
|
||||||
0x73DC1683,
|
|
||||||
0xE3630B12,
|
|
||||||
0x94643B84,
|
|
||||||
0x0D6D6A3E,
|
|
||||||
0x7A6A5AA8,
|
|
||||||
0xE40ECF0B,
|
|
||||||
0x9309FF9D,
|
|
||||||
0x0A00AE27,
|
|
||||||
0x7D079EB1,
|
|
||||||
0xF00F9344,
|
|
||||||
0x8708A3D2,
|
|
||||||
0x1E01F268,
|
|
||||||
0x6906C2FE,
|
|
||||||
0xF762575D,
|
|
||||||
0x806567CB,
|
|
||||||
0x196C3671,
|
|
||||||
0x6E6B06E7,
|
|
||||||
0xFED41B76,
|
|
||||||
0x89D32BE0,
|
|
||||||
0x10DA7A5A,
|
|
||||||
0x67DD4ACC,
|
|
||||||
0xF9B9DF6F,
|
|
||||||
0x8EBEEFF9,
|
|
||||||
0x17B7BE43,
|
|
||||||
0x60B08ED5,
|
|
||||||
0xD6D6A3E8,
|
|
||||||
0xA1D1937E,
|
|
||||||
0x38D8C2C4,
|
|
||||||
0x4FDFF252,
|
|
||||||
0xD1BB67F1,
|
|
||||||
0xA6BC5767,
|
|
||||||
0x3FB506DD,
|
|
||||||
0x48B2364B,
|
|
||||||
0xD80D2BDA,
|
|
||||||
0xAF0A1B4C,
|
|
||||||
0x36034AF6,
|
|
||||||
0x41047A60,
|
|
||||||
0xDF60EFC3,
|
|
||||||
0xA867DF55,
|
|
||||||
0x316E8EEF,
|
|
||||||
0x4669BE79,
|
|
||||||
0xCB61B38C,
|
|
||||||
0xBC66831A,
|
|
||||||
0x256FD2A0,
|
|
||||||
0x5268E236,
|
|
||||||
0xCC0C7795,
|
|
||||||
0xBB0B4703,
|
|
||||||
0x220216B9,
|
|
||||||
0x5505262F,
|
|
||||||
0xC5BA3BBE,
|
|
||||||
0xB2BD0B28,
|
|
||||||
0x2BB45A92,
|
|
||||||
0x5CB36A04,
|
|
||||||
0xC2D7FFA7,
|
|
||||||
0xB5D0CF31,
|
|
||||||
0x2CD99E8B,
|
|
||||||
0x5BDEAE1D,
|
|
||||||
0x9B64C2B0,
|
|
||||||
0xEC63F226,
|
|
||||||
0x756AA39C,
|
|
||||||
0x026D930A,
|
|
||||||
0x9C0906A9,
|
|
||||||
0xEB0E363F,
|
|
||||||
0x72076785,
|
|
||||||
0x05005713,
|
|
||||||
0x95BF4A82,
|
|
||||||
0xE2B87A14,
|
|
||||||
0x7BB12BAE,
|
|
||||||
0x0CB61B38,
|
|
||||||
0x92D28E9B,
|
|
||||||
0xE5D5BE0D,
|
|
||||||
0x7CDCEFB7,
|
|
||||||
0x0BDBDF21,
|
|
||||||
0x86D3D2D4,
|
|
||||||
0xF1D4E242,
|
|
||||||
0x68DDB3F8,
|
|
||||||
0x1FDA836E,
|
|
||||||
0x81BE16CD,
|
|
||||||
0xF6B9265B,
|
|
||||||
0x6FB077E1,
|
|
||||||
0x18B74777,
|
|
||||||
0x88085AE6,
|
|
||||||
0xFF0F6A70,
|
|
||||||
0x66063BCA,
|
|
||||||
0x11010B5C,
|
|
||||||
0x8F659EFF,
|
|
||||||
0xF862AE69,
|
|
||||||
0x616BFFD3,
|
|
||||||
0x166CCF45,
|
|
||||||
0xA00AE278,
|
|
||||||
0xD70DD2EE,
|
|
||||||
0x4E048354,
|
|
||||||
0x3903B3C2,
|
|
||||||
0xA7672661,
|
|
||||||
0xD06016F7,
|
|
||||||
0x4969474D,
|
|
||||||
0x3E6E77DB,
|
|
||||||
0xAED16A4A,
|
|
||||||
0xD9D65ADC,
|
|
||||||
0x40DF0B66,
|
|
||||||
0x37D83BF0,
|
|
||||||
0xA9BCAE53,
|
|
||||||
0xDEBB9EC5,
|
|
||||||
0x47B2CF7F,
|
|
||||||
0x30B5FFE9,
|
|
||||||
0xBDBDF21C,
|
|
||||||
0xCABAC28A,
|
|
||||||
0x53B39330,
|
|
||||||
0x24B4A3A6,
|
|
||||||
0xBAD03605,
|
|
||||||
0xCDD70693,
|
|
||||||
0x54DE5729,
|
|
||||||
0x23D967BF,
|
|
||||||
0xB3667A2E,
|
|
||||||
0xC4614AB8,
|
|
||||||
0x5D681B02,
|
|
||||||
0x2A6F2B94,
|
|
||||||
0xB40BBE37,
|
|
||||||
0xC30C8EA1,
|
|
||||||
0x5A05DF1B,
|
|
||||||
0x2D02EF8D,
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned long CRC16(const unsigned char *buf, int size, int key)
|
|
||||||
{
|
|
||||||
|
|
||||||
//printf("CRC16() key=%d\n",key);
|
|
||||||
/*
|
|
||||||
sub_0_10020760 proc near ; CODE XREF: sub_0_10008620+AEp
|
|
||||||
; sub_0_10022A90+14Fp ...
|
|
||||||
|
|
||||||
arg_0 = dword ptr 4
|
|
||||||
arg_4 = dword ptr 8
|
|
||||||
arg_8 = dword ptr 0Ch
|
|
||||||
*/
|
|
||||||
|
|
||||||
//int *pecx = buf;
|
|
||||||
unsigned long ecx = key; //mov ecx, [esp+arg_8]
|
|
||||||
unsigned long eax = ecx; //mov eax, ecx
|
|
||||||
unsigned long edi;
|
|
||||||
/* int ecx = key; //mov ecx, [esp+arg_8]
|
|
||||||
int eax = ecx; //mov eax, ecx
|
|
||||||
int edi;
|
|
||||||
*/
|
|
||||||
eax = ~ eax; //not eax
|
|
||||||
eax&=0xFF; //and eax, 0FFh
|
|
||||||
eax=IntArray[eax]; //mov eax, dword_0_10115D38[eax*4] IntArray
|
|
||||||
eax ^= 0x00FFFFFF; //xor eax, 0FFFFFFh
|
|
||||||
int edx = ecx; //mov edx, ecx
|
|
||||||
edx = edx >> 8; //sar edx, 8
|
|
||||||
edx = edx ^ eax; //xor edx, eax
|
|
||||||
eax = eax >> 8; //sar eax, 8
|
|
||||||
edx &= 0xFF; //and edx, 0FFh
|
|
||||||
eax &= 0x00FFFFFF; //and eax, 0FFFFFFh
|
|
||||||
//push esi
|
|
||||||
eax ^= IntArray[edx]; //xor eax, dword_0_10115D38[edx*4]
|
|
||||||
edx = ecx; //mov edx, ecx
|
|
||||||
edx = edx >> 0x10; //sar edx, 10h
|
|
||||||
edx ^= eax; //xor edx, eax
|
|
||||||
eax = eax >> 8; //sar eax, 8
|
|
||||||
edx &= 0xFF; //and edx, 0FFh
|
|
||||||
int esi = IntArray[edx]; //mov esi, dword_0_10115D38[edx*4]
|
|
||||||
edx = size; //mov edx, [esp+4+arg_4]
|
|
||||||
eax &= 0x00FFFFFF; //and eax, 0FFFFFFh
|
|
||||||
eax ^= esi; //xor eax, esi
|
|
||||||
ecx = ecx >> 0x18; //sar ecx, 18h
|
|
||||||
ecx ^= eax; //xor ecx, eax
|
|
||||||
ecx &= 0xFF; //and ecx, 0FFh
|
|
||||||
esi = IntArray[ecx]; //mov esi, dword_0_10115D38[ecx*4]
|
|
||||||
/*ecx = (int) buf; not used */ //mov ecx, [esp+4+arg_0]
|
|
||||||
eax = eax >> 8; //sar eax, 8
|
|
||||||
eax &= 0x00FFFFFF; //and eax, 0FFFFFFh
|
|
||||||
eax ^= esi; //xor eax, esi
|
|
||||||
/* int* esi = ecx+edx //??*///lea esi, [ecx+edx]
|
|
||||||
for(int x = 0; x < size; x++)
|
|
||||||
{ //eax is the crc, ecx is the current part of the buffer
|
|
||||||
int edx = 0; //xor edx, edx
|
|
||||||
edx = buf[x] & 0x00FF; //mov dl, [ecx]
|
|
||||||
|
|
||||||
/*if(pos > size) //cmp ecx, esi
|
|
||||||
return ~eax; //jnb short loc_0_10020803
|
|
||||||
*/
|
|
||||||
//push edi
|
|
||||||
|
|
||||||
//loc_0_100207E0: ; CODE XREF: sub_0_10020760+A0j
|
|
||||||
//LOOP
|
|
||||||
edx ^= eax; //xor edx, eax
|
|
||||||
eax = eax >> 8; //sar eax, 8
|
|
||||||
edx &= 0xFF; //and edx, 0FFh
|
|
||||||
edi = IntArray[edx]; //mov edi, dword_0_10115D38[edx*4]
|
|
||||||
eax &= 0x00FFFFFF; //and eax, 0FFFFFFh
|
|
||||||
eax ^= edi; //xor eax, edi
|
|
||||||
//inc ecx
|
|
||||||
//cmp ecx, esi
|
|
||||||
// jb short loc_0_100207E0
|
|
||||||
//pop edi
|
|
||||||
}
|
|
||||||
|
|
||||||
return ~eax;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*loc_0_10020803: ; CODE XREF: sub_0_10020760+7Dj
|
|
||||||
not eax
|
|
||||||
pop esi
|
|
||||||
retn
|
|
||||||
sub_0_10020760 endp
|
|
||||||
|
|
||||||
*/
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef _CRC16_H
|
|
||||||
#define _CRC16_H
|
|
||||||
|
|
||||||
unsigned long CRC16(const unsigned char *buf, int size, int key);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,153 +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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
#include "Condition.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#else
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
|
|
||||||
|
|
||||||
Condition::Condition()
|
|
||||||
{
|
|
||||||
m_events[SignalEvent] = CreateEvent (NULL, // security
|
|
||||||
FALSE, // is auto-reset event?
|
|
||||||
FALSE, // is signaled initially?
|
|
||||||
NULL); // name
|
|
||||||
m_events[BroadcastEvent] = CreateEvent (NULL, // security
|
|
||||||
TRUE, // is auto-reset event?
|
|
||||||
FALSE, // is signaled initially?
|
|
||||||
NULL); // name
|
|
||||||
m_waiters = 0;
|
|
||||||
InitializeCriticalSection(&CSMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
Condition::~Condition()
|
|
||||||
{
|
|
||||||
DeleteCriticalSection(&CSMutex);
|
|
||||||
CloseHandle(m_events[SignalEvent]);
|
|
||||||
CloseHandle(m_events[BroadcastEvent]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::Signal()
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&CSMutex);
|
|
||||||
if(m_waiters > 0)
|
|
||||||
SetEvent(m_events[SignalEvent]);
|
|
||||||
LeaveCriticalSection(&CSMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::SignalAll()
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&CSMutex);
|
|
||||||
if(m_waiters > 0)
|
|
||||||
SetEvent(m_events[BroadcastEvent]);
|
|
||||||
LeaveCriticalSection(&CSMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::Wait()
|
|
||||||
{
|
|
||||||
EnterCriticalSection(&CSMutex);
|
|
||||||
|
|
||||||
m_waiters++;
|
|
||||||
|
|
||||||
|
|
||||||
LeaveCriticalSection(&CSMutex);
|
|
||||||
int result = WaitForMultipleObjects (_eventCount, m_events, FALSE, INFINITE);
|
|
||||||
EnterCriticalSection(&CSMutex);
|
|
||||||
|
|
||||||
m_waiters--;
|
|
||||||
|
|
||||||
//see if we are the last person waiting on the condition, and there was a broadcast
|
|
||||||
//if so, we need to reset the broadcast event.
|
|
||||||
if(m_waiters == 0 && result == (WAIT_OBJECT_0+BroadcastEvent))
|
|
||||||
ResetEvent(m_events[BroadcastEvent]);
|
|
||||||
|
|
||||||
LeaveCriticalSection(&CSMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#else //!WIN32
|
|
||||||
|
|
||||||
Condition::Condition()
|
|
||||||
{
|
|
||||||
pthread_cond_init(&cond,NULL);
|
|
||||||
pthread_mutex_init(&mutex,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::Signal()
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
pthread_cond_signal(&cond);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::SignalAll()
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
pthread_cond_broadcast(&cond);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Condition::Wait()
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
pthread_cond_wait(&cond,&mutex);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
I commented this specifically because I think it might be very
|
|
||||||
difficult to write a windows counterpart to it, so I would like
|
|
||||||
to discourage its use until we can confirm that it can be reasonably
|
|
||||||
implemented on windows.
|
|
||||||
|
|
||||||
bool Condition::TimedWait(unsigned long usec)
|
|
||||||
{
|
|
||||||
struct timeval now;
|
|
||||||
struct timespec timeout;
|
|
||||||
int retcode=0;
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
gettimeofday(&now,NULL);
|
|
||||||
now.tv_usec+=usec;
|
|
||||||
timeout.tv_sec = now.tv_sec + (now.tv_usec/1000000);
|
|
||||||
timeout.tv_nsec = (now.tv_usec%1000000) *1000;
|
|
||||||
//cout << "now=" << now.tv_sec << "."<<now.tv_usec << endl;
|
|
||||||
//cout << "timeout=" << timeout.tv_sec << "."<<timeout.tv_nsec << endl;
|
|
||||||
retcode=pthread_cond_timedwait(&cond,&mutex,&timeout);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
|
|
||||||
return retcode!=ETIMEDOUT;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Condition::~Condition()
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
pthread_cond_destroy(&cond);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
pthread_mutex_destroy(&mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,56 +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
|
|
||||||
*/
|
|
||||||
#ifndef __CONDITION_H
|
|
||||||
#define __CONDITION_H
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Sombody, someday needs to figure out how to implement a condition
|
|
||||||
//system on windows...
|
|
||||||
|
|
||||||
|
|
||||||
class Condition {
|
|
||||||
private:
|
|
||||||
#ifdef WIN32
|
|
||||||
enum {
|
|
||||||
SignalEvent = 0,
|
|
||||||
BroadcastEvent,
|
|
||||||
_eventCount
|
|
||||||
};
|
|
||||||
|
|
||||||
HANDLE m_events[_eventCount];
|
|
||||||
uint32 m_waiters;
|
|
||||||
CRITICAL_SECTION CSMutex;
|
|
||||||
#else
|
|
||||||
pthread_cond_t cond;
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
#endif
|
|
||||||
public:
|
|
||||||
Condition();
|
|
||||||
void Signal();
|
|
||||||
void SignalAll();
|
|
||||||
void Wait();
|
|
||||||
// bool TimedWait(unsigned long usec);
|
|
||||||
~Condition();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#ifdef _EQDEBUG
|
|
||||||
#include "../common/debug.h"
|
|
||||||
#include <windows.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "../common/Mutex.h"
|
|
||||||
#include "DBMemLeak.h"
|
|
||||||
|
|
||||||
#include <crtdbg.h>
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DBMemLeak dbmemleak;
|
|
||||||
LinkedList<DBMemLeakStruct*>* list = 0;
|
|
||||||
Mutex MDBMemLeak;
|
|
||||||
|
|
||||||
DBMemLeak::DBMemLeak() {
|
|
||||||
list = new LinkedList<DBMemLeakStruct*>;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBMemLeak::~DBMemLeak() {
|
|
||||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
|
||||||
iterator.Reset();
|
|
||||||
while (iterator.MoreElements()) {
|
|
||||||
char tmp[200];
|
|
||||||
snprintf(tmp, sizeof(tmp) - 3, "DB Mem Leak: Block=%6d, Query=%s", iterator.GetData()->memblock, iterator.GetData()->query);
|
|
||||||
snprintf(tmp, sizeof(tmp), "%s\n", tmp);
|
|
||||||
OutputDebugString(tmp);
|
|
||||||
iterator.Advance();
|
|
||||||
}
|
|
||||||
safe_delete(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBMemLeak::Alloc(const void* result, const char* query) {
|
|
||||||
LockMutex lock(&MDBMemLeak);
|
|
||||||
long requestNumber;
|
|
||||||
uint8* tmp2 = new uint8;
|
|
||||||
_CrtIsMemoryBlock( tmp2, 1, &requestNumber, 0, 0 );
|
|
||||||
safe_delete(tmp2);
|
|
||||||
DBMemLeakStruct* tmp = (DBMemLeakStruct*) new uchar[sizeof(DBMemLeakStruct) + strlen(query) + 1];
|
|
||||||
tmp->result = result;
|
|
||||||
tmp->memblock = requestNumber;
|
|
||||||
strcpy(tmp->query, query);
|
|
||||||
list->Append(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBMemLeak::Free(const void* result) {
|
|
||||||
LockMutex lock(&MDBMemLeak);
|
|
||||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
|
||||||
iterator.Reset();
|
|
||||||
while (iterator.MoreElements()) {
|
|
||||||
if (result == iterator.GetData()->result)
|
|
||||||
iterator.RemoveCurrent();
|
|
||||||
else
|
|
||||||
iterator.Advance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#ifdef _EQDEBUG
|
|
||||||
#ifndef DBMemLeak_H
|
|
||||||
#define DBMemLeak_H
|
|
||||||
#include "../common/types.h"
|
|
||||||
#include "../common/linked_list.h"
|
|
||||||
|
|
||||||
#define mysql_free_result(r) { DBMemLeak::Free(r); mysql_free_result(r); }
|
|
||||||
|
|
||||||
struct DBMemLeakStruct {
|
|
||||||
const void* result;
|
|
||||||
uint32 memblock;
|
|
||||||
char query[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
class DBMemLeak {
|
|
||||||
public:
|
|
||||||
DBMemLeak();
|
|
||||||
~DBMemLeak();
|
|
||||||
|
|
||||||
static void Alloc(const void* result, const char* query);
|
|
||||||
static void Free(const void* result);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -1,300 +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
|
|
||||||
*/
|
|
||||||
#include "../common/debug.h"
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
#include "../common/types.h"
|
|
||||||
#include "EMuShareMem.h"
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#if (_MSC_VER < 1500)
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
|
|
||||||
#define EmuLibName "EMuShareMem"
|
|
||||||
#else
|
|
||||||
#define EmuLibName "libEMuShareMem.so"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LoadEMuShareMemDLL EMuShareMemDLL;
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
uint32 LoadEMuShareMemDLL::refCount = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LoadEMuShareMemDLL::LoadEMuShareMemDLL() {
|
|
||||||
ClearFunc();
|
|
||||||
#ifndef WIN32
|
|
||||||
refCountU();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadEMuShareMemDLL::~LoadEMuShareMemDLL() {
|
|
||||||
#ifndef WIN32
|
|
||||||
if (refCountD() <= 0) {
|
|
||||||
#endif
|
|
||||||
Unload();
|
|
||||||
#ifndef WIN32
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LoadEMuShareMemDLL::Load() {
|
|
||||||
if(loaded)
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
if(!SharedLibrary::Load(EmuLibName))
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
if (Loaded()) {
|
|
||||||
Items.GetItem = (DLLFUNC_GetItem) GetSym("GetItem");
|
|
||||||
Items.IterateItems = (DLLFUNC_IterateItems) GetSym("IterateItems");
|
|
||||||
Items.cbAddItem = (DLLFUNC_AddItem) GetSym("AddItem");
|
|
||||||
Items.DLLLoadItems = (DLLFUNC_DLLLoadItems) GetSym("DLLLoadItems");
|
|
||||||
Doors.GetDoor = (DLLFUNC_GetDoor) GetSym("GetDoor");
|
|
||||||
Doors.cbAddDoor = (DLLFUNC_AddDoor) GetSym("AddDoor");
|
|
||||||
Doors.DLLLoadDoors = (DLLFUNC_DLLLoadDoors) GetSym("DLLLoadDoors");
|
|
||||||
Spells.DLLLoadSPDat = (DLLFUNC_DLLLoadSPDat) GetSym("DLLLoadSPDat");
|
|
||||||
NPCFactionList.DLLLoadNPCFactionLists = (DLLFUNC_DLLLoadNPCFactionLists) GetSym("DLLLoadNPCFactionLists");
|
|
||||||
NPCFactionList.GetNPCFactionList = (DLLFUNC_GetNPCFactionList) GetSym("GetNPCFactionList");
|
|
||||||
NPCFactionList.cbAddNPCFactionList = (DLLFUNC_AddNPCFactionList) GetSym("AddNPCFactionList");
|
|
||||||
NPCFactionList.cbSetFaction = (DLLFUNC_SetFaction) GetSym("SetNPCFaction");
|
|
||||||
Loot.DLLLoadLoot = (DLLFUNC_DLLLoadLoot) GetSym("DLLLoadLoot");
|
|
||||||
Loot.cbAddLootTable = (DLLFUNC_AddLootTable) GetSym("AddLootTable");
|
|
||||||
Loot.cbAddLootDrop = (DLLFUNC_AddLootDrop) GetSym("AddLootDrop");
|
|
||||||
Loot.GetLootTable = (DLLFUNC_GetLootTable) GetSym("GetLootTable");
|
|
||||||
Loot.GetLootDrop = (DLLFUNC_GetLootDrop) GetSym("GetLootDrop");
|
|
||||||
Opcodes.GetEQOpcode = (DLLFUNC_GetEQOpcode) GetSym("GetEQOpcode");
|
|
||||||
Opcodes.GetEmuOpcode = (DLLFUNC_GetEmuOpcode) GetSym("GetEmuOpcode");
|
|
||||||
Opcodes.SetOpcodePair = (DLLFUNC_SetOpcodePair) GetSym("SetOpcodePair");
|
|
||||||
Opcodes.DLLLoadOpcodes = (DLLFUNC_DLLLoadOpcodes) GetSym("DLLLoadOpcodes");
|
|
||||||
Opcodes.ClearEQOpcodes = (DLLFUNC_ClearEQOpcodes) GetSym("ClearEQOpcodes");
|
|
||||||
SkillCaps.LoadSkillCaps = (DLLFUNC_DLLLoadSkillCaps) GetSym("LoadSkillCaps");
|
|
||||||
SkillCaps.GetSkillCap = (DLLFUNC_GetSkillCap) GetSym("GetSkillCap");
|
|
||||||
SkillCaps.SetSkillCap = (DLLFUNC_SetSkillCap) GetSym("SetSkillCap");
|
|
||||||
SkillCaps.ClearSkillCaps = (DLLFUNC_ClearSkillCaps) GetSym("ClearSkillCaps");
|
|
||||||
SkillCaps.GetTrainLevel = (DLLFUNC_GetTrainLevel) GetSym("GetTrainLevel");
|
|
||||||
if(Items.GetItem == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Items.GetItem");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Items.IterateItems == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Items.IterateItems");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Items.cbAddItem == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Items.cbAddItem");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Items.DLLLoadItems == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Items.DLLLoadItems");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Doors.GetDoor == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Doors.GetDoor");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Doors.cbAddDoor == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Doors.cbAddDoor");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Doors.DLLLoadDoors == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Doors.DLLLoadDoors");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Spells.DLLLoadSPDat == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Spells.DLLLoadSPDat");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(NPCFactionList.DLLLoadNPCFactionLists == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach NPCFactionList.DLLLoadNPCFactionLists");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(NPCFactionList.GetNPCFactionList == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach NPCFactionList.GetNPCFactionList");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(NPCFactionList.cbAddNPCFactionList == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach NPCFactionList.cbAddNPCFactionList");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(NPCFactionList.cbSetFaction == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach NPCFactionList.cbSetFaction");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Loot.DLLLoadLoot == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Loot.DLLLoadLoot");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Loot.cbAddLootTable == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Loot.cbAddLootTable");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Loot.cbAddLootDrop == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Loot.cbAddLootDrop");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Loot.GetLootTable == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Loot.GetLootTable");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Loot.GetLootDrop == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Loot.GetLootDrop");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Opcodes.GetEQOpcode == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Opcodes.GetEQOpcode");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Opcodes.GetEmuOpcode == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Opcodes.GetEmuOpcode");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Opcodes.SetOpcodePair == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Opcodes.SetOpcodePair");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Opcodes.DLLLoadOpcodes == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Opcodes.DLLLoadOpcodes");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Opcodes.ClearEQOpcodes == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach Opcodes.ClearEQOpcodes");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillCaps.LoadSkillCaps == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach SkillCaps.LoadSkillCaps");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillCaps.GetSkillCap == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach SkillCaps.GetSkillCap");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillCaps.SetSkillCap == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach SkillCaps.SetSkillCap");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillCaps.ClearSkillCaps == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach SkillCaps.ClearSkillCaps");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SkillCaps.GetTrainLevel == NULL) {
|
|
||||||
Unload();
|
|
||||||
LogFile->write(EQEMuLog::Error, "LoadEMuShareMemDLL::Load() failed to attach SkillCaps.GetTrainLevel");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogFile->write(EQEMuLog::Status, "%s loaded", EmuLibName);
|
|
||||||
loaded = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogFile->write(EQEMuLog::Error, "%s was not loaded, but did not report an error.", EmuLibName);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadEMuShareMemDLL::Unload() {
|
|
||||||
ClearFunc();
|
|
||||||
SharedLibrary::Unload();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadEMuShareMemDLL::ClearFunc() {
|
|
||||||
Items.GetItem = 0;
|
|
||||||
Items.IterateItems = 0;
|
|
||||||
Items.cbAddItem = 0;
|
|
||||||
Items.DLLLoadItems = 0;
|
|
||||||
Doors.GetDoor = 0;
|
|
||||||
Doors.cbAddDoor = 0;
|
|
||||||
Doors.DLLLoadDoors = 0;
|
|
||||||
NPCFactionList.DLLLoadNPCFactionLists = 0;
|
|
||||||
NPCFactionList.GetNPCFactionList = 0;
|
|
||||||
NPCFactionList.cbAddNPCFactionList = 0;
|
|
||||||
NPCFactionList.cbSetFaction = 0;
|
|
||||||
Loot.DLLLoadLoot = 0;
|
|
||||||
Loot.cbAddLootTable = 0;
|
|
||||||
Loot.cbAddLootDrop = 0;
|
|
||||||
Loot.GetLootTable = 0;
|
|
||||||
Loot.GetLootDrop = 0;
|
|
||||||
Opcodes.GetEQOpcode = NULL;
|
|
||||||
Opcodes.GetEmuOpcode = NULL;
|
|
||||||
Opcodes.SetOpcodePair = NULL;
|
|
||||||
Opcodes.DLLLoadOpcodes = NULL;
|
|
||||||
Opcodes.ClearEQOpcodes = NULL;
|
|
||||||
SkillCaps.LoadSkillCaps = NULL;
|
|
||||||
SkillCaps.GetSkillCap = NULL;
|
|
||||||
SkillCaps.SetSkillCap = NULL;
|
|
||||||
SkillCaps.ClearSkillCaps = NULL;
|
|
||||||
SkillCaps.GetTrainLevel = NULL;
|
|
||||||
loaded = false;
|
|
||||||
}
|
|
||||||
@@ -1,187 +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
|
|
||||||
*/
|
|
||||||
#ifndef EMuShareMem_H
|
|
||||||
#define EMuShareMem_H
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#endif
|
|
||||||
#include "../common/eq_packet_structs.h"
|
|
||||||
#include "../zone/zonedump.h"
|
|
||||||
#include "../zone/loottable.h"
|
|
||||||
#include "SharedLibrary.h"
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Items //
|
|
||||||
///////////
|
|
||||||
typedef bool(*CALLBACK_DBLoadItems)(int32, uint32);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadItems)(const CALLBACK_DBLoadItems, uint32, int32*, uint32*);
|
|
||||||
typedef const Item_Struct*(*DLLFUNC_GetItem)(uint32);
|
|
||||||
typedef const Item_Struct*(*DLLFUNC_IterateItems)(uint32*);
|
|
||||||
typedef bool(*DLLFUNC_AddItem)(uint32, const Item_Struct*);
|
|
||||||
|
|
||||||
struct ItemsDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadItems DLLLoadItems;
|
|
||||||
DLLFUNC_GetItem GetItem;
|
|
||||||
DLLFUNC_IterateItems IterateItems;
|
|
||||||
DLLFUNC_AddItem cbAddItem;
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
typedef bool(*CALLBACK_DBLoadNPCTypes)(int32, uint32);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadNPCTypes)(const CALLBACK_DBLoadNPCTypes, uint32, int32*, uint32*);
|
|
||||||
typedef const NPCType*(*DLLFUNC_GetNPCType)(uint32);
|
|
||||||
typedef bool(*DLLFUNC_AddNPCType)(uint32, const NPCType*);
|
|
||||||
struct NPCTypesDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadNPCTypes DLLLoadNPCTypes;
|
|
||||||
DLLFUNC_GetNPCType GetNPCType;
|
|
||||||
DLLFUNC_AddNPCType cbAddNPCType;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Doors ///
|
|
||||||
////////////
|
|
||||||
typedef bool(*CALLBACK_DBLoadDoors)(int32, uint32);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadDoors)(const CALLBACK_DBLoadDoors, uint32, int32*, uint32*);
|
|
||||||
typedef const Door*(*DLLFUNC_GetDoor)(uint32);
|
|
||||||
typedef bool(*DLLFUNC_AddDoor)(uint32, const Door*);
|
|
||||||
struct DoorsDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadDoors DLLLoadDoors;
|
|
||||||
DLLFUNC_GetDoor GetDoor;
|
|
||||||
DLLFUNC_AddDoor cbAddDoor;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Spells //
|
|
||||||
////////////
|
|
||||||
typedef bool(*CALLBACK_FileLoadSPDat)(void*, int32);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadSPDat)(const CALLBACK_FileLoadSPDat, const void**, int32*, uint32);
|
|
||||||
struct SpellsDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadSPDat DLLLoadSPDat;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Factions //
|
|
||||||
//////////////
|
|
||||||
|
|
||||||
typedef bool(*CALLBACK_DBLoadNPCFactionLists)(int32, uint32);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadNPCFactionLists)(const CALLBACK_DBLoadNPCFactionLists, uint32, int32*, uint32*, uint8);
|
|
||||||
typedef const NPCFactionList*(*DLLFUNC_GetNPCFactionList)(uint32);
|
|
||||||
typedef bool(*DLLFUNC_AddNPCFactionList)(uint32, const NPCFactionList*);
|
|
||||||
typedef bool(*DLLFUNC_SetFaction)(uint32, uint32*, int32*, int8*, uint8*);
|
|
||||||
struct NPCFactionListDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadNPCFactionLists DLLLoadNPCFactionLists;
|
|
||||||
DLLFUNC_GetNPCFactionList GetNPCFactionList;
|
|
||||||
DLLFUNC_AddNPCFactionList cbAddNPCFactionList;
|
|
||||||
DLLFUNC_SetFaction cbSetFaction;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Loot //
|
|
||||||
///////////
|
|
||||||
|
|
||||||
typedef bool(*CALLBACK_DBLoadLoot)();
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadLoot)(const CALLBACK_DBLoadLoot, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32);
|
|
||||||
typedef bool(*DLLFUNC_AddLootTable)(uint32, const LootTable_Struct*);
|
|
||||||
typedef bool(*DLLFUNC_AddLootDrop)(uint32, const LootDrop_Struct*);
|
|
||||||
typedef const LootTable_Struct*(*DLLFUNC_GetLootTable)(uint32);
|
|
||||||
typedef const LootDrop_Struct*(*DLLFUNC_GetLootDrop)(uint32);
|
|
||||||
struct LootDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadLoot DLLLoadLoot;
|
|
||||||
DLLFUNC_AddLootTable cbAddLootTable;
|
|
||||||
DLLFUNC_AddLootDrop cbAddLootDrop;
|
|
||||||
DLLFUNC_GetLootTable GetLootTable;
|
|
||||||
DLLFUNC_GetLootDrop GetLootDrop;
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////
|
|
||||||
// Opcodes //
|
|
||||||
/////////////
|
|
||||||
|
|
||||||
typedef bool(*CALLBACK_DBLoadOpcodes)(const char *filename);
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadOpcodes)(const CALLBACK_DBLoadOpcodes, uint32 opsize, uint32 eq_count, uint32 emu_count, const char *filename);
|
|
||||||
typedef uint16 (*DLLFUNC_GetEQOpcode)(uint16 emu_op);
|
|
||||||
typedef uint16 (*DLLFUNC_GetEmuOpcode)(uint16 eq_op);
|
|
||||||
typedef void (*DLLFUNC_ClearEQOpcodes)();
|
|
||||||
typedef bool(*DLLFUNC_SetOpcodePair)(uint16 emu_op, uint16 eq_op);
|
|
||||||
struct OpcodeDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadOpcodes DLLLoadOpcodes;
|
|
||||||
DLLFUNC_GetEQOpcode GetEQOpcode;
|
|
||||||
DLLFUNC_GetEmuOpcode GetEmuOpcode;
|
|
||||||
DLLFUNC_SetOpcodePair SetOpcodePair;
|
|
||||||
DLLFUNC_ClearEQOpcodes ClearEQOpcodes;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////
|
|
||||||
// Skill Caps //
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
typedef bool(*CALLBACK_DBLoadSkillCaps)();
|
|
||||||
|
|
||||||
typedef bool(*DLLFUNC_DLLLoadSkillCaps)(const CALLBACK_DBLoadSkillCaps, uint32 opsize, uint8 ClassCount, uint8 SkillCount, uint8 LevelCount);
|
|
||||||
typedef uint16 (*DLLFUNC_GetSkillCap)(uint8 Class_, uint8 Skill, uint8 Level);
|
|
||||||
typedef void (*DLLFUNC_ClearSkillCaps)();
|
|
||||||
typedef bool(*DLLFUNC_SetSkillCap)(uint8 Class_, uint8 Skill, uint8 Level, uint16 cap);
|
|
||||||
typedef uint8 (*DLLFUNC_GetTrainLevel)(uint8 Class_, uint8 Skill, uint8 Level);
|
|
||||||
struct SkillCapDLLFunc_Struct {
|
|
||||||
DLLFUNC_DLLLoadSkillCaps LoadSkillCaps;
|
|
||||||
DLLFUNC_GetSkillCap GetSkillCap;
|
|
||||||
DLLFUNC_SetSkillCap SetSkillCap;
|
|
||||||
DLLFUNC_ClearSkillCaps ClearSkillCaps;
|
|
||||||
DLLFUNC_GetTrainLevel GetTrainLevel;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LoadEMuShareMemDLL : public SharedLibrary {
|
|
||||||
public:
|
|
||||||
LoadEMuShareMemDLL();
|
|
||||||
~LoadEMuShareMemDLL();
|
|
||||||
|
|
||||||
bool Load();
|
|
||||||
void Unload();
|
|
||||||
|
|
||||||
ItemsDLLFunc_Struct Items;
|
|
||||||
//NPCTypesDLLFunc_Struct NPCTypes;
|
|
||||||
DoorsDLLFunc_Struct Doors;
|
|
||||||
SpellsDLLFunc_Struct Spells;
|
|
||||||
NPCFactionListDLLFunc_Struct NPCFactionList;
|
|
||||||
LootDLLFunc_Struct Loot;
|
|
||||||
OpcodeDLLFunc_Struct Opcodes;
|
|
||||||
SkillCapDLLFunc_Struct SkillCaps;
|
|
||||||
private:
|
|
||||||
void ClearFunc();
|
|
||||||
|
|
||||||
bool loaded;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#else
|
|
||||||
static uint32 refCount;
|
|
||||||
static uint32 refCountU() { return ++refCount; };
|
|
||||||
static uint32 refCountD() { return --refCount; };
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -1,51 +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
|
|
||||||
*/
|
|
||||||
#include "debug.h"
|
|
||||||
#include "EQDBRes.h"
|
|
||||||
#include <mysql.h>
|
|
||||||
|
|
||||||
vector<string> EQDBRes::fetch_row_array() {
|
|
||||||
vector<string> array;
|
|
||||||
if(res == NULL)
|
|
||||||
return(array);
|
|
||||||
|
|
||||||
int count=mysql_num_fields(res);
|
|
||||||
MYSQL_ROW row=mysql_fetch_row(res);
|
|
||||||
for (int i=0;i<count;i++)
|
|
||||||
array.push_back(row[i]);
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
map<string,string> EQDBRes::fetch_row_hash() {
|
|
||||||
map<string,string> rowhash;
|
|
||||||
if(res == NULL)
|
|
||||||
return(rowhash);
|
|
||||||
|
|
||||||
MYSQL_FIELD *fields;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned long num_fields,i;
|
|
||||||
|
|
||||||
if (res && (num_fields=mysql_num_fields(res)) && (row = mysql_fetch_row(res))!=NULL && (fields = mysql_fetch_fields(res))!=NULL) {
|
|
||||||
for(i=0;i<num_fields;i++) {
|
|
||||||
rowhash[fields[i].name]=(row[i] ? row[i] : "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rowhash;
|
|
||||||
}
|
|
||||||
@@ -1,48 +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
|
|
||||||
*/
|
|
||||||
#ifndef EQDBRes_H_
|
|
||||||
#define EQDBRes_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include "types.h"
|
|
||||||
#include "database.h"
|
|
||||||
#include <mysql.h>
|
|
||||||
|
|
||||||
//this is the main object exported to perl.
|
|
||||||
class EQDBRes {
|
|
||||||
public:
|
|
||||||
EQDBRes(MYSQL_RES *r) { res=r; }
|
|
||||||
~EQDBRes() { finish(); }
|
|
||||||
|
|
||||||
//BEGIN PERL EXPORT
|
|
||||||
unsigned long num_rows() { return (res) ? mysql_num_rows(res) : 0; }
|
|
||||||
unsigned long num_fields() { return (res) ? mysql_num_fields(res) : 0; }
|
|
||||||
void DESTROY() { }
|
|
||||||
void finish() { if (res) mysql_free_result(res); res=NULL; };
|
|
||||||
vector<string> fetch_row_array();
|
|
||||||
map<string,string> fetch_row_hash();
|
|
||||||
unsigned long * fetch_lengths() { return (res) ? mysql_fetch_lengths(res) : 0; }
|
|
||||||
//END PERL EXPORT
|
|
||||||
|
|
||||||
private:
|
|
||||||
MYSQL_RES *res;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*EQDBRes_H_*/
|
|
||||||
@@ -1,36 +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
|
|
||||||
*/
|
|
||||||
#ifndef EQEMuError_H
|
|
||||||
#define EQEMuError_H
|
|
||||||
|
|
||||||
#include "../common/types.h"
|
|
||||||
|
|
||||||
enum eEQEMuError { EQEMuError_NoError,
|
|
||||||
EQEMuError_Mysql_1405,
|
|
||||||
EQEMuError_Mysql_2003,
|
|
||||||
EQEMuError_Mysql_2005,
|
|
||||||
EQEMuError_Mysql_2007,
|
|
||||||
EQEMuError_MaxErrorID };
|
|
||||||
|
|
||||||
void AddEQEMuError(eEQEMuError iError, bool iExitNow = false);
|
|
||||||
void AddEQEMuError(char* iError, bool iExitNow = false);
|
|
||||||
uint32 CheckEQEMuError();
|
|
||||||
void CheckEQEMuErrorAndPause();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,414 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|
||||||
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* EQStream classes, by Quagmire
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <process.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#define SOCKET_ERROR -1
|
|
||||||
#endif
|
|
||||||
#include "EQNetwork.h"
|
|
||||||
#include "EQStream.h"
|
|
||||||
#include "../common/packet_dump.h"
|
|
||||||
#include "../common/packet_dump_file.h"
|
|
||||||
#include "../common/packet_functions.h"
|
|
||||||
#include "../common/MiscFunctions.h"
|
|
||||||
#include "../common/crc32.h"
|
|
||||||
#include "../common/eq_packet_structs.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#define EQN_DEBUG 0
|
|
||||||
#define EQN_DEBUG_Error 0
|
|
||||||
#define EQN_DEBUG_Packet 0
|
|
||||||
#define EQN_DEBUG_Fragment 0
|
|
||||||
#define EQN_DEBUG_ACK 0
|
|
||||||
#define EQN_DEBUG_Unknown 0
|
|
||||||
#define EQN_DEBUG_NewStream 0
|
|
||||||
#define LOG_PACKETS 0
|
|
||||||
#define LOG_RAW_PACKETS_OUT 0
|
|
||||||
#define LOG_RAW_PACKETS_IN 0
|
|
||||||
//#define PRIORITYTEST
|
|
||||||
|
|
||||||
template <typename type> // LO_BYTE
|
|
||||||
type LO_BYTE (type a) {return (a&=0xff);}
|
|
||||||
template <typename type> // HI_BYTE
|
|
||||||
type HI_BYTE (type a) {return (a&=0xff00);}
|
|
||||||
template <typename type> // LO_WORD
|
|
||||||
type LO_WORD (type a) {return (a&=0xffff);}
|
|
||||||
template <typename type> // HI_WORD
|
|
||||||
type HI_WORD (type a) {return (a&=0xffff0000);}
|
|
||||||
template <typename type> // HI_LOSWAPshort
|
|
||||||
type HI_LOSWAPshort (type a) {return (LO_BYTE(a)<<8) | (HI_BYTE(a)>>8);}
|
|
||||||
template <typename type> // HI_LOSWAPlong
|
|
||||||
type HI_LOSWAPlong (type x) {return (LO_WORD(a)<<16) | (HIWORD(a)>>16);}
|
|
||||||
|
|
||||||
EQStreamServer::EQStreamServer(uint16 iPort) {
|
|
||||||
RunLoop = false;
|
|
||||||
pPort = iPort;
|
|
||||||
pOpen = false;
|
|
||||||
#ifdef WIN32
|
|
||||||
WORD version = MAKEWORD (1,1);
|
|
||||||
WSADATA wsadata;
|
|
||||||
WSAStartup (version, &wsadata);
|
|
||||||
#endif
|
|
||||||
sock = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EQStreamServer::~EQStreamServer() {
|
|
||||||
Close();
|
|
||||||
RunLoop = false;
|
|
||||||
MLoopRunning.lock();
|
|
||||||
MLoopRunning.unlock();
|
|
||||||
#ifdef WIN32
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
connection_list.clear();
|
|
||||||
while (!NewQueue.empty())
|
|
||||||
NewQueue.pop(); // they're deleted with the list, clear this queue so it doesnt try to delete them again
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQStreamServer::Open(uint16 iPort) {
|
|
||||||
LockMutex lock(&MOpen);
|
|
||||||
if (iPort && pPort != iPort) {
|
|
||||||
if (pOpen)
|
|
||||||
return false;
|
|
||||||
pPort = iPort;
|
|
||||||
}
|
|
||||||
if (!RunLoop) {
|
|
||||||
RunLoop = true;
|
|
||||||
#ifdef WIN32
|
|
||||||
_beginthread(EQStreamServerLoop, 0, this);
|
|
||||||
#else
|
|
||||||
pthread_t thread;
|
|
||||||
pthread_create(&thread, NULL, &EQStreamServerLoop, this);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (pOpen) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
struct sockaddr_in address;
|
|
||||||
// int reuse_addr = 1;
|
|
||||||
int bufsize = 64 * 1024; // 64kbyte send/recieve buffers, up from default of 8k
|
|
||||||
#ifdef WIN32
|
|
||||||
unsigned long nonblocking = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Setup internet address information.
|
|
||||||
This is used with the bind() call */
|
|
||||||
memset((char *) &address, 0, sizeof(address));
|
|
||||||
address.sin_family = AF_INET;
|
|
||||||
address.sin_port = htons(pPort);
|
|
||||||
address.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
|
|
||||||
/* Setting up UDP port for new clients */
|
|
||||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (sock < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#ifdef WIN32
|
|
||||||
// setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &reuse_addr, sizeof(reuse_addr));
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*) &bufsize, sizeof(bufsize));
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*) &bufsize, sizeof(bufsize));
|
|
||||||
//#else
|
|
||||||
// setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
|
|
||||||
// setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize));
|
|
||||||
// setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr *) &address, sizeof(address)) < 0) {
|
|
||||||
#ifdef WIN32
|
|
||||||
closesocket(sock);
|
|
||||||
#else
|
|
||||||
close(sock);
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
ioctlsocket (sock, FIONBIO, &nonblocking);
|
|
||||||
#else
|
|
||||||
fcntl(sock, F_SETFL, O_NONBLOCK);
|
|
||||||
#endif
|
|
||||||
pOpen = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQStreamServer::Close() {
|
|
||||||
SetOpen(false);
|
|
||||||
if (sock) {
|
|
||||||
#ifdef WIN32
|
|
||||||
closesocket(sock);
|
|
||||||
#else
|
|
||||||
close(sock);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
sock = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQStreamServer::IsOpen() {
|
|
||||||
MOpen.lock();
|
|
||||||
bool ret = pOpen;
|
|
||||||
MOpen.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQStreamServer::SetOpen(bool iOpen) {
|
|
||||||
MOpen.lock();
|
|
||||||
pOpen = iOpen;
|
|
||||||
MOpen.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQStreamServer::Process() {
|
|
||||||
_CP(EQStreamServer_Process);
|
|
||||||
if (!IsOpen()) {
|
|
||||||
if (sock) {
|
|
||||||
#ifdef WIN32
|
|
||||||
closesocket(sock);
|
|
||||||
#else
|
|
||||||
close(sock);
|
|
||||||
#endif
|
|
||||||
sock = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uchar buffer[1518];
|
|
||||||
|
|
||||||
int status;
|
|
||||||
struct sockaddr_in from;
|
|
||||||
unsigned int fromlen;
|
|
||||||
|
|
||||||
from.sin_family = AF_INET;
|
|
||||||
fromlen = sizeof(from);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
#ifdef WIN32
|
|
||||||
status = recvfrom(sock, (char *) buffer, sizeof(buffer), 0,(struct sockaddr*) &from, (int *) &fromlen);
|
|
||||||
#else
|
|
||||||
status = recvfrom(sock, buffer, sizeof(buffer), 0,(struct sockaddr*) &from, &fromlen);
|
|
||||||
#endif
|
|
||||||
if (status >= 1) {
|
|
||||||
cout << "Got data from recvfrom" << endl;
|
|
||||||
RecvData(buffer, status, from.sin_addr.s_addr, from.sin_port);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
map <string, EQStream*>::iterator connection;
|
|
||||||
for (connection = connection_list.begin( ); connection != connection_list.end( );)
|
|
||||||
{
|
|
||||||
if(!connection->second)
|
|
||||||
{
|
|
||||||
map <string, EQStream*>::iterator tmp=connection;
|
|
||||||
connection++;
|
|
||||||
connection_list.erase(tmp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
EQStream* eqs_data = connection->second;
|
|
||||||
if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) {
|
|
||||||
map <string, EQStream*>::iterator tmp=connection;
|
|
||||||
connection++;
|
|
||||||
safe_delete(eqs_data);
|
|
||||||
connection_list.erase(tmp);
|
|
||||||
}
|
|
||||||
else if(!eqs_data->RunLoop) {
|
|
||||||
eqs_data->Process(sock);
|
|
||||||
connection++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQStreamServer::RecvData(uchar* data, uint32 size, uint32 irIP, uint16 irPort) {
|
|
||||||
/*
|
|
||||||
CHANGE HISTORY
|
|
||||||
|
|
||||||
Version Author Date Comment
|
|
||||||
1 Unknown Unknown Initial Revision
|
|
||||||
2 Joolz 05-Jan-2003 Optimised
|
|
||||||
3 Quagmire 05-Feb-2003 Changed so 2 connection objects wouldnt be created for the same ip/port pair, often happened
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Check for invalid data
|
|
||||||
if (!data || size <= 4) return;
|
|
||||||
//if (CRC32::Generate(data, size-4) != ntohl(*((uint32*) &data[size-4]))) {
|
|
||||||
#if EQN_DEBUG_Error >= 1
|
|
||||||
//cout << "Incomming Packet failed checksum" << endl;
|
|
||||||
#endif
|
|
||||||
//return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
char temp[25];
|
|
||||||
sprintf(temp,"%lu:%u",(unsigned long)irIP,irPort);
|
|
||||||
cout << "Data from " << temp << endl;
|
|
||||||
EQStream* tmp = NULL;
|
|
||||||
map <string, EQStream*>::iterator connection;
|
|
||||||
if ((connection=connection_list.find(temp))!=connection_list.end())
|
|
||||||
tmp=connection->second;
|
|
||||||
if(tmp != NULL && tmp->GetrPort() == irPort)
|
|
||||||
{
|
|
||||||
tmp->RecvData(data, size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(tmp != NULL && tmp->GetrPort() != irPort)
|
|
||||||
{
|
|
||||||
printf("Conflicting IPs & Ports: IP %i and Port %i is conflicting with IP %i and Port %i\n",irIP,irPort,tmp->GetrIP(),tmp->GetrPort());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data[1]==0x01) {
|
|
||||||
cout << "New EQStream Connection." << endl;
|
|
||||||
EQStream* tmp = new EQStream(irIP, irPort);
|
|
||||||
tmp->RecvData(data, size);
|
|
||||||
connection_list[temp]=tmp;
|
|
||||||
if (connection_list.find(temp)==connection_list.end()) {
|
|
||||||
cerr <<"Could not find new connection we just added!" << endl;
|
|
||||||
}
|
|
||||||
MNewQueue.lock();
|
|
||||||
NewQueue.push(tmp);
|
|
||||||
MNewQueue.unlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#if EQN_DEBUG >= 4
|
|
||||||
struct in_addr in;
|
|
||||||
in.s_addr = irIP;
|
|
||||||
cout << "WARNING: Stray packet? " << inet_ntoa(in) << ":" << irPort << endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
EQStream* EQStreamServer::NewQueuePop() {
|
|
||||||
EQStream* ret = 0;
|
|
||||||
MNewQueue.lock();
|
|
||||||
if (!NewQueue.empty()) {
|
|
||||||
ret = NewQueue.front();
|
|
||||||
NewQueue.pop();
|
|
||||||
}
|
|
||||||
MNewQueue.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
void EQStreamServerLoop(void* tmp)
|
|
||||||
#else
|
|
||||||
void* EQStreamServerLoop(void* tmp)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef WIN32
|
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
|
||||||
#endif
|
|
||||||
EQStreamServer* eqns = (EQStreamServer*) tmp;
|
|
||||||
eqns->MLoopRunning.lock();
|
|
||||||
while (eqns->RunLoop) {
|
|
||||||
{
|
|
||||||
_CP(EQStreamServerLoop);
|
|
||||||
eqns->Process();
|
|
||||||
}
|
|
||||||
Sleep(1);
|
|
||||||
}
|
|
||||||
eqns->MLoopRunning.unlock();
|
|
||||||
#ifdef WIN32
|
|
||||||
_endthread();
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
void EQStreamInLoop(void* tmp)
|
|
||||||
#else
|
|
||||||
void* EQStreamInLoop(void* tmp)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
EQStream* eqs = (EQStream*) tmp;
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if (eqs->ConnectionType != Outgoing) {
|
|
||||||
ThrowError("EQStreamInLoop: eqs->ConnectionType != Outgoing");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
eqs->MLoopRunning.lock();
|
|
||||||
Timer* tmp_timer = new Timer(100);
|
|
||||||
tmp_timer->Start();
|
|
||||||
while (eqs->RunLoop) {
|
|
||||||
{
|
|
||||||
_CP(EQStreamInLoop);
|
|
||||||
if(tmp_timer->Check())
|
|
||||||
eqs->DoRecvData();
|
|
||||||
}
|
|
||||||
Sleep(1);
|
|
||||||
}
|
|
||||||
safe_delete(tmp_timer);
|
|
||||||
eqs->MLoopRunning.unlock();
|
|
||||||
#ifdef WIN32
|
|
||||||
_endthread();
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
void EQStreamOutLoop(void* tmp)
|
|
||||||
#else
|
|
||||||
void* EQStreamOutLoop(void* tmp)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
EQStream* eqs = (EQStream*) tmp;
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if (eqs->ConnectionType != Outgoing) {
|
|
||||||
ThrowError("EQStreamOutLoop: eqs->ConnectionType != Outgoing");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
eqs->MLoopRunning.lock();
|
|
||||||
Timer* tmp_timer = new Timer(100);
|
|
||||||
tmp_timer->Start();
|
|
||||||
while (eqs->RunLoop) {
|
|
||||||
{
|
|
||||||
_CP(EQStreamOutLoop);
|
|
||||||
if(tmp_timer->Check())
|
|
||||||
eqs->Process(eqs->outsock);
|
|
||||||
}
|
|
||||||
Sleep(1);
|
|
||||||
}
|
|
||||||
safe_delete(tmp_timer);
|
|
||||||
eqs->MLoopRunning.unlock();
|
|
||||||
#ifdef WIN32
|
|
||||||
_endthread();
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|
||||||
|
|
||||||
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 EQNETWORK_H
|
|
||||||
#define EQNETWORK_H
|
|
||||||
|
|
||||||
#include "../common/debug.h"
|
|
||||||
|
|
||||||
//uncomment this to enable the packet profiler. Counts the number
|
|
||||||
//of each type of packet sent or received on a connection.
|
|
||||||
#ifdef ZONE
|
|
||||||
//#define PACKET_PROFILER 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <map>
|
|
||||||
#include <list>
|
|
||||||
#include <queue>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "../common/types.h"
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "../common/linked_list.h"
|
|
||||||
#include "../common/queue.h"
|
|
||||||
#include "../common/Mutex.h"
|
|
||||||
#include "../common/packet_functions.h"
|
|
||||||
#include "EQStream.h"
|
|
||||||
#ifdef PACKET_PROFILER
|
|
||||||
#include "../common/rdtsc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EQNC_TIMEOUT 60000
|
|
||||||
#define NAS_TIMER 100
|
|
||||||
#define KA_TIMER 400 /* keeps the lag bar constant */
|
|
||||||
#define MAX_HEADER_SIZE 39 // Quag: 39 is the max header + opcode + crc32 + unknowns size
|
|
||||||
|
|
||||||
class EQStreamServer;
|
|
||||||
class EQStream;
|
|
||||||
class EQStreamPacket;
|
|
||||||
class EQStreamFragmentGroupList;
|
|
||||||
class EQStreamFragmentGroup;
|
|
||||||
typedef EQStreamServer EQNServer;
|
|
||||||
typedef EQStream EQNConnection;
|
|
||||||
typedef EQStreamPacket EQNPacket;
|
|
||||||
typedef EQStreamFragmentGroupList EQNFragmentGroupList;
|
|
||||||
typedef EQStreamFragmentGroup EQNFragmentGroup;
|
|
||||||
|
|
||||||
#define FLAG_COMPRESSED 0x1000
|
|
||||||
#define FLAG_COMBINED 0x2000
|
|
||||||
#define FLAG_ENCRYPTED 0x4000
|
|
||||||
#define FLAG_IMPLICIT 0x8000
|
|
||||||
#define FLAG_ALL 0xF000
|
|
||||||
#define StripFlags(x) (x & ~FLAG_ALL)
|
|
||||||
|
|
||||||
// Optimistic compression, used for guessing pre-alloc size on debug output
|
|
||||||
#define BEST_COMPR_RATIO 300
|
|
||||||
|
|
||||||
enum eappCompressed { appNormal, appInflated, appDeflated };
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
void EQStreamServerLoop(void* tmp);
|
|
||||||
void EQStreamInLoop(void* tmp);
|
|
||||||
void EQStreamOutLoop(void* tmp);
|
|
||||||
#else
|
|
||||||
void* EQStreamServerLoop(void* tmp);
|
|
||||||
void* EQStreamInLoop(void* tmp);
|
|
||||||
void* EQStreamOutLoop(void* tmp);
|
|
||||||
#endif
|
|
||||||
class EQStreamServer {
|
|
||||||
public:
|
|
||||||
EQStreamServer(uint16 iPort = 0);
|
|
||||||
virtual ~EQStreamServer();
|
|
||||||
|
|
||||||
bool Open(uint16 iPort = 0); // opens the port
|
|
||||||
void Close(); // closes the port
|
|
||||||
void KillAll(); // kills all clients
|
|
||||||
inline uint16 GetPort() { return pPort; }
|
|
||||||
|
|
||||||
EQStream* NewQueuePop();
|
|
||||||
protected:
|
|
||||||
#ifdef WIN32
|
|
||||||
friend void EQStreamServerLoop(void* tmp);
|
|
||||||
#else
|
|
||||||
friend void* EQStreamServerLoop(void* tmp);
|
|
||||||
#endif
|
|
||||||
void Process();
|
|
||||||
bool IsOpen();
|
|
||||||
void SetOpen(bool iOpen);
|
|
||||||
bool RunLoop;
|
|
||||||
Mutex MLoopRunning;
|
|
||||||
private:
|
|
||||||
void RecvData(uchar* data, uint32 size, uint32 irIP, uint16 irPort);
|
|
||||||
#ifdef WIN32
|
|
||||||
SOCKET sock;
|
|
||||||
#else
|
|
||||||
int sock;
|
|
||||||
#endif
|
|
||||||
uint16 pPort;
|
|
||||||
bool pOpen;
|
|
||||||
Mutex MNewQueue;
|
|
||||||
Mutex MOpen;
|
|
||||||
|
|
||||||
map<string,EQStream*> connection_list;
|
|
||||||
queue<EQStream *> NewQueue;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
-1951
File diff suppressed because it is too large
Load Diff
-1901
File diff suppressed because it is too large
Load Diff
@@ -1,650 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|
||||||
|
|
||||||
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 "../common/debug.h"
|
|
||||||
#include "MiscFunctions.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <math.h>
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <io.h>
|
|
||||||
#endif
|
|
||||||
#include "../common/timer.h"
|
|
||||||
#include "../common/seperator.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#if (_MSC_VER < 1500)
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
#else
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef va_copy
|
|
||||||
#define va_copy(d,s) ((d) = (s))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool WELLRNG_init = false;
|
|
||||||
static int state_i = 0;
|
|
||||||
static unsigned int STATE[R];
|
|
||||||
static unsigned int z0, z1, z2;
|
|
||||||
unsigned int (*WELLRNG19937)(void);
|
|
||||||
static unsigned int case_1 (void);
|
|
||||||
static unsigned int case_2 (void);
|
|
||||||
static unsigned int case_3 (void);
|
|
||||||
static unsigned int case_4 (void);
|
|
||||||
static unsigned int case_5 (void);
|
|
||||||
static unsigned int case_6 (void);
|
|
||||||
uint32 rnd_hash(time_t t, clock_t c);
|
|
||||||
void oneseed(const uint32 seed);
|
|
||||||
|
|
||||||
void CoutTimestamp(bool ms) {
|
|
||||||
time_t rawtime;
|
|
||||||
struct tm* gmt_t;
|
|
||||||
time(&rawtime);
|
|
||||||
gmt_t = gmtime(&rawtime);
|
|
||||||
|
|
||||||
struct timeval read_time;
|
|
||||||
gettimeofday(&read_time,0);
|
|
||||||
|
|
||||||
cout << (gmt_t->tm_year + 1900) << "/" << setw(2) << setfill('0') << (gmt_t->tm_mon + 1) << "/" << setw(2) << setfill('0') << gmt_t->tm_mday << " " << setw(2) << setfill('0') << gmt_t->tm_hour << ":" << setw(2) << setfill('0') << gmt_t->tm_min << ":" << setw(2) << setfill('0') << gmt_t->tm_sec;
|
|
||||||
if (ms)
|
|
||||||
cout << "." << setw(3) << setfill('0') << (read_time.tv_usec / 1000);
|
|
||||||
cout << " GMT";
|
|
||||||
}
|
|
||||||
|
|
||||||
// normal strncpy doesnt put a null term on copied strings, this one does
|
|
||||||
// ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecrt/htm/_wcecrt_strncpy_wcsncpy.asp
|
|
||||||
char* strn0cpy(char* dest, const char* source, uint32 size) {
|
|
||||||
if (!dest)
|
|
||||||
return 0;
|
|
||||||
if (size == 0 || source == 0) {
|
|
||||||
dest[0] = 0;
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
strncpy(dest, source, size);
|
|
||||||
dest[size - 1] = 0;
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
// String N w/null Copy Truncated?
|
|
||||||
// return value =true if entire string(source) fit, false if it was truncated
|
|
||||||
bool strn0cpyt(char* dest, const char* source, uint32 size) {
|
|
||||||
if (!dest)
|
|
||||||
return 0;
|
|
||||||
if (size == 0 || source == 0) {
|
|
||||||
dest[0] = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
strncpy(dest, source, size);
|
|
||||||
dest[size - 1] = 0;
|
|
||||||
return (bool) (source[strlen(dest)] == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *MakeUpperString(const char *source) {
|
|
||||||
static char str[128];
|
|
||||||
if (!source)
|
|
||||||
return NULL;
|
|
||||||
MakeUpperString(source, str);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MakeUpperString(const char *source, char *target) {
|
|
||||||
if (!source || !target) {
|
|
||||||
*target=0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while (*source)
|
|
||||||
{
|
|
||||||
*target = toupper(*source);
|
|
||||||
target++;source++;
|
|
||||||
}
|
|
||||||
*target = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *MakeLowerString(const char *source) {
|
|
||||||
static char str[128];
|
|
||||||
if (!source)
|
|
||||||
return NULL;
|
|
||||||
MakeLowerString(source, str);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MakeLowerString(const char *source, char *target) {
|
|
||||||
if (!source || !target) {
|
|
||||||
*target=0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while (*source)
|
|
||||||
{
|
|
||||||
*target = tolower(*source);
|
|
||||||
target++;source++;
|
|
||||||
}
|
|
||||||
*target = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MakeAnyLenString(char** ret, const char* format, ...) {
|
|
||||||
int buf_len = 128;
|
|
||||||
int chars = -1;
|
|
||||||
va_list argptr, tmpargptr;
|
|
||||||
va_start(argptr, format);
|
|
||||||
while (chars == -1 || chars >= buf_len) {
|
|
||||||
safe_delete_array(*ret);
|
|
||||||
if (chars == -1)
|
|
||||||
buf_len *= 2;
|
|
||||||
else
|
|
||||||
buf_len = chars + 1;
|
|
||||||
*ret = new char[buf_len];
|
|
||||||
va_copy(tmpargptr, argptr);
|
|
||||||
chars = vsnprintf(*ret, buf_len, format, tmpargptr);
|
|
||||||
}
|
|
||||||
va_end(argptr);
|
|
||||||
return chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...) {
|
|
||||||
if (*bufsize == 0)
|
|
||||||
*bufsize = 256;
|
|
||||||
if (*ret == 0)
|
|
||||||
*strlen = 0;
|
|
||||||
int chars = -1;
|
|
||||||
char* oldret = 0;
|
|
||||||
va_list argptr, tmpargptr;
|
|
||||||
va_start(argptr, format);
|
|
||||||
while (chars == -1 || chars >= (int32)(*bufsize-*strlen)) {
|
|
||||||
if (chars == -1)
|
|
||||||
*bufsize += 256;
|
|
||||||
else
|
|
||||||
*bufsize += chars + 25;
|
|
||||||
oldret = *ret;
|
|
||||||
*ret = new char[*bufsize];
|
|
||||||
if (oldret) {
|
|
||||||
if (*strlen)
|
|
||||||
memcpy(*ret, oldret, *strlen);
|
|
||||||
safe_delete_array(oldret);
|
|
||||||
}
|
|
||||||
va_copy(tmpargptr, argptr);
|
|
||||||
chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, tmpargptr);
|
|
||||||
}
|
|
||||||
va_end(argptr);
|
|
||||||
*strlen += chars;
|
|
||||||
return *strlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 hextoi(char* num) {
|
|
||||||
int len = strlen(num);
|
|
||||||
if (len < 3)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint32 ret = 0;
|
|
||||||
int mul = 1;
|
|
||||||
for (int i=len-1; i>=2; i--) {
|
|
||||||
if (num[i] >= 'A' && num[i] <= 'F')
|
|
||||||
ret += ((num[i] - 'A') + 10) * mul;
|
|
||||||
else if (num[i] >= 'a' && num[i] <= 'f')
|
|
||||||
ret += ((num[i] - 'a') + 10) * mul;
|
|
||||||
else if (num[i] >= '0' && num[i] <= '9')
|
|
||||||
ret += (num[i] - '0') * mul;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
mul *= 16;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 hextoi64(char* num) {
|
|
||||||
int len = strlen(num);
|
|
||||||
if (len < 3)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (num[0] != '0' || (num[1] != 'x' && num[1] != 'X'))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint64 ret = 0;
|
|
||||||
int mul = 1;
|
|
||||||
for (int i=len-1; i>=2; i--) {
|
|
||||||
if (num[i] >= 'A' && num[i] <= 'F')
|
|
||||||
ret += ((num[i] - 'A') + 10) * mul;
|
|
||||||
else if (num[i] >= 'a' && num[i] <= 'f')
|
|
||||||
ret += ((num[i] - 'a') + 10) * mul;
|
|
||||||
else if (num[i] >= '0' && num[i] <= '9')
|
|
||||||
ret += (num[i] - '0') * mul;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
mul *= 16;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool atobool(char* iBool) {
|
|
||||||
if (!strcasecmp(iBool, "true"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "false"))
|
|
||||||
return false;
|
|
||||||
if (!strcasecmp(iBool, "yes"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "no"))
|
|
||||||
return false;
|
|
||||||
if (!strcasecmp(iBool, "on"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "off"))
|
|
||||||
return false;
|
|
||||||
if (!strcasecmp(iBool, "enable"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "disable"))
|
|
||||||
return false;
|
|
||||||
if (!strcasecmp(iBool, "enabled"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "disabled"))
|
|
||||||
return false;
|
|
||||||
if (!strcasecmp(iBool, "y"))
|
|
||||||
return true;
|
|
||||||
if (!strcasecmp(iBool, "n"))
|
|
||||||
return false;
|
|
||||||
if (atoi(iBool))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 filesize(FILE* fp) {
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
return _filelength(_fileno(fp));
|
|
||||||
#else
|
|
||||||
struct stat file_stat;
|
|
||||||
fstat(fileno(fp), &file_stat);
|
|
||||||
return (int32) file_stat.st_size;
|
|
||||||
/* uint32 tmp = 0;
|
|
||||||
while (!feof(fp)) {
|
|
||||||
fseek(fp, tmp++, SEEK_SET);
|
|
||||||
}
|
|
||||||
return tmp;*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 ResolveIP(const char* hostname, char* errbuf) {
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
static InitWinsock ws;
|
|
||||||
#endif
|
|
||||||
if (errbuf)
|
|
||||||
errbuf[0] = 0;
|
|
||||||
if (hostname == 0) {
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, ERRBUF_SIZE, "ResolveIP(): hostname == 0");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
struct sockaddr_in server_sin;
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
PHOSTENT phostent = NULL;
|
|
||||||
#else
|
|
||||||
struct hostent *phostent = NULL;
|
|
||||||
#endif
|
|
||||||
server_sin.sin_family = AF_INET;
|
|
||||||
if ((phostent = gethostbyname(hostname)) == NULL) {
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, ERRBUF_SIZE, "Unable to get the host name. Error: %i", WSAGetLastError());
|
|
||||||
#else
|
|
||||||
if (errbuf)
|
|
||||||
snprintf(errbuf, ERRBUF_SIZE, "Unable to get the host name. Error: %s", strerror(errno));
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
memcpy ((char FAR *)&(server_sin.sin_addr), phostent->h_addr, phostent->h_length);
|
|
||||||
#else
|
|
||||||
memcpy ((char*)&(server_sin.sin_addr), phostent->h_addr, phostent->h_length);
|
|
||||||
#endif
|
|
||||||
return server_sin.sin_addr.s_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf) {
|
|
||||||
Seperator sep(iAddress, ':', 2, 250, false, 0, 0);
|
|
||||||
if (sep.argnum == 1 && sep.IsNumber(1)) {
|
|
||||||
*oIP = ResolveIP(sep.arg[0], errbuf);
|
|
||||||
if (*oIP == 0)
|
|
||||||
return false;
|
|
||||||
if (oPort)
|
|
||||||
*oPort = atoi(sep.arg[1]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
InitWinsock::InitWinsock() {
|
|
||||||
WORD version = MAKEWORD (1,1);
|
|
||||||
WSADATA wsadata;
|
|
||||||
WSAStartup (version, &wsadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
InitWinsock::~InitWinsock() {
|
|
||||||
WSACleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
const char * itoa(int num) {
|
|
||||||
static char temp[_ITOA_BUFLEN];
|
|
||||||
memset(temp,0,_ITOA_BUFLEN);
|
|
||||||
snprintf(temp,_ITOA_BUFLEN,"%d",num);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
const char * itoa(int num, char* a,int b) {
|
|
||||||
static char temp[_ITOA_BUFLEN];
|
|
||||||
memset(temp,0,_ITOA_BUFLEN);
|
|
||||||
snprintf(temp,_ITOA_BUFLEN,"%d",num);
|
|
||||||
return temp;
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* generate a random integer in the range low-high this
|
|
||||||
* should be used instead of the rand()%limit method
|
|
||||||
*/
|
|
||||||
int MakeRandomInt(int low, int high)
|
|
||||||
{
|
|
||||||
_CP(MakeRandomInt);
|
|
||||||
if(low >= high)
|
|
||||||
return(low);
|
|
||||||
|
|
||||||
//return (rand()%(high-low+1) + (low));
|
|
||||||
if(!WELLRNG_init) {
|
|
||||||
WELLRNG_init = true;
|
|
||||||
oneseed( rnd_hash( time(NULL), clock() ) );
|
|
||||||
WELLRNG19937 = case_1;
|
|
||||||
}
|
|
||||||
unsigned int randomnum = ((WELLRNG19937)());
|
|
||||||
if(randomnum == 0xffffffffUL)
|
|
||||||
return high;
|
|
||||||
return int ((randomnum / (double)0xffffffffUL) * (high - low + 1) + low);
|
|
||||||
}
|
|
||||||
|
|
||||||
double MakeRandomFloat(double low, double high)
|
|
||||||
{
|
|
||||||
_CP(MakeRandomFloat);
|
|
||||||
if(low >= high)
|
|
||||||
return(low);
|
|
||||||
|
|
||||||
//return (rand() / (double)RAND_MAX * (high - low) + low);
|
|
||||||
if(!WELLRNG_init) {
|
|
||||||
WELLRNG_init = true;
|
|
||||||
oneseed( rnd_hash( time(NULL), clock() ) );
|
|
||||||
WELLRNG19937 = case_1;
|
|
||||||
}
|
|
||||||
return ((WELLRNG19937)() / (double)0xffffffffUL * (high - low) + low);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 rnd_hash( time_t t, clock_t c )
|
|
||||||
{
|
|
||||||
// Get a uint32 from t and c
|
|
||||||
// Better than uint32(x) in case x is floating point in [0,1]
|
|
||||||
// Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
|
|
||||||
|
|
||||||
static uint32 differ = 0; // guarantee time-based seeds will change
|
|
||||||
|
|
||||||
uint32 h1 = 0;
|
|
||||||
unsigned char *p = (unsigned char *) &t;
|
|
||||||
for( size_t i = 0; i < sizeof(t); ++i )
|
|
||||||
{
|
|
||||||
h1 *= 255 + 2U;
|
|
||||||
h1 += p[i];
|
|
||||||
}
|
|
||||||
uint32 h2 = 0;
|
|
||||||
p = (unsigned char *) &c;
|
|
||||||
for( size_t j = 0; j < sizeof(c); ++j )
|
|
||||||
{
|
|
||||||
h2 *= 255 + 2U;
|
|
||||||
h2 += p[j];
|
|
||||||
}
|
|
||||||
return ( h1 + differ++ ) ^ h2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void oneseed( const uint32 seed )
|
|
||||||
{
|
|
||||||
// Initialize generator state with seed
|
|
||||||
// See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
|
|
||||||
// In previous versions, most significant bits (MSBs) of the seed affect
|
|
||||||
// only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto.
|
|
||||||
register int j = 0;
|
|
||||||
STATE[j] = seed & 0xffffffffUL;
|
|
||||||
for (j = 1; j < R; j++)
|
|
||||||
{
|
|
||||||
STATE[j] = ( 1812433253UL * ( STATE[j-1] ^ (STATE[j-1] >> 30) ) + j ) & 0xffffffffUL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WELL RNG code
|
|
||||||
|
|
||||||
/* ***************************************************************************** */
|
|
||||||
/* Copyright: Francois Panneton and Pierre L'Ecuyer, University of Montreal */
|
|
||||||
/* Makoto Matsumoto, Hiroshima University */
|
|
||||||
/* Notice: This code can be used freely for personal, academic, */
|
|
||||||
/* or non-commercial purposes. For commercial purposes, */
|
|
||||||
/* please contact P. L'Ecuyer at: lecuyer@iro.UMontreal.ca */
|
|
||||||
/* A modified "maximally equidistributed" implementation */
|
|
||||||
/* by Shin Harase, Hiroshima University. */
|
|
||||||
/* ***************************************************************************** */
|
|
||||||
|
|
||||||
unsigned int case_1 (void){
|
|
||||||
// state_i == 0
|
|
||||||
z0 = (VRm1Under & MASKL) | (VRm2Under & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1);
|
|
||||||
z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0Under = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i = R - 1;
|
|
||||||
WELLRNG19937 = case_3;
|
|
||||||
return (STATE[state_i] ^ (newVM2Over & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int case_2 (void){
|
|
||||||
// state_i == 1
|
|
||||||
z0 = (VRm1 & MASKL) | (VRm2Under & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1);
|
|
||||||
z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i = 0;
|
|
||||||
WELLRNG19937 = case_1;
|
|
||||||
return (STATE[state_i] ^ (newVM2 & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int case_3 (void){
|
|
||||||
// state_i+M1 >= R
|
|
||||||
z0 = (VRm1 & MASKL) | (VRm2 & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1Over);
|
|
||||||
z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i--;
|
|
||||||
if (state_i + M1 < R)
|
|
||||||
WELLRNG19937 = case_5;
|
|
||||||
return (STATE[state_i] ^ (newVM2Over & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int case_4 (void){
|
|
||||||
// state_i+M3 >= R
|
|
||||||
z0 = (VRm1 & MASKL) | (VRm2 & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1);
|
|
||||||
z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3Over);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i--;
|
|
||||||
if (state_i + M3 < R)
|
|
||||||
WELLRNG19937 = case_6;
|
|
||||||
return (STATE[state_i] ^ (newVM2 & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int case_5 (void){
|
|
||||||
// state_i+M2 >= R
|
|
||||||
z0 = (VRm1 & MASKL) | (VRm2 & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1);
|
|
||||||
z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i--;
|
|
||||||
if (state_i + M2 < R)
|
|
||||||
WELLRNG19937 = case_4;
|
|
||||||
return (STATE[state_i] ^ (newVM2Over & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int case_6 (void){
|
|
||||||
// 2 <= state_i <= (R - M3 - 1)
|
|
||||||
z0 = (VRm1 & MASKL) | (VRm2 & MASKU);
|
|
||||||
z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1);
|
|
||||||
z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3);
|
|
||||||
newV1 = z1 ^ z2;
|
|
||||||
newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1);
|
|
||||||
state_i--;
|
|
||||||
if (state_i == 1)
|
|
||||||
WELLRNG19937 = case_2;
|
|
||||||
return (STATE[state_i] ^ (newVM2 & BITMASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
// end WELL RNG code
|
|
||||||
|
|
||||||
// solar: removes the crap and turns the underscores into spaces.
|
|
||||||
char *CleanMobName(const char *in, char *out)
|
|
||||||
{
|
|
||||||
unsigned i, j;
|
|
||||||
|
|
||||||
for(i = j = 0; i < strlen(in); i++)
|
|
||||||
{
|
|
||||||
// convert _ to space.. any other conversions like this? I *think* this
|
|
||||||
// is the only non alpha char that's not stripped but converted.
|
|
||||||
if(in[i] == '_')
|
|
||||||
{
|
|
||||||
out[j++] = ' ';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(isalpha(in[i]) || (in[i] == '`')) // numbers, #, or any other crap just gets skipped
|
|
||||||
out[j++] = in[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out[j] = 0; // terimnate the string before returning it
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ConvertArray(int input, char *returnchar)
|
|
||||||
{
|
|
||||||
sprintf(returnchar, "%i" ,input);
|
|
||||||
return returnchar;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ConvertArrayF(float input, char *returnchar)
|
|
||||||
{
|
|
||||||
sprintf(returnchar, "%0.2f", input);
|
|
||||||
return returnchar;
|
|
||||||
}
|
|
||||||
|
|
||||||
float EQ13toFloat(int d)
|
|
||||||
{
|
|
||||||
return ( float(d)/float(1<<2));
|
|
||||||
}
|
|
||||||
|
|
||||||
float NewEQ13toFloat(int d)
|
|
||||||
{
|
|
||||||
return ( float(d)/float(1<<6));
|
|
||||||
}
|
|
||||||
|
|
||||||
float EQ19toFloat(int d)
|
|
||||||
{
|
|
||||||
return ( float(d)/float(1<<3));
|
|
||||||
}
|
|
||||||
|
|
||||||
int FloatToEQ13(float d)
|
|
||||||
{
|
|
||||||
return int(d*float(1<<2));
|
|
||||||
}
|
|
||||||
|
|
||||||
int NewFloatToEQ13(float d)
|
|
||||||
{
|
|
||||||
return int(d*float(1<<6));
|
|
||||||
}
|
|
||||||
|
|
||||||
int FloatToEQ19(float d)
|
|
||||||
{
|
|
||||||
return int(d*float(1<<3));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Heading of 0 points in the pure positive Y direction
|
|
||||||
|
|
||||||
*/
|
|
||||||
int FloatToEQH(float d)
|
|
||||||
{
|
|
||||||
return(int((360.0f - d) * float(1<<11)) / 360);
|
|
||||||
}
|
|
||||||
|
|
||||||
float EQHtoFloat(int d)
|
|
||||||
{
|
|
||||||
return(360.0f - float((d * 360) >> 11));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoveApostrophes(std::string &s)
|
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < s.length(); ++i)
|
|
||||||
if(s[i] == '\'')
|
|
||||||
s[i] = '_';
|
|
||||||
}
|
|
||||||
|
|
||||||
char *RemoveApostrophes(const char *s)
|
|
||||||
{
|
|
||||||
char *NewString = new char[strlen(s) + 1];
|
|
||||||
|
|
||||||
strcpy(NewString, s);
|
|
||||||
|
|
||||||
for(unsigned int i = 0 ; i < strlen(NewString); ++i)
|
|
||||||
if(NewString[i] == '\'')
|
|
||||||
NewString[i] = '_';
|
|
||||||
|
|
||||||
return NewString;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|
||||||
|
|
||||||
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 MISCFUNCTIONS_H
|
|
||||||
#define MISCFUNCTIONS_H
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <string>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ERRBUF_SIZE
|
|
||||||
#define ERRBUF_SIZE 1024
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// These are helper macros for dealing with packets of variable length, typically those that contain
|
|
||||||
// variable length strings where it is not convenient to use a fixed length struct.
|
|
||||||
//
|
|
||||||
#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type);
|
|
||||||
#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1;
|
|
||||||
#define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, String); Buffer += strlen(String) + 1; }
|
|
||||||
#define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { sprintf(Buffer, "%i", Number); Buffer += strlen(Buffer) + 1; }
|
|
||||||
#define VARSTRUCT_ENCODE_TYPE(Type, Buffer, Value) { *(Type *)Buffer = Value; Buffer += sizeof(Type); }
|
|
||||||
#define VARSTRUCT_SKIP_TYPE(Type, Buffer) Buffer += sizeof(Type);
|
|
||||||
|
|
||||||
#define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \
|
|
||||||
if(Packet->size != sizeof(StructName)) \
|
|
||||||
{ \
|
|
||||||
LogFile->write(EQEMuLog::Debug, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \
|
|
||||||
DumpPacket(Packet); \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Definitions for WELLRNG
|
|
||||||
//
|
|
||||||
#define W 32
|
|
||||||
#define R 624
|
|
||||||
#define DISCARD 31
|
|
||||||
#define MASKU (0xffffffffU>>(W-DISCARD))
|
|
||||||
#define MASKL (~MASKU)
|
|
||||||
#define M1 70
|
|
||||||
#define M2 179
|
|
||||||
#define M3 449
|
|
||||||
|
|
||||||
#define MAT0POS(t,v) (v^(v>>t))
|
|
||||||
#define MAT0NEG(t,v) (v^(v<<(-(t))))
|
|
||||||
#define MAT1(v) v
|
|
||||||
#define MAT3POS(t,v) (v>>t)
|
|
||||||
|
|
||||||
#define V0 STATE[state_i]
|
|
||||||
#define VM1Over STATE[state_i+M1-R]
|
|
||||||
#define VM1 STATE[state_i+M1]
|
|
||||||
#define VM2Over STATE[state_i+M2-R]
|
|
||||||
#define VM2 STATE[state_i+M2]
|
|
||||||
#define VM3Over STATE[state_i+M3-R]
|
|
||||||
#define VM3 STATE[state_i+M3]
|
|
||||||
#define VRm1 STATE[state_i-1]
|
|
||||||
#define VRm1Under STATE[state_i+R-1]
|
|
||||||
#define VRm2 STATE[state_i-2]
|
|
||||||
#define VRm2Under STATE[state_i+R-2]
|
|
||||||
|
|
||||||
#define newV0 STATE[state_i-1]
|
|
||||||
#define newV0Under STATE[state_i-1+R]
|
|
||||||
#define newV1 STATE[state_i]
|
|
||||||
#define newVRm1 STATE[state_i-2]
|
|
||||||
#define newVRm1Under STATE[state_i-2+R]
|
|
||||||
|
|
||||||
#define newVM2Over STATE[state_i+M2-R+1]
|
|
||||||
#define newVM2 STATE[state_i+M2+1]
|
|
||||||
|
|
||||||
#define BITMASK 0x41180000
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// MakeUpperString
|
|
||||||
// i : source - allocated null-terminated string
|
|
||||||
// return: pointer to static buffer with the target string
|
|
||||||
const char *MakeUpperString(const char *source);
|
|
||||||
const char *MakeLowerString(const char *source);
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// MakeUpperString
|
|
||||||
// i : source - allocated null-terminated string
|
|
||||||
// io: target - allocated buffer, at least of size strlen(source)+1
|
|
||||||
void MakeUpperString(const char *source, char *target);
|
|
||||||
void MakeLowerString(const char *source, char *target);
|
|
||||||
|
|
||||||
|
|
||||||
int MakeAnyLenString(char** ret, const char* format, ...);
|
|
||||||
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...);
|
|
||||||
uint32 hextoi(char* num);
|
|
||||||
uint64 hextoi64(char* num);
|
|
||||||
bool atobool(char* iBool);
|
|
||||||
int32 filesize(FILE* fp);
|
|
||||||
uint32 ResolveIP(const char* hostname, char* errbuf = 0);
|
|
||||||
bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf = 0);
|
|
||||||
void CoutTimestamp(bool ms = true);
|
|
||||||
char* strn0cpy(char* dest, const char* source, uint32 size);
|
|
||||||
// return value =true if entire string(source) fit, false if it was truncated
|
|
||||||
bool strn0cpyt(char* dest, const char* source, uint32 size);
|
|
||||||
int MakeRandomInt(int low, int high);
|
|
||||||
double MakeRandomFloat(double low, double high);
|
|
||||||
char *CleanMobName(const char *in, char *out);
|
|
||||||
const char *ConvertArray(int input, char *returnchar);
|
|
||||||
const char *ConvertArrayF(float input, char *returnchar);
|
|
||||||
float EQ13toFloat(int d);
|
|
||||||
float NewEQ13toFloat(int d);
|
|
||||||
float EQ19toFloat(int d);
|
|
||||||
float EQHtoFloat(int d);
|
|
||||||
int FloatToEQ13(float d);
|
|
||||||
int NewFloatToEQ13(float d);
|
|
||||||
int FloatToEQ19(float d);
|
|
||||||
int FloatToEQH(float d);
|
|
||||||
void RemoveApostrophes(std::string &s);
|
|
||||||
char *RemoveApostrophes(const char *s);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define _ITOA_BUFLEN 25
|
|
||||||
const char *itoa(int num); //not thread safe
|
|
||||||
#ifndef _WINDOWS
|
|
||||||
const char *itoa(int num, char* a,int b);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class InitWinsock {
|
|
||||||
public:
|
|
||||||
InitWinsock();
|
|
||||||
~InitWinsock();
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class T> class AutoDelete {
|
|
||||||
public:
|
|
||||||
AutoDelete(T** iVar, T* iSetTo = 0) {
|
|
||||||
init(iVar, iSetTo);
|
|
||||||
}
|
|
||||||
AutoDelete() { pVar = NULL; }
|
|
||||||
void init(T** iVar, T* iSetTo = 0)
|
|
||||||
{
|
|
||||||
pVar = iVar;
|
|
||||||
if (iSetTo)
|
|
||||||
*pVar = iSetTo;
|
|
||||||
}
|
|
||||||
~AutoDelete() {
|
|
||||||
if(pVar != NULL)
|
|
||||||
safe_delete(*pVar);
|
|
||||||
}
|
|
||||||
void ReallyClearIt() {
|
|
||||||
pVar = NULL;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
T** pVar;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,117 +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
|
|
||||||
*/
|
|
||||||
#include "SharedLibrary.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#if (_MSC_VER < 1500)
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
|
|
||||||
#define EmuLibName "EMuShareMem"
|
|
||||||
#else
|
|
||||||
#define EmuLibName "libEMuShareMem.so"
|
|
||||||
|
|
||||||
#include "../common/unix.h"
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#define GetProcAddress(a,b) dlsym(a,b)
|
|
||||||
#define LoadLibrary(a) dlopen(a, RTLD_NOW)
|
|
||||||
#define FreeLibrary(a) dlclose(a)
|
|
||||||
#define GetLastError() dlerror()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SharedLibrary::SharedLibrary() {
|
|
||||||
hDLL = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedLibrary::~SharedLibrary() {
|
|
||||||
Unload();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SharedLibrary::Load(const char *name)
|
|
||||||
{
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
SetLastError(0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hDLL = LoadLibrary(name);
|
|
||||||
|
|
||||||
if(!hDLL) {
|
|
||||||
const char *load_error = GetError();
|
|
||||||
fprintf(stderr, "[Error] Load Shared Library '%s' failed. Error=%s\n", name, load_error?load_error:"Null Return, no error");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
else { SetLastError(0); } // Clear the win9x error
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedLibrary::Unload() {
|
|
||||||
if (hDLL != NULL) {
|
|
||||||
FreeLibrary(hDLL);
|
|
||||||
#ifndef WIN32
|
|
||||||
const char* error;
|
|
||||||
if ((error = GetError()) != NULL)
|
|
||||||
fprintf(stderr, "FreeLibrary() error = %s", error);
|
|
||||||
#endif
|
|
||||||
hDLL = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *SharedLibrary::GetSym(const char *name) {
|
|
||||||
if (!Loaded())
|
|
||||||
return(NULL);
|
|
||||||
|
|
||||||
void *r = GetProcAddress(hDLL, name);
|
|
||||||
|
|
||||||
if(GetError() != NULL)
|
|
||||||
r = NULL;
|
|
||||||
|
|
||||||
return(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SharedLibrary::GetSym(const char *name, void **sym)
|
|
||||||
{
|
|
||||||
bool result=false;
|
|
||||||
if (Loaded()) {
|
|
||||||
*sym = GetProcAddress(hDLL, name);
|
|
||||||
result= (GetError() == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *SharedLibrary::GetError()
|
|
||||||
{
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
//not thread safe, dont care.
|
|
||||||
static char ErrBuf[128];
|
|
||||||
unsigned long err = GetLastError();
|
|
||||||
if(err == 0)
|
|
||||||
return(NULL);
|
|
||||||
sprintf(ErrBuf, "Error #%lu", (unsigned long)err);
|
|
||||||
return(ErrBuf);
|
|
||||||
#else
|
|
||||||
return GetLastError();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,49 +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
|
|
||||||
*/
|
|
||||||
#ifndef _SHAREDLIBRARY_H
|
|
||||||
#define _SHAREDLIBRARY_H
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class SharedLibrary {
|
|
||||||
public:
|
|
||||||
SharedLibrary();
|
|
||||||
virtual ~SharedLibrary();
|
|
||||||
|
|
||||||
//two call styles for GetSym, one returns bool, other NULL for fail
|
|
||||||
bool GetSym(const char *name, void **sym);
|
|
||||||
void *GetSym(const char *name);
|
|
||||||
|
|
||||||
const char *GetError();
|
|
||||||
|
|
||||||
virtual bool Load(const char *file);
|
|
||||||
virtual void Unload();
|
|
||||||
|
|
||||||
inline bool Loaded() { return (hDLL != 0); }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
HINSTANCE hDLL;
|
|
||||||
#else
|
|
||||||
void* hDLL;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -43,7 +43,7 @@ namespace SOCKETS_NAMESPACE {
|
|||||||
|
|
||||||
|
|
||||||
File::File()
|
File::File()
|
||||||
:m_fil(NULL)
|
:m_fil(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ size_t File::fwrite(const char *ptr, size_t size, size_t nmemb)
|
|||||||
|
|
||||||
char *File::fgets(char *s, int size)
|
char *File::fgets(char *s, int size)
|
||||||
{
|
{
|
||||||
return m_fil ? ::fgets(s, size, m_fil) : NULL;
|
return m_fil ? ::fgets(s, size, m_fil) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "Parse.h"
|
#include "Parse.h"
|
||||||
#include "HTTPSocket.h"
|
#include "HTTPSocket.h"
|
||||||
#include "../TCPConnection.h"
|
#include "../tcp_connection.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../TCPConnection.h"
|
#include "../tcp_connection.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef SOCKETS_NAMESPACE
|
#ifdef SOCKETS_NAMESPACE
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ bool HttpdCookies::getvalue(const std::string& name,std::string& buffer) //char
|
|||||||
|
|
||||||
void HttpdCookies::replacevalue(const std::string& name,const std::string& value)
|
void HttpdCookies::replacevalue(const std::string& name,const std::string& value)
|
||||||
{
|
{
|
||||||
COOKIE *c = NULL;
|
COOKIE *c = nullptr;
|
||||||
|
|
||||||
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
||||||
{
|
{
|
||||||
c = *it;
|
c = *it;
|
||||||
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
||||||
break;
|
break;
|
||||||
c = NULL;
|
c = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
@@ -126,14 +126,14 @@ void HttpdCookies::replacevalue(const std::string& name,int i)
|
|||||||
|
|
||||||
size_t HttpdCookies::getlength(const std::string& name)
|
size_t HttpdCookies::getlength(const std::string& name)
|
||||||
{
|
{
|
||||||
COOKIE *c = NULL;
|
COOKIE *c = nullptr;
|
||||||
|
|
||||||
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
||||||
{
|
{
|
||||||
c = *it;
|
c = *it;
|
||||||
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
||||||
break;
|
break;
|
||||||
c = NULL;
|
c = nullptr;
|
||||||
}
|
}
|
||||||
return c ? c -> value.size() : 0;
|
return c ? c -> value.size() : 0;
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ void HttpdCookies::setcookie(HTTPSocket *sock, const std::string& domain, const
|
|||||||
|
|
||||||
const std::string& HttpdCookies::expiredatetime()
|
const std::string& HttpdCookies::expiredatetime()
|
||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(nullptr);
|
||||||
struct tm * tp = gmtime(&t);
|
struct tm * tp = gmtime(&t);
|
||||||
const char *days[7] = {"Sunday", "Monday",
|
const char *days[7] = {"Sunday", "Monday",
|
||||||
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace SOCKETS_NAMESPACE {
|
|||||||
|
|
||||||
HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
||||||
{
|
{
|
||||||
CGI *cgi = NULL;
|
CGI *cgi = nullptr;
|
||||||
char *c_t = getenv("CONTENT_TYPE");
|
char *c_t = getenv("CONTENT_TYPE");
|
||||||
char *c_l = getenv("CONTENT_LENGTH");
|
char *c_l = getenv("CONTENT_LENGTH");
|
||||||
size_t extra = 2;
|
size_t extra = 2;
|
||||||
@@ -59,7 +59,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
|||||||
if (c_t && !strncmp(c_t, "multipart/form-data",19))
|
if (c_t && !strncmp(c_t, "multipart/form-data",19))
|
||||||
{
|
{
|
||||||
Parse pa(c_t,";=");
|
Parse pa(c_t,";=");
|
||||||
char *tempcmp = NULL;
|
char *tempcmp = nullptr;
|
||||||
size_t tc = 0;
|
size_t tc = 0;
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
std::string str = pa.getword();
|
std::string str = pa.getword();
|
||||||
@@ -80,7 +80,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
|||||||
std::string content_type;
|
std::string content_type;
|
||||||
std::string current_name;
|
std::string current_name;
|
||||||
std::string current_filename;
|
std::string current_filename;
|
||||||
char slask[200];
|
char slask[2000];
|
||||||
infil -> fgets(slask, 200);
|
infil -> fgets(slask, 200);
|
||||||
while (!infil -> eof())
|
while (!infil -> eof())
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
|||||||
#else
|
#else
|
||||||
sprintf(fn,"/tmp/%s",current_filename.c_str());
|
sprintf(fn,"/tmp/%s",current_filename.c_str());
|
||||||
#endif
|
#endif
|
||||||
if ((fil = fopen(fn, "wb")) != NULL)
|
if ((fil = fopen(fn, "wb")) != nullptr)
|
||||||
{
|
{
|
||||||
infil -> fread(&c,1,1);
|
infil -> fread(&c,1,1);
|
||||||
while (!infil -> eof())
|
while (!infil -> eof())
|
||||||
@@ -353,7 +353,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
|||||||
|
|
||||||
HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false)
|
HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false)
|
||||||
{
|
{
|
||||||
CGI *cgi = NULL;
|
CGI *cgi = nullptr;
|
||||||
char slask[8888];
|
char slask[8888];
|
||||||
char name[200];
|
char name[200];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -424,7 +424,7 @@ HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false)
|
|||||||
|
|
||||||
HttpdForm::~HttpdForm()
|
HttpdForm::~HttpdForm()
|
||||||
{
|
{
|
||||||
CGI *cgi = NULL; //,*tmp;
|
CGI *cgi = nullptr; //,*tmp;
|
||||||
|
|
||||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -525,7 +525,7 @@ bool HttpdForm::getnext(std::string& n,std::string& v) //char *n,size_t len,char
|
|||||||
|
|
||||||
int HttpdForm::getvalue(const std::string& n,std::string& v) //char *v,size_t len)
|
int HttpdForm::getvalue(const std::string& n,std::string& v) //char *v,size_t len)
|
||||||
{
|
{
|
||||||
CGI *cgi = NULL;
|
CGI *cgi = nullptr;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||||
@@ -533,7 +533,7 @@ int HttpdForm::getvalue(const std::string& n,std::string& v) //char *v,size_t le
|
|||||||
cgi = *it;
|
cgi = *it;
|
||||||
if (cgi -> name == n)
|
if (cgi -> name == n)
|
||||||
break;
|
break;
|
||||||
cgi = NULL;
|
cgi = nullptr;
|
||||||
}
|
}
|
||||||
if (cgi)
|
if (cgi)
|
||||||
{
|
{
|
||||||
@@ -572,7 +572,7 @@ std::string HttpdForm::getvalue(const std::string& n)
|
|||||||
|
|
||||||
size_t HttpdForm::getlength(const std::string& n)
|
size_t HttpdForm::getlength(const std::string& n)
|
||||||
{
|
{
|
||||||
CGI *cgi = NULL;
|
CGI *cgi = nullptr;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||||
@@ -580,7 +580,7 @@ size_t HttpdForm::getlength(const std::string& n)
|
|||||||
cgi = *it;
|
cgi = *it;
|
||||||
if (cgi -> name == n)
|
if (cgi -> name == n)
|
||||||
break;
|
break;
|
||||||
cgi = NULL;
|
cgi = nullptr;
|
||||||
}
|
}
|
||||||
l = cgi ? cgi -> value.size() : 0;
|
l = cgi ? cgi -> value.size() : 0;
|
||||||
if (cgi && !raw)
|
if (cgi && !raw)
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ std::string HttpdSocket::m_start = "";
|
|||||||
HttpdSocket::HttpdSocket(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
HttpdSocket::HttpdSocket(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
||||||
: HTTPSocket(ID,in_socket,irIP,irPort)
|
: HTTPSocket(ID,in_socket,irIP,irPort)
|
||||||
,m_content_length(0)
|
,m_content_length(0)
|
||||||
,m_file(NULL)
|
,m_file(nullptr)
|
||||||
,m_received(0)
|
,m_received(0)
|
||||||
,m_request_id(++m_request_count)
|
,m_request_id(++m_request_count)
|
||||||
,m_cookies(NULL)
|
,m_cookies(nullptr)
|
||||||
,m_form(NULL)
|
,m_form(nullptr)
|
||||||
{
|
{
|
||||||
m_http_date = datetime2httpdate(GetDate());
|
m_http_date = datetime2httpdate(GetDate());
|
||||||
if (!m_start.size())
|
if (!m_start.size())
|
||||||
@@ -289,7 +289,7 @@ std::string HttpdSocket::datetime2httpdate(const std::string& dt)
|
|||||||
|
|
||||||
std::string HttpdSocket::GetDate()
|
std::string HttpdSocket::GetDate()
|
||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(nullptr);
|
||||||
struct tm* tp = localtime(&t);
|
struct tm* tp = localtime(&t);
|
||||||
char slask[40];
|
char slask[40];
|
||||||
if (tp)
|
if (tp)
|
||||||
@@ -315,16 +315,16 @@ void HttpdSocket::Reset()
|
|||||||
if (m_file)
|
if (m_file)
|
||||||
{
|
{
|
||||||
delete m_file;
|
delete m_file;
|
||||||
m_file = NULL;
|
m_file = nullptr;
|
||||||
}
|
}
|
||||||
m_received = 0;
|
m_received = 0;
|
||||||
m_request_id = ++m_request_count;
|
m_request_id = ++m_request_count;
|
||||||
if (m_cookies)
|
if (m_cookies)
|
||||||
delete m_cookies;
|
delete m_cookies;
|
||||||
m_cookies = NULL;
|
m_cookies = nullptr;
|
||||||
if (m_form)
|
if (m_form)
|
||||||
delete m_form;
|
delete m_form;
|
||||||
m_form = NULL;
|
m_form = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ MemFile::MemFile(const std::string& path)
|
|||||||
:m_path(path)
|
:m_path(path)
|
||||||
,m_temporary(false)
|
,m_temporary(false)
|
||||||
,m_base(m_files[path])
|
,m_base(m_files[path])
|
||||||
,m_current_read(NULL)
|
,m_current_read(nullptr)
|
||||||
,m_current_write(NULL)
|
,m_current_write(nullptr)
|
||||||
,m_read_ptr(0)
|
,m_read_ptr(0)
|
||||||
,m_write_ptr(0)
|
,m_write_ptr(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
/** File block structure.
|
/** File block structure.
|
||||||
\ingroup file */
|
\ingroup file */
|
||||||
struct block_t {
|
struct block_t {
|
||||||
block_t() : next(NULL) {}
|
block_t() : next(nullptr) {}
|
||||||
struct block_t *next;
|
struct block_t *next;
|
||||||
char data[BLOCKSIZE];
|
char data[BLOCKSIZE];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Mime::Mime(const std::string& filename) {
|
|||||||
|
|
||||||
bool Mime::LoadMimeFile(const std::string& filename) {
|
bool Mime::LoadMimeFile(const std::string& filename) {
|
||||||
FILE *fil;
|
FILE *fil;
|
||||||
if ((fil = fopen(filename.c_str(),"rt")) != NULL) {
|
if ((fil = fopen(filename.c_str(),"rt")) != nullptr) {
|
||||||
char * slask = new char[1000];
|
char * slask = new char[1000];
|
||||||
fgets(slask,1000,fil);
|
fgets(slask,1000,fil);
|
||||||
while (!feof(fil))
|
while (!feof(fil))
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ typedef unsigned short port_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _THREADSAFE_SOCKETS
|
#ifdef _THREADSAFE_SOCKETS
|
||||||
#include "Mutex.h"
|
#include "mutex.h"
|
||||||
#include "Lock.h"
|
#include "Lock.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ typedef struct _tagSTACKFRAME64 {
|
|||||||
ADDRESS64 AddrFrame; // frame pointer
|
ADDRESS64 AddrFrame; // frame pointer
|
||||||
ADDRESS64 AddrStack; // stack pointer
|
ADDRESS64 AddrStack; // stack pointer
|
||||||
ADDRESS64 AddrBStore; // backing store pointer
|
ADDRESS64 AddrBStore; // backing store pointer
|
||||||
PVOID FuncTableEntry; // pointer to pdata/fpo or NULL
|
PVOID FuncTableEntry; // pointer to pdata/fpo or nullptr
|
||||||
DWORD64 Params[4]; // possible arguments to the function
|
DWORD64 Params[4]; // possible arguments to the function
|
||||||
BOOL Far; // WOW far call
|
BOOL Far; // WOW far call
|
||||||
BOOL Virtual; // is this a virtual frame?
|
BOOL Virtual; // is this a virtual frame?
|
||||||
@@ -187,44 +187,44 @@ public:
|
|||||||
StackWalkerInternal(StackWalker *parent, HANDLE hProcess)
|
StackWalkerInternal(StackWalker *parent, HANDLE hProcess)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_hDbhHelp = NULL;
|
m_hDbhHelp = nullptr;
|
||||||
pSC = NULL;
|
pSC = nullptr;
|
||||||
m_hProcess = hProcess;
|
m_hProcess = hProcess;
|
||||||
m_szSymPath = NULL;
|
m_szSymPath = nullptr;
|
||||||
pSFTA = NULL;
|
pSFTA = nullptr;
|
||||||
pSGLFA = NULL;
|
pSGLFA = nullptr;
|
||||||
pSGMB = NULL;
|
pSGMB = nullptr;
|
||||||
pSGMI = NULL;
|
pSGMI = nullptr;
|
||||||
pSGO = NULL;
|
pSGO = nullptr;
|
||||||
pSGSFA = NULL;
|
pSGSFA = nullptr;
|
||||||
pSI = NULL;
|
pSI = nullptr;
|
||||||
pSLM = NULL;
|
pSLM = nullptr;
|
||||||
pSSO = NULL;
|
pSSO = nullptr;
|
||||||
pSW = NULL;
|
pSW = nullptr;
|
||||||
pUDSN = NULL;
|
pUDSN = nullptr;
|
||||||
pSGSP = NULL;
|
pSGSP = nullptr;
|
||||||
}
|
}
|
||||||
~StackWalkerInternal()
|
~StackWalkerInternal()
|
||||||
{
|
{
|
||||||
if (pSC != NULL)
|
if (pSC != nullptr)
|
||||||
pSC(m_hProcess); // SymCleanup
|
pSC(m_hProcess); // SymCleanup
|
||||||
if (m_hDbhHelp != NULL)
|
if (m_hDbhHelp != nullptr)
|
||||||
FreeLibrary(m_hDbhHelp);
|
FreeLibrary(m_hDbhHelp);
|
||||||
m_hDbhHelp = NULL;
|
m_hDbhHelp = nullptr;
|
||||||
m_parent = NULL;
|
m_parent = nullptr;
|
||||||
if(m_szSymPath != NULL)
|
if(m_szSymPath != nullptr)
|
||||||
free(m_szSymPath);
|
free(m_szSymPath);
|
||||||
m_szSymPath = NULL;
|
m_szSymPath = nullptr;
|
||||||
}
|
}
|
||||||
BOOL Init(LPCSTR szSymPath)
|
BOOL Init(LPCSTR szSymPath)
|
||||||
{
|
{
|
||||||
if (m_parent == NULL)
|
if (m_parent == nullptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
// Dynamically load the Entry-Points for dbghelp.dll:
|
// Dynamically load the Entry-Points for dbghelp.dll:
|
||||||
// First try to load the newsest one from
|
// First try to load the newsest one from
|
||||||
TCHAR szTemp[4096];
|
TCHAR szTemp[4096];
|
||||||
// But before wqe do this, we first check if the ".local" file exists
|
// But before wqe do this, we first check if the ".local" file exists
|
||||||
if (GetModuleFileName(NULL, szTemp, 4096) > 0)
|
if (GetModuleFileName(nullptr, szTemp, 4096) > 0)
|
||||||
{
|
{
|
||||||
_tcscat_s(szTemp, _T(".local"));
|
_tcscat_s(szTemp, _T(".local"));
|
||||||
if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES)
|
if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES)
|
||||||
@@ -240,7 +240,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Still not found? Then try to load the 64-Bit version:
|
// Still not found? Then try to load the 64-Bit version:
|
||||||
if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) )
|
if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) )
|
||||||
{
|
{
|
||||||
_tcscat_s(szTemp, _T("\\Debugging Tools for Windows 64-Bit\\dbghelp.dll"));
|
_tcscat_s(szTemp, _T("\\Debugging Tools for Windows 64-Bit\\dbghelp.dll"));
|
||||||
if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES)
|
if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES)
|
||||||
@@ -250,9 +250,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_hDbhHelp == NULL) // if not already loaded, try to load a default-one
|
if (m_hDbhHelp == nullptr) // if not already loaded, try to load a default-one
|
||||||
m_hDbhHelp = LoadLibrary( _T("dbghelp.dll") );
|
m_hDbhHelp = LoadLibrary( _T("dbghelp.dll") );
|
||||||
if (m_hDbhHelp == NULL)
|
if (m_hDbhHelp == nullptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize" );
|
pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize" );
|
||||||
pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup" );
|
pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup" );
|
||||||
@@ -271,18 +271,18 @@ public:
|
|||||||
pSLM = (tSLM) GetProcAddress(m_hDbhHelp, "SymLoadModule64" );
|
pSLM = (tSLM) GetProcAddress(m_hDbhHelp, "SymLoadModule64" );
|
||||||
pSGSP =(tSGSP) GetProcAddress(m_hDbhHelp, "SymGetSearchPath" );
|
pSGSP =(tSGSP) GetProcAddress(m_hDbhHelp, "SymGetSearchPath" );
|
||||||
|
|
||||||
if ( pSC == NULL || pSFTA == NULL || pSGMB == NULL || pSGMI == NULL ||
|
if ( pSC == nullptr || pSFTA == nullptr || pSGMB == nullptr || pSGMI == nullptr ||
|
||||||
pSGO == NULL || pSGSFA == NULL || pSI == NULL || pSSO == NULL ||
|
pSGO == nullptr || pSGSFA == nullptr || pSI == nullptr || pSSO == nullptr ||
|
||||||
pSW == NULL || pUDSN == NULL || pSLM == NULL )
|
pSW == nullptr || pUDSN == nullptr || pSLM == nullptr )
|
||||||
{
|
{
|
||||||
FreeLibrary(m_hDbhHelp);
|
FreeLibrary(m_hDbhHelp);
|
||||||
m_hDbhHelp = NULL;
|
m_hDbhHelp = nullptr;
|
||||||
pSC = NULL;
|
pSC = nullptr;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SymInitialize
|
// SymInitialize
|
||||||
if (szSymPath != NULL)
|
if (szSymPath != nullptr)
|
||||||
m_szSymPath = _strdup(szSymPath);
|
m_szSymPath = _strdup(szSymPath);
|
||||||
if (this->pSI(m_hProcess, m_szSymPath, FALSE) == FALSE)
|
if (this->pSI(m_hProcess, m_szSymPath, FALSE) == FALSE)
|
||||||
this->m_parent->OnDbgHelpErr("SymInitialize", GetLastError(), 0);
|
this->m_parent->OnDbgHelpErr("SymInitialize", GetLastError(), 0);
|
||||||
@@ -295,7 +295,7 @@ public:
|
|||||||
symOptions = this->pSSO(symOptions);
|
symOptions = this->pSSO(symOptions);
|
||||||
|
|
||||||
char buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0};
|
char buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0};
|
||||||
if (this->pSGSP != NULL)
|
if (this->pSGSP != nullptr)
|
||||||
{
|
{
|
||||||
if (this->pSGSP(m_hProcess, buf, StackWalker::STACKWALK_MAX_NAMELEN) == FALSE)
|
if (this->pSGSP(m_hProcess, buf, StackWalker::STACKWALK_MAX_NAMELEN) == FALSE)
|
||||||
this->m_parent->OnDbgHelpErr("SymGetSearchPath", GetLastError(), 0);
|
this->m_parent->OnDbgHelpErr("SymGetSearchPath", GetLastError(), 0);
|
||||||
@@ -458,10 +458,10 @@ private:
|
|||||||
|
|
||||||
// try both dlls...
|
// try both dlls...
|
||||||
const TCHAR *dllname[] = { _T("kernel32.dll"), _T("tlhelp32.dll") };
|
const TCHAR *dllname[] = { _T("kernel32.dll"), _T("tlhelp32.dll") };
|
||||||
HINSTANCE hToolhelp = NULL;
|
HINSTANCE hToolhelp = nullptr;
|
||||||
tCT32S pCT32S = NULL;
|
tCT32S pCT32S = nullptr;
|
||||||
tM32F pM32F = NULL;
|
tM32F pM32F = nullptr;
|
||||||
tM32N pM32N = NULL;
|
tM32N pM32N = nullptr;
|
||||||
|
|
||||||
HANDLE hSnap;
|
HANDLE hSnap;
|
||||||
MODULEENTRY32 me;
|
MODULEENTRY32 me;
|
||||||
@@ -472,18 +472,18 @@ private:
|
|||||||
for (i = 0; i<(sizeof(dllname) / sizeof(dllname[0])); i++ )
|
for (i = 0; i<(sizeof(dllname) / sizeof(dllname[0])); i++ )
|
||||||
{
|
{
|
||||||
hToolhelp = LoadLibrary( dllname[i] );
|
hToolhelp = LoadLibrary( dllname[i] );
|
||||||
if (hToolhelp == NULL)
|
if (hToolhelp == nullptr)
|
||||||
continue;
|
continue;
|
||||||
pCT32S = (tCT32S) GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot");
|
pCT32S = (tCT32S) GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot");
|
||||||
pM32F = (tM32F) GetProcAddress(hToolhelp, "Module32First");
|
pM32F = (tM32F) GetProcAddress(hToolhelp, "Module32First");
|
||||||
pM32N = (tM32N) GetProcAddress(hToolhelp, "Module32Next");
|
pM32N = (tM32N) GetProcAddress(hToolhelp, "Module32Next");
|
||||||
if ( (pCT32S != NULL) && (pM32F != NULL) && (pM32N != NULL) )
|
if ( (pCT32S != nullptr) && (pM32F != nullptr) && (pM32N != nullptr) )
|
||||||
break; // found the functions!
|
break; // found the functions!
|
||||||
FreeLibrary(hToolhelp);
|
FreeLibrary(hToolhelp);
|
||||||
hToolhelp = NULL;
|
hToolhelp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hToolhelp == NULL)
|
if (hToolhelp == nullptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
hSnap = pCT32S( TH32CS_SNAPMODULE, pid );
|
hSnap = pCT32S( TH32CS_SNAPMODULE, pid );
|
||||||
@@ -534,20 +534,20 @@ private:
|
|||||||
DWORD cbNeeded;
|
DWORD cbNeeded;
|
||||||
MODULEINFO mi;
|
MODULEINFO mi;
|
||||||
HMODULE *hMods = 0;
|
HMODULE *hMods = 0;
|
||||||
char *tt = NULL;
|
char *tt = nullptr;
|
||||||
char *tt2 = NULL;
|
char *tt2 = nullptr;
|
||||||
const SIZE_T TTBUFLEN = 8096;
|
const SIZE_T TTBUFLEN = 8096;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
hPsapi = LoadLibrary( _T("psapi.dll") );
|
hPsapi = LoadLibrary( _T("psapi.dll") );
|
||||||
if (hPsapi == NULL)
|
if (hPsapi == nullptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pEPM = (tEPM) GetProcAddress( hPsapi, "EnumProcessModules" );
|
pEPM = (tEPM) GetProcAddress( hPsapi, "EnumProcessModules" );
|
||||||
pGMFNE = (tGMFNE) GetProcAddress( hPsapi, "GetModuleFileNameExA" );
|
pGMFNE = (tGMFNE) GetProcAddress( hPsapi, "GetModuleFileNameExA" );
|
||||||
pGMBN = (tGMFNE) GetProcAddress( hPsapi, "GetModuleBaseNameA" );
|
pGMBN = (tGMFNE) GetProcAddress( hPsapi, "GetModuleBaseNameA" );
|
||||||
pGMI = (tGMI) GetProcAddress( hPsapi, "GetModuleInformation" );
|
pGMI = (tGMI) GetProcAddress( hPsapi, "GetModuleInformation" );
|
||||||
if ( (pEPM == NULL) || (pGMFNE == NULL) || (pGMBN == NULL) || (pGMI == NULL) )
|
if ( (pEPM == nullptr) || (pGMFNE == nullptr) || (pGMBN == nullptr) || (pGMI == nullptr) )
|
||||||
{
|
{
|
||||||
// we couldn?t find all functions
|
// we couldn?t find all functions
|
||||||
FreeLibrary(hPsapi);
|
FreeLibrary(hPsapi);
|
||||||
@@ -557,7 +557,7 @@ private:
|
|||||||
hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof HMODULE));
|
hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof HMODULE));
|
||||||
tt = (char*) malloc(sizeof(char) * TTBUFLEN);
|
tt = (char*) malloc(sizeof(char) * TTBUFLEN);
|
||||||
tt2 = (char*) malloc(sizeof(char) * TTBUFLEN);
|
tt2 = (char*) malloc(sizeof(char) * TTBUFLEN);
|
||||||
if ( (hMods == NULL) || (tt == NULL) || (tt2 == NULL) )
|
if ( (hMods == nullptr) || (tt == nullptr) || (tt2 == nullptr) )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ( ! pEPM( hProcess, hMods, TTBUFLEN, &cbNeeded ) )
|
if ( ! pEPM( hProcess, hMods, TTBUFLEN, &cbNeeded ) )
|
||||||
@@ -590,10 +590,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (hPsapi != NULL) FreeLibrary(hPsapi);
|
if (hPsapi != nullptr) FreeLibrary(hPsapi);
|
||||||
if (tt2 != NULL) free(tt2);
|
if (tt2 != nullptr) free(tt2);
|
||||||
if (tt != NULL) free(tt);
|
if (tt != nullptr) free(tt);
|
||||||
if (hMods != NULL) free(hMods);
|
if (hMods != nullptr) free(hMods);
|
||||||
|
|
||||||
return cnt != 0;
|
return cnt != 0;
|
||||||
} // GetModuleListPSAPI
|
} // GetModuleListPSAPI
|
||||||
@@ -603,7 +603,7 @@ private:
|
|||||||
CHAR *szImg = _strdup(img);
|
CHAR *szImg = _strdup(img);
|
||||||
CHAR *szMod = _strdup(mod);
|
CHAR *szMod = _strdup(mod);
|
||||||
DWORD result = ERROR_SUCCESS;
|
DWORD result = ERROR_SUCCESS;
|
||||||
if ( (szImg == NULL) || (szMod == NULL) )
|
if ( (szImg == nullptr) || (szMod == nullptr) )
|
||||||
result = ERROR_NOT_ENOUGH_MEMORY;
|
result = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -611,25 +611,25 @@ private:
|
|||||||
result = GetLastError();
|
result = GetLastError();
|
||||||
}
|
}
|
||||||
ULONGLONG fileVersion = 0;
|
ULONGLONG fileVersion = 0;
|
||||||
if ( (m_parent != NULL) && (szImg != NULL) )
|
if ( (m_parent != nullptr) && (szImg != nullptr) )
|
||||||
{
|
{
|
||||||
// try to retrive the file-version:
|
// try to retrive the file-version:
|
||||||
if ( (this->m_parent->m_options & StackWalker::RetrieveFileVersion) != 0)
|
if ( (this->m_parent->m_options & StackWalker::RetrieveFileVersion) != 0)
|
||||||
{
|
{
|
||||||
VS_FIXEDFILEINFO *fInfo = NULL;
|
VS_FIXEDFILEINFO *fInfo = nullptr;
|
||||||
DWORD dwHandle;
|
DWORD dwHandle;
|
||||||
DWORD dwSize = GetFileVersionInfoSizeA(szImg, &dwHandle);
|
DWORD dwSize = GetFileVersionInfoSizeA(szImg, &dwHandle);
|
||||||
if (dwSize > 0)
|
if (dwSize > 0)
|
||||||
{
|
{
|
||||||
LPVOID vData = malloc(dwSize);
|
LPVOID vData = malloc(dwSize);
|
||||||
if (vData != NULL)
|
if (vData != nullptr)
|
||||||
{
|
{
|
||||||
if (GetFileVersionInfoA(szImg, dwHandle, dwSize, vData) != 0)
|
if (GetFileVersionInfoA(szImg, dwHandle, dwSize, vData) != 0)
|
||||||
{
|
{
|
||||||
UINT len;
|
UINT len;
|
||||||
TCHAR szSubBlock[] = _T("\\");
|
TCHAR szSubBlock[] = _T("\\");
|
||||||
if (VerQueryValue(vData, szSubBlock, (LPVOID*) &fInfo, &len) == 0)
|
if (VerQueryValue(vData, szSubBlock, (LPVOID*) &fInfo, &len) == 0)
|
||||||
fInfo = NULL;
|
fInfo = nullptr;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileVersion = ((ULONGLONG)fInfo->dwFileVersionLS) + ((ULONGLONG)fInfo->dwFileVersionMS << 32);
|
fileVersion = ((ULONGLONG)fInfo->dwFileVersionLS) + ((ULONGLONG)fInfo->dwFileVersionMS << 32);
|
||||||
@@ -678,8 +678,8 @@ private:
|
|||||||
}
|
}
|
||||||
this->m_parent->OnLoadModule(img, mod, baseAddr, size, result, szSymType, Module.LoadedImageName, fileVersion);
|
this->m_parent->OnLoadModule(img, mod, baseAddr, size, result, szSymType, Module.LoadedImageName, fileVersion);
|
||||||
}
|
}
|
||||||
if (szImg != NULL) free(szImg);
|
if (szImg != nullptr) free(szImg);
|
||||||
if (szMod != NULL) free(szMod);
|
if (szMod != nullptr) free(szMod);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@@ -695,7 +695,7 @@ public:
|
|||||||
|
|
||||||
BOOL GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V2 *pModuleInfo)
|
BOOL GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V2 *pModuleInfo)
|
||||||
{
|
{
|
||||||
if(this->pSGMI == NULL)
|
if(this->pSGMI == nullptr)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -703,7 +703,7 @@ public:
|
|||||||
// First try to use the larger ModuleInfo-Structure
|
// First try to use the larger ModuleInfo-Structure
|
||||||
// memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3));
|
// memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3));
|
||||||
// pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3);
|
// pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3);
|
||||||
// if (this->pSGMI_V3 != NULL)
|
// if (this->pSGMI_V3 != nullptr)
|
||||||
// {
|
// {
|
||||||
// if (this->pSGMI_V3(hProcess, baseAddr, pModuleInfo) != FALSE)
|
// if (this->pSGMI_V3(hProcess, baseAddr, pModuleInfo) != FALSE)
|
||||||
// return TRUE;
|
// return TRUE;
|
||||||
@@ -714,7 +714,7 @@ public:
|
|||||||
// could not retrive the bigger structure, try with the smaller one (as defined in VC7.1)...
|
// could not retrive the bigger structure, try with the smaller one (as defined in VC7.1)...
|
||||||
pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2);
|
pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2);
|
||||||
void *pData = malloc(4096); // reserve enough memory, so the bug in v6.3.5.1 does not lead to memory-overwrites...
|
void *pData = malloc(4096); // reserve enough memory, so the bug in v6.3.5.1 does not lead to memory-overwrites...
|
||||||
if (pData == NULL)
|
if (pData == nullptr)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -742,7 +742,7 @@ StackWalker::StackWalker(DWORD dwProcessId, HANDLE hProcess)
|
|||||||
this->m_hProcess = hProcess;
|
this->m_hProcess = hProcess;
|
||||||
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
||||||
this->m_dwProcessId = dwProcessId;
|
this->m_dwProcessId = dwProcessId;
|
||||||
this->m_szSymPath = NULL;
|
this->m_szSymPath = nullptr;
|
||||||
}
|
}
|
||||||
StackWalker::StackWalker(int options, LPCSTR szSymPath, DWORD dwProcessId, HANDLE hProcess)
|
StackWalker::StackWalker(int options, LPCSTR szSymPath, DWORD dwProcessId, HANDLE hProcess)
|
||||||
{
|
{
|
||||||
@@ -751,28 +751,28 @@ StackWalker::StackWalker(int options, LPCSTR szSymPath, DWORD dwProcessId, HANDL
|
|||||||
this->m_hProcess = hProcess;
|
this->m_hProcess = hProcess;
|
||||||
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
||||||
this->m_dwProcessId = dwProcessId;
|
this->m_dwProcessId = dwProcessId;
|
||||||
if (szSymPath != NULL)
|
if (szSymPath != nullptr)
|
||||||
{
|
{
|
||||||
this->m_szSymPath = _strdup(szSymPath);
|
this->m_szSymPath = _strdup(szSymPath);
|
||||||
this->m_options |= SymBuildPath;
|
this->m_options |= SymBuildPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this->m_szSymPath = NULL;
|
this->m_szSymPath = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
StackWalker::~StackWalker()
|
StackWalker::~StackWalker()
|
||||||
{
|
{
|
||||||
if (m_szSymPath != NULL)
|
if (m_szSymPath != nullptr)
|
||||||
free(m_szSymPath);
|
free(m_szSymPath);
|
||||||
m_szSymPath = NULL;
|
m_szSymPath = nullptr;
|
||||||
if (this->m_sw != NULL)
|
if (this->m_sw != nullptr)
|
||||||
delete this->m_sw;
|
delete this->m_sw;
|
||||||
this->m_sw = NULL;
|
this->m_sw = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL StackWalker::LoadModules()
|
BOOL StackWalker::LoadModules()
|
||||||
{
|
{
|
||||||
if (this->m_sw == NULL)
|
if (this->m_sw == nullptr)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -781,19 +781,19 @@ BOOL StackWalker::LoadModules()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
// Build the sym-path:
|
// Build the sym-path:
|
||||||
char *szSymPath = NULL;
|
char *szSymPath = nullptr;
|
||||||
if ( (this->m_options & SymBuildPath) != 0)
|
if ( (this->m_options & SymBuildPath) != 0)
|
||||||
{
|
{
|
||||||
const size_t nSymPathLen = 4096;
|
const size_t nSymPathLen = 4096;
|
||||||
szSymPath = (char*) malloc(nSymPathLen);
|
szSymPath = (char*) malloc(nSymPathLen);
|
||||||
if (szSymPath == NULL)
|
if (szSymPath == nullptr)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
szSymPath[0] = 0;
|
szSymPath[0] = 0;
|
||||||
// Now first add the (optional) provided sympath:
|
// Now first add the (optional) provided sympath:
|
||||||
if (this->m_szSymPath != NULL)
|
if (this->m_szSymPath != nullptr)
|
||||||
{
|
{
|
||||||
strcat_s(szSymPath, nSymPathLen, this->m_szSymPath);
|
strcat_s(szSymPath, nSymPathLen, this->m_szSymPath);
|
||||||
strcat_s(szSymPath, nSymPathLen, ";");
|
strcat_s(szSymPath, nSymPathLen, ";");
|
||||||
@@ -812,7 +812,7 @@ BOOL StackWalker::LoadModules()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now add the path for the main-module:
|
// Now add the path for the main-module:
|
||||||
if (GetModuleFileNameA(NULL, szTemp, nTempLen) > 0)
|
if (GetModuleFileNameA(nullptr, szTemp, nTempLen) > 0)
|
||||||
{
|
{
|
||||||
szTemp[nTempLen-1] = 0;
|
szTemp[nTempLen-1] = 0;
|
||||||
for (char *p = (szTemp+strlen(szTemp)-1); p >= szTemp; --p)
|
for (char *p = (szTemp+strlen(szTemp)-1); p >= szTemp; --p)
|
||||||
@@ -870,7 +870,7 @@ BOOL StackWalker::LoadModules()
|
|||||||
|
|
||||||
// First Init the whole stuff...
|
// First Init the whole stuff...
|
||||||
BOOL bRet = this->m_sw->Init(szSymPath);
|
BOOL bRet = this->m_sw->Init(szSymPath);
|
||||||
if (szSymPath != NULL) free(szSymPath); szSymPath = NULL;
|
if (szSymPath != nullptr) free(szSymPath); szSymPath = nullptr;
|
||||||
if (bRet == FALSE)
|
if (bRet == FALSE)
|
||||||
{
|
{
|
||||||
this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0);
|
this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0);
|
||||||
@@ -889,14 +889,14 @@ BOOL StackWalker::LoadModules()
|
|||||||
// This has to be done due to a problem with the "hProcess"-parameter in x64...
|
// This has to be done due to a problem with the "hProcess"-parameter in x64...
|
||||||
// Because this class is in no case multi-threading-enabled (because of the limitations
|
// Because this class is in no case multi-threading-enabled (because of the limitations
|
||||||
// of dbghelp.dll) it is "safe" to use a static-variable
|
// of dbghelp.dll) it is "safe" to use a static-variable
|
||||||
static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = NULL;
|
static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = nullptr;
|
||||||
static LPVOID s_readMemoryFunction_UserData = NULL;
|
static LPVOID s_readMemoryFunction_UserData = nullptr;
|
||||||
|
|
||||||
BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData)
|
BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData)
|
||||||
{
|
{
|
||||||
CONTEXT c;;
|
CONTEXT c;;
|
||||||
CallstackEntry csEntry;
|
CallstackEntry csEntry;
|
||||||
IMAGEHLP_SYMBOL64 *pSym = NULL;
|
IMAGEHLP_SYMBOL64 *pSym = nullptr;
|
||||||
StackWalkerInternal::IMAGEHLP_MODULE64_V2 Module;
|
StackWalkerInternal::IMAGEHLP_MODULE64_V2 Module;
|
||||||
IMAGEHLP_LINE64 Line;
|
IMAGEHLP_LINE64 Line;
|
||||||
int frameNum;
|
int frameNum;
|
||||||
@@ -904,7 +904,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
if (m_modulesLoaded == FALSE)
|
if (m_modulesLoaded == FALSE)
|
||||||
this->LoadModules(); // ignore the result...
|
this->LoadModules(); // ignore the result...
|
||||||
|
|
||||||
if (this->m_sw->m_hDbhHelp == NULL)
|
if (this->m_sw->m_hDbhHelp == nullptr)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -913,7 +913,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
s_readMemoryFunction = readMemoryFunction;
|
s_readMemoryFunction = readMemoryFunction;
|
||||||
s_readMemoryFunction_UserData = pUserData;
|
s_readMemoryFunction_UserData = pUserData;
|
||||||
|
|
||||||
if (context == NULL)
|
if (context == nullptr)
|
||||||
{
|
{
|
||||||
// If no context is provided, capture the context
|
// If no context is provided, capture the context
|
||||||
if (hThread == GetCurrentThread())
|
if (hThread == GetCurrentThread())
|
||||||
@@ -989,7 +989,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
// assume that either you are done, or that the stack is so hosed that the next
|
// assume that either you are done, or that the stack is so hosed that the next
|
||||||
// deeper frame could not be found.
|
// deeper frame could not be found.
|
||||||
// CONTEXT need not to be suplied if imageTyp is IMAGE_FILE_MACHINE_I386!
|
// CONTEXT need not to be suplied if imageTyp is IMAGE_FILE_MACHINE_I386!
|
||||||
if ( ! this->m_sw->pSW(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem, this->m_sw->pSFTA, this->m_sw->pSGMB, NULL) )
|
if ( ! this->m_sw->pSW(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem, this->m_sw->pSFTA, this->m_sw->pSGMB, nullptr) )
|
||||||
{
|
{
|
||||||
this->OnDbgHelpErr("StackWalk64", GetLastError(), s.AddrPC.Offset);
|
this->OnDbgHelpErr("StackWalk64", GetLastError(), s.AddrPC.Offset);
|
||||||
break;
|
break;
|
||||||
@@ -1028,7 +1028,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show line number info, NT5.0-method (SymGetLineFromAddr64())
|
// show line number info, NT5.0-method (SymGetLineFromAddr64())
|
||||||
if (this->m_sw->pSGLFA != NULL )
|
if (this->m_sw->pSGLFA != nullptr )
|
||||||
{ // yes, we have SymGetLineFromAddr64()
|
{ // yes, we have SymGetLineFromAddr64()
|
||||||
if (this->m_sw->pSGLFA(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromLine), &Line) != FALSE)
|
if (this->m_sw->pSGLFA(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromLine), &Line) != FALSE)
|
||||||
{
|
{
|
||||||
@@ -1078,7 +1078,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//_snprintf( ty, sizeof ty, "symtype=%ld", (long) Module.SymType );
|
//_snprintf( ty, sizeof ty, "symtype=%ld", (long) Module.SymType );
|
||||||
csEntry.symTypeString = NULL;
|
csEntry.symTypeString = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1109,7 +1109,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (pSym) free( pSym );
|
if (pSym) free( pSym );
|
||||||
|
|
||||||
if (context == NULL)
|
if (context == nullptr)
|
||||||
ResumeThread(hThread);
|
ResumeThread(hThread);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1123,7 +1123,7 @@ BOOL __stdcall StackWalker::myReadProcMem(
|
|||||||
LPDWORD lpNumberOfBytesRead
|
LPDWORD lpNumberOfBytesRead
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (s_readMemoryFunction == NULL)
|
if (s_readMemoryFunction == nullptr)
|
||||||
{
|
{
|
||||||
SIZE_T st;
|
SIZE_T st;
|
||||||
BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st);
|
BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
StackWalker(
|
StackWalker(
|
||||||
int options = OptionsAll, // 'int' is by design, to combine the enum-flags
|
int options = OptionsAll, // 'int' is by design, to combine the enum-flags
|
||||||
LPCSTR szSymPath = NULL,
|
LPCSTR szSymPath = nullptr,
|
||||||
DWORD dwProcessId = GetCurrentProcessId(),
|
DWORD dwProcessId = GetCurrentProcessId(),
|
||||||
HANDLE hProcess = GetCurrentProcess()
|
HANDLE hProcess = GetCurrentProcess()
|
||||||
);
|
);
|
||||||
@@ -86,9 +86,9 @@ public:
|
|||||||
|
|
||||||
BOOL ShowCallstack(
|
BOOL ShowCallstack(
|
||||||
HANDLE hThread = GetCurrentThread(),
|
HANDLE hThread = GetCurrentThread(),
|
||||||
const CONTEXT *context = NULL,
|
const CONTEXT *context = nullptr,
|
||||||
PReadProcessMemoryRoutine readMemoryFunction = NULL,
|
PReadProcessMemoryRoutine readMemoryFunction = nullptr,
|
||||||
LPVOID pUserData = NULL // optional to identify some data in the 'readMemoryFunction'-callback
|
LPVOID pUserData = nullptr // optional to identify some data in the 'readMemoryFunction'-callback
|
||||||
);
|
);
|
||||||
|
|
||||||
#if _MSC_VER >= 1300
|
#if _MSC_VER >= 1300
|
||||||
@@ -157,11 +157,11 @@ protected:
|
|||||||
#define GET_CURRENT_CONTEXT(c, contextFlags) \
|
#define GET_CURRENT_CONTEXT(c, contextFlags) \
|
||||||
do { \
|
do { \
|
||||||
memset(&c, 0, sizeof(CONTEXT)); \
|
memset(&c, 0, sizeof(CONTEXT)); \
|
||||||
EXCEPTION_POINTERS *pExp = NULL; \
|
EXCEPTION_POINTERS *pExp = nullptr; \
|
||||||
__try { \
|
__try { \
|
||||||
throw 0; \
|
throw 0; \
|
||||||
} __except( ( (pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER)) {} \
|
} __except( ( (pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER)) {} \
|
||||||
if (pExp != NULL) \
|
if (pExp != nullptr) \
|
||||||
memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
|
memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \
|
||||||
c.ContextFlags = contextFlags; \
|
c.ContextFlags = contextFlags; \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|||||||
@@ -1,59 +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
|
|
||||||
*/
|
|
||||||
#ifndef XMLParser_H
|
|
||||||
#define XMLParser_H
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
#include "tinyxml/tinyxml.h"
|
|
||||||
#include "../common/types.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* See note in XMLParser::ParseFile() before inheriting this class.
|
|
||||||
*/
|
|
||||||
class XMLParser {
|
|
||||||
public:
|
|
||||||
typedef void (XMLParser::*ElementHandler)(TiXmlElement *ele);
|
|
||||||
|
|
||||||
XMLParser();
|
|
||||||
virtual ~XMLParser() {}
|
|
||||||
|
|
||||||
bool ParseFile(const char *file, const char *root_ele);
|
|
||||||
bool ParseStatus() const { return ParseOkay; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const char *ParseTextBlock(TiXmlNode *within, const char *name, bool optional = false);
|
|
||||||
const char *GetText(TiXmlNode *within, bool optional = false);
|
|
||||||
|
|
||||||
map<string,ElementHandler> Handlers;
|
|
||||||
|
|
||||||
bool ParseOkay;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+190
@@ -0,0 +1,190 @@
|
|||||||
|
/*
|
||||||
|
* Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
* obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
* this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
* execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
* Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
* do so, all subject to the following:
|
||||||
|
*
|
||||||
|
* The copyright notices in the Software and this entire statement, including
|
||||||
|
* the above license grant, this restriction and the following disclaimer,
|
||||||
|
* must be included in all copies of the Software, in whole or in part, and
|
||||||
|
* all derivative works of the Software, unless such copies or derivative
|
||||||
|
* works are solely in the form of machine-executable object code generated by
|
||||||
|
* a source language processor.
|
||||||
|
*
|
||||||
|
* 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// EQEmu::Any is a modified version of Boost::Any and as such retains the Boost licensing.
|
||||||
|
|
||||||
|
#ifndef EQEMU_COMMON_ANY_H
|
||||||
|
#define EQEMU_COMMON_ANY_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
namespace EQEmu
|
||||||
|
{
|
||||||
|
class Any
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Any()
|
||||||
|
: content(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
Any(const ValueType &value)
|
||||||
|
: content(new Holder<ValueType>(value))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Any(const Any &other)
|
||||||
|
: content(other.content ? other.content->clone() : 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~Any()
|
||||||
|
{
|
||||||
|
if(content)
|
||||||
|
delete content;
|
||||||
|
}
|
||||||
|
|
||||||
|
Any& swap(Any &rhs)
|
||||||
|
{
|
||||||
|
std::swap(content, rhs.content);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
Any& operator=(const ValueType &rhs)
|
||||||
|
{
|
||||||
|
Any(rhs).swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Any& operator=(Any rhs)
|
||||||
|
{
|
||||||
|
rhs.swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return !content;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::type_info& type() const
|
||||||
|
{
|
||||||
|
return content ? content->type() : typeid(void);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Placeholder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~Placeholder()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const std::type_info& type() const = 0;
|
||||||
|
virtual Placeholder* clone() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
class Holder : public Placeholder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Holder(const ValueType &value)
|
||||||
|
: held(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const std::type_info& type() const
|
||||||
|
{
|
||||||
|
return typeid(ValueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual Placeholder* clone() const
|
||||||
|
{
|
||||||
|
return new Holder(held);
|
||||||
|
}
|
||||||
|
|
||||||
|
ValueType held;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Holder& operator=(const Holder&);
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
template<typename ValueType>
|
||||||
|
friend ValueType* any_cast(Any*);
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
friend ValueType* unsafe_any_cast(Any*);
|
||||||
|
|
||||||
|
Placeholder* content;
|
||||||
|
};
|
||||||
|
|
||||||
|
class bad_any_cast : public std::bad_cast
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char * what() const throw()
|
||||||
|
{
|
||||||
|
return "DBI::bad_any_cast: failed conversion using DBI::any_cast";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
ValueType* any_cast(Any* operand)
|
||||||
|
{
|
||||||
|
return operand &&
|
||||||
|
operand->type() == typeid(ValueType) ? &static_cast<Any::Holder<ValueType>*>(operand->content)->held : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
inline const ValueType* any_cast(const Any* operand)
|
||||||
|
{
|
||||||
|
return any_cast<ValueType>(const_cast<Any*>(operand));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
ValueType any_cast(Any& operand)
|
||||||
|
{
|
||||||
|
typedef typename std::remove_reference<ValueType>::type nonref;
|
||||||
|
nonref* result = any_cast<nonref>(&operand);
|
||||||
|
if(!result)
|
||||||
|
throw bad_any_cast();
|
||||||
|
return *result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
inline ValueType any_cast(const Any& operand)
|
||||||
|
{
|
||||||
|
typedef typename std::remove_reference<ValueType>::type nonref;
|
||||||
|
return any_cast<const nonref&>(const_cast<Any&>(operand));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
inline ValueType* unsafe_any_cast(Any* operand)
|
||||||
|
{
|
||||||
|
return &static_cast<Any::Holder<ValueType>*>(operand->content)->held;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ValueType>
|
||||||
|
inline const ValueType* unsafe_any_cast(const Any* operand)
|
||||||
|
{
|
||||||
|
return unsafe_any_cast<ValueType>(const_cast<Any*>(operand));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
Copyright (C) 2001-2013 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 __EQEMU_COMMON_BASE_DATA_H
|
||||||
|
#define __EQEMU_COMMON_BASE_DATA_H
|
||||||
|
|
||||||
|
struct BaseDataStruct
|
||||||
|
{
|
||||||
|
double base_hp;
|
||||||
|
double base_mana;
|
||||||
|
double base_end;
|
||||||
|
double unk1;
|
||||||
|
double unk2;
|
||||||
|
double hp_factor;
|
||||||
|
double mana_factor;
|
||||||
|
double endurance_factor;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2006 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "BasePacket.h"
|
#include "base_packet.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "packet_dump.h"
|
#include "packet_dump.h"
|
||||||
|
|
||||||
@@ -24,16 +24,17 @@
|
|||||||
|
|
||||||
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
|
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
|
||||||
{
|
{
|
||||||
this->pBuffer=NULL;
|
this->pBuffer=nullptr;
|
||||||
this->size=0;
|
this->size=0;
|
||||||
this->_wpos = 0;
|
this->_wpos = 0;
|
||||||
this->_rpos = 0;
|
this->_rpos = 0;
|
||||||
|
this->timestamp.tv_sec = 0;
|
||||||
if (len>0) {
|
if (len>0) {
|
||||||
this->size=len;
|
this->size=len;
|
||||||
pBuffer= new unsigned char[len];
|
pBuffer= new unsigned char[len];
|
||||||
if (buf) {
|
if (buf) {
|
||||||
memcpy(this->pBuffer,buf,len);
|
memcpy(this->pBuffer,buf,len);
|
||||||
} else {
|
} else {
|
||||||
memset(this->pBuffer,0,len);
|
memset(this->pBuffer,0,len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +44,7 @@ BasePacket::~BasePacket()
|
|||||||
{
|
{
|
||||||
if (pBuffer)
|
if (pBuffer)
|
||||||
delete[] pBuffer;
|
delete[] pBuffer;
|
||||||
pBuffer=NULL;
|
pBuffer=nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ void BasePacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
|||||||
buffer += sprintf(buffer, "%s.%06lu ",temp,timestamp.tv_usec);
|
buffer += sprintf(buffer, "%s.%06lu ",temp,timestamp.tv_usec);
|
||||||
}
|
}
|
||||||
if (src_ip) {
|
if (src_ip) {
|
||||||
string sIP,dIP;;
|
std::string sIP,dIP;;
|
||||||
sIP=long2ip(src_ip);
|
sIP=long2ip(src_ip);
|
||||||
dIP=long2ip(dst_ip);
|
dIP=long2ip(dst_ip);
|
||||||
buffer += sprintf(buffer, "[%s:%d->%s:%d]\n",sIP.c_str(),src_port,dIP.c_str(),dst_port);
|
buffer += sprintf(buffer, "[%s:%d->%s:%d]\n",sIP.c_str(),src_port,dIP.c_str(),dst_port);
|
||||||
@@ -79,7 +80,7 @@ void BasePacket::build_header_dump(char *buffer) const
|
|||||||
void BasePacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
void BasePacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||||
{
|
{
|
||||||
if (src_ip) {
|
if (src_ip) {
|
||||||
string sIP,dIP;;
|
std::string sIP,dIP;;
|
||||||
sIP=long2ip(src_ip);
|
sIP=long2ip(src_ip);
|
||||||
dIP=long2ip(dst_ip);
|
dIP=long2ip(dst_ip);
|
||||||
fprintf(to, "[%s:%d->%s:%d] ",sIP.c_str(),src_port,dIP.c_str(),dst_port);
|
fprintf(to, "[%s:%d->%s:%d] ",sIP.c_str(),src_port,dIP.c_str(),dst_port);
|
||||||
@@ -123,24 +124,3 @@ void DumpPacketBin(const BasePacket* app) {
|
|||||||
DumpPacketBin(app->pBuffer, app->size);
|
DumpPacketBin(app->pBuffer, app->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2006 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 BASEPACKET_H_
|
#ifndef BASEPACKET_H_
|
||||||
#define BASEPACKET_H_
|
#define BASEPACKET_H_
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
void setSrcInfo(uint32 sip, uint16 sport) { src_ip=sip; src_port=sport; }
|
void setSrcInfo(uint32 sip, uint16 sport) { src_ip=sip; src_port=sport; }
|
||||||
void setDstInfo(uint32 dip, uint16 dport) { dst_ip=dip; dst_port=dport; }
|
void setDstInfo(uint32 dip, uint16 dport) { dst_ip=dip; dst_port=dport; }
|
||||||
void setTimeInfo(uint32 ts_sec, uint32 ts_usec) { timestamp.tv_sec=ts_sec; timestamp.tv_usec=ts_usec; }
|
void setTimeInfo(uint32 ts_sec, uint32 ts_usec) { timestamp.tv_sec=ts_sec; timestamp.tv_usec=ts_usec; }
|
||||||
void copyInfo(const BasePacket *p) { src_ip=p->src_ip; src_port=p->src_port; dst_ip=p->dst_ip; dst_port=p->dst_port; timestamp.tv_sec=p->timestamp.tv_sec; timestamp.tv_usec=p->timestamp.tv_usec; }
|
void copyInfo(const BasePacket *p) { src_ip=p->src_ip; src_port=p->src_port; dst_ip=p->dst_ip; dst_port=p->dst_port; timestamp.tv_sec=p->timestamp.tv_sec; timestamp.tv_usec=p->timestamp.tv_usec; }
|
||||||
|
|
||||||
inline bool operator<(const BasePacket &rhs) {
|
inline bool operator<(const BasePacket &rhs) {
|
||||||
return (timestamp.tv_sec < rhs.timestamp.tv_sec || (timestamp.tv_sec==rhs.timestamp.tv_sec && timestamp.tv_usec < rhs.timestamp.tv_usec));
|
return (timestamp.tv_sec < rhs.timestamp.tv_sec || (timestamp.tv_sec==rhs.timestamp.tv_sec && timestamp.tv_usec < rhs.timestamp.tv_usec));
|
||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~BasePacket();
|
virtual ~BasePacket();
|
||||||
BasePacket() { pBuffer=NULL; size=0; _wpos = 0; _rpos = 0; }
|
BasePacket() { pBuffer=nullptr; size=0; _wpos = 0; _rpos = 0; }
|
||||||
BasePacket(const unsigned char *buf, const uint32 len);
|
BasePacket(const unsigned char *buf, const uint32 len);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,5 +89,3 @@ extern void DumpPacketBin(const BasePacket* app);
|
|||||||
|
|
||||||
#endif /*BASEPACKET_H_*/
|
#endif /*BASEPACKET_H_*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+12
-12
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||||
|
|
||||||
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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 BODYTYPES_H
|
#ifndef BODYTYPES_H
|
||||||
#define BODYTYPES_H
|
#define BODYTYPES_H
|
||||||
@@ -45,7 +45,7 @@ typedef enum {
|
|||||||
BT_Dragon = 26,
|
BT_Dragon = 26,
|
||||||
BT_Summoned2 = 27,
|
BT_Summoned2 = 27,
|
||||||
BT_Summoned3 = 28,
|
BT_Summoned3 = 28,
|
||||||
// 29
|
//29
|
||||||
BT_VeliousDragon = 30, //might not be a tight set
|
BT_VeliousDragon = 30, //might not be a tight set
|
||||||
// ...
|
// ...
|
||||||
BT_Dragon3 = 32,
|
BT_Dragon3 = 32,
|
||||||
|
|||||||
+11
-11
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2006 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 BREAKDOWNS_H_
|
#ifndef BREAKDOWNS_H_
|
||||||
#define BREAKDOWNS_H_
|
#define BREAKDOWNS_H_
|
||||||
|
|||||||
+251
-251
@@ -1,279 +1,279 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||||
|
|
||||||
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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "../common/classes.h"
|
#include "../common/classes.h"
|
||||||
|
|
||||||
const char* GetEQClassName(uint8 class_, uint8 level) {
|
const char* GetEQClassName(uint8 class_, uint8 level) {
|
||||||
switch(class_) {
|
switch(class_) {
|
||||||
case WARRIOR:
|
case WARRIOR:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Vanquisher";
|
return "Vanquisher";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Warlord";
|
return "Warlord";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Myrmidon";
|
return "Myrmidon";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Champion";
|
return "Champion";
|
||||||
else
|
else
|
||||||
return "Warrior";
|
return "Warrior";
|
||||||
case CLERIC:
|
case CLERIC:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Prelate";
|
return "Prelate";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Archon";
|
return "Archon";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "High Priest";
|
return "High Priest";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Templar";
|
return "Templar";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Vicar";
|
return "Vicar";
|
||||||
else
|
else
|
||||||
return "Cleric";
|
return "Cleric";
|
||||||
case PALADIN:
|
case PALADIN:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Lord";
|
return "Lord";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Lord Protector";
|
return "Lord Protector";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Crusader";
|
return "Crusader";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Knight";
|
return "Knight";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Cavalier";
|
return "Cavalier";
|
||||||
else
|
else
|
||||||
return "Paladin";
|
return "Paladin";
|
||||||
case RANGER:
|
case RANGER:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Plainswalker";
|
return "Plainswalker";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Forest Stalker";
|
return "Forest Stalker";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Warder";
|
return "Warder";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Outrider";
|
return "Outrider";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Pathfinder";
|
return "Pathfinder";
|
||||||
else
|
else
|
||||||
return "Ranger";
|
return "Ranger";
|
||||||
case SHADOWKNIGHT:
|
case SHADOWKNIGHT:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Scourge Knight";
|
return "Scourge Knight";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Dread Lord";
|
return "Dread Lord";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Grave Lord";
|
return "Grave Lord";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Revenant";
|
return "Revenant";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Reaver";
|
return "Reaver";
|
||||||
else
|
else
|
||||||
return "Shadowknight";
|
return "Shadowknight";
|
||||||
case DRUID:
|
case DRUID:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Natureguard";
|
return "Natureguard";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Storm Warden";
|
return "Storm Warden";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Hierophant";
|
return "Hierophant";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Preserver";
|
return "Preserver";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Wanderer";
|
return "Wanderer";
|
||||||
else
|
else
|
||||||
return "Druid";
|
return "Druid";
|
||||||
case MONK:
|
case MONK:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Stone Fist";
|
return "Stone Fist";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Transcendent";
|
return "Transcendent";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Grandmaster";
|
return "Grandmaster";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Master";
|
return "Master";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Disciple";
|
return "Disciple";
|
||||||
else
|
else
|
||||||
return "Monk";
|
return "Monk";
|
||||||
case BARD:
|
case BARD:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Performer";
|
return "Performer";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Maestro";
|
return "Maestro";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Virtuoso";
|
return "Virtuoso";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Troubadour";
|
return "Troubadour";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Minstrel";
|
return "Minstrel";
|
||||||
else
|
else
|
||||||
return "Bard";
|
return "Bard";
|
||||||
case ROGUE:
|
case ROGUE:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Nemesis";
|
return "Nemesis";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Deceiver";
|
return "Deceiver";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Assassin";
|
return "Assassin";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Blackguard";
|
return "Blackguard";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Rake";
|
return "Rake";
|
||||||
else
|
else
|
||||||
return "Rogue";
|
return "Rogue";
|
||||||
case SHAMAN:
|
case SHAMAN:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Soothsayer";
|
return "Soothsayer";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Prophet";
|
return "Prophet";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Oracle";
|
return "Oracle";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Luminary";
|
return "Luminary";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Mystic";
|
return "Mystic";
|
||||||
else
|
else
|
||||||
return "Shaman";
|
return "Shaman";
|
||||||
case NECROMANCER:
|
case NECROMANCER:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Wraith";
|
return "Wraith";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Arch Lich";
|
return "Arch Lich";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Warlock";
|
return "Warlock";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Defiler";
|
return "Defiler";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Heretic";
|
return "Heretic";
|
||||||
else
|
else
|
||||||
return "Necromancer";
|
return "Necromancer";
|
||||||
case WIZARD:
|
case WIZARD:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Grand Arcanist";
|
return "Grand Arcanist";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Arcanist";
|
return "Arcanist";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Sorcerer";
|
return "Sorcerer";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Evoker";
|
return "Evoker";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Channeler";
|
return "Channeler";
|
||||||
else
|
else
|
||||||
return "Wizard";
|
return "Wizard";
|
||||||
case MAGICIAN:
|
case MAGICIAN:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Arch Magus";
|
return "Arch Magus";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Arch Convoker";
|
return "Arch Convoker";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Arch Mage";
|
return "Arch Mage";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Conjurer";
|
return "Conjurer";
|
||||||
if (level >= 51)
|
if (level >= 51)
|
||||||
return "Elementalist";
|
return "Elementalist";
|
||||||
else
|
else
|
||||||
return "Magician";
|
return "Magician";
|
||||||
case ENCHANTER:
|
case ENCHANTER:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Bedazzler";
|
return "Bedazzler";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Coercer";
|
return "Coercer";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Phantasmist";
|
return "Phantasmist";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Beguiler";
|
return "Beguiler";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Illusionist";
|
return "Illusionist";
|
||||||
else
|
else
|
||||||
return "Enchanter";
|
return "Enchanter";
|
||||||
case BEASTLORD:
|
case BEASTLORD:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Wildblood";
|
return "Wildblood";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Feral Lord";
|
return "Feral Lord";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Savage Lord";
|
return "Savage Lord";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Animist";
|
return "Animist";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Primalist";
|
return "Primalist";
|
||||||
else
|
else
|
||||||
return "Beastlord";
|
return "Beastlord";
|
||||||
case BERSERKER:
|
case BERSERKER:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Ravager";
|
return "Ravager";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Fury";
|
return "Fury";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Rager";
|
return "Rager";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Vehement";
|
return "Vehement";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Brawler";
|
return "Brawler";
|
||||||
else
|
else
|
||||||
return "Berserker";
|
return "Berserker";
|
||||||
case BANKER:
|
case BANKER:
|
||||||
if (level >= 70)
|
if (level >= 70)
|
||||||
return "Master Banker";
|
return "Master Banker";
|
||||||
else if (level >= 65)
|
else if (level >= 65)
|
||||||
return "Elder Banker";
|
return "Elder Banker";
|
||||||
else if (level >= 60)
|
else if (level >= 60)
|
||||||
return "Oldest Banker";
|
return "Oldest Banker";
|
||||||
else if (level >= 55)
|
else if (level >= 55)
|
||||||
return "Older Banker";
|
return "Older Banker";
|
||||||
else if (level >= 51)
|
else if (level >= 51)
|
||||||
return "Old Banker";
|
return "Old Banker";
|
||||||
else
|
else
|
||||||
return "Banker";
|
return "Banker";
|
||||||
case WARRIORGM:
|
case WARRIORGM:
|
||||||
return "Warrior Guildmaster";
|
return "Warrior Guildmaster";
|
||||||
case CLERICGM:
|
case CLERICGM:
|
||||||
return "Cleric Guildmaster";
|
return "Cleric Guildmaster";
|
||||||
case PALADINGM:
|
case PALADINGM:
|
||||||
return "Paladin Guildmaster";
|
return "Paladin Guildmaster";
|
||||||
case RANGERGM:
|
case RANGERGM:
|
||||||
return "Ranger Guildmaster";
|
return "Ranger Guildmaster";
|
||||||
case SHADOWKNIGHTGM:
|
case SHADOWKNIGHTGM:
|
||||||
return "Shadowknight Guildmaster";
|
return "Shadowknight Guildmaster";
|
||||||
case DRUIDGM:
|
case DRUIDGM:
|
||||||
return "Druid Guildmaster";
|
return "Druid Guildmaster";
|
||||||
case MONKGM:
|
case MONKGM:
|
||||||
return "Monk Guildmaster";
|
return "Monk Guildmaster";
|
||||||
case BARDGM:
|
case BARDGM:
|
||||||
return "Bard Guildmaster";
|
return "Bard Guildmaster";
|
||||||
case ROGUEGM:
|
case ROGUEGM:
|
||||||
return "Rogue Guildmaster";
|
return "Rogue Guildmaster";
|
||||||
case SHAMANGM:
|
case SHAMANGM:
|
||||||
return "Shaman Guildmaster";
|
return "Shaman Guildmaster";
|
||||||
case NECROMANCERGM:
|
case NECROMANCERGM:
|
||||||
return "Necromancer Guildmaster";
|
return "Necromancer Guildmaster";
|
||||||
case WIZARDGM:
|
case WIZARDGM:
|
||||||
return "Wizard Guildmaster";
|
return "Wizard Guildmaster";
|
||||||
case MAGICIANGM:
|
case MAGICIANGM:
|
||||||
return "Magician Guildmaster";
|
return "Magician Guildmaster";
|
||||||
case ENCHANTERGM:
|
case ENCHANTERGM:
|
||||||
return "Enchanter Guildmaster";
|
return "Enchanter Guildmaster";
|
||||||
case BEASTLORDGM:
|
case BEASTLORDGM:
|
||||||
return "Beastlord Guildmaster";
|
return "Beastlord Guildmaster";
|
||||||
case BERSERKERGM:
|
case BERSERKERGM:
|
||||||
return "Berserker Guildmaster";
|
return "Berserker Guildmaster";
|
||||||
case MERCHANT:
|
case MERCHANT:
|
||||||
return "Merchant";
|
return "Merchant";
|
||||||
case ADVENTURERECRUITER:
|
case ADVENTURERECRUITER:
|
||||||
return "Adventure Recruiter";
|
return "Adventure Recruiter";
|
||||||
@@ -285,7 +285,7 @@ const char* GetEQClassName(uint8 class_, uint8 level) {
|
|||||||
return "Tribute Master";
|
return "Tribute Master";
|
||||||
case GUILD_TRIBUTE_MASTER:
|
case GUILD_TRIBUTE_MASTER:
|
||||||
return "Guild Tribute Master";
|
return "Guild Tribute Master";
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-27
@@ -1,41 +1,41 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||||
|
|
||||||
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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 CLASSES_CH
|
#ifndef CLASSES_CH
|
||||||
#define CLASSES_CH
|
#define CLASSES_CH
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
|
|
||||||
#define Array_Class_UNKNOWN 0
|
#define Array_Class_UNKNOWN 0
|
||||||
#define WARRIOR 1
|
#define WARRIOR 1
|
||||||
#define CLERIC 2
|
#define CLERIC 2
|
||||||
#define PALADIN 3
|
#define PALADIN 3
|
||||||
#define RANGER 4
|
#define RANGER 4
|
||||||
#define SHADOWKNIGHT 5
|
#define SHADOWKNIGHT 5
|
||||||
#define DRUID 6
|
#define DRUID 6
|
||||||
#define MONK 7
|
#define MONK 7
|
||||||
#define BARD 8
|
#define BARD 8
|
||||||
#define ROGUE 9
|
#define ROGUE 9
|
||||||
#define SHAMAN 10
|
#define SHAMAN 10
|
||||||
#define NECROMANCER 11
|
#define NECROMANCER 11
|
||||||
#define WIZARD 12
|
#define WIZARD 12
|
||||||
#define MAGICIAN 13
|
#define MAGICIAN 13
|
||||||
#define ENCHANTER 14
|
#define ENCHANTER 14
|
||||||
#define BEASTLORD 15
|
#define BEASTLORD 15
|
||||||
#define BERSERKER 16
|
#define BERSERKER 16
|
||||||
#define PLAYER_CLASS_COUNT 16 // used for array defines, must be the count of playable classes
|
#define PLAYER_CLASS_COUNT 16 // used for array defines, must be the count of playable classes
|
||||||
#define WARRIORGM 20
|
#define WARRIORGM 20
|
||||||
#define CLERICGM 21
|
#define CLERICGM 21
|
||||||
|
|||||||
+33
-18
@@ -1,27 +1,42 @@
|
|||||||
#ifndef CLIENTVERSIONS_H
|
#ifndef CLIENTVERSIONS_H
|
||||||
#define CLIENTVERSIONS_H
|
#define CLIENTVERSIONS_H
|
||||||
|
|
||||||
static const uint32 BIT_Client62 = 1;
|
static const uint32 BIT_Client62 = 1;
|
||||||
static const uint32 BIT_Titanium = 2;
|
static const uint32 BIT_Titanium = 2;
|
||||||
static const uint32 BIT_SoF = 4;
|
static const uint32 BIT_SoF = 4;
|
||||||
static const uint32 BIT_SoD = 8;
|
static const uint32 BIT_SoD = 8;
|
||||||
static const uint32 BIT_Underfoot = 16;
|
static const uint32 BIT_Underfoot = 16;
|
||||||
static const uint32 BIT_RoF = 32;
|
static const uint32 BIT_RoF = 32;
|
||||||
static const uint32 BIT_TitaniumAndEarlier = 3;
|
static const uint32 BIT_RoF2 = 64;
|
||||||
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC;
|
|
||||||
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8;
|
static const uint32 BIT_TitaniumAndEarlier = 0x00000003;
|
||||||
static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0;
|
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC;
|
||||||
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
|
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8;
|
||||||
static const uint32 BIT_AllClients = 0xFFFFFFFF;
|
static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0;
|
||||||
|
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
|
||||||
|
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0;
|
||||||
|
static const uint32 BIT_AllClients = 0xFFFFFFFF;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EQClientUnknown = 0,
|
EQClientUnknown = 0,
|
||||||
EQClient62,
|
EQClient62, // Build: 'Aug 4 2005 15:40:59'
|
||||||
EQClientTitanium,
|
EQClientTitanium, // Build: 'Oct 31 2005 10:33:37'
|
||||||
EQClientSoF,
|
EQClientSoF, // Build: 'Sep 7 2007 09:11:49'
|
||||||
EQClientSoD,
|
EQClientSoD, // Build: 'Dec 19 2008 15:22:49'
|
||||||
EQClientUnderfoot,
|
EQClientUnderfoot, // Build: 'Jun 8 2010 16:44:32'
|
||||||
EQClientRoF
|
EQClientRoF, // Build: 'Dec 10 2012 17:35:44'
|
||||||
|
EQClientRoF2, // Build: 'May 10 2013 23:30:08'
|
||||||
|
|
||||||
|
_EQClientCount, // place new clients before this point (preferably, in release/attribute order)
|
||||||
|
|
||||||
|
// Values below are not implemented, as yet...
|
||||||
|
|
||||||
|
EmuNPC = _EQClientCount,
|
||||||
|
EmuMerc,
|
||||||
|
EmuBot,
|
||||||
|
EmuPet,
|
||||||
|
|
||||||
|
_EmuClientCount // array size for EQLimits
|
||||||
} EQClientVersion;
|
} EQClientVersion;
|
||||||
|
|
||||||
#endif /* CLIENTVERSIONS_H */
|
#endif /* CLIENTVERSIONS_H */
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
Copyright (C) 2001-2004 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_PROFILE_H
|
|
||||||
#define COMMON_PROFILE_H
|
|
||||||
|
|
||||||
#ifdef ZONE
|
|
||||||
#include "../zone/features.h"
|
|
||||||
|
|
||||||
#ifndef EQPROFILE
|
|
||||||
#ifdef COMMON_PROFILE
|
|
||||||
#undef COMMON_PROFILE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COMMON_PROFILE
|
|
||||||
|
|
||||||
#include "../common/profiler.h"
|
|
||||||
|
|
||||||
class CommonProfiler : public GeneralProfiler {
|
|
||||||
public:
|
|
||||||
enum {
|
|
||||||
Database_SaveInventory = 0,
|
|
||||||
Database_StoreCharacter,
|
|
||||||
Database_GetCharacterInfoForLogin,
|
|
||||||
Database_GetCharacterInfoForLogin_result,
|
|
||||||
Database_GetPlayerProfile,
|
|
||||||
Database_GetInventory,
|
|
||||||
Database_GetInventory_name,
|
|
||||||
Database_SetPlayerProfile,
|
|
||||||
Database_DBLoadItems,
|
|
||||||
Database_GetWaypoints,
|
|
||||||
Database_DBLoadNPCFactionLists,
|
|
||||||
|
|
||||||
DBcore_RunQuery,
|
|
||||||
|
|
||||||
DBAsync_ProcessWork,
|
|
||||||
DBAsync_DispatchWork,
|
|
||||||
DBAsyncLoop_loop,
|
|
||||||
|
|
||||||
EQStreamServer_Process,
|
|
||||||
|
|
||||||
EQStream_Process,
|
|
||||||
|
|
||||||
EQStreamServerLoop,
|
|
||||||
EQStreamInLoop,
|
|
||||||
EQStreamOutLoop,
|
|
||||||
TCPServerLoop,
|
|
||||||
TCPConnectionLoop,
|
|
||||||
|
|
||||||
Inventory_GetItem,
|
|
||||||
Inventory_HasItem,
|
|
||||||
|
|
||||||
BaseTCPServerLoop,
|
|
||||||
|
|
||||||
MakeRandomInt,
|
|
||||||
MakeRandomFloat,
|
|
||||||
|
|
||||||
Mutex_lock,
|
|
||||||
Timer_Check,
|
|
||||||
|
|
||||||
WorldConnection_Process,
|
|
||||||
|
|
||||||
MaxCommonProfilerId
|
|
||||||
};
|
|
||||||
|
|
||||||
inline CommonProfiler() : GeneralProfiler(MaxCommonProfilerId) { }
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
extern CommonProfiler _cp;
|
|
||||||
|
|
||||||
|
|
||||||
#define _CP(name) _GP(_cp, CommonProfiler, name)
|
|
||||||
|
|
||||||
#else
|
|
||||||
//no zone profiling, dummy functions
|
|
||||||
#define _CP(name) ;
|
|
||||||
|
|
||||||
#endif //COMMON_PROFILE
|
|
||||||
|
|
||||||
#else //else !ZONE
|
|
||||||
|
|
||||||
#define _CP(name) ;
|
|
||||||
|
|
||||||
#endif //!ZONE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
/* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
#include "condition.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
|
Condition::Condition()
|
||||||
|
{
|
||||||
|
m_events[SignalEvent] = CreateEvent (nullptr, // security
|
||||||
|
FALSE, // is auto-reset event?
|
||||||
|
FALSE, // is signaled initially?
|
||||||
|
nullptr); // name
|
||||||
|
m_events[BroadcastEvent] = CreateEvent (nullptr, // security
|
||||||
|
TRUE, // is auto-reset event?
|
||||||
|
FALSE, // is signaled initially?
|
||||||
|
nullptr); // name
|
||||||
|
m_waiters = 0;
|
||||||
|
InitializeCriticalSection(&CSMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Condition::~Condition()
|
||||||
|
{
|
||||||
|
DeleteCriticalSection(&CSMutex);
|
||||||
|
CloseHandle(m_events[SignalEvent]);
|
||||||
|
CloseHandle(m_events[BroadcastEvent]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::Signal()
|
||||||
|
{
|
||||||
|
EnterCriticalSection(&CSMutex);
|
||||||
|
if(m_waiters > 0)
|
||||||
|
SetEvent(m_events[SignalEvent]);
|
||||||
|
LeaveCriticalSection(&CSMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::SignalAll()
|
||||||
|
{
|
||||||
|
EnterCriticalSection(&CSMutex);
|
||||||
|
if(m_waiters > 0)
|
||||||
|
SetEvent(m_events[BroadcastEvent]);
|
||||||
|
LeaveCriticalSection(&CSMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::Wait()
|
||||||
|
{
|
||||||
|
EnterCriticalSection(&CSMutex);
|
||||||
|
|
||||||
|
m_waiters++;
|
||||||
|
|
||||||
|
|
||||||
|
LeaveCriticalSection(&CSMutex);
|
||||||
|
int result = WaitForMultipleObjects (_eventCount, m_events, FALSE, INFINITE);
|
||||||
|
EnterCriticalSection(&CSMutex);
|
||||||
|
|
||||||
|
m_waiters--;
|
||||||
|
|
||||||
|
//see if we are the last person waiting on the condition, and there was a broadcast
|
||||||
|
//if so, we need to reset the broadcast event.
|
||||||
|
if(m_waiters == 0 && result == (WAIT_OBJECT_0+BroadcastEvent))
|
||||||
|
ResetEvent(m_events[BroadcastEvent]);
|
||||||
|
|
||||||
|
LeaveCriticalSection(&CSMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
Condition::Condition()
|
||||||
|
{
|
||||||
|
pthread_cond_init(&cond,nullptr);
|
||||||
|
pthread_mutex_init(&mutex,nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::Signal()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
pthread_cond_signal(&cond);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::SignalAll()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
pthread_cond_broadcast(&cond);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Condition::Wait()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
pthread_cond_wait(&cond,&mutex);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
I commented this specifically because I think it might be very
|
||||||
|
difficult to write a windows counterpart to it, so I would like
|
||||||
|
to discourage its use until we can confirm that it can be reasonably
|
||||||
|
implemented on windows.
|
||||||
|
|
||||||
|
bool Condition::TimedWait(unsigned long usec)
|
||||||
|
{
|
||||||
|
struct timeval now;
|
||||||
|
struct timespec timeout;
|
||||||
|
int retcode=0;
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
gettimeofday(&now,nullptr);
|
||||||
|
now.tv_usec+=usec;
|
||||||
|
timeout.tv_sec = now.tv_sec + (now.tv_usec/1000000);
|
||||||
|
timeout.tv_nsec = (now.tv_usec%1000000) *1000;
|
||||||
|
//cout << "now=" << now.tv_sec << "."<<now.tv_usec << endl;
|
||||||
|
//cout << "timeout=" << timeout.tv_sec << "."<<timeout.tv_nsec << endl;
|
||||||
|
retcode=pthread_cond_timedwait(&cond,&mutex,&timeout);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
|
||||||
|
return retcode!=ETIMEDOUT;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Condition::~Condition()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
pthread_cond_destroy(&cond);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
pthread_mutex_destroy(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/* 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
|
||||||
|
*/
|
||||||
|
#ifndef __CONDITION_H
|
||||||
|
#define __CONDITION_H
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
#ifndef WIN32
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Sombody, someday needs to figure out how to implement a condition
|
||||||
|
//system on windows...
|
||||||
|
|
||||||
|
|
||||||
|
class Condition {
|
||||||
|
private:
|
||||||
|
#ifdef WIN32
|
||||||
|
enum {
|
||||||
|
SignalEvent = 0,
|
||||||
|
BroadcastEvent,
|
||||||
|
_eventCount
|
||||||
|
};
|
||||||
|
|
||||||
|
HANDLE m_events[_eventCount];
|
||||||
|
uint32 m_waiters;
|
||||||
|
CRITICAL_SECTION CSMutex;
|
||||||
|
#else
|
||||||
|
pthread_cond_t cond;
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
#endif
|
||||||
|
public:
|
||||||
|
Condition();
|
||||||
|
void Signal();
|
||||||
|
void SignalAll();
|
||||||
|
void Wait();
|
||||||
|
// bool TimedWait(unsigned long usec);
|
||||||
|
~Condition();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
+90
-90
@@ -7,107 +7,107 @@
|
|||||||
class EQEmuStackWalker : public StackWalker
|
class EQEmuStackWalker : public StackWalker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EQEmuStackWalker() : StackWalker() { }
|
EQEmuStackWalker() : StackWalker() { }
|
||||||
EQEmuStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess) { }
|
EQEmuStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess) { }
|
||||||
virtual void OnOutput(LPCSTR szText) {
|
virtual void OnOutput(LPCSTR szText) {
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
for(int i = 0; i < 4096; ++i) {
|
for(int i = 0; i < 4096; ++i) {
|
||||||
if(szText[i] == 0) {
|
if(szText[i] == 0) {
|
||||||
buffer[i] = '\0';
|
buffer[i] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(szText[i] == '\n' || szText[i] == '\r') {
|
if(szText[i] == '\n' || szText[i] == '\r') {
|
||||||
buffer[i] = ' ';
|
buffer[i] = ' ';
|
||||||
} else {
|
} else {
|
||||||
buffer[i] = szText[i];
|
buffer[i] = szText[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogFile->write(EQEMuLog::Crash, buffer);
|
LogFile->write(EQEMuLog::Crash, buffer);
|
||||||
StackWalker::OnOutput(szText);
|
StackWalker::OnOutput(szText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||||
{
|
{
|
||||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||||
{
|
{
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_BREAKPOINT:
|
case EXCEPTION_BREAKPOINT:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_OVERFLOW:
|
case EXCEPTION_FLT_OVERFLOW:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_STACK_CHECK:
|
case EXCEPTION_FLT_STACK_CHECK:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_UNDERFLOW:
|
case EXCEPTION_FLT_UNDERFLOW:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_OVERFLOW:
|
case EXCEPTION_INT_OVERFLOW:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INVALID_DISPOSITION:
|
case EXCEPTION_INVALID_DISPOSITION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_PRIV_INSTRUCTION:
|
case EXCEPTION_PRIV_INSTRUCTION:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_SINGLE_STEP:
|
case EXCEPTION_SINGLE_STEP:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_STACK_OVERFLOW:
|
case EXCEPTION_STACK_OVERFLOW:
|
||||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW");
|
LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogFile->write(EQEMuLog::Crash, "Unknown Exception");
|
LogFile->write(EQEMuLog::Crash, "Unknown Exception");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode)
|
if(EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||||
{
|
{
|
||||||
EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord);
|
EQEmuStackWalker sw; sw.ShowCallstack(GetCurrentThread(), ExceptionInfo->ContextRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_exception_handler() {
|
void set_exception_handler() {
|
||||||
SetUnhandledExceptionFilter(windows_exception_handler);
|
SetUnhandledExceptionFilter(windows_exception_handler);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// crash is off or an unhandled platform
|
// crash is off or an unhandled platform
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#include "crc32.h"
|
||||||
|
|
||||||
|
uint16 CRC16(const unsigned char *buf, int size, int key)
|
||||||
|
{
|
||||||
|
// This is computed as the lowest 16 bits of an Ethernet CRC32 checksum
|
||||||
|
// where the key is prepended to the data in little endian order.
|
||||||
|
uint8 keyBuf[] = {(uint8)((key >> 0) & 0xff),
|
||||||
|
(uint8)((key >> 8) & 0xff),
|
||||||
|
(uint8)((key >> 16) & 0xff),
|
||||||
|
(uint8)((key >> 24) & 0xff)};
|
||||||
|
uint32 crc = CRC32::Update(keyBuf, sizeof(uint32));
|
||||||
|
crc = CRC32::Update(buf, size, crc);
|
||||||
|
return CRC32::Finish(crc) & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef _CRC16_H
|
||||||
|
#define _CRC16_H
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
uint16 CRC16(const unsigned char *buf, int size, int key);
|
||||||
|
|
||||||
|
#endif
|
||||||
+11
-11
@@ -84,21 +84,21 @@ uint32 CRC32::GenerateNoFlip(const uint8* buf, uint32 bufsize) {
|
|||||||
void CRC32::SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at)
|
void CRC32::SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at)
|
||||||
{
|
{
|
||||||
unsigned long data;
|
unsigned long data;
|
||||||
unsigned long check = 0xffffffff;
|
unsigned long check = 0xffffffff;
|
||||||
|
|
||||||
assert(in_length >= start_at && in_data);
|
assert(in_length >= start_at && in_data);
|
||||||
|
|
||||||
for(uint32 i=start_at; i<in_length; i++)
|
for(uint32 i=start_at; i<in_length; i++)
|
||||||
{
|
{
|
||||||
data = in_data[i];
|
data = in_data[i];
|
||||||
data = data ^ (check);
|
data = data ^ (check);
|
||||||
data = data & 0x000000ff;
|
data = data & 0x000000ff;
|
||||||
check = check >> 8;
|
check = check >> 8;
|
||||||
data = CRC32Table[data];
|
data = CRC32Table[data];
|
||||||
check = check ^ data;
|
check = check ^ data;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(in_data, (char*)&check, 4);
|
memcpy(in_data, (char*)&check, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) {
|
uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) {
|
||||||
|
|||||||
+1446
-2100
File diff suppressed because it is too large
Load Diff
+62
-54
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2003 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 EQEMU_DATABASE_H
|
#ifndef EQEMU_DATABASE_H
|
||||||
#define EQEMU_DATABASE_H
|
#define EQEMU_DATABASE_H
|
||||||
@@ -26,19 +26,18 @@
|
|||||||
#include "dbcore.h"
|
#include "dbcore.h"
|
||||||
#include "linked_list.h"
|
#include "linked_list.h"
|
||||||
#include "eq_packet_structs.h"
|
#include "eq_packet_structs.h"
|
||||||
/*#include "EQStream.h"
|
/*#include "eq_stream.h"
|
||||||
#include "guilds.h"
|
#include "guilds.h"
|
||||||
#include "MiscFunctions.h"
|
#include "misc_functions.h"
|
||||||
#include "Mutex.h"
|
#include "mutex.h"
|
||||||
#include "Item.h"
|
#include "item.h"
|
||||||
#include "extprofile.h"*/
|
#include "extprofile.h"*/
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//atoi is not uint32 or uint32 safe!!!!
|
//atoi is not uint32 or uint32 safe!!!!
|
||||||
#define atoul(str) strtoul(str, NULL, 10)
|
#define atoul(str) strtoul(str, nullptr, 10)
|
||||||
|
|
||||||
//class Spawn;
|
//class Spawn;
|
||||||
class Corpse;
|
class Corpse;
|
||||||
@@ -79,7 +78,7 @@ EventLogDetails_Struct eld[255];
|
|||||||
// Added By Hogie
|
// Added By Hogie
|
||||||
// INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]');
|
// INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]');
|
||||||
// IE: decaytime 1 54 = Levels 1 through 54
|
// IE: decaytime 1 54 = Levels 1 through 54
|
||||||
// decaytime 55 100 = Levels 55 through 100
|
// decaytime 55 100 = Levels 55 through 100
|
||||||
// It will always put the LAST time for the level (I think) from the Database
|
// It will always put the LAST time for the level (I think) from the Database
|
||||||
struct npcDecayTimes_Struct {
|
struct npcDecayTimes_Struct {
|
||||||
uint16 minlvl;
|
uint16 minlvl;
|
||||||
@@ -107,13 +106,9 @@ public:
|
|||||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||||
~Database();
|
~Database();
|
||||||
|
|
||||||
|
|
||||||
// void ExtraOptions();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General Character Related Stuff
|
* General Character Related Stuff
|
||||||
*/
|
*/
|
||||||
bool MoveCharacterToZone(const char* charname, const char* zonename);
|
bool MoveCharacterToZone(const char* charname, const char* zonename);
|
||||||
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
|
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
|
||||||
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
|
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
|
||||||
@@ -128,27 +123,27 @@ public:
|
|||||||
uint8 CopyCharacter(const char* oldname, const char* newname, uint32 acctid);
|
uint8 CopyCharacter(const char* oldname, const char* newname, uint32 acctid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General Information Getting Queries
|
* General Information Getting Queries
|
||||||
*/
|
*/
|
||||||
bool CheckNameFilter(const char* name, bool surname = false);
|
bool CheckNameFilter(const char* name, bool surname = false);
|
||||||
bool CheckUsedName(const char* name);
|
bool CheckUsedName(const char* name);
|
||||||
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
|
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
|
||||||
uint32 GetAccountIDByChar(uint32 char_id);
|
uint32 GetAccountIDByChar(uint32 char_id);
|
||||||
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0);
|
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0);
|
||||||
uint32 GetGuildDBIDByCharID(uint32 char_id);
|
uint32 GetGuildIDByCharID(uint32 char_id);
|
||||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||||
void GetCharName(uint32 char_id, char* name);
|
void GetCharName(uint32 char_id, char* name);
|
||||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0);
|
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||||
uint32 GetCharacterID(const char *name);
|
uint32 GetCharacterID(const char *name);
|
||||||
bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incomming connection against banned IP table.
|
bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incomming connection against banned IP table.
|
||||||
bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table.
|
bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table.
|
||||||
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
||||||
bool AddGMIP(char* ip_address, char* name);
|
bool AddGMIP(char* ip_address, char* name);
|
||||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instancing Stuff
|
* Instancing Stuff
|
||||||
*/
|
*/
|
||||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||||
bool CharacterInInstanceGroup(uint16 instance_id, uint32 char_id);
|
bool CharacterInInstanceGroup(uint16 instance_id, uint32 char_id);
|
||||||
@@ -168,6 +163,7 @@ public:
|
|||||||
uint16 GetInstanceVersion(uint16 instance_id);
|
uint16 GetInstanceVersion(uint16 instance_id);
|
||||||
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
||||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||||
|
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||||
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
||||||
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
||||||
void FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid);
|
void FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid);
|
||||||
@@ -176,22 +172,22 @@ public:
|
|||||||
bool GlobalInstance(uint16 instance_id);
|
bool GlobalInstance(uint16 instance_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adventure related.
|
* Adventure related.
|
||||||
*/
|
*/
|
||||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||||
bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w,
|
bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w,
|
||||||
uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l);
|
uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Account Related
|
* Account Related
|
||||||
*/
|
*/
|
||||||
uint32 GetMiniLoginAccount(char* ip);
|
uint32 GetMiniLoginAccount(char* ip);
|
||||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||||
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
||||||
int16 CheckStatus(uint32 account_id);
|
int16 CheckStatus(uint32 account_id);
|
||||||
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
||||||
bool DeleteAccount(const char* name);
|
bool DeleteAccount(const char* name);
|
||||||
bool SetAccountStatus(const char* name, int16 status);
|
bool SetAccountStatus(const char* name, int16 status);
|
||||||
bool SetLocalPassword(uint32 accid, const char* password);
|
bool SetLocalPassword(uint32 accid, const char* password);
|
||||||
uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0);
|
uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0);
|
||||||
bool UpdateLiveChar(char* charname,uint32 lsaccount_id);
|
bool UpdateLiveChar(char* charname,uint32 lsaccount_id);
|
||||||
@@ -200,48 +196,49 @@ public:
|
|||||||
void SetAgreementFlag(uint32 acctid);
|
void SetAgreementFlag(uint32 acctid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Groups
|
* Groups
|
||||||
*/
|
*/
|
||||||
uint32 GetGroupID(const char* name);
|
uint32 GetGroupID(const char* name);
|
||||||
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
||||||
void ClearGroup(uint32 gid = 0);
|
void ClearGroup(uint32 gid = 0);
|
||||||
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
||||||
|
|
||||||
void SetGroupLeaderName(uint32 gid, const char* name);
|
void SetGroupLeaderName(uint32 gid, const char* name);
|
||||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = NULL, char* assist = NULL, char* puller = NULL, char *marknpc = NULL,
|
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||||
GroupLeadershipAA_Struct* GLAA = NULL);
|
GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||||
void ClearGroupLeader(uint32 gid = 0);
|
void ClearGroupLeader(uint32 gid = 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Raids
|
* Raids
|
||||||
*/
|
*/
|
||||||
void ClearRaid(uint32 rid = 0);
|
void ClearRaid(uint32 rid = 0);
|
||||||
void ClearRaidDetails(uint32 rid = 0);
|
void ClearRaidDetails(uint32 rid = 0);
|
||||||
uint32 GetRaidID(const char* name);
|
uint32 GetRaidID(const char* name);
|
||||||
const char *GetRaidLeaderName(uint32 rid);
|
const char *GetRaidLeaderName(uint32 rid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Database Varaibles
|
* Database Variables
|
||||||
*/
|
*/
|
||||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||||
bool SetVariable(const char* varname, const char* varvalue);
|
bool SetVariable(const char* varname, const char* varvalue);
|
||||||
bool LoadVariables();
|
bool LoadVariables();
|
||||||
uint32 LoadVariables_MQ(char** query);
|
uint32 LoadVariables_MQ(char** query);
|
||||||
bool LoadVariables_result(MYSQL_RES* result);
|
bool LoadVariables_result(MySQLRequestResult results);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General Queries
|
* General Queries
|
||||||
*/
|
*/
|
||||||
bool LoadZoneNames();
|
bool LoadZoneNames();
|
||||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||||
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
||||||
uint32 GetZoneID(const char* zonename);
|
uint32 GetZoneID(const char* zonename);
|
||||||
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
||||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||||
uint8 GetServerType();
|
uint8 GetServerType();
|
||||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = NULL);
|
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = NULL) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
||||||
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
||||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||||
@@ -256,19 +253,30 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void HandleMysqlError(uint32 errnum);
|
void HandleMysqlError(uint32 errnum);
|
||||||
//bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* errnum = 0, bool retry = true);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DBInitVars();
|
void DBInitVars();
|
||||||
|
|
||||||
uint32 max_zonename;
|
std::map<uint32,std::string> zonename_array;
|
||||||
char** zonename_array;
|
|
||||||
|
|
||||||
Mutex Mvarcache;
|
Mutex Mvarcache;
|
||||||
uint32 varcache_max;
|
uint32 varcache_max;
|
||||||
VarCache_Struct** varcache_array;
|
VarCache_Struct** varcache_array;
|
||||||
uint32 varcache_lastupdate;
|
uint32 varcache_lastupdate;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Groups, utility methods.
|
||||||
|
*/
|
||||||
|
void ClearAllGroupLeaders();
|
||||||
|
void ClearAllGroups();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Raid, utility methods.
|
||||||
|
*/
|
||||||
|
void ClearAllRaids();
|
||||||
|
void ClearAllRaidDetails();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool FetchRowMap(MYSQL_RES *result, map<string,string> &rowmap);
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+15
-23
@@ -5,16 +5,15 @@
|
|||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
#include "dbasync.h"
|
#include "dbasync.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include <errmsg.h>
|
#include <errmsg.h>
|
||||||
#include <mysqld_error.h>
|
#include <mysqld_error.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "dbcore.h"
|
#include "dbcore.h"
|
||||||
#include "common_profile.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../common/MiscFunctions.h"
|
//#include "../common/misc_functions.h"
|
||||||
|
#include "string_util.h"
|
||||||
#define ASYNC_LOOP_GRANULARITY 4 //# of ms between checking our work
|
#define ASYNC_LOOP_GRANULARITY 4 //# of ms between checking our work
|
||||||
|
|
||||||
bool DBAsyncCB_LoadVariables(DBAsyncWork* iWork) {
|
bool DBAsyncCB_LoadVariables(DBAsyncWork* iWork) {
|
||||||
@@ -24,7 +23,7 @@ bool DBAsyncCB_LoadVariables(DBAsyncWork* iWork) {
|
|||||||
if (dbaq->GetAnswer(errbuf, &result))
|
if (dbaq->GetAnswer(errbuf, &result))
|
||||||
iWork->GetDB()->LoadVariables_result(result);
|
iWork->GetDB()->LoadVariables_result(result);
|
||||||
else
|
else
|
||||||
cout << "Error: DBAsyncCB_LoadVariables failed: !GetAnswer: '" << errbuf << "'" << endl;
|
std::cout << "Error: DBAsyncCB_LoadVariables failed: !GetAnswer: '" << errbuf << "'" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,10 +53,8 @@ ThreadReturnType DBAsyncLoop(void* tmp) {
|
|||||||
//we could check dba->RunLoop() again to see if we
|
//we could check dba->RunLoop() again to see if we
|
||||||
//got turned off while we were waiting
|
//got turned off while we were waiting
|
||||||
{
|
{
|
||||||
_CP(DBAsyncLoop_loop);
|
|
||||||
dba->Process();
|
dba->Process();
|
||||||
}
|
}
|
||||||
// Sleep(ASYNC_LOOP_GRANULARITY);
|
|
||||||
}
|
}
|
||||||
dba->MLoopRunning.unlock();
|
dba->MLoopRunning.unlock();
|
||||||
|
|
||||||
@@ -65,7 +62,7 @@ ThreadReturnType DBAsyncLoop(void* tmp) {
|
|||||||
_log(COMMON__THREADS, "Ending DBAsyncLoop with thread ID %d", pthread_self());
|
_log(COMMON__THREADS, "Ending DBAsyncLoop with thread ID %d", pthread_self());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
THREAD_RETURN(NULL);
|
THREAD_RETURN(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBAsync::DBAsync(DBcore* iDBC)
|
DBAsync::DBAsync(DBcore* iDBC)
|
||||||
@@ -78,7 +75,7 @@ DBAsync::DBAsync(DBcore* iDBC)
|
|||||||
_beginthread(DBAsyncLoop, 0, this);
|
_beginthread(DBAsyncLoop, 0, this);
|
||||||
#else
|
#else
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
pthread_create(&thread, NULL, DBAsyncLoop, this);
|
pthread_create(&thread, nullptr, DBAsyncLoop, this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +112,8 @@ uint32 DBAsync::AddWork(DBAsyncWork** iWork, uint32 iDelay) {
|
|||||||
if (iDelay)
|
if (iDelay)
|
||||||
(*iWork)->pExecuteAfter = Timer::GetCurrentTime() + iDelay;
|
(*iWork)->pExecuteAfter = Timer::GetCurrentTime() + iDelay;
|
||||||
#if DEBUG_MYSQL_QUERIES >= 2
|
#if DEBUG_MYSQL_QUERIES >= 2
|
||||||
cout << "Adding AsyncWork #" << (*iWork)->GetWorkID() << endl;
|
std::cout << "Adding AsyncWork #" << (*iWork)->GetWorkID() << std::endl;
|
||||||
cout << "ExecuteAfter = " << (*iWork)->pExecuteAfter << " (" << Timer::GetCurrentTime() << " + " << iDelay << ")" << endl;
|
std::cout << "ExecuteAfter = " << (*iWork)->pExecuteAfter << " (" << Timer::GetCurrentTime() << " + " << iDelay << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
*iWork = 0;
|
*iWork = 0;
|
||||||
MInList.unlock();
|
MInList.unlock();
|
||||||
@@ -131,7 +128,7 @@ bool DBAsync::CancelWork(uint32 iWorkID) {
|
|||||||
if (iWorkID == 0)
|
if (iWorkID == 0)
|
||||||
return false;
|
return false;
|
||||||
#if DEBUG_MYSQL_QUERIES >= 2
|
#if DEBUG_MYSQL_QUERIES >= 2
|
||||||
cout << "DBAsync::CancelWork: " << iWorkID << endl;
|
std::cout << "DBAsync::CancelWork: " << iWorkID << std::endl;
|
||||||
#endif
|
#endif
|
||||||
MCurrentWork.lock();
|
MCurrentWork.lock();
|
||||||
if (CurrentWork && CurrentWork->GetWorkID() == iWorkID) {
|
if (CurrentWork && CurrentWork->GetWorkID() == iWorkID) {
|
||||||
@@ -174,8 +171,8 @@ DBAsyncWork* DBAsync::InListPop() {
|
|||||||
if (iterator.GetData()->pExecuteAfter <= Timer::GetCurrentTime()) {
|
if (iterator.GetData()->pExecuteAfter <= Timer::GetCurrentTime()) {
|
||||||
ret = iterator.GetData();
|
ret = iterator.GetData();
|
||||||
#if DEBUG_MYSQL_QUERIES >= 2
|
#if DEBUG_MYSQL_QUERIES >= 2
|
||||||
cout << "Poping AsyncWork #" << ret->GetWorkID() << endl;
|
std::cout << "Poping AsyncWork #" << ret->GetWorkID() << std::endl;
|
||||||
cout << ret->pExecuteAfter << " <= " << Timer::GetCurrentTime() << endl;
|
std::cout << ret->pExecuteAfter << " <= " << Timer::GetCurrentTime() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
iterator.RemoveCurrent(false);
|
iterator.RemoveCurrent(false);
|
||||||
break;
|
break;
|
||||||
@@ -232,7 +229,7 @@ void DBAsync::Process() {
|
|||||||
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
||||||
if (tmpStatus != Executing) {
|
if (tmpStatus != Executing) {
|
||||||
if (tmpStatus != Canceled) {
|
if (tmpStatus != Canceled) {
|
||||||
cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #1" << endl;
|
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #1" << std::endl;
|
||||||
}
|
}
|
||||||
MCurrentWork.lock();
|
MCurrentWork.lock();
|
||||||
safe_delete(tmpWork);
|
safe_delete(tmpWork);
|
||||||
@@ -246,7 +243,7 @@ void DBAsync::Process() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tmpStatus != Canceled) {
|
if (tmpStatus != Canceled) {
|
||||||
cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #2" << endl;
|
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #2" << std::endl;
|
||||||
}
|
}
|
||||||
MCurrentWork.lock();
|
MCurrentWork.lock();
|
||||||
safe_delete(CurrentWork);
|
safe_delete(CurrentWork);
|
||||||
@@ -274,7 +271,7 @@ void DBAsync::CheckTimeout() {
|
|||||||
|
|
||||||
void DBAsync::CommitWrites() {
|
void DBAsync::CommitWrites() {
|
||||||
#if DEBUG_MYSQL_QUERIES >= 2
|
#if DEBUG_MYSQL_QUERIES >= 2
|
||||||
cout << "DBAsync::CommitWrites() called." << endl;
|
std::cout << "DBAsync::CommitWrites() called." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
DBAsyncWork* tmpWork;
|
DBAsyncWork* tmpWork;
|
||||||
while ((tmpWork = InListPopWrite())) {
|
while ((tmpWork = InListPopWrite())) {
|
||||||
@@ -284,7 +281,7 @@ void DBAsync::CommitWrites() {
|
|||||||
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
||||||
if (tmpStatus != Executing) {
|
if (tmpStatus != Executing) {
|
||||||
if (tmpStatus != Canceled) {
|
if (tmpStatus != Canceled) {
|
||||||
cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #1" << endl;
|
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #1" << std::endl;
|
||||||
}
|
}
|
||||||
safe_delete(tmpWork);
|
safe_delete(tmpWork);
|
||||||
}
|
}
|
||||||
@@ -294,7 +291,7 @@ void DBAsync::CommitWrites() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tmpStatus != Canceled) {
|
if (tmpStatus != Canceled) {
|
||||||
cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #2" << endl;
|
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #2" << std::endl;
|
||||||
}
|
}
|
||||||
safe_delete(tmpWork);
|
safe_delete(tmpWork);
|
||||||
}
|
}
|
||||||
@@ -302,11 +299,7 @@ void DBAsync::CommitWrites() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DBAsync::ProcessWork(DBAsyncWork* iWork, bool iSleep) {
|
void DBAsync::ProcessWork(DBAsyncWork* iWork, bool iSleep) {
|
||||||
_CP(DBAsync_ProcessWork);
|
|
||||||
DBAsyncQuery* CurrentQuery;
|
DBAsyncQuery* CurrentQuery;
|
||||||
#if DEBUG_MYSQL_QUERIES >= 2
|
|
||||||
cout << "Processing AsyncWork #" << iWork->GetWorkID() << endl;
|
|
||||||
#endif
|
|
||||||
while ((CurrentQuery = iWork->PopQuery())) {
|
while ((CurrentQuery = iWork->PopQuery())) {
|
||||||
CurrentQuery->Process(pDBC);
|
CurrentQuery->Process(pDBC);
|
||||||
iWork->PushAnswer(CurrentQuery);
|
iWork->PushAnswer(CurrentQuery);
|
||||||
@@ -316,7 +309,6 @@ void DBAsync::ProcessWork(DBAsyncWork* iWork, bool iSleep) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DBAsync::DispatchWork(DBAsyncWork* iWork) {
|
void DBAsync::DispatchWork(DBAsyncWork* iWork) {
|
||||||
_CP(DBAsync_DispatchWork);
|
|
||||||
//if this work has a callback, call it
|
//if this work has a callback, call it
|
||||||
//otherwise, stick the work on the finish queue
|
//otherwise, stick the work on the finish queue
|
||||||
if (iWork->pCB) {
|
if (iWork->pCB) {
|
||||||
|
|||||||
+103
-20
@@ -5,13 +5,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
#include <errmsg.h>
|
#include <errmsg.h>
|
||||||
#include <mysqld_error.h>
|
#include <mysqld_error.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "dbcore.h"
|
#include "dbcore.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../common/MiscFunctions.h"
|
#include "../common/misc_functions.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
@@ -38,6 +37,7 @@ DBcore::DBcore() {
|
|||||||
pDatabase = 0;
|
pDatabase = 0;
|
||||||
pCompress = false;
|
pCompress = false;
|
||||||
pSSL = false;
|
pSSL = false;
|
||||||
|
pStatus = Closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBcore::~DBcore() {
|
DBcore::~DBcore() {
|
||||||
@@ -58,8 +58,94 @@ void DBcore::ping() {
|
|||||||
MDatabase.unlock();
|
MDatabase.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
|
||||||
|
{
|
||||||
|
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
|
||||||
|
}
|
||||||
|
|
||||||
|
MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce)
|
||||||
|
{
|
||||||
|
LockMutex lock(&MDatabase);
|
||||||
|
|
||||||
|
// Reconnect if we are not connected before hand.
|
||||||
|
if (pStatus != Connected)
|
||||||
|
Open();
|
||||||
|
|
||||||
|
// request query. != 0 indicates some kind of error.
|
||||||
|
if (mysql_real_query(&mysql, query, querylen) != 0)
|
||||||
|
{
|
||||||
|
unsigned int errorNumber = mysql_errno(&mysql);
|
||||||
|
|
||||||
|
if (errorNumber == CR_SERVER_GONE_ERROR)
|
||||||
|
pStatus = Error;
|
||||||
|
|
||||||
|
// error appears to be a disconnect error, may need to try again.
|
||||||
|
if (errorNumber == CR_SERVER_LOST || errorNumber == CR_SERVER_GONE_ERROR)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (retryOnFailureOnce)
|
||||||
|
{
|
||||||
|
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
|
||||||
|
MySQLRequestResult requestResult = QueryDatabase(query, querylen, false);
|
||||||
|
|
||||||
|
if (requestResult.Success())
|
||||||
|
{
|
||||||
|
std::cout << "Reconnection to database successful." << std::endl;
|
||||||
|
return requestResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pStatus = Error;
|
||||||
|
|
||||||
|
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||||
|
|
||||||
|
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||||
|
|
||||||
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
|
|
||||||
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||||
|
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||||
|
|
||||||
|
#ifdef _EQDEBUG
|
||||||
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
|
#endif
|
||||||
|
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// successful query. get results.
|
||||||
|
MYSQL_RES* res = mysql_store_result(&mysql);
|
||||||
|
uint32 rowCount = 0;
|
||||||
|
|
||||||
|
if (res != nullptr)
|
||||||
|
rowCount = (uint32)mysql_num_rows(res);
|
||||||
|
|
||||||
|
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||||
|
|
||||||
|
|
||||||
|
#if DEBUG_MYSQL_QUERIES >= 1
|
||||||
|
if (requestResult.Success())
|
||||||
|
{
|
||||||
|
std::cout << "query successful";
|
||||||
|
if (requestResult.Result())
|
||||||
|
std::cout << ", " << (int) mysql_num_rows(requestResult.Result()) << " rows returned";
|
||||||
|
|
||||||
|
std::cout << ", " << requestResult.RowCount() << " rows affected";
|
||||||
|
std::cout<< std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "QUERY: query FAILED" << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return requestResult;
|
||||||
|
}
|
||||||
|
|
||||||
bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum, bool retry) {
|
bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum, bool retry) {
|
||||||
_CP(DBcore_RunQuery);
|
|
||||||
if (errnum)
|
if (errnum)
|
||||||
*errnum = 0;
|
*errnum = 0;
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
@@ -68,20 +154,16 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE
|
|||||||
LockMutex lock(&MDatabase);
|
LockMutex lock(&MDatabase);
|
||||||
if (pStatus != Connected)
|
if (pStatus != Connected)
|
||||||
Open();
|
Open();
|
||||||
#if DEBUG_MYSQL_QUERIES >= 1
|
|
||||||
char tmp[120];
|
|
||||||
strn0cpy(tmp, query, sizeof(tmp));
|
|
||||||
cout << "QUERY: " << tmp << endl;
|
|
||||||
#endif
|
|
||||||
if (mysql_real_query(&mysql, query, querylen)) {
|
if (mysql_real_query(&mysql, query, querylen)) {
|
||||||
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
|
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
|
||||||
pStatus = Error;
|
pStatus = Error;
|
||||||
if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {
|
if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {
|
||||||
if (retry) {
|
if (retry) {
|
||||||
cout << "Database Error: Lost connection, attempting to recover...." << endl;
|
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
|
||||||
ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false);
|
ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
cout << "Reconnection to database successful." << endl;
|
std::cout << "Reconnection to database successful." << std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pStatus = Error;
|
pStatus = Error;
|
||||||
@@ -89,7 +171,7 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE
|
|||||||
*errnum = mysql_errno(&mysql);
|
*errnum = mysql_errno(&mysql);
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||||
cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << endl;
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +181,7 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE
|
|||||||
if (errbuf)
|
if (errbuf)
|
||||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||||
#ifdef _EQDEBUG
|
#ifdef _EQDEBUG
|
||||||
cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << endl;
|
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
@@ -116,14 +198,14 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE
|
|||||||
if (affected_rows)
|
if (affected_rows)
|
||||||
*affected_rows = mysql_affected_rows(&mysql);
|
*affected_rows = mysql_affected_rows(&mysql);
|
||||||
if (last_insert_id)
|
if (last_insert_id)
|
||||||
*last_insert_id = mysql_insert_id(&mysql);
|
*last_insert_id = (uint32)mysql_insert_id(&mysql);
|
||||||
if (result) {
|
if (result) {
|
||||||
if (*result) {
|
if (*result) {
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef _EQDEBUG
|
#ifdef _EQDEBUG
|
||||||
cout << "DB Query Error: No Result" << endl;
|
std::cout << "DB Query Error: No Result" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (errnum)
|
if (errnum)
|
||||||
*errnum = UINT_MAX;
|
*errnum = UINT_MAX;
|
||||||
@@ -138,15 +220,15 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE
|
|||||||
}
|
}
|
||||||
#if DEBUG_MYSQL_QUERIES >= 1
|
#if DEBUG_MYSQL_QUERIES >= 1
|
||||||
if (ret) {
|
if (ret) {
|
||||||
cout << "query successful";
|
std::cout << "query successful";
|
||||||
if (result && (*result))
|
if (result && (*result))
|
||||||
cout << ", " << (int) mysql_num_rows(*result) << " rows returned";
|
std::cout << ", " << (int) mysql_num_rows(*result) << " rows returned";
|
||||||
if (affected_rows)
|
if (affected_rows)
|
||||||
cout << ", " << (*affected_rows) << " rows affected";
|
std::cout << ", " << (*affected_rows) << " rows affected";
|
||||||
cout<< endl;
|
std::cout<< std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cout << "QUERY: query FAILED" << endl;
|
std::cout << "QUERY: query FAILED" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@@ -180,9 +262,10 @@ bool DBcore::Open(uint32* errnum, char* errbuf) {
|
|||||||
LockMutex lock(&MDatabase);
|
LockMutex lock(&MDatabase);
|
||||||
if (GetStatus() == Connected)
|
if (GetStatus() == Connected)
|
||||||
return true;
|
return true;
|
||||||
if (GetStatus() == Error)
|
if (GetStatus() == Error) {
|
||||||
mysql_close(&mysql);
|
mysql_close(&mysql);
|
||||||
mysql_init(&mysql); // Initialize structure again
|
mysql_init(&mysql); // Initialize structure again
|
||||||
|
}
|
||||||
if (!pHost)
|
if (!pHost)
|
||||||
return false;
|
return false;
|
||||||
/*
|
/*
|
||||||
|
|||||||
+7
-4
@@ -4,16 +4,17 @@
|
|||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
//#include <winsock.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include "../common/DBMemLeak.h"
|
#include <string.h>
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
#include "../common/Mutex.h"
|
#include "../common/mutex.h"
|
||||||
#include "../common/linked_list.h"
|
#include "../common/linked_list.h"
|
||||||
#include "../common/queue.h"
|
#include "../common/queue.h"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.h"
|
||||||
#include "../common/Condition.h"
|
#include "../common/condition.h"
|
||||||
|
#include "../common/mysql_request_result.h"
|
||||||
|
|
||||||
class DBcore {
|
class DBcore {
|
||||||
public:
|
public:
|
||||||
@@ -23,6 +24,8 @@ public:
|
|||||||
~DBcore();
|
~DBcore();
|
||||||
eStatus GetStatus() { return pStatus; }
|
eStatus GetStatus() { return pStatus; }
|
||||||
bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true);
|
bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true);
|
||||||
|
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||||
|
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||||
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
|
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
|
||||||
void ping();
|
void ping();
|
||||||
MYSQL* getMySQL(){ return &mysql; }
|
MYSQL* getMySQL(){ return &mysql; }
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
// Doors
|
// Doors
|
||||||
#ifdef SHAREMEM
|
#ifdef SHAREMEM
|
||||||
int32 Database::GetDoorsCount(uint32* oMaxID) {
|
int32 Database::GetDoorsCount(uint32* oMaxID) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||||
char *query = 0;
|
char *query = 0;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
query = new char[256];
|
query = new char[256];
|
||||||
strcpy(query, "SELECT MAX(id), count(*) FROM doors");
|
strcpy(query, "SELECT MAX(id), count(*) FROM doors");
|
||||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
||||||
@@ -65,9 +63,9 @@ bool Database::LoadDoors() {
|
|||||||
bool Database::DBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) {
|
bool Database::DBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) {
|
||||||
cout << "Loading Doors from database..." << endl;
|
cout << "Loading Doors from database..." << endl;
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||||
char *query = 0;
|
char *query = 0;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
query = new char[256];
|
query = new char[256];
|
||||||
strcpy(query, "SELECT MAX(id), Count(*) FROM doors");
|
strcpy(query, "SELECT MAX(id), Count(*) FROM doors");
|
||||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||||
|
|||||||
+131
-129
@@ -1,25 +1,27 @@
|
|||||||
#include "debug.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
#include <string>
|
||||||
|
#include <cstdarg>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#if (_MSC_VER < 1500)
|
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include "../common/MiscFunctions.h"
|
|
||||||
#include "../common/platform.h"
|
#include "debug.h"
|
||||||
|
#include "string_util.h"
|
||||||
|
#include "misc_functions.h"
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
#ifndef va_copy
|
#ifndef va_copy
|
||||||
#define va_copy(d,s) ((d) = (s))
|
#define va_copy(d,s) ((d) = (s))
|
||||||
@@ -33,29 +35,20 @@ static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu",
|
|||||||
static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
|
static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
|
||||||
|
|
||||||
EQEMuLog::EQEMuLog() {
|
EQEMuLog::EQEMuLog() {
|
||||||
// MOpen = new Mutex;
|
|
||||||
// MLog = new Mutex*[MaxLogID];
|
|
||||||
// fp = new FILE*[MaxLogID];
|
|
||||||
// pLogStatus = new uint8[MaxLogID];
|
|
||||||
for (int i=0; i<MaxLogID; i++) {
|
for (int i=0; i<MaxLogID; i++) {
|
||||||
fp[i] = 0;
|
fp[i] = 0;
|
||||||
// MLog[i] = new Mutex;
|
logCallbackFmt[i] = nullptr;
|
||||||
#if EQDEBUG >= 2
|
logCallbackBuf[i] = nullptr;
|
||||||
pLogStatus[i] = 1 | 2;
|
logCallbackPva[i] = nullptr;
|
||||||
#else
|
|
||||||
pLogStatus[i] = 0;
|
|
||||||
#endif
|
|
||||||
logCallbackFmt[i] = NULL;
|
|
||||||
logCallbackBuf[i] = NULL;
|
|
||||||
logCallbackPva[i] = NULL;
|
|
||||||
}
|
}
|
||||||
// TODO: Make this read from an ini or something, everyone has different opinions on what it should be
|
|
||||||
#if EQDEBUG < 2
|
pLogStatus[Status] = LOG_LEVEL_STATUS;
|
||||||
pLogStatus[Status] = 2;
|
pLogStatus[Normal] = LOG_LEVEL_NORMAL;
|
||||||
pLogStatus[Error] = 2;
|
pLogStatus[Error] = LOG_LEVEL_ERROR;
|
||||||
pLogStatus[Quest] = 2;
|
pLogStatus[Debug] = LOG_LEVEL_DEBUG;
|
||||||
pLogStatus[Commands] = 1;
|
pLogStatus[Quest] = LOG_LEVEL_QUEST;
|
||||||
#endif
|
pLogStatus[Commands] = LOG_LEVEL_COMMANDS;
|
||||||
|
pLogStatus[Crash] = LOG_LEVEL_CRASH;
|
||||||
logFileValid = true;
|
logFileValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,41 +59,43 @@ EQEMuLog::~EQEMuLog() {
|
|||||||
if (fp[i])
|
if (fp[i])
|
||||||
fclose(fp[i]);
|
fclose(fp[i]);
|
||||||
}
|
}
|
||||||
// safe_delete_array(fp);
|
|
||||||
// safe_delete_array(MLog);
|
|
||||||
// safe_delete_array(pLogStatus);
|
|
||||||
// safe_delete(MOpen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQEMuLog::open(LogIDs id) {
|
bool EQEMuLog::open(LogIDs id) {
|
||||||
if (!logFileValid) {
|
if (!logFileValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LockMutex lock(&MOpen);
|
LockMutex lock(&MOpen);
|
||||||
if (pLogStatus[id] & 4) {
|
if (pLogStatus[id] & 4) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fp[id]) {
|
if (fp[id]) {
|
||||||
//cerr<<"Warning: LogFile already open"<<endl;
|
//cerr<<"Warning: LogFile already open"<<endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char exename[200] = "";
|
char exename[200] = "";
|
||||||
const EQEmuExePlatform &platform = GetExecutablePlatform();
|
const EQEmuExePlatform &platform = GetExecutablePlatform();
|
||||||
if(platform == ExePlatformWorld) {
|
if(platform == ExePlatformWorld) {
|
||||||
snprintf(exename, sizeof(exename), "_world");
|
snprintf(exename, sizeof(exename), "_world");
|
||||||
} else if(platform == ExePlatformZone) {
|
} else if(platform == ExePlatformZone) {
|
||||||
snprintf(exename, sizeof(exename), "_zone");
|
snprintf(exename, sizeof(exename), "_zone");
|
||||||
} else if(platform == ExePlatformLaunch) {
|
} else if(platform == ExePlatformLaunch) {
|
||||||
snprintf(exename, sizeof(exename), "_launch");
|
snprintf(exename, sizeof(exename), "_launch");
|
||||||
} else if(platform == ExePlatformUCS) {
|
} else if(platform == ExePlatformUCS) {
|
||||||
snprintf(exename, sizeof(exename), "_ucs");
|
snprintf(exename, sizeof(exename), "_ucs");
|
||||||
} else if(platform == ExePlatformQueryServ) {
|
} else if(platform == ExePlatformQueryServ) {
|
||||||
snprintf(exename, sizeof(exename), "_queryserv");
|
snprintf(exename, sizeof(exename), "_queryserv");
|
||||||
}
|
} else if(platform == ExePlatformSharedMemory) {
|
||||||
|
snprintf(exename, sizeof(exename), "_shared_memory");
|
||||||
|
} else if(platform == ExePlatformClientImport) {
|
||||||
|
snprintf(exename, sizeof(exename), "_import");
|
||||||
|
} else if(platform == ExePlatformClientExport) {
|
||||||
|
snprintf(exename, sizeof(exename), "_export");
|
||||||
|
}
|
||||||
|
|
||||||
char filename[200];
|
char filename[200];
|
||||||
#ifndef NO_PIDLOG
|
#ifndef NO_PIDLOG
|
||||||
@@ -108,24 +103,24 @@ bool EQEMuLog::open(LogIDs id) {
|
|||||||
#else
|
#else
|
||||||
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
|
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
|
||||||
#endif
|
#endif
|
||||||
fp[id] = fopen(filename, "a");
|
fp[id] = fopen(filename, "a");
|
||||||
if (!fp[id]) {
|
if (!fp[id]) {
|
||||||
cerr << "Failed to open log file: " << filename << endl;
|
std::cerr << "Failed to open log file: " << filename << std::endl;
|
||||||
pLogStatus[id] |= 4; // set file state to error
|
pLogStatus[id] |= 4; // set file state to error
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fputs("---------------------------------------------\n",fp[id]);
|
fputs("---------------------------------------------\n",fp[id]);
|
||||||
write(id, "Starting Log: %s", filename);
|
write(id, "Starting Log: %s", filename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
||||||
if (!logFileValid) {
|
if (!logFileValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool dofile = false;
|
bool dofile = false;
|
||||||
if (pLogStatus[id] & 1) {
|
if (pLogStatus[id] & 1) {
|
||||||
dofile = open(id);
|
dofile = open(id);
|
||||||
@@ -136,13 +131,13 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
|||||||
if (!logFileValid)
|
if (!logFileValid)
|
||||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||||
|
|
||||||
time_t aclock;
|
time_t aclock;
|
||||||
struct tm *newtime;
|
struct tm *newtime;
|
||||||
|
|
||||||
time( &aclock ); /* Get time in seconds */
|
time( &aclock ); /* Get time in seconds */
|
||||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||||
|
|
||||||
if (dofile)
|
if (dofile)
|
||||||
#ifndef NO_PIDLOG
|
#ifndef NO_PIDLOG
|
||||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||||
#else
|
#else
|
||||||
@@ -160,7 +155,7 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
|||||||
va_copy(tmpargptr, argptr);
|
va_copy(tmpargptr, argptr);
|
||||||
p(id, fmt, tmpargptr );
|
p(id, fmt, tmpargptr );
|
||||||
}
|
}
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8) {
|
if (pLogStatus[id] & 8) {
|
||||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||||
vfprintf( stderr, fmt, argptr );
|
vfprintf( stderr, fmt, argptr );
|
||||||
@@ -171,9 +166,9 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
if (dofile)
|
if (dofile)
|
||||||
fprintf(fp[id], "\n");
|
fprintf(fp[id], "\n");
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8) {
|
if (pLogStatus[id] & 8) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@@ -182,19 +177,19 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dofile)
|
if(dofile)
|
||||||
fflush(fp[id]);
|
fflush(fp[id]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//write with Prefix and a VA_list
|
//write with Prefix and a VA_list
|
||||||
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) {
|
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) {
|
||||||
if (!logFileValid) {
|
if (!logFileValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool dofile = false;
|
bool dofile = false;
|
||||||
if (pLogStatus[id] & 1) {
|
if (pLogStatus[id] & 1) {
|
||||||
dofile = open(id);
|
dofile = open(id);
|
||||||
@@ -206,15 +201,15 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list
|
|||||||
if (!logFileValid)
|
if (!logFileValid)
|
||||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||||
|
|
||||||
time_t aclock;
|
time_t aclock;
|
||||||
struct tm *newtime;
|
struct tm *newtime;
|
||||||
|
|
||||||
time( &aclock ); /* Get time in seconds */
|
time( &aclock ); /* Get time in seconds */
|
||||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||||
|
|
||||||
va_list tmpargptr;
|
va_list tmpargptr;
|
||||||
|
|
||||||
if (dofile) {
|
if (dofile) {
|
||||||
#ifndef NO_PIDLOG
|
#ifndef NO_PIDLOG
|
||||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
||||||
#else
|
#else
|
||||||
@@ -222,13 +217,13 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list
|
|||||||
#endif
|
#endif
|
||||||
va_copy(tmpargptr, argptr);
|
va_copy(tmpargptr, argptr);
|
||||||
vfprintf( fp[id], fmt, tmpargptr );
|
vfprintf( fp[id], fmt, tmpargptr );
|
||||||
}
|
}
|
||||||
if(logCallbackPva[id]) {
|
if(logCallbackPva[id]) {
|
||||||
msgCallbackPva p = logCallbackPva[id];
|
msgCallbackPva p = logCallbackPva[id];
|
||||||
va_copy(tmpargptr, argptr);
|
va_copy(tmpargptr, argptr);
|
||||||
p(id, prefix, fmt, tmpargptr );
|
p(id, prefix, fmt, tmpargptr );
|
||||||
}
|
}
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8) {
|
if (pLogStatus[id] & 8) {
|
||||||
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
|
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
|
||||||
vfprintf( stderr, fmt, argptr );
|
vfprintf( stderr, fmt, argptr );
|
||||||
@@ -239,26 +234,26 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
if (dofile)
|
if (dofile)
|
||||||
fprintf(fp[id], "\n");
|
fprintf(fp[id], "\n");
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8)
|
if (pLogStatus[id] & 8)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
else
|
else
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
}
|
}
|
||||||
if(dofile)
|
if(dofile)
|
||||||
fflush(fp[id]);
|
fflush(fp[id]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
||||||
if (!logFileValid) {
|
if (!logFileValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool dofile = false;
|
bool dofile = false;
|
||||||
if (pLogStatus[id] & 1) {
|
if (pLogStatus[id] & 1) {
|
||||||
dofile = open(id);
|
dofile = open(id);
|
||||||
@@ -269,13 +264,13 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
|||||||
if (!logFileValid)
|
if (!logFileValid)
|
||||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||||
|
|
||||||
time_t aclock;
|
time_t aclock;
|
||||||
struct tm *newtime;
|
struct tm *newtime;
|
||||||
|
|
||||||
time( &aclock ); /* Get time in seconds */
|
time( &aclock ); /* Get time in seconds */
|
||||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||||
|
|
||||||
if (dofile)
|
if (dofile)
|
||||||
#ifndef NO_PIDLOG
|
#ifndef NO_PIDLOG
|
||||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||||
#else
|
#else
|
||||||
@@ -290,7 +285,7 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
|||||||
msgCallbackBuf p = logCallbackBuf[id];
|
msgCallbackBuf p = logCallbackBuf[id];
|
||||||
p(id, buf, size, count);
|
p(id, buf, size, count);
|
||||||
}
|
}
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8) {
|
if (pLogStatus[id] & 8) {
|
||||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||||
fwrite(buf, size, count, stderr);
|
fwrite(buf, size, count, stderr);
|
||||||
@@ -301,9 +296,9 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
|||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dofile)
|
if(dofile)
|
||||||
fflush(fp[id]);
|
fflush(fp[id]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
||||||
@@ -313,23 +308,23 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
|||||||
va_copy(tmpargptr, argptr);
|
va_copy(tmpargptr, argptr);
|
||||||
vfprintf( fp[id], fmt, tmpargptr );
|
vfprintf( fp[id], fmt, tmpargptr );
|
||||||
}
|
}
|
||||||
if (pLogStatus[id] & 2) {
|
if (pLogStatus[id] & 2) {
|
||||||
if (pLogStatus[id] & 8)
|
if (pLogStatus[id] & 8)
|
||||||
vfprintf( stderr, fmt, argptr );
|
vfprintf( stderr, fmt, argptr );
|
||||||
else
|
else
|
||||||
vfprintf( stdout, fmt, argptr );
|
vfprintf( stdout, fmt, argptr );
|
||||||
}
|
}
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) {
|
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) {
|
||||||
if (!logFileValid) {
|
if (!logFileValid) {
|
||||||
#if EQDEBUG >= 10
|
#if EQDEBUG >= 10
|
||||||
cerr << "Error: Dump() from null pointer"<<endl;
|
std::cerr << "Error: Dump() from null pointer" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return true;
|
return true;
|
||||||
if (!LogFile)
|
if (!LogFile)
|
||||||
@@ -348,36 +343,45 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski
|
|||||||
|
|
||||||
write(id, "Dumping Packet: %i", size);
|
write(id, "Dumping Packet: %i", size);
|
||||||
// Output as HEX
|
// Output as HEX
|
||||||
int j = 0; char* ascii = new char[cols+1]; memset(ascii, 0, cols+1);
|
|
||||||
uint32 i;
|
int beginningOfLineOffset = 0;
|
||||||
for(i=skip; i<size; i++) {
|
uint32 indexInData;
|
||||||
if ((i-skip)%cols==0) {
|
std::string asciiOutput;
|
||||||
if (i != skip)
|
|
||||||
writeNTS(id, dofile, " | %s\n", ascii);
|
for(indexInData=skip; indexInData<size; indexInData++) {
|
||||||
writeNTS(id, dofile, "%4i: ", i-skip);
|
if ((indexInData-skip)%cols==0) {
|
||||||
memset(ascii, 0, cols+1);
|
if (indexInData != skip)
|
||||||
j = 0;
|
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||||
|
writeNTS(id, dofile, "%4i: ", indexInData-skip);
|
||||||
|
asciiOutput.clear();
|
||||||
|
beginningOfLineOffset = 0;
|
||||||
}
|
}
|
||||||
else if ((i-skip)%(cols/2) == 0) {
|
else if ((indexInData-skip)%(cols/2) == 0) {
|
||||||
writeNTS(id, dofile, "- ");
|
writeNTS(id, dofile, "- ");
|
||||||
}
|
}
|
||||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[i]);
|
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
|
||||||
|
|
||||||
if (data[i] >= 32 && data[i] < 127)
|
if (data[indexInData] >= 32 && data[indexInData] < 127)
|
||||||
ascii[j++] = data[i];
|
{
|
||||||
|
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
||||||
|
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
|
||||||
|
// version.
|
||||||
|
asciiOutput.append(std::to_string((long long)data[indexInData]));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ascii[j++] = '.';
|
{
|
||||||
}
|
asciiOutput.append(".");
|
||||||
uint32 k = ((i-skip)-1)%cols;
|
}
|
||||||
|
}
|
||||||
|
uint32 k = ((indexInData-skip)-1)%cols;
|
||||||
if (k < 8)
|
if (k < 8)
|
||||||
writeNTS(id, dofile, " ");
|
writeNTS(id, dofile, " ");
|
||||||
for (uint32 h = k+1; h < cols; h++) {
|
for (uint32 h = k+1; h < cols; h++) {
|
||||||
writeNTS(id, dofile, " ");
|
writeNTS(id, dofile, " ");
|
||||||
}
|
}
|
||||||
writeNTS(id, dofile, " | %s\n", ascii);
|
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||||
if (dofile)
|
if (dofile)
|
||||||
fflush(fp[id]);
|
fflush(fp[id]);
|
||||||
safe_delete_array(ascii);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,8 +390,8 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) {
|
|||||||
return;
|
return;
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logCallbackFmt[id] = proc;
|
logCallbackFmt[id] = proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) {
|
void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) {
|
||||||
@@ -395,8 +399,8 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) {
|
|||||||
return;
|
return;
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logCallbackBuf[id] = proc;
|
logCallbackBuf[id] = proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) {
|
void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) {
|
||||||
@@ -404,8 +408,8 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) {
|
|||||||
return;
|
return;
|
||||||
if (id >= MaxLogID) {
|
if (id >= MaxLogID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logCallbackPva[id] = proc;
|
logCallbackPva[id] = proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) {
|
void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) {
|
||||||
@@ -435,5 +439,3 @@ void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-41
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||||
|
|
||||||
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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Debug Levels
|
// Debug Levels
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
////// File/Console options
|
////// File/Console options
|
||||||
// 0 <= Quiet mode Errors to file Status and Normal ignored
|
// 0 <= Quiet mode Errors to file Status and Normal ignored
|
||||||
// 1 >= Status and Normal to console, Errors to file
|
// 1 >= Status and Normal to console, Errors to file
|
||||||
// 2 >= Status, Normal, and Error to console and logfile
|
// 2 >= Status, Normal, and Error to console and logfile
|
||||||
// 3 >= Lite debug
|
// 3 >= Lite debug
|
||||||
// 4 >= Medium debug
|
// 4 >= Medium debug
|
||||||
// 5 >= Debug release (Anything higher is not recommended for regular use)
|
// 5 >= Debug release (Anything higher is not recommended for regular use)
|
||||||
// 6 == (Reserved for special builds) Login opcode debug All packets dumped
|
// 6 == (Reserved for special builds) Login opcode debug All packets dumped
|
||||||
// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped
|
// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped
|
||||||
// 8 == (Reserved for special builds) World opcode debug All packets dumped
|
// 8 == (Reserved for special builds) World opcode debug All packets dumped
|
||||||
// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped
|
// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped
|
||||||
@@ -45,31 +45,9 @@
|
|||||||
#ifndef _CRTDBG_MAP_ALLOC
|
#ifndef _CRTDBG_MAP_ALLOC
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#if (_MSC_VER < 1300)
|
|
||||||
#include <new>
|
|
||||||
#include <memory>
|
|
||||||
#define _CRTDBG_MAP_ALLOC
|
|
||||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
|
||||||
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ThrowError
|
|
||||||
void CatchSignal(int);
|
|
||||||
#if defined(CATCH_CRASH) || defined(_EQDEBUG)
|
|
||||||
#define ThrowError(errstr) { cout << "Fatal error: " << errstr << " (" << __FILE__ << ", line " << __LINE__ << ")" << endl; LogFile->write(EQEMuLog::Error, "Thown Error: %s (%s:%i)", errstr, __FILE__, __LINE__); throw errstr; }
|
|
||||||
#else
|
|
||||||
#define ThrowError(errstr) { cout << "Fatal error: " << errstr << " (" << __FILE__ << ", line " << __LINE__ << ")" << endl; LogFile->write(EQEMuLog::Error, "Thown Error: %s (%s:%i)", errstr, __FILE__, __LINE__); CatchSignal(0); }
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
// VS6 doesn't like the length of STL generated names: disabling
|
|
||||||
#pragma warning(disable:4786)
|
|
||||||
#pragma warning(disable:4996)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EQDEBUG_H
|
#ifndef EQDEBUG_H
|
||||||
#define EQDEBUG_H
|
#define EQDEBUG_H
|
||||||
|
|
||||||
@@ -90,12 +68,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "logsys.h"
|
#include "logsys.h"
|
||||||
#include "common_profile.h"
|
|
||||||
#ifdef ZONE
|
|
||||||
#include "../zone/zone_profile.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../common/Mutex.h"
|
#include "../common/mutex.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
@@ -112,7 +86,7 @@ public:
|
|||||||
Debug,
|
Debug,
|
||||||
Quest,
|
Quest,
|
||||||
Commands,
|
Commands,
|
||||||
Crash,
|
Crash,
|
||||||
MaxLogID
|
MaxLogID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+151
-50
@@ -1,65 +1,166 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||||
|
|
||||||
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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
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 DEITY_H
|
#ifndef DEITY_H
|
||||||
#define DEITY_H
|
#define DEITY_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// NOTE: This code is not fully implemented since there are no references in the existing code
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Diety List
|
** Diety types
|
||||||
|
**
|
||||||
|
** (ref: eqstr_us.txt)
|
||||||
|
**
|
||||||
|
** (Another orphaned enumeration...)
|
||||||
*/
|
*/
|
||||||
#define DEITY_AGNOSTIC 396 //drop the high bit for 140
|
enum DeityTypes
|
||||||
#define DEITY_BRELL 202
|
{
|
||||||
#define DEITY_CAZIC 203
|
/*----*/ DeityUnknown = 0,
|
||||||
#define DEITY_EROLLSI 204
|
/*----*/ DeityAgnostic_LB = 140,
|
||||||
#define DEITY_BRISTLE 205
|
/*3251*/ DeityBertoxxulous = 201,
|
||||||
#define DEITY_INNY 206
|
/*3262*/ DeityBrellSirilis,
|
||||||
#define DEITY_KARANA 207
|
/*3253*/ DeityCazicThule,
|
||||||
#define DEITY_MITH 208
|
/*3256*/ DeityErollisiMarr,
|
||||||
#define DEITY_PREXUS 209
|
/*3252*/ DeityBristlebane,
|
||||||
#define DEITY_QUELLIOUS 210
|
/*3254*/ DeityInnoruuk,
|
||||||
#define DEITY_RALLOS 211
|
/*3255*/ DeityKarana,
|
||||||
#define DEITY_SOLUSEK 213
|
/*3257*/ DeityMithanielMarr,
|
||||||
#define DEITY_TRIBUNAL 214
|
/*3259*/ DeityPrexus,
|
||||||
#define DEITY_TUNARE 215
|
/*3260*/ DeityQuellious,
|
||||||
|
/*3266*/ DeityRallosZek,
|
||||||
|
/*3258*/ DeityRodcetNife,
|
||||||
|
/*3261*/ DeitySolusekRo,
|
||||||
|
/*3263*/ DeityTheTribunal,
|
||||||
|
/*3264*/ DeityTunare,
|
||||||
|
/*3265*/ DeityVeeshan,
|
||||||
|
/*3250*/ DeityAgnostic = 396
|
||||||
|
};
|
||||||
|
|
||||||
//Guessed:
|
/*
|
||||||
#define DEITY_BERTOX 201
|
** Deity type bits
|
||||||
#define DEITY_RODCET 212
|
**
|
||||||
#define DEITY_VEESHAN 216
|
** (New orphan, but make use of it!)
|
||||||
|
|
||||||
/* on items:
|
|
||||||
*All 0
|
|
||||||
AGNOSTIC 1
|
|
||||||
BERTOX 2
|
|
||||||
BRELL 4
|
|
||||||
CAZIC 8
|
|
||||||
EROLLSI 16
|
|
||||||
BRISTLE 32
|
|
||||||
INNY 64
|
|
||||||
KARANA 128
|
|
||||||
MITH 256
|
|
||||||
PREXUS 512
|
|
||||||
QUELLIOUS 1024
|
|
||||||
RALLOS 2048
|
|
||||||
RODCET 4096
|
|
||||||
SOLUSEK 8192
|
|
||||||
TRIBUNAL 16384
|
|
||||||
TUNARE 32768
|
|
||||||
VEESHAN 65536
|
|
||||||
*/
|
*/
|
||||||
|
enum DeityTypeBits : uint32
|
||||||
|
{
|
||||||
|
BIT_DeityAll = 0x00000000,
|
||||||
|
BIT_DeityAgnostic = 0x00000001,
|
||||||
|
BIT_DeityBertoxxulous = 0x00000002,
|
||||||
|
BIT_DeityBrellSirilis = 0x00000004,
|
||||||
|
BIT_DeityCazicThule = 0x00000008,
|
||||||
|
BIT_DeityErollisiMarr = 0x00000010,
|
||||||
|
BIT_DeityBristlebane = 0x00000020,
|
||||||
|
BIT_DeityInnoruuk = 0x00000040,
|
||||||
|
BIT_DeityKarana = 0x00000080,
|
||||||
|
BIT_DeityMithanielMarr = 0x00000100,
|
||||||
|
BIT_DeityPrexus = 0x00000200,
|
||||||
|
BIT_DeityQuellious = 0x00000400,
|
||||||
|
BIT_DeityRallosZek = 0x00000800,
|
||||||
|
BIT_DeityRodcetNife = 0x00001000,
|
||||||
|
BIT_DeitySolusekRo = 0x00002000,
|
||||||
|
BIT_DeityTheTribunal = 0x00004000,
|
||||||
|
BIT_DeityTunare = 0x00008000,
|
||||||
|
BIT_DeityVeeshan = 0x00010000
|
||||||
|
};
|
||||||
|
|
||||||
|
static DeityTypeBits ConvertDeityToBitDeity(DeityTypes deity)
|
||||||
|
{
|
||||||
|
switch(deity)
|
||||||
|
{
|
||||||
|
case DeityBertoxxulous: { return BIT_DeityBertoxxulous; }
|
||||||
|
case DeityBrellSirilis: { return BIT_DeityBrellSirilis; }
|
||||||
|
case DeityCazicThule: { return BIT_DeityCazicThule; }
|
||||||
|
case DeityErollisiMarr: { return BIT_DeityErollisiMarr; }
|
||||||
|
case DeityBristlebane: { return BIT_DeityBristlebane; }
|
||||||
|
case DeityInnoruuk: { return BIT_DeityInnoruuk; }
|
||||||
|
case DeityKarana: { return BIT_DeityKarana; }
|
||||||
|
case DeityMithanielMarr: { return BIT_DeityMithanielMarr; }
|
||||||
|
case DeityPrexus: { return BIT_DeityPrexus; }
|
||||||
|
case DeityQuellious: { return BIT_DeityQuellious; }
|
||||||
|
case DeityRallosZek: { return BIT_DeityRallosZek; }
|
||||||
|
case DeityRodcetNife: { return BIT_DeityRodcetNife; }
|
||||||
|
case DeitySolusekRo: { return BIT_DeitySolusekRo; }
|
||||||
|
case DeityTheTribunal: { return BIT_DeityTheTribunal; }
|
||||||
|
case DeityTunare: { return BIT_DeityTunare; }
|
||||||
|
case DeityVeeshan: { return BIT_DeityVeeshan; }
|
||||||
|
case DeityAgnostic_LB:
|
||||||
|
case DeityAgnostic: { return BIT_DeityAgnostic; }
|
||||||
|
default: { break; }
|
||||||
|
};
|
||||||
|
|
||||||
|
return BIT_DeityAll;
|
||||||
|
};
|
||||||
|
|
||||||
|
static DeityTypes ConvertBitDeityToDeity(DeityTypeBits deity_bit)
|
||||||
|
{
|
||||||
|
switch(deity_bit)
|
||||||
|
{
|
||||||
|
case BIT_DeityAgnostic: { return DeityAgnostic; }
|
||||||
|
case BIT_DeityBertoxxulous: { return DeityBertoxxulous; }
|
||||||
|
case BIT_DeityBrellSirilis: { return DeityBrellSirilis; }
|
||||||
|
case BIT_DeityCazicThule: { return DeityCazicThule; }
|
||||||
|
case BIT_DeityErollisiMarr: { return DeityErollisiMarr; }
|
||||||
|
case BIT_DeityBristlebane: { return DeityBristlebane; }
|
||||||
|
case BIT_DeityInnoruuk: { return DeityInnoruuk; }
|
||||||
|
case BIT_DeityKarana: { return DeityKarana; }
|
||||||
|
case BIT_DeityMithanielMarr: { return DeityMithanielMarr; }
|
||||||
|
case BIT_DeityPrexus: { return DeityPrexus; }
|
||||||
|
case BIT_DeityQuellious: { return DeityQuellious; }
|
||||||
|
case BIT_DeityRallosZek: { return DeityRallosZek; }
|
||||||
|
case BIT_DeityRodcetNife: { return DeityRodcetNife; }
|
||||||
|
case BIT_DeitySolusekRo: { return DeitySolusekRo; }
|
||||||
|
case BIT_DeityTheTribunal: { return DeityTheTribunal; }
|
||||||
|
case BIT_DeityTunare: { return DeityTunare; }
|
||||||
|
case BIT_DeityVeeshan: { return DeityVeeshan; }
|
||||||
|
default: { break; }
|
||||||
|
};
|
||||||
|
|
||||||
|
return DeityUnknown;
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::string GetDeityName(DeityTypes deity)
|
||||||
|
{
|
||||||
|
switch(deity)
|
||||||
|
{
|
||||||
|
case DeityBertoxxulous: { return "Bertoxxulous"; }
|
||||||
|
case DeityBrellSirilis: { return "Brell Serilis"; }
|
||||||
|
case DeityCazicThule: { return "Cazic-Thule"; }
|
||||||
|
case DeityErollisiMarr: { return "Erollisi Marr"; }
|
||||||
|
case DeityBristlebane: { return "Bristlebane"; }
|
||||||
|
case DeityInnoruuk: { return "Innoruuk"; }
|
||||||
|
case DeityKarana: { return "Karana"; }
|
||||||
|
case DeityMithanielMarr: { return "Mithaniel Marr"; }
|
||||||
|
case DeityPrexus: { return "Prexus"; }
|
||||||
|
case DeityQuellious: { return "Quellious"; }
|
||||||
|
case DeityRallosZek: { return "Rallos Zek"; }
|
||||||
|
case DeityRodcetNife: { return "Rodcet Nife"; }
|
||||||
|
case DeitySolusekRo: { return "Solusek Ro"; }
|
||||||
|
case DeityTheTribunal: { return "The Tribunal"; }
|
||||||
|
case DeityTunare: { return "Tunare"; }
|
||||||
|
case DeityVeeshan: { return "Veeshan"; }
|
||||||
|
case DeityAgnostic_LB:
|
||||||
|
case DeityAgnostic: { return "Agnostic"; }
|
||||||
|
default: { break; }
|
||||||
|
};
|
||||||
|
|
||||||
|
return "Unknown";
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+14
-14
@@ -1,19 +1,19 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2005 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@@ -25,7 +25,7 @@ const char *OpcodeNames[_maxEmuOpcode+1] = {
|
|||||||
//a preprocessor hack so we dont have to maintain two lists
|
//a preprocessor hack so we dont have to maintain two lists
|
||||||
#define N(x) #x
|
#define N(x) #x
|
||||||
#include "emu_oplist.h"
|
#include "emu_oplist.h"
|
||||||
#include "mail_oplist.h"
|
#include "mail_oplist.h"
|
||||||
#undef N
|
#undef N
|
||||||
|
|
||||||
""
|
""
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2005 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
|
||||||
@@ -9,11 +9,11 @@ This program is distributed in the hope that it will be useful,
|
|||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
||||||
*/
|
*/
|
||||||
#ifndef EMU_OPCODES_H
|
#ifndef EMU_OPCODES_H
|
||||||
#define EMU_OPCODES_H
|
#define EMU_OPCODES_H
|
||||||
@@ -49,5 +49,3 @@ extern const char *OpcodeNames[_maxEmuOpcode+1];
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -538,3 +538,6 @@ N(OP_MercenaryDismiss),
|
|||||||
N(OP_MercenaryTimerRequest),
|
N(OP_MercenaryTimerRequest),
|
||||||
N(OP_OpenInventory),
|
N(OP_OpenInventory),
|
||||||
N(OP_OpenContainer),
|
N(OP_OpenContainer),
|
||||||
|
N(OP_Marquee),
|
||||||
|
N(OP_ClientTimeStamp),
|
||||||
|
N(OP_GuildPromote),
|
||||||
|
|||||||
@@ -1,59 +1,37 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2006 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
|
||||||
the Free Software Foundation; version 2 of the License.
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
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
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
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.
|
||||||
* 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/debug.h"
|
#include "../common/debug.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "EmuTCPConnection.h"
|
#include "emu_tcp_connection.h"
|
||||||
#include "EmuTCPServer.h"
|
#include "emu_tcp_server.h"
|
||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
#include "../common/packet_dump.h"
|
#include "../common/packet_dump.h"
|
||||||
|
|
||||||
@@ -71,12 +49,12 @@ using namespace std;
|
|||||||
|
|
||||||
//server side case
|
//server side case
|
||||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_socket, uint32 irIP, uint16 irPort, bool iOldFormat)
|
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_socket, uint32 irIP, uint16 irPort, bool iOldFormat)
|
||||||
: TCPConnection(ID, in_socket, irIP, irPort),
|
: TCPConnection(ID, in_socket, irIP, irPort),
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
keepalive_timer(SERVER_TIMEOUT),
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
timeout_timer(SERVER_TIMEOUT * 2)
|
||||||
{
|
{
|
||||||
id = 0;
|
id = 0;
|
||||||
Server = NULL;
|
Server = nullptr;
|
||||||
pOldFormat = iOldFormat;
|
pOldFormat = iOldFormat;
|
||||||
#ifdef MINILOGIN
|
#ifdef MINILOGIN
|
||||||
TCPMode = modePacket;
|
TCPMode = modePacket;
|
||||||
@@ -97,9 +75,9 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_s
|
|||||||
|
|
||||||
//client outgoing connection case (and client side relay)
|
//client outgoing connection case (and client side relay)
|
||||||
EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer, eTCPMode iMode)
|
EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer, eTCPMode iMode)
|
||||||
: TCPConnection(),
|
: TCPConnection(),
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
keepalive_timer(SERVER_TIMEOUT),
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
timeout_timer(SERVER_TIMEOUT * 2)
|
||||||
{
|
{
|
||||||
Server = iRelayServer;
|
Server = iRelayServer;
|
||||||
if (Server)
|
if (Server)
|
||||||
@@ -113,29 +91,27 @@ EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer,
|
|||||||
TCPMode = iMode;
|
TCPMode = iMode;
|
||||||
PacketMode = packetModeZone;
|
PacketMode = packetModeZone;
|
||||||
#if TCPN_DEBUG_Memory >= 7
|
#if TCPN_DEBUG_Memory >= 7
|
||||||
cout << "Constructor #1 on outgoing TCP# " << GetID() << endl;
|
std::cout << "Constructor #1 on outgoing TCP# " << GetID() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//server side relay case
|
//server side relay case
|
||||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort)
|
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort)
|
||||||
: TCPConnection(ID, 0, irIP, irPort),
|
: TCPConnection(ID, 0, irIP, irPort),
|
||||||
keepalive_timer(SERVER_TIMEOUT),
|
keepalive_timer(SERVER_TIMEOUT),
|
||||||
timeout_timer(SERVER_TIMEOUT * 2)
|
timeout_timer(SERVER_TIMEOUT * 2)
|
||||||
{
|
{
|
||||||
Server = iServer;
|
Server = iServer;
|
||||||
RelayLink = iRelayLink;
|
RelayLink = iRelayLink;
|
||||||
RelayServer = true;
|
RelayServer = true;
|
||||||
RelayCount = 0;
|
RelayCount = 0;
|
||||||
RemoteID = iRemoteID;
|
RemoteID = iRemoteID;
|
||||||
if (!RemoteID)
|
|
||||||
ThrowError("Error: TCPConnection: RemoteID == 0 on RelayLink constructor");
|
|
||||||
pOldFormat = false;
|
pOldFormat = false;
|
||||||
ConnectionType = Incomming;
|
ConnectionType = Incomming;
|
||||||
TCPMode = modePacket;
|
TCPMode = modePacket;
|
||||||
PacketMode = packetModeZone;
|
PacketMode = packetModeZone;
|
||||||
#if TCPN_DEBUG_Memory >= 7
|
#if TCPN_DEBUG_Memory >= 7
|
||||||
cout << "Constructor #3 on outgoing TCP# " << GetID() << endl;
|
std::cout << "Constructor #3 on outgoing TCP# " << GetID() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +119,6 @@ EmuTCPConnection::~EmuTCPConnection() {
|
|||||||
//the queues free their content right now I believe.
|
//the queues free their content right now I believe.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32 iDestination) {
|
EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32 iDestination) {
|
||||||
int32 size = sizeof(EmuTCPNetPacket_Struct) + pack->size;
|
int32 size = sizeof(EmuTCPNetPacket_Struct) + pack->size;
|
||||||
if (pack->compressed) {
|
if (pack->compressed) {
|
||||||
@@ -196,7 +171,7 @@ bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
|||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
CoutTimestamp(true);
|
CoutTimestamp(true);
|
||||||
cout << ": Logging outgoing TCP OldPacket. OPCode: 0x" << hex << setw(4) << setfill('0') << pack->opcode << dec << ", size: " << setw(5) << setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << endl;
|
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 TCPN_LOG_PACKETS == 2
|
||||||
if (pack->size >= 32)
|
if (pack->size >= 32)
|
||||||
DumpPacket(pack->pBuffer, 32);
|
DumpPacket(pack->pBuffer, 32);
|
||||||
@@ -223,7 +198,7 @@ bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
|||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
CoutTimestamp(true);
|
CoutTimestamp(true);
|
||||||
cout << ": Logging outgoing TCP packet. OPCode: 0x" << hex << setw(4) << setfill('0') << pack->opcode << dec << ", size: " << setw(5) << setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << endl;
|
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 TCPN_LOG_PACKETS == 2
|
||||||
if (pack->size >= 32)
|
if (pack->size >= 32)
|
||||||
DumpPacket(pack->pBuffer, 32);
|
DumpPacket(pack->pBuffer, 32);
|
||||||
@@ -262,10 +237,10 @@ bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
|||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
CoutTimestamp(true);
|
CoutTimestamp(true);
|
||||||
cout << ": Logging outgoing TCP NetPacket. OPCode: 0x" << hex << setw(4) << setfill('0') << tnps->opcode << dec << ", size: " << setw(5) << setfill(' ') << tnps->size << " " << inet_ntoa(in) << ":" << GetrPort();
|
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)
|
if (pOldFormat)
|
||||||
cout << " (OldFormat)";
|
std::cout << " (OldFormat)";
|
||||||
cout << endl;
|
std::cout << std::endl;
|
||||||
#if TCPN_LOG_PACKETS == 2
|
#if TCPN_LOG_PACKETS == 2
|
||||||
if (tnps->size >= 32)
|
if (tnps->size >= 32)
|
||||||
DumpPacket((uchar*) tnps, 32);
|
DumpPacket((uchar*) tnps, 32);
|
||||||
@@ -284,7 +259,7 @@ bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
|||||||
ServerPacket* EmuTCPConnection::PopPacket() {
|
ServerPacket* EmuTCPConnection::PopPacket() {
|
||||||
ServerPacket* ret;
|
ServerPacket* ret;
|
||||||
if (!MOutQueueLock.trylock())
|
if (!MOutQueueLock.trylock())
|
||||||
return NULL;
|
return nullptr;
|
||||||
ret = OutQueue.pop();
|
ret = OutQueue.pop();
|
||||||
MOutQueueLock.unlock();
|
MOutQueueLock.unlock();
|
||||||
return ret;
|
return ret;
|
||||||
@@ -307,7 +282,7 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
|||||||
#if defined(GOTFRAGS) && 0
|
#if defined(GOTFRAGS) && 0
|
||||||
if (strcmp(line, "**CRASHME**") == 0) {
|
if (strcmp(line, "**CRASHME**") == 0) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
cout << (5 / i) << endl;
|
std::cout << (5 / i) << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(line[0] == '*') {
|
if(line[0] == '*') {
|
||||||
@@ -391,7 +366,6 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
|||||||
safe_delete_array(line);
|
safe_delete_array(line);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TCPConnection::LineOutQueuePush(line));
|
return(TCPConnection::LineOutQueuePush(line));
|
||||||
@@ -444,7 +418,8 @@ bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
|
|||||||
sendbuf_used = sendbuf_size;
|
sendbuf_used = sendbuf_size;
|
||||||
sendbuf = new uchar[sendbuf_size];
|
sendbuf = new uchar[sendbuf_size];
|
||||||
memcpy(sendbuf, "\0**PACKETMODEQS**\r", sendbuf_size);
|
memcpy(sendbuf, "\0**PACKETMODEQS**\r", sendbuf_size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//default: packetModeZone
|
//default: packetModeZone
|
||||||
safe_delete_array(sendbuf);
|
safe_delete_array(sendbuf);
|
||||||
sendbuf_size = 20;
|
sendbuf_size = 20;
|
||||||
@@ -475,15 +450,14 @@ void EmuTCPConnection::ClearBuffers() {
|
|||||||
timeout_timer.Start();
|
timeout_timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
||||||
#if TCPC_DEBUG >= 1
|
#if TCPC_DEBUG >= 1
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
cout "NetError: '";
|
std::cout "NetError: '";
|
||||||
if (reason)
|
if (reason)
|
||||||
cout << reason;
|
std::cout << reason;
|
||||||
cout << "': " << inet_ntoa(in) << ":" << GetPort() << endl;
|
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
ServerPacket* pack = new ServerPacket(0);
|
ServerPacket* pack = new ServerPacket(0);
|
||||||
pack->size = 1;
|
pack->size = 1;
|
||||||
@@ -546,7 +520,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
|||||||
size = tnps->size;
|
size = tnps->size;
|
||||||
if (size >= MaxTCPReceiveBuffferSize) {
|
if (size >= MaxTCPReceiveBuffferSize) {
|
||||||
#if TCPN_DEBUG_Memory >= 1
|
#if TCPN_DEBUG_Memory >= 1
|
||||||
cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << endl;
|
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
||||||
DumpPacket(&recvbuf[base], 16);
|
DumpPacket(&recvbuf[base], 16);
|
||||||
#endif
|
#endif
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
@@ -586,13 +560,13 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
|||||||
if (pack->opcode == 0) {
|
if (pack->opcode == 0) {
|
||||||
if (pack->size) {
|
if (pack->size) {
|
||||||
#if TCPN_DEBUG >= 2
|
#if TCPN_DEBUG >= 2
|
||||||
cout << "Received TCP Network layer packet" << endl;
|
std::cout << "Received TCP Network layer packet" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
ProcessNetworkLayerPacket(pack);
|
ProcessNetworkLayerPacket(pack);
|
||||||
}
|
}
|
||||||
#if TCPN_DEBUG >= 5
|
#if TCPN_DEBUG >= 5
|
||||||
else {
|
else {
|
||||||
cout << "Received TCP keepalive packet. (opcode=0)" << endl;
|
std::cout << "Received TCP keepalive packet. (opcode=0)" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// keepalive, no need to process
|
// keepalive, no need to process
|
||||||
@@ -604,7 +578,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
|||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
CoutTimestamp(true);
|
CoutTimestamp(true);
|
||||||
cout << ": Logging incoming TCP packet. OPCode: 0x" << hex << setw(4) << setfill('0') << pack->opcode << dec << ", size: " << setw(5) << setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << endl;
|
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 TCPN_LOG_PACKETS == 2
|
||||||
if (pack->size >= 32)
|
if (pack->size >= 32)
|
||||||
DumpPacket(pack->pBuffer, 32);
|
DumpPacket(pack->pBuffer, 32);
|
||||||
@@ -620,7 +594,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
|||||||
EmuTCPConnection* con = Server->FindConnection(pack->destination);
|
EmuTCPConnection* con = Server->FindConnection(pack->destination);
|
||||||
if (!con) {
|
if (!con) {
|
||||||
#if TCPN_DEBUG >= 1
|
#if TCPN_DEBUG >= 1
|
||||||
cout << "Error relaying packet: con = 0" << endl;
|
std::cout << "Error relaying packet: con = 0" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
}
|
}
|
||||||
@@ -659,7 +633,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
|||||||
memcpy(&size, &buffer[2], 2);
|
memcpy(&size, &buffer[2], 2);
|
||||||
if (size >= MaxTCPReceiveBuffferSize) {
|
if (size >= MaxTCPReceiveBuffferSize) {
|
||||||
#if TCPN_DEBUG_Memory >= 1
|
#if TCPN_DEBUG_Memory >= 1
|
||||||
cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << endl;
|
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
||||||
@@ -689,7 +663,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
|||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
CoutTimestamp(true);
|
CoutTimestamp(true);
|
||||||
cout << ": Logging incoming TCP OldPacket. OPCode: 0x" << hex << setw(4) << setfill('0') << pack->opcode << dec << ", size: " << setw(5) << setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << endl;
|
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 TCPN_LOG_PACKETS == 2
|
||||||
if (pack->size >= 32)
|
if (pack->size >= 32)
|
||||||
DumpPacket(pack->pBuffer, 32);
|
DumpPacket(pack->pBuffer, 32);
|
||||||
@@ -750,7 +724,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
|||||||
#if TCPC_DEBUG >= 3
|
#if TCPC_DEBUG >= 3
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
cout << "Switching to RelayServer mode: " << inet_ntoa(in) << ":" << GetPort() << endl;
|
std::cout << "Switching to RelayServer mode: " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
RelayServer = true;
|
RelayServer = true;
|
||||||
break;
|
break;
|
||||||
@@ -798,10 +772,10 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
|||||||
#if TCPC_DEBUG >= 1
|
#if TCPC_DEBUG >= 1
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetrIP();
|
in.s_addr = GetrIP();
|
||||||
cout "Received NetError: '";
|
std::cout "Received NetError: '";
|
||||||
if (pack->size > 1)
|
if (pack->size > 1)
|
||||||
cout << (char*) data;
|
std::cout << (char*) data;
|
||||||
cout << "': " << inet_ntoa(in) << ":" << GetPort() << endl;
|
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -820,11 +794,11 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
|||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
#if TCPN_DEBUG >= 5
|
#if TCPN_DEBUG >= 5
|
||||||
cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << endl;
|
std::cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmuTCPConnection::RecvData(char* errbuf) {
|
bool EmuTCPConnection::RecvData(char* errbuf) {
|
||||||
@@ -844,14 +818,3 @@ bool EmuTCPConnection::RecvData(char* errbuf) {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EmuTCPCONNECTION_H_
|
#ifndef EmuTCPCONNECTION_H_
|
||||||
#define EmuTCPCONNECTION_H_
|
#define EmuTCPCONNECTION_H_
|
||||||
|
|
||||||
#include "TCPConnection.h"
|
#include "tcp_connection.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
//moved out of TCPConnection:: to be more exportable
|
//moved out of TCPConnection:: to be more exportable
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
void SetPacketMode(ePacketMode mode) { PacketMode = mode; }
|
void SetPacketMode(ePacketMode mode) { PacketMode = mode; }
|
||||||
|
|
||||||
eTCPMode GetMode() const { return TCPMode; }
|
eTCPMode GetMode() const { return TCPMode; }
|
||||||
ePacketMode GetPacketMode() const { return(PacketMode); }
|
ePacketMode GetPacketMode() const { return(PacketMode); }
|
||||||
|
|
||||||
//relay crap:
|
//relay crap:
|
||||||
inline bool IsRelayServer() const { return RelayServer; }
|
inline bool IsRelayServer() const { return RelayServer; }
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "EmuTCPServer.h"
|
#include "emu_tcp_server.h"
|
||||||
#include "EmuTCPConnection.h"
|
#include "emu_tcp_connection.h"
|
||||||
|
|
||||||
EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat)
|
EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat)
|
||||||
: TCPServer<EmuTCPConnection>(iPort),
|
: TCPServer<EmuTCPConnection>(iPort),
|
||||||
pOldFormat(iOldFormat)
|
pOldFormat(iOldFormat)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +38,7 @@ void EmuTCPServer::SendPacket(EmuTCPNetPacket_Struct** tnps) {
|
|||||||
MInQueue.lock();
|
MInQueue.lock();
|
||||||
m_InQueue.push(*tnps);
|
m_InQueue.push(*tnps);
|
||||||
MInQueue.unlock();
|
MInQueue.unlock();
|
||||||
tnps = NULL;
|
tnps = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuTCPServer::CheckInQueue() {
|
void EmuTCPServer::CheckInQueue() {
|
||||||
@@ -61,7 +57,7 @@ void EmuTCPServer::CheckInQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
||||||
EmuTCPNetPacket_Struct* ret = NULL;
|
EmuTCPNetPacket_Struct* ret = nullptr;
|
||||||
MInQueue.lock();
|
MInQueue.lock();
|
||||||
if(!m_InQueue.empty()) {
|
if(!m_InQueue.empty()) {
|
||||||
ret = m_InQueue.front();
|
ret = m_InQueue.front();
|
||||||
@@ -80,17 +76,6 @@ EmuTCPConnection *EmuTCPServer::FindConnection(uint32 iID) {
|
|||||||
if ((*cur)->GetID() == iID)
|
if ((*cur)->GetID() == iID)
|
||||||
return *cur;
|
return *cur;
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EmuTCPSERVER_H_
|
#ifndef EmuTCPSERVER_H_
|
||||||
#define EmuTCPSERVER_H_
|
#define EmuTCPSERVER_H_
|
||||||
|
|
||||||
#include "TCPServer.h"
|
#include "tcp_server.h"
|
||||||
|
|
||||||
class EmuTCPConnection;
|
class EmuTCPConnection;
|
||||||
struct EmuTCPNetPacket_Struct;
|
struct EmuTCPNetPacket_Struct;
|
||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
EmuTCPConnection *FindConnection(uint32 iID);
|
EmuTCPConnection *FindConnection(uint32 iID);
|
||||||
|
|
||||||
//exposed for some crap we pull. Do not call from outside this object.
|
//exposed for some crap we pull. Do not call from outside this object.
|
||||||
TCPServer<EmuTCPConnection>::AddConnection;
|
using TCPServer<EmuTCPConnection>::AddConnection;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Process();
|
virtual void Process();
|
||||||
+696
-385
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user