Compare commits
1109 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d862da540 | |||
| a1db96d70d | |||
| f8a0225b33 | |||
| 95f1a0e645 | |||
| afad6daa7d | |||
| ae472e9e67 | |||
| 1ad4380fab | |||
| 21da317453 | |||
| 394b698e92 | |||
| eca7339a67 | |||
| 4cbbbec8b3 | |||
| 0ed518a85d | |||
| eb7128bcc1 | |||
| 2200e6f4d9 | |||
| 336442eeba | |||
| 6f3b3f11c8 | |||
| eb3e18ac7e | |||
| d0fd6eedf6 | |||
| 677bc4c553 | |||
| 2e668cd2b6 | |||
| 35b57fc78e | |||
| f9c592098f | |||
| fe74f97d44 | |||
| 77e11d670a | |||
| 5a1d702e3d | |||
| 30b8e51234 | |||
| a99061127f | |||
| 69cb8349e6 | |||
| f5813bf2cd | |||
| 6bf4695721 | |||
| 2f2a0c8fbc | |||
| 5912953152 | |||
| 2fad8039f5 | |||
| b9bfd7af80 | |||
| 54cdc41ac8 | |||
| 5da33c6243 | |||
| 4e55e6abbd | |||
| 283c1f64e7 | |||
| c3960b7f43 | |||
| 12f217aba9 | |||
| dc8b0b09c6 | |||
| e79236a97f | |||
| 1c4ae999d6 | |||
| 7fca980887 | |||
| 52eaf10d93 | |||
| fda97f25a0 | |||
| 9048bab305 | |||
| 6e3289f392 | |||
| 568e99d4d3 | |||
| 90b9861043 | |||
| efffc7e6bc | |||
| 237e7989b4 | |||
| f131f134a5 | |||
| ccfaabd1d7 | |||
| bf6507e9be | |||
| 07006fd093 | |||
| 4f4ab4c81a | |||
| 4930d8785b | |||
| 79d34afb96 | |||
| ba08d25517 | |||
| 0541482ee4 | |||
| 95cc6fb3bc | |||
| ee58ba9fd9 | |||
| a6bca0ecc5 | |||
| 64044173c6 | |||
| aafa3351da | |||
| 76c8eedb25 | |||
| a4c5c4d5f9 | |||
| 44dd770cec | |||
| aaf60a1869 | |||
| 5007d62e27 | |||
| f7c0c6fd34 | |||
| f471857a25 | |||
| 49c9e0f3e2 | |||
| bf456d5d16 | |||
| 469faf43aa | |||
| c5a244c669 | |||
| 8112440a27 | |||
| ada0b31295 | |||
| 49e2d0528c | |||
| 9b951d5d3f | |||
| 70f6871363 | |||
| 52a1860f0a | |||
| a28ad25221 | |||
| c9dec7b118 | |||
| 4fedf5749e | |||
| 0d42fcf536 | |||
| 779117d129 | |||
| 2382f3b69e | |||
| e050b7fd1e | |||
| e85abdeb2c | |||
| bd6837f2f9 | |||
| 93481fe27d | |||
| 33d82e0d6e | |||
| ed10ea7544 | |||
| 10e10de98d | |||
| 314307b840 | |||
| c37905e465 | |||
| c4e3ec825e | |||
| f051011fd1 | |||
| d6f71ee2b3 | |||
| 4d84507c96 | |||
| 3c8815cc06 | |||
| 982ea35d44 | |||
| 7bb966ba82 | |||
| 03d2798dba | |||
| e0046671f1 | |||
| afcbeb3713 | |||
| 1b1ce85b32 | |||
| 125b71d2c5 | |||
| a4740d5f09 | |||
| f8e8e2f624 | |||
| 30a1516d19 | |||
| 4f5f600ef6 | |||
| 7855ebcd9f | |||
| 219e048922 | |||
| 5ed77a3ca9 | |||
| 2534216971 | |||
| 5e00dfb5c3 | |||
| 4ac8061240 | |||
| 8da681eab2 | |||
| 40add8f9a2 | |||
| 283f290f47 | |||
| 4f36ecc681 | |||
| b9a055f1c8 | |||
| 26fc29c1a9 | |||
| af219bb415 | |||
| 53b650e88f | |||
| 44d762fc60 | |||
| a61c4f6bb0 | |||
| 1827b91882 | |||
| 7c137cc482 | |||
| c7b26f1372 | |||
| ba91345984 | |||
| 585ac5a748 | |||
| 77f818fa23 | |||
| 1a37723a05 | |||
| 59628960b6 | |||
| 650c5155df | |||
| 4faa4d6ed9 | |||
| 664d2502ca | |||
| 8bb5da3b06 | |||
| a382b81d56 | |||
| aac846ff74 | |||
| c4075f1592 | |||
| e8efb8f9fb | |||
| 1bb140780b | |||
| 96e229abfa | |||
| b05bd51216 | |||
| 82c6d8d68b | |||
| 111da4d0fd | |||
| ab65b38d9a | |||
| f7d21596a5 | |||
| 54ede6c4e3 | |||
| c4522922f2 | |||
| a09984d210 | |||
| 96bcfdac7e | |||
| 05d80e4994 | |||
| 5597f95aba | |||
| 3662c4e9bf | |||
| cb3622176a | |||
| c216c0f2e8 | |||
| 2d77415cc3 | |||
| a9768739eb | |||
| 924f117ba0 | |||
| fe0e34cbe1 | |||
| dab71d01c1 | |||
| c6c87b66f9 | |||
| 16d909834f | |||
| c231bec736 | |||
| fea95d264f | |||
| 934856c350 | |||
| c00f4b6022 | |||
| d7d4cd4434 | |||
| ceeff8ae81 | |||
| da2c5bbda0 | |||
| 1bff3ad6ff | |||
| c01b5fb0db | |||
| 1efa137f8f | |||
| 1705c5afb6 | |||
| d300a50630 | |||
| ecd87aa2b5 | |||
| 1affafe5ea | |||
| 14fae9a401 | |||
| 0d3b8c0808 | |||
| 834f5dc9a9 | |||
| 802a1fee7c | |||
| 08c7ae64e3 | |||
| 41d0163781 | |||
| d3cb97d4e9 | |||
| 97561ff52b | |||
| a0cc3a0fb0 | |||
| 46e61efefb | |||
| 57d4d72f60 | |||
| f09a358ea5 | |||
| d455c21db5 | |||
| eb61c2a960 | |||
| 141d8e20ec | |||
| d5d4f88c17 | |||
| f545ba08cb | |||
| 940d71ecdb | |||
| bb64684be9 | |||
| 323a48d14b | |||
| 69ec7a041e | |||
| 13d68cbeeb | |||
| c1594255a7 | |||
| 872cbec8ba | |||
| 4f1b7bf69a | |||
| 3de9202533 | |||
| da77ed1de3 | |||
| b953e06622 | |||
| 42e5000c2d | |||
| f060f9e047 | |||
| f1257f9e3f | |||
| 40f0f80f5d | |||
| 948d4ef3a2 | |||
| 5fda90abc6 | |||
| 6b66f77590 | |||
| ddd485fdad | |||
| 9c1ec3569f | |||
| 95f67080f8 | |||
| 29d0b1443e | |||
| fe31f1be61 | |||
| c096bfce7a | |||
| 5109065425 | |||
| 5d88ca2287 | |||
| 2b8998af91 | |||
| 6780a2f0bf | |||
| 8a1227eaa2 | |||
| 6072fd2fbb | |||
| 33584b6668 | |||
| 03914d60d3 | |||
| 490d1059ac | |||
| b09560cc1c | |||
| 8a068e7fca | |||
| 59f08f9bdd | |||
| f49d3d6a28 | |||
| 360070bddb | |||
| a186efded2 | |||
| 82d60ee48d | |||
| 493bf93a5a | |||
| 0ec78e0d5e | |||
| 9e4c2c1030 | |||
| 6520b8f06d | |||
| a2af749e71 | |||
| e2ebb09d6c | |||
| 94393ff4ea | |||
| 3445f8a49f | |||
| b95667563f | |||
| e569de73d6 | |||
| 38e0c62e99 | |||
| 60514cc48d | |||
| e3a56e39d7 | |||
| 3475912233 | |||
| 570efab05f | |||
| 967935d389 | |||
| ec53f2557a | |||
| afc5294016 | |||
| 233b179f65 | |||
| 840e9d8ed8 | |||
| e0f89beb7d | |||
| 6bb812f283 | |||
| f67d30571b | |||
| 9209edc15c | |||
| 85785b471e | |||
| 4c02c20d84 | |||
| 9ce9c3ce21 | |||
| 0ba5bb4e7a | |||
| c312bc1b70 | |||
| 4f961c9e0b | |||
| e280d54f3f | |||
| 3aeb0b0f95 | |||
| 9bdb12e3da | |||
| 2834697f1f | |||
| 346614b0da | |||
| c2f3f04808 | |||
| 9e791da7bd | |||
| 0d0df4b491 | |||
| 7948f376fb | |||
| 612e515317 | |||
| 06c4c45200 | |||
| 4f63f57d26 | |||
| 5e36362a4c | |||
| b4a7684344 | |||
| 9e7f8564b6 | |||
| 1a6fa4aedc | |||
| be11bd85f6 | |||
| c8e52a78f9 | |||
| 07505aa9e2 | |||
| 7992115f6c | |||
| fed2998d48 | |||
| c0f55ae1e7 | |||
| c8dea6b931 | |||
| 28b10157ad | |||
| 439dd9d8a3 | |||
| cf0e116a56 | |||
| 0e3e4c7553 | |||
| 921de12d93 | |||
| dbcee43567 | |||
| b58320d7dc | |||
| 0978a1348e | |||
| 86d35d58df | |||
| 2f8e31cddd | |||
| 68bc41b436 | |||
| ac65af7b62 | |||
| ccc35176f6 | |||
| f7114cc620 | |||
| d745a7bb4e | |||
| 1f465bc7d8 | |||
| 389e3bbd91 | |||
| a3a6a8a9e0 | |||
| 36d5cf1a7f | |||
| a33e4c7346 | |||
| 0d9de89a26 | |||
| ddfdaa270e | |||
| e7a4eac676 | |||
| ca7c4e119e | |||
| 86ca4819ee | |||
| 8278c8f5c4 | |||
| 20af7c4981 | |||
| f5e1d9eab1 | |||
| 68b0f800ff | |||
| 42434adfaf | |||
| 315f1e62ad | |||
| f3c3bebd6e | |||
| 5b252a8bad | |||
| 5833d22fe0 | |||
| 38bd40891d | |||
| 4aefd5cbc4 | |||
| ca64054505 | |||
| 4c5b5f709f | |||
| 8d5599d3dc | |||
| 93cb2a0af9 | |||
| 6045c9a890 | |||
| ff89e06fd6 | |||
| 9290453d2e | |||
| 592e13b6a0 | |||
| a5c18b2a09 | |||
| d54237b0a3 | |||
| 134e891068 | |||
| cf86056ba9 | |||
| 5deedb1524 | |||
| 4d28d2e75d | |||
| 0e933439dc | |||
| 387eac4d08 | |||
| 0d4e950769 | |||
| 604eecf5d4 | |||
| 199845a9d1 | |||
| 29cd11ad06 | |||
| 5b0ebacc40 | |||
| 4de24cb436 | |||
| 0aa8a9f372 | |||
| 4c9444b958 | |||
| 11ca131607 | |||
| ebe20a0825 | |||
| 22a90a0907 | |||
| e7f0efa56d | |||
| 64cfab5b46 | |||
| 4db97eae7c | |||
| f908a3ca78 | |||
| 3220e9bbc4 | |||
| baaa2ae45a | |||
| 92d556524b | |||
| 90896560bb | |||
| 82e47a5c53 | |||
| 8ff354a4ea | |||
| 7b28d9d7ba | |||
| d6baac6fbe | |||
| fce0a1efa1 | |||
| fb03214f0a | |||
| bdb08c58d3 | |||
| 1fb8060263 | |||
| 75fe77115d | |||
| 763fb2719f | |||
| bcf63a0fae | |||
| 80eb12a9d6 | |||
| f2d6bf73ca | |||
| 563aa2d2ca | |||
| 2fdefc4fb5 | |||
| b550ccfc73 | |||
| dea8bed140 | |||
| 32554b7023 | |||
| c8d93d0da4 | |||
| e4c0b0310c | |||
| 2f7fbf01cf | |||
| 42d5da633a | |||
| 5f6a2e498a | |||
| 8feabb00d6 | |||
| 708662da39 | |||
| b877879db6 | |||
| 0c5526f2fd | |||
| db1ca2f89f | |||
| fad6c7cecb | |||
| 870fa5a153 | |||
| 0bcadaf155 | |||
| 95ca5315e7 | |||
| 9d3d7b09b3 | |||
| 7169972434 | |||
| 4981c576d2 | |||
| 6a24d2bbac | |||
| 07841fc9e3 | |||
| 85be97e6a2 | |||
| a766f5951d | |||
| 60a7fe17b5 | |||
| f906d031fa | |||
| 1ba5cafc5f | |||
| d085301af3 | |||
| d47dbf4f32 | |||
| b0699f38e7 | |||
| eea3aa9729 | |||
| a2157a5365 | |||
| 0d375809b1 | |||
| a24cb250d8 | |||
| 6facd8d9c6 | |||
| 555d053e32 | |||
| 15b0b6830e | |||
| 2b7c12a3f0 | |||
| ee2e0b3bbf | |||
| b0b6034e63 | |||
| 8c4fd75c82 | |||
| 090f7f8cfb | |||
| 0d7e45639a | |||
| 525084e7cc | |||
| e1bbedd4bf | |||
| 9e793c2122 | |||
| 678a964ff4 | |||
| 225c58c17b | |||
| 7875738391 | |||
| 62df7eb499 | |||
| ee9d25c675 | |||
| 79eaffaaa7 | |||
| ef108ae4d6 | |||
| 9900b36f07 | |||
| bad20ab9df | |||
| 5d091411a3 | |||
| d136adc73f | |||
| 29d2ea7513 | |||
| a57841d006 | |||
| dab0751300 | |||
| 34729e2687 | |||
| f073f1ca4b | |||
| aa8e854be2 | |||
| c41317dd82 | |||
| 8ef9414406 | |||
| 552b71a378 | |||
| 5dc9be649d | |||
| b87aa55351 | |||
| 57a9b557e9 | |||
| 0d7397a636 | |||
| a059297bf4 | |||
| a14c61802e | |||
| 180f8aac5d | |||
| cdaca2d308 | |||
| 25c3aa8e19 | |||
| d65968b41d | |||
| e56bb1b675 | |||
| a7057f5205 | |||
| c8d8428275 | |||
| 0763e429b8 | |||
| 770ebaf271 | |||
| 8183ee4d56 | |||
| 930d507d43 | |||
| 10ca726752 | |||
| e89ecd192b | |||
| ce1b6039ac | |||
| 4066950975 | |||
| 33f7afd6e6 | |||
| 3cb18ac5a9 | |||
| 1975b7e139 | |||
| 4e9dc8ab9c | |||
| f019bd995a | |||
| f9b68bc012 | |||
| 9e40247af0 | |||
| f45223563c | |||
| d36da21d6f | |||
| 3c5e3fa853 | |||
| c5a7946a24 | |||
| 26e80a18b4 | |||
| e65d1a3dd9 | |||
| 5a5edf17fd | |||
| 8798b05e1f | |||
| b6cda331c0 | |||
| f9e6230ead | |||
| e614a7313c | |||
| d0b249fbca | |||
| f76e1630b4 | |||
| d7dc938653 | |||
| 039dd480da | |||
| 842a6fe1d4 | |||
| 4a9310755f | |||
| bbbe2f8916 | |||
| 3243c4c0c8 | |||
| 3bcf5d1557 | |||
| 82edd111e9 | |||
| c6c6dbe546 | |||
| dcb9d53e6d | |||
| d0c9d7c0ae | |||
| e25796f0d0 | |||
| 4d4b6c0895 | |||
| 24eb97f287 | |||
| fb9dbfab3a | |||
| 1e02598903 | |||
| 7093852fa0 | |||
| 01b5681dc8 | |||
| 9d0dd4c7cf | |||
| 262607c83d | |||
| 2a83af6dbf | |||
| 91958ce1cb | |||
| 1aff35f669 | |||
| bb40c0a71a | |||
| fc9a90e220 | |||
| 2c2ee023b5 | |||
| 81cdaa883a | |||
| dad82aa1eb | |||
| b6d8f1e028 | |||
| 990fca3e7b | |||
| b3e0441940 | |||
| e2e8980194 | |||
| c294f5318f | |||
| d1219b0dc8 | |||
| d2ca1cc25a | |||
| 4857e86cdc | |||
| 748aa6fce8 | |||
| 373ae6b107 | |||
| 69352206b6 | |||
| 2ab8aa173d | |||
| 02729695ff | |||
| bcb9ad94c1 | |||
| bc095322c3 | |||
| febe8624bf | |||
| 8ac226ae69 | |||
| 7c79631609 | |||
| fa4473de49 | |||
| a09ad031ec | |||
| b1894ac6cb | |||
| 8a000940da | |||
| 24becb9325 | |||
| c4b64c8d9f | |||
| e47e37a8d2 | |||
| 01dbb8eb9a | |||
| 8011cc8ec4 | |||
| 66ec7c0d63 | |||
| 61d0e4ee54 | |||
| 8007693084 | |||
| 9afbbfad0a | |||
| 2106fb83b2 | |||
| b571f14fe4 | |||
| eab81deb27 | |||
| a62552b086 | |||
| 2d955dc297 | |||
| 196c2ffe5b | |||
| 9e2561d121 | |||
| fce074d812 | |||
| e6aa1a9553 | |||
| b9de74f5c6 | |||
| 479ef45aec | |||
| ae5d06d4be | |||
| 3e328cdea5 | |||
| 12b627fa9c | |||
| d6bcf14cc0 | |||
| 72bb0c842f | |||
| 7804c56584 | |||
| 33f7f37ca7 | |||
| 84c9323750 | |||
| 4c6aa34810 | |||
| e24027eccb | |||
| 98024cbb01 | |||
| b317b2feda | |||
| a7fbd5c9b6 | |||
| 6141c33630 | |||
| 689c41ccb3 | |||
| 503c24453a | |||
| 64b80f5a2e | |||
| 1be14f818a | |||
| 5bf70afb21 | |||
| b36a5a95f0 | |||
| 70cc2494aa | |||
| 98b4a35fb5 | |||
| e03b68f12f | |||
| 950fcfe4ef | |||
| 2c7269e3de | |||
| d533572ee9 | |||
| 544bacf54e | |||
| 64145d7d62 | |||
| 1fd42c34c2 | |||
| c541176a32 | |||
| 7d3414c44c | |||
| a5f35cc437 | |||
| 7f5412f427 | |||
| 007f0f2437 | |||
| 8e44bcdbda | |||
| 9b0bcf0b54 | |||
| 457455b71d | |||
| f399ce68a2 | |||
| 2185465d34 | |||
| a7bc2034d0 | |||
| 994ce50392 | |||
| 79c01316d6 | |||
| c57d3af8dd | |||
| ebc6b9e66e | |||
| 3e9cbb4a24 | |||
| 7f7a23027b | |||
| 8a54f542d0 | |||
| 31e1464e1a | |||
| 621edfb926 | |||
| a5d9c9033f | |||
| b8d3ce7ae8 | |||
| 21d19ccd59 | |||
| 9b1c0c97d3 | |||
| 0ef0cfb38a | |||
| 90b83f6b3e | |||
| 6841230141 | |||
| 8302e6c001 | |||
| 4db1f49aaf | |||
| c00850c4c5 | |||
| 874da27599 | |||
| ea34cb52c1 | |||
| 7bab42455b | |||
| d1ffea0847 | |||
| be80a7c39c | |||
| d0ea397492 | |||
| 3701b2b551 | |||
| 169fcd098b | |||
| 5ea58d9451 | |||
| 39d1e21802 | |||
| cad7a05848 | |||
| ad7ac17647 | |||
| f86ac251a8 | |||
| 834700eb24 | |||
| f0e73a652f | |||
| f0129382b9 | |||
| 6e4203998a | |||
| cd4f0b2c68 | |||
| 87e016bdf0 | |||
| 5a1ce28105 | |||
| acf955635f | |||
| 8c2aee5e64 | |||
| a520934abd | |||
| 27bb41d652 | |||
| 38bfbe2c40 | |||
| 2ddee26d83 | |||
| 37f7a31a22 | |||
| 2601933bdc | |||
| fb38897b8f | |||
| 39dc6f0838 | |||
| 4b14c72ed8 | |||
| cf4501fe41 | |||
| 9786c036d5 | |||
| c4d9223034 | |||
| 6968137bbc | |||
| 475c3ff967 | |||
| 4cbe3a2a46 | |||
| 1a1bed2258 | |||
| 39a717b239 | |||
| a00f47b5e4 | |||
| 4aa6ddf3dd | |||
| c9a421f12f | |||
| 0a35c4f2c4 | |||
| c4a9c874d1 | |||
| 65eb873597 | |||
| 60d922da11 | |||
| 024aa0660c | |||
| 6c4a980d36 | |||
| 48abfdfbb1 | |||
| b0f6b03c38 | |||
| 50d49141b0 | |||
| 2c447f686d | |||
| 2de22f0321 | |||
| 8cc6a287a7 | |||
| 0e437312ad | |||
| 80cfb2eb58 | |||
| fb1b57720c | |||
| 62f9d454eb | |||
| c08c5eef10 | |||
| 5c563d04c7 | |||
| 9194b73a81 | |||
| a31160fe99 | |||
| b31a990cf1 | |||
| 5f3f7e197a | |||
| b7b33145f6 | |||
| 7f7d5a57c8 | |||
| d5e94d4cd9 | |||
| 7984df37c3 | |||
| d90d2f2df7 | |||
| 1aa6e5df95 | |||
| a33575b115 | |||
| b46cb71324 | |||
| bde5c9cfed | |||
| 8461bee32e | |||
| 2f65e84562 | |||
| 75f535c947 | |||
| fdf935afe9 | |||
| df894c05b2 | |||
| 1c302433af | |||
| 3a00ec7682 | |||
| 3127543b6e | |||
| 0edd70d3d8 | |||
| 4af648905c | |||
| 3871134a49 | |||
| e32a6a2eea | |||
| 898fbf02b8 | |||
| fac86aae58 | |||
| 05c6a96d27 | |||
| e86a849600 | |||
| d6596ca453 | |||
| 39d3814be7 | |||
| 384536ba4f | |||
| 8204deaae6 | |||
| bc77f27bb2 | |||
| d32025ae3c | |||
| b32a8e2e28 | |||
| 8a4c67deab | |||
| 11571cf2a4 | |||
| 354cf24302 | |||
| bd45704c83 | |||
| 05db17b2b0 | |||
| caa797cee3 | |||
| 85626024a0 | |||
| 4770e5af08 | |||
| a1adc6cdaa | |||
| c064c701e2 | |||
| 6fcead2a0e | |||
| 851acfdbf3 | |||
| bea8be29d5 | |||
| 7a1d44b552 | |||
| b4712c0dca | |||
| c978fe377d | |||
| 9e62b330b1 | |||
| 1e53c7f244 | |||
| e0d3f1cae6 | |||
| 6c28753dae | |||
| 7f7ad1b661 | |||
| cd10dca71f | |||
| d418cceae4 | |||
| 4828723d5c | |||
| 17fa60c31c | |||
| fd564159b5 | |||
| 377db4515a | |||
| 6a15351363 | |||
| dbc39bce40 | |||
| 38fbd190b0 | |||
| f3a3a630c3 | |||
| 1ab5bc40a0 | |||
| dbdae77780 | |||
| d0300e5f43 | |||
| 5fbc190c80 | |||
| 8b952bf98c | |||
| f85420b343 | |||
| 8bd0ee875c | |||
| 8048c70bc8 | |||
| 0bd5dc5363 | |||
| 681c3c53f0 | |||
| 2827db0e2a | |||
| d9d80d8fb4 | |||
| 7379b0e2ed | |||
| 1908286e7c | |||
| a14276abf1 | |||
| 92fb77d50e | |||
| aef3b24c8d | |||
| 1be8563fdb | |||
| bebf027e0b | |||
| 9a30ce5f18 | |||
| 696e00a570 | |||
| 8df7f49b55 | |||
| 81b19057bb | |||
| 7c6c20ef18 | |||
| 05184d2e71 | |||
| b56df0c7f6 | |||
| 07135570f4 | |||
| e7a721a1fb | |||
| 17b877e448 | |||
| 5f9e60c45f | |||
| 81147506f0 | |||
| 08b4748aae | |||
| 9351e50f63 | |||
| d6fe398f79 | |||
| 8fedbd204e | |||
| ab4c4c2fd2 | |||
| 45452c57c4 | |||
| b1df7444a4 | |||
| 83a7c83761 | |||
| b85a86b225 | |||
| 51613df455 | |||
| d849e083b6 | |||
| 22558df68e | |||
| 7f7b12a6dd | |||
| 07c9fbee7f | |||
| ab25edfacc | |||
| 931929a82c | |||
| bd8ff4ca11 | |||
| 4375b9dd2a | |||
| 321d323beb | |||
| 5d59dae730 | |||
| a7368cc893 | |||
| 01f3763eb4 | |||
| 3fdb50b0ea | |||
| 848c5dadf0 | |||
| 5590efe054 | |||
| 700698247a | |||
| bdc8eba3bb | |||
| f3ad989e34 | |||
| deaedcb6fa | |||
| f2a3db0bd8 | |||
| e066bcf261 | |||
| b5d588a40b | |||
| f179bd4cd7 | |||
| e03d274071 | |||
| 8bf8c7e6e9 | |||
| f7967f97ec | |||
| e94ea409fe | |||
| 82e0bbebdb | |||
| 209155d71d | |||
| 6fbd4d3daf | |||
| 11ba83738f | |||
| eb93e87b7f | |||
| 2b63888782 | |||
| 6846d15dc8 | |||
| 5a240c32a9 | |||
| a6faf04db4 | |||
| 373d189edb | |||
| 5953781c13 | |||
| 77ec2c954f | |||
| 256ee2ff8a | |||
| 39e72fc3cc | |||
| d3f4b086c6 | |||
| de95ac3adb | |||
| 3a9b5afe30 | |||
| b8400cbe63 | |||
| 460d948e87 | |||
| e9b3c4b5f6 | |||
| 1400625648 | |||
| 8adf19c904 | |||
| b05e466e8f | |||
| 48115b153e | |||
| 427a63f324 | |||
| 7423997b42 | |||
| bc38af04a5 | |||
| b9c3dc352d | |||
| c2ec1cb709 | |||
| fdcdd7769f | |||
| bf26e069b8 | |||
| 3f52a6aa50 | |||
| b9abb1e075 | |||
| 59dcbd3ba3 | |||
| 4d98826259 | |||
| 6dcfaf8617 | |||
| 30df3727c2 | |||
| 145450964a | |||
| 8f7ceee36a | |||
| 27a4e6a2b6 | |||
| d85c26aa8b | |||
| 4ebd974f5e | |||
| 3308fefa7f | |||
| 66a9acfb04 | |||
| ed40732e7b | |||
| 6c606be09f | |||
| ce88a4fc9a | |||
| 74426fd4e9 | |||
| e0737204fd | |||
| c515cb8fb6 | |||
| cfe154d916 | |||
| d2bd0b0ccf | |||
| aeca523a34 | |||
| ad4ad4e55d | |||
| 311486ed79 | |||
| a0c8e116df | |||
| 8ba8d35541 | |||
| 7fce5589f8 | |||
| beb19633e9 | |||
| 8467d8c8c7 | |||
| 39bb6d3b2b | |||
| da8cd146eb | |||
| 79c2654a8c | |||
| bff084c233 | |||
| 15dd0bb0f2 | |||
| b602260314 | |||
| 16c284214f | |||
| 9526ff37b9 | |||
| 31c0687fc0 | |||
| 9919154d66 | |||
| 985b27daab | |||
| 6553909dc5 | |||
| 67601bd639 | |||
| d93ce95a36 | |||
| 678e455b4f | |||
| 4b8d6b6919 | |||
| 432c6cf206 | |||
| 6efe751d4c | |||
| 67a144df2a | |||
| d07b5f0dc8 | |||
| 7e591deaf3 | |||
| 3209b2f5f3 | |||
| 057efb48fa | |||
| 543ed01642 | |||
| 211a477864 | |||
| 4de64e5afe | |||
| 88208f5e01 | |||
| 09387879a0 | |||
| e8d00e6bbd | |||
| 824fd46062 | |||
| 8e9dcd279a | |||
| fc3f5348b8 | |||
| 51512f25c5 | |||
| eac9526549 | |||
| 4ee90e1f90 | |||
| 8a3835bcef | |||
| d16dbedaa1 | |||
| 93faac5780 | |||
| 64bfae6648 | |||
| 4b356998f2 | |||
| ec942f2657 | |||
| f260d1c602 | |||
| cf740f5129 | |||
| 14c7c63e34 | |||
| 7920f6d473 | |||
| 9b9e621593 | |||
| 8514a14cf4 | |||
| 6504ddede4 | |||
| 66a481d4bc | |||
| 5f9bc13898 | |||
| 6fb1a67a83 | |||
| dc2fd8c39e | |||
| d65647acf3 | |||
| ab41540064 | |||
| 159b6ecea3 | |||
| 4e4dd43646 | |||
| 48726e8fed | |||
| 9e06aeff33 | |||
| 509d46a544 | |||
| e41f21abc7 | |||
| e0a70bb0fa | |||
| 970b834f2e | |||
| 4e8cd72e59 | |||
| 2506810a2e | |||
| 1be7454bc4 | |||
| 76695a97b9 | |||
| 1d61e7b4a4 | |||
| 775bf8b340 | |||
| f4952bee18 | |||
| 7971db665e | |||
| cbeadcf872 | |||
| 40f2e679ec | |||
| db8f01717c | |||
| 5f8d36600c | |||
| 2d011e94cd | |||
| 5f06f46f32 | |||
| aa9b0d0a31 | |||
| 64b18b4dc2 | |||
| 1a43fe5ceb | |||
| 906f448221 | |||
| 552fd355bc | |||
| d1a27748a3 | |||
| 3858f5097e | |||
| 7277940b84 | |||
| 9a1e22fb85 | |||
| 24d01a28c8 | |||
| 429041097b | |||
| e807ae1a58 | |||
| f477b62813 | |||
| 69be408b32 | |||
| ca13d4f2ef | |||
| 286254a10a | |||
| 1ab5ef9dd7 | |||
| 35257f5e94 | |||
| 3a82ed5dc9 | |||
| ab2bc35b18 | |||
| eb2ab73e16 | |||
| 456374d487 | |||
| b500fcbaed | |||
| fdb3fdb927 | |||
| ba8108d595 | |||
| 37b5b49f58 | |||
| c9abf559be | |||
| e28ba30561 | |||
| c3d2cd344f | |||
| 01a274a1db | |||
| eed6a7ffe3 | |||
| ee137323aa | |||
| 2c1cb51843 | |||
| bc3772614b | |||
| c9fc99c388 | |||
| e2de06da63 | |||
| 849af30bfd | |||
| bba9ea830f | |||
| e8d2245a0b | |||
| bf03874be2 | |||
| 23539f13b5 | |||
| 78ca7e1d44 | |||
| 34ac4688e6 | |||
| eaef09df91 | |||
| 2135fb9685 | |||
| 34f5997f82 | |||
| 76a93443c3 | |||
| 430ded8259 | |||
| 9bf8f2eec5 | |||
| bba1b6a6e0 | |||
| a9a246a866 | |||
| ff4fcdd5fd | |||
| 241ae83645 | |||
| 73c2628ef4 | |||
| 38fabf7cd2 | |||
| 1cfcc742d8 | |||
| ae39d3802f | |||
| b217742c7b | |||
| f0946c4bc8 | |||
| 384e20acf0 | |||
| c48168ffc7 | |||
| 65c920bc8d | |||
| 5ce57e963f | |||
| a32fe40275 | |||
| 28a5d1bcab | |||
| 1bc99a3762 | |||
| 794cd4cf89 | |||
| 6bcaf469e8 | |||
| d83a9b12d6 | |||
| 4fbfc14763 | |||
| 9ce30fdd74 | |||
| dae31c44e0 | |||
| 97d65e5563 | |||
| 03d2525ccc | |||
| a852baee5b | |||
| 12c2e13dfa | |||
| 206cc6ac91 | |||
| 9a8cf34f44 | |||
| f43a324937 | |||
| c7ca4b996a | |||
| 0ff38bc8ce | |||
| 2926d3805c | |||
| d8bd34b57e | |||
| f91bd80bc2 | |||
| da9c778a4c | |||
| 268a654fec | |||
| 8463694d4f | |||
| cbe4ab253c | |||
| 5e1a958ee6 | |||
| 62c1980cac | |||
| aab69513aa | |||
| ead70f5c00 | |||
| 9d5b13839b | |||
| 19fea00432 | |||
| 5373747210 | |||
| baea02901b | |||
| 382ae8a78f | |||
| 2a5f353e1e | |||
| 45e58d882e | |||
| b1caa5f9c4 | |||
| 6d56f1ae86 | |||
| 584d4eb9d4 | |||
| 3dd9683b47 | |||
| 842559804f | |||
| 521244b0e0 | |||
| a55f76879e | |||
| 63482dcfdc | |||
| 1192d20295 | |||
| 6ea2c7d6a8 | |||
| 3b15f35432 | |||
| 620b8d0369 | |||
| 3076571b6f | |||
| 3c762750a0 | |||
| 60261408c2 | |||
| 099333c992 | |||
| f18fff08c7 | |||
| b263c3ebaf | |||
| 6b22e7d90a | |||
| 0b35be32a4 | |||
| 6622dc42b5 | |||
| 198d0a2fc0 | |||
| f1b420eb3b | |||
| c1565e55e5 | |||
| 5874a5683e | |||
| 64cd9746b8 | |||
| 8259006bc3 | |||
| dd48f827c3 | |||
| f8193fd784 | |||
| 23ece01a0b | |||
| efd336b743 | |||
| 2eb2a2a197 | |||
| 9bb2d082e6 | |||
| afb9273823 | |||
| 784fc571b3 | |||
| 1a85ccbbf4 | |||
| eebe859f83 | |||
| e655999a23 | |||
| 7d97bbfbbf | |||
| 03dcfeabc3 | |||
| db7e68d308 | |||
| 9c6ae554fa | |||
| bf293ebbfc | |||
| a11de0f607 | |||
| 20665b9f89 | |||
| d7e4f7ec3b | |||
| b85d39bfc3 | |||
| 1024a7c7c4 | |||
| 1b7302c0ba | |||
| 4835ae35af | |||
| aea7f4aa77 | |||
| 0275b430cf | |||
| 3123432dcc | |||
| 43e0c84f64 | |||
| eefd175900 | |||
| 9b921f3c2d | |||
| f25fa26b42 | |||
| f4b98074b0 | |||
| f42e6d7374 | |||
| 96c692aefc | |||
| d249bfef4d | |||
| cd3ad0b149 | |||
| fafb88672a | |||
| 6fd824fcca |
+48
-11
@@ -9,21 +9,58 @@
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
/libs
|
||||
# *.a # Commented out since OpenAL Soft's binaries use this extension.
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.user
|
||||
/bin/rpcs3.exe
|
||||
/bin/RPCS3.log
|
||||
*.suo
|
||||
*.tlog
|
||||
*.idb
|
||||
*.pdb
|
||||
*.obj
|
||||
*.ilk
|
||||
*.pch
|
||||
|
||||
*.log
|
||||
*.exe
|
||||
*.dll
|
||||
*.elf
|
||||
*.lastbuildstate
|
||||
*.unsuccessfulbuild
|
||||
*.res
|
||||
*.dump
|
||||
*.wav
|
||||
|
||||
/libs
|
||||
/ipch
|
||||
/rpcs3/Debug
|
||||
/rpcs3/Release
|
||||
|
||||
/wxWidgets/lib
|
||||
/bin/rpcs3.ini
|
||||
/bin/compiled.elf
|
||||
/bin/FragmentProgram.txt
|
||||
/bin/VertexDataArray.dump
|
||||
/bin/VertexProgram.txt
|
||||
/bin/BreakPoints.dat
|
||||
/bin/textures
|
||||
*.suo
|
||||
/rpcs3/Debug
|
||||
/rpcs3/Release
|
||||
/ipch
|
||||
/bin/*.lib
|
||||
/bin/*.exp
|
||||
rpcs3/git-version.h
|
||||
|
||||
# Visual Studio Profiler Files
|
||||
*.vspx
|
||||
*.psess
|
||||
|
||||
# Copyrighted files
|
||||
/bin/data/
|
||||
/bin/dev_flash/data/font
|
||||
/bin/dev_flash/sys
|
||||
/bin/dev_flash/vsh
|
||||
|
||||
# Ignore installed games except test homebrews
|
||||
!/bin/dev_hdd0/game/
|
||||
/bin/dev_hdd0/game/*
|
||||
!/bin/dev_hdd0/game/TEST12345/
|
||||
|
||||
# Ignore other system generated files
|
||||
bin/dev_hdd0/log.txt
|
||||
x64/Debug/emucore.lib
|
||||
x64/Release/emucore.lib
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[submodule "wxWidgets"]
|
||||
path = wxWidgets
|
||||
url = https://github.com/DHrpcs3/wxWidgets.git
|
||||
ignore = dirty
|
||||
[submodule "rpcs3-ffmpeg"]
|
||||
path = ffmpeg
|
||||
url = https://github.com/hrydgard/ppsspp-ffmpeg
|
||||
[submodule "asmjit"]
|
||||
path = asmjit
|
||||
url = https://github.com/kobalicekp/asmjit
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
before_install:
|
||||
- echo "yes" | sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
|
||||
- echo "yes" | sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0/ubuntu/ precise universe'
|
||||
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install libwxgtk3.0-dev libopenal-dev freeglut3-dev libglew-dev
|
||||
- sudo apt-get install aria2 -qq
|
||||
- download_extract() { aria2c -x 16 $1 -o $2 && tar -xf $2; }
|
||||
# Travis uses CMake 2.8.7. We require 2.8.8. Grab latest
|
||||
- sudo apt-get install -qq g++-4.8
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
- sudo apt-get install lib32stdc++6 -qq &&
|
||||
aria2c -x 16 http://www.cmake.org/files/v2.8/cmake-2.8.12.1-Linux-i386.sh &&
|
||||
chmod a+x cmake-2.8.12.1-Linux-i386.sh &&
|
||||
sudo ./cmake-2.8.12.1-Linux-i386.sh --skip-license --prefix=/usr;
|
||||
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ..
|
||||
|
||||
script:
|
||||
- make
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(ASMJIT_STATIC TRUE)
|
||||
|
||||
add_subdirectory( asmjit )
|
||||
add_subdirectory( rpcs3 )
|
||||
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
Binary file not shown.
@@ -0,0 +1,656 @@
|
||||
#ifndef AL_AL_H
|
||||
#define AL_AL_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef AL_API
|
||||
#if defined(AL_LIBTYPE_STATIC)
|
||||
#define AL_API
|
||||
#elif defined(_WIN32)
|
||||
#define AL_API __declspec(dllimport)
|
||||
#else
|
||||
#define AL_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define AL_APIENTRY __cdecl
|
||||
#else
|
||||
#define AL_APIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/** Deprecated macro. */
|
||||
#define OPENAL
|
||||
#define ALAPI AL_API
|
||||
#define ALAPIENTRY AL_APIENTRY
|
||||
#define AL_INVALID (-1)
|
||||
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
|
||||
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
|
||||
|
||||
/** Supported AL version. */
|
||||
#define AL_VERSION_1_0
|
||||
#define AL_VERSION_1_1
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef signed char ALbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/** "no distance model" or "no buffer" */
|
||||
#define AL_NONE 0
|
||||
|
||||
/** Boolean False. */
|
||||
#define AL_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define AL_TRUE 1
|
||||
|
||||
|
||||
/**
|
||||
* Relative source.
|
||||
* Type: ALboolean
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: AL_FALSE
|
||||
*
|
||||
* Specifies if the Source has relative coordinates.
|
||||
*/
|
||||
#define AL_SOURCE_RELATIVE 0x202
|
||||
|
||||
|
||||
/**
|
||||
* Inner cone angle, in degrees.
|
||||
* Type: ALint, ALfloat
|
||||
* Range: [0 - 360]
|
||||
* Default: 360
|
||||
*
|
||||
* The angle covered by the inner cone, where the source will not attenuate.
|
||||
*/
|
||||
#define AL_CONE_INNER_ANGLE 0x1001
|
||||
|
||||
/**
|
||||
* Outer cone angle, in degrees.
|
||||
* Range: [0 - 360]
|
||||
* Default: 360
|
||||
*
|
||||
* The angle covered by the outer cone, where the source will be fully
|
||||
* attenuated.
|
||||
*/
|
||||
#define AL_CONE_OUTER_ANGLE 0x1002
|
||||
|
||||
/**
|
||||
* Source pitch.
|
||||
* Type: ALfloat
|
||||
* Range: [0.5 - 2.0]
|
||||
* Default: 1.0
|
||||
*
|
||||
* A multiplier for the frequency (sample rate) of the source's buffer.
|
||||
*/
|
||||
#define AL_PITCH 0x1003
|
||||
|
||||
/**
|
||||
* Source or listener position.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* The source or listener location in three dimensional space.
|
||||
*
|
||||
* OpenAL, like OpenGL, uses a right handed coordinate system, where in a
|
||||
* frontal default view X (thumb) points right, Y points up (index finger), and
|
||||
* Z points towards the viewer/camera (middle finger).
|
||||
*
|
||||
* To switch from a left handed coordinate system, flip the sign on the Z
|
||||
* coordinate.
|
||||
*/
|
||||
#define AL_POSITION 0x1004
|
||||
|
||||
/**
|
||||
* Source direction.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* Specifies the current direction in local space.
|
||||
* A zero-length vector specifies an omni-directional source (cone is ignored).
|
||||
*/
|
||||
#define AL_DIRECTION 0x1005
|
||||
|
||||
/**
|
||||
* Source or listener velocity.
|
||||
* Type: ALfloat[3], ALint[3]
|
||||
* Default: {0, 0, 0}
|
||||
*
|
||||
* Specifies the current velocity in local space.
|
||||
*/
|
||||
#define AL_VELOCITY 0x1006
|
||||
|
||||
/**
|
||||
* Source looping.
|
||||
* Type: ALboolean
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: AL_FALSE
|
||||
*
|
||||
* Specifies whether source is looping.
|
||||
*/
|
||||
#define AL_LOOPING 0x1007
|
||||
|
||||
/**
|
||||
* Source buffer.
|
||||
* Type: ALuint
|
||||
* Range: any valid Buffer.
|
||||
*
|
||||
* Specifies the buffer to provide sound samples.
|
||||
*/
|
||||
#define AL_BUFFER 0x1009
|
||||
|
||||
/**
|
||||
* Source or listener gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
*
|
||||
* A value of 1.0 means unattenuated. Each division by 2 equals an attenuation
|
||||
* of about -6dB. Each multiplicaton by 2 equals an amplification of about
|
||||
* +6dB.
|
||||
*
|
||||
* A value of 0.0 is meaningless with respect to a logarithmic scale; it is
|
||||
* silent.
|
||||
*/
|
||||
#define AL_GAIN 0x100A
|
||||
|
||||
/**
|
||||
* Minimum source gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* The minimum gain allowed for a source, after distance and cone attenation is
|
||||
* applied (if applicable).
|
||||
*/
|
||||
#define AL_MIN_GAIN 0x100D
|
||||
|
||||
/**
|
||||
* Maximum source gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* The maximum gain allowed for a source, after distance and cone attenation is
|
||||
* applied (if applicable).
|
||||
*/
|
||||
#define AL_MAX_GAIN 0x100E
|
||||
|
||||
/**
|
||||
* Listener orientation.
|
||||
* Type: ALfloat[6]
|
||||
* Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}
|
||||
*
|
||||
* Effectively two three dimensional vectors. The first vector is the front (or
|
||||
* "at") and the second is the top (or "up").
|
||||
*
|
||||
* Both vectors are in local space.
|
||||
*/
|
||||
#define AL_ORIENTATION 0x100F
|
||||
|
||||
/**
|
||||
* Source state (query only).
|
||||
* Type: ALint
|
||||
* Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED]
|
||||
*/
|
||||
#define AL_SOURCE_STATE 0x1010
|
||||
|
||||
/** Source state value. */
|
||||
#define AL_INITIAL 0x1011
|
||||
#define AL_PLAYING 0x1012
|
||||
#define AL_PAUSED 0x1013
|
||||
#define AL_STOPPED 0x1014
|
||||
|
||||
/**
|
||||
* Source Buffer Queue size (query only).
|
||||
* Type: ALint
|
||||
*
|
||||
* The number of buffers queued using alSourceQueueBuffers, minus the buffers
|
||||
* removed with alSourceUnqueueBuffers.
|
||||
*/
|
||||
#define AL_BUFFERS_QUEUED 0x1015
|
||||
|
||||
/**
|
||||
* Source Buffer Queue processed count (query only).
|
||||
* Type: ALint
|
||||
*
|
||||
* The number of queued buffers that have been fully processed, and can be
|
||||
* removed with alSourceUnqueueBuffers.
|
||||
*
|
||||
* Looping sources will never fully process buffers because they will be set to
|
||||
* play again for when the source loops.
|
||||
*/
|
||||
#define AL_BUFFERS_PROCESSED 0x1016
|
||||
|
||||
/**
|
||||
* Source reference distance.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* The distance in units that no attenuation occurs.
|
||||
*
|
||||
* At 0.0, no distance attenuation ever occurs on non-linear attenuation models.
|
||||
*/
|
||||
#define AL_REFERENCE_DISTANCE 0x1020
|
||||
|
||||
/**
|
||||
* Source rolloff factor.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* Multiplier to exaggerate or diminish distance attenuation.
|
||||
*
|
||||
* At 0.0, no distance attenuation ever occurs.
|
||||
*/
|
||||
#define AL_ROLLOFF_FACTOR 0x1021
|
||||
|
||||
/**
|
||||
* Outer cone gain.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
* Default: 0.0
|
||||
*
|
||||
* The gain attenuation applied when the listener is outside of the source's
|
||||
* outer cone.
|
||||
*/
|
||||
#define AL_CONE_OUTER_GAIN 0x1022
|
||||
|
||||
/**
|
||||
* Source maximum distance.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: +inf
|
||||
*
|
||||
* The distance above which the source is not attenuated any further with a
|
||||
* clamped distance model, or where attenuation reaches 0.0 gain for linear
|
||||
* distance models with a default rolloff factor.
|
||||
*/
|
||||
#define AL_MAX_DISTANCE 0x1023
|
||||
|
||||
/** Source buffer position, in seconds */
|
||||
#define AL_SEC_OFFSET 0x1024
|
||||
/** Source buffer position, in sample frames */
|
||||
#define AL_SAMPLE_OFFSET 0x1025
|
||||
/** Source buffer position, in bytes */
|
||||
#define AL_BYTE_OFFSET 0x1026
|
||||
|
||||
/**
|
||||
* Source type (query only).
|
||||
* Type: ALint
|
||||
* Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED]
|
||||
*
|
||||
* A Source is Static if a Buffer has been attached using AL_BUFFER.
|
||||
*
|
||||
* A Source is Streaming if one or more Buffers have been attached using
|
||||
* alSourceQueueBuffers.
|
||||
*
|
||||
* A Source is Undetermined when it has the NULL buffer attached using
|
||||
* AL_BUFFER.
|
||||
*/
|
||||
#define AL_SOURCE_TYPE 0x1027
|
||||
|
||||
/** Source type value. */
|
||||
#define AL_STATIC 0x1028
|
||||
#define AL_STREAMING 0x1029
|
||||
#define AL_UNDETERMINED 0x1030
|
||||
|
||||
/** Buffer format specifier. */
|
||||
#define AL_FORMAT_MONO8 0x1100
|
||||
#define AL_FORMAT_MONO16 0x1101
|
||||
#define AL_FORMAT_STEREO8 0x1102
|
||||
#define AL_FORMAT_STEREO16 0x1103
|
||||
|
||||
/** Buffer frequency (query only). */
|
||||
#define AL_FREQUENCY 0x2001
|
||||
/** Buffer bits per sample (query only). */
|
||||
#define AL_BITS 0x2002
|
||||
/** Buffer channel count (query only). */
|
||||
#define AL_CHANNELS 0x2003
|
||||
/** Buffer data size (query only). */
|
||||
#define AL_SIZE 0x2004
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not for public use.
|
||||
*/
|
||||
#define AL_UNUSED 0x2010
|
||||
#define AL_PENDING 0x2011
|
||||
#define AL_PROCESSED 0x2012
|
||||
|
||||
|
||||
/** No error. */
|
||||
#define AL_NO_ERROR 0
|
||||
|
||||
/** Invalid name paramater passed to AL call. */
|
||||
#define AL_INVALID_NAME 0xA001
|
||||
|
||||
/** Invalid enum parameter passed to AL call. */
|
||||
#define AL_INVALID_ENUM 0xA002
|
||||
|
||||
/** Invalid value parameter passed to AL call. */
|
||||
#define AL_INVALID_VALUE 0xA003
|
||||
|
||||
/** Illegal AL call. */
|
||||
#define AL_INVALID_OPERATION 0xA004
|
||||
|
||||
/** Not enough memory. */
|
||||
#define AL_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Context string: Vendor ID. */
|
||||
#define AL_VENDOR 0xB001
|
||||
/** Context string: Version. */
|
||||
#define AL_VERSION 0xB002
|
||||
/** Context string: Renderer ID. */
|
||||
#define AL_RENDERER 0xB003
|
||||
/** Context string: Space-separated extension list. */
|
||||
#define AL_EXTENSIONS 0xB004
|
||||
|
||||
|
||||
/**
|
||||
* Doppler scale.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - ]
|
||||
* Default: 1.0
|
||||
*
|
||||
* Scale for source and listener velocities.
|
||||
*/
|
||||
#define AL_DOPPLER_FACTOR 0xC000
|
||||
AL_API void AL_APIENTRY alDopplerFactor(ALfloat value);
|
||||
|
||||
/**
|
||||
* Doppler velocity (deprecated).
|
||||
*
|
||||
* A multiplier applied to the Speed of Sound.
|
||||
*/
|
||||
#define AL_DOPPLER_VELOCITY 0xC001
|
||||
AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value);
|
||||
|
||||
/**
|
||||
* Speed of Sound, in units per second.
|
||||
* Type: ALfloat
|
||||
* Range: [0.0001 - ]
|
||||
* Default: 343.3
|
||||
*
|
||||
* The speed at which sound waves are assumed to travel, when calculating the
|
||||
* doppler effect.
|
||||
*/
|
||||
#define AL_SPEED_OF_SOUND 0xC003
|
||||
AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
|
||||
|
||||
/**
|
||||
* Distance attenuation model.
|
||||
* Type: ALint
|
||||
* Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED,
|
||||
* AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED,
|
||||
* AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED]
|
||||
* Default: AL_INVERSE_DISTANCE_CLAMPED
|
||||
*
|
||||
* The model by which sources attenuate with distance.
|
||||
*
|
||||
* None - No distance attenuation.
|
||||
* Inverse - Doubling the distance halves the source gain.
|
||||
* Linear - Linear gain scaling between the reference and max distances.
|
||||
* Exponent - Exponential gain dropoff.
|
||||
*
|
||||
* Clamped variations work like the non-clamped counterparts, except the
|
||||
* distance calculated is clamped between the reference and max distances.
|
||||
*/
|
||||
#define AL_DISTANCE_MODEL 0xD000
|
||||
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
|
||||
|
||||
/** Distance model value. */
|
||||
#define AL_INVERSE_DISTANCE 0xD001
|
||||
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
|
||||
#define AL_LINEAR_DISTANCE 0xD003
|
||||
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
|
||||
#define AL_EXPONENT_DISTANCE 0xD005
|
||||
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
|
||||
|
||||
/** Renderer State management. */
|
||||
AL_API void AL_APIENTRY alEnable(ALenum capability);
|
||||
AL_API void AL_APIENTRY alDisable(ALenum capability);
|
||||
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability);
|
||||
|
||||
/** State retrieval. */
|
||||
AL_API const ALchar* AL_APIENTRY alGetString(ALenum param);
|
||||
AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values);
|
||||
AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values);
|
||||
AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values);
|
||||
AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param);
|
||||
AL_API ALint AL_APIENTRY alGetInteger(ALenum param);
|
||||
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param);
|
||||
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param);
|
||||
|
||||
/**
|
||||
* Error retrieval.
|
||||
*
|
||||
* Obtain the first error generated in the AL context since the last check.
|
||||
*/
|
||||
AL_API ALenum AL_APIENTRY alGetError(void);
|
||||
|
||||
/**
|
||||
* Extension support.
|
||||
*
|
||||
* Query for the presence of an extension, and obtain any appropriate function
|
||||
* pointers and enum values.
|
||||
*/
|
||||
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname);
|
||||
AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname);
|
||||
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename);
|
||||
|
||||
|
||||
/** Set Listener parameters */
|
||||
AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values);
|
||||
|
||||
/** Get Listener parameters */
|
||||
AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values);
|
||||
|
||||
|
||||
/** Create Source objects. */
|
||||
AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources);
|
||||
/** Delete Source objects. */
|
||||
AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources);
|
||||
/** Verify a handle is a valid Source. */
|
||||
AL_API ALboolean AL_APIENTRY alIsSource(ALuint source);
|
||||
|
||||
/** Set Source parameters. */
|
||||
AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values);
|
||||
|
||||
/** Get Source parameters. */
|
||||
AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values);
|
||||
|
||||
|
||||
/** Play, replay, or resume (if paused) a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources);
|
||||
/** Stop a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources);
|
||||
/** Rewind a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources);
|
||||
/** Pause a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources);
|
||||
|
||||
/** Play, replay, or resume a Source */
|
||||
AL_API void AL_APIENTRY alSourcePlay(ALuint source);
|
||||
/** Stop a Source */
|
||||
AL_API void AL_APIENTRY alSourceStop(ALuint source);
|
||||
/** Rewind a Source (set playback postiton to beginning) */
|
||||
AL_API void AL_APIENTRY alSourceRewind(ALuint source);
|
||||
/** Pause a Source */
|
||||
AL_API void AL_APIENTRY alSourcePause(ALuint source);
|
||||
|
||||
/** Queue buffers onto a source */
|
||||
AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
/** Unqueue processed buffers from a source */
|
||||
AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
|
||||
|
||||
/** Create Buffer objects */
|
||||
AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers);
|
||||
/** Delete Buffer objects */
|
||||
AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers);
|
||||
/** Verify a handle is a valid Buffer */
|
||||
AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer);
|
||||
|
||||
/** Specifies the data to be copied into a buffer */
|
||||
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
|
||||
/** Set Buffer parameters, */
|
||||
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value);
|
||||
AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value);
|
||||
AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values);
|
||||
|
||||
/** Get Buffer parameters. */
|
||||
AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
|
||||
AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
|
||||
AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value);
|
||||
AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values);
|
||||
|
||||
/** Pointer-to-function type, useful for dynamically getting AL entry points. */
|
||||
typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability);
|
||||
typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability);
|
||||
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param);
|
||||
typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values);
|
||||
typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values);
|
||||
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param);
|
||||
typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param);
|
||||
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param);
|
||||
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param);
|
||||
typedef ALenum (AL_APIENTRY *LPALGETERROR)(void);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname);
|
||||
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname);
|
||||
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers);
|
||||
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values);
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AL_AL_H */
|
||||
@@ -0,0 +1,237 @@
|
||||
#ifndef AL_ALC_H
|
||||
#define AL_ALC_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ALC_API
|
||||
#if defined(AL_LIBTYPE_STATIC)
|
||||
#define ALC_API
|
||||
#elif defined(_WIN32)
|
||||
#define ALC_API __declspec(dllimport)
|
||||
#else
|
||||
#define ALC_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define ALC_APIENTRY __cdecl
|
||||
#else
|
||||
#define ALC_APIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/** Deprecated macro. */
|
||||
#define ALCAPI ALC_API
|
||||
#define ALCAPIENTRY ALC_APIENTRY
|
||||
#define ALC_INVALID 0
|
||||
|
||||
/** Supported ALC version? */
|
||||
#define ALC_VERSION_0_1 1
|
||||
|
||||
/** Opaque device handle */
|
||||
typedef struct ALCdevice_struct ALCdevice;
|
||||
/** Opaque context handle */
|
||||
typedef struct ALCcontext_struct ALCcontext;
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALCboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALCchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef signed char ALCbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALCubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALCshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALCushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALCint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALCuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALCsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALCenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALCfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALCdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALCvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/** Boolean False. */
|
||||
#define ALC_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define ALC_TRUE 1
|
||||
|
||||
/** Context attribute: <int> Hz. */
|
||||
#define ALC_FREQUENCY 0x1007
|
||||
|
||||
/** Context attribute: <int> Hz. */
|
||||
#define ALC_REFRESH 0x1008
|
||||
|
||||
/** Context attribute: AL_TRUE or AL_FALSE. */
|
||||
#define ALC_SYNC 0x1009
|
||||
|
||||
/** Context attribute: <int> requested Mono (3D) Sources. */
|
||||
#define ALC_MONO_SOURCES 0x1010
|
||||
|
||||
/** Context attribute: <int> requested Stereo Sources. */
|
||||
#define ALC_STEREO_SOURCES 0x1011
|
||||
|
||||
/** No error. */
|
||||
#define ALC_NO_ERROR 0
|
||||
|
||||
/** Invalid device handle. */
|
||||
#define ALC_INVALID_DEVICE 0xA001
|
||||
|
||||
/** Invalid context handle. */
|
||||
#define ALC_INVALID_CONTEXT 0xA002
|
||||
|
||||
/** Invalid enum parameter passed to an ALC call. */
|
||||
#define ALC_INVALID_ENUM 0xA003
|
||||
|
||||
/** Invalid value parameter passed to an ALC call. */
|
||||
#define ALC_INVALID_VALUE 0xA004
|
||||
|
||||
/** Out of memory. */
|
||||
#define ALC_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Runtime ALC version. */
|
||||
#define ALC_MAJOR_VERSION 0x1000
|
||||
#define ALC_MINOR_VERSION 0x1001
|
||||
|
||||
/** Context attribute list properties. */
|
||||
#define ALC_ATTRIBUTES_SIZE 0x1002
|
||||
#define ALC_ALL_ATTRIBUTES 0x1003
|
||||
|
||||
/** String for the default device specifier. */
|
||||
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
|
||||
/**
|
||||
* String for the given device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_DEVICE_SPECIFIER 0x1005
|
||||
/** String for space-separated list of ALC extensions. */
|
||||
#define ALC_EXTENSIONS 0x1006
|
||||
|
||||
|
||||
/** Capture extension */
|
||||
#define ALC_EXT_CAPTURE 1
|
||||
/**
|
||||
* String for the given capture device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known capture device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
|
||||
/** String for the default capture device specifier. */
|
||||
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
|
||||
/** Number of sample frames available for capture. */
|
||||
#define ALC_CAPTURE_SAMPLES 0x312
|
||||
|
||||
|
||||
/** Enumerate All extension */
|
||||
#define ALC_ENUMERATE_ALL_EXT 1
|
||||
/** String for the default extended device specifier. */
|
||||
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
|
||||
/**
|
||||
* String for the given extended device's specifier.
|
||||
*
|
||||
* If device handle is NULL, it is instead a null-char separated list of
|
||||
* strings of known extended device specifiers (list ends with an empty string).
|
||||
*/
|
||||
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
|
||||
|
||||
|
||||
/** Context management. */
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint* attrlist);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context);
|
||||
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context);
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
|
||||
|
||||
/** Device management. */
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
|
||||
|
||||
|
||||
/**
|
||||
* Error support.
|
||||
*
|
||||
* Obtain the most recent Device error.
|
||||
*/
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
|
||||
|
||||
/**
|
||||
* Extension support.
|
||||
*
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
|
||||
ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
|
||||
|
||||
/** Query function. */
|
||||
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param);
|
||||
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
|
||||
/** Capture function. */
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device);
|
||||
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
|
||||
/** Pointer-to-function type, useful for dynamically getting ALC entry points. */
|
||||
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context);
|
||||
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context);
|
||||
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
|
||||
typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
|
||||
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
|
||||
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AL_ALC_H */
|
||||
@@ -0,0 +1,355 @@
|
||||
/**
|
||||
* OpenAL cross platform audio library
|
||||
* Copyright (C) 2008 by authors.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
* Or go to http://www.gnu.org/copyleft/lgpl.html
|
||||
*/
|
||||
|
||||
#ifndef AL_ALEXT_H
|
||||
#define AL_ALEXT_H
|
||||
|
||||
#include <stddef.h>
|
||||
/* Define int64_t and uint64_t types */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include "alc.h"
|
||||
#include "al.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_IMA_ADPCM_format
|
||||
#define AL_LOKI_IMA_ADPCM_format 1
|
||||
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
|
||||
#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_WAVE_format
|
||||
#define AL_LOKI_WAVE_format 1
|
||||
#define AL_FORMAT_WAVE_EXT 0x10002
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_vorbis
|
||||
#define AL_EXT_vorbis 1
|
||||
#define AL_FORMAT_VORBIS_EXT 0x10003
|
||||
#endif
|
||||
|
||||
#ifndef AL_LOKI_quadriphonic
|
||||
#define AL_LOKI_quadriphonic 1
|
||||
#define AL_FORMAT_QUAD8_LOKI 0x10004
|
||||
#define AL_FORMAT_QUAD16_LOKI 0x10005
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_float32
|
||||
#define AL_EXT_float32 1
|
||||
#define AL_FORMAT_MONO_FLOAT32 0x10010
|
||||
#define AL_FORMAT_STEREO_FLOAT32 0x10011
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_double
|
||||
#define AL_EXT_double 1
|
||||
#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
|
||||
#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MULAW
|
||||
#define AL_EXT_MULAW 1
|
||||
#define AL_FORMAT_MONO_MULAW_EXT 0x10014
|
||||
#define AL_FORMAT_STEREO_MULAW_EXT 0x10015
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_ALAW
|
||||
#define AL_EXT_ALAW 1
|
||||
#define AL_FORMAT_MONO_ALAW_EXT 0x10016
|
||||
#define AL_FORMAT_STEREO_ALAW_EXT 0x10017
|
||||
#endif
|
||||
|
||||
#ifndef ALC_LOKI_audio_channel
|
||||
#define ALC_LOKI_audio_channel 1
|
||||
#define ALC_CHAN_MAIN_LOKI 0x500001
|
||||
#define ALC_CHAN_PCM_LOKI 0x500002
|
||||
#define ALC_CHAN_CD_LOKI 0x500003
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MCFORMATS
|
||||
#define AL_EXT_MCFORMATS 1
|
||||
#define AL_FORMAT_QUAD8 0x1204
|
||||
#define AL_FORMAT_QUAD16 0x1205
|
||||
#define AL_FORMAT_QUAD32 0x1206
|
||||
#define AL_FORMAT_REAR8 0x1207
|
||||
#define AL_FORMAT_REAR16 0x1208
|
||||
#define AL_FORMAT_REAR32 0x1209
|
||||
#define AL_FORMAT_51CHN8 0x120A
|
||||
#define AL_FORMAT_51CHN16 0x120B
|
||||
#define AL_FORMAT_51CHN32 0x120C
|
||||
#define AL_FORMAT_61CHN8 0x120D
|
||||
#define AL_FORMAT_61CHN16 0x120E
|
||||
#define AL_FORMAT_61CHN32 0x120F
|
||||
#define AL_FORMAT_71CHN8 0x1210
|
||||
#define AL_FORMAT_71CHN16 0x1211
|
||||
#define AL_FORMAT_71CHN32 0x1212
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_MULAW_MCFORMATS
|
||||
#define AL_EXT_MULAW_MCFORMATS 1
|
||||
#define AL_FORMAT_MONO_MULAW 0x10014
|
||||
#define AL_FORMAT_STEREO_MULAW 0x10015
|
||||
#define AL_FORMAT_QUAD_MULAW 0x10021
|
||||
#define AL_FORMAT_REAR_MULAW 0x10022
|
||||
#define AL_FORMAT_51CHN_MULAW 0x10023
|
||||
#define AL_FORMAT_61CHN_MULAW 0x10024
|
||||
#define AL_FORMAT_71CHN_MULAW 0x10025
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_IMA4
|
||||
#define AL_EXT_IMA4 1
|
||||
#define AL_FORMAT_MONO_IMA4 0x1300
|
||||
#define AL_FORMAT_STEREO_IMA4 0x1301
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_STATIC_BUFFER
|
||||
#define AL_EXT_STATIC_BUFFER 1
|
||||
typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_EFX
|
||||
#define ALC_EXT_EFX 1
|
||||
#include "efx.h"
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_disconnect
|
||||
#define ALC_EXT_disconnect 1
|
||||
#define ALC_CONNECTED 0x313
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_thread_local_context
|
||||
#define ALC_EXT_thread_local_context 1
|
||||
typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
|
||||
typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
|
||||
ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_source_distance_model
|
||||
#define AL_EXT_source_distance_model 1
|
||||
#define AL_SOURCE_DISTANCE_MODEL 0x200
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_buffer_sub_data
|
||||
#define AL_SOFT_buffer_sub_data 1
|
||||
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
|
||||
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
|
||||
typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_loop_points
|
||||
#define AL_SOFT_loop_points 1
|
||||
#define AL_LOOP_POINTS_SOFT 0x2015
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_FOLDBACK
|
||||
#define AL_EXT_FOLDBACK 1
|
||||
#define AL_EXT_FOLDBACK_NAME "AL_EXT_FOLDBACK"
|
||||
#define AL_FOLDBACK_EVENT_BLOCK 0x4112
|
||||
#define AL_FOLDBACK_EVENT_START 0x4111
|
||||
#define AL_FOLDBACK_EVENT_STOP 0x4113
|
||||
#define AL_FOLDBACK_MODE_MONO 0x4101
|
||||
#define AL_FOLDBACK_MODE_STEREO 0x4102
|
||||
typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei);
|
||||
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK);
|
||||
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback);
|
||||
AL_API void AL_APIENTRY alRequestFoldbackStop(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALC_EXT_DEDICATED
|
||||
#define ALC_EXT_DEDICATED 1
|
||||
#define AL_DEDICATED_GAIN 0x0001
|
||||
#define AL_EFFECT_DEDICATED_DIALOGUE 0x9001
|
||||
#define AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT 0x9000
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_buffer_samples
|
||||
#define AL_SOFT_buffer_samples 1
|
||||
/* Channel configurations */
|
||||
#define AL_MONO_SOFT 0x1500
|
||||
#define AL_STEREO_SOFT 0x1501
|
||||
#define AL_REAR_SOFT 0x1502
|
||||
#define AL_QUAD_SOFT 0x1503
|
||||
#define AL_5POINT1_SOFT 0x1504
|
||||
#define AL_6POINT1_SOFT 0x1505
|
||||
#define AL_7POINT1_SOFT 0x1506
|
||||
|
||||
/* Sample types */
|
||||
#define AL_BYTE_SOFT 0x1400
|
||||
#define AL_UNSIGNED_BYTE_SOFT 0x1401
|
||||
#define AL_SHORT_SOFT 0x1402
|
||||
#define AL_UNSIGNED_SHORT_SOFT 0x1403
|
||||
#define AL_INT_SOFT 0x1404
|
||||
#define AL_UNSIGNED_INT_SOFT 0x1405
|
||||
#define AL_FLOAT_SOFT 0x1406
|
||||
#define AL_DOUBLE_SOFT 0x1407
|
||||
#define AL_BYTE3_SOFT 0x1408
|
||||
#define AL_UNSIGNED_BYTE3_SOFT 0x1409
|
||||
|
||||
/* Storage formats */
|
||||
#define AL_MONO8_SOFT 0x1100
|
||||
#define AL_MONO16_SOFT 0x1101
|
||||
#define AL_MONO32F_SOFT 0x10010
|
||||
#define AL_STEREO8_SOFT 0x1102
|
||||
#define AL_STEREO16_SOFT 0x1103
|
||||
#define AL_STEREO32F_SOFT 0x10011
|
||||
#define AL_QUAD8_SOFT 0x1204
|
||||
#define AL_QUAD16_SOFT 0x1205
|
||||
#define AL_QUAD32F_SOFT 0x1206
|
||||
#define AL_REAR8_SOFT 0x1207
|
||||
#define AL_REAR16_SOFT 0x1208
|
||||
#define AL_REAR32F_SOFT 0x1209
|
||||
#define AL_5POINT1_8_SOFT 0x120A
|
||||
#define AL_5POINT1_16_SOFT 0x120B
|
||||
#define AL_5POINT1_32F_SOFT 0x120C
|
||||
#define AL_6POINT1_8_SOFT 0x120D
|
||||
#define AL_6POINT1_16_SOFT 0x120E
|
||||
#define AL_6POINT1_32F_SOFT 0x120F
|
||||
#define AL_7POINT1_8_SOFT 0x1210
|
||||
#define AL_7POINT1_16_SOFT 0x1211
|
||||
#define AL_7POINT1_32F_SOFT 0x1212
|
||||
|
||||
/* Buffer attributes */
|
||||
#define AL_INTERNAL_FORMAT_SOFT 0x2008
|
||||
#define AL_BYTE_LENGTH_SOFT 0x2009
|
||||
#define AL_SAMPLE_LENGTH_SOFT 0x200A
|
||||
#define AL_SEC_LENGTH_SOFT 0x200B
|
||||
|
||||
typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
|
||||
typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
|
||||
typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
|
||||
typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
|
||||
AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
|
||||
AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data);
|
||||
AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_direct_channels
|
||||
#define AL_SOFT_direct_channels 1
|
||||
#define AL_DIRECT_CHANNELS_SOFT 0x1033
|
||||
#endif
|
||||
|
||||
#ifndef ALC_SOFT_loopback
|
||||
#define ALC_SOFT_loopback 1
|
||||
#define ALC_FORMAT_CHANNELS_SOFT 0x1990
|
||||
#define ALC_FORMAT_TYPE_SOFT 0x1991
|
||||
|
||||
/* Sample types */
|
||||
#define ALC_BYTE_SOFT 0x1400
|
||||
#define ALC_UNSIGNED_BYTE_SOFT 0x1401
|
||||
#define ALC_SHORT_SOFT 0x1402
|
||||
#define ALC_UNSIGNED_SHORT_SOFT 0x1403
|
||||
#define ALC_INT_SOFT 0x1404
|
||||
#define ALC_UNSIGNED_INT_SOFT 0x1405
|
||||
#define ALC_FLOAT_SOFT 0x1406
|
||||
|
||||
/* Channel configurations */
|
||||
#define ALC_MONO_SOFT 0x1500
|
||||
#define ALC_STEREO_SOFT 0x1501
|
||||
#define ALC_QUAD_SOFT 0x1503
|
||||
#define ALC_5POINT1_SOFT 0x1504
|
||||
#define ALC_6POINT1_SOFT 0x1505
|
||||
#define ALC_7POINT1_SOFT 0x1506
|
||||
|
||||
typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*);
|
||||
typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum);
|
||||
typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName);
|
||||
ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type);
|
||||
ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_STEREO_ANGLES
|
||||
#define AL_EXT_STEREO_ANGLES 1
|
||||
#define AL_STEREO_ANGLES 0x1030
|
||||
#endif
|
||||
|
||||
#ifndef AL_EXT_SOURCE_RADIUS
|
||||
#define AL_EXT_SOURCE_RADIUS 1
|
||||
#define AL_SOURCE_RADIUS 0x1031
|
||||
#endif
|
||||
|
||||
#ifndef AL_SOFT_source_latency
|
||||
#define AL_SOFT_source_latency 1
|
||||
#define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200
|
||||
#define AL_SEC_OFFSET_LATENCY_SOFT 0x1201
|
||||
typedef int64_t ALint64SOFT;
|
||||
typedef uint64_t ALuint64SOFT;
|
||||
typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble);
|
||||
typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT);
|
||||
typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT);
|
||||
typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*);
|
||||
typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*);
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value);
|
||||
AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3);
|
||||
AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values);
|
||||
AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value);
|
||||
AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values);
|
||||
AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value);
|
||||
AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3);
|
||||
AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values);
|
||||
AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value);
|
||||
AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3);
|
||||
AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
/* The tokens that would be defined here are already defined in efx.h. This
|
||||
* empty file is here to provide compatibility with Windows-based projects
|
||||
* that would include it. */
|
||||
@@ -0,0 +1,402 @@
|
||||
/* Reverb presets for EFX */
|
||||
|
||||
#ifndef EFX_PRESETS_H
|
||||
#define EFX_PRESETS_H
|
||||
|
||||
#ifndef EFXEAXREVERBPROPERTIES_DEFINED
|
||||
#define EFXEAXREVERBPROPERTIES_DEFINED
|
||||
typedef struct {
|
||||
float flDensity;
|
||||
float flDiffusion;
|
||||
float flGain;
|
||||
float flGainHF;
|
||||
float flGainLF;
|
||||
float flDecayTime;
|
||||
float flDecayHFRatio;
|
||||
float flDecayLFRatio;
|
||||
float flReflectionsGain;
|
||||
float flReflectionsDelay;
|
||||
float flReflectionsPan[3];
|
||||
float flLateReverbGain;
|
||||
float flLateReverbDelay;
|
||||
float flLateReverbPan[3];
|
||||
float flEchoTime;
|
||||
float flEchoDepth;
|
||||
float flModulationTime;
|
||||
float flModulationDepth;
|
||||
float flAirAbsorptionGainHF;
|
||||
float flHFReference;
|
||||
float flLFReference;
|
||||
float flRoomRolloffFactor;
|
||||
int iDecayHFLimit;
|
||||
} EFXEAXREVERBPROPERTIES, *LPEFXEAXREVERBPROPERTIES;
|
||||
#endif
|
||||
|
||||
/* Default Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_GENERIC \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.8913f, 1.0000f, 1.4900f, 0.8300f, 1.0000f, 0.0500f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PADDEDCELL \
|
||||
{ 0.1715f, 1.0000f, 0.3162f, 0.0010f, 1.0000f, 0.1700f, 0.1000f, 1.0000f, 0.2500f, 0.0010f, { 0.0000f, 0.0000f, 0.0000f }, 1.2691f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ROOM \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.5929f, 1.0000f, 0.4000f, 0.8300f, 1.0000f, 0.1503f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 1.0629f, 0.0030f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_BATHROOM \
|
||||
{ 0.1715f, 1.0000f, 0.3162f, 0.2512f, 1.0000f, 1.4900f, 0.5400f, 1.0000f, 0.6531f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 3.2734f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_LIVINGROOM \
|
||||
{ 0.9766f, 1.0000f, 0.3162f, 0.0010f, 1.0000f, 0.5000f, 0.1000f, 1.0000f, 0.2051f, 0.0030f, { 0.0000f, 0.0000f, 0.0000f }, 0.2805f, 0.0040f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_STONEROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.7079f, 1.0000f, 2.3100f, 0.6400f, 1.0000f, 0.4411f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1003f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_AUDITORIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.5781f, 1.0000f, 4.3200f, 0.5900f, 1.0000f, 0.4032f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.7170f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CONCERTHALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.5623f, 1.0000f, 3.9200f, 0.7000f, 1.0000f, 0.2427f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.9977f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CAVE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 1.0000f, 2.9100f, 1.3000f, 1.0000f, 0.5000f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.7063f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ARENA \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.4477f, 1.0000f, 7.2400f, 0.3300f, 1.0000f, 0.2612f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.0186f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_HANGAR \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3162f, 1.0000f, 10.0500f, 0.2300f, 1.0000f, 0.5000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2560f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CARPETEDHALLWAY \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.0100f, 1.0000f, 0.3000f, 0.1000f, 1.0000f, 0.1215f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 0.1531f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_HALLWAY \
|
||||
{ 0.3645f, 1.0000f, 0.3162f, 0.7079f, 1.0000f, 1.4900f, 0.5900f, 1.0000f, 0.2458f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.6615f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_STONECORRIDOR \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.7612f, 1.0000f, 2.7000f, 0.7900f, 1.0000f, 0.2472f, 0.0130f, { 0.0000f, 0.0000f, 0.0000f }, 1.5758f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ALLEY \
|
||||
{ 1.0000f, 0.3000f, 0.3162f, 0.7328f, 1.0000f, 1.4900f, 0.8600f, 1.0000f, 0.2500f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.9954f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.9500f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FOREST \
|
||||
{ 1.0000f, 0.3000f, 0.3162f, 0.0224f, 1.0000f, 1.4900f, 0.5400f, 1.0000f, 0.0525f, 0.1620f, { 0.0000f, 0.0000f, 0.0000f }, 0.7682f, 0.0880f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY \
|
||||
{ 1.0000f, 0.5000f, 0.3162f, 0.3981f, 1.0000f, 1.4900f, 0.6700f, 1.0000f, 0.0730f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.1427f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOUNTAINS \
|
||||
{ 1.0000f, 0.2700f, 0.3162f, 0.0562f, 1.0000f, 1.4900f, 0.2100f, 1.0000f, 0.0407f, 0.3000f, { 0.0000f, 0.0000f, 0.0000f }, 0.1919f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_QUARRY \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3162f, 1.0000f, 1.4900f, 0.8300f, 1.0000f, 0.0000f, 0.0610f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0250f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.7000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PLAIN \
|
||||
{ 1.0000f, 0.2100f, 0.3162f, 0.1000f, 1.0000f, 1.4900f, 0.5000f, 1.0000f, 0.0585f, 0.1790f, { 0.0000f, 0.0000f, 0.0000f }, 0.1089f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PARKINGLOT \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 1.0000f, 1.6500f, 1.5000f, 1.0000f, 0.2082f, 0.0080f, { 0.0000f, 0.0000f, 0.0000f }, 0.2652f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SEWERPIPE \
|
||||
{ 0.3071f, 0.8000f, 0.3162f, 0.3162f, 1.0000f, 2.8100f, 0.1400f, 1.0000f, 1.6387f, 0.0140f, { 0.0000f, 0.0000f, 0.0000f }, 3.2471f, 0.0210f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_UNDERWATER \
|
||||
{ 0.3645f, 1.0000f, 0.3162f, 0.0100f, 1.0000f, 1.4900f, 0.1000f, 1.0000f, 0.5963f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 7.0795f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 1.1800f, 0.3480f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRUGGED \
|
||||
{ 0.4287f, 0.5000f, 0.3162f, 1.0000f, 1.0000f, 8.3900f, 1.3900f, 1.0000f, 0.8760f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 3.1081f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 1.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DIZZY \
|
||||
{ 0.3645f, 0.6000f, 0.3162f, 0.6310f, 1.0000f, 17.2300f, 0.5600f, 1.0000f, 0.1392f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.4937f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.8100f, 0.3100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PSYCHOTIC \
|
||||
{ 0.0625f, 0.5000f, 0.3162f, 0.8404f, 1.0000f, 7.5600f, 0.9100f, 1.0000f, 0.4864f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 2.4378f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 4.0000f, 1.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Castle Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_SMALLROOM \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3981f, 0.1000f, 1.2200f, 0.8300f, 0.3100f, 0.8913f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_SHORTPASSAGE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3162f, 0.1000f, 2.3200f, 0.8300f, 0.3100f, 0.8913f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_MEDIUMROOM \
|
||||
{ 1.0000f, 0.9300f, 0.3162f, 0.2818f, 0.1000f, 2.0400f, 0.8300f, 0.4600f, 0.6310f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1550f, 0.0300f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_LARGEROOM \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.2818f, 0.1259f, 2.5300f, 0.8300f, 0.5000f, 0.4467f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1850f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_LONGPASSAGE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.3981f, 0.1000f, 3.4200f, 0.8300f, 0.3100f, 0.8913f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_HALL \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.2818f, 0.1778f, 3.1400f, 0.7900f, 0.6200f, 0.1778f, 0.0560f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_CUPBOARD \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.2818f, 0.1000f, 0.6700f, 0.8700f, 0.3100f, 1.4125f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 3.5481f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_COURTYARD \
|
||||
{ 1.0000f, 0.4200f, 0.3162f, 0.4467f, 0.1995f, 2.1300f, 0.6100f, 0.2300f, 0.2239f, 0.1600f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0360f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.3700f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CASTLE_ALCOVE \
|
||||
{ 1.0000f, 0.8900f, 0.3162f, 0.5012f, 0.1000f, 1.6400f, 0.8700f, 0.3100f, 1.0000f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 0.1380f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 5168.6001f, 139.5000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Factory Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_SMALLROOM \
|
||||
{ 0.3645f, 0.8200f, 0.3162f, 0.7943f, 0.5012f, 1.7200f, 0.6500f, 1.3100f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.1190f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_SHORTPASSAGE \
|
||||
{ 0.3645f, 0.6400f, 0.2512f, 0.7943f, 0.5012f, 2.5300f, 0.6500f, 1.3100f, 1.0000f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.1350f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_MEDIUMROOM \
|
||||
{ 0.4287f, 0.8200f, 0.2512f, 0.7943f, 0.5012f, 2.7600f, 0.6500f, 1.3100f, 0.2818f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1740f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_LARGEROOM \
|
||||
{ 0.4287f, 0.7500f, 0.2512f, 0.7079f, 0.6310f, 4.2400f, 0.5100f, 1.3100f, 0.1778f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.2310f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_LONGPASSAGE \
|
||||
{ 0.3645f, 0.6400f, 0.2512f, 0.7943f, 0.5012f, 4.0600f, 0.6500f, 1.3100f, 1.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0370f, { 0.0000f, 0.0000f, 0.0000f }, 0.1350f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_HALL \
|
||||
{ 0.4287f, 0.7500f, 0.3162f, 0.7079f, 0.6310f, 7.4300f, 0.5100f, 1.3100f, 0.0631f, 0.0730f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_CUPBOARD \
|
||||
{ 0.3071f, 0.6300f, 0.2512f, 0.7943f, 0.5012f, 0.4900f, 0.6500f, 1.3100f, 1.2589f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.1070f, 0.0700f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_COURTYARD \
|
||||
{ 0.3071f, 0.5700f, 0.3162f, 0.3162f, 0.6310f, 2.3200f, 0.2900f, 0.5600f, 0.2239f, 0.1400f, { 0.0000f, 0.0000f, 0.0000f }, 0.3981f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2900f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_FACTORY_ALCOVE \
|
||||
{ 0.3645f, 0.5900f, 0.2512f, 0.7943f, 0.5012f, 3.1400f, 0.6500f, 1.3100f, 1.4125f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.1140f, 0.1000f, 0.2500f, 0.0000f, 0.9943f, 3762.6001f, 362.5000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Ice Palace Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_SMALLROOM \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 0.2818f, 1.5100f, 1.5300f, 0.2700f, 0.8913f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1640f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_SHORTPASSAGE \
|
||||
{ 1.0000f, 0.7500f, 0.3162f, 0.5623f, 0.2818f, 1.7900f, 1.4600f, 0.2800f, 0.5012f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.1770f, 0.0900f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_MEDIUMROOM \
|
||||
{ 1.0000f, 0.8700f, 0.3162f, 0.5623f, 0.4467f, 2.2200f, 1.5300f, 0.3200f, 0.3981f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.1860f, 0.1200f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_LARGEROOM \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.5623f, 0.4467f, 3.1400f, 1.5300f, 0.3200f, 0.2512f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0270f, { 0.0000f, 0.0000f, 0.0000f }, 0.2140f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_LONGPASSAGE \
|
||||
{ 1.0000f, 0.7700f, 0.3162f, 0.5623f, 0.3981f, 3.0100f, 1.4600f, 0.2800f, 0.7943f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0250f, { 0.0000f, 0.0000f, 0.0000f }, 0.1860f, 0.0400f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_HALL \
|
||||
{ 1.0000f, 0.7600f, 0.3162f, 0.4467f, 0.5623f, 5.4900f, 1.5300f, 0.3800f, 0.1122f, 0.0540f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0520f, { 0.0000f, 0.0000f, 0.0000f }, 0.2260f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_CUPBOARD \
|
||||
{ 1.0000f, 0.8300f, 0.3162f, 0.5012f, 0.2239f, 0.7600f, 1.5300f, 0.2600f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1430f, 0.0800f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_COURTYARD \
|
||||
{ 1.0000f, 0.5900f, 0.3162f, 0.2818f, 0.3162f, 2.0400f, 1.2000f, 0.3800f, 0.3162f, 0.1730f, { 0.0000f, 0.0000f, 0.0000f }, 0.3162f, 0.0430f, { 0.0000f, 0.0000f, 0.0000f }, 0.2350f, 0.4800f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_ICEPALACE_ALCOVE \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 0.2818f, 2.7600f, 1.4600f, 0.2800f, 1.1220f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1610f, 0.0900f, 0.2500f, 0.0000f, 0.9943f, 12428.5000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Space Station Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_SMALLROOM \
|
||||
{ 0.2109f, 0.7000f, 0.3162f, 0.7079f, 0.8913f, 1.7200f, 0.8200f, 0.5500f, 0.7943f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0130f, { 0.0000f, 0.0000f, 0.0000f }, 0.1880f, 0.2600f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_SHORTPASSAGE \
|
||||
{ 0.2109f, 0.8700f, 0.3162f, 0.6310f, 0.8913f, 3.5700f, 0.5000f, 0.5500f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.1720f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_MEDIUMROOM \
|
||||
{ 0.2109f, 0.7500f, 0.3162f, 0.6310f, 0.8913f, 3.0100f, 0.5000f, 0.5500f, 0.3981f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0350f, { 0.0000f, 0.0000f, 0.0000f }, 0.2090f, 0.3100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_LARGEROOM \
|
||||
{ 0.3645f, 0.8100f, 0.3162f, 0.6310f, 0.8913f, 3.8900f, 0.3800f, 0.6100f, 0.3162f, 0.0560f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0350f, { 0.0000f, 0.0000f, 0.0000f }, 0.2330f, 0.2800f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_LONGPASSAGE \
|
||||
{ 0.4287f, 0.8200f, 0.3162f, 0.6310f, 0.8913f, 4.6200f, 0.6200f, 0.5500f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0310f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2300f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_HALL \
|
||||
{ 0.4287f, 0.8700f, 0.3162f, 0.6310f, 0.8913f, 7.1100f, 0.3800f, 0.6100f, 0.1778f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0470f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2500f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_CUPBOARD \
|
||||
{ 0.1715f, 0.5600f, 0.3162f, 0.7079f, 0.8913f, 0.7900f, 0.8100f, 0.5500f, 1.4125f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.7783f, 0.0180f, { 0.0000f, 0.0000f, 0.0000f }, 0.1810f, 0.3100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPACESTATION_ALCOVE \
|
||||
{ 0.2109f, 0.7800f, 0.3162f, 0.7079f, 0.8913f, 1.1600f, 0.8100f, 0.5500f, 1.4125f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0180f, { 0.0000f, 0.0000f, 0.0000f }, 0.1920f, 0.2100f, 0.2500f, 0.0000f, 0.9943f, 3316.1001f, 458.2000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Wooden Galleon Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_SMALLROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1122f, 0.3162f, 0.7900f, 0.3200f, 0.8700f, 1.0000f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_SHORTPASSAGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1259f, 0.3162f, 1.7500f, 0.5000f, 0.8700f, 0.8913f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.6310f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_MEDIUMROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1000f, 0.2818f, 1.4700f, 0.4200f, 0.8200f, 0.8913f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_LARGEROOM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0891f, 0.2818f, 2.6500f, 0.3300f, 0.8200f, 0.8913f, 0.0660f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_LONGPASSAGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1000f, 0.3162f, 1.9900f, 0.4000f, 0.7900f, 1.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.4467f, 0.0360f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_HALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0794f, 0.2818f, 3.4500f, 0.3000f, 0.8200f, 0.8913f, 0.0880f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0630f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_CUPBOARD \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1413f, 0.3162f, 0.5600f, 0.4600f, 0.9100f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_COURTYARD \
|
||||
{ 1.0000f, 0.6500f, 0.3162f, 0.0794f, 0.3162f, 1.7900f, 0.3500f, 0.7900f, 0.5623f, 0.1230f, { 0.0000f, 0.0000f, 0.0000f }, 0.1000f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_WOODEN_ALCOVE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.1259f, 0.3162f, 1.2200f, 0.6200f, 0.9100f, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 4705.0000f, 99.6000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Sports Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_EMPTYSTADIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.4467f, 0.7943f, 6.2600f, 0.5100f, 1.1000f, 0.0631f, 0.1830f, { 0.0000f, 0.0000f, 0.0000f }, 0.3981f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_SQUASHCOURT \
|
||||
{ 1.0000f, 0.7500f, 0.3162f, 0.3162f, 0.7943f, 2.2200f, 0.9100f, 1.1600f, 0.4467f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.1260f, 0.1900f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_SMALLSWIMMINGPOOL \
|
||||
{ 1.0000f, 0.7000f, 0.3162f, 0.7943f, 0.8913f, 2.7600f, 1.2500f, 1.1400f, 0.6310f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_LARGESWIMMINGPOOL \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.7943f, 1.0000f, 5.4900f, 1.3100f, 1.1400f, 0.4467f, 0.0390f, { 0.0000f, 0.0000f, 0.0000f }, 0.5012f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2220f, 0.5500f, 1.1590f, 0.2100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_GYMNASIUM \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.4467f, 0.8913f, 3.1400f, 1.0600f, 1.3500f, 0.3981f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.5623f, 0.0450f, { 0.0000f, 0.0000f, 0.0000f }, 0.1460f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_FULLSTADIUM \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0708f, 0.7943f, 5.2500f, 0.1700f, 0.8000f, 0.1000f, 0.1880f, { 0.0000f, 0.0000f, 0.0000f }, 0.2818f, 0.0380f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SPORT_STADIUMTANNOY \
|
||||
{ 1.0000f, 0.7800f, 0.3162f, 0.5623f, 0.5012f, 2.5300f, 0.8800f, 0.6800f, 0.2818f, 0.2300f, { 0.0000f, 0.0000f, 0.0000f }, 0.5012f, 0.0630f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Prefab Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_WORKSHOP \
|
||||
{ 0.4287f, 1.0000f, 0.3162f, 0.1413f, 0.3981f, 0.7600f, 1.0000f, 1.0000f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_SCHOOLROOM \
|
||||
{ 0.4022f, 0.6900f, 0.3162f, 0.6310f, 0.5012f, 0.9800f, 0.4500f, 0.1800f, 1.4125f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.0950f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_PRACTISEROOM \
|
||||
{ 0.4022f, 0.8700f, 0.3162f, 0.3981f, 0.5012f, 1.1200f, 0.5600f, 0.1800f, 1.2589f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.0950f, 0.1400f, 0.2500f, 0.0000f, 0.9943f, 7176.8999f, 211.2000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_OUTHOUSE \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.1122f, 0.1585f, 1.3800f, 0.3800f, 0.3500f, 0.8913f, 0.0240f, { 0.0000f, 0.0000f, -0.0000f }, 0.6310f, 0.0440f, { 0.0000f, 0.0000f, 0.0000f }, 0.1210f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PREFAB_CARAVAN \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.0891f, 0.1259f, 0.4300f, 1.5000f, 1.0000f, 1.0000f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 1.9953f, 0.0120f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Dome and Pipe Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DOME_TOMB \
|
||||
{ 1.0000f, 0.7900f, 0.3162f, 0.3548f, 0.2239f, 4.1800f, 0.2100f, 0.1000f, 0.3868f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 1.6788f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.1770f, 0.1900f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_SMALL \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3548f, 0.2239f, 5.0400f, 0.1000f, 0.1000f, 0.5012f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 2.5119f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DOME_SAINTPAULS \
|
||||
{ 1.0000f, 0.8700f, 0.3162f, 0.3548f, 0.2239f, 10.4800f, 0.1900f, 0.1000f, 0.1778f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0420f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1200f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_LONGTHIN \
|
||||
{ 0.2560f, 0.9100f, 0.3162f, 0.4467f, 0.2818f, 9.2100f, 0.1800f, 0.1000f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_LARGE \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.3548f, 0.2239f, 8.4500f, 0.1000f, 0.1000f, 0.3981f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_PIPE_RESONANT \
|
||||
{ 0.1373f, 0.9100f, 0.3162f, 0.4467f, 0.2818f, 6.8100f, 0.1800f, 0.1000f, 0.7079f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.0000f, 0.0220f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 20.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Outdoors Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_BACKYARD \
|
||||
{ 1.0000f, 0.4500f, 0.3162f, 0.2512f, 0.5012f, 1.1200f, 0.3400f, 0.4600f, 0.4467f, 0.0690f, { 0.0000f, 0.0000f, -0.0000f }, 0.7079f, 0.0230f, { 0.0000f, 0.0000f, 0.0000f }, 0.2180f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_ROLLINGPLAINS \
|
||||
{ 1.0000f, 0.0000f, 0.3162f, 0.0112f, 0.6310f, 2.1300f, 0.2100f, 0.4600f, 0.1778f, 0.3000f, { 0.0000f, 0.0000f, -0.0000f }, 0.4467f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_DEEPCANYON \
|
||||
{ 1.0000f, 0.7400f, 0.3162f, 0.1778f, 0.6310f, 3.8900f, 0.2100f, 0.4600f, 0.3162f, 0.2230f, { 0.0000f, 0.0000f, -0.0000f }, 0.3548f, 0.0190f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_CREEK \
|
||||
{ 1.0000f, 0.3500f, 0.3162f, 0.1778f, 0.5012f, 2.1300f, 0.2100f, 0.4600f, 0.3981f, 0.1150f, { 0.0000f, 0.0000f, -0.0000f }, 0.1995f, 0.0310f, { 0.0000f, 0.0000f, 0.0000f }, 0.2180f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 4399.1001f, 242.9000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_OUTDOORS_VALLEY \
|
||||
{ 1.0000f, 0.2800f, 0.3162f, 0.0282f, 0.1585f, 2.8800f, 0.2600f, 0.3500f, 0.1413f, 0.2630f, { 0.0000f, 0.0000f, -0.0000f }, 0.3981f, 0.1000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.3400f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Mood Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_HEAVEN \
|
||||
{ 1.0000f, 0.9400f, 0.3162f, 0.7943f, 0.4467f, 5.0400f, 1.1200f, 0.5600f, 0.2427f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0290f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0800f, 2.7420f, 0.0500f, 0.9977f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_HELL \
|
||||
{ 1.0000f, 0.5700f, 0.3162f, 0.3548f, 0.4467f, 3.5700f, 0.4900f, 2.0000f, 0.0000f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1100f, 0.0400f, 2.1090f, 0.5200f, 0.9943f, 5000.0000f, 139.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_MOOD_MEMORY \
|
||||
{ 1.0000f, 0.8500f, 0.3162f, 0.6310f, 0.3548f, 4.0600f, 0.8200f, 0.5600f, 0.0398f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.1220f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.4740f, 0.4500f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
/* Driving Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \
|
||||
{ 1.0000f, 0.0000f, 3.1623f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_PITGARAGE \
|
||||
{ 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_RACER \
|
||||
{ 0.0832f, 0.8000f, 0.3162f, 1.0000f, 0.7943f, 0.1700f, 2.0000f, 0.4100f, 1.7783f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0150f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_SPORTS \
|
||||
{ 0.0832f, 0.8000f, 0.3162f, 0.6310f, 1.0000f, 0.1700f, 0.7500f, 0.4100f, 1.0000f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_INCAR_LUXURY \
|
||||
{ 0.2560f, 1.0000f, 0.3162f, 0.1000f, 0.5012f, 0.1300f, 0.4100f, 0.4600f, 0.7943f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 1.5849f, 0.0100f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10268.2002f, 251.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_FULLGRANDSTAND \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 0.2818f, 0.6310f, 3.0100f, 1.3700f, 1.2800f, 0.3548f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 0.1778f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10420.2002f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_EMPTYGRANDSTAND \
|
||||
{ 1.0000f, 1.0000f, 0.3162f, 1.0000f, 0.7943f, 4.6200f, 1.7500f, 1.4000f, 0.2082f, 0.0900f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.0000f, 0.9943f, 10420.2002f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_DRIVING_TUNNEL \
|
||||
{ 1.0000f, 0.8100f, 0.3162f, 0.3981f, 0.8913f, 3.4200f, 0.9400f, 1.3100f, 0.7079f, 0.0510f, { 0.0000f, 0.0000f, 0.0000f }, 0.7079f, 0.0470f, { 0.0000f, 0.0000f, 0.0000f }, 0.2140f, 0.0500f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 155.3000f, 0.0000f, 0x1 }
|
||||
|
||||
/* City Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_STREETS \
|
||||
{ 1.0000f, 0.7800f, 0.3162f, 0.7079f, 0.8913f, 1.7900f, 1.1200f, 0.9100f, 0.2818f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 0.1995f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_SUBWAY \
|
||||
{ 1.0000f, 0.7400f, 0.3162f, 0.7079f, 0.8913f, 3.0100f, 1.2300f, 0.9100f, 0.7079f, 0.0460f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0280f, { 0.0000f, 0.0000f, 0.0000f }, 0.1250f, 0.2100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_MUSEUM \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.1778f, 0.1778f, 3.2800f, 1.4000f, 0.5700f, 0.2512f, 0.0390f, { 0.0000f, 0.0000f, -0.0000f }, 0.8913f, 0.0340f, { 0.0000f, 0.0000f, 0.0000f }, 0.1300f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_LIBRARY \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.2818f, 0.0891f, 2.7600f, 0.8900f, 0.4100f, 0.3548f, 0.0290f, { 0.0000f, 0.0000f, -0.0000f }, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 0.1300f, 0.1700f, 0.2500f, 0.0000f, 0.9943f, 2854.3999f, 107.5000f, 0.0000f, 0x0 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_UNDERPASS \
|
||||
{ 1.0000f, 0.8200f, 0.3162f, 0.4467f, 0.8913f, 3.5700f, 1.1200f, 0.9100f, 0.3981f, 0.0590f, { 0.0000f, 0.0000f, 0.0000f }, 0.8913f, 0.0370f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1400f, 0.2500f, 0.0000f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CITY_ABANDONED \
|
||||
{ 1.0000f, 0.6900f, 0.3162f, 0.7943f, 0.8913f, 3.2800f, 1.1700f, 0.9100f, 0.4467f, 0.0440f, { 0.0000f, 0.0000f, 0.0000f }, 0.2818f, 0.0240f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.2000f, 0.2500f, 0.0000f, 0.9966f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
/* Misc. Presets */
|
||||
|
||||
#define EFX_REVERB_PRESET_DUSTYROOM \
|
||||
{ 0.3645f, 0.5600f, 0.3162f, 0.7943f, 0.7079f, 1.7900f, 0.3800f, 0.2100f, 0.5012f, 0.0020f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0060f, { 0.0000f, 0.0000f, 0.0000f }, 0.2020f, 0.0500f, 0.2500f, 0.0000f, 0.9886f, 13046.0000f, 163.3000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_CHAPEL \
|
||||
{ 1.0000f, 0.8400f, 0.3162f, 0.5623f, 1.0000f, 4.6200f, 0.6400f, 1.2300f, 0.4467f, 0.0320f, { 0.0000f, 0.0000f, 0.0000f }, 0.7943f, 0.0490f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 0.2500f, 0.1100f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
|
||||
|
||||
#define EFX_REVERB_PRESET_SMALLWATERROOM \
|
||||
{ 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
|
||||
|
||||
#endif /* EFX_PRESETS_H */
|
||||
@@ -0,0 +1,761 @@
|
||||
#ifndef AL_EFX_H
|
||||
#define AL_EFX_H
|
||||
|
||||
|
||||
#include "alc.h"
|
||||
#include "al.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
|
||||
|
||||
#define ALC_EFX_MAJOR_VERSION 0x20001
|
||||
#define ALC_EFX_MINOR_VERSION 0x20002
|
||||
#define ALC_MAX_AUXILIARY_SENDS 0x20003
|
||||
|
||||
|
||||
/* Listener properties. */
|
||||
#define AL_METERS_PER_UNIT 0x20004
|
||||
|
||||
/* Source properties. */
|
||||
#define AL_DIRECT_FILTER 0x20005
|
||||
#define AL_AUXILIARY_SEND_FILTER 0x20006
|
||||
#define AL_AIR_ABSORPTION_FACTOR 0x20007
|
||||
#define AL_ROOM_ROLLOFF_FACTOR 0x20008
|
||||
#define AL_CONE_OUTER_GAINHF 0x20009
|
||||
#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
|
||||
#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
|
||||
#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
|
||||
|
||||
|
||||
/* Effect properties. */
|
||||
|
||||
/* Reverb effect parameters */
|
||||
#define AL_REVERB_DENSITY 0x0001
|
||||
#define AL_REVERB_DIFFUSION 0x0002
|
||||
#define AL_REVERB_GAIN 0x0003
|
||||
#define AL_REVERB_GAINHF 0x0004
|
||||
#define AL_REVERB_DECAY_TIME 0x0005
|
||||
#define AL_REVERB_DECAY_HFRATIO 0x0006
|
||||
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
|
||||
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
|
||||
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
|
||||
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
|
||||
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
|
||||
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
|
||||
#define AL_REVERB_DECAY_HFLIMIT 0x000D
|
||||
|
||||
/* EAX Reverb effect parameters */
|
||||
#define AL_EAXREVERB_DENSITY 0x0001
|
||||
#define AL_EAXREVERB_DIFFUSION 0x0002
|
||||
#define AL_EAXREVERB_GAIN 0x0003
|
||||
#define AL_EAXREVERB_GAINHF 0x0004
|
||||
#define AL_EAXREVERB_GAINLF 0x0005
|
||||
#define AL_EAXREVERB_DECAY_TIME 0x0006
|
||||
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
|
||||
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
|
||||
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
|
||||
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
|
||||
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
|
||||
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
|
||||
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
|
||||
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
|
||||
#define AL_EAXREVERB_ECHO_TIME 0x000F
|
||||
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
|
||||
#define AL_EAXREVERB_MODULATION_TIME 0x0011
|
||||
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
|
||||
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
|
||||
#define AL_EAXREVERB_HFREFERENCE 0x0014
|
||||
#define AL_EAXREVERB_LFREFERENCE 0x0015
|
||||
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
|
||||
#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
|
||||
|
||||
/* Chorus effect parameters */
|
||||
#define AL_CHORUS_WAVEFORM 0x0001
|
||||
#define AL_CHORUS_PHASE 0x0002
|
||||
#define AL_CHORUS_RATE 0x0003
|
||||
#define AL_CHORUS_DEPTH 0x0004
|
||||
#define AL_CHORUS_FEEDBACK 0x0005
|
||||
#define AL_CHORUS_DELAY 0x0006
|
||||
|
||||
/* Distortion effect parameters */
|
||||
#define AL_DISTORTION_EDGE 0x0001
|
||||
#define AL_DISTORTION_GAIN 0x0002
|
||||
#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
|
||||
#define AL_DISTORTION_EQCENTER 0x0004
|
||||
#define AL_DISTORTION_EQBANDWIDTH 0x0005
|
||||
|
||||
/* Echo effect parameters */
|
||||
#define AL_ECHO_DELAY 0x0001
|
||||
#define AL_ECHO_LRDELAY 0x0002
|
||||
#define AL_ECHO_DAMPING 0x0003
|
||||
#define AL_ECHO_FEEDBACK 0x0004
|
||||
#define AL_ECHO_SPREAD 0x0005
|
||||
|
||||
/* Flanger effect parameters */
|
||||
#define AL_FLANGER_WAVEFORM 0x0001
|
||||
#define AL_FLANGER_PHASE 0x0002
|
||||
#define AL_FLANGER_RATE 0x0003
|
||||
#define AL_FLANGER_DEPTH 0x0004
|
||||
#define AL_FLANGER_FEEDBACK 0x0005
|
||||
#define AL_FLANGER_DELAY 0x0006
|
||||
|
||||
/* Frequency shifter effect parameters */
|
||||
#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
|
||||
#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
|
||||
#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
|
||||
|
||||
/* Vocal morpher effect parameters */
|
||||
#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
|
||||
#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
|
||||
#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
|
||||
#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
|
||||
#define AL_VOCAL_MORPHER_RATE 0x0006
|
||||
|
||||
/* Pitchshifter effect parameters */
|
||||
#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
|
||||
#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
|
||||
|
||||
/* Ringmodulator effect parameters */
|
||||
#define AL_RING_MODULATOR_FREQUENCY 0x0001
|
||||
#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
|
||||
#define AL_RING_MODULATOR_WAVEFORM 0x0003
|
||||
|
||||
/* Autowah effect parameters */
|
||||
#define AL_AUTOWAH_ATTACK_TIME 0x0001
|
||||
#define AL_AUTOWAH_RELEASE_TIME 0x0002
|
||||
#define AL_AUTOWAH_RESONANCE 0x0003
|
||||
#define AL_AUTOWAH_PEAK_GAIN 0x0004
|
||||
|
||||
/* Compressor effect parameters */
|
||||
#define AL_COMPRESSOR_ONOFF 0x0001
|
||||
|
||||
/* Equalizer effect parameters */
|
||||
#define AL_EQUALIZER_LOW_GAIN 0x0001
|
||||
#define AL_EQUALIZER_LOW_CUTOFF 0x0002
|
||||
#define AL_EQUALIZER_MID1_GAIN 0x0003
|
||||
#define AL_EQUALIZER_MID1_CENTER 0x0004
|
||||
#define AL_EQUALIZER_MID1_WIDTH 0x0005
|
||||
#define AL_EQUALIZER_MID2_GAIN 0x0006
|
||||
#define AL_EQUALIZER_MID2_CENTER 0x0007
|
||||
#define AL_EQUALIZER_MID2_WIDTH 0x0008
|
||||
#define AL_EQUALIZER_HIGH_GAIN 0x0009
|
||||
#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
|
||||
|
||||
/* Effect type */
|
||||
#define AL_EFFECT_FIRST_PARAMETER 0x0000
|
||||
#define AL_EFFECT_LAST_PARAMETER 0x8000
|
||||
#define AL_EFFECT_TYPE 0x8001
|
||||
|
||||
/* Effect types, used with the AL_EFFECT_TYPE property */
|
||||
#define AL_EFFECT_NULL 0x0000
|
||||
#define AL_EFFECT_REVERB 0x0001
|
||||
#define AL_EFFECT_CHORUS 0x0002
|
||||
#define AL_EFFECT_DISTORTION 0x0003
|
||||
#define AL_EFFECT_ECHO 0x0004
|
||||
#define AL_EFFECT_FLANGER 0x0005
|
||||
#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
|
||||
#define AL_EFFECT_VOCAL_MORPHER 0x0007
|
||||
#define AL_EFFECT_PITCH_SHIFTER 0x0008
|
||||
#define AL_EFFECT_RING_MODULATOR 0x0009
|
||||
#define AL_EFFECT_AUTOWAH 0x000A
|
||||
#define AL_EFFECT_COMPRESSOR 0x000B
|
||||
#define AL_EFFECT_EQUALIZER 0x000C
|
||||
#define AL_EFFECT_EAXREVERB 0x8000
|
||||
|
||||
/* Auxiliary Effect Slot properties. */
|
||||
#define AL_EFFECTSLOT_EFFECT 0x0001
|
||||
#define AL_EFFECTSLOT_GAIN 0x0002
|
||||
#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
|
||||
|
||||
/* NULL Auxiliary Slot ID to disable a source send. */
|
||||
#define AL_EFFECTSLOT_NULL 0x0000
|
||||
|
||||
|
||||
/* Filter properties. */
|
||||
|
||||
/* Lowpass filter parameters */
|
||||
#define AL_LOWPASS_GAIN 0x0001
|
||||
#define AL_LOWPASS_GAINHF 0x0002
|
||||
|
||||
/* Highpass filter parameters */
|
||||
#define AL_HIGHPASS_GAIN 0x0001
|
||||
#define AL_HIGHPASS_GAINLF 0x0002
|
||||
|
||||
/* Bandpass filter parameters */
|
||||
#define AL_BANDPASS_GAIN 0x0001
|
||||
#define AL_BANDPASS_GAINLF 0x0002
|
||||
#define AL_BANDPASS_GAINHF 0x0003
|
||||
|
||||
/* Filter type */
|
||||
#define AL_FILTER_FIRST_PARAMETER 0x0000
|
||||
#define AL_FILTER_LAST_PARAMETER 0x8000
|
||||
#define AL_FILTER_TYPE 0x8001
|
||||
|
||||
/* Filter types, used with the AL_FILTER_TYPE property */
|
||||
#define AL_FILTER_NULL 0x0000
|
||||
#define AL_FILTER_LOWPASS 0x0001
|
||||
#define AL_FILTER_HIGHPASS 0x0002
|
||||
#define AL_FILTER_BANDPASS 0x0003
|
||||
|
||||
|
||||
/* Effect object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
/* Filter object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
/* Auxiliary Effect Slot object function types. */
|
||||
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
|
||||
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*);
|
||||
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
|
||||
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
|
||||
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
|
||||
|
||||
#ifdef AL_ALEXT_PROTOTYPES
|
||||
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects);
|
||||
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
|
||||
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
|
||||
|
||||
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters);
|
||||
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
|
||||
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
|
||||
|
||||
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
|
||||
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots);
|
||||
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
|
||||
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
|
||||
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
|
||||
#endif
|
||||
|
||||
/* Filter ranges and defaults. */
|
||||
|
||||
/* Lowpass filter */
|
||||
#define AL_LOWPASS_MIN_GAIN (0.0f)
|
||||
#define AL_LOWPASS_MAX_GAIN (1.0f)
|
||||
#define AL_LOWPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_LOWPASS_MIN_GAINHF (0.0f)
|
||||
#define AL_LOWPASS_MAX_GAINHF (1.0f)
|
||||
#define AL_LOWPASS_DEFAULT_GAINHF (1.0f)
|
||||
|
||||
/* Highpass filter */
|
||||
#define AL_HIGHPASS_MIN_GAIN (0.0f)
|
||||
#define AL_HIGHPASS_MAX_GAIN (1.0f)
|
||||
#define AL_HIGHPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_HIGHPASS_MIN_GAINLF (0.0f)
|
||||
#define AL_HIGHPASS_MAX_GAINLF (1.0f)
|
||||
#define AL_HIGHPASS_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
/* Bandpass filter */
|
||||
#define AL_BANDPASS_MIN_GAIN (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAIN (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAIN (1.0f)
|
||||
|
||||
#define AL_BANDPASS_MIN_GAINHF (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAINHF (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAINHF (1.0f)
|
||||
|
||||
#define AL_BANDPASS_MIN_GAINLF (0.0f)
|
||||
#define AL_BANDPASS_MAX_GAINLF (1.0f)
|
||||
#define AL_BANDPASS_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
|
||||
/* Effect parameter ranges and defaults. */
|
||||
|
||||
/* Standard reverb effect */
|
||||
#define AL_REVERB_MIN_DENSITY (0.0f)
|
||||
#define AL_REVERB_MAX_DENSITY (1.0f)
|
||||
#define AL_REVERB_DEFAULT_DENSITY (1.0f)
|
||||
|
||||
#define AL_REVERB_MIN_DIFFUSION (0.0f)
|
||||
#define AL_REVERB_MAX_DIFFUSION (1.0f)
|
||||
#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
|
||||
|
||||
#define AL_REVERB_MIN_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_GAIN (1.0f)
|
||||
#define AL_REVERB_DEFAULT_GAIN (0.32f)
|
||||
|
||||
#define AL_REVERB_MIN_GAINHF (0.0f)
|
||||
#define AL_REVERB_MAX_GAINHF (1.0f)
|
||||
#define AL_REVERB_DEFAULT_GAINHF (0.89f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_TIME (0.1f)
|
||||
#define AL_REVERB_MAX_DECAY_TIME (20.0f)
|
||||
#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
|
||||
#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
|
||||
#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
|
||||
|
||||
#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
|
||||
#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
|
||||
|
||||
#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
|
||||
#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
|
||||
#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
|
||||
|
||||
#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
|
||||
#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
|
||||
#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
|
||||
|
||||
#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
|
||||
#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
|
||||
#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
|
||||
|
||||
#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
|
||||
#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
|
||||
#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
|
||||
|
||||
#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
|
||||
#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
|
||||
#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
|
||||
|
||||
/* EAX reverb effect */
|
||||
#define AL_EAXREVERB_MIN_DENSITY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_DENSITY (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
|
||||
#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAIN (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAINHF (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAINHF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_GAINLF (0.0f)
|
||||
#define AL_EAXREVERB_MAX_GAINLF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
|
||||
#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
|
||||
|
||||
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
|
||||
#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
|
||||
#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
|
||||
|
||||
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
|
||||
#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
|
||||
#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
|
||||
#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
|
||||
#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
|
||||
#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
|
||||
#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
|
||||
#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
|
||||
#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
|
||||
#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
|
||||
#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
|
||||
|
||||
/* Chorus effect */
|
||||
#define AL_CHORUS_WAVEFORM_SINUSOID (0)
|
||||
#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
|
||||
|
||||
#define AL_CHORUS_MIN_WAVEFORM (0)
|
||||
#define AL_CHORUS_MAX_WAVEFORM (1)
|
||||
#define AL_CHORUS_DEFAULT_WAVEFORM (1)
|
||||
|
||||
#define AL_CHORUS_MIN_PHASE (-180)
|
||||
#define AL_CHORUS_MAX_PHASE (180)
|
||||
#define AL_CHORUS_DEFAULT_PHASE (90)
|
||||
|
||||
#define AL_CHORUS_MIN_RATE (0.0f)
|
||||
#define AL_CHORUS_MAX_RATE (10.0f)
|
||||
#define AL_CHORUS_DEFAULT_RATE (1.1f)
|
||||
|
||||
#define AL_CHORUS_MIN_DEPTH (0.0f)
|
||||
#define AL_CHORUS_MAX_DEPTH (1.0f)
|
||||
#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
|
||||
|
||||
#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
|
||||
#define AL_CHORUS_MAX_FEEDBACK (1.0f)
|
||||
#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
|
||||
|
||||
#define AL_CHORUS_MIN_DELAY (0.0f)
|
||||
#define AL_CHORUS_MAX_DELAY (0.016f)
|
||||
#define AL_CHORUS_DEFAULT_DELAY (0.016f)
|
||||
|
||||
/* Distortion effect */
|
||||
#define AL_DISTORTION_MIN_EDGE (0.0f)
|
||||
#define AL_DISTORTION_MAX_EDGE (1.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
|
||||
|
||||
#define AL_DISTORTION_MIN_GAIN (0.01f)
|
||||
#define AL_DISTORTION_MAX_GAIN (1.0f)
|
||||
#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
|
||||
|
||||
#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
|
||||
#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
|
||||
|
||||
#define AL_DISTORTION_MIN_EQCENTER (80.0f)
|
||||
#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
|
||||
|
||||
#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
|
||||
#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
|
||||
#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
|
||||
|
||||
/* Echo effect */
|
||||
#define AL_ECHO_MIN_DELAY (0.0f)
|
||||
#define AL_ECHO_MAX_DELAY (0.207f)
|
||||
#define AL_ECHO_DEFAULT_DELAY (0.1f)
|
||||
|
||||
#define AL_ECHO_MIN_LRDELAY (0.0f)
|
||||
#define AL_ECHO_MAX_LRDELAY (0.404f)
|
||||
#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
|
||||
|
||||
#define AL_ECHO_MIN_DAMPING (0.0f)
|
||||
#define AL_ECHO_MAX_DAMPING (0.99f)
|
||||
#define AL_ECHO_DEFAULT_DAMPING (0.5f)
|
||||
|
||||
#define AL_ECHO_MIN_FEEDBACK (0.0f)
|
||||
#define AL_ECHO_MAX_FEEDBACK (1.0f)
|
||||
#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
|
||||
|
||||
#define AL_ECHO_MIN_SPREAD (-1.0f)
|
||||
#define AL_ECHO_MAX_SPREAD (1.0f)
|
||||
#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
|
||||
|
||||
/* Flanger effect */
|
||||
#define AL_FLANGER_WAVEFORM_SINUSOID (0)
|
||||
#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
|
||||
|
||||
#define AL_FLANGER_MIN_WAVEFORM (0)
|
||||
#define AL_FLANGER_MAX_WAVEFORM (1)
|
||||
#define AL_FLANGER_DEFAULT_WAVEFORM (1)
|
||||
|
||||
#define AL_FLANGER_MIN_PHASE (-180)
|
||||
#define AL_FLANGER_MAX_PHASE (180)
|
||||
#define AL_FLANGER_DEFAULT_PHASE (0)
|
||||
|
||||
#define AL_FLANGER_MIN_RATE (0.0f)
|
||||
#define AL_FLANGER_MAX_RATE (10.0f)
|
||||
#define AL_FLANGER_DEFAULT_RATE (0.27f)
|
||||
|
||||
#define AL_FLANGER_MIN_DEPTH (0.0f)
|
||||
#define AL_FLANGER_MAX_DEPTH (1.0f)
|
||||
#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
|
||||
|
||||
#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
|
||||
#define AL_FLANGER_MAX_FEEDBACK (1.0f)
|
||||
#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
|
||||
|
||||
#define AL_FLANGER_MIN_DELAY (0.0f)
|
||||
#define AL_FLANGER_MAX_DELAY (0.004f)
|
||||
#define AL_FLANGER_DEFAULT_DELAY (0.002f)
|
||||
|
||||
/* Frequency shifter effect */
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
|
||||
#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
|
||||
|
||||
#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
|
||||
#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
|
||||
#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
|
||||
|
||||
/* Vocal morpher effect */
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
|
||||
#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_PHONEME_A (0)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_E (1)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_I (2)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_O (3)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_U (4)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AA (5)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AE (6)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AH (7)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_AO (8)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_EH (9)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_ER (10)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_IH (11)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_IY (12)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_UH (13)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_UW (14)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_B (15)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_D (16)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_F (17)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_G (18)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_J (19)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_K (20)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_L (21)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_M (22)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_N (23)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_P (24)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_R (25)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_S (26)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_T (27)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_V (28)
|
||||
#define AL_VOCAL_MORPHER_PHONEME_Z (29)
|
||||
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
|
||||
#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
|
||||
#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
|
||||
|
||||
#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
|
||||
#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
|
||||
#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
|
||||
|
||||
/* Pitch shifter effect */
|
||||
#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
|
||||
#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
|
||||
#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
|
||||
|
||||
#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
|
||||
#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
|
||||
#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
|
||||
|
||||
/* Ring modulator effect */
|
||||
#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
|
||||
#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
|
||||
#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
|
||||
|
||||
#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
|
||||
#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
|
||||
#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
|
||||
|
||||
#define AL_RING_MODULATOR_SINUSOID (0)
|
||||
#define AL_RING_MODULATOR_SAWTOOTH (1)
|
||||
#define AL_RING_MODULATOR_SQUARE (2)
|
||||
|
||||
#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
|
||||
#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
|
||||
#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
|
||||
|
||||
/* Autowah effect */
|
||||
#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
|
||||
#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
|
||||
#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
|
||||
#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
|
||||
|
||||
#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
|
||||
#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
|
||||
#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
|
||||
|
||||
/* Compressor effect */
|
||||
#define AL_COMPRESSOR_MIN_ONOFF (0)
|
||||
#define AL_COMPRESSOR_MAX_ONOFF (1)
|
||||
#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
|
||||
|
||||
/* Equalizer effect */
|
||||
#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
|
||||
#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
|
||||
#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
|
||||
#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
|
||||
#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
|
||||
#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
|
||||
#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
|
||||
#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
|
||||
|
||||
#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
|
||||
#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
|
||||
#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
|
||||
|
||||
|
||||
/* Source parameter value ranges and defaults. */
|
||||
#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
|
||||
#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
|
||||
#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
|
||||
|
||||
#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
|
||||
#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
|
||||
|
||||
#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
|
||||
#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
|
||||
#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
|
||||
|
||||
#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
|
||||
#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
|
||||
|
||||
#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
|
||||
#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
|
||||
|
||||
#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
|
||||
#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
|
||||
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
|
||||
|
||||
|
||||
/* Listener parameter value ranges and defaults. */
|
||||
#define AL_MIN_METERS_PER_UNIT FLT_MIN
|
||||
#define AL_MAX_METERS_PER_UNIT FLT_MAX
|
||||
#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AL_EFX_H */
|
||||
@@ -1,4 +1,36 @@
|
||||
rpcs3
|
||||
RPCS3
|
||||
=====
|
||||
|
||||
PS3 emulator/debugger
|
||||
[](https://travis-ci.org/DHrpcs3/rpcs3)
|
||||
|
||||
An open-source PlayStation 3 emulator/debugger written in C++.
|
||||
|
||||
You can find some basic information in the [FAQ](https://github.com/DHrpcs3/rpcs3/wiki/FAQ). For discussion about this emulator and PS3 emulation please visit the [official forums](http://www.emunewz.net/forum/forumdisplay.php?fid=162).
|
||||
|
||||
|
||||
### Development
|
||||
|
||||
If you want to contribute please take a took at the [Coding Style](https://github.com/DHrpcs3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/DHrpcs3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/DHrpcs3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
__Windows__
|
||||
* [Visual C++ Redistributable Packages for Visual Studio 2013](http://www.microsoft.com/en-us/download/details.aspx?id=40784)
|
||||
* [OpenAL binaries](http://kcat.strangesoft.net/openal.html): download and copy `Win64\soft_oal.dll` to `rpcs3\bin\`
|
||||
|
||||
__Linux__
|
||||
* Debian & Ubuntu: `sudo apt-get install libopenal-dev libwxgtk3.0-dev build-essential`
|
||||
|
||||
__Mac OSX__
|
||||
* Install with Homebrew: `brew install glew wxwidgets`
|
||||
* Remove '-framework QuickTime' from '_ldflags' in /usr/local/bin/wx-config
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
To initialize the repository don't forget to execute `git submodule update --init` to pull the wxWidgets source.
|
||||
* __Windows__: Install *Visual Studio 2013*. Then open the *.SLN* file, and press *Build* > *Rebuild Solution*.
|
||||
* __Linux & Mac OSX__:
|
||||
`cd rpcs3 && cmake CMakeLists.txt && make && cd ../` Then run with `cd bin && ./rpcs3`
|
||||
|
||||
|
||||
+1
-414
@@ -1,318 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
template<typename T> class Array
|
||||
{
|
||||
protected:
|
||||
u32 m_count;
|
||||
T* m_array;
|
||||
|
||||
public:
|
||||
Array()
|
||||
: m_count(0)
|
||||
, m_array(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
~Array()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
inline bool RemoveAt(const u32 from, const u32 count = 1)
|
||||
{
|
||||
if(!GetCount()) return false;
|
||||
const u32 to = from + count;
|
||||
if(to > GetCount()) return false;
|
||||
|
||||
for(u32 i=0; i<count; ++i) m_array[from + i].~T();
|
||||
memmove(m_array + from, m_array + to, (m_count-to) * sizeof(T));
|
||||
m_count -= count;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InsertRoomEnd(const u32 size)
|
||||
{
|
||||
_InsertRoomEnd(size);
|
||||
}
|
||||
|
||||
bool InsertRoom(const u32 pos, const u32 size)
|
||||
{
|
||||
if(pos >= m_count) return false;
|
||||
|
||||
_InsertRoomEnd(size);
|
||||
memmove(m_array + pos + size, m_array + pos, sizeof(T) * (m_count - size - pos));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool Move(const u32 pos, T* data)
|
||||
{
|
||||
if(!InsertRoom(pos, 1)) return false;
|
||||
|
||||
memcpy(m_array + pos, data, sizeof(T));
|
||||
free(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline u32 Move(T* data)
|
||||
{
|
||||
_InsertRoomEnd(1);
|
||||
|
||||
memcpy(m_array + GetCount() - 1, data, sizeof(T));
|
||||
free(data);
|
||||
|
||||
return m_count - 1;
|
||||
}
|
||||
|
||||
inline bool Add(const u32 pos, T*& data)
|
||||
{
|
||||
if(!InsertRoom(pos, 1)) return false;
|
||||
|
||||
memcpy(m_array + pos, data, sizeof(T));
|
||||
free(data);
|
||||
data = m_array + pos;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline u32 Add(T*& data)
|
||||
{
|
||||
_InsertRoomEnd(1);
|
||||
|
||||
memcpy(m_array + GetCount() - 1, data, sizeof(T));
|
||||
free(data);
|
||||
data = m_array + GetCount() - 1;
|
||||
|
||||
return m_count - 1;
|
||||
}
|
||||
|
||||
inline bool AddCpy(const u32 pos, const T* data, u32 count = 1)
|
||||
{
|
||||
if(!InsertRoom(pos, count)) return false;
|
||||
|
||||
for(u32 i=0; i<count; ++i)
|
||||
{
|
||||
new (m_array + pos + i) T(data[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool AddCpy(const u32 pos, const T& data)
|
||||
{
|
||||
return AddCpy(pos, &data);
|
||||
}
|
||||
|
||||
inline u32 AddCpy(const T* data, u32 count = 1)
|
||||
{
|
||||
_InsertRoomEnd(count);
|
||||
|
||||
for(u32 i=0; i<count; ++i)
|
||||
{
|
||||
new (m_array + m_count - count + i) T(data[i]);
|
||||
}
|
||||
|
||||
return m_count - count;
|
||||
}
|
||||
|
||||
inline u32 AddCpy(const T& data)
|
||||
{
|
||||
return AddCpy(&data);
|
||||
}
|
||||
|
||||
inline void Clear()
|
||||
{
|
||||
u32 count = m_count;
|
||||
m_count = 0;
|
||||
for(u32 i=0; i<count; ++i) m_array[i].~T();
|
||||
safe_free(m_array);
|
||||
}
|
||||
|
||||
inline void ClearF()
|
||||
{
|
||||
m_count = 0;
|
||||
safe_free(m_array);
|
||||
}
|
||||
|
||||
inline T& Get(u32 num)
|
||||
{
|
||||
//if(num >= GetCount()) return *new T();
|
||||
return m_array[num];
|
||||
}
|
||||
|
||||
virtual u32 GetCount() const { return m_count; }
|
||||
|
||||
virtual void SetCount(const u32 count, bool memzero = true)
|
||||
{
|
||||
if(m_count >= count) return;
|
||||
|
||||
_InsertRoomEnd(count - m_count);
|
||||
|
||||
if(memzero) memset(m_array + m_count - count, 0, sizeof(T) * (m_count - count));
|
||||
}
|
||||
|
||||
void Reserve(const u32 count)
|
||||
{
|
||||
SetCount(GetCount() + count);
|
||||
}
|
||||
|
||||
void AppendFrom(const Array<T>& src)
|
||||
{
|
||||
if(!src.GetCount()) return;
|
||||
|
||||
Reserve(src.GetCount());
|
||||
|
||||
memcpy(m_array, &src[0], GetCount() * sizeof(T));
|
||||
}
|
||||
|
||||
void CopyFrom(const Array<T>& src)
|
||||
{
|
||||
Clear();
|
||||
|
||||
AppendFrom(src);
|
||||
}
|
||||
|
||||
inline T* GetPtr() { return m_array; }
|
||||
inline const T* GetPtr() const { return m_array; }
|
||||
|
||||
T& operator[](u32 num) const { return m_array[num]; }
|
||||
|
||||
T* operator + (u32 right) const
|
||||
{
|
||||
return m_array + right;
|
||||
}
|
||||
|
||||
T* operator ->()
|
||||
{
|
||||
return m_array;
|
||||
}
|
||||
|
||||
protected:
|
||||
void _InsertRoomEnd(const u32 size)
|
||||
{
|
||||
if(!size) return;
|
||||
|
||||
m_array = m_count ? (T*)realloc(m_array, sizeof(T) * (m_count + size)) : (T*)malloc(sizeof(T) * size);
|
||||
m_count += size;
|
||||
}
|
||||
};
|
||||
|
||||
class ArrayString : public Array<char>
|
||||
{
|
||||
public:
|
||||
ArrayString() : Array()
|
||||
{
|
||||
}
|
||||
|
||||
ArrayString(const wxString& value) : Array()
|
||||
{
|
||||
*this = value;
|
||||
}
|
||||
|
||||
ArrayString(const char* value) : Array()
|
||||
{
|
||||
*this = value;
|
||||
}
|
||||
|
||||
virtual u32 GetCount() const
|
||||
{
|
||||
return m_array ? strlen(m_array) : 0;
|
||||
}
|
||||
|
||||
virtual void SetCount(const u32 count, bool memzero = true)
|
||||
{
|
||||
if(m_count && count < m_count - 1)
|
||||
{
|
||||
m_array[count] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
Array::SetCount(count + 1, memzero);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayString& operator = (const char* right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(right)
|
||||
{
|
||||
size_t len = strlen(right);
|
||||
|
||||
if(len)
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right, len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString& operator = (const ArrayString& right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(size_t len = right.GetCount())
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right.GetPtr(), len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString& operator = (const wxString& right)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(size_t len = right.Len())
|
||||
{
|
||||
SetCount(len);
|
||||
memcpy(m_array, right.c_str(), len * sizeof(char));
|
||||
m_array[len] = '\0';
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayString* Clone() const
|
||||
{
|
||||
ArrayString* new_array = new ArrayString();
|
||||
(*new_array) = m_array;
|
||||
|
||||
return new_array;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct Stack : public Array<T>
|
||||
{
|
||||
Stack() : Array<T>()
|
||||
{
|
||||
}
|
||||
|
||||
~Stack()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Push(const T data) { AddCpy(data); }
|
||||
|
||||
T Pop()
|
||||
{
|
||||
const u32 pos = GetCount() - 1;
|
||||
|
||||
const T ret = Get(pos);
|
||||
RemoveAt(pos);
|
||||
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, size_t size> class SizedStack
|
||||
{
|
||||
T m_ptr[size];
|
||||
@@ -368,106 +55,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> class ArrayF
|
||||
{
|
||||
u32 m_count;
|
||||
T** m_array;
|
||||
|
||||
public:
|
||||
ArrayF()
|
||||
: m_count(0)
|
||||
, m_array(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ArrayF()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
inline bool RemoveFAt(const u32 from, const u32 count = 1)
|
||||
{
|
||||
if(from + count > m_count) return false;
|
||||
|
||||
memmove(&m_array[from], &m_array[from+count], (m_count-(from+count)) * sizeof(T**));
|
||||
|
||||
m_count -= count;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool RemoveAt(const u32 from, const u32 count = 1)
|
||||
{
|
||||
if(from + count > m_count) return false;
|
||||
|
||||
for(uint i = from; i < from + count; ++i)
|
||||
{
|
||||
free(m_array[i]);
|
||||
}
|
||||
|
||||
return RemoveFAt(from, count);
|
||||
}
|
||||
|
||||
inline u32 Add(T& data)
|
||||
{
|
||||
return Add(&data);
|
||||
}
|
||||
|
||||
inline u32 Add(T* data)
|
||||
{
|
||||
if(!m_array)
|
||||
{
|
||||
m_array = (T**)malloc(sizeof(T*));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_array = (T**)realloc(m_array, sizeof(T*) * (m_count + 1));
|
||||
}
|
||||
|
||||
m_array[m_count] = data;
|
||||
return m_count++;
|
||||
}
|
||||
|
||||
inline void ClearF()
|
||||
{
|
||||
if(m_count == 0) return;
|
||||
|
||||
m_count = 0;
|
||||
m_array = NULL;
|
||||
}
|
||||
|
||||
inline void Clear()
|
||||
{
|
||||
if(m_count == 0) return;
|
||||
|
||||
m_count = 0;
|
||||
safe_free(m_array);
|
||||
}
|
||||
|
||||
inline T& Get(const u64 num)
|
||||
{
|
||||
//if(m_count <= num) *m_array[0]; //TODO
|
||||
return *m_array[num];
|
||||
}
|
||||
|
||||
T** operator + (u32 right) const
|
||||
{
|
||||
return m_array + right;
|
||||
}
|
||||
|
||||
T* operator ->()
|
||||
{
|
||||
return *m_array;
|
||||
}
|
||||
|
||||
inline T** GetPtr()
|
||||
{
|
||||
return m_array;
|
||||
}
|
||||
|
||||
inline u32 GetCount() const { return m_count; }
|
||||
T& operator[](u32 num) const { return *m_array[num]; }
|
||||
};
|
||||
|
||||
template<typename T> struct ScopedPtr
|
||||
{
|
||||
private:
|
||||
@@ -498,4 +85,4 @@ public:
|
||||
delete m_ptr;
|
||||
m_ptr = ptr;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
#pragma once
|
||||
|
||||
#include "Utilities/GNU.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
||||
//#define re(val) MemoryBase::Reverse(val)
|
||||
#define re64(val) MemoryBase::Reverse64(val)
|
||||
#define re32(val) MemoryBase::Reverse32(val)
|
||||
#define re16(val) MemoryBase::Reverse16(val)
|
||||
|
||||
template<typename T, int size = sizeof(T)> struct se_t;
|
||||
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
|
||||
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
|
||||
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
|
||||
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
|
||||
|
||||
template<typename T> T re(const T val) { T res; se_t<T>::func(res, val); return res; }
|
||||
template<typename T1, typename T2> void re(T1& dst, const T2 val) { se_t<T1>::func(dst, val); }
|
||||
|
||||
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
|
||||
{
|
||||
static const T value = (T)_value;
|
||||
};
|
||||
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 2>
|
||||
{
|
||||
static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00);
|
||||
};
|
||||
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 4>
|
||||
{
|
||||
static const T value =
|
||||
((_value >> 24) & 0x000000ff) |
|
||||
((_value >> 8) & 0x0000ff00) |
|
||||
((_value << 8) & 0x00ff0000) |
|
||||
((_value << 24) & 0xff000000);
|
||||
};
|
||||
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 8>
|
||||
{
|
||||
static const T value =
|
||||
((_value >> 56) & 0x00000000000000ff) |
|
||||
((_value >> 40) & 0x000000000000ff00) |
|
||||
((_value >> 24) & 0x0000000000ff0000) |
|
||||
((_value >> 8) & 0x00000000ff000000) |
|
||||
((_value << 8) & 0x000000ff00000000) |
|
||||
((_value << 24) & 0x0000ff0000000000) |
|
||||
((_value << 40) & 0x00ff000000000000) |
|
||||
((_value << 56) & 0xff00000000000000);
|
||||
};
|
||||
|
||||
template<typename T, int size=sizeof(T)>
|
||||
class be_t
|
||||
{
|
||||
static_assert(size == 1 || size == 2 || size == 4 || size == 8, "Bad be_t type");
|
||||
T m_data;
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
#ifdef _WIN32
|
||||
be_t(){}
|
||||
#else
|
||||
be_t() noexcept = default;
|
||||
#endif
|
||||
|
||||
be_t(const be_t<T,size>& value) = default;
|
||||
be_t(const T& value)
|
||||
{
|
||||
FromLE(value);
|
||||
}
|
||||
|
||||
template<typename T1>
|
||||
explicit be_t(const be_t<T1>& value)
|
||||
{
|
||||
FromBE(value.ToBE());
|
||||
}
|
||||
|
||||
const T& ToBE() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
T ToLE() const
|
||||
{
|
||||
T res;
|
||||
|
||||
se_t<T>::func(res, m_data);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void FromBE(const T& value)
|
||||
{
|
||||
m_data = value;
|
||||
}
|
||||
|
||||
void FromLE(const T& value)
|
||||
{
|
||||
se_t<T>::func(m_data, value);
|
||||
}
|
||||
|
||||
static be_t MakeFromLE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromLE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
static be_t MakeFromBE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromBE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
//template<typename T1>
|
||||
operator const T() const
|
||||
{
|
||||
return ToLE();
|
||||
}
|
||||
|
||||
template<typename T1>
|
||||
operator const be_t<T1>() const
|
||||
{
|
||||
be_t<T1> res;
|
||||
res.FromBE(ToBE());
|
||||
return res;
|
||||
}
|
||||
|
||||
be_t& operator = (const T& right)
|
||||
{
|
||||
FromLE(right);
|
||||
return *this;
|
||||
}
|
||||
|
||||
be_t<T,size>& operator = (const be_t<T,size>& right) = default;
|
||||
|
||||
template<typename T1> be_t& operator += (T1 right) { return *this = T(*this) + right; }
|
||||
template<typename T1> be_t& operator -= (T1 right) { return *this = T(*this) - right; }
|
||||
template<typename T1> be_t& operator *= (T1 right) { return *this = T(*this) * right; }
|
||||
template<typename T1> be_t& operator /= (T1 right) { return *this = T(*this) / right; }
|
||||
template<typename T1> be_t& operator %= (T1 right) { return *this = T(*this) % right; }
|
||||
template<typename T1> be_t& operator &= (T1 right) { return *this = T(*this) & right; }
|
||||
template<typename T1> be_t& operator |= (T1 right) { return *this = T(*this) | right; }
|
||||
template<typename T1> be_t& operator ^= (T1 right) { return *this = T(*this) ^ right; }
|
||||
template<typename T1> be_t& operator <<= (T1 right) { return *this = T(*this) << right; }
|
||||
template<typename T1> be_t& operator >>= (T1 right) { return *this = T(*this) >> right; }
|
||||
|
||||
template<typename T1> be_t& operator += (const be_t<T1>& right) { return *this = ToLE() + right.ToLE(); }
|
||||
template<typename T1> be_t& operator -= (const be_t<T1>& right) { return *this = ToLE() - right.ToLE(); }
|
||||
template<typename T1> be_t& operator *= (const be_t<T1>& right) { return *this = ToLE() * right.ToLE(); }
|
||||
template<typename T1> be_t& operator /= (const be_t<T1>& right) { return *this = ToLE() / right.ToLE(); }
|
||||
template<typename T1> be_t& operator %= (const be_t<T1>& right) { return *this = ToLE() % right.ToLE(); }
|
||||
template<typename T1> be_t& operator &= (const be_t<T1>& right) { return *this = ToBE() & right.ToBE(); }
|
||||
template<typename T1> be_t& operator |= (const be_t<T1>& right) { return *this = ToBE() | right.ToBE(); }
|
||||
template<typename T1> be_t& operator ^= (const be_t<T1>& right) { return *this = ToBE() ^ right.ToBE(); }
|
||||
|
||||
template<typename T1> be_t operator & (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() & right.ToBE()); return res; }
|
||||
template<typename T1> be_t operator | (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() | right.ToBE()); return res; }
|
||||
template<typename T1> be_t operator ^ (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() ^ right.ToBE()); return res; }
|
||||
|
||||
template<typename T1> bool operator == (T1 right) const { return (T1)ToLE() == right; }
|
||||
template<typename T1> bool operator != (T1 right) const { return !(*this == right); }
|
||||
template<typename T1> bool operator > (T1 right) const { return (T1)ToLE() > right; }
|
||||
template<typename T1> bool operator < (T1 right) const { return (T1)ToLE() < right; }
|
||||
template<typename T1> bool operator >= (T1 right) const { return (T1)ToLE() >= right; }
|
||||
template<typename T1> bool operator <= (T1 right) const { return (T1)ToLE() <= right; }
|
||||
|
||||
template<typename T1> bool operator == (const be_t<T1>& right) const { return ToBE() == right.ToBE(); }
|
||||
template<typename T1> bool operator != (const be_t<T1>& right) const { return !(*this == right); }
|
||||
template<typename T1> bool operator > (const be_t<T1>& right) const { return (T1)ToLE() > right.ToLE(); }
|
||||
template<typename T1> bool operator < (const be_t<T1>& right) const { return (T1)ToLE() < right.ToLE(); }
|
||||
template<typename T1> bool operator >= (const be_t<T1>& right) const { return (T1)ToLE() >= right.ToLE(); }
|
||||
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
|
||||
|
||||
be_t operator++ (int) { be_t res = *this; *this += 1; return res; }
|
||||
be_t operator-- (int) { be_t res = *this; *this -= 1; return res; }
|
||||
be_t& operator++ () { *this += 1; return *this; }
|
||||
be_t& operator-- () { *this -= 1; return *this; }
|
||||
};
|
||||
|
||||
template<typename T, typename T1, T1 value> struct _se : public const_se_t<T, value> {};
|
||||
template<typename T, typename T1, T1 value> struct _se<be_t<T>, T1, value> : public const_se_t<T, value> {};
|
||||
|
||||
#define se(t, x) _se<decltype(t), decltype(x), x>::value
|
||||
#define se16(x) _se<u16, decltype(x), x>::value
|
||||
#define se32(x) _se<u32, decltype(x), x>::value
|
||||
#define se64(x) _se<u64, decltype(x), x>::value
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "GNU.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
void * _aligned_malloc(size_t size, size_t alignment) {
|
||||
void *buffer;
|
||||
posix_memalign(&buffer, alignment, size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int clock_gettime(int foo, struct timespec *ts) {
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
ts->tv_sec = tv.tv_sec;
|
||||
ts->tv_nsec = tv.tv_usec * 1000;
|
||||
return(0);
|
||||
}
|
||||
#endif /* !__APPLE__ */
|
||||
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#define thread_local __declspec(thread)
|
||||
#elif __APPLE__
|
||||
#define thread_local __thread
|
||||
#endif
|
||||
|
||||
#if defined(__GNUG__)
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define _fpclass(x) std::fpclassify(x)
|
||||
#define __forceinline __attribute__((always_inline))
|
||||
#define _byteswap_ushort(x) __builtin_bswap16(x)
|
||||
#define _byteswap_ulong(x) __builtin_bswap32(x)
|
||||
#define _byteswap_uint64(x) __builtin_bswap64(x)
|
||||
#define Sleep(x) usleep(x * 1000)
|
||||
#define mkdir(x) mkdir(x, 0777)
|
||||
#define INFINITE 0xFFFFFFFF
|
||||
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
|
||||
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
|
||||
#define InterlockedCompareExchange64(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
|
||||
|
||||
inline int64_t InterlockedOr64(volatile int64_t *dest, int64_t val)
|
||||
{
|
||||
int64_t olderval;
|
||||
int64_t oldval = *dest;
|
||||
do
|
||||
{
|
||||
olderval = oldval;
|
||||
oldval = InterlockedCompareExchange64(dest, olderval | val, olderval);
|
||||
} while (olderval != oldval);
|
||||
return oldval;
|
||||
}
|
||||
|
||||
inline uint64_t __umulh(uint64_t a, uint64_t b)
|
||||
{
|
||||
uint64_t result;
|
||||
__asm__("mulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
|
||||
return result;
|
||||
}
|
||||
|
||||
inline int64_t __mulh(int64_t a, int64_t b)
|
||||
{
|
||||
int64_t result;
|
||||
__asm__("imulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
#define _aligned_malloc(size,alignment) memalign(alignment,size)
|
||||
#else
|
||||
void * _aligned_malloc(size_t size, size_t alignment);
|
||||
int clock_gettime(int foo, struct timespec *ts);
|
||||
#define wxIsNaN(x) ((x) != (x))
|
||||
|
||||
#ifndef CLOCK_MONOTONIC
|
||||
#define CLOCK_MONOTONIC 0
|
||||
#endif /* !CLOCK_MONOTONIC */
|
||||
|
||||
#endif /* !__APPLE__ */
|
||||
|
||||
#define _aligned_free free
|
||||
|
||||
#define DWORD int32_t
|
||||
#endif
|
||||
+129
-86
@@ -1,43 +1,90 @@
|
||||
#pragma once
|
||||
#include "Array.h"
|
||||
#include <unordered_map>
|
||||
|
||||
#define rID_ANY -1 // was wxID_ANY
|
||||
|
||||
typedef u32 ID_TYPE;
|
||||
|
||||
class IDData
|
||||
{
|
||||
protected:
|
||||
void* m_ptr;
|
||||
std::function<void(void*)> m_destr;
|
||||
|
||||
public:
|
||||
IDData(void* ptr, std::function<void(void*)> destr)
|
||||
: m_ptr(ptr)
|
||||
, m_destr(destr)
|
||||
{
|
||||
}
|
||||
|
||||
~IDData()
|
||||
{
|
||||
m_destr(m_ptr);
|
||||
}
|
||||
|
||||
template<typename T> T* get()
|
||||
{
|
||||
return (T*)m_ptr;
|
||||
}
|
||||
|
||||
template<typename T> const T* get() const
|
||||
{
|
||||
return (const T*)m_ptr;
|
||||
}
|
||||
};
|
||||
|
||||
struct ID
|
||||
{
|
||||
bool m_used;
|
||||
wxString m_name;
|
||||
u8 m_attr;
|
||||
void* m_data;
|
||||
std::string m_name;
|
||||
u32 m_attr;
|
||||
IDData* m_data;
|
||||
|
||||
ID(bool used = false, const wxString& name = wxEmptyString, void* data = NULL, const u8 attr = 0)
|
||||
: m_used(used)
|
||||
, m_name(name)
|
||||
, m_data(data)
|
||||
template<typename T>
|
||||
ID(const std::string& name, T* data, const u32 attr)
|
||||
: m_name(name)
|
||||
, m_attr(attr)
|
||||
{
|
||||
m_data = new IDData(data, [](void *ptr) -> void { delete (T*)ptr; });
|
||||
}
|
||||
|
||||
ID() : m_data(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ID(ID&& other)
|
||||
{
|
||||
m_name = other.m_name;
|
||||
m_attr = other.m_attr;
|
||||
m_data = other.m_data;
|
||||
other.m_data = nullptr;
|
||||
}
|
||||
ID& operator=(ID&& other)
|
||||
{
|
||||
std::swap(m_name,other.m_name);
|
||||
std::swap(m_attr,other.m_attr);
|
||||
std::swap(m_data,other.m_data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Kill()
|
||||
{
|
||||
delete m_data;
|
||||
}
|
||||
};
|
||||
|
||||
class IdManager
|
||||
{
|
||||
ArrayF<ID> IDs;
|
||||
static const ID_TYPE s_first_id = 1;
|
||||
static const ID_TYPE s_max_id = -1;
|
||||
|
||||
static const u64 first_id = 1;
|
||||
std::unordered_map<ID_TYPE, ID> m_id_map;
|
||||
std::mutex m_mtx_main;
|
||||
|
||||
ID_TYPE m_cur_id;
|
||||
|
||||
void Cleanup()
|
||||
{
|
||||
while(IDs.GetCount())
|
||||
{
|
||||
const u32 num = IDs.GetCount()-1;
|
||||
ID& id = IDs[num];
|
||||
if(id.m_used) break;
|
||||
IDs.RemoveAt(num);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
IdManager()
|
||||
IdManager() : m_cur_id(s_first_id)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,92 +92,88 @@ public:
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
static ID_TYPE GetMaxID()
|
||||
{
|
||||
return (ID_TYPE)-1;
|
||||
}
|
||||
|
||||
bool CheckID(const u64 id)
|
||||
{
|
||||
if(id == 0 || id > (u64)NumToID(IDs.GetCount()-1) || id >= GetMaxID()) return false;
|
||||
|
||||
return IDs[IDToNum(id)].m_used;
|
||||
}
|
||||
|
||||
__forceinline const ID_TYPE NumToID(const ID_TYPE num) const
|
||||
bool CheckID(const ID_TYPE id)
|
||||
{
|
||||
return num + first_id;
|
||||
}
|
||||
|
||||
__forceinline const ID_TYPE IDToNum(const ID_TYPE id) const
|
||||
{
|
||||
return id - first_id;
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
return m_id_map.find(id) != m_id_map.end();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
IDs.Clear();
|
||||
}
|
||||
|
||||
virtual ID_TYPE GetNewID(const wxString& name = wxEmptyString, void* data = NULL, const u8 attr = 0)
|
||||
{
|
||||
for(uint i=0; i<IDs.GetCount(); ++i)
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
for(auto& i : m_id_map)
|
||||
{
|
||||
if(IDs[i].m_used) continue;
|
||||
return NumToID(i);
|
||||
i.second.Kill();
|
||||
}
|
||||
|
||||
const ID_TYPE pos = IDs.GetCount();
|
||||
if(NumToID(pos) >= GetMaxID()) return 0;
|
||||
IDs.Add(new ID(true, name, data, attr));
|
||||
return NumToID(pos);
|
||||
m_id_map.clear();
|
||||
m_cur_id = s_first_id;
|
||||
}
|
||||
|
||||
ID& GetIDData(const ID_TYPE _id)
|
||||
template<typename T
|
||||
#ifdef __GNUG__
|
||||
= char
|
||||
#endif
|
||||
>
|
||||
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u32 attr = 0)
|
||||
{
|
||||
//if(!CheckID(_id)) return IDs.Get(0); //TODO
|
||||
return IDs[IDToNum(_id)];
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
bool GetFirst(ID& dst, ID_TYPE* _id = NULL)
|
||||
m_id_map[m_cur_id] = ID(name, data, attr);
|
||||
|
||||
return m_cur_id++;
|
||||
}
|
||||
|
||||
ID& GetID(const ID_TYPE id)
|
||||
{
|
||||
u32 pos = 0;
|
||||
return GetNext(pos, dst, _id);
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
return m_id_map[id];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool GetIDData(const ID_TYPE id, T*& result)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
auto f = m_id_map.find(id);
|
||||
|
||||
if(f == m_id_map.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
result = f->second.m_data->get<T>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HasID(const s64 id)
|
||||
{
|
||||
if(id == wxID_ANY) return IDs.GetCount() != 0;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
if(id == rID_ANY)
|
||||
return m_id_map.begin() != m_id_map.end();
|
||||
}
|
||||
|
||||
return CheckID(id);
|
||||
}
|
||||
|
||||
bool GetNext(u32& pos, ID& dst, ID_TYPE* _id = NULL)
|
||||
bool RemoveID(const ID_TYPE id)
|
||||
{
|
||||
while(pos < IDs.GetCount())
|
||||
{
|
||||
ID& id = IDs[pos++];
|
||||
if(!id.m_used) continue;
|
||||
dst = id;
|
||||
if(_id) *_id = NumToID(pos - 1);
|
||||
return true;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
return false;
|
||||
}
|
||||
auto item = m_id_map.find(id);
|
||||
|
||||
if(item == m_id_map.end()) return false;
|
||||
|
||||
item->second.Kill();
|
||||
m_id_map.erase(item);
|
||||
|
||||
virtual bool RemoveID(const ID_TYPE _id, bool free_data = true)
|
||||
{
|
||||
if(!CheckID(_id)) return false;
|
||||
ID& id = IDs[IDToNum(_id)];
|
||||
if(!id.m_used) return false;
|
||||
id.m_used = false;
|
||||
id.m_attr = 0;
|
||||
id.m_name.Clear();
|
||||
if(free_data) delete id.m_data;
|
||||
id.m_data = NULL;
|
||||
if(IDToNum(_id) == IDs.GetCount()-1) Cleanup();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
template<typename T>
|
||||
struct BaseInterval
|
||||
{
|
||||
static const uint64_t zero = 0ull;
|
||||
static const uint64_t notz = 0xffffffffffffffffull;
|
||||
|
||||
T m_min, m_max;
|
||||
|
||||
static BaseInterval<T> make(T min_value, T max_value)
|
||||
{
|
||||
BaseInterval<T> res = { min_value, max_value };
|
||||
return res;
|
||||
}
|
||||
|
||||
static BaseInterval<T> make()
|
||||
{
|
||||
return make((T&)zero, (T&)notz);
|
||||
}
|
||||
|
||||
bool getconst(T& result)
|
||||
{
|
||||
if (m_min == m_max)
|
||||
{
|
||||
result = m_min;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isindef()
|
||||
{
|
||||
if (T == float)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,239 @@
|
||||
#include "stdafx.h"
|
||||
#include "Log.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
#include <array>
|
||||
|
||||
using namespace Log;
|
||||
|
||||
LogManager *gLogManager = nullptr;
|
||||
|
||||
u32 LogMessage::size()
|
||||
{
|
||||
//1 byte for NULL terminator
|
||||
return sizeof(LogMessage::size_type) + sizeof(LogType) + sizeof(LogSeverity) + sizeof(std::string::value_type)*mText.size() + 1;
|
||||
}
|
||||
|
||||
void LogMessage::serialize(char *output)
|
||||
{
|
||||
LogMessage::size_type size = this->size();
|
||||
memcpy(output, &size, sizeof(LogMessage::size_type));
|
||||
output += sizeof(LogMessage::size_type);
|
||||
memcpy(output, &mType, sizeof(LogType));
|
||||
output += sizeof(LogType);
|
||||
memcpy(output, &mServerity, sizeof(LogSeverity));
|
||||
output += sizeof(LogSeverity);
|
||||
memcpy(output, mText.c_str(), mText.size() );
|
||||
output += sizeof(std::string::value_type)*mText.size();
|
||||
*output = '\0';
|
||||
|
||||
}
|
||||
LogMessage LogMessage::deserialize(char *input, u32* size_out)
|
||||
{
|
||||
LogMessage msg;
|
||||
LogMessage::size_type msgSize = *(reinterpret_cast<LogMessage::size_type*>(input));
|
||||
input += sizeof(LogMessage::size_type);
|
||||
msg.mType = *(reinterpret_cast<LogType*>(input));
|
||||
input += sizeof(LogType);
|
||||
msg.mServerity = *(reinterpret_cast<LogSeverity*>(input));
|
||||
input += sizeof(LogSeverity);
|
||||
if (msgSize > 9000)
|
||||
{
|
||||
int wtf = 6;
|
||||
}
|
||||
msg.mText.append(input, msgSize - 1 - sizeof(LogSeverity) - sizeof(LogType));
|
||||
if (size_out){(*size_out) = msgSize;}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LogChannel::LogChannel() : LogChannel("unknown")
|
||||
{}
|
||||
|
||||
LogChannel::LogChannel(const std::string& name) :
|
||||
name(name)
|
||||
, mEnabled(true)
|
||||
, mLogLevel(Warning)
|
||||
{}
|
||||
|
||||
void LogChannel::log(LogMessage msg)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
for (auto &listener : mListeners)
|
||||
{
|
||||
listener->log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void LogChannel::addListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
mListeners.insert(listener);
|
||||
}
|
||||
void LogChannel::removeListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
mListeners.erase(listener);
|
||||
}
|
||||
|
||||
struct CoutListener : LogListener
|
||||
{
|
||||
void log(LogMessage msg)
|
||||
{
|
||||
std::cerr << msg.mText << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
struct FileListener : LogListener
|
||||
{
|
||||
rFile mFile;
|
||||
bool mPrependChannelName;
|
||||
|
||||
FileListener(const std::string& name = _PRGNAME_, bool prependChannel = true)
|
||||
: mFile(name + ".log", rFile::write),
|
||||
mPrependChannelName(prependChannel)
|
||||
{
|
||||
if (!mFile.IsOpened())
|
||||
{
|
||||
rMessageBox("Can't create log file! (" + name + ".log)", rMessageBoxCaptionStr, rICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void log(LogMessage msg)
|
||||
{
|
||||
if (mPrependChannelName)
|
||||
{
|
||||
msg.mText.insert(0, gTypeNameTable[static_cast<u32>(msg.mType)].mName);
|
||||
}
|
||||
mFile.Write(msg.mText);
|
||||
}
|
||||
};
|
||||
|
||||
LogManager::LogManager()
|
||||
#ifdef BUFFERED_LOGGING
|
||||
: mExiting(false), mLogConsumer()
|
||||
#endif
|
||||
{
|
||||
auto it = mChannels.begin();
|
||||
std::shared_ptr<LogListener> listener(new FileListener());
|
||||
for (const LogTypeName& name : gTypeNameTable)
|
||||
{
|
||||
it->name = name.mName;
|
||||
it->addListener(listener);
|
||||
it++;
|
||||
}
|
||||
std::shared_ptr<LogListener> TTYListener(new FileListener("TTY",false));
|
||||
getChannel(TTY).addListener(TTYListener);
|
||||
#ifdef BUFFERED_LOGGING
|
||||
mLogConsumer = std::thread(&LogManager::consumeLog, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
LogManager::~LogManager()
|
||||
{
|
||||
#ifdef BUFFERED_LOGGING
|
||||
mExiting = true;
|
||||
mBufferReady.notify_all();
|
||||
mLogConsumer.join();
|
||||
}
|
||||
|
||||
void LogManager::consumeLog()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mStatusMut);
|
||||
while (!mExiting)
|
||||
{
|
||||
mBufferReady.wait(lock);
|
||||
mBuffer.lockGet();
|
||||
size_t size = mBuffer.size();
|
||||
std::vector<char> local_messages(size);
|
||||
mBuffer.popN(&local_messages.front(), size);
|
||||
mBuffer.unlockGet();
|
||||
|
||||
u32 cursor = 0;
|
||||
u32 removed = 0;
|
||||
while (cursor < size)
|
||||
{
|
||||
Log::LogMessage msg = Log::LogMessage::deserialize(local_messages.data() + cursor, &removed);
|
||||
cursor += removed;
|
||||
getChannel(msg.mType).log(msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogManager::log(LogMessage msg)
|
||||
{
|
||||
//don't do any formatting changes or filtering to the TTY output since we
|
||||
//use the raw output to do diffs with the output of a real PS3 and some
|
||||
//programs write text in single bytes to the console
|
||||
if (msg.mType != TTY)
|
||||
{
|
||||
std::string prefix;
|
||||
switch (msg.mServerity)
|
||||
{
|
||||
case Success:
|
||||
prefix = "S ";
|
||||
break;
|
||||
case Notice:
|
||||
prefix = "! ";
|
||||
break;
|
||||
case Warning:
|
||||
prefix = "W ";
|
||||
break;
|
||||
case Error:
|
||||
prefix = "E ";
|
||||
break;
|
||||
}
|
||||
if (NamedThreadBase* thr = GetCurrentNamedThread())
|
||||
{
|
||||
prefix += thr->GetThreadName();
|
||||
}
|
||||
msg.mText.insert(0, prefix);
|
||||
msg.mText.append(1,'\n');
|
||||
}
|
||||
#ifdef BUFFERED_LOGGING
|
||||
size_t size = msg.size();
|
||||
std::vector<char> temp_buffer(size);
|
||||
msg.serialize(temp_buffer.data());
|
||||
mBuffer.pushRange(temp_buffer.begin(), temp_buffer.end());
|
||||
mBufferReady.notify_one();
|
||||
#else
|
||||
mChannels[static_cast<u32>(msg.mType)].log(msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogManager::addListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
{
|
||||
channel.addListener(listener);
|
||||
}
|
||||
}
|
||||
void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
{
|
||||
channel.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
LogManager& LogManager::getInstance()
|
||||
{
|
||||
if (!gLogManager)
|
||||
{
|
||||
gLogManager = new LogManager();
|
||||
}
|
||||
return *gLogManager;
|
||||
}
|
||||
LogChannel &LogManager::getChannel(LogType type)
|
||||
{
|
||||
return mChannels[static_cast<u32>(type)];
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <array>
|
||||
#include "Utilities/MTRingbuffer.h"
|
||||
|
||||
//#define BUFFERED_LOGGING 1
|
||||
|
||||
//first parameter is of type Log::LogType and text is of type std::string
|
||||
|
||||
#define LOG_SUCCESS(logType, text, ...) log_message(logType, Log::Success, text, ##__VA_ARGS__)
|
||||
#define LOG_NOTICE(logType, text, ...) log_message(logType, Log::Notice, text, ##__VA_ARGS__)
|
||||
#define LOG_WARNING(logType, text, ...) log_message(logType, Log::Warning, text, ##__VA_ARGS__)
|
||||
#define LOG_ERROR(logType, text, ...) log_message(logType, Log::Error, text, ##__VA_ARGS__)
|
||||
|
||||
namespace Log
|
||||
{
|
||||
const unsigned int MAX_LOG_BUFFER_LENGTH = 1024*1024;
|
||||
const unsigned int gBuffSize = 1000;
|
||||
|
||||
enum LogType : u32
|
||||
{
|
||||
GENERAL = 0,
|
||||
LOADER,
|
||||
MEMORY,
|
||||
RSX,
|
||||
HLE,
|
||||
PPU,
|
||||
SPU,
|
||||
TTY,
|
||||
};
|
||||
|
||||
|
||||
struct LogTypeName
|
||||
{
|
||||
LogType mType;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
//well I'd love make_array() but alas manually counting is not the end of the world
|
||||
static const std::array<LogTypeName, 8> gTypeNameTable = { {
|
||||
{ GENERAL, "G: " },
|
||||
{ LOADER, "LDR: " },
|
||||
{ MEMORY, "MEM: " },
|
||||
{ RSX, "RSX: " },
|
||||
{ HLE, "HLE: " },
|
||||
{ PPU, "PPU: " },
|
||||
{ SPU, "SPU: " },
|
||||
{ TTY, "TTY: " }
|
||||
} };
|
||||
|
||||
enum LogSeverity : u32
|
||||
{
|
||||
Success = 0,
|
||||
Notice,
|
||||
Warning,
|
||||
Error,
|
||||
};
|
||||
|
||||
struct LogMessage
|
||||
{
|
||||
using size_type = u32;
|
||||
LogType mType;
|
||||
LogSeverity mServerity;
|
||||
std::string mText;
|
||||
|
||||
u32 size();
|
||||
void serialize(char *output);
|
||||
static LogMessage deserialize(char *input, u32* size_out=nullptr);
|
||||
};
|
||||
|
||||
struct LogListener
|
||||
{
|
||||
virtual ~LogListener() {};
|
||||
virtual void log(LogMessage msg) = 0;
|
||||
};
|
||||
|
||||
struct LogChannel
|
||||
{
|
||||
LogChannel();
|
||||
LogChannel(const std::string& name);
|
||||
LogChannel(LogChannel& other) = delete;
|
||||
LogChannel& operator = (LogChannel& other) = delete;
|
||||
void log(LogMessage msg);
|
||||
void addListener(std::shared_ptr<LogListener> listener);
|
||||
void removeListener(std::shared_ptr<LogListener> listener);
|
||||
std::string name;
|
||||
private:
|
||||
bool mEnabled;
|
||||
LogSeverity mLogLevel;
|
||||
std::mutex mListenerLock;
|
||||
std::set<std::shared_ptr<LogListener>> mListeners;
|
||||
};
|
||||
|
||||
struct LogManager
|
||||
{
|
||||
LogManager();
|
||||
~LogManager();
|
||||
static LogManager& getInstance();
|
||||
LogChannel& getChannel(LogType type);
|
||||
void log(LogMessage msg);
|
||||
void addListener(std::shared_ptr<LogListener> listener);
|
||||
void removeListener(std::shared_ptr<LogListener> listener);
|
||||
#ifdef BUFFERED_LOGGING
|
||||
void consumeLog();
|
||||
#endif
|
||||
private:
|
||||
#ifdef BUFFERED_LOGGING
|
||||
MTRingbuffer<char, MAX_LOG_BUFFER_LENGTH> mBuffer;
|
||||
std::condition_variable mBufferReady;
|
||||
std::mutex mStatusMut;
|
||||
std::atomic<bool> mExiting;
|
||||
std::thread mLogConsumer;
|
||||
#endif
|
||||
std::array<LogChannel, std::tuple_size<decltype(gTypeNameTable)>::value> mChannels;
|
||||
//std::array<LogChannel,gTypeNameTable.size()> mChannels; //TODO: use this once Microsoft sorts their shit out
|
||||
};
|
||||
}
|
||||
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::GENERAL; } } GENERAL;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::LOADER; } } LOADER;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::MEMORY; } } MEMORY;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::RSX; } } RSX;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::HLE; } } HLE;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::PPU; } } PPU;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::SPU; } } SPU;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::TTY; } } TTY;
|
||||
|
||||
inline void log_message(Log::LogType type, Log::LogSeverity sev, std::string text)
|
||||
{
|
||||
//another msvc bug makes this not work, uncomment this and delete everything else in this function when it's fixed
|
||||
//Log::LogManager::getInstance().log({logType, severity, text})
|
||||
|
||||
Log::LogMessage msg{type, sev, text};
|
||||
Log::LogManager::getInstance().log(msg);
|
||||
}
|
||||
|
||||
template<typename T, typename ...Ts>
|
||||
inline void log_message(Log::LogType type, Log::LogSeverity sev, std::string text, T arg, Ts... args)
|
||||
{
|
||||
Log::LogMessage msg{type, sev, fmt::Format(text,arg,args...)};
|
||||
Log::LogManager::getInstance().log(msg);
|
||||
}
|
||||
@@ -95,4 +95,4 @@ public:
|
||||
|
||||
wxDialog::Close(force);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
#pragma once
|
||||
#include <thread>
|
||||
#include <array>
|
||||
#include <mutex>
|
||||
#include <algorithm>
|
||||
|
||||
//Simple non-resizable FIFO Ringbuffer that can be simultaneously be read from and written to
|
||||
//if we ever get to use boost please replace this with boost::circular_buffer, there's no reason
|
||||
//why we would have to keep this amateur attempt at such a fundamental data-structure around
|
||||
template< typename T, unsigned int MAX_MTRINGBUFFER_BUFFER_SIZE>
|
||||
class MTRingbuffer{
|
||||
std::array<T, MAX_MTRINGBUFFER_BUFFER_SIZE> mBuffer;
|
||||
//this is a recursive mutex because the get methods lock it but the only
|
||||
//way to be sure that they do not block is to check the size and the only
|
||||
//way to check the size and use get atomically is to lock this mutex,
|
||||
//so it goes:
|
||||
//lock get mutex-->check size-->call get-->lock get mutex-->unlock get mutex-->return from get-->unlock get mutex
|
||||
std::recursive_mutex mMutGet;
|
||||
std::mutex mMutPut;
|
||||
|
||||
size_t mGet;
|
||||
size_t mPut;
|
||||
size_t moveGet(size_t by = 1){ return (mGet + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; }
|
||||
size_t movePut(size_t by = 1){ return (mPut + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; }
|
||||
public:
|
||||
MTRingbuffer() : mGet(0), mPut(0){}
|
||||
|
||||
//blocks until there's something to get, so check "spaceLeft()" if you want to avoid blocking
|
||||
//also lock the get mutex around the spaceLeft() check and the pop if you want to avoid racing
|
||||
T pop()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mMutGet);
|
||||
while (mGet == mPut)
|
||||
{
|
||||
//wait until there's actually something to get
|
||||
//throwing an exception might be better, blocking here is a little awkward
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
size_t ret = mGet;
|
||||
mGet = moveGet();
|
||||
return mBuffer[ret];
|
||||
}
|
||||
|
||||
//blocks if the buffer is full until there's enough room
|
||||
void push(T &putEle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutPut);
|
||||
while (movePut() == mGet)
|
||||
{
|
||||
//if this is reached a lot it's time to increase the buffer size
|
||||
//or implement dynamic re-sizing
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
mBuffer[mPut] = std::forward(putEle);
|
||||
mPut = movePut();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return mGet == mPut;
|
||||
}
|
||||
|
||||
//returns the amount of free places, this is the amount of actual free spaces-1
|
||||
//since mGet==mPut signals an empty buffer we can't actually use the last free
|
||||
//space, so we shouldn't report it as free.
|
||||
size_t spaceLeft() //apparently free() is a macro definition in msvc in some conditions
|
||||
{
|
||||
if (mGet < mPut)
|
||||
{
|
||||
return mBuffer.size() - (mPut - mGet) - 1;
|
||||
}
|
||||
else if (mGet > mPut)
|
||||
{
|
||||
return mGet - mPut - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBuffer.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
//the magic -1 is the same magic 1 that is explained in the spaceLeft() function
|
||||
return mBuffer.size() - spaceLeft() - 1;
|
||||
}
|
||||
|
||||
//takes random access iterator to T
|
||||
template<typename IteratorType>
|
||||
void pushRange(IteratorType from, IteratorType until)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutPut);
|
||||
size_t length = until - from;
|
||||
|
||||
//if whatever we're trying to store is greater than the entire buffer the following loop will be infinite
|
||||
assert(mBuffer.size() > length);
|
||||
while (spaceLeft() < length)
|
||||
{
|
||||
//if this is reached a lot it's time to increase the buffer size
|
||||
//or implement dynamic re-sizing
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
if (mPut + length <= mBuffer.size())
|
||||
{
|
||||
std::copy(from, until, mBuffer.begin() + mPut);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t tillEnd = mBuffer.size() - mPut;
|
||||
std::copy(from, from + tillEnd, mBuffer.begin() + mPut);
|
||||
std::copy(from + tillEnd, until, mBuffer.begin());
|
||||
}
|
||||
mPut = movePut(length);
|
||||
|
||||
}
|
||||
|
||||
//takes output iterator to T
|
||||
template<typename IteratorType>
|
||||
void popN(IteratorType output, size_t n)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mMutGet);
|
||||
//make sure we're not trying to retrieve more than is in
|
||||
assert(n <= size());
|
||||
peekN<IteratorType>(output, n);
|
||||
mGet = moveGet(n);
|
||||
}
|
||||
|
||||
//takes output iterator to T
|
||||
template<typename IteratorType>
|
||||
void peekN(IteratorType output, size_t n)
|
||||
{
|
||||
size_t lGet = mGet;
|
||||
if (lGet + n <= mBuffer.size())
|
||||
{
|
||||
std::copy_n(mBuffer.begin() + lGet, n, output);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto next = std::copy(mBuffer.begin() + lGet, mBuffer.end(), output);
|
||||
std::copy_n(mBuffer.begin(), n - (mBuffer.size() - lGet), next);
|
||||
}
|
||||
}
|
||||
|
||||
//well this is just asking for trouble
|
||||
//but the comment above the declaration of mMutGet explains why it's there
|
||||
//if there's a better way please remove this
|
||||
void lockGet()
|
||||
{
|
||||
mMutGet.lock();
|
||||
}
|
||||
|
||||
//well this is just asking for trouble
|
||||
//but the comment above the declaration of mMutGet explains why it's there
|
||||
//if there's a better way please remove this
|
||||
void unlockGet()
|
||||
{
|
||||
mMutGet.unlock();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <stdafx.h>
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/CPU/CPUThread.h"
|
||||
|
||||
#include "Utilities/SMutex.h"
|
||||
|
||||
__forceinline void SM_Sleep()
|
||||
{
|
||||
if (NamedThreadBase* t = GetCurrentNamedThread())
|
||||
{
|
||||
t->WaitForAnySignal();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
thread_local size_t g_this_thread_id = 0;
|
||||
|
||||
__forceinline size_t SM_GetCurrentThreadId()
|
||||
{
|
||||
return g_this_thread_id ? g_this_thread_id : g_this_thread_id = std::hash<std::thread::id>()(std::this_thread::get_id());
|
||||
}
|
||||
|
||||
__forceinline u32 SM_GetCurrentCPUThreadId()
|
||||
{
|
||||
if (CPUThread* t = GetCurrentCPUThread())
|
||||
{
|
||||
return t->GetId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
__forceinline be_t<u32> SM_GetCurrentCPUThreadIdBE()
|
||||
{
|
||||
return SM_GetCurrentCPUThreadId();
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
#pragma once
|
||||
#include "BEType.h"
|
||||
|
||||
extern void SM_Sleep();
|
||||
extern size_t SM_GetCurrentThreadId();
|
||||
extern u32 SM_GetCurrentCPUThreadId();
|
||||
extern be_t<u32> SM_GetCurrentCPUThreadIdBE();
|
||||
|
||||
enum SMutexResult
|
||||
{
|
||||
SMR_OK = 0, // succeeded (lock, trylock, unlock)
|
||||
SMR_FAILED, // failed (trylock, unlock)
|
||||
SMR_DEADLOCK, // mutex reached deadlock (lock, trylock)
|
||||
SMR_SIGNAL = SMR_DEADLOCK, // unlock can be used for signaling specific thread
|
||||
SMR_PERMITTED, // not owner of the mutex (unlock)
|
||||
SMR_ABORT, // emulator has been stopped (lock, trylock, unlock)
|
||||
SMR_DESTROYED, // mutex has been destroyed (lock, trylock, unlock)
|
||||
SMR_TIMEOUT, // timed out (lock)
|
||||
};
|
||||
|
||||
template
|
||||
<
|
||||
typename T,
|
||||
u64 free_value = 0,
|
||||
u64 dead_value = 0xffffffff,
|
||||
void (*wait)() = SM_Sleep
|
||||
>
|
||||
class SMutexBase
|
||||
{
|
||||
static_assert(sizeof(T) == sizeof(std::atomic<T>), "Invalid SMutexBase type");
|
||||
std::atomic<T> owner;
|
||||
|
||||
public:
|
||||
SMutexBase()
|
||||
: owner((T)free_value)
|
||||
{
|
||||
}
|
||||
|
||||
void initialize()
|
||||
{
|
||||
(T&)owner = free_value;
|
||||
}
|
||||
|
||||
~SMutexBase()
|
||||
{
|
||||
lock((T)dead_value);
|
||||
owner = (T)dead_value;
|
||||
}
|
||||
|
||||
__forceinline T GetOwner() const
|
||||
{
|
||||
return (T&)owner;
|
||||
}
|
||||
|
||||
__forceinline T GetFreeValue() const
|
||||
{
|
||||
return (T)free_value;
|
||||
}
|
||||
|
||||
__forceinline T GetDeadValue() const
|
||||
{
|
||||
return (T)dead_value;
|
||||
}
|
||||
|
||||
SMutexResult trylock(T tid)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
return SMR_ABORT;
|
||||
}
|
||||
T old = (T)free_value;
|
||||
|
||||
if (!owner.compare_exchange_strong(old, tid))
|
||||
{
|
||||
if (old == tid)
|
||||
{
|
||||
return SMR_DEADLOCK;
|
||||
}
|
||||
if (old == (T)dead_value)
|
||||
{
|
||||
return SMR_DESTROYED;
|
||||
}
|
||||
return SMR_FAILED;
|
||||
}
|
||||
|
||||
return SMR_OK;
|
||||
}
|
||||
|
||||
SMutexResult unlock(T tid, T to = (T)free_value)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
return SMR_ABORT;
|
||||
}
|
||||
T old = tid;
|
||||
|
||||
if (!owner.compare_exchange_strong(old, to))
|
||||
{
|
||||
if (old == (T)free_value)
|
||||
{
|
||||
return SMR_FAILED;
|
||||
}
|
||||
if (old == (T)dead_value)
|
||||
{
|
||||
return SMR_DESTROYED;
|
||||
}
|
||||
|
||||
return SMR_PERMITTED;
|
||||
}
|
||||
|
||||
return SMR_OK;
|
||||
}
|
||||
|
||||
SMutexResult lock(T tid, u64 timeout = 0)
|
||||
{
|
||||
u64 counter = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
switch (SMutexResult res = trylock(tid))
|
||||
{
|
||||
case SMR_FAILED: break;
|
||||
default: return res;
|
||||
}
|
||||
|
||||
if (wait) wait();
|
||||
|
||||
if (timeout && counter++ > timeout)
|
||||
{
|
||||
return SMR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename Tid, Tid (get_tid)()>
|
||||
class SMutexLockerBase
|
||||
{
|
||||
T& sm;
|
||||
public:
|
||||
const Tid tid;
|
||||
|
||||
__forceinline SMutexLockerBase(T& _sm)
|
||||
: sm(_sm)
|
||||
, tid(get_tid())
|
||||
{
|
||||
if (!tid)
|
||||
{
|
||||
if (!Emu.IsStopped())
|
||||
{
|
||||
LOG_ERROR(HLE, "SMutexLockerBase: thread id == 0");
|
||||
Emu.Pause();
|
||||
}
|
||||
return;
|
||||
}
|
||||
sm.lock(tid);
|
||||
}
|
||||
|
||||
__forceinline ~SMutexLockerBase()
|
||||
{
|
||||
if (tid) sm.unlock(tid);
|
||||
}
|
||||
};
|
||||
|
||||
typedef SMutexBase<size_t>
|
||||
SMutexGeneral;
|
||||
typedef SMutexBase<u32>
|
||||
SMutex;
|
||||
typedef SMutexBase<be_t<u32>>
|
||||
SMutexBE;
|
||||
|
||||
typedef SMutexLockerBase<SMutexGeneral, size_t, SM_GetCurrentThreadId>
|
||||
SMutexGeneralLocker;
|
||||
typedef SMutexLockerBase<SMutex, u32, SM_GetCurrentCPUThreadId>
|
||||
SMutexLocker;
|
||||
typedef SMutexLockerBase<SMutexBE, be_t<u32>, SM_GetCurrentCPUThreadIdBE>
|
||||
SMutexBELocker;
|
||||
@@ -0,0 +1,139 @@
|
||||
#pragma once
|
||||
|
||||
template<typename T, u32 SQSize = 666>
|
||||
class SQueue
|
||||
{
|
||||
std::mutex m_mutex;
|
||||
NamedThreadBase* push_waiter;
|
||||
NamedThreadBase* pop_waiter;
|
||||
u32 m_pos;
|
||||
u32 m_count;
|
||||
T m_data[SQSize];
|
||||
|
||||
public:
|
||||
SQueue()
|
||||
: m_pos(0)
|
||||
, m_count(0)
|
||||
, push_waiter(nullptr)
|
||||
, pop_waiter(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
const u32 GetSize() const
|
||||
{
|
||||
return SQSize;
|
||||
}
|
||||
|
||||
bool Push(const T& data)
|
||||
{
|
||||
NamedThreadBase* t = GetCurrentNamedThread();
|
||||
push_waiter = t;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (m_count >= SQSize)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SM_Sleep();
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_count >= SQSize) continue;
|
||||
if (pop_waiter && !m_count) pop_waiter->Notify();
|
||||
|
||||
m_data[(m_pos + m_count++) % SQSize] = data;
|
||||
|
||||
push_waiter = nullptr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Pop(T& data)
|
||||
{
|
||||
NamedThreadBase* t = GetCurrentNamedThread();
|
||||
pop_waiter = t;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!m_count)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SM_Sleep();
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (!m_count) continue;
|
||||
if (push_waiter && m_count >= SQSize) push_waiter->Notify();
|
||||
|
||||
data = m_data[m_pos];
|
||||
m_pos = (m_pos + 1) % SQSize;
|
||||
m_count--;
|
||||
|
||||
pop_waiter = nullptr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volatile u32 GetCount() // may be thread unsafe
|
||||
{
|
||||
return m_count;
|
||||
}
|
||||
|
||||
volatile bool IsEmpty() // may be thread unsafe
|
||||
{
|
||||
return !m_count;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (push_waiter && m_count >= SQSize) push_waiter->Notify();
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
T& Peek(u32 pos = 0)
|
||||
{
|
||||
NamedThreadBase* t = GetCurrentNamedThread();
|
||||
pop_waiter = t;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!m_count)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
SM_Sleep();
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_count)
|
||||
{
|
||||
pop_waiter = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_data[(m_pos + pos) % SQSize];
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/SSemaphore.h"
|
||||
|
||||
void SSemaphore::wait()
|
||||
{
|
||||
u32 order;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_count && m_out_order == m_in_order)
|
||||
{
|
||||
m_count--;
|
||||
return;
|
||||
}
|
||||
order = m_in_order++;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> cv_lock(m_cv_mutex);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_cond.wait_for(cv_lock, std::chrono::milliseconds(1));
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (m_count)
|
||||
{
|
||||
if (m_out_order == order)
|
||||
{
|
||||
m_count--;
|
||||
m_out_order++;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cond.notify_one();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SSemaphore::try_wait()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_count && m_in_order == m_out_order)
|
||||
{
|
||||
m_count--;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SSemaphore::post()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_count < m_max)
|
||||
{
|
||||
m_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_cond.notify_one();
|
||||
}
|
||||
|
||||
bool SSemaphore::post_and_wait()
|
||||
{
|
||||
// TODO: merge these functions? Probably has a race condition.
|
||||
if (try_wait()) return false;
|
||||
|
||||
post();
|
||||
wait();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
class SSemaphore
|
||||
{
|
||||
const u32 m_max;
|
||||
u32 m_count;
|
||||
u32 m_in_order;
|
||||
u32 m_out_order;
|
||||
std::mutex m_cv_mutex;
|
||||
std::mutex m_mutex;
|
||||
std::condition_variable m_cond;
|
||||
|
||||
public:
|
||||
SSemaphore(u32 value, u32 max = 1)
|
||||
: m_max(max > 0 ? max : 0xffffffff)
|
||||
, m_count(value > m_max ? m_max : value)
|
||||
, m_in_order(0)
|
||||
, m_out_order(0)
|
||||
{
|
||||
}
|
||||
|
||||
SSemaphore()
|
||||
: m_max(0xffffffff)
|
||||
, m_count(0)
|
||||
, m_in_order(0)
|
||||
, m_out_order(0)
|
||||
{
|
||||
}
|
||||
|
||||
~SSemaphore()
|
||||
{
|
||||
}
|
||||
|
||||
void wait();
|
||||
|
||||
bool try_wait();
|
||||
|
||||
void post();
|
||||
|
||||
bool post_and_wait();
|
||||
};
|
||||
@@ -0,0 +1,132 @@
|
||||
#include "stdafx.h"
|
||||
#include "StrFmt.h"
|
||||
|
||||
extern const std::string fmt::placeholder = "???";
|
||||
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
//can't take strings by reference because of "va_start", so overload it with char *
|
||||
std::string fmt::FormatV(const char *fmt, va_list args)
|
||||
{
|
||||
size_t length = 256;
|
||||
std::string str;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<char> buffptr(length);
|
||||
size_t printlen = vsnprintf(buffptr.data(), length, fmt, args);
|
||||
if (printlen < length)
|
||||
{
|
||||
str = std::string(buffptr.data(), printlen);
|
||||
break;
|
||||
}
|
||||
length *= 2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string fmt::FormatV(std::string fmt, va_list args)
|
||||
{
|
||||
std::string str = FormatV(fmt.c_str(), args);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string replace_first(const std::string& src, const std::string& from, const std::string& to)
|
||||
{
|
||||
auto pos = src.find(from);
|
||||
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
||||
return (pos ? src.substr(0, pos) + to : to) + std::string(src.c_str() + pos + from.length());
|
||||
}
|
||||
|
||||
std::string replace_all(std::string src, const std::string& from, const std::string& to)
|
||||
{
|
||||
for (auto pos = src.find(from); pos != std::string::npos; src.find(from, pos + 1))
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + to : to) + std::string(src.c_str() + pos + from.length());
|
||||
pos += to.length();
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
//TODO: move this wx Stuff somewhere else
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string fmt::ToUTF8(const wxString& right)
|
||||
{
|
||||
auto ret = std::string(((const char *)right.utf8_str()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString fmt::FromUTF8(const std::string& right)
|
||||
{
|
||||
auto ret = wxString::FromUTF8(right.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int fmt::CmpNoCase(const std::string& a, const std::string& b)
|
||||
{
|
||||
if (a.length() != b.length())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::equal(a.begin(),
|
||||
a.end(),
|
||||
b.begin(),
|
||||
[](const char& a, const char& b){return tolower(a) == tolower(b); })
|
||||
? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
void fmt::Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm)
|
||||
{
|
||||
size_t cursor = 0;
|
||||
do
|
||||
{
|
||||
cursor = str.find(searchterm, cursor);
|
||||
if (cursor != std::string::npos)
|
||||
{
|
||||
str.replace(cursor, searchterm.size(), replaceterm);
|
||||
cursor += replaceterm.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
std::vector<std::string> fmt::rSplit(const std::string& source, const std::string& delim)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
size_t cursor = 0;
|
||||
do
|
||||
{
|
||||
size_t prevcurs = cursor;
|
||||
cursor = source.find(delim, cursor);
|
||||
if (cursor != std::string::npos)
|
||||
{
|
||||
ret.push_back(source.substr(prevcurs,cursor-prevcurs));
|
||||
cursor += delim.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.push_back(source.substr(prevcurs));
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
namespace fmt{
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
|
||||
struct empty_t{};
|
||||
|
||||
extern const string placeholder;
|
||||
|
||||
template <typename T>
|
||||
std::string AfterLast(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.rfind(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(search_pos);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string BeforeLast(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.rfind(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(0, search_pos);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string AfterFirst(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.find(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(search_pos);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string BeforeFirst(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.find(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(0, search_pos);
|
||||
}
|
||||
|
||||
// write `fmt` from `pos` to the first occurence of `fmt::placeholder` to
|
||||
// the stream `os`. Then write `arg` to to the stream. If there's no
|
||||
// `fmt::placeholder` after `pos` everything in `fmt` after pos is written
|
||||
// to `os`. Then `arg` is written to `os` after appending a space character
|
||||
template<typename T>
|
||||
empty_t write(const string &fmt, ostream &os, string::size_type &pos, T &&arg)
|
||||
{
|
||||
string::size_type ins = fmt.find(placeholder, pos);
|
||||
|
||||
if (ins == string::npos)
|
||||
{
|
||||
os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
os << ' ' << arg;
|
||||
|
||||
pos = fmt.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write(fmt.data() + pos, ins - pos);
|
||||
os << arg;
|
||||
|
||||
pos = ins + placeholder.size();
|
||||
}
|
||||
return{};
|
||||
}
|
||||
|
||||
// typesafe version of a sprintf-like function. Returns the printed to
|
||||
// string. To mark positions where the arguments are supposed to be
|
||||
// inserted use `fmt::placeholder`. If there's not enough placeholders
|
||||
// the rest of the arguments are appended at the end, seperated by spaces
|
||||
template<typename ... Args>
|
||||
string SFormat(const string &fmt, Args&& ... parameters)
|
||||
{
|
||||
ostringstream os;
|
||||
string::size_type pos = 0;
|
||||
std::initializer_list<empty_t> { write(fmt, os, pos, parameters)... };
|
||||
|
||||
if (!fmt.empty())
|
||||
{
|
||||
os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
}
|
||||
|
||||
string result = os.str();
|
||||
return result;
|
||||
}
|
||||
|
||||
//small wrapper used to deal with bitfields
|
||||
template<typename T>
|
||||
T by_value(T x) { return x; }
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
//can't take strings by reference because of "va_start", so overload it with char *
|
||||
string FormatV(const char *fmt, va_list args);
|
||||
|
||||
string FormatV(string fmt, va_list args);
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
template<typename ... Args>
|
||||
string Format(const string &fmt, Args ... parameters)
|
||||
{
|
||||
size_t length = 256;
|
||||
string str;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<char> buffptr(length);
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-security"
|
||||
size_t printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward<Args>(parameters)...);
|
||||
#pragma clang diagnostic pop
|
||||
if (printlen < length)
|
||||
{
|
||||
str = string(buffptr.data(), printlen);
|
||||
break;
|
||||
}
|
||||
length *= 2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
|
||||
std::string replace_all(std::string src, const std::string& from, const std::string& to);
|
||||
|
||||
template<size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::string>(&list)[list_size])
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second : list[i].second) + std::string(src.c_str() + pos + comp_length);
|
||||
pos += list[i].second.length() - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
template<size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::function<std::string()>>(&list)[list_size])
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second() : list[i].second()) + std::string(src.c_str() + pos + comp_length);
|
||||
pos += list[i].second().length() - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string ToUTF8(const wxString& right);
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString FromUTF8(const string& right);
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int CmpNoCase(const std::string& a, const std::string& b);
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with Replace from wxString
|
||||
void Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm);
|
||||
|
||||
std::vector<std::string> rSplit(const std::string& source, const std::string& delim);
|
||||
}
|
||||
+146
-85
@@ -1,97 +1,158 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
#include "Thread.h"
|
||||
|
||||
ThreadBase* GetCurrentNamedThread()
|
||||
thread_local NamedThreadBase* g_tls_this_thread = nullptr;
|
||||
std::atomic<u32> g_thread_count(0);
|
||||
|
||||
NamedThreadBase* GetCurrentNamedThread()
|
||||
{
|
||||
ThreadExec* thr = (ThreadExec*)::wxThread::This();
|
||||
return thr ? thr->m_parent : nullptr;
|
||||
return g_tls_this_thread;
|
||||
}
|
||||
|
||||
ThreadBase::ThreadBase(bool detached, const wxString& name)
|
||||
: m_detached(detached)
|
||||
, m_name(name)
|
||||
, m_executor(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void ThreadBase::Start()
|
||||
{
|
||||
if(m_executor) return;
|
||||
|
||||
m_executor = new ThreadExec(m_detached, this);
|
||||
}
|
||||
|
||||
void ThreadBase::Resume()
|
||||
{
|
||||
if(m_executor)
|
||||
{
|
||||
m_executor->Resume();
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadBase::Pause()
|
||||
{
|
||||
if(m_executor)
|
||||
{
|
||||
m_executor->Pause();
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadBase::Stop(bool wait)
|
||||
{
|
||||
if(!m_executor) return;
|
||||
ThreadExec* exec = m_executor;
|
||||
m_executor = nullptr;
|
||||
|
||||
if(!m_detached)
|
||||
{
|
||||
if(wait)
|
||||
{
|
||||
exec->Wait();
|
||||
}
|
||||
|
||||
exec->Stop(false);
|
||||
delete exec;
|
||||
}
|
||||
else
|
||||
{
|
||||
exec->Stop(wait);
|
||||
}
|
||||
}
|
||||
|
||||
bool ThreadBase::Wait() const
|
||||
{
|
||||
return m_executor != nullptr && m_executor->Wait() != (wxThread::ExitCode)-1;
|
||||
}
|
||||
|
||||
bool ThreadBase::IsRunning() const
|
||||
{
|
||||
return m_executor != nullptr && m_executor->IsRunning();
|
||||
}
|
||||
|
||||
bool ThreadBase::IsPaused() const
|
||||
{
|
||||
return m_executor != nullptr && m_executor->IsPaused();
|
||||
}
|
||||
|
||||
bool ThreadBase::IsAlive() const
|
||||
{
|
||||
return m_executor != nullptr;
|
||||
}
|
||||
|
||||
bool ThreadBase::TestDestroy() const
|
||||
{
|
||||
if(!m_executor || !m_executor->m_parent) return true;
|
||||
|
||||
return m_executor->TestDestroy();
|
||||
}
|
||||
|
||||
wxString ThreadBase::GetThreadName() const
|
||||
std::string NamedThreadBase::GetThreadName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void ThreadBase::SetThreadName(const wxString& name)
|
||||
void NamedThreadBase::SetThreadName(const std::string& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
}
|
||||
|
||||
ThreadBase::ThreadBase(const std::string& name)
|
||||
: NamedThreadBase(name)
|
||||
, m_executor(nullptr)
|
||||
, m_destroy(false)
|
||||
, m_alive(false)
|
||||
{
|
||||
}
|
||||
|
||||
ThreadBase::~ThreadBase()
|
||||
{
|
||||
if(IsAlive())
|
||||
Stop(false);
|
||||
|
||||
safe_delete(m_executor);
|
||||
}
|
||||
|
||||
void ThreadBase::Start()
|
||||
{
|
||||
if(m_executor) Stop();
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_main_mutex);
|
||||
|
||||
m_destroy = false;
|
||||
m_alive = true;
|
||||
|
||||
m_executor = new std::thread(
|
||||
[this]()
|
||||
{
|
||||
g_tls_this_thread = this;
|
||||
g_thread_count++;
|
||||
|
||||
Task();
|
||||
|
||||
m_alive = false;
|
||||
g_thread_count--;
|
||||
});
|
||||
}
|
||||
|
||||
void ThreadBase::Stop(bool wait, bool send_destroy)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_main_mutex);
|
||||
|
||||
if (send_destroy)
|
||||
m_destroy = true;
|
||||
|
||||
if(!m_executor)
|
||||
return;
|
||||
|
||||
if(wait && m_executor->joinable() && m_alive)
|
||||
{
|
||||
m_executor->join();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_executor->detach();
|
||||
}
|
||||
|
||||
delete m_executor;
|
||||
m_executor = nullptr;
|
||||
}
|
||||
|
||||
bool ThreadBase::Join() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_main_mutex);
|
||||
if(m_executor->joinable() && m_alive && m_executor != nullptr)
|
||||
{
|
||||
m_executor->join();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ThreadBase::IsAlive() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_main_mutex);
|
||||
return m_alive;
|
||||
}
|
||||
|
||||
bool ThreadBase::TestDestroy() const
|
||||
{
|
||||
return m_destroy;
|
||||
}
|
||||
|
||||
thread::thread(const std::string& name, std::function<void()> func) : m_name(name)
|
||||
{
|
||||
start(func);
|
||||
}
|
||||
|
||||
thread::thread(const std::string& name) : m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
thread::thread()
|
||||
{
|
||||
}
|
||||
|
||||
void thread::start(std::function<void()> func)
|
||||
{
|
||||
std::string name = m_name;
|
||||
|
||||
m_thr = std::thread([func, name]()
|
||||
{
|
||||
NamedThreadBase info(name);
|
||||
g_tls_this_thread = &info;
|
||||
g_thread_count++;
|
||||
|
||||
try
|
||||
{
|
||||
func();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
LOG_ERROR(HLE, "Crash :(");
|
||||
//std::terminate();
|
||||
}
|
||||
|
||||
g_thread_count--;
|
||||
});
|
||||
}
|
||||
|
||||
void thread::detach()
|
||||
{
|
||||
m_thr.detach();
|
||||
}
|
||||
|
||||
void thread::join()
|
||||
{
|
||||
m_thr.join();
|
||||
}
|
||||
|
||||
bool thread::joinable() const
|
||||
{
|
||||
return m_thr.joinable();
|
||||
}
|
||||
|
||||
+72
-80
@@ -2,94 +2,96 @@
|
||||
#include "Array.h"
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <Utilities/SSemaphore.h>
|
||||
|
||||
class ThreadExec;
|
||||
|
||||
class ThreadBase
|
||||
class NamedThreadBase
|
||||
{
|
||||
protected:
|
||||
wxString m_name;
|
||||
bool m_detached;
|
||||
std::string m_name;
|
||||
|
||||
std::condition_variable m_signal_cv;
|
||||
std::mutex m_signal_mtx;
|
||||
|
||||
public:
|
||||
wxMutex m_main_mutex;
|
||||
|
||||
protected:
|
||||
ThreadBase(bool detached = true, const wxString& name = "Unknown ThreadBase");
|
||||
|
||||
public:
|
||||
ThreadExec* m_executor;
|
||||
|
||||
virtual void Task()=0;
|
||||
|
||||
virtual void Start();
|
||||
virtual void Resume();
|
||||
virtual void Pause();
|
||||
virtual void Stop(bool wait = true);
|
||||
|
||||
virtual bool Wait() const;
|
||||
virtual bool IsRunning() const;
|
||||
virtual bool IsPaused() const;
|
||||
virtual bool IsAlive() const;
|
||||
virtual bool TestDestroy() const;
|
||||
virtual wxString GetThreadName() const;
|
||||
virtual void SetThreadName(const wxString& name);
|
||||
};
|
||||
|
||||
ThreadBase* GetCurrentNamedThread();
|
||||
|
||||
class ThreadExec : public wxThread
|
||||
{
|
||||
wxCriticalSection m_wait_for_exit;
|
||||
volatile bool m_alive;
|
||||
|
||||
public:
|
||||
ThreadBase* m_parent;
|
||||
|
||||
ThreadExec(bool detached, ThreadBase* parent)
|
||||
: wxThread(detached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE)
|
||||
, m_parent(parent)
|
||||
, m_alive(true)
|
||||
NamedThreadBase(const std::string& name) : m_name(name)
|
||||
{
|
||||
Create();
|
||||
Run();
|
||||
}
|
||||
|
||||
void Stop(bool wait = true)
|
||||
NamedThreadBase()
|
||||
{
|
||||
if(!m_alive) return;
|
||||
|
||||
m_parent = nullptr;
|
||||
|
||||
if(wait)
|
||||
{
|
||||
Delete();
|
||||
//wxCriticalSectionLocker lock(m_wait_for_exit);
|
||||
}
|
||||
}
|
||||
|
||||
ExitCode Entry()
|
||||
virtual std::string GetThreadName() const;
|
||||
virtual void SetThreadName(const std::string& name);
|
||||
|
||||
void WaitForAnySignal() // wait 1 ms for something
|
||||
{
|
||||
//wxCriticalSectionLocker lock(m_wait_for_exit);
|
||||
m_parent->Task();
|
||||
m_alive = false;
|
||||
if(m_parent) m_parent->m_executor = nullptr;
|
||||
return (ExitCode)0;
|
||||
std::unique_lock<std::mutex> lock(m_signal_mtx);
|
||||
m_signal_cv.wait_for(lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
void Notify() // wake up waiting thread or nothing
|
||||
{
|
||||
m_signal_cv.notify_one();
|
||||
}
|
||||
};
|
||||
|
||||
//ThreadBase* GetCurrentThread();
|
||||
NamedThreadBase* GetCurrentNamedThread();
|
||||
|
||||
class ThreadBase : public NamedThreadBase
|
||||
{
|
||||
protected:
|
||||
std::atomic<bool> m_destroy;
|
||||
std::atomic<bool> m_alive;
|
||||
std::thread* m_executor;
|
||||
|
||||
mutable std::mutex m_main_mutex;
|
||||
|
||||
ThreadBase(const std::string& name);
|
||||
~ThreadBase();
|
||||
|
||||
public:
|
||||
void Start();
|
||||
void Stop(bool wait = true, bool send_destroy = true);
|
||||
|
||||
bool Join() const;
|
||||
bool IsAlive() const;
|
||||
bool TestDestroy() const;
|
||||
|
||||
virtual void Task() = 0;
|
||||
};
|
||||
|
||||
class thread
|
||||
{
|
||||
std::string m_name;
|
||||
std::thread m_thr;
|
||||
|
||||
public:
|
||||
thread(const std::string& name, std::function<void()> func);
|
||||
thread(const std::string& name);
|
||||
thread();
|
||||
|
||||
|
||||
public:
|
||||
void start(std::function<void()> func);
|
||||
void detach();
|
||||
void join();
|
||||
bool joinable() const;
|
||||
};
|
||||
|
||||
template<typename T> class MTPacketBuffer
|
||||
{
|
||||
protected:
|
||||
volatile bool m_busy;
|
||||
volatile u32 m_put, m_get;
|
||||
Array<u8> m_buffer;
|
||||
std::vector<u8> m_buffer;
|
||||
u32 m_max_buffer_size;
|
||||
mutable wxCriticalSection m_cs_main;
|
||||
mutable std::recursive_mutex m_cs_main;
|
||||
|
||||
void CheckBusy()
|
||||
{
|
||||
@@ -110,9 +112,9 @@ public:
|
||||
|
||||
void Flush()
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_cs_main);
|
||||
std::lock_guard<std::recursive_mutex> lock(m_cs_main);
|
||||
m_put = m_get = 0;
|
||||
m_buffer.Clear();
|
||||
m_buffer.clear();
|
||||
m_busy = false;
|
||||
}
|
||||
|
||||
@@ -123,30 +125,20 @@ private:
|
||||
public:
|
||||
void Push(const T& v)
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_cs_main);
|
||||
std::lock_guard<std::recursive_mutex> lock(m_cs_main);
|
||||
_push(v);
|
||||
}
|
||||
|
||||
T Pop()
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_cs_main);
|
||||
std::lock_guard<std::recursive_mutex> lock(m_cs_main);
|
||||
return _pop();
|
||||
}
|
||||
|
||||
bool HasNewPacket() const { wxCriticalSectionLocker lock(m_cs_main); return m_put != m_get; }
|
||||
bool HasNewPacket() const { std::lock_guard<std::recursive_mutex> lock(m_cs_main); return m_put != m_get; }
|
||||
bool IsBusy() const { return m_busy; }
|
||||
};
|
||||
|
||||
static __forceinline bool SemaphorePostAndWait(wxSemaphore& sem)
|
||||
{
|
||||
if(sem.TryWait() != wxSEMA_BUSY) return false;
|
||||
|
||||
sem.Post();
|
||||
sem.Wait();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
class StepThread : public ThreadBase
|
||||
{
|
||||
@@ -155,7 +147,7 @@ class StepThread : public ThreadBase
|
||||
volatile bool m_exit;
|
||||
|
||||
protected:
|
||||
StepThread(const wxString& name = "Unknown StepThread")
|
||||
StepThread(const std::string& name = "Unknown StepThread")
|
||||
: ThreadBase(true, name)
|
||||
, m_exit(false)
|
||||
{
|
||||
@@ -218,4 +210,4 @@ public:
|
||||
if(wait) WaitForExit();
|
||||
}
|
||||
};
|
||||
*/
|
||||
*/
|
||||
|
||||
+32
-27
@@ -1,47 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
class Timer
|
||||
{
|
||||
private:
|
||||
bool stopped;
|
||||
double startTimeInMicroSec;
|
||||
double endTimeInMicroSec;
|
||||
LARGE_INTEGER frequency;
|
||||
LARGE_INTEGER startCycle;
|
||||
LARGE_INTEGER endCycle;
|
||||
bool m_stopped;
|
||||
std::chrono::high_resolution_clock::time_point m_start;
|
||||
std::chrono::high_resolution_clock::time_point m_end;
|
||||
|
||||
public:
|
||||
Timer()
|
||||
Timer() : m_stopped(false)
|
||||
{
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
startCycle.QuadPart = 0;
|
||||
endCycle.QuadPart = 0;
|
||||
stopped = false;
|
||||
startTimeInMicroSec = 0;
|
||||
endTimeInMicroSec = 0;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
stopped = false;
|
||||
QueryPerformanceCounter(&startCycle);
|
||||
m_stopped = false;
|
||||
m_start = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
void Stop()
|
||||
{
|
||||
stopped = true;
|
||||
QueryPerformanceCounter(&endCycle);
|
||||
m_stopped = true;
|
||||
m_end = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
double GetElapsedTimeInSec(){return GetElapsedTimeInMicroSec() / 1000000.0;}
|
||||
double GetElapsedTimeInMilliSec(){return GetElapsedTimeInMicroSec() / 1000.0;}
|
||||
double GetElapsedTimeInMicroSec()
|
||||
double GetElapsedTimeInSec() const
|
||||
{
|
||||
if(!stopped) QueryPerformanceCounter(&endCycle);
|
||||
|
||||
startTimeInMicroSec = startCycle.QuadPart * (1000000.0 / frequency.QuadPart);
|
||||
endTimeInMicroSec = endCycle.QuadPart * (1000000.0 / frequency.QuadPart);
|
||||
|
||||
return endTimeInMicroSec - startTimeInMicroSec;
|
||||
return GetElapsedTimeInMicroSec() / 1000000.0;
|
||||
}
|
||||
};
|
||||
|
||||
double GetElapsedTimeInMilliSec() const
|
||||
{
|
||||
return GetElapsedTimeInMicroSec() / 1000.0;
|
||||
}
|
||||
|
||||
double GetElapsedTimeInMicroSec() const
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count();
|
||||
}
|
||||
|
||||
double GetElapsedTimeInNanoSec() const
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(now - m_start).count();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
@echo off
|
||||
|
||||
rem // This program is free software: you can redistribute it and/or modify
|
||||
rem // it under the terms of the GNU General Public License as published by
|
||||
rem // the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
rem // This program is distributed in the hope that it will be useful,
|
||||
rem // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
rem // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
rem // GNU General Public License 2.0 for more details.
|
||||
|
||||
rem // A copy of the GPL 2.0 should have been included with the program.
|
||||
rem // If not, see http://www.gnu.org/licenses/
|
||||
|
||||
rem // Official git repository and contact information can be found at
|
||||
rem // https://github.com/DHrpcs3/rpcs3 and http://rpcs3.net/.
|
||||
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
|
||||
set GIT_VERSION_FILE=%~p0..\rpcs3\git-version.h
|
||||
if not defined GIT (
|
||||
set GIT="git"
|
||||
)
|
||||
call %GIT% describe > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
echo Git not on path, trying default Msysgit paths
|
||||
set GIT="%ProgramFiles(x86)%\Git\bin\git.exe"
|
||||
call !GIT! describe > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
set GIT="%ProgramFiles%\Git\bin\git.exe"
|
||||
)
|
||||
)
|
||||
|
||||
if exist "%GIT_VERSION_FILE%" (
|
||||
rem // Skip updating the file if RPCS3_GIT_VERSION_NO_UPDATE is 1.
|
||||
findstr /B /C:"#define RPCS3_GIT_VERSION_NO_UPDATE 1" "%GIT_VERSION_FILE%" > NUL
|
||||
if not errorlevel 1 (
|
||||
goto done
|
||||
)
|
||||
)
|
||||
|
||||
call %GIT% describe --always > NUL 2> NUL
|
||||
if errorlevel 1 (
|
||||
echo Unable to update git-version.h, git not found.
|
||||
echo If you don't want to add it to your path, set the GIT environment variable.
|
||||
|
||||
echo // This is a generated file. > "%GIT_VERSION_FILE%"
|
||||
echo. >> "%GIT_VERSION_FILE%"
|
||||
echo #define RPCS3_GIT_VERSION "unknown" >> "%GIT_VERSION_FILE%"
|
||||
echo. >> "%GIT_VERSION_FILE%"
|
||||
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
|
||||
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
|
||||
goto done
|
||||
)
|
||||
|
||||
for /F %%I IN ('call %GIT% describe --always') do set GIT_VERSION=%%I
|
||||
|
||||
rem // Don't modify the file if it already has the current version.
|
||||
if exist "%GIT_VERSION_FILE%" (
|
||||
findstr /C:"%GIT_VERSION%" "%GIT_VERSION_FILE%" > NUL
|
||||
if not errorlevel 1 (
|
||||
goto done
|
||||
)
|
||||
)
|
||||
|
||||
echo // This is a generated file. > "%GIT_VERSION_FILE%"
|
||||
echo. >> "%GIT_VERSION_FILE%"
|
||||
echo #define RPCS3_GIT_VERSION "%GIT_VERSION%" >> "%GIT_VERSION_FILE%"
|
||||
echo. >> "%GIT_VERSION_FILE%"
|
||||
echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%"
|
||||
echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"
|
||||
|
||||
:done
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
rTimer::rTimer()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxTimer());
|
||||
}
|
||||
|
||||
rTimer::~rTimer()
|
||||
{
|
||||
delete reinterpret_cast<wxTimer*>(handle);
|
||||
}
|
||||
|
||||
void rTimer::Start()
|
||||
{
|
||||
reinterpret_cast<wxTimer*>(handle)->Start();
|
||||
}
|
||||
|
||||
void rTimer::Stop()
|
||||
{
|
||||
reinterpret_cast<wxTimer*>(handle)->Stop();
|
||||
}
|
||||
|
||||
void rSleep(u32 time)
|
||||
{
|
||||
wxSleep(time);
|
||||
}
|
||||
|
||||
void rMicroSleep(u64 time)
|
||||
{
|
||||
wxMicroSleep(time);
|
||||
}
|
||||
|
||||
bool rThread::IsMain()
|
||||
{
|
||||
return wxThread::IsMain();
|
||||
}
|
||||
|
||||
void rYieldIfNeeded()
|
||||
{
|
||||
wxYieldIfNeeded();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
struct rTimer
|
||||
{
|
||||
rTimer();
|
||||
rTimer(const rTimer& other) = delete;
|
||||
~rTimer();
|
||||
void Start();
|
||||
void Stop();
|
||||
private:
|
||||
void *handle;
|
||||
};
|
||||
|
||||
void rSleep(u32 time);
|
||||
void rMicroSleep(u64 time);
|
||||
|
||||
struct rThread
|
||||
{
|
||||
static bool IsMain();
|
||||
};
|
||||
|
||||
void rYieldIfNeeded();
|
||||
@@ -0,0 +1,311 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
const int rPATH_MKDIR_FULL = wxPATH_MKDIR_FULL;
|
||||
|
||||
wxFile::OpenMode convertOpenMode(rFile::OpenMode open)
|
||||
{
|
||||
wxFile::OpenMode mode;
|
||||
switch (open)
|
||||
{
|
||||
case rFile::read:
|
||||
mode = wxFile::read;
|
||||
break;
|
||||
case rFile::write:
|
||||
mode = wxFile::write;
|
||||
break;
|
||||
case rFile::read_write:
|
||||
mode = wxFile::read_write;
|
||||
break;
|
||||
case rFile::write_append:
|
||||
mode = wxFile::write_append;
|
||||
break;
|
||||
case rFile::write_excl:
|
||||
mode = wxFile::write_excl;
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
rFile::OpenMode rConvertOpenMode(wxFile::OpenMode open)
|
||||
{
|
||||
rFile::OpenMode mode;
|
||||
switch (open)
|
||||
{
|
||||
case wxFile::read:
|
||||
mode = rFile::read;
|
||||
break;
|
||||
case wxFile::write:
|
||||
mode = rFile::write;
|
||||
break;
|
||||
case wxFile::read_write:
|
||||
mode = rFile::read_write;
|
||||
break;
|
||||
case wxFile::write_append:
|
||||
mode = rFile::write_append;
|
||||
break;
|
||||
case wxFile::write_excl:
|
||||
mode = rFile::write_excl;
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
wxSeekMode convertSeekMode(rSeekMode mode)
|
||||
{
|
||||
wxSeekMode ret;
|
||||
switch (mode)
|
||||
{
|
||||
case rFromStart:
|
||||
ret = wxFromStart;
|
||||
break;
|
||||
case rFromCurrent:
|
||||
ret = wxFromCurrent;
|
||||
break;
|
||||
case rFromEnd:
|
||||
ret = wxFromEnd;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
rSeekMode rConvertSeekMode(wxSeekMode mode)
|
||||
{
|
||||
rSeekMode ret;
|
||||
switch (mode)
|
||||
{
|
||||
case wxFromStart:
|
||||
ret = rFromStart;
|
||||
break;
|
||||
case wxFromCurrent:
|
||||
ret = rFromCurrent;
|
||||
break;
|
||||
case wxFromEnd:
|
||||
ret = rFromEnd;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
rFile::rFile()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxFile());
|
||||
}
|
||||
|
||||
rFile::rFile(const std::string& filename, rFile::OpenMode open)
|
||||
{
|
||||
|
||||
handle = reinterpret_cast<void*>(new wxFile(fmt::FromUTF8(filename), convertOpenMode(open)));
|
||||
}
|
||||
|
||||
rFile::rFile(int fd)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxFile(fd));
|
||||
}
|
||||
|
||||
rFile::~rFile()
|
||||
{
|
||||
delete reinterpret_cast<wxFile*>(handle);
|
||||
}
|
||||
|
||||
bool rFile::Access(const std::string &filename, rFile::OpenMode mode)
|
||||
{
|
||||
return wxFile::Access(fmt::FromUTF8(filename), convertOpenMode(mode));
|
||||
}
|
||||
|
||||
size_t rFile::Write(const void *buffer, size_t count)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Write(buffer,count);
|
||||
}
|
||||
|
||||
bool rFile::Write(const std::string &text)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Write(reinterpret_cast<const void*>(text.c_str()),text.size());
|
||||
}
|
||||
|
||||
bool rFile::Close()
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Close();
|
||||
}
|
||||
|
||||
bool rFile::Create(const std::string &filename, bool overwrite, int access)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Create(fmt::FromUTF8(filename),overwrite,access);
|
||||
}
|
||||
|
||||
bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Open(fmt::FromUTF8(filename), convertOpenMode(mode), access);
|
||||
}
|
||||
|
||||
bool rFile::Exists(const std::string &file)
|
||||
{
|
||||
return wxFile::Exists(fmt::FromUTF8(file));
|
||||
}
|
||||
|
||||
bool rFile::IsOpened() const
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->IsOpened();
|
||||
}
|
||||
|
||||
size_t rFile::Length() const
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Length();
|
||||
}
|
||||
|
||||
size_t rFile::Read(void *buffer, size_t count)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Read(buffer,count);
|
||||
}
|
||||
|
||||
size_t rFile::Seek(size_t ofs, rSeekMode mode)
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Seek(ofs, convertSeekMode(mode));
|
||||
}
|
||||
|
||||
size_t rFile::Tell() const
|
||||
{
|
||||
return reinterpret_cast<wxFile*>(handle)->Tell();
|
||||
}
|
||||
|
||||
std::string rGetCwd()
|
||||
{
|
||||
return fmt::ToUTF8(wxGetCwd());
|
||||
}
|
||||
|
||||
bool rMkdir(const std::string &path)
|
||||
{
|
||||
return wxMkdir(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rRmdir(const std::string &path)
|
||||
{
|
||||
return wxRmdir(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rDirExists(const std::string &path)
|
||||
{
|
||||
return wxDirExists(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rFileExists(const std::string &path)
|
||||
{
|
||||
return wxFileExists(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rRemoveFile(const std::string &path)
|
||||
{
|
||||
return wxRemoveFile(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rIsWritable(const std::string& path)
|
||||
{
|
||||
return wxIsWritable(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rIsReadable(const std::string& path)
|
||||
{
|
||||
return wxIsReadable(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rIsExecutable(const std::string& path)
|
||||
{
|
||||
return wxIsExecutable(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
rDir::rDir()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxDir());
|
||||
}
|
||||
|
||||
rDir::~rDir()
|
||||
{
|
||||
delete reinterpret_cast<wxDir*>(handle);
|
||||
}
|
||||
|
||||
rDir::rDir(const std::string &path)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxDir(fmt::FromUTF8(path)));
|
||||
}
|
||||
|
||||
bool rDir::Open(const std::string& path)
|
||||
{
|
||||
return reinterpret_cast<wxDir*>(handle)->Open(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rDir::Exists(const std::string &path)
|
||||
{
|
||||
return wxDir::Exists(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rDir::GetFirst(std::string *filename) const
|
||||
{
|
||||
wxString str;
|
||||
bool res;
|
||||
res = reinterpret_cast<wxDir*>(handle)->GetFirst(&str);
|
||||
*filename = str.ToStdString();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool rDir::GetNext(std::string *filename) const
|
||||
{
|
||||
wxString str;
|
||||
bool res;
|
||||
res = reinterpret_cast<wxDir*>(handle)->GetNext(&str);
|
||||
*filename = str.ToStdString();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rFileName::rFileName()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxFileName());
|
||||
}
|
||||
|
||||
rFileName::~rFileName()
|
||||
{
|
||||
delete reinterpret_cast<wxFileName*>(handle);
|
||||
}
|
||||
|
||||
rFileName::rFileName(const rFileName& filename)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxFileName(*reinterpret_cast<wxFileName*>(filename.handle)));
|
||||
}
|
||||
|
||||
|
||||
rFileName::rFileName(const std::string& name)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxFileName(fmt::FromUTF8(name)));
|
||||
}
|
||||
|
||||
std::string rFileName::GetFullPath()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullPath());
|
||||
}
|
||||
|
||||
std::string rFileName::GetPath()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetPath());
|
||||
}
|
||||
|
||||
std::string rFileName::GetName()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetName());
|
||||
}
|
||||
|
||||
std::string rFileName::GetFullName()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullName());
|
||||
}
|
||||
|
||||
bool rFileName::Mkdir(const std::string& name, int permissions , int flags )
|
||||
{
|
||||
return wxFileName::Mkdir(fmt::FromUTF8(name), permissions, flags);
|
||||
}
|
||||
|
||||
bool rFileName::Normalize()
|
||||
{
|
||||
return reinterpret_cast<wxFileName*>(handle)->Normalize();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
extern const int rPATH_MKDIR_FULL;
|
||||
|
||||
enum rSeekMode
|
||||
{
|
||||
rFromStart,
|
||||
rFromCurrent,
|
||||
rFromEnd
|
||||
};
|
||||
|
||||
class rFile
|
||||
{
|
||||
public:
|
||||
enum OpenMode
|
||||
{
|
||||
read,
|
||||
write,
|
||||
read_write,
|
||||
write_append,
|
||||
write_excl
|
||||
};
|
||||
rFile();
|
||||
rFile(const rFile& other) = delete;
|
||||
~rFile();
|
||||
rFile(const std::string& filename, rFile::OpenMode open = rFile::read);
|
||||
rFile(int fd);
|
||||
static bool Access(const std::string &filename, rFile::OpenMode mode);
|
||||
size_t Write(const void *buffer, size_t count);
|
||||
bool Write(const std::string &text);
|
||||
bool Close();
|
||||
bool Create(const std::string &filename, bool overwrite = false, int access = 0666);
|
||||
bool Open(const std::string &filename, rFile::OpenMode mode = rFile::read, int access = 0666);
|
||||
static bool Exists(const std::string&);
|
||||
bool IsOpened() const;
|
||||
size_t Length() const;
|
||||
size_t Read(void *buffer, size_t count);
|
||||
size_t Seek(size_t ofs, rSeekMode mode = rFromStart);
|
||||
size_t Tell() const;
|
||||
|
||||
void *handle;
|
||||
};
|
||||
|
||||
std::string rGetCwd();
|
||||
bool rMkdir(const std::string &path);
|
||||
bool rRmdir(const std::string &path);
|
||||
bool rDirExists(const std::string &path);
|
||||
bool rFileExists(const std::string &path);
|
||||
bool rRemoveFile(const std::string &path);
|
||||
|
||||
bool rIsWritable(const std::string& path);
|
||||
bool rIsReadable(const std::string& path);
|
||||
bool rIsExecutable(const std::string& path);
|
||||
|
||||
struct rDir
|
||||
{
|
||||
rDir();
|
||||
~rDir();
|
||||
rDir(const rDir& other) = delete;
|
||||
rDir(const std::string &path);
|
||||
bool Open(const std::string& path);
|
||||
static bool Exists(const std::string &path);
|
||||
bool GetFirst(std::string *filename) const;
|
||||
bool GetNext(std::string *filename) const;
|
||||
|
||||
void *handle;
|
||||
};
|
||||
struct rFileName
|
||||
{
|
||||
rFileName();
|
||||
rFileName(const rFileName& other);
|
||||
~rFileName();
|
||||
rFileName(const std::string& name);
|
||||
std::string GetFullPath();
|
||||
std::string GetPath();
|
||||
std::string GetName();
|
||||
std::string GetFullName();
|
||||
static bool Mkdir(const std::string& name, int permissions=0777, int flags=0);
|
||||
bool Normalize();
|
||||
|
||||
void *handle;
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
std::string rMessageBoxCaptionStr = "Message";
|
||||
|
||||
rMessageDialog::rMessageDialog(void *parent, const std::string& msg, const std::string& title , long style )
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxMessageDialog(
|
||||
reinterpret_cast<wxWindow*>(parent)
|
||||
, fmt::FromUTF8(msg)
|
||||
, fmt::FromUTF8(title)
|
||||
, style
|
||||
));
|
||||
}
|
||||
|
||||
rMessageDialog::~rMessageDialog()
|
||||
{
|
||||
delete reinterpret_cast<wxMessageDialog*>(handle);
|
||||
}
|
||||
|
||||
long rMessageDialog::ShowModal()
|
||||
{
|
||||
return reinterpret_cast<wxMessageDialog*>(handle)->ShowModal();
|
||||
}
|
||||
|
||||
long rMessageBox(const std::string& message, const std::string& title, long style)
|
||||
{
|
||||
return wxMessageBox(fmt::FromUTF8(message), fmt::FromUTF8(title),style);
|
||||
}
|
||||
|
||||
std::string dummyApp::GetAppName()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxApp*>(handle)->GetAppName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return "NULL";
|
||||
}
|
||||
}
|
||||
dummyApp::dummyApp() : handle(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
static dummyApp app;
|
||||
|
||||
dummyApp& rGetApp()
|
||||
{
|
||||
return app;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
extern std::string rMessageBoxCaptionStr;// = "Message";
|
||||
|
||||
enum MsgBoxParams : unsigned long
|
||||
{
|
||||
rOK = 0x4
|
||||
, rYES =0x2//res
|
||||
, rNO = 0x8 //res
|
||||
, rID_YES = 5103 //resDialog
|
||||
, rCANCEL = 0x10
|
||||
, rYES_NO = 0xA
|
||||
, rHELP = 0x1000
|
||||
, rNO_DEFAULT = 0x80
|
||||
, rCANCEL_DEFAULT = 0x80000000
|
||||
, rYES_DEFAULT = 0x0
|
||||
, rOK_DEFAULT = 0x0
|
||||
, rICON_NONE = 0x40000
|
||||
, rICON_EXCLAMATION = 0x100
|
||||
, rICON_ERROR = 0x200
|
||||
, rICON_HAND = 0x200
|
||||
, rICON_QUESTION = 0x400
|
||||
, rICON_INFORMATION = 0x800
|
||||
, rICON_AUTH_NEEDED = 0x80000
|
||||
, rSTAY_ON_TOP = 0x8000
|
||||
, rCENTRE = 0x1
|
||||
};
|
||||
|
||||
struct rMessageDialog
|
||||
{
|
||||
rMessageDialog(void *parent, const std::string& msg, const std::string& title = rMessageBoxCaptionStr, long style = rOK | rCENTRE);
|
||||
rMessageDialog(const rMessageDialog& other) = delete;
|
||||
~rMessageDialog();
|
||||
long ShowModal();
|
||||
void *handle;
|
||||
};
|
||||
|
||||
long rMessageBox(const std::string& message, const std::string& title,long style);
|
||||
|
||||
struct dummyApp
|
||||
{
|
||||
dummyApp();
|
||||
std::string GetAppName();
|
||||
void* handle;
|
||||
};
|
||||
|
||||
dummyApp& rGetApp();
|
||||
@@ -0,0 +1,182 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
#include "Gui/GLGSFrame.h"
|
||||
|
||||
#include "Emu/Io/Null/NullKeyboardHandler.h"
|
||||
#include "Emu/Io/Windows/WindowsKeyboardHandler.h"
|
||||
|
||||
#include "Emu/Io/Null/NullMouseHandler.h"
|
||||
#include "Emu/Io/Windows/WindowsMouseHandler.h"
|
||||
|
||||
#include "Emu/Io/Null/NullPadHandler.h"
|
||||
#include "Emu/Io/Windows/WindowsPadHandler.h"
|
||||
#if defined(_WIN32)
|
||||
#include "Emu/Io/XInput/XInputPadHandler.h"
|
||||
#endif
|
||||
|
||||
|
||||
rCanvas::rCanvas(void *parent)
|
||||
{
|
||||
handle = static_cast<void*>(new wxGLCanvas(static_cast<wxWindow *>(parent),wxID_ANY,NULL));
|
||||
}
|
||||
|
||||
rCanvas::~rCanvas()
|
||||
{
|
||||
delete static_cast<wxGLCanvas*>(handle);
|
||||
}
|
||||
|
||||
bool rCanvas::SetCurrent(void *ctx)
|
||||
{
|
||||
return static_cast<wxGLCanvas*>(handle)->SetCurrent(*static_cast<wxGLContext *>(ctx));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
rGLFrame::rGLFrame()
|
||||
{
|
||||
handle = static_cast<void*>(new GLGSFrame());
|
||||
}
|
||||
|
||||
rGLFrame::~rGLFrame()
|
||||
{
|
||||
delete static_cast<GLGSFrame*>(handle);
|
||||
}
|
||||
|
||||
void rGLFrame::Close()
|
||||
{
|
||||
static_cast<GLGSFrame*>(handle)->Close();
|
||||
}
|
||||
|
||||
bool rGLFrame::IsShown()
|
||||
{
|
||||
return static_cast<GLGSFrame*>(handle)->IsShown();
|
||||
}
|
||||
|
||||
void rGLFrame::Hide()
|
||||
{
|
||||
static_cast<GLGSFrame*>(handle)->Hide();
|
||||
}
|
||||
|
||||
void rGLFrame::Show()
|
||||
{
|
||||
static_cast<GLGSFrame*>(handle)->Show();
|
||||
}
|
||||
|
||||
|
||||
void *rGLFrame::GetNewContext()
|
||||
{
|
||||
return static_cast<void *>(new wxGLContext(
|
||||
static_cast<GLGSFrame*>(handle)->GetCanvas()
|
||||
));
|
||||
}
|
||||
|
||||
void rGLFrame::Flip(void *ctx)
|
||||
{
|
||||
static_cast<GLGSFrame*>(handle)->Flip(
|
||||
static_cast<wxGLContext*>(ctx));
|
||||
}
|
||||
|
||||
void rGLFrame::SetCurrent(void *ctx)
|
||||
{
|
||||
static_cast<GLGSFrame*>(handle)->GetCanvas()->SetCurrent(*static_cast<wxGLContext*>(ctx));
|
||||
}
|
||||
|
||||
|
||||
rImage::rImage()
|
||||
{
|
||||
handle = static_cast<void*>(new wxImage());
|
||||
}
|
||||
|
||||
rImage::~rImage()
|
||||
{
|
||||
delete static_cast<wxImage*>(handle);
|
||||
}
|
||||
|
||||
void rImage::Create(int width, int height, void *data, void *alpha)
|
||||
{
|
||||
static_cast<wxImage*>(handle)->Create(width, height, static_cast<unsigned char*>(data), static_cast<unsigned char*>(alpha));
|
||||
}
|
||||
void rImage::SaveFile(const std::string& name, rImageType type)
|
||||
{
|
||||
if (type == rBITMAP_TYPE_PNG)
|
||||
{
|
||||
static_cast<wxImage*>(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::string("unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
int rPlatform::getKeyboardHandlerCount()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
KeyboardHandlerBase *rPlatform::getKeyboardHandler(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return new NullKeyboardHandler();
|
||||
break;
|
||||
case 1:
|
||||
return new WindowsKeyboardHandler();
|
||||
break;
|
||||
default:
|
||||
return new NullKeyboardHandler();
|
||||
}
|
||||
}
|
||||
|
||||
int rPlatform::getMouseHandlerCount()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
MouseHandlerBase *rPlatform::getMouseHandler(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return new NullMouseHandler();
|
||||
break;
|
||||
case 1:
|
||||
return new WindowsMouseHandler();
|
||||
break;
|
||||
default:
|
||||
return new NullMouseHandler();
|
||||
}
|
||||
}
|
||||
|
||||
int rPlatform::getPadHandlerCount()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return 3;
|
||||
#else
|
||||
return 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
PadHandlerBase *rPlatform::getPadHandler(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return new NullPadHandler();
|
||||
break;
|
||||
case 1:
|
||||
return new WindowsPadHandler();
|
||||
break;
|
||||
#if defined(_WIN32)
|
||||
case 2:
|
||||
return new XInputPadHandler();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return new NullPadHandler();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Emu/Io/Null/NullKeyboardHandler.h"
|
||||
#include "Emu/Io/Null/NullMouseHandler.h"
|
||||
#include "Emu/Io/Null/NullPadHandler.h"
|
||||
|
||||
struct rCanvas
|
||||
{
|
||||
rCanvas(void *parent);
|
||||
rCanvas(const rCanvas &) = delete;
|
||||
~rCanvas();
|
||||
/*rGLContext*/void *GetCurrent();
|
||||
bool SetCurrent(/*rGLContext &*/ void *ctx);
|
||||
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rGLFrame
|
||||
{
|
||||
rGLFrame();
|
||||
rGLFrame(const rGLFrame &) = delete;
|
||||
~rGLFrame();
|
||||
|
||||
void Close();
|
||||
bool IsShown();
|
||||
void Hide();
|
||||
void Show();
|
||||
|
||||
void *handle;
|
||||
|
||||
void SetCurrent( void *ctx);
|
||||
void *GetNewContext();
|
||||
void Flip(/*rGLContext*/void *ctx);
|
||||
};
|
||||
|
||||
struct rPlatform
|
||||
{
|
||||
rGLFrame *getGLGSFrame();
|
||||
static rPlatform &getPlatform();
|
||||
|
||||
static int getKeyboardHandlerCount();
|
||||
static KeyboardHandlerBase *getKeyboardHandler(int i);
|
||||
static int getMouseHandlerCount();
|
||||
static MouseHandlerBase *getMouseHandler(int i);
|
||||
static int getPadHandlerCount();
|
||||
static PadHandlerBase *getPadHandler(int i);
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
*********** RSX Debugger
|
||||
************************************************************************/
|
||||
|
||||
struct RSXDebuggerProgram
|
||||
{
|
||||
u32 id;
|
||||
u32 vp_id;
|
||||
u32 fp_id;
|
||||
std::string vp_shader;
|
||||
std::string fp_shader;
|
||||
bool modified;
|
||||
|
||||
RSXDebuggerProgram()
|
||||
: modified(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
extern std::vector<RSXDebuggerProgram> m_debug_programs;
|
||||
|
||||
/**********************************************************************
|
||||
*********** Image stuff
|
||||
************************************************************************/
|
||||
enum rImageType
|
||||
{
|
||||
rBITMAP_TYPE_PNG
|
||||
};
|
||||
struct rImage
|
||||
{
|
||||
rImage();
|
||||
rImage(const rImage &) = delete;
|
||||
~rImage();
|
||||
void Create(int width , int height, void *data, void *alpha);
|
||||
void SaveFile(const std::string& name, rImageType type);
|
||||
|
||||
void *handle;
|
||||
};
|
||||
@@ -0,0 +1,231 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <wx/datetime.h>
|
||||
|
||||
std::string rDefaultDateTimeFormat = "%c";
|
||||
|
||||
rTimeSpan::rTimeSpan()
|
||||
{
|
||||
handle = static_cast<void *>(new wxTimeSpan());
|
||||
}
|
||||
|
||||
rTimeSpan::~rTimeSpan()
|
||||
{
|
||||
delete static_cast<wxTimeSpan*>(handle);
|
||||
}
|
||||
|
||||
rTimeSpan::rTimeSpan(const rTimeSpan& other)
|
||||
|
||||
{
|
||||
handle = static_cast<void *>(new wxTimeSpan(*static_cast<wxTimeSpan*>(other.handle)));
|
||||
|
||||
}
|
||||
|
||||
rTimeSpan::rTimeSpan(int a, int b , int c, int d)
|
||||
{
|
||||
handle = static_cast<void *>(new wxTimeSpan(a,b,c,d));
|
||||
}
|
||||
|
||||
|
||||
rDateSpan::rDateSpan()
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateSpan());
|
||||
}
|
||||
|
||||
rDateSpan::~rDateSpan()
|
||||
{
|
||||
delete static_cast<wxDateSpan*>(handle);
|
||||
}
|
||||
|
||||
rDateSpan::rDateSpan(const rDateSpan& other)
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateSpan(*static_cast<wxDateSpan*>(other.handle)));
|
||||
}
|
||||
|
||||
rDateSpan::rDateSpan(int a, int b, int c, int d)
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateSpan(a,b,c,d));
|
||||
}
|
||||
|
||||
rDateTime::rDateTime()
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateTime());
|
||||
}
|
||||
|
||||
rDateTime::~rDateTime()
|
||||
{
|
||||
delete static_cast<wxDateTime*>(handle);
|
||||
}
|
||||
|
||||
rDateTime::rDateTime(const rDateTime& other)
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateTime(*static_cast<wxDateTime*>(other.handle)));
|
||||
}
|
||||
|
||||
rDateTime::rDateTime(const time_t& time)
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateTime(time));
|
||||
}
|
||||
|
||||
rDateTime::rDateTime(u16 day, rDateTime::Month month, u16 year, u16 hour, u16 minute, u16 second, u32 millisecond)
|
||||
{
|
||||
handle = static_cast<void *>(new wxDateTime(day,(wxDateTime::Month)month,year,hour,minute,second,millisecond));
|
||||
}
|
||||
|
||||
rDateTime rDateTime::UNow()
|
||||
{
|
||||
rDateTime time;
|
||||
delete static_cast<wxDateTime*>(time.handle);
|
||||
time.handle = static_cast<void *>(new wxDateTime(wxDateTime::UNow()));
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
rDateTime rDateTime::FromUTC(bool val)
|
||||
{
|
||||
rDateTime time(*this);
|
||||
void *temp = time.handle;
|
||||
|
||||
time.handle = static_cast<void *>(new wxDateTime(static_cast<wxDateTime*>(temp)->FromTimezone(wxDateTime::GMT0, val)));
|
||||
delete static_cast<wxDateTime*>(temp);
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
rDateTime rDateTime::ToUTC(bool val)
|
||||
{
|
||||
rDateTime time(*this);
|
||||
void *temp = time.handle;
|
||||
|
||||
time.handle = static_cast<void *>(new wxDateTime(static_cast<wxDateTime*>(temp)->ToTimezone(wxDateTime::GMT0, val)));
|
||||
delete static_cast<wxDateTime*>(temp);
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
time_t rDateTime::GetTicks()
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetTicks();
|
||||
}
|
||||
|
||||
void rDateTime::Add(const rTimeSpan& span)
|
||||
{
|
||||
static_cast<wxDateTime*>(handle)->Add(*static_cast<wxTimeSpan*>(span.handle));
|
||||
}
|
||||
|
||||
void rDateTime::Add(const rDateSpan& span)
|
||||
{
|
||||
static_cast<wxDateTime*>(handle)->Add(*static_cast<wxDateSpan*>(span.handle));
|
||||
}
|
||||
|
||||
wxDateTime::TimeZone convertTZ(rDateTime::rTimeZone tz)
|
||||
{
|
||||
switch (tz)
|
||||
{
|
||||
case rDateTime::Local:
|
||||
return wxDateTime::Local;
|
||||
case rDateTime::GMT0:
|
||||
return wxDateTime::GMT0;
|
||||
case rDateTime::UTC:
|
||||
return wxDateTime::UTC;
|
||||
default:
|
||||
throw std::string("WRONG DATETIME");
|
||||
}
|
||||
}
|
||||
|
||||
std::string rDateTime::Format(const std::string &format, const rTimeZone &tz) const
|
||||
{
|
||||
return fmt::ToUTF8(static_cast<wxDateTime*>(handle)->Format(fmt::FromUTF8(format),convertTZ(tz)));
|
||||
}
|
||||
|
||||
void rDateTime::ParseDateTime(const std::string & format)
|
||||
{
|
||||
static_cast<wxDateTime*>(handle)->ParseDateTime(fmt::FromUTF8(format));
|
||||
}
|
||||
|
||||
u32 rDateTime::GetAsDOS()
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetAsDOS();
|
||||
}
|
||||
|
||||
rDateTime &rDateTime::SetFromDOS(u32 fromdos)
|
||||
{
|
||||
static_cast<wxDateTime*>(handle)->SetFromDOS(fromdos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool rDateTime::IsLeapYear(int year, rDateTime::Calender cal)
|
||||
{
|
||||
if (cal == Gregorian)
|
||||
{
|
||||
return wxDateTime::IsLeapYear(year, wxDateTime::Gregorian);
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxDateTime::IsLeapYear(year, wxDateTime::Julian);
|
||||
}
|
||||
}
|
||||
|
||||
int rDateTime::GetNumberOfDays(rDateTime::Month month, int year, rDateTime::Calender cal)
|
||||
{
|
||||
if (cal == Gregorian)
|
||||
{
|
||||
return wxDateTime::GetNumberOfDays(static_cast<wxDateTime::Month>(month), year, wxDateTime::Gregorian);
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxDateTime::GetNumberOfDays(static_cast<wxDateTime::Month>(month), year, wxDateTime::Julian);
|
||||
}
|
||||
}
|
||||
|
||||
void rDateTime::SetToWeekDay(rDateTime::WeekDay day, int n, rDateTime::Month month, int year)
|
||||
{
|
||||
static_cast<wxDateTime*>(handle)->SetToWeekDay(
|
||||
static_cast<wxDateTime::WeekDay>(day)
|
||||
, n
|
||||
, static_cast<wxDateTime::Month>(month)
|
||||
, year
|
||||
);
|
||||
}
|
||||
|
||||
int rDateTime::GetWeekDay()
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetWeekDay();
|
||||
}
|
||||
|
||||
u16 rDateTime::GetYear(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetYear(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u16 rDateTime::GetMonth(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetMonth(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u16 rDateTime::GetDay(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetDay(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u16 rDateTime::GetHour(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetHour(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u16 rDateTime::GetMinute(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetMinute(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u16 rDateTime::GetSecond(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetSecond(convertTZ(timezone));
|
||||
}
|
||||
|
||||
u32 rDateTime::GetMillisecond(rDateTime::TZ timezone)
|
||||
{
|
||||
return static_cast<wxDateTime*>(handle)->GetMillisecond(convertTZ(timezone));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
#pragma once
|
||||
|
||||
extern std::string rDefaultDateTimeFormat;
|
||||
|
||||
|
||||
struct rTimeSpan
|
||||
{
|
||||
rTimeSpan();
|
||||
~rTimeSpan();
|
||||
rTimeSpan(const rTimeSpan& other);
|
||||
rTimeSpan(int, int, int, int);
|
||||
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rDateSpan
|
||||
{
|
||||
rDateSpan();
|
||||
~rDateSpan();
|
||||
rDateSpan(const rDateSpan& other);
|
||||
rDateSpan(int, int, int, int);
|
||||
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rDateTime
|
||||
{
|
||||
enum TZ
|
||||
{
|
||||
Local, GMT0,UTC
|
||||
};
|
||||
enum Calender
|
||||
{
|
||||
Gregorian, Julian
|
||||
};
|
||||
|
||||
using rTimeZone = TZ;
|
||||
|
||||
enum WeekDay
|
||||
{
|
||||
Sun = 0,
|
||||
Mon,
|
||||
Tue,
|
||||
Wed,
|
||||
Thu,
|
||||
Fri,
|
||||
Sat,
|
||||
Inv_WeekDay
|
||||
};
|
||||
|
||||
enum Month {
|
||||
Jan = 0,
|
||||
Feb = 1,
|
||||
Mar = 2,
|
||||
Apr = 3,
|
||||
May = 4,
|
||||
Jun = 5,
|
||||
Jul = 6,
|
||||
Aug = 7,
|
||||
Sep = 8,
|
||||
Oct = 9,
|
||||
Nov = 10,
|
||||
Dec = 11,
|
||||
Inv_Month = 12
|
||||
};
|
||||
|
||||
rDateTime();
|
||||
~rDateTime();
|
||||
rDateTime(const rDateTime& other);
|
||||
rDateTime(const time_t &time);
|
||||
rDateTime(u16 day, rDateTime::Month month, u16 year, u16 hour, u16 minute, u16 second, u32 millisecond);
|
||||
|
||||
static rDateTime UNow();
|
||||
rDateTime FromUTC(bool val);
|
||||
rDateTime ToUTC(bool val);
|
||||
time_t GetTicks();
|
||||
void Add(const rTimeSpan& span);
|
||||
void Add(const rDateSpan& span);
|
||||
void Close();
|
||||
std::string Format(const std::string &format = rDefaultDateTimeFormat, const rTimeZone &tz = Local) const;
|
||||
|
||||
void ParseDateTime(const std::string & format);
|
||||
|
||||
u32 GetAsDOS();
|
||||
rDateTime &SetFromDOS(u32 fromdos);
|
||||
|
||||
static bool IsLeapYear(int year, rDateTime::Calender cal);
|
||||
static int GetNumberOfDays(rDateTime::Month month, int year, rDateTime::Calender cal);
|
||||
void SetToWeekDay(rDateTime::WeekDay day, int n, rDateTime::Month month, int year);
|
||||
int GetWeekDay();
|
||||
|
||||
u16 GetYear( rDateTime::TZ timezone);
|
||||
u16 GetMonth(rDateTime::TZ timezone);
|
||||
u16 GetDay(rDateTime::TZ timezone);
|
||||
u16 GetHour(rDateTime::TZ timezone);
|
||||
u16 GetMinute(rDateTime::TZ timezone);
|
||||
u16 GetSecond(rDateTime::TZ timezone);
|
||||
u32 GetMillisecond(rDateTime::TZ timezone);
|
||||
|
||||
void *handle;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <wx/xml/xml.h>
|
||||
|
||||
rXmlNode::rXmlNode()
|
||||
{
|
||||
ownPtr = true;
|
||||
handle = reinterpret_cast<void *>(new wxXmlNode());
|
||||
}
|
||||
|
||||
rXmlNode::rXmlNode(void *ptr)
|
||||
{
|
||||
ownPtr = false;
|
||||
handle = ptr;
|
||||
}
|
||||
|
||||
rXmlNode::rXmlNode(const rXmlNode& other)
|
||||
{
|
||||
ownPtr = true;
|
||||
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
|
||||
}
|
||||
|
||||
rXmlNode &rXmlNode::operator=(const rXmlNode& other)
|
||||
{
|
||||
if (ownPtr)
|
||||
{
|
||||
delete reinterpret_cast<wxXmlNode*>(handle);
|
||||
}
|
||||
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
|
||||
ownPtr = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
rXmlNode::~rXmlNode()
|
||||
{
|
||||
if (ownPtr)
|
||||
{
|
||||
delete reinterpret_cast<wxXmlNode*>(handle);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlNode::GetChildren()
|
||||
{
|
||||
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetChildren();
|
||||
if (result)
|
||||
{
|
||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::shared_ptr<rXmlNode>(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlNode::GetNext()
|
||||
{
|
||||
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetNext();
|
||||
if (result)
|
||||
{
|
||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::shared_ptr<rXmlNode>(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetName()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetName());
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetAttribute(const std::string &name)
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetAttribute(fmt::FromUTF8(name)));
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetNodeContent()
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetNodeContent());
|
||||
}
|
||||
|
||||
rXmlDocument::rXmlDocument()
|
||||
{
|
||||
handle = reinterpret_cast<void *>(new wxXmlDocument());
|
||||
}
|
||||
|
||||
rXmlDocument::rXmlDocument(const rXmlDocument& other)
|
||||
{
|
||||
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
|
||||
}
|
||||
|
||||
rXmlDocument &rXmlDocument::operator = (const rXmlDocument& other)
|
||||
{
|
||||
delete reinterpret_cast<wxXmlDocument*>(handle);
|
||||
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
rXmlDocument::~rXmlDocument()
|
||||
{
|
||||
delete reinterpret_cast<wxXmlDocument*>(handle);
|
||||
}
|
||||
|
||||
void rXmlDocument::Load(const std::string & path)
|
||||
{
|
||||
reinterpret_cast<wxXmlDocument*>(handle)->Load(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
|
||||
{
|
||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(reinterpret_cast<wxXmlDocument*>(handle)->GetRoot()));
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
struct rXmlNode
|
||||
{
|
||||
rXmlNode();
|
||||
rXmlNode(void *);
|
||||
rXmlNode(const rXmlNode& other);
|
||||
rXmlNode &operator=(const rXmlNode& other);
|
||||
~rXmlNode();
|
||||
std::shared_ptr<rXmlNode> GetChildren();
|
||||
std::shared_ptr<rXmlNode> GetNext();
|
||||
std::string GetName();
|
||||
std::string GetAttribute( const std::string &name);
|
||||
std::string GetNodeContent();
|
||||
|
||||
void *handle;
|
||||
bool ownPtr;
|
||||
};
|
||||
|
||||
struct rXmlDocument
|
||||
{
|
||||
rXmlDocument();
|
||||
rXmlDocument(const rXmlDocument& other);
|
||||
rXmlDocument &operator=(const rXmlDocument& other);
|
||||
~rXmlDocument();
|
||||
void Load(const std::string & path);
|
||||
std::shared_ptr<rXmlNode> GetRoot();
|
||||
|
||||
void *handle;
|
||||
};
|
||||
@@ -0,0 +1,539 @@
|
||||
/*
|
||||
* Copyright 2001-2004 Unicode, Inc.
|
||||
*
|
||||
* Disclaimer
|
||||
*
|
||||
* This source code is provided as is by Unicode, Inc. No claims are
|
||||
* made as to fitness for any particular purpose. No warranties of any
|
||||
* kind are expressed or implied. The recipient agrees to determine
|
||||
* applicability of information provided. If this file has been
|
||||
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||
* sole remedy for any claim will be exchange of defective media
|
||||
* within 90 days of receipt.
|
||||
*
|
||||
* Limitations on Rights to Redistribute This Code
|
||||
*
|
||||
* Unicode, Inc. hereby grants the right to freely use the information
|
||||
* supplied in this file in the creation of products supporting the
|
||||
* Unicode Standard, and to make copies of this file in any form
|
||||
* for internal or external distribution as long as this notice
|
||||
* remains attached.
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Conversions between UTF32, UTF-16, and UTF-8. Source code file.
|
||||
Author: Mark E. Davis, 1994.
|
||||
Rev History: Rick McGowan, fixes & updates May 2001.
|
||||
Sept 2001: fixed const & error conditions per
|
||||
mods suggested by S. Parent & A. Lillich.
|
||||
June 2002: Tim Dodd added detection and handling of incomplete
|
||||
source sequences, enhanced error detection, added casts
|
||||
to eliminate compiler warnings.
|
||||
July 2003: slight mods to back out aggressive FFFE detection.
|
||||
Jan 2004: updated switches in from-UTF8 conversions.
|
||||
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
|
||||
|
||||
See the header file "ConvertUTF.h" for complete documentation.
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#include "ConvertUTF.h"
|
||||
#ifdef CVTUTF_DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
static const int halfShift = 10; /* used for shifting by 10 bits */
|
||||
|
||||
static const UTF32 halfBase = 0x0010000UL;
|
||||
static const UTF32 halfMask = 0x3FFUL;
|
||||
|
||||
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
||||
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
||||
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
||||
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF32toUTF16 (
|
||||
const UTF32** sourceStart, const UTF32* sourceEnd,
|
||||
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF32* source = *sourceStart;
|
||||
UTF16* target = *targetStart;
|
||||
while (source < sourceEnd) {
|
||||
UTF32 ch;
|
||||
if (target >= targetEnd) {
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
ch = *source++;
|
||||
if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
|
||||
/* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
|
||||
if (flags == strictConversion) {
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
} else {
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else {
|
||||
*target++ = (UTF16)ch; /* normal case */
|
||||
}
|
||||
} else if (ch > UNI_MAX_LEGAL_UTF32) {
|
||||
if (flags == strictConversion) {
|
||||
result = sourceIllegal;
|
||||
} else {
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else {
|
||||
/* target is a character in range 0xFFFF - 0x10FFFF. */
|
||||
if (target + 1 >= targetEnd) {
|
||||
--source; /* Back up source pointer! */
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
ch -= halfBase;
|
||||
*target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
|
||||
*target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
|
||||
}
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF16toUTF32 (
|
||||
const UTF16** sourceStart, const UTF16* sourceEnd,
|
||||
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF16* source = *sourceStart;
|
||||
UTF32* target = *targetStart;
|
||||
UTF32 ch, ch2;
|
||||
while (source < sourceEnd) {
|
||||
const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
ch = *source++;
|
||||
/* If we have a surrogate pair, convert to UTF32 first. */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
|
||||
/* If the 16 bits following the high surrogate are in the source buffer... */
|
||||
if (source < sourceEnd) {
|
||||
ch2 = *source;
|
||||
/* If it's a low surrogate, convert to UTF32. */
|
||||
if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
|
||||
ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
|
||||
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
||||
++source;
|
||||
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
} else { /* We don't have the 16 bits following the high surrogate. */
|
||||
--source; /* return to the high surrogate */
|
||||
result = sourceExhausted;
|
||||
break;
|
||||
}
|
||||
} else if (flags == strictConversion) {
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (target >= targetEnd) {
|
||||
source = oldSource; /* Back up source pointer! */
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
*target++ = ch;
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
#ifdef CVTUTF_DEBUG
|
||||
if (result == sourceIllegal) {
|
||||
fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
|
||||
fflush(stderr);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Index into the table below with the first byte of a UTF-8 sequence to
|
||||
* get the number of trailing bytes that are supposed to follow it.
|
||||
* Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
|
||||
* left as-is for anyone who may want to do such conversion, which was
|
||||
* allowed in earlier algorithms.
|
||||
*/
|
||||
static const char trailingBytesForUTF8[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
||||
};
|
||||
|
||||
/*
|
||||
* Magic values subtracted from a buffer value during UTF8 conversion.
|
||||
* This table contains as many values as there might be trailing bytes
|
||||
* in a UTF-8 sequence.
|
||||
*/
|
||||
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
||||
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
|
||||
|
||||
/*
|
||||
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
|
||||
* into the first byte, depending on how many bytes follow. There are
|
||||
* as many entries in this table as there are UTF-8 sequence types.
|
||||
* (I.e., one byte sequence, two byte... etc.). Remember that sequencs
|
||||
* for *legal* UTF-8 will be 4 or fewer bytes total.
|
||||
*/
|
||||
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/* The interface converts a whole buffer to avoid function-call overhead.
|
||||
* Constants have been gathered. Loops & conditionals have been removed as
|
||||
* much as possible for efficiency, in favor of drop-through switches.
|
||||
* (See "Note A" at the bottom of the file for equivalent code.)
|
||||
* If your compiler supports it, the "isLegalUTF8" call can be turned
|
||||
* into an inline function.
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF16toUTF8 (
|
||||
const UTF16** sourceStart, const UTF16* sourceEnd,
|
||||
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF16* source = *sourceStart;
|
||||
UTF8* target = *targetStart;
|
||||
while (source < sourceEnd) {
|
||||
UTF32 ch;
|
||||
unsigned short bytesToWrite = 0;
|
||||
const UTF32 byteMask = 0xBF;
|
||||
const UTF32 byteMark = 0x80;
|
||||
const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
ch = *source++;
|
||||
/* If we have a surrogate pair, convert to UTF32 first. */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
|
||||
/* If the 16 bits following the high surrogate are in the source buffer... */
|
||||
if (source < sourceEnd) {
|
||||
UTF32 ch2 = *source;
|
||||
/* If it's a low surrogate, convert to UTF32. */
|
||||
if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
|
||||
ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
|
||||
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
||||
++source;
|
||||
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
} else { /* We don't have the 16 bits following the high surrogate. */
|
||||
--source; /* return to the high surrogate */
|
||||
result = sourceExhausted;
|
||||
break;
|
||||
}
|
||||
} else if (flags == strictConversion) {
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Figure out how many bytes the result will require */
|
||||
if (ch < (UTF32)0x80) { bytesToWrite = 1;
|
||||
} else if (ch < (UTF32)0x800) { bytesToWrite = 2;
|
||||
} else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
|
||||
} else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
|
||||
} else { bytesToWrite = 3;
|
||||
ch = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
|
||||
target += bytesToWrite;
|
||||
if (target > targetEnd) {
|
||||
source = oldSource; /* Back up source pointer! */
|
||||
target -= bytesToWrite; result = targetExhausted; break;
|
||||
}
|
||||
switch (bytesToWrite) { /* note: everything falls through. */
|
||||
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
|
||||
}
|
||||
target += bytesToWrite;
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Utility routine to tell whether a sequence of bytes is legal UTF-8.
|
||||
* This must be called with the length pre-determined by the first byte.
|
||||
* If not calling this from ConvertUTF8to*, then the length can be set by:
|
||||
* length = trailingBytesForUTF8[*source]+1;
|
||||
* and the sequence is illegal right away if there aren't that many bytes
|
||||
* available.
|
||||
* If presented with a length > 4, this returns false. The Unicode
|
||||
* definition of UTF-8 goes up to 4-byte sequences.
|
||||
*/
|
||||
|
||||
static Boolean isLegalUTF8(const UTF8 *source, int length) {
|
||||
UTF8 a;
|
||||
const UTF8 *srcptr = source+length;
|
||||
switch (length) {
|
||||
default: return false;
|
||||
/* Everything else falls through when "true"... */
|
||||
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
||||
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
||||
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
|
||||
|
||||
switch (*source) {
|
||||
/* no fall-through in this inner switch */
|
||||
case 0xE0: if (a < 0xA0) return false; break;
|
||||
case 0xED: if (a > 0x9F) return false; break;
|
||||
case 0xF0: if (a < 0x90) return false; break;
|
||||
case 0xF4: if (a > 0x8F) return false; break;
|
||||
default: if (a < 0x80) return false;
|
||||
}
|
||||
|
||||
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
|
||||
}
|
||||
if (*source > 0xF4) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Exported function to return whether a UTF-8 sequence is legal or not.
|
||||
* This is not used here; it's just exported.
|
||||
*/
|
||||
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
|
||||
int length = trailingBytesForUTF8[*source]+1;
|
||||
if (source+length > sourceEnd) {
|
||||
return false;
|
||||
}
|
||||
return isLegalUTF8(source, length);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF8toUTF16 (
|
||||
const UTF8** sourceStart, const UTF8* sourceEnd,
|
||||
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF8* source = *sourceStart;
|
||||
UTF16* target = *targetStart;
|
||||
while (source < sourceEnd) {
|
||||
UTF32 ch = 0;
|
||||
unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
|
||||
if (source + extraBytesToRead >= sourceEnd) {
|
||||
result = sourceExhausted; break;
|
||||
}
|
||||
/* Do this check whether lenient or strict */
|
||||
if (! isLegalUTF8(source, extraBytesToRead+1)) {
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* The cases all fall through. See "Note A" below.
|
||||
*/
|
||||
switch (extraBytesToRead) {
|
||||
case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
||||
case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
||||
case 3: ch += *source++; ch <<= 6;
|
||||
case 2: ch += *source++; ch <<= 6;
|
||||
case 1: ch += *source++; ch <<= 6;
|
||||
case 0: ch += *source++;
|
||||
}
|
||||
ch -= offsetsFromUTF8[extraBytesToRead];
|
||||
|
||||
if (target >= targetEnd) {
|
||||
source -= (extraBytesToRead+1); /* Back up source pointer! */
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
|
||||
if (flags == strictConversion) {
|
||||
source -= (extraBytesToRead+1); /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
} else {
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else {
|
||||
*target++ = (UTF16)ch; /* normal case */
|
||||
}
|
||||
} else if (ch > UNI_MAX_UTF16) {
|
||||
if (flags == strictConversion) {
|
||||
result = sourceIllegal;
|
||||
source -= (extraBytesToRead+1); /* return to the start */
|
||||
break; /* Bail out; shouldn't continue */
|
||||
} else {
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else {
|
||||
/* target is a character in range 0xFFFF - 0x10FFFF. */
|
||||
if (target + 1 >= targetEnd) {
|
||||
source -= (extraBytesToRead+1); /* Back up source pointer! */
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
ch -= halfBase;
|
||||
*target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
|
||||
*target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
|
||||
}
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF32toUTF8 (
|
||||
const UTF32** sourceStart, const UTF32* sourceEnd,
|
||||
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF32* source = *sourceStart;
|
||||
UTF8* target = *targetStart;
|
||||
while (source < sourceEnd) {
|
||||
UTF32 ch;
|
||||
unsigned short bytesToWrite = 0;
|
||||
const UTF32 byteMask = 0xBF;
|
||||
const UTF32 byteMark = 0x80;
|
||||
ch = *source++;
|
||||
if (flags == strictConversion ) {
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Figure out how many bytes the result will require. Turn any
|
||||
* illegally large UTF32 things (> Plane 17) into replacement chars.
|
||||
*/
|
||||
if (ch < (UTF32)0x80) { bytesToWrite = 1;
|
||||
} else if (ch < (UTF32)0x800) { bytesToWrite = 2;
|
||||
} else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
|
||||
} else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
|
||||
} else { bytesToWrite = 3;
|
||||
ch = UNI_REPLACEMENT_CHAR;
|
||||
result = sourceIllegal;
|
||||
}
|
||||
|
||||
target += bytesToWrite;
|
||||
if (target > targetEnd) {
|
||||
--source; /* Back up source pointer! */
|
||||
target -= bytesToWrite; result = targetExhausted; break;
|
||||
}
|
||||
switch (bytesToWrite) { /* note: everything falls through. */
|
||||
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
|
||||
}
|
||||
target += bytesToWrite;
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF8toUTF32 (
|
||||
const UTF8** sourceStart, const UTF8* sourceEnd,
|
||||
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
|
||||
ConversionResult result = conversionOK;
|
||||
const UTF8* source = *sourceStart;
|
||||
UTF32* target = *targetStart;
|
||||
while (source < sourceEnd) {
|
||||
UTF32 ch = 0;
|
||||
unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
|
||||
if (source + extraBytesToRead >= sourceEnd) {
|
||||
result = sourceExhausted; break;
|
||||
}
|
||||
/* Do this check whether lenient or strict */
|
||||
if (! isLegalUTF8(source, extraBytesToRead+1)) {
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* The cases all fall through. See "Note A" below.
|
||||
*/
|
||||
switch (extraBytesToRead) {
|
||||
case 5: ch += *source++; ch <<= 6;
|
||||
case 4: ch += *source++; ch <<= 6;
|
||||
case 3: ch += *source++; ch <<= 6;
|
||||
case 2: ch += *source++; ch <<= 6;
|
||||
case 1: ch += *source++; ch <<= 6;
|
||||
case 0: ch += *source++;
|
||||
}
|
||||
ch -= offsetsFromUTF8[extraBytesToRead];
|
||||
|
||||
if (target >= targetEnd) {
|
||||
source -= (extraBytesToRead+1); /* Back up the source pointer! */
|
||||
result = targetExhausted; break;
|
||||
}
|
||||
if (ch <= UNI_MAX_LEGAL_UTF32) {
|
||||
/*
|
||||
* UTF-16 surrogate values are illegal in UTF-32, and anything
|
||||
* over Plane 17 (> 0x10FFFF) is illegal.
|
||||
*/
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
|
||||
if (flags == strictConversion) {
|
||||
source -= (extraBytesToRead+1); /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
} else {
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else {
|
||||
*target++ = ch;
|
||||
}
|
||||
} else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
|
||||
result = sourceIllegal;
|
||||
*target++ = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
}
|
||||
*sourceStart = source;
|
||||
*targetStart = target;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Note A.
|
||||
The fall-through switches in UTF-8 reading code save a
|
||||
temp variable, some decrements & conditionals. The switches
|
||||
are equivalent to the following loop:
|
||||
{
|
||||
int tmpBytesToRead = extraBytesToRead+1;
|
||||
do {
|
||||
ch += *source++;
|
||||
--tmpBytesToRead;
|
||||
if (tmpBytesToRead) ch <<= 6;
|
||||
} while (tmpBytesToRead > 0);
|
||||
}
|
||||
In UTF-8 writing code, the switches on "bytesToWrite" are
|
||||
similarly unrolled loops.
|
||||
|
||||
--------------------------------------------------------------------- */
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright 2001-2004 Unicode, Inc.
|
||||
*
|
||||
* Disclaimer
|
||||
*
|
||||
* This source code is provided as is by Unicode, Inc. No claims are
|
||||
* made as to fitness for any particular purpose. No warranties of any
|
||||
* kind are expressed or implied. The recipient agrees to determine
|
||||
* applicability of information provided. If this file has been
|
||||
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||
* sole remedy for any claim will be exchange of defective media
|
||||
* within 90 days of receipt.
|
||||
*
|
||||
* Limitations on Rights to Redistribute This Code
|
||||
*
|
||||
* Unicode, Inc. hereby grants the right to freely use the information
|
||||
* supplied in this file in the creation of products supporting the
|
||||
* Unicode Standard, and to make copies of this file in any form
|
||||
* for internal or external distribution as long as this notice
|
||||
* remains attached.
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Conversions between UTF32, UTF-16, and UTF-8. Header file.
|
||||
|
||||
Several funtions are included here, forming a complete set of
|
||||
conversions between the three formats. UTF-7 is not included
|
||||
here, but is handled in a separate source file.
|
||||
|
||||
Each of these routines takes pointers to input buffers and output
|
||||
buffers. The input buffers are const.
|
||||
|
||||
Each routine converts the text between *sourceStart and sourceEnd,
|
||||
putting the result into the buffer between *targetStart and
|
||||
targetEnd. Note: the end pointers are *after* the last item: e.g.
|
||||
*(sourceEnd - 1) is the last item.
|
||||
|
||||
The return result indicates whether the conversion was successful,
|
||||
and if not, whether the problem was in the source or target buffers.
|
||||
(Only the first encountered problem is indicated.)
|
||||
|
||||
After the conversion, *sourceStart and *targetStart are both
|
||||
updated to point to the end of last text successfully converted in
|
||||
the respective buffers.
|
||||
|
||||
Input parameters:
|
||||
sourceStart - pointer to a pointer to the source buffer.
|
||||
The contents of this are modified on return so that
|
||||
it points at the next thing to be converted.
|
||||
targetStart - similarly, pointer to pointer to the target buffer.
|
||||
sourceEnd, targetEnd - respectively pointers to the ends of the
|
||||
two buffers, for overflow checking only.
|
||||
|
||||
These conversion functions take a ConversionFlags argument. When this
|
||||
flag is set to strict, both irregular sequences and isolated surrogates
|
||||
will cause an error. When the flag is set to lenient, both irregular
|
||||
sequences and isolated surrogates are converted.
|
||||
|
||||
Whether the flag is strict or lenient, all illegal sequences will cause
|
||||
an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
|
||||
or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
|
||||
must check for illegal sequences.
|
||||
|
||||
When the flag is set to lenient, characters over 0x10FFFF are converted
|
||||
to the replacement character; otherwise (when the flag is set to strict)
|
||||
they constitute an error.
|
||||
|
||||
Output parameters:
|
||||
The value "sourceIllegal" is returned from some routines if the input
|
||||
sequence is malformed. When "sourceIllegal" is returned, the source
|
||||
value will point to the illegal value that caused the problem. E.g.,
|
||||
in UTF-8 when a sequence is malformed, it points to the start of the
|
||||
malformed sequence.
|
||||
|
||||
Author: Mark E. Davis, 1994.
|
||||
Rev History: Rick McGowan, fixes & updates May 2001.
|
||||
Fixes & updates, Sept 2001.
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
The following 4 definitions are compiler-specific.
|
||||
The C standard does not guarantee that wchar_t has at least
|
||||
16 bits, so wchar_t is no less portable than unsigned short!
|
||||
All should be unsigned values to avoid sign extension during
|
||||
bit mask & shift operations.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
typedef unsigned int UTF32; /* at least 32 bits */
|
||||
typedef unsigned short UTF16; /* at least 16 bits */
|
||||
typedef unsigned char UTF8; /* typically 8 bits */
|
||||
typedef unsigned char Boolean; /* 0 or 1 */
|
||||
|
||||
/* Some fundamental constants */
|
||||
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
||||
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
||||
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
||||
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
||||
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
||||
|
||||
typedef enum {
|
||||
conversionOK, /* conversion successful */
|
||||
sourceExhausted, /* partial character in source, but hit end */
|
||||
targetExhausted, /* insuff. room in target for conversion */
|
||||
sourceIllegal /* source sequence is illegal/malformed */
|
||||
} ConversionResult;
|
||||
|
||||
typedef enum {
|
||||
strictConversion = 0,
|
||||
lenientConversion
|
||||
} ConversionFlags;
|
||||
|
||||
/* This is for C++ and does no harm in C */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
ConversionResult ConvertUTF8toUTF16 (
|
||||
const UTF8** sourceStart, const UTF8* sourceEnd,
|
||||
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
|
||||
|
||||
ConversionResult ConvertUTF16toUTF8 (
|
||||
const UTF16** sourceStart, const UTF16* sourceEnd,
|
||||
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
|
||||
|
||||
ConversionResult ConvertUTF8toUTF32 (
|
||||
const UTF8** sourceStart, const UTF8* sourceEnd,
|
||||
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
|
||||
|
||||
ConversionResult ConvertUTF32toUTF8 (
|
||||
const UTF32** sourceStart, const UTF32* sourceEnd,
|
||||
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
|
||||
|
||||
ConversionResult ConvertUTF16toUTF32 (
|
||||
const UTF16** sourceStart, const UTF16* sourceEnd,
|
||||
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
|
||||
|
||||
ConversionResult ConvertUTF32toUTF16 (
|
||||
const UTF32** sourceStart, const UTF32* sourceEnd,
|
||||
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
|
||||
|
||||
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2006-2013 Brodie Thiesfield
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,150 @@
|
||||
simpleini
|
||||
=========
|
||||
|
||||
A cross-platform library that provides a simple API to read and write INI-style configuration files. It supports data files in ASCII, MBCS and Unicode. It is designed explicitly to be portable to any platform and has been tested on Windows, WinCE and Linux. Released as open-source and free using the MIT licence.
|
||||
|
||||
# Feature Summary
|
||||
|
||||
- MIT Licence allows free use in all software (including GPL and commercial)
|
||||
- multi-platform (Windows 95/98/ME/NT/2K/XP/2003, Windows CE, Linux, Unix)
|
||||
- loading and saving of INI-style configuration files
|
||||
- configuration files can have any newline format on all platforms
|
||||
- liberal acceptance of file format
|
||||
* key/values with no section
|
||||
* removal of whitespace around sections, keys and values
|
||||
- support for multi-line values (values with embedded newline characters)
|
||||
- optional support for multiple keys with the same name
|
||||
- optional case-insensitive sections and keys (for ASCII characters only)
|
||||
- saves files with sections and keys in the same order as they were loaded
|
||||
- preserves comments on the file, section and keys where possible.
|
||||
- supports both char or wchar_t programming interfaces
|
||||
- supports both MBCS (system locale) and UTF-8 file encodings
|
||||
- system locale does not need to be UTF-8 on Linux/Unix to load UTF-8 file
|
||||
- support for non-ASCII characters in section, keys, values and comments
|
||||
- support for non-standard character types or file encodings via user-written converter classes
|
||||
- support for adding/modifying values programmatically
|
||||
- compiles cleanly in the following compilers:
|
||||
* Windows/VC6 (warning level 3)
|
||||
* Windows/VC.NET 2003 (warning level 4)
|
||||
* Windows/VC 2005 (warning level 4)
|
||||
* Linux/gcc (-Wall)
|
||||
* Windows/MinGW GCC
|
||||
|
||||
# Documentation
|
||||
|
||||
Full documentation of the interface is available in doxygen format.
|
||||
|
||||
# Examples
|
||||
|
||||
These snippets are included with the distribution in the file snippets.cpp.
|
||||
|
||||
### SIMPLE USAGE
|
||||
|
||||
```c++
|
||||
CSimpleIniA ini;
|
||||
ini.SetUnicode();
|
||||
ini.LoadFile("myfile.ini");
|
||||
const char * pVal = ini.GetValue("section", "key", "default");
|
||||
ini.SetValue("section", "key", "newvalue");
|
||||
```
|
||||
|
||||
### LOADING DATA
|
||||
|
||||
```c++
|
||||
// load from a data file
|
||||
CSimpleIniA ini(a_bIsUtf8, a_bUseMultiKey, a_bUseMultiLine);
|
||||
SI_Error rc = ini.LoadFile(a_pszFile);
|
||||
if (rc < 0) return false;
|
||||
|
||||
// load from a string
|
||||
std::string strData;
|
||||
rc = ini.LoadData(strData.c_str(), strData.size());
|
||||
if (rc < 0) return false;
|
||||
```
|
||||
|
||||
### GETTING SECTIONS AND KEYS
|
||||
|
||||
```c++
|
||||
// get all sections
|
||||
CSimpleIniA::TNamesDepend sections;
|
||||
ini.GetAllSections(sections);
|
||||
|
||||
// get all keys in a section
|
||||
CSimpleIniA::TNamesDepend keys;
|
||||
ini.GetAllKeys("section-name", keys);
|
||||
```
|
||||
|
||||
### GETTING VALUES
|
||||
|
||||
```c++
|
||||
// get the value of a key
|
||||
const char * pszValue = ini.GetValue("section-name",
|
||||
"key-name", NULL /*default*/);
|
||||
|
||||
// get the value of a key which may have multiple
|
||||
// values. If bHasMultipleValues is true, then just
|
||||
// one value has been returned
|
||||
bool bHasMultipleValues;
|
||||
pszValue = ini.GetValue("section-name", "key-name",
|
||||
NULL /*default*/, &bHasMultipleValues);
|
||||
|
||||
// get all values of a key with multiple values
|
||||
CSimpleIniA::TNamesDepend values;
|
||||
ini.GetAllValues("section-name", "key-name", values);
|
||||
|
||||
// sort the values into the original load order
|
||||
values.sort(CSimpleIniA::Entry::LoadOrder());
|
||||
|
||||
// output all of the items
|
||||
CSimpleIniA::TNamesDepend::const_iterator i;
|
||||
for (i = values.begin(); i != values.end(); ++i) {
|
||||
printf("key-name = '%s'\n", i->pItem);
|
||||
}
|
||||
```
|
||||
|
||||
### MODIFYING DATA
|
||||
|
||||
```c++
|
||||
// adding a new section
|
||||
rc = ini.SetValue("new-section", NULL, NULL);
|
||||
if (rc < 0) return false;
|
||||
printf("section: %s\n", rc == SI_INSERTED ?
|
||||
"inserted" : "updated");
|
||||
|
||||
// adding a new key ("new-section" will be added
|
||||
// automatically if it doesn't already exist)
|
||||
rc = ini.SetValue("new-section", "new-key", "value");
|
||||
if (rc < 0) return false;
|
||||
printf("key: %s\n", rc == SI_INSERTED ?
|
||||
"inserted" : "updated");
|
||||
|
||||
// changing the value of a key
|
||||
rc = ini.SetValue("section", "key", "updated-value");
|
||||
if (rc < 0) return false;
|
||||
printf("key: %s\n", rc == SI_INSERTED ?
|
||||
"inserted" : "updated");
|
||||
```
|
||||
|
||||
### DELETING DATA
|
||||
|
||||
```c++
|
||||
// deleting a key from a section. Optionally the entire
|
||||
// section may be deleted if it is now empty.
|
||||
ini.Delete("section-name", "key-name",
|
||||
true /*delete the section if empty*/);
|
||||
|
||||
// deleting an entire section and all keys in it
|
||||
ini.Delete("section-name", NULL);
|
||||
```
|
||||
|
||||
### SAVING DATA
|
||||
|
||||
```c++
|
||||
// save the data to a string
|
||||
rc = ini.Save(strData);
|
||||
if (rc < 0) return false;
|
||||
|
||||
// save the data back to the file
|
||||
rc = ini.SaveFile(a_pszFile);
|
||||
if (rc < 0) return false;
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
Submodule
+1
Submodule asmjit added at a66efd5460
@@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\assembler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\codegen.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\constpool.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cputicks.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\error.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\globals.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\logger.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\podvector.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\runtime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\string.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\vmem.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\zone.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\contrib\winremoteruntime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86assembler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86inst.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86regs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\asmjit\src\asmjit\base\constpool.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AC40FF01-426E-4838-A317-66354CEFAE88}</ProjectGuid>
|
||||
<RootNamespace>asmjit</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)libs\$(Configuration)\</OutDir>
|
||||
<IntDir>
|
||||
</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)libs\$(Configuration)\</OutDir>
|
||||
<IntDir>
|
||||
</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)libs\$(Configuration)\</OutDir>
|
||||
<IntDir>
|
||||
</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)libs\$(Configuration)\</OutDir>
|
||||
<IntDir>
|
||||
</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>ASMJIT_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>ASMJIT_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>ASMJIT_STATIC;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>ASMJIT_STATIC;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86assembler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86func.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\contrib\winremoteruntime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\assembler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\codegen.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\compiler.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\context.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cpuinfo.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\cputicks.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\error.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\globals.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\logger.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\podvector.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\runtime.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\string.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\vmem.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\zone.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\constpool.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\base\operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86inst.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86operand.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86regs.cpp" />
|
||||
<ClCompile Include="..\asmjit\src\asmjit\x86\x86util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\asmjit\src\asmjit\base\constpool.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
User
|
||||
@@ -0,0 +1,6 @@
|
||||
# Note: This folder has to exist. Once the User Account manager is implemented, make sure it creates this folder in case it's missing and delete this .gitignore file.
|
||||
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,6 @@
|
||||
# Note: This folder has to exist. Once the User Account manager is implemented, make sure it creates this folder in case it's missing and delete this .gitignore file.
|
||||
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,6 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
!cache
|
||||
!cache/README.txt
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
every Folder in this directory gets cleared when cellSysCacheClear() is called, so don't store important data here
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
Submodule
+1
Submodule ffmpeg added at 8bcaa2485c
@@ -1,262 +1,328 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {3111D679-7796-23C4-BA0C-271F1145DA24}
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E} = {5C363C34-4741-7036-861C-2E2279CF552E}
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2} = {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01} = {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3} = {99C9EB95-DB4C-1996-490E-5212EFBF07C3}
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9} = {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001} = {76169FE8-0814-4F36-6409-699EF1A23001}
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4} = {7047EE97-7F80-A70D-6147-BC11102DB6F4}
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA} = {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wxWidgets", "wxWidgets", "{5812E712-6213-4372-B095-9EB9BAA1F2DF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adv", "wxWidgets\build\msw\wx_adv.vcxproj", "{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aui", "wxWidgets\build\msw\wx_aui.vcxproj", "{7047EE97-7F80-A70D-6147-BC11102DB6F4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "wxWidgets\build\msw\wx_base.vcxproj", "{3111D679-7796-23C4-BA0C-271F1145DA24}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "wxWidgets\build\msw\wx_core.vcxproj", "{067D9406-2A93-DACA-9449-93A2D356357D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dbgrid", "wxWidgets\build\msw\wx_dbgrid.vcxproj", "{9ED1866B-D4AE-3440-24E4-7A9475B163B2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gl", "wxWidgets\build\msw\wx_gl.vcxproj", "{99C9EB95-DB4C-1996-490E-5212EFBF07C3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "html", "wxWidgets\build\msw\wx_html.vcxproj", "{6EDC3B79-D217-F11A-406F-F11D856493F9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "media", "wxWidgets\build\msw\wx_media.vcxproj", "{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net", "wxWidgets\build\msw\wx_net.vcxproj", "{CD478F02-7550-58A5-E085-CE4BC0C0AD23}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odbc", "wxWidgets\build\msw\wx_odbc.vcxproj", "{C051C502-820F-2983-EF97-144C0CD92905}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qa", "wxWidgets\build\msw\wx_qa.vcxproj", "{22B14659-C5B6-B775-868D-A49198FEAD4A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "richtext", "wxWidgets\build\msw\wx_richtext.vcxproj", "{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxexpat", "wxWidgets\build\msw\wx_wxexpat.vcxproj", "{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxjpeg", "wxWidgets\build\msw\wx_wxjpeg.vcxproj", "{5C363C34-4741-7036-861C-2E2279CF552E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxpng", "wxWidgets\build\msw\wx_wxpng.vcxproj", "{76169FE8-0814-4F36-6409-699EF1A23001}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxregex", "wxWidgets\build\msw\wx_wxregex.vcxproj", "{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxtiff", "wxWidgets\build\msw\wx_wxtiff.vcxproj", "{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxzlib", "wxWidgets\build\msw\wx_wxzlib.vcxproj", "{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml", "wxWidgets\build\msw\wx_xml.vcxproj", "{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrc", "wxWidgets\build\msw\wx_xrc.vcxproj", "{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.Build.0 = Debug|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|Win32.Build.0 = Release|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.Build.0 = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.Build.0 = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|Win32.Build.0 = Release|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.Build.0 = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.Build.0 = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|Win32.Build.0 = Release|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.ActiveCfg = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.Build.0 = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.Build.0 = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|Win32.Build.0 = Release|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.ActiveCfg = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.Build.0 = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.Build.0 = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|Win32.Build.0 = Release|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.ActiveCfg = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.Build.0 = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.Build.0 = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|Win32.Build.0 = Release|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.ActiveCfg = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.Build.0 = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.Build.0 = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|Win32.Build.0 = Release|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.ActiveCfg = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.Build.0 = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|Win32.Build.0 = Release|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.Build.0 = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.Build.0 = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|Win32.Build.0 = Release|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.ActiveCfg = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.Build.0 = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.Build.0 = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|Win32.Build.0 = Release|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.ActiveCfg = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.Build.0 = Release|x64
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Debug|x64.Build.0 = Debug|x64
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Release|Win32.Build.0 = Release|Win32
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Release|x64.ActiveCfg = Release|x64
|
||||
{C051C502-820F-2983-EF97-144C0CD92905}.Release|x64.Build.0 = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.Build.0 = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|Win32.Build.0 = Release|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.ActiveCfg = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.Build.0 = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.Build.0 = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|Win32.Build.0 = Release|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.ActiveCfg = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.Build.0 = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.Build.0 = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|Win32.Build.0 = Release|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.ActiveCfg = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.Build.0 = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.Build.0 = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|Win32.Build.0 = Release|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.ActiveCfg = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.Build.0 = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.Build.0 = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|Win32.Build.0 = Release|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.ActiveCfg = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.Build.0 = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.Build.0 = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|Win32.Build.0 = Release|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.ActiveCfg = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.Build.0 = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.Build.0 = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|Win32.Build.0 = Release|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.ActiveCfg = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.Build.0 = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.Build.0 = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|Win32.Build.0 = Release|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.ActiveCfg = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.Build.0 = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.Build.0 = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|Win32.Build.0 = Release|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.Build.0 = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.Build.0 = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|Win32.Build.0 = Release|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.ActiveCfg = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{C051C502-820F-2983-EF97-144C0CD92905} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88} = {AC40FF01-426E-4838-A317-66354CEFAE88}
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {CD478F02-7550-58A5-E085-CE4BC0C0AD23}
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038} = {C4A10229-4712-4BD2-B63E-50D93C67A038}
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E} = {5C363C34-4741-7036-861C-2E2279CF552E}
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606} = {23E1C437-A951-5943-8639-A17F3CF2E606}
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A} = {22B14659-C5B6-B775-868D-A49198FEAD4A}
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2} = {9ED1866B-D4AE-3440-24E4-7A9475B163B2}
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9} = {6EDC3B79-D217-F11A-406F-F11D856493F9}
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {3111D679-7796-23C4-BA0C-271F1145DA24}
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA} = {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774} = {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6} = {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3} = {99C9EB95-DB4C-1996-490E-5212EFBF07C3}
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4} = {7047EE97-7F80-A70D-6147-BC11102DB6F4}
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D} = {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01} = {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0} = {74827EBD-93DC-5110-BA95-3F2AB029B6B0}
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2} = {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9} = {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001} = {76169FE8-0814-4F36-6409-699EF1A23001}
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25} = {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wxWidgets", "wxWidgets", "{5812E712-6213-4372-B095-9EB9BAA1F2DF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adv", "wxWidgets\build\msw\wx_vc10_adv.vcxproj", "{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aui", "wxWidgets\build\msw\wx_vc10_aui.vcxproj", "{7047EE97-7F80-A70D-6147-BC11102DB6F4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9} = {6EDC3B79-D217-F11A-406F-F11D856493F9}
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "wxWidgets\build\msw\wx_vc10_base.vcxproj", "{3111D679-7796-23C4-BA0C-271F1145DA24}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA} = {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01} = {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2} = {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "wxWidgets\build\msw\wx_vc10_core.vcxproj", "{067D9406-2A93-DACA-9449-93A2D356357D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "propgrid", "wxWidgets\build\msw\wx_vc10_propgrid.vcxproj", "{9ED1866B-D4AE-3440-24E4-7A9475B163B2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gl", "wxWidgets\build\msw\wx_vc10_gl.vcxproj", "{99C9EB95-DB4C-1996-490E-5212EFBF07C3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "html", "wxWidgets\build\msw\wx_vc10_html.vcxproj", "{6EDC3B79-D217-F11A-406F-F11D856493F9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "media", "wxWidgets\build\msw\wx_vc10_media.vcxproj", "{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net", "wxWidgets\build\msw\wx_vc10_net.vcxproj", "{CD478F02-7550-58A5-E085-CE4BC0C0AD23}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {3111D679-7796-23C4-BA0C-271F1145DA24}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qa", "wxWidgets\build\msw\wx_vc10_qa.vcxproj", "{22B14659-C5B6-B775-868D-A49198FEAD4A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "richtext", "wxWidgets\build\msw\wx_vc10_richtext.vcxproj", "{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxexpat", "wxWidgets\build\msw\wx_vc10_wxexpat.vcxproj", "{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxjpeg", "wxWidgets\build\msw\wx_vc10_wxjpeg.vcxproj", "{5C363C34-4741-7036-861C-2E2279CF552E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxpng", "wxWidgets\build\msw\wx_vc10_wxpng.vcxproj", "{76169FE8-0814-4F36-6409-699EF1A23001}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxregex", "wxWidgets\build\msw\wx_vc10_wxregex.vcxproj", "{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxtiff", "wxWidgets\build\msw\wx_vc10_wxtiff.vcxproj", "{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxzlib", "wxWidgets\build\msw\wx_vc10_wxzlib.vcxproj", "{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml", "wxWidgets\build\msw\wx_vc10_xml.vcxproj", "{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {3111D679-7796-23C4-BA0C-271F1145DA24}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrc", "wxWidgets\build\msw\wx_vc10_xrc.vcxproj", "{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stblib", "stblib", "{9D839DFB-76E6-4F10-8EED-BA2AC7CC3FB6}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
stblib\stb_image.c = stblib\stb_image.c
|
||||
stblib\stb_image.h = stblib\stb_image.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ribbon", "wxWidgets\build\msw\wx_vc10_ribbon.vcxproj", "{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc", "wxWidgets\build\msw\wx_vc10_stc.vcxproj", "{23E1C437-A951-5943-8639-A17F3CF2E606}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxscintilla", "wxWidgets\build\msw\wx_vc10_wxscintilla.vcxproj", "{74827EBD-93DC-5110-BA95-3F2AB029B6B0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjitsrc\asmjit.vcxproj", "{AC40FF01-426E-4838-A317-66354CEFAE88}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asmjit", "asmjit", "{E2A982F2-4B1A-48B1-8D77-A17A589C58D7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vcxproj", "{C4A10229-4712-4BD2-B63E-50D93C67A038}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug - MemLeak|x64 = Debug - MemLeak|x64
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.Build.0 = Debug|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.Build.0 = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.Build.0 = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.Build.0 = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.Build.0 = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.ActiveCfg = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.Build.0 = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.Build.0 = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.ActiveCfg = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.Build.0 = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.Build.0 = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.ActiveCfg = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.Build.0 = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.Build.0 = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.ActiveCfg = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.Build.0 = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.Build.0 = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.ActiveCfg = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Deploy.0 = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.Build.0 = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.Build.0 = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.Build.0 = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.ActiveCfg = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.Build.0 = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.Build.0 = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.ActiveCfg = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.Build.0 = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.Build.0 = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.ActiveCfg = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.Build.0 = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.Build.0 = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.ActiveCfg = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.Build.0 = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.Build.0 = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.ActiveCfg = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.Build.0 = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.Build.0 = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.ActiveCfg = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.Build.0 = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.Build.0 = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.ActiveCfg = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.Build.0 = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.Build.0 = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.ActiveCfg = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.Build.0 = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.Build.0 = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.ActiveCfg = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.Build.0 = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.Build.0 = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.ActiveCfg = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.Build.0 = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.Build.0 = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.Build.0 = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.Build.0 = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.ActiveCfg = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.Build.0 = Release|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|x64.Build.0 = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.ActiveCfg = Release|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.Build.0 = Release|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|x64.Build.0 = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.ActiveCfg = Release|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.Build.0 = Release|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|x64.Build.0 = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.ActiveCfg = Release|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.Build.0 = Release|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.Build.0 = Debug|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.Build.0 = Release|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.Build.0 = Debug|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.ActiveCfg = Release|x64
|
||||
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "AppConnector.h"
|
||||
|
||||
AppConnector::~AppConnector()
|
||||
{
|
||||
for(uint i=0; i<m_connect_arr.GetCount(); ++i)
|
||||
{
|
||||
wxGetApp().Disconnect(
|
||||
m_connect_arr[i].winid,
|
||||
m_connect_arr[i].lastId,
|
||||
m_connect_arr[i].eventType,
|
||||
m_connect_arr[i].func,
|
||||
m_connect_arr[i].userData,
|
||||
m_connect_arr[i].eventSink);
|
||||
}
|
||||
}
|
||||
|
||||
void AppConnector::Connect(int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
{
|
||||
m_connect_arr.Move(new ConnectInfo(winid, lastId, eventType, func, userData, eventSink));
|
||||
wxGetApp().Connect(winid, lastId, eventType, func, userData, eventSink);
|
||||
}
|
||||
|
||||
void AppConnector::Connect(int winid, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
{
|
||||
Connect(winid, wxID_ANY, eventType, func, userData, eventSink);
|
||||
}
|
||||
|
||||
void AppConnector::Connect(int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
{
|
||||
Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
class AppConnector
|
||||
{
|
||||
struct ConnectInfo
|
||||
{
|
||||
int winid;
|
||||
int lastId;
|
||||
int eventType;
|
||||
wxObjectEventFunction func;
|
||||
wxObject* userData;
|
||||
wxEvtHandler* eventSink;
|
||||
|
||||
ConnectInfo(int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
: winid(winid)
|
||||
, lastId(lastId)
|
||||
, eventType(eventType)
|
||||
, func(func)
|
||||
, userData(userData)
|
||||
, eventSink(eventSink)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
Array<ConnectInfo> m_connect_arr;
|
||||
|
||||
public:
|
||||
~AppConnector();
|
||||
|
||||
void Connect(int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
void Connect(int winid, int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
void Connect(int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
};
|
||||
@@ -0,0 +1,104 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/rpcs3/cmake_modules")
|
||||
include(cotire)
|
||||
|
||||
project(rpcs3)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
add_definitions(-DwxGUI)
|
||||
#add_definitions(-D__WXGTK__)
|
||||
#add_definitions(-Wfatal-errors)
|
||||
add_definitions(-w) # TODO: remove me
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
|
||||
add_definitions(-fpermissive) # TODO: remove me
|
||||
add_definitions(-g) # Debugging!!
|
||||
add_definitions(-msse2)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
add_definitions(-DwxGUI)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
|
||||
endif()
|
||||
|
||||
If( NOT RPCS3_SRC_DIR)
|
||||
SET(RPCS3_SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
Message("-- Initializing RPCS3_SRC_DIR=${RPCS3_SRC_DIR}")
|
||||
Else()
|
||||
Message("-- Using Custom RPCS3_SRC_DIR=${RPCS3_SRC_DIR}")
|
||||
EndIf()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${RPCS3_SRC_DIR}/cmake_modules")
|
||||
# TODO: do real installation, including copying directory structure
|
||||
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/../bin")
|
||||
#include(cotire)
|
||||
|
||||
add_definitions(-DGL_GLEXT_PROTOTYPES)
|
||||
add_definitions(-DGLX_GLXEXT_PROTOTYPES)
|
||||
|
||||
find_package(wxWidgets COMPONENTS core base net aui gl xml REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
||||
include("${wxWidgets_USE_FILE}")
|
||||
|
||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." )
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(PLATFORM_ARCH "macosx/x86_64")
|
||||
elseif(WIN32)
|
||||
set(PLATFORM_ARCH "Windows/x86_64")
|
||||
else()
|
||||
set(PLATFORM_ARCH "linux/x86_64")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${wxWidgets_INCLUDE_DIRS}
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
"${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/include"
|
||||
"${RPCS3_SRC_DIR}"
|
||||
"${RPCS3_SRC_DIR}/Emu"
|
||||
"${RPCS3_SRC_DIR}/Gui"
|
||||
"${RPCS3_SRC_DIR}/Loader"
|
||||
"${RPCS3_SRC_DIR}/Crypto"
|
||||
"${RPCS3_SRC_DIR}/.."
|
||||
"${RPCS3_SRC_DIR}/../asmjit/src/asmjit"
|
||||
)
|
||||
|
||||
link_directories("${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib")
|
||||
|
||||
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
foreach(dir ${dirs})
|
||||
message(STATUS "dir='${dir}'")
|
||||
endforeach()
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
RPCS3_SRC
|
||||
"${RPCS3_SRC_DIR}/rpcs3.cpp"
|
||||
"${RPCS3_SRC_DIR}/Ini.cpp"
|
||||
"${RPCS3_SRC_DIR}/../Utilities/GNU.cpp"
|
||||
"${RPCS3_SRC_DIR}/Emu/*"
|
||||
"${RPCS3_SRC_DIR}/Gui/*"
|
||||
"${RPCS3_SRC_DIR}/Loader/*"
|
||||
"${RPCS3_SRC_DIR}/Crypto/*"
|
||||
"${RPCS3_SRC_DIR}/../Utilities/*"
|
||||
)
|
||||
|
||||
add_executable(rpcs3 ${RPCS3_SRC})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_CURRENT_BINARY_DIR}/../asmjit/") #hack because the asmjit cmake file force fno exceptions
|
||||
target_link_libraries(rpcs3 asmjit.a ${wxWidgets_LIBRARIES} ${OPENAL_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES} libavformat.a libavcodec.a libavutil.a libswresample.a libswscale.a ${ZLIB_LIBRARIES})
|
||||
|
||||
set_target_properties(rpcs3 PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h")
|
||||
cotire(rpcs3)
|
||||
|
||||
@@ -0,0 +1,975 @@
|
||||
/*
|
||||
* FIPS-197 compliant AES implementation
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
|
||||
*
|
||||
* http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
|
||||
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "aes.h"
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (little endian)
|
||||
*/
|
||||
#ifndef GET_UINT32_LE
|
||||
#define GET_UINT32_LE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32_t) (b)[(i) ] ) \
|
||||
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
|
||||
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
|
||||
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_UINT32_LE
|
||||
#define PUT_UINT32_LE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (unsigned char) ( (n) ); \
|
||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_AES_ROM_TABLES)
|
||||
/*
|
||||
* Forward S-box
|
||||
*/
|
||||
static const unsigned char FSb[256] =
|
||||
{
|
||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
|
||||
0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
||||
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
|
||||
0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
|
||||
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC,
|
||||
0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
||||
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A,
|
||||
0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
|
||||
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
|
||||
0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
|
||||
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B,
|
||||
0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
||||
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85,
|
||||
0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
|
||||
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
|
||||
0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
|
||||
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17,
|
||||
0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88,
|
||||
0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
|
||||
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
|
||||
0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
|
||||
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9,
|
||||
0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
||||
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6,
|
||||
0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
|
||||
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
|
||||
0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
|
||||
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94,
|
||||
0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
|
||||
0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward tables
|
||||
*/
|
||||
#define FT \
|
||||
\
|
||||
V(A5,63,63,C6), V(84,7C,7C,F8), V(99,77,77,EE), V(8D,7B,7B,F6), \
|
||||
V(0D,F2,F2,FF), V(BD,6B,6B,D6), V(B1,6F,6F,DE), V(54,C5,C5,91), \
|
||||
V(50,30,30,60), V(03,01,01,02), V(A9,67,67,CE), V(7D,2B,2B,56), \
|
||||
V(19,FE,FE,E7), V(62,D7,D7,B5), V(E6,AB,AB,4D), V(9A,76,76,EC), \
|
||||
V(45,CA,CA,8F), V(9D,82,82,1F), V(40,C9,C9,89), V(87,7D,7D,FA), \
|
||||
V(15,FA,FA,EF), V(EB,59,59,B2), V(C9,47,47,8E), V(0B,F0,F0,FB), \
|
||||
V(EC,AD,AD,41), V(67,D4,D4,B3), V(FD,A2,A2,5F), V(EA,AF,AF,45), \
|
||||
V(BF,9C,9C,23), V(F7,A4,A4,53), V(96,72,72,E4), V(5B,C0,C0,9B), \
|
||||
V(C2,B7,B7,75), V(1C,FD,FD,E1), V(AE,93,93,3D), V(6A,26,26,4C), \
|
||||
V(5A,36,36,6C), V(41,3F,3F,7E), V(02,F7,F7,F5), V(4F,CC,CC,83), \
|
||||
V(5C,34,34,68), V(F4,A5,A5,51), V(34,E5,E5,D1), V(08,F1,F1,F9), \
|
||||
V(93,71,71,E2), V(73,D8,D8,AB), V(53,31,31,62), V(3F,15,15,2A), \
|
||||
V(0C,04,04,08), V(52,C7,C7,95), V(65,23,23,46), V(5E,C3,C3,9D), \
|
||||
V(28,18,18,30), V(A1,96,96,37), V(0F,05,05,0A), V(B5,9A,9A,2F), \
|
||||
V(09,07,07,0E), V(36,12,12,24), V(9B,80,80,1B), V(3D,E2,E2,DF), \
|
||||
V(26,EB,EB,CD), V(69,27,27,4E), V(CD,B2,B2,7F), V(9F,75,75,EA), \
|
||||
V(1B,09,09,12), V(9E,83,83,1D), V(74,2C,2C,58), V(2E,1A,1A,34), \
|
||||
V(2D,1B,1B,36), V(B2,6E,6E,DC), V(EE,5A,5A,B4), V(FB,A0,A0,5B), \
|
||||
V(F6,52,52,A4), V(4D,3B,3B,76), V(61,D6,D6,B7), V(CE,B3,B3,7D), \
|
||||
V(7B,29,29,52), V(3E,E3,E3,DD), V(71,2F,2F,5E), V(97,84,84,13), \
|
||||
V(F5,53,53,A6), V(68,D1,D1,B9), V(00,00,00,00), V(2C,ED,ED,C1), \
|
||||
V(60,20,20,40), V(1F,FC,FC,E3), V(C8,B1,B1,79), V(ED,5B,5B,B6), \
|
||||
V(BE,6A,6A,D4), V(46,CB,CB,8D), V(D9,BE,BE,67), V(4B,39,39,72), \
|
||||
V(DE,4A,4A,94), V(D4,4C,4C,98), V(E8,58,58,B0), V(4A,CF,CF,85), \
|
||||
V(6B,D0,D0,BB), V(2A,EF,EF,C5), V(E5,AA,AA,4F), V(16,FB,FB,ED), \
|
||||
V(C5,43,43,86), V(D7,4D,4D,9A), V(55,33,33,66), V(94,85,85,11), \
|
||||
V(CF,45,45,8A), V(10,F9,F9,E9), V(06,02,02,04), V(81,7F,7F,FE), \
|
||||
V(F0,50,50,A0), V(44,3C,3C,78), V(BA,9F,9F,25), V(E3,A8,A8,4B), \
|
||||
V(F3,51,51,A2), V(FE,A3,A3,5D), V(C0,40,40,80), V(8A,8F,8F,05), \
|
||||
V(AD,92,92,3F), V(BC,9D,9D,21), V(48,38,38,70), V(04,F5,F5,F1), \
|
||||
V(DF,BC,BC,63), V(C1,B6,B6,77), V(75,DA,DA,AF), V(63,21,21,42), \
|
||||
V(30,10,10,20), V(1A,FF,FF,E5), V(0E,F3,F3,FD), V(6D,D2,D2,BF), \
|
||||
V(4C,CD,CD,81), V(14,0C,0C,18), V(35,13,13,26), V(2F,EC,EC,C3), \
|
||||
V(E1,5F,5F,BE), V(A2,97,97,35), V(CC,44,44,88), V(39,17,17,2E), \
|
||||
V(57,C4,C4,93), V(F2,A7,A7,55), V(82,7E,7E,FC), V(47,3D,3D,7A), \
|
||||
V(AC,64,64,C8), V(E7,5D,5D,BA), V(2B,19,19,32), V(95,73,73,E6), \
|
||||
V(A0,60,60,C0), V(98,81,81,19), V(D1,4F,4F,9E), V(7F,DC,DC,A3), \
|
||||
V(66,22,22,44), V(7E,2A,2A,54), V(AB,90,90,3B), V(83,88,88,0B), \
|
||||
V(CA,46,46,8C), V(29,EE,EE,C7), V(D3,B8,B8,6B), V(3C,14,14,28), \
|
||||
V(79,DE,DE,A7), V(E2,5E,5E,BC), V(1D,0B,0B,16), V(76,DB,DB,AD), \
|
||||
V(3B,E0,E0,DB), V(56,32,32,64), V(4E,3A,3A,74), V(1E,0A,0A,14), \
|
||||
V(DB,49,49,92), V(0A,06,06,0C), V(6C,24,24,48), V(E4,5C,5C,B8), \
|
||||
V(5D,C2,C2,9F), V(6E,D3,D3,BD), V(EF,AC,AC,43), V(A6,62,62,C4), \
|
||||
V(A8,91,91,39), V(A4,95,95,31), V(37,E4,E4,D3), V(8B,79,79,F2), \
|
||||
V(32,E7,E7,D5), V(43,C8,C8,8B), V(59,37,37,6E), V(B7,6D,6D,DA), \
|
||||
V(8C,8D,8D,01), V(64,D5,D5,B1), V(D2,4E,4E,9C), V(E0,A9,A9,49), \
|
||||
V(B4,6C,6C,D8), V(FA,56,56,AC), V(07,F4,F4,F3), V(25,EA,EA,CF), \
|
||||
V(AF,65,65,CA), V(8E,7A,7A,F4), V(E9,AE,AE,47), V(18,08,08,10), \
|
||||
V(D5,BA,BA,6F), V(88,78,78,F0), V(6F,25,25,4A), V(72,2E,2E,5C), \
|
||||
V(24,1C,1C,38), V(F1,A6,A6,57), V(C7,B4,B4,73), V(51,C6,C6,97), \
|
||||
V(23,E8,E8,CB), V(7C,DD,DD,A1), V(9C,74,74,E8), V(21,1F,1F,3E), \
|
||||
V(DD,4B,4B,96), V(DC,BD,BD,61), V(86,8B,8B,0D), V(85,8A,8A,0F), \
|
||||
V(90,70,70,E0), V(42,3E,3E,7C), V(C4,B5,B5,71), V(AA,66,66,CC), \
|
||||
V(D8,48,48,90), V(05,03,03,06), V(01,F6,F6,F7), V(12,0E,0E,1C), \
|
||||
V(A3,61,61,C2), V(5F,35,35,6A), V(F9,57,57,AE), V(D0,B9,B9,69), \
|
||||
V(91,86,86,17), V(58,C1,C1,99), V(27,1D,1D,3A), V(B9,9E,9E,27), \
|
||||
V(38,E1,E1,D9), V(13,F8,F8,EB), V(B3,98,98,2B), V(33,11,11,22), \
|
||||
V(BB,69,69,D2), V(70,D9,D9,A9), V(89,8E,8E,07), V(A7,94,94,33), \
|
||||
V(B6,9B,9B,2D), V(22,1E,1E,3C), V(92,87,87,15), V(20,E9,E9,C9), \
|
||||
V(49,CE,CE,87), V(FF,55,55,AA), V(78,28,28,50), V(7A,DF,DF,A5), \
|
||||
V(8F,8C,8C,03), V(F8,A1,A1,59), V(80,89,89,09), V(17,0D,0D,1A), \
|
||||
V(DA,BF,BF,65), V(31,E6,E6,D7), V(C6,42,42,84), V(B8,68,68,D0), \
|
||||
V(C3,41,41,82), V(B0,99,99,29), V(77,2D,2D,5A), V(11,0F,0F,1E), \
|
||||
V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C)
|
||||
|
||||
#define V(a,b,c,d) 0x##a##b##c##d
|
||||
static const uint32_t FT0[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##b##c##d##a
|
||||
static const uint32_t FT1[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##c##d##a##b
|
||||
static const uint32_t FT2[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##d##a##b##c
|
||||
static const uint32_t FT3[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#undef FT
|
||||
|
||||
/*
|
||||
* Reverse S-box
|
||||
*/
|
||||
static const unsigned char RSb[256] =
|
||||
{
|
||||
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38,
|
||||
0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
|
||||
0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87,
|
||||
0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
|
||||
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D,
|
||||
0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
||||
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2,
|
||||
0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
|
||||
0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16,
|
||||
0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
|
||||
0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA,
|
||||
0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
||||
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A,
|
||||
0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
|
||||
0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02,
|
||||
0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
|
||||
0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA,
|
||||
0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
||||
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85,
|
||||
0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
|
||||
0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89,
|
||||
0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
|
||||
0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20,
|
||||
0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
||||
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31,
|
||||
0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
|
||||
0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
|
||||
0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
|
||||
0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0,
|
||||
0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
||||
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26,
|
||||
0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
|
||||
};
|
||||
|
||||
/*
|
||||
* Reverse tables
|
||||
*/
|
||||
#define RT \
|
||||
\
|
||||
V(50,A7,F4,51), V(53,65,41,7E), V(C3,A4,17,1A), V(96,5E,27,3A), \
|
||||
V(CB,6B,AB,3B), V(F1,45,9D,1F), V(AB,58,FA,AC), V(93,03,E3,4B), \
|
||||
V(55,FA,30,20), V(F6,6D,76,AD), V(91,76,CC,88), V(25,4C,02,F5), \
|
||||
V(FC,D7,E5,4F), V(D7,CB,2A,C5), V(80,44,35,26), V(8F,A3,62,B5), \
|
||||
V(49,5A,B1,DE), V(67,1B,BA,25), V(98,0E,EA,45), V(E1,C0,FE,5D), \
|
||||
V(02,75,2F,C3), V(12,F0,4C,81), V(A3,97,46,8D), V(C6,F9,D3,6B), \
|
||||
V(E7,5F,8F,03), V(95,9C,92,15), V(EB,7A,6D,BF), V(DA,59,52,95), \
|
||||
V(2D,83,BE,D4), V(D3,21,74,58), V(29,69,E0,49), V(44,C8,C9,8E), \
|
||||
V(6A,89,C2,75), V(78,79,8E,F4), V(6B,3E,58,99), V(DD,71,B9,27), \
|
||||
V(B6,4F,E1,BE), V(17,AD,88,F0), V(66,AC,20,C9), V(B4,3A,CE,7D), \
|
||||
V(18,4A,DF,63), V(82,31,1A,E5), V(60,33,51,97), V(45,7F,53,62), \
|
||||
V(E0,77,64,B1), V(84,AE,6B,BB), V(1C,A0,81,FE), V(94,2B,08,F9), \
|
||||
V(58,68,48,70), V(19,FD,45,8F), V(87,6C,DE,94), V(B7,F8,7B,52), \
|
||||
V(23,D3,73,AB), V(E2,02,4B,72), V(57,8F,1F,E3), V(2A,AB,55,66), \
|
||||
V(07,28,EB,B2), V(03,C2,B5,2F), V(9A,7B,C5,86), V(A5,08,37,D3), \
|
||||
V(F2,87,28,30), V(B2,A5,BF,23), V(BA,6A,03,02), V(5C,82,16,ED), \
|
||||
V(2B,1C,CF,8A), V(92,B4,79,A7), V(F0,F2,07,F3), V(A1,E2,69,4E), \
|
||||
V(CD,F4,DA,65), V(D5,BE,05,06), V(1F,62,34,D1), V(8A,FE,A6,C4), \
|
||||
V(9D,53,2E,34), V(A0,55,F3,A2), V(32,E1,8A,05), V(75,EB,F6,A4), \
|
||||
V(39,EC,83,0B), V(AA,EF,60,40), V(06,9F,71,5E), V(51,10,6E,BD), \
|
||||
V(F9,8A,21,3E), V(3D,06,DD,96), V(AE,05,3E,DD), V(46,BD,E6,4D), \
|
||||
V(B5,8D,54,91), V(05,5D,C4,71), V(6F,D4,06,04), V(FF,15,50,60), \
|
||||
V(24,FB,98,19), V(97,E9,BD,D6), V(CC,43,40,89), V(77,9E,D9,67), \
|
||||
V(BD,42,E8,B0), V(88,8B,89,07), V(38,5B,19,E7), V(DB,EE,C8,79), \
|
||||
V(47,0A,7C,A1), V(E9,0F,42,7C), V(C9,1E,84,F8), V(00,00,00,00), \
|
||||
V(83,86,80,09), V(48,ED,2B,32), V(AC,70,11,1E), V(4E,72,5A,6C), \
|
||||
V(FB,FF,0E,FD), V(56,38,85,0F), V(1E,D5,AE,3D), V(27,39,2D,36), \
|
||||
V(64,D9,0F,0A), V(21,A6,5C,68), V(D1,54,5B,9B), V(3A,2E,36,24), \
|
||||
V(B1,67,0A,0C), V(0F,E7,57,93), V(D2,96,EE,B4), V(9E,91,9B,1B), \
|
||||
V(4F,C5,C0,80), V(A2,20,DC,61), V(69,4B,77,5A), V(16,1A,12,1C), \
|
||||
V(0A,BA,93,E2), V(E5,2A,A0,C0), V(43,E0,22,3C), V(1D,17,1B,12), \
|
||||
V(0B,0D,09,0E), V(AD,C7,8B,F2), V(B9,A8,B6,2D), V(C8,A9,1E,14), \
|
||||
V(85,19,F1,57), V(4C,07,75,AF), V(BB,DD,99,EE), V(FD,60,7F,A3), \
|
||||
V(9F,26,01,F7), V(BC,F5,72,5C), V(C5,3B,66,44), V(34,7E,FB,5B), \
|
||||
V(76,29,43,8B), V(DC,C6,23,CB), V(68,FC,ED,B6), V(63,F1,E4,B8), \
|
||||
V(CA,DC,31,D7), V(10,85,63,42), V(40,22,97,13), V(20,11,C6,84), \
|
||||
V(7D,24,4A,85), V(F8,3D,BB,D2), V(11,32,F9,AE), V(6D,A1,29,C7), \
|
||||
V(4B,2F,9E,1D), V(F3,30,B2,DC), V(EC,52,86,0D), V(D0,E3,C1,77), \
|
||||
V(6C,16,B3,2B), V(99,B9,70,A9), V(FA,48,94,11), V(22,64,E9,47), \
|
||||
V(C4,8C,FC,A8), V(1A,3F,F0,A0), V(D8,2C,7D,56), V(EF,90,33,22), \
|
||||
V(C7,4E,49,87), V(C1,D1,38,D9), V(FE,A2,CA,8C), V(36,0B,D4,98), \
|
||||
V(CF,81,F5,A6), V(28,DE,7A,A5), V(26,8E,B7,DA), V(A4,BF,AD,3F), \
|
||||
V(E4,9D,3A,2C), V(0D,92,78,50), V(9B,CC,5F,6A), V(62,46,7E,54), \
|
||||
V(C2,13,8D,F6), V(E8,B8,D8,90), V(5E,F7,39,2E), V(F5,AF,C3,82), \
|
||||
V(BE,80,5D,9F), V(7C,93,D0,69), V(A9,2D,D5,6F), V(B3,12,25,CF), \
|
||||
V(3B,99,AC,C8), V(A7,7D,18,10), V(6E,63,9C,E8), V(7B,BB,3B,DB), \
|
||||
V(09,78,26,CD), V(F4,18,59,6E), V(01,B7,9A,EC), V(A8,9A,4F,83), \
|
||||
V(65,6E,95,E6), V(7E,E6,FF,AA), V(08,CF,BC,21), V(E6,E8,15,EF), \
|
||||
V(D9,9B,E7,BA), V(CE,36,6F,4A), V(D4,09,9F,EA), V(D6,7C,B0,29), \
|
||||
V(AF,B2,A4,31), V(31,23,3F,2A), V(30,94,A5,C6), V(C0,66,A2,35), \
|
||||
V(37,BC,4E,74), V(A6,CA,82,FC), V(B0,D0,90,E0), V(15,D8,A7,33), \
|
||||
V(4A,98,04,F1), V(F7,DA,EC,41), V(0E,50,CD,7F), V(2F,F6,91,17), \
|
||||
V(8D,D6,4D,76), V(4D,B0,EF,43), V(54,4D,AA,CC), V(DF,04,96,E4), \
|
||||
V(E3,B5,D1,9E), V(1B,88,6A,4C), V(B8,1F,2C,C1), V(7F,51,65,46), \
|
||||
V(04,EA,5E,9D), V(5D,35,8C,01), V(73,74,87,FA), V(2E,41,0B,FB), \
|
||||
V(5A,1D,67,B3), V(52,D2,DB,92), V(33,56,10,E9), V(13,47,D6,6D), \
|
||||
V(8C,61,D7,9A), V(7A,0C,A1,37), V(8E,14,F8,59), V(89,3C,13,EB), \
|
||||
V(EE,27,A9,CE), V(35,C9,61,B7), V(ED,E5,1C,E1), V(3C,B1,47,7A), \
|
||||
V(59,DF,D2,9C), V(3F,73,F2,55), V(79,CE,14,18), V(BF,37,C7,73), \
|
||||
V(EA,CD,F7,53), V(5B,AA,FD,5F), V(14,6F,3D,DF), V(86,DB,44,78), \
|
||||
V(81,F3,AF,CA), V(3E,C4,68,B9), V(2C,34,24,38), V(5F,40,A3,C2), \
|
||||
V(72,C3,1D,16), V(0C,25,E2,BC), V(8B,49,3C,28), V(41,95,0D,FF), \
|
||||
V(71,01,A8,39), V(DE,B3,0C,08), V(9C,E4,B4,D8), V(90,C1,56,64), \
|
||||
V(61,84,CB,7B), V(70,B6,32,D5), V(74,5C,6C,48), V(42,57,B8,D0)
|
||||
|
||||
#define V(a,b,c,d) 0x##a##b##c##d
|
||||
static const uint32_t RT0[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##b##c##d##a
|
||||
static const uint32_t RT1[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##c##d##a##b
|
||||
static const uint32_t RT2[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##d##a##b##c
|
||||
static const uint32_t RT3[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#undef RT
|
||||
|
||||
/*
|
||||
* Round constants
|
||||
*/
|
||||
static const uint32_t RCON[10] =
|
||||
{
|
||||
0x00000001, 0x00000002, 0x00000004, 0x00000008,
|
||||
0x00000010, 0x00000020, 0x00000040, 0x00000080,
|
||||
0x0000001B, 0x00000036
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Forward S-box & tables
|
||||
*/
|
||||
static unsigned char FSb[256];
|
||||
static uint32_t FT0[256];
|
||||
static uint32_t FT1[256];
|
||||
static uint32_t FT2[256];
|
||||
static uint32_t FT3[256];
|
||||
|
||||
/*
|
||||
* Reverse S-box & tables
|
||||
*/
|
||||
static unsigned char RSb[256];
|
||||
static uint32_t RT0[256];
|
||||
static uint32_t RT1[256];
|
||||
static uint32_t RT2[256];
|
||||
static uint32_t RT3[256];
|
||||
|
||||
/*
|
||||
* Round constants
|
||||
*/
|
||||
static uint32_t RCON[10];
|
||||
|
||||
/*
|
||||
* Tables generation code
|
||||
*/
|
||||
#define ROTL8(x) ( ( x << 8 ) & 0xFFFFFFFF ) | ( x >> 24 )
|
||||
#define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) )
|
||||
#define MUL(x,y) ( ( x && y ) ? pow[(log[x]+log[y]) % 255] : 0 )
|
||||
|
||||
static int aes_init_done = 0;
|
||||
|
||||
static void aes_gen_tables( void )
|
||||
{
|
||||
int i, x, y, z;
|
||||
int pow[256];
|
||||
int log[256];
|
||||
|
||||
/*
|
||||
* compute pow and log tables over GF(2^8)
|
||||
*/
|
||||
for( i = 0, x = 1; i < 256; i++ )
|
||||
{
|
||||
pow[i] = x;
|
||||
log[x] = i;
|
||||
x = ( x ^ XTIME( x ) ) & 0xFF;
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate the round constants
|
||||
*/
|
||||
for( i = 0, x = 1; i < 10; i++ )
|
||||
{
|
||||
RCON[i] = (uint32_t) x;
|
||||
x = XTIME( x ) & 0xFF;
|
||||
}
|
||||
|
||||
/*
|
||||
* generate the forward and reverse S-boxes
|
||||
*/
|
||||
FSb[0x00] = 0x63;
|
||||
RSb[0x63] = 0x00;
|
||||
|
||||
for( i = 1; i < 256; i++ )
|
||||
{
|
||||
x = pow[255 - log[i]];
|
||||
|
||||
y = x; y = ( (y << 1) | (y >> 7) ) & 0xFF;
|
||||
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
|
||||
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
|
||||
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
|
||||
x ^= y ^ 0x63;
|
||||
|
||||
FSb[i] = (unsigned char) x;
|
||||
RSb[x] = (unsigned char) i;
|
||||
}
|
||||
|
||||
/*
|
||||
* generate the forward and reverse tables
|
||||
*/
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
x = FSb[i];
|
||||
y = XTIME( x ) & 0xFF;
|
||||
z = ( y ^ x ) & 0xFF;
|
||||
|
||||
FT0[i] = ( (uint32_t) y ) ^
|
||||
( (uint32_t) x << 8 ) ^
|
||||
( (uint32_t) x << 16 ) ^
|
||||
( (uint32_t) z << 24 );
|
||||
|
||||
FT1[i] = ROTL8( FT0[i] );
|
||||
FT2[i] = ROTL8( FT1[i] );
|
||||
FT3[i] = ROTL8( FT2[i] );
|
||||
|
||||
x = RSb[i];
|
||||
|
||||
RT0[i] = ( (uint32_t) MUL( 0x0E, x ) ) ^
|
||||
( (uint32_t) MUL( 0x09, x ) << 8 ) ^
|
||||
( (uint32_t) MUL( 0x0D, x ) << 16 ) ^
|
||||
( (uint32_t) MUL( 0x0B, x ) << 24 );
|
||||
|
||||
RT1[i] = ROTL8( RT0[i] );
|
||||
RT2[i] = ROTL8( RT1[i] );
|
||||
RT3[i] = ROTL8( RT2[i] );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AES key schedule (encryption)
|
||||
*/
|
||||
int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize )
|
||||
{
|
||||
unsigned int i;
|
||||
uint32_t *RK;
|
||||
|
||||
#if !defined(POLARSSL_AES_ROM_TABLES)
|
||||
if( aes_init_done == 0 )
|
||||
{
|
||||
aes_gen_tables();
|
||||
aes_init_done = 1;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
case 128: ctx->nr = 10; break;
|
||||
case 192: ctx->nr = 12; break;
|
||||
case 256: ctx->nr = 14; break;
|
||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||
}
|
||||
|
||||
ctx->rk = RK = ctx->buf;
|
||||
|
||||
for( i = 0; i < (keysize >> 5); i++ )
|
||||
{
|
||||
GET_UINT32_LE( RK[i], key, i << 2 );
|
||||
}
|
||||
|
||||
switch( ctx->nr )
|
||||
{
|
||||
case 10:
|
||||
|
||||
for( i = 0; i < 10; i++, RK += 4 )
|
||||
{
|
||||
RK[4] = RK[0] ^ RCON[i] ^
|
||||
( (uint32_t) FSb[ ( RK[3] >> 8 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( RK[3] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( RK[3] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( RK[3] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[5] = RK[1] ^ RK[4];
|
||||
RK[6] = RK[2] ^ RK[5];
|
||||
RK[7] = RK[3] ^ RK[6];
|
||||
}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
||||
for( i = 0; i < 8; i++, RK += 6 )
|
||||
{
|
||||
RK[6] = RK[0] ^ RCON[i] ^
|
||||
( (uint32_t) FSb[ ( RK[5] >> 8 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( RK[5] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( RK[5] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( RK[5] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[7] = RK[1] ^ RK[6];
|
||||
RK[8] = RK[2] ^ RK[7];
|
||||
RK[9] = RK[3] ^ RK[8];
|
||||
RK[10] = RK[4] ^ RK[9];
|
||||
RK[11] = RK[5] ^ RK[10];
|
||||
}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
||||
for( i = 0; i < 7; i++, RK += 8 )
|
||||
{
|
||||
RK[8] = RK[0] ^ RCON[i] ^
|
||||
( (uint32_t) FSb[ ( RK[7] >> 8 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( RK[7] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( RK[7] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( RK[7] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[9] = RK[1] ^ RK[8];
|
||||
RK[10] = RK[2] ^ RK[9];
|
||||
RK[11] = RK[3] ^ RK[10];
|
||||
|
||||
RK[12] = RK[4] ^
|
||||
( (uint32_t) FSb[ ( RK[11] ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( RK[11] >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( RK[11] >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( RK[11] >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
RK[13] = RK[5] ^ RK[12];
|
||||
RK[14] = RK[6] ^ RK[13];
|
||||
RK[15] = RK[7] ^ RK[14];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES key schedule (decryption)
|
||||
*/
|
||||
int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize )
|
||||
{
|
||||
int i, j;
|
||||
aes_context cty;
|
||||
uint32_t *RK;
|
||||
uint32_t *SK;
|
||||
int ret;
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
case 128: ctx->nr = 10; break;
|
||||
case 192: ctx->nr = 12; break;
|
||||
case 256: ctx->nr = 14; break;
|
||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||
}
|
||||
|
||||
ctx->rk = RK = ctx->buf;
|
||||
|
||||
ret = aes_setkey_enc( &cty, key, keysize );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
SK = cty.rk + cty.nr * 4;
|
||||
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
|
||||
for( i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8 )
|
||||
{
|
||||
for( j = 0; j < 4; j++, SK++ )
|
||||
{
|
||||
*RK++ = RT0[ FSb[ ( *SK ) & 0xFF ] ] ^
|
||||
RT1[ FSb[ ( *SK >> 8 ) & 0xFF ] ] ^
|
||||
RT2[ FSb[ ( *SK >> 16 ) & 0xFF ] ] ^
|
||||
RT3[ FSb[ ( *SK >> 24 ) & 0xFF ] ];
|
||||
}
|
||||
}
|
||||
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
|
||||
memset( &cty, 0, sizeof( aes_context ) );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
|
||||
{ \
|
||||
X0 = *RK++ ^ FT0[ ( Y0 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y3 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X1 = *RK++ ^ FT0[ ( Y1 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y0 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X2 = *RK++ ^ FT0[ ( Y2 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y1 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X3 = *RK++ ^ FT0[ ( Y3 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y2 >> 24 ) & 0xFF ]; \
|
||||
}
|
||||
|
||||
#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
|
||||
{ \
|
||||
X0 = *RK++ ^ RT0[ ( Y0 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y1 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X1 = *RK++ ^ RT0[ ( Y1 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y2 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X2 = *RK++ ^ RT0[ ( Y2 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y3 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X3 = *RK++ ^ RT0[ ( Y3 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y0 >> 24 ) & 0xFF ]; \
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-ECB block encryption/decryption
|
||||
*/
|
||||
int aes_crypt_ecb( aes_context *ctx,
|
||||
int mode,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] )
|
||||
{
|
||||
int i;
|
||||
uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
|
||||
|
||||
RK = ctx->rk;
|
||||
|
||||
GET_UINT32_LE( X0, input, 0 ); X0 ^= *RK++;
|
||||
GET_UINT32_LE( X1, input, 4 ); X1 ^= *RK++;
|
||||
GET_UINT32_LE( X2, input, 8 ); X2 ^= *RK++;
|
||||
GET_UINT32_LE( X3, input, 12 ); X3 ^= *RK++;
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
|
||||
{
|
||||
AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
|
||||
}
|
||||
|
||||
AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
|
||||
X0 = *RK++ ^ \
|
||||
( (uint32_t) RSb[ ( Y0 ) & 0xFF ] ) ^
|
||||
( (uint32_t) RSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) RSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) RSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X1 = *RK++ ^ \
|
||||
( (uint32_t) RSb[ ( Y1 ) & 0xFF ] ) ^
|
||||
( (uint32_t) RSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) RSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) RSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X2 = *RK++ ^ \
|
||||
( (uint32_t) RSb[ ( Y2 ) & 0xFF ] ) ^
|
||||
( (uint32_t) RSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) RSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) RSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X3 = *RK++ ^ \
|
||||
( (uint32_t) RSb[ ( Y3 ) & 0xFF ] ) ^
|
||||
( (uint32_t) RSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) RSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) RSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
|
||||
}
|
||||
else /* AES_ENCRYPT */
|
||||
{
|
||||
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
|
||||
{
|
||||
AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
|
||||
}
|
||||
|
||||
AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
|
||||
X0 = *RK++ ^ \
|
||||
( (uint32_t) FSb[ ( Y0 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X1 = *RK++ ^ \
|
||||
( (uint32_t) FSb[ ( Y1 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X2 = *RK++ ^ \
|
||||
( (uint32_t) FSb[ ( Y2 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X3 = *RK++ ^ \
|
||||
( (uint32_t) FSb[ ( Y3 ) & 0xFF ] ) ^
|
||||
( (uint32_t) FSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (uint32_t) FSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (uint32_t) FSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
|
||||
}
|
||||
|
||||
PUT_UINT32_LE( X0, output, 0 );
|
||||
PUT_UINT32_LE( X1, output, 4 );
|
||||
PUT_UINT32_LE( X2, output, 8 );
|
||||
PUT_UINT32_LE( X3, output, 12 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-CBC buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_cbc( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int i;
|
||||
unsigned char temp[16];
|
||||
|
||||
if( length % 16 )
|
||||
return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH );
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
memcpy( temp, input, 16 );
|
||||
aes_crypt_ecb( ctx, mode, input, output );
|
||||
|
||||
for( i = 0; i < 16; i++ )
|
||||
output[i] = (unsigned char)( output[i] ^ iv[i] );
|
||||
|
||||
memcpy( iv, temp, 16 );
|
||||
|
||||
input += 16;
|
||||
output += 16;
|
||||
length -= 16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
for( i = 0; i < 16; i++ )
|
||||
output[i] = (unsigned char)( input[i] ^ iv[i] );
|
||||
|
||||
aes_crypt_ecb( ctx, mode, output, output );
|
||||
memcpy( iv, output, 16 );
|
||||
|
||||
input += 16;
|
||||
output += 16;
|
||||
length -= 16;
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-CFB128 buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_cfb128( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
size_t *iv_off,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int c;
|
||||
size_t n = *iv_off;
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
while( length-- )
|
||||
{
|
||||
if( n == 0 )
|
||||
aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv );
|
||||
|
||||
c = *input++;
|
||||
*output++ = (unsigned char)( c ^ iv[n] );
|
||||
iv[n] = (unsigned char) c;
|
||||
|
||||
n = (n + 1) & 0x0F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( length-- )
|
||||
{
|
||||
if( n == 0 )
|
||||
aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv );
|
||||
|
||||
iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ );
|
||||
|
||||
n = (n + 1) & 0x0F;
|
||||
}
|
||||
}
|
||||
|
||||
*iv_off = n;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-CTR buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int c, i;
|
||||
size_t n = *nc_off;
|
||||
|
||||
while( length-- )
|
||||
{
|
||||
if( n == 0 ) {
|
||||
aes_crypt_ecb( ctx, AES_ENCRYPT, nonce_counter, stream_block );
|
||||
|
||||
for( i = 16; i > 0; i-- )
|
||||
if( ++nonce_counter[i - 1] != 0 )
|
||||
break;
|
||||
}
|
||||
c = *input++;
|
||||
*output++ = (unsigned char)( c ^ stream_block[n] );
|
||||
|
||||
n = (n + 1) & 0x0F;
|
||||
}
|
||||
|
||||
*nc_off = n;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* AES-CMAC */
|
||||
|
||||
unsigned char const_Rb[16] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87
|
||||
};
|
||||
unsigned char const_Zero[16] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
void leftshift_onebit(unsigned char *input, unsigned char *output)
|
||||
{
|
||||
int i;
|
||||
unsigned char overflow = 0;
|
||||
|
||||
for (i = 15; i >= 0; i--)
|
||||
{
|
||||
output[i] = input[i] << 1;
|
||||
output[i] |= overflow;
|
||||
overflow = (input[i] & 0x80) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
void xor_128(unsigned char *a, unsigned char *b, unsigned char *out)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = a[i] ^ b[i];
|
||||
}
|
||||
|
||||
void generate_subkey(aes_context *ctx, unsigned char *K1, unsigned char *K2)
|
||||
{
|
||||
unsigned char L[16];
|
||||
unsigned char Z[16];
|
||||
unsigned char tmp[16];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 16; i++) Z[i] = 0;
|
||||
|
||||
aes_crypt_ecb(ctx, AES_ENCRYPT, Z, L);
|
||||
|
||||
if ((L[0] & 0x80) == 0)
|
||||
{
|
||||
leftshift_onebit(L,K1);
|
||||
} else {
|
||||
leftshift_onebit(L,tmp);
|
||||
xor_128(tmp,const_Rb,K1);
|
||||
}
|
||||
|
||||
if ((K1[0] & 0x80) == 0)
|
||||
{
|
||||
leftshift_onebit(K1,K2);
|
||||
} else {
|
||||
leftshift_onebit(K1,tmp);
|
||||
xor_128(tmp,const_Rb,K2);
|
||||
}
|
||||
}
|
||||
|
||||
void padding (unsigned char *lastb, unsigned char *pad, int length)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (i < length)
|
||||
pad[i] = lastb[i];
|
||||
else if (i == length)
|
||||
pad[i] = 0x80;
|
||||
else
|
||||
pad[i] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char *output)
|
||||
{
|
||||
unsigned char X[16], Y[16], M_last[16], padded[16];
|
||||
unsigned char K1[16], K2[16];
|
||||
int n, i, flag;
|
||||
generate_subkey(ctx, K1, K2);
|
||||
|
||||
n = (length + 15) / 16;
|
||||
if (n == 0)
|
||||
{
|
||||
n = 1;
|
||||
flag = 0;
|
||||
} else {
|
||||
if ((length % 16) == 0)
|
||||
flag = 1;
|
||||
else
|
||||
flag = 0;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
xor_128(&input[16 * (n - 1)], K1, M_last);
|
||||
} else {
|
||||
padding(&input[16 * (n - 1)], padded, length % 16);
|
||||
xor_128(padded, K2, M_last);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) X[i] = 0;
|
||||
for (i = 0; i < n - 1; i++)
|
||||
{
|
||||
xor_128(X, &input[16*i], Y);
|
||||
aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X);
|
||||
}
|
||||
|
||||
xor_128(X,M_last,Y);
|
||||
aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
output[i] = X[i];
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* \file aes.h
|
||||
*
|
||||
* \brief AES block cipher
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
typedef UINT32 uint32_t;
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */
|
||||
#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */
|
||||
|
||||
// Regular implementation
|
||||
//
|
||||
|
||||
/**
|
||||
* \brief AES context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int nr; /*!< number of rounds */
|
||||
uint32_t *rk; /*!< AES round keys */
|
||||
uint32_t buf[68]; /*!< unaligned data */
|
||||
}
|
||||
aes_context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (encryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key encryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (decryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key decryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES-ECB block encryption/decryption
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode AES_ENCRYPT or AES_DECRYPT
|
||||
* \param input 16-byte input block
|
||||
* \param output 16-byte output block
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_ecb( aes_context *ctx,
|
||||
int mode,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief AES-CBC buffer encryption/decryption
|
||||
* Length should be a multiple of the block
|
||||
* size (16 bytes)
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode AES_ENCRYPT or AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
|
||||
*/
|
||||
int aes_crypt_cbc( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
/**
|
||||
* \brief AES-CFB128 buffer encryption/decryption.
|
||||
*
|
||||
* Note: Due to the nature of CFB you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT.
|
||||
*
|
||||
* both
|
||||
* \param ctx AES context
|
||||
* \param mode AES_ENCRYPT or AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv_off offset in IV (updated after use)
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_cfb128( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
size_t *iv_off,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
/**
|
||||
* \brief AES-CTR buffer encryption/decryption
|
||||
*
|
||||
* Warning: You have to keep the maximum use of your counter in mind!
|
||||
*
|
||||
* Note: Due to the nature of CTR you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT.
|
||||
*
|
||||
* \param length The length of the data
|
||||
* \param nc_off The offset in the current stream_block (for resuming
|
||||
* within current cipher stream). The offset pointer to
|
||||
* should be 0 at the start of a stream.
|
||||
* \param nonce_counter The 128-bit nonce and counter.
|
||||
* \param stream_block The saved stream-block for resuming. Is overwritten
|
||||
* by the function.
|
||||
* \param input The input data stream
|
||||
* \param output The output data stream
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char *output);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,790 @@
|
||||
#include "stdafx.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
KeyVault::KeyVault()
|
||||
{
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV0Keys()
|
||||
{
|
||||
sk_LV0_arr.clear();
|
||||
sk_LV0_arr.emplace_back(0x0000000000000000, 0x0000, KEY_LV0,
|
||||
"CA7A24EC38BDB45B98CCD7D363EA2AF0C326E65081E0630CB9AB2D215865878A",
|
||||
"F9205F46F6021697E670F13DFA726212",
|
||||
"A8FD6DB24532D094EFA08CB41C9A72287D905C6B27B42BE4AB925AAF4AFFF34D41EEB54DD128700D",
|
||||
"001AD976FCDE86F5B8FF3E63EF3A7F94E861975BA3",
|
||||
0x33);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLDRKeys()
|
||||
{
|
||||
sk_LDR_arr.clear();
|
||||
sk_LDR_arr.emplace_back(0x0000000000000000, 0x0000, KEY_LDR,
|
||||
"C0CEFE84C227F75BD07A7EB846509F93B238E770DACB9FF4A388F812482BE21B",
|
||||
"47EE7454E4774CC9B8960C7B59F4C14D",
|
||||
"C2D4AAF319355019AF99D44E2B58CA29252C89123D11D6218F40B138CAB29B7101F3AEB72A975019",
|
||||
"00C5B2BFA1A413DD16F26D31C0F2ED4720DCFB0670",
|
||||
0x20);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV1Keys()
|
||||
{
|
||||
sk_LV1_arr.clear();
|
||||
sk_LV1_arr.emplace_back(0x0003003000000000, 0x0000, KEY_LV1,
|
||||
"B9F3F9E6107CFF2680A91E118C2403CF4A6F18F3C7EFD7D13D1AC4DB760BD222",
|
||||
"B43661B9A79BAD9D8E2B046469CDA1E7",
|
||||
"4C870BE86DDD996A92A3F7F404F33604244A1D02AB5B78BC9DAF030B78BE8867CF586171B7D45D20",
|
||||
"002CC736C7AD06D264E9AB663EB1F35F5DC159248C",
|
||||
0x33);
|
||||
sk_LV1_arr.emplace_back(0x0003004200000000, 0x0000, KEY_LV1,
|
||||
"B880593856C8C6D2037585626A12977F50DCFCF3F132D2C89AA6E670EAFC1646",
|
||||
"A79B05D4E37B8117A95E6E7C14FB640E",
|
||||
"7454C7CCBFC2F66C142D78A730A3A6F973CC0FB75A46FCBB390790138910A0CAC78E5E21F4DA3375",
|
||||
"00033A699FDD2DA6CDD6CCC03B2C6145F998706F74",
|
||||
0x34);
|
||||
sk_LV1_arr.emplace_back(0x0003005000000000, 0x0000, KEY_LV1,
|
||||
"1E8EEEA9E80A729F3FA52CF523B25941EA44B4155D94E5DADC5C5A77847620C7",
|
||||
"E034D31A80316960024D1B3D3164FDC3",
|
||||
"7E3A196f4A5879F3A7B091A2263F7C24E1716129B580566D308D9C2254B36AEE53DEF30EC85F8398",
|
||||
"005815D17125D04C33790321DE29EB6241365100B5",
|
||||
0x35);
|
||||
sk_LV1_arr.emplace_back(0x0003005500000000, 0x0000, KEY_LV1,
|
||||
"53ABDF84BE08B0351B734F2B97D2BE1621BC6C889E4362E5C70F39D6C3ED9F23",
|
||||
"44E652661AC7584DBE08ECB810FB5FC0",
|
||||
"733198A7759BC07326755BC9773A8A17C8A7043C7BDAB83D88E230512E2EA3852D7DA4263A7E97F9",
|
||||
"004312C65347ACBE95CC306442FEFD0AF4C2935EB3",
|
||||
0x05);
|
||||
sk_LV1_arr.emplace_back(0x0003005600000000, 0x0000, KEY_LV1,
|
||||
"48793EBDDA1AF65D737DA2FDA2DD104447A698F8A82CAAEE992831711BA94E83",
|
||||
"15DCF3C67147A45D09DE7521EECA07A1",
|
||||
"85A8868C320127F10B6598964C69221C086702021D31803520E21FDE4DBE827766BE41825CB7328C",
|
||||
"",
|
||||
0x07);
|
||||
sk_LV1_arr.emplace_back(0x0003006100000000, 0x0000, KEY_LV1,
|
||||
"5FF17D836E2C4AD69476E2614F64BDD05B9115389A9A6D055B5B544B1C34E3D5",
|
||||
"DF0F50EC3C4743C5B17839D7B49F24A4",
|
||||
"1CDABE30833823F461CA534104115FFF60010B710631E435A7D915E82AE88EDE667264656CB7062E",
|
||||
"",
|
||||
0x05);
|
||||
sk_LV1_arr.emplace_back(0x0003006600000000, 0x0000, KEY_LV1,
|
||||
"BD0621FA19383C3C72ECBC3B008F1CD55FFD7C3BB7510BF11AD0CF0FC2B70951",
|
||||
"569AF3745E1E02E3E288273CDE244CD8",
|
||||
"21E26F11C2D69478609DD1BD278CDFC940D90386455BA52FCD1FA7E27AC2AFA826C79A10193B625C",
|
||||
"",
|
||||
0x07);
|
||||
sk_LV1_arr.emplace_back(0x0003007400000000, 0x0000, KEY_LV1,
|
||||
"41A6E0039041E9D8AAF4EF2F2A2971248EDBD96A3985611ED7B4CE73EE4804FE",
|
||||
"C8C98D5A5CE23AF5607A352AECACB0DC",
|
||||
"4389664390265F96C1A882374C0F856364E33DB09BE124A4666F9A12F0DD9C811EDD55BA21ED0667",
|
||||
"",
|
||||
0x12);
|
||||
sk_LV1_arr.emplace_back(0x0004001100000000, 0x0000, KEY_LV1,
|
||||
"557EDF6C063F3272B0D44EEC12F418DA774815B5415597CC5F75C21E048BAD74",
|
||||
"7144D7574937818517826227EF4AC0B4",
|
||||
"085D38DBF9B757329EB862107929909D32FA1DAE60641BF4AC25319D7650597EE977F8E810FEEA96",
|
||||
"",
|
||||
0x13);
|
||||
sk_LV1_arr.emplace_back(0x0004005000000000, 0x0000, KEY_LV1,
|
||||
"10CEA04973FCCC12EC19924510822D8D4C41F657FD3D7E73F415A8D687421BCD",
|
||||
"ED8699562C6AC65204FA166257E7FCF4",
|
||||
"9AF86FC869C159FBB62F7D9674EE257ABF12E5A96D5875B4AA73C13C2BC13E2A4079F98B9B935EE2",
|
||||
"",
|
||||
0x14);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV2Keys()
|
||||
{
|
||||
sk_LV2_arr.clear();
|
||||
sk_LV2_arr.emplace_back(0x0003003000000000, 0x0000, KEY_LV2,
|
||||
"94303F69513572AB5AE17C8C2A1839D2C24C28F65389D3BBB11894CE23E0798F",
|
||||
"9769BFD187B90990AE5FEA4E110B9CF5",
|
||||
"AFAF5E96AF396CBB69071082C46A8F34A030E8EDB799E0A7BE00AA264DFF3AEBF7923920D559404D",
|
||||
"0070ABF9361B02291829D479F56AB248203CD3EB46",
|
||||
0x20);
|
||||
sk_LV2_arr.emplace_back(0x0003004200000000, 0x0000, KEY_LV2,
|
||||
"575B0A6C4B4F2760A03FE4189EBAF4D947279FD982B14070349098B08FF92C10",
|
||||
"411CB18F460CE50CAF2C426D8F0D93C8",
|
||||
"3FEE313954CB3039C321A7E33B97FFDEC8988A8B55759161B04DBF4731284E4A8191E3F17D32B0EA",
|
||||
"0073076441A08CD179E5FACE349B86DA58B5B7BA78",
|
||||
0x21);
|
||||
sk_LV2_arr.emplace_back(0x0003005000000000, 0x0000, KEY_LV2,
|
||||
"6DBD48D787C58803A8D724DA5ACF04FF8FCE91D7545D2322F2B7ABF57014AF68",
|
||||
"603A36213708520ED5D745DEC1325BA5",
|
||||
"5888CB83AC3CCA9610BC173C53141C0CA58B93719E744660CA8823D5EAEE8F9BF736997054E4B7E3",
|
||||
"0009EBC3DE442FA5FBF6C4F3D4F9EAB07778A142BD",
|
||||
0x22);
|
||||
sk_LV2_arr.emplace_back(0x0003005500000000, 0x0000, KEY_LV2,
|
||||
"84015E90FA23139628A3C75CC09714E6427B527A82D18ABC3E91CD8D7DDAFF17",
|
||||
"5B240444D645F2038118F97FD5A145D5",
|
||||
"B266318245266B2D33641CD8A864066D077FAC60B7E27399099A70A683454B70F9888E7CC0C2BF72",
|
||||
"009D4CBA2BFB1A8330D3E20E59D281D476D231C73A",
|
||||
0x32);
|
||||
sk_LV2_arr.emplace_back(0x0003005600000000, 0x0000, KEY_LV2,
|
||||
"EAE15444048EFDE7A831BFA9F5D96F047C9FCFF50723E292CF50F5417D81E359",
|
||||
"9CA9282DC7FA9F315EF3156D970B7CD4",
|
||||
"0D58938CB47598A6A672874F1768068F8B80D8D17014D2ABEBAC85E5B0993D9FB6F307DDC3DDA699",
|
||||
"",
|
||||
0x33);
|
||||
sk_LV2_arr.emplace_back(0x0003006100000000, 0x0000, KEY_LV2,
|
||||
"88AD367EDEC2FEED3E2F99B1C685075C41BDEC90C84F526CAF588F89BBD1CBCC",
|
||||
"8D18E8E525230E63DE10291C9DD615BF",
|
||||
"86EED1D65E58890ABDA9ACA486A2BDDB9C0A529C2053FAE301F0F698EAF443DA0F60595A597A7027",
|
||||
"",
|
||||
0x32);
|
||||
sk_LV2_arr.emplace_back(0x0003006600000000, 0x0000, KEY_LV2,
|
||||
"688D5FCAC6F4EA35AC6AC79B10506007286131EE038116DB8AA2C0B0340D9FB0",
|
||||
"75E0239D18B0B669EAE650972F99726B",
|
||||
"008E1C820AC567D1BFB8FE3CC6AD2E1845A1D1B19ED2E18B18CA34A8D28A83EC60C63859CDB3DACA",
|
||||
"",
|
||||
0x33);
|
||||
sk_LV2_arr.emplace_back(0x0003007400000000, 0x0000, KEY_LV2,
|
||||
"E81C5B04C29FB079A4A2687A39D4EA97BFB49D80EF546CEB292979A5F77A6254",
|
||||
"15058FA7F2CAD7C528B5F605F6444EB0",
|
||||
"438D0E5C1E7AFB18234DB6867472FF5F52B750F30C379C7DD1EE0FD23E417B3EA819CC01BAC480ED",
|
||||
"",
|
||||
0x11);
|
||||
sk_LV2_arr.emplace_back(0x0004001100000000, 0x0000, KEY_LV2,
|
||||
"A1E4B86ED02BF7F1372A2C73FE02BC738907EB37CE3BA605FE783C999FAFDB97",
|
||||
"BBE7799B9A37CB272E386618FDFD4AEC",
|
||||
"5B31A8E2A663EBD673196E2E1022E0D64988C4E1BBFE5E474415883A3BA0D9C562A2BE9C30E9B4A8",
|
||||
"",
|
||||
0x07);
|
||||
sk_LV2_arr.emplace_back(0x0004005000000000, 0x0000, KEY_LV2,
|
||||
"0CAF212B6FA53C0DA7E2C575ADF61DBE68F34A33433B1B891ABF5C4251406A03",
|
||||
"9B79374722AD888EB6A35A2DF25A8B3E",
|
||||
"1034A6F98AF6625CC3E3604B59B971CA617DF337538D2179EBB22F3BDC9D0C6DA56BA7DDFD205A50",
|
||||
"",
|
||||
0x14);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfISOKeys()
|
||||
{
|
||||
sk_ISO_arr.clear();
|
||||
sk_ISO_arr.emplace_back(0x0003003000000000, 0x0001, KEY_ISO,
|
||||
"8860D0CFF4D0DC688D3223321B96B59A777E6914961488E07048DAECB020ECA4",
|
||||
"C82D015D46CF152F1DD0C16F18B5B1E5",
|
||||
"733918D7C888130509346E6B4A8B6CAA357AB557E814E8122BF102C14A314BF9475B9D70EAF9EC29",
|
||||
"009BE892E122A5C943C1BB7403A67318AA9E1B286F",
|
||||
0x36);
|
||||
sk_ISO_arr.emplace_back(0x0003004200000000, 0x0001, KEY_ISO,
|
||||
"101E27F3FA2FB53ACA924F783AD553162D56B975D05B81351A1111799F20254D",
|
||||
"8D2E9C6297B8AD252998458296AC773C",
|
||||
"138446EE0BDDA5638F97328C8956E6489CBBFE57C5961D40DD5C43BB4138F1C400A8B27204A5D625",
|
||||
"00849DBC57D3B92F01864E6E82EB4EF0EF6311E122",
|
||||
0x32);
|
||||
sk_ISO_arr.emplace_back(0x0003005000000000, 0x0001, KEY_ISO,
|
||||
"3F2604FA27AEADFBE1AC69EB00BB16EF196C2193CBD62900FFD8C25041680843",
|
||||
"A414AC1DB7987E43777651B330B899E1",
|
||||
"1F4633AFDE18614D6CEF38A2FD6C4CCAC7B6EB8109D72CD066ECEBA0193EA3F43C37AE83179A4E5F",
|
||||
"0085B4B05DEBA7E6AD831653C974D95149803BB272",
|
||||
0x33);
|
||||
sk_ISO_arr.emplace_back(0x0003005500000000, 0x0001, KEY_ISO,
|
||||
"BDB74AA6E3BA2DC10B1BD7F17198399A158DBE1FA0BEA68C90FCACBE4D04BE37",
|
||||
"0207A479B1574F8E7F697528F05D5435",
|
||||
"917E1F1DC48A54EB5F10B38E7569BB5383628A7C906F0DCA62FDA33805C15FAB270016940A09DB58",
|
||||
"00294411363290975BA551336D3965D88AF029A17B",
|
||||
0x03);
|
||||
sk_ISO_arr.emplace_back(0x0003005600000000, 0x0001, KEY_ISO,
|
||||
"311C015F169F2A1E0757F7064B14C7C9F3A3FFEE015BD4E3A22401A2667857CE",
|
||||
"7BB8B3F5AC8E0890E3148AE5688C7350",
|
||||
"3F040EFA2335FED5670BA4D5C3AB2D9D0B4BA69D154A0062EA995A7D21DBAF0DC5A0DAD333D1C1DD",
|
||||
"",
|
||||
0x08);
|
||||
sk_ISO_arr.emplace_back(0x0003006100000000, 0x0001, KEY_ISO,
|
||||
"8474ADCA3B3244931EECEB9357841442442A1C4A4BCF4E498E6738950F4E4093",
|
||||
"FFF9CACCC4129125CAFB240F419E5F39",
|
||||
"098E1A53E59A95316B00D5A29C05FFEBAE41D1A8A386F9DA96F98858FD25E07BB7A3BC96A5D5B556",
|
||||
"",
|
||||
0x03);
|
||||
sk_ISO_arr.emplace_back(0x0003006600000000, 0x0001, KEY_ISO,
|
||||
"E6A21C599B75696C169EC02582BDA74A776134A6E05108EA701EC0CA2AC03592",
|
||||
"D292A7BD57C0BB2EABBCA1252FA9EDEF",
|
||||
"2ED078A13DC4617EB550AD06E228C83C142A2D588EB5E729402D18038A14842FD65B277DCAD225A5",
|
||||
"",
|
||||
0x08);
|
||||
sk_ISO_arr.emplace_back(0x0003007400000000, 0x0001, KEY_ISO,
|
||||
"072D3A5C3BDB0D674DE209381432B20414BC9BDA0F583ECB94BD9A134176DD51",
|
||||
"8516A81F02CF938740498A406C880871",
|
||||
"5A778DEB5C4F12E8D48E06A2BBBBE3C90FA8C6C47DF9BDB5697FD4A8EB7941CE3F59A557E81C787D",
|
||||
"",
|
||||
0x21);
|
||||
sk_ISO_arr.emplace_back(0x0003007400000000, 0x0100, KEY_ISO,
|
||||
"786FAB8A0B89474A2CB80B3EA104CCCB9E13F66B45EC499BB31865D07C661EA8",
|
||||
"94662F13D99A9F5D211C979FFDF65FE3",
|
||||
"912C94C252B7799CEB45DFBB73EF7CAD9BCC0793A3331BBB79E3C47C0F5C782F698065A8D4DB0D8B",
|
||||
"",
|
||||
0x0E);
|
||||
sk_ISO_arr.emplace_back(0x0004001100000000, 0x0001, KEY_ISO,
|
||||
"4262657A3185D9480F82C8BD2F81766FCC2C8FD7DD5EBE8657B00B939E0C75BD",
|
||||
"4F1E3EF07D893A4714B1B3D5A4E50479",
|
||||
"4DBFCFA68B52F1D66E09AFA6C18EC65479EDBD027B6B8C6A5D85FE5C84D43EA40CEF1672078A0702",
|
||||
"",
|
||||
0x11);
|
||||
sk_ISO_arr.emplace_back(0x0004001100000000, 0x0100, KEY_ISO,
|
||||
"16AA7D7C35399E2B1BFAF68CD19D7512A7855029C08BECC4CC3F035DF7F9C70B",
|
||||
"0E50DB6D937D262CB0499136852FCB80",
|
||||
"AEE2795BF295662A50DFAFE70D1B0B6F0A2EBB211E1323A275FC6E2D13BE4F2F10CA34784F4CF1EC",
|
||||
"",
|
||||
0x0F);
|
||||
sk_ISO_arr.emplace_back(0x0004005000000000, 0x0001, KEY_ISO,
|
||||
"63565DBE98C3B1A52AADC907C47130FE57A10734E84F22592670F86ED2B0A086",
|
||||
"953F6A99891B4739358F5363A00C08B9",
|
||||
"26BE7B02E7D65C6C21BF4063CDB8C0092FE1679D62FA1A8CCC284A1D21885473A959992537A06612",
|
||||
"",
|
||||
0x15);
|
||||
sk_ISO_arr.emplace_back(0x0004005000000000, 0x0100, KEY_ISO,
|
||||
"B96EA32CB96EA32DB96EA32CB96EA32CB96EA32CB96EA32DB96EA32CB96EA32C",
|
||||
"B96EA32CB96EA32DB96EA32DB96EA32C",
|
||||
"2D7066E68C6AC3373B1346FD76FE7D18A207C811500E65D85DB57BC4A27AD78F59FD53F38F50E151",
|
||||
"0044AA25B4276D79B494A29CB8DE104642424F8EEF",
|
||||
0x02);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfAPPKeys()
|
||||
{
|
||||
sk_APP_arr.clear();
|
||||
sk_APP_arr.emplace_back(0x0000009200000000, 0x0000, KEY_APP,
|
||||
"95F50019E7A68E341FA72EFDF4D60ED376E25CF46BB48DFDD1F080259DC93F04",
|
||||
"4A0955D946DB70D691A640BB7FAECC4C",
|
||||
"6F8DF8EBD0A1D1DB08B30DD3A951E3F1F27E34030B42C729C55555232D61B834B8BDFFB07E54B343",
|
||||
"006C3E4CCB2C69A5AD7C6F60448E50C7F9184EEAF4",
|
||||
0x21);
|
||||
sk_APP_arr.emplace_back(0x0003003000000000, 0x0001, KEY_APP,
|
||||
"79481839C406A632BDB4AC093D73D99AE1587F24CE7E69192C1CD0010274A8AB",
|
||||
"6F0F25E1C8C4B7AE70DF968B04521DDA",
|
||||
"94D1B7378BAFF5DFED269240A7A364ED68446741622E50BC6079B6E606A2F8E0A4C56E5CFF836526",
|
||||
"003DE80167D2F0E9D30F2145144A558D1174F5410C",
|
||||
0x11);
|
||||
sk_APP_arr.emplace_back(0x0003003000000000, 0x0002, KEY_APP,
|
||||
"4F89BE98DDD43CAD343F5BA6B1A133B0A971566F770484AAC20B5DD1DC9FA06A",
|
||||
"90C127A9B43BA9D8E89FE6529E25206F",
|
||||
"8CA6905F46148D7D8D84D2AFCEAE61B41E6750FC22EA435DFA61FCE6F4F860EE4F54D9196CA5290E",
|
||||
"",
|
||||
0x13);
|
||||
sk_APP_arr.emplace_back(0x0003003000000000, 0x0003, KEY_APP,
|
||||
"C1E6A351FCED6A0636BFCB6801A0942DB7C28BDFC5E0A053A3F52F52FCE9754E",
|
||||
"E0908163F457576440466ACAA443AE7C",
|
||||
"50022D5D37C97905F898E78E7AA14A0B5CAAD5CE8190AE5629A10D6F0CF4173597B37A95A7545C92",
|
||||
"",
|
||||
0x0B);
|
||||
sk_APP_arr.emplace_back(0x0003004200000000, 0x0004, KEY_APP,
|
||||
"838F5860CF97CDAD75B399CA44F4C214CDF951AC795298D71DF3C3B7E93AAEDA",
|
||||
"7FDBB2E924D182BB0D69844ADC4ECA5B",
|
||||
"1F140E8EF887DAB52F079A06E6915A6460B75CD256834A43FA7AF90C23067AF412EDAFE2C1778D69",
|
||||
"0074E922FDEE5DC4CDF22FC8D7986477F813400860",
|
||||
0x14);
|
||||
sk_APP_arr.emplace_back(0x0003004200000000, 0x0005, KEY_APP,
|
||||
"C109AB56593DE5BE8BA190578E7D8109346E86A11088B42C727E2B793FD64BDC",
|
||||
"15D3F191295C94B09B71EBDE088A187A",
|
||||
"B6BB0A84C649A90D97EBA55B555366F52381BB38A84C8BB71DA5A5A0949043C6DB249029A43156F7",
|
||||
"",
|
||||
0x15);
|
||||
sk_APP_arr.emplace_back(0x0003004200000000, 0x0006, KEY_APP,
|
||||
"6DFD7AFB470D2B2C955AB22264B1FF3C67F180983B26C01615DE9F2ECCBE7F41",
|
||||
"24BD1C19D2A8286B8ACE39E4A37801C2",
|
||||
"71F46AC33FF89DF589A100A7FB64CEAC244C9A0CBBC1FDCE80FB4BF8A0D2E66293309CB8EE8CFA95",
|
||||
"",
|
||||
0x2C);
|
||||
sk_APP_arr.emplace_back(0x0003005000000000, 0x0007, KEY_APP,
|
||||
"945B99C0E69CAF0558C588B95FF41B232660ECB017741F3218C12F9DFDEEDE55",
|
||||
"1D5EFBE7C5D34AD60F9FBC46A5977FCE",
|
||||
"AB284CA549B2DE9AA5C903B75652F78D192F8F4A8F3CD99209415C0A84C5C9FD6BF3095C1C18FFCD",
|
||||
"002CF896D35DB871D0E6A252E799876A70D043C23E",
|
||||
0x15);
|
||||
sk_APP_arr.emplace_back(0x0003005000000000, 0x0008, KEY_APP,
|
||||
"2C9E8969EC44DFB6A8771DC7F7FDFBCCAF329EC3EC070900CABB23742A9A6E13",
|
||||
"5A4CEFD5A9C3C093D0B9352376D19405",
|
||||
"6E82F6B54A0E9DEBE4A8B3043EE3B24CD9BBB62B4416B0482582E419A2552E29AB4BEA0A4D7FA2D5",
|
||||
"",
|
||||
0x16);
|
||||
sk_APP_arr.emplace_back(0x0003005000000000, 0x0009, KEY_APP,
|
||||
"F69E4A2934F114D89F386CE766388366CDD210F1D8913E3B973257F1201D632B",
|
||||
"F4D535069301EE888CC2A852DB654461",
|
||||
"1D7B974D10E61C2ED087A0981535904677EC07E96260F89565FF7EBDA4EE035C2AA9BCBDD5893F99",
|
||||
"",
|
||||
0x2D);
|
||||
sk_APP_arr.emplace_back(0x0003005500000000, 0x000A, KEY_APP,
|
||||
"29805302E7C92F204009161CA93F776A072141A8C46A108E571C46D473A176A3",
|
||||
"5D1FAB844107676ABCDFC25EAEBCB633",
|
||||
"09301B6436C85B53CB1585300A3F1AF9FB14DB7C30088C4642AD66D5C148B8995BB1A698A8C71827",
|
||||
"0010818ED8A666051C6198662C3D6DDE2CA4901DDC",
|
||||
0x25);
|
||||
sk_APP_arr.emplace_back(0x0003005500000000, 0x000B, KEY_APP,
|
||||
"A4C97402CC8A71BC7748661FE9CE7DF44DCE95D0D58938A59F47B9E9DBA7BFC3",
|
||||
"E4792F2B9DB30CB8D1596077A13FB3B5",
|
||||
"2733C889D289550FE00EAA5A47A34CEF0C1AF187610EB07BA35D2C09BB73C80B244EB4147700D1BF",
|
||||
"",
|
||||
0x26);
|
||||
sk_APP_arr.emplace_back(0x0003005500000000, 0x000C, KEY_APP,
|
||||
"9814EFFF67B7074D1B263BF85BDC8576CE9DEC914123971B169472A1BC2387FA",
|
||||
"D43B1FA8BE15714B3078C23908BB2BCA",
|
||||
"7D1986C6BEE6CE1E0C5893BD2DF203881F40D5056761CC3F1F2E9D9A378617A2DE40BA5F09844CEB",
|
||||
"",
|
||||
0x3D);
|
||||
sk_APP_arr.emplace_back(0x0003005600000000, 0x000D, KEY_APP,
|
||||
"03B4C421E0C0DE708C0F0B71C24E3EE04306AE7383D8C5621394CCB99FF7A194",
|
||||
"5ADB9EAFE897B54CB1060D6885BE22CF",
|
||||
"71502ADB5783583AB88B2D5F23F419AF01C8B1E72FCA1E694AD49FE3266F1F9C61EFC6F29B351142",
|
||||
"",
|
||||
0x12);
|
||||
sk_APP_arr.emplace_back(0x0003005600000000, 0x000E, KEY_APP,
|
||||
"39A870173C226EB8A3EEE9CA6FB675E82039B2D0CCB22653BFCE4DB013BAEA03",
|
||||
"90266C98CBAA06C1BF145FF760EA1B45",
|
||||
"84DE5692809848E5ACBE25BE548F6981E3DB14735A5DDE1A0FD1F475866532B862B1AB6A004B7255",
|
||||
"",
|
||||
0x27);
|
||||
sk_APP_arr.emplace_back(0x0003005600000000, 0x000F, KEY_APP,
|
||||
"FD52DFA7C6EEF5679628D12E267AA863B9365E6DB95470949CFD235B3FCA0F3B",
|
||||
"64F50296CF8CF49CD7C643572887DA0B",
|
||||
"0696D6CCBD7CF585EF5E00D547503C185D7421581BAD196E081723CD0A97FA40B2C0CD2492B0B5A1",
|
||||
"",
|
||||
0x3A);
|
||||
sk_APP_arr.emplace_back(0x0003006100000000, 0x0010, KEY_APP,
|
||||
"A5E51AD8F32FFBDE808972ACEE46397F2D3FE6BC823C8218EF875EE3A9B0584F",
|
||||
"7A203D5112F799979DF0E1B8B5B52AA4",
|
||||
"50597B7F680DD89F6594D9BDC0CBEE03666AB53647D0487F7F452FE2DD02694631EA755548C9E934",
|
||||
"",
|
||||
0x25);
|
||||
sk_APP_arr.emplace_back(0x0003006100000000, 0x0011, KEY_APP,
|
||||
"0F8EAB8884A51D092D7250597388E3B8B75444AC138B9D36E5C7C5B8C3DF18FD",
|
||||
"97AF39C383E7EF1C98FA447C597EA8FE",
|
||||
"2FDA7A56AAEA65921C0284FF1942C6DE137370093D106034B59191951A5201B422D462F8726F852D",
|
||||
"",
|
||||
0x26);
|
||||
sk_APP_arr.emplace_back(0x0003006600000000, 0x0013, KEY_APP,
|
||||
"DBF62D76FC81C8AC92372A9D631DDC9219F152C59C4B20BFF8F96B64AB065E94",
|
||||
"CB5DD4BE8CF115FFB25801BC6086E729",
|
||||
"B26FE6D3E3A1E766FAE79A8E6A7F48998E7FC1E4B0AD8745FF54C018C2A6CC7A0DD7525FAFEA4917",
|
||||
"",
|
||||
0x12);
|
||||
sk_APP_arr.emplace_back(0x0003006600000000, 0x0014, KEY_APP,
|
||||
"491B0D72BB21ED115950379F4564CE784A4BFAABB00E8CB71294B192B7B9F88E",
|
||||
"F98843588FED8B0E62D7DDCB6F0CECF4",
|
||||
"04275E8838EF95BD013B223C3DF674540932F21B534C7ED2944B9104D938FEB03B824DDB866AB26E",
|
||||
"",
|
||||
0x27);
|
||||
sk_APP_arr.emplace_back(0x0003007400000000, 0x0016, KEY_APP,
|
||||
"A106692224F1E91E1C4EBAD4A25FBFF66B4B13E88D878E8CD072F23CD1C5BF7C",
|
||||
"62773C70BD749269C0AFD1F12E73909E",
|
||||
"566635D3E1DCEC47243AAD1628AE6B2CEB33463FC155E4635846CE33899C5E353DDFA47FEF5694AF",
|
||||
"",
|
||||
0x30);
|
||||
sk_APP_arr.emplace_back(0x0003007400000000, 0x0017, KEY_APP,
|
||||
"4E104DCE09BA878C75DA98D0B1636F0E5F058328D81419E2A3D22AB0256FDF46",
|
||||
"954A86C4629E116532304A740862EF85",
|
||||
"3B7B04C71CAE2B1199D57453C038BB1B541A05AD1B94167B0AB47A9B24CAECB9000CB21407009666",
|
||||
"",
|
||||
0x08);
|
||||
sk_APP_arr.emplace_back(0x0003007400000000, 0x0018, KEY_APP,
|
||||
"1F876AB252DDBCB70E74DC4A20CD8ED51E330E62490E652F862877E8D8D0F997",
|
||||
"BF8D6B1887FA88E6D85C2EDB2FBEC147",
|
||||
"64A04126D77BF6B4D686F6E8F87DD150A5B014BA922D2B694FFF4453E11239A6E0B58F1703C51494",
|
||||
"",
|
||||
0x11);
|
||||
sk_APP_arr.emplace_back(0x0004001100000000, 0x0019, KEY_APP,
|
||||
"3236B9937174DF1DC12EC2DD8A318A0EA4D3ECDEA5DFB4AC1B8278447000C297",
|
||||
"6153DEE781B8ADDC6A439498B816DC46",
|
||||
"148DCA961E2738BAF84B2D1B6E2DA2ABD6A95F2C9571E54C6922F9ED9674F062B7F1BE5BD6FA5268",
|
||||
"",
|
||||
0x31);
|
||||
sk_APP_arr.emplace_back(0x0004001100000000, 0x001A, KEY_APP,
|
||||
"5EFD1E9961462794E3B9EF2A4D0C1F46F642AAE053B5025504130590E66F19C9",
|
||||
"1AC8FA3B3C90F8FDE639515F91B58327",
|
||||
"BE4B1B513536960618BFEF12A713F6673881B02F9DC616191E823FC8337CCF99ADAA6172019C0C23",
|
||||
"",
|
||||
0x17);
|
||||
sk_APP_arr.emplace_back(0x0004001100000000, 0x001B, KEY_APP,
|
||||
"66637570D1DEC098467DB207BAEA786861964D0964D4DBAF89E76F46955D181B",
|
||||
"9F7B5713A5ED59F6B35CD8F8A165D4B8",
|
||||
"4AB6FB1F6F0C3D9219923C1AC683137AB05DF667833CC6A5E8F590E4E28FE2EB180C7D5861117CFB",
|
||||
"",
|
||||
0x12);
|
||||
sk_APP_arr.emplace_back(0x0004004600000000, 0x001C, KEY_APP,
|
||||
"CFF025375BA0079226BE01F4A31F346D79F62CFB643CA910E16CF60BD9092752",
|
||||
"FD40664E2EBBA01BF359B0DCDF543DA4",
|
||||
"36C1ACE6DD5CCC0006FDF3424750FAC515FC5CFA2C93EC53C6EC2BC421708D154E91F2E7EA54A893",
|
||||
"",
|
||||
0x09);
|
||||
sk_APP_arr.emplace_back(0x0004004600000000, 0x001D, KEY_APP,
|
||||
"D202174EB65A62048F3674B59EF6FE72E1872962F3E1CD658DE8D7AF71DA1F3E",
|
||||
"ACB9945914EBB7B9A31ECE320AE09F2D",
|
||||
"430322887503CF52928FAAA410FD623C7321281C8825D95F5B47EF078EFCFC44454C3AB4F00BB879",
|
||||
"",
|
||||
0x1A);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfNPDRMKeys()
|
||||
{
|
||||
sk_NPDRM_arr.clear();
|
||||
sk_NPDRM_arr.emplace_back(0x0001000000000000, 0x0001, KEY_NPDRM,
|
||||
"F9EDD0301F770FABBA8863D9897F0FEA6551B09431F61312654E28F43533EA6B",
|
||||
"A551CCB4A42C37A734A2B4F9657D5540",
|
||||
"B05F9DA5F9121EE4031467E74C505C29A8E29D1022379EDFF0500B9AE480B5DAB4578A4C61C5D6BF",
|
||||
"00040AB47509BED04BD96521AD1B365B86BF620A98",
|
||||
0x11);
|
||||
sk_NPDRM_arr.emplace_back(0x0001000000000000, 0x0002, KEY_NPDRM,
|
||||
"8E737230C80E66AD0162EDDD32F1F774EE5E4E187449F19079437A508FCF9C86",
|
||||
"7AAECC60AD12AED90C348D8C11D2BED5",
|
||||
"05BF09CB6FD78050C78DE69CC316FF27C9F1ED66A45BFCE0A1E5A6749B19BD546BBB4602CF373440",
|
||||
"",
|
||||
0x0A);
|
||||
sk_NPDRM_arr.emplace_back(0x0003003000000000, 0x0003, KEY_NPDRM,
|
||||
"1B715B0C3E8DC4C1A5772EBA9C5D34F7CCFE5B82025D453F3167566497239664",
|
||||
"E31E206FBB8AEA27FAB0D9A2FFB6B62F",
|
||||
"3F51E59FC74D6618D34431FA67987FA11ABBFACC7111811473CD9988FE91C43FC74605E7B8CB732D",
|
||||
"",
|
||||
0x08);
|
||||
sk_NPDRM_arr.emplace_back(0x0003004200000000, 0x0004, KEY_NPDRM,
|
||||
"BB4DBF66B744A33934172D9F8379A7A5EA74CB0F559BB95D0E7AECE91702B706",
|
||||
"ADF7B207A15AC601110E61DDFC210AF6",
|
||||
"9C327471BAFF1F877AE4FE29F4501AF5AD6A2C459F8622697F583EFCA2CA30ABB5CD45D1131CAB30",
|
||||
"00B61A91DF4AB6A9F142C326BA9592B5265DA88856",
|
||||
0x16);
|
||||
sk_NPDRM_arr.emplace_back(0x0003004200000000, 0x0006, KEY_NPDRM,
|
||||
"8B4C52849765D2B5FA3D5628AFB17644D52B9FFEE235B4C0DB72A62867EAA020",
|
||||
"05719DF1B1D0306C03910ADDCE4AF887",
|
||||
"2A5D6C6908CA98FC4740D834C6400E6D6AD74CF0A712CF1E7DAE806E98605CC308F6A03658F2970E",
|
||||
"",
|
||||
0x29);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005000000000, 0x0007, KEY_NPDRM,
|
||||
"3946DFAA141718C7BE339A0D6C26301C76B568AEBC5CD52652F2E2E0297437C3",
|
||||
"E4897BE553AE025CDCBF2B15D1C9234E",
|
||||
"A13AFE8B63F897DA2D3DC3987B39389DC10BAD99DFB703838C4A0BC4E8BB44659C726CFD0CE60D0E",
|
||||
"009EF86907782A318D4CC3617EBACE2480E73A46F6",
|
||||
0x17);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005000000000, 0x0009, KEY_NPDRM,
|
||||
"0786F4B0CA5937F515BDCE188F569B2EF3109A4DA0780A7AA07BD89C3350810A",
|
||||
"04AD3C2F122A3B35E804850CAD142C6D",
|
||||
"A1FE61035DBBEA5A94D120D03C000D3B2F084B9F4AFA99A2D4A588DF92B8F36327CE9E47889A45D0",
|
||||
"",
|
||||
0x2A);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005500000000, 0x000A, KEY_NPDRM,
|
||||
"03C21AD78FBB6A3D425E9AAB1298F9FD70E29FD4E6E3A3C151205DA50C413DE4",
|
||||
"0A99D4D4F8301A88052D714AD2FB565E",
|
||||
"3995C390C9F7FBBAB124A1C14E70F9741A5E6BDF17A605D88239652C8EA7D5FC9F24B30546C1E44B",
|
||||
"009AC6B22A056BA9E0B6D1520F28A57A3135483F9F",
|
||||
0x27);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005500000000, 0x000C, KEY_NPDRM,
|
||||
"357EBBEA265FAEC271182D571C6CD2F62CFA04D325588F213DB6B2E0ED166D92",
|
||||
"D26E6DD2B74CD78E866E742E5571B84F",
|
||||
"00DCF5391618604AB42C8CFF3DC304DF45341EBA4551293E9E2B68FFE2DF527FFA3BE8329E015E57",
|
||||
"",
|
||||
0x3A);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005600000000, 0x000D, KEY_NPDRM,
|
||||
"337A51416105B56E40D7CAF1B954CDAF4E7645F28379904F35F27E81CA7B6957",
|
||||
"8405C88E042280DBD794EC7E22B74002",
|
||||
"9BFF1CC7118D2393DE50D5CF44909860683411A532767BFDAC78622DB9E5456753FE422CBAFA1DA1",
|
||||
"",
|
||||
0x18);
|
||||
sk_NPDRM_arr.emplace_back(0x0003005600000000, 0x000F, KEY_NPDRM,
|
||||
"135C098CBE6A3E037EBE9F2BB9B30218DDE8D68217346F9AD33203352FBB3291",
|
||||
"4070C898C2EAAD1634A288AA547A35A8",
|
||||
"BBD7CCCB556C2EF0F908DC7810FAFC37F2E56B3DAA5F7FAF53A4944AA9B841F76AB091E16B231433",
|
||||
"",
|
||||
0x3B);
|
||||
sk_NPDRM_arr.emplace_back(0x0003006100000000, 0x0010, KEY_NPDRM,
|
||||
"4B3CD10F6A6AA7D99F9B3A660C35ADE08EF01C2C336B9E46D1BB5678B4261A61",
|
||||
"C0F2AB86E6E0457552DB50D7219371C5",
|
||||
"64A5C60BC2AD18B8A237E4AA690647E12BF7A081523FAD4F29BE89ACAC72F7AB43C74EC9AFFDA213",
|
||||
"",
|
||||
0x27);
|
||||
sk_NPDRM_arr.emplace_back(0x0003006600000000, 0x0013, KEY_NPDRM,
|
||||
"265C93CF48562EC5D18773BEB7689B8AD10C5EB6D21421455DEBC4FB128CBF46",
|
||||
"8DEA5FF959682A9B98B688CEA1EF4A1D",
|
||||
"9D8DB5A880608DC69717991AFC3AD5C0215A5EE413328C2ABC8F35589E04432373DB2E2339EEF7C8",
|
||||
"",
|
||||
0x18);
|
||||
sk_NPDRM_arr.emplace_back(0x0003007400000000, 0x0016, KEY_NPDRM,
|
||||
"7910340483E419E55F0D33E4EA5410EEEC3AF47814667ECA2AA9D75602B14D4B",
|
||||
"4AD981431B98DFD39B6388EDAD742A8E",
|
||||
"62DFE488E410B1B6B2F559E4CB932BCB78845AB623CC59FDF65168400FD76FA82ED1DC60E091D1D1",
|
||||
"",
|
||||
0x25);
|
||||
sk_NPDRM_arr.emplace_back(0x0004001100000000, 0x0019, KEY_NPDRM,
|
||||
"FBDA75963FE690CFF35B7AA7B408CF631744EDEF5F7931A04D58FD6A921FFDB3",
|
||||
"F72C1D80FFDA2E3BF085F4133E6D2805",
|
||||
"637EAD34E7B85C723C627E68ABDD0419914EBED4008311731DD87FDDA2DAF71F856A70E14DA17B42",
|
||||
"",
|
||||
0x24);
|
||||
sk_NPDRM_arr.emplace_back(0x0004004600000000, 0x001C, KEY_NPDRM,
|
||||
"8103EA9DB790578219C4CEDF0592B43064A7D98B601B6C7BC45108C4047AA80F",
|
||||
"246F4B8328BE6A2D394EDE20479247C5",
|
||||
"503172C9551308A87621ECEE90362D14889BFED2CF32B0B3E32A4F9FE527A41464B735E1ADBC6762",
|
||||
"",
|
||||
0x30);
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfUNK7Keys()
|
||||
{
|
||||
sk_UNK7_arr.clear();
|
||||
sk_UNK7_arr.emplace_back(0x0003003000000000, 0x0000, KEY_UNK7,
|
||||
"D91166973979EA8694476B011AC62C7E9F37DA26DE1E5C2EE3D66E42B8517085",
|
||||
"DC01280A6E46BC674B81A7E8801EBE6E",
|
||||
"A0FC44108236141BF3517A662B027AFC1AC513A05690496C754DEB7D43BDC41B80FD75C212624EE4",
|
||||
"",
|
||||
0x11);
|
||||
sk_UNK7_arr.emplace_back(0x0003004200000000, 0x0000, KEY_UNK7,
|
||||
"B73111B0B00117E48DE5E2EE5E534C0F0EFFA4890BBB8CAD01EE0F848F91583E",
|
||||
"86F56F9E5DE513894874B8BA253334B1",
|
||||
"B0BA1A1AB9723BB4E87CED9637BE056066BC56E16572D43D0210A06411DBF8FEB8885CD912384AE5",
|
||||
"",
|
||||
0x12);
|
||||
sk_UNK7_arr.emplace_back(0x0003005000000000, 0x0000, KEY_UNK7,
|
||||
"8E944267C02E69A4FE474B7F5FCD7974A4F936FF4355AEC4F80EFA123858D8F6",
|
||||
"908A75754E521EAC2F5A4889C6D7B72D",
|
||||
"91201DA7D79E8EE2563142ECBD646DA026C963AC09E760E5390FFE24DAE6864310ABE147F8204D0B",
|
||||
"",
|
||||
0x13);
|
||||
sk_UNK7_arr.emplace_back(0x0003005500000000, 0x0000, KEY_UNK7,
|
||||
"BB31DF9A6F62C0DF853075FAA65134D9CE2240306C1731D1F7DA9B5329BD699F",
|
||||
"263057225873F83940A65C8C926AC3E4",
|
||||
"BC3A82A4F44C43A197070CD236FDC94FCC542D69A3E803E0AFF78D1F3DA19A79D2F61FAB5B94B437",
|
||||
"",
|
||||
0x23);
|
||||
sk_UNK7_arr.emplace_back(0x0003005600000000, 0x0000, KEY_UNK7,
|
||||
"71AA75C70A255580E4AE9BDAA0B08828C53EAA713CD0713797F143B284C1589B",
|
||||
"9DED878CB6BA07121C0F50E7B172A8BF",
|
||||
"387FCDAEAFF1B59CFAF79CE6215A065ACEAFFAF4048A4F217E1FF5CE67C66EC3F089DB235E52F9D3",
|
||||
"",
|
||||
0x29);
|
||||
sk_UNK7_arr.emplace_back(0x0003006100000000, 0x0000, KEY_UNK7,
|
||||
"F5D1DBC182F5083CD4EA37C431C7DAC73882C07F232D2699B1DD9FDDF1BF4195",
|
||||
"D3A7C3C91CBA014FCBCA6D5570DE13FF",
|
||||
"97CA8A9781F45E557E98F176EF794FCDA6B151EB3DFD1ABA12151E00AE59957C3B15628FC8875D28",
|
||||
"",
|
||||
0x23);
|
||||
sk_UNK7_arr.emplace_back(0x0003006600000000, 0x0000, KEY_UNK7,
|
||||
"BF10F09590C0152F7EF749FF4B990122A4E8E5491DA49A2D931E72EEB990F860",
|
||||
"22C19C5522F7A782AFC547C2640F5BDE",
|
||||
"3233BA2B284189FB1687DF653002257A0925D8EB0C64EBBE8CC7DE87F548D107DE1FD3D1D285DB4F",
|
||||
"",
|
||||
0x29);
|
||||
sk_UNK7_arr.emplace_back(0x0003007400000000, 0x0000, KEY_UNK7,
|
||||
"F11DBD2C97B32AD37E55F8E743BC821D3E67630A6784D9A058DDD26313482F0F",
|
||||
"FC5FA12CA3D2D336C4B8B425D679DA55",
|
||||
"19E27EE90E33EDAB16B22E688B5F704E5C6EC1062070EBF43554CD03DFDAE16D684BB8B5574DBECA",
|
||||
"",
|
||||
0x15);
|
||||
sk_UNK7_arr.emplace_back(0x0004001100000000, 0x0000, KEY_UNK7,
|
||||
"751EE949CD3ADF50A469197494A1EC358409CCBE6E85217EBDE7A87D3FF1ABD8",
|
||||
"23AE4ADA4D3F798DC5ED98000337FF77",
|
||||
"1BABA87CD1AD705C462D4E7427B6DAF59A50383A348A15088F0EDFCF1ADF2B5C2B2D507B2A357D36",
|
||||
"",
|
||||
0x1A);
|
||||
sk_UNK7_arr.emplace_back(0x0004004600000000, 0x0000, KEY_UNK7,
|
||||
"46BD0891224E0CE13E2162921D4BB76193AEEE4416A729FCDD111C5536BF87C9",
|
||||
"BF036387CDB613C0AC88A6D9D2CC5316",
|
||||
"A14F6D5F9AD7EBB3B7A39A7C32F13E5DC3B0BA16BDC33D39FDDF88F4AEEA6CFEEB0C0796C917A952",
|
||||
"",
|
||||
0x0F);
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV0Key()
|
||||
{
|
||||
return sk_LV0_arr[0];
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLDRKey()
|
||||
{
|
||||
return sk_LDR_arr[0];
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV1Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_LV1_arr.size(); i++)
|
||||
{
|
||||
if (sk_LV1_arr[i].version == version)
|
||||
{
|
||||
key = sk_LV1_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV2Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_LV2_arr.size(); i++)
|
||||
{
|
||||
if (sk_LV2_arr[i].version == version)
|
||||
{
|
||||
key = sk_LV2_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfISOKey(u16 revision, u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_ISO_arr.size(); i++)
|
||||
{
|
||||
if ((sk_ISO_arr[i].version == version) &&
|
||||
(sk_ISO_arr[i].revision == revision))
|
||||
{
|
||||
key = sk_ISO_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfAPPKey(u16 revision)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_APP_arr.size(); i++)
|
||||
{
|
||||
if (sk_APP_arr[i].revision == revision)
|
||||
{
|
||||
key = sk_APP_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfUNK7Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_UNK7_arr.size(); i++)
|
||||
{
|
||||
if (sk_UNK7_arr[i].version == version)
|
||||
{
|
||||
key = sk_UNK7_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfNPDRMKey(u16 revision)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(unsigned int i = 0; i < sk_NPDRM_arr.size(); i++)
|
||||
{
|
||||
if (sk_NPDRM_arr[i].revision == revision)
|
||||
{
|
||||
key = sk_NPDRM_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::FindSelfKey(u32 type, u16 revision, u64 version)
|
||||
{
|
||||
// Empty key.
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
// Check SELF type.
|
||||
switch (type)
|
||||
{
|
||||
case KEY_LV0:
|
||||
LoadSelfLV0Keys();
|
||||
key = GetSelfLV0Key();
|
||||
break;
|
||||
case KEY_LV1:
|
||||
LoadSelfLV1Keys();
|
||||
key = GetSelfLV1Key(version);
|
||||
break;
|
||||
case KEY_LV2:
|
||||
LoadSelfLV2Keys();
|
||||
key = GetSelfLV2Key(version);
|
||||
break;
|
||||
case KEY_APP:
|
||||
LoadSelfAPPKeys();
|
||||
key = GetSelfAPPKey(revision);
|
||||
break;
|
||||
case KEY_ISO:
|
||||
LoadSelfISOKeys();
|
||||
key = GetSelfISOKey(revision, version);
|
||||
break;
|
||||
case KEY_LDR:
|
||||
LoadSelfLDRKeys();
|
||||
key = GetSelfLDRKey();
|
||||
break;
|
||||
case KEY_UNK7:
|
||||
LoadSelfUNK7Keys();
|
||||
key = GetSelfUNK7Key(version);
|
||||
break;
|
||||
case KEY_NPDRM:
|
||||
LoadSelfNPDRMKeys();
|
||||
key = GetSelfNPDRMKey(revision);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
void KeyVault::SetKlicenseeKey(u8 *key)
|
||||
{
|
||||
memcpy(klicensee_key, key, 0x10);
|
||||
}
|
||||
|
||||
u8 *KeyVault::GetKlicenseeKey()
|
||||
{
|
||||
return klicensee_key;
|
||||
}
|
||||
|
||||
void rap_to_rif(unsigned char* rap, unsigned char* rif)
|
||||
{
|
||||
int i;
|
||||
int round;
|
||||
aes_context aes;
|
||||
|
||||
unsigned char key[0x10];
|
||||
unsigned char iv[0x10];
|
||||
memset(key, 0, 0x10);
|
||||
memset(iv, 0, 0x10);
|
||||
|
||||
// Initial decrypt.
|
||||
aes_setkey_dec(&aes, RAP_KEY, 128);
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, 0x10, iv, rap, key);
|
||||
|
||||
// rap2rifkey round.
|
||||
for (round = 0; round < 5; ++round) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
int p = RAP_PBOX[i];
|
||||
key[p] ^= RAP_E1[p];
|
||||
}
|
||||
for (i = 15; i >= 1; --i) {
|
||||
int p = RAP_PBOX[i];
|
||||
int pp = RAP_PBOX[i - 1];
|
||||
key[p] ^= key[pp];
|
||||
}
|
||||
int o = 0;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
int p = RAP_PBOX[i];
|
||||
unsigned char kc = key[p] - o;
|
||||
unsigned char ec2 = RAP_E2[p];
|
||||
if (o != 1 || kc != 0xFF) {
|
||||
o = kc < ec2 ? 1 : 0;
|
||||
key[p] = kc - ec2;
|
||||
} else if (kc == 0xFF) {
|
||||
key[p] = kc - ec2;
|
||||
} else {
|
||||
key[p] = kc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(rif, key, 0x10);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
|
||||
enum SELF_KEY_TYPE {
|
||||
KEY_LV0 = 1,
|
||||
KEY_LV1,
|
||||
KEY_LV2,
|
||||
KEY_APP,
|
||||
KEY_ISO,
|
||||
KEY_LDR,
|
||||
KEY_UNK7,
|
||||
KEY_NPDRM
|
||||
};
|
||||
|
||||
struct SELF_KEY {
|
||||
u64 version;
|
||||
u16 revision;
|
||||
u32 self_type;
|
||||
u8 erk[0x20];
|
||||
u8 riv[0x10];
|
||||
u8 pub[0x28];
|
||||
u8 priv[0x15];
|
||||
u32 curve_type;
|
||||
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
{
|
||||
version = ver;
|
||||
revision = rev;
|
||||
self_type = type;
|
||||
hex_to_bytes(erk, e.c_str());
|
||||
hex_to_bytes(riv, r.c_str());
|
||||
hex_to_bytes(pub, pb.c_str());
|
||||
hex_to_bytes(priv, pr.c_str());
|
||||
curve_type = ct;
|
||||
}
|
||||
};
|
||||
|
||||
static u8 PKG_AES_KEY[0x10] = {
|
||||
0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8
|
||||
};
|
||||
|
||||
static u8 NP_IDPS[0x10] = {
|
||||
0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
static u8 NP_KLIC_FREE[0x10] = {
|
||||
0x72, 0xF9, 0x90, 0x78, 0x8F, 0x9C, 0xFF, 0x74, 0x57, 0x25, 0xF0, 0x8E, 0x4C, 0x12, 0x83, 0x87
|
||||
};
|
||||
|
||||
static u8 NP_OMAC_KEY_2[0x10] = {
|
||||
0x6B, 0xA5, 0x29, 0x76, 0xEF, 0xDA, 0x16, 0xEF, 0x3C, 0x33, 0x9F, 0xB2, 0x97, 0x1E, 0x25, 0x6B
|
||||
};
|
||||
|
||||
static u8 NP_OMAC_KEY_3[0x10] = {
|
||||
0x9B, 0x51, 0x5F, 0xEA, 0xCF, 0x75, 0x06, 0x49, 0x81, 0xAA, 0x60, 0x4D, 0x91, 0xA5, 0x4E, 0x97
|
||||
};
|
||||
|
||||
static u8 NP_KLIC_KEY[0x10] = {
|
||||
0xF2, 0xFB, 0xCA, 0x7A, 0x75, 0xB0, 0x4E, 0xDC, 0x13, 0x90, 0x63, 0x8C, 0xCD, 0xFD, 0xD1, 0xEE
|
||||
};
|
||||
|
||||
static u8 NP_RIF_KEY[0x10] = {
|
||||
0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53, 0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B
|
||||
};
|
||||
|
||||
static u8 NP_PSP_KEY_1[0x10] = {
|
||||
0x2A, 0x6A, 0xFB, 0xCF, 0x43, 0xD1, 0x57, 0x9F, 0x7D, 0x73, 0x87, 0x41, 0xA1, 0x3B, 0xD4, 0x2E
|
||||
};
|
||||
|
||||
static u8 NP_PSP_KEY_2[0x10] = {
|
||||
0x0D, 0xB8, 0x57, 0x32, 0x36, 0x6C, 0xD7, 0x34, 0xFC, 0x87, 0x9E, 0x74, 0x33, 0x43, 0xBB, 0x4F
|
||||
};
|
||||
|
||||
static u8 NP_PSX_KEY[0x10] = {
|
||||
0x52, 0xC0, 0xB5, 0xCA, 0x76, 0xD6, 0x13, 0x4B, 0xB4, 0x5F, 0xC6, 0x6C, 0xA6, 0x37, 0xF2, 0xC1
|
||||
};
|
||||
|
||||
static u8 RAP_KEY[0x10] = {
|
||||
0x86, 0x9F, 0x77, 0x45, 0xC1, 0x3F, 0xD8, 0x90, 0xCC, 0xF2, 0x91, 0x88, 0xE3, 0xCC, 0x3E, 0xDF
|
||||
};
|
||||
|
||||
static u8 RAP_PBOX[0x10] = {
|
||||
0x0C, 0x03, 0x06, 0x04, 0x01, 0x0B, 0x0F, 0x08, 0x02, 0x07, 0x00, 0x05, 0x0A, 0x0E, 0x0D, 0x09
|
||||
};
|
||||
|
||||
static u8 RAP_E1[0x10] = {
|
||||
0xA9, 0x3E, 0x1F, 0xD6, 0x7C, 0x55, 0xA3, 0x29, 0xB7, 0x5F, 0xDD, 0xA6, 0x2A, 0x95, 0xC7, 0xA5
|
||||
};
|
||||
|
||||
static u8 RAP_E2[0x10] = {
|
||||
0x67, 0xD4, 0x5D, 0xA3, 0x29, 0x6D, 0x00, 0x6A, 0x4E, 0x7C, 0x53, 0x7B, 0xF5, 0x53, 0x8C, 0x74
|
||||
};
|
||||
|
||||
static u8 SDAT_KEY[0x10] = {
|
||||
0x0D, 0x65, 0x5E, 0xF8, 0xE6, 0x74, 0xA9, 0x8A, 0xB8, 0x50, 0x5C, 0xFA, 0x7D, 0x01, 0x29, 0x33
|
||||
};
|
||||
|
||||
static u8 EDAT_KEY_0[0x10] = {
|
||||
0xBE, 0x95, 0x9C, 0xA8, 0x30, 0x8D, 0xEF, 0xA2, 0xE5, 0xE1, 0x80, 0xC6, 0x37, 0x12, 0xA9, 0xAE
|
||||
};
|
||||
|
||||
static u8 EDAT_HASH_0[0x10] = {
|
||||
0xEF, 0xFE, 0x5B, 0xD1, 0x65, 0x2E, 0xEB, 0xC1, 0x19, 0x18, 0xCF, 0x7C, 0x04, 0xD4, 0xF0, 0x11
|
||||
};
|
||||
|
||||
static u8 EDAT_KEY_1[0x10] = {
|
||||
0x4C, 0xA9, 0xC1, 0x4B, 0x01, 0xC9, 0x53, 0x09, 0x96, 0x9B, 0xEC, 0x68, 0xAA, 0x0B, 0xC0, 0x81
|
||||
};
|
||||
|
||||
static u8 EDAT_HASH_1[0x10] = {
|
||||
0x3D, 0x92, 0x69, 0x9B, 0x70, 0x5B, 0x07, 0x38, 0x54, 0xD8, 0xFC, 0xC6, 0xC7, 0x67, 0x27, 0x47
|
||||
};
|
||||
|
||||
static u8 EDAT_IV[0x10] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
class KeyVault
|
||||
{
|
||||
std::vector<SELF_KEY> sk_LV0_arr;
|
||||
std::vector<SELF_KEY> sk_LV1_arr;
|
||||
std::vector<SELF_KEY> sk_LV2_arr;
|
||||
std::vector<SELF_KEY> sk_APP_arr;
|
||||
std::vector<SELF_KEY> sk_ISO_arr;
|
||||
std::vector<SELF_KEY> sk_LDR_arr;
|
||||
std::vector<SELF_KEY> sk_UNK7_arr;
|
||||
std::vector<SELF_KEY> sk_NPDRM_arr;
|
||||
u8 klicensee_key[0x10];
|
||||
|
||||
public:
|
||||
KeyVault();
|
||||
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
|
||||
void SetKlicenseeKey(u8 *key);
|
||||
u8 *GetKlicenseeKey();
|
||||
|
||||
private:
|
||||
void LoadSelfLV0Keys();
|
||||
void LoadSelfLDRKeys();
|
||||
void LoadSelfLV1Keys();
|
||||
void LoadSelfLV2Keys();
|
||||
void LoadSelfISOKeys();
|
||||
void LoadSelfAPPKeys();
|
||||
void LoadSelfUNK7Keys();
|
||||
void LoadSelfNPDRMKeys();
|
||||
SELF_KEY GetSelfLV0Key();
|
||||
SELF_KEY GetSelfLDRKey();
|
||||
SELF_KEY GetSelfLV1Key(u64 version);
|
||||
SELF_KEY GetSelfLV2Key(u64 version);
|
||||
SELF_KEY GetSelfISOKey(u16 revision, u64 version);
|
||||
SELF_KEY GetSelfAPPKey(u16 revision);
|
||||
SELF_KEY GetSelfUNK7Key(u64 version);
|
||||
SELF_KEY GetSelfNPDRMKey(u16 revision);
|
||||
};
|
||||
|
||||
// RAP to RIF function.
|
||||
void rap_to_rif(unsigned char* rap, unsigned char* rif);
|
||||
@@ -0,0 +1,274 @@
|
||||
// Copyright (C) 2014 Hykem <hykem@hotmail.com>
|
||||
// Licensed under the terms of the GNU GPL, version 3
|
||||
// http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
#include "lz.h"
|
||||
|
||||
int decode_range(unsigned int *range, unsigned int *code, unsigned char **src)
|
||||
{
|
||||
if (!((*range) >> 24))
|
||||
{
|
||||
(*range) <<= 8;
|
||||
*code = ((*code) << 8) + (*src)++[5];
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c)
|
||||
{
|
||||
unsigned int val = *range;
|
||||
|
||||
if (decode_range(range, code, src))
|
||||
val *= (*c);
|
||||
else
|
||||
val = (val >> 8) * (*c);
|
||||
|
||||
*c -= ((*c) >> 3);
|
||||
if (index) (*index) <<= 1;
|
||||
|
||||
if (*code < val)
|
||||
{
|
||||
*range = val;
|
||||
*c += 31;
|
||||
if (index) (*index)++;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*code -= val;
|
||||
*range -= val;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if (index >= 3)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978
|
||||
if (index >= 4)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978
|
||||
if (index >= 5)
|
||||
{
|
||||
decode_range(range, code, src);
|
||||
for (; index >= 5; index--)
|
||||
{
|
||||
i <<= 1;
|
||||
(*range) >>= 1;
|
||||
if (*code < *range)
|
||||
i++;
|
||||
else
|
||||
(*code) -= *range;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*bit_flag = decode_bit(range, code, &i, src, ptr); // Offset 0x960
|
||||
|
||||
if (index >= 1)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 0x8); // Offset 0x968
|
||||
if (index >= 2)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 0x10); // Offset 0x970
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src)
|
||||
{
|
||||
int i = 1;
|
||||
index /= 8;
|
||||
|
||||
if (index >= 3)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr); // Offset 0x8A8
|
||||
if (index >= 4)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr); // Offset 0x8A8
|
||||
if (index >= 5)
|
||||
{
|
||||
decode_range(range, code, src);
|
||||
for (; index >= 5; index--)
|
||||
{
|
||||
i <<= 1;
|
||||
(*range) >>= 1;
|
||||
if (*code < *range)
|
||||
i++;
|
||||
else
|
||||
(*code) -= *range;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*bit_flag = decode_bit(range, code, &i, src, ptr + 3); // Offset 0x8A8 + 3
|
||||
|
||||
if (index >= 1)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 2); // Offset 0x8A8 + 2
|
||||
if (index >= 2)
|
||||
{
|
||||
decode_bit(range, code, &i, src, ptr + 1); // Offset 0x8A8 + 1
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
||||
{
|
||||
int result;
|
||||
|
||||
unsigned char *tmp = new unsigned char[0xA70];
|
||||
|
||||
int offset = 0;
|
||||
int bit_flag = 0;
|
||||
int data_length = 0;
|
||||
int data_offset = 0;
|
||||
|
||||
unsigned char *tmp_sect1, *tmp_sect2, *tmp_sect3;
|
||||
unsigned char *buf_start, *buf_end;
|
||||
unsigned char prev = 0;
|
||||
|
||||
unsigned char *start = out;
|
||||
unsigned char *end = (out + size);
|
||||
unsigned char head = in[0];
|
||||
|
||||
unsigned int range = 0xFFFFFFFF;
|
||||
unsigned int code = (in[1] << 24) | (in[2] << 16) | (in[3] << 8) | in[4];
|
||||
|
||||
if (head < 0) // Check if we have a valid starting byte.
|
||||
{
|
||||
// The dictionary header is invalid, the data is not compressed.
|
||||
result = -1;
|
||||
if (code <= size)
|
||||
{
|
||||
memcpy(out, (const void *)(in + 5), code);
|
||||
result = (start - out);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set up a temporary buffer (sliding window).
|
||||
memset(tmp, 0x80, 0xA60);
|
||||
while (1)
|
||||
{
|
||||
// Start reading at 0x920.
|
||||
tmp_sect1 = tmp + offset + 0x920;
|
||||
if (!decode_bit(&range, &code, 0, &in, tmp_sect1)) // Raw char.
|
||||
{
|
||||
// Adjust offset and check for stream end.
|
||||
if (offset > 0) offset--;
|
||||
if (start == end) return (start - out);
|
||||
|
||||
// Locate first section.
|
||||
int sect = (((((((int)(start - out)) & 7) << 8) + prev) >> head) & 7) * 0xFF - 1;
|
||||
tmp_sect1 = tmp + sect;
|
||||
int index = 1;
|
||||
|
||||
// Read, decode and write back.
|
||||
do
|
||||
{
|
||||
decode_bit(&range, &code, &index, &in, tmp_sect1 + index);
|
||||
} while ((index >> 8) == 0);
|
||||
|
||||
// Save index.
|
||||
*start++ = index;
|
||||
}
|
||||
else // Compressed char stream.
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
// Identify the data length bit field.
|
||||
do {
|
||||
tmp_sect1 += 8;
|
||||
bit_flag = decode_bit(&range, &code, 0, &in, tmp_sect1);
|
||||
index += bit_flag;
|
||||
} while ((bit_flag != 0) && (index < 6));
|
||||
|
||||
// Default block size is 0x40.
|
||||
int b_size = 0x40;
|
||||
tmp_sect2 = tmp + index + 0x7F1;
|
||||
|
||||
// If the data length was found, parse it as a number.
|
||||
if ((index >= 0) || (bit_flag != 0))
|
||||
{
|
||||
// Locate next section.
|
||||
int sect = (index << 5) | (((((start - out)) << index) & 3) << 3) | (offset & 7);
|
||||
tmp_sect1 = tmp + 0x960 + sect;
|
||||
|
||||
// Decode the data length (8 bit fields).
|
||||
data_length = decode_number(tmp_sect1, index, &bit_flag, &range, &code, &in);
|
||||
|
||||
// If we got valid parameters, seek to find data offset.
|
||||
if ((data_length != 3) && ((index > 0) || (bit_flag != 0))) {
|
||||
tmp_sect2 += 0x38;
|
||||
b_size = 0x80; // Block size is now 0x80.
|
||||
}
|
||||
} else {
|
||||
// Assume one byte of advance.
|
||||
data_length = 1;
|
||||
}
|
||||
|
||||
int diff = 0;
|
||||
int shift = 1;
|
||||
|
||||
// Identify the data offset bit field.
|
||||
do {
|
||||
diff = (shift << 4) - b_size;
|
||||
bit_flag = decode_bit(&range, &code, &shift, &in, tmp_sect2 + (shift << 3));
|
||||
} while (diff < 0);
|
||||
|
||||
// If the data offset was found, parse it as a number.
|
||||
if ((diff > 0) || (bit_flag != 0))
|
||||
{
|
||||
// Adjust diff if needed.
|
||||
if (bit_flag == 0) diff -= 8;
|
||||
|
||||
// Locate section.
|
||||
tmp_sect3 = tmp + 0x8A8 + diff;
|
||||
|
||||
// Decode the data offset (1 bit fields).
|
||||
data_offset = decode_word(tmp_sect3, diff, &bit_flag, &range, &code, &in);
|
||||
} else {
|
||||
// Assume one byte of advance.
|
||||
data_offset = 1;
|
||||
}
|
||||
|
||||
// Set buffer start/end.
|
||||
buf_start = start - data_offset;
|
||||
buf_end = start + data_length + 1;
|
||||
|
||||
// Underflow.
|
||||
if (buf_start < out)
|
||||
return -1;
|
||||
|
||||
// Overflow.
|
||||
if (buf_end > end)
|
||||
return -1;
|
||||
|
||||
// Update offset.
|
||||
offset = ((((int)(buf_end - out)) + 1) & 1) + 6;
|
||||
|
||||
// Copy data.
|
||||
do {
|
||||
*start++ = *buf_start++;
|
||||
} while (start < buf_end);
|
||||
|
||||
}
|
||||
prev = *(start - 1);
|
||||
}
|
||||
result = (start - out);
|
||||
}
|
||||
delete[] tmp;
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <string.h>
|
||||
|
||||
int decode_range(unsigned int *range, unsigned int *code, unsigned char **src);
|
||||
int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c);
|
||||
int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src);
|
||||
int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src);
|
||||
int decompress(unsigned char *out, unsigned char *in, unsigned int size);
|
||||
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* FIPS-180-1 compliant SHA-1 implementation
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* The SHA-1 standard was published by NIST in 1993.
|
||||
*
|
||||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "sha1.h"
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (big endian)
|
||||
*/
|
||||
#ifndef GET_UINT32_BE
|
||||
#define GET_UINT32_BE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
|
||||
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
|
||||
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
|
||||
| ( (uint32_t) (b)[(i) + 3] ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_UINT32_BE
|
||||
#define PUT_UINT32_BE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
||||
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SHA-1 context setup
|
||||
*/
|
||||
void sha1_starts( sha1_context *ctx )
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
ctx->state[4] = 0xC3D2E1F0;
|
||||
}
|
||||
|
||||
void sha1_process( sha1_context *ctx, const unsigned char data[64] )
|
||||
{
|
||||
uint32_t temp, W[16], A, B, C, D, E;
|
||||
|
||||
GET_UINT32_BE( W[ 0], data, 0 );
|
||||
GET_UINT32_BE( W[ 1], data, 4 );
|
||||
GET_UINT32_BE( W[ 2], data, 8 );
|
||||
GET_UINT32_BE( W[ 3], data, 12 );
|
||||
GET_UINT32_BE( W[ 4], data, 16 );
|
||||
GET_UINT32_BE( W[ 5], data, 20 );
|
||||
GET_UINT32_BE( W[ 6], data, 24 );
|
||||
GET_UINT32_BE( W[ 7], data, 28 );
|
||||
GET_UINT32_BE( W[ 8], data, 32 );
|
||||
GET_UINT32_BE( W[ 9], data, 36 );
|
||||
GET_UINT32_BE( W[10], data, 40 );
|
||||
GET_UINT32_BE( W[11], data, 44 );
|
||||
GET_UINT32_BE( W[12], data, 48 );
|
||||
GET_UINT32_BE( W[13], data, 52 );
|
||||
GET_UINT32_BE( W[14], data, 56 );
|
||||
GET_UINT32_BE( W[15], data, 60 );
|
||||
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define R(t) \
|
||||
( \
|
||||
temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \
|
||||
W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \
|
||||
( W[t & 0x0F] = S(temp,1) ) \
|
||||
)
|
||||
|
||||
#define P(a,b,c,d,e,x) \
|
||||
{ \
|
||||
e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
E = ctx->state[4];
|
||||
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define K 0x5A827999
|
||||
|
||||
P( A, B, C, D, E, W[0] );
|
||||
P( E, A, B, C, D, W[1] );
|
||||
P( D, E, A, B, C, W[2] );
|
||||
P( C, D, E, A, B, W[3] );
|
||||
P( B, C, D, E, A, W[4] );
|
||||
P( A, B, C, D, E, W[5] );
|
||||
P( E, A, B, C, D, W[6] );
|
||||
P( D, E, A, B, C, W[7] );
|
||||
P( C, D, E, A, B, W[8] );
|
||||
P( B, C, D, E, A, W[9] );
|
||||
P( A, B, C, D, E, W[10] );
|
||||
P( E, A, B, C, D, W[11] );
|
||||
P( D, E, A, B, C, W[12] );
|
||||
P( C, D, E, A, B, W[13] );
|
||||
P( B, C, D, E, A, W[14] );
|
||||
P( A, B, C, D, E, W[15] );
|
||||
P( E, A, B, C, D, R(16) );
|
||||
P( D, E, A, B, C, R(17) );
|
||||
P( C, D, E, A, B, R(18) );
|
||||
P( B, C, D, E, A, R(19) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
#define K 0x6ED9EBA1
|
||||
|
||||
P( A, B, C, D, E, R(20) );
|
||||
P( E, A, B, C, D, R(21) );
|
||||
P( D, E, A, B, C, R(22) );
|
||||
P( C, D, E, A, B, R(23) );
|
||||
P( B, C, D, E, A, R(24) );
|
||||
P( A, B, C, D, E, R(25) );
|
||||
P( E, A, B, C, D, R(26) );
|
||||
P( D, E, A, B, C, R(27) );
|
||||
P( C, D, E, A, B, R(28) );
|
||||
P( B, C, D, E, A, R(29) );
|
||||
P( A, B, C, D, E, R(30) );
|
||||
P( E, A, B, C, D, R(31) );
|
||||
P( D, E, A, B, C, R(32) );
|
||||
P( C, D, E, A, B, R(33) );
|
||||
P( B, C, D, E, A, R(34) );
|
||||
P( A, B, C, D, E, R(35) );
|
||||
P( E, A, B, C, D, R(36) );
|
||||
P( D, E, A, B, C, R(37) );
|
||||
P( C, D, E, A, B, R(38) );
|
||||
P( B, C, D, E, A, R(39) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) ((x & y) | (z & (x | y)))
|
||||
#define K 0x8F1BBCDC
|
||||
|
||||
P( A, B, C, D, E, R(40) );
|
||||
P( E, A, B, C, D, R(41) );
|
||||
P( D, E, A, B, C, R(42) );
|
||||
P( C, D, E, A, B, R(43) );
|
||||
P( B, C, D, E, A, R(44) );
|
||||
P( A, B, C, D, E, R(45) );
|
||||
P( E, A, B, C, D, R(46) );
|
||||
P( D, E, A, B, C, R(47) );
|
||||
P( C, D, E, A, B, R(48) );
|
||||
P( B, C, D, E, A, R(49) );
|
||||
P( A, B, C, D, E, R(50) );
|
||||
P( E, A, B, C, D, R(51) );
|
||||
P( D, E, A, B, C, R(52) );
|
||||
P( C, D, E, A, B, R(53) );
|
||||
P( B, C, D, E, A, R(54) );
|
||||
P( A, B, C, D, E, R(55) );
|
||||
P( E, A, B, C, D, R(56) );
|
||||
P( D, E, A, B, C, R(57) );
|
||||
P( C, D, E, A, B, R(58) );
|
||||
P( B, C, D, E, A, R(59) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
#define K 0xCA62C1D6
|
||||
|
||||
P( A, B, C, D, E, R(60) );
|
||||
P( E, A, B, C, D, R(61) );
|
||||
P( D, E, A, B, C, R(62) );
|
||||
P( C, D, E, A, B, R(63) );
|
||||
P( B, C, D, E, A, R(64) );
|
||||
P( A, B, C, D, E, R(65) );
|
||||
P( E, A, B, C, D, R(66) );
|
||||
P( D, E, A, B, C, R(67) );
|
||||
P( C, D, E, A, B, R(68) );
|
||||
P( B, C, D, E, A, R(69) );
|
||||
P( A, B, C, D, E, R(70) );
|
||||
P( E, A, B, C, D, R(71) );
|
||||
P( D, E, A, B, C, R(72) );
|
||||
P( C, D, E, A, B, R(73) );
|
||||
P( B, C, D, E, A, R(74) );
|
||||
P( A, B, C, D, E, R(75) );
|
||||
P( E, A, B, C, D, R(76) );
|
||||
P( D, E, A, B, C, R(77) );
|
||||
P( C, D, E, A, B, R(78) );
|
||||
P( B, C, D, E, A, R(79) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
ctx->state[4] += E;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 process buffer
|
||||
*/
|
||||
void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
size_t fill;
|
||||
uint32_t left;
|
||||
|
||||
if( ilen <= 0 )
|
||||
return;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += (uint32_t) ilen;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < (uint32_t) ilen )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && ilen >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), input, fill );
|
||||
sha1_process( ctx, ctx->buffer );
|
||||
input += fill;
|
||||
ilen -= fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( ilen >= 64 )
|
||||
{
|
||||
sha1_process( ctx, input );
|
||||
input += 64;
|
||||
ilen -= 64;
|
||||
}
|
||||
|
||||
if( ilen > 0 )
|
||||
memcpy( (void *) (ctx->buffer + left), input, ilen );
|
||||
}
|
||||
|
||||
static const unsigned char sha1_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* SHA-1 final digest
|
||||
*/
|
||||
void sha1_finish( sha1_context *ctx, unsigned char output[20] )
|
||||
{
|
||||
uint32_t last, padn;
|
||||
uint32_t high, low;
|
||||
unsigned char msglen[8];
|
||||
|
||||
high = ( ctx->total[0] >> 29 )
|
||||
| ( ctx->total[1] << 3 );
|
||||
low = ( ctx->total[0] << 3 );
|
||||
|
||||
PUT_UINT32_BE( high, msglen, 0 );
|
||||
PUT_UINT32_BE( low, msglen, 4 );
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
sha1_update( ctx, sha1_padding, padn );
|
||||
sha1_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_UINT32_BE( ctx->state[0], output, 0 );
|
||||
PUT_UINT32_BE( ctx->state[1], output, 4 );
|
||||
PUT_UINT32_BE( ctx->state[2], output, 8 );
|
||||
PUT_UINT32_BE( ctx->state[3], output, 12 );
|
||||
PUT_UINT32_BE( ctx->state[4], output, 16 );
|
||||
}
|
||||
|
||||
/*
|
||||
* output = SHA-1( input buffer )
|
||||
*/
|
||||
void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] )
|
||||
{
|
||||
sha1_context ctx;
|
||||
|
||||
sha1_starts( &ctx );
|
||||
sha1_update( &ctx, input, ilen );
|
||||
sha1_finish( &ctx, output );
|
||||
|
||||
memset( &ctx, 0, sizeof( sha1_context ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC context setup
|
||||
*/
|
||||
void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
size_t i;
|
||||
unsigned char sum[20];
|
||||
|
||||
if( keylen > 64 )
|
||||
{
|
||||
sha1( key, keylen, sum );
|
||||
keylen = 20;
|
||||
key = sum;
|
||||
}
|
||||
|
||||
memset( ctx->ipad, 0x36, 64 );
|
||||
memset( ctx->opad, 0x5C, 64 );
|
||||
|
||||
for( i = 0; i < keylen; i++ )
|
||||
{
|
||||
ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
|
||||
ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
|
||||
}
|
||||
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->ipad, 64 );
|
||||
|
||||
memset( sum, 0, sizeof( sum ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC process buffer
|
||||
*/
|
||||
void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha1_update( ctx, input, ilen );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC final digest
|
||||
*/
|
||||
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] )
|
||||
{
|
||||
unsigned char tmpbuf[20];
|
||||
|
||||
sha1_finish( ctx, tmpbuf );
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->opad, 64 );
|
||||
sha1_update( ctx, tmpbuf, 20 );
|
||||
sha1_finish( ctx, output );
|
||||
|
||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA1 HMAC context reset
|
||||
*/
|
||||
void sha1_hmac_reset( sha1_context *ctx )
|
||||
{
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->ipad, 64 );
|
||||
}
|
||||
|
||||
/*
|
||||
* output = HMAC-SHA-1( hmac key, input buffer )
|
||||
*/
|
||||
void sha1_hmac( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char output[20] )
|
||||
{
|
||||
sha1_context ctx;
|
||||
|
||||
sha1_hmac_starts( &ctx, key, keylen );
|
||||
sha1_hmac_update( &ctx, input, ilen );
|
||||
sha1_hmac_finish( &ctx, output );
|
||||
|
||||
memset( &ctx, 0, sizeof( sha1_context ) );
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* \file sha1.h
|
||||
*
|
||||
* \brief SHA-1 cryptographic hash function
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
typedef UINT32 uint32_t;
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/write error in file. */
|
||||
|
||||
// Regular implementation
|
||||
//
|
||||
|
||||
/**
|
||||
* \brief SHA-1 context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t total[2]; /*!< number of bytes processed */
|
||||
uint32_t state[5]; /*!< intermediate digest state */
|
||||
unsigned char buffer[64]; /*!< data block being processed */
|
||||
|
||||
unsigned char ipad[64]; /*!< HMAC: inner padding */
|
||||
unsigned char opad[64]; /*!< HMAC: outer padding */
|
||||
}
|
||||
sha1_context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief SHA-1 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*/
|
||||
void sha1_starts( sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process buffer
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 final digest
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param output SHA-1 checksum result
|
||||
*/
|
||||
void sha1_finish( sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/* Internal use */
|
||||
void sha1_process( sha1_context *ctx, const unsigned char data[64] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Output = SHA-1( input buffer )
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output SHA-1 checksum result
|
||||
*/
|
||||
void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief Output = SHA-1( file contents )
|
||||
*
|
||||
* \param path input file name
|
||||
* \param output SHA-1 checksum result
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_SHA1_FILE_IO_ERROR
|
||||
*/
|
||||
int sha1_file( const char *path, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC context setup
|
||||
*
|
||||
* \param ctx HMAC context to be initialized
|
||||
* \param key HMAC secret key
|
||||
* \param keylen length of the HMAC key
|
||||
*/
|
||||
void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC process buffer
|
||||
*
|
||||
* \param ctx HMAC context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC final digest
|
||||
*
|
||||
* \param ctx HMAC context
|
||||
* \param output SHA-1 HMAC checksum result
|
||||
*/
|
||||
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC context reset
|
||||
*
|
||||
* \param ctx HMAC context to be reset
|
||||
*/
|
||||
void sha1_hmac_reset( sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief Output = HMAC-SHA-1( hmac key, input buffer )
|
||||
*
|
||||
* \param key HMAC secret key
|
||||
* \param keylen length of the HMAC key
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output HMAC-SHA-1 result
|
||||
*/
|
||||
void sha1_hmac( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,699 @@
|
||||
#include "stdafx.h"
|
||||
#include "unedat.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv)
|
||||
{
|
||||
int mode = (int) (crypto_mode & 0xF0000000);
|
||||
switch (mode) {
|
||||
case 0x10000000:
|
||||
// Encrypted ERK.
|
||||
// Decrypt the key with EDAT_KEY + EDAT_IV and copy the original IV.
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, EDAT_IV, key, key_final, 0x10);
|
||||
memcpy(iv_final, iv, 0x10);
|
||||
break;
|
||||
case 0x20000000:
|
||||
// Default ERK.
|
||||
// Use EDAT_KEY and EDAT_IV.
|
||||
memcpy(key_final, version ? EDAT_KEY_1 : EDAT_KEY_0, 0x10);
|
||||
memcpy(iv_final, EDAT_IV, 0x10);
|
||||
break;
|
||||
case 0x00000000:
|
||||
// Unencrypted ERK.
|
||||
// Use the original key and iv.
|
||||
memcpy(key_final, key, 0x10);
|
||||
memcpy(iv_final, iv, 0x10);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsigned char *hash)
|
||||
{
|
||||
int mode = (int) (hash_mode & 0xF0000000);
|
||||
switch (mode) {
|
||||
case 0x10000000:
|
||||
// Encrypted HASH.
|
||||
// Decrypt the hash with EDAT_KEY + EDAT_IV.
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, EDAT_IV, hash, hash_final, 0x10);
|
||||
break;
|
||||
case 0x20000000:
|
||||
// Default HASH.
|
||||
// Use EDAT_HASH.
|
||||
memcpy(hash_final, version ? EDAT_HASH_1 : EDAT_HASH_0, 0x10);
|
||||
break;
|
||||
case 0x00000000:
|
||||
// Unencrypted ERK.
|
||||
// Use the original hash.
|
||||
memcpy(hash_final, hash, 0x10);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
bool crypto(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, int length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash)
|
||||
{
|
||||
// Setup buffers for key, iv and hash.
|
||||
unsigned char key_final[0x10] = {};
|
||||
unsigned char iv_final[0x10] = {};
|
||||
unsigned char hash_final_10[0x10] = {};
|
||||
unsigned char hash_final_14[0x14] = {};
|
||||
|
||||
// Generate crypto key and hash.
|
||||
generate_key(crypto_mode, version, key_final, iv_final, key, iv);
|
||||
if ((hash_mode & 0xFF) == 0x01)
|
||||
generate_hash(hash_mode, version, hash_final_14, hash);
|
||||
else
|
||||
generate_hash(hash_mode, version, hash_final_10, hash);
|
||||
|
||||
if ((crypto_mode & 0xFF) == 0x01) // No algorithm.
|
||||
{
|
||||
memcpy(out, in, length);
|
||||
}
|
||||
else if ((crypto_mode & 0xFF) == 0x02) // AES128-CBC
|
||||
{
|
||||
aescbc128_decrypt(key_final, iv_final, in, out, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown crypto algorithm!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((hash_mode & 0xFF) == 0x01) // 0x14 SHA1-HMAC
|
||||
{
|
||||
return hmac_hash_compare(hash_final_14, 0x14, in, length, test_hash);
|
||||
}
|
||||
else if ((hash_mode & 0xFF) == 0x02) // 0x10 AES-CMAC
|
||||
{
|
||||
return cmac_hash_compare(hash_final_10, 0x10, in, length, test_hash);
|
||||
}
|
||||
else if ((hash_mode & 0xFF) == 0x04) //0x10 SHA1-HMAC
|
||||
{
|
||||
return hmac_hash_compare(hash_final_10, 0x10, in, length, test_hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown hashing algorithm!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char* dec_section(unsigned char* metadata)
|
||||
{
|
||||
unsigned char *dec = new unsigned char[0x10];
|
||||
dec[0x00] = (metadata[0xC] ^ metadata[0x8] ^ metadata[0x10]);
|
||||
dec[0x01] = (metadata[0xD] ^ metadata[0x9] ^ metadata[0x11]);
|
||||
dec[0x02] = (metadata[0xE] ^ metadata[0xA] ^ metadata[0x12]);
|
||||
dec[0x03] = (metadata[0xF] ^ metadata[0xB] ^ metadata[0x13]);
|
||||
dec[0x04] = (metadata[0x4] ^ metadata[0x8] ^ metadata[0x14]);
|
||||
dec[0x05] = (metadata[0x5] ^ metadata[0x9] ^ metadata[0x15]);
|
||||
dec[0x06] = (metadata[0x6] ^ metadata[0xA] ^ metadata[0x16]);
|
||||
dec[0x07] = (metadata[0x7] ^ metadata[0xB] ^ metadata[0x17]);
|
||||
dec[0x08] = (metadata[0xC] ^ metadata[0x0] ^ metadata[0x18]);
|
||||
dec[0x09] = (metadata[0xD] ^ metadata[0x1] ^ metadata[0x19]);
|
||||
dec[0x0A] = (metadata[0xE] ^ metadata[0x2] ^ metadata[0x1A]);
|
||||
dec[0x0B] = (metadata[0xF] ^ metadata[0x3] ^ metadata[0x1B]);
|
||||
dec[0x0C] = (metadata[0x4] ^ metadata[0x0] ^ metadata[0x1C]);
|
||||
dec[0x0D] = (metadata[0x5] ^ metadata[0x1] ^ metadata[0x1D]);
|
||||
dec[0x0E] = (metadata[0x6] ^ metadata[0x2] ^ metadata[0x1E]);
|
||||
dec[0x0F] = (metadata[0x7] ^ metadata[0x3] ^ metadata[0x1F]);
|
||||
return dec;
|
||||
}
|
||||
|
||||
unsigned char* get_block_key(int block, NPD_HEADER *npd)
|
||||
{
|
||||
unsigned char empty_key[0x10] = {};
|
||||
unsigned char *src_key = (npd->version <= 1) ? empty_key : npd->dev_hash;
|
||||
unsigned char *dest_key = new unsigned char[0x10];
|
||||
memcpy(dest_key, src_key, 0xC);
|
||||
dest_key[0xC] = (block >> 24 & 0xFF);
|
||||
dest_key[0xD] = (block >> 16 & 0xFF);
|
||||
dest_key[0xE] = (block >> 8 & 0xFF);
|
||||
dest_key[0xF] = (block & 0xFF);
|
||||
return dest_key;
|
||||
}
|
||||
|
||||
// EDAT/SDAT functions.
|
||||
int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool verbose)
|
||||
{
|
||||
// Get metadata info and setup buffers.
|
||||
int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size);
|
||||
int metadata_section_size = ((edat->flags & EDAT_COMPRESSED_FLAG) != 0 || (edat->flags & EDAT_FLAG_0x20) != 0) ? 0x20 : 0x10;
|
||||
int metadata_offset = 0x100;
|
||||
|
||||
unsigned char *enc_data;
|
||||
unsigned char *dec_data;
|
||||
unsigned char *b_key;
|
||||
unsigned char *iv;
|
||||
|
||||
unsigned char empty_iv[0x10] = {};
|
||||
|
||||
// Decrypt the metadata.
|
||||
for (int i = 0; i < block_num; i++)
|
||||
{
|
||||
in->Seek(metadata_offset + i * metadata_section_size);
|
||||
unsigned char hash_result[0x10];
|
||||
long offset;
|
||||
int length = 0;
|
||||
int compression_end = 0;
|
||||
|
||||
if ((edat->flags & EDAT_FLAG_0x3C) != 0 || (edat->flags & EDAT_FLAG_0x3D) != 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Flag 0x3C/0x3D EDAT files are unsupported yet");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((edat->flags & EDAT_COMPRESSED_FLAG) != 0)
|
||||
{
|
||||
unsigned char metadata[0x20];
|
||||
in->Read(metadata, 0x20);
|
||||
|
||||
// If the data is compressed, decrypt the metadata.
|
||||
unsigned char *result = dec_section(metadata);
|
||||
offset = ((swap32(*(int*)&result[0]) << 4) | (swap32(*(int*)&result[4])));
|
||||
length = swap32(*(int*)&result[8]);
|
||||
compression_end = swap32(*(int*)&result[12]);
|
||||
delete[] result;
|
||||
|
||||
memcpy(hash_result, metadata, 0x10);
|
||||
}
|
||||
else if ((edat->flags & EDAT_FLAG_0x20) != 0)
|
||||
{
|
||||
// If FLAG 0x20, the metadata precedes each data block.
|
||||
in->Seek(metadata_offset + i * metadata_section_size + length);
|
||||
|
||||
unsigned char metadata[0x20];
|
||||
in->Read(metadata, 0x20);
|
||||
|
||||
// If FLAG 0x20 is set, apply custom xor.
|
||||
for (int j = 0; j < 0x10; j++) {
|
||||
hash_result[j] = (unsigned char)(metadata[j] ^ metadata[j+0x10]);
|
||||
}
|
||||
|
||||
offset = metadata_offset + i * edat->block_size + (i + 1) * metadata_section_size;
|
||||
length = edat->block_size;
|
||||
|
||||
if ((i == (block_num - 1)) && (edat->file_size % edat->block_size))
|
||||
length = (int) (edat->file_size % edat->block_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
in->Read(hash_result, 0x10);
|
||||
offset = metadata_offset + i * edat->block_size + block_num * metadata_section_size;
|
||||
length = edat->block_size;
|
||||
|
||||
if ((i == (block_num - 1)) && (edat->file_size % edat->block_size))
|
||||
length = (int) (edat->file_size % edat->block_size);
|
||||
}
|
||||
|
||||
// Locate the real data.
|
||||
int pad_length = length;
|
||||
length = (int) ((pad_length + 0xF) & 0xFFFFFFF0);
|
||||
in->Seek(offset);
|
||||
|
||||
// Setup buffers for decryption and read the data.
|
||||
enc_data = new unsigned char[length];
|
||||
dec_data = new unsigned char[length];
|
||||
unsigned char key_result[0x10];
|
||||
unsigned char hash[0x10];
|
||||
in->Read(enc_data, length);
|
||||
|
||||
// Generate a key for the current block.
|
||||
b_key = get_block_key(i, npd);
|
||||
|
||||
// Encrypt the block key with the crypto key.
|
||||
aesecb128_encrypt(crypt_key, b_key, key_result);
|
||||
if ((edat->flags & EDAT_FLAG_0x10) != 0)
|
||||
aesecb128_encrypt(crypt_key, key_result, hash); // If FLAG 0x10 is set, encrypt again to get the final hash.
|
||||
else
|
||||
memcpy(hash, key_result, 0x10);
|
||||
|
||||
// Setup the crypto and hashing mode based on the extra flags.
|
||||
int crypto_mode = ((edat->flags & EDAT_FLAG_0x02) == 0) ? 0x2 : 0x1;
|
||||
int hash_mode;
|
||||
|
||||
if ((edat->flags & EDAT_FLAG_0x10) == 0)
|
||||
hash_mode = 0x02;
|
||||
else if ((edat->flags & EDAT_FLAG_0x20) == 0)
|
||||
hash_mode = 0x04;
|
||||
else
|
||||
hash_mode = 0x01;
|
||||
|
||||
if ((edat->flags & EDAT_ENCRYPTED_KEY_FLAG) != 0)
|
||||
{
|
||||
crypto_mode |= 0x10000000;
|
||||
hash_mode |= 0x10000000;
|
||||
}
|
||||
|
||||
if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0)
|
||||
{
|
||||
// Reset the flags.
|
||||
crypto_mode |= 0x01000000;
|
||||
hash_mode |= 0x01000000;
|
||||
// Simply copy the data without the header or the footer.
|
||||
memcpy(dec_data, enc_data, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// IV is null if NPD version is 1 or 0.
|
||||
iv = (npd->version <= 1) ? empty_iv : npd->digest;
|
||||
// Call main crypto routine on this data block.
|
||||
crypto(hash_mode, crypto_mode, (npd->version == 4), enc_data, dec_data, length, key_result, iv, hash, hash_result);
|
||||
}
|
||||
|
||||
// Apply additional compression if needed and write the decrypted data.
|
||||
if (((edat->flags & EDAT_COMPRESSED_FLAG) != 0) && compression_end)
|
||||
{
|
||||
int decomp_size = (int)edat->file_size;
|
||||
unsigned char *decomp_data = new unsigned char[decomp_size];
|
||||
memset(decomp_data, 0, decomp_size);
|
||||
|
||||
if (verbose)
|
||||
LOG_NOTICE(LOADER, "EDAT: Decompressing...\n");
|
||||
|
||||
int res = lz_decompress(decomp_data, dec_data, decomp_size);
|
||||
out->Write(decomp_data, res);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "EDAT: Compressed block size: %d\n", pad_length);
|
||||
LOG_NOTICE(LOADER, "EDAT: Decompressed block size: %d\n", res);
|
||||
}
|
||||
|
||||
edat->file_size -= res;
|
||||
|
||||
if (edat->file_size == 0)
|
||||
{
|
||||
if (res < 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Decompression failed!\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
LOG_SUCCESS(LOADER, "EDAT: Data successfully decompressed!\n");
|
||||
}
|
||||
|
||||
delete[] decomp_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->Write(dec_data, pad_length);
|
||||
}
|
||||
|
||||
delete[] enc_data;
|
||||
delete[] dec_data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd)
|
||||
{
|
||||
if (edat == nullptr || npd == nullptr)
|
||||
return false;
|
||||
|
||||
if (npd->version == 0 || npd->version == 1)
|
||||
{
|
||||
if (edat->flags & 0x7EFFFFFE)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (npd->version == 2)
|
||||
{
|
||||
if (edat->flags & 0x7EFFFFE0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (npd->version == 3 || npd->version == 4)
|
||||
{
|
||||
if (edat->flags & 0x7EFFFFC0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (npd->version > 4)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown version - %d\n", npd->version);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFile *f, bool verbose)
|
||||
{
|
||||
f->Seek(0);
|
||||
unsigned char *header = new unsigned char[0xA0];
|
||||
unsigned char *tmp = new unsigned char[0xA0];
|
||||
unsigned char *hash_result = new unsigned char[0x10];
|
||||
|
||||
// Check NPD version and EDAT flags.
|
||||
if (!check_flags(edat, npd))
|
||||
{
|
||||
delete[] header;
|
||||
delete[] tmp;
|
||||
delete[] hash_result;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Read in the file header.
|
||||
f->Read(header, 0xA0);
|
||||
f->Read(hash_result, 0x10);
|
||||
|
||||
// Setup the hashing mode and the crypto mode used in the file.
|
||||
int crypto_mode = 0x1;
|
||||
int hash_mode = ((edat->flags & EDAT_ENCRYPTED_KEY_FLAG) == 0) ? 0x00000002 : 0x10000002;
|
||||
if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: DEBUG data detected!\n");
|
||||
hash_mode |= 0x01000000;
|
||||
}
|
||||
|
||||
// Setup header key and iv buffers.
|
||||
unsigned char header_key[0x10] = {};
|
||||
unsigned char header_iv[0x10] = {};
|
||||
|
||||
// Test the header hash (located at offset 0xA0).
|
||||
if (!crypto(hash_mode, crypto_mode, (npd->version == 4), header, tmp, 0xA0, header_key, header_iv, key, hash_result))
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: Header hash is invalid!\n");
|
||||
}
|
||||
|
||||
// Parse the metadata info.
|
||||
int metadata_section_size = 0x10;
|
||||
if (((edat->flags & EDAT_COMPRESSED_FLAG) != 0))
|
||||
{
|
||||
LOG_WARNING(LOADER, "EDAT: COMPRESSED data detected!\n");
|
||||
metadata_section_size = 0x20;
|
||||
}
|
||||
|
||||
int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size);
|
||||
int bytes_read = 0;
|
||||
int metadata_offset = 0x100;
|
||||
|
||||
long bytes_to_read = metadata_section_size * block_num;
|
||||
while (bytes_to_read > 0)
|
||||
{
|
||||
// Locate the metadata blocks.
|
||||
int block_size = (0x3C00 > bytes_to_read) ? (int) bytes_to_read : 0x3C00; // 0x3C00 is the maximum block size.
|
||||
f->Seek(metadata_offset + bytes_read);
|
||||
unsigned char *data = new unsigned char[block_size];
|
||||
|
||||
// Read in the metadata.
|
||||
tmp = new unsigned char[block_size];
|
||||
f->Read(data, block_size);
|
||||
|
||||
// Check the generated hash against the metadata hash located at offset 0x90 in the header.
|
||||
memset(hash_result, 0, 0x10);
|
||||
f->Seek(0x90);
|
||||
f->Read(hash_result, 0x10);
|
||||
|
||||
// Generate the hash for this block.
|
||||
if (!crypto(hash_mode, crypto_mode, (npd->version == 4), data, tmp, block_size, header_key, header_iv, key, hash_result))
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: Metadata hash from block 0x%08x is invalid!\n", metadata_offset + bytes_read);
|
||||
}
|
||||
|
||||
// Adjust sizes.
|
||||
bytes_read += block_size;
|
||||
bytes_to_read -= block_size;
|
||||
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
delete[] header;
|
||||
delete[] tmp;
|
||||
delete[] hash_result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER *npd, bool verbose)
|
||||
{
|
||||
int title_hash_result = 0;
|
||||
int dev_hash_result = 0;
|
||||
|
||||
int file_name_length = strlen(file_name);
|
||||
unsigned char *buf = new unsigned char[0x30 + file_name_length];
|
||||
unsigned char key[0x10];
|
||||
|
||||
// Build the buffer (content_id + file_name).
|
||||
memcpy(buf, npd->content_id, 0x30);
|
||||
memcpy(buf + 0x30, file_name, file_name_length);
|
||||
|
||||
// Hash with NP_OMAC_KEY_3 and compare with title_hash.
|
||||
title_hash_result = cmac_hash_compare(NP_OMAC_KEY_3, 0x10, buf, 0x30 + file_name_length, npd->title_hash);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
if (title_hash_result)
|
||||
LOG_SUCCESS(LOADER, "EDAT: NPD title hash is valid!\n");
|
||||
else
|
||||
LOG_WARNING(LOADER, "EDAT: NPD title hash is invalid!\n");
|
||||
}
|
||||
|
||||
// Check for an empty dev_hash (can't validate if devklic is NULL);
|
||||
bool isDevklicEmpty = true;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
if (klicensee[i] != 0)
|
||||
{
|
||||
isDevklicEmpty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isDevklicEmpty)
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: NPD dev hash is empty!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate klicensee xor key.
|
||||
xor_(key, klicensee, NP_OMAC_KEY_2, 0x10);
|
||||
|
||||
// Hash with generated key and compare with dev_hash.
|
||||
dev_hash_result = cmac_hash_compare(key, 0x10, (unsigned char *)npd, 0x60, npd->dev_hash);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
if (dev_hash_result)
|
||||
LOG_SUCCESS(LOADER, "EDAT: NPD dev hash is valid!\n");
|
||||
else
|
||||
LOG_WARNING(LOADER, "EDAT: NPD dev hash is invalid!\n");
|
||||
}
|
||||
}
|
||||
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsigned char* devklic, unsigned char* rifkey, bool verbose)
|
||||
{
|
||||
// Setup NPD and EDAT/SDAT structs.
|
||||
NPD_HEADER *NPD = new NPD_HEADER();
|
||||
EDAT_SDAT_HEADER *EDAT = new EDAT_SDAT_HEADER();
|
||||
|
||||
// Read in the NPD and EDAT/SDAT headers.
|
||||
char npd_header[0x80];
|
||||
char edat_header[0x10];
|
||||
input->Read(npd_header, 0x80);
|
||||
input->Read(edat_header, 0x10);
|
||||
|
||||
memcpy(NPD->magic, npd_header, 4);
|
||||
NPD->version = swap32(*(int*)&npd_header[4]);
|
||||
NPD->license = swap32(*(int*)&npd_header[8]);
|
||||
NPD->type = swap32(*(int*)&npd_header[12]);
|
||||
memcpy(NPD->content_id, (unsigned char*)&npd_header[16], 0x30);
|
||||
memcpy(NPD->digest, (unsigned char*)&npd_header[64], 0x10);
|
||||
memcpy(NPD->title_hash, (unsigned char*)&npd_header[80], 0x10);
|
||||
memcpy(NPD->dev_hash, (unsigned char*)&npd_header[96], 0x10);
|
||||
NPD->unk1 = swap64(*(u64*)&npd_header[112]);
|
||||
NPD->unk2 = swap64(*(u64*)&npd_header[120]);
|
||||
|
||||
unsigned char npd_magic[4] = {0x4E, 0x50, 0x44, 0x00}; //NPD0
|
||||
if(memcmp(NPD->magic, npd_magic, 4))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: File has invalid NPD header.");
|
||||
delete NPD;
|
||||
delete EDAT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EDAT->flags = swap32(*(int*)&edat_header[0]);
|
||||
EDAT->block_size = swap32(*(int*)&edat_header[4]);
|
||||
EDAT->file_size = swap64(*(u64*)&edat_header[8]);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "NPD HEADER\n");
|
||||
LOG_NOTICE(LOADER, "NPD version: %d\n", NPD->version);
|
||||
LOG_NOTICE(LOADER, "NPD license: %d\n", NPD->license);
|
||||
LOG_NOTICE(LOADER, "NPD type: %d\n", NPD->type);
|
||||
LOG_NOTICE(LOADER, "\n");
|
||||
LOG_NOTICE(LOADER, "EDAT HEADER\n");
|
||||
LOG_NOTICE(LOADER, "EDAT flags: 0x%08X\n", EDAT->flags);
|
||||
LOG_NOTICE(LOADER, "EDAT block size: 0x%08X\n", EDAT->block_size);
|
||||
LOG_NOTICE(LOADER, "EDAT file size: 0x%08X\n", EDAT->file_size);
|
||||
LOG_NOTICE(LOADER, "\n");
|
||||
}
|
||||
|
||||
// Set decryption key.
|
||||
unsigned char key[0x10];
|
||||
memset(key, 0, 0x10);
|
||||
|
||||
if((EDAT->flags & SDAT_FLAG) == SDAT_FLAG)
|
||||
{
|
||||
LOG_WARNING(LOADER, "EDAT: SDAT detected!\n");
|
||||
xor_(key, NPD->dev_hash, SDAT_KEY, 0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Perform header validation (optional step).
|
||||
validate_data(input_file_name, devklic, NPD, verbose);
|
||||
|
||||
if ((NPD->license & 0x3) == 0x3) // Type 3: Use supplied devklic.
|
||||
memcpy(key, devklic, 0x10);
|
||||
else if ((NPD->license & 0x2) == 0x2) // Type 2: Use key from RAP file (RIF key).
|
||||
{
|
||||
memcpy(key, rifkey, 0x10);
|
||||
|
||||
// Make sure we don't have an empty RIF key.
|
||||
int i, test = 0;
|
||||
for(i = 0; i < 0x10; i++)
|
||||
{
|
||||
if (key[i] != 0)
|
||||
{
|
||||
test = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!test)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: A valid RAP file is needed!");
|
||||
delete NPD;
|
||||
delete EDAT;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "EDAT: Parsing data...\n");
|
||||
if (check_data(key, EDAT, NPD, input, verbose))
|
||||
LOG_ERROR(LOADER, "EDAT: Data parsing failed!\n");
|
||||
else
|
||||
LOG_SUCCESS(LOADER, "EDAT: Data successfully parsed!\n");
|
||||
|
||||
printf("\n");
|
||||
|
||||
LOG_NOTICE(LOADER, "EDAT: Decrypting data...\n");
|
||||
if (decrypt_data(input, output, EDAT, NPD, key, verbose))
|
||||
LOG_ERROR(LOADER, "EDAT: Data decryption failed!");
|
||||
else
|
||||
LOG_SUCCESS(LOADER, "EDAT: Data successfully decrypted!");
|
||||
|
||||
delete NPD;
|
||||
delete EDAT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DecryptEDAT(const std::string& input_file_name, const std::string& output_file_name, int mode, const std::string& rap_file_name, unsigned char *custom_klic, bool verbose)
|
||||
{
|
||||
// Prepare the files.
|
||||
rFile input(input_file_name.c_str());
|
||||
rFile output(output_file_name.c_str(), rFile::write);
|
||||
rFile rap(rap_file_name.c_str());
|
||||
|
||||
// Set keys (RIF and DEVKLIC).
|
||||
unsigned char rifkey[0x10];
|
||||
unsigned char devklic[0x10];
|
||||
memset(rifkey, 0, 0x10);
|
||||
memset(devklic, 0, 0x10);
|
||||
|
||||
// Select the EDAT key mode.
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
memcpy(devklic, NP_KLIC_FREE, 0x10);
|
||||
break;
|
||||
case 2:
|
||||
memcpy(devklic, NP_OMAC_KEY_2, 0x10);
|
||||
break;
|
||||
case 3:
|
||||
memcpy(devklic, NP_OMAC_KEY_3, 0x10);
|
||||
break;
|
||||
case 4:
|
||||
memcpy(devklic, NP_KLIC_KEY, 0x10);
|
||||
break;
|
||||
case 5:
|
||||
memcpy(devklic, NP_PSX_KEY, 0x10);
|
||||
break;
|
||||
case 6:
|
||||
memcpy(devklic, NP_PSP_KEY_1, 0x10);
|
||||
break;
|
||||
case 7:
|
||||
memcpy(devklic, NP_PSP_KEY_2, 0x10);
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if (custom_klic != NULL)
|
||||
memcpy(devklic, custom_klic, 0x10);
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Invalid custom klic!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR(LOADER, "EDAT: Invalid mode!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check the input/output files.
|
||||
if (!input.IsOpened() || !output.IsOpened())
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Failed to open files!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read the RAP file, if provided.
|
||||
if (rap.IsOpened())
|
||||
{
|
||||
unsigned char rapkey[0x10];
|
||||
memset(rapkey, 0, 0x10);
|
||||
|
||||
rap.Read(rapkey, 0x10);
|
||||
|
||||
rap_to_rif(rapkey, rifkey);
|
||||
|
||||
rap.Close();
|
||||
}
|
||||
|
||||
// Delete the bad output file if any errors arise.
|
||||
if (extract_data(&input, &output, input_file_name.c_str(), devklic, rifkey, verbose))
|
||||
{
|
||||
input.Close();
|
||||
output.Close();
|
||||
rRemoveFile(output_file_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
input.Close();
|
||||
output.Close();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
#define SDAT_FLAG 0x01000000
|
||||
#define EDAT_COMPRESSED_FLAG 0x00000001
|
||||
#define EDAT_FLAG_0x02 0x00000002
|
||||
#define EDAT_ENCRYPTED_KEY_FLAG 0x00000008
|
||||
#define EDAT_FLAG_0x10 0x00000010
|
||||
#define EDAT_FLAG_0x20 0x00000020
|
||||
#define EDAT_DEBUG_DATA_FLAG 0x80000000
|
||||
#define EDAT_FLAG_0x3C 0x0000003C
|
||||
#define EDAT_FLAG_0x3D 0x0000003D
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char magic[4];
|
||||
int version;
|
||||
int license;
|
||||
int type;
|
||||
unsigned char content_id[0x30];
|
||||
unsigned char digest[0x10];
|
||||
unsigned char title_hash[0x10];
|
||||
unsigned char dev_hash[0x10];
|
||||
unsigned long long unk1;
|
||||
unsigned long long unk2;
|
||||
} NPD_HEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int flags;
|
||||
int block_size;
|
||||
unsigned long long file_size;
|
||||
} EDAT_SDAT_HEADER;
|
||||
|
||||
int DecryptEDAT(const std::string& input_file_name, const std::string& output_file_name, int mode, const std::string& rap_file_name, unsigned char *custom_klic, bool verbose);
|
||||
@@ -0,0 +1,224 @@
|
||||
#include "stdafx.h"
|
||||
#include "unpkg.h"
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
// Decryption.
|
||||
bool CheckHeader(rFile& pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
if (m_header->pkg_magic != 0x7F504B47) {
|
||||
LOG_ERROR(LOADER, "PKG: Not a package file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ((u32)m_header->pkg_type)
|
||||
{
|
||||
case PKG_RELEASE_TYPE_DEBUG: break;
|
||||
case PKG_RELEASE_TYPE_RELEASE: break;
|
||||
default:
|
||||
LOG_ERROR(LOADER, "PKG: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ((u32)m_header->pkg_platform)
|
||||
{
|
||||
case PKG_PLATFORM_TYPE_PS3: break;
|
||||
case PKG_PLATFORM_TYPE_PSP: break;
|
||||
default:
|
||||
LOG_ERROR(LOADER, "PKG: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->header_size != PKG_HEADER_SIZE) {
|
||||
LOG_ERROR(LOADER, "PKG: Wrong header size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->pkg_size != pkg_f.Length()) {
|
||||
LOG_ERROR(LOADER, "PKG: File size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->data_size + m_header->data_offset + 0x60 != pkg_f.Length()) {
|
||||
LOG_ERROR(LOADER, "PKG: Data size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadHeader(rFile& pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
pkg_f.Seek(0);
|
||||
|
||||
if (pkg_f.Read(m_header, sizeof(PKGHeader)) != sizeof(PKGHeader)) {
|
||||
LOG_ERROR(LOADER, "PKG: Package file is too short!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckHeader(pkg_f, m_header))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Decrypt(rFile& pkg_f, rFile& dec_pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
if (!LoadHeader(pkg_f, m_header))
|
||||
return -1;
|
||||
|
||||
aes_context c;
|
||||
u8 iv[HASH_LEN];
|
||||
u8 buf[BUF_SIZE];
|
||||
u8 ctr[BUF_SIZE];
|
||||
|
||||
// Debug key
|
||||
u8 key[0x40];
|
||||
memset(key, 0, 0x40);
|
||||
memcpy(key+0x00, &m_header->qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x08, &m_header->qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x10, &m_header->qa_digest[8], 8); // &data[0x68]
|
||||
memcpy(key+0x18, &m_header->qa_digest[8], 8); // &data[0x68]
|
||||
|
||||
pkg_f.Seek(m_header->data_offset);
|
||||
u32 parts = (m_header->data_size + BUF_SIZE - 1) / BUF_SIZE;
|
||||
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, decrypting...", parts, 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
memcpy(iv, m_header->klicensee, sizeof(iv));
|
||||
aes_setkey_enc(&c, PKG_AES_KEY, 128);
|
||||
|
||||
for (u32 i=0; i<parts; i++)
|
||||
{
|
||||
memset(buf, 0, sizeof(buf));
|
||||
u32 length = pkg_f.Read(buf, BUF_SIZE);
|
||||
u32 bits = (length + HASH_LEN - 1) / HASH_LEN;
|
||||
|
||||
if (m_header->pkg_type == PKG_RELEASE_TYPE_DEBUG)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
u8 hash[0x14];
|
||||
sha1(key, 0x40, hash);
|
||||
*(u64*)&buf[j*HASH_LEN + 0] ^= *(u64*)&hash[0];
|
||||
*(u64*)&buf[j*HASH_LEN + 8] ^= *(u64*)&hash[8];
|
||||
*(be_t<u64>*)&key[0x38] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_header->pkg_type == PKG_RELEASE_TYPE_RELEASE)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
aes_crypt_ecb(&c, AES_ENCRYPT, iv, ctr+j*HASH_LEN);
|
||||
|
||||
be_t<u64> hi = *(be_t<u64>*)&iv[0];
|
||||
be_t<u64> lo = *(be_t<u64>*)&iv[8] + 1;
|
||||
|
||||
if (lo == 0)
|
||||
hi += 1;
|
||||
|
||||
*(be_t<u64>*)&iv[0] = hi;
|
||||
*(be_t<u64>*)&iv[8] = lo;
|
||||
}
|
||||
|
||||
for (u32 j=0; j<length; j++) {
|
||||
buf[j] ^= ctr[j];
|
||||
}
|
||||
}
|
||||
dec_pkg_f.Write(buf, length);
|
||||
pdlg.Update(i);
|
||||
}
|
||||
pdlg.Update(parts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Unpacking.
|
||||
bool LoadEntries(rFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries)
|
||||
{
|
||||
dec_pkg_f.Seek(0);
|
||||
dec_pkg_f.Read(m_entries, sizeof(PKGEntry) * m_header->file_count);
|
||||
|
||||
if (m_entries->name_offset / sizeof(PKGEntry) != m_header->file_count) {
|
||||
LOG_ERROR(LOADER, "PKG: Entries are damaged!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir)
|
||||
{
|
||||
u8 buf[BUF_SIZE];
|
||||
|
||||
dec_pkg_f.Seek(entry.name_offset);
|
||||
dec_pkg_f.Read(buf, entry.name_size);
|
||||
buf[entry.name_size] = 0;
|
||||
|
||||
switch (entry.type & (0xff))
|
||||
{
|
||||
case PKG_FILE_ENTRY_NPDRM:
|
||||
case PKG_FILE_ENTRY_NPDRMEDAT:
|
||||
case PKG_FILE_ENTRY_SDAT:
|
||||
case PKG_FILE_ENTRY_REGULAR:
|
||||
{
|
||||
rFile out;
|
||||
out.Create(dir + std::string(reinterpret_cast<char *>(buf), entry.name_size));
|
||||
dec_pkg_f.Seek(entry.file_offset);
|
||||
|
||||
for (u64 size = 0; size < entry.file_size; ) {
|
||||
size += dec_pkg_f.Read(buf, BUF_SIZE);
|
||||
if (size > entry.file_size)
|
||||
out.Write(buf, BUF_SIZE - (size - entry.file_size));
|
||||
else
|
||||
out.Write(buf, BUF_SIZE);
|
||||
}
|
||||
out.Close();
|
||||
}
|
||||
break;
|
||||
|
||||
case PKG_FILE_ENTRY_FOLDER:
|
||||
rMkdir(dir + std::string(reinterpret_cast<char *>(buf), entry.name_size));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int Unpack(rFile& pkg_f, std::string src, std::string dst)
|
||||
{
|
||||
PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader));
|
||||
|
||||
rFile dec_pkg_f;
|
||||
std::string decryptedFile = rGetCwd() + "/dev_hdd1/" + src + ".dec";
|
||||
|
||||
dec_pkg_f.Create(decryptedFile, true);
|
||||
|
||||
if (Decrypt(pkg_f, dec_pkg_f, m_header) < 0)
|
||||
return -1;
|
||||
|
||||
dec_pkg_f.Close();
|
||||
|
||||
rFile n_dec_pkg_f(decryptedFile, rFile::read);
|
||||
|
||||
std::vector<PKGEntry> m_entries;
|
||||
m_entries.resize(m_header->file_count);
|
||||
|
||||
PKGEntry *m_entries_ptr = &m_entries[0];
|
||||
if (!LoadEntries(n_dec_pkg_f, m_header, m_entries_ptr))
|
||||
return -1;
|
||||
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, unpacking...", m_entries.size(), 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
for (const PKGEntry& entry : m_entries)
|
||||
{
|
||||
UnpackEntry(n_dec_pkg_f, entry, dst + src + "/");
|
||||
pdlg.Update(pdlg.GetValue() + 1);
|
||||
}
|
||||
pdlg.Update(m_entries.size());
|
||||
|
||||
n_dec_pkg_f.Close();
|
||||
wxRemoveFile(decryptedFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
// Constants
|
||||
#define PKG_HEADER_SIZE 0xC0 //sizeof(pkg_header) + sizeof(pkg_unk_checksum)
|
||||
#define PKG_RELEASE_TYPE_RELEASE 0x8000
|
||||
#define PKG_RELEASE_TYPE_DEBUG 0x0000
|
||||
#define PKG_PLATFORM_TYPE_PS3 0x0001
|
||||
#define PKG_PLATFORM_TYPE_PSP 0x0002
|
||||
|
||||
#define PKG_FILE_ENTRY_NPDRM 0x0001
|
||||
#define PKG_FILE_ENTRY_NPDRMEDAT 0x0002
|
||||
#define PKG_FILE_ENTRY_REGULAR 0x0003
|
||||
#define PKG_FILE_ENTRY_FOLDER 0x0004
|
||||
#define PKG_FILE_ENTRY_SDAT 0x0009
|
||||
#define PKG_FILE_ENTRY_OVERWRITE 0x80000000
|
||||
|
||||
#define HASH_LEN 16
|
||||
#define BUF_SIZE 4096
|
||||
|
||||
// Structs
|
||||
struct PKGHeader
|
||||
{
|
||||
be_t<u32> pkg_magic; // Magic (0x7f504b47)
|
||||
be_t<u16> pkg_type; // Release type (Retail:0x8000, Debug:0x0000)
|
||||
be_t<u16> pkg_platform; // Platform type (PS3:0x0001, PSP:0x0002)
|
||||
be_t<u32> header_size; // Header size (0xc0)
|
||||
be_t<u32> unk1; // Some PKG version maybe?
|
||||
be_t<u32> meta_size; // Size of metadata (block after header & hashes)
|
||||
be_t<u32> file_count; // Number of files
|
||||
be_t<u64> pkg_size; // PKG size in bytes
|
||||
be_t<u64> data_offset; // Encrypted data offset
|
||||
be_t<u64> data_size; // Encrypted data size in bytes
|
||||
char title_id[48]; // Title ID
|
||||
u8 qa_digest[16]; // This should be the hash of "files + attribs"
|
||||
u8 klicensee[16]; // Nonce
|
||||
};
|
||||
|
||||
struct PKGEntry
|
||||
{
|
||||
be_t<u32> name_offset; // File name offset
|
||||
be_t<u32> name_size; // File name size
|
||||
be_t<u64> file_offset; // File offset
|
||||
be_t<u64> file_size; // File size
|
||||
be_t<u32> type; // File type
|
||||
be_t<u32> pad; // Padding (zeros)
|
||||
};
|
||||
|
||||
extern int Unpack(rFile& dec_pkg_f, std::string src, std::string dst);
|
||||
@@ -0,0 +1,670 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/FS/vfsLocalFile.h"
|
||||
#include "unself.h"
|
||||
|
||||
SELFDecrypter::SELFDecrypter(vfsStream& s)
|
||||
: self_f(s), key_v(), data_buf_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
{
|
||||
// Read SCE header.
|
||||
self_f.Seek(0);
|
||||
sce_hdr.Load(self_f);
|
||||
|
||||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Not a SELF file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read SELF header.
|
||||
self_hdr.Load(self_f);
|
||||
|
||||
// Read the APP INFO.
|
||||
self_f.Seek(self_hdr.se_appinfooff);
|
||||
app_info.Load(self_f);
|
||||
|
||||
// Read ELF header.
|
||||
self_f.Seek(self_hdr.se_elfoff);
|
||||
if (isElf32)
|
||||
elf32_hdr.Load(self_f);
|
||||
else
|
||||
elf64_hdr.Load(self_f);
|
||||
|
||||
// Read ELF program headers.
|
||||
if (isElf32)
|
||||
{
|
||||
phdr32_arr.clear();
|
||||
if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
|
||||
{
|
||||
phdr32_arr.emplace_back();
|
||||
phdr32_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phdr64_arr.clear();
|
||||
if(elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_phnum; ++i)
|
||||
{
|
||||
phdr64_arr.emplace_back();
|
||||
phdr64_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Read section info.
|
||||
secinfo_arr.clear();
|
||||
self_f.Seek(self_hdr.se_secinfoff);
|
||||
|
||||
for(u32 i = 0; i < ((isElf32) ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i)
|
||||
{
|
||||
secinfo_arr.emplace_back();
|
||||
secinfo_arr.back().Load(self_f);
|
||||
}
|
||||
|
||||
// Read SCE version info.
|
||||
self_f.Seek(self_hdr.se_sceveroff);
|
||||
scev_info.Load(self_f);
|
||||
|
||||
// Read control info.
|
||||
ctrlinfo_arr.clear();
|
||||
self_f.Seek(self_hdr.se_controloff);
|
||||
|
||||
u32 i = 0;
|
||||
while(i < self_hdr.se_controlsize)
|
||||
{
|
||||
ctrlinfo_arr.emplace_back();
|
||||
ControlInfo &cinfo = ctrlinfo_arr.back();
|
||||
cinfo.Load(self_f);
|
||||
i += cinfo.size;
|
||||
}
|
||||
|
||||
// Read ELF section headers.
|
||||
if (isElf32)
|
||||
{
|
||||
shdr32_arr.clear();
|
||||
if(elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
|
||||
{
|
||||
LOG_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_shnum; ++i)
|
||||
{
|
||||
shdr32_arr.emplace_back();
|
||||
shdr32_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shdr64_arr.clear();
|
||||
if(elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum)
|
||||
{
|
||||
LOG_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_shnum; ++i)
|
||||
{
|
||||
shdr64_arr.emplace_back();
|
||||
shdr64_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "SCE header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
sce_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "SELF header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "APP INFO");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
app_info.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
isElf32 ? elf32_hdr.Show() : elf64_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF program headers");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++)
|
||||
isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "Section info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < secinfo_arr.size(); i++)
|
||||
secinfo_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "SCE version info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
scev_info.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "Control info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF section headers");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++)
|
||||
isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
{
|
||||
aes_context aes;
|
||||
ControlInfo *ctrl = NULL;
|
||||
u8 npdrm_key[0x10];
|
||||
u8 npdrm_iv[0x10];
|
||||
|
||||
// Parse the control info structures to find the NPDRM control info.
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
{
|
||||
if (ctrlinfo_arr[i].type == 3)
|
||||
{
|
||||
ctrl = &ctrlinfo_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we have a valid NPDRM control info structure.
|
||||
// If not, the data has no NPDRM layer.
|
||||
if (!ctrl)
|
||||
{
|
||||
LOG_WARNING(LOADER, "SELF: No NPDRM control info found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 klicensee_key[0x10];
|
||||
memcpy(klicensee_key, key_v.GetKlicenseeKey(), 0x10);
|
||||
|
||||
// Use klicensee if available.
|
||||
if (klicensee_key != NULL)
|
||||
memcpy(npdrm_key, klicensee_key, 0x10);
|
||||
|
||||
if (ctrl->npdrm.license == 1) // Network license.
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Can't decrypt network NPDRM!");
|
||||
return false;
|
||||
}
|
||||
else if (ctrl->npdrm.license == 2) // Local license.
|
||||
{
|
||||
// Try to find a RAP file to get the key.
|
||||
if (!GetKeyFromRap(ctrl->npdrm.content_id, npdrm_key))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Can't find RAP file for NPDRM decryption!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ctrl->npdrm.license == 3) // Free license.
|
||||
{
|
||||
// Use the NP_KLIC_FREE.
|
||||
memcpy(npdrm_key, NP_KLIC_FREE, 0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Invalid NPDRM license type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decrypt our key with NP_KLIC_KEY.
|
||||
aes_setkey_dec(&aes, NP_KLIC_KEY, 128);
|
||||
aes_crypt_ecb(&aes, AES_DECRYPT, npdrm_key, npdrm_key);
|
||||
|
||||
// IV is empty.
|
||||
memset(npdrm_iv, 0, 0x10);
|
||||
|
||||
// Use our final key to decrypt the NPDRM layer.
|
||||
aes_setkey_dec(&aes, npdrm_key, 128);
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, metadata_size, npdrm_iv, metadata, metadata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadMetadata()
|
||||
{
|
||||
aes_context aes;
|
||||
u32 metadata_info_size = sizeof(meta_info);
|
||||
u8 *metadata_info = (u8 *)malloc(metadata_info_size);
|
||||
u32 metadata_headers_size = sce_hdr.se_hsize - (sizeof(sce_hdr) + sce_hdr.se_meta + sizeof(meta_info));
|
||||
u8 *metadata_headers = (u8 *)malloc(metadata_headers_size);
|
||||
|
||||
// Locate and read the encrypted metadata info.
|
||||
self_f.Seek(sce_hdr.se_meta + sizeof(sce_hdr));
|
||||
self_f.Read(metadata_info, metadata_info_size);
|
||||
|
||||
// Locate and read the encrypted metadata header and section header.
|
||||
self_f.Seek(sce_hdr.se_meta + sizeof(sce_hdr) + metadata_info_size);
|
||||
self_f.Read(metadata_headers, metadata_headers_size);
|
||||
|
||||
// Find the right keyset from the key vault.
|
||||
SELF_KEY keyset = key_v.FindSelfKey(app_info.self_type, sce_hdr.se_flags, app_info.version);
|
||||
|
||||
// Copy the necessary parameters.
|
||||
u8 metadata_key[0x20];
|
||||
u8 metadata_iv[0x10];
|
||||
memcpy(metadata_key, keyset.erk, 0x20);
|
||||
memcpy(metadata_iv, keyset.riv, 0x10);
|
||||
|
||||
// Check DEBUG flag.
|
||||
if ((sce_hdr.se_flags & 0x8000) != 0x8000)
|
||||
{
|
||||
// Decrypt the NPDRM layer.
|
||||
if (!DecryptNPDRM(metadata_info, metadata_info_size))
|
||||
return false;
|
||||
|
||||
// Decrypt the metadata info.
|
||||
aes_setkey_dec(&aes, metadata_key, 256); // AES-256
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, metadata_info_size, metadata_iv, metadata_info, metadata_info);
|
||||
}
|
||||
|
||||
// Load the metadata info.
|
||||
meta_info.Load(metadata_info);
|
||||
|
||||
// If the padding is not NULL for the key or iv fields, the metadata info
|
||||
// is not properly decrypted.
|
||||
if ((meta_info.key_pad[0] != 0x00) ||
|
||||
(meta_info.iv_pad[0] != 0x00))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to decrypt metadata info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform AES-CTR encryption on the metadata headers.
|
||||
size_t ctr_nc_off = 0;
|
||||
u8 ctr_stream_block[0x10];
|
||||
aes_setkey_enc(&aes, meta_info.key, 128);
|
||||
aes_crypt_ctr(&aes, metadata_headers_size, &ctr_nc_off, meta_info.iv, ctr_stream_block, metadata_headers, metadata_headers);
|
||||
|
||||
// Load the metadata header.
|
||||
meta_hdr.Load(metadata_headers);
|
||||
|
||||
// Load the metadata section headers.
|
||||
meta_shdr.clear();
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
meta_shdr.emplace_back();
|
||||
meta_shdr.back().Load(metadata_headers + sizeof(meta_hdr) + sizeof(MetadataSectionHeader) * i);
|
||||
}
|
||||
|
||||
// Copy the decrypted data keys.
|
||||
data_keys_length = meta_hdr.key_count * 0x10;
|
||||
data_keys = (u8 *) malloc (data_keys_length);
|
||||
memcpy(data_keys, metadata_headers + sizeof(meta_hdr) + meta_hdr.section_count * sizeof(MetadataSectionHeader), data_keys_length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptData()
|
||||
{
|
||||
aes_context aes;
|
||||
|
||||
// Calculate the total data size.
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
if ((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
data_buf_length += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a buffer to store decrypted data.
|
||||
data_buf = (u8*)malloc(data_buf_length);
|
||||
|
||||
// Set initial offset.
|
||||
u32 data_buf_offset = 0;
|
||||
|
||||
// Parse the metadata section headers to find the offsets of encrypted data.
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
size_t ctr_nc_off = 0;
|
||||
u8 ctr_stream_block[0x10];
|
||||
u8 data_key[0x10];
|
||||
u8 data_iv[0x10];
|
||||
|
||||
// Check if this is an encrypted section.
|
||||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
// Make sure the key and iv are not out of boundaries.
|
||||
if((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
{
|
||||
// Get the key and iv from the previously stored key buffer.
|
||||
memcpy(data_key, data_keys + meta_shdr[i].key_idx * 0x10, 0x10);
|
||||
memcpy(data_iv, data_keys + meta_shdr[i].iv_idx * 0x10, 0x10);
|
||||
|
||||
// Allocate a buffer to hold the data.
|
||||
u8 *buf = (u8 *)malloc(meta_shdr[i].data_size);
|
||||
|
||||
// Seek to the section data offset and read the encrypted data.
|
||||
self_f.Seek(meta_shdr[i].data_offset);
|
||||
self_f.Read(buf, meta_shdr[i].data_size);
|
||||
|
||||
// Zero out our ctr nonce.
|
||||
memset(ctr_stream_block, 0, sizeof(ctr_stream_block));
|
||||
|
||||
// Perform AES-CTR encryption on the data blocks.
|
||||
aes_setkey_enc(&aes, data_key, 128);
|
||||
aes_crypt_ctr(&aes, meta_shdr[i].data_size, &ctr_nc_off, data_iv, ctr_stream_block, buf, buf);
|
||||
|
||||
// Copy the decrypted data.
|
||||
memcpy(data_buf + data_buf_offset, buf, meta_shdr[i].data_size);
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
|
||||
// Release the temporary buffer.
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
|
||||
{
|
||||
// Create a new ELF file.
|
||||
rFile e(elf.c_str(), rFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
LOG_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial offset.
|
||||
u32 data_buf_offset = 0;
|
||||
|
||||
if (isElf32)
|
||||
{
|
||||
// Write ELF header.
|
||||
WriteEhdr(e, elf32_hdr);
|
||||
|
||||
// Write program headers.
|
||||
for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
|
||||
WritePhdr(e, phdr32_arr[i]);
|
||||
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
// PHDR type.
|
||||
if (meta_shdr[i].type == 2)
|
||||
{
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr32_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Write section headers.
|
||||
if(self_hdr.se_shdroff != 0)
|
||||
{
|
||||
e.Seek(elf32_hdr.e_shoff);
|
||||
|
||||
for(u32 i = 0; i < elf32_hdr.e_shnum; ++i)
|
||||
WriteShdr(e, shdr32_arr[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Write ELF header.
|
||||
WriteEhdr(e, elf64_hdr);
|
||||
|
||||
// Write program headers.
|
||||
for(u32 i = 0; i < elf64_hdr.e_phnum; ++i)
|
||||
WritePhdr(e, phdr64_arr[i]);
|
||||
|
||||
// Write data.
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
// PHDR type.
|
||||
if (meta_shdr[i].type == 2)
|
||||
{
|
||||
// Decompress if necessary.
|
||||
if (meta_shdr[i].compressed == 2)
|
||||
{
|
||||
// Allocate a buffer for decompression.
|
||||
u8 *decomp_buf = (u8 *)malloc(phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Set up memory streams for input/output.
|
||||
wxMemoryInputStream decomp_stream_in(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
wxMemoryOutputStream decomp_stream_out;
|
||||
|
||||
// Create a Zlib stream, read the data and flush the stream.
|
||||
wxZlibInputStream* z_stream = new wxZlibInputStream(decomp_stream_in);
|
||||
z_stream->Read(decomp_stream_out);
|
||||
delete z_stream;
|
||||
|
||||
// Copy the decompressed result from the stream.
|
||||
decomp_stream_out.CopyTo(decomp_buf, phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr64_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(decomp_buf, phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Release the decompression buffer.
|
||||
free(decomp_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr64_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
}
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Write section headers.
|
||||
if(self_hdr.se_shdroff != 0)
|
||||
{
|
||||
e.Seek(elf64_hdr.e_shoff);
|
||||
|
||||
for(u32 i = 0; i < elf64_hdr.e_shnum; ++i)
|
||||
WriteShdr(e, shdr64_arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
e.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
||||
{
|
||||
// Set empty RAP key.
|
||||
u8 rap_key[0x10];
|
||||
memset(rap_key, 0, 0x10);
|
||||
|
||||
// Try to find a matching RAP file under dev_usb000.
|
||||
std::string ci_str((const char *)content_id);
|
||||
std::string rap_path(rGetCwd() + "/dev_usb000/" + ci_str + ".rap");
|
||||
|
||||
// Check if we have a valid RAP file.
|
||||
if (!rFile::Exists(rap_path))
|
||||
{
|
||||
LOG_ERROR(LOADER, "This application requires a valid RAP file for decryption!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open the RAP file and read the key.
|
||||
rFile rap_file(rap_path, rFile::read);
|
||||
|
||||
if (!rap_file.IsOpened())
|
||||
{
|
||||
LOG_ERROR(LOADER, "Failed to load RAP file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Loading RAP file %s", (ci_str + ".rap").c_str());
|
||||
rap_file.Read(rap_key, 0x10);
|
||||
rap_file.Close();
|
||||
|
||||
// Convert the RAP key.
|
||||
rap_to_rif(rap_key, npdrm_key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSelf(const std::string& path)
|
||||
{
|
||||
vfsLocalFile f(nullptr);
|
||||
|
||||
if(!f.Open(path))
|
||||
return false;
|
||||
|
||||
SceHeader hdr;
|
||||
hdr.Load(f);
|
||||
|
||||
return hdr.CheckMagic();
|
||||
}
|
||||
|
||||
bool IsSelfElf32(const std::string& path)
|
||||
{
|
||||
vfsLocalFile f(nullptr);
|
||||
|
||||
if(!f.Open(path))
|
||||
return false;
|
||||
|
||||
SceHeader hdr;
|
||||
SelfHeader sh;
|
||||
hdr.Load(f);
|
||||
sh.Load(f);
|
||||
|
||||
// Locate the class byte and check it.
|
||||
u8 elf_class[0x8];
|
||||
f.Seek(sh.se_elfoff);
|
||||
f.Read(elf_class, 0x8);
|
||||
|
||||
return (elf_class[4] == 1);
|
||||
}
|
||||
|
||||
bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
||||
{
|
||||
// Open the SELF file.
|
||||
rFile s(self);
|
||||
|
||||
if(!s.IsOpened())
|
||||
{
|
||||
LOG_ERROR(LOADER, "Could not open SELF file! (%s)", self.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the key version.
|
||||
s.Seek(0x08);
|
||||
u16 key_version;
|
||||
s.Read(&key_version, sizeof(key_version));
|
||||
|
||||
// Check for DEBUG version.
|
||||
if(swap16(key_version) == 0x8000)
|
||||
{
|
||||
LOG_WARNING(LOADER, "Debug SELF detected! Removing fake header...");
|
||||
|
||||
// Get the real elf offset.
|
||||
s.Seek(0x10);
|
||||
u64 elf_offset;
|
||||
s.Read(&elf_offset, sizeof(elf_offset));
|
||||
|
||||
// Start at the real elf offset.
|
||||
elf_offset = swap64(elf_offset);
|
||||
s.Seek(elf_offset);
|
||||
|
||||
// Write the real ELF file back.
|
||||
rFile e(elf, rFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
LOG_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the data.
|
||||
char buf[2048];
|
||||
while (ssize_t size = s.Read(buf, 2048))
|
||||
e.Write(buf, size);
|
||||
|
||||
e.Close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Leave the file untouched.
|
||||
s.Seek(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool DecryptSelf(const std::string& elf, const std::string& self)
|
||||
{
|
||||
// Check for a debug SELF first.
|
||||
if (!CheckDebugSelf(self, elf))
|
||||
{
|
||||
// Set a virtual pointer to the SELF file.
|
||||
vfsLocalFile self_vf(nullptr);
|
||||
|
||||
if (!self_vf.Open(self))
|
||||
return false;
|
||||
|
||||
// Check the ELF file class (32 or 64 bit).
|
||||
bool isElf32 = IsSelfElf32(self);
|
||||
|
||||
// Start the decrypter on this SELF file.
|
||||
SELFDecrypter self_dec(self_vf);
|
||||
|
||||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file headers!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file metadata!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decrypt the SELF file data.
|
||||
if (!self_dec.DecryptData())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to decrypt SELF file data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make a new ELF file from this SELF.
|
||||
if (!self_dec.MakeElf(elf, isElf32))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to make ELF file from SELF!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Loader/SELF.h"
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
struct AppInfo
|
||||
{
|
||||
u64 authid;
|
||||
u32 vendor_id;
|
||||
u32 self_type;
|
||||
u64 version;
|
||||
u64 padding;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
padding = Read64(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "AuthID: 0x%llx", authid);
|
||||
LOG_NOTICE(LOADER, "VendorID: 0x%08x", vendor_id);
|
||||
LOG_NOTICE(LOADER, "SELF type: 0x%08x", self_type);
|
||||
LOG_NOTICE(LOADER, "Version: 0x%llx", version);
|
||||
}
|
||||
};
|
||||
|
||||
struct SectionInfo
|
||||
{
|
||||
u64 offset;
|
||||
u64 size;
|
||||
u32 compressed;
|
||||
u32 unknown1;
|
||||
u32 unknown2;
|
||||
u32 encrypted;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read32(f);
|
||||
encrypted = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Offset: 0x%llx", offset);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%llx", size);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
}
|
||||
};
|
||||
|
||||
struct SCEVersionInfo
|
||||
{
|
||||
u32 subheader_type;
|
||||
u32 present;
|
||||
u32 size;
|
||||
u32 unknown;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Sub-header type: 0x%08x", subheader_type);
|
||||
LOG_NOTICE(LOADER, "Present: 0x%08x", present);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%08x", unknown);
|
||||
}
|
||||
};
|
||||
|
||||
struct ControlInfo
|
||||
{
|
||||
u32 type;
|
||||
u32 size;
|
||||
u64 next;
|
||||
|
||||
union {
|
||||
// type 1 0x30 bytes
|
||||
struct {
|
||||
u32 ctrl_flag1;
|
||||
u32 unknown1;
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
u32 unknown6;
|
||||
u32 unknown7;
|
||||
} control_flags;
|
||||
|
||||
// type 2 0x30 bytes
|
||||
struct {
|
||||
u8 digest[20];
|
||||
u64 unknown;
|
||||
} file_digest_30;
|
||||
|
||||
// type 2 0x40 bytes
|
||||
struct {
|
||||
u8 digest1[20];
|
||||
u8 digest2[20];
|
||||
u64 unknown;
|
||||
} file_digest_40;
|
||||
|
||||
// type 3 0x90 bytes
|
||||
struct {
|
||||
u32 magic;
|
||||
u32 unknown1;
|
||||
u32 license;
|
||||
u32 type;
|
||||
u8 content_id[48];
|
||||
u8 digest[16];
|
||||
u8 invdigest[16];
|
||||
u8 xordigest[16];
|
||||
u64 unknown2;
|
||||
u64 unknown3;
|
||||
} npdrm;
|
||||
};
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
next = Read64(f);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
control_flags.ctrl_flag1 = Read32(f);
|
||||
control_flags.unknown1 = Read32(f);
|
||||
control_flags.unknown2 = Read32(f);
|
||||
control_flags.unknown3 = Read32(f);
|
||||
control_flags.unknown4 = Read32(f);
|
||||
control_flags.unknown5 = Read32(f);
|
||||
control_flags.unknown6 = Read32(f);
|
||||
control_flags.unknown7 = Read32(f);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
f.Read(file_digest_30.digest, 20);
|
||||
file_digest_30.unknown = Read64(f);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
f.Read(file_digest_40.digest1, 20);
|
||||
f.Read(file_digest_40.digest2, 20);
|
||||
file_digest_40.unknown = Read64(f);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
npdrm.magic = Read32(f);
|
||||
npdrm.unknown1 = Read32(f);
|
||||
npdrm.license = Read32(f);
|
||||
npdrm.type = Read32(f);
|
||||
f.Read(npdrm.content_id, 48);
|
||||
f.Read(npdrm.digest, 16);
|
||||
f.Read(npdrm.invdigest, 16);
|
||||
f.Read(npdrm.xordigest, 16);
|
||||
npdrm.unknown2 = Read64(f);
|
||||
npdrm.unknown3 = Read64(f);
|
||||
}
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", control_flags.unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", control_flags.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", control_flags.unknown3);
|
||||
LOG_NOTICE(LOADER, "Unknown4: 0x%08x", control_flags.unknown4);
|
||||
LOG_NOTICE(LOADER, "Unknown5: 0x%08x", control_flags.unknown5);
|
||||
LOG_NOTICE(LOADER, "Unknown6: 0x%08x", control_flags.unknown6);
|
||||
LOG_NOTICE(LOADER, "Unknown7: 0x%08x", control_flags.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
std::string digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += fmt::Format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
std::string digest_str1;
|
||||
std::string digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += fmt::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += fmt::Format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest2: %s", digest_str2.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
std::string contentid_str;
|
||||
std::string digest_str;
|
||||
std::string invdigest_str;
|
||||
std::string xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += fmt::Format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
digest_str += fmt::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += fmt::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += fmt::Format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", npdrm.unknown1);
|
||||
LOG_NOTICE(LOADER, "License: 0x%08x", npdrm.license);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", npdrm.type);
|
||||
LOG_NOTICE(LOADER, "ContentID: %s", contentid_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Inverse digest: %s", invdigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "XOR digest: %s", xordigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%llx", npdrm.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct MetadataInfo
|
||||
{
|
||||
u8 key[0x10];
|
||||
u8 key_pad[0x10];
|
||||
u8 iv[0x10];
|
||||
u8 iv_pad[0x10];
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
memcpy(iv_pad, in + 0x30, 0x10);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
std::string key_str;
|
||||
std::string key_pad_str;
|
||||
std::string iv_str;
|
||||
std::string iv_pad_str;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
key_str += fmt::Format("%02x", key[i]);
|
||||
key_pad_str += fmt::Format("%02x", key_pad[i]);
|
||||
iv_str += fmt::Format("%02x", iv[i]);
|
||||
iv_pad_str += fmt::Format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Key: %s", key_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Key pad: %s", key_pad_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV: %s", iv_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV pad: %s", iv_pad_str.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
struct MetadataHeader
|
||||
{
|
||||
u64 signature_input_length;
|
||||
u32 unknown1;
|
||||
u32 section_count;
|
||||
u32 key_count;
|
||||
u32 opt_header_size;
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
memcpy(&key_count, in + 16, 4);
|
||||
memcpy(&opt_header_size, in + 20, 4);
|
||||
memcpy(&unknown2, in + 24, 4);
|
||||
memcpy(&unknown3, in + 28, 4);
|
||||
|
||||
// Endian swap.
|
||||
signature_input_length = swap64(signature_input_length);
|
||||
unknown1 = swap32(unknown1);
|
||||
section_count = swap32(section_count);
|
||||
key_count = swap32(key_count);
|
||||
opt_header_size = swap32(opt_header_size);
|
||||
unknown2 = swap32(unknown2);
|
||||
unknown3 = swap32(unknown3);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Signature input length: 0x%llx", signature_input_length);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Section count: 0x%08x", section_count);
|
||||
LOG_NOTICE(LOADER, "Key count: 0x%08x", key_count);
|
||||
LOG_NOTICE(LOADER, "Optional header size: 0x%08x", opt_header_size);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", unknown3);
|
||||
}
|
||||
};
|
||||
|
||||
struct MetadataSectionHeader
|
||||
{
|
||||
u64 data_offset;
|
||||
u64 data_size;
|
||||
u32 type;
|
||||
u32 program_idx;
|
||||
u32 hashed;
|
||||
u32 sha1_idx;
|
||||
u32 encrypted;
|
||||
u32 key_idx;
|
||||
u32 iv_idx;
|
||||
u32 compressed;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
memcpy(&compressed, in + 44, 4);
|
||||
|
||||
// Endian swap.
|
||||
data_offset = swap64(data_offset);
|
||||
data_size = swap64(data_size);
|
||||
type = swap32(type);
|
||||
program_idx = swap32(program_idx);
|
||||
hashed = swap32(hashed);
|
||||
sha1_idx = swap32(sha1_idx);
|
||||
encrypted = swap32(encrypted);
|
||||
key_idx = swap32(key_idx);
|
||||
iv_idx = swap32(iv_idx);
|
||||
compressed = swap32(compressed);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Data offset: 0x%llx", data_offset);
|
||||
LOG_NOTICE(LOADER, "Data size: 0x%llx", data_size);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Program index: 0x%08x", program_idx);
|
||||
LOG_NOTICE(LOADER, "Hashed: 0x%08x", hashed);
|
||||
LOG_NOTICE(LOADER, "SHA1 index: 0x%08x", sha1_idx);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
LOG_NOTICE(LOADER, "Key index: 0x%08x", key_idx);
|
||||
LOG_NOTICE(LOADER, "IV index: 0x%08x", iv_idx);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
}
|
||||
};
|
||||
|
||||
struct SectionHash {
|
||||
u8 sha1[20];
|
||||
u8 padding[12];
|
||||
u8 hmac_key[64];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(sha1, 20);
|
||||
f.Read(padding, 12);
|
||||
f.Read(hmac_key, 64);
|
||||
}
|
||||
};
|
||||
|
||||
struct CapabilitiesInfo
|
||||
{
|
||||
u32 type;
|
||||
u32 capabilities_size;
|
||||
u32 next;
|
||||
u32 unknown1;
|
||||
u64 unknown2;
|
||||
u64 unknown3;
|
||||
u64 flags;
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read64(f);
|
||||
unknown3 = Read64(f);
|
||||
flags = Read64(f);
|
||||
unknown4 = Read32(f);
|
||||
unknown5 = Read32(f);
|
||||
}
|
||||
};
|
||||
|
||||
struct Signature
|
||||
{
|
||||
u8 r[21];
|
||||
u8 s[21];
|
||||
u8 padding[6];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(r, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(padding, 6);
|
||||
}
|
||||
};
|
||||
|
||||
struct SelfSection
|
||||
{
|
||||
u8 *data;
|
||||
u64 size;
|
||||
u64 offset;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
offset = Read64(f);
|
||||
}
|
||||
};
|
||||
|
||||
class SELFDecrypter
|
||||
{
|
||||
// Main SELF file stream.
|
||||
vfsStream& self_f;
|
||||
|
||||
// SCE, SELF and APP headers.
|
||||
SceHeader sce_hdr;
|
||||
SelfHeader self_hdr;
|
||||
AppInfo app_info;
|
||||
|
||||
// ELF64 header and program header/section header arrays.
|
||||
Elf64_Ehdr elf64_hdr;
|
||||
std::vector<Elf64_Shdr> shdr64_arr;
|
||||
std::vector<Elf64_Phdr> phdr64_arr;
|
||||
|
||||
// ELF32 header and program header/section header arrays.
|
||||
Elf32_Ehdr elf32_hdr;
|
||||
std::vector<Elf32_Shdr> shdr32_arr;
|
||||
std::vector<Elf32_Phdr> phdr32_arr;
|
||||
|
||||
// Decryption info structs.
|
||||
std::vector<SectionInfo> secinfo_arr;
|
||||
SCEVersionInfo scev_info;
|
||||
std::vector<ControlInfo> ctrlinfo_arr;
|
||||
|
||||
// Metadata structs.
|
||||
MetadataInfo meta_info;
|
||||
MetadataHeader meta_hdr;
|
||||
std::vector<MetadataSectionHeader> meta_shdr;
|
||||
|
||||
// Internal data buffers.
|
||||
u8 *data_keys;
|
||||
u32 data_keys_length;
|
||||
u8 *data_buf;
|
||||
u32 data_buf_length;
|
||||
|
||||
// Main key vault instance.
|
||||
KeyVault key_v;
|
||||
|
||||
public:
|
||||
SELFDecrypter(vfsStream& s);
|
||||
bool MakeElf(const std::string& elf, bool isElf32);
|
||||
bool LoadHeaders(bool isElf32);
|
||||
void ShowHeaders(bool isElf32);
|
||||
bool LoadMetadata();
|
||||
bool DecryptData();
|
||||
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
|
||||
bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
|
||||
};
|
||||
|
||||
extern bool IsSelf(const std::string& path);
|
||||
extern bool IsSelfElf32(const std::string& path);
|
||||
extern bool CheckDebugSelf(const std::string& self, const std::string& elf);
|
||||
extern bool DecryptSelf(const std::string& elf, const std::string& self);
|
||||
@@ -0,0 +1,147 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Endian swap auxiliary functions.
|
||||
u16 swap16(u16 i)
|
||||
{
|
||||
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
|
||||
}
|
||||
|
||||
u32 swap32(u32 i)
|
||||
{
|
||||
return ((i & 0xFF000000) >> 24) | ((i & 0xFF0000) >> 8) | ((i & 0xFF00) << 8) | ((i & 0xFF) << 24);
|
||||
}
|
||||
|
||||
u64 swap64(u64 i)
|
||||
{
|
||||
return ((i & 0x00000000000000ff) << 56) | ((i & 0x000000000000ff00) << 40) |
|
||||
((i & 0x0000000000ff0000) << 24) | ((i & 0x00000000ff000000) << 8) |
|
||||
((i & 0x000000ff00000000) >> 8) | ((i & 0x0000ff0000000000) >> 24) |
|
||||
((i & 0x00ff000000000000) >> 40) | ((i & 0xff00000000000000) >> 56);
|
||||
}
|
||||
|
||||
void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
dest[i] = src1[i] ^ src2[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str)
|
||||
{
|
||||
u32 length = strlen(hex_str);
|
||||
u64 tmp = 0;
|
||||
u64 result = 0;
|
||||
char c;
|
||||
|
||||
while (length--)
|
||||
{
|
||||
c = *hex_str++;
|
||||
if((c >= '0') && (c <= '9'))
|
||||
tmp = c - '0';
|
||||
else if((c >= 'a') && (c <= 'f'))
|
||||
tmp = c - 'a' + 10;
|
||||
else if((c >= 'A') && (c <= 'F'))
|
||||
tmp = c - 'A' + 10;
|
||||
else
|
||||
tmp = 0;
|
||||
result |= (tmp << (length * 4));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str)
|
||||
{
|
||||
u32 str_length = strlen(hex_str);
|
||||
u32 data_length = str_length / 2;
|
||||
char tmp_buf[3] = {0, 0, 0};
|
||||
|
||||
// Don't convert if the string length is odd.
|
||||
if (!(str_length % 2))
|
||||
{
|
||||
u8 *out = (u8 *) malloc (str_length * sizeof(u8));
|
||||
u8 *pos = out;
|
||||
|
||||
while (str_length--)
|
||||
{
|
||||
tmp_buf[0] = *hex_str++;
|
||||
tmp_buf[1] = *hex_str++;
|
||||
|
||||
*pos++ = (u8)(hex_to_u64(tmp_buf) & 0xFF);
|
||||
}
|
||||
|
||||
// Copy back to our array.
|
||||
memcpy(data, out, data_length);
|
||||
}
|
||||
}
|
||||
|
||||
// Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC).
|
||||
void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len)
|
||||
{
|
||||
aes_context ctx;
|
||||
aes_setkey_dec(&ctx, key, 128);
|
||||
aes_crypt_cbc(&ctx, AES_DECRYPT, len, iv, in, out);
|
||||
|
||||
// Reset the IV.
|
||||
memset(iv, 0, 0x10);
|
||||
}
|
||||
|
||||
void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out)
|
||||
{
|
||||
aes_context ctx;
|
||||
aes_setkey_enc(&ctx, key, 128);
|
||||
aes_crypt_ecb(&ctx, AES_ENCRYPT, in, out);
|
||||
}
|
||||
|
||||
bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash)
|
||||
{
|
||||
unsigned char *out = new unsigned char[key_len];
|
||||
|
||||
sha1_hmac(key, key_len, in, in_len, out);
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
{
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash)
|
||||
{
|
||||
unsigned char *out = new unsigned char[key_len];
|
||||
|
||||
aes_context ctx;
|
||||
aes_setkey_enc(&ctx, key, 128);
|
||||
aes_cmac(&ctx, in_len, in, out);
|
||||
|
||||
for (int i = 0; i < key_len; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
{
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "lz.h"
|
||||
// Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC).
|
||||
int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
||||
{
|
||||
return decompress(out,in,size);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
|
||||
// Auxiliary functions (endian swap and xor).
|
||||
u16 swap16(u16 i);
|
||||
u32 swap32(u32 i);
|
||||
u64 swap64(u64 i);
|
||||
void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size);
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str);
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str);
|
||||
|
||||
// Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC).
|
||||
void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len);
|
||||
void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out);
|
||||
bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash);
|
||||
bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash);
|
||||
|
||||
// Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC).
|
||||
int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size);
|
||||
@@ -0,0 +1,137 @@
|
||||
#pragma once
|
||||
#include "Emu/CPU/CPUDecoder.h"
|
||||
#include "ARMv7Opcodes.h"
|
||||
|
||||
|
||||
class ARMv7Decoder : public CPUDecoder
|
||||
{
|
||||
ARMv7Opcodes& m_op;
|
||||
u8 m_last_instr_size;
|
||||
|
||||
public:
|
||||
ARMv7Decoder(ARMv7Opcodes& op) : m_op(op)
|
||||
{
|
||||
}
|
||||
|
||||
u32 branchTarget(u32 imm)
|
||||
{
|
||||
return imm << 1;
|
||||
}
|
||||
|
||||
virtual u8 DecodeMemory(const u64 address)
|
||||
{
|
||||
using namespace ARMv7_opcodes;
|
||||
const u16 code0 = Memory.Read16(address);
|
||||
const u16 code1 = Memory.Read16(address + 2);
|
||||
|
||||
switch(code0 >> 12) //15 - 12
|
||||
{
|
||||
case T1_CBZ:
|
||||
switch((code0 >> 10) & 0x1)
|
||||
{
|
||||
case 0:
|
||||
switch((code0 >> 8) & 0x1)
|
||||
{
|
||||
case 1:
|
||||
m_op.CBZ((code0 >> 11) & 0x1, branchTarget((((code0 >> 9) & 0x1) << 5) | (code0 >> 3) & 0x1f), code0 & 0x7, 2);
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T1_B:
|
||||
m_op.B((code0 >> 8) & 0xf, branchTarget(code0 & 0xff), 2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
switch(code0 >> 11) //15 - 11
|
||||
{
|
||||
case T2_B:
|
||||
m_op.B(0xf, branchTarget(code0 & 0xfff), 2);
|
||||
return 2;
|
||||
|
||||
case T3_B:
|
||||
{
|
||||
u8 S = (code0 >> 10) & 0x1;
|
||||
u8 J1 = (code1 >> 13) & 0x1;
|
||||
u8 J2 = (code1 >> 11) & 0x1;
|
||||
u8 I1 = 1 - (J1 ^ S);
|
||||
u8 I2 = 1 - (J2 ^ S);
|
||||
u16 imm11 = code1 & 0x7ff;
|
||||
u32 imm32 = 0;
|
||||
|
||||
switch(code1 >> 14)
|
||||
{
|
||||
case 2: //B
|
||||
{
|
||||
u8 cond;
|
||||
switch((code1 >> 12) & 0x1)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
cond = (code0 >> 6) & 0xf;
|
||||
u32 imm6 = code0 & 0x3f;
|
||||
imm32 = sign<19, u32>((S << 19) | (I1 << 18) | (I2 << 17) | (imm6 << 11) | imm11);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
cond = 0xf;
|
||||
u32 imm10 = code0 & 0x7ff;
|
||||
imm32 = sign<23, u32>((S << 23) | (I1 << 22) | (I2 << 21) | (imm10 << 11) | imm11);
|
||||
break;
|
||||
}
|
||||
|
||||
m_op.B(cond, branchTarget(imm32), 4);
|
||||
}
|
||||
return 4;
|
||||
|
||||
case 3: //BL
|
||||
switch((code1 >> 12) & 0x1)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
u32 imm10 = code0 & 0x7ff;
|
||||
imm32 = sign<23, u32>((S << 23) | (I1 << 22) | (I2 << 21) | (imm10 << 11) | imm11);
|
||||
m_op.BL(branchTarget(imm32), 4);
|
||||
return 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch(code0 >> 9)
|
||||
{
|
||||
case T1_PUSH:
|
||||
m_op.PUSH((((code0 >> 8) & 0x1) << 14) | (code0 & 0xff));
|
||||
return 2;
|
||||
|
||||
case T1_POP:
|
||||
m_op.POP((((code0 >> 8) & 0x1) << 15) | (code0 & 0xff));
|
||||
return 2;
|
||||
}
|
||||
|
||||
switch(code0)
|
||||
{
|
||||
case T2_PUSH:
|
||||
m_op.PUSH(code1);
|
||||
return 4;
|
||||
|
||||
case T2_POP:
|
||||
m_op.POP(code1);
|
||||
return 4;
|
||||
|
||||
case T1_NOP:
|
||||
m_op.NOP();
|
||||
return 2;
|
||||
}
|
||||
|
||||
m_op.UNK(code0, code1);
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
#pragma once
|
||||
#include "Emu/ARMv7/ARMv7Opcodes.h"
|
||||
#include "Emu/CPU/CPUDisAsm.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
|
||||
static const char* g_arm_cond_name[16] =
|
||||
{
|
||||
"eq", "ne", "cs", "cc",
|
||||
"mi", "pl", "vs", "vc",
|
||||
"hi", "ls", "ge", "lt",
|
||||
"gt", "le", "al", "al",
|
||||
};
|
||||
|
||||
class ARMv7DisAsm
|
||||
: public CPUDisAsm
|
||||
, public ARMv7Opcodes
|
||||
{
|
||||
public:
|
||||
ARMv7DisAsm(CPUDisAsmMode mode) : CPUDisAsm(mode)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual u32 DisAsmBranchTarget(const s32 imm)
|
||||
{
|
||||
return dump_pc + imm;
|
||||
}
|
||||
|
||||
std::string GetRegsListString(u16 regs_list)
|
||||
{
|
||||
std::string regs_str;
|
||||
|
||||
for(u16 mask=0x1, i=0; mask; mask <<= 1, i++)
|
||||
{
|
||||
if(regs_list & mask)
|
||||
{
|
||||
if(!regs_str.empty())
|
||||
{
|
||||
regs_str += ", ";
|
||||
}
|
||||
|
||||
regs_str += g_arm_reg_name[i];
|
||||
}
|
||||
}
|
||||
|
||||
return regs_str;
|
||||
}
|
||||
|
||||
void NULL_OP()
|
||||
{
|
||||
Write("null");
|
||||
}
|
||||
|
||||
void PUSH(u16 regs_list)
|
||||
{
|
||||
Write(fmt::Format("push {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
void POP(u16 regs_list)
|
||||
{
|
||||
Write(fmt::Format("pop {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
void NOP()
|
||||
{
|
||||
Write("nop");
|
||||
}
|
||||
|
||||
void B(u8 cond, u32 imm, u8 intstr_size)
|
||||
{
|
||||
if((cond & 0xe) == 0xe)
|
||||
{
|
||||
Write(fmt::Format("b 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
Write(fmt::Format("b[%s] 0x%x", g_arm_cond_name[cond], DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void CBZ(u8 op, u32 imm, u8 rn, u8 intstr_size)
|
||||
{
|
||||
Write(fmt::Format("cb%sz 0x%x,%s", (op ? "n" : ""), DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
}
|
||||
|
||||
void BL(u32 imm, u8 intstr_size)
|
||||
{
|
||||
Write(fmt::Format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
|
||||
void UNK(const u16 code0, const u16 code1)
|
||||
{
|
||||
Write(fmt::Format("Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,322 @@
|
||||
#pragma once
|
||||
#include "Emu/ARMv7/ARMv7Opcodes.h"
|
||||
|
||||
class ARMv7Interpreter : public ARMv7Opcodes
|
||||
{
|
||||
ARMv7Thread& CPU;
|
||||
|
||||
public:
|
||||
ARMv7Interpreter(ARMv7Thread& cpu) : CPU(cpu)
|
||||
{
|
||||
}
|
||||
|
||||
enum SRType
|
||||
{
|
||||
SRType_None,
|
||||
SRType_LSL,
|
||||
SRType_LSR,
|
||||
SRType_ASR,
|
||||
SRType_ROR,
|
||||
SRType_RRX,
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool IsZero(T x)
|
||||
{
|
||||
return x == T(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool IsOnes(T x)
|
||||
{
|
||||
return x == ~T(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
u8 IsZeroBit(T x)
|
||||
{
|
||||
return IsZero(x) ? 1 : 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool IsOnesBit(T x, u8 len = sizeof(T) * 8)
|
||||
{
|
||||
return IsOnes(x) ? 1 : 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
u8 BitCount(T x, u8 len = sizeof(T) * 8)
|
||||
{
|
||||
u8 result = 0;
|
||||
|
||||
for(u8 mask=1 << (len - 1); mask; mask >>= 1)
|
||||
{
|
||||
if(x & mask) result++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
s8 LowestSetBit(T x, u8 len = sizeof(T) * 8)
|
||||
{
|
||||
if(!x) return len;
|
||||
|
||||
u8 result = 0;
|
||||
|
||||
for(T mask=1, i=0; i<len && (x & mask) == 0; mask <<= 1, i++)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
s8 HighestSetBit(T x, u8 len = sizeof(T) * 8)
|
||||
{
|
||||
if(!x) return -1;
|
||||
|
||||
u8 result = len;
|
||||
|
||||
for(T mask=T(1) << (len - 1); (x & mask) == 0; mask >>= 1)
|
||||
{
|
||||
result--;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
s8 CountLeadingZeroBits(T x, u8 len = sizeof(T) * 8)
|
||||
{
|
||||
return len - 1 - HighestSetBit(x, len);
|
||||
}
|
||||
|
||||
SRType DecodeImmShift(u8 type, u8 imm5, uint* shift_n)
|
||||
{
|
||||
SRType shift_t = SRType_None;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: shift_t = SRType_LSL; if(shift_n) *shift_n = imm5; break;
|
||||
case 1: shift_t = SRType_LSR; if(shift_n) *shift_n = imm5 == 0 ? 32 : imm5; break;
|
||||
case 2: shift_t = SRType_ASR; if(shift_n) *shift_n = imm5 == 0 ? 32 : imm5; break;
|
||||
case 3:
|
||||
if(imm5 == 0)
|
||||
{
|
||||
shift_t = SRType_RRX; if(shift_n) *shift_n = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
shift_t = SRType_ROR; if(shift_n) *shift_n = imm5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return shift_t;
|
||||
}
|
||||
|
||||
SRType DecodeRegShift(u8 type)
|
||||
{
|
||||
SRType shift_t = SRType_None;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: shift_t = SRType_LSL; break;
|
||||
case 1: shift_t = SRType_LSR; break;
|
||||
case 2: shift_t = SRType_ASR; break;
|
||||
case 3: shift_t = SRType_ROR; break;
|
||||
}
|
||||
|
||||
return shift_t;
|
||||
}
|
||||
|
||||
u32 LSL_C(u32 x, int shift, bool& carry_out)
|
||||
{
|
||||
u32 extended_x = x << shift;
|
||||
carry_out = (extended_x >> 31) ? 1 : 0;
|
||||
return extended_x & ~(1 << 31);
|
||||
}
|
||||
|
||||
u32 LSL(u32 x, int shift)
|
||||
{
|
||||
if(!shift) return x;
|
||||
bool carry_out;
|
||||
return LSL_C(x, shift, carry_out);
|
||||
}
|
||||
|
||||
u32 LSR_C(u32 x, int shift, bool& carry_out)
|
||||
{
|
||||
carry_out = (x >> (shift - 1)) & 0x1;
|
||||
return x >> shift;
|
||||
}
|
||||
|
||||
u32 LSR(u32 x, int shift)
|
||||
{
|
||||
if(!shift) return x;
|
||||
bool carry_out;
|
||||
return LSR_C(x, shift, carry_out);
|
||||
}
|
||||
|
||||
s32 ASR_C(s32 x, int shift, bool& carry_out)
|
||||
{
|
||||
carry_out = (x >> (shift - 1)) & 0x1;
|
||||
return x >> shift;
|
||||
}
|
||||
|
||||
s32 ASR(s32 x, int shift)
|
||||
{
|
||||
if(!shift) return x;
|
||||
bool carry_out;
|
||||
return ASR_C(x, shift, carry_out);
|
||||
}
|
||||
|
||||
u32 ROR_C(u32 x, int shift, bool& carry_out)
|
||||
{
|
||||
u32 result = LSR(x, shift) | LSL(x, 32 - shift);
|
||||
carry_out = (result >> 30) & 0x1;
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 ROR(s32 x, int shift)
|
||||
{
|
||||
if(!shift) return x;
|
||||
bool carry_out;
|
||||
return ROR_C(x, shift, carry_out);
|
||||
}
|
||||
|
||||
template<typename T> T RRX_C(T x, bool carry_in, bool& carry_out)
|
||||
{
|
||||
carry_out = x & 0x1;
|
||||
return ((u32)carry_in << 31) | (x & 0x7ffffffe);
|
||||
}
|
||||
|
||||
s32 RRX(s32 x, int shift)
|
||||
{
|
||||
if(!shift) return x;
|
||||
bool carry_out;
|
||||
return RRX_C(x, shift, carry_out);
|
||||
}
|
||||
|
||||
template<typename T> T Shift_C(T value, SRType type, uint amount, bool carry_in, bool& carry_out)
|
||||
{
|
||||
if(amount)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SRType_LSL: return LSL_C(value, amount, carry_out);
|
||||
case SRType_LSR: return LSR_C(value, amount, carry_out);
|
||||
case SRType_ASR: return ASR_C(value, amount, carry_out);
|
||||
case SRType_ROR: return ROR_C(value, amount, carry_out);
|
||||
case SRType_RRX: return RRX_C(value, amount, carry_out);
|
||||
}
|
||||
}
|
||||
|
||||
carry_out = carry_in;
|
||||
return value;
|
||||
}
|
||||
|
||||
template<typename T> T Shift(T value, SRType type, uint amount, bool carry_in)
|
||||
{
|
||||
bool carry_out;
|
||||
return Shift_C(value, type, amount, carry_in, carry_out);
|
||||
}
|
||||
|
||||
template<typename T> T AddWithCarry(T x, T y, bool carry_in, bool& carry_out, bool& overflow)
|
||||
{
|
||||
uint unsigned_sum = (uint)x + (uint)y + (uint)carry_in;
|
||||
int signed_sum = (int)x + (int)y + (int)carry_in;
|
||||
T result = unsigned_sum & ~(T(1) << (sizeof(T) - 1));
|
||||
carry_out = (uint)result != unsigned_sum;
|
||||
overflow = (int)result != signed_sum;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ConditionPassed(u8 cond)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
switch(cond >> 1)
|
||||
{
|
||||
case 0: result = CPU.APSR.Z == 1; break;
|
||||
case 1: result = CPU.APSR.C == 1; break;
|
||||
case 2: result = CPU.APSR.N == 1; break;
|
||||
case 3: result = CPU.APSR.V == 1; break;
|
||||
case 4: result = CPU.APSR.C == 1 && CPU.APSR.Z == 0; break;
|
||||
case 5: result = CPU.APSR.N == CPU.APSR.V; break;
|
||||
case 6: result = CPU.APSR.N == CPU.APSR.V && CPU.APSR.Z == 0; break;
|
||||
case 7: return true;
|
||||
}
|
||||
|
||||
if(cond & 0x1)
|
||||
{
|
||||
return !result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected:
|
||||
void NULL_OP()
|
||||
{
|
||||
LOG_ERROR(HLE, "null");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
void NOP()
|
||||
{
|
||||
}
|
||||
|
||||
void PUSH(u16 regs_list)
|
||||
{
|
||||
for(u16 mask=0x1, i=0; mask; mask <<= 1, i++)
|
||||
{
|
||||
if(regs_list & mask)
|
||||
{
|
||||
CPU.SP -= 4;
|
||||
Memory.Write32(CPU.SP, CPU.read_gpr(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void POP(u16 regs_list)
|
||||
{
|
||||
for(u16 mask=(0x1 << 15), i=15; mask; mask >>= 1, i--)
|
||||
{
|
||||
if(regs_list & mask)
|
||||
{
|
||||
CPU.write_gpr(i, Memory.Read32(CPU.SP));
|
||||
CPU.SP += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void B(u8 cond, u32 imm, u8 intstr_size)
|
||||
{
|
||||
if(ConditionPassed(cond))
|
||||
{
|
||||
CPU.SetBranch(CPU.PC + intstr_size + imm);
|
||||
}
|
||||
}
|
||||
|
||||
void CBZ(u8 op, u32 imm, u8 rn, u8 intstr_size)
|
||||
{
|
||||
if((CPU.GPR[rn] == 0) ^ op)
|
||||
{
|
||||
CPU.SetBranch(CPU.PC + intstr_size + imm);
|
||||
}
|
||||
}
|
||||
|
||||
void BL(u32 imm, u8 intstr_size)
|
||||
{
|
||||
CPU.LR = (CPU.PC + intstr_size) | 1;
|
||||
CPU.SetBranch(CPU.PC + intstr_size + imm);
|
||||
}
|
||||
|
||||
void UNK(const u16 code0, const u16 code1)
|
||||
{
|
||||
LOG_ERROR(HLE, "Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1);
|
||||
Emu.Pause();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
static const char* g_arm_reg_name[16] =
|
||||
{
|
||||
"r0", "r1", "r2", "r3",
|
||||
"r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11",
|
||||
"r12", "sp", "lr", "pc",
|
||||
};
|
||||
|
||||
namespace ARMv7_opcodes
|
||||
{
|
||||
enum ARMv7_T1Opcodes
|
||||
{
|
||||
T1_CBZ = 0xb,
|
||||
T1_B = 0xd,
|
||||
T1_PUSH = 0x1d,
|
||||
T1_POP = 0x5e,
|
||||
T1_NOP = 0xBF00,
|
||||
};
|
||||
|
||||
enum ARMv7_T2Opcodes
|
||||
{
|
||||
T2_B = 0x1c,
|
||||
T2_PUSH = 0xe92d,
|
||||
T2_POP = 0xe8bd,
|
||||
};
|
||||
|
||||
enum ARMv7_T3Opcodes
|
||||
{
|
||||
T3_B = 0x1e,
|
||||
};
|
||||
}
|
||||
|
||||
class ARMv7Opcodes
|
||||
{
|
||||
public:
|
||||
virtual void NULL_OP() = 0;
|
||||
virtual void NOP() = 0;
|
||||
|
||||
virtual void PUSH(u16 regs_list) = 0;
|
||||
virtual void POP(u16 regs_list) = 0;
|
||||
|
||||
virtual void B(u8 cond, u32 imm, u8 intstr_size) = 0;
|
||||
virtual void CBZ(u8 op, u32 imm, u8 rn, u8 intstr_size) = 0;
|
||||
virtual void BL(u32 imm, u8 intstr_size)=0;
|
||||
|
||||
virtual void UNK(const u16 code0, const u16 code1) = 0;
|
||||
};
|
||||
@@ -0,0 +1,107 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPCThread.h"
|
||||
|
||||
#include "ARMv7Thread.h"
|
||||
#include "ARMv7Decoder.h"
|
||||
#include "ARMv7DisAsm.h"
|
||||
#include "ARMv7Interpreter.h"
|
||||
|
||||
ARMv7Thread::ARMv7Thread() : CPUThread(CPU_THREAD_ARMv7)
|
||||
{
|
||||
}
|
||||
|
||||
void ARMv7Thread::InitRegs()
|
||||
{
|
||||
memset(GPR, 0, sizeof(GPR[0]) * 15);
|
||||
APSR.APSR = 0;
|
||||
IPSR.IPSR = 0;
|
||||
SP = m_stack_point;
|
||||
}
|
||||
|
||||
void ARMv7Thread::InitStack()
|
||||
{
|
||||
if(!m_stack_addr)
|
||||
{
|
||||
m_stack_size = 0x10000;
|
||||
m_stack_addr = Memory.Alloc(0x10000, 1);
|
||||
}
|
||||
|
||||
m_stack_point = m_stack_addr + m_stack_size;
|
||||
}
|
||||
|
||||
u64 ARMv7Thread::GetFreeStackSize() const
|
||||
{
|
||||
return SP - GetStackAddr();
|
||||
}
|
||||
|
||||
void ARMv7Thread::SetArg(const uint pos, const u64 arg)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
std::string ARMv7Thread::RegsToString()
|
||||
{
|
||||
std::string result = "Registers:\n=========\n";
|
||||
for(int i=0; i<15; ++i)
|
||||
{
|
||||
result += fmt::Format("%s\t= 0x%08x\n", g_arm_reg_name[i], GPR[i]);
|
||||
}
|
||||
|
||||
result += fmt::Format("APSR\t= 0x%08x [N: %d, Z: %d, C: %d, V: %d, Q: %d]\n",
|
||||
APSR.APSR,
|
||||
fmt::by_value(APSR.N),
|
||||
fmt::by_value(APSR.Z),
|
||||
fmt::by_value(APSR.C),
|
||||
fmt::by_value(APSR.V),
|
||||
fmt::by_value(APSR.Q));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ARMv7Thread::ReadRegString(const std::string& reg)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
bool ARMv7Thread::WriteRegString(const std::string& reg, std::string value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoReset()
|
||||
{
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoRun()
|
||||
{
|
||||
switch(Ini.CPUDecoderMode.GetValue())
|
||||
{
|
||||
case 0:
|
||||
//m_dec = new ARMv7Decoder(*new ARMv7DisAsm());
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
m_dec = new ARMv7Decoder(*new ARMv7Interpreter(*this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoPause()
|
||||
{
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoResume()
|
||||
{
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoStop()
|
||||
{
|
||||
}
|
||||
|
||||
void ARMv7Thread::DoCode()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
#include "Emu/CPU/CPUThread.h"
|
||||
|
||||
class ARMv7Thread : public CPUThread
|
||||
{
|
||||
public:
|
||||
ARMv7Thread();
|
||||
|
||||
union
|
||||
{
|
||||
u32 GPR[15];
|
||||
|
||||
struct
|
||||
{
|
||||
u32 pad[13];
|
||||
|
||||
union
|
||||
{
|
||||
u32 SP;
|
||||
|
||||
struct { u16 SP_main, SP_process; };
|
||||
};
|
||||
|
||||
u32 LR;
|
||||
};
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 N : 1; //Negative condition code flag
|
||||
u32 Z : 1; //Zero condition code flag
|
||||
u32 C : 1; //Carry condition code flag
|
||||
u32 V : 1; //Overflow condition code flag
|
||||
u32 Q : 1; //Set to 1 if an SSAT or USAT instruction changes (saturates) the input value for the signed or unsigned range of the result
|
||||
u32 : 27;
|
||||
};
|
||||
|
||||
u32 APSR;
|
||||
} APSR;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 : 24;
|
||||
u32 exception : 8;
|
||||
};
|
||||
|
||||
u32 IPSR;
|
||||
} IPSR;
|
||||
|
||||
void write_gpr(u8 n, u32 value)
|
||||
{
|
||||
assert(n < 16);
|
||||
|
||||
if(n < 15)
|
||||
{
|
||||
GPR[n] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBranch(value);
|
||||
}
|
||||
}
|
||||
|
||||
u32 read_gpr(u8 n)
|
||||
{
|
||||
assert(n < 16);
|
||||
|
||||
if(n < 15)
|
||||
{
|
||||
return GPR[n];
|
||||
}
|
||||
|
||||
return PC;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void InitRegs();
|
||||
virtual void InitStack();
|
||||
virtual u64 GetFreeStackSize() const;
|
||||
virtual void SetArg(const uint pos, const u64 arg);
|
||||
|
||||
public:
|
||||
virtual std::string RegsToString();
|
||||
virtual std::string ReadRegString(const std::string& reg);
|
||||
virtual bool WriteRegString(const std::string& reg, std::string value);
|
||||
|
||||
protected:
|
||||
virtual void DoReset();
|
||||
virtual void DoRun();
|
||||
virtual void DoPause();
|
||||
virtual void DoResume();
|
||||
virtual void DoStop();
|
||||
|
||||
virtual void DoCode();
|
||||
};
|
||||
@@ -0,0 +1,160 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "rpcs3/Ini.h"
|
||||
|
||||
#include "OpenALThread.h"
|
||||
|
||||
ALenum g_last_al_error = AL_NO_ERROR;
|
||||
ALCenum g_last_alc_error = ALC_NO_ERROR;
|
||||
|
||||
#define checkForAlError(sit) if((g_last_al_error = alGetError()) != AL_NO_ERROR) printAlError(g_last_al_error, sit)
|
||||
#define checkForAlcError(sit) if((g_last_alc_error = alcGetError(m_device)) != ALC_NO_ERROR) printAlcError(g_last_alc_error, sit)
|
||||
|
||||
static const ALenum g_audio_format = Ini.AudioConvertToU16.GetValue() ? AL_FORMAT_STEREO16 : AL_FORMAT_STEREO_FLOAT32;
|
||||
|
||||
void printAlError(ALenum err, const char* situation)
|
||||
{
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
LOG_ERROR(HLE, "%s: OpenAL error 0x%04x", situation, err);
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
void printAlcError(ALCenum err, const char* situation)
|
||||
{
|
||||
if(err != ALC_NO_ERROR)
|
||||
{
|
||||
LOG_ERROR(HLE, "%s: OpenALC error 0x%04x", situation, err);
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
OpenALThread::~OpenALThread()
|
||||
{
|
||||
Quit();
|
||||
}
|
||||
|
||||
void OpenALThread::Init()
|
||||
{
|
||||
m_device = alcOpenDevice(nullptr);
|
||||
checkForAlcError("alcOpenDevice");
|
||||
|
||||
m_context = alcCreateContext(m_device, nullptr);
|
||||
checkForAlcError("alcCreateContext");
|
||||
|
||||
alcMakeContextCurrent(m_context);
|
||||
checkForAlcError("alcMakeContextCurrent");
|
||||
}
|
||||
|
||||
void OpenALThread::Quit()
|
||||
{
|
||||
m_context = alcGetCurrentContext();
|
||||
m_device = alcGetContextsDevice(m_context);
|
||||
alcMakeContextCurrent(nullptr);
|
||||
alcDestroyContext(m_context);
|
||||
alcCloseDevice(m_device);
|
||||
}
|
||||
|
||||
void OpenALThread::Play()
|
||||
{
|
||||
ALint state;
|
||||
alGetSourcei(m_source, AL_SOURCE_STATE, &state);
|
||||
checkForAlError("OpenALThread::Play -> alGetSourcei");
|
||||
|
||||
if(state != AL_PLAYING)
|
||||
{
|
||||
alSourcePlay(m_source);
|
||||
checkForAlError("alSourcePlay");
|
||||
}
|
||||
}
|
||||
|
||||
void OpenALThread::Close()
|
||||
{
|
||||
alSourceStop(m_source);
|
||||
checkForAlError("alSourceStop");
|
||||
if (alIsSource(m_source))
|
||||
alDeleteSources(1, &m_source);
|
||||
|
||||
alDeleteBuffers(g_al_buffers_count, m_buffers);
|
||||
checkForAlError("alDeleteBuffers");
|
||||
}
|
||||
|
||||
void OpenALThread::Stop()
|
||||
{
|
||||
alSourceStop(m_source);
|
||||
checkForAlError("alSourceStop");
|
||||
}
|
||||
|
||||
void OpenALThread::Open(const void* src, ALsizei size)
|
||||
{
|
||||
alGenSources(1, &m_source);
|
||||
checkForAlError("alGenSources");
|
||||
|
||||
alGenBuffers(g_al_buffers_count, m_buffers);
|
||||
checkForAlError("alGenBuffers");
|
||||
|
||||
alSourcei(m_source, AL_LOOPING, AL_FALSE);
|
||||
checkForAlError("OpenALThread::Open ->alSourcei");
|
||||
|
||||
m_buffer_size = size;
|
||||
|
||||
for(uint i=0; i<g_al_buffers_count; ++i)
|
||||
{
|
||||
AddBlock(m_buffers[i], m_buffer_size, src);
|
||||
}
|
||||
|
||||
alSourceQueueBuffers(m_source, g_al_buffers_count, m_buffers);
|
||||
checkForAlError("alSourceQueueBuffers");
|
||||
Play();
|
||||
}
|
||||
|
||||
void OpenALThread::AddData(const void* src, ALsizei size)
|
||||
{
|
||||
const char* bsrc = (const char*)src;
|
||||
ALuint buffer;
|
||||
ALint buffers_count;
|
||||
|
||||
alGetSourcei(m_source, AL_BUFFERS_PROCESSED, &buffers_count);
|
||||
checkForAlError("OpenALThread::AddData -> alGetSourcei");
|
||||
|
||||
while(size)
|
||||
{
|
||||
if(buffers_count-- <= 0)
|
||||
{
|
||||
Play();
|
||||
|
||||
alGetSourcei(m_source, AL_BUFFERS_PROCESSED, &buffers_count);
|
||||
checkForAlError("OpenALThread::AddData(in loop) -> alGetSourcei");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
alSourceUnqueueBuffers(m_source, 1, &buffer);
|
||||
checkForAlError("alSourceUnqueueBuffers");
|
||||
|
||||
int bsize = size < m_buffer_size ? size : m_buffer_size;
|
||||
if (!AddBlock(buffer, bsize, bsrc))
|
||||
LOG_ERROR(HLE, "OpenALThread::AddBlock: invalid block size: %d", bsize);
|
||||
|
||||
alSourceQueueBuffers(m_source, 1, &buffer);
|
||||
checkForAlError("alSourceQueueBuffers");
|
||||
|
||||
size -= bsize;
|
||||
bsrc += bsize;
|
||||
}
|
||||
|
||||
Play();
|
||||
}
|
||||
|
||||
bool OpenALThread::AddBlock(const ALuint buffer_id, const ALsizei size, const void* src)
|
||||
{
|
||||
if (size < 1) return false;
|
||||
|
||||
alBufferData(buffer_id, g_audio_format, src, size, 48000);
|
||||
checkForAlError("alBufferData");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "OpenAL/include/alext.h"
|
||||
|
||||
class OpenALThread
|
||||
{
|
||||
private:
|
||||
static const uint g_al_buffers_count = 16;
|
||||
|
||||
ALuint m_source;
|
||||
ALuint m_buffers[g_al_buffers_count];
|
||||
ALCdevice* m_device;
|
||||
ALCcontext* m_context;
|
||||
ALsizei m_buffer_size;
|
||||
|
||||
public:
|
||||
~OpenALThread();
|
||||
|
||||
void Init();
|
||||
void Quit();
|
||||
void Play();
|
||||
void Open(const void* src, ALsizei size);
|
||||
void Close();
|
||||
void Stop();
|
||||
bool AddBlock(const ALuint buffer_id, ALsizei size, const void* src);
|
||||
void AddData(const void* src, ALsizei size);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "stdafx.h"
|
||||
#include "AudioDumper.h"
|
||||
|
||||
AudioDumper::AudioDumper(u8 ch) : m_header(ch)
|
||||
{
|
||||
}
|
||||
|
||||
AudioDumper::~AudioDumper()
|
||||
{
|
||||
}
|
||||
|
||||
bool AudioDumper::Init()
|
||||
{
|
||||
return m_output.Open("audio.wav", rFile::write);
|
||||
}
|
||||
|
||||
void AudioDumper::WriteHeader()
|
||||
{
|
||||
m_output.Write(&m_header, sizeof(m_header)); // write file header
|
||||
}
|
||||
|
||||
size_t AudioDumper::WriteData(const void* buffer, size_t size)
|
||||
{
|
||||
#ifdef SKIP_EMPTY_AUDIO
|
||||
bool do_save = false;
|
||||
for (u32 i = 0; i < size / 8; i++)
|
||||
{
|
||||
if (((u64*)buffer)[i]) do_save = true;
|
||||
}
|
||||
for (u32 i = 0; i < size % 8; i++)
|
||||
{
|
||||
if (((u8*)buffer)[i + (size & ~7)]) do_save = true;
|
||||
}
|
||||
if (!do_save) return size; // ignore empty data
|
||||
#endif
|
||||
size_t ret = m_output.Write(buffer, size);
|
||||
m_header.Size += ret;
|
||||
m_header.RIFF.Size += ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AudioDumper::Finalize()
|
||||
{
|
||||
m_output.Seek(0);
|
||||
m_output.Write(&m_header, sizeof(m_header)); // write fixed file header
|
||||
m_output.Close();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
struct WAVHeader
|
||||
{
|
||||
struct RIFFHeader
|
||||
{
|
||||
u32 ID; // "RIFF"
|
||||
u32 Size; // FileSize - 8
|
||||
u32 WAVE; // "WAVE"
|
||||
|
||||
RIFFHeader(u32 size)
|
||||
: ID(*(u32*)"RIFF")
|
||||
, WAVE(*(u32*)"WAVE")
|
||||
, Size(size)
|
||||
{
|
||||
}
|
||||
} RIFF;
|
||||
struct FMTHeader
|
||||
{
|
||||
u32 ID; // "fmt "
|
||||
u32 Size; // 16
|
||||
u16 AudioFormat; // 1 for PCM, 3 for IEEE Floating Point
|
||||
u16 NumChannels; // 1, 2, 6, 8
|
||||
u32 SampleRate; // 48000
|
||||
u32 ByteRate; // SampleRate * NumChannels * BitsPerSample/8
|
||||
u16 BlockAlign; // NumChannels * BitsPerSample/8
|
||||
u16 BitsPerSample; // sizeof(float) * 8
|
||||
|
||||
FMTHeader(u8 ch)
|
||||
: ID(*(u32*)"fmt ")
|
||||
, Size(16)
|
||||
, AudioFormat(3)
|
||||
, NumChannels(ch)
|
||||
, SampleRate(48000)
|
||||
, ByteRate(SampleRate * ch * sizeof(float))
|
||||
, BlockAlign(ch * sizeof(float))
|
||||
, BitsPerSample(sizeof(float) * 8)
|
||||
{
|
||||
}
|
||||
} FMT;
|
||||
u32 ID; // "data"
|
||||
u32 Size; // size of data (256 * NumChannels * sizeof(float))
|
||||
|
||||
WAVHeader(u8 ch)
|
||||
: ID(*(u32*)"data")
|
||||
, Size(0)
|
||||
, FMT(ch)
|
||||
, RIFF(sizeof(RIFFHeader) + sizeof(FMTHeader))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class AudioDumper
|
||||
{
|
||||
private:
|
||||
WAVHeader m_header;
|
||||
rFile m_output;
|
||||
|
||||
public:
|
||||
AudioDumper(u8 ch);
|
||||
~AudioDumper();
|
||||
|
||||
bool Init();
|
||||
void WriteHeader();
|
||||
size_t WriteData(const void* buffer, size_t size);
|
||||
void Finalize();
|
||||
const u8 GetCh() const { return m_header.FMT.NumChannels; }
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "stdafx.h"
|
||||
#include "rpcs3/Ini.h"
|
||||
#include "AudioManager.h"
|
||||
|
||||
OpenALThread* m_audio_out;
|
||||
|
||||
AudioManager::AudioManager()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioManager::Init()
|
||||
{
|
||||
if(m_audio_out) return;
|
||||
|
||||
m_audio_info.Init();
|
||||
|
||||
switch(Ini.AudioOutMode.GetValue())
|
||||
{
|
||||
default:
|
||||
case 0: m_audio_out = nullptr; break;
|
||||
case 1: m_audio_out = new OpenALThread(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioManager::Close()
|
||||
{
|
||||
delete m_audio_out;
|
||||
m_audio_out = nullptr;
|
||||
}
|
||||
|
||||
u8 AudioManager::GetState()
|
||||
{
|
||||
return CELL_AUDIO_OUT_OUTPUT_STATE_ENABLED;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user