mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 03:29:43 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed9cd1a70d | ||
|
|
61df9b273b | ||
|
|
e10aee3f1d | ||
|
|
7ff25fe732 | ||
|
|
731db6a4be | ||
|
|
34934b169c | ||
|
|
1615a6b538 | ||
|
|
ed2db75765 | ||
|
|
4a09dfdb30 | ||
|
|
842362699c | ||
|
|
b32a69889e | ||
|
|
b7f3bede61 | ||
|
|
118f1986ed | ||
|
|
8f14a92c54 | ||
|
|
7588ed6944 | ||
|
|
4c3969976b | ||
|
|
7be0dd9b18 | ||
|
|
8dfc585c59 | ||
|
|
c5dfa314ad | ||
|
|
5b3c1edbef | ||
|
|
a1539e432c | ||
|
|
4c9fc31354 | ||
|
|
877a218778 | ||
|
|
18436a476d | ||
|
|
846181951b | ||
|
|
29289011c2 | ||
|
|
e9afdb327e | ||
|
|
b430b772b5 | ||
|
|
11611acbe4 | ||
|
|
9b673152f7 | ||
|
|
1cefef4d4f | ||
|
|
4f9ebc4037 | ||
|
|
efad07e89f | ||
|
|
885f5e7ed7 | ||
|
|
149469515f | ||
|
|
0114c7b0c4 | ||
|
|
6dc32ffe17 | ||
|
|
c89ed117b6 | ||
|
|
e807f04127 | ||
|
|
6eb18ed03f | ||
|
|
0e01d3d821 | ||
|
|
8b360c9072 | ||
|
|
1927508879 | ||
|
|
b73a8750e4 | ||
|
|
5a990841dc | ||
|
|
7f38177246 | ||
|
|
3b6f78972a | ||
|
|
47c99eb2b4 | ||
|
|
2432445641 | ||
|
|
0c65e6e4e9 | ||
|
|
bf8863d360 | ||
|
|
46ab09e4b5 | ||
|
|
84f61a8b46 | ||
|
|
29b5e09b24 | ||
|
|
21ae4a29a1 | ||
|
|
5ba28b60aa | ||
|
|
eddc5d3b8d | ||
|
|
c720c237c5 | ||
|
|
13a0da1f25 | ||
|
|
75e6ad53b6 | ||
|
|
f0f033486f | ||
|
|
711877b056 | ||
|
|
1db8ae9f60 | ||
|
|
bedf65e72e | ||
|
|
b668193923 | ||
|
|
9d598cb917 | ||
|
|
795057bacf | ||
|
|
1bd65c8f3e | ||
|
|
668cc01c5c | ||
|
|
94aa2cd08a | ||
|
|
e6e27fe4cb | ||
|
|
56a3bc10e3 | ||
|
|
1aa05de8ba | ||
|
|
41df4a0555 | ||
|
|
a9c0297931 | ||
|
|
066cbea3c3 | ||
|
|
07f3919811 | ||
|
|
c0308f9954 | ||
|
|
f3c774a797 | ||
|
|
6f2efe7f1e | ||
|
|
40bb1da981 | ||
|
|
c0d8a2f093 | ||
|
|
360e2e54d3 | ||
|
|
bfd815985f | ||
|
|
1dc19d347c | ||
|
|
55cca49c76 | ||
|
|
c1bf34606f | ||
|
|
dd6ec31f3d | ||
|
|
b3e22f6060 | ||
|
|
55461f2c2b | ||
|
|
53d037ee58 | ||
|
|
721b5f9529 | ||
|
|
b6b6ba9226 | ||
|
|
a5076df751 | ||
|
|
619acbb5aa | ||
|
|
2b1481d97f | ||
|
|
2ac75f98ae | ||
|
|
bc969d0bf7 | ||
|
|
0e131044fe | ||
|
|
1ebf008517 | ||
|
|
b50a667335 | ||
|
|
229841b1c4 | ||
|
|
683c437941 | ||
|
|
41daddfe1c | ||
|
|
2878818b34 | ||
|
|
8c363f5e94 | ||
|
|
b975cb43a7 | ||
|
|
ed41b3c531 | ||
|
|
8d4ba8d8c8 | ||
|
|
e40d392605 | ||
|
|
7b30868a29 | ||
|
|
e91bae38cf | ||
|
|
0d572b0deb | ||
|
|
bc2d6d02af | ||
|
|
bd586e6d2d | ||
|
|
118002ce6c | ||
|
|
e560adcc9f | ||
|
|
ade80dbe76 | ||
|
|
f53fe4a07c | ||
|
|
2327d38e0d | ||
|
|
8a82fd7905 | ||
|
|
2aea191835 | ||
|
|
6b6d1ee986 | ||
|
|
97095404bd | ||
|
|
fcae5deb2d | ||
|
|
79fdb55f4b | ||
|
|
58bae8456a | ||
|
|
5879e551a5 | ||
|
|
d005adbd42 | ||
|
|
87c82797fd | ||
|
|
da15f9d730 | ||
|
|
6493b79324 | ||
|
|
d861d2b0ae | ||
|
|
e5ed1acc0a | ||
|
|
67fea30406 | ||
|
|
ec123ef6ca | ||
|
|
6fa5fcfa1f | ||
|
|
40a8388c29 | ||
|
|
e9acbbdf9e | ||
|
|
3519e4e16a | ||
|
|
6db4bd2d8a | ||
|
|
91c40ddfbf | ||
|
|
9c791e7fb5 | ||
|
|
60d96b60b5 | ||
|
|
3ab26b6738 | ||
|
|
5eadf021cf | ||
|
|
c5292025c3 | ||
|
|
ac14f8bb2a | ||
|
|
b11922dd17 | ||
|
|
6e8cb62cb8 | ||
|
|
23527a82ca | ||
|
|
69f69849be | ||
|
|
c1c9e1897c | ||
|
|
764290b851 | ||
|
|
40cfde0eba | ||
|
|
063fc96736 | ||
|
|
faab2526c8 | ||
|
|
ea5de035bf | ||
|
|
be21586b76 | ||
|
|
33d8031593 | ||
|
|
90aea4dfd7 | ||
|
|
7e7363305b | ||
|
|
b80057bfe6 | ||
|
|
c334b8f2fd | ||
|
|
dcfcfe8d70 | ||
|
|
7ae474e4ac | ||
|
|
5976f34805 | ||
|
|
72bf821a11 | ||
|
|
6a08ca6a18 | ||
|
|
0495ea07c8 | ||
|
|
f1254e43f8 | ||
|
|
de4d38637c | ||
|
|
385499d624 | ||
|
|
7e185b7ce4 | ||
|
|
b3d8146009 | ||
|
|
0ff54e7bd7 | ||
|
|
77ac13b2e9 | ||
|
|
a4c9c738b8 | ||
|
|
4f016b2c2c | ||
|
|
3e1f4defb8 | ||
|
|
3e0b4552d6 | ||
|
|
9ab13b719b | ||
|
|
5f7527df08 | ||
|
|
c825f849f5 | ||
|
|
d6cc447aa0 | ||
|
|
7c6377a7fa | ||
|
|
9f987dd97b | ||
|
|
0703615bf5 | ||
|
|
e7188d9444 | ||
|
|
9f222010de | ||
|
|
3428e3d80a | ||
|
|
e91cc7aced | ||
|
|
9f79b99c94 | ||
|
|
f28d6009ec | ||
|
|
6fefc71aa2 | ||
|
|
c1d5622255 | ||
|
|
4b0932ffb3 | ||
|
|
64ac26b7d1 | ||
|
|
bc45ba38bf | ||
|
|
a295169a3b | ||
|
|
308818afd1 | ||
|
|
5b268b79d2 | ||
|
|
9dd253adea | ||
|
|
5252d3216a | ||
|
|
4a7e8b03b2 | ||
|
|
24434db9d9 | ||
|
|
a72461c16b | ||
|
|
bd1f04554e | ||
|
|
96876c66ce | ||
|
|
dc664ff4f2 | ||
|
|
c1f0fceb4f | ||
|
|
e7599e8952 | ||
|
|
97e0ffde9f | ||
|
|
0085b24fd5 | ||
|
|
4cae577ade | ||
|
|
dc700c5d8b | ||
|
|
0f6a3c8f9d | ||
|
|
5ea63f3b08 | ||
|
|
1bc30331a7 | ||
|
|
7a33bfe924 | ||
|
|
3ccf8c19f1 | ||
|
|
0100e7b673 | ||
|
|
fc43a14637 | ||
|
|
fe2bf47b98 | ||
|
|
00d52a4783 | ||
|
|
a7cd8d94b0 | ||
|
|
9c6edaff30 | ||
|
|
1729bdd7bd | ||
|
|
b05b27bff6 | ||
|
|
f681cb455c | ||
|
|
814f18b7a8 | ||
|
|
01ac15716e | ||
|
|
79809df6b5 | ||
|
|
c9c311a770 | ||
|
|
0d7f9c7cf0 | ||
|
|
7d2e9290e2 | ||
|
|
f5d9427d48 | ||
|
|
40a7755fe2 | ||
|
|
13e0bd1932 | ||
|
|
e5d4e2ac0a | ||
|
|
00f2a8d7ba | ||
|
|
9af89e5d8e | ||
|
|
3c066b7a13 | ||
|
|
f2d70664a3 | ||
|
|
a1ce72ef0d | ||
|
|
5136ec2df0 | ||
|
|
9d8dddfc3c | ||
|
|
451dc774b0 | ||
|
|
360a3686a0 | ||
|
|
a776565367 | ||
|
|
10722920ed | ||
|
|
20031e0bc4 | ||
|
|
82de482b9f | ||
|
|
1771b11a39 | ||
|
|
b8df76271c | ||
|
|
f7ac5b3baf | ||
|
|
a0dde6ea48 | ||
|
|
3144c38e7d | ||
|
|
e29e8d9c62 | ||
|
|
f781db38b9 | ||
|
|
7ceeb9804d | ||
|
|
0893f7df6f | ||
|
|
5c39950cf1 | ||
|
|
10032affcb | ||
|
|
5bd78cc410 | ||
|
|
2e62a0a7e7 | ||
|
|
6090aa8f8a | ||
|
|
5f00e2f6bb | ||
|
|
0d38612f4a | ||
|
|
b49268a9e9 | ||
|
|
e39c820cee | ||
|
|
e41b8db3e2 | ||
|
|
fc79fec964 | ||
|
|
4e463123af | ||
|
|
a3e4a7612f | ||
|
|
c96a9dbf76 | ||
|
|
595e69d34d | ||
|
|
ed0ce4988d | ||
|
|
b4abc39289 | ||
|
|
91c9da529f | ||
|
|
f91b9acf2e | ||
|
|
d1278306c7 | ||
|
|
ad9f7c2e44 | ||
|
|
bf50bd1df3 | ||
|
|
e41c79daed | ||
|
|
256766df5e | ||
|
|
1fe0002a21 | ||
|
|
3ada77d154 | ||
|
|
7ba2797032 | ||
|
|
2ce53f32ac | ||
|
|
400b27a227 | ||
|
|
598285b461 | ||
|
|
28ec3ac3b5 | ||
|
|
07b504ce2a | ||
|
|
f341c8daf2 | ||
|
|
b63d12e091 | ||
|
|
a25fcf31b7 | ||
|
|
65e2f85bc7 | ||
|
|
6c157cfd85 | ||
|
|
fc856c76a8 | ||
|
|
b7f9b08f30 | ||
|
|
ade710a331 | ||
|
|
93477289df | ||
|
|
06b989f8bf | ||
|
|
68a8198e4a | ||
|
|
89265f5cf2 | ||
|
|
5715774c3f | ||
|
|
3d236a57e4 | ||
|
|
7b24950438 | ||
|
|
ec806f65f9 | ||
|
|
5aba01ed26 | ||
|
|
22d4fc6fa1 | ||
|
|
bbf6f2f451 | ||
|
|
1842471eb1 | ||
|
|
cdc61bc206 | ||
|
|
a75014c705 | ||
|
|
48db41a112 | ||
|
|
d5448f3261 | ||
|
|
45058acbef | ||
|
|
b0d9a5c539 | ||
|
|
91b5fa7ad6 | ||
|
|
08cee280c9 | ||
|
|
e1bddc8432 | ||
|
|
34e5d73ce9 | ||
|
|
526d63872a | ||
|
|
c5a69a2b72 | ||
|
|
6c3a0b0fea | ||
|
|
bd17c11350 | ||
|
|
2ddba6770d | ||
|
|
93ee38af05 | ||
|
|
a71ec4a836 | ||
|
|
9ae4a9276b | ||
|
|
4f58c1a77b | ||
|
|
6bd333263a | ||
|
|
77cd18e6bc | ||
|
|
94309a65cf | ||
|
|
0d43f9f8c7 | ||
|
|
91f6218913 | ||
|
|
b971b821be | ||
|
|
e13837fc18 | ||
|
|
d540e87c3d | ||
|
|
50bea6a743 | ||
|
|
6fa80376e0 | ||
|
|
03524278c6 | ||
|
|
6575cc5166 | ||
|
|
a0b5a2794c | ||
|
|
185ef85ded | ||
|
|
b9a866326a | ||
|
|
08dcac4b02 | ||
|
|
e12d203a76 | ||
|
|
9503edce82 | ||
|
|
e8abc1c0f0 | ||
|
|
8884190154 | ||
|
|
86bb116625 | ||
|
|
5173be8cc6 | ||
|
|
cd942f1faa | ||
|
|
c2a5296ee3 | ||
|
|
affe1932a8 | ||
|
|
2b939ab40b | ||
|
|
11ff3ddd4b | ||
|
|
3098b5e3df | ||
|
|
20850a7f92 | ||
|
|
3f27e5d7bb | ||
|
|
0731bbb81c | ||
|
|
6ead9a09a1 | ||
|
|
f9b105d30f | ||
|
|
86ff1995b3 | ||
|
|
33eb1f9e28 | ||
|
|
03803d1be4 | ||
|
|
c1543e6219 | ||
|
|
5a1555c91c | ||
|
|
e2749ee426 | ||
|
|
9ee28f0f24 | ||
|
|
db1b53fd21 | ||
|
|
108c4a3127 | ||
|
|
85f8823d05 | ||
|
|
9279c33711 | ||
|
|
ee6841e80f | ||
|
|
cd918390bb | ||
|
|
538d51553c | ||
|
|
008a87c1ae | ||
|
|
24d2cafbdf | ||
|
|
9c128cd2ea | ||
|
|
3427c03aba | ||
|
|
50685a0101 | ||
|
|
db7c05edd5 | ||
|
|
182dec7802 | ||
|
|
83f6e70bfa | ||
|
|
565701b197 | ||
|
|
7c6dc0c8a7 | ||
|
|
72d189da96 | ||
|
|
5438eb1c6e | ||
|
|
2fa74c997b | ||
|
|
8072dab6fe | ||
|
|
d203e4dc9c | ||
|
|
bb051f185b | ||
|
|
f1192ca8ac | ||
|
|
f7218eb85b | ||
|
|
38ed310261 | ||
|
|
833c122d38 | ||
|
|
79ee19e2a5 | ||
|
|
b733807099 | ||
|
|
0ff7e829f0 | ||
|
|
a943fabe1e | ||
|
|
514391b4d8 | ||
|
|
cca4a25757 | ||
|
|
40070e2c93 | ||
|
|
aa8b7f65c5 | ||
|
|
dc7b1c122b | ||
|
|
63ba8be296 | ||
|
|
19af87214a | ||
|
|
b0f8a570b5 | ||
|
|
e9708be756 | ||
|
|
675b257302 | ||
|
|
be62ed11e5 | ||
|
|
4aaaf16aa8 | ||
|
|
ba2f79a8c3 | ||
|
|
b40d50bba4 | ||
|
|
5b48112379 | ||
|
|
17a95abeef | ||
|
|
ef5cbfed61 | ||
|
|
628acf5296 | ||
|
|
f50d755b45 | ||
|
|
6733c37805 | ||
|
|
fd18c2c942 | ||
|
|
5ec052b675 | ||
|
|
f3aceefe84 | ||
|
|
d9ec2267f7 | ||
|
|
3ba4ba5c42 | ||
|
|
65ef37706c | ||
|
|
05ef63fd08 | ||
|
|
0d06a48546 | ||
|
|
bd06668075 | ||
|
|
f8a60b2b76 | ||
|
|
4121928899 | ||
|
|
8464ad30bd | ||
|
|
1b1d5c468d | ||
|
|
f3c57ee343 | ||
|
|
2c773a0eb8 | ||
|
|
c7849de707 | ||
|
|
d6dbe9a6ad | ||
|
|
cf0d358f1e | ||
|
|
b4854305b0 | ||
|
|
ac3b7bc4cc | ||
|
|
1e40f73b76 | ||
|
|
ac70cdce2a | ||
|
|
e86e237ed7 | ||
|
|
338723bc31 | ||
|
|
f1d72e241c | ||
|
|
303af012bb | ||
|
|
a7c8cc88e5 | ||
|
|
38c30667c5 | ||
|
|
74ac642752 | ||
|
|
590c8ee934 | ||
|
|
f462d5e7c2 | ||
|
|
aadc532b9c | ||
|
|
5b7262d83f | ||
|
|
bae8157697 | ||
|
|
ee7590868a | ||
|
|
052ea42c0b | ||
|
|
0a0c538e2b | ||
|
|
55fa6696cd | ||
|
|
bdb1f8588f | ||
|
|
2bf338df12 | ||
|
|
d075074703 | ||
|
|
4a68904733 | ||
|
|
677229d541 | ||
|
|
aa6301e0d6 | ||
|
|
256bde3478 | ||
|
|
79155f7301 | ||
|
|
24c1ad72ce | ||
|
|
01f8e4e74f | ||
|
|
81a5b6c2c2 | ||
|
|
8708906f15 | ||
|
|
a87cf6d2e7 | ||
|
|
20aa59249c | ||
|
|
f1453b6696 | ||
|
|
840e772b16 | ||
|
|
1b856f7a1e | ||
|
|
c68db61188 | ||
|
|
7cf1793801 | ||
|
|
cadc4f56a3 | ||
|
|
d5c2279502 | ||
|
|
59cabfe80f | ||
|
|
cc3d2b0084 | ||
|
|
39619d1245 | ||
|
|
69a18324c0 | ||
|
|
8b7b85ad82 | ||
|
|
5ccdc8811c | ||
|
|
ab45670738 | ||
|
|
eb3d8c8804 | ||
|
|
fff3e225d2 | ||
|
|
b6fef15457 | ||
|
|
072b347c0f | ||
|
|
a4bc1c9768 | ||
|
|
7aadb0ee13 | ||
|
|
f156f7cd94 | ||
|
|
a153ed0b42 | ||
|
|
576583c9fb | ||
|
|
fd07c57ed5 | ||
|
|
b1a6753976 | ||
|
|
c7da6e1ca8 | ||
|
|
1053a4e38f | ||
|
|
6f8201d398 | ||
|
|
3f1dd895da | ||
|
|
b7654dac7e | ||
|
|
a64683ba34 | ||
|
|
d5a802e4a8 | ||
|
|
d25916cacf | ||
|
|
9356c326e0 | ||
|
|
db0e0f443a | ||
|
|
b402b4a6cd | ||
|
|
e286c5dda2 | ||
|
|
affd56f293 | ||
|
|
6a5ad56bc6 | ||
|
|
ed061fd27b | ||
|
|
7a3bbc3215 | ||
|
|
84701efd24 | ||
|
|
5c46e176d5 | ||
|
|
83991d6c36 | ||
|
|
9db0e9dbc6 | ||
|
|
f073d5167a | ||
|
|
082629ccd5 | ||
|
|
7ee1797fa1 | ||
|
|
7d34a5f423 | ||
|
|
b67e6dc1ee | ||
|
|
20da0f0666 | ||
|
|
608bc45388 | ||
|
|
3d9d5320ad | ||
|
|
6013e25b2b | ||
|
|
bd206f7744 | ||
|
|
76283edd07 | ||
|
|
19b313c221 | ||
|
|
1e3da091a5 | ||
|
|
a88ee1a6e5 | ||
|
|
12d0f4107a | ||
|
|
0eb5566dea | ||
|
|
cc3b64f951 | ||
|
|
856fccd65c | ||
|
|
489acabdf4 | ||
|
|
9829019306 | ||
|
|
135b636bd4 | ||
|
|
032109512a | ||
|
|
bb6ca3e4ff | ||
|
|
1763a2ef7b | ||
|
|
8238545bef | ||
|
|
6bb5af8ee0 | ||
|
|
9cdea532ce | ||
|
|
970c35056d | ||
|
|
e01fdcb07d | ||
|
|
59ec089c2e | ||
|
|
b7c5dbdd92 | ||
|
|
fca48021aa | ||
|
|
6ed9f28656 | ||
|
|
f59470c523 | ||
|
|
942ea38248 | ||
|
|
41024fbb0a | ||
|
|
3b8559dafc | ||
|
|
865d395f26 | ||
|
|
796746525d | ||
|
|
cfd4a4bdf4 | ||
|
|
9d817f95f5 | ||
|
|
4f1e9b0bd3 | ||
|
|
355b6dcbdd | ||
|
|
6597447324 | ||
|
|
e3ef431b79 | ||
|
|
54065807dc | ||
|
|
46ed23e649 | ||
|
|
d87d57a368 | ||
|
|
79908ec8d4 | ||
|
|
7dcafe4b40 | ||
|
|
a1b39b9c8b | ||
|
|
0a3a30c99c | ||
|
|
86f5cc6571 | ||
|
|
0695d93cee | ||
|
|
be5d3cb0ba | ||
|
|
d0d6d0bfe8 | ||
|
|
02ee7df743 | ||
|
|
cf9ab18cab | ||
|
|
1f8adeaadc | ||
|
|
51ea984f4f | ||
|
|
d10de20bff | ||
|
|
bd94f265fa | ||
|
|
51a173fc83 | ||
|
|
6c262fe44f | ||
|
|
d23d742439 | ||
|
|
e101c9ae11 | ||
|
|
97f995218f | ||
|
|
2bb20a0b4f | ||
|
|
71dd8f9084 | ||
|
|
702f1276d6 | ||
|
|
c91c4ff9c0 | ||
|
|
dc4c2cd6d9 | ||
|
|
8d274f4f43 | ||
|
|
b97853a536 | ||
|
|
9c89b3e546 | ||
|
|
bb2702ef2f | ||
|
|
345e1ae419 | ||
|
|
d22e662d1c | ||
|
|
34963ee438 | ||
|
|
af7df0cba3 | ||
|
|
721afe22d8 | ||
|
|
7ff34f8efe | ||
|
|
590cdeb130 | ||
|
|
8aef6dff1c | ||
|
|
cdb24aff1c | ||
|
|
fa0728d6b7 | ||
|
|
9abd790353 | ||
|
|
0db3aec722 | ||
|
|
bceb8000dd | ||
|
|
6eb23efb54 | ||
|
|
af9ec3f7a2 | ||
|
|
bd66937112 | ||
|
|
c3bcbaea14 | ||
|
|
983e160e67 | ||
|
|
8d850dc0bd | ||
|
|
9c639ec529 | ||
|
|
5ef6de4d4e | ||
|
|
22b14142b6 | ||
|
|
f6fb1fd953 | ||
|
|
4dd209696b | ||
|
|
6b1a1272a7 | ||
|
|
cf9147ff66 | ||
|
|
ace611798e | ||
|
|
52b479fb22 | ||
|
|
c4c41b277e | ||
|
|
c1cf1af265 | ||
|
|
86096e677c | ||
|
|
b8253284e6 | ||
|
|
95d035883c | ||
|
|
0559be4e72 | ||
|
|
95ca5a3876 | ||
|
|
d254decf28 | ||
|
|
9f591fc42c | ||
|
|
ebe5f65893 | ||
|
|
d960cc8c0f | ||
|
|
8b1ae9427e | ||
|
|
d6533bac19 | ||
|
|
30af756969 | ||
|
|
563024502f | ||
|
|
ff40cba3de | ||
|
|
55a2020c07 | ||
|
|
1aff508ae5 | ||
|
|
96c3d6cc1d | ||
|
|
8b4fd58f17 | ||
|
|
5c67fc3040 | ||
|
|
b4c950ac32 | ||
|
|
43b4c65b1e | ||
|
|
cc988cf559 | ||
|
|
1d960e0c42 | ||
|
|
710c70f838 | ||
|
|
2b55e5858e | ||
|
|
df15a67c71 | ||
|
|
e66ef15580 | ||
|
|
a87bef6ed0 | ||
|
|
3cac2a6df8 | ||
|
|
59f7a59b3f | ||
|
|
a11d04f252 | ||
|
|
bdad323b96 | ||
|
|
7a6d2cb5e6 | ||
|
|
45ce8bf773 | ||
|
|
849538b15c | ||
|
|
9dde5fc33f | ||
|
|
de6b1bcbf0 | ||
|
|
455b202142 | ||
|
|
73d1539bb0 | ||
|
|
b46f2ba35f | ||
|
|
1e37aab49b | ||
|
|
4dd6c7fac7 | ||
|
|
2a8b74eeb9 | ||
|
|
98ddc80035 | ||
|
|
f61b9e1747 | ||
|
|
02cc57e5b3 | ||
|
|
6b5d863136 | ||
|
|
b0de197da4 | ||
|
|
063343e538 | ||
|
|
c856a36a58 | ||
|
|
e376bd75c0 | ||
|
|
638a441530 | ||
|
|
00ea9be8fc | ||
|
|
ff926439ac | ||
|
|
5fd05c6b56 | ||
|
|
eae2217c6d | ||
|
|
3040d1da36 | ||
|
|
1156d6cec5 | ||
|
|
eea7fe2dce | ||
|
|
94fdf314f2 | ||
|
|
f323168251 | ||
|
|
d6b385d0b8 | ||
|
|
aab154fadf | ||
|
|
f5dedd673f | ||
|
|
dc2664a4ef | ||
|
|
7959cd3993 | ||
|
|
57ded65189 | ||
|
|
862cf48108 | ||
|
|
127d98fb68 | ||
|
|
35376a7961 | ||
|
|
fc79569682 | ||
|
|
bae31a318d | ||
|
|
542f87bf55 | ||
|
|
4fd00ac146 | ||
|
|
66de49c987 | ||
|
|
01099d526c | ||
|
|
3551ac825c | ||
|
|
f398f44253 | ||
|
|
238de4aa57 | ||
|
|
3490c3dbc5 | ||
|
|
3090f3ff3a | ||
|
|
4db14dca9a | ||
|
|
5da54b6f88 | ||
|
|
7f80ecbe93 | ||
|
|
8e01424450 | ||
|
|
4639b2547d | ||
|
|
1c477ca007 | ||
|
|
efde859e17 | ||
|
|
9c90f97792 | ||
|
|
08f9e4aaf9 | ||
|
|
05d5def6c2 | ||
|
|
a90d0a2117 | ||
|
|
9b279ca968 | ||
|
|
851af0532d | ||
|
|
a40692f0c4 | ||
|
|
028c04f358 | ||
|
|
9ca4b9baf0 | ||
|
|
5b9f90dd9a | ||
|
|
819e3fb02a | ||
|
|
51d98ef0c0 | ||
|
|
476f7e560b | ||
|
|
8bf741257c | ||
|
|
dc11a02e61 | ||
|
|
b2932d5270 | ||
|
|
f713a30705 | ||
|
|
5951bed07d | ||
|
|
5379b12e7c | ||
|
|
642818d59c | ||
|
|
15bb8e2ebe | ||
|
|
9fc063cd43 | ||
|
|
3564562563 | ||
|
|
6dcbf0eab8 | ||
|
|
3374b0ffde | ||
|
|
8eb28eaae9 | ||
|
|
0f1d0ebfa9 | ||
|
|
5b96231f49 | ||
|
|
547557d443 | ||
|
|
f1c2800fa4 | ||
|
|
0cbd2d4aa1 | ||
|
|
37ca5b0605 | ||
|
|
be333837e9 | ||
|
|
d9593c7cae | ||
|
|
ff48af4d06 | ||
|
|
9eba2c8e39 | ||
|
|
7d12eb4a51 | ||
|
|
2af4457bec | ||
|
|
61810cfd82 | ||
|
|
51cdf5a6d7 | ||
|
|
0a29c4711a | ||
|
|
97f821e743 | ||
|
|
c828a425e7 | ||
|
|
28c118c3c1 | ||
|
|
df13f3bbd0 | ||
|
|
f21c520e28 | ||
|
|
bb4a659abb | ||
|
|
ee8d8e1be6 | ||
|
|
bb9efe9bf1 | ||
|
|
282782c829 | ||
|
|
65edb2f06c | ||
|
|
9185fb3ed1 | ||
|
|
f444ef109f | ||
|
|
270f35753a | ||
|
|
1fb640377f | ||
|
|
dfe6035ade | ||
|
|
f914a91944 | ||
|
|
decea56c03 | ||
|
|
7adf4ca854 | ||
|
|
76277a12b0 | ||
|
|
db7e1a4fdf | ||
|
|
b8e900cd32 | ||
|
|
c5255b1bff | ||
|
|
2f10fd14d6 | ||
|
|
bb6e4a6633 | ||
|
|
a0552fa4d9 | ||
|
|
3f433fe220 | ||
|
|
a616fa16f3 | ||
|
|
ec082df2e0 | ||
|
|
afa7d7d8e5 | ||
|
|
7633141bd6 | ||
|
|
e1a0139164 | ||
|
|
8af2559b2a | ||
|
|
8b62a7cb7d | ||
|
|
04bc2fef8c | ||
|
|
b28536ba16 | ||
|
|
59e442419e | ||
|
|
8b5f8d8c64 | ||
|
|
08ecfc74ec | ||
|
|
72087d1749 | ||
|
|
72f42b602f | ||
|
|
b253ea7b08 | ||
|
|
9863afdbd0 | ||
|
|
221939ccb5 | ||
|
|
67ff372a38 | ||
|
|
4a133144d5 | ||
|
|
a75ceae688 | ||
|
|
c7975d8e36 | ||
|
|
a05dd09ea8 | ||
|
|
1ed61d2fdb | ||
|
|
cb92ad77d2 | ||
|
|
f34250e38e | ||
|
|
e7d41f6ea7 | ||
|
|
7acda37b4e | ||
|
|
a3ded01b64 | ||
|
|
fcf6228dce | ||
|
|
b79f95668b | ||
|
|
9302e5627e | ||
|
|
cf81ddcb4e | ||
|
|
8ec326a43f | ||
|
|
208854e3d9 | ||
|
|
a1e9027fe2 | ||
|
|
e86beb7ee2 | ||
|
|
5b388a0e81 | ||
|
|
33fad9ffa2 | ||
|
|
9c4192c9c7 | ||
|
|
6cf6d46e4b | ||
|
|
581ef744d7 | ||
|
|
cd45143ec6 | ||
|
|
5f6b79e7f4 | ||
|
|
655d6d6047 | ||
|
|
f75ce5fb5c | ||
|
|
bf8811ca64 | ||
|
|
76e9aaf172 | ||
|
|
5a7a54d10c | ||
|
|
2af496e7e2 | ||
|
|
5fe9a613f9 | ||
|
|
65f9dc7acc | ||
|
|
ac20e971c5 | ||
|
|
30132d5d73 | ||
|
|
38775b6be2 | ||
|
|
09e1b2bdcd | ||
|
|
00dacaba56 | ||
|
|
fcc5adda85 | ||
|
|
cc8e897222 | ||
|
|
b97558d504 | ||
|
|
b6cfd0456c | ||
|
|
06047bc958 | ||
|
|
d03ce02788 | ||
|
|
905d1db813 | ||
|
|
848fe719fb | ||
|
|
6141761e63 | ||
|
|
4bbaa65361 | ||
|
|
3c04a9776c | ||
|
|
a715bebaaa | ||
|
|
e74da12d26 | ||
|
|
50d48139a3 | ||
|
|
1a77c383b9 | ||
|
|
0f80e31382 | ||
|
|
01b2d09a98 | ||
|
|
ece3dddfce | ||
|
|
d5d6f8c49a | ||
|
|
939b3b8772 | ||
|
|
1e30f02ecc | ||
|
|
46b79ccd78 | ||
|
|
477be1108a | ||
|
|
158920a786 | ||
|
|
c0de19f23d | ||
|
|
c3b5981dc0 | ||
|
|
6f5867b0fc | ||
|
|
cff35f3611 | ||
|
|
df60512a0d | ||
|
|
e3f20e4b56 | ||
|
|
cf94e8e9c9 | ||
|
|
7af2cc3b60 | ||
|
|
2cfedab339 | ||
|
|
a3f04ffa9b | ||
|
|
bb7243a412 | ||
|
|
f58329d921 | ||
|
|
0002912328 | ||
|
|
e9a072c1ce | ||
|
|
808a723969 | ||
|
|
ac732ecdb0 | ||
|
|
37715114ae | ||
|
|
01c30f23c6 | ||
|
|
4a929bd8e2 | ||
|
|
6ac4486f4d | ||
|
|
9a76a93ea8 | ||
|
|
e8f39f004e | ||
|
|
b3a45a9899 | ||
|
|
ee06a8f175 | ||
|
|
105b98b837 | ||
|
|
2fb68c7007 | ||
|
|
0ddc349557 | ||
|
|
52970c773b | ||
|
|
d5321c2001 | ||
|
|
406aa2a1e7 | ||
|
|
fb8fe84684 | ||
|
|
2c45f0c31e | ||
|
|
cc5adc56ac | ||
|
|
d4beeeda33 | ||
|
|
84edc8ffb0 | ||
|
|
93d05665c2 | ||
|
|
46e78e9d1b | ||
|
|
c6c090052e | ||
|
|
6c1044a699 | ||
|
|
70ff0aa0c1 | ||
|
|
7061cb14fb | ||
|
|
fa6d0fac67 | ||
|
|
5b20c13f92 | ||
|
|
edf90d250f | ||
|
|
770640be58 | ||
|
|
fa7a792180 | ||
|
|
60c7f8e35f | ||
|
|
c90307c585 | ||
|
|
e931bad7d1 | ||
|
|
49cf80db10 | ||
|
|
21ff58f66e | ||
|
|
bda1aefccc | ||
|
|
6648ebed0d | ||
|
|
33431b7b36 | ||
|
|
5c6ad1645d | ||
|
|
8b666ff73d | ||
|
|
a536532e30 | ||
|
|
3b7a202934 | ||
|
|
f1eaf787ec | ||
|
|
1bbb7aff08 | ||
|
|
f5988b2323 | ||
|
|
fdccf4a6b0 | ||
|
|
da0abc3126 | ||
|
|
4a9325d01d | ||
|
|
23fe08cb4b | ||
|
|
971458c039 | ||
|
|
e35eeb8a42 | ||
|
|
9cfc41d96c | ||
|
|
4e71b75a7d | ||
|
|
f67641c52c | ||
|
|
1d3a2d7002 | ||
|
|
94830e80d6 | ||
|
|
5a3969d4fa | ||
|
|
08ce00d798 | ||
|
|
a5dc63b390 | ||
|
|
2c7b6a94e4 | ||
|
|
8a5fe21702 | ||
|
|
4ead5da18a | ||
|
|
d41ea34d6b | ||
|
|
836111b99b | ||
|
|
e5fdc50812 | ||
|
|
92d0c1f593 | ||
|
|
d149d590cf | ||
|
|
3ab07fc43f | ||
|
|
557c6c1d19 | ||
|
|
550a140405 | ||
|
|
88b593e4af | ||
|
|
170b368044 | ||
|
|
07148293a5 | ||
|
|
dd351a3501 | ||
|
|
be367138f6 | ||
|
|
0800047258 | ||
|
|
5c7b288873 | ||
|
|
91feec157e | ||
|
|
587747e030 | ||
|
|
76aa866af8 | ||
|
|
d47de4b17e | ||
|
|
e687e2bf6d | ||
|
|
049d69f9cc | ||
|
|
804c62cc9e | ||
|
|
46ed484b69 | ||
|
|
b1b09837af | ||
|
|
278d171483 | ||
|
|
4bed91d919 | ||
|
|
dc2ccffbd4 | ||
|
|
b36d23c1a9 | ||
|
|
b6d2e10ded | ||
|
|
d43b18b26d | ||
|
|
21d55fa626 | ||
|
|
583a74c0e4 | ||
|
|
6a561f6414 | ||
|
|
b51a19da5c | ||
|
|
c29c48bacf | ||
|
|
466df258d8 | ||
|
|
2d4cd1bd0e | ||
|
|
c1f60c1aa6 | ||
|
|
c1c42cac6b | ||
|
|
a532ef3cea | ||
|
|
a25f9d291e | ||
|
|
0ced9ca913 | ||
|
|
f62bf91e90 | ||
|
|
5dc52d9489 | ||
|
|
ba24d6440a | ||
|
|
529afd8451 | ||
|
|
f1f4d629ad | ||
|
|
bb2a92c980 | ||
|
|
551d85630e | ||
|
|
708ff99513 | ||
|
|
9abbf47a8d | ||
|
|
3c9651ace0 | ||
|
|
c8752ec630 | ||
|
|
b93417fbed | ||
|
|
503658b446 | ||
|
|
efce234dc4 | ||
|
|
654db9caac | ||
|
|
cd72bd1bb4 | ||
|
|
fe8a0657b4 | ||
|
|
0af92cc92e | ||
|
|
db5f4dceb1 | ||
|
|
4adbba2513 | ||
|
|
83b07b6d0d | ||
|
|
e1237f6d58 | ||
|
|
4d9ef0d9b6 | ||
|
|
6b7fe304b8 | ||
|
|
5d03a4719f | ||
|
|
632225ee73 | ||
|
|
dbb6adb453 | ||
|
|
266970bead | ||
|
|
29114ffe29 | ||
|
|
e36c3b9a0b | ||
|
|
c86901547b | ||
|
|
ecd7733a85 | ||
|
|
fedb4f1de6 | ||
|
|
fa802ac19a | ||
|
|
ea5538d955 | ||
|
|
078e249ff7 | ||
|
|
0007d66bf8 | ||
|
|
98d10a7cd3 | ||
|
|
419fbc60b6 | ||
|
|
2ccafff5c3 | ||
|
|
402a2fd03a | ||
|
|
1eaa7a842e | ||
|
|
b13cc25358 | ||
|
|
4b2abc3334 | ||
|
|
716a21b5ac | ||
|
|
8b43e738ba | ||
|
|
5f2a35853d | ||
|
|
aaddc416a1 | ||
|
|
f722e26167 | ||
|
|
155d6a23b9 | ||
|
|
daa82a3c4f | ||
|
|
08e3bb2122 | ||
|
|
b079cc8927 | ||
|
|
e6200f00e3 | ||
|
|
0724cbbf2b | ||
|
|
91b1afad0a | ||
|
|
ae3dc27a3f | ||
|
|
f676774eed | ||
|
|
c61f163454 | ||
|
|
84d33fb847 | ||
|
|
14f57cad78 | ||
|
|
5abf4b277e | ||
|
|
a38a9c643e | ||
|
|
e9d5413084 | ||
|
|
750621e28c | ||
|
|
3301c04a97 | ||
|
|
ba77d862a3 | ||
|
|
9aa16ddfcc | ||
|
|
e338838ade | ||
|
|
47fb82538a | ||
|
|
a2317bf1e1 | ||
|
|
3860d95c8f | ||
|
|
1f0394d0b6 | ||
|
|
6df9c7ca30 | ||
|
|
4a7f9775bf | ||
|
|
28397b334f | ||
|
|
f6bedeeb7c | ||
|
|
6ec9d643f6 | ||
|
|
d6dd297721 | ||
|
|
4a4de389d1 | ||
|
|
6d65c5157a | ||
|
|
8e53ce6184 | ||
|
|
03009d618e | ||
|
|
116d3ae09a | ||
|
|
a14c2101dd | ||
|
|
75d850eead | ||
|
|
8792e78102 | ||
|
|
12957e461d | ||
|
|
8654f124d1 | ||
|
|
1b168bc95e | ||
|
|
06a33aada8 | ||
|
|
30bff1ffab | ||
|
|
0a6c8122d0 | ||
|
|
2dee343ec7 | ||
|
|
3a92a60a8e | ||
|
|
0488415329 | ||
|
|
36e0ff8268 | ||
|
|
ce6c11c16b | ||
|
|
c0207e9b56 | ||
|
|
06ed024f3a | ||
|
|
ad579e5cc4 | ||
|
|
3eeae957f6 | ||
|
|
330d8dc59e | ||
|
|
79f1166c6e | ||
|
|
eb12526b79 | ||
|
|
017961d433 | ||
|
|
79f3f6ee72 | ||
|
|
ca32013665 | ||
|
|
ca6a7578e4 | ||
|
|
02ac92b91d | ||
|
|
3b26263126 | ||
|
|
d6bcc45bb8 | ||
|
|
d0cf88ebc5 | ||
|
|
d1a41a742f | ||
|
|
c3bb76a05e | ||
|
|
8b054c2a67 | ||
|
|
1cc4239e2b | ||
|
|
cacef3866a | ||
|
|
d29e8c18fa | ||
|
|
07566c51a1 | ||
|
|
8f1523f659 | ||
|
|
3ef416d8ef | ||
|
|
a6cb25a3a5 | ||
|
|
e3f4e0d71a | ||
|
|
0bda66cc2e | ||
|
|
8e3a2ad480 | ||
|
|
ac949a14bf | ||
|
|
48550235d5 | ||
|
|
7d3330da74 | ||
|
|
6f572654a2 | ||
|
|
de27275fc9 | ||
|
|
8e59cb9f7e | ||
|
|
0a1b3fedc0 | ||
|
|
42ac90665e | ||
|
|
47b4de7bbf | ||
|
|
acc24b8a57 | ||
|
|
a37b880a3d | ||
|
|
56c66376ff | ||
|
|
33a77bd3a3 | ||
|
|
5ad8f2aa90 | ||
|
|
511d563a1c | ||
|
|
582b688121 | ||
|
|
674dbfed19 | ||
|
|
bde5a6dc19 | ||
|
|
21d3e890f8 | ||
|
|
97d7240c47 | ||
|
|
1c6314f1ff | ||
|
|
057444433d | ||
|
|
3eecbd7135 | ||
|
|
374b6115e1 | ||
|
|
83ffb5092a | ||
|
|
9880e76d25 | ||
|
|
2b81f945df | ||
|
|
6f26a9b97e | ||
|
|
c691bbaedc | ||
|
|
fb5744318a | ||
|
|
fd14986368 | ||
|
|
e1c139dda6 | ||
|
|
d1709c7ffb | ||
|
|
9087b367b6 | ||
|
|
b46c4b4db5 | ||
|
|
c96b843330 | ||
|
|
521d3220b5 | ||
|
|
007888f54d | ||
|
|
47f3a801ba | ||
|
|
455a455d9f | ||
|
|
6b20986d67 | ||
|
|
747dd2ad12 | ||
|
|
1204715525 | ||
|
|
9e41efbd24 | ||
|
|
8d525f711a | ||
|
|
0d8220cc1c | ||
|
|
80dc96a8fb | ||
|
|
fa2b43f241 | ||
|
|
455349880e | ||
|
|
3f70099f01 | ||
|
|
eac68b9d41 | ||
|
|
d40deb737d | ||
|
|
6c7a354822 | ||
|
|
67710daf4b | ||
|
|
2ac4bb7767 | ||
|
|
9a50f5f8b1 | ||
|
|
718eeb4a39 | ||
|
|
a7e6b02107 | ||
|
|
65ec1e973a | ||
|
|
8f72431b7e | ||
|
|
1a1e5047e8 | ||
|
|
35c4770c9b | ||
|
|
145e404211 | ||
|
|
a1822055b6 | ||
|
|
47bfca5365 | ||
|
|
4bfc8f8243 | ||
|
|
c7d7c5c909 | ||
|
|
24dc35d97b | ||
|
|
44a1a429c8 | ||
|
|
652b0aa940 | ||
|
|
dfc25dc29f | ||
|
|
d142a1c849 | ||
|
|
e40ebccbdd | ||
|
|
fa75f47995 | ||
|
|
d993bd3dcf | ||
|
|
40f4d805a8 | ||
|
|
f521a32c00 | ||
|
|
e16371b8a5 | ||
|
|
0c5781ba8d | ||
|
|
863fd7b18d | ||
|
|
d8f27886ad | ||
|
|
e215341d05 | ||
|
|
5e3531a5f2 | ||
|
|
bd96c75bfe | ||
|
|
3010b8ab2e | ||
|
|
7846f0312b | ||
|
|
85e2a11845 | ||
|
|
32b0bb6f7f | ||
|
|
0a83c37272 | ||
|
|
17408b1b33 | ||
|
|
aea3b0c632 | ||
|
|
b4c8f4f9f5 | ||
|
|
1aa07fe11a | ||
|
|
13b1dba540 | ||
|
|
8c05967d75 | ||
|
|
bb0b946fd1 | ||
|
|
7871d361b6 | ||
|
|
0454e72e49 | ||
|
|
42017b6d08 | ||
|
|
b03c818ae6 | ||
|
|
439b204370 | ||
|
|
8a91fcb60c | ||
|
|
b599ac2122 | ||
|
|
a7159b6fb9 | ||
|
|
4e72be1bb6 | ||
|
|
6e3f0fbc24 | ||
|
|
9c49b693f3 | ||
|
|
e3d68cd131 | ||
|
|
972e5c2368 | ||
|
|
4ae39dab32 | ||
|
|
70b6f951d3 | ||
|
|
22ef8538b7 | ||
|
|
3f36bfbfb4 | ||
|
|
788620a5cd | ||
|
|
b2d9bad3a2 | ||
|
|
a9eb27e079 | ||
|
|
7fbec9be75 | ||
|
|
596c759982 | ||
|
|
62afb605da | ||
|
|
19fa2756d5 | ||
|
|
a6c59e4a84 | ||
|
|
1533bc0937 | ||
|
|
6365177a20 | ||
|
|
a235c0b771 | ||
|
|
c39332a496 | ||
|
|
5506f00018 | ||
|
|
d86641e39d | ||
|
|
0d917b06c2 | ||
|
|
e7010e1517 | ||
|
|
87b743969d | ||
|
|
585a931bb2 | ||
|
|
ecc72ee748 | ||
|
|
3507f299de | ||
|
|
df13d46523 | ||
|
|
37b49f5bc0 | ||
|
|
1d251dd643 | ||
|
|
ebc9ee192b | ||
|
|
764f5e22aa | ||
|
|
1711daab76 | ||
|
|
ecc91d743d | ||
|
|
3854ee7a1c | ||
|
|
7aa05153eb | ||
|
|
d92458c554 | ||
|
|
97d98b87ce | ||
|
|
e5adb1056c | ||
|
|
2bce8b10e3 | ||
|
|
2b49669898 | ||
|
|
06ab96c622 | ||
|
|
1cac74d69f | ||
|
|
7ca508d516 | ||
|
|
7156de52c4 | ||
|
|
3a46538680 | ||
|
|
836aae9e9d | ||
|
|
b694c99631 | ||
|
|
d93dc10882 | ||
|
|
f8b4307356 | ||
|
|
af2042e0fd | ||
|
|
ca8fd24252 | ||
|
|
0605a8d656 | ||
|
|
e0eb935b90 | ||
|
|
866760f6db | ||
|
|
85ab8b83a0 | ||
|
|
d17bc12b32 | ||
|
|
17726b36a1 | ||
|
|
e79ed86e38 | ||
|
|
1bc0319f79 | ||
|
|
6bc5cd302a | ||
|
|
4d8914e24b | ||
|
|
e065d70426 | ||
|
|
1205c2f438 | ||
|
|
ab50eca024 | ||
|
|
e193f7a22a | ||
|
|
822e2fd0d4 | ||
|
|
1d2014a3c9 | ||
|
|
e77f990807 | ||
|
|
5b5774e153 | ||
|
|
cb44766c47 | ||
|
|
99aaee50f9 | ||
|
|
93f863aeb7 | ||
|
|
6b5aef09a1 | ||
|
|
738d17ff3b | ||
|
|
6de19a1d6c | ||
|
|
7d259b4eaa | ||
|
|
993309daf1 | ||
|
|
e2653c949b | ||
|
|
de638b66b5 | ||
|
|
61473d8f15 | ||
|
|
67ea020cdf | ||
|
|
842845a9fb | ||
|
|
aaecf82608 | ||
|
|
1d32d747d6 | ||
|
|
584e12ed37 | ||
|
|
6940019102 | ||
|
|
2ff6bee726 | ||
|
|
6c56ddcc22 | ||
|
|
8e8bdaaab3 | ||
|
|
6c91c39aae | ||
|
|
59aaabb9bf | ||
|
|
456e1b033f | ||
|
|
0d59994c42 | ||
|
|
ea9991f749 | ||
|
|
139d95c563 | ||
|
|
87b4576e78 | ||
|
|
e70c15e641 | ||
|
|
8cae8a5720 | ||
|
|
73e00e021a | ||
|
|
b4912db587 | ||
|
|
6fc48a39d9 | ||
|
|
6d3292945e | ||
|
|
9242cdeda9 | ||
|
|
7a402b97ec | ||
|
|
d4ffc6801f | ||
|
|
dff78cf0cc | ||
|
|
4e37b784d2 | ||
|
|
828f4aa8b9 | ||
|
|
6952d6bd12 | ||
|
|
366c73f429 | ||
|
|
5909d72a09 | ||
|
|
8e2689fca2 | ||
|
|
33a2d58891 | ||
|
|
04b8f0584e | ||
|
|
4af569fbcc | ||
|
|
e3818d50ac | ||
|
|
4dcb151f03 | ||
|
|
e56250c84f | ||
|
|
c08fc10ba4 | ||
|
|
a795237898 | ||
|
|
8dbafceebe | ||
|
|
47cf178309 | ||
|
|
adc3b4b726 | ||
|
|
e743875de2 | ||
|
|
8acd734be2 | ||
|
|
d0e24b02b4 | ||
|
|
a243278f53 | ||
|
|
887364062a | ||
|
|
d1f0f19824 | ||
|
|
b8008d74e5 | ||
|
|
2a1c8c7a6c | ||
|
|
ef83954376 | ||
|
|
7a44d29ed4 | ||
|
|
877d14b1e7 | ||
|
|
494e229b03 | ||
|
|
1093c1bac8 | ||
|
|
0eb78a26b3 | ||
|
|
442339a63e | ||
|
|
1a3d79b458 | ||
|
|
f54a834ada | ||
|
|
6804432fa7 | ||
|
|
6f4697d60f | ||
|
|
cf7fd7b34b | ||
|
|
5c7fd82a40 | ||
|
|
db48561289 | ||
|
|
0d86027cd5 | ||
|
|
e32ec709b3 | ||
|
|
89b695dae3 | ||
|
|
ef79711837 | ||
|
|
5c6b230e42 | ||
|
|
b2fd9c5b05 | ||
|
|
1887862a03 | ||
|
|
a66f9249df | ||
|
|
c438e556b1 | ||
|
|
990f746aee | ||
|
|
b760a407fd | ||
|
|
e34f8e0911 | ||
|
|
f1069ee7ed | ||
|
|
573cf1df1a | ||
|
|
09cf3262f1 | ||
|
|
ade279c0ba | ||
|
|
a73695aca9 | ||
|
|
31317f7cbf | ||
|
|
09c980c645 | ||
|
|
19efd41164 | ||
|
|
e4a8793dcc | ||
|
|
5de11039c6 | ||
|
|
aad8e551fe | ||
|
|
27966879b0 | ||
|
|
ea16a51342 | ||
|
|
1bcec096bb | ||
|
|
64686b46b1 | ||
|
|
c5c5af0507 | ||
|
|
14f7ee6116 | ||
|
|
b40f59a6ec | ||
|
|
950264e89e | ||
|
|
28ade72baf | ||
|
|
07dd7c8ccb | ||
|
|
e9d738226a | ||
|
|
db24e4da42 | ||
|
|
f608ac3556 | ||
|
|
a0859229f9 | ||
|
|
8fc6427d0e | ||
|
|
058116b8da | ||
|
|
00ae975c6f | ||
|
|
28147d8aa6 | ||
|
|
777308c42c | ||
|
|
736477d4e4 | ||
|
|
e060029d4c | ||
|
|
559fabeb08 | ||
|
|
4c877148fe | ||
|
|
648cf89893 | ||
|
|
c2c98184e6 | ||
|
|
147374c9c1 | ||
|
|
fd0c9fb9c1 | ||
|
|
24878694f8 | ||
|
|
e262ae3326 | ||
|
|
91d1b18124 | ||
|
|
8d4e06856b | ||
|
|
7c54cebfb3 | ||
|
|
d469be76a7 | ||
|
|
7165ba5245 | ||
|
|
81273cedcf | ||
|
|
0a9143b999 | ||
|
|
c8c3f9b842 | ||
|
|
e324b4a074 | ||
|
|
6a47658502 | ||
|
|
b906da5131 | ||
|
|
8e0e99ba66 | ||
|
|
b1daf18772 | ||
|
|
8424c26068 | ||
|
|
9dfb39c672 | ||
|
|
76899d0d33 | ||
|
|
42012389cd | ||
|
|
c9ad8cd1f9 | ||
|
|
02cfe1f7c0 | ||
|
|
f6458334b6 | ||
|
|
0ed4b97bbc | ||
|
|
f9765a98fb | ||
|
|
dce21063dd | ||
|
|
45cb6925cf | ||
|
|
2756217d9b | ||
|
|
6ec27a7e5d | ||
|
|
a0cbb1ee43 | ||
|
|
1666827ad4 | ||
|
|
2558ca2fb6 | ||
|
|
782b9eef0e | ||
|
|
950b77c0ca | ||
|
|
26a9648c4f | ||
|
|
c384f56e4f | ||
|
|
772c126f1e | ||
|
|
4177286dbb | ||
|
|
4dd3d897dc | ||
|
|
c4f7111aa3 | ||
|
|
b0805d5e1d | ||
|
|
8ca5c7558f | ||
|
|
45e823dec9 | ||
|
|
51ca9825dd | ||
|
|
cb2fd48bb6 | ||
|
|
f4283f6de0 | ||
|
|
a98e8bc915 | ||
|
|
9f760af6c6 | ||
|
|
2f9ad9c3fa | ||
|
|
ae2435cf16 | ||
|
|
f546020429 | ||
|
|
00412c9836 | ||
|
|
9c32d03c1e | ||
|
|
6611ccf3fa | ||
|
|
cfde480e82 | ||
|
|
39e72ae0f8 | ||
|
|
8bda6e8a3a | ||
|
|
f1ccd29e77 | ||
|
|
d037546a13 | ||
|
|
921418af03 | ||
|
|
61cc899867 | ||
|
|
ae5535c425 | ||
|
|
fc2637a696 | ||
|
|
80be260b68 | ||
|
|
74a22169ac | ||
|
|
cb63584511 | ||
|
|
e3015088c2 | ||
|
|
a443196726 | ||
|
|
a5bb61684c | ||
|
|
dad0fcbbe8 | ||
|
|
22139dc4a0 | ||
|
|
4e66ec28cb | ||
|
|
4a9c7384c7 | ||
|
|
29af83f8e3 | ||
|
|
16f59aba96 | ||
|
|
edb70936ae | ||
|
|
7a490aa6d6 | ||
|
|
805c2ad529 | ||
|
|
5d12368c83 | ||
|
|
ff98730906 | ||
|
|
abf95744ee | ||
|
|
530d79f8e3 | ||
|
|
d557deb70d | ||
|
|
d2f870a2a1 | ||
|
|
23d9637dc0 | ||
|
|
3310939983 | ||
|
|
34236932a3 | ||
|
|
5101895cc9 | ||
|
|
dfd2c45454 | ||
|
|
2f832d145f | ||
|
|
4e49155147 | ||
|
|
ee275c85d8 | ||
|
|
795ae524e9 | ||
|
|
a4a027be67 | ||
|
|
c3851d42e6 | ||
|
|
535dbe0aaa | ||
|
|
05558697ca | ||
|
|
3bac7cc7ef | ||
|
|
dccc9711d9 | ||
|
|
365cfd22ee | ||
|
|
9272d26269 | ||
|
|
cea3cab3f4 | ||
|
|
97de6deb56 | ||
|
|
1ecdbf4050 | ||
|
|
b943060797 | ||
|
|
ca80f13b2b | ||
|
|
3a5a2d9de6 | ||
|
|
aef66e3d9e | ||
|
|
63c0cae326 | ||
|
|
8d358899df | ||
|
|
c0cb042998 | ||
|
|
a37f91c2a1 | ||
|
|
ee76e54617 | ||
|
|
3f3b30b5dc | ||
|
|
988468f691 | ||
|
|
3c758609b5 | ||
|
|
e979eece1c | ||
|
|
383d810fd4 | ||
|
|
86a107afc9 | ||
|
|
d14fa0c8b9 | ||
|
|
060603b8d3 | ||
|
|
5bece2cbcc | ||
|
|
c5b36320df | ||
|
|
c07380293e | ||
|
|
8e69a348e6 | ||
|
|
b0ad2c4a2b | ||
|
|
f0606d60d2 | ||
|
|
6a36453f20 | ||
|
|
4ed715d0f3 | ||
|
|
23b2e4488a | ||
|
|
5a85c53174 | ||
|
|
cc06b8b62e | ||
|
|
0df4186191 | ||
|
|
4c31d41920 | ||
|
|
3d4e36455d | ||
|
|
c882e64653 | ||
|
|
b6cd19a83c | ||
|
|
10492c1ee7 | ||
|
|
08118cb445 | ||
|
|
7649164f51 | ||
|
|
c7615fdf00 | ||
|
|
6359fe44af | ||
|
|
2e1ad9684a | ||
|
|
09922f5ee7 | ||
|
|
46552de0f6 | ||
|
|
cfa0d74df9 | ||
|
|
b521236c3e | ||
|
|
7b09cd34db | ||
|
|
5d2ab5bf82 | ||
|
|
bf72dafe5c | ||
|
|
2e7b4242f7 | ||
|
|
56733c6f18 | ||
|
|
0afb629c81 | ||
|
|
af477ff317 | ||
|
|
86dbcaf563 | ||
|
|
ab936adf1c | ||
|
|
7c1d3991f8 | ||
|
|
a550f83452 | ||
|
|
02db71f529 | ||
|
|
c426f68379 | ||
|
|
8f616c13e4 | ||
|
|
0bc4254ab1 | ||
|
|
2cd38297c2 | ||
|
|
5caabab2eb | ||
|
|
ceed309b19 | ||
|
|
ba31285160 | ||
|
|
b345a4b860 | ||
|
|
999fd0f120 | ||
|
|
38b2f32dc0 | ||
|
|
c6379a7c62 | ||
|
|
c0e5f28498 | ||
|
|
c7e6f19920 | ||
|
|
7382a38485 | ||
|
|
6d4d9aa1fb | ||
|
|
912c7265e6 | ||
|
|
e52e70aa5a | ||
|
|
e3192ad3c5 | ||
|
|
ba36055632 | ||
|
|
1a7247c1bb | ||
|
|
8c8334e5a5 | ||
|
|
5a4b5da68e | ||
|
|
ace3401042 | ||
|
|
50ba42aa57 | ||
|
|
6b369775cf | ||
|
|
54ef8f1399 | ||
|
|
99a8d2ec86 | ||
|
|
169aea5ae1 | ||
|
|
740ad823ab | ||
|
|
c150b4f6dc | ||
|
|
4387dd7c15 | ||
|
|
86f7972aa8 | ||
|
|
e259a8c63b | ||
|
|
944eb01fb4 | ||
|
|
a8d3b205ca | ||
|
|
27d9b04080 | ||
|
|
8bb3852944 | ||
|
|
a17e23dc6c | ||
|
|
2cd552b760 | ||
|
|
cf8783644d | ||
|
|
a4192bf99b | ||
|
|
9858b94e87 | ||
|
|
7af556e200 | ||
|
|
70956dca6f | ||
|
|
2db79242c9 | ||
|
|
a973d5dc8a | ||
|
|
9862b75b4b | ||
|
|
32234b44d3 | ||
|
|
2aa095aa4b | ||
|
|
449a33cf17 | ||
|
|
b671f68e00 | ||
|
|
05c7bdedbe | ||
|
|
9195eeb1e1 | ||
|
|
2a7bb2def1 | ||
|
|
b1904bcfa6 | ||
|
|
c8e6a98651 | ||
|
|
24b3705fa1 | ||
|
|
aa4d68760b | ||
|
|
34af7f301d | ||
|
|
33f80371fc | ||
|
|
7ea86f2b16 | ||
|
|
93eb7b349a | ||
|
|
3de9bb9fe1 | ||
|
|
70e741a70b | ||
|
|
d11b9e80b4 | ||
|
|
d865c4cdcf | ||
|
|
e668d10a23 | ||
|
|
cbe2d9a941 | ||
|
|
fb303a4d40 | ||
|
|
6f5220d774 | ||
|
|
eff03a1fd5 | ||
|
|
40a4a5a733 | ||
|
|
ceaeee33e0 | ||
|
|
3a3d9cd41e | ||
|
|
f5360d0d82 | ||
|
|
2ef75cb300 | ||
|
|
a6b24b4d42 | ||
|
|
cacb69542c | ||
|
|
15b05fb057 | ||
|
|
150bc81ee1 | ||
|
|
2c092a882e | ||
|
|
38b9ecb1b1 | ||
|
|
3256af4ffe | ||
|
|
0996291d91 | ||
|
|
d78ea9cffc | ||
|
|
12c8a5d6a4 | ||
|
|
572f7bea2b | ||
|
|
14d66749cc | ||
|
|
3687a706b9 | ||
|
|
e7eac6004b | ||
|
|
7a20875668 | ||
|
|
3566c41b9c | ||
|
|
b8853b76a5 | ||
|
|
aed8ec7741 | ||
|
|
387d087fcd | ||
|
|
d05dfcce78 | ||
|
|
8ed147e1f3 | ||
|
|
d5d0f580b0 | ||
|
|
b5323b65b1 | ||
|
|
1b9ae701f5 | ||
|
|
fad37a3bd1 | ||
|
|
50b838d8ed | ||
|
|
a3b1b9f690 | ||
|
|
bbb2a7d6f4 | ||
|
|
c13c7d0df2 | ||
|
|
a60049de90 | ||
|
|
6506b71776 | ||
|
|
c072894a93 | ||
|
|
29d26f29a6 | ||
|
|
2a92b22128 | ||
|
|
252dc1b130 | ||
|
|
aa455a7239 | ||
|
|
9c6b6ee4f0 | ||
|
|
24ae754901 | ||
|
|
7d71746b21 | ||
|
|
24107229fc |
No files matched your search
@@ -110,3 +110,5 @@ obj-unix/
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.obj
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.res
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.pdb
|
||||
|
||||
retroarch.cfg
|
||||
+17
@@ -3,6 +3,22 @@ language: generic
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: mingw-x86
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-mingw-w64-i686
|
||||
- mingw-w64-i686-dev
|
||||
script:
|
||||
- CROSS_COMPILE=i686-w64-mingw32- ./configure --disable-d3d9 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
|
||||
- compiler: mingw-x64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-mingw-w64-x86-64
|
||||
- mingw-w64-x86-64-dev
|
||||
script:
|
||||
- CROSS_COMPILE=x86_64-w64-mingw32- ./configure --disable-d3d9 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
|
||||
- compiler: gcc
|
||||
- compiler: clang
|
||||
addons:
|
||||
@@ -25,6 +41,7 @@ script:
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS="-j2"
|
||||
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
|
||||
addons:
|
||||
apt:
|
||||
|
||||
+115
-3
@@ -1,5 +1,117 @@
|
||||
# 1.6.2 (future)
|
||||
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
|
||||
# 1.6.9 (future)
|
||||
|
||||
# 1.6.8
|
||||
- Audio: Fix the Audio DSP picker
|
||||
- CHEEVOS: Add support for Atari Lynx cheevos.
|
||||
- CHEEVOS: Add support for RetroAchievements Leaderboards.
|
||||
- GUI: (MaterialUI) Fix crash that happened on context reset with Vulkan.
|
||||
- GUI: (MaterialUI) Skip querying and drawing items that are not visible; Cache content height and bbox calculation.
|
||||
- GUI: (MaterialUI) Fix entry box highlight calculation.
|
||||
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
|
||||
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
|
||||
- GUI: (RGUI) Prevent crashes when using a non-English language reliant on UTF8.
|
||||
- GUI: Add menu option for OSD background color.
|
||||
- GUI: Add menu option for OSD text color.
|
||||
- GUI: Add menu option to remove frame count from OSD.
|
||||
- GUI: Allow wraparound of int/float settings when pressing the left key
|
||||
- INPUT/LIBRETRO: Add support for more mouse buttons (buttons 4/5)
|
||||
- INPUT/LIBRETRO: Add support for analog buttons
|
||||
- INPUT: Always show the controls menu even if descriptors are not set
|
||||
- INPUT: Fix input descriptors not being set on cores that don't implement the controllers interface
|
||||
- INPUT: Apply descriptors only for the amount of cores the core supports
|
||||
- INPUT: Implement keyboard to gamepad input remapping (limited to one gamepad device for now)
|
||||
- INPUT: Fix absolute mouse move handling on the winraw driver
|
||||
- INPUT: Ignore keyboard input if window is not active on udev driver
|
||||
- INPUT: Sanitize the filenames of autoconfig profiles before saving
|
||||
- LOBBIES: Fix crash on navigating left / right from the lobby menu
|
||||
- LOCALIZATION: Update Dutch translation
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Portuguese-Brazilian translation.
|
||||
- LOCALIZATION: Update Russian translation.
|
||||
- LINUX/ARMHF: Set buildbot updater URL to armhf location instead of blank string
|
||||
- LINUX/PI: Broadcom VC4: Add Videocore config option
|
||||
- LINUX/UDEV: Fix - RetroArch reads keyboard input when not focused with the udev input driver.
|
||||
- NETPLAY: Fix disconnection not fully deinitializing Netplay.
|
||||
- NETPLAY: Fix lan rooms when there is more than one room
|
||||
- NETPLAY: Fix lan rooms on systems where all addresses are treated as IPv6
|
||||
- COMMON: Fix clear/free loop conditionals in playlists.
|
||||
- WINDOWS/GDI: Fix flickering of text.
|
||||
- WINDOWS/GDI: Fix graphics corruption on Windows 98
|
||||
- WINDOWS/GDI: Allow compiling without DirectInput8 for NT support
|
||||
- WINDOWS/WGL: Try to use wglSwapLayerBuffers instead of SwapBuffers if possible (for more optimal performance).
|
||||
- WINDOWS: Fix menubar text corruption on Japanese locale systems
|
||||
- WINDOWS: Support Unicode file I/O (can now display CJK characters in file browser for example).
|
||||
- WINDOWS: Support Windows 95, NT3.51, NT4
|
||||
- WINDOWS: add Makefile.griffin targets for msvc6,2003,2005,2010,2012,2013
|
||||
- WII: Use custom, embedded libogc SDK.
|
||||
- WIIU: Initial touchscreen support for WiiU gamepad.
|
||||
- WIIU: Add Cheevos support.
|
||||
- SCANNER: Fix archive scanning.
|
||||
- SCANNER: Support CHD files.
|
||||
- SCANNER: Support Gamecube ISO scanning.
|
||||
- SCANNER: Use primary data track of disc images for CRC lookups rather than cue files. This is slower but finds matches more reliably, and is necessary for CHD files to work at all. Update your databases!
|
||||
- SCANNER: Fall back on looking inside archives when matching MAME/FBA content (most recent cores only). If you had difficulty with content being detected before, you may have better luck now. Update your databases and core info!
|
||||
|
||||
# 1.6.7
|
||||
- SCANNER: Fix directory scanning.
|
||||
- SCANNER: Fix file scanning.
|
||||
- COMMON: Fix 'Disk Image Append' option.
|
||||
- FREEBSD: Compatibility fixes for Video4Linux2 camera driver.
|
||||
- GUI: (MaterialUI) Add disk image append icons.
|
||||
- GUI: (MaterialUI) Improve word wrapping when menu icons are enabled.
|
||||
- GUI: (MaterialUI) Add User Interface -> Appearance -> Menu Icons Enable. You can turn on/off the icons on the lefthand side of the menu entries.
|
||||
- GUI: Performance optimizations for XMB menu driver - only calculates visible items.
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
|
||||
# 1.6.6
|
||||
- 3DS: Fixes serious performance regression that affected every core; rewind was always implicitly enabled.
|
||||
- AUDIO: MOD/S3M/XM sound should now be properly mixed in with the core's sound.
|
||||
- GUI: Visual makeover of MaterialUI.
|
||||
- GUI: Added 'Music', 'Images' and 'Video' collection options to RGUI/MaterialUI.
|
||||
- GUI: Allow the user to add 'Favorites'.
|
||||
- GUI: Allow the user to rename entries.
|
||||
- GUI: Performance optimizations for XMB menu driver.
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- INPUT: Overlay controller response - when we press buttons on the gamepad or keyboard, the corresponding buttons on the overlay will be highlighted as well.
|
||||
- NETBSD: Silence some compilation warnings.
|
||||
- COMMON: Fixed bug 'Deleting an entry from a playlist would not update the list view inside XMB'.
|
||||
- COMMON: Fix inet_ntop_compat on Unix
|
||||
- LOBBY: Add skeleton to add help descriptions to lobbies
|
||||
|
||||
# 1.6.5
|
||||
Skipped this one.
|
||||
|
||||
# 1.6.4
|
||||
|
||||
- ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices
|
||||
- ANDROID: Provide default save / system / state / screenshot locations
|
||||
- AUDIO: Audio mixer supports MOD/S3M/XM file types now!
|
||||
- INPUT: input swap override flag (for remotes) is cleared correctly
|
||||
- INPUT: allow specifying libretro device in remap files
|
||||
- INPUT: allow specifying analog dpad mode in remap files
|
||||
- INPUT: allow saving libretro device to remap files
|
||||
- INPUT: allow saving analog dpad mode to remap files
|
||||
- INPUT: allow removing core and game remap files from the menu
|
||||
- COMMON: Cores can now request to set a 'shared context'. You no longer need to explicitly enable 'Shared Hardware Context' for Citra/OpenLara/Dolphin.
|
||||
- COMMON: Add 'Delete Core' option to Core Information menu.
|
||||
- COMMON: Allow Max Timing Skew to be set to 0.
|
||||
- COMMON: Change the "content dir" behavior so it works on either a flag or an empty directory setting, now platform drivers can provide defaults for save / system / state / screenshot dirs and still allow the content dir functionality, these settings are under settings / saving and flagged as advanced
|
||||
- GUI: You can turn on/off 'Horizontal Animation' now for the XMB menu. Turning animations off can result in a performance boost.
|
||||
- GUI: Fix sublabel word-wrapping in XMB where multi-byte languages were cut off too soon
|
||||
- LOCALIZATION: Update Dutch translation
|
||||
- LOCALIZATION: Update Traditional Chinese translation
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- LOCALIZATION: Update Russian translation
|
||||
- WINDOWS: Provide default save / system / state / screenshot locations
|
||||
- LOBBIES: Show what country the host is in
|
||||
- MENU: Enable OSD text rendering for gdi and libcaca drivers
|
||||
- WINDOWS 98/ME/2K: Set default directory for MSVC 2005 RetroArch version.
|
||||
- WII: Better V-Sync handling, backported from SuperrSonic.
|
||||
- WIIU: Exception handler rewritten.
|
||||
|
||||
# 1.6.3
|
||||
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
|
||||
- CHEEVOS: Add support for N64 cheevos and other small fixes.
|
||||
- CHEEVOS: Add 'Achievements -> Achievements Verbose Mode'. Ability to display cheevos related messages in OSD, useful for RetroAchievements users.
|
||||
- AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted.
|
||||
@@ -23,7 +135,7 @@
|
||||
- VITA: Add cheevos support
|
||||
- VITA: Add support for external USB if mounted
|
||||
- WAYLAND: Fix menu mouse input
|
||||
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter'
|
||||
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter
|
||||
|
||||
# 1.6.0
|
||||
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
|
||||
|
||||
@@ -13,10 +13,6 @@ TARGET = retroarch
|
||||
|
||||
OBJDIR := obj-unix
|
||||
|
||||
ifeq ($(GLOBAL_CONFIG_DIR),)
|
||||
GLOBAL_CONFIG_DIR = /etc
|
||||
endif
|
||||
|
||||
OBJ :=
|
||||
LIBS :=
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
@@ -78,7 +74,7 @@ ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -mwindows
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I. -Ideps -Ideps/stb
|
||||
|
||||
APPEND_CFLAGS := $(CFLAGS)
|
||||
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
|
||||
@@ -208,7 +204,7 @@ install: $(TARGET)
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/monochrome/src; \
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/retroactive/src; \
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/neoactive/src; \
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/retroactive_marked/src; \
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/retrosystem/src; \
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/dot-art/src; \
|
||||
echo "Asset copying done."; \
|
||||
fi
|
||||
|
||||
+191
-133
@@ -3,6 +3,10 @@ DEPS_DIR := $(ROOT_DIR)/deps
|
||||
LIBRETRO_COMM_DIR := $(ROOT_DIR)/libretro-common
|
||||
WANT_WGL = 0
|
||||
|
||||
ifeq ($(HAVE_STACK_USAGE), 1)
|
||||
CFLAGS += -fstack-usage
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT),)
|
||||
HAVE_GL_CONTEXT=0
|
||||
|
||||
@@ -48,10 +52,6 @@ ifeq ($(HAVE_VITA2D), 1)
|
||||
DEFINES += -DHAVE_VITA2D
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FBO), 1)
|
||||
DEFINES += -DHAVE_FBO
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
DEFINES += -DHAVE_DYLIB
|
||||
endif
|
||||
@@ -91,7 +91,7 @@ ifeq ($(HAVE_SHADERPIPELINE), 1)
|
||||
CFLAGS += -DHAVE_SHADERPIPELINE
|
||||
endif
|
||||
|
||||
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include
|
||||
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR)
|
||||
|
||||
# Switches
|
||||
|
||||
@@ -207,7 +207,6 @@ OBJ += frontend/frontend.o \
|
||||
gfx/drivers_font_renderer/bitmapfont.o \
|
||||
tasks/task_autodetect.o \
|
||||
input/input_autodetect_builtin.o \
|
||||
input/input_config.o \
|
||||
input/input_keymaps.o \
|
||||
input/input_remapping.o \
|
||||
tasks/task_overlay.o \
|
||||
@@ -380,106 +379,62 @@ OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBUI), 1)
|
||||
ifeq ($(HAVE_GTKPLUS), 1)
|
||||
CFLAGS += -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
|
||||
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
|
||||
OBJ += deps/libui/gtk/alloc.o \
|
||||
deps/libui/gtk/area.o \
|
||||
deps/libui/gtk/box.o \
|
||||
deps/libui/gtk/button.o \
|
||||
deps/libui/gtk/cellrendererbutton.o \
|
||||
deps/libui/gtk/checkbox.o \
|
||||
deps/libui/gtk/child.o \
|
||||
deps/libui/gtk/colorbutton.o \
|
||||
deps/libui/gtk/combobox.o \
|
||||
deps/libui/gtk/control.o \
|
||||
deps/libui/gtk/datetimepicker.o \
|
||||
deps/libui/gtk/debug.o \
|
||||
deps/libui/gtk/draw.o \
|
||||
deps/libui/gtk/drawmatrix.o \
|
||||
deps/libui/gtk/drawpath.o \
|
||||
deps/libui/gtk/drawtext.o \
|
||||
deps/libui/gtk/editablecombo.o \
|
||||
deps/libui/gtk/entry.o \
|
||||
deps/libui/gtk/fontbutton.o \
|
||||
deps/libui/gtk/form.o \
|
||||
deps/libui/gtk/future.o \
|
||||
deps/libui/gtk/graphemes.o \
|
||||
deps/libui/gtk/grid.o \
|
||||
deps/libui/gtk/group.o \
|
||||
deps/libui/gtk/image.o \
|
||||
deps/libui/gtk/label.o \
|
||||
deps/libui/gtk/main.o \
|
||||
deps/libui/gtk/menu.o \
|
||||
deps/libui/gtk/multilineentry.o \
|
||||
deps/libui/gtk/progressbar.o \
|
||||
deps/libui/gtk/radiobuttons.o \
|
||||
deps/libui/gtk/separator.o \
|
||||
deps/libui/gtk/slider.o \
|
||||
deps/libui/gtk/spinbox.o \
|
||||
deps/libui/gtk/stddialogs.o \
|
||||
deps/libui/gtk/tab.o \
|
||||
deps/libui/gtk/text.o \
|
||||
deps/libui/gtk/util.o \
|
||||
deps/libui/gtk/window.o
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_LIBUI
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
OBJ += deps/libui/win32/alloc.o \
|
||||
deps/libui/win32/area.o \
|
||||
deps/libui/win32/areadraw.o \
|
||||
deps/libui/win32/areaevents.o \
|
||||
deps/libui/win32/areascroll.o \
|
||||
deps/libui/win32/areautil.o \
|
||||
deps/libui/win32/box.o \
|
||||
deps/libui/win32/button.o \
|
||||
deps/libui/win32/checkbox.o \
|
||||
deps/libui/win32/colorbutton.o \
|
||||
deps/libui/win32/colordialog.o \
|
||||
deps/libui/win32/combobox.o \
|
||||
deps/libui/win32/container.o \
|
||||
deps/libui/win32/control.o \
|
||||
deps/libui/win32/d2dscratch.o \
|
||||
deps/libui/win32/datetimepicker.o \
|
||||
deps/libui/win32/debug.o \
|
||||
deps/libui/win32/draw.o \
|
||||
deps/libui/win32/drawmatrix.o \
|
||||
deps/libui/win32/drawpath.o \
|
||||
deps/libui/win32/drawtext.o \
|
||||
deps/libui/win32/dwrite.o \
|
||||
deps/libui/win32/editablecombo.o \
|
||||
deps/libui/win32/entry.o \
|
||||
deps/libui/win32/events.o \
|
||||
deps/libui/win32/fontbutton.o \
|
||||
deps/libui/win32/fontdialog.o \
|
||||
deps/libui/win32/form.o \
|
||||
deps/libui/win32/graphemes.o \
|
||||
deps/libui/win32/grid.o \
|
||||
deps/libui/win32/group.o \
|
||||
deps/libui/win32/init.o \
|
||||
deps/libui/win32/label.o \
|
||||
deps/libui/win32/main.o \
|
||||
deps/libui/win32/menu.o \
|
||||
deps/libui/win32/multilineentry.o \
|
||||
deps/libui/win32/parent.o \
|
||||
deps/libui/win32/progressbar.o \
|
||||
deps/libui/win32/radiobuttons.o \
|
||||
deps/libui/win32/separator.o \
|
||||
deps/libui/win32/sizing.o \
|
||||
deps/libui/win32/slider.o \
|
||||
deps/libui/win32/spinbox.o \
|
||||
deps/libui/win32/stddialogs.o \
|
||||
deps/libui/win32/tab.o \
|
||||
deps/libui/win32/tabpage.o \
|
||||
deps/libui/win32/text.o \
|
||||
deps/libui/win32/utf16.o \
|
||||
deps/libui/win32/utilwin.o \
|
||||
deps/libui/win32/window.o \
|
||||
deps/libui/win32/winpublic.o \
|
||||
deps/libui/win32/winutil.o
|
||||
OBJ += deps/libui/windows/alloc.o \
|
||||
deps/libui/windows/area.o \
|
||||
deps/libui/windows/areadraw.o \
|
||||
deps/libui/windows/areaevents.o \
|
||||
deps/libui/windows/areascroll.o \
|
||||
deps/libui/windows/areautil.o \
|
||||
deps/libui/windows/box.o \
|
||||
deps/libui/windows/button.o \
|
||||
deps/libui/windows/checkbox.o \
|
||||
deps/libui/windows/colorbutton.o \
|
||||
deps/libui/windows/colordialog.o \
|
||||
deps/libui/windows/combobox.o \
|
||||
deps/libui/windows/container.o \
|
||||
deps/libui/windows/control.o \
|
||||
deps/libui/windows/d2dscratch.o \
|
||||
deps/libui/windows/datetimepicker.o \
|
||||
deps/libui/windows/debug.o \
|
||||
deps/libui/windows/draw.o \
|
||||
deps/libui/windows/drawmatrix.o \
|
||||
deps/libui/windows/drawpath.o \
|
||||
deps/libui/windows/drawtext.o \
|
||||
deps/libui/windows/dwrite.o \
|
||||
deps/libui/windows/editablecombo.o \
|
||||
deps/libui/windows/entry.o \
|
||||
deps/libui/windows/events.o \
|
||||
deps/libui/windows/fontbutton.o \
|
||||
deps/libui/windows/fontdialog.o \
|
||||
deps/libui/windows/form.o \
|
||||
deps/libui/windows/graphemes.o \
|
||||
deps/libui/windows/grid.o \
|
||||
deps/libui/windows/group.o \
|
||||
deps/libui/windows/init.o \
|
||||
deps/libui/windows/label.o \
|
||||
deps/libui/windows/main.o \
|
||||
deps/libui/windows/menu.o \
|
||||
deps/libui/windows/multilineentry.o \
|
||||
deps/libui/windows/parent.o \
|
||||
deps/libui/windows/progressbar.o \
|
||||
deps/libui/windows/radiobuttons.o \
|
||||
deps/libui/windows/separator.o \
|
||||
deps/libui/windows/sizing.o \
|
||||
deps/libui/windows/slider.o \
|
||||
deps/libui/windows/spinbox.o \
|
||||
deps/libui/windows/stddialogs.o \
|
||||
deps/libui/windows/tab.o \
|
||||
deps/libui/windows/tabpage.o \
|
||||
deps/libui/windows/text.o \
|
||||
deps/libui/windows/utf16.o \
|
||||
deps/libui/windows/utilwin.o \
|
||||
deps/libui/windows/window.o \
|
||||
deps/libui/windows/winpublic.o \
|
||||
deps/libui/windows/winutil.o
|
||||
LIBS += -luxtheme -ld2d1 -ldwrite -lusp10
|
||||
endif
|
||||
|
||||
else
|
||||
ifneq ($(findstring Darwin,$(OS)),)
|
||||
OBJ += deps/libui/darwin/alloc.o \
|
||||
deps/libui/darwin/area.o \
|
||||
@@ -519,6 +474,49 @@ OBJ += deps/libui/darwin/alloc.o \
|
||||
deps/libui/darwin/util.o \
|
||||
deps/libui/darwin/window.o \
|
||||
deps/libui/darwin/winmoveresize.o
|
||||
else
|
||||
CFLAGS += -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
|
||||
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
|
||||
OBJ += deps/libui/unix/alloc.o \
|
||||
deps/libui/unix/area.o \
|
||||
deps/libui/unix/box.o \
|
||||
deps/libui/unix/button.o \
|
||||
deps/libui/unix/cellrendererbutton.o \
|
||||
deps/libui/unix/checkbox.o \
|
||||
deps/libui/unix/child.o \
|
||||
deps/libui/unix/colorbutton.o \
|
||||
deps/libui/unix/combobox.o \
|
||||
deps/libui/unix/control.o \
|
||||
deps/libui/unix/datetimepicker.o \
|
||||
deps/libui/unix/debug.o \
|
||||
deps/libui/unix/draw.o \
|
||||
deps/libui/unix/drawmatrix.o \
|
||||
deps/libui/unix/drawpath.o \
|
||||
deps/libui/unix/drawtext.o \
|
||||
deps/libui/unix/editablecombo.o \
|
||||
deps/libui/unix/entry.o \
|
||||
deps/libui/unix/fontbutton.o \
|
||||
deps/libui/unix/form.o \
|
||||
deps/libui/unix/future.o \
|
||||
deps/libui/unix/graphemes.o \
|
||||
deps/libui/unix/grid.o \
|
||||
deps/libui/unix/group.o \
|
||||
deps/libui/unix/image.o \
|
||||
deps/libui/unix/label.o \
|
||||
deps/libui/unix/main.o \
|
||||
deps/libui/unix/menu.o \
|
||||
deps/libui/unix/multilineentry.o \
|
||||
deps/libui/unix/progressbar.o \
|
||||
deps/libui/unix/radiobuttons.o \
|
||||
deps/libui/unix/separator.o \
|
||||
deps/libui/unix/slider.o \
|
||||
deps/libui/unix/spinbox.o \
|
||||
deps/libui/unix/stddialogs.o \
|
||||
deps/libui/unix/tab.o \
|
||||
deps/libui/unix/text.o \
|
||||
deps/libui/unix/util.o \
|
||||
deps/libui/unix/window.o
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJ += deps/libui/common/areaevents.o \
|
||||
@@ -630,7 +628,6 @@ ifeq ($(HAVE_RSOUND), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DSOUND), 1)
|
||||
HAVE_DIRECTX=1
|
||||
OBJ += audio/drivers/dsound.o
|
||||
DEFINES += -DHAVE_DSOUND
|
||||
LIBS += -ldxguid -ldsound
|
||||
@@ -728,10 +725,7 @@ endif
|
||||
ifeq ($(HAVE_NUKLEAR), 1)
|
||||
OBJ += menu/drivers/nuklear/nk_common.o
|
||||
OBJ += menu/drivers/nuklear/nk_menu.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_main.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_file_picker.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_shader_parameters.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_settings.o
|
||||
OBJ += menu/drivers/nuklear/nk_wnd_debug.o
|
||||
OBJ += menu/drivers/nuklear.o
|
||||
DEFINES += -DHAVE_NUKLEAR
|
||||
endif
|
||||
@@ -857,7 +851,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_DINPUT), 1)
|
||||
LIBS += -ldinput8 -ldxguid -lole32
|
||||
HAVE_DIRECTX=1
|
||||
DEFINES += -DHAVE_DINPUT
|
||||
OBJ += input/drivers/dinput.o \
|
||||
input/drivers_joypad/dinput_joypad.o
|
||||
@@ -1004,7 +997,7 @@ OBJ += \
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_GLSL
|
||||
OBJ += gfx/drivers/gl.o \
|
||||
gfx/drivers_renderchain/gl_legacy_renderchain.o \
|
||||
gfx/drivers_renderchain/gl2_renderchain.o \
|
||||
$(LIBRETRO_COMM_DIR)/gfx/gl_capabilities.o \
|
||||
gfx/common/gl_common.o \
|
||||
gfx/drivers_font/gl_raster_font.o \
|
||||
@@ -1238,22 +1231,39 @@ ifeq ($(HAVE_CG), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
OBJ += gfx/drivers/d3d.o \
|
||||
gfx/common/d3d_common.o \
|
||||
gfx/drivers_font/d3d_w32_font.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
HAVE_DIRECTX=1
|
||||
DEFINES += -DHAVE_D3D -DHAVE_D3D9
|
||||
HAVE_D3D_COMMON = 1
|
||||
DEFINES += -DHAVE_D3D9
|
||||
LIBS += -ld3d9 -ld3dx9 -ldxguid
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_d3d.o
|
||||
endif
|
||||
|
||||
OBJ += gfx/drivers_font/d3d_w32_font.o
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
LIBS += -lcgD3D9
|
||||
OBJ += gfx/drivers_renderchain/d3d9_cg_renderchain.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_HLSL), 1)
|
||||
LIBS += -lcgD3D9
|
||||
OBJ += gfx/drivers_renderchain/d3d9_hlsl_renderchain.o \
|
||||
gfx/drivers_shader/shader_hlsl.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D8), 1)
|
||||
HAVE_D3D_COMMON = 1
|
||||
DEFINES += -DHAVE_D3D8
|
||||
LIBS += -ld3d8 -ld3dx8 -ldxguid
|
||||
|
||||
OBJ += gfx/drivers_renderchain/d3d8_renderchain.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D_COMMON), 1)
|
||||
DEFINES += -DHAVE_D3D
|
||||
OBJ += gfx/drivers/d3d.o \
|
||||
gfx/common/d3d_common.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_d3d.o
|
||||
endif
|
||||
endif
|
||||
|
||||
#ifeq ($(HAVE_LIBXML2), 1)
|
||||
@@ -1272,12 +1282,14 @@ OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file.o \
|
||||
ifeq ($(HAVE_7ZIP),1)
|
||||
CFLAGS += -I$(DEPS_DIR)/7zip
|
||||
HAVE_COMPRESSION = 1
|
||||
DEFINES += -DHAVE_7ZIP
|
||||
DEFINES += -DHAVE_7ZIP -D_7ZIP_ST
|
||||
7ZOBJ = $(DEPS_DIR)/7zip/7zIn.o \
|
||||
$(DEPS_DIR)/7zip/Bra86.o \
|
||||
$(DEPS_DIR)/7zip/7zFile.o \
|
||||
$(DEPS_DIR)/7zip/7zStream.o \
|
||||
$(DEPS_DIR)/7zip/LzFind.o \
|
||||
$(DEPS_DIR)/7zip/LzmaDec.o \
|
||||
$(DEPS_DIR)/7zip/LzmaEnc.o \
|
||||
$(DEPS_DIR)/7zip/7zCrcOpt.o \
|
||||
$(DEPS_DIR)/7zip/Bra.o \
|
||||
$(DEPS_DIR)/7zip/7zDec.o \
|
||||
@@ -1289,6 +1301,33 @@ ifeq ($(HAVE_7ZIP),1)
|
||||
$(7ZOBJ)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FLAC),1)
|
||||
CFLAGS += -I$(DEPS_DIR)/libFLAC/include
|
||||
DEFINES += -DHAVE_FLAC -DHAVE_STDINT_H -DHAVE_LROUND -DFLAC__HAS_OGG=0 \
|
||||
-DFLAC_PACKAGE_VERSION="\"retroarch\""
|
||||
FLACOBJ = $(DEPS_DIR)/libFLAC/bitmath.o \
|
||||
$(DEPS_DIR)/libFLAC/bitreader.o \
|
||||
$(DEPS_DIR)/libFLAC/cpu.o \
|
||||
$(DEPS_DIR)/libFLAC/crc.o \
|
||||
$(DEPS_DIR)/libFLAC/fixed.o \
|
||||
$(DEPS_DIR)/libFLAC/float.o \
|
||||
$(DEPS_DIR)/libFLAC/format.o \
|
||||
$(DEPS_DIR)/libFLAC/lpc.o \
|
||||
$(DEPS_DIR)/libFLAC/lpc_intrin_avx2.o \
|
||||
$(DEPS_DIR)/libFLAC/lpc_intrin_sse2.o \
|
||||
$(DEPS_DIR)/libFLAC/lpc_intrin_sse41.o \
|
||||
$(DEPS_DIR)/libFLAC/lpc_intrin_sse.o \
|
||||
$(DEPS_DIR)/libFLAC/md5.o \
|
||||
$(DEPS_DIR)/libFLAC/memory.o \
|
||||
$(DEPS_DIR)/libFLAC/stream_decoder.o
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
DEFINES += -DHAVE_FSEEKO
|
||||
# make sure not to use this on legacy Windows versions that don't have W-functions implemented
|
||||
DEFINES += -DNEED_UTF8_SUPPORT
|
||||
FLACOBJ += $(DEPS_DIR)/libFLAC/windows_unicode_filenames.o
|
||||
endif
|
||||
OBJ += $(FLACOBJ)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.o \
|
||||
@@ -1297,6 +1336,7 @@ ifeq ($(HAVE_ZLIB), 1)
|
||||
DEFINES += -DHAVE_ZLIB
|
||||
HAVE_COMPRESSION = 1
|
||||
ifeq ($(HAVE_BUILTINZLIB), 1)
|
||||
INCLUDE_DIRS += -I$(LIBRETRO_COMM_DIR)/include/compat
|
||||
DEFINES += -DWANT_ZLIB
|
||||
else
|
||||
LIBS += -lz
|
||||
@@ -1324,6 +1364,11 @@ ifeq ($(HAVE_RBMP), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_IBXM), 1)
|
||||
DEFINES += -DHAVE_IBXM
|
||||
OBJ += $(DEPS_DIR)/ibxm/ibxm.o
|
||||
endif
|
||||
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp_encode.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax_full.o \
|
||||
@@ -1354,6 +1399,19 @@ OBJ += $(ZLIB_OBJS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_7ZIP),1)
|
||||
ifeq ($(HAVE_FLAC),1)
|
||||
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
|
||||
CFLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/bitstream.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/cdrom.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/chd.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/flac.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/huffman.o \
|
||||
$(LIBRETRO_COMM_DIR)/streams/chd_stream.o
|
||||
endif
|
||||
endif
|
||||
|
||||
# Video4Linux 2
|
||||
|
||||
ifeq ($(HAVE_V4L2),1)
|
||||
@@ -1411,14 +1469,18 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
network/netplay/netplay_buf.o \
|
||||
network/netplay/netplay_room_parse.o
|
||||
|
||||
# Retro Achievements (also depends on threads)
|
||||
# Retro Achievements
|
||||
|
||||
ifeq ($(HAVE_CHEEVOS), 1)
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
DEFINES += -DHAVE_CHEEVOS
|
||||
OBJ += cheevos/cheevos.o \
|
||||
$(LIBRETRO_COMM_DIR)/utils/md5.o
|
||||
endif
|
||||
DEFINES += -DHAVE_CHEEVOS
|
||||
OBJ += cheevos/cheevos.o \
|
||||
cheevos/var.o \
|
||||
cheevos/cond.o \
|
||||
$(LIBRETRO_COMM_DIR)/utils/md5.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_KEYMAPPER), 1)
|
||||
OBJ += input/input_mapper.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_NETWORKGAMEPAD), 1)
|
||||
@@ -1490,10 +1552,6 @@ ifeq ($(HAVE_COMPRESSION), 1)
|
||||
OBJ += tasks/task_decompress.o
|
||||
endif
|
||||
|
||||
#ifeq ($(HAVE_DIRECTX), 1)
|
||||
#$DEFINES += -I"$(DXSDK_DIR)/Include"
|
||||
#endif
|
||||
|
||||
ifeq ($(HAVE_COCOA),1)
|
||||
DEFINES += -DHAVE_MAIN
|
||||
OBJ += input/drivers/cocoa_input.o \
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
|
||||
CFLAGS += -I. -Ideps -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
@@ -25,6 +25,7 @@ OBJ := ctr/ctr_system.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_ctr.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
@@ -73,7 +74,7 @@ else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
|
||||
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
|
||||
|
||||
#CFLAGS += -DRARCH_INTERNAL
|
||||
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ HAVE_RGUI = 1
|
||||
HAVE_SDL = 0
|
||||
HAVE_SDL2 = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_FBO = 1
|
||||
WANT_ZLIB = 1
|
||||
MEMORY = 536870912
|
||||
|
||||
@@ -72,7 +71,7 @@ OBJ += libretro-common/audio/dsp_filters/phaser.o
|
||||
OBJ += libretro-common/audio/dsp_filters/reverb.o
|
||||
OBJ += libretro-common/audio/dsp_filters/wahwah.o
|
||||
|
||||
CFLAGS += -Ideps/libz/
|
||||
CFLAGS += -Ideps/libz -Ideps -Ideps/stb
|
||||
libretro = libretro_emscripten.bc
|
||||
|
||||
ifneq ($(V), 1)
|
||||
|
||||
+715
-253
File diff suppressed because it is too large.
Load diff
+358
@@ -0,0 +1,358 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
export PATH := $(DEVKITPPC)/bin:$(PATH)
|
||||
|
||||
ifeq ($(PLATFORM),)
|
||||
PLATFORM=wii
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# change shell on Snow Leopard
|
||||
#---------------------------------------------------------------------------------
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_R := $(shell uname -r)
|
||||
|
||||
ifneq (,$(findstring Darwin,$(UNAME_S)))
|
||||
ifneq (,$(findstring 10.8.0,$(UNAME_R)))
|
||||
export SHELL=/bin/bash
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools
|
||||
#---------------------------------------------------------------------------------
|
||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# the prefix on the compiler executables
|
||||
#---------------------------------------------------------------------------------
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
export AS := $(PREFIX)as
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
|
||||
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.a:
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -f $@
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.m
|
||||
$(CC) $(OBJCFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.s
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.S
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
bin2s -a 32 $< | $(AS) -o $(@)
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
|
||||
endef
|
||||
|
||||
BUILD := build
|
||||
|
||||
BUILD_LITE = 1
|
||||
CURDIR = .
|
||||
|
||||
export BASEDIR := $(CURDIR)
|
||||
export DEPSDIR := $(BASEDIR)/wii/libogc/deps
|
||||
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
|
||||
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
|
||||
export DBDIR := $(BASEDIR)/wii/libogc/libdb
|
||||
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
|
||||
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
|
||||
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
|
||||
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
|
||||
export LIBS := $(BASEDIR)/wii/libogc/libs
|
||||
|
||||
export INCDIR := $(BASEDIR)/wii/libogc/include
|
||||
|
||||
export LIBDIR := $(LIBS)/$(PLATFORM)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
BBALIB := $(LIBDIR)/libbba
|
||||
OGCLIB := $(LIBDIR)/libogc
|
||||
DBLIB := $(LIBDIR)/libdb
|
||||
BTELIB := $(LIBDIR)/libbte
|
||||
WIIUSELIB := $(LIBDIR)/libwiiuse
|
||||
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
|
||||
STUBSLIB := $(LIBDIR)/libgclibstubs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
|
||||
DEFINCS := -I$(DEFAULTINCDIR)
|
||||
INCLUDES := $(DEFINCS) \
|
||||
-I$(BASEDIR)/wii/libogc \
|
||||
-I$(DEFAULTINCDIR)/netif \
|
||||
-I$(DEFAULTINCDIR)/ipv4 \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/ogc \
|
||||
-I$(DEFAULTINCDIR)/ogc/machine \
|
||||
-I$(DEFAULTINCDIR)/bte \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/wiikeyboard \
|
||||
-I$(DEFAULTINCDIR)/wiiuse \
|
||||
-I$(DEFAULTINCDIR)/di
|
||||
|
||||
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),wii)
|
||||
MACHDEP += -DHW_RVL
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
MACHDEP += -DHW_DOL
|
||||
endif
|
||||
|
||||
CFLAGS := -DLIBOGC_INTERNAL -DNDEBUG -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
|
||||
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
VPATH := $(LWIPDIR) \
|
||||
$(LWIPDIR)/arch/gc \
|
||||
$(LWIPDIR)/arch/gc/netif \
|
||||
$(LWIPDIR)/core \
|
||||
$(LWIPDIR)/core/ipv4 \
|
||||
$(LWIPDIR)/netif \
|
||||
$(OGCDIR) \
|
||||
$(DBDIR) \
|
||||
$(DBDIR)/uIP \
|
||||
$(BTEDIR) \
|
||||
$(WIIUSEDIR) \
|
||||
$(SDCARDDIR) \
|
||||
$(LIBWIIKEYB) \
|
||||
$(STUBSDIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_LWIP := $(LWIPDIR)/network.c \
|
||||
$(LWIPDIR)/netio.c \
|
||||
$(LWIPDIR)/arch/gc/netif/gcif.c \
|
||||
$(LWIPDIR)/core/inet.c \
|
||||
$(LWIPDIR)/core/mem.c \
|
||||
$(LWIPDIR)/core/dhcp.c \
|
||||
$(LWIPDIR)/core/raw.c \
|
||||
$(LWIPDIR)/core/memp.c \
|
||||
$(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c \
|
||||
$(LWIPDIR)/core/stats.c \
|
||||
$(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c \
|
||||
$(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c \
|
||||
$(LWIPDIR)/core/udp.c \
|
||||
$(LWIPDIR)/core/ipv4/icmp.c \
|
||||
$(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_frag.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_addr.c \
|
||||
$(LWIPDIR)/netif/etharp.c \
|
||||
$(LWIPDIR)/netif/loopif.c
|
||||
|
||||
LWIPOBJ := $(SOURCES_LWIP:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_OGC := \
|
||||
$(OGCDIR)/console.c \
|
||||
$(OGCDIR)/lwp_priority.c \
|
||||
$(OGCDIR)/lwp_queue.c \
|
||||
$(OGCDIR)/lwp_threadq.c \
|
||||
$(OGCDIR)/lwp_threads.c \
|
||||
$(OGCDIR)/lwp_sema.c \
|
||||
$(OGCDIR)/lwp_messages.c \
|
||||
$(OGCDIR)/lwp.c \
|
||||
$(OGCDIR)/lwp_stack.c \
|
||||
$(OGCDIR)/lwp_mutex.c \
|
||||
$(OGCDIR)/lwp_watchdog.c \
|
||||
$(OGCDIR)/lwp_wkspace.c \
|
||||
$(OGCDIR)/lwp_objmgr.c \
|
||||
$(OGCDIR)/lwp_heap.c \
|
||||
$(OGCDIR)/sys_state.c \
|
||||
$(OGCDIR)/exception.c \
|
||||
$(OGCDIR)/irq.c \
|
||||
$(OGCDIR)/semaphore.c \
|
||||
$(OGCDIR)/video.c \
|
||||
$(OGCDIR)/pad.c \
|
||||
$(OGCDIR)/exi.c \
|
||||
$(OGCDIR)/mutex.c \
|
||||
$(OGCDIR)/arqueue.c \
|
||||
$(OGCDIR)/arqmgr.c \
|
||||
$(OGCDIR)/system.c \
|
||||
$(OGCDIR)/cond.c \
|
||||
$(OGCDIR)/gx.c \
|
||||
$(OGCDIR)/gu.c \
|
||||
$(OGCDIR)/audio.c \
|
||||
$(OGCDIR)/cache.c \
|
||||
$(OGCDIR)/decrementer.c \
|
||||
$(OGCDIR)/message.c \
|
||||
$(OGCDIR)/card.c \
|
||||
$(OGCDIR)/aram.c \
|
||||
$(OGCDIR)/depackrnc1.c \
|
||||
$(OGCDIR)/dsp.c \
|
||||
$(OGCDIR)/si.c \
|
||||
$(OGCDIR)/tpl.c \
|
||||
$(OGCDIR)/ipc.c \
|
||||
$(OGCDIR)/console_font_8x16.c \
|
||||
$(OGCDIR)/timesupp.c \
|
||||
$(OGCDIR)/lock_supp.c \
|
||||
$(OGCDIR)/newlibc.c \
|
||||
$(OGCDIR)/usbgecko.c \
|
||||
$(OGCDIR)/usbmouse.c \
|
||||
$(OGCDIR)/sbrk.c \
|
||||
$(OGCDIR)/malloc_lock.c \
|
||||
$(OGCDIR)/kprintf.c \
|
||||
$(OGCDIR)/stm.c \
|
||||
$(OGCDIR)/ios.c \
|
||||
$(OGCDIR)/es.c \
|
||||
$(OGCDIR)/isfs.c \
|
||||
$(OGCDIR)/usb.c \
|
||||
$(OGCDIR)/network_common.c \
|
||||
$(OGCDIR)/sdgecko_io.c \
|
||||
$(OGCDIR)/sdgecko_buf.c \
|
||||
$(OGCDIR)/gcsd.c \
|
||||
$(OGCDIR)/argv.c \
|
||||
$(OGCDIR)/network_wii.c \
|
||||
$(OGCDIR)/wiisd.c \
|
||||
$(OGCDIR)/conf.c \
|
||||
$(OGCDIR)/usbstorage.c \
|
||||
$(OGCDIR)/texconv.c \
|
||||
$(OGCDIR)/wiilaunch.c
|
||||
|
||||
SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
|
||||
$(OGCDIR)/decrementer_handler.S \
|
||||
$(OGCDIR)/depackrnc.S \
|
||||
$(OGCDIR)/exception_handler.S \
|
||||
$(OGCDIR)/gu_psasm.S \
|
||||
$(OGCDIR)/irq_handler.S \
|
||||
$(OGCDIR)/lwp_handler.S \
|
||||
$(OGCDIR)/ogc_crt0.S \
|
||||
$(OGCDIR)/system_asm.S \
|
||||
$(OGCDIR)/video_asm.S
|
||||
|
||||
|
||||
ifneq ($(BUILD_LITE), 1)
|
||||
SOURCES_OGC += $(OGCDIR)/dvd.c
|
||||
endif
|
||||
|
||||
OGCOBJ := $(SOURCES_OGC:.c=.o) $(SOURCES_OGC_ASM:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_DB := \
|
||||
$(DBDIR)/uIP/uip_ip.c \
|
||||
$(DBDIR)/uIP/uip_tcp.c \
|
||||
$(DBDIR)/uIP/uip_pbuf.c \
|
||||
$(DBDIR)/uIP/uip_netif.c \
|
||||
$(DBDIR)/uIP/uip_arp.c \
|
||||
$(DBDIR)/uIP/uip_arch.c \
|
||||
$(DBDIR)/uIP/uip_icmp.c \
|
||||
$(DBDIR)/uIP/memb.c \
|
||||
$(DBDIR)/uIP/memr.c \
|
||||
$(DBDIR)/uIP/bba.c \
|
||||
$(DBDIR)/tcpip.c \
|
||||
$(DBDIR)/debug.c \
|
||||
$(DBDIR)/debug_handler.c \
|
||||
$(DBDIR)/debug_supp.c \
|
||||
$(DBDIR)/geckousb.c
|
||||
|
||||
DBOBJ := $(SOURCES_DB:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_BTE := \
|
||||
$(BTEDIR)/bte.c \
|
||||
$(BTEDIR)/hci.c \
|
||||
$(BTEDIR)/l2cap.c \
|
||||
$(BTEDIR)/btmemb.c \
|
||||
$(BTEDIR)/btmemr.c \
|
||||
$(BTEDIR)/btpbuf.c \
|
||||
$(BTEDIR)/physbusif.c
|
||||
|
||||
BTEOBJ := $(SOURCES_BTE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIUSE := \
|
||||
$(WIIUSEDIR)/classic.c \
|
||||
$(WIIUSEDIR)/dynamics.c \
|
||||
$(WIIUSEDIR)/events.c \
|
||||
$(WIIUSEDIR)/io.c \
|
||||
$(WIIUSEDIR)/io_wii.c \
|
||||
$(WIIUSEDIR)/ir.c \
|
||||
$(WIIUSEDIR)/nunchuk.c \
|
||||
$(WIIUSEDIR)/wiiuse.c \
|
||||
$(WIIUSEDIR)/speaker.c \
|
||||
$(WIIUSEDIR)/wpad.c \
|
||||
$(WIIUSEDIR)/motion_plus.c
|
||||
|
||||
WIIUSEOBJ := $(SOURCES_WIIUSE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIKEYB = $(LIBWIIKEYB)/usbkeyboard.c \
|
||||
$(LIBWIIKEYB)/keyboard.c \
|
||||
$(LIBWIIKEYB)/ukbdmap.c \
|
||||
$(LIBWIIKEYB)/wskbdutil.c
|
||||
|
||||
WIIKEYBLIBOBJ := $(SOURCES_WIIKEYB:.c=.o)
|
||||
|
||||
LIBRARIES := $(OGCLIB).a $(DBLIB).a
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
LIBRARIES += $(BBALIB).a
|
||||
endif
|
||||
ifeq ($(PLATFORM),wii)
|
||||
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
|
||||
endif
|
||||
|
||||
all: $(LIBRARIES)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BBALIB).a: $(LWIPOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OGCLIB).a: $(OGCOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(DBLIB).a: $(DBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BTELIB).a: $(BTEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIUSELIB).a: $(WIIUSEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
#---------------------------------------------------------------------------------
|
||||
rm -fr $(LWIPOBJ) $(OGCOBJ) $(DBOBJ) $(BTEOBJ) $(WIIUSEOBJ) $(WIIKEYBLIBOBJ)
|
||||
rm -f *.map
|
||||
@@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
include version.all
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
include version.all
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@@ -33,7 +33,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Idefines -Ideps/libz -Ilibretro-common/include
|
||||
INCDIRS = -I. -Idefines -Ideps/libz -Ilibretro-common/include -Ideps -Ideps/stb
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -101,7 +101,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LANGEXTRA -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LANGEXTRA -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN
|
||||
|
||||
#DEFINES += -DHAVE_IMAGEVIEWER
|
||||
|
||||
@@ -163,20 +163,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
include version.all
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@@ -31,7 +31,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Idefines
|
||||
INCDIRS = -I. -Idefines -Ideps -Ideps/stb
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -99,7 +99,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
@@ -159,20 +159,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+13
-3
@@ -16,9 +16,20 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
PPU_OPTIMIZE_LV := -O2 -DNDEBUG
|
||||
endif
|
||||
|
||||
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
|
||||
|
||||
PPU_CFLAGS += -I. -Ilibretro-common/include -Ideps/libz -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
INCFLAGS = -I. -Idefines -Ilibretro-common/include -Ideps/libz
|
||||
DEFINES = -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
|
||||
PPU_CXXFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
|
||||
|
||||
PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/frontend_driver.c \
|
||||
frontend/drivers/platform_ps3.c \
|
||||
@@ -29,6 +40,7 @@ PPU_SRCS = frontend/frontend_salamander.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/stdstring.c \
|
||||
libretro-common/encodings/encoding_utf.c \
|
||||
libretro-common/compat/compat_strl.c \
|
||||
libretro-common/compat/compat_strcasestr.c \
|
||||
libretro-common/streams/file_stream.c \
|
||||
@@ -60,8 +72,6 @@ endif
|
||||
|
||||
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
|
||||
|
||||
PPU_OPTIMIZE_LV := -O2
|
||||
|
||||
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.target.mk
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
include version.all
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
@@ -17,7 +17,7 @@ ELF_TARGET := retroarch_psl1ght.elf
|
||||
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
|
||||
@@ -89,7 +89,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
@@ -121,7 +121,7 @@ pkg: $(ELF_TARGET) create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
|
||||
|
||||
pkg-signed: $(ELF_TARGET) create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
INCDIR = deps/libz deps/7zip libretro-common/include
|
||||
INCDIR = deps deps/stb deps/libz deps/7zip libretro-common/include
|
||||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ OBJS = frontend/frontend_salamander.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
|
||||
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb
|
||||
LIBDIRS := -L.
|
||||
|
||||
ARCHFLAGS := -march=armv7-a -mfpu=neon -mfloat-abi=hard -DVITA
|
||||
|
||||
@@ -41,6 +41,7 @@ OBJS = frontend/frontend_salamander.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
|
||||
+28
-2
@@ -6,6 +6,7 @@
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
EXTERNAL_LIBOGC = 0
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -29,13 +30,23 @@ ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
|
||||
DOL_TARGET := retroarch-salamander_wii.dol
|
||||
ELF_TARGET := retroarch-salamander_wii.elf
|
||||
|
||||
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ilibretro-common/include -Ideps/libz
|
||||
INCLUDE := -I. -Ilibretro-common/include -Ideps/libz
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
INCLUDE += -I$(DEVKITPRO)/libogc/include
|
||||
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
|
||||
else
|
||||
INCLUDE += -Iwii/libogc/include
|
||||
LIBDIRS := -Lwii/libogc/libs/wii -L.
|
||||
endif
|
||||
|
||||
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
|
||||
LIBS := -lfat -lwiiuse -logc -lbte
|
||||
LIBS := -lwiiuse -logc -lbte
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
LIBS += -lfat
|
||||
endif
|
||||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
@@ -51,6 +62,7 @@ OBJ = frontend/frontend_salamander.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
@@ -58,6 +70,20 @@ OBJ = frontend/frontend_salamander.o \
|
||||
verbosity.o \
|
||||
$(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
else
|
||||
OBJ += wii/libogc/libfat/cache.o \
|
||||
wii/libogc/libfat/directory.o \
|
||||
wii/libogc/libfat/disc.o \
|
||||
wii/libogc/libfat/fatdir.o \
|
||||
wii/libogc/libfat/fatfile.o \
|
||||
wii/libogc/libfat/file_allocation_table.o \
|
||||
wii/libogc/libfat/filetime.o \
|
||||
wii/libogc/libfat/libfat.o \
|
||||
wii/libogc/libfat/lock.o \
|
||||
wii/libogc/libfat/partition.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
|
||||
+30
-14
@@ -5,6 +5,10 @@ DEBUG = 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
ifneq ($(V), 1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS ?=
|
||||
PC_DEVELOPMENT_TCP_PORT ?=
|
||||
|
||||
@@ -52,6 +56,7 @@ else
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_KEYMAPPER = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 1
|
||||
@@ -61,6 +66,7 @@ else
|
||||
HAVE_LANGEXTRA = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_CHEEVOS = 1
|
||||
# WANT_IFADDRS = 1
|
||||
|
||||
include Makefile.common
|
||||
@@ -97,6 +103,7 @@ else
|
||||
OBJ += libretro-common/audio/dsp_filters/wahwah.o
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_KEYMAPPER
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
@@ -127,7 +134,7 @@ else
|
||||
endif
|
||||
|
||||
|
||||
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
|
||||
INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
|
||||
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
|
||||
|
||||
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
|
||||
@@ -199,41 +206,50 @@ all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
@$(if $(Q), echo CXX $<,)
|
||||
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
@$(if $(Q), echo CC $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
@$(if $(Q), echo AS $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
@$(if $(Q), echo AS $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
%.a:
|
||||
$(AR) -rc $@ $^
|
||||
@$(if $(Q), echo AR $<,)
|
||||
$(Q)$(AR) -rc $@ $^
|
||||
|
||||
%.depend: ;
|
||||
|
||||
|
||||
$(ELF2RPL):
|
||||
$(MAKE) -C wiiu/wut/elf2rpl/
|
||||
@$(if $(Q), echo MAKE $@,)
|
||||
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
|
||||
|
||||
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
@$(if $(Q), echo LD $@,)
|
||||
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
@$(if $(Q), echo LD $@,)
|
||||
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
|
||||
-$(ELF2RPL) $(TARGET).rpx.elf $@
|
||||
@$(if $(Q), echo ELF2RPL $@,)
|
||||
$(Q)-$(ELF2RPL) $(TARGET).rpx.elf $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
|
||||
|
||||
@@ -16,6 +16,7 @@ OBJ += frontend/frontend_salamander.o
|
||||
OBJ += frontend/frontend_driver.o
|
||||
OBJ += frontend/drivers/platform_wiiu.o
|
||||
OBJ += frontend/drivers/platform_null.o
|
||||
OBJ += libretro-common/encodings/encoding_utf.o
|
||||
OBJ += libretro-common/compat/compat_strcasestr.o
|
||||
OBJ += libretro-common/file/file_path.o
|
||||
OBJ += libretro-common/string/stdstring.o
|
||||
|
||||
+2
-3
@@ -5,7 +5,6 @@ HAVE_XAUDIO = 1
|
||||
HAVE_DSOUND = 1
|
||||
HAVE_WASAPI = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_FBO = 1
|
||||
HAVE_DYLIB = 1
|
||||
HAVE_D3D9 = 1
|
||||
HAVE_NETWORKING = 1
|
||||
@@ -122,8 +121,8 @@ else
|
||||
CXXFLAGS += -O3 -ffast-math
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
|
||||
else
|
||||
|
||||
@@ -8,6 +8,12 @@ Popular examples of implementations for this API includes videogame system emula
|
||||
more generalized 3D programs.
|
||||
These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## libretro
|
||||
|
||||
[libretro](http://libretro.com) is an API that exposes generic audio/video/input callbacks.
|
||||
@@ -30,13 +36,16 @@ or visit our IRC channel: #retroarch @ irc.freenode.org.
|
||||
|
||||
## Documentation
|
||||
|
||||
See our [wiki](https://github.com/libretro/RetroArch/wiki). On Unix, man-pages are provided.
|
||||
See our [Documentation Center](https://docs.libretro.com/). On Unix, man-pages are provided.
|
||||
More developer-centric stuff is found [here](https://github.com/libretro/libretro.github.com/wiki/Documentation-devs).
|
||||
|
||||
## Related projects
|
||||
|
||||
- Cg/HLSL shaders: [common-shaders](https://github.com/libretro/common-shaders)
|
||||
- slang shaders: [slang-shaders](https://github.com/libretro/slang-shaders)
|
||||
- GLSL shaders: [glsl-shaders](https://github.com/libretro/glsl-shaders)
|
||||
- Helper scripts to build libretro implementations: [libretro-super](https://github.com/libretro/libretro-super)
|
||||
- GitHub mirrors of projects, useful for generating diff files: [libretro-mirrors](https://github.com/libretro-mirrors/)
|
||||
|
||||
## Philosophy
|
||||
|
||||
@@ -52,12 +61,19 @@ RetroArch also emphasizes on being easy to integrate into various launcher front
|
||||
|
||||
## Platforms
|
||||
|
||||
RetroArch has been ported to the following platforms outside PC:
|
||||
RetroArch has been ported to the following platforms:
|
||||
|
||||
- Windows
|
||||
- Linux
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- MacOS
|
||||
- PlayStation 3
|
||||
- PlayStation Portable
|
||||
- Original Xbox
|
||||
- Xbox 360 (Libxenon/XeXDK)
|
||||
- Xbox 1
|
||||
- Wii, Gamecube (Libogc)
|
||||
- Wii, GameCube (Libogc)
|
||||
- WiiU
|
||||
- Nintendo 3DS
|
||||
- Raspberry Pi
|
||||
- Android
|
||||
@@ -119,94 +135,5 @@ Users only need to configure a certain option if the desired value deviates from
|
||||
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
|
||||
|
||||
## Compiling and installing
|
||||
**Linux**
|
||||
|
||||
- Prerequisites:
|
||||
```bash
|
||||
sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
|
||||
```
|
||||
- Compiling:
|
||||
```bash
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
**Mac**
|
||||
|
||||
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
**PC**
|
||||
|
||||
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
|
||||
|
||||
**PlayStation 3**
|
||||
|
||||
RetroArch PS3 needs to be compiled in the following order:
|
||||
|
||||
1) Compile RetroArch Salamander
|
||||
|
||||
make -f Makefile.ps3.salamander
|
||||
|
||||
2) Finally, compile RetroArch packed together with the GUI:
|
||||
|
||||
make -f Makefile.ps3
|
||||
|
||||
**PlayStation 3 - Creating a PKG installable file**
|
||||
|
||||
You can add `pkg` as a parameter in order to make a PKG file - for example:
|
||||
|
||||
make -f Makefile.ps3 pkg
|
||||
|
||||
This creates an NPDRM package. This can be installed on debug PS3s.
|
||||
|
||||
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
|
||||
|
||||
make -f Makefile.ps3 pkg-signed
|
||||
|
||||
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
|
||||
|
||||
make -f Makefile.ps3 pkg-signed-cfw
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called ***`libretro_ps3.a`***.
|
||||
|
||||
**Xbox 360 (XeXDK)**
|
||||
|
||||
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
|
||||
|
||||
The solution file can be found at the following location:
|
||||
|
||||
pkg/msvc-360/RetroArch-360.sln
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
called ***`libretro_xdk360.lib`***.
|
||||
|
||||
**Xbox 360 (Libxenon)**
|
||||
|
||||
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
|
||||
|
||||
make -f Makefile.xenon
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called ***`libretro_xenon360.a`***.
|
||||
|
||||
**Wii**
|
||||
|
||||
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
|
||||
|
||||
make -f Makefile.griffin platform=wii
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called ***`libretro_wii.a`***.
|
||||
Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://docs.libretro.com/).
|
||||
+34
-12
@@ -212,10 +212,13 @@ static void compute_audio_buffer_statistics(void)
|
||||
accum_var += diff * diff;
|
||||
}
|
||||
|
||||
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
|
||||
avg_filled = 1.0f - (float)avg / audio_driver_buffer_size;
|
||||
deviation = (float)stddev / audio_driver_buffer_size;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1200
|
||||
/* FIXME: error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 */
|
||||
#else
|
||||
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
|
||||
avg_filled = 1.0f - (float)avg / audio_driver_buffer_size;
|
||||
deviation = (float)stddev / audio_driver_buffer_size;
|
||||
#endif
|
||||
low_water_size = (unsigned)(audio_driver_buffer_size * 3 / 4);
|
||||
high_water_size = (unsigned)(audio_driver_buffer_size / 4);
|
||||
|
||||
@@ -750,15 +753,14 @@ void audio_driver_dsp_filter_free(void)
|
||||
|
||||
void audio_driver_dsp_filter_init(const char *device)
|
||||
{
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
fill_pathname_basedir(basedir, device, sizeof(basedir));
|
||||
char *basedir = (char*)calloc(PATH_MAX_LENGTH, sizeof(*basedir));
|
||||
char *ext_name = (char*)calloc(PATH_MAX_LENGTH, sizeof(*ext_name));
|
||||
size_t str_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
fill_pathname_basedir(basedir, device, str_size);
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
if (!frontend_driver_get_core_extension(ext_name, str_size))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, true, false, false);
|
||||
@@ -770,9 +772,18 @@ void audio_driver_dsp_filter_init(const char *device)
|
||||
if (!audio_driver_dsp)
|
||||
goto error;
|
||||
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
free(basedir);
|
||||
free(ext_name);
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
free(basedir);
|
||||
free(ext_name);
|
||||
#endif
|
||||
if (!audio_driver_dsp)
|
||||
RARCH_ERR("[DSP]: Failed to initialize DSP filter \"%s\".\n", device);
|
||||
}
|
||||
@@ -914,6 +925,11 @@ bool audio_driver_mixer_extension_supported(const char *ext)
|
||||
|
||||
#ifdef HAVE_STB_VORBIS
|
||||
string_list_append(str_list, "ogg", attr);
|
||||
#endif
|
||||
#ifdef HAVE_IBXM
|
||||
string_list_append(str_list, "mod", attr);
|
||||
string_list_append(str_list, "s3m", attr);
|
||||
string_list_append(str_list, "xm", attr);
|
||||
#endif
|
||||
string_list_append(str_list, "wav", attr);
|
||||
|
||||
@@ -945,7 +961,8 @@ static int audio_mixer_find_index(audio_mixer_sound_t *sound)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void audio_mixer_play_stop_cb(audio_mixer_sound_t *sound, unsigned reason)
|
||||
static void audio_mixer_play_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason)
|
||||
{
|
||||
int idx = audio_mixer_find_index(sound);
|
||||
|
||||
@@ -1008,6 +1025,9 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
|
||||
case AUDIO_MIXER_TYPE_OGG:
|
||||
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_MOD:
|
||||
handle = audio_mixer_load_mod(buf, (int32_t)params->bufsize);
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_NONE:
|
||||
free(buf);
|
||||
return false;
|
||||
@@ -1152,7 +1172,9 @@ bool audio_driver_callback(void)
|
||||
|
||||
bool audio_driver_has_callback(void)
|
||||
{
|
||||
return audio_callback.callback;
|
||||
if (audio_callback.callback)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool audio_driver_toggle_mute(void)
|
||||
|
||||
@@ -322,7 +322,11 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
|
||||
|
||||
RARCH_LOG("DirectSound devices:\n");
|
||||
#ifndef _XBOX
|
||||
DirectSoundEnumerate(enumerate_cb, &dev);
|
||||
#ifdef UNICODE
|
||||
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
|
||||
#else
|
||||
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
|
||||
|
||||
@@ -1523,7 +1523,7 @@ static struct pcm_params *pcm_params_get(unsigned int card, unsigned int device,
|
||||
snprintf(fn, sizeof(fn), "/dev/snd/pcmC%uD%u%c", card, device,
|
||||
flags & PCM_IN ? 'c' : 'p');
|
||||
|
||||
fd = open(fn, O_RDWR);
|
||||
fd = open(fn, O_RDWR|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf(stderr, "cannot open device '%s'\n", fn);
|
||||
|
||||
+244
-162
@@ -38,36 +38,92 @@
|
||||
|
||||
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); /* DEVPROP_TYPE_STRING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->Item(nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->Start() )
|
||||
#define _IAudioClient_Stop(This) ( (This)->Stop() )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->GetCurrentPadding(pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->GetBuffer(NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->ReleaseBuffer(NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->GetService(riid,ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->SetEventHandle(eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->GetBufferSize(pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->GetStreamLatency(phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->GetDevicePeriod(phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->Activate(iid,(dwClsCtx),pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->EnumAudioEndpoints(dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->GetDefaultAudioEndpoint(dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->OpenPropertyStore(stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) ((This)->GetId(ppstrId))
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->GetValue(key,pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->GetCount(cProps) )
|
||||
#else
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->lpVtbl->Item(This,nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->lpVtbl -> Start(This) )
|
||||
#define _IAudioClient_Stop(This) ( (This)->lpVtbl -> Stop(This) )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->lpVtbl -> GetService(This,&(riid),ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->lpVtbl->Activate(This,&(iid),dwClsCtx,pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->lpVtbl->EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->lpVtbl->GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->lpVtbl->OpenPropertyStore(This,stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) (This)->lpVtbl->GetId(This,ppstrId)
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->lpVtbl -> GetValue(This,&(key),pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->lpVtbl -> GetCount(This,cProps) )
|
||||
#endif
|
||||
|
||||
#define WASAPI_WARN(bool_exp, err_str, warn_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_warn(err_str);\
|
||||
#define WASAPI_WARN(bool_exp, err_str, warn_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_WARN("[WASAPI]: %s.\n", err_str); \
|
||||
warn_exp; }
|
||||
|
||||
#define WASAPI_CHECK(bool_exp, err_str, err_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_err(err_str);\
|
||||
#define WASAPI_CHECK(bool_exp, err_str, err_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_ERR("[WASAPI]: %s.\n", err_str); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_HR_CHECK(hr, fun_str, err_exp)\
|
||||
if (FAILED(hr)) {\
|
||||
wasapi_com_err(fun_str, hr);\
|
||||
#define WASAPI_HR_CHECK(hr, fun_str, err_exp) \
|
||||
if (FAILED(hr)) { \
|
||||
RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_HR_WARN(hr, fun_str, warn_exp)\
|
||||
if (FAILED(hr)) {\
|
||||
wasapi_com_warn(fun_str, hr);\
|
||||
#define WASAPI_HR_WARN(hr, fun_str, warn_exp) \
|
||||
if (FAILED(hr)) { \
|
||||
RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
|
||||
warn_exp; }
|
||||
|
||||
#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_sys_err(fun_str);\
|
||||
#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun_str, GetLastError()); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_RELEASE(iface)\
|
||||
if(iface) {\
|
||||
#ifdef __cplusplus
|
||||
#define WASAPI_RELEASE(iface) \
|
||||
if(iface) \
|
||||
{ \
|
||||
iface->Release(); \
|
||||
iface = NULL; \
|
||||
}
|
||||
#else
|
||||
#define WASAPI_RELEASE(iface) \
|
||||
if(iface) \
|
||||
{ \
|
||||
iface->lpVtbl->Release(iface);\
|
||||
iface = NULL; }\
|
||||
iface = NULL; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define WASAPI_FREE(ptr)\
|
||||
if(ptr) {\
|
||||
@@ -81,48 +137,18 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IMMDevice *device;
|
||||
IAudioClient *client;
|
||||
IAudioRenderClient *renderer;
|
||||
HANDLE write_event;
|
||||
fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */
|
||||
size_t frame_size; /* 4 or 8 only */
|
||||
size_t engine_buffer_size;
|
||||
bool exclusive;
|
||||
bool blocking;
|
||||
bool running;
|
||||
size_t frame_size; /* 4 or 8 only */
|
||||
size_t engine_buffer_size;
|
||||
HANDLE write_event;
|
||||
IMMDevice *device;
|
||||
IAudioClient *client;
|
||||
IAudioRenderClient *renderer;
|
||||
fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */
|
||||
} wasapi_t;
|
||||
|
||||
static void wasapi_log(const char *msg)
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: %s.\n", msg);
|
||||
}
|
||||
|
||||
static void wasapi_warn(const char *warn)
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: %s.\n", warn);
|
||||
}
|
||||
|
||||
static void wasapi_err(const char *err)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s.\n", err);
|
||||
}
|
||||
|
||||
static void wasapi_com_warn(const char *fun, HRESULT hr)
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr);
|
||||
}
|
||||
|
||||
static void wasapi_com_err(const char *fun, HRESULT hr)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr);
|
||||
}
|
||||
|
||||
static void wasapi_sys_err(const char *fun)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun, GetLastError());
|
||||
}
|
||||
|
||||
static bool wasapi_check_device_id(IMMDevice *device, const char *id)
|
||||
{
|
||||
HRESULT hr;
|
||||
@@ -138,7 +164,7 @@ static bool wasapi_check_device_id(IMMDevice *device, const char *id)
|
||||
id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, dev_cmp_id, id_length);
|
||||
WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error);
|
||||
|
||||
hr = device->lpVtbl->GetId(device, &dev_id);
|
||||
hr = _IMMDevice_GetId(device, &dev_id);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
|
||||
|
||||
result = lstrcmpW(dev_cmp_id, dev_id) == 0 ? true : false;
|
||||
@@ -164,27 +190,36 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
IMMDeviceCollection *collection = NULL;
|
||||
|
||||
if (id)
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Initializing device %s ...\n", id);
|
||||
}
|
||||
else
|
||||
wasapi_log("Initializing default device ..");
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Initializing default device.. \n");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
&IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#endif
|
||||
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
|
||||
|
||||
if (id)
|
||||
{
|
||||
hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints",
|
||||
goto error);
|
||||
|
||||
hr = collection->lpVtbl->GetCount(collection, &dev_count);
|
||||
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
|
||||
|
||||
for (i = 0; i < dev_count; ++i)
|
||||
{
|
||||
hr = collection->lpVtbl->Item(collection, i, &device);
|
||||
hr = _IMMDeviceCollection_Item(collection, i, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", continue);
|
||||
|
||||
if (wasapi_check_device_id(device, id))
|
||||
@@ -195,8 +230,8 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = enumerator->lpVtbl->GetDefaultAudioEndpoint(enumerator,
|
||||
eRender, eConsole, &device);
|
||||
hr = _IMMDeviceEnumerator_GetDefaultAudioEndpoint(
|
||||
enumerator, eRender, eConsole, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::GetDefaultAudioEndpoint",
|
||||
goto error);
|
||||
}
|
||||
@@ -207,8 +242,6 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
WASAPI_RELEASE(collection);
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
wasapi_log("Device initialized");
|
||||
|
||||
return device;
|
||||
|
||||
error:
|
||||
@@ -216,9 +249,13 @@ error:
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
if (id)
|
||||
wasapi_warn("Failed to initialize device");
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: Failed to initialize device.\n");
|
||||
}
|
||||
else
|
||||
wasapi_err("Failed to initialize device");
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: Failed to initialize device.\n");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -268,7 +305,8 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
IAudioClient *client = NULL;
|
||||
bool float_fmt_res = *float_fmt;
|
||||
unsigned rate_res = *rate;
|
||||
HRESULT hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
@@ -286,19 +324,33 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
float_fmt_res ? "float" : "pcm", rate_res, latency);
|
||||
|
||||
wasapi_set_format(&wf, float_fmt_res, rate_res);
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
|
||||
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
|
||||
{
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||
{
|
||||
@@ -306,7 +358,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
break;
|
||||
}
|
||||
|
||||
wasapi_warn("Unsupported format");
|
||||
RARCH_WARN("[WASAPI]: Unsupported format.\n");
|
||||
rate_res = wasapi_pref_rate(j);
|
||||
if (rate_res == *rate) /* requested rate is allready tested */
|
||||
rate_res = wasapi_pref_rate(++j); /* skip it */
|
||||
@@ -337,12 +389,12 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
REFERENCE_TIME minimum_period = 0;
|
||||
REFERENCE_TIME buffer_duration = 0;
|
||||
UINT32 buffer_length = 0;
|
||||
HRESULT hr = device->lpVtbl->Activate(
|
||||
device, &IID_IAudioClient,
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, NULL, &minimum_period);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, NULL, &minimum_period);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
|
||||
|
||||
/* buffer_duration is in 100ns units */
|
||||
@@ -364,34 +416,54 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
float_fmt_res ? "float" : "pcm", rate_res, latency);
|
||||
|
||||
wasapi_set_format(&wf, float_fmt_res, rate_res);
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
|
||||
{
|
||||
hr = client->lpVtbl->GetBufferSize(client, &buffer_length);
|
||||
hr = _IAudioClient_GetBufferSize(client, &buffer_length);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
|
||||
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
buffer_duration = 10000.0 * 1000.0 / rate_res * buffer_length + 0.5;
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
|
||||
{
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||
{
|
||||
@@ -405,7 +477,7 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
break;
|
||||
}
|
||||
|
||||
wasapi_warn("Unsupported format");
|
||||
RARCH_WARN("[WASAPI]: Unsupported format.\n");
|
||||
rate_res = wasapi_pref_rate(j);
|
||||
if (rate_res == *rate) /* requested rate is allready tested */
|
||||
rate_res = wasapi_pref_rate(++j); /* skip it */
|
||||
@@ -461,22 +533,29 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive,
|
||||
/* next calls are allowed to fail (we losing info only) */
|
||||
|
||||
if (*exclusive)
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, NULL, &device_period);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, NULL, &device_period);
|
||||
else
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, &device_period, NULL);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, &device_period, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetDevicePeriod", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetDevicePeriod failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
|
||||
if (!*exclusive)
|
||||
{
|
||||
hr = client->lpVtbl->GetStreamLatency(client, &stream_latency);
|
||||
hr = _IAudioClient_GetStreamLatency(client, &stream_latency);
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetStreamLatency", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetStreamLatency failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
}
|
||||
|
||||
hr = client->lpVtbl->GetBufferSize(client, &buffer_length);
|
||||
hr = _IAudioClient_GetBufferSize(client, &buffer_length);
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetBufferSize", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetBufferSize failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
|
||||
if (*exclusive)
|
||||
latency_res = (double)buffer_length * 1000.0 / (*rate);
|
||||
@@ -528,7 +607,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
if (!w->client)
|
||||
goto error;
|
||||
|
||||
hr = w->client->lpVtbl->GetBufferSize(w->client, &frame_count);
|
||||
hr = _IAudioClient_GetBufferSize(w->client, &frame_count);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
|
||||
|
||||
w->frame_size = float_format ? 8 : 4;
|
||||
@@ -545,7 +624,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
{
|
||||
if (sh_buffer_length < 0)
|
||||
{
|
||||
hr = w->client->lpVtbl->GetDevicePeriod(w->client, &dev_period, NULL);
|
||||
hr = _IAudioClient_GetDevicePeriod(w->client, &dev_period, NULL);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
|
||||
|
||||
sh_buffer_length = dev_period * rate / 10000000;
|
||||
@@ -558,26 +637,29 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
sh_buffer_length, (double)sh_buffer_length * 1000.0 / rate);
|
||||
}
|
||||
else
|
||||
wasapi_log("Intermediate buffer is off");
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Intermediate buffer is off. \n");
|
||||
}
|
||||
|
||||
w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->SetEventHandle(w->client, w->write_event);
|
||||
hr = _IAudioClient_SetEventHandle(w->client, w->write_event);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::SetEventHandle", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->GetService(w->client,
|
||||
&IID_IAudioRenderClient, (void**)&w->renderer);
|
||||
hr = _IAudioClient_GetService(w->client,
|
||||
IID_IAudioRenderClient, (void**)&w->renderer);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetService", goto error);
|
||||
|
||||
hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
hr = _IAudioRenderClient_GetBuffer(w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", goto error);
|
||||
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count,
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
AUDCLNT_BUFFERFLAGS_SILENT);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->Start(w->client);
|
||||
hr = _IAudioClient_Start(w->client);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::Start", goto error);
|
||||
w->running = true;
|
||||
w->blocking = settings->bools.audio_sync;
|
||||
@@ -603,13 +685,14 @@ static bool wasapi_flush(wasapi_t * w, const void * data, size_t size)
|
||||
{
|
||||
BYTE *dest = NULL;
|
||||
UINT32 frame_count = size / w->frame_size;
|
||||
HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
|
||||
HRESULT hr = _IAudioRenderClient_GetBuffer(
|
||||
w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
|
||||
|
||||
memcpy(dest, data, size);
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0);
|
||||
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
0);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
|
||||
|
||||
return true;
|
||||
@@ -619,13 +702,14 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size)
|
||||
{
|
||||
BYTE *dest = NULL;
|
||||
UINT32 frame_count = size / w->frame_size;
|
||||
HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
|
||||
HRESULT hr = _IAudioRenderClient_GetBuffer(
|
||||
w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
|
||||
|
||||
fifo_read(w->buffer, dest, size);
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0);
|
||||
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
0);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
|
||||
|
||||
return true;
|
||||
@@ -634,42 +718,41 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size)
|
||||
static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
|
||||
{
|
||||
DWORD ir;
|
||||
size_t read_avail;
|
||||
size_t write_avail;
|
||||
HRESULT hr;
|
||||
bool br;
|
||||
ssize_t writen = -1;
|
||||
UINT32 padding = 0;
|
||||
size_t write_avail = 0;
|
||||
ssize_t written = -1;
|
||||
UINT32 padding = 0;
|
||||
|
||||
if (w->buffer)
|
||||
{
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
if (!write_avail)
|
||||
{
|
||||
size_t read_avail = 0;
|
||||
|
||||
if (w->blocking)
|
||||
{
|
||||
ir = WaitForSingleObject(w->write_event, INFINITE);
|
||||
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
|
||||
}
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
|
||||
|
||||
read_avail = fifo_read_avail(w->buffer);
|
||||
read_avail = fifo_read_avail(w->buffer);
|
||||
write_avail = w->engine_buffer_size - padding * w->frame_size;
|
||||
writen = read_avail < write_avail ? read_avail : write_avail;
|
||||
if (writen)
|
||||
written = read_avail < write_avail ? read_avail : write_avail;
|
||||
if (written)
|
||||
{
|
||||
br = wasapi_flush_buffer(w, writen);
|
||||
if (!br)
|
||||
if (!wasapi_flush_buffer(w, written))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
writen = size < write_avail ? size : write_avail;
|
||||
if (writen)
|
||||
fifo_write(w->buffer, data, writen);
|
||||
written = size < write_avail ? size : write_avail;
|
||||
if (written)
|
||||
fifo_write(w->buffer, data, written);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -679,46 +762,42 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
|
||||
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
|
||||
}
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
|
||||
|
||||
write_avail = w->engine_buffer_size - padding * w->frame_size;
|
||||
if (!write_avail)
|
||||
return 0;
|
||||
|
||||
writen = size < write_avail ? size : write_avail;
|
||||
if (writen)
|
||||
written = size < write_avail ? size : write_avail;
|
||||
if (written)
|
||||
{
|
||||
br = wasapi_flush(w, data, writen);
|
||||
if (!br)
|
||||
if (!wasapi_flush(w, data, written))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return writen;
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
|
||||
{
|
||||
DWORD ir;
|
||||
size_t write_avail;
|
||||
bool br = false;
|
||||
ssize_t writen = 0;
|
||||
ssize_t writen = 0;
|
||||
size_t write_avail = fifo_write_avail(w->buffer);
|
||||
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
if (!write_avail)
|
||||
{
|
||||
ir = WaitForSingleObject(w->write_event, w->blocking ? INFINITE : 0);
|
||||
DWORD ir = WaitForSingleObject(
|
||||
w->write_event, w->blocking ? INFINITE : 0);
|
||||
if (ir != WAIT_OBJECT_0 && w->blocking)
|
||||
{
|
||||
wasapi_sys_err("WaitForSingleObject");
|
||||
RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
if (ir != WAIT_OBJECT_0)
|
||||
return 0;
|
||||
|
||||
br = wasapi_flush_buffer(w, w->engine_buffer_size);
|
||||
if (!br)
|
||||
if (!wasapi_flush_buffer(w, w->engine_buffer_size))
|
||||
return -1;
|
||||
|
||||
write_avail = w->engine_buffer_size;
|
||||
@@ -732,34 +811,34 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
|
||||
|
||||
static ssize_t wasapi_write(void *wh, const void *data, size_t size)
|
||||
{
|
||||
size_t writen;
|
||||
ssize_t ir;
|
||||
size_t written;
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
|
||||
if (w->blocking)
|
||||
{
|
||||
for (writen = 0, ir = -1; writen < size; writen += ir)
|
||||
ssize_t ir;
|
||||
for (written = 0, ir = -1; written < size; written += ir)
|
||||
{
|
||||
if (w->exclusive)
|
||||
ir = wasapi_write_ex(w, data + writen, size - writen);
|
||||
ir = wasapi_write_ex(w, (char*)data + written, size - written);
|
||||
else
|
||||
ir = wasapi_write_sh(w, data + writen, size - writen);
|
||||
ir = wasapi_write_sh(w, (char*)data + written, size - written);
|
||||
if (ir == -1)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (w->exclusive)
|
||||
writen = wasapi_write_ex(w, data, size);
|
||||
written = wasapi_write_ex(w, data, size);
|
||||
else
|
||||
writen = wasapi_write_sh(w, data, size);
|
||||
written = wasapi_write_sh(w, data, size);
|
||||
|
||||
return writen;
|
||||
return written;
|
||||
}
|
||||
|
||||
static bool wasapi_stop(void *wh)
|
||||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HRESULT hr = w->client->lpVtbl->Stop(w->client);
|
||||
HRESULT hr = _IAudioClient_Stop(w->client);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::Stop", return !w->running);
|
||||
|
||||
w->running = false;
|
||||
@@ -770,7 +849,7 @@ static bool wasapi_stop(void *wh)
|
||||
static bool wasapi_start(void *wh, bool u)
|
||||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HRESULT hr = w->client->lpVtbl->Start(w->client);
|
||||
HRESULT hr = _IAudioClient_Start(w->client);
|
||||
|
||||
if (hr == AUDCLNT_E_NOT_STOPPED)
|
||||
return true;
|
||||
@@ -800,13 +879,13 @@ static void wasapi_set_nonblock_state(void *wh, bool nonblock)
|
||||
|
||||
static void wasapi_free(void *wh)
|
||||
{
|
||||
DWORD ir;
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HANDLE write_event = w->write_event;
|
||||
DWORD ir;
|
||||
|
||||
WASAPI_RELEASE(w->renderer);
|
||||
if (w->client)
|
||||
w->client->lpVtbl->Stop(w->client);
|
||||
_IAudioClient_Stop(w->client);
|
||||
WASAPI_RELEASE(w->client);
|
||||
WASAPI_RELEASE(w->device);
|
||||
CoUninitialize();
|
||||
@@ -816,7 +895,9 @@ static void wasapi_free(void *wh)
|
||||
|
||||
ir = WaitForSingleObject(write_event, 20);
|
||||
if (ir == WAIT_FAILED)
|
||||
wasapi_sys_err("WaitForSingleObject");
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError());
|
||||
}
|
||||
|
||||
/* If event isn't signaled log and leak */
|
||||
WASAPI_CHECK(ir == WAIT_OBJECT_0, "Memory leak in wasapi_free", return);
|
||||
@@ -850,28 +931,31 @@ static void *wasapi_device_list_new(void *u)
|
||||
char *dev_name_str = NULL;
|
||||
struct string_list *sl = string_list_new();
|
||||
|
||||
wasapi_log("Enumerating active devices ..");
|
||||
|
||||
WASAPI_CHECK(sl, "string_list_new failed", return NULL);
|
||||
|
||||
attr.i = 0;
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
&IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#endif
|
||||
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
|
||||
|
||||
hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator,
|
||||
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error);
|
||||
|
||||
hr = collection->lpVtbl->GetCount(collection, &dev_count);
|
||||
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
|
||||
|
||||
for (i = 0; i < dev_count; ++i)
|
||||
{
|
||||
hr = collection->lpVtbl->Item(collection, i, &device);
|
||||
hr = _IMMDeviceCollection_Item(collection, i, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", goto error);
|
||||
|
||||
hr = device->lpVtbl->GetId(device, &dev_id_wstr);
|
||||
hr = _IMMDevice_GetId(device, &dev_id_wstr);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
|
||||
|
||||
ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1,
|
||||
@@ -885,13 +969,13 @@ static void *wasapi_device_list_new(void *u)
|
||||
dev_id_str, ir, NULL, NULL);
|
||||
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
|
||||
|
||||
hr = device->lpVtbl->OpenPropertyStore(device, STGM_READ, &prop_store);
|
||||
hr = _IMMDevice_OpenPropertyStore(device, STGM_READ, &prop_store);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::OpenPropertyStore", goto error);
|
||||
|
||||
PropVariantInit(&prop_var);
|
||||
prop_var_init = true;
|
||||
hr = prop_store->lpVtbl->GetValue(prop_store,
|
||||
&PKEY_Device_FriendlyName, &prop_var);
|
||||
hr = _IPropertyStore_GetValue(prop_store, PKEY_Device_FriendlyName,
|
||||
&prop_var);
|
||||
WASAPI_HR_CHECK(hr, "IPropertyStore::GetValue", goto error);
|
||||
|
||||
ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1,
|
||||
@@ -922,8 +1006,6 @@ static void *wasapi_device_list_new(void *u)
|
||||
WASAPI_RELEASE(collection);
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
wasapi_log("Devices enumerated");
|
||||
|
||||
return sl;
|
||||
|
||||
error:
|
||||
@@ -939,7 +1021,7 @@ error:
|
||||
if (sl)
|
||||
string_list_free(sl);
|
||||
|
||||
wasapi_err("Device enumeration failed");
|
||||
RARCH_ERR("[WASAPI]: Device enumeration failed.\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -960,7 +1042,7 @@ static size_t wasapi_write_avail(void *wh)
|
||||
if (w->buffer)
|
||||
return fifo_write_avail(w->buffer);
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return 0);
|
||||
|
||||
return w->engine_buffer_size - padding * w->frame_size;
|
||||
|
||||
@@ -193,11 +193,11 @@ static bool ax_audio_start(void* data, bool is_shutdown)
|
||||
|
||||
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
size_t countAvail = 0;
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
const uint16_t* src = buf;
|
||||
int count = size >> 2;
|
||||
size_t count = size >> 2;
|
||||
|
||||
if(!size || (size & 0x3))
|
||||
return 0;
|
||||
@@ -330,8 +330,8 @@ audio_driver_t audio_ax =
|
||||
ax_audio_free,
|
||||
ax_audio_use_float,
|
||||
"AX",
|
||||
NULL,
|
||||
NULL,
|
||||
/* ax_audio_write_avail, */
|
||||
/* ax_audio_buffer_size */
|
||||
NULL, /* device_list_new */
|
||||
NULL, /* device_list_free */
|
||||
NULL, /* write_avail */
|
||||
NULL, /* buffer_size */
|
||||
};
|
||||
@@ -53,8 +53,13 @@ typedef struct
|
||||
size_t bufsize;
|
||||
} xa_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct xaudio2 : public IXAudio2VoiceCallback
|
||||
#else
|
||||
struct xaudio2
|
||||
#endif
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
xaudio2() :
|
||||
buf(0), pXAudio2(0), pMasterVoice(0),
|
||||
pSourceVoice(0), hEvent(0), buffers(0), bufsize(0),
|
||||
@@ -74,6 +79,9 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
STDMETHOD_(void, OnVoiceError) (void *, HRESULT) {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
||||
#else
|
||||
const IXAudio2VoiceCallbackVtbl *lpVtbl;
|
||||
#endif
|
||||
|
||||
uint8_t *buf;
|
||||
IXAudio2 *pXAudio2;
|
||||
@@ -87,6 +95,31 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
unsigned write_buffer;
|
||||
};
|
||||
|
||||
#ifndef __cplusplus
|
||||
static void WINAPI voice_on_buffer_end(void *handle_, void *data)
|
||||
{
|
||||
xaudio2_t *handle = (xaudio2_t*)handle_;
|
||||
(void)data;
|
||||
InterlockedDecrement((LONG volatile*)&handle->buffers);
|
||||
SetEvent(handle->hEvent);
|
||||
}
|
||||
|
||||
static void WINAPI dummy_voidp(void *handle, void *data) { (void)handle; (void)data; }
|
||||
static void WINAPI dummy_nil(void *handle) { (void)handle; }
|
||||
static void WINAPI dummy_uint32(void *handle, UINT32 dummy) { (void)handle; (void)dummy; }
|
||||
static void WINAPI dummy_voidp_hresult(void *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; }
|
||||
|
||||
const struct IXAudio2VoiceCallbackVtbl voice_vtable = {
|
||||
dummy_uint32,
|
||||
dummy_nil,
|
||||
dummy_nil,
|
||||
dummy_voidp,
|
||||
voice_on_buffer_end,
|
||||
dummy_voidp,
|
||||
dummy_voidp_hresult,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
{
|
||||
@@ -97,13 +130,13 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
(void)i;
|
||||
(void)dev_count;
|
||||
#ifndef _XBOX
|
||||
xa->pXAudio2->GetDeviceCount(&dev_count);
|
||||
IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count);
|
||||
fprintf(stderr, "XAudio2 devices:\n");
|
||||
|
||||
for (i = 0; i < dev_count; i++)
|
||||
{
|
||||
XAUDIO2_DEVICE_DETAILS dev_detail;
|
||||
xa->pXAudio2->GetDeviceDetails(i, &dev_detail);
|
||||
IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail);
|
||||
fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName);
|
||||
}
|
||||
#endif
|
||||
@@ -130,21 +163,31 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||
|
||||
if (handle->pSourceVoice)
|
||||
{
|
||||
handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW);
|
||||
handle->pSourceVoice->DestroyVoice();
|
||||
IXAudio2SourceVoice_Stop(handle->pSourceVoice,
|
||||
0, XAUDIO2_COMMIT_NOW);
|
||||
IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice);
|
||||
}
|
||||
|
||||
if (handle->pMasterVoice)
|
||||
handle->pMasterVoice->DestroyVoice();
|
||||
{
|
||||
IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice);
|
||||
}
|
||||
|
||||
if (handle->pXAudio2)
|
||||
handle->pXAudio2->Release();
|
||||
{
|
||||
IXAudio2_Release(handle->pXAudio2);
|
||||
}
|
||||
|
||||
if (handle->hEvent)
|
||||
CloseHandle(handle->hEvent);
|
||||
|
||||
free(handle->buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
delete handle;
|
||||
#else
|
||||
free(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef COINIT_MULTITHREADED
|
||||
@@ -154,27 +197,38 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
size_t size, unsigned device)
|
||||
{
|
||||
xaudio2_t *handle;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
xaudio2_t *handle = NULL;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
|
||||
#ifndef _XBOX
|
||||
CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
handle = new xaudio2;
|
||||
#else
|
||||
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
|
||||
#endif
|
||||
|
||||
if (!handle)
|
||||
goto error;
|
||||
|
||||
#ifndef __cplusplus
|
||||
handle->lpVtbl = &voice_vtable;
|
||||
#endif
|
||||
|
||||
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
goto error;
|
||||
|
||||
if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice,
|
||||
channels, samplerate, 0, device, NULL)))
|
||||
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL)))
|
||||
goto error;
|
||||
|
||||
xaudio2_set_wavefmt(&wfx, channels, samplerate);
|
||||
|
||||
if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx,
|
||||
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
|
||||
handle)))
|
||||
if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2,
|
||||
&handle->pSourceVoice, &wfx,
|
||||
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
|
||||
(IXAudio2VoiceCallback*)handle, 0, 0)))
|
||||
goto error;
|
||||
|
||||
handle->hEvent = CreateEvent(0, FALSE, FALSE, 0);
|
||||
@@ -186,7 +240,8 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
if (!handle->buf)
|
||||
goto error;
|
||||
|
||||
if (FAILED(handle->pSourceVoice->Start(0)))
|
||||
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0,
|
||||
XAUDIO2_COMMIT_NOW)))
|
||||
goto error;
|
||||
|
||||
return handle;
|
||||
@@ -210,7 +265,8 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
{
|
||||
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
|
||||
|
||||
memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr,
|
||||
memcpy(handle->buf + handle->write_buffer *
|
||||
handle->bufsize + handle->bufptr,
|
||||
buffer, need);
|
||||
|
||||
handle->bufptr += need;
|
||||
@@ -219,15 +275,23 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
|
||||
if (handle->bufptr == handle->bufsize)
|
||||
{
|
||||
XAUDIO2_BUFFER xa2buffer = {0};
|
||||
XAUDIO2_BUFFER xa2buffer;
|
||||
|
||||
while (handle->buffers == MAX_BUFFERS - 1)
|
||||
WaitForSingleObject(handle->hEvent, INFINITE);
|
||||
|
||||
xa2buffer.Flags = 0;
|
||||
xa2buffer.AudioBytes = handle->bufsize;
|
||||
xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize;
|
||||
xa2buffer.PlayBegin = 0;
|
||||
xa2buffer.PlayLength = 0;
|
||||
xa2buffer.LoopBegin = 0;
|
||||
xa2buffer.LoopLength = 0;
|
||||
xa2buffer.LoopCount = 0;
|
||||
xa2buffer.pContext = NULL;
|
||||
|
||||
if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL)))
|
||||
if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(
|
||||
handle->pSourceVoice, &xa2buffer, NULL)))
|
||||
return 0;
|
||||
|
||||
InterlockedIncrement((LONG volatile*)&handle->buffers);
|
||||
+86
-13
@@ -15,20 +15,29 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Kinda stripped down. Only contains the bare essentials used in RetroArch.
|
||||
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
|
||||
|
||||
#ifndef XAUDIO2_STRIPPED_H
|
||||
#define XAUDIO2_STRIPPED_H
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <retro_environment.h>
|
||||
|
||||
// All structures defined in this file use tight field packing
|
||||
/* All structures defined in this file use tight field packing */
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define X2DEFAULT(x) = (x)
|
||||
#else
|
||||
#define X2DEFAULT(x)
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define OPAQUE interface
|
||||
#endif
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
@@ -38,7 +47,7 @@ DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de);
|
||||
DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e);
|
||||
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
|
||||
#include <audiodefs.h> // Basic audio data types and constants
|
||||
#include <audiodefs.h> /* Basic audio data types and constants */
|
||||
|
||||
#else
|
||||
|
||||
@@ -48,6 +57,11 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#include <objbase.h>
|
||||
#include <mmreg.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#undef OPAQUE
|
||||
#define OPAQUE struct
|
||||
#endif
|
||||
|
||||
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
@@ -55,7 +69,13 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); // 2.7
|
||||
#ifndef __cplusplus
|
||||
#ifndef INTERFACE
|
||||
#define INTERFACE void
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */
|
||||
DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
|
||||
#endif
|
||||
@@ -99,7 +119,11 @@ typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
|
||||
#else
|
||||
typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
|
||||
{
|
||||
#if defined(__STDC_C89__)
|
||||
XAUDIO2_ANY_PROCESSOR = 0xffff,
|
||||
#else
|
||||
XAUDIO2_ANY_PROCESSOR = 0xffffffff,
|
||||
#endif
|
||||
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
|
||||
} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
|
||||
#endif
|
||||
@@ -118,7 +142,8 @@ typedef struct XAUDIO2_DEVICE_DETAILS
|
||||
WAVEFORMATEXTENSIBLE OutputFormat;
|
||||
} XAUDIO2_DEVICE_DETAILS;
|
||||
|
||||
// Forward declarations.
|
||||
/* Forward declarations. */
|
||||
#ifdef __cplusplus
|
||||
struct XAUDIO2_VOICE_DETAILS;
|
||||
struct XAUDIO2_VOICE_SENDS;
|
||||
struct XAUDIO2_EFFECT_DESCRIPTOR;
|
||||
@@ -130,6 +155,20 @@ struct XAUDIO2_PERFORMANCE_DATA;
|
||||
struct XAUDIO2_DEBUG_CONFIGURATION;
|
||||
struct IXAudio2EngineCallback;
|
||||
struct IXAudio2SubmixVoice;
|
||||
#else
|
||||
typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS;
|
||||
typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS;
|
||||
typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR;
|
||||
typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN;
|
||||
typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS;
|
||||
typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA;
|
||||
typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE;
|
||||
typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA;
|
||||
typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION;
|
||||
typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback;
|
||||
typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct XAUDIO2_BUFFER
|
||||
{
|
||||
@@ -253,31 +292,65 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
|
||||
void *pReserved X2DEFAULT(NULL)) PURE;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* C++ hooks */
|
||||
#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b)
|
||||
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b)
|
||||
#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b)
|
||||
#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice()
|
||||
#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice()
|
||||
#define IXAudio2_Release(handle) handle->Release()
|
||||
#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g)
|
||||
#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f)
|
||||
#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b)
|
||||
#else
|
||||
/* C hooks */
|
||||
#define IXAudio2_Initialize(THIS,a,b) (THIS)->lpVtbl->Initialize(THIS, a, b)
|
||||
#define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS)
|
||||
#define IXAudio2_CreateSourceVoice(THIS,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (THIS)->lpVtbl->CreateSourceVoice(THIS, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)
|
||||
#define IXAudio2_CreateMasteringVoice(THIS,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (THIS)->lpVtbl->CreateMasteringVoice(THIS, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
|
||||
#define IXAudio2_GetDeviceCount(THIS, puCount) (THIS)->lpVtbl->GetDeviceCount(THIS, puCount)
|
||||
#define IXAudio2_GetDeviceDetails(THIS, Index,pDeviceDetails) (THIS)->lpVtbl->GetDeviceDetails(THIS, Index, pDeviceDetails)
|
||||
#define IXAudio2SourceVoice_Start(THIS, Flags, OperationSet) (THIS)->lpVtbl->Start(THIS, Flags, OperationSet)
|
||||
#define IXAudio2SourceVoice_Stop(THIS, Flags, OperationSet) (THIS)->lpVtbl->Stop(THIS, Flags, OperationSet)
|
||||
#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, pBuffer, pBufferWMA) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, pBuffer, pBufferWMA)
|
||||
#define IXAudio2SourceVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
|
||||
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
|
||||
#else
|
||||
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR)
|
||||
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc)
|
||||
{
|
||||
IXAudio2 *pXAudio2;
|
||||
HRESULT hr;
|
||||
IXAudio2 *pXAudio2 = NULL;
|
||||
|
||||
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
|
||||
(void)flags;
|
||||
(void)proc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
|
||||
#endif
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
if (SUCCEEDED(hr))
|
||||
*ppXAudio2 = pXAudio2;
|
||||
else
|
||||
//IXAudio2_Release(pXAudio2);
|
||||
pXAudio2->Release();
|
||||
{
|
||||
IXAudio2_Release(pXAudio2);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Undo the #pragma pack(push, 1) directive at the top of this file
|
||||
/* Undo the #pragma pack(push, 1) directive at the top of this file */
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#if !defined(__FreeBSD__) || __FreeBSD__ < 5
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
@@ -28,7 +30,9 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
#include <asm/types.h>
|
||||
#endif
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include <memmap.h>
|
||||
|
||||
+981
-1126
File diff suppressed because it is too large.
Load diff
+82
-10
@@ -19,10 +19,25 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
/*****************************************************************************
|
||||
Setup - mainly for debugging
|
||||
*****************************************************************************/
|
||||
|
||||
/* Define this macro to get extra-verbose log for cheevos. */
|
||||
#undef CHEEVOS_VERBOSE
|
||||
|
||||
/*****************************************************************************
|
||||
End of setup
|
||||
*****************************************************************************/
|
||||
|
||||
#define CHEEVOS_TAG "[CHEEVOS]: "
|
||||
|
||||
typedef struct cheevos_ctx_desc
|
||||
{
|
||||
unsigned idx;
|
||||
@@ -30,14 +45,73 @@ typedef struct cheevos_ctx_desc
|
||||
size_t len;
|
||||
} cheevos_ctx_desc_t;
|
||||
|
||||
typedef struct
|
||||
typedef enum
|
||||
{
|
||||
unsigned size;
|
||||
unsigned type;
|
||||
int bank_id;
|
||||
unsigned value;
|
||||
unsigned previous;
|
||||
} cheevos_var_t;
|
||||
/* Don't change those, the values match the console IDs
|
||||
* at retroachievements.org. */
|
||||
CHEEVOS_CONSOLE_MEGA_DRIVE = 1,
|
||||
CHEEVOS_CONSOLE_NINTENDO_64 = 2,
|
||||
CHEEVOS_CONSOLE_SUPER_NINTENDO = 3,
|
||||
CHEEVOS_CONSOLE_GAMEBOY = 4,
|
||||
CHEEVOS_CONSOLE_GAMEBOY_ADVANCE = 5,
|
||||
CHEEVOS_CONSOLE_GAMEBOY_COLOR = 6,
|
||||
CHEEVOS_CONSOLE_NINTENDO = 7,
|
||||
CHEEVOS_CONSOLE_PC_ENGINE = 8,
|
||||
CHEEVOS_CONSOLE_SEGA_CD = 9,
|
||||
CHEEVOS_CONSOLE_SEGA_32X = 10,
|
||||
CHEEVOS_CONSOLE_MASTER_SYSTEM = 11,
|
||||
CHEEVOS_CONSOLE_PLAYSTATION = 12,
|
||||
CHEEVOS_CONSOLE_ATARI_LYNX = 13,
|
||||
CHEEVOS_CONSOLE_NEOGEO = 14,
|
||||
CHEEVOS_CONSOLE_XBOX_360 = 15,
|
||||
CHEEVOS_CONSOLE_GAMECUBE = 16,
|
||||
CHEEVOS_CONSOLE_ATARI_JAGUAR = 17,
|
||||
CHEEVOS_CONSOLE_NINTENDO_DS = 18,
|
||||
CHEEVOS_CONSOLE_WII = 19,
|
||||
CHEEVOS_CONSOLE_WII_U = 20,
|
||||
CHEEVOS_CONSOLE_PLAYSTATION_2 = 21,
|
||||
CHEEVOS_CONSOLE_XBOX = 22,
|
||||
CHEEVOS_CONSOLE_SKYNET = 23,
|
||||
CHEEVOS_CONSOLE_XBOX_ONE = 24,
|
||||
CHEEVOS_CONSOLE_ATARI_2600 = 25,
|
||||
CHEEVOS_CONSOLE_MS_DOS = 26,
|
||||
CHEEVOS_CONSOLE_ARCADE = 27,
|
||||
CHEEVOS_CONSOLE_VIRTUAL_BOY = 28,
|
||||
CHEEVOS_CONSOLE_MSX = 29,
|
||||
CHEEVOS_CONSOLE_COMMODORE_64 = 30,
|
||||
CHEEVOS_CONSOLE_ZX81 = 31
|
||||
} cheevos_console_t;
|
||||
|
||||
enum
|
||||
{
|
||||
CHEEVOS_DIRTY_TITLE = 1 << 0,
|
||||
CHEEVOS_DIRTY_DESC = 1 << 1,
|
||||
CHEEVOS_DIRTY_POINTS = 1 << 2,
|
||||
CHEEVOS_DIRTY_AUTHOR = 1 << 3,
|
||||
CHEEVOS_DIRTY_ID = 1 << 4,
|
||||
CHEEVOS_DIRTY_BADGE = 1 << 5,
|
||||
CHEEVOS_DIRTY_CONDITIONS = 1 << 6,
|
||||
CHEEVOS_DIRTY_VOTES = 1 << 7,
|
||||
CHEEVOS_DIRTY_DESCRIPTION = 1 << 8,
|
||||
|
||||
CHEEVOS_DIRTY_ALL = (1 << 9) - 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CHEEVOS_ACTIVE_SOFTCORE = 1 << 0,
|
||||
CHEEVOS_ACTIVE_HARDCORE = 1 << 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CHEEVOS_FORMAT_FRAMES = 0,
|
||||
CHEEVOS_FORMAT_SECS,
|
||||
CHEEVOS_FORMAT_MILLIS,
|
||||
CHEEVOS_FORMAT_SCORE,
|
||||
CHEEVOS_FORMAT_VALUE,
|
||||
CHEEVOS_FORMAT_OTHER
|
||||
};
|
||||
|
||||
bool cheevos_load(const void *data);
|
||||
|
||||
@@ -61,9 +135,7 @@ void cheevos_set_support_cheevos(bool state);
|
||||
|
||||
bool cheevos_get_support_cheevos(void);
|
||||
|
||||
void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value);
|
||||
|
||||
uint8_t *cheevos_get_memory(const cheevos_var_t *var);
|
||||
cheevos_console_t cheevos_get_console(void);
|
||||
|
||||
extern bool cheevos_loaded;
|
||||
extern int cheats_are_enabled;
|
||||
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2015-2017 - Andre Leiradella
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cond.h"
|
||||
#include "var.h"
|
||||
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
/*****************************************************************************
|
||||
Parsing
|
||||
*****************************************************************************/
|
||||
|
||||
static cheevos_cond_op_t cheevos_cond_parse_operator(const char** memaddr)
|
||||
{
|
||||
const char *str = *memaddr;
|
||||
cheevos_cond_op_t op;
|
||||
|
||||
if (*str == '=' && str[1] == '=')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_EQUALS;
|
||||
str += 2;
|
||||
}
|
||||
else if (*str == '=')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_EQUALS;
|
||||
str++;
|
||||
}
|
||||
else if (*str == '!' && str[1] == '=')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_NOT_EQUAL_TO;
|
||||
str += 2;
|
||||
}
|
||||
else if (*str == '<' && str[1] == '=')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL;
|
||||
str += 2;
|
||||
}
|
||||
else if (*str == '<')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_LESS_THAN;
|
||||
str++;
|
||||
}
|
||||
else if (*str == '>' && str[1] == '=')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL;
|
||||
str += 2;
|
||||
}
|
||||
else if (*str == '>')
|
||||
{
|
||||
op = CHEEVOS_COND_OP_GREATER_THAN;
|
||||
str++;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str);
|
||||
op = CHEEVOS_COND_OP_EQUALS;
|
||||
}
|
||||
|
||||
*memaddr = str;
|
||||
return op;
|
||||
}
|
||||
|
||||
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr)
|
||||
{
|
||||
const char* str = *memaddr;
|
||||
cond->type = CHEEVOS_COND_TYPE_STANDARD;
|
||||
|
||||
if (*str != 0 && str[1] == ':')
|
||||
{
|
||||
int skip = 2;
|
||||
|
||||
switch (*str)
|
||||
{
|
||||
case 'R':
|
||||
cond->type = CHEEVOS_COND_TYPE_RESET_IF;
|
||||
break;
|
||||
case 'P':
|
||||
cond->type = CHEEVOS_COND_TYPE_PAUSE_IF;
|
||||
break;
|
||||
case 'A':
|
||||
cond->type = CHEEVOS_COND_TYPE_ADD_SOURCE;
|
||||
break;
|
||||
case 'B':
|
||||
cond->type = CHEEVOS_COND_TYPE_SUB_SOURCE;
|
||||
break;
|
||||
case 'C':
|
||||
cond->type = CHEEVOS_COND_TYPE_ADD_HITS;
|
||||
break;
|
||||
default:
|
||||
skip = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
str += skip;
|
||||
}
|
||||
|
||||
cheevos_var_parse(&cond->source, &str);
|
||||
cond->op = cheevos_cond_parse_operator(&str);
|
||||
cheevos_var_parse(&cond->target, &str);
|
||||
cond->curr_hits = 0;
|
||||
|
||||
if (*str == '(' || *str == '.')
|
||||
{
|
||||
char* end;
|
||||
cond->req_hits = (unsigned)strtol(str + 1, &end, 10);
|
||||
str = end + (*end == ')' || *end == '.');
|
||||
}
|
||||
else
|
||||
cond->req_hits = 0;
|
||||
|
||||
*memaddr = str;
|
||||
}
|
||||
|
||||
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which)
|
||||
{
|
||||
cheevos_cond_t dummy;
|
||||
unsigned index = 0;
|
||||
unsigned count = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
cheevos_cond_parse(&dummy, &memaddr);
|
||||
|
||||
if (index == which)
|
||||
count++;
|
||||
|
||||
if (*memaddr != '_')
|
||||
break;
|
||||
|
||||
memaddr++;
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (*memaddr != 'S')
|
||||
break;
|
||||
|
||||
memaddr++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which)
|
||||
{
|
||||
cheevos_cond_t dummy;
|
||||
unsigned index = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (index == which)
|
||||
{
|
||||
cheevos_cond_parse(cond, &memaddr);
|
||||
#ifdef CHEEVOS_VERBOSE
|
||||
/*cheevos_log_cond(cond);*/
|
||||
#endif
|
||||
cond++;
|
||||
}
|
||||
else
|
||||
cheevos_cond_parse(&dummy, &memaddr);
|
||||
|
||||
if (*memaddr != '_')
|
||||
break;
|
||||
|
||||
memaddr++;
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (*memaddr != 'S')
|
||||
break;
|
||||
|
||||
memaddr++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2015-2017 - Andre Leiradella
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_CHEEVOS_COND_H
|
||||
#define __RARCH_CHEEVOS_COND_H
|
||||
|
||||
#include "var.h"
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHEEVOS_COND_TYPE_STANDARD,
|
||||
CHEEVOS_COND_TYPE_PAUSE_IF,
|
||||
CHEEVOS_COND_TYPE_RESET_IF,
|
||||
CHEEVOS_COND_TYPE_ADD_SOURCE,
|
||||
CHEEVOS_COND_TYPE_SUB_SOURCE,
|
||||
CHEEVOS_COND_TYPE_ADD_HITS
|
||||
} cheevos_cond_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHEEVOS_COND_OP_EQUALS,
|
||||
CHEEVOS_COND_OP_LESS_THAN,
|
||||
CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL,
|
||||
CHEEVOS_COND_OP_GREATER_THAN,
|
||||
CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL,
|
||||
CHEEVOS_COND_OP_NOT_EQUAL_TO
|
||||
} cheevos_cond_op_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cheevos_cond_type_t type;
|
||||
unsigned req_hits;
|
||||
unsigned curr_hits;
|
||||
|
||||
cheevos_var_t source;
|
||||
cheevos_cond_op_t op;
|
||||
cheevos_var_t target;
|
||||
} cheevos_cond_t;
|
||||
|
||||
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr);
|
||||
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which);
|
||||
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif /* __RARCH_CHEEVOS_COND_H */
|
||||
+422
@@ -0,0 +1,422 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2015-2017 - Andre Leiradella
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libretro.h>
|
||||
|
||||
#include "var.h"
|
||||
|
||||
#include "../retroarch.h"
|
||||
#include "../core.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#ifdef CHEEVOS_VERBOSE
|
||||
#define CHEEVOS_LOG RARCH_LOG
|
||||
#else
|
||||
#define CHEEVOS_LOG(...)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Parsing
|
||||
*****************************************************************************/
|
||||
|
||||
static cheevos_var_size_t cheevos_var_parse_prefix(const char** memaddr)
|
||||
{
|
||||
/* Careful not to use ABCDEF here, this denotes part of an actual variable! */
|
||||
const char* str = *memaddr;
|
||||
cheevos_var_size_t size;
|
||||
|
||||
switch (toupper((unsigned char)*str++))
|
||||
{
|
||||
case 'M':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_0;
|
||||
break;
|
||||
case 'N':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_1;
|
||||
break;
|
||||
case 'O':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_2;
|
||||
break;
|
||||
case 'P':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_3;
|
||||
break;
|
||||
case 'Q':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_4;
|
||||
break;
|
||||
case 'R':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_5;
|
||||
break;
|
||||
case 'S':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_6;
|
||||
break;
|
||||
case 'T':
|
||||
size = CHEEVOS_VAR_SIZE_BIT_7;
|
||||
break;
|
||||
case 'L':
|
||||
size = CHEEVOS_VAR_SIZE_NIBBLE_LOWER;
|
||||
break;
|
||||
case 'U':
|
||||
size = CHEEVOS_VAR_SIZE_NIBBLE_UPPER;
|
||||
break;
|
||||
case 'H':
|
||||
size = CHEEVOS_VAR_SIZE_EIGHT_BITS;
|
||||
break;
|
||||
case 'X':
|
||||
size = CHEEVOS_VAR_SIZE_THIRTYTWO_BITS;
|
||||
break;
|
||||
default:
|
||||
str--;
|
||||
/* fall through */
|
||||
case ' ':
|
||||
size = CHEEVOS_VAR_SIZE_SIXTEEN_BITS;
|
||||
break;
|
||||
}
|
||||
|
||||
*memaddr = str;
|
||||
return size;
|
||||
}
|
||||
|
||||
static size_t cheevos_var_reduce(size_t addr, size_t mask)
|
||||
{
|
||||
while (mask)
|
||||
{
|
||||
size_t tmp = (mask - 1) & ~mask;
|
||||
addr = (addr & tmp) | ((addr >> 1) & ~tmp);
|
||||
mask = (mask & (mask - 1)) >> 1;
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
static size_t cheevos_var_highest_bit(size_t n)
|
||||
{
|
||||
n |= n >> 1;
|
||||
n |= n >> 2;
|
||||
n |= n >> 4;
|
||||
n |= n >> 8;
|
||||
n |= n >> 16;
|
||||
|
||||
return n ^ (n >> 1);
|
||||
}
|
||||
|
||||
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr)
|
||||
{
|
||||
char *end = NULL;
|
||||
const char *str = *memaddr;
|
||||
unsigned base = 16;
|
||||
|
||||
var->is_bcd = false;
|
||||
|
||||
if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
|
||||
{
|
||||
/* d0x + 4 hex digits */
|
||||
str += 3;
|
||||
var->type = CHEEVOS_VAR_TYPE_DELTA_MEM;
|
||||
}
|
||||
else if (toupper((unsigned char)*str) == 'B' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
|
||||
{
|
||||
/* b0x (binary-coded decimal) */
|
||||
str += 3;
|
||||
var->is_bcd = true;
|
||||
var->type = CHEEVOS_VAR_TYPE_ADDRESS;
|
||||
}
|
||||
else if (*str == '0' && toupper((unsigned char)str[1]) == 'X')
|
||||
{
|
||||
/* 0x + 4 hex digits */
|
||||
str += 2;
|
||||
var->type = CHEEVOS_VAR_TYPE_ADDRESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
var->type = CHEEVOS_VAR_TYPE_VALUE_COMP;
|
||||
|
||||
if (toupper((unsigned char)*str) == 'H')
|
||||
str++;
|
||||
else
|
||||
{
|
||||
if (toupper((unsigned char)*str) == 'V')
|
||||
str++;
|
||||
|
||||
base = 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (var->type != CHEEVOS_VAR_TYPE_VALUE_COMP)
|
||||
{
|
||||
var->size = cheevos_var_parse_prefix(&str);
|
||||
}
|
||||
|
||||
var->value = (unsigned)strtol(str, &end, base);
|
||||
*memaddr = end;
|
||||
}
|
||||
|
||||
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
|
||||
var->bank_id = -1;
|
||||
|
||||
if (console == CHEEVOS_CONSOLE_NINTENDO)
|
||||
{
|
||||
if (var->value >= 0x0800 && var->value < 0x2000)
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "NES memory address in mirrorred RAM %X, adjusted to %X\n", var->value, var->value & 0x07ff);
|
||||
var->value &= 0x07ff;
|
||||
}
|
||||
}
|
||||
else if (console == CHEEVOS_CONSOLE_GAMEBOY_COLOR)
|
||||
{
|
||||
if (var->value >= 0xe000 && var->value <= 0xfdff)
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "GBC memory address in echo RAM %X, adjusted to %X\n", var->value, var->value - 0x2000);
|
||||
var->value -= 0x2000;
|
||||
}
|
||||
}
|
||||
|
||||
if (system->mmaps.num_descriptors != 0)
|
||||
{
|
||||
const rarch_memory_descriptor_t *desc = NULL;
|
||||
const rarch_memory_descriptor_t *end = NULL;
|
||||
|
||||
/* Patch the address to correctly map it to the mmaps */
|
||||
if (console == CHEEVOS_CONSOLE_GAMEBOY_ADVANCE)
|
||||
{
|
||||
if (var->value < 0x8000) /* Internal RAM */
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x3000000);
|
||||
var->value += 0x3000000;
|
||||
}
|
||||
else /* Work RAM */
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x2000000 - 0x8000);
|
||||
var->value += 0x2000000 - 0x8000;
|
||||
}
|
||||
}
|
||||
else if (console == CHEEVOS_CONSOLE_PC_ENGINE)
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "PCE memory address %X adjusted to %X\n", var->value, var->value + 0x1f0000);
|
||||
var->value += 0x1f0000;
|
||||
}
|
||||
else if (console == CHEEVOS_CONSOLE_SUPER_NINTENDO)
|
||||
{
|
||||
if (var->value < 0x020000) /* Work RAM */
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x7e0000);
|
||||
var->value += 0x7e0000;
|
||||
}
|
||||
else /* Save RAM */
|
||||
{
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x006000 - 0x020000);
|
||||
var->value += 0x006000 - 0x020000;
|
||||
}
|
||||
}
|
||||
|
||||
desc = system->mmaps.descriptors;
|
||||
end = desc + system->mmaps.num_descriptors;
|
||||
|
||||
for (; desc < end; desc++)
|
||||
{
|
||||
if (((desc->core.start ^ var->value) & desc->core.select) == 0)
|
||||
{
|
||||
unsigned addr = var->value;
|
||||
var->bank_id = (int)(desc - system->mmaps.descriptors);
|
||||
var->value = (unsigned)cheevos_var_reduce(
|
||||
(addr - desc->core.start) & desc->disconnect_mask,
|
||||
desc->core.disconnect);
|
||||
|
||||
if (var->value >= desc->core.len)
|
||||
var->value -= cheevos_var_highest_bit(var->value);
|
||||
|
||||
var->value += desc->core.offset;
|
||||
|
||||
CHEEVOS_LOG(CHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, var->bank_id + 1, var->value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
retro_ctx_memory_info_t meminfo;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
|
||||
break;
|
||||
case 1:
|
||||
meminfo.id = RETRO_MEMORY_SAVE_RAM;
|
||||
break;
|
||||
case 2:
|
||||
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
|
||||
break;
|
||||
case 3:
|
||||
meminfo.id = RETRO_MEMORY_RTC;
|
||||
break;
|
||||
}
|
||||
|
||||
core_get_memory(&meminfo);
|
||||
|
||||
if (var->value < meminfo.size)
|
||||
{
|
||||
var->bank_id = i;
|
||||
break;
|
||||
}
|
||||
|
||||
/* HACK subtract the correct amount of bytes to reach the save RAM */
|
||||
if (i == 0 && console == CHEEVOS_CONSOLE_NINTENDO)
|
||||
var->value -= 0x6000;
|
||||
else
|
||||
var->value -= meminfo.size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Testing
|
||||
*****************************************************************************/
|
||||
|
||||
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var)
|
||||
{
|
||||
uint8_t* memory = NULL;
|
||||
|
||||
if (var->bank_id >= 0)
|
||||
{
|
||||
rarch_system_info_t* system = runloop_get_system_info();
|
||||
|
||||
if (system->mmaps.num_descriptors != 0)
|
||||
memory = (uint8_t*)system->mmaps.descriptors[var->bank_id].core.ptr;
|
||||
else
|
||||
{
|
||||
retro_ctx_memory_info_t meminfo = {NULL, 0, 0};
|
||||
|
||||
switch (var->bank_id)
|
||||
{
|
||||
case 0:
|
||||
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
|
||||
break;
|
||||
case 1:
|
||||
meminfo.id = RETRO_MEMORY_SAVE_RAM;
|
||||
break;
|
||||
case 2:
|
||||
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
|
||||
break;
|
||||
case 3:
|
||||
meminfo.id = RETRO_MEMORY_RTC;
|
||||
break;
|
||||
default:
|
||||
RARCH_ERR(CHEEVOS_TAG "invalid bank id: %s\n", var->bank_id);
|
||||
break;
|
||||
}
|
||||
|
||||
core_get_memory(&meminfo);
|
||||
memory = (uint8_t*)meminfo.data;
|
||||
}
|
||||
|
||||
if (memory)
|
||||
memory += var->value;
|
||||
}
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
||||
unsigned cheevos_var_get_value(cheevos_var_t* var)
|
||||
{
|
||||
const uint8_t* memory = NULL;
|
||||
unsigned value = 0;
|
||||
|
||||
switch (var->type)
|
||||
{
|
||||
case CHEEVOS_VAR_TYPE_VALUE_COMP:
|
||||
value = var->value;
|
||||
break;
|
||||
|
||||
case CHEEVOS_VAR_TYPE_ADDRESS:
|
||||
case CHEEVOS_VAR_TYPE_DELTA_MEM:
|
||||
memory = cheevos_var_get_memory(var);
|
||||
|
||||
if (memory)
|
||||
{
|
||||
value = memory[0];
|
||||
|
||||
switch (var->size)
|
||||
{
|
||||
case CHEEVOS_VAR_SIZE_BIT_0:
|
||||
value &= 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_1:
|
||||
value = (value >> 1) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_2:
|
||||
value = (value >> 2) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_3:
|
||||
value = (value >> 3) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_4:
|
||||
value = (value >> 4) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_5:
|
||||
value = (value >> 5) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_6:
|
||||
value = (value >> 6) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_BIT_7:
|
||||
value = (value >> 7) & 1;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_NIBBLE_LOWER:
|
||||
value &= 0x0f;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_NIBBLE_UPPER:
|
||||
value = (value >> 4) & 0x0f;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_EIGHT_BITS:
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_SIXTEEN_BITS:
|
||||
value |= memory[1] << 8;
|
||||
break;
|
||||
case CHEEVOS_VAR_SIZE_THIRTYTWO_BITS:
|
||||
value |= memory[1] << 8;
|
||||
value |= memory[2] << 16;
|
||||
value |= memory[3] << 24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (var->type == CHEEVOS_VAR_TYPE_DELTA_MEM)
|
||||
{
|
||||
unsigned previous = var->previous;
|
||||
var->previous = value;
|
||||
value = previous;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CHEEVOS_VAR_TYPE_DYNAMIC_VAR:
|
||||
/* We shouldn't get here... */
|
||||
break;
|
||||
}
|
||||
|
||||
if(var->is_bcd)
|
||||
return (((value >> 4) & 0xf) * 10) + (value & 0xf);
|
||||
else
|
||||
return value;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2015-2017 - Andre Leiradella
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_CHEEVOS_VAR_H
|
||||
#define __RARCH_CHEEVOS_VAR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cheevos.h"
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHEEVOS_VAR_SIZE_BIT_0 = 0,
|
||||
CHEEVOS_VAR_SIZE_BIT_1,
|
||||
CHEEVOS_VAR_SIZE_BIT_2,
|
||||
CHEEVOS_VAR_SIZE_BIT_3,
|
||||
CHEEVOS_VAR_SIZE_BIT_4,
|
||||
CHEEVOS_VAR_SIZE_BIT_5,
|
||||
CHEEVOS_VAR_SIZE_BIT_6,
|
||||
CHEEVOS_VAR_SIZE_BIT_7,
|
||||
CHEEVOS_VAR_SIZE_NIBBLE_LOWER,
|
||||
CHEEVOS_VAR_SIZE_NIBBLE_UPPER,
|
||||
/* Byte, */
|
||||
CHEEVOS_VAR_SIZE_EIGHT_BITS, /* =Byte, */
|
||||
CHEEVOS_VAR_SIZE_SIXTEEN_BITS,
|
||||
CHEEVOS_VAR_SIZE_THIRTYTWO_BITS
|
||||
} cheevos_var_size_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* compare to the value of a live address in RAM */
|
||||
CHEEVOS_VAR_TYPE_ADDRESS = 0,
|
||||
|
||||
/* a number. assume 32 bit */
|
||||
CHEEVOS_VAR_TYPE_VALUE_COMP,
|
||||
|
||||
/* the value last known at this address. */
|
||||
CHEEVOS_VAR_TYPE_DELTA_MEM,
|
||||
|
||||
/* a custom user-set variable */
|
||||
CHEEVOS_VAR_TYPE_DYNAMIC_VAR
|
||||
} cheevos_var_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cheevos_var_size_t size;
|
||||
cheevos_var_type_t type;
|
||||
int bank_id;
|
||||
bool is_bcd;
|
||||
unsigned value;
|
||||
unsigned previous;
|
||||
} cheevos_var_t;
|
||||
|
||||
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr);
|
||||
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console);
|
||||
|
||||
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var);
|
||||
unsigned cheevos_var_get_value(cheevos_var_t* var);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif /* __RARCH_CHEEVOS_VAR_H */
|
||||
@@ -134,6 +134,8 @@ enum event_command
|
||||
CMD_EVENT_REBOOT,
|
||||
/* Resume RetroArch when in menu. */
|
||||
CMD_EVENT_RESUME,
|
||||
/* Add a playlist entry to favorites. */
|
||||
CMD_EVENT_ADD_TO_FAVORITES,
|
||||
/* Toggles pause. */
|
||||
CMD_EVENT_PAUSE_TOGGLE,
|
||||
/* Pauses RetroArch. */
|
||||
@@ -191,6 +193,10 @@ enum event_command
|
||||
CMD_EVENT_REMOTE_INIT,
|
||||
/* Deinitializes remote gamepad interface. */
|
||||
CMD_EVENT_REMOTE_DEINIT,
|
||||
/* Initializes keyboard to gamepad mapper interface. */
|
||||
CMD_EVENT_MAPPER_INIT,
|
||||
/* Deinitializes keyboard to gamepad mapper interface. */
|
||||
CMD_EVENT_MAPPER_DEINIT,
|
||||
/* Reinitializes audio driver. */
|
||||
CMD_EVENT_AUDIO_REINIT,
|
||||
/* Resizes windowed scale. Will reinitialize video driver. */
|
||||
@@ -218,17 +224,14 @@ enum event_command
|
||||
CMD_EVENT_MIXER_VOLUME_UP,
|
||||
CMD_EVENT_MIXER_VOLUME_DOWN,
|
||||
CMD_EVENT_DISABLE_OVERRIDES,
|
||||
CMD_EVENT_RESTORE_REMAPS,
|
||||
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
|
||||
CMD_EVENT_LIBUI_TEST
|
||||
};
|
||||
|
||||
bool command_set_shader(const char *arg);
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
bool command_network_send(const char *cmd_);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_network_new(
|
||||
command_t *handle,
|
||||
@@ -246,8 +249,6 @@ bool command_set(command_handle_t *handle);
|
||||
|
||||
bool command_free(command_t *handle);
|
||||
|
||||
bool command_event_quit(void);
|
||||
|
||||
/**
|
||||
* command_event:
|
||||
* @cmd : Command index.
|
||||
|
||||
+56
-3
@@ -58,8 +58,13 @@ static bool bundle_assets_extract_enable = true;
|
||||
static bool bundle_assets_extract_enable = false;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATERIALUI
|
||||
static bool materialui_icons_enable = true;
|
||||
#endif
|
||||
|
||||
static const bool def_history_list_enable = true;
|
||||
static const bool def_playlist_entry_remove = true;
|
||||
static const bool def_playlist_entry_rename = true;
|
||||
|
||||
static const unsigned int def_user_language = 0;
|
||||
|
||||
@@ -231,7 +236,28 @@ static const bool display_keyboard_overlay = false;
|
||||
|
||||
static bool default_block_config_read = true;
|
||||
|
||||
static bool quick_menu_show_take_screenshot = true;
|
||||
static bool quick_menu_show_save_load_state = true;
|
||||
static bool quick_menu_show_undo_save_load_state = true;
|
||||
static bool quick_menu_show_add_to_favorites = true;
|
||||
static bool quick_menu_show_options = true;
|
||||
static bool quick_menu_show_controls = true;
|
||||
static bool quick_menu_show_cheats = true;
|
||||
static bool quick_menu_show_shaders = true;
|
||||
static bool quick_menu_show_save_core_overrides = true;
|
||||
static bool quick_menu_show_save_game_overrides = true;
|
||||
static bool quick_menu_show_information = true;
|
||||
|
||||
static bool kiosk_mode_enable = false;
|
||||
|
||||
static bool menu_show_online_updater = true;
|
||||
static bool menu_show_load_core = true;
|
||||
static bool menu_show_load_content = true;
|
||||
static bool menu_show_information = true;
|
||||
static bool menu_show_configurations = true;
|
||||
static bool menu_show_help = true;
|
||||
static bool menu_show_quit_retroarch = true;
|
||||
static bool menu_show_reboot = true;
|
||||
|
||||
#if defined(HAVE_LAKKA) || defined(VITA)
|
||||
static bool menu_show_core_updater = false;
|
||||
@@ -250,6 +276,7 @@ static bool xmb_shadows_enable = false;
|
||||
static bool xmb_shadows_enable = true;
|
||||
#endif
|
||||
static bool xmb_show_settings = true;
|
||||
static bool xmb_show_favorites = true;
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
static bool xmb_show_images = true;
|
||||
#endif
|
||||
@@ -266,6 +293,8 @@ static bool xmb_show_add = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static float menu_framebuffer_opacity = 0.900;
|
||||
|
||||
static float menu_wallpaper_opacity = 0.300;
|
||||
|
||||
static float menu_footer_opacity = 1.000;
|
||||
@@ -295,6 +324,11 @@ static bool default_auto_shaders_enable = true;
|
||||
static bool default_sort_savefiles_enable = false;
|
||||
static bool default_sort_savestates_enable = false;
|
||||
|
||||
static bool default_savestates_in_content_dir = false;
|
||||
static bool default_savefiles_in_content_dir = false;
|
||||
static bool default_systemfiles_in_content_dir = false;
|
||||
static bool default_screenshots_in_content_dir = false;
|
||||
|
||||
#if defined(__CELLOS_LV2__) || defined(_XBOX1) || defined(_XBOX360)
|
||||
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
|
||||
#elif defined(VITA)
|
||||
@@ -308,6 +342,8 @@ static unsigned input_backtouch_enable = false;
|
||||
static unsigned input_backtouch_toggle = false;
|
||||
#endif
|
||||
|
||||
static bool show_physical_inputs = true;
|
||||
|
||||
static bool all_users_control_menu = false;
|
||||
|
||||
#if defined(ANDROID) || defined(_WIN32)
|
||||
@@ -339,6 +375,12 @@ static const float message_pos_offset_y = 0.05;
|
||||
* RGB hex value. */
|
||||
static const uint32_t message_color = 0xffff00;
|
||||
|
||||
static const bool message_bgcolor_enable = false;
|
||||
static const uint32_t message_bgcolor_red = 0;
|
||||
static const uint32_t message_bgcolor_green = 0;
|
||||
static const uint32_t message_bgcolor_blue = 0;
|
||||
static const float message_bgcolor_opacity = 1.0f;
|
||||
|
||||
/* Record post-filtered (CPU filter) video,
|
||||
* rather than raw game output. */
|
||||
static const bool post_filter_record = false;
|
||||
@@ -438,6 +480,9 @@ static const int wasapi_sh_buffer_length = -16; /* auto */
|
||||
/* Enables displaying the current frames per second. */
|
||||
static const bool fps_show = false;
|
||||
|
||||
/* Show frame count on FPS display */
|
||||
static const bool framecount_show = true;
|
||||
|
||||
/* Enables use of rewind. This will incur some memory footprint
|
||||
* depending on the save state buffer. */
|
||||
static const bool rewind_enable = false;
|
||||
@@ -483,7 +528,7 @@ static const bool netplay_nat_traversal = false;
|
||||
|
||||
static const unsigned netplay_delay_frames = 16;
|
||||
|
||||
static const int netplay_check_frames = 30;
|
||||
static const int netplay_check_frames = 600;
|
||||
|
||||
static const bool netplay_use_mitm_server = false;
|
||||
|
||||
@@ -610,11 +655,17 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/window
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2010/x86/latest/";
|
||||
#endif
|
||||
#elif _MSC_VER == 1400
|
||||
#if defined(__x86_64__)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86_64/latest/";
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86/latest/";
|
||||
#endif
|
||||
#else
|
||||
#if defined(__x86_64__)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86_64/latest/";
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86_64/latest/";
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86/latest/";
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86/latest/";
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__linux__)
|
||||
@@ -622,6 +673,8 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x8
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/x86_64/latest/";
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i686__)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/x86/latest/";
|
||||
#elif defined(__arm__) && __ARM_ARCH == 7 && defined(__ARM_PCS_VFP)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/armhf/latest/";
|
||||
#else
|
||||
static char buildbot_server_url[] = "";
|
||||
#endif
|
||||
|
||||
@@ -260,12 +260,6 @@ static const bool _sdl_image_supp = true;
|
||||
static const bool _sdl_image_supp = false;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
static const bool _fbo_supp = true;
|
||||
#else
|
||||
static const bool _fbo_supp = false;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
static const bool _dynamic_supp = true;
|
||||
#else
|
||||
|
||||
+362
-168
File diff suppressed because it is too large.
Load diff
+87
-72
@@ -25,13 +25,26 @@
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gfx/video_driver.h"
|
||||
#include "input/input_defines.h"
|
||||
|
||||
#define configuration_set_float(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_bool(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_uint(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_int(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
|
||||
enum override_type
|
||||
{
|
||||
OVERRIDE_NONE = 0,
|
||||
@@ -53,9 +66,7 @@ typedef struct settings
|
||||
bool video_vsync;
|
||||
bool video_hard_sync;
|
||||
bool video_black_frame_insertion;
|
||||
#ifdef GEKKO
|
||||
bool video_vfilter;
|
||||
#endif
|
||||
bool video_smooth;
|
||||
bool video_force_aspect;
|
||||
bool video_crop_overscan;
|
||||
@@ -72,15 +83,15 @@ typedef struct settings
|
||||
bool video_shared_context;
|
||||
bool video_force_srgb_disable;
|
||||
bool video_fps_show;
|
||||
bool video_framecount_show;
|
||||
bool video_msg_bgcolor_enable;
|
||||
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
bool audio_sync;
|
||||
bool audio_rate_control;
|
||||
#ifdef HAVE_WASAPI
|
||||
bool audio_wasapi_exclusive_mode;
|
||||
bool audio_wasapi_float_format;
|
||||
#endif
|
||||
|
||||
/* Input */
|
||||
bool input_remap_binds_enable;
|
||||
@@ -88,20 +99,16 @@ typedef struct settings
|
||||
bool input_overlay_enable;
|
||||
bool input_overlay_enable_autopreferred;
|
||||
bool input_overlay_hide_in_menu;
|
||||
bool input_overlay_show_physical_inputs;
|
||||
bool input_descriptor_label_show;
|
||||
bool input_descriptor_hide_unbound;
|
||||
bool input_all_users_control_menu;
|
||||
bool input_menu_swap_ok_cancel_buttons;
|
||||
#if defined(VITA)
|
||||
bool input_backtouch_enable;
|
||||
bool input_backtouch_toggle;
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
bool input_small_keyboard_enable;
|
||||
#endif
|
||||
bool input_keyboard_gamepad_enable;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* Menu */
|
||||
bool filter_by_current_core;
|
||||
bool menu_show_start_screen;
|
||||
@@ -119,10 +126,20 @@ typedef struct settings
|
||||
bool menu_show_advanced_settings;
|
||||
bool menu_throttle_framerate;
|
||||
bool menu_linear_filter;
|
||||
bool menu_horizontal_animation;
|
||||
bool menu_show_online_updater;
|
||||
bool menu_show_core_updater;
|
||||
bool menu_show_load_core;
|
||||
bool menu_show_load_content;
|
||||
bool menu_show_information;
|
||||
bool menu_show_configurations;
|
||||
bool menu_show_help;
|
||||
bool menu_show_quit_retroarch;
|
||||
bool menu_show_reboot;
|
||||
bool menu_materialui_icons_enable;
|
||||
bool menu_xmb_shadows_enable;
|
||||
bool menu_xmb_show_settings;
|
||||
bool menu_xmb_show_favorites;
|
||||
bool menu_xmb_show_images;
|
||||
bool menu_xmb_show_music;
|
||||
bool menu_xmb_show_video;
|
||||
@@ -130,9 +147,19 @@ typedef struct settings
|
||||
bool menu_xmb_show_history;
|
||||
bool menu_xmb_show_add;
|
||||
bool menu_unified_controls;
|
||||
#endif
|
||||
bool quick_menu_show_take_screenshot;
|
||||
bool quick_menu_show_save_load_state;
|
||||
bool quick_menu_show_undo_save_load_state;
|
||||
bool quick_menu_show_add_to_favorites;
|
||||
bool quick_menu_show_options;
|
||||
bool quick_menu_show_controls;
|
||||
bool quick_menu_show_cheats;
|
||||
bool quick_menu_show_shaders;
|
||||
bool quick_menu_show_save_core_overrides;
|
||||
bool quick_menu_show_save_game_overrides;
|
||||
bool quick_menu_show_information;
|
||||
bool kiosk_mode_enable;
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
/* Netplay */
|
||||
bool netplay_public_announce;
|
||||
bool netplay_start_as_spectator;
|
||||
@@ -142,7 +169,6 @@ typedef struct settings
|
||||
bool netplay_swap_input;
|
||||
bool netplay_nat_traversal;
|
||||
bool netplay_use_mitm_server;
|
||||
#endif
|
||||
|
||||
/* Network */
|
||||
bool network_buildbot_auto_extract_archive;
|
||||
@@ -153,13 +179,12 @@ typedef struct settings
|
||||
bool ui_companion_start_on_boot;
|
||||
bool ui_companion_enable;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Cheevos */
|
||||
bool cheevos_enable;
|
||||
bool cheevos_test_unofficial;
|
||||
bool cheevos_hardcore_mode_enable;
|
||||
bool cheevos_leaderboards_enable;
|
||||
bool cheevos_verbose_enable;
|
||||
#endif
|
||||
|
||||
/* Camera */
|
||||
bool camera_allow;
|
||||
@@ -179,13 +204,12 @@ typedef struct settings
|
||||
bool bundle_assets_extract_enable;
|
||||
|
||||
/* Misc. */
|
||||
#ifdef HAVE_THREADS
|
||||
bool threaded_data_runloop_enable;
|
||||
#endif
|
||||
bool set_supports_no_game_enable;
|
||||
bool auto_screenshot_filename;
|
||||
bool history_list_enable;
|
||||
bool playlist_entry_remove;
|
||||
bool playlist_entry_rename;
|
||||
bool rewind_enable;
|
||||
bool pause_nonactive;
|
||||
bool block_sram_overwrite;
|
||||
@@ -195,6 +219,7 @@ typedef struct settings
|
||||
bool savestate_thumbnail_enable;
|
||||
bool network_cmd_enable;
|
||||
bool stdin_cmd_enable;
|
||||
bool keymapper_enable;
|
||||
bool network_remote_enable;
|
||||
bool network_remote_enable_user[MAX_USERS];
|
||||
bool load_dummy_on_core_shutdown;
|
||||
@@ -209,11 +234,14 @@ typedef struct settings
|
||||
bool sort_savestates_enable;
|
||||
bool config_save_on_exit;
|
||||
bool show_hidden_files;
|
||||
#ifdef HAVE_LAKKA
|
||||
|
||||
bool savefiles_in_content_dir;
|
||||
bool savestates_in_content_dir;
|
||||
bool screenshots_in_content_dir;
|
||||
bool systemfiles_in_content_dir;
|
||||
bool ssh_enable;
|
||||
bool samba_enable;
|
||||
bool bluetooth_enable;
|
||||
#endif
|
||||
} bools;
|
||||
|
||||
struct
|
||||
@@ -228,8 +256,10 @@ typedef struct settings
|
||||
float video_msg_color_r;
|
||||
float video_msg_color_g;
|
||||
float video_msg_color_b;
|
||||
float video_msg_bgcolor_opacity;
|
||||
|
||||
float menu_wallpaper_opacity;
|
||||
float menu_framebuffer_opacity;
|
||||
float menu_footer_opacity;
|
||||
float menu_header_opacity;
|
||||
|
||||
@@ -251,10 +281,7 @@ typedef struct settings
|
||||
int location_update_interval_ms;
|
||||
int location_update_interval_distance;
|
||||
int state_slot;
|
||||
|
||||
#ifdef HAVE_WASAPI
|
||||
int audio_wasapi_sh_buffer_length;
|
||||
#endif
|
||||
} ints;
|
||||
|
||||
struct
|
||||
@@ -263,16 +290,8 @@ typedef struct settings
|
||||
unsigned audio_out_rate;
|
||||
unsigned audio_block_frames;
|
||||
unsigned audio_latency;
|
||||
unsigned input_remap_ids[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
|
||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||
* Does not override main binds. */
|
||||
unsigned input_libretro_device[MAX_USERS];
|
||||
unsigned input_analog_dpad_mode[MAX_USERS];
|
||||
|
||||
unsigned input_joypad_map[MAX_USERS];
|
||||
unsigned input_device[MAX_USERS];
|
||||
unsigned input_mouse_index[MAX_USERS];
|
||||
|
||||
unsigned input_turbo_period;
|
||||
unsigned input_turbo_duty_cycle;
|
||||
@@ -293,6 +312,7 @@ typedef struct settings
|
||||
unsigned autosave_interval;
|
||||
unsigned network_cmd_port;
|
||||
unsigned network_remote_base_port;
|
||||
unsigned keymapper_port;
|
||||
unsigned video_window_x;
|
||||
unsigned video_window_y;
|
||||
unsigned video_monitor_index;
|
||||
@@ -302,11 +322,12 @@ typedef struct settings
|
||||
unsigned video_swap_interval;
|
||||
unsigned video_hard_sync_frames;
|
||||
unsigned video_frame_delay;
|
||||
#ifdef GEKKO
|
||||
unsigned video_viwidth;
|
||||
#endif
|
||||
unsigned video_aspect_ratio_idx;
|
||||
unsigned video_rotation;
|
||||
unsigned video_msg_bgcolor_red;
|
||||
unsigned video_msg_bgcolor_green;
|
||||
unsigned video_msg_bgcolor_blue;
|
||||
|
||||
unsigned menu_thumbnails;
|
||||
unsigned menu_dpi_override_value;
|
||||
@@ -322,34 +343,47 @@ typedef struct settings
|
||||
|
||||
unsigned camera_width;
|
||||
unsigned camera_height;
|
||||
|
||||
unsigned input_overlay_show_physical_inputs_port;
|
||||
|
||||
unsigned input_joypad_map[MAX_USERS];
|
||||
unsigned input_device[MAX_USERS];
|
||||
unsigned input_mouse_index[MAX_USERS];
|
||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||
* Does not override main binds. */
|
||||
unsigned input_libretro_device[MAX_USERS];
|
||||
unsigned input_analog_dpad_mode[MAX_USERS];
|
||||
|
||||
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
|
||||
|
||||
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
|
||||
} uints;
|
||||
|
||||
struct
|
||||
{
|
||||
char placeholder;
|
||||
|
||||
char playlist_names[PATH_MAX_LENGTH];
|
||||
char playlist_cores[PATH_MAX_LENGTH];
|
||||
char video_driver[32];
|
||||
char record_driver[32];
|
||||
char camera_driver[32];
|
||||
char wifi_driver[32];
|
||||
char location_driver[32];
|
||||
#ifdef HAVE_MENU
|
||||
char menu_driver[32];
|
||||
#endif
|
||||
char audio_device[255];
|
||||
char camera_device[255];
|
||||
#ifdef HAVE_CHEEVOS
|
||||
char cheevos_username[32];
|
||||
char cheevos_password[32];
|
||||
#endif
|
||||
char video_context_driver[32];
|
||||
char audio_driver[32];
|
||||
char audio_resampler[32];
|
||||
char input_driver[32];
|
||||
char input_joypad_driver[32];
|
||||
|
||||
char input_keyboard_layout[64];
|
||||
|
||||
char audio_device[255];
|
||||
char camera_device[255];
|
||||
|
||||
char playlist_names[PATH_MAX_LENGTH];
|
||||
char playlist_cores[PATH_MAX_LENGTH];
|
||||
char bundle_assets_src[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
|
||||
@@ -359,12 +393,17 @@ typedef struct settings
|
||||
{
|
||||
char placeholder;
|
||||
|
||||
|
||||
char username[32];
|
||||
char netplay_password[128];
|
||||
char netplay_spectate_password[128];
|
||||
char netplay_server[255];
|
||||
char network_buildbot_url[255];
|
||||
char network_buildbot_assets_url[255];
|
||||
char browse_url[4096];
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
char path_menu_xmb_font[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
char menu_xmb_show_settings_password[PATH_MAX_LENGTH];
|
||||
char kiosk_mode_password[PATH_MAX_LENGTH];
|
||||
char path_cheat_database[PATH_MAX_LENGTH];
|
||||
char path_content_database[PATH_MAX_LENGTH];
|
||||
char path_overlay[PATH_MAX_LENGTH];
|
||||
@@ -373,6 +412,7 @@ typedef struct settings
|
||||
char path_softfilter_plugin[PATH_MAX_LENGTH];
|
||||
char path_core_options[PATH_MAX_LENGTH];
|
||||
char path_content_history[PATH_MAX_LENGTH];
|
||||
char path_content_favorites[PATH_MAX_LENGTH];
|
||||
char path_content_music_history[PATH_MAX_LENGTH];
|
||||
char path_content_image_history[PATH_MAX_LENGTH];
|
||||
char path_content_video_history[PATH_MAX_LENGTH];
|
||||
@@ -381,14 +421,13 @@ typedef struct settings
|
||||
char path_shader[PATH_MAX_LENGTH];
|
||||
char path_font[PATH_MAX_LENGTH];
|
||||
|
||||
char network_buildbot_url[255];
|
||||
char network_buildbot_assets_url[255];
|
||||
|
||||
char directory_audio_filter[PATH_MAX_LENGTH];
|
||||
char directory_autoconfig[PATH_MAX_LENGTH];
|
||||
char directory_video_filter[PATH_MAX_LENGTH];
|
||||
char directory_video_shader[PATH_MAX_LENGTH];
|
||||
char directory_content_history[PATH_MAX_LENGTH];
|
||||
char directory_content_favorites[PATH_MAX_LENGTH];
|
||||
char directory_libretro[PATH_MAX_LENGTH];
|
||||
char directory_cursor[PATH_MAX_LENGTH];
|
||||
char directory_input_remapping[PATH_MAX_LENGTH];
|
||||
@@ -404,12 +443,6 @@ typedef struct settings
|
||||
char directory_thumbnails[PATH_MAX_LENGTH];
|
||||
char directory_menu_config[PATH_MAX_LENGTH];
|
||||
char directory_menu_content[PATH_MAX_LENGTH];
|
||||
#ifdef HAVE_NETWORKING
|
||||
char netplay_server[255];
|
||||
char netplay_password[128];
|
||||
char netplay_spectate_password[128];
|
||||
#endif
|
||||
char username[32];
|
||||
} paths;
|
||||
|
||||
bool modified;
|
||||
@@ -419,22 +452,6 @@ typedef struct settings
|
||||
size_t rewind_buffer_size;
|
||||
} settings_t;
|
||||
|
||||
#define configuration_set_float(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_bool(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_uint(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_int(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
/**
|
||||
* config_get_default_camera:
|
||||
*
|
||||
@@ -507,7 +524,6 @@ const char *config_get_default_input(void);
|
||||
**/
|
||||
const char *config_get_default_joypad(void);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/**
|
||||
* config_get_default_menu:
|
||||
*
|
||||
@@ -516,7 +532,6 @@ const char *config_get_default_joypad(void);
|
||||
* Returns: Default menu driver.
|
||||
**/
|
||||
const char *config_get_default_menu(void);
|
||||
#endif
|
||||
|
||||
const char *config_get_default_record(void);
|
||||
|
||||
|
||||
+106
-90
@@ -46,9 +46,6 @@ static void core_info_list_resolve_all_extensions(
|
||||
size_t all_ext_len = 0;
|
||||
char *all_ext = NULL;
|
||||
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
if (core_info_list->list[i].supported_extensions)
|
||||
@@ -189,19 +186,21 @@ static bool core_info_list_iterate(
|
||||
char *s, size_t len,
|
||||
struct string_list *contents, size_t i)
|
||||
{
|
||||
char info_path_base[PATH_MAX_LENGTH];
|
||||
size_t info_path_base_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA))
|
||||
char *substr = NULL;
|
||||
char *substr = NULL;
|
||||
#endif
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!contents || !contents->elems[i].data)
|
||||
return false;
|
||||
goto error;
|
||||
|
||||
info_path_base[0] = '\0';
|
||||
|
||||
fill_pathname_base_noext(info_path_base, contents->elems[i].data,
|
||||
sizeof(info_path_base));
|
||||
fill_pathname_base_noext(info_path_base,
|
||||
contents->elems[i].data,
|
||||
info_path_base_size);
|
||||
|
||||
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA) && !defined(HW_WUP))
|
||||
substr = strrchr(info_path_base, '_');
|
||||
@@ -211,14 +210,20 @@ static bool core_info_list_iterate(
|
||||
|
||||
strlcat(info_path_base,
|
||||
file_path_str(FILE_PATH_CORE_INFO_EXTENSION),
|
||||
sizeof(info_path_base));
|
||||
info_path_base_size);
|
||||
|
||||
fill_pathname_join(s,
|
||||
(!string_is_empty(settings->paths.path_libretro_info)) ?
|
||||
settings->paths.path_libretro_info : settings->paths.directory_libretro,
|
||||
settings->paths.path_libretro_info :
|
||||
settings->paths.directory_libretro,
|
||||
info_path_base, len);
|
||||
|
||||
free(info_path_base);
|
||||
return true;
|
||||
|
||||
error:
|
||||
free(info_path_base);
|
||||
return false;
|
||||
}
|
||||
|
||||
static core_info_list_t *core_info_list_new(const char *path)
|
||||
@@ -245,12 +250,13 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
|
||||
for (i = 0; i < contents->size; i++)
|
||||
{
|
||||
char info_path[PATH_MAX_LENGTH];
|
||||
size_t info_path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
info_path[0] = '\0';
|
||||
info_path[0] = '\0';
|
||||
|
||||
if (
|
||||
core_info_list_iterate(info_path, sizeof(info_path),
|
||||
core_info_list_iterate(info_path, info_path_size,
|
||||
contents, i)
|
||||
&& path_is_valid(info_path))
|
||||
{
|
||||
@@ -259,30 +265,36 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
unsigned count = 0;
|
||||
config_file_t *conf = config_file_new(info_path);
|
||||
|
||||
free(info_path);
|
||||
|
||||
if (!conf)
|
||||
continue;
|
||||
|
||||
if (config_get_string(conf, "display_name", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "display_name", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].display_name = strdup(tmp);
|
||||
free(tmp);
|
||||
tmp = NULL;
|
||||
}
|
||||
if (config_get_string(conf, "corename", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "corename", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].core_name = strdup(tmp);
|
||||
free(tmp);
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "systemname", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "systemname", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].systemname = strdup(tmp);
|
||||
free(tmp);
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "manufacturer", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "manufacturer", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].system_manufacturer = strdup(tmp);
|
||||
free(tmp);
|
||||
@@ -293,7 +305,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
|
||||
core_info[i].firmware_count = count;
|
||||
|
||||
if (config_get_string(conf, "supported_extensions", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "supported_extensions", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].supported_extensions = strdup(tmp);
|
||||
core_info[i].supported_extensions_list =
|
||||
@@ -303,7 +316,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "authors", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "authors", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].authors = strdup(tmp);
|
||||
core_info[i].authors_list =
|
||||
@@ -313,7 +327,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "permissions", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "permissions", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].permissions = strdup(tmp);
|
||||
core_info[i].permissions_list =
|
||||
@@ -323,7 +338,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "license", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "license", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].licenses = strdup(tmp);
|
||||
core_info[i].licenses_list =
|
||||
@@ -333,7 +349,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "categories", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "categories", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].categories = strdup(tmp);
|
||||
core_info[i].categories_list =
|
||||
@@ -343,7 +360,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "database", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "database", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].databases = strdup(tmp);
|
||||
core_info[i].databases_list =
|
||||
@@ -353,7 +371,8 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "notes", &tmp) && !string_is_empty(tmp))
|
||||
if (config_get_string(conf, "notes", &tmp)
|
||||
&& !string_is_empty(tmp))
|
||||
{
|
||||
core_info[i].notes = strdup(tmp);
|
||||
core_info[i].note_list = string_split(core_info[i].notes, "|");
|
||||
@@ -370,8 +389,14 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
&tmp_bool))
|
||||
core_info[i].supports_no_game = tmp_bool;
|
||||
|
||||
if (config_get_bool(conf, "database_match_archive_member",
|
||||
&tmp_bool))
|
||||
core_info[i].database_match_archive_member = tmp_bool;
|
||||
|
||||
core_info[i].config_data = conf;
|
||||
}
|
||||
else
|
||||
free(info_path);
|
||||
|
||||
if (!string_is_empty(contents->elems[i].data))
|
||||
core_info[i].path = strdup(contents->elems[i].data);
|
||||
@@ -381,10 +406,11 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
strdup(path_basename(core_info[i].path));
|
||||
}
|
||||
|
||||
core_info_list_resolve_all_extensions(core_info_list);
|
||||
|
||||
if (core_info_list)
|
||||
{
|
||||
core_info_list_resolve_all_extensions(core_info_list);
|
||||
core_info_list_resolve_all_firmware(core_info_list);
|
||||
}
|
||||
|
||||
dir_list_free(contents);
|
||||
return core_info_list;
|
||||
@@ -493,17 +519,18 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
const char *systemdir)
|
||||
{
|
||||
size_t i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
core_info_t *info = NULL;
|
||||
core_info_t *info = NULL;
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
if (!core_info_list || !core)
|
||||
return false;
|
||||
goto error;
|
||||
|
||||
path[0] = '\0';
|
||||
info = core_info_find_internal(core_info_list, core);
|
||||
|
||||
if (!info)
|
||||
return false;
|
||||
goto error;
|
||||
|
||||
rarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
@@ -512,7 +539,7 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
continue;
|
||||
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].path, path_size);
|
||||
info->firmware[i].missing = !path_file_exists(path);
|
||||
if (info->firmware[i].missing && !info->firmware[i].optional)
|
||||
{
|
||||
@@ -521,7 +548,12 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
}
|
||||
}
|
||||
|
||||
free(path);
|
||||
return true;
|
||||
|
||||
error:
|
||||
free(path);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -732,24 +764,34 @@ void core_info_get_name(const char *path, char *s, size_t len)
|
||||
|
||||
for (i = 0; i < contents->size; i++)
|
||||
{
|
||||
char info_path[PATH_MAX_LENGTH];
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
config_file_t *conf = NULL;
|
||||
char *new_core_name = NULL;
|
||||
|
||||
info_path[0] = '\0';
|
||||
|
||||
if (!string_is_equal(contents->elems[i].data, path))
|
||||
{
|
||||
free(info_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!core_info_list_iterate(info_path,
|
||||
sizeof(info_path), contents, i)
|
||||
path_size, contents, i)
|
||||
&& path_is_valid(info_path))
|
||||
{
|
||||
free(info_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
conf = config_file_new(info_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
free(info_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "corename",
|
||||
&new_core_name))
|
||||
@@ -759,6 +801,7 @@ void core_info_get_name(const char *path, char *s, size_t len)
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
free(info_path);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -784,43 +827,44 @@ size_t core_info_list_num_info_files(core_info_list_t *core_info_list)
|
||||
return num;
|
||||
}
|
||||
|
||||
bool core_info_unsupported_content_path(const char *path)
|
||||
bool core_info_database_match_archive_member(const char *database_path)
|
||||
{
|
||||
size_t i;
|
||||
const char *archive_path = NULL;
|
||||
const char *delim = path_get_archive_delim(path);
|
||||
char *database = NULL;
|
||||
const char *new_path = path_basename(database_path);
|
||||
|
||||
if (delim)
|
||||
archive_path = delim - 1;
|
||||
|
||||
if (!core_info_curr_list)
|
||||
if (string_is_empty(new_path))
|
||||
return false;
|
||||
|
||||
/* if the path contains a compressed file and the core supports archives,
|
||||
* we don't want to look at this file */
|
||||
if (archive_path)
|
||||
database = strdup(new_path);
|
||||
|
||||
if (string_is_empty(database))
|
||||
goto error;
|
||||
|
||||
path_remove_extension(database);
|
||||
|
||||
if (core_info_curr_list)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < core_info_curr_list->count; i++)
|
||||
{
|
||||
const core_info_t *info = &core_info_curr_list->list[i];
|
||||
|
||||
if ( !string_list_find_elem(info->supported_extensions_list, "zip")
|
||||
&& !string_list_find_elem(info->supported_extensions_list, "7z"))
|
||||
continue;
|
||||
if (!info->database_match_archive_member)
|
||||
continue;
|
||||
|
||||
return false;
|
||||
if (!string_list_find_elem(info->databases_list, database))
|
||||
continue;
|
||||
|
||||
free(database);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < core_info_curr_list->count; i++)
|
||||
{
|
||||
const core_info_t *info = &core_info_curr_list->list[i];
|
||||
|
||||
if (string_list_find_elem(info->supported_extensions_list, path_get_extension(path)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
error:
|
||||
if (database)
|
||||
free(database);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool core_info_database_supports_content_path(const char *database_path, const char *path)
|
||||
@@ -834,43 +878,13 @@ bool core_info_database_supports_content_path(const char *database_path, const c
|
||||
database = strdup(new_path);
|
||||
|
||||
if (string_is_empty(database))
|
||||
{
|
||||
if (database)
|
||||
free(database);
|
||||
return false;
|
||||
}
|
||||
goto error;
|
||||
|
||||
path_remove_extension(database);
|
||||
|
||||
if (core_info_curr_list)
|
||||
{
|
||||
size_t i;
|
||||
const char *delim = path_get_archive_delim(path);
|
||||
|
||||
if (delim)
|
||||
{
|
||||
const char *archive_path = delim - 1;
|
||||
|
||||
/* if the path contains a compressed file and the core supports archives,
|
||||
* we don't want to look at this file */
|
||||
if (archive_path)
|
||||
{
|
||||
for (i = 0; i < core_info_curr_list->count; i++)
|
||||
{
|
||||
const core_info_t *info = &core_info_curr_list->list[i];
|
||||
|
||||
if (!string_list_find_elem(info->databases_list, database))
|
||||
continue;
|
||||
|
||||
if ( !string_list_find_elem(info->supported_extensions_list, "zip")
|
||||
&& !string_list_find_elem(info->supported_extensions_list, "7z"))
|
||||
continue;
|
||||
|
||||
free(database);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < core_info_curr_list->count; i++)
|
||||
{
|
||||
@@ -888,7 +902,9 @@ bool core_info_database_supports_content_path(const char *database_path, const c
|
||||
}
|
||||
}
|
||||
|
||||
free(database);
|
||||
error:
|
||||
if (database)
|
||||
free(database);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -37,6 +37,9 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool supports_no_game;
|
||||
bool database_match_archive_member;
|
||||
size_t firmware_count;
|
||||
char *path;
|
||||
void *config_data;
|
||||
char *display_name;
|
||||
@@ -57,10 +60,7 @@ typedef struct
|
||||
struct string_list *authors_list;
|
||||
struct string_list *permissions_list;
|
||||
struct string_list *licenses_list;
|
||||
|
||||
core_info_firmware_t *firmware;
|
||||
size_t firmware_count;
|
||||
bool supports_no_game;
|
||||
void *userdata;
|
||||
} core_info_t;
|
||||
|
||||
@@ -121,6 +121,8 @@ bool core_info_load(core_info_ctx_find_t *info);
|
||||
|
||||
bool core_info_database_supports_content_path(const char *database_path, const char *path);
|
||||
|
||||
bool core_info_database_match_archive_member(const char *database_path);
|
||||
|
||||
bool core_info_unsupported_content_path(const char *path);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
+31
-86
@@ -398,10 +398,34 @@ static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool type_is_prioritized(enum msg_file_type type)
|
||||
{
|
||||
return (type == FILE_TYPE_CUE || type == FILE_TYPE_GDI);
|
||||
}
|
||||
|
||||
static enum msg_file_type file_type(const char *path)
|
||||
{
|
||||
return msg_hash_to_file_type(msg_hash_calculate(path_get_extension(path)));
|
||||
}
|
||||
|
||||
static int dir_entry_compare(const void *left, const void *right)
|
||||
{
|
||||
const struct string_list_elem *le = (const struct string_list_elem*)left;
|
||||
const struct string_list_elem *re = (const struct string_list_elem*)right;
|
||||
bool l = type_is_prioritized(file_type(le->data));
|
||||
bool r = type_is_prioritized(file_type(re->data));
|
||||
|
||||
return (int) r - (int) l;
|
||||
}
|
||||
|
||||
static void dir_list_prioritize(struct string_list *list)
|
||||
{
|
||||
qsort(list->elems, list->size, sizeof(*list->elems), dir_entry_compare);
|
||||
}
|
||||
|
||||
database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
enum database_type type, retro_task_t *task)
|
||||
{
|
||||
unsigned i;
|
||||
database_info_handle_t *db = (database_info_handle_t*)
|
||||
calloc(1, sizeof(*db));
|
||||
|
||||
@@ -413,56 +437,12 @@ database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
if (!db->list)
|
||||
goto error;
|
||||
|
||||
dir_list_prioritize(db->list);
|
||||
|
||||
db->list_ptr = 0;
|
||||
db->status = DATABASE_STATUS_ITERATE;
|
||||
db->type = type;
|
||||
|
||||
if (db->list->size > 0)
|
||||
{
|
||||
for (i = 0; i < db->list->size; i++)
|
||||
{
|
||||
const char *path = db->list->elems[i].data;
|
||||
|
||||
if (task)
|
||||
task_set_progress(task, (i / (float)db->list->size) * 100);
|
||||
|
||||
if (path_is_compressed_file(path) && !path_contains_compressed_file(path))
|
||||
{
|
||||
struct string_list *archive_list = path_is_compressed_file(path) ?
|
||||
file_archive_get_file_list(path, NULL) : NULL;
|
||||
|
||||
if (archive_list && archive_list->size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < archive_list->size; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
size_t path_len = strlen(path);
|
||||
|
||||
new_path[0] = '\0';
|
||||
|
||||
strlcpy(new_path, path, sizeof(new_path));
|
||||
|
||||
if (path_len + strlen(archive_list->elems[i].data)
|
||||
+ 1 < PATH_MAX_LENGTH)
|
||||
{
|
||||
new_path[path_len] = '#';
|
||||
strlcpy(new_path + path_len + 1,
|
||||
archive_list->elems[i].data,
|
||||
sizeof(new_path) - path_len);
|
||||
}
|
||||
|
||||
string_list_append(db->list, new_path,
|
||||
archive_list->elems[i].attr);
|
||||
}
|
||||
|
||||
string_list_free(archive_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return db;
|
||||
|
||||
error:
|
||||
@@ -490,44 +470,6 @@ database_info_handle_t *database_info_file_init(const char *path,
|
||||
|
||||
string_list_append(db->list, path, attr);
|
||||
|
||||
if (path_is_compressed_file(path))
|
||||
{
|
||||
struct string_list *archive_list =path_is_compressed_file(path) ?
|
||||
file_archive_get_file_list(path, NULL) : NULL;
|
||||
|
||||
if (archive_list && archive_list->size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < archive_list->size; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
size_t path_len = strlen(path);
|
||||
|
||||
if (task)
|
||||
task_set_progress(task, (i / (float)archive_list->size) * 100);
|
||||
|
||||
new_path[0] = '\0';
|
||||
|
||||
strlcpy(new_path, path, sizeof(new_path));
|
||||
|
||||
if (path_len + strlen(archive_list->elems[i].data)
|
||||
+ 1 < PATH_MAX_LENGTH)
|
||||
{
|
||||
new_path[path_len] = '#';
|
||||
strlcpy(new_path + path_len + 1,
|
||||
archive_list->elems[i].data,
|
||||
sizeof(new_path) - path_len);
|
||||
}
|
||||
|
||||
string_list_append(db->list, new_path,
|
||||
archive_list->elems[i].attr);
|
||||
}
|
||||
|
||||
string_list_free(archive_list);
|
||||
}
|
||||
}
|
||||
|
||||
db->list_ptr = 0;
|
||||
db->status = DATABASE_STATUS_ITERATE;
|
||||
db->type = type;
|
||||
@@ -565,11 +507,14 @@ database_info_list_t *database_info_list_new(
|
||||
goto end;
|
||||
|
||||
database_info_list = (database_info_list_t*)
|
||||
calloc(1, sizeof(*database_info_list));
|
||||
malloc(sizeof(*database_info_list));
|
||||
|
||||
if (!database_info_list)
|
||||
goto end;
|
||||
|
||||
database_info_list->count = 0;
|
||||
database_info_list->list = NULL;
|
||||
|
||||
while (ret != -1)
|
||||
{
|
||||
database_info_t db_info = {0};
|
||||
|
||||
+13
-13
@@ -81,6 +81,18 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int analog_supported;
|
||||
int rumble_supported;
|
||||
int coop_supported;
|
||||
uint32_t crc32;
|
||||
unsigned size;
|
||||
unsigned famitsu_magazine_rating;
|
||||
unsigned edge_magazine_rating;
|
||||
unsigned edge_magazine_issue;
|
||||
unsigned max_users;
|
||||
unsigned releasemonth;
|
||||
unsigned releaseyear;
|
||||
unsigned tgdb_rating;
|
||||
char *name;
|
||||
char *rom_name;
|
||||
char *serial;
|
||||
@@ -97,27 +109,15 @@ typedef struct
|
||||
char *pegi_rating;
|
||||
char *cero_rating;
|
||||
char *enhancement_hw;
|
||||
uint32_t crc32;
|
||||
char *sha1;
|
||||
char *md5;
|
||||
unsigned size;
|
||||
unsigned famitsu_magazine_rating;
|
||||
unsigned edge_magazine_rating;
|
||||
unsigned edge_magazine_issue;
|
||||
unsigned max_users;
|
||||
unsigned releasemonth;
|
||||
unsigned releaseyear;
|
||||
unsigned tgdb_rating;
|
||||
int analog_supported;
|
||||
int rumble_supported;
|
||||
int coop_supported;
|
||||
void *userdata;
|
||||
} database_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
database_info_t *list;
|
||||
size_t count;
|
||||
database_info_t *list;
|
||||
} database_info_list_t;
|
||||
|
||||
database_info_list_t *database_info_list_new(const char *rdb_path,
|
||||
|
||||
@@ -102,6 +102,7 @@ struct defaults
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
playlist_t *content_history;
|
||||
playlist_t *content_favorites;
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
playlist_t *image_history;
|
||||
#endif
|
||||
|
||||
+11
-2
@@ -21,6 +21,8 @@
|
||||
/* Direct3D 9 */
|
||||
#include <d3d9.h>
|
||||
|
||||
#define ID3DSURFACE IDirect3DSurface9
|
||||
|
||||
#define LPDIRECT3D LPDIRECT3D9
|
||||
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
|
||||
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
|
||||
@@ -41,8 +43,12 @@
|
||||
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0
|
||||
#endif
|
||||
|
||||
#elif defined(_XBOX1)
|
||||
#elif defined(HAVE_D3D8)
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#else
|
||||
#include "../gfx/include/d3d8/d3d8.h"
|
||||
#endif
|
||||
|
||||
/* Direct3D 8 */
|
||||
#define LPDIRECT3D LPDIRECT3D8
|
||||
@@ -56,9 +62,12 @@
|
||||
#define D3DVERTEXELEMENT D3DVERTEXELEMENT8
|
||||
#define D3DVIEWPORT D3DVIEWPORT8
|
||||
|
||||
#define ID3DSURFACE IDirect3DSurface8
|
||||
#define D3DCREATE_CTX Direct3DCreate8
|
||||
|
||||
#if !defined(D3DLOCK_NOSYSLOCK) && defined(_XBOX)
|
||||
#define D3DLOCK_NOSYSLOCK (0)
|
||||
#endif
|
||||
#define D3DSAMP_ADDRESSU D3DTSS_ADDRESSU
|
||||
#define D3DSAMP_ADDRESSV D3DTSS_ADDRESSV
|
||||
#define D3DSAMP_MAGFILTER D3DTSS_MAGFILTER
|
||||
@@ -67,7 +76,7 @@
|
||||
|
||||
#if defined(_XBOX360)
|
||||
#define D3DFVF_CUSTOMVERTEX 0
|
||||
#elif defined(_XBOX1)
|
||||
#elif defined(HAVE_D3D8)
|
||||
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW | D3DFVF_TEX1)
|
||||
#endif
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __7Z_BUF_H
|
||||
#define __7Z_BUF_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __7Z_CRC_H
|
||||
#define __7Z_CRC_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+5
-116
@@ -3,8 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/* #define _7ZIP_PPMD_SUPPPORT */
|
||||
#include <boolean.h>
|
||||
|
||||
#include "7z.h"
|
||||
|
||||
@@ -13,9 +12,6 @@
|
||||
#include "CpuArch.h"
|
||||
#include "LzmaDec.h"
|
||||
#include "Lzma2Dec.h"
|
||||
#ifdef _7ZIP_PPMD_SUPPPORT
|
||||
#include "Ppmd7.h"
|
||||
#endif
|
||||
|
||||
#define k_Copy 0
|
||||
#define k_LZMA2 0x21
|
||||
@@ -27,104 +23,6 @@
|
||||
#define k_SPARC 0x03030805
|
||||
#define k_BCJ2 0x0303011B
|
||||
|
||||
#ifdef _7ZIP_PPMD_SUPPPORT
|
||||
|
||||
#define k_PPMD 0x30401
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Iuint8_tIn p;
|
||||
const uint8_t *cur;
|
||||
const uint8_t *end;
|
||||
const uint8_t *begin;
|
||||
uint64_t processed;
|
||||
Bool extra;
|
||||
SRes res;
|
||||
ILookInStream *inStream;
|
||||
} Cuint8_tInToLook;
|
||||
|
||||
static uint8_t Readuint8_t(void *pp)
|
||||
{
|
||||
Cuint8_tInToLook *p = (Cuint8_tInToLook *)pp;
|
||||
if (p->cur != p->end)
|
||||
return *p->cur++;
|
||||
if (p->res == SZ_OK)
|
||||
{
|
||||
size_t size = p->cur - p->begin;
|
||||
p->processed += size;
|
||||
p->res = p->inStream->Skip(p->inStream, size);
|
||||
size = (1 << 25);
|
||||
p->res = p->inStream->Look(p->inStream, (const void **)&p->begin, &size);
|
||||
p->cur = p->begin;
|
||||
p->end = p->begin + size;
|
||||
if (size != 0)
|
||||
return *p->cur++;
|
||||
}
|
||||
p->extra = True;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SRes SzDecodePpmd(CSzCoderInfo *coder, uint64_t inSize, ILookInStream *inStream,
|
||||
uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain)
|
||||
{
|
||||
CPpmd7 ppmd;
|
||||
Cuint8_tInToLook s;
|
||||
SRes res = SZ_OK;
|
||||
|
||||
s.p.Read = Readuint8_t;
|
||||
s.inStream = inStream;
|
||||
s.begin = s.end = s.cur = NULL;
|
||||
s.extra = False;
|
||||
s.res = SZ_OK;
|
||||
s.processed = 0;
|
||||
|
||||
if (coder->Props.size != 5)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
|
||||
{
|
||||
unsigned order = coder->Props.data[0];
|
||||
uint32_t memSize = GetUi32(coder->Props.data + 1);
|
||||
if (order < PPMD7_MIN_ORDER ||
|
||||
order > PPMD7_MAX_ORDER ||
|
||||
memSize < PPMD7_MIN_MEM_SIZE ||
|
||||
memSize > PPMD7_MAX_MEM_SIZE)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
Ppmd7_Construct(&ppmd);
|
||||
if (!Ppmd7_Alloc(&ppmd, memSize, allocMain))
|
||||
return SZ_ERROR_MEM;
|
||||
Ppmd7_Init(&ppmd, order);
|
||||
}
|
||||
{
|
||||
CPpmd7z_RangeDec rc;
|
||||
Ppmd7z_RangeDec_CreateVTable(&rc);
|
||||
rc.Stream = &s.p;
|
||||
if (!Ppmd7z_RangeDec_Init(&rc))
|
||||
res = SZ_ERROR_DATA;
|
||||
else if (s.extra)
|
||||
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < outSize; i++)
|
||||
{
|
||||
int sym = Ppmd7_DecodeSymbol(&ppmd, &rc.p);
|
||||
if (s.extra || sym < 0)
|
||||
break;
|
||||
outBuffer[i] = (uint8_t)sym;
|
||||
}
|
||||
if (i != outSize)
|
||||
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
|
||||
else if (s.processed + (s.cur - s.begin) != inSize || !Ppmd7z_RangeDec_IsFinishedOK(&rc))
|
||||
res = SZ_ERROR_DATA;
|
||||
}
|
||||
}
|
||||
Ppmd7_Free(&ppmd, allocMain);
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static SRes SzDecodeLzma(CSzCoderInfo *coder, uint64_t inSize, ILookInStream *inStream,
|
||||
uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain)
|
||||
{
|
||||
@@ -241,22 +139,19 @@ static SRes SzDecodeCopy(uint64_t inSize, ILookInStream *inStream, uint8_t *outB
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
static Bool IS_MAIN_METHOD(uint32_t m)
|
||||
static bool IS_MAIN_METHOD(uint32_t m)
|
||||
{
|
||||
switch(m)
|
||||
{
|
||||
case k_Copy:
|
||||
case k_LZMA:
|
||||
case k_LZMA2:
|
||||
#ifdef _7ZIP_PPMD_SUPPPORT
|
||||
case k_PPMD:
|
||||
#endif
|
||||
return True;
|
||||
return true;
|
||||
}
|
||||
return False;
|
||||
return false;
|
||||
}
|
||||
|
||||
static Bool IS_SUPPORTED_CODER(const CSzCoderInfo *c)
|
||||
static bool IS_SUPPORTED_CODER(const CSzCoderInfo *c)
|
||||
{
|
||||
return
|
||||
c->NumInStreams == 1 &&
|
||||
@@ -402,13 +297,7 @@ static SRes SzFolder_Decode2(const CSzFolder *folder, const uint64_t *packSizes,
|
||||
RINOK(SzDecodeLzma2(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _7ZIP_PPMD_SUPPPORT
|
||||
RINOK(SzDecodePpmd(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
|
||||
#else
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (coder->MethodID == k_BCJ2)
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
SRes SeqInStream_Readuint8_t(ISeqInStream *stream, uint8_t *buf);
|
||||
|
||||
|
||||
Vendored
+173
@@ -0,0 +1,173 @@
|
||||
/* 7zTypes.h -- Basic types
|
||||
2013-11-12 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_TYPES_H
|
||||
#define __7Z_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef EXTERN_C_BEGIN
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C_BEGIN extern "C" {
|
||||
#define EXTERN_C_END }
|
||||
#else
|
||||
#define EXTERN_C_BEGIN
|
||||
#define EXTERN_C_END
|
||||
#endif
|
||||
#endif
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#define _7ZIP_ST
|
||||
#endif
|
||||
|
||||
#define SZ_OK 0
|
||||
|
||||
#define SZ_ERROR_DATA 1
|
||||
#define SZ_ERROR_MEM 2
|
||||
#define SZ_ERROR_CRC 3
|
||||
#define SZ_ERROR_UNSUPPORTED 4
|
||||
#define SZ_ERROR_PARAM 5
|
||||
#define SZ_ERROR_INPUT_EOF 6
|
||||
#define SZ_ERROR_OUTPUT_EOF 7
|
||||
#define SZ_ERROR_READ 8
|
||||
#define SZ_ERROR_WRITE 9
|
||||
#define SZ_ERROR_PROGRESS 10
|
||||
#define SZ_ERROR_FAIL 11
|
||||
#define SZ_ERROR_THREAD 12
|
||||
|
||||
#define SZ_ERROR_ARCHIVE 16
|
||||
#define SZ_ERROR_NO_ARCHIVE 17
|
||||
|
||||
typedef int SRes;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef unsigned WRes;
|
||||
#else
|
||||
typedef int WRes;
|
||||
#endif
|
||||
|
||||
#ifndef RINOK
|
||||
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define MY_FAST_CALL __fastcall
|
||||
#else
|
||||
#define MY_FAST_CALL
|
||||
#endif
|
||||
|
||||
/* The following interfaces use first parameter as pointer to structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */
|
||||
} IByteIn;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*Write)(void *p, unsigned char b);
|
||||
} IByteOut;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||
(output(*size) < input(*size)) is allowed */
|
||||
} ISeqInStream;
|
||||
|
||||
/* it can return SZ_ERROR_INPUT_EOF */
|
||||
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
|
||||
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
|
||||
SRes SeqInStream_ReadByte(ISeqInStream *stream, unsigned char *buf);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t (*Write)(void *p, const void *buf, size_t size);
|
||||
/* Returns: result - the number of actually written bytes.
|
||||
(result < size) means error */
|
||||
} ISeqOutStream;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SZ_SEEK_SET = 0,
|
||||
SZ_SEEK_CUR = 1,
|
||||
SZ_SEEK_END = 2
|
||||
} ESzSeek;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
|
||||
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
|
||||
} ISeekInStream;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Look)(void *p, const void **buf, size_t *size);
|
||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||
(output(*size) > input(*size)) is not allowed
|
||||
(output(*size) < input(*size)) is allowed */
|
||||
SRes (*Skip)(void *p, size_t offset);
|
||||
/* offset must be <= output(*size) of Look */
|
||||
|
||||
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||
/* reads directly (without buffer). It's same as ISeqInStream::Read */
|
||||
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
|
||||
} ILookInStream;
|
||||
|
||||
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
|
||||
SRes LookInStream_SeekTo(ILookInStream *stream, uint64_t offset);
|
||||
|
||||
/* reads via ILookInStream::Read */
|
||||
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
|
||||
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
|
||||
|
||||
#define LookToRead_BUF_SIZE (1 << 14)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ILookInStream s;
|
||||
ISeekInStream *realStream;
|
||||
size_t pos;
|
||||
size_t size;
|
||||
unsigned char buf[LookToRead_BUF_SIZE];
|
||||
} CLookToRead;
|
||||
|
||||
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
|
||||
void LookToRead_Init(CLookToRead *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISeqInStream s;
|
||||
ILookInStream *realStream;
|
||||
} CSecToLook;
|
||||
|
||||
void SecToLook_CreateVTable(CSecToLook *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISeqInStream s;
|
||||
ILookInStream *realStream;
|
||||
} CSecToRead;
|
||||
|
||||
void SecToRead_CreateVTable(CSecToRead *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Progress)(void *p, uint64_t inSize, uint64_t outSize);
|
||||
} ICompressProgress;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *(*Alloc)(void *p, size_t size);
|
||||
void (*Free)(void *p, void *address); /* address can be 0 */
|
||||
} ISzAlloc;
|
||||
|
||||
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
|
||||
#define IAlloc_Free(p, a) (p)->Free((p), a)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __BCJ2_H
|
||||
#define __BCJ2_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __BRA_H
|
||||
#define __BRA_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __CPU_ARCH_H
|
||||
#define __CPU_ARCH_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+830
@@ -0,0 +1,830 @@
|
||||
/* LzFind.c -- Match finder for LZ algorithms
|
||||
2015-10-15 : Igor Pavlov : Public domain */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "LzFind.h"
|
||||
#include "LzHash.h"
|
||||
|
||||
#define kEmptyHashValue 0
|
||||
#define kMaxValForNormalize ((uint32_t)0xFFFFFFFF)
|
||||
#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
|
||||
#define kNormalizeMask (~(uint32_t)(kNormalizeStepMin - 1))
|
||||
#define LzFindkMaxHistorySize ((uint32_t)7 << 29)
|
||||
|
||||
#define kStartMaxLen 3
|
||||
|
||||
static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
|
||||
{
|
||||
if (!p->directInput)
|
||||
{
|
||||
alloc->Free(alloc, p->bufferBase);
|
||||
p->bufferBase = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
|
||||
|
||||
static int LzInWindow_Create(CMatchFinder *p, uint32_t keepSizeReserv, ISzAlloc *alloc)
|
||||
{
|
||||
uint32_t blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
|
||||
if (p->directInput)
|
||||
{
|
||||
p->blockSize = blockSize;
|
||||
return 1;
|
||||
}
|
||||
if (!p->bufferBase || p->blockSize != blockSize)
|
||||
{
|
||||
LzInWindow_Free(p, alloc);
|
||||
p->blockSize = blockSize;
|
||||
p->bufferBase = (unsigned char*)alloc->Alloc(alloc, (size_t)blockSize);
|
||||
}
|
||||
return (p->bufferBase != NULL);
|
||||
}
|
||||
|
||||
unsigned char *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
||||
|
||||
uint32_t MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
||||
|
||||
void MatchFinder_ReduceOffsets(CMatchFinder *p, uint32_t subValue)
|
||||
{
|
||||
p->posLimit -= subValue;
|
||||
p->pos -= subValue;
|
||||
p->streamPos -= subValue;
|
||||
}
|
||||
|
||||
static void MatchFinder_ReadBlock(CMatchFinder *p)
|
||||
{
|
||||
if (p->streamEndWasReached || p->result != SZ_OK)
|
||||
return;
|
||||
|
||||
/* We use (p->streamPos - p->pos) value. (p->streamPos < p->pos) is allowed. */
|
||||
|
||||
if (p->directInput)
|
||||
{
|
||||
uint32_t curSize = 0xFFFFFFFF - (p->streamPos - p->pos);
|
||||
if (curSize > p->directInputRem)
|
||||
curSize = (uint32_t)p->directInputRem;
|
||||
p->directInputRem -= curSize;
|
||||
p->streamPos += curSize;
|
||||
if (p->directInputRem == 0)
|
||||
p->streamEndWasReached = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
unsigned char *dest = p->buffer + (p->streamPos - p->pos);
|
||||
size_t size = (p->bufferBase + p->blockSize - dest);
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
p->result = p->stream->Read(p->stream, dest, &size);
|
||||
if (p->result != SZ_OK)
|
||||
return;
|
||||
if (size == 0)
|
||||
{
|
||||
p->streamEndWasReached = 1;
|
||||
return;
|
||||
}
|
||||
p->streamPos += (uint32_t)size;
|
||||
if (p->streamPos - p->pos > p->keepSizeAfter)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void MatchFinder_MoveBlock(CMatchFinder *p)
|
||||
{
|
||||
memmove(p->bufferBase,
|
||||
p->buffer - p->keepSizeBefore,
|
||||
(size_t)(p->streamPos - p->pos) + p->keepSizeBefore);
|
||||
p->buffer = p->bufferBase + p->keepSizeBefore;
|
||||
}
|
||||
|
||||
int MatchFinder_NeedMove(CMatchFinder *p)
|
||||
{
|
||||
if (p->directInput)
|
||||
return 0;
|
||||
/* if (p->streamEndWasReached) return 0; */
|
||||
return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
|
||||
}
|
||||
|
||||
void MatchFinder_ReadIfRequired(CMatchFinder *p)
|
||||
{
|
||||
if (p->streamEndWasReached)
|
||||
return;
|
||||
if (p->keepSizeAfter >= p->streamPos - p->pos)
|
||||
MatchFinder_ReadBlock(p);
|
||||
}
|
||||
|
||||
static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
|
||||
{
|
||||
if (MatchFinder_NeedMove(p))
|
||||
MatchFinder_MoveBlock(p);
|
||||
MatchFinder_ReadBlock(p);
|
||||
}
|
||||
|
||||
static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
|
||||
{
|
||||
p->cutValue = 32;
|
||||
p->btMode = 1;
|
||||
p->numHashBytes = 4;
|
||||
p->bigHash = 0;
|
||||
}
|
||||
|
||||
#define kCrcPoly 0xEDB88320
|
||||
|
||||
void MatchFinder_Construct(CMatchFinder *p)
|
||||
{
|
||||
uint32_t i;
|
||||
p->bufferBase = NULL;
|
||||
p->directInput = 0;
|
||||
p->hash = NULL;
|
||||
MatchFinder_SetDefaultSettings(p);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
uint32_t r = i;
|
||||
unsigned j;
|
||||
for (j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
|
||||
p->crc[i] = r;
|
||||
}
|
||||
}
|
||||
|
||||
static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
|
||||
{
|
||||
alloc->Free(alloc, p->hash);
|
||||
p->hash = NULL;
|
||||
}
|
||||
|
||||
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
|
||||
{
|
||||
MatchFinder_FreeThisClassMemory(p, alloc);
|
||||
LzInWindow_Free(p, alloc);
|
||||
}
|
||||
|
||||
static CLzRef* AllocRefs(size_t num, ISzAlloc *alloc)
|
||||
{
|
||||
size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
|
||||
if (sizeInBytes / sizeof(CLzRef) != num)
|
||||
return NULL;
|
||||
return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
|
||||
}
|
||||
|
||||
int MatchFinder_Create(CMatchFinder *p, uint32_t historySize,
|
||||
uint32_t keepAddBufferBefore, uint32_t matchMaxLen, uint32_t keepAddBufferAfter,
|
||||
ISzAlloc *alloc)
|
||||
{
|
||||
uint32_t sizeReserv;
|
||||
|
||||
if (historySize > LzFindkMaxHistorySize)
|
||||
{
|
||||
MatchFinder_Free(p, alloc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sizeReserv = historySize >> 1;
|
||||
if (historySize >= ((uint32_t)3 << 30)) sizeReserv = historySize >> 3;
|
||||
else if (historySize >= ((uint32_t)2 << 30)) sizeReserv = historySize >> 2;
|
||||
|
||||
sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
|
||||
|
||||
p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
|
||||
p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
|
||||
|
||||
/* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
|
||||
|
||||
if (LzInWindow_Create(p, sizeReserv, alloc))
|
||||
{
|
||||
uint32_t newCyclicBufferSize = historySize + 1;
|
||||
uint32_t hs;
|
||||
p->matchMaxLen = matchMaxLen;
|
||||
{
|
||||
p->fixedHashSize = 0;
|
||||
if (p->numHashBytes == 2)
|
||||
hs = (1 << 16) - 1;
|
||||
else
|
||||
{
|
||||
hs = historySize - 1;
|
||||
hs |= (hs >> 1);
|
||||
hs |= (hs >> 2);
|
||||
hs |= (hs >> 4);
|
||||
hs |= (hs >> 8);
|
||||
hs >>= 1;
|
||||
hs |= 0xFFFF; /* don't change it! It's required for Deflate */
|
||||
if (hs > (1 << 24))
|
||||
{
|
||||
if (p->numHashBytes == 3)
|
||||
hs = (1 << 24) - 1;
|
||||
else
|
||||
hs >>= 1;
|
||||
/* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
|
||||
}
|
||||
}
|
||||
p->hashMask = hs;
|
||||
hs++;
|
||||
if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
|
||||
if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
|
||||
if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
|
||||
hs += p->fixedHashSize;
|
||||
}
|
||||
|
||||
{
|
||||
size_t newSize;
|
||||
size_t numSons;
|
||||
p->historySize = historySize;
|
||||
p->hashSizeSum = hs;
|
||||
p->cyclicBufferSize = newCyclicBufferSize;
|
||||
|
||||
numSons = newCyclicBufferSize;
|
||||
if (p->btMode)
|
||||
numSons <<= 1;
|
||||
newSize = hs + numSons;
|
||||
|
||||
if (p->hash && p->numRefs == newSize)
|
||||
return 1;
|
||||
|
||||
MatchFinder_FreeThisClassMemory(p, alloc);
|
||||
p->numRefs = newSize;
|
||||
p->hash = AllocRefs(newSize, alloc);
|
||||
|
||||
if (p->hash)
|
||||
{
|
||||
p->son = p->hash + p->hashSizeSum;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MatchFinder_Free(p, alloc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void MatchFinder_SetLimits(CMatchFinder *p)
|
||||
{
|
||||
uint32_t limit = kMaxValForNormalize - p->pos;
|
||||
uint32_t limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
|
||||
|
||||
if (limit2 < limit)
|
||||
limit = limit2;
|
||||
limit2 = p->streamPos - p->pos;
|
||||
|
||||
if (limit2 <= p->keepSizeAfter)
|
||||
{
|
||||
if (limit2 > 0)
|
||||
limit2 = 1;
|
||||
}
|
||||
else
|
||||
limit2 -= p->keepSizeAfter;
|
||||
|
||||
if (limit2 < limit)
|
||||
limit = limit2;
|
||||
|
||||
{
|
||||
uint32_t lenLimit = p->streamPos - p->pos;
|
||||
if (lenLimit > p->matchMaxLen)
|
||||
lenLimit = p->matchMaxLen;
|
||||
p->lenLimit = lenLimit;
|
||||
}
|
||||
p->posLimit = p->pos + limit;
|
||||
}
|
||||
|
||||
void MatchFinder_Init_2(CMatchFinder *p, int readData)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t *hash = p->hash;
|
||||
uint32_t num = p->hashSizeSum;
|
||||
for (i = 0; i < num; i++)
|
||||
hash[i] = kEmptyHashValue;
|
||||
|
||||
p->cyclicBufferPos = 0;
|
||||
p->buffer = p->bufferBase;
|
||||
p->pos = p->streamPos = p->cyclicBufferSize;
|
||||
p->result = SZ_OK;
|
||||
p->streamEndWasReached = 0;
|
||||
|
||||
if (readData)
|
||||
MatchFinder_ReadBlock(p);
|
||||
|
||||
MatchFinder_SetLimits(p);
|
||||
}
|
||||
|
||||
void MatchFinder_Init(CMatchFinder *p)
|
||||
{
|
||||
MatchFinder_Init_2(p, true);
|
||||
}
|
||||
|
||||
static uint32_t MatchFinder_GetSubValue(CMatchFinder *p)
|
||||
{
|
||||
return (p->pos - p->historySize - 1) & kNormalizeMask;
|
||||
}
|
||||
|
||||
void MatchFinder_Normalize3(uint32_t subValue, CLzRef *items, size_t numItems)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < numItems; i++)
|
||||
{
|
||||
uint32_t value = items[i];
|
||||
if (value <= subValue)
|
||||
value = kEmptyHashValue;
|
||||
else
|
||||
value -= subValue;
|
||||
items[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
static void MatchFinder_Normalize(CMatchFinder *p)
|
||||
{
|
||||
uint32_t subValue = MatchFinder_GetSubValue(p);
|
||||
MatchFinder_Normalize3(subValue, p->hash, p->numRefs);
|
||||
MatchFinder_ReduceOffsets(p, subValue);
|
||||
}
|
||||
|
||||
static void MatchFinder_CheckLimits(CMatchFinder *p)
|
||||
{
|
||||
if (p->pos == kMaxValForNormalize)
|
||||
MatchFinder_Normalize(p);
|
||||
if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
|
||||
MatchFinder_CheckAndMoveAndRead(p);
|
||||
if (p->cyclicBufferPos == p->cyclicBufferSize)
|
||||
p->cyclicBufferPos = 0;
|
||||
MatchFinder_SetLimits(p);
|
||||
}
|
||||
|
||||
static uint32_t * Hc_GetMatchesSpec(uint32_t lenLimit, uint32_t curMatch, uint32_t pos, const unsigned char *cur, CLzRef *son,
|
||||
uint32_t _cyclicBufferPos, uint32_t _cyclicBufferSize, uint32_t cutValue,
|
||||
uint32_t *distances, uint32_t maxLen)
|
||||
{
|
||||
son[_cyclicBufferPos] = curMatch;
|
||||
for (;;)
|
||||
{
|
||||
uint32_t delta = pos - curMatch;
|
||||
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||
return distances;
|
||||
{
|
||||
const unsigned char *pb = cur - delta;
|
||||
curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
|
||||
if (pb[maxLen] == cur[maxLen] && *pb == *cur)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
while (++len != lenLimit)
|
||||
if (pb[len] != cur[len])
|
||||
break;
|
||||
if (maxLen < len)
|
||||
{
|
||||
*distances++ = maxLen = len;
|
||||
*distances++ = delta - 1;
|
||||
if (len == lenLimit)
|
||||
return distances;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t * GetMatchesSpec1(uint32_t lenLimit, uint32_t curMatch, uint32_t pos, const unsigned char *cur, CLzRef *son,
|
||||
uint32_t _cyclicBufferPos, uint32_t _cyclicBufferSize, uint32_t cutValue,
|
||||
uint32_t *distances, uint32_t maxLen)
|
||||
{
|
||||
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
|
||||
uint32_t len0 = 0, len1 = 0;
|
||||
for (;;)
|
||||
{
|
||||
uint32_t delta = pos - curMatch;
|
||||
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
return distances;
|
||||
}
|
||||
{
|
||||
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||
const unsigned char *pb = cur - delta;
|
||||
uint32_t len = (len0 < len1 ? len0 : len1);
|
||||
if (pb[len] == cur[len])
|
||||
{
|
||||
if (++len != lenLimit && pb[len] == cur[len])
|
||||
while (++len != lenLimit)
|
||||
if (pb[len] != cur[len])
|
||||
break;
|
||||
if (maxLen < len)
|
||||
{
|
||||
*distances++ = maxLen = len;
|
||||
*distances++ = delta - 1;
|
||||
if (len == lenLimit)
|
||||
{
|
||||
*ptr1 = pair[0];
|
||||
*ptr0 = pair[1];
|
||||
return distances;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pb[len] < cur[len])
|
||||
{
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
curMatch = *ptr1;
|
||||
len1 = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
curMatch = *ptr0;
|
||||
len0 = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SkipMatchesSpec(uint32_t lenLimit, uint32_t curMatch, uint32_t pos, const unsigned char *cur, CLzRef *son,
|
||||
uint32_t _cyclicBufferPos, uint32_t _cyclicBufferSize, uint32_t cutValue)
|
||||
{
|
||||
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
|
||||
uint32_t len0 = 0, len1 = 0;
|
||||
for (;;)
|
||||
{
|
||||
uint32_t delta = pos - curMatch;
|
||||
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
return;
|
||||
}
|
||||
{
|
||||
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||
const unsigned char *pb = cur - delta;
|
||||
uint32_t len = (len0 < len1 ? len0 : len1);
|
||||
if (pb[len] == cur[len])
|
||||
{
|
||||
while (++len != lenLimit)
|
||||
if (pb[len] != cur[len])
|
||||
break;
|
||||
{
|
||||
if (len == lenLimit)
|
||||
{
|
||||
*ptr1 = pair[0];
|
||||
*ptr0 = pair[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pb[len] < cur[len])
|
||||
{
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
curMatch = *ptr1;
|
||||
len1 = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
curMatch = *ptr0;
|
||||
len0 = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MOVE_POS \
|
||||
++p->cyclicBufferPos; \
|
||||
p->buffer++; \
|
||||
if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
|
||||
|
||||
#define MOVE_POS_RET MOVE_POS return offset;
|
||||
|
||||
static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
|
||||
|
||||
#define GET_MATCHES_HEADER2(minLen, ret_op) \
|
||||
uint32_t lenLimit; uint32_t hv; const unsigned char *cur; uint32_t curMatch; \
|
||||
lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
|
||||
cur = p->buffer;
|
||||
|
||||
#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
|
||||
#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
|
||||
|
||||
#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
|
||||
|
||||
#define GET_MATCHES_FOOTER(offset, maxLen) \
|
||||
offset = (uint32_t)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
|
||||
distances + offset, maxLen) - distances); MOVE_POS_RET;
|
||||
|
||||
#define SKIP_FOOTER \
|
||||
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
|
||||
|
||||
#define UPDATE_maxLen { \
|
||||
ptrdiff_t diff = (ptrdiff_t)0 - d2; \
|
||||
const unsigned char *c = cur + maxLen; \
|
||||
const unsigned char *lim = cur + lenLimit; \
|
||||
for (; c != lim; c++) if (*(c + diff) != *c) break; \
|
||||
maxLen = (uint32_t)(c - cur); }
|
||||
|
||||
static uint32_t Bt2_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t offset;
|
||||
GET_MATCHES_HEADER(2)
|
||||
HASH2_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
offset = 0;
|
||||
GET_MATCHES_FOOTER(offset, 1)
|
||||
}
|
||||
|
||||
uint32_t Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t offset;
|
||||
GET_MATCHES_HEADER(3)
|
||||
HASH_ZIP_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
offset = 0;
|
||||
GET_MATCHES_FOOTER(offset, 2)
|
||||
}
|
||||
|
||||
static uint32_t Bt3_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t h2, d2, maxLen, offset, pos;
|
||||
uint32_t *hash;
|
||||
GET_MATCHES_HEADER(3)
|
||||
|
||||
HASH3_CALC;
|
||||
|
||||
hash = p->hash;
|
||||
pos = p->pos;
|
||||
|
||||
d2 = pos - hash[h2];
|
||||
|
||||
curMatch = hash[kFix3HashSize + hv];
|
||||
|
||||
hash[h2] = pos;
|
||||
hash[kFix3HashSize + hv] = pos;
|
||||
|
||||
maxLen = 2;
|
||||
offset = 0;
|
||||
|
||||
if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
|
||||
{
|
||||
UPDATE_maxLen
|
||||
distances[0] = maxLen;
|
||||
distances[1] = d2 - 1;
|
||||
offset = 2;
|
||||
if (maxLen == lenLimit)
|
||||
{
|
||||
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
|
||||
MOVE_POS_RET;
|
||||
}
|
||||
}
|
||||
|
||||
GET_MATCHES_FOOTER(offset, maxLen)
|
||||
}
|
||||
|
||||
static uint32_t Bt4_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t h2, h3, d2, d3, maxLen, offset, pos;
|
||||
uint32_t *hash;
|
||||
GET_MATCHES_HEADER(4)
|
||||
|
||||
HASH4_CALC;
|
||||
|
||||
hash = p->hash;
|
||||
pos = p->pos;
|
||||
|
||||
d2 = pos - hash[ h2];
|
||||
d3 = pos - hash[kFix3HashSize + h3];
|
||||
|
||||
curMatch = hash[kFix4HashSize + hv];
|
||||
|
||||
hash[ h2] = pos;
|
||||
hash[kFix3HashSize + h3] = pos;
|
||||
hash[kFix4HashSize + hv] = pos;
|
||||
|
||||
maxLen = 0;
|
||||
offset = 0;
|
||||
|
||||
if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
|
||||
{
|
||||
distances[0] = maxLen = 2;
|
||||
distances[1] = d2 - 1;
|
||||
offset = 2;
|
||||
}
|
||||
|
||||
if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
|
||||
{
|
||||
maxLen = 3;
|
||||
distances[offset + 1] = d3 - 1;
|
||||
offset += 2;
|
||||
d2 = d3;
|
||||
}
|
||||
|
||||
if (offset != 0)
|
||||
{
|
||||
UPDATE_maxLen
|
||||
distances[offset - 2] = maxLen;
|
||||
if (maxLen == lenLimit)
|
||||
{
|
||||
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
|
||||
MOVE_POS_RET;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxLen < 3)
|
||||
maxLen = 3;
|
||||
|
||||
GET_MATCHES_FOOTER(offset, maxLen)
|
||||
}
|
||||
|
||||
static uint32_t Hc4_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t h2, h3, d2, d3, maxLen, offset, pos;
|
||||
uint32_t *hash;
|
||||
GET_MATCHES_HEADER(4)
|
||||
|
||||
HASH4_CALC;
|
||||
|
||||
hash = p->hash;
|
||||
pos = p->pos;
|
||||
|
||||
d2 = pos - hash[ h2];
|
||||
d3 = pos - hash[kFix3HashSize + h3];
|
||||
|
||||
curMatch = hash[kFix4HashSize + hv];
|
||||
|
||||
hash[ h2] = pos;
|
||||
hash[kFix3HashSize + h3] = pos;
|
||||
hash[kFix4HashSize + hv] = pos;
|
||||
|
||||
maxLen = 0;
|
||||
offset = 0;
|
||||
|
||||
if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
|
||||
{
|
||||
distances[0] = maxLen = 2;
|
||||
distances[1] = d2 - 1;
|
||||
offset = 2;
|
||||
}
|
||||
|
||||
if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
|
||||
{
|
||||
maxLen = 3;
|
||||
distances[offset + 1] = d3 - 1;
|
||||
offset += 2;
|
||||
d2 = d3;
|
||||
}
|
||||
|
||||
if (offset != 0)
|
||||
{
|
||||
UPDATE_maxLen
|
||||
distances[offset - 2] = maxLen;
|
||||
if (maxLen == lenLimit)
|
||||
{
|
||||
p->son[p->cyclicBufferPos] = curMatch;
|
||||
MOVE_POS_RET;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxLen < 3)
|
||||
maxLen = 3;
|
||||
|
||||
offset = (uint32_t)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
|
||||
distances + offset, maxLen) - (distances));
|
||||
MOVE_POS_RET
|
||||
}
|
||||
|
||||
uint32_t Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances)
|
||||
{
|
||||
uint32_t offset;
|
||||
GET_MATCHES_HEADER(3)
|
||||
HASH_ZIP_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
offset = (uint32_t)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
|
||||
distances, 2) - (distances));
|
||||
MOVE_POS_RET
|
||||
}
|
||||
|
||||
static void Bt2_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
SKIP_HEADER(2)
|
||||
HASH2_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
SKIP_FOOTER
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
SKIP_HEADER(3)
|
||||
HASH_ZIP_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
SKIP_FOOTER
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
static void Bt3_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t h2;
|
||||
uint32_t *hash;
|
||||
SKIP_HEADER(3)
|
||||
HASH3_CALC;
|
||||
hash = p->hash;
|
||||
curMatch = hash[kFix3HashSize + hv];
|
||||
hash[h2] =
|
||||
hash[kFix3HashSize + hv] = p->pos;
|
||||
SKIP_FOOTER
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
static void Bt4_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t h2, h3;
|
||||
uint32_t *hash;
|
||||
SKIP_HEADER(4)
|
||||
HASH4_CALC;
|
||||
hash = p->hash;
|
||||
curMatch = hash[kFix4HashSize + hv];
|
||||
hash[ h2] =
|
||||
hash[kFix3HashSize + h3] =
|
||||
hash[kFix4HashSize + hv] = p->pos;
|
||||
SKIP_FOOTER
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
static void Hc4_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t h2, h3;
|
||||
uint32_t *hash;
|
||||
SKIP_HEADER(4)
|
||||
HASH4_CALC;
|
||||
hash = p->hash;
|
||||
curMatch = hash[kFix4HashSize + hv];
|
||||
hash[ h2] =
|
||||
hash[kFix3HashSize + h3] =
|
||||
hash[kFix4HashSize + hv] = p->pos;
|
||||
p->son[p->cyclicBufferPos] = curMatch;
|
||||
MOVE_POS
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, uint32_t num)
|
||||
{
|
||||
do
|
||||
{
|
||||
SKIP_HEADER(3)
|
||||
HASH_ZIP_CALC;
|
||||
curMatch = p->hash[hv];
|
||||
p->hash[hv] = p->pos;
|
||||
p->son[p->cyclicBufferPos] = curMatch;
|
||||
MOVE_POS
|
||||
}
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
|
||||
{
|
||||
vTable->Init = (Mf_Init_Func)MatchFinder_Init;
|
||||
vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
|
||||
vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
|
||||
if (!p->btMode)
|
||||
{
|
||||
{
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
|
||||
vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
|
||||
}
|
||||
}
|
||||
else if (p->numHashBytes == 2)
|
||||
{
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
|
||||
vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
|
||||
}
|
||||
else if (p->numHashBytes == 3)
|
||||
{
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
|
||||
vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
|
||||
}
|
||||
else /* if (p->numHashBytes == 4) */
|
||||
{
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
|
||||
vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
|
||||
}
|
||||
}
|
||||
Vendored
+117
@@ -0,0 +1,117 @@
|
||||
/* LzFind.h -- Match finder for LZ algorithms
|
||||
2015-10-15 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_FIND_H
|
||||
#define __LZ_FIND_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
typedef uint32_t CLzRef;
|
||||
|
||||
typedef struct _CMatchFinder
|
||||
{
|
||||
unsigned char *buffer;
|
||||
uint32_t pos;
|
||||
uint32_t posLimit;
|
||||
uint32_t streamPos;
|
||||
uint32_t lenLimit;
|
||||
|
||||
uint32_t cyclicBufferPos;
|
||||
uint32_t cyclicBufferSize; /* it must be = (historySize + 1) */
|
||||
|
||||
unsigned char streamEndWasReached;
|
||||
unsigned char btMode;
|
||||
unsigned char bigHash;
|
||||
unsigned char directInput;
|
||||
|
||||
uint32_t matchMaxLen;
|
||||
CLzRef *hash;
|
||||
CLzRef *son;
|
||||
uint32_t hashMask;
|
||||
uint32_t cutValue;
|
||||
|
||||
unsigned char *bufferBase;
|
||||
ISeqInStream *stream;
|
||||
|
||||
uint32_t blockSize;
|
||||
uint32_t keepSizeBefore;
|
||||
uint32_t keepSizeAfter;
|
||||
|
||||
uint32_t numHashBytes;
|
||||
size_t directInputRem;
|
||||
uint32_t historySize;
|
||||
uint32_t fixedHashSize;
|
||||
uint32_t hashSizeSum;
|
||||
SRes result;
|
||||
uint32_t crc[256];
|
||||
size_t numRefs;
|
||||
} CMatchFinder;
|
||||
|
||||
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
|
||||
|
||||
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
|
||||
|
||||
#define Inline_MatchFinder_IsFinishedOK(p) \
|
||||
((p)->streamEndWasReached \
|
||||
&& (p)->streamPos == (p)->pos \
|
||||
&& (!(p)->directInput || (p)->directInputRem == 0))
|
||||
|
||||
int MatchFinder_NeedMove(CMatchFinder *p);
|
||||
unsigned char *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
|
||||
void MatchFinder_MoveBlock(CMatchFinder *p);
|
||||
void MatchFinder_ReadIfRequired(CMatchFinder *p);
|
||||
|
||||
void MatchFinder_Construct(CMatchFinder *p);
|
||||
|
||||
/* Conditions:
|
||||
historySize <= 3 GB
|
||||
keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
|
||||
*/
|
||||
int MatchFinder_Create(CMatchFinder *p, uint32_t historySize,
|
||||
uint32_t keepAddBufferBefore, uint32_t matchMaxLen, uint32_t keepAddBufferAfter,
|
||||
ISzAlloc *alloc);
|
||||
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
|
||||
void MatchFinder_Normalize3(uint32_t subValue, CLzRef *items, size_t numItems);
|
||||
void MatchFinder_ReduceOffsets(CMatchFinder *p, uint32_t subValue);
|
||||
|
||||
uint32_t * GetMatchesSpec1(uint32_t lenLimit, uint32_t curMatch, uint32_t pos, const unsigned char *buffer, CLzRef *son,
|
||||
uint32_t _cyclicBufferPos, uint32_t _cyclicBufferSize, uint32_t _cutValue,
|
||||
uint32_t *distances, uint32_t maxLen);
|
||||
|
||||
/*
|
||||
Conditions:
|
||||
Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
|
||||
Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
|
||||
*/
|
||||
|
||||
typedef void (*Mf_Init_Func)(void *object);
|
||||
typedef uint32_t (*Mf_GetNumAvailableBytes_Func)(void *object);
|
||||
typedef const unsigned char * (*Mf_GetPointerToCurrentPos_Func)(void *object);
|
||||
typedef uint32_t (*Mf_GetMatches_Func)(void *object, uint32_t *distances);
|
||||
typedef void (*Mf_Skip_Func)(void *object, uint32_t);
|
||||
|
||||
typedef struct _IMatchFinder
|
||||
{
|
||||
Mf_Init_Func Init;
|
||||
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
|
||||
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
|
||||
Mf_GetMatches_Func GetMatches;
|
||||
Mf_Skip_Func Skip;
|
||||
} IMatchFinder;
|
||||
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
|
||||
|
||||
void MatchFinder_Init_2(CMatchFinder *p, int readData);
|
||||
void MatchFinder_Init(CMatchFinder *p);
|
||||
|
||||
uint32_t Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances);
|
||||
uint32_t Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, uint32_t *distances);
|
||||
|
||||
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, uint32_t num);
|
||||
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, uint32_t num);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
/* LzHash.h -- HASH functions for LZ algorithms
|
||||
2015-04-12 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_HASH_H
|
||||
#define __LZ_HASH_H
|
||||
|
||||
#define kHash2Size (1 << 10)
|
||||
#define kHash3Size (1 << 16)
|
||||
#define kHash4Size (1 << 20)
|
||||
|
||||
#define kFix3HashSize (kHash2Size)
|
||||
#define kFix4HashSize (kHash2Size + kHash3Size)
|
||||
#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
||||
|
||||
#define HASH2_CALC hv = cur[0] | ((uint32_t)cur[1] << 8);
|
||||
|
||||
#define HASH3_CALC { \
|
||||
uint32_t temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
hv = (temp ^ ((uint32_t)cur[2] << 8)) & p->hashMask; }
|
||||
|
||||
#define HASH4_CALC { \
|
||||
uint32_t temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((uint32_t)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
|
||||
|
||||
#define HASH5_CALC { \
|
||||
uint32_t temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((uint32_t)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
temp ^= (p->crc[cur[3]] << 5); \
|
||||
h4 = temp & (kHash4Size - 1); \
|
||||
hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; }
|
||||
|
||||
#define HASH_ZIP_CALC hv = ((cur[2] | ((uint32_t)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
|
||||
|
||||
|
||||
#define MT_HASH2_CALC \
|
||||
h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
|
||||
|
||||
#define MT_HASH3_CALC { \
|
||||
uint32_t temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
h3 = (temp ^ ((uint32_t)cur[2] << 8)) & (kHash3Size - 1); }
|
||||
|
||||
#define MT_HASH4_CALC { \
|
||||
uint32_t temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((uint32_t)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
|
||||
|
||||
#endif
|
||||
Vendored
+13
-13
@@ -80,9 +80,9 @@ SRes Lzma2Dec_Allocate(CLzma2Dec *p, uint8_t prop, ISzAlloc *alloc)
|
||||
void Lzma2Dec_Init(CLzma2Dec *p)
|
||||
{
|
||||
p->state = LZMA2_STATE_CONTROL;
|
||||
p->needInitDic = True;
|
||||
p->needInitState = True;
|
||||
p->needInitProp = True;
|
||||
p->needInitDic = true;
|
||||
p->needInitState = true;
|
||||
p->needInitProp = true;
|
||||
LzmaDec_Init(&p->decoder);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, uint8_t b)
|
||||
return LZMA2_STATE_ERROR;
|
||||
p->decoder.prop.lc = lc;
|
||||
p->decoder.prop.lp = lp;
|
||||
p->needInitProp = False;
|
||||
p->needInitProp = false;
|
||||
return LZMA2_STATE_DATA;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const uint8_t *src, size
|
||||
p->processedPos += (uint32_t)size;
|
||||
}
|
||||
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState);
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, bool initDic, bool initState);
|
||||
|
||||
SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, size_t dicLimit,
|
||||
const uint8_t *src, size_t *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
@@ -207,13 +207,13 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, size_t dicLimit,
|
||||
|
||||
if (p->state == LZMA2_STATE_DATA)
|
||||
{
|
||||
Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC);
|
||||
bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC);
|
||||
if (initDic)
|
||||
p->needInitProp = p->needInitState = True;
|
||||
p->needInitProp = p->needInitState = true;
|
||||
else if (p->needInitDic)
|
||||
return SZ_ERROR_DATA;
|
||||
p->needInitDic = False;
|
||||
LzmaDec_InitDicAndState(&p->decoder, initDic, False);
|
||||
p->needInitDic = false;
|
||||
LzmaDec_InitDicAndState(&p->decoder, initDic, false);
|
||||
}
|
||||
|
||||
if (srcSizeCur > destSizeCur)
|
||||
@@ -237,14 +237,14 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, size_t dicLimit,
|
||||
if (p->state == LZMA2_STATE_DATA)
|
||||
{
|
||||
int mode = LZMA2_GET_LZMA_MODE(p);
|
||||
Bool initDic = (mode == 3);
|
||||
Bool initState = (mode > 0);
|
||||
bool initDic = (mode == 3);
|
||||
bool initState = (mode > 0);
|
||||
if ((!initDic && p->needInitDic) || (!initState && p->needInitState))
|
||||
return SZ_ERROR_DATA;
|
||||
|
||||
LzmaDec_InitDicAndState(&p->decoder, initDic, initState);
|
||||
p->needInitDic = False;
|
||||
p->needInitState = False;
|
||||
p->needInitDic = false;
|
||||
p->needInitState = false;
|
||||
p->state = LZMA2_STATE_DATA_CONT;
|
||||
}
|
||||
if (srcSizeCur > p->packSize)
|
||||
|
||||
Vendored
+4
-3
@@ -4,6 +4,7 @@
|
||||
#ifndef __LZMA2_DEC_H
|
||||
#define __LZMA2_DEC_H
|
||||
|
||||
#include <boolean.h>
|
||||
#include "LzmaDec.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -19,9 +20,9 @@ typedef struct
|
||||
uint32_t unpackSize;
|
||||
int state;
|
||||
uint8_t control;
|
||||
Bool needInitDic;
|
||||
Bool needInitState;
|
||||
Bool needInitProp;
|
||||
bool needInitDic;
|
||||
bool needInitState;
|
||||
bool needInitProp;
|
||||
} CLzma2Dec;
|
||||
|
||||
#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder)
|
||||
|
||||
Vendored
+4
-4
@@ -2,10 +2,10 @@
|
||||
2009-09-20 : Igor Pavlov : Public domain */
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "LzmaDec.h"
|
||||
|
||||
|
||||
#define kNumTopBits 24
|
||||
#define kTopValue ((uint32_t)1 << kNumTopBits)
|
||||
|
||||
@@ -721,9 +721,9 @@ static void LzmaDec_InitRc(CLzmaDec *p, const uint8_t *data)
|
||||
p->needFlush = 0;
|
||||
}
|
||||
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState);
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, bool initDic, bool initState);
|
||||
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, bool initDic, bool initState)
|
||||
{
|
||||
p->needFlush = 1;
|
||||
p->remainLen = 0;
|
||||
@@ -742,7 +742,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
||||
void LzmaDec_Init(CLzmaDec *p)
|
||||
{
|
||||
p->dicPos = 0;
|
||||
LzmaDec_InitDicAndState(p, True, True);
|
||||
LzmaDec_InitDicAndState(p, true, true);
|
||||
}
|
||||
|
||||
static void LzmaDec_InitStateReal(CLzmaDec *p)
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
#ifndef __LZMA_DEC_H
|
||||
#define __LZMA_DEC_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "7zTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Vendored
+2256
File diff suppressed because it is too large.
Load diff
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
/* LzmaEnc.h -- LZMA Encoder
|
||||
2013-01-18 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZMA_ENC_H
|
||||
#define __LZMA_ENC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define LZMA_PROPS_SIZE 5
|
||||
|
||||
typedef struct _CLzmaEncProps
|
||||
{
|
||||
int level; /* 0 <= level <= 9 */
|
||||
uint32_t dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
|
||||
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version
|
||||
default = (1 << 24) */
|
||||
uint64_t reduceSize; /* estimated size of data that will be compressed. default = 0xFFFFFFFF.
|
||||
Encoder uses this value to reduce dictionary size */
|
||||
int lc; /* 0 <= lc <= 8, default = 3 */
|
||||
int lp; /* 0 <= lp <= 4, default = 0 */
|
||||
int pb; /* 0 <= pb <= 4, default = 2 */
|
||||
int algo; /* 0 - fast, 1 - normal, default = 1 */
|
||||
int fb; /* 5 <= fb <= 273, default = 32 */
|
||||
int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
|
||||
int numHashBytes; /* 2, 3 or 4, default = 4 */
|
||||
uint32_t mc; /* 1 <= mc <= (1 << 30), default = 32 */
|
||||
unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
|
||||
int numThreads; /* 1 or 2, default = 2 */
|
||||
} CLzmaEncProps;
|
||||
|
||||
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||
void LzmaEncProps_Normalize(CLzmaEncProps *p);
|
||||
uint32_t LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
|
||||
|
||||
|
||||
/* ---------- CLzmaEncHandle Interface ---------- */
|
||||
|
||||
/* LzmaEnc_* functions can return the following exit codes:
|
||||
Returns:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_PARAM - Incorrect paramater in props
|
||||
SZ_ERROR_WRITE - Write callback error.
|
||||
SZ_ERROR_PROGRESS - some break from progress callback
|
||||
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
*/
|
||||
|
||||
typedef void * CLzmaEncHandle;
|
||||
|
||||
CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
|
||||
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
|
||||
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, unsigned char *properties, size_t *size);
|
||||
SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
|
||||
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
|
||||
int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
|
||||
/* ---------- One Call Interface ---------- */
|
||||
|
||||
/* LzmaEncode
|
||||
Return code:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_PARAM - Incorrect paramater
|
||||
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
*/
|
||||
|
||||
SRes LzmaEncode(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
|
||||
const CLzmaEncProps *props, unsigned char *propsEncoded, size_t *propsSize, int writeEndMark,
|
||||
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
-201
@@ -1,201 +0,0 @@
|
||||
/* Types.h -- Basic types
|
||||
2010-10-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_TYPES_H
|
||||
#define __7Z_TYPES_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SZ_OK 0
|
||||
|
||||
#define SZ_ERROR_DATA 1
|
||||
#define SZ_ERROR_MEM 2
|
||||
#define SZ_ERROR_CRC 3
|
||||
#define SZ_ERROR_UNSUPPORTED 4
|
||||
#define SZ_ERROR_PARAM 5
|
||||
#define SZ_ERROR_INPUT_EOF 6
|
||||
#define SZ_ERROR_OUTPUT_EOF 7
|
||||
#define SZ_ERROR_READ 8
|
||||
#define SZ_ERROR_WRITE 9
|
||||
#define SZ_ERROR_PROGRESS 10
|
||||
#define SZ_ERROR_FAIL 11
|
||||
#define SZ_ERROR_THREAD 12
|
||||
|
||||
#define SZ_ERROR_ARCHIVE 16
|
||||
#define SZ_ERROR_NO_ARCHIVE 17
|
||||
|
||||
typedef int SRes;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef DWORD WRes;
|
||||
#else
|
||||
typedef int WRes;
|
||||
#endif
|
||||
|
||||
#ifndef RINOK
|
||||
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||
#endif
|
||||
|
||||
#ifdef _SZ_NO_INT_64
|
||||
|
||||
#else
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#define UINT64_CONST(n) n
|
||||
#else
|
||||
#define UINT64_CONST(n) n ## ULL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef int Bool;
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define MY_FAST_CALL __fastcall
|
||||
#else
|
||||
#define MY_FAST_CALL
|
||||
#endif
|
||||
|
||||
|
||||
/* The following interfaces use first parameter as pointer to structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */
|
||||
} IByteIn;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*Write)(void *p, uint8_t b);
|
||||
} IByteOut;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||
(output(*size) < input(*size)) is allowed */
|
||||
} ISeqInStream;
|
||||
|
||||
/* it can return SZ_ERROR_INPUT_EOF */
|
||||
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
|
||||
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
|
||||
SRes SeqInStream_ReadByte(ISeqInStream *stream, uint8_t *buf);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t (*Write)(void *p, const void *buf, size_t size);
|
||||
/* Returns: result - the number of actually written bytes.
|
||||
(result < size) means error */
|
||||
} ISeqOutStream;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SZ_SEEK_SET = 0,
|
||||
SZ_SEEK_CUR = 1,
|
||||
SZ_SEEK_END = 2
|
||||
} ESzSeek;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
|
||||
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
|
||||
} ISeekInStream;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Look)(void *p, const void **buf, size_t *size);
|
||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||
(output(*size) > input(*size)) is not allowed
|
||||
(output(*size) < input(*size)) is allowed */
|
||||
SRes (*Skip)(void *p, size_t offset);
|
||||
/* offset must be <= output(*size) of Look */
|
||||
|
||||
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||
/* reads directly (without buffer). It's same as ISeqInStream::Read */
|
||||
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
|
||||
} ILookInStream;
|
||||
|
||||
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
|
||||
SRes LookInStream_SeekTo(ILookInStream *stream, uint64_t offset);
|
||||
|
||||
/* reads via ILookInStream::Read */
|
||||
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
|
||||
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
|
||||
|
||||
#define LookToRead_BUF_SIZE (1 << 14)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ILookInStream s;
|
||||
ISeekInStream *realStream;
|
||||
size_t pos;
|
||||
size_t size;
|
||||
uint8_t buf[LookToRead_BUF_SIZE];
|
||||
} CLookToRead;
|
||||
|
||||
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
|
||||
void LookToRead_Init(CLookToRead *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISeqInStream s;
|
||||
ILookInStream *realStream;
|
||||
} CSecToLook;
|
||||
|
||||
void SecToLook_CreateVTable(CSecToLook *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISeqInStream s;
|
||||
ILookInStream *realStream;
|
||||
} CSecToRead;
|
||||
|
||||
void SecToRead_CreateVTable(CSecToRead *p);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SRes (*Progress)(void *p, uint64_t inSize, uint64_t outSize);
|
||||
/* Returns: result. (result != SZ_OK) means break.
|
||||
Value (uint64_t)(int64_t)-1 for size means unknown value. */
|
||||
} ICompressProgress;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *(*Alloc)(void *p, size_t size);
|
||||
void (*Free)(void *p, void *address); /* address can be 0 */
|
||||
} ISzAlloc;
|
||||
|
||||
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
|
||||
#define IAlloc_Free(p, a) (p)->Free((p), a)
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define CHAR_PATH_SEPARATOR '\\'
|
||||
#define WCHAR_PATH_SEPARATOR L'\\'
|
||||
#define STRING_PATH_SEPARATOR "\\"
|
||||
#define WSTRING_PATH_SEPARATOR L"\\"
|
||||
|
||||
#else
|
||||
|
||||
#define CHAR_PATH_SEPARATOR '/'
|
||||
#define WCHAR_PATH_SEPARATOR L'/'
|
||||
#define STRING_PATH_SEPARATOR "/"
|
||||
#define WSTRING_PATH_SEPARATOR L"/"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
Micromod (c)2017 [email protected]
|
||||
|
||||
A good-quality player library for the ProTracker MOD music format
|
||||
for Javascript (HTML5 Web Audio), Java, ANSI C (SDL) and Pascal (SDL).
|
||||
|
||||
Also hosted here is IBXM, a player library for the ProTracker MOD,
|
||||
Scream Tracker 3 S3M, and FastTracker 2 XM music formats for Javascript
|
||||
(HTML5 Web Audio), Java and ANSI C.
|
||||
|
||||
The Java version of Micromod contains a powerful command-line tool for
|
||||
the creation of MOD files from textual MT files and WAV samples.
|
||||
There is some basic documentation built-in to the tool and some example
|
||||
MT files are contained in the songs directory. Some knowledge of the
|
||||
ProTracker MOD format, audio synthesis and "tracking" is assumed.
|
||||
|
||||
If you have any questions or feedback please feel free to
|
||||
contact me at the above email address!
|
||||
|
||||
Cheers,
|
||||
Martin
|
||||
Vendored
+1922
File diff suppressed because it is too large.
Load diff
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
|
||||
/* ibxm/ac mod/xm/s3m replay (c)[email protected] */
|
||||
|
||||
#ifndef __IBXM_H__
|
||||
#define __IBXM_H__
|
||||
|
||||
extern const char *IBXM_VERSION;
|
||||
|
||||
struct data {
|
||||
char *buffer;
|
||||
int length;
|
||||
};
|
||||
|
||||
struct sample {
|
||||
char name[ 32 ];
|
||||
int loop_start, loop_length;
|
||||
short volume, panning, rel_note, fine_tune, *data;
|
||||
};
|
||||
|
||||
struct envelope {
|
||||
char enabled, sustain, looped, num_points;
|
||||
short sustain_tick, loop_start_tick, loop_end_tick;
|
||||
short points_tick[ 16 ], points_ampl[ 16 ];
|
||||
};
|
||||
|
||||
struct instrument {
|
||||
int num_samples, vol_fadeout;
|
||||
char name[ 32 ], key_to_sample[ 97 ];
|
||||
char vib_type, vib_sweep, vib_depth, vib_rate;
|
||||
struct envelope vol_env, pan_env;
|
||||
struct sample *samples;
|
||||
};
|
||||
|
||||
struct pattern {
|
||||
int num_channels, num_rows;
|
||||
char *data;
|
||||
};
|
||||
|
||||
struct module {
|
||||
char name[ 32 ];
|
||||
int num_channels, num_instruments;
|
||||
int num_patterns, sequence_len, restart_pos;
|
||||
int default_gvol, default_speed, default_tempo, c2_rate, gain;
|
||||
int linear_periods, fast_vol_slides;
|
||||
unsigned char *default_panning, *sequence;
|
||||
struct pattern *patterns;
|
||||
struct instrument *instruments;
|
||||
};
|
||||
|
||||
/* Allocate and initialize a module from the specified data, returns NULL on error.
|
||||
Message should point to a 64-character buffer to receive error messages. */
|
||||
struct module* module_load( struct data *data, char *message );
|
||||
/* Deallocate the specified module. */
|
||||
void dispose_module( struct module *module );
|
||||
/* Allocate and initialize a replay with the specified module and sampling rate. */
|
||||
struct replay* new_replay( struct module *module, int sample_rate, int interpolation );
|
||||
/* Deallocate the specified replay. */
|
||||
void dispose_replay( struct replay *replay );
|
||||
/* Returns the song duration in samples at the current sampling rate. */
|
||||
int replay_calculate_duration( struct replay *replay );
|
||||
/* Seek to approximately the specified sample position.
|
||||
The actual sample position reached is returned. */
|
||||
int replay_seek( struct replay *replay, int sample_pos );
|
||||
/* Set the pattern in the sequence to play. The tempo is reset to the default. */
|
||||
void replay_set_sequence_pos( struct replay *replay, int pos );
|
||||
/* Generates audio and returns the number of stereo samples written into mix_buf. */
|
||||
int replay_get_audio( struct replay *replay, int *mix_buf );
|
||||
/* Returns the length of the output buffer required by replay_get_audio(). */
|
||||
int calculate_mix_buf_len( int sample_rate );
|
||||
|
||||
#endif
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
---
|
||||
Copyright (c) 2015, Martin Cameron
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the
|
||||
above copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the organization nor the names of
|
||||
its contributors may be used to endorse or promote
|
||||
products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
---
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
/* FLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* This file is part the FLAC project. FLAC is comprised of several
|
||||
* components distributed under different licenses. The codec libraries
|
||||
* are distributed under Xiph.Org's BSD-like license (see the file
|
||||
* COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||
* plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||
* is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||
* FLAC distribution contains at the top the terms under which it may be
|
||||
* distributed.
|
||||
*
|
||||
* Since this particular file is relevant to all components of FLAC,
|
||||
* it may be distributed under the Xiph.Org license, which is the least
|
||||
* restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
Current FLAC maintainer: Erik de Castro Lopo <[email protected]>
|
||||
|
||||
Original author: Josh Coalson <[email protected]>
|
||||
|
||||
Website : https://www.xiph.org/flac/
|
||||
|
||||
FLAC is an Open Source lossless audio codec originally developed by Josh Coalson
|
||||
between 2001 and 2009. From 2009 to 2012 FLAC was basically unmaintained. In
|
||||
2012 the Erik de Castro Lopo became the chief maintainer as part of the
|
||||
Xiph.Org Foundation.
|
||||
|
||||
Other major contributors and their contributions:
|
||||
|
||||
"lvqcl" <[email protected]>
|
||||
* Visual Studio build system.
|
||||
* Optimisations in the encoder and decoder.
|
||||
|
||||
"Janne Hyvärinen" <[email protected]>
|
||||
* Visual Studio build system.
|
||||
* Unicode handling on Windows.
|
||||
|
||||
"Andrey Astafiev" <[email protected]>
|
||||
* Russian translation of the HTML documentation
|
||||
|
||||
"Miroslav Lichvar" <[email protected]>
|
||||
* IA-32 assembly versions of several libFLAC routines
|
||||
|
||||
"Brady Patterson" <[email protected]>
|
||||
* AIFF file support, PPC assembly versions of libFLAC routines
|
||||
|
||||
"Daisuke Shimamura" <[email protected]>
|
||||
* i18n support in the XMMS plugin
|
||||
|
||||
"X-Fixer" <[email protected]>
|
||||
* Configuration system, tag editing, and file info in the Winamp2 plugin
|
||||
|
||||
"Matt Zimmerman" <[email protected]>
|
||||
* Libtool/autoconf/automake make system, flac man page
|
||||
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
Copyright (C) 2000-2009 Josh Coalson
|
||||
Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Vendored
+254
@@ -0,0 +1,254 @@
|
||||
/* FLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* This file is part the FLAC project. FLAC is comprised of several
|
||||
* components distributed under different licenses. The codec libraries
|
||||
* are distributed under Xiph.Org's BSD-like license (see the file
|
||||
* COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||
* plugins are distributed under the LGPL or GPL (see COPYING.LGPL and
|
||||
* COPYING.GPL). The documentation is distributed under the Gnu FDL (see
|
||||
* COPYING.FDL). Each file in the FLAC distribution contains at the top the
|
||||
* terms under which it may be distributed.
|
||||
*
|
||||
* Since this particular file is relevant to all components of FLAC,
|
||||
* it may be distributed under the Xiph.Org license, which is the least
|
||||
* restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
|
||||
FLAC is an Open Source lossless audio codec developed by Josh Coalson from 2001
|
||||
to 2009.
|
||||
|
||||
From January 2012 FLAC is being maintained by Erik de Castro Lopo under the
|
||||
auspices of the Xiph.org Foundation.
|
||||
|
||||
FLAC is comprised of
|
||||
* `libFLAC', a library which implements reference encoders and
|
||||
decoders for native FLAC and Ogg FLAC, and a metadata interface
|
||||
* `libFLAC++', a C++ object wrapper library around libFLAC
|
||||
* `flac', a command-line program for encoding and decoding files
|
||||
* `metaflac', a command-line program for viewing and editing FLAC
|
||||
metadata
|
||||
* player plugin for XMMS
|
||||
* user and API documentation
|
||||
|
||||
The libraries (libFLAC, libFLAC++) are
|
||||
licensed under Xiph.org's BSD-like license (see COPYING.Xiph). All other
|
||||
programs and plugins are licensed under the GNU General Public License
|
||||
(see COPYING.GPL). The documentation is licensed under the GNU Free
|
||||
Documentation License (see COPYING.FDL).
|
||||
|
||||
|
||||
===============================================================================
|
||||
FLAC - 1.3.2 - Contents
|
||||
===============================================================================
|
||||
|
||||
- Introduction
|
||||
- Prerequisites
|
||||
- Note to embedded developers
|
||||
- Building in a GNU environment
|
||||
- Building with Makefile.lite
|
||||
- Building with MSVC
|
||||
- Building on Mac OS X
|
||||
|
||||
|
||||
===============================================================================
|
||||
Introduction
|
||||
===============================================================================
|
||||
|
||||
This is the source release for the FLAC project. See
|
||||
|
||||
doc/html/index.html
|
||||
|
||||
for full documentation.
|
||||
|
||||
A brief description of the directory tree:
|
||||
|
||||
doc/ the HTML documentation
|
||||
examples/ example programs demonstrating the use of libFLAC and libFLAC++
|
||||
include/ public include files for libFLAC and libFLAC++
|
||||
man/ the man pages for `flac' and `metaflac'
|
||||
src/ the source code and private headers
|
||||
test/ the test scripts
|
||||
|
||||
If you have questions about building FLAC that this document does not answer,
|
||||
please submit them at the following tracker so this document can be improved:
|
||||
|
||||
https://sourceforge.net/p/flac/support-requests/
|
||||
|
||||
|
||||
===============================================================================
|
||||
Prerequisites
|
||||
===============================================================================
|
||||
|
||||
To build FLAC with support for Ogg FLAC you must have built and installed
|
||||
libogg according to the specific instructions below. You must have
|
||||
libogg 1.1.2 or greater, or there will be seeking problems with Ogg FLAC.
|
||||
|
||||
If you are building on x86 and want the assembly optimizations, you will
|
||||
need to have NASM >= 0.98.30 installed according to the specific instructions
|
||||
below.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Note to embedded developers
|
||||
===============================================================================
|
||||
|
||||
libFLAC has grown larger over time as more functionality has been
|
||||
included, but much of it may be unnecessary for a particular embedded
|
||||
implementation. Unused parts may be pruned by some simple editing of
|
||||
configure.ac and src/libFLAC/Makefile.am; the following dependency
|
||||
graph shows which modules may be pruned without breaking things
|
||||
further down:
|
||||
|
||||
metadata.h
|
||||
stream_decoder.h
|
||||
format.h
|
||||
|
||||
stream_encoder.h
|
||||
stream_decoder.h
|
||||
format.h
|
||||
|
||||
stream_decoder.h
|
||||
format.h
|
||||
|
||||
In other words, for pure decoding applications, both the stream encoder
|
||||
and metadata editing interfaces can be safely removed.
|
||||
|
||||
There is a section dedicated to embedded use in the libFLAC API
|
||||
HTML documentation (see doc/html/api/index.html).
|
||||
|
||||
Also, there are several places in the libFLAC code with comments marked
|
||||
with "OPT:" where a #define can be changed to enable code that might be
|
||||
faster on a specific platform. Experimenting with these can yield faster
|
||||
binaries.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Building in a GNU environment
|
||||
===============================================================================
|
||||
|
||||
FLAC uses autoconf and libtool for configuring and building.
|
||||
Better documentation for these will be forthcoming, but in
|
||||
general, this should work:
|
||||
|
||||
./configure && make && make check && make install
|
||||
|
||||
The 'make check' step is optional; omit it to skip all the tests,
|
||||
which can take several hours and use around 70-80 megs of disk space.
|
||||
Even though it will stop with an explicit message on any failure, it
|
||||
does print out a lot of stuff so you might want to capture the output
|
||||
to a file if you're having a problem. Also, don't run 'make check'
|
||||
as root because it confuses some of the tests.
|
||||
|
||||
NOTE: Despite our best efforts it's entirely possible to have
|
||||
problems when using older versions of autoconf, automake, or
|
||||
libtool. If you have the latest versions and still can't get it
|
||||
to work, see the next section on Makefile.lite.
|
||||
|
||||
There are a few FLAC-specific arguments you can give to
|
||||
`configure':
|
||||
|
||||
--enable-debug : Builds everything with debug symbols and some
|
||||
extra (and more verbose) error checking.
|
||||
|
||||
--disable-asm-optimizations : Disables the compilation of the
|
||||
assembly routines. Many routines have assembly versions for
|
||||
speed and `configure' is pretty good about knowing what is
|
||||
supported, but you can use this option to build only from the
|
||||
C sources. May be necessary for building on OS X (Intel).
|
||||
|
||||
--enable-sse : If you are building for an x86 CPU that supports
|
||||
SSE instructions, you can enable some of the faster routines
|
||||
if your operating system also supports SSE instructions. flac
|
||||
can tell if the CPU supports the instructions but currently has
|
||||
no way to test if the OS does, so if it does, you must pass
|
||||
this argument to configure to use the SSE routines. If flac
|
||||
crashes when built with this option you will have to go back and
|
||||
configure without --enable-sse. Note that
|
||||
--disable-asm-optimizations implies --disable-sse.
|
||||
|
||||
--enable-local-xmms-plugin : Installs the FLAC XMMS plugin in
|
||||
$HOME/.xmms/Plugins, instead of the global XMMS plugin area
|
||||
(usually /usr/lib/xmms/Input).
|
||||
|
||||
--with-ogg=
|
||||
--with-xmms-prefix=
|
||||
--with-libiconv-prefix=
|
||||
Use these if you have these packages but configure can't find them.
|
||||
|
||||
If you want to build completely from scratch (i.e. starting with just
|
||||
configure.ac and Makefile.am) you should be able to just run 'autogen.sh'
|
||||
but make sure and read the comments in that file first.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Building with Makefile.lite
|
||||
===============================================================================
|
||||
|
||||
There is a more lightweight build system for do-it-yourself-ers.
|
||||
It is also useful if configure isn't working, which may be the
|
||||
case since lately we've had some problems with different versions
|
||||
of automake and libtool. The Makefile.lite system should work
|
||||
on GNU systems with few or no adjustments.
|
||||
|
||||
From the top level just 'make -f Makefile.lite'. You can
|
||||
specify zero or one optional target from 'release', 'debug',
|
||||
'test', or 'clean'. The default is 'release'. There is no
|
||||
'install' target but everything you need will end up in the
|
||||
obj/ directory.
|
||||
|
||||
If you are not on an x86 system or you don't have nasm, you
|
||||
may have to change the DEFINES in src/libFLAC/Makefile.lite. If
|
||||
you don't have nasm, remove -DFLAC__HAS_NASM. If your target is
|
||||
not an x86, change -DFLAC__CPU_IA32 to -DFLAC__CPU_UNKNOWN.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Building with MSVC
|
||||
===============================================================================
|
||||
|
||||
There are .vcproj projects and a master FLAC.sln solution to build all
|
||||
the libraries and executables with MSVC 2005 or newer.
|
||||
|
||||
Prerequisite: you must have the Ogg libraries installed as described
|
||||
later.
|
||||
|
||||
Prerequisite: you must have nasm installed, and nasm.exe must be in
|
||||
your PATH, or the path to nasm.exe must be added to the list of
|
||||
directories for executable files in the MSVC global options.
|
||||
|
||||
To build everything, run Visual Studio, do File|Open and open FLAC.sln.
|
||||
From the dropdown in the toolbar, select "Release" instead of "Debug",
|
||||
then do Build|Build Solution.
|
||||
|
||||
This will build all libraries both statically (e.g.
|
||||
objs\release\lib\libFLAC_static.lib) and as DLLs (e.g.
|
||||
objs\release\lib\libFLAC.dll), and it will build all binaries, statically
|
||||
linked (e.g. objs\release\bin\flac.exe).
|
||||
|
||||
Everything will end up in the "objs" directory. DLLs and .exe files
|
||||
are all that are needed and can be copied to an installation area and
|
||||
added to the PATH.
|
||||
|
||||
By default the code is configured with Ogg support. Before building FLAC
|
||||
you will need to get the Ogg source distribution
|
||||
(see http://xiph.org/downloads/), build libogg_static.lib (load
|
||||
win32\libogg_static.sln, change solution configuration to "Release" and
|
||||
code generation to "Multi-threaded (/MT)", then build), copy libogg_static.lib
|
||||
into FLAC's 'objs\release\lib' directory, and copy the entire include\ogg tree
|
||||
into FLAC's 'include' directory (so that there is an 'ogg' directory in FLAC's
|
||||
'include' directory with the files ogg.h, os_types.h and config_types.h).
|
||||
|
||||
If you want to build without Ogg support, instead edit all .vcproj files
|
||||
and remove any "FLAC__HAS_OGG" definitions.
|
||||
|
||||
|
||||
===============================================================================
|
||||
Building on Mac OS X
|
||||
===============================================================================
|
||||
|
||||
If you have Fink or a recent version of OS X with the proper autotools,
|
||||
the GNU flow above should work.
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/bitmath.h"
|
||||
|
||||
/* An example of what FLAC__bitmath_silog2() computes:
|
||||
*
|
||||
* silog2(-10) = 5
|
||||
* silog2(- 9) = 5
|
||||
* silog2(- 8) = 4
|
||||
* silog2(- 7) = 4
|
||||
* silog2(- 6) = 4
|
||||
* silog2(- 5) = 4
|
||||
* silog2(- 4) = 3
|
||||
* silog2(- 3) = 3
|
||||
* silog2(- 2) = 2
|
||||
* silog2(- 1) = 2
|
||||
* silog2( 0) = 0
|
||||
* silog2( 1) = 2
|
||||
* silog2( 2) = 3
|
||||
* silog2( 3) = 3
|
||||
* silog2( 4) = 4
|
||||
* silog2( 5) = 4
|
||||
* silog2( 6) = 4
|
||||
* silog2( 7) = 4
|
||||
* silog2( 8) = 5
|
||||
* silog2( 9) = 5
|
||||
* silog2( 10) = 5
|
||||
*/
|
||||
unsigned FLAC__bitmath_silog2(FLAC__int64 v)
|
||||
{
|
||||
if(v == 0)
|
||||
return 0;
|
||||
|
||||
if(v == -1)
|
||||
return 2;
|
||||
|
||||
v = (v < 0) ? (-(v+1)) : v;
|
||||
return FLAC__bitmath_ilog2_wide(v)+2;
|
||||
}
|
||||
Vendored
+1087
File diff suppressed because it is too large.
Load diff
Vendored
+291
@@ -0,0 +1,291 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/cpu.h"
|
||||
#include "share/compat.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# include <intrin.h> /* for __cpuid() and _xgetbv() */
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__ && defined HAVE_CPUID_H
|
||||
# include <cpuid.h> /* for __get_cpuid() and __get_cpuid_max() */
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined FLAC__CPU_IA32
|
||||
/* these are flags in EDX of CPUID AX=00000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000;
|
||||
#endif
|
||||
|
||||
#if FLAC__HAS_X86INTRIN || FLAC__AVX_SUPPORTED
|
||||
/* these are flags in ECX of CPUID AX=00000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000;
|
||||
|
||||
/* these are flags in ECX of CPUID AX=00000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_OSXSAVE = 0x08000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX = 0x10000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_FMA = 0x00001000;
|
||||
/* these are flags in EBX of CPUID AX=00000007 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX2 = 0x00000020;
|
||||
#endif
|
||||
|
||||
#if defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64
|
||||
static uint32_t
|
||||
cpu_xgetbv_x86(void)
|
||||
{
|
||||
#if (defined _MSC_VER || defined __INTEL_COMPILER) && FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED
|
||||
return (uint32_t)_xgetbv(0);
|
||||
#elif defined __GNUC__
|
||||
uint32_t lo, hi;
|
||||
asm volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(lo), "=d"(hi) : "c" (0));
|
||||
return lo;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
ia32_cpu_info (FLAC__CPUInfo *info)
|
||||
{
|
||||
#if !defined FLAC__CPU_IA32
|
||||
(void) info;
|
||||
#else
|
||||
FLAC__bool ia32_osxsave = false;
|
||||
FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx;
|
||||
|
||||
#if !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN)
|
||||
info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */
|
||||
#if defined FLAC__HAS_NASM
|
||||
if(!FLAC__cpu_have_cpuid_asm_ia32())
|
||||
return;
|
||||
#endif
|
||||
/* http://www.sandpile.org/x86/cpuid.htm */
|
||||
if (FLAC__HAS_X86INTRIN) {
|
||||
FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
info->ia32.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E) ? true : false; /* GenuineIntel */
|
||||
FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
}
|
||||
else {
|
||||
FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx);
|
||||
}
|
||||
|
||||
info->ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV ) ? true : false;
|
||||
info->ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX ) ? true : false;
|
||||
info->ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE ) ? true : false;
|
||||
info->ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 ) ? true : false;
|
||||
info->ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 ) ? true : false;
|
||||
info->ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3) ? true : false;
|
||||
info->ia32.sse41 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE41) ? true : false;
|
||||
info->ia32.sse42 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE42) ? true : false;
|
||||
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) {
|
||||
ia32_osxsave = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_OSXSAVE) ? true : false;
|
||||
info->ia32.avx = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_AVX ) ? true : false;
|
||||
info->ia32.fma = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_FMA ) ? true : false;
|
||||
FLAC__cpu_info_x86(7, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
info->ia32.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "CPU info (IA-32):\n");
|
||||
fprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n');
|
||||
fprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n');
|
||||
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) {
|
||||
fprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
fprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n');
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* now have to check for OS support of AVX instructions
|
||||
*/
|
||||
if (!FLAC__HAS_X86INTRIN || !info->ia32.avx || !ia32_osxsave || (cpu_xgetbv_x86() & 0x6) != 0x6) {
|
||||
/* no OS AVX support */
|
||||
info->ia32.avx = false;
|
||||
info->ia32.avx2 = false;
|
||||
info->ia32.fma = false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED)
|
||||
fprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
#endif
|
||||
#else
|
||||
info->use_asm = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
x86_64_cpu_info (FLAC__CPUInfo *info)
|
||||
{
|
||||
#if !defined FLAC__NO_ASM && FLAC__HAS_X86INTRIN
|
||||
FLAC__bool x86_osxsave = false;
|
||||
FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx;
|
||||
|
||||
info->use_asm = true;
|
||||
|
||||
/* http://www.sandpile.org/x86/cpuid.htm */
|
||||
FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
info->x86.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E) ? true : false; /* GenuineIntel */
|
||||
FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
info->x86.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 ) ? true : false;
|
||||
info->x86.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3) ? true : false;
|
||||
info->x86.sse41 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE41) ? true : false;
|
||||
info->x86.sse42 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE42) ? true : false;
|
||||
|
||||
if (FLAC__AVX_SUPPORTED) {
|
||||
x86_osxsave = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_OSXSAVE) ? true : false;
|
||||
info->x86.avx = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_AVX ) ? true : false;
|
||||
info->x86.fma = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_FMA ) ? true : false;
|
||||
FLAC__cpu_info_x86(7, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
|
||||
info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false;
|
||||
}
|
||||
|
||||
fprintf(stderr, "CPU info (x86-64):\n");
|
||||
fprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n');
|
||||
|
||||
if (FLAC__AVX_SUPPORTED) {
|
||||
fprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
fprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n');
|
||||
}
|
||||
|
||||
/*
|
||||
* now have to check for OS support of AVX instructions
|
||||
*/
|
||||
if (!info->x86.avx || !x86_osxsave || (cpu_xgetbv_x86() & 0x6) != 0x6) {
|
||||
/* no OS AVX support */
|
||||
info->x86.avx = false;
|
||||
info->x86.avx2 = false;
|
||||
info->x86.fma = false;
|
||||
}
|
||||
|
||||
if (FLAC__AVX_SUPPORTED) {
|
||||
fprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
}
|
||||
#else
|
||||
/* Silence compiler warnings. */
|
||||
(void) info;
|
||||
#if defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64
|
||||
if (0) cpu_xgetbv_x86 ();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void FLAC__cpu_info (FLAC__CPUInfo *info)
|
||||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
#ifdef FLAC__CPU_IA32
|
||||
info->type = FLAC__CPUINFO_TYPE_IA32;
|
||||
#elif defined FLAC__CPU_X86_64
|
||||
info->type = FLAC__CPUINFO_TYPE_X86_64;
|
||||
#else
|
||||
info->type = FLAC__CPUINFO_TYPE_UNKNOWN;
|
||||
info->use_asm = false;
|
||||
#endif
|
||||
|
||||
switch (info->type) {
|
||||
case FLAC__CPUINFO_TYPE_IA32:
|
||||
ia32_cpu_info (info);
|
||||
break;
|
||||
case FLAC__CPUINFO_TYPE_X86_64:
|
||||
x86_64_cpu_info (info);
|
||||
break;
|
||||
default:
|
||||
info->use_asm = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
|
||||
|
||||
void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx)
|
||||
{
|
||||
#if defined _MSC_VER || defined __INTEL_COMPILER
|
||||
int cpuinfo[4];
|
||||
int ext = level & 0x80000000;
|
||||
__cpuid(cpuinfo, ext);
|
||||
if((unsigned)cpuinfo[0] >= level) {
|
||||
#if FLAC__AVX_SUPPORTED
|
||||
__cpuidex(cpuinfo, ext, 0); /* for AVX2 detection */
|
||||
#else
|
||||
__cpuid(cpuinfo, ext); /* some old compilers don't support __cpuidex */
|
||||
#endif
|
||||
|
||||
*eax = cpuinfo[0]; *ebx = cpuinfo[1]; *ecx = cpuinfo[2]; *edx = cpuinfo[3];
|
||||
|
||||
return;
|
||||
}
|
||||
#elif defined __GNUC__ && defined HAVE_CPUID_H
|
||||
FLAC__uint32 ext = level & 0x80000000;
|
||||
__cpuid(ext, *eax, *ebx, *ecx, *edx);
|
||||
if (*eax >= level) {
|
||||
__cpuid_count(level, 0, *eax, *ebx, *ecx, *edx);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
}
|
||||
|
||||
#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */
|
||||
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/crc.h"
|
||||
|
||||
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
|
||||
|
||||
FLAC__byte const FLAC__crc8_table[256] = {
|
||||
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
|
||||
0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
|
||||
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
|
||||
0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
|
||||
0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5,
|
||||
0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
|
||||
0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85,
|
||||
0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
|
||||
0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
|
||||
0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
|
||||
0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2,
|
||||
0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
|
||||
0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32,
|
||||
0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
|
||||
0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
|
||||
0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
|
||||
0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C,
|
||||
0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
|
||||
0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC,
|
||||
0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
|
||||
0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
|
||||
0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
|
||||
0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C,
|
||||
0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
|
||||
0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B,
|
||||
0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
|
||||
0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
|
||||
0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
|
||||
0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB,
|
||||
0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
|
||||
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB,
|
||||
0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
|
||||
};
|
||||
|
||||
/* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */
|
||||
|
||||
unsigned const FLAC__crc16_table[256] = {
|
||||
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
|
||||
0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
|
||||
0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
|
||||
0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
|
||||
0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
|
||||
0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
|
||||
0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
|
||||
0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
|
||||
0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
|
||||
0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
|
||||
0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
|
||||
0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
|
||||
0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
|
||||
0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
|
||||
0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
|
||||
0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
|
||||
0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
|
||||
0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
|
||||
0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
|
||||
0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
|
||||
0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
|
||||
0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
|
||||
0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
|
||||
0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
|
||||
0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
|
||||
0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
|
||||
0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
|
||||
0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
|
||||
0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
|
||||
0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
|
||||
0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
|
||||
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
|
||||
};
|
||||
|
||||
|
||||
void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc)
|
||||
{
|
||||
*crc = FLAC__crc8_table[*crc ^ data];
|
||||
}
|
||||
|
||||
void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc)
|
||||
{
|
||||
while(len--)
|
||||
*crc = FLAC__crc8_table[*crc ^ *data++];
|
||||
}
|
||||
|
||||
FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len)
|
||||
{
|
||||
FLAC__uint8 crc = 0;
|
||||
|
||||
while(len--)
|
||||
crc = FLAC__crc8_table[crc ^ *data++];
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned FLAC__crc16(const FLAC__byte *data, unsigned len)
|
||||
{
|
||||
unsigned crc = 0;
|
||||
|
||||
while(len--)
|
||||
crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff;
|
||||
|
||||
return crc;
|
||||
}
|
||||
Vendored
+395
@@ -0,0 +1,395 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "share/compat.h"
|
||||
#include "private/bitmath.h"
|
||||
#include "private/fixed.h"
|
||||
#include "private/macros.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifdef local_abs
|
||||
#undef local_abs
|
||||
#endif
|
||||
#define local_abs(x) ((unsigned)((x)<0? -(x) : (x)))
|
||||
|
||||
#ifdef FLAC__INTEGER_ONLY_LIBRARY
|
||||
/* rbps stands for residual bits per sample
|
||||
*
|
||||
* (ln(2) * err)
|
||||
* rbps = log (-----------)
|
||||
* 2 ( n )
|
||||
*/
|
||||
static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n)
|
||||
{
|
||||
FLAC__uint32 rbps;
|
||||
unsigned bits; /* the number of bits required to represent a number */
|
||||
int fracbits; /* the number of bits of rbps that comprise the fractional part */
|
||||
|
||||
FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
|
||||
FLAC__ASSERT(err > 0);
|
||||
FLAC__ASSERT(n > 0);
|
||||
|
||||
FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
|
||||
if(err <= n)
|
||||
return 0;
|
||||
/*
|
||||
* The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
|
||||
* These allow us later to know we won't lose too much precision in the
|
||||
* fixed-point division (err<<fracbits)/n.
|
||||
*/
|
||||
|
||||
fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2(err)+1);
|
||||
|
||||
err <<= fracbits;
|
||||
err /= n;
|
||||
/* err now holds err/n with fracbits fractional bits */
|
||||
|
||||
/*
|
||||
* Whittle err down to 16 bits max. 16 significant bits is enough for
|
||||
* our purposes.
|
||||
*/
|
||||
FLAC__ASSERT(err > 0);
|
||||
bits = FLAC__bitmath_ilog2(err)+1;
|
||||
if(bits > 16) {
|
||||
err >>= (bits-16);
|
||||
fracbits -= (bits-16);
|
||||
}
|
||||
rbps = (FLAC__uint32)err;
|
||||
|
||||
/* Multiply by fixed-point version of ln(2), with 16 fractional bits */
|
||||
rbps *= FLAC__FP_LN2;
|
||||
fracbits += 16;
|
||||
FLAC__ASSERT(fracbits >= 0);
|
||||
|
||||
/* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
|
||||
{
|
||||
const int f = fracbits & 3;
|
||||
if(f) {
|
||||
rbps >>= f;
|
||||
fracbits -= f;
|
||||
}
|
||||
}
|
||||
|
||||
rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
|
||||
|
||||
if(rbps == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The return value must have 16 fractional bits. Since the whole part
|
||||
* of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
|
||||
* must be >= -3, these assertion allows us to be able to shift rbps
|
||||
* left if necessary to get 16 fracbits without losing any bits of the
|
||||
* whole part of rbps.
|
||||
*
|
||||
* There is a slight chance due to accumulated error that the whole part
|
||||
* will require 6 bits, so we use 6 in the assertion. Really though as
|
||||
* long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
|
||||
*/
|
||||
FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
|
||||
FLAC__ASSERT(fracbits >= -3);
|
||||
|
||||
/* now shift the decimal point into place */
|
||||
if(fracbits < 16)
|
||||
return rbps << (16-fracbits);
|
||||
else if(fracbits > 16)
|
||||
return rbps >> (fracbits-16);
|
||||
else
|
||||
return rbps;
|
||||
}
|
||||
|
||||
static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n)
|
||||
{
|
||||
FLAC__uint32 rbps;
|
||||
unsigned bits; /* the number of bits required to represent a number */
|
||||
int fracbits; /* the number of bits of rbps that comprise the fractional part */
|
||||
|
||||
FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
|
||||
FLAC__ASSERT(err > 0);
|
||||
FLAC__ASSERT(n > 0);
|
||||
|
||||
FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
|
||||
if(err <= n)
|
||||
return 0;
|
||||
/*
|
||||
* The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
|
||||
* These allow us later to know we won't lose too much precision in the
|
||||
* fixed-point division (err<<fracbits)/n.
|
||||
*/
|
||||
|
||||
fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2_wide(err)+1);
|
||||
|
||||
err <<= fracbits;
|
||||
err /= n;
|
||||
/* err now holds err/n with fracbits fractional bits */
|
||||
|
||||
/*
|
||||
* Whittle err down to 16 bits max. 16 significant bits is enough for
|
||||
* our purposes.
|
||||
*/
|
||||
FLAC__ASSERT(err > 0);
|
||||
bits = FLAC__bitmath_ilog2_wide(err)+1;
|
||||
if(bits > 16) {
|
||||
err >>= (bits-16);
|
||||
fracbits -= (bits-16);
|
||||
}
|
||||
rbps = (FLAC__uint32)err;
|
||||
|
||||
/* Multiply by fixed-point version of ln(2), with 16 fractional bits */
|
||||
rbps *= FLAC__FP_LN2;
|
||||
fracbits += 16;
|
||||
FLAC__ASSERT(fracbits >= 0);
|
||||
|
||||
/* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
|
||||
{
|
||||
const int f = fracbits & 3;
|
||||
if(f) {
|
||||
rbps >>= f;
|
||||
fracbits -= f;
|
||||
}
|
||||
}
|
||||
|
||||
rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
|
||||
|
||||
if(rbps == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The return value must have 16 fractional bits. Since the whole part
|
||||
* of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
|
||||
* must be >= -3, these assertion allows us to be able to shift rbps
|
||||
* left if necessary to get 16 fracbits without losing any bits of the
|
||||
* whole part of rbps.
|
||||
*
|
||||
* There is a slight chance due to accumulated error that the whole part
|
||||
* will require 6 bits, so we use 6 in the assertion. Really though as
|
||||
* long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
|
||||
*/
|
||||
FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
|
||||
FLAC__ASSERT(fracbits >= -3);
|
||||
|
||||
/* now shift the decimal point into place */
|
||||
if(fracbits < 16)
|
||||
return rbps << (16-fracbits);
|
||||
else if(fracbits > 16)
|
||||
return rbps >> (fracbits-16);
|
||||
else
|
||||
return rbps;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#endif
|
||||
{
|
||||
FLAC__int32 last_error_0 = data[-1];
|
||||
FLAC__int32 last_error_1 = data[-1] - data[-2];
|
||||
FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
|
||||
FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
|
||||
FLAC__int32 error, save;
|
||||
FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
|
||||
unsigned i, order;
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
error = data[i] ; total_error_0 += local_abs(error); save = error;
|
||||
error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
|
||||
error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
|
||||
error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
|
||||
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
|
||||
}
|
||||
|
||||
if(total_error_0 < flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
order = 0;
|
||||
else if(total_error_1 < flac_min(flac_min(total_error_2, total_error_3), total_error_4))
|
||||
order = 1;
|
||||
else if(total_error_2 < flac_min(total_error_3, total_error_4))
|
||||
order = 2;
|
||||
else if(total_error_3 < total_error_4)
|
||||
order = 3;
|
||||
else
|
||||
order = 4;
|
||||
|
||||
/* Estimate the expected number of bits per residual signal sample. */
|
||||
/* 'total_error*' is linearly related to the variance of the residual */
|
||||
/* signal, so we use it directly to compute E(|x|) */
|
||||
FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0);
|
||||
#else
|
||||
residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0;
|
||||
residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0;
|
||||
residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_integerized(total_error_2, data_len) : 0;
|
||||
residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_integerized(total_error_3, data_len) : 0;
|
||||
residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_integerized(total_error_4, data_len) : 0;
|
||||
#endif
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#endif
|
||||
{
|
||||
FLAC__int32 last_error_0 = data[-1];
|
||||
FLAC__int32 last_error_1 = data[-1] - data[-2];
|
||||
FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
|
||||
FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
|
||||
FLAC__int32 error, save;
|
||||
/* total_error_* are 64-bits to avoid overflow when encoding
|
||||
* erratic signals when the bits-per-sample and blocksize are
|
||||
* large.
|
||||
*/
|
||||
FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
|
||||
unsigned i, order;
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
error = data[i] ; total_error_0 += local_abs(error); save = error;
|
||||
error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
|
||||
error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
|
||||
error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
|
||||
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
|
||||
}
|
||||
|
||||
if(total_error_0 < flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
order = 0;
|
||||
else if(total_error_1 < flac_min(flac_min(total_error_2, total_error_3), total_error_4))
|
||||
order = 1;
|
||||
else if(total_error_2 < flac_min(total_error_3, total_error_4))
|
||||
order = 2;
|
||||
else if(total_error_3 < total_error_4)
|
||||
order = 3;
|
||||
else
|
||||
order = 4;
|
||||
|
||||
/* Estimate the expected number of bits per residual signal sample. */
|
||||
/* 'total_error*' is linearly related to the variance of the residual */
|
||||
/* signal, so we use it directly to compute E(|x|) */
|
||||
FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0);
|
||||
#else
|
||||
residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0;
|
||||
residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0;
|
||||
residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_wide_integerized(total_error_2, data_len) : 0;
|
||||
residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_wide_integerized(total_error_3, data_len) : 0;
|
||||
residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_wide_integerized(total_error_4, data_len) : 0;
|
||||
#endif
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[])
|
||||
{
|
||||
const int idata_len = (int)data_len;
|
||||
int i;
|
||||
|
||||
switch(order) {
|
||||
case 0:
|
||||
FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
|
||||
memcpy(residual, data, sizeof(residual[0])*data_len);
|
||||
break;
|
||||
case 1:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
residual[i] = data[i] - data[i-1];
|
||||
break;
|
||||
case 2:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
residual[i] = data[i] - 2*data[i-1] + data[i-2];
|
||||
break;
|
||||
case 3:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3];
|
||||
break;
|
||||
case 4:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4];
|
||||
break;
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[])
|
||||
{
|
||||
int i, idata_len = (int)data_len;
|
||||
|
||||
switch(order) {
|
||||
case 0:
|
||||
FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
|
||||
memcpy(data, residual, sizeof(residual[0])*data_len);
|
||||
break;
|
||||
case 1:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
data[i] = residual[i] + data[i-1];
|
||||
break;
|
||||
case 2:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
data[i] = residual[i] + 2*data[i-1] - data[i-2];
|
||||
break;
|
||||
case 3:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
data[i] = residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3];
|
||||
break;
|
||||
case 4:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
data[i] = residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4];
|
||||
break;
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
Vendored
+302
@@ -0,0 +1,302 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/assert.h"
|
||||
#include "share/compat.h"
|
||||
#include "private/float.h"
|
||||
|
||||
#ifdef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
const FLAC__fixedpoint FLAC__FP_ZERO = 0;
|
||||
const FLAC__fixedpoint FLAC__FP_ONE_HALF = 0x00008000;
|
||||
const FLAC__fixedpoint FLAC__FP_ONE = 0x00010000;
|
||||
const FLAC__fixedpoint FLAC__FP_LN2 = 45426;
|
||||
const FLAC__fixedpoint FLAC__FP_E = 178145;
|
||||
|
||||
/* Lookup tables for Knuth's logarithm algorithm */
|
||||
#define LOG2_LOOKUP_PRECISION 16
|
||||
static const FLAC__uint32 log2_lookup[][LOG2_LOOKUP_PRECISION] = {
|
||||
{
|
||||
/*
|
||||
* 0 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000001,
|
||||
/* lg(4/3) = */ 0x00000000,
|
||||
/* lg(8/7) = */ 0x00000000,
|
||||
/* lg(16/15) = */ 0x00000000,
|
||||
/* lg(32/31) = */ 0x00000000,
|
||||
/* lg(64/63) = */ 0x00000000,
|
||||
/* lg(128/127) = */ 0x00000000,
|
||||
/* lg(256/255) = */ 0x00000000,
|
||||
/* lg(512/511) = */ 0x00000000,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 4 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000010,
|
||||
/* lg(4/3) = */ 0x00000007,
|
||||
/* lg(8/7) = */ 0x00000003,
|
||||
/* lg(16/15) = */ 0x00000001,
|
||||
/* lg(32/31) = */ 0x00000001,
|
||||
/* lg(64/63) = */ 0x00000000,
|
||||
/* lg(128/127) = */ 0x00000000,
|
||||
/* lg(256/255) = */ 0x00000000,
|
||||
/* lg(512/511) = */ 0x00000000,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 8 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000100,
|
||||
/* lg(4/3) = */ 0x0000006a,
|
||||
/* lg(8/7) = */ 0x00000031,
|
||||
/* lg(16/15) = */ 0x00000018,
|
||||
/* lg(32/31) = */ 0x0000000c,
|
||||
/* lg(64/63) = */ 0x00000006,
|
||||
/* lg(128/127) = */ 0x00000003,
|
||||
/* lg(256/255) = */ 0x00000001,
|
||||
/* lg(512/511) = */ 0x00000001,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 12 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00001000,
|
||||
/* lg(4/3) = */ 0x000006a4,
|
||||
/* lg(8/7) = */ 0x00000315,
|
||||
/* lg(16/15) = */ 0x0000017d,
|
||||
/* lg(32/31) = */ 0x000000bc,
|
||||
/* lg(64/63) = */ 0x0000005d,
|
||||
/* lg(128/127) = */ 0x0000002e,
|
||||
/* lg(256/255) = */ 0x00000017,
|
||||
/* lg(512/511) = */ 0x0000000c,
|
||||
/* lg(1024/1023) = */ 0x00000006,
|
||||
/* lg(2048/2047) = */ 0x00000003,
|
||||
/* lg(4096/4095) = */ 0x00000001,
|
||||
/* lg(8192/8191) = */ 0x00000001,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 16 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00010000,
|
||||
/* lg(4/3) = */ 0x00006a40,
|
||||
/* lg(8/7) = */ 0x00003151,
|
||||
/* lg(16/15) = */ 0x000017d6,
|
||||
/* lg(32/31) = */ 0x00000bba,
|
||||
/* lg(64/63) = */ 0x000005d1,
|
||||
/* lg(128/127) = */ 0x000002e6,
|
||||
/* lg(256/255) = */ 0x00000172,
|
||||
/* lg(512/511) = */ 0x000000b9,
|
||||
/* lg(1024/1023) = */ 0x0000005c,
|
||||
/* lg(2048/2047) = */ 0x0000002e,
|
||||
/* lg(4096/4095) = */ 0x00000017,
|
||||
/* lg(8192/8191) = */ 0x0000000c,
|
||||
/* lg(16384/16383) = */ 0x00000006,
|
||||
/* lg(32768/32767) = */ 0x00000003
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 20 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00100000,
|
||||
/* lg(4/3) = */ 0x0006a3fe,
|
||||
/* lg(8/7) = */ 0x00031513,
|
||||
/* lg(16/15) = */ 0x00017d60,
|
||||
/* lg(32/31) = */ 0x0000bb9d,
|
||||
/* lg(64/63) = */ 0x00005d10,
|
||||
/* lg(128/127) = */ 0x00002e59,
|
||||
/* lg(256/255) = */ 0x00001721,
|
||||
/* lg(512/511) = */ 0x00000b8e,
|
||||
/* lg(1024/1023) = */ 0x000005c6,
|
||||
/* lg(2048/2047) = */ 0x000002e3,
|
||||
/* lg(4096/4095) = */ 0x00000171,
|
||||
/* lg(8192/8191) = */ 0x000000b9,
|
||||
/* lg(16384/16383) = */ 0x0000005c,
|
||||
/* lg(32768/32767) = */ 0x0000002e
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 24 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x01000000,
|
||||
/* lg(4/3) = */ 0x006a3fe6,
|
||||
/* lg(8/7) = */ 0x00315130,
|
||||
/* lg(16/15) = */ 0x0017d605,
|
||||
/* lg(32/31) = */ 0x000bb9ca,
|
||||
/* lg(64/63) = */ 0x0005d0fc,
|
||||
/* lg(128/127) = */ 0x0002e58f,
|
||||
/* lg(256/255) = */ 0x0001720e,
|
||||
/* lg(512/511) = */ 0x0000b8d8,
|
||||
/* lg(1024/1023) = */ 0x00005c61,
|
||||
/* lg(2048/2047) = */ 0x00002e2d,
|
||||
/* lg(4096/4095) = */ 0x00001716,
|
||||
/* lg(8192/8191) = */ 0x00000b8b,
|
||||
/* lg(16384/16383) = */ 0x000005c5,
|
||||
/* lg(32768/32767) = */ 0x000002e3
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 28 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x10000000,
|
||||
/* lg(4/3) = */ 0x06a3fe5c,
|
||||
/* lg(8/7) = */ 0x03151301,
|
||||
/* lg(16/15) = */ 0x017d6049,
|
||||
/* lg(32/31) = */ 0x00bb9ca6,
|
||||
/* lg(64/63) = */ 0x005d0fba,
|
||||
/* lg(128/127) = */ 0x002e58f7,
|
||||
/* lg(256/255) = */ 0x001720da,
|
||||
/* lg(512/511) = */ 0x000b8d87,
|
||||
/* lg(1024/1023) = */ 0x0005c60b,
|
||||
/* lg(2048/2047) = */ 0x0002e2d7,
|
||||
/* lg(4096/4095) = */ 0x00017160,
|
||||
/* lg(8192/8191) = */ 0x0000b8ad,
|
||||
/* lg(16384/16383) = */ 0x00005c56,
|
||||
/* lg(32768/32767) = */ 0x00002e2b
|
||||
}
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const FLAC__uint64 log2_lookup_wide[] = {
|
||||
{
|
||||
/*
|
||||
* 32 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ FLAC__U64L(0x100000000),
|
||||
/* lg(4/3) = */ FLAC__U64L(0x6a3fe5c6),
|
||||
/* lg(8/7) = */ FLAC__U64L(0x31513015),
|
||||
/* lg(16/15) = */ FLAC__U64L(0x17d60497),
|
||||
/* lg(32/31) = */ FLAC__U64L(0x0bb9ca65),
|
||||
/* lg(64/63) = */ FLAC__U64L(0x05d0fba2),
|
||||
/* lg(128/127) = */ FLAC__U64L(0x02e58f74),
|
||||
/* lg(256/255) = */ FLAC__U64L(0x01720d9c),
|
||||
/* lg(512/511) = */ FLAC__U64L(0x00b8d875),
|
||||
/* lg(1024/1023) = */ FLAC__U64L(0x005c60aa),
|
||||
/* lg(2048/2047) = */ FLAC__U64L(0x002e2d72),
|
||||
/* lg(4096/4095) = */ FLAC__U64L(0x00171600),
|
||||
/* lg(8192/8191) = */ FLAC__U64L(0x000b8ad2),
|
||||
/* lg(16384/16383) = */ FLAC__U64L(0x0005c55d),
|
||||
/* lg(32768/32767) = */ FLAC__U64L(0x0002e2ac)
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 48 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ FLAC__U64L(0x1000000000000),
|
||||
/* lg(4/3) = */ FLAC__U64L(0x6a3fe5c60429),
|
||||
/* lg(8/7) = */ FLAC__U64L(0x315130157f7a),
|
||||
/* lg(16/15) = */ FLAC__U64L(0x17d60496cfbb),
|
||||
/* lg(32/31) = */ FLAC__U64L(0xbb9ca64ecac),
|
||||
/* lg(64/63) = */ FLAC__U64L(0x5d0fba187cd),
|
||||
/* lg(128/127) = */ FLAC__U64L(0x2e58f7441ee),
|
||||
/* lg(256/255) = */ FLAC__U64L(0x1720d9c06a8),
|
||||
/* lg(512/511) = */ FLAC__U64L(0xb8d8752173),
|
||||
/* lg(1024/1023) = */ FLAC__U64L(0x5c60aa252e),
|
||||
/* lg(2048/2047) = */ FLAC__U64L(0x2e2d71b0d8),
|
||||
/* lg(4096/4095) = */ FLAC__U64L(0x1716001719),
|
||||
/* lg(8192/8191) = */ FLAC__U64L(0xb8ad1de1b),
|
||||
/* lg(16384/16383) = */ FLAC__U64L(0x5c55d640d),
|
||||
/* lg(32768/32767) = */ FLAC__U64L(0x2e2abcf52)
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision)
|
||||
{
|
||||
const FLAC__uint32 ONE = (1u << fracbits);
|
||||
const FLAC__uint32 *table = log2_lookup[fracbits >> 2];
|
||||
|
||||
FLAC__ASSERT(fracbits < 32);
|
||||
FLAC__ASSERT((fracbits & 0x3) == 0);
|
||||
|
||||
if(x < ONE)
|
||||
return 0;
|
||||
|
||||
if(precision > LOG2_LOOKUP_PRECISION)
|
||||
precision = LOG2_LOOKUP_PRECISION;
|
||||
|
||||
/* Knuth's algorithm for computing logarithms, optimized for base-2 with lookup tables */
|
||||
{
|
||||
FLAC__uint32 y = 0;
|
||||
FLAC__uint32 z = x >> 1, k = 1;
|
||||
while (x > ONE && k < precision) {
|
||||
if (x - z >= ONE) {
|
||||
x -= z;
|
||||
z = x >> k;
|
||||
y += table[k];
|
||||
}
|
||||
else {
|
||||
z >>= 1;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
Vendored
+595
@@ -0,0 +1,595 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for qsort() */
|
||||
#include <string.h> /* for memset() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/format.h"
|
||||
#include "share/alloc.h"
|
||||
#include "share/compat.h"
|
||||
#include "private/format.h"
|
||||
#include "private/macros.h"
|
||||
|
||||
/* FLAC_PACKAGE_VERSION should come from configure */
|
||||
#if defined(__LIBRETRO__) || defined(RARCH_INTERNAL)
|
||||
FLAC_API const char *FLAC__VERSION_STRING = "";
|
||||
|
||||
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 20170101";
|
||||
#else
|
||||
FLAC_API const char *FLAC__VERSION_STRING = FLAC_PACKAGE_VERSION;
|
||||
|
||||
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " FLAC_PACKAGE_VERSION " 20170101";
|
||||
#endif
|
||||
|
||||
FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' };
|
||||
FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143;
|
||||
FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
|
||||
|
||||
FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = FLAC__U64L(0xffffffffffffffff);
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC = 0x3ffe;
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
|
||||
|
||||
FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] = {
|
||||
"PARTITIONED_RICE",
|
||||
"PARTITIONED_RICE2"
|
||||
};
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
|
||||
|
||||
FLAC_API const char * const FLAC__SubframeTypeString[] = {
|
||||
"CONSTANT",
|
||||
"VERBATIM",
|
||||
"FIXED",
|
||||
"LPC"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__ChannelAssignmentString[] = {
|
||||
"INDEPENDENT",
|
||||
"LEFT_SIDE",
|
||||
"RIGHT_SIDE",
|
||||
"MID_SIDE"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__FrameNumberTypeString[] = {
|
||||
"FRAME_NUMBER_TYPE_FRAME_NUMBER",
|
||||
"FRAME_NUMBER_TYPE_SAMPLE_NUMBER"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__MetadataTypeString[] = {
|
||||
"STREAMINFO",
|
||||
"PADDING",
|
||||
"APPLICATION",
|
||||
"SEEKTABLE",
|
||||
"VORBIS_COMMENT",
|
||||
"CUESHEET",
|
||||
"PICTURE"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] = {
|
||||
"Other",
|
||||
"32x32 pixels 'file icon' (PNG only)",
|
||||
"Other file icon",
|
||||
"Cover (front)",
|
||||
"Cover (back)",
|
||||
"Leaflet page",
|
||||
"Media (e.g. label side of CD)",
|
||||
"Lead artist/lead performer/soloist",
|
||||
"Artist/performer",
|
||||
"Conductor",
|
||||
"Band/Orchestra",
|
||||
"Composer",
|
||||
"Lyricist/text writer",
|
||||
"Recording Location",
|
||||
"During recording",
|
||||
"During performance",
|
||||
"Movie/video screen capture",
|
||||
"A bright coloured fish",
|
||||
"Illustration",
|
||||
"Band/artist logotype",
|
||||
"Publisher/Studio logotype"
|
||||
};
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate)
|
||||
{
|
||||
if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate)
|
||||
{
|
||||
if(blocksize > 16384)
|
||||
return false;
|
||||
else if(sample_rate <= 48000 && blocksize > 4608)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate)
|
||||
{
|
||||
if(
|
||||
!FLAC__format_sample_rate_is_valid(sample_rate) ||
|
||||
(
|
||||
sample_rate >= (1u << 16) &&
|
||||
!(sample_rate % 1000 == 0 || sample_rate % 10 == 0)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table)
|
||||
{
|
||||
unsigned i;
|
||||
FLAC__uint64 prev_sample_number = 0;
|
||||
FLAC__bool got_prev = false;
|
||||
|
||||
FLAC__ASSERT(0 != seek_table);
|
||||
|
||||
for(i = 0; i < seek_table->num_points; i++) {
|
||||
if(got_prev) {
|
||||
if(
|
||||
seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
|
||||
seek_table->points[i].sample_number <= prev_sample_number
|
||||
)
|
||||
return false;
|
||||
}
|
||||
prev_sample_number = seek_table->points[i].sample_number;
|
||||
got_prev = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* used as the sort predicate for qsort() */
|
||||
static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLAC__StreamMetadata_SeekPoint *r)
|
||||
{
|
||||
/* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */
|
||||
if(l->sample_number == r->sample_number)
|
||||
return 0;
|
||||
else if(l->sample_number < r->sample_number)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
|
||||
{
|
||||
unsigned i, j;
|
||||
FLAC__bool first;
|
||||
|
||||
FLAC__ASSERT(0 != seek_table);
|
||||
|
||||
if (seek_table->num_points == 0)
|
||||
return 0;
|
||||
|
||||
/* sort the seekpoints */
|
||||
qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
|
||||
|
||||
/* uniquify the seekpoints */
|
||||
first = true;
|
||||
for(i = j = 0; i < seek_table->num_points; i++) {
|
||||
if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
|
||||
if(!first) {
|
||||
if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
first = false;
|
||||
seek_table->points[j++] = seek_table->points[i];
|
||||
}
|
||||
|
||||
for(i = j; i < seek_table->num_points; i++) {
|
||||
seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
|
||||
seek_table->points[i].stream_offset = 0;
|
||||
seek_table->points[i].frame_samples = 0;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
/*
|
||||
* also disallows non-shortest-form encodings, c.f.
|
||||
* http://www.unicode.org/versions/corrigendum1.html
|
||||
* and a more clear explanation at the end of this section:
|
||||
* http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
*/
|
||||
static unsigned utf8len_(const FLAC__byte *utf8)
|
||||
{
|
||||
FLAC__ASSERT(0 != utf8);
|
||||
if ((utf8[0] & 0x80) == 0) {
|
||||
return 1;
|
||||
}
|
||||
else if ((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80) {
|
||||
if ((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
/* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */
|
||||
if (utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */
|
||||
return 0;
|
||||
if (utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */
|
||||
return 0;
|
||||
return 3;
|
||||
}
|
||||
else if ((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 4;
|
||||
}
|
||||
else if ((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 5;
|
||||
}
|
||||
else if ((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 6;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name)
|
||||
{
|
||||
char c;
|
||||
for(c = *name; c; c = *(++name))
|
||||
if(c < 0x20 || c == 0x3d || c > 0x7d)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length)
|
||||
{
|
||||
if(length == (unsigned)(-1)) {
|
||||
while(*value) {
|
||||
unsigned n = utf8len_(value);
|
||||
if(n == 0)
|
||||
return false;
|
||||
value += n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const FLAC__byte *end = value + length;
|
||||
while(value < end) {
|
||||
unsigned n = utf8len_(value);
|
||||
if(n == 0)
|
||||
return false;
|
||||
value += n;
|
||||
}
|
||||
if(value != end)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length)
|
||||
{
|
||||
const FLAC__byte *s, *end;
|
||||
|
||||
for(s = entry, end = s + length; s < end && *s != '='; s++) {
|
||||
if(*s < 0x20 || *s > 0x7D)
|
||||
return false;
|
||||
}
|
||||
if(s == end)
|
||||
return false;
|
||||
|
||||
s++; /* skip '=' */
|
||||
|
||||
while(s < end) {
|
||||
unsigned n = utf8len_(s);
|
||||
if(n == 0)
|
||||
return false;
|
||||
s += n;
|
||||
}
|
||||
if(s != end)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
if(check_cd_da_subset) {
|
||||
if(cue_sheet->lead_in < 2 * 44100) {
|
||||
if(violation) *violation = "CD-DA cue sheet must have a lead-in length of at least 2 seconds";
|
||||
return false;
|
||||
}
|
||||
if(cue_sheet->lead_in % 588 != 0) {
|
||||
if(violation) *violation = "CD-DA cue sheet lead-in length must be evenly divisible by 588 samples";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(cue_sheet->num_tracks == 0) {
|
||||
if(violation) *violation = "cue sheet must have at least one track (the lead-out)";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(check_cd_da_subset && cue_sheet->tracks[cue_sheet->num_tracks-1].number != 170) {
|
||||
if(violation) *violation = "CD-DA cue sheet must have a lead-out track number 170 (0xAA)";
|
||||
return false;
|
||||
}
|
||||
|
||||
for(i = 0; i < cue_sheet->num_tracks; i++) {
|
||||
if(cue_sheet->tracks[i].number == 0) {
|
||||
if(violation) *violation = "cue sheet may not have a track number 0";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(check_cd_da_subset) {
|
||||
if(!((cue_sheet->tracks[i].number >= 1 && cue_sheet->tracks[i].number <= 99) || cue_sheet->tracks[i].number == 170)) {
|
||||
if(violation) *violation = "CD-DA cue sheet track number must be 1-99 or 170";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(check_cd_da_subset && cue_sheet->tracks[i].offset % 588 != 0) {
|
||||
if(violation) {
|
||||
if(i == cue_sheet->num_tracks-1) /* the lead-out track... */
|
||||
*violation = "CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples";
|
||||
else
|
||||
*violation = "CD-DA cue sheet track offset must be evenly divisible by 588 samples";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(i < cue_sheet->num_tracks - 1) {
|
||||
if(cue_sheet->tracks[i].num_indices == 0) {
|
||||
if(violation) *violation = "cue sheet track must have at least one index point";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(cue_sheet->tracks[i].indices[0].number > 1) {
|
||||
if(violation) *violation = "cue sheet track's first index number must be 0 or 1";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(j = 0; j < cue_sheet->tracks[i].num_indices; j++) {
|
||||
if(check_cd_da_subset && cue_sheet->tracks[i].indices[j].offset % 588 != 0) {
|
||||
if(violation) *violation = "CD-DA cue sheet track index offset must be evenly divisible by 588 samples";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(j > 0) {
|
||||
if(cue_sheet->tracks[i].indices[j].number != cue_sheet->tracks[i].indices[j-1].number + 1) {
|
||||
if(violation) *violation = "cue sheet track index numbers must increase by 1";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation)
|
||||
{
|
||||
char *p;
|
||||
FLAC__byte *b;
|
||||
|
||||
for(p = picture->mime_type; *p; p++) {
|
||||
if(*p < 0x20 || *p > 0x7e) {
|
||||
if(violation) *violation = "MIME type string must contain only printable ASCII characters (0x20-0x7e)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(b = picture->description; *b; ) {
|
||||
unsigned n = utf8len_(b);
|
||||
if(n == 0) {
|
||||
if(violation) *violation = "description string must be valid UTF-8";
|
||||
return false;
|
||||
}
|
||||
b += n;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* These routines are private to libFLAC
|
||||
*/
|
||||
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order)
|
||||
{
|
||||
return
|
||||
FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(
|
||||
FLAC__format_get_max_rice_partition_order_from_blocksize(blocksize),
|
||||
blocksize,
|
||||
predictor_order
|
||||
);
|
||||
}
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize)
|
||||
{
|
||||
unsigned max_rice_partition_order = 0;
|
||||
while(!(blocksize & 1)) {
|
||||
max_rice_partition_order++;
|
||||
blocksize >>= 1;
|
||||
}
|
||||
return flac_min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
|
||||
}
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order)
|
||||
{
|
||||
unsigned max_rice_partition_order = limit;
|
||||
|
||||
while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order)
|
||||
max_rice_partition_order--;
|
||||
|
||||
FLAC__ASSERT(
|
||||
(max_rice_partition_order == 0 && blocksize >= predictor_order) ||
|
||||
(max_rice_partition_order > 0 && blocksize >> max_rice_partition_order > predictor_order)
|
||||
);
|
||||
|
||||
return max_rice_partition_order;
|
||||
}
|
||||
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
object->parameters = 0;
|
||||
object->raw_bits = 0;
|
||||
object->capacity_by_order = 0;
|
||||
}
|
||||
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
if(0 != object->parameters)
|
||||
free(object->parameters);
|
||||
if(0 != object->raw_bits)
|
||||
free(object->raw_bits);
|
||||
FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object);
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
|
||||
|
||||
if(object->capacity_by_order < max_partition_order) {
|
||||
if(0 == (object->parameters = (unsigned int*)safe_realloc_(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
|
||||
return false;
|
||||
if(0 == (object->raw_bits = (unsigned int*)safe_realloc_(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
|
||||
return false;
|
||||
memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
|
||||
object->capacity_by_order = max_partition_order;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ASSERT_H
|
||||
#define FLAC__ASSERT_H
|
||||
|
||||
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#define FLAC__ASSERT(x) assert(x)
|
||||
#define FLAC__ASSERT_DECLARATION(x) x
|
||||
#else
|
||||
#define FLAC__ASSERT(x)
|
||||
#define FLAC__ASSERT_DECLARATION(x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+185
@@ -0,0 +1,185 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__CALLBACK_H
|
||||
#define FLAC__CALLBACK_H
|
||||
|
||||
#include "ordinals.h"
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
/** \file include/FLAC/callback.h
|
||||
*
|
||||
* \brief
|
||||
* This module defines the structures for describing I/O callbacks
|
||||
* to the other FLAC interfaces.
|
||||
*
|
||||
* See the detailed documentation for callbacks in the
|
||||
* \link flac_callbacks callbacks \endlink module.
|
||||
*/
|
||||
|
||||
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
|
||||
* \ingroup flac
|
||||
*
|
||||
* \brief
|
||||
* This module defines the structures for describing I/O callbacks
|
||||
* to the other FLAC interfaces.
|
||||
*
|
||||
* The purpose of the I/O callback functions is to create a common way
|
||||
* for the metadata interfaces to handle I/O.
|
||||
*
|
||||
* Originally the metadata interfaces required filenames as the way of
|
||||
* specifying FLAC files to operate on. This is problematic in some
|
||||
* environments so there is an additional option to specify a set of
|
||||
* callbacks for doing I/O on the FLAC file, instead of the filename.
|
||||
*
|
||||
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
|
||||
* opaque structure for a data source.
|
||||
*
|
||||
* The callback function prototypes are similar (but not identical) to the
|
||||
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
|
||||
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
|
||||
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
|
||||
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
|
||||
* is required. \warning You generally CANNOT directly use fseek or ftell
|
||||
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
|
||||
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
|
||||
* large files. You will have to find an equivalent function (e.g. ftello),
|
||||
* or write a wrapper. The same is true for feof() since this is usually
|
||||
* implemented as a macro, not as a function whose address can be taken.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** This is the opaque handle type used by the callbacks. Typically
|
||||
* this is a \c FILE* or address of a file descriptor.
|
||||
*/
|
||||
typedef void* FLAC__IOHandle;
|
||||
|
||||
/** Signature for the read callback.
|
||||
* The signature and semantics match POSIX fread() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param ptr The address of the read buffer.
|
||||
* \param size The size of the records to be read.
|
||||
* \param nmemb The number of records to be read.
|
||||
* \param handle The handle to the data source.
|
||||
* \retval size_t
|
||||
* The number of records read.
|
||||
*/
|
||||
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the write callback.
|
||||
* The signature and semantics match POSIX fwrite() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param ptr The address of the write buffer.
|
||||
* \param size The size of the records to be written.
|
||||
* \param nmemb The number of records to be written.
|
||||
* \param handle The handle to the data source.
|
||||
* \retval size_t
|
||||
* The number of records written.
|
||||
*/
|
||||
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the seek callback.
|
||||
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
|
||||
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
|
||||
* and 32-bits wide.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \param offset The new position, relative to \a whence
|
||||
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
|
||||
* \retval int
|
||||
* \c 0 on success, \c -1 on error.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
|
||||
|
||||
/** Signature for the tell callback.
|
||||
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
|
||||
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
|
||||
* and 32-bits wide.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval FLAC__int64
|
||||
* The current position on success, \c -1 on error.
|
||||
*/
|
||||
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the EOF callback.
|
||||
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
|
||||
* on many systems, feof() is a macro, so in this case a wrapper function
|
||||
* must be provided instead.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval int
|
||||
* \c 0 if not at end of file, nonzero if at end of file.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
|
||||
|
||||
/** Signature for the close callback.
|
||||
* The signature and semantics match POSIX fclose() implementations
|
||||
* and can generally be used interchangeably.
|
||||
*
|
||||
* \param handle The handle to the data source.
|
||||
* \retval int
|
||||
* \c 0 on success, \c EOF on error.
|
||||
*/
|
||||
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
|
||||
|
||||
/** A structure for holding a set of callbacks.
|
||||
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
|
||||
* describe which of the callbacks are required. The ones that are not
|
||||
* required may be set to NULL.
|
||||
*
|
||||
* If the seek requirement for an interface is optional, you can signify that
|
||||
* a data sorce is not seekable by setting the \a seek field to \c NULL.
|
||||
*/
|
||||
typedef struct {
|
||||
FLAC__IOCallback_Read read;
|
||||
FLAC__IOCallback_Write write;
|
||||
FLAC__IOCallback_Seek seek;
|
||||
FLAC__IOCallback_Tell tell;
|
||||
FLAC__IOCallback_Eof eof;
|
||||
FLAC__IOCallback_Close close;
|
||||
} FLAC__IOCallbacks;
|
||||
|
||||
/* \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__EXPORT_H
|
||||
#define FLAC__EXPORT_H
|
||||
|
||||
/** \file include/FLAC/export.h
|
||||
*
|
||||
* \brief
|
||||
* This module contains #defines and symbols for exporting function
|
||||
* calls, and providing version information and compiled-in features.
|
||||
*
|
||||
* See the \link flac_export export \endlink module.
|
||||
*/
|
||||
|
||||
/** \defgroup flac_export FLAC/export.h: export symbols
|
||||
* \ingroup flac
|
||||
*
|
||||
* \brief
|
||||
* This module contains #defines and symbols for exporting function
|
||||
* calls, and providing version information and compiled-in features.
|
||||
*
|
||||
* If you are compiling with MSVC and will link to the static library
|
||||
* (libFLAC.lib) you should define FLAC__NO_DLL in your project to
|
||||
* make sure the symbols are exported properly.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#if defined(FLAC__NO_DLL)
|
||||
#define FLAC_API
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#ifdef FLAC_API_EXPORTS
|
||||
#define FLAC_API __declspec(dllexport)
|
||||
#else
|
||||
#define FLAC_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#elif defined(FLAC__USE_VISIBILITY_ATTR)
|
||||
#define FLAC_API __attribute__ ((visibility ("default")))
|
||||
|
||||
#else
|
||||
#define FLAC_API
|
||||
|
||||
#endif
|
||||
|
||||
/** These #defines will mirror the libtool-based library version number, see
|
||||
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
|
||||
*/
|
||||
#define FLAC_API_VERSION_CURRENT 11
|
||||
#define FLAC_API_VERSION_REVISION 0 /**< see above */
|
||||
#define FLAC_API_VERSION_AGE 3 /**< see above */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
|
||||
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* \} */
|
||||
|
||||
#endif
|
||||
Vendored
+1025
File diff suppressed because it is too large.
Load diff
Vendored
+2182
File diff suppressed because it is too large.
Load diff
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ORDINALS_H
|
||||
#define FLAC__ORDINALS_H
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
|
||||
/* Microsoft Visual Studio earlier than the 2010 version did not provide
|
||||
* the 1999 ISO C Standard header file <stdint.h>.
|
||||
*/
|
||||
|
||||
typedef __int8 FLAC__int8;
|
||||
typedef unsigned __int8 FLAC__uint8;
|
||||
|
||||
typedef __int16 FLAC__int16;
|
||||
typedef __int32 FLAC__int32;
|
||||
typedef __int64 FLAC__int64;
|
||||
typedef unsigned __int16 FLAC__uint16;
|
||||
typedef unsigned __int32 FLAC__uint32;
|
||||
typedef unsigned __int64 FLAC__uint64;
|
||||
|
||||
#else
|
||||
|
||||
/* For MSVC 2010 and everything else which provides <stdint.h>. */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t FLAC__int8;
|
||||
typedef uint8_t FLAC__uint8;
|
||||
|
||||
typedef int16_t FLAC__int16;
|
||||
typedef int32_t FLAC__int32;
|
||||
typedef int64_t FLAC__int64;
|
||||
typedef uint16_t FLAC__uint16;
|
||||
typedef uint32_t FLAC__uint32;
|
||||
typedef uint64_t FLAC__uint64;
|
||||
|
||||
#endif
|
||||
|
||||
typedef int FLAC__bool;
|
||||
|
||||
typedef FLAC__uint8 FLAC__byte;
|
||||
|
||||
|
||||
#ifdef true
|
||||
#undef true
|
||||
#endif
|
||||
#ifdef false
|
||||
#undef false
|
||||
#endif
|
||||
#ifndef __cplusplus
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+1560
File diff suppressed because it is too large.
Load diff
+212
@@ -0,0 +1,212 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__BITMATH_H
|
||||
#define FLAC__PRIVATE__BITMATH_H
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#include "share/compat.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h> /* for _BitScanReverse* */
|
||||
#endif
|
||||
|
||||
/* Will never be emitted for MSVC, GCC, Intel compilers */
|
||||
static INLINE unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
|
||||
{
|
||||
static const unsigned char byte_to_unary_table[] = {
|
||||
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
};
|
||||
|
||||
return word > 0xffffff ? byte_to_unary_table[word >> 24] :
|
||||
word > 0xffff ? byte_to_unary_table[word >> 16] + 8 :
|
||||
word > 0xff ? byte_to_unary_table[word >> 8] + 16 :
|
||||
byte_to_unary_table[word] + 24;
|
||||
}
|
||||
|
||||
static INLINE unsigned int FLAC__clz_uint32(FLAC__uint32 v)
|
||||
{
|
||||
/* Never used with input 0 */
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__INTEL_COMPILER)
|
||||
return _bit_scan_reverse(v) ^ 31U;
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
/* This will translate either to (bsr ^ 31U), clz , ctlz, cntlz, lzcnt depending on
|
||||
* -march= setting or to a software routine in exotic machines. */
|
||||
return __builtin_clz(v);
|
||||
#elif defined(_MSC_VER)
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, v);
|
||||
return idx ^ 31U;
|
||||
}
|
||||
#else
|
||||
return FLAC__clz_soft_uint32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Used when 64-bit bsr/clz is unavailable; can use 32-bit bsr/clz when possible */
|
||||
static INLINE unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word)
|
||||
{
|
||||
return (FLAC__uint32)(word>>32) ? FLAC__clz_uint32((FLAC__uint32)(word>>32)) :
|
||||
FLAC__clz_uint32((FLAC__uint32)word) + 32;
|
||||
}
|
||||
|
||||
static INLINE unsigned int FLAC__clz_uint64(FLAC__uint64 v)
|
||||
{
|
||||
/* Never used with input 0 */
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
return __builtin_clzll(v);
|
||||
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanReverse64(&idx, v);
|
||||
return idx ^ 63U;
|
||||
}
|
||||
#else
|
||||
return FLAC__clz_soft_uint64(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* These two functions work with input 0 */
|
||||
static INLINE unsigned int FLAC__clz2_uint32(FLAC__uint32 v)
|
||||
{
|
||||
if (!v)
|
||||
return 32;
|
||||
return FLAC__clz_uint32(v);
|
||||
}
|
||||
|
||||
static INLINE unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
|
||||
{
|
||||
if (!v)
|
||||
return 64;
|
||||
return FLAC__clz_uint64(v);
|
||||
}
|
||||
|
||||
/* An example of what FLAC__bitmath_ilog2() computes:
|
||||
*
|
||||
* ilog2( 0) = assertion failure
|
||||
* ilog2( 1) = 0
|
||||
* ilog2( 2) = 1
|
||||
* ilog2( 3) = 1
|
||||
* ilog2( 4) = 2
|
||||
* ilog2( 5) = 2
|
||||
* ilog2( 6) = 2
|
||||
* ilog2( 7) = 2
|
||||
* ilog2( 8) = 3
|
||||
* ilog2( 9) = 3
|
||||
* ilog2(10) = 3
|
||||
* ilog2(11) = 3
|
||||
* ilog2(12) = 3
|
||||
* ilog2(13) = 3
|
||||
* ilog2(14) = 3
|
||||
* ilog2(15) = 3
|
||||
* ilog2(16) = 4
|
||||
* ilog2(17) = 4
|
||||
* ilog2(18) = 4
|
||||
*/
|
||||
|
||||
static INLINE unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
|
||||
{
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__INTEL_COMPILER)
|
||||
return _bit_scan_reverse(v);
|
||||
#elif defined(_MSC_VER)
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, v);
|
||||
return idx;
|
||||
}
|
||||
#else
|
||||
return FLAC__clz_uint32(v) ^ 31U;
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
|
||||
{
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
return __builtin_clzll(v) ^ 63U;
|
||||
/* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */
|
||||
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanReverse64(&idx, v);
|
||||
return idx;
|
||||
}
|
||||
#else
|
||||
/* Brain-damaged compilers will use the fastest possible way that is,
|
||||
de Bruijn sequences (http://supertech.csail.mit.edu/papers/debruijn.pdf)
|
||||
(C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain).
|
||||
*/
|
||||
{
|
||||
static const unsigned char DEBRUIJN_IDX64[64]={
|
||||
0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40,
|
||||
5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57,
|
||||
63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56,
|
||||
62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58
|
||||
};
|
||||
v|= v>>1;
|
||||
v|= v>>2;
|
||||
v|= v>>4;
|
||||
v|= v>>8;
|
||||
v|= v>>16;
|
||||
v|= v>>32;
|
||||
v= (v>>1)+1;
|
||||
return DEBRUIJN_IDX64[v*FLAC__U64L(0x218A392CD3D5DBF)>>58&0x3F];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned FLAC__bitmath_silog2(FLAC__int64 v);
|
||||
|
||||
#endif
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__BITREADER_H
|
||||
#define FLAC__PRIVATE__BITREADER_H
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "cpu.h"
|
||||
|
||||
/*
|
||||
* opaque structure definition
|
||||
*/
|
||||
struct FLAC__BitReader;
|
||||
typedef struct FLAC__BitReader FLAC__BitReader;
|
||||
|
||||
typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data);
|
||||
|
||||
/*
|
||||
* construction, deletion, initialization, etc functions
|
||||
*/
|
||||
FLAC__BitReader *FLAC__bitreader_new(void);
|
||||
void FLAC__bitreader_delete(FLAC__BitReader *br);
|
||||
FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__BitReaderReadCallback rcb, void *cd);
|
||||
void FLAC__bitreader_free(FLAC__BitReader *br); /* does not 'free(br)' */
|
||||
FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br);
|
||||
void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out);
|
||||
|
||||
/*
|
||||
* CRC functions
|
||||
*/
|
||||
void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed);
|
||||
FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br);
|
||||
|
||||
/*
|
||||
* info functions
|
||||
*/
|
||||
FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br);
|
||||
unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
|
||||
unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
|
||||
|
||||
/*
|
||||
* read functions
|
||||
*/
|
||||
|
||||
FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/
|
||||
FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */
|
||||
FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
|
||||
FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
|
||||
FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val);
|
||||
FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
|
||||
#if 0 /* UNUSED */
|
||||
FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter);
|
||||
#endif
|
||||
FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen);
|
||||
FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen);
|
||||
#endif
|
||||
Vendored
+186
@@ -0,0 +1,186 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__CPU_H
|
||||
#define FLAC__PRIVATE__CPU_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef FLAC__CPU_X86_64
|
||||
|
||||
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
|
||||
#define FLAC__CPU_X86_64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FLAC__CPU_IA32
|
||||
|
||||
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)
|
||||
#define FLAC__CPU_IA32
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if FLAC__HAS_X86INTRIN
|
||||
/* SSE intrinsics support by ICC/MSVC/GCC */
|
||||
#if defined __INTEL_COMPILER
|
||||
#define FLAC__SSE_TARGET(x)
|
||||
#define FLAC__SSE_SUPPORTED 1
|
||||
#define FLAC__SSE2_SUPPORTED 1
|
||||
#if (__INTEL_COMPILER >= 1000) /* Intel C++ Compiler 10.0 */
|
||||
#define FLAC__SSSE3_SUPPORTED 1
|
||||
#define FLAC__SSE4_1_SUPPORTED 1
|
||||
#endif
|
||||
#if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */
|
||||
#define FLAC__AVX_SUPPORTED 1
|
||||
#endif
|
||||
#if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */
|
||||
#define FLAC__AVX2_SUPPORTED 1
|
||||
#define FLAC__FMA_SUPPORTED 1
|
||||
#endif
|
||||
#elif defined _MSC_VER
|
||||
#define FLAC__SSE_TARGET(x)
|
||||
#define FLAC__SSE_SUPPORTED 1
|
||||
#define FLAC__SSE2_SUPPORTED 1
|
||||
#if (_MSC_VER >= 1500) /* MS Visual Studio 2008 */
|
||||
#define FLAC__SSSE3_SUPPORTED 1
|
||||
#define FLAC__SSE4_1_SUPPORTED 1
|
||||
#endif
|
||||
#if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */
|
||||
#define FLAC__AVX_SUPPORTED 1
|
||||
#endif
|
||||
#if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */
|
||||
#define FLAC__AVX2_SUPPORTED 1
|
||||
#define FLAC__FMA_SUPPORTED 1
|
||||
#endif
|
||||
#elif defined __GNUC__
|
||||
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* since GCC 4.9 -msse.. compiler options aren't necessary */
|
||||
#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x)))
|
||||
#define FLAC__SSE_SUPPORTED 1
|
||||
#define FLAC__SSE2_SUPPORTED 1
|
||||
#define FLAC__SSSE3_SUPPORTED 1
|
||||
#define FLAC__SSE4_1_SUPPORTED 1
|
||||
#ifdef FLAC__USE_AVX
|
||||
#define FLAC__AVX_SUPPORTED 1
|
||||
#define FLAC__AVX2_SUPPORTED 1
|
||||
#define FLAC__FMA_SUPPORTED 1
|
||||
#endif
|
||||
#else /* for GCC older than 4.9 */
|
||||
#define FLAC__SSE_TARGET(x)
|
||||
#ifdef __SSE__
|
||||
#define FLAC__SSE_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __SSE2__
|
||||
#define FLAC__SSE2_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __SSSE3__
|
||||
#define FLAC__SSSE3_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __SSE4_1__
|
||||
#define FLAC__SSE4_1_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __AVX__
|
||||
#define FLAC__AVX_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __AVX2__
|
||||
#define FLAC__AVX2_SUPPORTED 1
|
||||
#endif
|
||||
#ifdef __FMA__
|
||||
#define FLAC__FMA_SUPPORTED 1
|
||||
#endif
|
||||
#endif /* GCC version */
|
||||
#endif /* compiler version */
|
||||
#endif /* intrinsics support */
|
||||
|
||||
|
||||
#ifndef FLAC__AVX_SUPPORTED
|
||||
#define FLAC__AVX_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
FLAC__CPUINFO_TYPE_IA32,
|
||||
FLAC__CPUINFO_TYPE_X86_64,
|
||||
FLAC__CPUINFO_TYPE_UNKNOWN
|
||||
} FLAC__CPUInfo_Type;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool intel;
|
||||
|
||||
FLAC__bool cmov;
|
||||
FLAC__bool mmx;
|
||||
FLAC__bool sse;
|
||||
FLAC__bool sse2;
|
||||
|
||||
FLAC__bool sse3;
|
||||
FLAC__bool ssse3;
|
||||
FLAC__bool sse41;
|
||||
FLAC__bool sse42;
|
||||
FLAC__bool avx;
|
||||
FLAC__bool avx2;
|
||||
FLAC__bool fma;
|
||||
} FLAC__CPUInfo_IA32;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool intel;
|
||||
|
||||
FLAC__bool sse3;
|
||||
FLAC__bool ssse3;
|
||||
FLAC__bool sse41;
|
||||
FLAC__bool sse42;
|
||||
FLAC__bool avx;
|
||||
FLAC__bool avx2;
|
||||
FLAC__bool fma;
|
||||
} FLAC__CPUInfo_x86;
|
||||
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool use_asm;
|
||||
FLAC__CPUInfo_Type type;
|
||||
FLAC__CPUInfo_IA32 ia32;
|
||||
FLAC__CPUInfo_x86 x86;
|
||||
} FLAC__CPUInfo;
|
||||
|
||||
void FLAC__cpu_info(FLAC__CPUInfo *info);
|
||||
|
||||
FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void);
|
||||
|
||||
void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx);
|
||||
|
||||
void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx);
|
||||
|
||||
#endif
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__CRC_H
|
||||
#define FLAC__PRIVATE__CRC_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/* 8 bit CRC generator, MSB shifted first
|
||||
** polynomial = x^8 + x^2 + x^1 + x^0
|
||||
** init = 0
|
||||
*/
|
||||
extern FLAC__byte const FLAC__crc8_table[256];
|
||||
#define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)];
|
||||
void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc);
|
||||
void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc);
|
||||
FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len);
|
||||
|
||||
/* 16 bit CRC generator, MSB shifted first
|
||||
** polynomial = x^16 + x^15 + x^2 + x^0
|
||||
** init = 0
|
||||
*/
|
||||
extern unsigned const FLAC__crc16_table[256];
|
||||
|
||||
#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)])
|
||||
/* this alternate may be faster on some systems/compilers */
|
||||
#if 0
|
||||
#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff)
|
||||
#endif
|
||||
|
||||
unsigned FLAC__crc16(const FLAC__byte *data, unsigned len);
|
||||
|
||||
#endif
|
||||
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FIXED_H
|
||||
#define FLAC__PRIVATE__FIXED_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/cpu.h"
|
||||
#include "private/float.h"
|
||||
#include "FLAC/format.h"
|
||||
|
||||
/*
|
||||
* FLAC__fixed_compute_best_predictor()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the best fixed predictor and the expected bits-per-sample
|
||||
* of the residual signal for each order. The _wide() version uses
|
||||
* 64-bit integers which is statistically necessary when bits-per-
|
||||
* sample + log2(blocksize) > 30
|
||||
*
|
||||
* IN data[0,data_len-1]
|
||||
* IN data_len
|
||||
* OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER]
|
||||
*/
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
# ifndef FLAC__NO_ASM
|
||||
# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
|
||||
# ifdef FLAC__SSE2_SUPPORTED
|
||||
unsigned FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
|
||||
# endif
|
||||
# ifdef FLAC__SSSE3_SUPPORTED
|
||||
unsigned FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
|
||||
# endif
|
||||
# endif
|
||||
# if defined FLAC__CPU_IA32 && defined FLAC__HAS_NASM
|
||||
unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FLAC__fixed_compute_residual()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the residual signal obtained from sutracting the predicted
|
||||
* signal from the original.
|
||||
*
|
||||
* IN data[-order,data_len-1] original signal (NOTE THE INDICES!)
|
||||
* IN data_len length of original signal
|
||||
* IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
|
||||
* OUT residual[0,data_len-1] residual signal
|
||||
*/
|
||||
void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]);
|
||||
|
||||
/*
|
||||
* FLAC__fixed_restore_signal()
|
||||
* --------------------------------------------------------------------
|
||||
* Restore the original signal by summing the residual and the
|
||||
* predictor.
|
||||
*
|
||||
* IN residual[0,data_len-1] residual signal
|
||||
* IN data_len length of original signal
|
||||
* IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
|
||||
* *** IMPORTANT: the caller must pass in the historical samples:
|
||||
* IN data[-order,-1] previously-reconstructed historical samples
|
||||
* OUT data[0,data_len-1] original signal
|
||||
*/
|
||||
void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]);
|
||||
|
||||
#endif
|
||||
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FLOAT_H
|
||||
#define FLAC__PRIVATE__FLOAT_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/*
|
||||
* All the code in libFLAC that uses float and double
|
||||
* should be protected by checks of the macro
|
||||
* FLAC__INTEGER_ONLY_LIBRARY.
|
||||
*
|
||||
*/
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
/*
|
||||
* FLAC__real is the basic floating point type used in LPC analysis.
|
||||
*
|
||||
* WATCHOUT: changing FLAC__real will change the signatures of many
|
||||
* functions that have assembly language equivalents and break them.
|
||||
*/
|
||||
typedef float FLAC__real;
|
||||
#else
|
||||
/*
|
||||
* The convention for FLAC__fixedpoint is to use the upper 16 bits
|
||||
* for the integer part and lower 16 bits for the fractional part.
|
||||
*/
|
||||
typedef FLAC__int32 FLAC__fixedpoint;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ZERO;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ONE_HALF;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ONE;
|
||||
extern const FLAC__fixedpoint FLAC__FP_LN2;
|
||||
extern const FLAC__fixedpoint FLAC__FP_E;
|
||||
|
||||
#define FLAC__fixedpoint_trunc(x) ((x)>>16)
|
||||
|
||||
#define FLAC__fixedpoint_mul(x, y) ( (FLAC__fixedpoint) ( ((FLAC__int64)(x)*(FLAC__int64)(y)) >> 16 ) )
|
||||
|
||||
#define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<32) / (FLAC__int64)(y) ) >> 16 ) )
|
||||
|
||||
/*
|
||||
* FLAC__fixedpoint_log2()
|
||||
* --------------------------------------------------------------------
|
||||
* Returns the base-2 logarithm of the fixed-point number 'x' using an
|
||||
* algorithm by Knuth for x >= 1.0
|
||||
*
|
||||
* 'fracbits' is the number of fractional bits of 'x'. 'fracbits' must
|
||||
* be < 32 and evenly divisible by 4 (0 is OK but not very precise).
|
||||
*
|
||||
* 'precision' roughly limits the number of iterations that are done;
|
||||
* use (unsigned)(-1) for maximum precision.
|
||||
*
|
||||
* If 'x' is less than one -- that is, x < (1<<fracbits) -- then this
|
||||
* function will punt and return 0.
|
||||
*
|
||||
* The return value will also have 'fracbits' fractional bits.
|
||||
*/
|
||||
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FORMAT_H
|
||||
#define FLAC__PRIVATE__FORMAT_H
|
||||
|
||||
#include "FLAC/format.h"
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order);
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize);
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order);
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
|
||||
FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order);
|
||||
|
||||
#endif
|
||||
Vendored
+250
@@ -0,0 +1,250 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000-2009 Josh Coalson
|
||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__LPC_H
|
||||
#define FLAC__PRIVATE__LPC_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/cpu.h"
|
||||
#include "private/float.h"
|
||||
#include "FLAC/format.h"
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/*
|
||||
* FLAC__lpc_window_data()
|
||||
* --------------------------------------------------------------------
|
||||
* Applies the given window to the data.
|
||||
* OPT: asm implementation
|
||||
*
|
||||
* IN in[0,data_len-1]
|
||||
* IN window[0,data_len-1]
|
||||
* OUT out[0,lag-1]
|
||||
* IN data_len
|
||||
*/
|
||||
void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_autocorrelation()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the autocorrelation for lags between 0 and lag-1.
|
||||
* Assumes data[] outside of [0,data_len-1] == 0.
|
||||
* Asserts that lag > 0.
|
||||
*
|
||||
* IN data[0,data_len-1]
|
||||
* IN data_len
|
||||
* IN 0 < lag <= data_len
|
||||
* OUT autoc[0,lag-1]
|
||||
*/
|
||||
void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
# endif
|
||||
# endif
|
||||
# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
|
||||
# ifdef FLAC__SSE_SUPPORTED
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_lp_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Computes LP coefficients for orders 1..max_order.
|
||||
* Do not call if autoc[0] == 0.0. This means the signal is zero
|
||||
* and there is no point in calculating a predictor.
|
||||
*
|
||||
* IN autoc[0,max_order] autocorrelation values
|
||||
* IN 0 < max_order <= FLAC__MAX_LPC_ORDER max LP order to compute
|
||||
* OUT lp_coeff[0,max_order-1][0,max_order-1] LP coefficients for each order
|
||||
* *** IMPORTANT:
|
||||
* *** lp_coeff[0,max_order-1][max_order,FLAC__MAX_LPC_ORDER-1] are untouched
|
||||
* OUT error[0,max_order-1] error for each order (more
|
||||
* specifically, the variance of
|
||||
* the error signal times # of
|
||||
* samples in the signal)
|
||||
*
|
||||
* Example: if max_order is 9, the LP coefficients for order 9 will be
|
||||
* in lp_coeff[8][0,8], the LP coefficients for order 8 will be
|
||||
* in lp_coeff[7][0,7], etc.
|
||||
*/
|
||||
void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[]);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_quantize_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Quantizes the LP coefficients. NOTE: precision + bits_per_sample
|
||||
* must be less than 32 (sizeof(FLAC__int32)*8).
|
||||
*
|
||||
* IN lp_coeff[0,order-1] LP coefficients
|
||||
* IN order LP order
|
||||
* IN FLAC__MIN_QLP_COEFF_PRECISION < precision
|
||||
* desired precision (in bits, including sign
|
||||
* bit) of largest coefficient
|
||||
* OUT qlp_coeff[0,order-1] quantized coefficients
|
||||
* OUT shift # of bits to shift right to get approximated
|
||||
* LP coefficients. NOTE: could be negative.
|
||||
* RETURN 0 => quantization OK
|
||||
* 1 => coefficients require too much shifting for *shift to
|
||||
* fit in the LPC subframe header. 'shift' is unset.
|
||||
* 2 => coefficients are all zero, which is bad. 'shift' is
|
||||
* unset.
|
||||
*/
|
||||
int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_residual_from_qlp_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the residual signal obtained from sutracting the predicted
|
||||
* signal from the original.
|
||||
*
|
||||
* IN data[-order,data_len-1] original signal (NOTE THE INDICES!)
|
||||
* IN data_len length of original signal
|
||||
* IN qlp_coeff[0,order-1] quantized LP coefficients
|
||||
* IN order > 0 LP order
|
||||
* IN lp_quantization quantization of LP coefficients in bits
|
||||
* OUT residual[0,data_len-1] residual signal
|
||||
*/
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
# endif
|
||||
# endif
|
||||
# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
|
||||
# ifdef FLAC__SSE2_SUPPORTED
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
# endif
|
||||
# ifdef FLAC__SSE4_1_SUPPORTED
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
# endif
|
||||
# ifdef FLAC__AVX2_SUPPORTED
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
/*
|
||||
* FLAC__lpc_restore_signal()
|
||||
* --------------------------------------------------------------------
|
||||
* Restore the original signal by summing the residual and the
|
||||
* predictor.
|
||||
*
|
||||
* IN residual[0,data_len-1] residual signal
|
||||
* IN data_len length of original signal
|
||||
* IN qlp_coeff[0,order-1] quantized LP coefficients
|
||||
* IN order > 0 LP order
|
||||
* IN lp_quantization quantization of LP coefficients in bits
|
||||
* *** IMPORTANT: the caller must pass in the historical samples:
|
||||
* IN data[-order,-1] previously-reconstructed historical samples
|
||||
* OUT data[0,data_len-1] original signal
|
||||
*/
|
||||
void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_wide_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
# endif /* FLAC__HAS_NASM */
|
||||
# endif /* FLAC__CPU_IA32 */
|
||||
# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
|
||||
# ifdef FLAC__SSE2_SUPPORTED
|
||||
void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
# endif
|
||||
# ifdef FLAC__SSE4_1_SUPPORTED
|
||||
void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
# endif
|
||||
# endif
|
||||
#endif /* FLAC__NO_ASM */
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_expected_bits_per_residual_sample()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the expected number of bits per residual signal sample
|
||||
* based on the LP error (which is related to the residual variance).
|
||||
*
|
||||
* IN lpc_error >= 0.0 error returned from calculating LP coefficients
|
||||
* IN total_samples > 0 # of samples in residual signal
|
||||
* RETURN expected bits per sample
|
||||
*/
|
||||
double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, unsigned total_samples);
|
||||
double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(double lpc_error, double error_scale);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_best_order()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the best order from the array of signal errors returned
|
||||
* during coefficient computation.
|
||||
*
|
||||
* IN lpc_error[0,max_order-1] >= 0.0 error returned from calculating LP coefficients
|
||||
* IN max_order > 0 max LP order
|
||||
* IN total_samples > 0 # of samples in residual signal
|
||||
* IN overhead_bits_per_order # of bits overhead for each increased LP order
|
||||
* (includes warmup sample size and quantized LP coefficient)
|
||||
* RETURN [1,max_order] best order
|
||||
*/
|
||||
unsigned FLAC__lpc_compute_best_order(const double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order);
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
#endif
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2012-2016 Xiph.org Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__MACROS_H
|
||||
#define FLAC__PRIVATE__MACROS_H
|
||||
|
||||
#if defined(__GNUC__) && (defined(__clang__) || __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
|
||||
#define flac_max(a,b) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a > _b ? _a : _b; })
|
||||
|
||||
#define MIN_PASTE(A,B) A##B
|
||||
#define MIN_IMPL(A,B,L) ({ \
|
||||
__typeof__(A) MIN_PASTE(__a,L) = (A); \
|
||||
__typeof__(B) MIN_PASTE(__b,L) = (B); \
|
||||
MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); \
|
||||
})
|
||||
|
||||
#define flac_min(A,B) MIN_IMPL(A,B,__COUNTER__)
|
||||
|
||||
/* Whatever other unix that has sys/param.h */
|
||||
#elif defined(HAVE_SYS_PARAM_H)
|
||||
#include <sys/param.h>
|
||||
#define flac_max(a,b) MAX(a,b)
|
||||
#define flac_min(a,b) MIN(a,b)
|
||||
|
||||
/* Windows VS has them in stdlib.h.. XXX:Untested */
|
||||
#elif defined(_MSC_VER)
|
||||
#include <stdlib.h>
|
||||
#define flac_max(a,b) __max(a,b)
|
||||
#define flac_min(a,b) __min(a,b)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) <= (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) ((x) >= (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
#ifndef FLAC__PRIVATE__MD5_H
|
||||
#define FLAC__PRIVATE__MD5_H
|
||||
|
||||
/*
|
||||
* This is the header file for the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*
|
||||
* Changed so as no longer to depend on Colin Plumb's `usual.h'
|
||||
* header definitions; now uses stuff from dpkg's config.h
|
||||
* - Ian Jackson <ijackson@nyx.cs.du.edu>.
|
||||
* Still in the public domain.
|
||||
*
|
||||
* Josh Coalson: made some changes to integrate with libFLAC.
|
||||
* Still in the public domain, with no warranty.
|
||||
*/
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
typedef union {
|
||||
FLAC__byte *p8;
|
||||
FLAC__int16 *p16;
|
||||
FLAC__int32 *p32;
|
||||
} FLAC__multibyte;
|
||||
|
||||
typedef struct {
|
||||
FLAC__uint32 in[16];
|
||||
FLAC__uint32 buf[4];
|
||||
FLAC__uint32 bytes[2];
|
||||
FLAC__multibyte internal_buf;
|
||||
size_t capacity;
|
||||
} FLAC__MD5Context;
|
||||
|
||||
void FLAC__MD5Init(FLAC__MD5Context *context);
|
||||
void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context);
|
||||
|
||||
FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
|
||||
|
||||
#endif
|
||||
Loaded 100 of 1051 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user