mirror of
https://github.com/rodamaral/lsnes.git
synced 2025-04-02 10:42:15 -04:00
Compare commits
1286 commits
lsnes-rr2-
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
7d9b3e93ec | ||
|
3dee7b756a | ||
|
323db52b6b | ||
|
f49b82c989 | ||
|
6fd18bd0f0 | ||
|
b5f3e543d8 | ||
|
4c6338888d | ||
|
9318e4de94 | ||
|
298610752b | ||
|
f85cdab6c5 | ||
|
dd18168993 | ||
|
7be5215c08 | ||
|
8ac8304824 | ||
|
c2e40c4cd3 | ||
|
669381821e | ||
|
c5d441c6b0 | ||
|
5544b9ba12 | ||
|
4c9bb20270 | ||
|
eb6ff6c38b | ||
|
7903ba1fda | ||
|
40ac5d56e3 | ||
|
a3f1d7c8a4 | ||
|
d287f64c14 | ||
|
62ee8b0039 | ||
|
05ad5b9da1 | ||
|
019fbc2646 | ||
|
3da2e26e1b | ||
|
610685db0f | ||
|
6a580bb332 | ||
|
fa3e5b6751 | ||
|
813449ac1b | ||
|
ff697846d1 | ||
|
476f79f14a | ||
|
e9e00fd881 | ||
|
51bbbd1772 | ||
|
1834c61dfb | ||
|
5ab3b133a4 | ||
|
918dc6db7b | ||
|
97ba0292d6 | ||
|
d8048863e8 | ||
|
6d1a67719b | ||
|
5e73a844a9 | ||
|
4a4c71acf4 | ||
|
957738035f | ||
|
859d60513f | ||
|
7ada70888f | ||
|
250679f656 | ||
|
2e609624fa | ||
|
daa5ca41e9 | ||
|
4a4004d3f8 | ||
|
0b3743e258 | ||
|
73e0232176 | ||
|
d86f713aa4 | ||
|
52073af3ac | ||
|
1c48e0ab06 | ||
|
c5b368ab3f | ||
|
1056f4b4b2 | ||
|
80867950f3 | ||
|
88a00a2a84 | ||
|
2da23de987 | ||
|
0d83c3aba6 | ||
|
0960e967ea | ||
|
c2a7eed9d8 | ||
|
1dd19faaeb | ||
|
8bca9ce614 | ||
|
0c0156647b | ||
|
56deafcd4a | ||
|
82a7c255a4 | ||
|
6a2d7f9aa2 | ||
|
478472e883 | ||
|
f06eb401c4 | ||
|
f04379b03c | ||
|
a8bc4a2cf8 | ||
|
ae71090387 | ||
|
04d7e60fe1 | ||
|
15ff9e0cc8 | ||
|
8a794244be | ||
|
10eb0dbd22 | ||
|
eeaf3706d8 | ||
|
9aa8578e74 | ||
|
17efbec1a6 | ||
|
39286f820a | ||
|
653f44e353 | ||
|
a45baf5559 | ||
|
4d3d483a34 | ||
|
3571fb3e08 | ||
|
b7aedc6cd9 | ||
|
1bf49d532d | ||
|
a6b7391da5 | ||
|
8af9dda77f | ||
|
a1b96d75da | ||
|
2842b76907 | ||
|
c51cfe9099 | ||
|
71d649c487 | ||
|
ae3cb19a03 | ||
|
f2169b725f | ||
|
046bc221ef | ||
|
5f0d5dcdb0 | ||
|
3eb7585947 | ||
|
d7744e00e7 | ||
|
52dff27f3e | ||
|
93875839b9 | ||
|
929155f14d | ||
|
63b59e35f7 | ||
|
aade7a9fb8 | ||
|
fd65e1e435 | ||
|
8e95c54d68 | ||
|
e3fc1ed5fa | ||
|
94170ec2d5 | ||
|
ea78fecb1b | ||
|
19b12b1215 | ||
|
4e70e95e7f | ||
|
8967f3a261 | ||
|
7ece85f0c6 | ||
|
5f8f8af25f | ||
|
c86f10376a | ||
|
791684edc3 | ||
|
ff1004d7fa | ||
|
bdcf21a4e1 | ||
|
95ec8a8ba7 | ||
|
5c0f57448c | ||
|
773e84cfd7 | ||
|
44aa95cc57 | ||
|
54cbe456b4 | ||
|
94b603c9f2 | ||
|
1cb702bd5e | ||
|
7c7ee6637d | ||
|
5f0b9e3315 | ||
|
58e4ad1b94 | ||
|
2312324824 | ||
|
8d5783536a | ||
|
6e80331962 | ||
|
538128686a | ||
|
d507a05237 | ||
|
b3c0fc76f9 | ||
|
7584121717 | ||
|
792bb0867e | ||
|
43e2ce5906 | ||
|
d4c6bd3bbd | ||
|
162a57c950 | ||
|
2f9782fd9c | ||
|
8403744ba6 | ||
|
0346a1ea3e | ||
|
94732b0bc4 | ||
|
d09d301849 | ||
|
ac51bf61e8 | ||
|
201d65116a | ||
|
346ea41e0d | ||
|
680be72a8f | ||
|
71b57756ca | ||
|
f4c1bc6e84 | ||
|
50fd1b6b5f | ||
|
aff0370e35 | ||
|
667f7df3c1 | ||
|
f68459ac53 | ||
|
696cab4862 | ||
|
82b7c8d5e2 | ||
|
16da5396aa | ||
|
0e844d4720 | ||
|
9c484d819e | ||
|
4262be0b93 | ||
|
37d587da21 | ||
|
5dedb34943 | ||
|
b074cb2e31 | ||
|
0ae6981b5c | ||
|
dc0a6e1282 | ||
|
386405aace | ||
|
0ea814c0c3 | ||
|
03a57aa421 | ||
|
4d86f19837 | ||
|
0e29ab43eb | ||
|
a98208c284 | ||
|
4b44f8ee10 | ||
|
b6349a0980 | ||
|
03de099aae | ||
|
8e6eb72351 | ||
|
d19d0e8945 | ||
|
3146ec5352 | ||
|
60f9d3b217 | ||
|
514984671d | ||
|
9fdd0bdd38 | ||
|
028a51066c | ||
|
4ab23cfeb4 | ||
|
5ddf119ef0 | ||
|
c68048d029 | ||
|
15c57d7a8c | ||
|
3b2298180a | ||
|
5ee7962cb9 | ||
|
fb6d998d43 | ||
|
fe8b1166d4 | ||
|
42fef3336f | ||
|
5cfa21b622 | ||
|
b9131f852a | ||
|
b218c1aaa0 | ||
|
c330c9c42a | ||
|
212d554ad1 | ||
|
e2589db8b7 | ||
|
b0c08d3a9f | ||
|
3c2b0402b2 | ||
|
b5ed0f73b1 | ||
|
9a69dc3511 | ||
|
6639ab0437 | ||
|
d32b1697a6 | ||
|
0f51ad0b16 | ||
|
1dd52cc68b | ||
|
35f027fabf | ||
|
50215d8c01 | ||
|
4318618a8f | ||
|
4c5b582796 | ||
|
a00d357bef | ||
|
25d4f27a9b | ||
|
ebb3676505 | ||
|
b91a6ad5f4 | ||
|
0a51f53abc | ||
|
833866cb1a | ||
|
7893ed36e8 | ||
|
e3508934cd | ||
|
bf32d095a6 | ||
|
b7d0fe9eb1 | ||
|
2087db93e2 | ||
|
5c84507e22 | ||
|
72b5050a27 | ||
|
70b9d95c44 | ||
|
e4d6f3839b | ||
|
32d14ecfc0 | ||
|
351d0d0282 | ||
|
f0233fb7f2 | ||
|
e8fd0a29a4 | ||
|
4a005292d7 | ||
|
c3982c8902 | ||
|
a2f4ba6dfd | ||
|
b13e9ef12c | ||
|
99356caf71 | ||
|
3d3160c965 | ||
|
b6dac6c1ed | ||
|
b8b4233255 | ||
|
4afda2550e | ||
|
ae17d41df4 | ||
|
301198e98f | ||
|
7914d0bd70 | ||
|
8f54db2902 | ||
|
a2fed56d69 | ||
|
f62caa4b08 | ||
|
63dfbd59d6 | ||
|
0631826095 | ||
|
c87c5de458 | ||
|
99577e806a | ||
|
b021e7b5af | ||
|
7f271989d9 | ||
|
a30c8f0890 | ||
|
14a0862342 | ||
|
b8c72344c1 | ||
|
fc8484f984 | ||
|
bf00f42e0a | ||
|
5d27f23cb2 | ||
|
5f4924debc | ||
|
c34db9ef74 | ||
|
888afe8bcb | ||
|
bf0ca9b2f9 | ||
|
7e22f32429 | ||
|
86da0775e0 | ||
|
e6e3c71925 | ||
|
6ba5fdfca8 | ||
|
2e36040731 | ||
|
c634a74cf9 | ||
|
c3b1031498 | ||
|
77abaa2d98 | ||
|
aa7e15aa27 | ||
|
a2f6ba2b6f | ||
|
d7c6cd1905 | ||
|
6bad138d8b | ||
|
f89ecc3870 | ||
|
9baba2cc99 | ||
|
4829c852ad | ||
|
cf21744d00 | ||
|
f036ccd02d | ||
|
5266f96cfd | ||
|
11f231b9ee | ||
|
3d1d920fff | ||
|
cfc18e9e91 | ||
|
205b8eccdf | ||
|
ed7496cc88 | ||
|
a6a110bac9 | ||
|
88a526d9cd | ||
|
ee59859dd3 | ||
|
0a0cd049b1 | ||
|
1b2bd60455 | ||
|
f3c081da1e | ||
|
7b4eadbe3e | ||
|
878100b52c | ||
|
52864d3aaa | ||
|
95d1b5130f | ||
|
16663f7786 | ||
|
c5372a4826 | ||
|
f20d522c4c | ||
|
2d811d2b4e | ||
|
adb1b29c67 | ||
|
c5a31e85d8 | ||
|
f2de04266e | ||
|
7f586e55b6 | ||
|
7fb5407541 | ||
|
7834906157 | ||
|
606ce072a7 | ||
|
b6b5243abe | ||
|
2ffe0066c9 | ||
|
0b8e2f0a6b | ||
|
8b027be798 | ||
|
57d3b99ecd | ||
|
3066892e69 | ||
|
ff996c05b6 | ||
|
e6f1ea51b1 | ||
|
51bb860c85 | ||
|
b1fbb804c8 | ||
|
aad393c4ba | ||
|
e21ced3adb | ||
|
2f7089da5f | ||
|
927467b6ec | ||
|
436b5c4238 | ||
|
9bcdcdcb13 | ||
|
3a61504580 | ||
|
986640b6ba | ||
|
b601b18bf6 | ||
|
29ee02309b | ||
|
9f7c5523d7 | ||
|
3a85ccc506 | ||
|
6c9d34123d | ||
|
670f92c3f8 | ||
|
1cd3e3d004 | ||
|
04575a789b | ||
|
a77c6a4df6 | ||
|
ba3446697e | ||
|
f41142ea16 | ||
|
3ca96fb1b0 | ||
|
d47959b618 | ||
|
6f35061747 | ||
|
66839ba82f | ||
|
30d7196cd4 | ||
|
d2334af286 | ||
|
ab9c568062 | ||
|
8851cec1cc | ||
|
4eb217e766 | ||
|
8eb23a34ca | ||
|
7f8fd7b393 | ||
|
f4c6c6e322 | ||
|
635e1fac44 | ||
|
6ced0ce890 | ||
|
04ba635f1a | ||
|
21dbab5a77 | ||
|
97ecbe06f0 | ||
|
4099291b35 | ||
|
3e4c03d114 | ||
|
ee0d0089dc | ||
|
4be906fa36 | ||
|
6f65559571 | ||
|
b57e6d5eda | ||
|
d95f247e9f | ||
|
ee6b522395 | ||
|
5ee9514791 | ||
|
c84a8125c9 | ||
|
dcd9bec1fc | ||
|
46feccd206 | ||
|
e9e9fd4394 | ||
|
4e29357123 | ||
|
24af115b47 | ||
|
c961f78f03 | ||
|
40d5f30d1c | ||
|
965cc73bfa | ||
|
6af073792a | ||
|
ffcdc987bd | ||
|
579c20988a | ||
|
192d876e96 | ||
|
9ccd279646 | ||
|
45388e8ee2 | ||
|
7f0da4d4eb | ||
|
3b5ccbaf36 | ||
|
7534bf66d9 | ||
|
499e85fbab | ||
|
e10a2fcfe5 | ||
|
6fc0cf9cf6 | ||
|
be838db972 | ||
|
175a080382 | ||
|
f4102dc311 | ||
|
a3c81eec0c | ||
|
a0d293a7b6 | ||
|
4560782668 | ||
|
c594082dfa | ||
|
ceed4f622f | ||
|
acb0c481a5 | ||
|
ebf7a1e90e | ||
|
91f63c4d63 | ||
|
2e8c828f05 | ||
|
dffb2d614b | ||
|
2e4d9098cd | ||
|
602166c5d3 | ||
|
4ffdbdd695 | ||
|
119fefedd4 | ||
|
4c952beb3b | ||
|
0e0989b568 | ||
|
3752a3f8a2 | ||
|
d7daa8963c | ||
|
f2e1930909 | ||
|
ff45e27d5e | ||
|
154abcb8d7 | ||
|
d533647560 | ||
|
3bd8f21369 | ||
|
12c9a5fdfb | ||
|
5f5e709cb1 | ||
|
b14bc7a3a7 | ||
|
9754bbc5f4 | ||
|
9e0277636f | ||
|
f4d7b6cf73 | ||
|
5cc3661437 | ||
|
47b5e9b6be | ||
|
d210680315 | ||
|
59300d2339 | ||
|
5745859815 | ||
|
5d0fb0f39a | ||
|
7ba7fc24f6 | ||
|
e0827ce54f | ||
|
2498bad58d | ||
|
7a1e20e9db | ||
|
4a027d5f4e | ||
|
c50c458bd1 | ||
|
7d4a8b3742 | ||
|
c9777bba18 | ||
|
b367334238 | ||
|
b0503ad245 | ||
|
1b844492c7 | ||
|
45ab432c61 | ||
|
80d4f30ee2 | ||
|
5562a2fc2c | ||
|
bc6b3adc6c | ||
|
39d2ecaa62 | ||
|
debb6dd421 | ||
|
2592a724bc | ||
|
3ab62196fd | ||
|
efa7a3bb4e | ||
|
97f72c2952 | ||
|
99475b2a0b | ||
|
32f2e2ce81 | ||
|
4f0e636b9b | ||
|
2823958ffb | ||
|
896b7144b8 | ||
|
5a0ccb1401 | ||
|
9a1895eaea | ||
|
e1c890de1d | ||
|
b7cf3921e0 | ||
|
92465b929f | ||
|
a26de8a081 | ||
|
57992947ae | ||
|
1436aa7d3d | ||
|
f73e59688c | ||
|
7f511cd1f7 | ||
|
2325e501b3 | ||
|
34aa56d429 | ||
|
4556e01edf | ||
|
cfbccd9518 | ||
|
2af2a30e6a | ||
|
6e93d2c786 | ||
|
d6cfb451b7 | ||
|
8226514183 | ||
|
a0ac5a3b84 | ||
|
432185f37d | ||
|
455d43b2ba | ||
|
89f31f328b | ||
|
e44468f426 | ||
|
8a430a657e | ||
|
aa420b8297 | ||
|
1d72c3c4f8 | ||
|
76c9599369 | ||
|
08b41877a3 | ||
|
defb1cba72 | ||
|
960fd4f892 | ||
|
733881d232 | ||
|
fc95e85126 | ||
|
1994af1d09 | ||
|
bad1141c65 | ||
|
bb40d868f6 | ||
|
75d15409f9 | ||
|
02749cc650 | ||
|
c685319f88 | ||
|
c1699a0c8c | ||
|
fa8b07b4d8 | ||
|
0f6bf458d8 | ||
|
89b8cd91f4 | ||
|
9bd1791701 | ||
|
ccc7fa2fba | ||
|
8438774606 | ||
|
ef1f61a6e7 | ||
|
b53979bcd1 | ||
|
9b05adcf35 | ||
|
d1176cbf9e | ||
|
a8fa742a36 | ||
|
ee254e311e | ||
|
f35e68a11a | ||
|
17d27a2a9a | ||
|
0e0ca079fa | ||
|
783d20f690 | ||
|
c22040dac8 | ||
|
6341415723 | ||
|
799549530a | ||
|
6ebc1563eb | ||
|
18ca96bda8 | ||
|
a52f1a5afa | ||
|
89aab3b1db | ||
|
8bae3615ab | ||
|
ef140f3324 | ||
|
a50cadb1a8 | ||
|
3e92462a3d | ||
|
aa6579b10c | ||
|
369d604254 | ||
|
ceb35eb72c | ||
|
d9b70e893d | ||
|
3e8eed0ac1 | ||
|
137656ce0c | ||
|
a2407c4e79 | ||
|
2e4502896f | ||
|
8670a7b01d | ||
|
9a9f58d747 | ||
|
a2a8fad24e | ||
|
1fd5a490bf | ||
|
02eed4668c | ||
|
67ed92de33 | ||
|
85d78e2632 | ||
|
5f6b59b766 | ||
|
cb5a9898be | ||
|
53d7bbd633 | ||
|
59113ed24d | ||
|
75838b9212 | ||
|
598ecc6542 | ||
|
ebb1779e29 | ||
|
d4a7b65df8 | ||
|
a848e9d154 | ||
|
53d82395c0 | ||
|
bb6bf9ca26 | ||
|
ccb6d4b4be | ||
|
1800453c4f | ||
|
b7ea7bb2c7 | ||
|
82a1ce3c9c | ||
|
d5e75bbb61 | ||
|
eb820c442e | ||
|
16ed1f9e7f | ||
|
764abbaeaf | ||
|
bdca062ba8 | ||
|
676dfe7ac8 | ||
|
94114f1e2e | ||
|
4caf44e057 | ||
|
fa9971c2a0 | ||
|
b54a776f13 | ||
|
1da06a7675 | ||
|
156a23782a | ||
|
ce0c625072 | ||
|
2bc837dbf5 | ||
|
91c765a0a7 | ||
|
4bb75bc30e | ||
|
56c15a59a3 | ||
|
dffe0de67e | ||
|
31ff9a4b8f | ||
|
a727d47a0c | ||
|
a9bc132e20 | ||
|
26c0d38955 | ||
|
65267f8ebd | ||
|
0a41e8d901 | ||
|
c0faaf1fce | ||
|
2e0f2a359a | ||
|
57c2adb511 | ||
|
af4cab15ce | ||
|
e42a606ae8 | ||
|
a6ed9aad0b | ||
|
d72711e7cb | ||
|
8492f6029d | ||
|
7b5c281d7f | ||
|
9620390514 | ||
|
848a0eef1e | ||
|
ba08f9a792 | ||
|
561cca5efc | ||
|
b375df6102 | ||
|
8b5b33c422 | ||
|
c7bdac819d | ||
|
89a9363e6f | ||
|
1a0f0448e8 | ||
|
1c2885fc12 | ||
|
5b76990e97 | ||
|
34eaba54a2 | ||
|
64d498b74e | ||
|
e677ebee61 | ||
|
c6d744b867 | ||
|
5c3682f445 | ||
|
0d39cfc692 | ||
|
f4eb4e3073 | ||
|
d2e3cf9927 | ||
|
b74d47ae5b | ||
|
8e6d005f15 | ||
|
3f14664f0c | ||
|
00b961bb55 | ||
|
f032ae3b60 | ||
|
a1fb86eddc | ||
|
5a0fdd430f | ||
|
68a360ee6a | ||
|
43952138a3 | ||
|
f52c20895a | ||
|
42f8862283 | ||
|
b6143a6125 | ||
|
2d87514d4b | ||
|
53a7777723 | ||
|
36f56232b5 | ||
|
57a36002d8 | ||
|
b5aaf93f07 | ||
|
92c1c776cc | ||
|
371c6fd9e3 | ||
|
2ce7872f39 | ||
|
634e9bafe0 | ||
|
59a5b4eefa | ||
|
78cade7daa | ||
|
299a4c0e3c | ||
|
94a0f1d6b0 | ||
|
2c4a3a5f84 | ||
|
9df05e03a9 | ||
|
007ef21d7a | ||
|
51aae81c78 | ||
|
d610c305cf | ||
|
f3dd0ddc7d | ||
|
1f8e008d6e | ||
|
327c3197c4 | ||
|
1bcbae1163 | ||
|
0416962afa | ||
|
040f8ebc63 | ||
|
db80bea7a5 | ||
|
94f3bfa1df | ||
|
10dbbf278d | ||
|
dce933b76d | ||
|
4a58db3c25 | ||
|
69f06ce1b0 | ||
|
8383dbe580 | ||
|
f89395dbc1 | ||
|
dd486e7ff8 | ||
|
0cf09e958d | ||
|
6256506884 | ||
|
99b526335c | ||
|
3dc116b430 | ||
|
c9636bc63d | ||
|
b9298b78b1 | ||
|
f5184c4fd1 | ||
|
7e8a777f5a | ||
|
59439aa28b | ||
|
cd80fa3ebf | ||
|
00b8a193a0 | ||
|
fcd06b8b1a | ||
|
a81e59a1f7 | ||
|
cae6687242 | ||
|
7244f45f0b | ||
|
53b612265b | ||
|
56c1282e48 | ||
|
76b8349abe | ||
|
bb32cf2a22 | ||
|
d91a1254b0 | ||
|
6256f1b0c9 | ||
|
670031cea3 | ||
|
1ab4da5d73 | ||
|
cc0d79566a | ||
|
aaa3634d1a | ||
|
be7f8ef115 | ||
|
b8b982871d | ||
|
4645fd0e2f | ||
|
e28121a0e1 | ||
|
3bf658c5ea | ||
|
29197e124d | ||
|
c367bf1f9b | ||
|
ced144784a | ||
|
4b9ae1fbb5 | ||
|
75a0f641f4 | ||
|
5ccdb1be8c | ||
|
68e5fddf63 | ||
|
8e154f30a0 | ||
|
f04224ecf2 | ||
|
c8932decef | ||
|
6eda3fceee | ||
|
34011352b7 | ||
|
a97bf29232 | ||
|
82bbf9f5c1 | ||
|
02965a8adb | ||
|
1e055b17b2 | ||
|
c7acd46352 | ||
|
b46f4153c6 | ||
|
fa854a2bd6 | ||
|
d0f5b8ece9 | ||
|
d92b321d16 | ||
|
8c2fdff4c8 | ||
|
1ac35c2773 | ||
|
3ab4db9aeb | ||
|
74f8723fa8 | ||
|
2f301e1502 | ||
|
a271756c06 | ||
|
fb8910cda5 | ||
|
ef0eca0caf | ||
|
4e082a0150 | ||
|
3a77967619 | ||
|
2fb3f201dc | ||
|
6e729a5595 | ||
|
64557c2245 | ||
|
5661c7ca59 | ||
|
3cae98e8a5 | ||
|
2ca99739ae | ||
|
e48213f1b9 | ||
|
50e3a3e0f6 | ||
|
1d2df8ebea | ||
|
4f3df85a46 | ||
|
182accd4b2 | ||
|
cda917a45a | ||
|
b9e3a36588 | ||
|
99130e1f21 | ||
|
b3417018d4 | ||
|
ff59cb6e91 | ||
|
84f0d2f774 | ||
|
d3eee55445 | ||
|
8de45f693e | ||
|
a471680ec9 | ||
|
4bcbbb7691 | ||
|
ed8a251b6e | ||
|
7101af82fa | ||
|
88dc3f0108 | ||
|
45447e3c14 | ||
|
f19fea0ea4 | ||
|
ecd8b74ee1 | ||
|
72cc54876a | ||
|
7afdb33c8f | ||
|
75f90891f6 | ||
|
163909f907 | ||
|
54c257fbbf | ||
|
0bc6e39301 | ||
|
93056a1993 | ||
|
01a8f5521c | ||
|
1561b33dea | ||
|
861caf2256 | ||
|
379db3d4a8 | ||
|
4f674a1a1f | ||
|
8afef341d3 | ||
|
3373dcd53c | ||
|
4c8f9c04d2 | ||
|
504dcb912e | ||
|
ae643213e9 | ||
|
e8c868c7d9 | ||
|
1eda43114c | ||
|
ecd872d6c3 | ||
|
afbc8ae932 | ||
|
7c1acd2219 | ||
|
06f099f877 | ||
|
a41894d5d3 | ||
|
3657e593d6 | ||
|
68e8630308 | ||
|
1110596977 | ||
|
59ef6961e3 | ||
|
a42c0bf6ea | ||
|
22cba85a37 | ||
|
ba1d20dda5 | ||
|
513534a53a | ||
|
837aa6def0 | ||
|
2bd43d53d5 | ||
|
e1579c3746 | ||
|
e4f656185f | ||
|
e80185a8b9 | ||
|
b3b14a6a0d | ||
|
6772bcf8d2 | ||
|
92093e7062 | ||
|
8301de15b2 | ||
|
5568de778c | ||
|
9a714d0c7f | ||
|
01c6855072 | ||
|
69b1fd05b2 | ||
|
40578782dc | ||
|
53674105c1 | ||
|
2477d45f29 | ||
|
a6c13a7c9d | ||
|
982c617a4d | ||
|
a48b226af5 | ||
|
70ad5377b8 | ||
|
702a4b8c4b | ||
|
d25f5bbe78 | ||
|
83dcbee83a | ||
|
82440c44bb | ||
|
2168f85b30 | ||
|
4bfb16ea6c | ||
|
c253b2a165 | ||
|
ffb68eb4fb | ||
|
f1a3b105f2 | ||
|
c0f19435e4 | ||
|
61482629ee | ||
|
d0bf4e220a | ||
|
2f80b044a5 | ||
|
67484f1ea5 | ||
|
f054cfb61c | ||
|
a7e78b4aea | ||
|
dda9460c3d | ||
|
13eee961a7 | ||
|
06f3f37626 | ||
|
f9e0abd0bd | ||
|
e10a7ccbd4 | ||
|
f4f052589b | ||
|
d782eb0125 | ||
|
f6efcdef24 | ||
|
85cf485807 | ||
|
0d01d22d83 | ||
|
a355917b70 | ||
|
da20b6d0cf | ||
|
430f1a1afc | ||
|
b3d7dc5786 | ||
|
0ac78762a2 | ||
|
bf0d0b7ac0 | ||
|
995dcf1cf2 | ||
|
4d5a088496 | ||
|
dbbf274110 | ||
|
0e479a907b | ||
|
ef3509cbcf | ||
|
c3701056c6 | ||
|
fa18a739e0 | ||
|
6a0f9750b2 | ||
|
1909357f99 | ||
|
e7472118a5 | ||
|
9092dea931 | ||
|
17f8603ec5 | ||
|
ae7f99b49c | ||
|
7026453768 | ||
|
e2b08d9c83 | ||
|
e4db2486b5 | ||
|
c4bcddbfbd | ||
|
4feb4b6290 | ||
|
a38ce6b99e | ||
|
ccd4c2d5b8 | ||
|
76c9e338c5 | ||
|
065b59cd64 | ||
|
782caddfa8 | ||
|
707c1a4041 | ||
|
29fbf12e90 | ||
|
d4698e6380 | ||
|
9ebf20f19c | ||
|
e6884c194c | ||
|
29f25ce1cb | ||
|
5298eb04f1 | ||
|
156974f362 | ||
|
be852e63e1 | ||
|
408002eec1 | ||
|
07d3065afc | ||
|
0192d46adb | ||
|
9f9bddccb6 | ||
|
e3bcf53676 | ||
|
d7dc71a6e4 | ||
|
208228bc7e | ||
|
212c819416 | ||
|
f79359a526 | ||
|
3876f60183 | ||
|
11655fb0d8 | ||
|
3b1383232e | ||
|
11b83ef0ff | ||
|
b3f8f7f1b7 | ||
|
da1fb14e24 | ||
|
e2ecb61db0 | ||
|
f4fd9cfa09 | ||
|
7b67bfaac4 | ||
|
2fcd8b391d | ||
|
7da4621285 | ||
|
89c4f45f36 | ||
|
e436cabd72 | ||
|
3cb5d08c86 | ||
|
25f63a8c09 | ||
|
b66c3b4777 | ||
|
9f546c38a9 | ||
|
750608ad56 | ||
|
0a3fc9ccc6 | ||
|
78c6ea99df | ||
|
75e5d53912 | ||
|
32b98a880c | ||
|
85d48a9349 | ||
|
eaf3d4be72 | ||
|
eb7c213985 | ||
|
05d25513fb | ||
|
7b7a96bfa3 | ||
|
7a89929868 | ||
|
2308401234 | ||
|
19040b2033 | ||
|
2b1ffb9f17 | ||
|
45300b3a2b | ||
|
12ec5a9dcf | ||
|
75b3e79ea7 | ||
|
a2fc2a19ec | ||
|
d23d312e78 | ||
|
2095d7858e | ||
|
59710f8f38 | ||
|
79dd270a7e | ||
|
cd9ee7be69 | ||
|
7186e515ff | ||
|
740eaf17de | ||
|
8c7e8a1636 | ||
|
6d6570ecea | ||
|
d8ab482470 | ||
|
15679e0776 | ||
|
d84b665333 | ||
|
53b75adcf2 | ||
|
d10c863a56 | ||
|
a149c67c40 | ||
|
ff86d2f0c2 | ||
|
a8a1f09e94 | ||
|
319d23ca69 | ||
|
da6d1256d2 | ||
|
5923c4def6 | ||
|
6e2b56ddbb | ||
|
b9f44d4f20 | ||
|
9275e5cb93 | ||
|
97e47ccb9b | ||
|
284d3d78c1 | ||
|
9bcb9c7760 | ||
|
4c0dde5678 | ||
|
8fe4f70d9a | ||
|
95bbae153e | ||
|
eed387af93 | ||
|
9d440ace13 | ||
|
338a1d8a1b | ||
|
ac06feeeba | ||
|
b10a560611 | ||
|
5386986129 | ||
|
9538f19c92 | ||
|
ec23d31819 | ||
|
a111afad42 | ||
|
7616cccb7a | ||
|
84faf2f42e | ||
|
08e5f6acc9 | ||
|
6ce7b3dc7b | ||
|
b9fedf0dde | ||
|
2995be7f12 | ||
|
839304f701 | ||
|
2874a1e7c5 | ||
|
cd8b2e7d39 | ||
|
b221e29552 | ||
|
bcecac1e66 | ||
|
c6025beccb | ||
|
c1c5a3f84d | ||
|
30fe476014 | ||
|
fbf7c48b84 | ||
|
992096c8c5 | ||
|
511a2aef1c | ||
|
f87a5fd453 | ||
|
3206d206fe | ||
|
9ac0d00d17 | ||
|
0cf62d0d58 | ||
|
5fb06d7e78 | ||
|
14327834ce | ||
|
dfd0453feb | ||
|
83b91168d3 | ||
|
64683d6908 | ||
|
081adfb565 | ||
|
1866f480b2 | ||
|
f091268ef4 | ||
|
bd592f223d | ||
|
3e2e4379dc | ||
|
985e4c6327 | ||
|
015bd796f6 | ||
|
e31084cc2b | ||
|
1ee295f6de | ||
|
0658872a7f | ||
|
0243e3fc53 | ||
|
b404184412 | ||
|
1be1d0ff72 | ||
|
7f6468ce03 | ||
|
3bcddd27cc | ||
|
d531dc6afc | ||
|
54ebc86762 | ||
|
2b7268a0dc | ||
|
7039c28305 | ||
|
b9f20f2d35 | ||
|
6fc02d459b | ||
|
93d0263404 | ||
|
8affdb3edc | ||
|
b4ad4adc09 | ||
|
64a4317818 | ||
|
a539c58cee | ||
|
c366723065 | ||
|
6c77539a93 | ||
|
2c89ce8f60 | ||
|
059f1f37d7 | ||
|
1a8a4b049a | ||
|
c233f88c2a | ||
|
c11b6de9e1 | ||
|
bb9d6a8ce2 | ||
|
19828f169b | ||
|
fd16f6f6eb | ||
|
2cf05458bc | ||
|
b0edee81c8 | ||
|
192ac85aa2 | ||
|
69597313e6 | ||
|
2f868547df | ||
|
6029a92914 | ||
|
a2cbad39ab | ||
|
c725e4e874 | ||
|
6677ef19b1 | ||
|
9dc12ae746 | ||
|
8b1b021d00 | ||
|
d88cb4fb15 | ||
|
d1c8435fa2 | ||
|
96c1f417c5 | ||
|
acec789323 | ||
|
30943200fe | ||
|
1daca22d81 | ||
|
8c4b8e1605 | ||
|
0b8ab9324c | ||
|
9f7008bf2a | ||
|
3f493d24d1 | ||
|
089602bd77 | ||
|
3ded324737 | ||
|
9a1cbc2207 | ||
|
f051aabb57 | ||
|
bce5e8a936 | ||
|
6fe837ab48 | ||
|
9fdb5b0deb | ||
|
efbc60d494 | ||
|
04f32ca48a | ||
|
92fe2c0c92 | ||
|
a77781f9fb | ||
|
9013904da3 | ||
|
c37d2c69ad | ||
|
7f823a21a3 | ||
|
fa65332496 | ||
|
45e7712234 | ||
|
9201705087 | ||
|
27fd5df59e | ||
|
c5a5a4059d | ||
|
485558d148 | ||
|
3c3d3051b3 | ||
|
e8d32ed930 | ||
|
3ab8f196ec | ||
|
a85619270d | ||
|
f1399d2f2e | ||
|
b7e3329db3 | ||
|
81145d38ea | ||
|
4a482d22c1 | ||
|
c75596f7e4 | ||
|
b53f647315 | ||
|
99b666f790 | ||
|
e75667068a | ||
|
b7dfe28ae1 | ||
|
185085a019 | ||
|
4f92b11336 | ||
|
6494536334 | ||
|
f32e593912 | ||
|
1d9fdedbb3 | ||
|
254e49c476 | ||
|
fade785bc4 | ||
|
7ee2c4ddb6 | ||
|
7d0acfbaec | ||
|
bfaf627c66 | ||
|
bd39b322ce | ||
|
53d436f399 | ||
|
f7b6602f10 | ||
|
e60af4d32c | ||
|
cf19dc3335 | ||
|
65218e0894 | ||
|
31434a691d | ||
|
3ae089cf05 | ||
|
03c03fc4c1 | ||
|
ccf3ca8ba9 | ||
|
e27a06f7c3 | ||
|
3e1836453b | ||
|
31e05b501d | ||
|
d0858038fd | ||
|
2e00c726f0 | ||
|
145b7e3dbe | ||
|
73fd1d4737 | ||
|
3e8f02fcaf | ||
|
5b0f5b25f9 | ||
|
92adf8519c | ||
|
3c2aefdc06 | ||
|
8bbf432ada | ||
|
cc366d3de0 | ||
|
ba6efda53e | ||
|
688f75e261 | ||
|
98b940db3c | ||
|
9c6df350bd | ||
|
ab9080294c | ||
|
c1c9c1d2b2 | ||
|
b534131f21 | ||
|
34e83828c3 | ||
|
058a63c7c0 | ||
|
282dfe02a3 | ||
|
84d8770486 | ||
|
c89be21bdf | ||
|
3e48ffcf98 | ||
|
f38671a3e2 | ||
|
2c2591501b | ||
|
dea02b366d | ||
|
f114762b87 | ||
|
d66adf9602 | ||
|
f88b3eaee5 | ||
|
67c78124d5 | ||
|
3b92a5eb72 | ||
|
43145be27a | ||
|
8f57ae5834 | ||
|
00f5754ef7 | ||
|
b53fb1fe75 | ||
|
5d9131d2dc | ||
|
acb377cc83 | ||
|
4637efb9b7 | ||
|
22826009b3 | ||
|
491edbd34c | ||
|
5d3b142d21 | ||
|
6812037774 | ||
|
cfd129d86b | ||
|
40ef521f82 | ||
|
f8705fa56c | ||
|
ff0a484fb2 | ||
|
2fae20cdad | ||
|
d9a5332df9 | ||
|
efc06d1f10 | ||
|
dca767f650 | ||
|
458343b390 | ||
|
f01505a910 | ||
|
c913e473bb | ||
|
ecbadcc148 | ||
|
9492b81d28 | ||
|
27f7cda29a | ||
|
3022e04740 | ||
|
ee3a232e37 | ||
|
3880648ec8 | ||
|
51800c72a9 | ||
|
02039ee3bd | ||
|
5ec61c864f | ||
|
03d1ec9aae | ||
|
ec76e05b50 | ||
|
caa216c290 | ||
|
2004486a1e | ||
|
aa9881278e | ||
|
a103052222 | ||
|
ff8e220fb7 | ||
|
1295518041 | ||
|
236b9075d9 | ||
|
80c9dcee2d | ||
|
93758678b7 | ||
|
615d525fa6 | ||
|
60404062a5 | ||
|
4084b1c16b | ||
|
db28464d61 | ||
|
7beef32a8a | ||
|
a88ae3a8a3 | ||
|
0c711d4c6c | ||
|
b64d10a171 | ||
|
698dfdde1c | ||
|
d7531086e3 | ||
|
80a0ddf5c0 | ||
|
579b52e3aa | ||
|
870102d3ce | ||
|
c53339a31d | ||
|
e83cc21e8a | ||
|
a3ecd5ca9d | ||
|
a8392eeecc | ||
|
a22a31c33e | ||
|
1732705e62 | ||
|
629beb01d5 | ||
|
3e1cce95d2 | ||
|
67c41463b9 | ||
|
b9968d0bdd | ||
|
15f597939f | ||
|
90a5f80232 | ||
|
408ea46268 | ||
|
2a3efcd229 | ||
|
063edaf9a5 | ||
|
7e091d2cf5 | ||
|
60f2801ecf | ||
|
2bcb022f95 | ||
|
c9e05a607a | ||
|
363e7c7a3c | ||
|
bf3255e315 | ||
|
ac6bb35fa3 | ||
|
0b4459cafc | ||
|
02bddef57e | ||
|
be616a5316 | ||
|
aa1e6f184a | ||
|
ac954193c6 | ||
|
6b1097edbe | ||
|
c0d3d7fd2f | ||
|
4413ffe901 | ||
|
8a80c86684 | ||
|
cf365d181e | ||
|
3917c41b6b | ||
|
118eb3fbdf | ||
|
891235f5d4 | ||
|
3cbfd67ddb | ||
|
719d90956d | ||
|
c6424efa7f | ||
|
cc31d0ea86 | ||
|
368564d040 | ||
|
1e64ba0c6b | ||
|
833a16437f | ||
|
5a5968511c | ||
|
90d5fff406 | ||
|
91d096984f | ||
|
c7272f39d4 | ||
|
891d10fcc6 | ||
|
feaa527e2a | ||
|
f819fe8510 | ||
|
43a6d1012f | ||
|
9f8a7ccdd9 | ||
|
ed22b1acab | ||
|
c0bf2046d4 | ||
|
f7fc235e25 | ||
|
a0682ca5ba | ||
|
cc67a7f887 | ||
|
1e29e41577 | ||
|
463eacedf1 | ||
|
4e2db8416d | ||
|
0925eea4cc | ||
|
4feed2304e | ||
|
62cb6c0727 | ||
|
4a1838427e | ||
|
590b7fb927 | ||
|
1cc8a3dc92 | ||
|
a1b1dd8d65 | ||
|
4e7d763abb | ||
|
e032662a38 | ||
|
ccb4d67074 | ||
|
e5b9a62194 | ||
|
124238cea7 | ||
|
ea2042acfd | ||
|
e7fd247c07 | ||
|
5eaa80a5f2 | ||
|
ca63bd5bea | ||
|
dfe18d2a4d | ||
|
f9415b0154 | ||
|
9560c66bf4 | ||
|
c3ae963cbe | ||
|
3eea885a64 | ||
|
010c337fa9 | ||
|
3539fc508d | ||
|
1d6cf64908 | ||
|
8e88ad35b3 | ||
|
bcdb9dd9f8 | ||
|
8c346c0695 | ||
|
531c0d0635 | ||
|
5d08c36390 | ||
|
86d4f99da9 | ||
|
246f0e32b9 | ||
|
b928596e09 | ||
|
0b45d38af1 | ||
|
5171900b43 | ||
|
33ad2fcc12 | ||
|
c065f0398f | ||
|
0fa3109116 | ||
|
c5d45840ed | ||
|
23b5f9891e | ||
|
1297f683e0 | ||
|
a116622b32 | ||
|
ee3035cacc | ||
|
c168be8562 | ||
|
422e90b7d6 | ||
|
ed77f5a4e0 | ||
|
2526414a53 | ||
|
bd14e31e57 | ||
|
5c3e48348b | ||
|
fa3211f87f | ||
|
ab204556da | ||
|
10bff4a0c3 | ||
|
242ce42bb7 | ||
|
ecfec8a1f4 | ||
|
0763a00bef | ||
|
c9e038f902 | ||
|
bbe8f0b0fd | ||
|
b764bd3c62 | ||
|
865a450a43 | ||
|
312c3a8944 | ||
|
0cf0681c1d | ||
|
9dc3284969 | ||
|
03b060de89 | ||
|
5efecc7041 | ||
|
41ca0a3051 | ||
|
8770824c15 | ||
|
ad997c36bd | ||
|
13f69fac09 | ||
|
b322011ee2 | ||
|
8578b8812a | ||
|
0186929e64 | ||
|
6e013653cb | ||
|
4467f693f5 | ||
|
e9a3787344 | ||
|
0dacba56a3 | ||
|
2caf7001dc | ||
|
0da8befb8d | ||
|
17ff101f9d | ||
|
389ec0f63d | ||
|
b2be07750f | ||
|
f89a2caa52 |
677 changed files with 133997 additions and 36458 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -3,7 +3,9 @@
|
|||
*.lib
|
||||
*.obj
|
||||
*.exe
|
||||
*.dep
|
||||
*.ldflags
|
||||
*.files
|
||||
docs
|
||||
rom
|
||||
lsnes
|
||||
|
@ -13,3 +15,9 @@ lsnes
|
|||
/gambatte
|
||||
src/fonts/font.cpp
|
||||
src/core/version.cpp
|
||||
src/cmdhelp/*.cpp
|
||||
include/cmdhelp/*.hpp
|
||||
src/emulation/make-ports
|
||||
src/cmdhelp/mkstubs
|
||||
src/cmdhelp/mkstubsi
|
||||
buildaux/mkdeps
|
||||
|
|
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
[submodule "bsnes"]
|
||||
path = bsnes
|
||||
url = ./
|
||||
[submodule "gambatte"]
|
||||
path = gambatte
|
||||
url = ./
|
56
Makefile
56
Makefile
|
@ -12,14 +12,16 @@ REALRANLIB = $(CROSS_PREFIX)$(RANLIB)
|
|||
|
||||
#Flags.
|
||||
HOSTCCFLAGS = -std=gnu++0x
|
||||
CFLAGS += -std=gnu++0x $(USER_CFLAGS)
|
||||
CFLAGS += -std=gnu++0x -pthread $(USER_CFLAGS)
|
||||
ifdef BOOST_NEEDS_MT
|
||||
BOOST_LIB_POSTFIX=-mt
|
||||
else
|
||||
BOOST_LIB_POSTFIX=
|
||||
endif
|
||||
ifdef HOST_BOOST_NEEDS_MT
|
||||
HOST_BOOST_POSTFIX=-mt
|
||||
endif
|
||||
|
||||
LDFLAGS = -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lboost_regex$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
|
||||
LDFLAGS = -pthread -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
|
||||
HOSTHELPER_LDFLAGS =
|
||||
|
||||
ifeq ($(THREADS), NATIVE)
|
||||
CFLAGS += -DNATIVE_THREADS
|
||||
|
@ -32,6 +34,33 @@ $(error "Bad value for THREADS (expected NATIVE or BOOST)")
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(REGEX), BOOST)
|
||||
CFLAGS += -DUSE_BOOST_REGEX
|
||||
LDFLAGS += -lboost_regex$(BOOST_LIB_POSTFIX)
|
||||
HOSTHELPER_LDFLAGS += -lboost_regex$(HOST_BOOST_POSTFIX)
|
||||
endif
|
||||
HOSTHELPER_LDFLAGS += -lboost_system$(HOST_BOOST_POSTFIX)
|
||||
|
||||
|
||||
ifdef NEED_LIBICONV
|
||||
LDFLAGS += -liconv
|
||||
endif
|
||||
|
||||
ifdef USE_LIBGCRYPT
|
||||
CFLAGS += -DUSE_LIBGCRYPT_SHA256
|
||||
LDFLAGS += -lgcrypt -lgpg-error
|
||||
endif
|
||||
|
||||
ifdef USE_LIBLZMA
|
||||
CFLAGS += -DLIBLZMA_AVAILABLE
|
||||
LDFLAGS += -llzma
|
||||
endif
|
||||
|
||||
ifeq ($(ARCHITECTURE), I386)
|
||||
CFLAGS += -DARCH_IS_I386
|
||||
else
|
||||
endif
|
||||
|
||||
|
||||
export
|
||||
|
||||
|
@ -39,6 +68,8 @@ all: src/__all_files__
|
|||
|
||||
CFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --cflags)
|
||||
LDFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --libs)
|
||||
CFLAGS += $(shell $(CROSS_PREFIX)curl-config --cflags)
|
||||
LDFLAGS += $(shell $(CROSS_PREFIX)curl-config --libs)
|
||||
|
||||
compiler=$(subst ++,cc,$(REALCC))
|
||||
gambatte_compiler=$(REALCC)
|
||||
|
@ -48,19 +79,28 @@ bsnes/out/libsnes.$(ARCHIVE_SUFFIX): forcelook
|
|||
$(REALRANLIB) bsnes/out/libsnes.$(ARCHIVE_SUFFIX)
|
||||
|
||||
|
||||
src/__all_files__: src/core/version.cpp forcelook
|
||||
src/__all_files__: src/core/version.cpp buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX) buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX) forcelook
|
||||
$(MAKE) -C src precheck
|
||||
$(MAKE) -C src
|
||||
cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
|
||||
|
||||
buildaux/version.exe: buildaux/version.cpp VERSION
|
||||
buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX): buildaux/txt2cstr.cpp
|
||||
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
|
||||
src/core/version.cpp: buildaux/version.exe forcelook
|
||||
buildaux/version.exe >$@
|
||||
buildaux/version$(DOT_EXECUTABLE_SUFFIX): buildaux/version.cpp VERSION
|
||||
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
|
||||
buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX): buildaux/mkdeps.cpp VERSION
|
||||
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $< -lboost_filesystem$(HOST_BOOST_POSTFIX) -lboost_system$(HOST_BOOST_POSTFIX)
|
||||
src/core/version.cpp: buildaux/version$(DOT_EXECUTABLE_SUFFIX) forcelook
|
||||
buildaux/version$(DOT_EXECUTABLE_SUFFIX) >$@
|
||||
|
||||
platclean:
|
||||
$(MAKE) -C src platclean
|
||||
|
||||
clean:
|
||||
$(MAKE) -C src clean
|
||||
rm -f buildaux/version$(DOT_EXECUTABLE_SUFFIX)
|
||||
rm -f buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX)
|
||||
rm -f buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX)
|
||||
|
||||
forcelook:
|
||||
@true
|
||||
|
|
3
TODO
Normal file
3
TODO
Normal file
|
@ -0,0 +1,3 @@
|
|||
- Memory Tracking: Track dynamic state.
|
||||
- Fix paths and filenames containing non-ASCII on Win32.
|
||||
- Win64 build.
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2-β0
|
||||
2-β23
|
||||
|
|
1
bsnes
Submodule
1
bsnes
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 4cfbbeadc3abe3e3911f7f59ce57b715edc76563
|
|
@ -1,13 +1,13 @@
|
|||
From df75db4512ef7e6ad70f8cee8c7d7071132168f0 Mon Sep 17 00:00:00 2001
|
||||
From 831e9614a7babbacf59935960fbaa6cfc8d49c08 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:30:36 +0200
|
||||
Subject: [PATCH 1/7] Make libsnes compile
|
||||
Subject: [PATCH 01/10] Make libsnes compile
|
||||
|
||||
Changes between v083 and v084 had broken libsnes. Fix it so it at least
|
||||
compiles.
|
||||
---
|
||||
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
|
||||
1 files changed, 35 insertions(+), 2 deletions(-)
|
||||
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 35 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
|
||||
index fbb4482..5f5ded6 100755
|
||||
|
@ -78,5 +78,5 @@ index fbb4482..5f5ded6 100755
|
|||
}
|
||||
SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, xmlrom);
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
From 637952f6b97bef882ca3870be8d434c31aeacf77 Mon Sep 17 00:00:00 2001
|
||||
From df7851648e41ae6b6efd1a54cdcd32ac55a90131 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:31:59 +0200
|
||||
Subject: [PATCH 2/7] Fix bsnes version number in libsnes to be v084, not v083
|
||||
Subject: [PATCH 02/10] Fix bsnes version number in libsnes to be v084, not
|
||||
v083
|
||||
|
||||
---
|
||||
ui-libsnes/libsnes.cpp | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
ui-libsnes/libsnes.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
|
||||
index 5f5ded6..6b4ef12 100755
|
||||
|
@ -21,5 +22,5 @@ index 5f5ded6..6b4ef12 100755
|
|||
|
||||
unsigned snes_library_revision_major(void) {
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
From 308ba2d96d3dc0e49821c9db9902882e3919e372 Mon Sep 17 00:00:00 2001
|
||||
From b481e3d161d924cc5a4449329393c8d9f23b27ec Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:37:44 +0200
|
||||
Subject: [PATCH 3/7] Don't use time() in emulating chips
|
||||
Subject: [PATCH 03/10] Don't use time() in emulating chips
|
||||
|
||||
Instead of using time() in chip emulation, create new interface method
|
||||
currentTime(), defaulting to time(0). This way frontend can cleanly
|
||||
override the current time bsnes is using.
|
||||
---
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
5 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
|
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
|
|||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
From 8d990991d97eb7742c4daa461b158d1aa9f6dce4 Mon Sep 17 00:00:00 2001
|
||||
From af7fdd9f73a3eb5e9266c59bfb4dd676679b2f7d Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 01:52:08 +0200
|
||||
Subject: [PATCH 4/7] Save controller state when savestating
|
||||
Subject: [PATCH 04/10] Save controller state when savestating
|
||||
|
||||
When savestating, save the controller state and restore it upon loadstate.
|
||||
Prevents libsnes from mixing up buttons.
|
||||
---
|
||||
snes/controller/controller.cpp | 8 ++++++
|
||||
snes/controller/controller.hpp | 2 +
|
||||
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 ++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/input/input.cpp | 15 ++++++++++++
|
||||
snes/input/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
snes/controller/controller.cpp | 8 +++++++
|
||||
snes/controller/controller.hpp | 2 ++
|
||||
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 +++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/input/input.cpp | 15 +++++++++++++
|
||||
snes/input/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
15 files changed, 141 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
|
||||
|
@ -341,5 +341,5 @@ index f7d6f3b..08e7051 100755
|
|||
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
|
||||
if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.serialize(s);
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 0520c04455b9e96e6caa54009d4ef7c300146c67 Mon Sep 17 00:00:00 2001
|
||||
From aa1352516e38ff64f304d8831b357841c4795e43 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 03:05:48 +0200
|
||||
Subject: [PATCH 5/7] Fix unserialization of 64-bit signed integers
|
||||
Subject: [PATCH 05/10] Fix unserialization of 64-bit signed integers
|
||||
|
||||
---
|
||||
nall/serializer.hpp | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
nall/serializer.hpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nall/serializer.hpp b/nall/serializer.hpp
|
||||
index ff2337a..e6bc8fa 100755
|
||||
|
@ -21,5 +21,5 @@ index ff2337a..e6bc8fa 100755
|
|||
isize += size;
|
||||
}
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
From 723b5884d53db9d5e24b8cd300e97b1bb12fba29 Mon Sep 17 00:00:00 2001
|
||||
From 794d83cb28a93d9ae1e613598d3c7cf09090d6a3 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
||||
Subject: [PATCH 6/7] Allow frontend to control random number seed
|
||||
Subject: [PATCH 06/10] Allow frontend to control random number seed
|
||||
|
||||
---
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletions(-)
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index b3017c9..0a21a13 100755
|
||||
|
@ -49,5 +49,5 @@ index 6881810..8583595 100755
|
|||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,60 +1,63 @@
|
|||
From eea50468e8d7e7a034b05c819aef11a032f972eb Mon Sep 17 00:00:00 2001
|
||||
From 4f6981592e29038ad9f818399c0d5a48750cf28a Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 7 Mar 2012 16:57:18 +0200
|
||||
Subject: [PATCH 7/7] Fix mouse polling
|
||||
Subject: [PATCH 07/10] Fix mouse polling
|
||||
|
||||
Don't poll for mouse motion excessive number of times (no need to poll it for
|
||||
each bit!)
|
||||
---
|
||||
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index 6b26fae..824ecd3 100755
|
||||
index 6b26fae..1a066b9 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -3,8 +3,10 @@
|
||||
@@ -3,9 +3,13 @@
|
||||
uint2 Mouse::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ if(counter == 0) {
|
||||
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ }
|
||||
|
||||
+ int position_x = _position_x;
|
||||
+ int position_y = _position_y;
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
|
||||
|
||||
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
|
||||
unsigned char block[Controller::SaveSize] = {0};
|
||||
block[0] = latched ? 1 : 0;
|
||||
block[1] = counter;
|
||||
+ block[2] = (unsigned short)position_x >> 8;
|
||||
+ block[3] = (unsigned short)position_x;
|
||||
+ block[4] = (unsigned short)position_y >> 8;
|
||||
+ block[5] = (unsigned short)position_y;
|
||||
+ block[2] = (unsigned short)_position_x >> 8;
|
||||
+ block[3] = (unsigned short)_position_x;
|
||||
+ block[4] = (unsigned short)_position_y >> 8;
|
||||
+ block[5] = (unsigned short)_position_y;
|
||||
s.array(block, Controller::SaveSize);
|
||||
if(s.mode() == nall::serializer::Load) {
|
||||
latched = (block[0] != 0);
|
||||
counter = block[1];
|
||||
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index b66ea51..6074f34 100755
|
||||
index b66ea51..b07c8ab 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -6,4 +6,6 @@ struct Mouse : Controller {
|
||||
private:
|
||||
bool latched;
|
||||
unsigned counter;
|
||||
+ int position_x;
|
||||
+ int position_y;
|
||||
+ int _position_x;
|
||||
+ int _position_y;
|
||||
};
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
From 170490ff3a98a4d4c923fb3fe48014359d4b5f6f Mon Sep 17 00:00:00 2001
|
||||
From 7b09063fbcaf50c56b476a744f9f3d9634777740 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 24 Sep 2012 21:46:09 +0300
|
||||
Subject: [PATCH] Add needed support for detecting true polls as opposed to
|
||||
just autopolling
|
||||
Subject: [PATCH 08/10] Add needed support for detecting true polls as opposed
|
||||
to just autopolling
|
||||
|
||||
---
|
||||
bsnes/snes/cpu/cpu.hpp | 1 +
|
||||
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
snes/cpu/cpu.hpp | 1 +
|
||||
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
|
||||
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
|
||||
index 67a56d1..976a4a6 100755
|
||||
--- a/bsnes/snes/cpu/cpu.hpp
|
||||
+++ b/bsnes/snes/cpu/cpu.hpp
|
||||
--- a/snes/cpu/cpu.hpp
|
||||
+++ b/snes/cpu/cpu.hpp
|
||||
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
|
||||
CPU();
|
||||
~CPU();
|
||||
|
@ -21,10 +21,10 @@ index 67a56d1..976a4a6 100755
|
|||
private:
|
||||
#include "dma/dma.hpp"
|
||||
#include "memory/memory.hpp"
|
||||
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index 8b6aaa6..c5ee930 100755
|
||||
--- a/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
|
||||
//1-0 = Joypad serial data
|
||||
uint8 CPU::mmio_r4016() {
|
||||
|
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
|
|||
//DMAPx
|
||||
uint8 CPU::mmio_r43x0(uint8 i) {
|
||||
--
|
||||
1.7.10.4
|
||||
1.8.4.4
|
||||
|
||||
|
|
65
bsnes-patches/v084/0009-Support-notifying-latches.patch
Normal file
65
bsnes-patches/v084/0009-Support-notifying-latches.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 62f8a07104b57b75071318098145d99012dbc908 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 27 Oct 2013 10:52:45 +0200
|
||||
Subject: [PATCH 09/10] Support notifying latches
|
||||
|
||||
---
|
||||
snes/cpu/mmio/mmio.cpp | 1 +
|
||||
snes/cpu/timing/joypad.cpp | 1 +
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index c5ee930..b7afff0 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
|
||||
//strobing $4016.d0 affects both controller port latches.
|
||||
//$4017 bit 0 writes are ignored.
|
||||
void CPU::mmio_w4016(uint8 data) {
|
||||
+ if(data&1) interface->notifyLatched();
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
}
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 6e15346..c69b708 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -7,6 +7,7 @@ void CPU::step_auto_joypad_poll() {
|
||||
|
||||
if(status.auto_joypad_active && status.auto_joypad_poll) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
+ interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index 0a21a13..6685556 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
|
||||
return time(0);
|
||||
}
|
||||
|
||||
+void Interface::notifyLatched()
|
||||
+{
|
||||
+ //Nothing.
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index 30ee7fd..203f7b0 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -7,6 +7,7 @@ struct Interface {
|
||||
virtual void message(const string &text);
|
||||
virtual time_t currentTime();
|
||||
virtual time_t randomSeed();
|
||||
+ virtual void notifyLatched();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.8.4.4
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From 242efcc9cf10fa58c8e06f154c41db21e6aa2688 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 30 Nov 2013 10:26:59 +0200
|
||||
Subject: [PATCH 10/10] Add support for auto-detecting bsnes version
|
||||
|
||||
---
|
||||
bsnes.mk | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
create mode 100644 bsnes.mk
|
||||
|
||||
diff --git a/bsnes.mk b/bsnes.mk
|
||||
new file mode 100644
|
||||
index 0000000..11300e2
|
||||
--- /dev/null
|
||||
+++ b/bsnes.mk
|
||||
@@ -0,0 +1,3 @@
|
||||
+BSNES_SUPPORTS_DEBUGGER=yes
|
||||
+LIBSNES_DIR=ui-libsnes
|
||||
+BSNES_VERSION=084
|
||||
--
|
||||
1.8.4.4
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
From 7c8d537a7be0f9c5883393e0d4a0df76d69bf19c Mon Sep 17 00:00:00 2001
|
||||
From b19b3b2d1d7a522af695f4482abb28e52804326b Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:30:36 +0200
|
||||
Subject: [PATCH 1/7] Make libsnes compile
|
||||
Subject: [PATCH 01/27] Make libsnes compile
|
||||
|
||||
Changes between v083 and v084 had broken libsnes. Fix it so it at least
|
||||
compiles.
|
||||
---
|
||||
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
|
||||
1 files changed, 35 insertions(+), 2 deletions(-)
|
||||
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 35 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
|
||||
index fbb4482..5f5ded6 100755
|
||||
index fbb4482c..5f5ded69 100755
|
||||
--- a/ui-libsnes/libsnes.cpp
|
||||
+++ b/ui-libsnes/libsnes.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -78,5 +78,5 @@ index fbb4482..5f5ded6 100755
|
|||
}
|
||||
SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, xmlrom);
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
From 5f9f74b1334cb05d8636d71c2cfc0a48685a7347 Mon Sep 17 00:00:00 2001
|
||||
From bb2fed04fbfe62a89e4bcfe90f44b4738f7c7c1a Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:31:59 +0200
|
||||
Subject: [PATCH 2/7] Fix bsnes version number in libsnes to be v085, not v083
|
||||
Subject: [PATCH 02/27] Fix bsnes version number in libsnes to be v085, not
|
||||
v083
|
||||
|
||||
---
|
||||
ui-libsnes/libsnes.cpp | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
ui-libsnes/libsnes.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
|
||||
index 5f5ded6..0e63075 100755
|
||||
index 5f5ded69..0e63075e 100755
|
||||
--- a/ui-libsnes/libsnes.cpp
|
||||
+++ b/ui-libsnes/libsnes.cpp
|
||||
@@ -112,7 +112,7 @@ struct Interface : public SNES::Interface {
|
||||
|
@ -21,5 +22,5 @@ index 5f5ded6..0e63075 100755
|
|||
|
||||
unsigned snes_library_revision_major(void) {
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
From 773d0a3f71fca2df375a8e75c081d1f28c3b817b Mon Sep 17 00:00:00 2001
|
||||
From 7379b4570e5755a5a1da25181ba4f5d1ca461a98 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:37:44 +0200
|
||||
Subject: [PATCH 3/7] Don't use time() in emulating chips
|
||||
Subject: [PATCH 03/27] Don't use time() in emulating chips
|
||||
|
||||
Instead of using time() in chip emulation, create new interface method
|
||||
currentTime(), defaulting to time(0). This way frontend can cleanly
|
||||
override the current time bsnes is using.
|
||||
---
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
5 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
index 386fb62..3c98019 100755
|
||||
index 386fb628..3c980195 100755
|
||||
--- a/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
+++ b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
@@ -38,7 +38,7 @@ uint8 BSXSatellaview::mmio_read(unsigned addr) {
|
||||
|
@ -28,7 +28,7 @@ index 386fb62..3c98019 100755
|
|||
|
||||
regs.r2192_hour = t->tm_hour;
|
||||
diff --git a/snes/chip/spc7110/spc7110.cpp b/snes/chip/spc7110/spc7110.cpp
|
||||
index d2dc640..74a817a 100755
|
||||
index d2dc640b..74a817a6 100755
|
||||
--- a/snes/chip/spc7110/spc7110.cpp
|
||||
+++ b/snes/chip/spc7110/spc7110.cpp
|
||||
@@ -101,7 +101,7 @@ void SPC7110::set_data_adjust(unsigned addr) { r4814 = addr; r4815 = addr >> 8;
|
||||
|
@ -41,7 +41,7 @@ index d2dc640..74a817a 100755
|
|||
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
|
||||
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
|
||||
diff --git a/snes/chip/srtc/srtc.cpp b/snes/chip/srtc/srtc.cpp
|
||||
index 1b2fd2a..78fc4c1 100755
|
||||
index 1b2fd2aa..78fc4c1f 100755
|
||||
--- a/snes/chip/srtc/srtc.cpp
|
||||
+++ b/snes/chip/srtc/srtc.cpp
|
||||
@@ -31,7 +31,7 @@ void SRTC::reset() {
|
||||
|
@ -54,7 +54,7 @@ index 1b2fd2a..78fc4c1 100755
|
|||
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
|
||||
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index a0e3a81..b3017c9 100755
|
||||
index a0e3a81b..b3017c90 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -18,4 +18,9 @@ void Interface::message(const string &text) {
|
||||
|
@ -68,7 +68,7 @@ index a0e3a81..b3017c9 100755
|
|||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index f1a48c0..df975e8 100755
|
||||
index f1a48c0f..df975e83 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -5,6 +5,7 @@ struct Interface {
|
||||
|
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
|
|||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
From c7bf497a7016c9be3a1e2fff46973a555f9ad555 Mon Sep 17 00:00:00 2001
|
||||
From efe1b5884c316ce070953edd87c6c9aeffffaa94 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 01:52:08 +0200
|
||||
Subject: [PATCH 4/7] Save controller state when savestating
|
||||
Subject: [PATCH 04/27] Save controller state when savestating
|
||||
|
||||
When savestating, save the controller state and restore it upon loadstate.
|
||||
Prevents libsnes from mixing up buttons.
|
||||
---
|
||||
snes/controller/controller.cpp | 8 ++++++
|
||||
snes/controller/controller.hpp | 2 +
|
||||
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 ++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 +++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
snes/controller/controller.cpp | 8 +++++++
|
||||
snes/controller/controller.hpp | 2 ++
|
||||
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 +++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 ++++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
15 files changed, 142 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
|
||||
index 9091b21..f254bed 100755
|
||||
index 9091b21b..f254bedb 100755
|
||||
--- a/snes/controller/controller.cpp
|
||||
+++ b/snes/controller/controller.cpp
|
||||
@@ -46,8 +46,16 @@ void Controller::iobit(bool data) {
|
||||
|
@ -45,7 +45,7 @@ index 9091b21..f254bed 100755
|
|||
+
|
||||
}
|
||||
diff --git a/snes/controller/controller.hpp b/snes/controller/controller.hpp
|
||||
index 7332712..827b2eb 100755
|
||||
index 73327129..827b2eb4 100755
|
||||
--- a/snes/controller/controller.hpp
|
||||
+++ b/snes/controller/controller.hpp
|
||||
@@ -13,12 +13,14 @@
|
||||
|
@ -64,7 +64,7 @@ index 7332712..827b2eb 100755
|
|||
bool iobit();
|
||||
void iobit(bool data);
|
||||
diff --git a/snes/controller/gamepad/gamepad.cpp b/snes/controller/gamepad/gamepad.cpp
|
||||
index 594020d..4fa1c99 100755
|
||||
index 594020d2..4fa1c99e 100755
|
||||
--- a/snes/controller/gamepad/gamepad.cpp
|
||||
+++ b/snes/controller/gamepad/gamepad.cpp
|
||||
@@ -13,6 +13,19 @@ void Gamepad::latch(bool data) {
|
||||
|
@ -88,7 +88,7 @@ index 594020d..4fa1c99 100755
|
|||
latched = 0;
|
||||
counter = 0;
|
||||
diff --git a/snes/controller/gamepad/gamepad.hpp b/snes/controller/gamepad/gamepad.hpp
|
||||
index c5ca69c..a2392d1 100755
|
||||
index c5ca69ca..a2392d1e 100755
|
||||
--- a/snes/controller/gamepad/gamepad.hpp
|
||||
+++ b/snes/controller/gamepad/gamepad.hpp
|
||||
@@ -2,7 +2,7 @@ struct Gamepad : Controller {
|
||||
|
@ -101,7 +101,7 @@ index c5ca69c..a2392d1 100755
|
|||
bool latched;
|
||||
unsigned counter;
|
||||
diff --git a/snes/controller/justifier/justifier.cpp b/snes/controller/justifier/justifier.cpp
|
||||
index 6207916..ad13a9b 100755
|
||||
index 62079166..ad13a9bd 100755
|
||||
--- a/snes/controller/justifier/justifier.cpp
|
||||
+++ b/snes/controller/justifier/justifier.cpp
|
||||
@@ -100,6 +100,42 @@ void Justifier::latch(bool data) {
|
||||
|
@ -148,7 +148,7 @@ index 6207916..ad13a9b 100755
|
|||
create(Controller::Enter, 21477272);
|
||||
latched = 0;
|
||||
diff --git a/snes/controller/justifier/justifier.hpp b/snes/controller/justifier/justifier.hpp
|
||||
index f927acf..6b7bba0 100755
|
||||
index f927acf6..6b7bba07 100755
|
||||
--- a/snes/controller/justifier/justifier.hpp
|
||||
+++ b/snes/controller/justifier/justifier.hpp
|
||||
@@ -2,6 +2,7 @@ struct Justifier : Controller {
|
||||
|
@ -160,7 +160,7 @@ index f927acf..6b7bba0 100755
|
|||
|
||||
//private:
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index c9f5d16..6b26fae 100755
|
||||
index c9f5d16b..6b26fae5 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -61,6 +61,19 @@ void Mouse::latch(bool data) {
|
||||
|
@ -184,7 +184,7 @@ index c9f5d16..6b26fae 100755
|
|||
latched = 0;
|
||||
counter = 0;
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index 95e24b6..b66ea51 100755
|
||||
index 95e24b65..b66ea513 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -2,7 +2,7 @@ struct Mouse : Controller {
|
||||
|
@ -197,7 +197,7 @@ index 95e24b6..b66ea51 100755
|
|||
bool latched;
|
||||
unsigned counter;
|
||||
diff --git a/snes/controller/multitap/multitap.cpp b/snes/controller/multitap/multitap.cpp
|
||||
index 3a6eb72..146c41d 100755
|
||||
index 3a6eb720..146c41d4 100755
|
||||
--- a/snes/controller/multitap/multitap.cpp
|
||||
+++ b/snes/controller/multitap/multitap.cpp
|
||||
@@ -30,6 +30,22 @@ void Multitap::latch(bool data) {
|
||||
|
@ -224,7 +224,7 @@ index 3a6eb72..146c41d 100755
|
|||
latched = 0;
|
||||
counter1 = 0;
|
||||
diff --git a/snes/controller/multitap/multitap.hpp b/snes/controller/multitap/multitap.hpp
|
||||
index 0540af7..e6324ac 100755
|
||||
index 0540af71..e6324ac5 100755
|
||||
--- a/snes/controller/multitap/multitap.hpp
|
||||
+++ b/snes/controller/multitap/multitap.hpp
|
||||
@@ -2,7 +2,7 @@ struct Multitap : Controller {
|
||||
|
@ -237,7 +237,7 @@ index 0540af7..e6324ac 100755
|
|||
bool latched;
|
||||
unsigned counter1;
|
||||
diff --git a/snes/controller/superscope/superscope.cpp b/snes/controller/superscope/superscope.cpp
|
||||
index 12068f0..1a1dfbf 100755
|
||||
index 12068f05..1a1dfbff 100755
|
||||
--- a/snes/controller/superscope/superscope.cpp
|
||||
+++ b/snes/controller/superscope/superscope.cpp
|
||||
@@ -100,6 +100,37 @@ void SuperScope::latch(bool data) {
|
||||
|
@ -279,7 +279,7 @@ index 12068f0..1a1dfbf 100755
|
|||
create(Controller::Enter, 21477272);
|
||||
latched = 0;
|
||||
diff --git a/snes/controller/superscope/superscope.hpp b/snes/controller/superscope/superscope.hpp
|
||||
index a7a90b7..93509d7 100755
|
||||
index a7a90b71..93509d79 100755
|
||||
--- a/snes/controller/superscope/superscope.hpp
|
||||
+++ b/snes/controller/superscope/superscope.hpp
|
||||
@@ -2,6 +2,7 @@ struct SuperScope : Controller {
|
||||
|
@ -291,7 +291,7 @@ index a7a90b7..93509d7 100755
|
|||
|
||||
//private:
|
||||
diff --git a/snes/system/input.cpp b/snes/system/input.cpp
|
||||
index 9050310..ec5559d 100755
|
||||
index 90503106..ec5559dc 100755
|
||||
--- a/snes/system/input.cpp
|
||||
+++ b/snes/system/input.cpp
|
||||
@@ -26,6 +26,22 @@ void Input::connect(bool port, Input::Device id) {
|
||||
|
@ -318,7 +318,7 @@ index 9050310..ec5559d 100755
|
|||
connect(Controller::Port1, Input::Device::Joypad);
|
||||
connect(Controller::Port2, Input::Device::Joypad);
|
||||
diff --git a/snes/system/input.hpp b/snes/system/input.hpp
|
||||
index 13ef46e..6832e82 100755
|
||||
index 13ef46e1..6832e823 100755
|
||||
--- a/snes/system/input.hpp
|
||||
+++ b/snes/system/input.hpp
|
||||
@@ -31,6 +31,7 @@ struct Input {
|
||||
|
@ -330,7 +330,7 @@ index 13ef46e..6832e82 100755
|
|||
Input();
|
||||
~Input();
|
||||
diff --git a/snes/system/serialization.cpp b/snes/system/serialization.cpp
|
||||
index f7d6f3b..08e7051 100755
|
||||
index f7d6f3b1..08e70510 100755
|
||||
--- a/snes/system/serialization.cpp
|
||||
+++ b/snes/system/serialization.cpp
|
||||
@@ -56,6 +56,7 @@ void System::serialize_all(serializer &s) {
|
||||
|
@ -342,5 +342,5 @@ index f7d6f3b..08e7051 100755
|
|||
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
|
||||
if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.serialize(s);
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
From 18812e5cc5bd4cdc7cc7ef87a18bce78adbb4b13 Mon Sep 17 00:00:00 2001
|
||||
From cdf2f46490f128308eb7f399d03530936ebeda0a Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 03:05:48 +0200
|
||||
Subject: [PATCH 5/7] Fix unserialization of 64-bit signed integers
|
||||
Subject: [PATCH 05/27] Fix unserialization of 64-bit signed integers
|
||||
|
||||
---
|
||||
nall/serializer.hpp | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
nall/serializer.hpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nall/serializer.hpp b/nall/serializer.hpp
|
||||
index ff2337a..e6bc8fa 100755
|
||||
index ff2337ab..e6bc8fad 100755
|
||||
--- a/nall/serializer.hpp
|
||||
+++ b/nall/serializer.hpp
|
||||
@@ -58,7 +58,7 @@ namespace nall {
|
||||
|
@ -21,5 +21,5 @@ index ff2337a..e6bc8fa 100755
|
|||
isize += size;
|
||||
}
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
From efe643e986ac15028ac7c7842532d8a8fb33963b Mon Sep 17 00:00:00 2001
|
||||
From 4dc46334ec175e26277632fee4aea80768749af9 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
||||
Subject: [PATCH 6/7] Allow frontend to control random number seed
|
||||
Subject: [PATCH 06/27] Allow frontend to control random number seed
|
||||
|
||||
---
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletions(-)
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index b3017c9..0a21a13 100755
|
||||
index b3017c90..0a21a132 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -23,4 +23,9 @@ time_t Interface::currentTime()
|
||||
|
@ -24,7 +24,7 @@ index b3017c9..0a21a13 100755
|
|||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index df975e8..30ee7fd 100755
|
||||
index df975e83..30ee7fde 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -6,6 +6,7 @@ struct Interface {
|
||||
|
@ -36,7 +36,7 @@ index df975e8..30ee7fd 100755
|
|||
|
||||
extern Interface *interface;
|
||||
diff --git a/snes/system/system.cpp b/snes/system/system.cpp
|
||||
index c19a7c5..dbd912d 100755
|
||||
index c19a7c51..dbd912d8 100755
|
||||
--- a/snes/system/system.cpp
|
||||
+++ b/snes/system/system.cpp
|
||||
@@ -146,7 +146,7 @@ void System::unload() {
|
||||
|
@ -49,5 +49,5 @@ index c19a7c5..dbd912d 100755
|
|||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,60 +1,63 @@
|
|||
From ce95700dc34ffdc5370aa699992bd8275e21c5c2 Mon Sep 17 00:00:00 2001
|
||||
From eeaf6dc52d39ca9c150ff61864c11297d200d968 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 7 Mar 2012 16:57:18 +0200
|
||||
Subject: [PATCH 7/7] Fix mouse polling
|
||||
Subject: [PATCH 07/27] Fix mouse polling
|
||||
|
||||
Don't poll for mouse motion excessive number of times (no need to poll it for
|
||||
each bit!)
|
||||
---
|
||||
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index 6b26fae..824ecd3 100755
|
||||
index 6b26fae5..1a066b98 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -3,8 +3,10 @@
|
||||
@@ -3,9 +3,13 @@
|
||||
uint2 Mouse::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ if(counter == 0) {
|
||||
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ }
|
||||
|
||||
+ int position_x = _position_x;
|
||||
+ int position_y = _position_y;
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
|
||||
|
||||
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
|
||||
unsigned char block[Controller::SaveSize] = {0};
|
||||
block[0] = latched ? 1 : 0;
|
||||
block[1] = counter;
|
||||
+ block[2] = (unsigned short)position_x >> 8;
|
||||
+ block[3] = (unsigned short)position_x;
|
||||
+ block[4] = (unsigned short)position_y >> 8;
|
||||
+ block[5] = (unsigned short)position_y;
|
||||
+ block[2] = (unsigned short)_position_x >> 8;
|
||||
+ block[3] = (unsigned short)_position_x;
|
||||
+ block[4] = (unsigned short)_position_y >> 8;
|
||||
+ block[5] = (unsigned short)_position_y;
|
||||
s.array(block, Controller::SaveSize);
|
||||
if(s.mode() == nall::serializer::Load) {
|
||||
latched = (block[0] != 0);
|
||||
counter = block[1];
|
||||
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index b66ea51..6074f34 100755
|
||||
index b66ea513..b07c8ab7 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -6,4 +6,6 @@ struct Mouse : Controller {
|
||||
private:
|
||||
bool latched;
|
||||
unsigned counter;
|
||||
+ int position_x;
|
||||
+ int position_y;
|
||||
+ int _position_x;
|
||||
+ int _position_y;
|
||||
};
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
From 3761a50c0faed2d9252781c5508bf91cc84ad493 Mon Sep 17 00:00:00 2001
|
||||
From 7018377c93553071fc404db872b2746d40ac3bce Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 1 Sep 2012 11:23:34 +0300
|
||||
Subject: [PATCH] Fix uninitialized variables
|
||||
Subject: [PATCH 08/27] Fix uninitialized variables
|
||||
|
||||
These uninitialized variables cause a lot of desyncs in Shadowrun.
|
||||
---
|
||||
snes/alt/dsp/dsp.cpp | 2 ++
|
||||
snes/alt/ppu-compatibility/ppu.cpp | 11 +++++++++++
|
||||
snes/cpu/core/core.cpp | 8 ++++++++
|
||||
snes/cpu/core/core.hpp | 2 ++
|
||||
snes/cpu/cpu.cpp | 1 +
|
||||
snes/smp/core/core.cpp | 11 +++++++++++
|
||||
snes/smp/core/core.hpp | 2 ++
|
||||
snes/smp/smp.cpp | 1 +
|
||||
8 files changed, 38 insertions(+), 0 deletions(-)
|
||||
snes/alt/dsp/dsp.cpp | 2 ++
|
||||
snes/alt/ppu-compatibility/ppu.cpp | 11 +++++++++++
|
||||
snes/cpu/core/core.cpp | 8 ++++++++
|
||||
snes/cpu/core/core.hpp | 2 ++
|
||||
snes/cpu/cpu.cpp | 1 +
|
||||
snes/smp/core/core.cpp | 11 +++++++++++
|
||||
snes/smp/core/core.hpp | 2 ++
|
||||
snes/smp/smp.cpp | 1 +
|
||||
8 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/snes/alt/dsp/dsp.cpp b/snes/alt/dsp/dsp.cpp
|
||||
index d0c9e07..c6809f7 100755
|
||||
index d0c9e077..c6809f73 100755
|
||||
--- a/snes/alt/dsp/dsp.cpp
|
||||
+++ b/snes/alt/dsp/dsp.cpp
|
||||
@@ -40,6 +40,8 @@ void DSP::write(uint8 addr, uint8 data) {
|
||||
|
@ -29,7 +29,7 @@ index d0c9e07..c6809f7 100755
|
|||
spc_dsp.reset();
|
||||
spc_dsp.set_output(samplebuffer, 8192);
|
||||
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
index 1a3835b..a21e5e3 100755
|
||||
index 1a3835b3..a21e5e31 100755
|
||||
--- a/snes/alt/ppu-compatibility/ppu.cpp
|
||||
+++ b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
@@ -345,6 +345,17 @@ void PPU::power() {
|
||||
|
@ -51,7 +51,7 @@ index 1a3835b..a21e5e3 100755
|
|||
}
|
||||
|
||||
diff --git a/snes/cpu/core/core.cpp b/snes/cpu/core/core.cpp
|
||||
index 427176b..a5b809b 100755
|
||||
index 427176b0..a5b809b9 100755
|
||||
--- a/snes/cpu/core/core.cpp
|
||||
+++ b/snes/cpu/core/core.cpp
|
||||
@@ -86,4 +86,12 @@ CPUcore::CPUcore() {
|
||||
|
@ -68,7 +68,7 @@ index 427176b..a5b809b 100755
|
|||
+
|
||||
}
|
||||
diff --git a/snes/cpu/core/core.hpp b/snes/cpu/core/core.hpp
|
||||
index 964bd12..7a685a8 100755
|
||||
index 964bd128..7a685a8d 100755
|
||||
--- a/snes/cpu/core/core.hpp
|
||||
+++ b/snes/cpu/core/core.hpp
|
||||
@@ -7,6 +7,8 @@ struct CPUcore {
|
||||
|
@ -81,7 +81,7 @@ index 964bd12..7a685a8 100755
|
|||
virtual uint8_t op_read(uint32_t addr) = 0;
|
||||
virtual void op_write(uint32_t addr, uint8_t data) = 0;
|
||||
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
|
||||
index f6ae975..2d7d343 100755
|
||||
index f6ae9754..2d7d3432 100755
|
||||
--- a/snes/cpu/cpu.cpp
|
||||
+++ b/snes/cpu/cpu.cpp
|
||||
@@ -125,6 +125,7 @@ void CPU::power() {
|
||||
|
@ -93,7 +93,7 @@ index f6ae975..2d7d343 100755
|
|||
|
||||
void CPU::reset() {
|
||||
diff --git a/snes/smp/core/core.cpp b/snes/smp/core/core.cpp
|
||||
index 9c94d00..2fc29be 100755
|
||||
index 9c94d00a..2fc29be1 100755
|
||||
--- a/snes/smp/core/core.cpp
|
||||
+++ b/snes/smp/core/core.cpp
|
||||
@@ -269,4 +269,15 @@ void SMPcore::op_step() {
|
||||
|
@ -113,7 +113,7 @@ index 9c94d00..2fc29be 100755
|
|||
+
|
||||
}
|
||||
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
|
||||
index 6adf6f6..1489fce 100755
|
||||
index 6adf6f6b..1489fcef 100755
|
||||
--- a/snes/smp/core/core.hpp
|
||||
+++ b/snes/smp/core/core.hpp
|
||||
@@ -11,6 +11,8 @@ struct SMPcore {
|
||||
|
@ -126,7 +126,7 @@ index 6adf6f6..1489fce 100755
|
|||
string disassemble_opcode(uint16 addr);
|
||||
|
||||
diff --git a/snes/smp/smp.cpp b/snes/smp/smp.cpp
|
||||
index 9080624..d4ccf42 100755
|
||||
index 90806245..d4ccf425 100755
|
||||
--- a/snes/smp/smp.cpp
|
||||
+++ b/snes/smp/smp.cpp
|
||||
@@ -53,6 +53,7 @@ void SMP::power() {
|
||||
|
@ -138,5 +138,5 @@ index 9080624..d4ccf42 100755
|
|||
|
||||
void SMP::reset() {
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
From 03f134f4db8d179cf95f6017dffd893cd3801e82 Mon Sep 17 00:00:00 2001
|
||||
From 6e0364c9a86caa71623a188a720b2d68b304b89b Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 24 Sep 2012 21:46:09 +0300
|
||||
Subject: [PATCH] Add needed support for detecting true polls as opposed to
|
||||
just autopolling
|
||||
Subject: [PATCH 09/27] Add needed support for detecting true polls as opposed
|
||||
to just autopolling
|
||||
|
||||
---
|
||||
bsnes/snes/cpu/cpu.hpp | 1 +
|
||||
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
snes/cpu/cpu.hpp | 1 +
|
||||
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
|
||||
index 3da865e..4944577 100755
|
||||
--- a/bsnes/snes/cpu/cpu.hpp
|
||||
+++ b/bsnes/snes/cpu/cpu.hpp
|
||||
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
|
||||
index 3da865e2..49445773 100755
|
||||
--- a/snes/cpu/cpu.hpp
|
||||
+++ b/snes/cpu/cpu.hpp
|
||||
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
|
||||
CPU();
|
||||
~CPU();
|
||||
|
@ -21,10 +21,10 @@ index 3da865e..4944577 100755
|
|||
private:
|
||||
#include "dma/dma.hpp"
|
||||
#include "memory/memory.hpp"
|
||||
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
index 8b6aaa6..c5ee930 100755
|
||||
--- a/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index 8b6aaa6a..c5ee930f 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
|
||||
//1-0 = Joypad serial data
|
||||
uint8 CPU::mmio_r4016() {
|
||||
|
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
|
|||
//DMAPx
|
||||
uint8 CPU::mmio_r43x0(uint8 i) {
|
||||
--
|
||||
1.7.10.4
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
From 36777ec11c093a1cc902b8b72188e06f49a4d0f2 Mon Sep 17 00:00:00 2001
|
||||
From e397bd46f17d6ea00c8c96d5a8e0c5f5b4a6f642 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 14 Oct 2012 23:31:36 +0300
|
||||
Subject: [PATCH] Fix compiling on GCC 4.7
|
||||
Subject: [PATCH 10/27] Fix compiling on GCC 4.7
|
||||
|
||||
---
|
||||
bsnes/nall/string.hpp | 2 +-
|
||||
nall/string.hpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bsnes/nall/string.hpp b/bsnes/nall/string.hpp
|
||||
index 1b255ce..07a64df 100755
|
||||
--- a/bsnes/nall/string.hpp
|
||||
+++ b/bsnes/nall/string.hpp
|
||||
diff --git a/nall/string.hpp b/nall/string.hpp
|
||||
index 1b255ce2..07a64dfc 100755
|
||||
--- a/nall/string.hpp
|
||||
+++ b/nall/string.hpp
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <nall/string/base.hpp>
|
||||
#include <nall/string/bml.hpp>
|
||||
|
@ -22,5 +22,5 @@ index 1b255ce..07a64df 100755
|
|||
#include <nall/string/convert.hpp>
|
||||
#include <nall/string/cstring.hpp>
|
||||
--
|
||||
1.7.10.4
|
||||
2.15.0.rc1
|
||||
|
||||
|
|
65
bsnes-patches/v085/0011-Support-notifying-latches.patch
Normal file
65
bsnes-patches/v085/0011-Support-notifying-latches.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From e047aa8eb9883f60e4141effba8128a4a555d8be Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 27 Oct 2013 10:52:45 +0200
|
||||
Subject: [PATCH 11/27] Support notifying latches
|
||||
|
||||
---
|
||||
snes/cpu/mmio/mmio.cpp | 1 +
|
||||
snes/cpu/timing/joypad.cpp | 1 +
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index c5ee930f..b7afff00 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
|
||||
//strobing $4016.d0 affects both controller port latches.
|
||||
//$4017 bit 0 writes are ignored.
|
||||
void CPU::mmio_w4016(uint8 data) {
|
||||
+ if(data&1) interface->notifyLatched();
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
}
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 179df27d..6a98de00 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
|
||||
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
+ interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index 0a21a132..6685556c 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
|
||||
return time(0);
|
||||
}
|
||||
|
||||
+void Interface::notifyLatched()
|
||||
+{
|
||||
+ //Nothing.
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index 30ee7fde..203f7b0c 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -7,6 +7,7 @@ struct Interface {
|
||||
virtual void message(const string &text);
|
||||
virtual time_t currentTime();
|
||||
virtual time_t randomSeed();
|
||||
+ virtual void notifyLatched();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,799 @@
|
|||
From a5b380757b086e3a00b47fe14e2a63c74683e8da Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Thu, 28 Nov 2013 22:36:29 +0200
|
||||
Subject: [PATCH 12/27] Support unlimited number of breakpoints
|
||||
|
||||
---
|
||||
snes/alt/cpu/cpu.cpp | 22 +++++++-------
|
||||
snes/alt/ppu-compatibility/ppu.cpp | 4 +--
|
||||
snes/alt/ppu-parallel/ppu.cpp | 4 +--
|
||||
snes/alt/ppu-performance/ppu.cpp | 4 +--
|
||||
snes/cartridge/cartridge.hpp | 17 +++++++++++
|
||||
snes/cartridge/markup.cpp | 11 +++++++
|
||||
snes/cheat/cheat.cpp | 11 ++++---
|
||||
snes/cheat/cheat.hpp | 1 +
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 4 +--
|
||||
snes/chip/hitachidsp/hitachidsp.cpp | 2 +-
|
||||
snes/chip/hitachidsp/memory.cpp | 2 +-
|
||||
snes/chip/nss/nss.cpp | 4 +--
|
||||
snes/chip/sa1/memory/memory.cpp | 2 +-
|
||||
snes/chip/sa1/memory/memory.hpp | 2 +-
|
||||
snes/chip/sa1/sa1.cpp | 2 +-
|
||||
snes/chip/sdd1/sdd1.cpp | 4 +--
|
||||
snes/cpu/core/core.hpp | 2 +-
|
||||
snes/cpu/core/disassembler/disassembler.cpp | 2 +-
|
||||
snes/cpu/core/memory.hpp | 2 +-
|
||||
snes/cpu/cpu.cpp | 26 ++++++++--------
|
||||
snes/cpu/debugger/debugger.cpp | 4 +--
|
||||
snes/cpu/debugger/debugger.hpp | 2 +-
|
||||
snes/cpu/dma/dma.cpp | 4 +--
|
||||
snes/cpu/memory/memory.cpp | 4 +--
|
||||
snes/cpu/memory/memory.hpp | 2 +-
|
||||
snes/cpu/mmio/mmio.cpp | 2 +-
|
||||
snes/debugger/debugger.cpp | 2 +-
|
||||
snes/memory/memory-inline.hpp | 21 +++++++++++--
|
||||
snes/memory/memory.cpp | 47 ++++++++++++++++++++++++++---
|
||||
snes/memory/memory.hpp | 13 +++++++-
|
||||
snes/ppu/ppu.cpp | 4 +--
|
||||
snes/smp/core/core.hpp | 2 +-
|
||||
snes/snes.hpp | 1 +
|
||||
33 files changed, 166 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/snes/alt/cpu/cpu.cpp b/snes/alt/cpu/cpu.cpp
|
||||
index 814908d0..dcbb92d3 100755
|
||||
--- a/snes/alt/cpu/cpu.cpp
|
||||
+++ b/snes/alt/cpu/cpu.cpp
|
||||
@@ -89,24 +89,24 @@ void CPU::enable() {
|
||||
function<uint8 (unsigned)> read = { &CPU::mmio_read, (CPU*)&cpu };
|
||||
function<void (unsigned, uint8)> write = { &CPU::mmio_write, (CPU*)&cpu };
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, read, write);
|
||||
|
||||
read = [](unsigned addr) { return cpu.wram[addr]; };
|
||||
write = [](unsigned addr, uint8 data) { cpu.wram[addr] = data; };
|
||||
|
||||
- bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
|
||||
- bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
|
||||
- bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, read, write);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, 3, read, write);
|
||||
}
|
||||
|
||||
void CPU::power() {
|
||||
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
index a21e5e31..122b1430 100755
|
||||
--- a/snes/alt/ppu-compatibility/ppu.cpp
|
||||
+++ b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
@@ -126,8 +126,8 @@ void PPU::enable() {
|
||||
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
|
||||
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
|
||||
}
|
||||
|
||||
void PPU::power() {
|
||||
diff --git a/snes/alt/ppu-parallel/ppu.cpp b/snes/alt/ppu-parallel/ppu.cpp
|
||||
index 1c3dcb70..8dd118b2 100755
|
||||
--- a/snes/alt/ppu-parallel/ppu.cpp
|
||||
+++ b/snes/alt/ppu-parallel/ppu.cpp
|
||||
@@ -36,8 +36,8 @@ void PPU::frame() {
|
||||
}
|
||||
|
||||
void PPU::enable() {
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
|
||||
}
|
||||
|
||||
void PPU::power() {
|
||||
diff --git a/snes/alt/ppu-performance/ppu.cpp b/snes/alt/ppu-performance/ppu.cpp
|
||||
index 7c231bc0..4b2b2948 100755
|
||||
--- a/snes/alt/ppu-performance/ppu.cpp
|
||||
+++ b/snes/alt/ppu-performance/ppu.cpp
|
||||
@@ -90,8 +90,8 @@ void PPU::enable() {
|
||||
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
|
||||
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
|
||||
}
|
||||
|
||||
void PPU::power() {
|
||||
diff --git a/snes/cartridge/cartridge.hpp b/snes/cartridge/cartridge.hpp
|
||||
index 37555bc0..82e73c4c 100755
|
||||
--- a/snes/cartridge/cartridge.hpp
|
||||
+++ b/snes/cartridge/cartridge.hpp
|
||||
@@ -12,6 +12,22 @@ struct Cartridge : property<Cartridge> {
|
||||
PAL,
|
||||
};
|
||||
|
||||
+ enum class MemoryClass : unsigned {
|
||||
+ MISC = 0,
|
||||
+ ROM = 1,
|
||||
+ SRAM = 2,
|
||||
+ WRAM = 3,
|
||||
+ SUPERFXROM = 4,
|
||||
+ SUPERFXRAM = 5,
|
||||
+ SA1IRAM = 6,
|
||||
+ SA1BWRAM = 7,
|
||||
+ SUFAMITURBO_ROMA = 8,
|
||||
+ SUFAMITURBO_ROMB = 9,
|
||||
+ SUFAMITURBO_RAMA = 10,
|
||||
+ SUFAMITURBO_RAMB = 11,
|
||||
+ BSXFLASH = 12,
|
||||
+ };
|
||||
+
|
||||
enum class Slot : unsigned {
|
||||
Base,
|
||||
Bsx,
|
||||
@@ -68,6 +84,7 @@ struct Cartridge : property<Cartridge> {
|
||||
unsigned addrhi;
|
||||
unsigned offset;
|
||||
unsigned size;
|
||||
+ MemoryClass clazz;
|
||||
|
||||
Mapping();
|
||||
Mapping(const function<uint8 (unsigned)>&, const function<void (unsigned, uint8)>&);
|
||||
diff --git a/snes/cartridge/markup.cpp b/snes/cartridge/markup.cpp
|
||||
index e639fe52..2dd0d646 100755
|
||||
--- a/snes/cartridge/markup.cpp
|
||||
+++ b/snes/cartridge/markup.cpp
|
||||
@@ -74,6 +74,7 @@ void Cartridge::parse_markup_rom(XML::Node &root) {
|
||||
for(auto &node : root) {
|
||||
if(node.name != "map") continue;
|
||||
Mapping m(rom);
|
||||
+ m.clazz = MemoryClass::ROM;
|
||||
parse_markup_map(m, node);
|
||||
if(m.size == 0) m.size = rom.size();
|
||||
mapping.append(m);
|
||||
@@ -85,6 +86,7 @@ void Cartridge::parse_markup_ram(XML::Node &root) {
|
||||
ram_size = parse_markup_integer(root["size"].data);
|
||||
for(auto &node : root) {
|
||||
Mapping m(ram);
|
||||
+ m.clazz = MemoryClass::SRAM;
|
||||
parse_markup_map(m, node);
|
||||
if(m.size == 0) m.size = ram_size;
|
||||
mapping.append(m);
|
||||
@@ -133,6 +135,7 @@ void Cartridge::parse_markup_superfx(XML::Node &root) {
|
||||
for(auto &leaf : node) {
|
||||
if(leaf.name != "map") continue;
|
||||
Mapping m(superfx.rom);
|
||||
+ //m.clazz = MemoryClass::SUPERFXROM; -- Aliases ROM.
|
||||
parse_markup_map(m, leaf);
|
||||
mapping.append(m);
|
||||
}
|
||||
@@ -145,6 +148,7 @@ void Cartridge::parse_markup_superfx(XML::Node &root) {
|
||||
}
|
||||
if(leaf.name != "map") continue;
|
||||
Mapping m(superfx.ram);
|
||||
+ //m.clazz = MemoryClass::SUPERFXRAM; -- Aliases SRAM.
|
||||
parse_markup_map(m, leaf);
|
||||
if(m.size == 0) m.size = ram_size;
|
||||
mapping.append(m);
|
||||
@@ -188,6 +192,7 @@ void Cartridge::parse_markup_sa1(XML::Node &root) {
|
||||
for(auto &node : iram) {
|
||||
if(node.name != "map") continue;
|
||||
Mapping m(sa1.cpuiram);
|
||||
+ m.clazz = MemoryClass::SA1IRAM;
|
||||
parse_markup_map(m, node);
|
||||
if(m.size == 0) m.size = 2048;
|
||||
mapping.append(m);
|
||||
@@ -197,6 +202,7 @@ void Cartridge::parse_markup_sa1(XML::Node &root) {
|
||||
for(auto &node : bwram) {
|
||||
if(node.name != "map") continue;
|
||||
Mapping m(sa1.cpubwram);
|
||||
+ //m.clazz = MemoryClass::SA1BWRAM; -- Aliases SRAM
|
||||
parse_markup_map(m, node);
|
||||
if(m.size == 0) m.size = ram_size;
|
||||
mapping.append(m);
|
||||
@@ -341,6 +347,7 @@ void Cartridge::parse_markup_bsx(XML::Node &root) {
|
||||
for(auto &node : root["slot"]) {
|
||||
if(node.name != "map") continue;
|
||||
Mapping m(bsxflash.memory);
|
||||
+ m.clazz = MemoryClass::BSXFLASH;
|
||||
parse_markup_map(m, node);
|
||||
mapping.append(m);
|
||||
}
|
||||
@@ -373,6 +380,7 @@ void Cartridge::parse_markup_sufamiturbo(XML::Node &root) {
|
||||
if(leaf.name != "map") continue;
|
||||
Memory &memory = slotid == 0 ? sufamiturbo.slotA.rom : sufamiturbo.slotB.rom;
|
||||
Mapping m(memory);
|
||||
+ m.clazz = slotid ? MemoryClass::SUFAMITURBO_ROMB : MemoryClass::SUFAMITURBO_ROMA;
|
||||
parse_markup_map(m, leaf);
|
||||
if(m.size == 0) m.size = memory.size();
|
||||
if(m.size) mapping.append(m);
|
||||
@@ -384,6 +392,7 @@ void Cartridge::parse_markup_sufamiturbo(XML::Node &root) {
|
||||
if(leaf.name != "map") continue;
|
||||
Memory &memory = slotid == 0 ? sufamiturbo.slotA.ram : sufamiturbo.slotB.ram;
|
||||
Mapping m(memory);
|
||||
+ m.clazz = slotid ? MemoryClass::SUFAMITURBO_RAMB : MemoryClass::SUFAMITURBO_RAMA;
|
||||
parse_markup_map(m, leaf);
|
||||
if(m.size == 0) m.size = ram_size;
|
||||
if(m.size) mapping.append(m);
|
||||
@@ -536,11 +545,13 @@ void Cartridge::parse_markup_link(XML::Node &root) {
|
||||
}
|
||||
|
||||
Cartridge::Mapping::Mapping() {
|
||||
+ clazz = MemoryClass::MISC;
|
||||
mode = Bus::MapMode::Direct;
|
||||
banklo = bankhi = addrlo = addrhi = offset = size = 0;
|
||||
}
|
||||
|
||||
Cartridge::Mapping::Mapping(Memory &memory) {
|
||||
+ clazz = MemoryClass::MISC;
|
||||
read = { &Memory::read, &memory };
|
||||
write = { &Memory::write, &memory };
|
||||
mode = Bus::MapMode::Direct;
|
||||
diff --git a/snes/cheat/cheat.cpp b/snes/cheat/cheat.cpp
|
||||
index 46c42d1c..3a269cc5 100755
|
||||
--- a/snes/cheat/cheat.cpp
|
||||
+++ b/snes/cheat/cheat.cpp
|
||||
@@ -21,9 +21,9 @@ void Cheat::synchronize() {
|
||||
for(unsigned i = 0; i < size(); i++) {
|
||||
const CheatCode &code = operator[](i);
|
||||
|
||||
- unsigned addr = mirror(code.addr);
|
||||
+ unsigned addr = code.nomirror ? code.addr : mirror(code.addr);
|
||||
override[addr] = true;
|
||||
- if((addr & 0xffe000) == 0x7e0000) {
|
||||
+ if(!code.nomirror && (addr & 0xffe000) == 0x7e0000) {
|
||||
//mirror $7e:0000-1fff to $00-3f|80-bf:0000-1fff
|
||||
unsigned mirroraddr;
|
||||
for(unsigned x = 0; x <= 0x3f; x++) {
|
||||
@@ -40,11 +40,14 @@ void Cheat::synchronize() {
|
||||
}
|
||||
|
||||
uint8 Cheat::read(unsigned addr) const {
|
||||
- addr = mirror(addr);
|
||||
+ unsigned raddr = mirror(addr);
|
||||
|
||||
for(unsigned i = 0; i < size(); i++) {
|
||||
const CheatCode &code = operator[](i);
|
||||
- if(addr == mirror(code.addr)) {
|
||||
+ if(!code.nomirror && addr == mirror(code.addr)) {
|
||||
+ return code.data;
|
||||
+ }
|
||||
+ if(code.nomirror && raddr == code.addr) {
|
||||
return code.data;
|
||||
}
|
||||
}
|
||||
diff --git a/snes/cheat/cheat.hpp b/snes/cheat/cheat.hpp
|
||||
index 306b99b1..b4d2a42e 100755
|
||||
--- a/snes/cheat/cheat.hpp
|
||||
+++ b/snes/cheat/cheat.hpp
|
||||
@@ -1,6 +1,7 @@
|
||||
struct CheatCode {
|
||||
unsigned addr;
|
||||
unsigned data;
|
||||
+ bool nomirror;
|
||||
};
|
||||
|
||||
struct Cheat : public linear_vector<CheatCode> {
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
index 3c980195..25af8e56 100755
|
||||
--- a/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
+++ b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
@@ -6,8 +6,8 @@ void BSXSatellaview::init() {
|
||||
}
|
||||
|
||||
void BSXSatellaview::load() {
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2188, 0x219f, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2188, 0x219f, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2188, 0x219f, 0, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2188, 0x219f, 0, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
|
||||
}
|
||||
|
||||
void BSXSatellaview::unload() {
|
||||
diff --git a/snes/chip/hitachidsp/hitachidsp.cpp b/snes/chip/hitachidsp/hitachidsp.cpp
|
||||
index 1042267e..3e5c5bdb 100755
|
||||
--- a/snes/chip/hitachidsp/hitachidsp.cpp
|
||||
+++ b/snes/chip/hitachidsp/hitachidsp.cpp
|
||||
@@ -23,7 +23,7 @@ void HitachiDSP::enter() {
|
||||
break;
|
||||
case State::DMA:
|
||||
for(unsigned n = 0; n < regs.dma_length; n++) {
|
||||
- bus.write(regs.dma_target + n, bus.read(regs.dma_source + n));
|
||||
+ bus.write(regs.dma_target + n, bus.read(regs.dma_source + n, false));
|
||||
step(2);
|
||||
}
|
||||
state = State::Idle;
|
||||
diff --git a/snes/chip/hitachidsp/memory.cpp b/snes/chip/hitachidsp/memory.cpp
|
||||
index 3c9c3af1..36868e88 100755
|
||||
--- a/snes/chip/hitachidsp/memory.cpp
|
||||
+++ b/snes/chip/hitachidsp/memory.cpp
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifdef HITACHIDSP_CPP
|
||||
|
||||
uint8 HitachiDSP::bus_read(unsigned addr) {
|
||||
- if((addr & 0x408000) == 0x008000) return bus.read(addr);
|
||||
+ if((addr & 0x408000) == 0x008000) return bus.read(addr, false);
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
diff --git a/snes/chip/nss/nss.cpp b/snes/chip/nss/nss.cpp
|
||||
index 964973d0..5946af3b 100755
|
||||
--- a/snes/chip/nss/nss.cpp
|
||||
+++ b/snes/chip/nss/nss.cpp
|
||||
@@ -10,8 +10,8 @@ void NSS::init() {
|
||||
|
||||
void NSS::load() {
|
||||
dip = 0x0000;
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4100, 0x4101, { &NSS::read, this }, { &NSS::write, this });
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4100, 0x4101, { &NSS::read, this }, { &NSS::write, this });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4100, 0x4101, 0, { &NSS::read, this }, { &NSS::write, this });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4100, 0x4101, 0, { &NSS::read, this }, { &NSS::write, this });
|
||||
}
|
||||
|
||||
void NSS::unload() {
|
||||
diff --git a/snes/chip/sa1/memory/memory.cpp b/snes/chip/sa1/memory/memory.cpp
|
||||
index d13ac929..9bb4ff20 100755
|
||||
--- a/snes/chip/sa1/memory/memory.cpp
|
||||
+++ b/snes/chip/sa1/memory/memory.cpp
|
||||
@@ -107,7 +107,7 @@ void SA1::op_io() {
|
||||
tick();
|
||||
}
|
||||
|
||||
-uint8 SA1::op_read(unsigned addr) {
|
||||
+uint8 SA1::op_read(unsigned addr, bool exec) {
|
||||
tick();
|
||||
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
|
||||
return bus_read(addr);
|
||||
diff --git a/snes/chip/sa1/memory/memory.hpp b/snes/chip/sa1/memory/memory.hpp
|
||||
index ffb9e9f6..ab8e1edd 100755
|
||||
--- a/snes/chip/sa1/memory/memory.hpp
|
||||
+++ b/snes/chip/sa1/memory/memory.hpp
|
||||
@@ -3,7 +3,7 @@ void bus_write(unsigned addr, uint8 data);
|
||||
uint8 vbr_read(unsigned addr);
|
||||
|
||||
alwaysinline void op_io();
|
||||
-alwaysinline uint8 op_read(unsigned addr);
|
||||
+alwaysinline uint8 op_read(unsigned addr, bool exec);
|
||||
alwaysinline void op_write(unsigned addr, uint8 data);
|
||||
|
||||
uint8 mmc_read(unsigned addr);
|
||||
diff --git a/snes/chip/sa1/sa1.cpp b/snes/chip/sa1/sa1.cpp
|
||||
index 71c6310a..30e00809 100755
|
||||
--- a/snes/chip/sa1/sa1.cpp
|
||||
+++ b/snes/chip/sa1/sa1.cpp
|
||||
@@ -37,7 +37,7 @@ void SA1::enter() {
|
||||
}
|
||||
|
||||
void SA1::op_irq() {
|
||||
- op_read(regs.pc.d);
|
||||
+ op_read(regs.pc.d, false);
|
||||
op_io();
|
||||
if(!regs.e) op_writestack(regs.pc.b);
|
||||
op_writestack(regs.pc.h);
|
||||
diff --git a/snes/chip/sdd1/sdd1.cpp b/snes/chip/sdd1/sdd1.cpp
|
||||
index c9b8b1c4..5d6cc55f 100755
|
||||
--- a/snes/chip/sdd1/sdd1.cpp
|
||||
+++ b/snes/chip/sdd1/sdd1.cpp
|
||||
@@ -14,8 +14,8 @@ void SDD1::init() {
|
||||
void SDD1::load() {
|
||||
//hook S-CPU DMA MMIO registers to gather information for struct dma[];
|
||||
//buffer address and transfer size information for use in SDD1::mcu_read()
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
|
||||
}
|
||||
|
||||
void SDD1::unload() {
|
||||
diff --git a/snes/cpu/core/core.hpp b/snes/cpu/core/core.hpp
|
||||
index 7a685a8d..9d77f3c5 100755
|
||||
--- a/snes/cpu/core/core.hpp
|
||||
+++ b/snes/cpu/core/core.hpp
|
||||
@@ -10,7 +10,7 @@ struct CPUcore {
|
||||
void powercycle();
|
||||
|
||||
virtual void op_io() = 0;
|
||||
- virtual uint8_t op_read(uint32_t addr) = 0;
|
||||
+ virtual uint8_t op_read(uint32_t addr, bool exec = false) = 0;
|
||||
virtual void op_write(uint32_t addr, uint8_t data) = 0;
|
||||
virtual void last_cycle() = 0;
|
||||
virtual bool interrupt_pending() = 0;
|
||||
diff --git a/snes/cpu/core/disassembler/disassembler.cpp b/snes/cpu/core/disassembler/disassembler.cpp
|
||||
index 030b3ab5..ab8dde24 100755
|
||||
--- a/snes/cpu/core/disassembler/disassembler.cpp
|
||||
+++ b/snes/cpu/core/disassembler/disassembler.cpp
|
||||
@@ -6,7 +6,7 @@ uint8 CPUcore::dreadb(uint32 addr) {
|
||||
//do not read MMIO registers within debugger
|
||||
return 0x00;
|
||||
}
|
||||
- return bus.read(addr);
|
||||
+ return bus.read(addr, false);
|
||||
}
|
||||
|
||||
uint16 CPUcore::dreadw(uint32 addr) {
|
||||
diff --git a/snes/cpu/core/memory.hpp b/snes/cpu/core/memory.hpp
|
||||
index 49926578..132501c1 100755
|
||||
--- a/snes/cpu/core/memory.hpp
|
||||
+++ b/snes/cpu/core/memory.hpp
|
||||
@@ -1,5 +1,5 @@
|
||||
alwaysinline uint8_t op_readpc() {
|
||||
- return op_read((regs.pc.b << 16) + regs.pc.w++);
|
||||
+ return op_read((regs.pc.b << 16) + regs.pc.w++, true);
|
||||
}
|
||||
|
||||
alwaysinline uint8_t op_readstack() {
|
||||
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
|
||||
index 2d7d3432..39da6b16 100755
|
||||
--- a/snes/cpu/cpu.cpp
|
||||
+++ b/snes/cpu/cpu.cpp
|
||||
@@ -78,8 +78,8 @@ void CPU::enter() {
|
||||
} else if(status.reset_pending) {
|
||||
status.reset_pending = false;
|
||||
add_clocks(186);
|
||||
- regs.pc.l = bus.read(0xfffc);
|
||||
- regs.pc.h = bus.read(0xfffd);
|
||||
+ regs.pc.l = bus.read(0xfffc, false);
|
||||
+ regs.pc.h = bus.read(0xfffd, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,24 +95,24 @@ void CPU::enable() {
|
||||
function<uint8 (unsigned)> read = { &CPU::mmio_read, (CPU*)&cpu };
|
||||
function<void (unsigned, uint8)> write = { &CPU::mmio_write, (CPU*)&cpu };
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, 0, read, write);
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, read, write);
|
||||
|
||||
read = [](unsigned addr) { return cpu.wram[addr]; };
|
||||
write = [](unsigned addr, uint8 data) { cpu.wram[addr] = data; };
|
||||
|
||||
- bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
|
||||
- bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
|
||||
- bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, read, write);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
|
||||
+ bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, 3, read, write);
|
||||
}
|
||||
|
||||
void CPU::power() {
|
||||
diff --git a/snes/cpu/debugger/debugger.cpp b/snes/cpu/debugger/debugger.cpp
|
||||
index a33518ed..8301bdb6 100755
|
||||
--- a/snes/cpu/debugger/debugger.cpp
|
||||
+++ b/snes/cpu/debugger/debugger.cpp
|
||||
@@ -19,8 +19,8 @@ void CPUDebugger::op_step() {
|
||||
synchronize_smp();
|
||||
}
|
||||
|
||||
-uint8 CPUDebugger::op_read(uint32 addr) {
|
||||
- uint8 data = CPU::op_read(addr);
|
||||
+uint8 CPUDebugger::op_read(uint32 addr, bool exec) {
|
||||
+ uint8 data = CPU::op_read(addr, exec);
|
||||
usage[addr] |= UsageRead;
|
||||
debugger.breakpoint_test(Debugger::Breakpoint::Source::CPUBus, Debugger::Breakpoint::Mode::Read, addr, data);
|
||||
return data;
|
||||
diff --git a/snes/cpu/debugger/debugger.hpp b/snes/cpu/debugger/debugger.hpp
|
||||
index 579f6f03..c3d66db5 100755
|
||||
--- a/snes/cpu/debugger/debugger.hpp
|
||||
+++ b/snes/cpu/debugger/debugger.hpp
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
bool opcode_edge; //true right before an opcode execues, used to skip over opcodes
|
||||
|
||||
void op_step();
|
||||
- uint8 op_read(uint32 addr);
|
||||
+ uint8 op_read(uint32 addr, bool exec = false);
|
||||
void op_write(uint32 addr, uint8 data);
|
||||
|
||||
CPUDebugger();
|
||||
diff --git a/snes/cpu/dma/dma.cpp b/snes/cpu/dma/dma.cpp
|
||||
index e8cdb3ec..0a00bfea 100755
|
||||
--- a/snes/cpu/dma/dma.cpp
|
||||
+++ b/snes/cpu/dma/dma.cpp
|
||||
@@ -26,7 +26,7 @@ bool CPU::dma_addr_valid(uint32 abus) {
|
||||
|
||||
uint8 CPU::dma_read(uint32 abus) {
|
||||
if(dma_addr_valid(abus) == false) return 0x00;
|
||||
- return bus.read(abus);
|
||||
+ return bus.read(abus, false);
|
||||
}
|
||||
|
||||
//simulate two-stage pipeline for DMA transfers; example:
|
||||
@@ -49,7 +49,7 @@ void CPU::dma_transfer(bool direction, uint8 bbus, uint32 abus) {
|
||||
dma_write(dma_transfer_valid(bbus, abus), 0x2100 | bbus, regs.mdr);
|
||||
} else {
|
||||
dma_add_clocks(4);
|
||||
- regs.mdr = dma_transfer_valid(bbus, abus) ? bus.read(0x2100 | bbus) : 0x00;
|
||||
+ regs.mdr = dma_transfer_valid(bbus, abus) ? bus.read(0x2100 | bbus, false) : 0x00;
|
||||
dma_add_clocks(4);
|
||||
dma_write(dma_addr_valid(abus), abus, regs.mdr);
|
||||
}
|
||||
diff --git a/snes/cpu/memory/memory.cpp b/snes/cpu/memory/memory.cpp
|
||||
index c2c8f1fa..31f82c31 100755
|
||||
--- a/snes/cpu/memory/memory.cpp
|
||||
+++ b/snes/cpu/memory/memory.cpp
|
||||
@@ -10,11 +10,11 @@ void CPU::op_io() {
|
||||
alu_edge();
|
||||
}
|
||||
|
||||
-uint8 CPU::op_read(uint32 addr) {
|
||||
+uint8 CPU::op_read(uint32 addr, bool exec) {
|
||||
status.clock_count = speed(addr);
|
||||
dma_edge();
|
||||
add_clocks(status.clock_count - 4);
|
||||
- regs.mdr = bus.read(addr);
|
||||
+ regs.mdr = bus.read(addr, exec);
|
||||
add_clocks(4);
|
||||
alu_edge();
|
||||
return regs.mdr;
|
||||
diff --git a/snes/cpu/memory/memory.hpp b/snes/cpu/memory/memory.hpp
|
||||
index d33861d4..fd64ba8b 100755
|
||||
--- a/snes/cpu/memory/memory.hpp
|
||||
+++ b/snes/cpu/memory/memory.hpp
|
||||
@@ -1,4 +1,4 @@
|
||||
void op_io();
|
||||
-debugvirtual uint8 op_read(uint32 addr);
|
||||
+debugvirtual uint8 op_read(uint32 addr, bool exec);
|
||||
debugvirtual void op_write(uint32 addr, uint8 data);
|
||||
alwaysinline unsigned speed(unsigned addr) const;
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index b7afff00..30048c19 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -5,7 +5,7 @@ bool CPU::joylatch() { return status.joypad_strobe_latch; }
|
||||
|
||||
//WMDATA
|
||||
uint8 CPU::mmio_r2180() {
|
||||
- return bus.read(0x7e0000 | status.wram_addr++);
|
||||
+ return bus.read(0x7e0000 | status.wram_addr++, false);
|
||||
}
|
||||
|
||||
//WMDATA
|
||||
diff --git a/snes/debugger/debugger.cpp b/snes/debugger/debugger.cpp
|
||||
index b1312339..e8d0f5af 100755
|
||||
--- a/snes/debugger/debugger.cpp
|
||||
+++ b/snes/debugger/debugger.cpp
|
||||
@@ -33,7 +33,7 @@ uint8 Debugger::read(Debugger::MemorySource source, unsigned addr) {
|
||||
case MemorySource::CPUBus: {
|
||||
//do not read from memory-mapped registers that could affect program behavior
|
||||
if(((addr - 0x2000) & 0x40c000) == 0x000000) break; //$00-3f:2000-5fff MMIO
|
||||
- return bus.read(addr & 0xffffff);
|
||||
+ return bus.read(addr & 0xffffff, false);
|
||||
} break;
|
||||
|
||||
case MemorySource::APUBus: {
|
||||
diff --git a/snes/memory/memory-inline.hpp b/snes/memory/memory-inline.hpp
|
||||
index 70503bea..45f150c9 100755
|
||||
--- a/snes/memory/memory-inline.hpp
|
||||
+++ b/snes/memory/memory-inline.hpp
|
||||
@@ -51,11 +51,26 @@ MappedRAM::MappedRAM() : data_(0), size_(0), write_protect_(false) {}
|
||||
|
||||
//Bus
|
||||
|
||||
-uint8 Bus::read(unsigned addr) {
|
||||
- if(cheat.override[addr]) return cheat.read(addr);
|
||||
- return reader[lookup[addr]](target[addr]);
|
||||
+uint8 Bus::read(unsigned addr, bool exec) {
|
||||
+ uint8 emask = exec ? 0x24 : 0x09;
|
||||
+ uint8 val;
|
||||
+ if(__builtin_expect(cheat.override[addr], 0))
|
||||
+ val = cheat.read(addr);
|
||||
+ else
|
||||
+ val = reader[lookup[addr]](target[addr]);
|
||||
+ if(__builtin_expect((u_debugflags | debugflags[addr]) & emask, 0)) {
|
||||
+ unsigned daddr = target[addr];
|
||||
+ uint8 mclass = classmap[addr];
|
||||
+ debug_read(mclass, daddr, addr, val, exec);
|
||||
+ }
|
||||
+ return val;
|
||||
}
|
||||
|
||||
void Bus::write(unsigned addr, uint8 data) {
|
||||
+ if(__builtin_expect((u_debugflags | debugflags[addr]) & 0x12, 0)) {
|
||||
+ unsigned daddr = target[addr];
|
||||
+ uint8 mclass = classmap[addr];
|
||||
+ debug_write(mclass, daddr, addr, data);
|
||||
+ }
|
||||
return writer[lookup[addr]](target[addr], data);
|
||||
}
|
||||
diff --git a/snes/memory/memory.cpp b/snes/memory/memory.cpp
|
||||
index ede9cbd0..a9a484a0 100755
|
||||
--- a/snes/memory/memory.cpp
|
||||
+++ b/snes/memory/memory.cpp
|
||||
@@ -27,6 +27,7 @@ void Bus::map(
|
||||
MapMode mode,
|
||||
unsigned bank_lo, unsigned bank_hi,
|
||||
unsigned addr_lo, unsigned addr_hi,
|
||||
+ unsigned mclass,
|
||||
const function<uint8 (unsigned)> &rd,
|
||||
const function<void (unsigned, uint8)> &wr,
|
||||
unsigned base, unsigned length
|
||||
@@ -48,6 +49,7 @@ void Bus::map(
|
||||
if(mode == MapMode::Shadow) destaddr = mirror(base + destaddr, length);
|
||||
lookup[(bank << 16) | addr] = id;
|
||||
target[(bank << 16) | addr] = destaddr;
|
||||
+ if(mclass) classmap[(bank << 16) | addr] = mclass;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,23 +59,58 @@ void Bus::map_reset() {
|
||||
function<void (unsigned, uint8)> writer = [](unsigned, uint8) {};
|
||||
|
||||
idcount = 0;
|
||||
- map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, reader, writer);
|
||||
+ map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, 0xFF, reader, writer);
|
||||
}
|
||||
|
||||
void Bus::map_xml() {
|
||||
for(auto &m : cartridge.mapping) {
|
||||
- map(m.mode, m.banklo, m.bankhi, m.addrlo, m.addrhi, m.read, m.write, m.offset, m.size);
|
||||
+ map(m.mode, m.banklo, m.bankhi, m.addrlo, m.addrhi, (unsigned)m.clazz, m.read, m.write, m.offset, m.size);
|
||||
}
|
||||
}
|
||||
|
||||
+unsigned Bus::enumerateMirrors(uint8 clazz, uint32 offset, unsigned start)
|
||||
+{
|
||||
+ unsigned i;
|
||||
+ for(i = start; i < 0x1000000; i++)
|
||||
+ if((classmap[i] == clazz && target[i] == offset) || (i == offset && clazz == 255))
|
||||
+ return i;
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
+void Bus::clearDebugFlags()
|
||||
+{
|
||||
+ u_debugflags = 0;
|
||||
+ memset(debugflags, 0, 0x1000000);
|
||||
+}
|
||||
+
|
||||
+void Bus::debugFlags(uint8 setf, uint8 clrf)
|
||||
+{
|
||||
+ u_debugflags = (u_debugflags | setf) & ~clrf;
|
||||
+}
|
||||
+
|
||||
+void Bus::debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset)
|
||||
+{
|
||||
+ if(clazz == 255) {
|
||||
+ setf <<= 3;
|
||||
+ clrf <<= 3;
|
||||
+ debugflags[offset] = (debugflags[offset] | setf) & ~clrf;
|
||||
+ } else
|
||||
+ for(unsigned i = 0; i < 0x1000000; i++)
|
||||
+ if(classmap[i] == clazz && target[i] == offset)
|
||||
+ debugflags[i] = (debugflags[i] | setf) & ~clrf;
|
||||
+}
|
||||
+
|
||||
Bus::Bus() {
|
||||
- lookup = new uint8 [16 * 1024 * 1024];
|
||||
- target = new uint32[16 * 1024 * 1024];
|
||||
+ u_debugflags = 0;
|
||||
+ lookup = new uint8 [112 * 1024 * 1024];
|
||||
+ target = (uint32*)(lookup + 0x3000000);
|
||||
+ classmap = lookup + 0x1000000;
|
||||
+ debugflags = lookup + 0x2000000;
|
||||
+ memset(debugflags, 0, 0x1000000);
|
||||
}
|
||||
|
||||
Bus::~Bus() {
|
||||
delete[] lookup;
|
||||
- delete[] target;
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/snes/memory/memory.hpp b/snes/memory/memory.hpp
|
||||
index 634e0717..c20e14db 100755
|
||||
--- a/snes/memory/memory.hpp
|
||||
+++ b/snes/memory/memory.hpp
|
||||
@@ -44,10 +44,13 @@ private:
|
||||
struct Bus {
|
||||
unsigned mirror(unsigned addr, unsigned size);
|
||||
|
||||
- alwaysinline uint8 read(unsigned addr);
|
||||
+ alwaysinline uint8 read(unsigned addr, bool exec);
|
||||
alwaysinline void write(unsigned addr, uint8 data);
|
||||
|
||||
uint8 *lookup;
|
||||
+ uint8 *classmap;
|
||||
+ uint8 *debugflags;
|
||||
+ uint8 u_debugflags;
|
||||
uint32 *target;
|
||||
|
||||
unsigned idcount;
|
||||
@@ -59,6 +62,7 @@ struct Bus {
|
||||
MapMode mode,
|
||||
unsigned bank_lo, unsigned bank_hi,
|
||||
unsigned addr_lo, unsigned addr_hi,
|
||||
+ unsigned mclass,
|
||||
const function<uint8 (unsigned)> &read,
|
||||
const function<void (unsigned, uint8)> &write,
|
||||
unsigned base = 0, unsigned length = 0
|
||||
@@ -67,6 +71,13 @@ struct Bus {
|
||||
void map_reset();
|
||||
void map_xml();
|
||||
|
||||
+ void clearDebugFlags();
|
||||
+ void debugFlags(uint8 setf, uint8 clrf);
|
||||
+ void debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset);
|
||||
+ unsigned enumerateMirrors(uint8 clazz, uint32 offset, unsigned start);
|
||||
+ function<void (uint8, unsigned, unsigned, uint8, bool)> debug_read;
|
||||
+ function<void (uint8, unsigned, unsigned, uint8)> debug_write;
|
||||
+
|
||||
Bus();
|
||||
~Bus();
|
||||
};
|
||||
diff --git a/snes/ppu/ppu.cpp b/snes/ppu/ppu.cpp
|
||||
index 8545175f..13e231cf 100755
|
||||
--- a/snes/ppu/ppu.cpp
|
||||
+++ b/snes/ppu/ppu.cpp
|
||||
@@ -87,8 +87,8 @@ void PPU::enable() {
|
||||
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
|
||||
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
|
||||
|
||||
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
|
||||
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
|
||||
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
|
||||
}
|
||||
|
||||
void PPU::power() {
|
||||
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
|
||||
index 1489fcef..13d69364 100755
|
||||
--- a/snes/smp/core/core.hpp
|
||||
+++ b/snes/smp/core/core.hpp
|
||||
@@ -2,7 +2,7 @@ struct SMPcore {
|
||||
virtual void op_io() = 0;
|
||||
virtual uint8 op_read(uint16 addr) = 0;
|
||||
virtual void op_write(uint16 addr, uint8 data) = 0;
|
||||
- void op_step();
|
||||
+ virtual void op_step();
|
||||
|
||||
#include "registers.hpp"
|
||||
#include "memory.hpp"
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index dffeeee3..37ed1feb 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#ifndef SNES_HPP
|
||||
#define SNES_HPP
|
||||
+#define BSNES_SUPPORTS_ADV_BREAKPOINTS
|
||||
|
||||
namespace SNES {
|
||||
namespace Info {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From 8bc6bb381e680616dcc843c99889799aedd43163 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 30 Nov 2013 10:27:37 +0200
|
||||
Subject: [PATCH 13/27] Support auto-detecting bsnes version
|
||||
|
||||
---
|
||||
bsnes.mk | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
create mode 100644 bsnes.mk
|
||||
|
||||
diff --git a/bsnes.mk b/bsnes.mk
|
||||
new file mode 100644
|
||||
index 00000000..20f22f61
|
||||
--- /dev/null
|
||||
+++ b/bsnes.mk
|
||||
@@ -0,0 +1,3 @@
|
||||
+BSNES_SUPPORTS_DEBUGGER=yes
|
||||
+LIBSNES_DIR=ui-libsnes
|
||||
+BSNES_VERSION=085
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
From 40c456dadd79cb2c94379fda8b41a4d0ba051ad1 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 7 Dec 2013 23:32:44 +0200
|
||||
Subject: [PATCH 14/27] Support alternate (more accurate) poll timings
|
||||
|
||||
---
|
||||
snes/config/config.cpp | 1 +
|
||||
snes/config/config.hpp | 1 +
|
||||
snes/cpu/timing/joypad.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
snes/cpu/timing/timing.cpp | 16 ++++++++++++----
|
||||
snes/cpu/timing/timing.hpp | 1 +
|
||||
snes/snes.hpp | 1 +
|
||||
6 files changed, 56 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
|
||||
index 701af94c..206daae0 100755
|
||||
--- a/snes/config/config.cpp
|
||||
+++ b/snes/config/config.cpp
|
||||
@@ -13,6 +13,7 @@ Configuration::Configuration() {
|
||||
cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000
|
||||
cpu.pal_frequency = 21281370;
|
||||
cpu.wram_init_value = 0x55;
|
||||
+ cpu.alt_poll_timings = false;
|
||||
|
||||
smp.ntsc_frequency = 24607104; //32040.5 * 768
|
||||
smp.pal_frequency = 24607104;
|
||||
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
|
||||
index 1f4d037c..dabde597 100755
|
||||
--- a/snes/config/config.hpp
|
||||
+++ b/snes/config/config.hpp
|
||||
@@ -10,6 +10,7 @@ struct Configuration {
|
||||
unsigned ntsc_frequency;
|
||||
unsigned pal_frequency;
|
||||
unsigned wram_init_value;
|
||||
+ bool alt_poll_timings;
|
||||
} cpu;
|
||||
|
||||
struct SMP {
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 6a98de00..ae8e94f8 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -29,4 +29,44 @@ void CPU::step_auto_joypad_poll() {
|
||||
}
|
||||
}
|
||||
|
||||
+//called every 128 clocks; see CPU::add_clocks()
|
||||
+void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
+ if(status.auto_joypad_counter > 0 && status.auto_joypad_counter <= 34) {
|
||||
+ if(!status.auto_joypad_latch) {
|
||||
+ //FIXME: Is this right, busy flag goes on even if not enabled???
|
||||
+ if(status.auto_joypad_counter == 1)
|
||||
+ status.auto_joypad_active = true;
|
||||
+ if(status.auto_joypad_counter == 34)
|
||||
+ status.auto_joypad_active = false;
|
||||
+ } else {
|
||||
+ if(status.auto_joypad_counter == 1) {
|
||||
+ status.auto_joypad_active = true;
|
||||
+ input.port1->latch(1);
|
||||
+ input.port2->latch(1);
|
||||
+ }
|
||||
+ if(status.auto_joypad_counter == 3) {
|
||||
+ input.port1->latch(0);
|
||||
+ input.port2->latch(0);
|
||||
+ }
|
||||
+ if((status.auto_joypad_counter & 1) != 0 && status.auto_joypad_counter != 1) {
|
||||
+ uint2 port0 = input.port1->data();
|
||||
+ uint2 port1 = input.port2->data();
|
||||
+
|
||||
+ status.joy1 = (status.joy1 << 1) | (bool)(port0 & 1);
|
||||
+ status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
|
||||
+ status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
+ status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
+ }
|
||||
+ if(status.auto_joypad_counter == 34)
|
||||
+ status.auto_joypad_active = false;
|
||||
+ }
|
||||
+ status.auto_joypad_counter++;
|
||||
+ }
|
||||
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && status.auto_joypad_counter == 0 && !polarity) {
|
||||
+ status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
+ status.auto_joypad_counter = 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
#endif
|
||||
diff --git a/snes/cpu/timing/timing.cpp b/snes/cpu/timing/timing.cpp
|
||||
index f1378f0c..d7cf24f3 100755
|
||||
--- a/snes/cpu/timing/timing.cpp
|
||||
+++ b/snes/cpu/timing/timing.cpp
|
||||
@@ -17,10 +17,18 @@ void CPU::add_clocks(unsigned clocks) {
|
||||
|
||||
step(clocks);
|
||||
|
||||
- status.auto_joypad_clock += clocks;
|
||||
- if(status.auto_joypad_clock >= 256) {
|
||||
- status.auto_joypad_clock -= 256;
|
||||
- step_auto_joypad_poll();
|
||||
+ if(config.cpu.alt_poll_timings) {
|
||||
+ bool opolarity = (status.auto_joypad_clock & 128);
|
||||
+ status.auto_joypad_clock = (status.auto_joypad_clock + clocks) & 0xFF;
|
||||
+ bool npolarity = (status.auto_joypad_clock & 128);
|
||||
+ if(opolarity != npolarity)
|
||||
+ step_auto_joypad_poll_NEW(opolarity);
|
||||
+ } else {
|
||||
+ status.auto_joypad_clock += clocks;
|
||||
+ if(status.auto_joypad_clock >= 256) {
|
||||
+ status.auto_joypad_clock -= 256;
|
||||
+ step_auto_joypad_poll();
|
||||
+ }
|
||||
}
|
||||
|
||||
if(status.dram_refreshed == false && hcounter() >= status.dram_refresh_position) {
|
||||
diff --git a/snes/cpu/timing/timing.hpp b/snes/cpu/timing/timing.hpp
|
||||
index 6c225dab..bf15a727 100755
|
||||
--- a/snes/cpu/timing/timing.hpp
|
||||
+++ b/snes/cpu/timing/timing.hpp
|
||||
@@ -22,3 +22,4 @@ alwaysinline bool irq_test();
|
||||
|
||||
//joypad.cpp
|
||||
void step_auto_joypad_poll();
|
||||
+void step_auto_joypad_poll_NEW(bool polarity);
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 37ed1feb..4e3ba64c 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef SNES_HPP
|
||||
#define SNES_HPP
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
|
||||
+#define BSNES_SUPPORTS_ALT_TIMINGS
|
||||
|
||||
namespace SNES {
|
||||
namespace Info {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
103
bsnes-patches/v085/0015-Fix-mouse-speed-support.patch
Normal file
103
bsnes-patches/v085/0015-Fix-mouse-speed-support.patch
Normal file
|
@ -0,0 +1,103 @@
|
|||
From 863bde899b53ae31e854096ac5258208c848a293 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Thu, 6 Mar 2014 21:07:54 +0200
|
||||
Subject: [PATCH 15/27] Fix mouse speed support
|
||||
|
||||
---
|
||||
snes/config/config.cpp | 1 +
|
||||
snes/config/config.hpp | 3 +++
|
||||
snes/controller/mouse/mouse.cpp | 11 +++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 1 +
|
||||
4 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
|
||||
index 206daae0..19831370 100755
|
||||
--- a/snes/config/config.cpp
|
||||
+++ b/snes/config/config.cpp
|
||||
@@ -8,6 +8,7 @@ Configuration::Configuration() {
|
||||
expansion_port = System::ExpansionPortDevice::BSX;
|
||||
region = System::Region::Autodetect;
|
||||
random = true;
|
||||
+ mouse_speed_fix = false;
|
||||
|
||||
cpu.version = 2;
|
||||
cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000
|
||||
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
|
||||
index dabde597..68fe0bde 100755
|
||||
--- a/snes/config/config.hpp
|
||||
+++ b/snes/config/config.hpp
|
||||
@@ -1,9 +1,12 @@
|
||||
+#define BSNES_SUPPORTS_MOUSE_SPEED_FIX
|
||||
+
|
||||
struct Configuration {
|
||||
Input::Device controller_port1;
|
||||
Input::Device controller_port2;
|
||||
System::ExpansionPortDevice expansion_port;
|
||||
System::Region region;
|
||||
bool random;
|
||||
+ bool mouse_speed_fix;
|
||||
|
||||
struct CPU {
|
||||
unsigned version;
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index 1a066b98..caa7a358 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifdef CONTROLLER_CPP
|
||||
|
||||
uint2 Mouse::data() {
|
||||
+ if(config.mouse_speed_fix && latched) {
|
||||
+ speed = (speed + 1) % 3;
|
||||
+ return 0;
|
||||
+ }
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
if(counter == 0) {
|
||||
@@ -31,8 +35,8 @@ uint2 Mouse::data() {
|
||||
|
||||
case 8: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Right);
|
||||
case 9: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Left);
|
||||
- case 10: return 0; //speed (0 = slow, 1 = normal, 2 = fast, 3 = unused)
|
||||
- case 11: return 0; // ||
|
||||
+ case 10: return speed >> 1; //speed (0 = slow, 1 = normal, 2 = fast, 3 = unused)
|
||||
+ case 11: return speed & 1; // ||
|
||||
|
||||
case 12: return 0; //signature
|
||||
case 13: return 0; // ||
|
||||
@@ -75,10 +79,12 @@ void Mouse::serialize(serializer& s) {
|
||||
block[3] = (unsigned short)_position_x;
|
||||
block[4] = (unsigned short)_position_y >> 8;
|
||||
block[5] = (unsigned short)_position_y;
|
||||
+ block[6] = speed;
|
||||
s.array(block, Controller::SaveSize);
|
||||
if(s.mode() == nall::serializer::Load) {
|
||||
latched = (block[0] != 0);
|
||||
counter = block[1];
|
||||
+ speed = block[6];
|
||||
_position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
_position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
}
|
||||
@@ -87,6 +93,7 @@ void Mouse::serialize(serializer& s) {
|
||||
Mouse::Mouse(bool port) : Controller(port) {
|
||||
latched = 0;
|
||||
counter = 0;
|
||||
+ speed = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index b07c8ab7..13a9313e 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -6,6 +6,7 @@ struct Mouse : Controller {
|
||||
private:
|
||||
bool latched;
|
||||
unsigned counter;
|
||||
+ unsigned speed;
|
||||
int _position_x;
|
||||
int _position_y;
|
||||
};
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 60267d1f22fd2ff3197c6c829640f66304c89283 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 16 Mar 2014 16:40:55 +0200
|
||||
Subject: [PATCH 16/27] Fix tracelog of controller registers
|
||||
|
||||
---
|
||||
snes/cpu/core/disassembler/disassembler.cpp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/snes/cpu/core/disassembler/disassembler.cpp b/snes/cpu/core/disassembler/disassembler.cpp
|
||||
index ab8dde24..624a80ce 100755
|
||||
--- a/snes/cpu/core/disassembler/disassembler.cpp
|
||||
+++ b/snes/cpu/core/disassembler/disassembler.cpp
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifdef CPUCORE_CPP
|
||||
|
||||
uint8 CPUcore::dreadb(uint32 addr) {
|
||||
+ if((addr & 0x40fff8) == 0x4218)
|
||||
+ return bus.read(addr, false); //Controller registers are safe to read.
|
||||
if((addr & 0x40ffff) >= 0x2000 && (addr & 0x40ffff) <= 0x5fff) {
|
||||
//$[00-3f|80-bf]:[2000-5fff]
|
||||
//do not read MMIO registers within debugger
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
From de71f12eb59a41899a5c77d797e144e6f0919777 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 17 Mar 2014 14:22:58 +0200
|
||||
Subject: [PATCH 17/27] Fix performance problem with non-bus breakpoints
|
||||
|
||||
---
|
||||
snes/memory/memory.cpp | 35 ++++++++++++++++++++++++++---------
|
||||
snes/memory/memory.hpp | 1 +
|
||||
snes/snes.hpp | 1 +
|
||||
3 files changed, 28 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/snes/memory/memory.cpp b/snes/memory/memory.cpp
|
||||
index a9a484a0..d22e3137 100755
|
||||
--- a/snes/memory/memory.cpp
|
||||
+++ b/snes/memory/memory.cpp
|
||||
@@ -43,6 +43,7 @@ void Bus::map(
|
||||
|
||||
unsigned offset = 0;
|
||||
for(unsigned bank = bank_lo; bank <= bank_hi; bank++) {
|
||||
+ region_start.insert((bank << 16) | addr_lo);
|
||||
for(unsigned addr = addr_lo; addr <= addr_hi; addr++) {
|
||||
unsigned destaddr = (bank << 16) | addr;
|
||||
if(mode == MapMode::Linear) destaddr = mirror(base + offset++, length);
|
||||
@@ -60,6 +61,7 @@ void Bus::map_reset() {
|
||||
|
||||
idcount = 0;
|
||||
map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, 0xFF, reader, writer);
|
||||
+ region_start.clear();
|
||||
}
|
||||
|
||||
void Bus::map_xml() {
|
||||
@@ -70,11 +72,21 @@ void Bus::map_xml() {
|
||||
|
||||
unsigned Bus::enumerateMirrors(uint8 clazz, uint32 offset, unsigned start)
|
||||
{
|
||||
- unsigned i;
|
||||
- for(i = start; i < 0x1000000; i++)
|
||||
- if((classmap[i] == clazz && target[i] == offset) || (i == offset && clazz == 255))
|
||||
- return i;
|
||||
- return i;
|
||||
+ if(clazz == 255) {
|
||||
+ if(start > offset)
|
||||
+ return 0x1000000;
|
||||
+ else
|
||||
+ return start;
|
||||
+ }
|
||||
+ //Given region can not contain the same address twice.
|
||||
+ for(std::set<uint32>::iterator i = region_start.lower_bound(start); i != region_start.end(); i++) {
|
||||
+ if(classmap[*i] != clazz) continue;
|
||||
+ if(target[*i] > offset) continue;
|
||||
+ uint32 wouldbe = offset - target[*i] + *i;
|
||||
+ if(wouldbe > 0xFFFFFF) continue;
|
||||
+ if(classmap[wouldbe] == clazz && target[wouldbe] == offset) return wouldbe;
|
||||
+ }
|
||||
+ return 0x1000000;
|
||||
}
|
||||
|
||||
void Bus::clearDebugFlags()
|
||||
@@ -94,10 +106,15 @@ void Bus::debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset)
|
||||
setf <<= 3;
|
||||
clrf <<= 3;
|
||||
debugflags[offset] = (debugflags[offset] | setf) & ~clrf;
|
||||
- } else
|
||||
- for(unsigned i = 0; i < 0x1000000; i++)
|
||||
- if(classmap[i] == clazz && target[i] == offset)
|
||||
- debugflags[i] = (debugflags[i] | setf) & ~clrf;
|
||||
+ } else {
|
||||
+ uint32 i = 0;
|
||||
+ while(true) {
|
||||
+ i = enumerateMirrors(clazz, offset, i);
|
||||
+ if(i >= 0x1000000) break;
|
||||
+ debugflags[i] = (debugflags[i] | setf) & ~clrf;
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
Bus::Bus() {
|
||||
diff --git a/snes/memory/memory.hpp b/snes/memory/memory.hpp
|
||||
index c20e14db..ee0c0a9e 100755
|
||||
--- a/snes/memory/memory.hpp
|
||||
+++ b/snes/memory/memory.hpp
|
||||
@@ -52,6 +52,7 @@ struct Bus {
|
||||
uint8 *debugflags;
|
||||
uint8 u_debugflags;
|
||||
uint32 *target;
|
||||
+ std::set<uint32> region_start;
|
||||
|
||||
unsigned idcount;
|
||||
function<uint8 (unsigned)> reader[256];
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 4e3ba64c..9589db9b 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -38,6 +38,7 @@ namespace SNES {
|
||||
#include <nall/varint.hpp>
|
||||
#include <nall/vector.hpp>
|
||||
#include <nall/gameboy/cartridge.hpp>
|
||||
+#include <set>
|
||||
using namespace nall;
|
||||
|
||||
#include <gameboy/gameboy.hpp>
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,537 @@
|
|||
From 6bd069191d29ad70d38c82d59dd72cd0996fc45c Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 31 Mar 2014 20:17:46 +0300
|
||||
Subject: [PATCH 18/27] Support VRAM, OAM, CGRAM and APURAM breakpoints
|
||||
|
||||
---
|
||||
snes/alt/ppu-compatibility/memory/memory.cpp | 44 +++++++++++++++++++++--
|
||||
snes/alt/ppu-compatibility/ppu.hpp | 6 ++++
|
||||
snes/cartridge/cartridge.hpp | 4 +++
|
||||
snes/smp/core/core.hpp | 2 +-
|
||||
snes/smp/core/memory.hpp | 6 ++--
|
||||
snes/smp/core/opcodes.cpp | 36 +++++++++----------
|
||||
snes/smp/debugger/debugger.cpp | 4 +--
|
||||
snes/smp/debugger/debugger.hpp | 2 +-
|
||||
snes/smp/memory/memory.cpp | 54 +++++++++++++++++++---------
|
||||
snes/smp/memory/memory.hpp | 4 +--
|
||||
snes/smp/smp.hpp | 4 +++
|
||||
snes/snes.hpp | 1 +
|
||||
12 files changed, 122 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/snes/alt/ppu-compatibility/memory/memory.cpp b/snes/alt/ppu-compatibility/memory/memory.cpp
|
||||
index 3f120d84..e47cf201 100755
|
||||
--- a/snes/alt/ppu-compatibility/memory/memory.cpp
|
||||
+++ b/snes/alt/ppu-compatibility/memory/memory.cpp
|
||||
@@ -47,20 +47,31 @@ uint8 PPU::vram_mmio_read(uint16 addr) {
|
||||
data = vram[addr];
|
||||
}
|
||||
}
|
||||
-
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x1, 0)) {
|
||||
+ debug_read(13, addr, data);
|
||||
+ }
|
||||
return data;
|
||||
}
|
||||
|
||||
void PPU::vram_mmio_write(uint16 addr, uint8 data) {
|
||||
if(regs.display_disabled == true) {
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(13, addr, data);
|
||||
+ }
|
||||
vram[addr] = data;
|
||||
} else {
|
||||
uint16 v = cpu.vcounter();
|
||||
uint16 h = cpu.hcounter();
|
||||
if(v == 0) {
|
||||
if(h <= 4) {
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(13, addr, data);
|
||||
+ }
|
||||
vram[addr] = data;
|
||||
} else if(h == 6) {
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(13, addr, cpu.regs.mdr);
|
||||
+ }
|
||||
vram[addr] = cpu.regs.mdr;
|
||||
} else {
|
||||
//no write
|
||||
@@ -71,9 +82,15 @@ void PPU::vram_mmio_write(uint16 addr, uint8 data) {
|
||||
if(h <= 4) {
|
||||
//no write
|
||||
} else {
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(13, addr, data);
|
||||
+ }
|
||||
vram[addr] = data;
|
||||
}
|
||||
} else {
|
||||
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(13, addr, data);
|
||||
+ }
|
||||
vram[addr] = data;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +110,9 @@ uint8 PPU::oam_mmio_read(uint16 addr) {
|
||||
data = oam[addr];
|
||||
}
|
||||
}
|
||||
-
|
||||
+ if(__builtin_expect(oam_debugflags[addr] & 0x1, 0)) {
|
||||
+ debug_read(14, addr, data);
|
||||
+ }
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -104,13 +123,22 @@ void PPU::oam_mmio_write(uint16 addr, uint8 data) {
|
||||
sprite_list_valid = false;
|
||||
|
||||
if(regs.display_disabled == true) {
|
||||
+ if(__builtin_expect(oam_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(14, addr, data);
|
||||
+ }
|
||||
oam[addr] = data;
|
||||
update_sprite_list(addr, data);
|
||||
} else {
|
||||
if(cpu.vcounter() < (!overscan() ? 225 : 240)) {
|
||||
+ if(__builtin_expect(oam_debugflags[regs.ioamaddr] & 0x2, 0)) {
|
||||
+ debug_write(14, regs.ioamaddr, data);
|
||||
+ }
|
||||
oam[regs.ioamaddr] = data;
|
||||
update_sprite_list(regs.ioamaddr, data);
|
||||
} else {
|
||||
+ if(__builtin_expect(oam_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(14, addr, data);
|
||||
+ }
|
||||
oam[addr] = data;
|
||||
update_sprite_list(addr, data);
|
||||
}
|
||||
@@ -134,6 +162,9 @@ uint8 PPU::cgram_mmio_read(uint16 addr) {
|
||||
}
|
||||
|
||||
if(addr & 1) data &= 0x7f;
|
||||
+ if(__builtin_expect(cgram_debugflags[addr] & 0x1, 0)) {
|
||||
+ debug_read(15, addr, data);
|
||||
+ }
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -142,13 +173,22 @@ void PPU::cgram_mmio_write(uint16 addr, uint8 data) {
|
||||
if(addr & 1) data &= 0x7f;
|
||||
|
||||
if(1 || regs.display_disabled == true) {
|
||||
+ if(__builtin_expect(cgram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(15, addr, data);
|
||||
+ }
|
||||
cgram[addr] = data;
|
||||
} else {
|
||||
uint16 v = cpu.vcounter();
|
||||
uint16 h = cpu.hcounter();
|
||||
if(v < (!overscan() ? 225 : 240) && h >= 128 && h < 1096) {
|
||||
+ if(__builtin_expect(cgram_debugflags[regs.icgramaddr] & 0x2, 0)) {
|
||||
+ debug_write(15, regs.icgramaddr, data & 0x7f);
|
||||
+ }
|
||||
cgram[regs.icgramaddr] = data & 0x7f;
|
||||
} else {
|
||||
+ if(__builtin_expect(cgram_debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(15, addr, data);
|
||||
+ }
|
||||
cgram[addr] = data;
|
||||
}
|
||||
}
|
||||
diff --git a/snes/alt/ppu-compatibility/ppu.hpp b/snes/alt/ppu-compatibility/ppu.hpp
|
||||
index cccaabba..4adac4c4 100755
|
||||
--- a/snes/alt/ppu-compatibility/ppu.hpp
|
||||
+++ b/snes/alt/ppu-compatibility/ppu.hpp
|
||||
@@ -3,6 +3,12 @@ public:
|
||||
uint8 vram[128 * 1024];
|
||||
uint8 oam[544];
|
||||
uint8 cgram[512];
|
||||
+ //4 is read, 2 is write.
|
||||
+ uint8 vram_debugflags[128 * 1024];
|
||||
+ uint8 oam_debugflags[544];
|
||||
+ uint8 cgram_debugflags[512];
|
||||
+ function<void (uint8, unsigned, uint8)> debug_read;
|
||||
+ function<void (uint8, unsigned, uint8)> debug_write;
|
||||
|
||||
enum : bool { Threaded = true };
|
||||
alwaysinline void step(unsigned clocks);
|
||||
diff --git a/snes/cartridge/cartridge.hpp b/snes/cartridge/cartridge.hpp
|
||||
index 82e73c4c..2358c088 100755
|
||||
--- a/snes/cartridge/cartridge.hpp
|
||||
+++ b/snes/cartridge/cartridge.hpp
|
||||
@@ -26,6 +26,10 @@ struct Cartridge : property<Cartridge> {
|
||||
SUFAMITURBO_RAMA = 10,
|
||||
SUFAMITURBO_RAMB = 11,
|
||||
BSXFLASH = 12,
|
||||
+ VRAM = 13,
|
||||
+ OAM = 14,
|
||||
+ CGRAM = 15,
|
||||
+ APURAM = 16,
|
||||
};
|
||||
|
||||
enum class Slot : unsigned {
|
||||
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
|
||||
index 13d69364..03f9ac66 100755
|
||||
--- a/snes/smp/core/core.hpp
|
||||
+++ b/snes/smp/core/core.hpp
|
||||
@@ -1,6 +1,6 @@
|
||||
struct SMPcore {
|
||||
virtual void op_io() = 0;
|
||||
- virtual uint8 op_read(uint16 addr) = 0;
|
||||
+ virtual uint8 op_read(uint16 addr, bool exec) = 0;
|
||||
virtual void op_write(uint16 addr, uint8 data) = 0;
|
||||
virtual void op_step();
|
||||
|
||||
diff --git a/snes/smp/core/memory.hpp b/snes/smp/core/memory.hpp
|
||||
index c4b6d99f..c297962f 100755
|
||||
--- a/snes/smp/core/memory.hpp
|
||||
+++ b/snes/smp/core/memory.hpp
|
||||
@@ -1,9 +1,9 @@
|
||||
alwaysinline uint8 op_readpc() {
|
||||
- return op_read(regs.pc++);
|
||||
+ return op_read(regs.pc++, true);
|
||||
}
|
||||
|
||||
alwaysinline uint8 op_readsp() {
|
||||
- return op_read(0x0100 | ++regs.s);
|
||||
+ return op_read(0x0100 | ++regs.s, false);
|
||||
}
|
||||
|
||||
alwaysinline void op_writesp(uint8 data) {
|
||||
@@ -11,7 +11,7 @@ alwaysinline void op_writesp(uint8 data) {
|
||||
}
|
||||
|
||||
alwaysinline uint8 op_readdp(uint8 addr) {
|
||||
- return op_read((regs.p.p << 8) + addr);
|
||||
+ return op_read((regs.p.p << 8) + addr, false);
|
||||
}
|
||||
|
||||
alwaysinline void op_writedp(uint8 addr, uint8 data) {
|
||||
diff --git a/snes/smp/core/opcodes.cpp b/snes/smp/core/opcodes.cpp
|
||||
index 95b9844f..43db081d 100755
|
||||
--- a/snes/smp/core/opcodes.cpp
|
||||
+++ b/snes/smp/core/opcodes.cpp
|
||||
@@ -11,7 +11,7 @@ template<uint8 (SMPcore::*op)(uint8)>
|
||||
void SMPcore::op_adjust_addr() {
|
||||
dp.l = op_readpc();
|
||||
dp.h = op_readpc();
|
||||
- rd = op_read(dp);
|
||||
+ rd = op_read(dp, false);
|
||||
rd = call(rd);
|
||||
op_write(dp, rd);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ template<uint8 (SMPcore::*op)(uint8, uint8)>
|
||||
void SMPcore::op_read_addr(uint8 &r) {
|
||||
dp.l = op_readpc();
|
||||
dp.h = op_readpc();
|
||||
- rd = op_read(dp);
|
||||
+ rd = op_read(dp, false);
|
||||
r = call(r, rd);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void SMPcore::op_read_addri(uint8 &r) {
|
||||
dp.l = op_readpc();
|
||||
dp.h = op_readpc();
|
||||
op_io();
|
||||
- rd = op_read(dp + r);
|
||||
+ rd = op_read(dp + r, false);
|
||||
regs.a = call(regs.a, rd);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void SMPcore::op_read_idpx() {
|
||||
op_io();
|
||||
sp.l = op_readdp(dp++);
|
||||
sp.h = op_readdp(dp++);
|
||||
- rd = op_read(sp);
|
||||
+ rd = op_read(sp, false);
|
||||
regs.a = call(regs.a, rd);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void SMPcore::op_read_idpy() {
|
||||
op_io();
|
||||
sp.l = op_readdp(dp++);
|
||||
sp.h = op_readdp(dp++);
|
||||
- rd = op_read(sp + regs.y);
|
||||
+ rd = op_read(sp + regs.y, false);
|
||||
regs.a = call(regs.a, rd);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void SMPcore::op_set_addr_bit() {
|
||||
dp.h = op_readpc();
|
||||
bit = dp >> 13;
|
||||
dp &= 0x1fff;
|
||||
- rd = op_read(dp);
|
||||
+ rd = op_read(dp, false);
|
||||
switch(opcode >> 5) {
|
||||
case 0: //orc addr:bit
|
||||
case 1: //orc !addr:bit
|
||||
@@ -198,10 +198,10 @@ void SMPcore::op_set_flag(bool &flag, bool data) {
|
||||
void SMPcore::op_test_addr(bool set) {
|
||||
dp.l = op_readpc();
|
||||
dp.h = op_readpc();
|
||||
- rd = op_read(dp);
|
||||
+ rd = op_read(dp, false);
|
||||
regs.p.n = (regs.a - rd) & 0x80;
|
||||
regs.p.z = (regs.a - rd) == 0;
|
||||
- op_read(dp);
|
||||
+ op_read(dp, false);
|
||||
op_write(dp, set ? rd | regs.a : rd & ~regs.a);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void SMPcore::op_transfer(uint8 &from, uint8 &to) {
|
||||
void SMPcore::op_write_addr(uint8 &r) {
|
||||
dp.l = op_readpc();
|
||||
dp.h = op_readpc();
|
||||
- op_read(dp);
|
||||
+ op_read(dp, false);
|
||||
op_write(dp, r);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ void SMPcore::op_write_addri(uint8 &i) {
|
||||
dp.h = op_readpc();
|
||||
op_io();
|
||||
dp += i;
|
||||
- op_read(dp);
|
||||
+ op_read(dp, false);
|
||||
op_write(dp, regs.a);
|
||||
}
|
||||
|
||||
@@ -317,8 +317,8 @@ void SMPcore::op_bne_ydec() {
|
||||
}
|
||||
|
||||
void SMPcore::op_brk() {
|
||||
- rd.l = op_read(0xffde);
|
||||
- rd.h = op_read(0xffdf);
|
||||
+ rd.l = op_read(0xffde, false);
|
||||
+ rd.h = op_read(0xffdf, false);
|
||||
op_io();
|
||||
op_io();
|
||||
op_writesp(regs.pc.h);
|
||||
@@ -411,8 +411,8 @@ void SMPcore::op_jmp_iaddrx() {
|
||||
dp.h = op_readpc();
|
||||
op_io();
|
||||
dp += regs.x;
|
||||
- rd.l = op_read(dp++);
|
||||
- rd.h = op_read(dp++);
|
||||
+ rd.l = op_read(dp++, false);
|
||||
+ rd.h = op_read(dp++, false);
|
||||
regs.pc = rd;
|
||||
}
|
||||
|
||||
@@ -438,8 +438,8 @@ void SMPcore::op_jsr_addr() {
|
||||
|
||||
void SMPcore::op_jst() {
|
||||
dp = 0xffde - ((opcode >> 4) << 1);
|
||||
- rd.l = op_read(dp++);
|
||||
- rd.h = op_read(dp++);
|
||||
+ rd.l = op_read(dp++, false);
|
||||
+ rd.h = op_read(dp++, false);
|
||||
op_io();
|
||||
op_io();
|
||||
op_io();
|
||||
@@ -505,7 +505,7 @@ void SMPcore::op_sta_idpx() {
|
||||
op_io();
|
||||
dp.l = op_readdp(sp++);
|
||||
dp.h = op_readdp(sp++);
|
||||
- op_read(dp);
|
||||
+ op_read(dp, false);
|
||||
op_write(dp, regs.a);
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ void SMPcore::op_sta_idpy() {
|
||||
dp.h = op_readdp(sp++);
|
||||
op_io();
|
||||
dp += regs.y;
|
||||
- op_read(dp);
|
||||
+ op_read(dp, false);
|
||||
op_write(dp, regs.a);
|
||||
}
|
||||
|
||||
diff --git a/snes/smp/debugger/debugger.cpp b/snes/smp/debugger/debugger.cpp
|
||||
index 9546c118..894fdac9 100755
|
||||
--- a/snes/smp/debugger/debugger.cpp
|
||||
+++ b/snes/smp/debugger/debugger.cpp
|
||||
@@ -18,8 +18,8 @@ void SMPDebugger::op_step() {
|
||||
synchronize_cpu();
|
||||
}
|
||||
|
||||
-uint8 SMPDebugger::op_read(uint16 addr) {
|
||||
- uint8 data = SMP::op_read(addr);
|
||||
+uint8 SMPDebugger::op_read(uint16 addr, bool exec) {
|
||||
+ uint8 data = SMP::op_read(addr, exec);
|
||||
usage[addr] |= UsageRead;
|
||||
debugger.breakpoint_test(Debugger::Breakpoint::Source::APURAM, Debugger::Breakpoint::Mode::Read, addr, data);
|
||||
return data;
|
||||
diff --git a/snes/smp/debugger/debugger.hpp b/snes/smp/debugger/debugger.hpp
|
||||
index d5d28e53..26bc7af9 100755
|
||||
--- a/snes/smp/debugger/debugger.hpp
|
||||
+++ b/snes/smp/debugger/debugger.hpp
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
bool opcode_edge;
|
||||
|
||||
void op_step();
|
||||
- uint8 op_read(uint16 addr);
|
||||
+ uint8 op_read(uint16 addr, bool exec);
|
||||
void op_write(uint16 addr, uint8 data);
|
||||
|
||||
SMPDebugger();
|
||||
diff --git a/snes/smp/memory/memory.cpp b/snes/smp/memory/memory.cpp
|
||||
index 391324c4..58c11915 100755
|
||||
--- a/snes/smp/memory/memory.cpp
|
||||
+++ b/snes/smp/memory/memory.cpp
|
||||
@@ -19,61 +19,83 @@ void SMP::port_write(uint2 port, uint8 data) {
|
||||
apuram[0xf4 + port] = data;
|
||||
}
|
||||
|
||||
-alwaysinline uint8 SMP::op_busread(uint16 addr) {
|
||||
+alwaysinline uint8 SMP::op_busread(uint16 addr, bool exec) {
|
||||
unsigned result;
|
||||
+ uint8 data;
|
||||
|
||||
switch(addr) {
|
||||
case 0xf0: //TEST -- write-only register
|
||||
- return 0x00;
|
||||
+ data = 0x00;
|
||||
+ break;
|
||||
|
||||
case 0xf1: //CONTROL -- write-only register
|
||||
- return 0x00;
|
||||
+ data = 0x00;
|
||||
+ break;
|
||||
|
||||
case 0xf2: //DSPADDR
|
||||
- return status.dsp_addr;
|
||||
+ data = status.dsp_addr;
|
||||
+ break;
|
||||
|
||||
case 0xf3: //DSPDATA
|
||||
//0x80-0xff are read-only mirrors of 0x00-0x7f
|
||||
- return dsp.read(status.dsp_addr & 0x7f);
|
||||
+ data = dsp.read(status.dsp_addr & 0x7f);
|
||||
+ break;
|
||||
|
||||
case 0xf4: //CPUIO0
|
||||
case 0xf5: //CPUIO1
|
||||
case 0xf6: //CPUIO2
|
||||
case 0xf7: //CPUIO3
|
||||
synchronize_cpu();
|
||||
- return cpu.port_read(addr);
|
||||
+ data = cpu.port_read(addr);
|
||||
+ break;
|
||||
|
||||
case 0xf8: //RAM0
|
||||
- return status.ram00f8;
|
||||
+ data = status.ram00f8;
|
||||
+ break;
|
||||
|
||||
case 0xf9: //RAM1
|
||||
- return status.ram00f9;
|
||||
+ data = status.ram00f9;
|
||||
+ break;
|
||||
|
||||
case 0xfa: //T0TARGET
|
||||
case 0xfb: //T1TARGET
|
||||
case 0xfc: //T2TARGET -- write-only registers
|
||||
- return 0x00;
|
||||
+ data = 0x00;
|
||||
+ break;
|
||||
|
||||
case 0xfd: //T0OUT -- 4-bit counter value
|
||||
result = timer0.stage3_ticks;
|
||||
timer0.stage3_ticks = 0;
|
||||
- return result;
|
||||
+ data = result;
|
||||
+ break;
|
||||
|
||||
case 0xfe: //T1OUT -- 4-bit counter value
|
||||
result = timer1.stage3_ticks;
|
||||
timer1.stage3_ticks = 0;
|
||||
- return result;
|
||||
+ data = result;
|
||||
+ break;
|
||||
|
||||
case 0xff: //T2OUT -- 4-bit counter value
|
||||
result = timer2.stage3_ticks;
|
||||
timer2.stage3_ticks = 0;
|
||||
- return result;
|
||||
+ data = result;
|
||||
+ break;
|
||||
+ default:
|
||||
+ data = ram_read(addr);
|
||||
+ break;
|
||||
}
|
||||
-
|
||||
- return ram_read(addr);
|
||||
+ uint8 flag = exec ? 0x04 : 0x01;
|
||||
+ if(__builtin_expect(debugflags[addr] & flag, 0)) {
|
||||
+ debug_read(16, addr, data, exec);
|
||||
+ }
|
||||
+ return data;
|
||||
}
|
||||
|
||||
alwaysinline void SMP::op_buswrite(uint16 addr, uint8 data) {
|
||||
+ if(__builtin_expect(debugflags[addr] & 0x2, 0)) {
|
||||
+ debug_write(16, addr, data);
|
||||
+ }
|
||||
+
|
||||
switch(addr) {
|
||||
case 0xf0: //TEST
|
||||
if(regs.p.p) break; //writes only valid when P flag is clear
|
||||
@@ -180,9 +202,9 @@ void SMP::op_io() {
|
||||
cycle_edge();
|
||||
}
|
||||
|
||||
-uint8 SMP::op_read(uint16 addr) {
|
||||
+uint8 SMP::op_read(uint16 addr, bool exec) {
|
||||
add_clocks(12);
|
||||
- uint8 r = op_busread(addr);
|
||||
+ uint8 r = op_busread(addr, exec);
|
||||
add_clocks(12);
|
||||
cycle_edge();
|
||||
return r;
|
||||
diff --git a/snes/smp/memory/memory.hpp b/snes/smp/memory/memory.hpp
|
||||
index 1a07445d..faa28daa 100755
|
||||
--- a/snes/smp/memory/memory.hpp
|
||||
+++ b/snes/smp/memory/memory.hpp
|
||||
@@ -1,9 +1,9 @@
|
||||
uint8 ram_read(uint16 addr);
|
||||
void ram_write(uint16 addr, uint8 data);
|
||||
|
||||
-uint8 op_busread(uint16 addr);
|
||||
+uint8 op_busread(uint16 addr, bool exec);
|
||||
void op_buswrite(uint16 addr, uint8 data);
|
||||
|
||||
void op_io();
|
||||
-debugvirtual uint8 op_read(uint16 addr);
|
||||
+debugvirtual uint8 op_read(uint16 addr, bool exec);
|
||||
debugvirtual void op_write(uint16 addr, uint8 data);
|
||||
diff --git a/snes/smp/smp.hpp b/snes/smp/smp.hpp
|
||||
index 6b387cba..6b6ae837 100755
|
||||
--- a/snes/smp/smp.hpp
|
||||
+++ b/snes/smp/smp.hpp
|
||||
@@ -1,6 +1,10 @@
|
||||
struct SMP : public Processor, public SMPcore {
|
||||
static const uint8 iplrom[64];
|
||||
uint8 apuram[64 * 1024];
|
||||
+ uint8 debugflags[64 * 1024];
|
||||
+
|
||||
+ function<void (uint8, unsigned, uint8, bool)> debug_read;
|
||||
+ function<void (uint8, unsigned, uint8)> debug_write;
|
||||
|
||||
enum : bool { Threaded = true };
|
||||
alwaysinline void step(unsigned clocks);
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 9589db9b..27632bff 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef SNES_HPP
|
||||
#define SNES_HPP
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
|
||||
+#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
|
||||
#define BSNES_SUPPORTS_ALT_TIMINGS
|
||||
|
||||
namespace SNES {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
53
bsnes-patches/v085/0019-SA1-trace-hook-support.patch
Normal file
53
bsnes-patches/v085/0019-SA1-trace-hook-support.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
From f1106d3dffd27dab526a703aa434512495fbacea Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 14 Apr 2014 21:21:36 +0300
|
||||
Subject: [PATCH 19/27] SA1 trace hook support
|
||||
|
||||
---
|
||||
snes/chip/sa1/sa1.cpp | 2 ++
|
||||
snes/chip/sa1/sa1.hpp | 3 +++
|
||||
snes/snes.hpp | 1 +
|
||||
3 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/snes/chip/sa1/sa1.cpp b/snes/chip/sa1/sa1.cpp
|
||||
index 30e00809..fdec362c 100755
|
||||
--- a/snes/chip/sa1/sa1.cpp
|
||||
+++ b/snes/chip/sa1/sa1.cpp
|
||||
@@ -32,6 +32,8 @@ void SA1::enter() {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if(__builtin_expect(trace_enabled ? 1 : 0, 0))
|
||||
+ step_event();
|
||||
(this->*opcode_table[op_readpc()])();
|
||||
}
|
||||
}
|
||||
diff --git a/snes/chip/sa1/sa1.hpp b/snes/chip/sa1/sa1.hpp
|
||||
index 732b2a85..efd36376 100755
|
||||
--- a/snes/chip/sa1/sa1.hpp
|
||||
+++ b/snes/chip/sa1/sa1.hpp
|
||||
@@ -15,6 +15,9 @@ public:
|
||||
uint16 hcounter;
|
||||
} status;
|
||||
|
||||
+ bool trace_enabled;
|
||||
+ nall::function<void()> step_event;
|
||||
+
|
||||
static void Enter();
|
||||
void enter();
|
||||
void tick();
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 27632bff..3bdca7e5 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -3,6 +3,7 @@
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
|
||||
#define BSNES_SUPPORTS_ALT_TIMINGS
|
||||
+#define BSNES_SUPPORTS_TRACE_SA1
|
||||
|
||||
namespace SNES {
|
||||
namespace Info {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
From cf662a12578778cb50c25d5275ce58deabd7eabe Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 30 Apr 2014 00:18:58 +0300
|
||||
Subject: [PATCH 20/27] Fixes to SA1 open bus emulation
|
||||
|
||||
---
|
||||
snes/chip/sa1/memory/memory.cpp | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/sa1/memory/memory.cpp b/snes/chip/sa1/memory/memory.cpp
|
||||
index 9bb4ff20..614dfb0c 100755
|
||||
--- a/snes/chip/sa1/memory/memory.cpp
|
||||
+++ b/snes/chip/sa1/memory/memory.cpp
|
||||
@@ -36,6 +36,7 @@ uint8 SA1::bus_read(unsigned addr) {
|
||||
synchronize_cpu();
|
||||
return bitmap_read(addr & 0x0fffff);
|
||||
}
|
||||
+ return regs.mdr;
|
||||
}
|
||||
|
||||
void SA1::bus_write(unsigned addr, uint8 data) {
|
||||
@@ -73,29 +74,31 @@ void SA1::bus_write(unsigned addr, uint8 data) {
|
||||
//to avoid syncing the S-CPU and SA-1*; as both chips are able to access
|
||||
//these ports.
|
||||
uint8 SA1::vbr_read(unsigned addr) {
|
||||
+ //Let's share the bus state with main SA1 bus (is this correct?)
|
||||
if((addr & 0x408000) == 0x008000) { //$00-3f|80-bf:8000-ffff
|
||||
- return mmc_read(addr);
|
||||
+ return regs.mdr = mmc_read(addr);
|
||||
}
|
||||
|
||||
if((addr & 0xc00000) == 0xc00000) { //$c0-ff:0000-ffff
|
||||
- return mmc_read(addr);
|
||||
+ return regs.mdr = mmc_read(addr);
|
||||
}
|
||||
|
||||
if((addr & 0x40e000) == 0x006000) { //$00-3f|80-bf:6000-7fff
|
||||
- return cartridge.ram.read(addr & (cartridge.ram.size() - 1));
|
||||
+ return regs.mdr = cartridge.ram.read(addr & (cartridge.ram.size() - 1));
|
||||
}
|
||||
|
||||
if((addr & 0xf00000) == 0x400000) { //$40-4f:0000-ffff
|
||||
- return cartridge.ram.read(addr & (cartridge.ram.size() - 1));
|
||||
+ return regs.mdr = cartridge.ram.read(addr & (cartridge.ram.size() - 1));
|
||||
}
|
||||
|
||||
if((addr & 0x40f800) == 0x000000) { //$00-3f|80-bf:0000-07ff
|
||||
- return iram.read(addr & 2047);
|
||||
+ return regs.mdr = iram.read(addr & 2047);
|
||||
}
|
||||
|
||||
if((addr & 0x40f800) == 0x003000) { //$00-3f|80-bf:3000-37ff
|
||||
- return iram.read(addr & 0x2047);
|
||||
+ return regs.mdr = iram.read(addr & 0x2047);
|
||||
}
|
||||
+ return regs.mdr;
|
||||
}
|
||||
|
||||
//ROM, I-RAM and MMIO registers are accessed at ~10.74MHz (2 clock ticks)
|
||||
@@ -110,13 +113,13 @@ void SA1::op_io() {
|
||||
uint8 SA1::op_read(unsigned addr, bool exec) {
|
||||
tick();
|
||||
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
|
||||
- return bus_read(addr);
|
||||
+ return regs.mdr = bus_read(addr);
|
||||
}
|
||||
|
||||
void SA1::op_write(unsigned addr, uint8 data) {
|
||||
tick();
|
||||
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
|
||||
- bus_write(addr, data);
|
||||
+ bus_write(addr, regs.mdr = data);
|
||||
}
|
||||
|
||||
uint8 SA1::mmc_read(unsigned addr) {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 63fc77b07d517c2f9a0fd6ca3fa94f30fb0f5ec2 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 15 Jun 2014 22:01:26 +0300
|
||||
Subject: [PATCH 21/27] Call notify latch function on alternate timings mode
|
||||
too
|
||||
|
||||
---
|
||||
snes/cpu/timing/joypad.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index ae8e94f8..3fd4d23e 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -41,6 +41,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
} else {
|
||||
if(status.auto_joypad_counter == 1) {
|
||||
status.auto_joypad_active = true;
|
||||
+ interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
}
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
288
bsnes-patches/v085/0022-Support-DMA-tracing.patch
Normal file
288
bsnes-patches/v085/0022-Support-DMA-tracing.patch
Normal file
|
@ -0,0 +1,288 @@
|
|||
From 5bc96b8aeea26729ef4399c2d8d5e562894616e1 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Tue, 20 Jan 2015 10:04:58 +0200
|
||||
Subject: [PATCH 22/27] Support DMA tracing
|
||||
|
||||
---
|
||||
snes/alt/ppu-compatibility/mmio/mmio.cpp | 18 +++++++
|
||||
snes/alt/ppu-compatibility/ppu.cpp | 1 +
|
||||
snes/alt/ppu-compatibility/ppu.hpp | 4 ++
|
||||
snes/cpu/cpu.cpp | 1 +
|
||||
snes/cpu/cpu.hpp | 1 +
|
||||
snes/cpu/dma/dma.cpp | 84 ++++++++++++++++++++++++++++++++
|
||||
snes/cpu/dma/dma.hpp | 5 ++
|
||||
snes/ppu/mmio/mmio.cpp | 18 +++++++
|
||||
snes/ppu/ppu.cpp | 1 +
|
||||
snes/ppu/ppu.hpp | 3 ++
|
||||
snes/snes.hpp | 1 +
|
||||
11 files changed, 137 insertions(+)
|
||||
|
||||
diff --git a/snes/alt/ppu-compatibility/mmio/mmio.cpp b/snes/alt/ppu-compatibility/mmio/mmio.cpp
|
||||
index aedb67c1..0a269cc0 100755
|
||||
--- a/snes/alt/ppu-compatibility/mmio/mmio.cpp
|
||||
+++ b/snes/alt/ppu-compatibility/mmio/mmio.cpp
|
||||
@@ -1,5 +1,23 @@
|
||||
#ifdef PPU_CPP
|
||||
|
||||
+size_t PPU::get_dma_oam_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%03x]", regs.oam_addr);
|
||||
+}
|
||||
+
|
||||
+size_t PPU::get_dma_cgram_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%02x%c]", regs.cgram_addr >> 1, (regs.cgram_addr & 1) ?
|
||||
+ 'H' : 'L');
|
||||
+}
|
||||
+
|
||||
+size_t PPU::get_dma_vram_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%04x map%d inc %d on %s]", regs.vram_addr << 1,
|
||||
+ regs.vram_mapping, 2 * regs.vram_incsize, regs.vram_incmode ? "high" :
|
||||
+ "low");
|
||||
+}
|
||||
+
|
||||
//INIDISP
|
||||
void PPU::mmio_w2100(uint8 value) {
|
||||
if(regs.display_disabled == true && cpu.vcounter() == (!overscan() ? 225 : 240)) {
|
||||
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
index 122b1430..ac886edc 100755
|
||||
--- a/snes/alt/ppu-compatibility/ppu.cpp
|
||||
+++ b/snes/alt/ppu-compatibility/ppu.cpp
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <snes/snes.hpp>
|
||||
+#include <cstdio>
|
||||
|
||||
#define PPU_CPP
|
||||
namespace SNES {
|
||||
diff --git a/snes/alt/ppu-compatibility/ppu.hpp b/snes/alt/ppu-compatibility/ppu.hpp
|
||||
index 4adac4c4..b0eabf7c 100755
|
||||
--- a/snes/alt/ppu-compatibility/ppu.hpp
|
||||
+++ b/snes/alt/ppu-compatibility/ppu.hpp
|
||||
@@ -14,6 +14,10 @@ public:
|
||||
alwaysinline void step(unsigned clocks);
|
||||
alwaysinline void synchronize_cpu();
|
||||
|
||||
+ size_t get_dma_oam_subaddr(char* buf);
|
||||
+ size_t get_dma_cgram_subaddr(char* buf);
|
||||
+ size_t get_dma_vram_subaddr(char* buf);
|
||||
+
|
||||
#include "memory/memory.hpp"
|
||||
#include "mmio/mmio.hpp"
|
||||
#include "render/render.hpp"
|
||||
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
|
||||
index 39da6b16..ce112afa 100755
|
||||
--- a/snes/cpu/cpu.cpp
|
||||
+++ b/snes/cpu/cpu.cpp
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <snes/snes.hpp>
|
||||
+#include <cstdio>
|
||||
|
||||
#define CPU_CPP
|
||||
namespace SNES {
|
||||
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
|
||||
index 49445773..fd665b1f 100755
|
||||
--- a/snes/cpu/cpu.hpp
|
||||
+++ b/snes/cpu/cpu.hpp
|
||||
@@ -26,6 +26,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
|
||||
~CPU();
|
||||
|
||||
bool controller_flag;
|
||||
+ function<void(const char*)> dma_trace_fn;
|
||||
private:
|
||||
#include "dma/dma.hpp"
|
||||
#include "memory/memory.hpp"
|
||||
diff --git a/snes/cpu/dma/dma.cpp b/snes/cpu/dma/dma.cpp
|
||||
index 0a00bfea..8f7be263 100755
|
||||
--- a/snes/cpu/dma/dma.cpp
|
||||
+++ b/snes/cpu/dma/dma.cpp
|
||||
@@ -144,6 +144,7 @@ void CPU::dma_run() {
|
||||
|
||||
for(unsigned i = 0; i < 8; i++) {
|
||||
if(channel[i].dma_enabled == false) continue;
|
||||
+ dma_trace_start(i);
|
||||
|
||||
unsigned index = 0;
|
||||
do {
|
||||
@@ -155,6 +156,7 @@ void CPU::dma_run() {
|
||||
dma_write(false);
|
||||
dma_edge();
|
||||
|
||||
+ dma_trace_end(i);
|
||||
channel[i].dma_enabled = false;
|
||||
}
|
||||
|
||||
@@ -202,6 +204,7 @@ void CPU::hdma_run() {
|
||||
channel[i].dma_enabled = false; //HDMA run during DMA will stop DMA mid-transfer
|
||||
|
||||
if(channel[i].hdma_do_transfer) {
|
||||
+ dma_trace_hdma(i);
|
||||
static const unsigned transfer_length[8] = { 1, 2, 2, 4, 4, 4, 2, 4 };
|
||||
unsigned length = transfer_length[channel[i].transfer_mode];
|
||||
for(unsigned index = 0; index < length; index++) {
|
||||
@@ -286,4 +289,85 @@ void CPU::dma_reset() {
|
||||
pipe.data = 0;
|
||||
}
|
||||
|
||||
+size_t CPU::dma_trace_subaddr(char* buf, uint8 b_addr)
|
||||
+{
|
||||
+ if(b_addr == 0x04 || b_addr == 0x38) {
|
||||
+ return ppu.get_dma_oam_subaddr(buf);
|
||||
+ }
|
||||
+ if(b_addr == 0x22 || b_addr == 0x3B) {
|
||||
+ return ppu.get_dma_cgram_subaddr(buf);
|
||||
+ }
|
||||
+ if(b_addr == 0x18 || b_addr == 0x19 || b_addr == 0x39 || b_addr == 0x3A) {
|
||||
+ return ppu.get_dma_vram_subaddr(buf);
|
||||
+ }
|
||||
+ if(b_addr == 0x80) {
|
||||
+ return sprintf(buf, "[%06x]", 0x7e0000 | status.wram_addr);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void CPU::dma_trace_start(unsigned i)
|
||||
+{
|
||||
+ if(!dma_trace_fn) return;
|
||||
+ char buf[512];
|
||||
+ size_t ptr = 0;
|
||||
+ unsigned bytes = channel[i].transfer_size;
|
||||
+ if(!bytes) bytes = 0x10000;
|
||||
+ ptr += sprintf(buf + ptr, "-- DMA%i %d(%x) bytes ", i, bytes, bytes);
|
||||
+ if(channel[i].direction) {
|
||||
+ //B->A
|
||||
+ ptr += sprintf(buf + ptr, "%02x", channel[i].dest_addr);
|
||||
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
|
||||
+ ptr += sprintf(buf + ptr, "-> %02x%04x", channel[i].source_bank,
|
||||
+ channel[i].source_addr);
|
||||
+ } else {
|
||||
+ //A->B
|
||||
+ ptr += sprintf(buf + ptr, "%02x%04x -> %02x", channel[i].source_bank,
|
||||
+ channel[i].source_addr, channel[i].dest_addr);
|
||||
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
|
||||
+ }
|
||||
+ if(channel[i].fixed_transfer)
|
||||
+ ptr += sprintf(buf + ptr, " fixed");
|
||||
+ else if(channel[i].reverse_transfer)
|
||||
+ ptr += sprintf(buf + ptr, " decrement");
|
||||
+ else
|
||||
+ ptr += sprintf(buf + ptr, " incrment");
|
||||
+ ptr += sprintf(buf + ptr, " mode%d --", channel[i].transfer_mode);
|
||||
+ dma_trace_fn(buf);
|
||||
+}
|
||||
+
|
||||
+void CPU::dma_trace_end(unsigned i)
|
||||
+{
|
||||
+ if(!dma_trace_fn) return;
|
||||
+ if(!channel[i].transfer_size) return; //No message for complete DMA.
|
||||
+ char buf[512];
|
||||
+ size_t ptr = 0;
|
||||
+ sprintf(buf, "-- DMA%i aborted with %d(0x%x) bytes remaining --", i,
|
||||
+ (int)channel[i].transfer_size, (unsigned)channel[i].transfer_size);
|
||||
+ dma_trace_fn(buf);
|
||||
+}
|
||||
+
|
||||
+void CPU::dma_trace_hdma(unsigned i)
|
||||
+{
|
||||
+ if(!dma_trace_fn) return;
|
||||
+ char buf[512];
|
||||
+ size_t ptr = 0;
|
||||
+ unsigned addr = channel[i].indirect ?
|
||||
+ (channel[i].indirect_bank << 16) | (channel[i].indirect_addr) :
|
||||
+ (channel[i].source_bank << 16) | (channel[i].hdma_addr);
|
||||
+ ptr += sprintf(buf + ptr, "-- HDMA%i %06x -> %02x", i, addr,
|
||||
+ channel[i].dest_addr);
|
||||
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
|
||||
+ if(channel[i].indirect)
|
||||
+ ptr += sprintf(buf + ptr, " indirect");
|
||||
+ if(channel[i].fixed_transfer)
|
||||
+ ptr += sprintf(buf + ptr, " fixed");
|
||||
+ else if(channel[i].reverse_transfer)
|
||||
+ ptr += sprintf(buf + ptr, " decrement");
|
||||
+ else
|
||||
+ ptr += sprintf(buf + ptr, " incrment");
|
||||
+ ptr += sprintf(buf + ptr, " mode%d --", channel[i].transfer_mode);
|
||||
+ dma_trace_fn(buf);
|
||||
+}
|
||||
+
|
||||
#endif
|
||||
diff --git a/snes/cpu/dma/dma.hpp b/snes/cpu/dma/dma.hpp
|
||||
index 33755bde..8740bb3a 100755
|
||||
--- a/snes/cpu/dma/dma.hpp
|
||||
+++ b/snes/cpu/dma/dma.hpp
|
||||
@@ -77,3 +77,8 @@ void hdma_init();
|
||||
|
||||
void dma_power();
|
||||
void dma_reset();
|
||||
+
|
||||
+size_t dma_trace_subaddr(char* buf, uint8 b_addr);
|
||||
+void dma_trace_start(unsigned i);
|
||||
+void dma_trace_end(unsigned i);
|
||||
+void dma_trace_hdma(unsigned i);
|
||||
diff --git a/snes/ppu/mmio/mmio.cpp b/snes/ppu/mmio/mmio.cpp
|
||||
index 302f74f8..4a4fb9ce 100755
|
||||
--- a/snes/ppu/mmio/mmio.cpp
|
||||
+++ b/snes/ppu/mmio/mmio.cpp
|
||||
@@ -1,5 +1,23 @@
|
||||
#ifdef PPU_CPP
|
||||
|
||||
+size_t PPU::get_dma_oam_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%03x]", regs.oam_addr);
|
||||
+}
|
||||
+
|
||||
+size_t PPU::get_dma_cgram_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%02x%c]", regs.cgram_addr >> 1, (regs.cgram_addr & 1) ?
|
||||
+ 'H' : 'L');
|
||||
+}
|
||||
+
|
||||
+size_t PPU::get_dma_vram_subaddr(char* buf)
|
||||
+{
|
||||
+ return sprintf(buf, "[%04x map%d inc %d on %s]", regs.vram_addr << 1,
|
||||
+ regs.vram_mapping, 2 * regs.vram_incsize, regs.vram_incmode ? "high" :
|
||||
+ "low");
|
||||
+}
|
||||
+
|
||||
bool PPU::interlace() const {
|
||||
return display.interlace;
|
||||
}
|
||||
diff --git a/snes/ppu/ppu.cpp b/snes/ppu/ppu.cpp
|
||||
index 13e231cf..58742098 100755
|
||||
--- a/snes/ppu/ppu.cpp
|
||||
+++ b/snes/ppu/ppu.cpp
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <snes/snes.hpp>
|
||||
+#include <cstdio>
|
||||
|
||||
#define PPU_CPP
|
||||
namespace SNES {
|
||||
diff --git a/snes/ppu/ppu.hpp b/snes/ppu/ppu.hpp
|
||||
index fdba113c..0addb775 100755
|
||||
--- a/snes/ppu/ppu.hpp
|
||||
+++ b/snes/ppu/ppu.hpp
|
||||
@@ -21,6 +21,9 @@ struct PPU : public Processor, public PPUcounter {
|
||||
PPU();
|
||||
~PPU();
|
||||
|
||||
+ size_t get_dma_oam_subaddr(char* buf);
|
||||
+ size_t get_dma_cgram_subaddr(char* buf);
|
||||
+ size_t get_dma_vram_subaddr(char* buf);
|
||||
private:
|
||||
uint32 *surface;
|
||||
uint32 *output;
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 3bdca7e5..7c48ebb3 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -4,6 +4,7 @@
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
|
||||
#define BSNES_SUPPORTS_ALT_TIMINGS
|
||||
#define BSNES_SUPPORTS_TRACE_SA1
|
||||
+#define BSNES_SUPPORTS_DMA_TRACE
|
||||
|
||||
namespace SNES {
|
||||
namespace Info {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
From 9682df9e33c366dfe047a99c8bcefc2c8ab29620 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 24 Jan 2015 16:46:18 +0200
|
||||
Subject: [PATCH 23/27] Add autopoller and IRQ/NMI tracing
|
||||
|
||||
---
|
||||
snes/cpu/cpu.cpp | 3 +++
|
||||
snes/cpu/timing/joypad.cpp | 16 ++++++++++++++--
|
||||
2 files changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
|
||||
index ce112afa..e11fc882 100755
|
||||
--- a/snes/cpu/cpu.cpp
|
||||
+++ b/snes/cpu/cpu.cpp
|
||||
@@ -69,14 +69,17 @@ void CPU::enter() {
|
||||
if(status.interrupt_pending) {
|
||||
status.interrupt_pending = false;
|
||||
if(status.nmi_pending) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- NMI occured --");
|
||||
status.nmi_pending = false;
|
||||
regs.vector = (regs.e == false ? 0xffea : 0xfffa);
|
||||
op_irq();
|
||||
} else if(status.irq_pending) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- IRQ occured --");
|
||||
status.irq_pending = false;
|
||||
regs.vector = (regs.e == false ? 0xffee : 0xfffe);
|
||||
op_irq();
|
||||
} else if(status.reset_pending) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- RESET occured --");
|
||||
status.reset_pending = false;
|
||||
add_clocks(186);
|
||||
regs.pc.l = bus.read(0xfffc, false);
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 3fd4d23e..afca7504 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -6,9 +6,9 @@ void CPU::step_auto_joypad_poll() {
|
||||
//cache enable state at first iteration
|
||||
if(status.auto_joypad_counter == 0) status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
status.auto_joypad_active = status.auto_joypad_counter <= 15;
|
||||
-
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
@@ -23,6 +23,12 @@ void CPU::step_auto_joypad_poll() {
|
||||
status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
|
||||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
+ if(status.auto_joypad_counter == 15) {
|
||||
+ char buf[512];
|
||||
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
+ status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
+ if(dma_trace_fn) dma_trace_fn(buf);
|
||||
+ }
|
||||
}
|
||||
|
||||
status.auto_joypad_counter++;
|
||||
@@ -40,6 +46,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
status.auto_joypad_active = false;
|
||||
} else {
|
||||
if(status.auto_joypad_counter == 1) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
status.auto_joypad_active = true;
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
@@ -58,8 +65,13 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
}
|
||||
- if(status.auto_joypad_counter == 34)
|
||||
+ if(status.auto_joypad_counter == 34) {
|
||||
status.auto_joypad_active = false;
|
||||
+ char buf[512];
|
||||
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
+ status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
+ if(dma_trace_fn) dma_trace_fn(buf);
|
||||
+ }
|
||||
}
|
||||
status.auto_joypad_counter++;
|
||||
}
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
50
bsnes-patches/v085/0024-Build-fixes-for-GCC-5.X.patch
Normal file
50
bsnes-patches/v085/0024-Build-fixes-for-GCC-5.X.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
From f2bbef8a4e12e05190a68dfe410cff3e4b1eb13f Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 8 Aug 2015 11:09:41 +0300
|
||||
Subject: [PATCH 24/27] Build fixes for GCC 5.X
|
||||
|
||||
---
|
||||
nall/bit.hpp | 21 +++++++++++++++------
|
||||
1 file changed, 15 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/nall/bit.hpp b/nall/bit.hpp
|
||||
index 67a35ad6..11d9d8de 100755
|
||||
--- a/nall/bit.hpp
|
||||
+++ b/nall/bit.hpp
|
||||
@@ -8,18 +8,27 @@ namespace nall {
|
||||
}
|
||||
|
||||
template<int bits> constexpr inline unsigned uclip(const unsigned x) {
|
||||
- enum { m = (1U << (bits - 1)) + ((1U << (bits - 1)) - 1) };
|
||||
- return (x & m);
|
||||
+ return x & ((1U << (bits - 1)) + ((1U << (bits - 1)) - 1));
|
||||
+ }
|
||||
+
|
||||
+ template<int bits> constexpr inline signed sclamp_b() {
|
||||
+ return 1U << (bits - 1);
|
||||
+ }
|
||||
+
|
||||
+ template<int bits> constexpr inline signed sclamp_m() {
|
||||
+ return (1U << (bits - 1)) - 1;
|
||||
}
|
||||
|
||||
template<int bits> constexpr inline signed sclamp(const signed x) {
|
||||
- enum { b = 1U << (bits - 1), m = (1U << (bits - 1)) - 1 };
|
||||
- return (x > m) ? m : (x < -b) ? -b : x;
|
||||
+ return (x > sclamp_m<bits>()) ? sclamp_m<bits>() : (x < -sclamp_b<bits>()) ? -sclamp_b<bits>() : x;
|
||||
+ }
|
||||
+
|
||||
+ template<int bits> constexpr inline signed sclip_m() {
|
||||
+ return (1U << (bits)) - 1;
|
||||
}
|
||||
|
||||
template<int bits> constexpr inline signed sclip(const signed x) {
|
||||
- enum { b = 1U << (bits - 1), m = (1U << bits) - 1 };
|
||||
- return ((x & m) ^ b) - b;
|
||||
+ return ((x & sclip_m<bits>()) ^ sclamp_b<bits>()) - sclamp_b<bits>();
|
||||
}
|
||||
|
||||
namespace bit {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From d39571de650d49636778a73c66414aff372c08af Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 7 Sep 2015 20:48:14 +0300
|
||||
Subject: [PATCH 25/27] Fix MSU-1 bug where write to MSU1BASE+4 is mirred to
|
||||
MSUBASE+5
|
||||
|
||||
---
|
||||
snes/chip/msu1/msu1.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snes/chip/msu1/msu1.cpp b/snes/chip/msu1/msu1.cpp
|
||||
index 71700e60..ec1cf46a 100755
|
||||
--- a/snes/chip/msu1/msu1.cpp
|
||||
+++ b/snes/chip/msu1/msu1.cpp
|
||||
@@ -107,7 +107,7 @@ void MSU1::mmio_write(unsigned addr, uint8 data) {
|
||||
if(datafile.open()) datafile.seek(mmio.data_offset);
|
||||
mmio.data_busy = false;
|
||||
break;
|
||||
- case 4: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0);
|
||||
+ case 4: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0); break;
|
||||
case 5: mmio.audio_track = (mmio.audio_track & 0x00ff) | (data << 8);
|
||||
if(audiofile.open()) audiofile.close();
|
||||
if(audiofile.open(interface->path(Cartridge::Slot::Base, { "-", (unsigned)mmio.audio_track, ".pcm" }), file::mode::read)) {
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From c0a2270cfd5f56e8a311b36011e1f15fac6c54ca Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilariliusvaara@welho.com>
|
||||
Date: Tue, 9 Aug 2016 18:54:57 +0300
|
||||
Subject: [PATCH 26/27] Add <vector> to avoid compile error due to missing
|
||||
std::vector
|
||||
|
||||
---
|
||||
snes/snes.hpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 7c48ebb3..3a65e360 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -22,6 +22,7 @@ namespace SNES {
|
||||
|
||||
#include <libco/libco.h>
|
||||
|
||||
+#include <vector>
|
||||
#include <nall/platform.hpp>
|
||||
#include <nall/algorithm.hpp>
|
||||
#include <nall/any.hpp>
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -0,0 +1,377 @@
|
|||
From 4cfbbeadc3abe3e3911f7f59ce57b715edc76563 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilariliusvaara@welho.com>
|
||||
Date: Wed, 25 Oct 2017 14:18:34 +0300
|
||||
Subject: [PATCH 27/27] Bus fixes: Do not update MDR on read from CPU MMIO
|
||||
space
|
||||
|
||||
Also, updates the controller read timings to be more accurate.
|
||||
---
|
||||
snes/config/config.cpp | 1 +
|
||||
snes/config/config.hpp | 1 +
|
||||
snes/cpu/cpu.cpp | 2 +
|
||||
snes/cpu/memory/memory.cpp | 26 ++++++++-
|
||||
snes/cpu/mmio/mmio.cpp | 14 +++--
|
||||
snes/cpu/timing/joypad.cpp | 132 +++++++++++++++++++++++++++++++++++++++------
|
||||
snes/cpu/timing/timing.cpp | 11 ++--
|
||||
snes/cpu/timing/timing.hpp | 3 +-
|
||||
snes/snes.hpp | 1 +
|
||||
9 files changed, 166 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
|
||||
index 19831370..8dcfd7e8 100755
|
||||
--- a/snes/config/config.cpp
|
||||
+++ b/snes/config/config.cpp
|
||||
@@ -15,6 +15,7 @@ Configuration::Configuration() {
|
||||
cpu.pal_frequency = 21281370;
|
||||
cpu.wram_init_value = 0x55;
|
||||
cpu.alt_poll_timings = false;
|
||||
+ cpu.bus_fixes = false;
|
||||
|
||||
smp.ntsc_frequency = 24607104; //32040.5 * 768
|
||||
smp.pal_frequency = 24607104;
|
||||
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
|
||||
index 68fe0bde..d8577e39 100755
|
||||
--- a/snes/config/config.hpp
|
||||
+++ b/snes/config/config.hpp
|
||||
@@ -14,6 +14,7 @@ struct Configuration {
|
||||
unsigned pal_frequency;
|
||||
unsigned wram_init_value;
|
||||
bool alt_poll_timings;
|
||||
+ bool bus_fixes;
|
||||
} cpu;
|
||||
|
||||
struct SMP {
|
||||
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
|
||||
index e11fc882..5e8e3137 100755
|
||||
--- a/snes/cpu/cpu.cpp
|
||||
+++ b/snes/cpu/cpu.cpp
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <snes/snes.hpp>
|
||||
#include <cstdio>
|
||||
+#include <iostream>
|
||||
+#include <cassert>
|
||||
|
||||
#define CPU_CPP
|
||||
namespace SNES {
|
||||
diff --git a/snes/cpu/memory/memory.cpp b/snes/cpu/memory/memory.cpp
|
||||
index 31f82c31..df439c22 100755
|
||||
--- a/snes/cpu/memory/memory.cpp
|
||||
+++ b/snes/cpu/memory/memory.cpp
|
||||
@@ -14,10 +14,32 @@ uint8 CPU::op_read(uint32 addr, bool exec) {
|
||||
status.clock_count = speed(addr);
|
||||
dma_edge();
|
||||
add_clocks(status.clock_count - 4);
|
||||
- regs.mdr = bus.read(addr, exec);
|
||||
+ //MDR presents the state held by parasitic capacitance of the external bus.
|
||||
+ //This bus is not affected by reads from CPU-internal registers, only if
|
||||
+ //some external device responds. SDD1 does hook some of these addresses, but
|
||||
+ //passes read straight through, as expected (as the CPU probably won't
|
||||
+ //monitor if external device responds, even if it broadcasts a read).
|
||||
+ //
|
||||
+ //We use 4000-43FF as CPU register range, and not 4000-437F it likely is
|
||||
+ //for quickness of checking. This will only affect things if some device
|
||||
+ //tries to map the 4380-43FF range (that device will still work correctly,
|
||||
+ //but openbus in that range won't).
|
||||
+ //
|
||||
+ //This was discovered while investigating why one Super Metroid glitch
|
||||
+ //worked on emulator but crashed on real console.
|
||||
+ //
|
||||
+ //a word fetch from 2f4017 AND 0xfffc results in 2f3c and a word fetch from
|
||||
+ //2f4210 AND 0x7f7f results in 2f22. This also extends to long fetches
|
||||
+ //by arguments. E.g. long argument fetch from 94420F with 2F already on
|
||||
+ //the bus AND 0x7f7fff results in 2f222f.
|
||||
+ //
|
||||
+ //The reason for masking some bits in above explanation was to ignore some
|
||||
+ //known bits in those registers (bits 7 of 4210 and 4211, bits 0&1 of 4017).
|
||||
+ uint8_t tmp = bus.read(addr, exec);
|
||||
+ if(!config.cpu.bus_fixes || (addr & 0x40FC00) != 0x004000) regs.mdr = tmp;
|
||||
add_clocks(4);
|
||||
alu_edge();
|
||||
- return regs.mdr;
|
||||
+ return tmp;
|
||||
}
|
||||
|
||||
void CPU::op_write(uint32 addr, uint8 data) {
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index 30048c19..be2990a3 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -33,9 +33,17 @@ void CPU::mmio_w2183(uint8 data) {
|
||||
//strobing $4016.d0 affects both controller port latches.
|
||||
//$4017 bit 0 writes are ignored.
|
||||
void CPU::mmio_w4016(uint8 data) {
|
||||
- if(data&1) interface->notifyLatched();
|
||||
- input.port1->latch(data & 1);
|
||||
- input.port2->latch(data & 1);
|
||||
+ //Only consider autoassert if both busfix and auto flags are set.
|
||||
+ auto auto_asserted = (status.auto_joypad_counter & 384) == 384;
|
||||
+ //Bit 6 of status.auto_joypad_counter follows "manual" latch.
|
||||
+ auto oldstatus = auto_asserted || (status.auto_joypad_counter & 64) != 0;
|
||||
+ status.auto_joypad_counter &= ~64;
|
||||
+ status.auto_joypad_counter |= (data & 1) << 6;
|
||||
+ auto newstatus = auto_asserted || (status.auto_joypad_counter & 64) != 0;
|
||||
+ //If !oldstatus and newstatus, signal latch.
|
||||
+ if(!oldstatus && newstatus) interface->notifyLatched();
|
||||
+ input.port1->latch(newstatus);
|
||||
+ input.port2->latch(newstatus);
|
||||
}
|
||||
|
||||
//JOYSER0
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index afca7504..b60be020 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -3,11 +3,14 @@
|
||||
//called every 256 clocks; see CPU::add_clocks()
|
||||
void CPU::step_auto_joypad_poll() {
|
||||
if(vcounter() >= (ppu.overscan() == false ? 225 : 240)) {
|
||||
+ auto cycle = status.auto_joypad_counter & 63;
|
||||
//cache enable state at first iteration
|
||||
- if(status.auto_joypad_counter == 0) status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
- status.auto_joypad_active = status.auto_joypad_counter <= 15;
|
||||
+ if(cycle == 0) status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
+ status.auto_joypad_active = cycle <= 15;
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
- if(status.auto_joypad_counter == 0) {
|
||||
+ if(cycle == 0) {
|
||||
+ if(status.auto_joypad_counter & 128)
|
||||
+ std::cerr << "step_auto_joypad_poll(): bus fixes set (counter=" << status.auto_joypad_counter << ")???" << std::endl;
|
||||
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
@@ -23,7 +26,7 @@ void CPU::step_auto_joypad_poll() {
|
||||
status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
|
||||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
- if(status.auto_joypad_counter == 15) {
|
||||
+ if(cycle == 15) {
|
||||
char buf[512];
|
||||
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
@@ -31,32 +34,129 @@ void CPU::step_auto_joypad_poll() {
|
||||
}
|
||||
}
|
||||
|
||||
- status.auto_joypad_counter++;
|
||||
+ //Only bits 0-5 are supposed to increment.
|
||||
+ if(cycle < 60)
|
||||
+ status.auto_joypad_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
//called every 128 clocks; see CPU::add_clocks()
|
||||
-void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
- if(status.auto_joypad_counter > 0 && status.auto_joypad_counter <= 34) {
|
||||
+void CPU::step_auto_joypad_poll_NEW2(bool polarity) {
|
||||
+ //Poll starts on multiple of 128 mod 256 clocks (polarity=false) on first
|
||||
+ //vblank scanline. If autopoller is off, mark as done for the frame.
|
||||
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && !polarity &&
|
||||
+ (status.auto_joypad_counter & 63) == 0) {
|
||||
+ if(!(status.auto_joypad_counter & 128))
|
||||
+ std::cerr << "step_auto_joypad_poll_NEW2(): bus fixes clear???" << std::endl;
|
||||
+ //Preserve high bits of autopoll counter.
|
||||
+ auto x = status.auto_joypad_counter & ~63;
|
||||
+ status.auto_joypad_counter = x | (status.auto_joypad_poll ? 1 : 36);
|
||||
+ status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
+ }
|
||||
+ //Abuse bit 6 of counter for "manual" poll flag. Bit 7 is supposed to be
|
||||
+ //always set.
|
||||
+ auto cycle = status.auto_joypad_counter & 63;
|
||||
+ auto old_latchstate = (status.auto_joypad_counter & 320) != 0;
|
||||
+ //If not enabled... This is not latched, as autopoll can be aborted.
|
||||
+ if(!status.auto_joypad_poll && cycle > 0 && cycle < 36) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- Automatic polling ABORTED --");
|
||||
+ status.auto_joypad_counter += (36 - cycle);
|
||||
+ status.auto_joypad_active = false;
|
||||
+ status.auto_joypad_latch = false;
|
||||
+ //Release autopoll latch.
|
||||
+ status.auto_joypad_counter &= ~256; //Autopoll clears latch.
|
||||
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
|
||||
+ if(old_latchstate && !new_latchstate) {
|
||||
+ input.port1->latch(0);
|
||||
+ input.port2->latch(0);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ //On cycle #1, latch is asserted (unless latch is already high, in this
|
||||
+ //case the autopoller is supposed to force latch high too).
|
||||
+ if(cycle == 1) {
|
||||
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
+ //Assert autopoll latch.
|
||||
+ status.auto_joypad_counter |= 256;
|
||||
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
|
||||
+ if(!old_latchstate && new_latchstate) {
|
||||
+ interface->notifyLatched();
|
||||
+ input.port1->latch(1);
|
||||
+ input.port2->latch(1);
|
||||
+ }
|
||||
+ }
|
||||
+ //On cycle #2, busy is asserted and controllers are cleared.
|
||||
+ if(cycle == 2) {
|
||||
+ status.joy1 = 0;
|
||||
+ status.joy2 = 0;
|
||||
+ status.joy3 = 0;
|
||||
+ status.joy4 = 0;
|
||||
+ status.auto_joypad_active = true;
|
||||
+ }
|
||||
+ //Then, on cycle #3, latch is deasserted, unless "manual" latch forces
|
||||
+ //real latch high.
|
||||
+ if(cycle == 3) {
|
||||
+ //Release autopoll latch.
|
||||
+ status.auto_joypad_counter &= ~256;
|
||||
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
|
||||
+ if(old_latchstate && !new_latchstate) {
|
||||
+ input.port1->latch(0);
|
||||
+ input.port2->latch(0);
|
||||
+ }
|
||||
+ }
|
||||
+ //Then on cycles #4, #6, #8, ..., #34, a bit is shifted. Also, clock would
|
||||
+ //go low, but we can not emulate that.
|
||||
+ if(cycle >= 4 && cycle <= 34 && cycle % 2 == 0) {
|
||||
+ uint2 port0 = input.port1->data();
|
||||
+ uint2 port1 = input.port2->data();
|
||||
+ status.joy1 = (status.joy1 << 1) | (bool)(port0 & 1);
|
||||
+ status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
|
||||
+ status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
+ status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
+ }
|
||||
+ //Then on cycles #5, #7, #9, ..., #35, clock drops high, But we can not
|
||||
+ //emulate that.
|
||||
+ //Then on cycle #35, busy flag is deasserted and poll is complete.
|
||||
+ if(cycle == 35) {
|
||||
+ status.auto_joypad_active = false;
|
||||
+ char buf[512];
|
||||
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
+ status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
+ if(dma_trace_fn) dma_trace_fn(buf);
|
||||
+ }
|
||||
+ //The entiere train is 35 cycles.
|
||||
+ if(cycle > 0 && cycle < 36) {
|
||||
+ status.auto_joypad_counter++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+//called every 128 clocks; see CPU::add_clocks()
|
||||
+void CPU::step_auto_joypad_poll_NEW(bool polarity, bool new2) {
|
||||
+ if(new2) return step_auto_joypad_poll_NEW2(polarity);
|
||||
+ auto cycle = status.auto_joypad_counter & 63;
|
||||
+ if(cycle > 0 && cycle <= 34) {
|
||||
if(!status.auto_joypad_latch) {
|
||||
//FIXME: Is this right, busy flag goes on even if not enabled???
|
||||
- if(status.auto_joypad_counter == 1)
|
||||
+ if(cycle == 1)
|
||||
status.auto_joypad_active = true;
|
||||
- if(status.auto_joypad_counter == 34)
|
||||
+ if(cycle == 34)
|
||||
status.auto_joypad_active = false;
|
||||
} else {
|
||||
- if(status.auto_joypad_counter == 1) {
|
||||
+ if(cycle == 1) {
|
||||
+ if(status.auto_joypad_counter & 128)
|
||||
+ std::cerr << "step_auto_joypad_poll_NEW(): bus fixes set???" << std::endl;
|
||||
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
status.auto_joypad_active = true;
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
}
|
||||
- if(status.auto_joypad_counter == 3) {
|
||||
+ if(cycle == 3) {
|
||||
input.port1->latch(0);
|
||||
input.port2->latch(0);
|
||||
}
|
||||
- if((status.auto_joypad_counter & 1) != 0 && status.auto_joypad_counter != 1) {
|
||||
+ if((cycle & 1) != 0 && cycle != 1) {
|
||||
uint2 port0 = input.port1->data();
|
||||
uint2 port1 = input.port2->data();
|
||||
|
||||
@@ -65,7 +165,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
}
|
||||
- if(status.auto_joypad_counter == 34) {
|
||||
+ if(cycle == 34) {
|
||||
status.auto_joypad_active = false;
|
||||
char buf[512];
|
||||
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
@@ -75,9 +175,11 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
||||
}
|
||||
status.auto_joypad_counter++;
|
||||
}
|
||||
- if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && status.auto_joypad_counter == 0 && !polarity) {
|
||||
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && cycle == 0 && !polarity) {
|
||||
+ //Preserve high bits of autopoller counter.
|
||||
+ auto x = status.auto_joypad_counter & ~63;
|
||||
status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
- status.auto_joypad_counter = 1;
|
||||
+ status.auto_joypad_counter = x | 1;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/snes/cpu/timing/timing.cpp b/snes/cpu/timing/timing.cpp
|
||||
index d7cf24f3..ef81d891 100755
|
||||
--- a/snes/cpu/timing/timing.cpp
|
||||
+++ b/snes/cpu/timing/timing.cpp
|
||||
@@ -17,12 +17,12 @@ void CPU::add_clocks(unsigned clocks) {
|
||||
|
||||
step(clocks);
|
||||
|
||||
- if(config.cpu.alt_poll_timings) {
|
||||
+ if(config.cpu.alt_poll_timings || config.cpu.bus_fixes) {
|
||||
bool opolarity = (status.auto_joypad_clock & 128);
|
||||
status.auto_joypad_clock = (status.auto_joypad_clock + clocks) & 0xFF;
|
||||
bool npolarity = (status.auto_joypad_clock & 128);
|
||||
if(opolarity != npolarity)
|
||||
- step_auto_joypad_poll_NEW(opolarity);
|
||||
+ step_auto_joypad_poll_NEW(opolarity, config.cpu.bus_fixes);
|
||||
} else {
|
||||
status.auto_joypad_clock += clocks;
|
||||
if(status.auto_joypad_clock >= 256) {
|
||||
@@ -53,7 +53,8 @@ void CPU::scanline() {
|
||||
status.hdma_init_position = (cpu_version == 1 ? 12 + 8 - dma_counter() : 12 + dma_counter());
|
||||
status.hdma_init_triggered = false;
|
||||
|
||||
- status.auto_joypad_counter = 0;
|
||||
+ //Only clear the low 6 bits (counter).
|
||||
+ status.auto_joypad_counter &= ~63;
|
||||
}
|
||||
|
||||
//DRAM refresh occurs once every scanline
|
||||
@@ -200,7 +201,9 @@ void CPU::timing_reset() {
|
||||
|
||||
status.auto_joypad_active = false;
|
||||
status.auto_joypad_latch = false;
|
||||
- status.auto_joypad_counter = 0;
|
||||
+ //Set bit 7 of joypad counter if bus fixes are active (for combined
|
||||
+ //latch behavior).
|
||||
+ status.auto_joypad_counter = config.cpu.bus_fixes ? 128 : 0;
|
||||
status.auto_joypad_clock = 0;
|
||||
}
|
||||
|
||||
diff --git a/snes/cpu/timing/timing.hpp b/snes/cpu/timing/timing.hpp
|
||||
index bf15a727..8be2b830 100755
|
||||
--- a/snes/cpu/timing/timing.hpp
|
||||
+++ b/snes/cpu/timing/timing.hpp
|
||||
@@ -22,4 +22,5 @@ alwaysinline bool irq_test();
|
||||
|
||||
//joypad.cpp
|
||||
void step_auto_joypad_poll();
|
||||
-void step_auto_joypad_poll_NEW(bool polarity);
|
||||
+void step_auto_joypad_poll_NEW(bool polarity, bool new2);
|
||||
+void step_auto_joypad_poll_NEW2(bool polarity);
|
||||
diff --git a/snes/snes.hpp b/snes/snes.hpp
|
||||
index 3a65e360..961842b3 100755
|
||||
--- a/snes/snes.hpp
|
||||
+++ b/snes/snes.hpp
|
||||
@@ -3,6 +3,7 @@
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
|
||||
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
|
||||
#define BSNES_SUPPORTS_ALT_TIMINGS
|
||||
+#define BSNES_SUPPORTS_BUS_FIXES
|
||||
#define BSNES_SUPPORTS_TRACE_SA1
|
||||
#define BSNES_SUPPORTS_DMA_TRACE
|
||||
|
||||
--
|
||||
2.15.0.rc1
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
From f66f4b9ecfcccb22b113acc6e5e92c93ed8890a9 Mon Sep 17 00:00:00 2001
|
||||
From 6c3da8eb6516d25e97b46d97fb0d3d24ca9ecfd0 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:37:44 +0200
|
||||
Subject: [PATCH 1/4] Don't use time() in emulating chips
|
||||
Subject: [PATCH 1/8] Don't use time() in emulating chips
|
||||
|
||||
Instead of using time() in chip emulation, create new interface method
|
||||
currentTime(), defaulting to time(0). This way frontend can cleanly
|
||||
override the current time bsnes is using.
|
||||
---
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
5 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
|
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
|
|||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
From b02a77dd57546588a44b70bec3d6772e8ed5c11d Mon Sep 17 00:00:00 2001
|
||||
From c87e7d9288a91db3b32b5ba4b2b74e52c0d3c11d Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 01:52:08 +0200
|
||||
Subject: [PATCH 2/4] Save controller state when savestating
|
||||
Subject: [PATCH 2/8] Save controller state when savestating
|
||||
|
||||
When savestating, save the controller state and restore it upon loadstate.
|
||||
Prevents libsnes from mixing up buttons.
|
||||
---
|
||||
snes/controller/controller.cpp | 8 ++++++
|
||||
snes/controller/controller.hpp | 2 +
|
||||
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 ++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 +++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
snes/controller/controller.cpp | 8 +++++++
|
||||
snes/controller/controller.hpp | 2 ++
|
||||
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 +++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 ++++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
15 files changed, 142 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
|
||||
|
@ -342,5 +342,5 @@ index 9f5273d..005e731 100755
|
|||
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
|
||||
#if defined(GAMEBOY)
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
From a47431385fedf705a3c9c1b820c116c230632943 Mon Sep 17 00:00:00 2001
|
||||
From a62794b0bfa1d2bfc8907a1e4d4e5aa6fe3ee426 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
||||
Subject: [PATCH 3/4] Allow frontend to control random number seed
|
||||
Subject: [PATCH 3/8] Allow frontend to control random number seed
|
||||
|
||||
---
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletions(-)
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index b3017c9..0a21a13 100755
|
||||
|
@ -49,5 +49,5 @@ index 284e389..99901ff 100755
|
|||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,60 +1,63 @@
|
|||
From 395130ad02c50c329c0290b675086ff104839943 Mon Sep 17 00:00:00 2001
|
||||
From 33ecd422954b7e15d9e83b7035b07ffb52f4e1e8 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 7 Mar 2012 16:57:18 +0200
|
||||
Subject: [PATCH 4/4] Fix mouse polling
|
||||
Subject: [PATCH 4/8] Fix mouse polling
|
||||
|
||||
Don't poll for mouse motion excessive number of times (no need to poll it for
|
||||
each bit!)
|
||||
---
|
||||
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index 6b26fae..824ecd3 100755
|
||||
index 6b26fae..1a066b9 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -3,8 +3,10 @@
|
||||
@@ -3,9 +3,13 @@
|
||||
uint2 Mouse::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ if(counter == 0) {
|
||||
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ }
|
||||
|
||||
+ int position_x = _position_x;
|
||||
+ int position_y = _position_y;
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
|
||||
|
||||
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
|
||||
unsigned char block[Controller::SaveSize] = {0};
|
||||
block[0] = latched ? 1 : 0;
|
||||
block[1] = counter;
|
||||
+ block[2] = (unsigned short)position_x >> 8;
|
||||
+ block[3] = (unsigned short)position_x;
|
||||
+ block[4] = (unsigned short)position_y >> 8;
|
||||
+ block[5] = (unsigned short)position_y;
|
||||
+ block[2] = (unsigned short)_position_x >> 8;
|
||||
+ block[3] = (unsigned short)_position_x;
|
||||
+ block[4] = (unsigned short)_position_y >> 8;
|
||||
+ block[5] = (unsigned short)_position_y;
|
||||
s.array(block, Controller::SaveSize);
|
||||
if(s.mode() == nall::serializer::Load) {
|
||||
latched = (block[0] != 0);
|
||||
counter = block[1];
|
||||
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index b66ea51..6074f34 100755
|
||||
index b66ea51..b07c8ab 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -6,4 +6,6 @@ struct Mouse : Controller {
|
||||
private:
|
||||
bool latched;
|
||||
unsigned counter;
|
||||
+ int position_x;
|
||||
+ int position_y;
|
||||
+ int _position_x;
|
||||
+ int _position_y;
|
||||
};
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
From 574754de0ed7da044d3c559bb2c8bbca895c1e97 Mon Sep 17 00:00:00 2001
|
||||
From 52a1a595f4473b4de0cdedcb018aef68108a2c73 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 24 Sep 2012 21:46:09 +0300
|
||||
Subject: [PATCH] Add needed support for detecting true polls as opposed to
|
||||
Subject: [PATCH 5/8] Add needed support for detecting true polls as opposed to
|
||||
just autopolling
|
||||
|
||||
---
|
||||
bsnes/snes/cpu/cpu.hpp | 1 +
|
||||
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
snes/cpu/cpu.hpp | 1 +
|
||||
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
|
||||
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
|
||||
index 5eb963e..f6466cc 100755
|
||||
--- a/bsnes/snes/cpu/cpu.hpp
|
||||
+++ b/bsnes/snes/cpu/cpu.hpp
|
||||
--- a/snes/cpu/cpu.hpp
|
||||
+++ b/snes/cpu/cpu.hpp
|
||||
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
|
||||
CPU();
|
||||
~CPU();
|
||||
|
@ -21,10 +21,10 @@ index 5eb963e..f6466cc 100755
|
|||
privileged:
|
||||
#include "dma/dma.hpp"
|
||||
#include "memory/memory.hpp"
|
||||
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index 8b6aaa6..c5ee930 100755
|
||||
--- a/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
|
||||
//1-0 = Joypad serial data
|
||||
uint8 CPU::mmio_r4016() {
|
||||
|
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
|
|||
//DMAPx
|
||||
uint8 CPU::mmio_r43x0(uint8 i) {
|
||||
--
|
||||
1.7.10.4
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
From 919c8935121c2ec7cb96ce561044981526c1ca7e Mon Sep 17 00:00:00 2001
|
||||
From 74b67f36961839fcbc1caa23930151bd9b3e9d7e Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 14 Oct 2012 23:29:40 +0300
|
||||
Subject: [PATCH] Fix compiling on GCC 4.7
|
||||
Subject: [PATCH 6/8] Fix compiling on GCC 4.7
|
||||
|
||||
---
|
||||
bsnes/nall/string.hpp | 2 +-
|
||||
bsnes/ui-libsnes/libsnes.cpp | 1 +
|
||||
nall/string.hpp | 2 +-
|
||||
ui-libsnes/libsnes.cpp | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bsnes/nall/string.hpp b/bsnes/nall/string.hpp
|
||||
diff --git a/nall/string.hpp b/nall/string.hpp
|
||||
index 996cd68..4747e4c 100755
|
||||
--- a/bsnes/nall/string.hpp
|
||||
+++ b/bsnes/nall/string.hpp
|
||||
--- a/nall/string.hpp
|
||||
+++ b/nall/string.hpp
|
||||
@@ -25,8 +25,8 @@
|
||||
#include <nall/string/base.hpp>
|
||||
#include <nall/string/bml.hpp>
|
||||
|
@ -22,10 +22,10 @@ index 996cd68..4747e4c 100755
|
|||
#include <nall/string/compare.hpp>
|
||||
#include <nall/string/convert.hpp>
|
||||
#include <nall/string/cstring.hpp>
|
||||
diff --git a/bsnes/ui-libsnes/libsnes.cpp b/bsnes/ui-libsnes/libsnes.cpp
|
||||
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
|
||||
index 3b2be7a..ca90762 100755
|
||||
--- a/bsnes/ui-libsnes/libsnes.cpp
|
||||
+++ b/bsnes/ui-libsnes/libsnes.cpp
|
||||
--- a/ui-libsnes/libsnes.cpp
|
||||
+++ b/ui-libsnes/libsnes.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "libsnes.hpp"
|
||||
#include <snes/snes.hpp>
|
||||
|
@ -34,5 +34,5 @@ index 3b2be7a..ca90762 100755
|
|||
#include <nall/snes/cartridge.hpp>
|
||||
#include <nall/gameboy/cartridge.hpp>
|
||||
--
|
||||
1.7.10.4
|
||||
1.8.4.4
|
||||
|
||||
|
|
65
bsnes-patches/v086/0007-Support-notifying-latches.patch
Normal file
65
bsnes-patches/v086/0007-Support-notifying-latches.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 5dc532e67245f1e83504be4a21fef1ab15b08af2 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 27 Oct 2013 10:52:45 +0200
|
||||
Subject: [PATCH 7/8] Support notifying latches
|
||||
|
||||
---
|
||||
snes/cpu/mmio/mmio.cpp | 1 +
|
||||
snes/cpu/timing/joypad.cpp | 1 +
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index c5ee930..b7afff0 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
|
||||
//strobing $4016.d0 affects both controller port latches.
|
||||
//$4017 bit 0 writes are ignored.
|
||||
void CPU::mmio_w4016(uint8 data) {
|
||||
+ if(data&1) interface->notifyLatched();
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
}
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 179df27..6a98de0 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
|
||||
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
+ interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index 0a21a13..6685556 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
|
||||
return time(0);
|
||||
}
|
||||
|
||||
+void Interface::notifyLatched()
|
||||
+{
|
||||
+ //Nothing.
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index 30ee7fd..203f7b0 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -7,6 +7,7 @@ struct Interface {
|
||||
virtual void message(const string &text);
|
||||
virtual time_t currentTime();
|
||||
virtual time_t randomSeed();
|
||||
+ virtual void notifyLatched();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.8.4.4
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From ce0634fe5a8dea973ca9c357ec788740fbcfcf09 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 30 Nov 2013 10:28:05 +0200
|
||||
Subject: [PATCH 8/8] Support auto-detecting bsnes version
|
||||
|
||||
---
|
||||
bsnes.mk | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
create mode 100644 bsnes.mk
|
||||
|
||||
diff --git a/bsnes.mk b/bsnes.mk
|
||||
new file mode 100644
|
||||
index 0000000..2248b71
|
||||
--- /dev/null
|
||||
+++ b/bsnes.mk
|
||||
@@ -0,0 +1,3 @@
|
||||
+BSNES_SUPPORTS_DEBUGGER=
|
||||
+LIBSNES_DIR=ui-libsnes
|
||||
+BSNES_VERSION=086
|
||||
--
|
||||
1.8.4.4
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
From 22205d4d339cfa11f6d53e644eae1c859a56d349 Mon Sep 17 00:00:00 2001
|
||||
From a8018b3c90314bd0c112842fe81b27e978b891eb Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:37:44 +0200
|
||||
Subject: [PATCH 1/4] Don't use time() in emulating chips
|
||||
Subject: [PATCH 1/8] Don't use time() in emulating chips
|
||||
|
||||
Instead of using time() in chip emulation, create new interface method
|
||||
currentTime(), defaulting to time(0). This way frontend can cleanly
|
||||
override the current time bsnes is using.
|
||||
---
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
5 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
|
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
|
|||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
From fe11984ad18561506a7cc874cb7c0421f1e21ad1 Mon Sep 17 00:00:00 2001
|
||||
From de423d6ec33a20f33652c6b9c8ce703b867b51bd Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 01:52:08 +0200
|
||||
Subject: [PATCH 2/4] Save controller state when savestating
|
||||
Subject: [PATCH 2/8] Save controller state when savestating
|
||||
|
||||
When savestating, save the controller state and restore it upon loadstate.
|
||||
Prevents libsnes from mixing up buttons.
|
||||
---
|
||||
snes/controller/controller.cpp | 8 ++++++
|
||||
snes/controller/controller.hpp | 2 +
|
||||
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 ++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 +++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
snes/controller/controller.cpp | 8 +++++++
|
||||
snes/controller/controller.hpp | 2 ++
|
||||
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
|
||||
snes/controller/gamepad/gamepad.hpp | 2 +-
|
||||
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
|
||||
snes/controller/justifier/justifier.hpp | 1 +
|
||||
snes/controller/mouse/mouse.cpp | 13 +++++++++++
|
||||
snes/controller/mouse/mouse.hpp | 2 +-
|
||||
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
|
||||
snes/controller/multitap/multitap.hpp | 2 +-
|
||||
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
|
||||
snes/controller/superscope/superscope.hpp | 1 +
|
||||
snes/system/input.cpp | 16 ++++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
snes/system/serialization.cpp | 1 +
|
||||
15 files changed, 142 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
|
||||
|
@ -342,5 +342,5 @@ index f746c3a..67e08a2 100755
|
|||
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
|
||||
#if defined(GAMEBOY)
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
From 5f76449a70c9a546e18c2fdebe7588bbe90b56d2 Mon Sep 17 00:00:00 2001
|
||||
From e1fce124df0a1ea43324df65b9d0ee7262eda988 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
||||
Subject: [PATCH 3/4] Allow frontend to control random number seed
|
||||
Subject: [PATCH 3/8] Allow frontend to control random number seed
|
||||
|
||||
---
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletions(-)
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index b3017c9..0a21a13 100755
|
||||
|
@ -49,5 +49,5 @@ index 9b70bbf..cbd096c 100755
|
|||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,60 +1,63 @@
|
|||
From 160dedf35571478781737ee35307b9321cfb41bb Mon Sep 17 00:00:00 2001
|
||||
From 21e21c3b953f499bb3e309ff6a04b38763e7910a Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 7 Mar 2012 16:57:18 +0200
|
||||
Subject: [PATCH 4/4] Fix mouse polling
|
||||
Subject: [PATCH 4/8] Fix mouse polling
|
||||
|
||||
Don't poll for mouse motion excessive number of times (no need to poll it for
|
||||
each bit!)
|
||||
---
|
||||
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
|
||||
snes/controller/mouse/mouse.hpp | 2 ++
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
|
||||
index 6b26fae..824ecd3 100755
|
||||
index 6b26fae..1a066b9 100755
|
||||
--- a/snes/controller/mouse/mouse.cpp
|
||||
+++ b/snes/controller/mouse/mouse.cpp
|
||||
@@ -3,8 +3,10 @@
|
||||
@@ -3,9 +3,13 @@
|
||||
uint2 Mouse::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ if(counter == 0) {
|
||||
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
+ }
|
||||
|
||||
+ int position_x = _position_x;
|
||||
+ int position_y = _position_y;
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
|
||||
|
||||
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
|
||||
unsigned char block[Controller::SaveSize] = {0};
|
||||
block[0] = latched ? 1 : 0;
|
||||
block[1] = counter;
|
||||
+ block[2] = (unsigned short)position_x >> 8;
|
||||
+ block[3] = (unsigned short)position_x;
|
||||
+ block[4] = (unsigned short)position_y >> 8;
|
||||
+ block[5] = (unsigned short)position_y;
|
||||
+ block[2] = (unsigned short)_position_x >> 8;
|
||||
+ block[3] = (unsigned short)_position_x;
|
||||
+ block[4] = (unsigned short)_position_y >> 8;
|
||||
+ block[5] = (unsigned short)_position_y;
|
||||
s.array(block, Controller::SaveSize);
|
||||
if(s.mode() == nall::serializer::Load) {
|
||||
latched = (block[0] != 0);
|
||||
counter = block[1];
|
||||
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
|
||||
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
|
||||
index b66ea51..6074f34 100755
|
||||
index b66ea51..b07c8ab 100755
|
||||
--- a/snes/controller/mouse/mouse.hpp
|
||||
+++ b/snes/controller/mouse/mouse.hpp
|
||||
@@ -6,4 +6,6 @@ struct Mouse : Controller {
|
||||
private:
|
||||
bool latched;
|
||||
unsigned counter;
|
||||
+ int position_x;
|
||||
+ int position_y;
|
||||
+ int _position_x;
|
||||
+ int _position_y;
|
||||
};
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
From f22d7a2b57d57959ac947465323870a8772d15ad Mon Sep 17 00:00:00 2001
|
||||
From 9b14075f51587694015f8507f1c7cb565fee8225 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Mon, 24 Sep 2012 21:46:09 +0300
|
||||
Subject: [PATCH] Add needed support for detecting true polls as opposed to
|
||||
Subject: [PATCH 5/8] Add needed support for detecting true polls as opposed to
|
||||
just autopolling
|
||||
|
||||
---
|
||||
bsnes/snes/cpu/cpu.hpp | 1 +
|
||||
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
snes/cpu/cpu.hpp | 1 +
|
||||
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
|
||||
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
|
||||
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
|
||||
index 5eb963e..f6466cc 100755
|
||||
--- a/bsnes/snes/cpu/cpu.hpp
|
||||
+++ b/bsnes/snes/cpu/cpu.hpp
|
||||
--- a/snes/cpu/cpu.hpp
|
||||
+++ b/snes/cpu/cpu.hpp
|
||||
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
|
||||
CPU();
|
||||
~CPU();
|
||||
|
@ -21,10 +21,10 @@ index 5eb963e..f6466cc 100755
|
|||
privileged:
|
||||
#include "dma/dma.hpp"
|
||||
#include "memory/memory.hpp"
|
||||
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index 8b6aaa6..c5ee930 100755
|
||||
--- a/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
|
||||
//1-0 = Joypad serial data
|
||||
uint8 CPU::mmio_r4016() {
|
||||
|
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
|
|||
//DMAPx
|
||||
uint8 CPU::mmio_r43x0(uint8 i) {
|
||||
--
|
||||
1.7.10.4
|
||||
1.8.4.4
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
From d4a3678c9cfbca544af8069b42b9eaa0205f8ea3 Mon Sep 17 00:00:00 2001
|
||||
From 8c41bf9b792c08ecbf22a87d4e85f3e4801e62d2 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 14 Oct 2012 23:25:33 +0300
|
||||
Subject: [PATCH] Add missing include to libsnes.cpp
|
||||
Subject: [PATCH 6/8] Add missing include to libsnes.cpp
|
||||
|
||||
---
|
||||
bsnes/target-libsnes/libsnes.cpp | 1 +
|
||||
target-libsnes/libsnes.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/bsnes/target-libsnes/libsnes.cpp b/bsnes/target-libsnes/libsnes.cpp
|
||||
diff --git a/target-libsnes/libsnes.cpp b/target-libsnes/libsnes.cpp
|
||||
index 3b2be7a..ca90762 100755
|
||||
--- a/bsnes/target-libsnes/libsnes.cpp
|
||||
+++ b/bsnes/target-libsnes/libsnes.cpp
|
||||
--- a/target-libsnes/libsnes.cpp
|
||||
+++ b/target-libsnes/libsnes.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "libsnes.hpp"
|
||||
#include <snes/snes.hpp>
|
||||
|
@ -19,5 +19,5 @@ index 3b2be7a..ca90762 100755
|
|||
#include <nall/snes/cartridge.hpp>
|
||||
#include <nall/gameboy/cartridge.hpp>
|
||||
--
|
||||
1.7.10.4
|
||||
1.8.4.4
|
||||
|
||||
|
|
65
bsnes-patches/v087/0007-Support-notifying-latches.patch
Normal file
65
bsnes-patches/v087/0007-Support-notifying-latches.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 13643c86bfff3871968cf6e8b4f991465d4e81e7 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sun, 27 Oct 2013 10:52:45 +0200
|
||||
Subject: [PATCH 7/8] Support notifying latches
|
||||
|
||||
---
|
||||
snes/cpu/mmio/mmio.cpp | 1 +
|
||||
snes/cpu/timing/joypad.cpp | 1 +
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
|
||||
index c5ee930..b7afff0 100755
|
||||
--- a/snes/cpu/mmio/mmio.cpp
|
||||
+++ b/snes/cpu/mmio/mmio.cpp
|
||||
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
|
||||
//strobing $4016.d0 affects both controller port latches.
|
||||
//$4017 bit 0 writes are ignored.
|
||||
void CPU::mmio_w4016(uint8 data) {
|
||||
+ if(data&1) interface->notifyLatched();
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
}
|
||||
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
|
||||
index 179df27..6a98de0 100755
|
||||
--- a/snes/cpu/timing/joypad.cpp
|
||||
+++ b/snes/cpu/timing/joypad.cpp
|
||||
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
|
||||
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
+ interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index 0a21a13..6685556 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
|
||||
return time(0);
|
||||
}
|
||||
|
||||
+void Interface::notifyLatched()
|
||||
+{
|
||||
+ //Nothing.
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index 30ee7fd..203f7b0 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -7,6 +7,7 @@ struct Interface {
|
||||
virtual void message(const string &text);
|
||||
virtual time_t currentTime();
|
||||
virtual time_t randomSeed();
|
||||
+ virtual void notifyLatched();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.8.4.4
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From e74f6d6ce7b369d82abf1eed6d7c3e99af0d8f64 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Sat, 30 Nov 2013 10:28:40 +0200
|
||||
Subject: [PATCH 8/8] Support auto-dectecting bsnes version
|
||||
|
||||
---
|
||||
bsnes.mk | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
create mode 100644 bsnes.mk
|
||||
|
||||
diff --git a/bsnes.mk b/bsnes.mk
|
||||
new file mode 100644
|
||||
index 0000000..c31911f
|
||||
--- /dev/null
|
||||
+++ b/bsnes.mk
|
||||
@@ -0,0 +1,3 @@
|
||||
+BSNES_SUPPORTS_DEBUGGER=
|
||||
+LIBSNES_DIR=target-libsnes
|
||||
+BSNES_VERSION=087
|
||||
--
|
||||
1.8.4.4
|
||||
|
124
buildaux/mkdeps.cpp
Normal file
124
buildaux/mkdeps.cpp
Normal file
|
@ -0,0 +1,124 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
#include <sys/time.h>
|
||||
#include <fstream>
|
||||
#include <cctype>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace boost_fs = boost::filesystem;
|
||||
|
||||
bool is_cmdhelp_file(const std::string& filename)
|
||||
{
|
||||
std::string _filename = filename;
|
||||
return (_filename.length() > 8 && _filename.substr(0, 8) == "cmdhelp/");
|
||||
}
|
||||
|
||||
std::string search_include(const std::list<std::string>& searchpath, const std::string& _filename,
|
||||
const std::string& ref_by)
|
||||
{
|
||||
std::string filename = _filename;
|
||||
//Hack: process cmdhelp includes internally as the date were for the JSON include.
|
||||
if(is_cmdhelp_file(filename)) {
|
||||
if(filename != "cmdhelp/inverselist.hpp") {
|
||||
filename = "../src/" + filename;
|
||||
//Replace the extension with .json.
|
||||
size_t split = filename.find_last_of("./\\");
|
||||
if(split < filename.length() && filename[split] == '.') {
|
||||
filename = filename.substr(0, split) + ".json";
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t p = ref_by.find_last_of("/");
|
||||
if(p < ref_by.length()) {
|
||||
std::string i = ref_by;
|
||||
i = i.substr(0, p);
|
||||
std::string real_fn = i + "/" + filename;
|
||||
boost_fs::path p(real_fn);
|
||||
if(boost_fs::exists(p) && boost_fs::is_regular_file(p))
|
||||
return real_fn;
|
||||
}
|
||||
for(auto& i : searchpath) {
|
||||
std::string real_fn = i + "/" + filename;
|
||||
boost_fs::path p(real_fn);
|
||||
if(boost_fs::exists(p) && boost_fs::is_regular_file(p))
|
||||
return real_fn;
|
||||
}
|
||||
std::cerr << "WARNING: Include file '" << filename << "' not found." << std::endl;
|
||||
return "";
|
||||
}
|
||||
|
||||
time_t get_timestamp(const std::string& path)
|
||||
{
|
||||
boost_fs::path p(path);
|
||||
if(!boost_fs::exists(p)) return 0;
|
||||
return boost_fs::last_write_time(p);
|
||||
}
|
||||
|
||||
time_t recursive_scan(const std::list<std::string>& searchpath, const std::string& filename,
|
||||
std::map<std::string, time_t>& scanned)
|
||||
{
|
||||
if(filename == "")
|
||||
return 0;
|
||||
if(scanned.count(filename))
|
||||
return 0;
|
||||
std::ifstream fp(filename);
|
||||
if(!fp) {
|
||||
std::cerr << "WARNING: File '" << filename << "' can't be opened." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
time_t newest = get_timestamp(filename);
|
||||
scanned[filename] = newest;
|
||||
std::string tmp;
|
||||
while(std::getline(fp, tmp)) {
|
||||
if(tmp.length() > 0 && tmp[0] == '#') {
|
||||
//Possibly include.
|
||||
std::string included;
|
||||
if(strncmp(tmp.c_str(), "#include", 8))
|
||||
continue;
|
||||
size_t ptr = 8;
|
||||
while(ptr < tmp.length() && isspace((unsigned char)tmp[ptr]))
|
||||
ptr++;
|
||||
if(ptr == tmp.length())
|
||||
continue;
|
||||
if(tmp[ptr] != '\"')
|
||||
continue;
|
||||
size_t iptr = ++ptr;
|
||||
while(ptr < tmp.length() && tmp[ptr] != '\"')
|
||||
ptr++;
|
||||
if(ptr == tmp.length())
|
||||
continue;
|
||||
included = tmp.substr(iptr, ptr - iptr);
|
||||
newest = std::max(newest, recursive_scan(searchpath, search_include(searchpath, included,
|
||||
filename), scanned));
|
||||
}
|
||||
}
|
||||
return newest;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::list<std::string> searchpath;
|
||||
std::list<std::string> files;
|
||||
bool step = false;
|
||||
for(int i = 1; i < argc; i++) {
|
||||
if(!step && !strcmp(argv[i], "--"))
|
||||
step = true;
|
||||
else if(!step)
|
||||
searchpath.push_back(argv[i]);
|
||||
else
|
||||
files.push_back(argv[i]);
|
||||
}
|
||||
searchpath.push_back(".");
|
||||
for(auto& i : files) {
|
||||
std::map<std::string, time_t> x;
|
||||
time_t t = recursive_scan(searchpath, i, x);
|
||||
if(get_timestamp(i + ".dep") < t) {
|
||||
std::ofstream y(i + ".dep");
|
||||
for(auto& j : x)
|
||||
y << j.second << " " << j.first << std::endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
91
buildaux/txt2cstr.cpp
Normal file
91
buildaux/txt2cstr.cpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
const char* hexes = "0123456789ABCDEF";
|
||||
|
||||
struct encoder
|
||||
{
|
||||
encoder(std::ostream& _output) : output(_output)
|
||||
{
|
||||
have_quote = false;
|
||||
}
|
||||
size_t operator()(unsigned char* buf, size_t bufuse, bool eof)
|
||||
{
|
||||
if(!bufuse) return 0;
|
||||
std::ostringstream out;
|
||||
size_t i = 0;
|
||||
while(i < bufuse) {
|
||||
if(!have_quote) {
|
||||
out << "\"";
|
||||
have_quote = true;
|
||||
}
|
||||
unsigned char ch = buf[i];
|
||||
if(ch == 9) {
|
||||
out << "\\t";
|
||||
} else if(ch == 10) {
|
||||
out << "\\n\"" << std::endl;
|
||||
have_quote = false;
|
||||
} else if(ch == 13) {
|
||||
out << "\\r";
|
||||
} else if(ch < 32) {
|
||||
out << "\\x" << hexes[(ch >> 4)] << hexes[ch & 15];
|
||||
} else if(ch == '\"') {
|
||||
out << "\\\"";
|
||||
} else if(ch == '\\') {
|
||||
out << "\\\\";
|
||||
} else if(ch < 127) {
|
||||
out << ch;
|
||||
} else {
|
||||
out << "\\x" << hexes[(ch >> 4)] << hexes[ch & 15];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
output << out.str();
|
||||
return i;
|
||||
}
|
||||
size_t operator()()
|
||||
{
|
||||
if(have_quote) {
|
||||
output << "\"";
|
||||
have_quote = false;
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::ostream& output;
|
||||
bool have_quote;
|
||||
};
|
||||
|
||||
void do_encode(std::istream& input, std::ostream& output)
|
||||
{
|
||||
char buf[4096];
|
||||
size_t bufuse = 0;
|
||||
bool eof = false;
|
||||
encoder e(output);
|
||||
while(true) {
|
||||
if(!eof) {
|
||||
input.read(buf + bufuse, 4096 - bufuse);
|
||||
bufuse += input.gcount();
|
||||
}
|
||||
if(!input)
|
||||
eof = true;
|
||||
size_t bytes = e(reinterpret_cast<unsigned char*>(buf), bufuse, eof);
|
||||
memmove(buf, buf + bytes, bufuse - bytes);
|
||||
bufuse -= bytes;
|
||||
if(eof && !bufuse) break;
|
||||
}
|
||||
e();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc != 3) {
|
||||
std::cerr << "Usage: txt2cstr <symbol> <file>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::ifstream in(argv[2], std::ios::binary);
|
||||
std::cout << "const char* " << argv[1] << " =" << std::endl;
|
||||
do_encode(in, std::cout);
|
||||
std::cout << ";" << std::endl;
|
||||
}
|
BIN
data/snes9xlua.font
Normal file
BIN
data/snes9xlua.font
Normal file
Binary file not shown.
BIN
data/snes9xluaclever.font
Normal file
BIN
data/snes9xluaclever.font
Normal file
Binary file not shown.
BIN
data/snes9xluasmall.font
Normal file
BIN
data/snes9xluasmall.font
Normal file
Binary file not shown.
BIN
data/snes9xtext.font
Normal file
BIN
data/snes9xtext.font
Normal file
Binary file not shown.
BIN
data/verysmall.font
Normal file
BIN
data/verysmall.font
Normal file
Binary file not shown.
1
gambatte
Submodule
1
gambatte
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a77b5548ae91cf66d1d18d4fbe2aa76eb39c7ea3
|
2
include/cmdhelp/inverselist.hpp
Normal file
2
include/cmdhelp/inverselist.hpp
Normal file
|
@ -0,0 +1,2 @@
|
|||
#pragma once
|
||||
namespace STUBS { extern const char* inverse_cmd_list[]; }
|
|
@ -4,30 +4,48 @@
|
|||
#include <string>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
|
||||
#include "library/framebuffer.hpp"
|
||||
#include "library/dispatch.hpp"
|
||||
#include "library/threads.hpp"
|
||||
|
||||
class adv_dumper
|
||||
class master_dumper;
|
||||
class dumper_factory_base;
|
||||
class dumper_base;
|
||||
class lua_state;
|
||||
|
||||
class dumper_factory_base
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Notifier base.
|
||||
*/
|
||||
class notifier
|
||||
{
|
||||
public:
|
||||
virtual ~notifier() throw();
|
||||
virtual void dumpers_updated() throw() = 0;
|
||||
};
|
||||
/**
|
||||
* Detail flags.
|
||||
*/
|
||||
static unsigned target_type_mask;
|
||||
static unsigned target_type_file;
|
||||
static unsigned target_type_prefix;
|
||||
static unsigned target_type_special;
|
||||
static const unsigned target_type_mask;
|
||||
static const unsigned target_type_file;
|
||||
static const unsigned target_type_prefix;
|
||||
static const unsigned target_type_special;
|
||||
/**
|
||||
* Register a dumper.
|
||||
*
|
||||
* Parameter id: The ID of dumper.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
adv_dumper(const std::string& id) throw(std::bad_alloc);
|
||||
dumper_factory_base(const std::string& id) throw(std::bad_alloc);
|
||||
/**
|
||||
* Unregister a dumper.
|
||||
*/
|
||||
~adv_dumper();
|
||||
~dumper_factory_base();
|
||||
/**
|
||||
* Get ID of dumper.
|
||||
*
|
||||
|
@ -40,7 +58,7 @@ public:
|
|||
* Returns: The set.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
static std::set<adv_dumper*> get_dumper_set() throw(std::bad_alloc);
|
||||
static std::set<dumper_factory_base*> get_dumper_set() throw(std::bad_alloc);
|
||||
/**
|
||||
* List all valid submodes.
|
||||
*
|
||||
|
@ -77,30 +95,193 @@ public:
|
|||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
virtual std::string modename(const std::string& mode) throw(std::bad_alloc) = 0;
|
||||
/**
|
||||
* Is this dumper busy dumping?
|
||||
*
|
||||
* Return: True if busy, false if not.
|
||||
*/
|
||||
virtual bool busy() = 0;
|
||||
/**
|
||||
* Start dump.
|
||||
*
|
||||
* parameter mode: The mode to dump using.
|
||||
* parameter targetname: The target filename or prefix.
|
||||
* returns: The dumper object.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
* Throws std::runtime_error: Can't start dump.
|
||||
*/
|
||||
virtual void start(const std::string& mode, const std::string& targetname) throw(std::bad_alloc,
|
||||
std::runtime_error) = 0;
|
||||
virtual dumper_base* start(master_dumper& _mdumper, const std::string& mode, const std::string& targetname)
|
||||
throw(std::bad_alloc, std::runtime_error) = 0;
|
||||
/**
|
||||
* End current dump.
|
||||
* Is hidden?
|
||||
*/
|
||||
virtual void end() throw() = 0;
|
||||
virtual bool hidden() const { return false; }
|
||||
/**
|
||||
* Add dumper update notifier object.
|
||||
*/
|
||||
static void add_notifier(notifier& n);
|
||||
/**
|
||||
* Remove dumper update notifier object.
|
||||
*/
|
||||
static void drop_notifier(notifier& n);
|
||||
/**
|
||||
* Notify ctor finished.
|
||||
*/
|
||||
void ctor_notify();
|
||||
/**
|
||||
* Notify dumper change.
|
||||
*/
|
||||
static void run_notify();
|
||||
private:
|
||||
std::string d_id;
|
||||
};
|
||||
|
||||
class master_dumper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Information about run.
|
||||
*/
|
||||
struct gameinfo
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct game info.
|
||||
*/
|
||||
gameinfo() throw(std::bad_alloc);
|
||||
/**
|
||||
* Game name.
|
||||
*/
|
||||
std::string gamename;
|
||||
/**
|
||||
* Run length in seconds.
|
||||
*/
|
||||
double length;
|
||||
/**
|
||||
* Rerecord count (base 10 ASCII)
|
||||
*/
|
||||
std::string rerecords;
|
||||
/**
|
||||
* Authors. The first components are real names, the second components are nicknames. Either (but not both) may be
|
||||
* blank.
|
||||
*/
|
||||
std::vector<std::pair<std::string, std::string>> authors;
|
||||
/**
|
||||
* Format human-redable representation of the length.
|
||||
*
|
||||
* Parameter digits: Number of sub-second digits to use.
|
||||
* Returns: The time formated.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
std::string get_readable_time(unsigned digits) const throw(std::bad_alloc);
|
||||
/**
|
||||
* Get number of authors.
|
||||
*
|
||||
* Returns: Number of authors.
|
||||
*/
|
||||
size_t get_author_count() const throw();
|
||||
/**
|
||||
* Get short name of author (nickname if present, otherwise full name).
|
||||
*
|
||||
* Parameter idx: Index of author (0-based).
|
||||
* Returns: The short name.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
std::string get_author_short(size_t idx) const throw(std::bad_alloc);
|
||||
/**
|
||||
* Get long name of author (full name and nickname if present).
|
||||
*
|
||||
* Parameter idx: Index of author (0-based).
|
||||
* Returns: The long name.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
std::string get_author_long(size_t idx) const throw(std::bad_alloc);
|
||||
/**
|
||||
* Get rerecord count as a number. If rerecord count is too high, returns the maximum representatible count.
|
||||
*
|
||||
* Returns: The rerecord count.
|
||||
*/
|
||||
uint64_t get_rerecords() const throw();
|
||||
};
|
||||
/**
|
||||
* Notifier.
|
||||
*/
|
||||
class notifier
|
||||
{
|
||||
public:
|
||||
virtual ~notifier() throw();
|
||||
virtual void dump_status_change() = 0;
|
||||
};
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
master_dumper(lua_state& _lua2);
|
||||
/**
|
||||
* Get instance for specified dumper.
|
||||
*/
|
||||
dumper_base* get_instance(dumper_factory_base* dumper) throw();
|
||||
/**
|
||||
* Is dumper busy in this instance?
|
||||
*/
|
||||
bool busy(dumper_factory_base* dumper) throw()
|
||||
{
|
||||
return get_instance(dumper) != NULL;
|
||||
}
|
||||
/**
|
||||
* Call start on dumper.
|
||||
*/
|
||||
dumper_base* start(dumper_factory_base& factory, const std::string& mode, const std::string& targetname)
|
||||
throw(std::bad_alloc, std::runtime_error);
|
||||
/**
|
||||
* Add dumper update notifier object.
|
||||
*/
|
||||
void add_notifier(notifier& n);
|
||||
/**
|
||||
* Remove dumper update notifier object.
|
||||
*/
|
||||
void drop_notifier(notifier& n);
|
||||
/**
|
||||
* Add dumper update notifier object.
|
||||
*/
|
||||
void add_dumper(dumper_base& n);
|
||||
/**
|
||||
* Remove dumper update notifier object.
|
||||
*/
|
||||
void drop_dumper(dumper_base& n);
|
||||
/**
|
||||
* Get number of active dumpers.
|
||||
*/
|
||||
unsigned get_dumper_count() throw();
|
||||
/**
|
||||
* Call all notifiers (on_frame).
|
||||
*/
|
||||
void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d);
|
||||
/**
|
||||
* Call all notifiers (on_sample).
|
||||
*/
|
||||
void on_sample(short l, short r);
|
||||
/**
|
||||
* Call all notifiers (on_rate_change)
|
||||
*
|
||||
* Also changes builtin rate variables.
|
||||
*/
|
||||
void on_rate_change(uint32_t n, uint32_t d);
|
||||
/**
|
||||
* Call all notifiers (on_gameinfo_change)
|
||||
*
|
||||
* Also changes builtin gameinfo structure.
|
||||
*/
|
||||
void on_gameinfo_change(const gameinfo& gi);
|
||||
/**
|
||||
* Get current sound rate in effect.
|
||||
*/
|
||||
std::pair<uint32_t, uint32_t> get_rate();
|
||||
/**
|
||||
* Get current gameinfo in effect.
|
||||
*/
|
||||
const gameinfo& get_gameinfo();
|
||||
/**
|
||||
* End all dumps.
|
||||
*/
|
||||
void end_dumps();
|
||||
/**
|
||||
* Set output stream.
|
||||
*/
|
||||
void set_output(std::ostream* _output);
|
||||
/**
|
||||
* Render Lua HUD on video.
|
||||
*
|
||||
|
@ -108,17 +289,91 @@ private:
|
|||
* Parameter source: The source screen to read.
|
||||
* Parameter hscl: The horizontal scale factor.
|
||||
* Parameter vscl: The vertical scale factor.
|
||||
* Parameter roffset: Red offset.
|
||||
* Parameter goffset: Green offset.
|
||||
* Parameter boffset: Blue offset.
|
||||
* Parameter lgap: Left gap.
|
||||
* Parameter tgap: Top gap.
|
||||
* Parameter rgap: Right gap
|
||||
* Parameter bgap: Bottom gap.
|
||||
* Parameter fn: Function to call between running lua hooks and actually rendering.
|
||||
* Returns: True if frame should be dumped, false if not.
|
||||
*/
|
||||
template<bool X> void render_video_hud(struct framebuffer<X>& target, struct framebuffer_raw& source, uint32_t hscl,
|
||||
uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap,
|
||||
uint32_t rgap, uint32_t bgap, void(*fn)());
|
||||
template<bool X> bool render_video_hud(struct framebuffer::fb<X>& target, struct framebuffer::raw& source,
|
||||
uint32_t hscl, uint32_t vscl, uint32_t lgap, uint32_t tgap, uint32_t rgap, uint32_t bgap,
|
||||
std::function<void()> fn);
|
||||
/**
|
||||
* Calculate number of sound samples to drop due to dropped frame.
|
||||
*/
|
||||
uint64_t killed_audio_length(uint32_t fps_n, uint32_t fps_d, double& fraction);
|
||||
private:
|
||||
void statuschange();
|
||||
friend class dumper_base;
|
||||
std::map<dumper_factory_base*, dumper_base*> dumpers;
|
||||
std::set<notifier*> notifications;
|
||||
std::set<dumper_base*> sdumpers;
|
||||
uint32_t current_rate_n;
|
||||
uint32_t current_rate_d;
|
||||
gameinfo current_gi;
|
||||
std::ostream* output;
|
||||
threads::rlock lock;
|
||||
lua_state& lua2;
|
||||
};
|
||||
|
||||
class dumper_base
|
||||
{
|
||||
public:
|
||||
dumper_base();
|
||||
dumper_base(master_dumper& _mdumper, dumper_factory_base& _fbase);
|
||||
virtual ~dumper_base() throw();
|
||||
/**
|
||||
* New frame available.
|
||||
*/
|
||||
virtual void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) = 0;
|
||||
/**
|
||||
* New sample available.
|
||||
*/
|
||||
virtual void on_sample(short l, short r) = 0;
|
||||
/**
|
||||
* Sample rate is changing.
|
||||
*/
|
||||
virtual void on_rate_change(uint32_t n, uint32_t d) = 0;
|
||||
/**
|
||||
* Gameinfo is changing.
|
||||
*/
|
||||
virtual void on_gameinfo_change(const master_dumper::gameinfo& gi) = 0;
|
||||
/**
|
||||
* Dump is being forcibly ended.
|
||||
*/
|
||||
virtual void on_end() = 0;
|
||||
/**
|
||||
* Render Lua HUD on video. samples_killed is incremented if needed.
|
||||
*
|
||||
* Parameter target: The target screen to render on.
|
||||
* Parameter source: The source screen to read.
|
||||
* Parameter fps_n: Fps numerator.
|
||||
* Parameter fps_d: Fps denominator.
|
||||
* Parameter hscl: The horizontal scale factor.
|
||||
* Parameter vscl: The vertical scale factor.
|
||||
* Parameter lgap: Left gap.
|
||||
* Parameter tgap: Top gap.
|
||||
* Parameter rgap: Right gap
|
||||
* Parameter bgap: Bottom gap.
|
||||
* Parameter fn: Function to call between running lua hooks and actually rendering.
|
||||
* Returns: True if frame should be dumped, false if not.
|
||||
*/
|
||||
template<bool X> bool render_video_hud(struct framebuffer::fb<X>& target, struct framebuffer::raw& source,
|
||||
uint32_t fps_n, uint32_t fps_d, uint32_t hscl, uint32_t vscl, uint32_t lgap, uint32_t tgap,
|
||||
uint32_t rgap, uint32_t bgap, std::function<void()> fn)
|
||||
{
|
||||
bool r = mdumper->render_video_hud(target, source, hscl, vscl, lgap, tgap, rgap, bgap, fn);
|
||||
if(!r)
|
||||
samples_killed += mdumper->killed_audio_length(fps_n, fps_d, akillfrac);
|
||||
return r;
|
||||
}
|
||||
private:
|
||||
friend class master_dumper;
|
||||
uint64_t samples_killed;
|
||||
master_dumper* mdumper;
|
||||
dumper_factory_base* fbase;
|
||||
double akillfrac;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
109
include/core/audioapi-driver.hpp
Normal file
109
include/core/audioapi-driver.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
#ifndef _audioapi_driver__hpp__included__
|
||||
#define _audioapi_driver__hpp__included__
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class audioapi_instance;
|
||||
|
||||
//All the following need to be implemented by the sound driver itself
|
||||
struct _audioapi_driver
|
||||
{
|
||||
//These correspond to various audioapi_driver_* functions.
|
||||
void (*init)() throw();
|
||||
void (*quit)() throw();
|
||||
void (*enable)(bool enable);
|
||||
bool (*initialized)();
|
||||
void (*set_device)(const std::string& pdev, const std::string& rdev);
|
||||
std::string (*get_device)(bool rec);
|
||||
std::map<std::string, std::string> (*get_devices)(bool rec);
|
||||
const char* (*name)();
|
||||
};
|
||||
|
||||
struct audioapi_driver
|
||||
{
|
||||
audioapi_driver(struct _audioapi_driver driver);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the driver.
|
||||
*/
|
||||
void audioapi_driver_init() throw();
|
||||
|
||||
/**
|
||||
* Deinitialize the driver.
|
||||
*/
|
||||
void audioapi_driver_quit() throw();
|
||||
|
||||
/**
|
||||
* Enable or disable sound.
|
||||
*
|
||||
* parameter enable: Enable sounds if true, otherwise disable sounds.
|
||||
*/
|
||||
void audioapi_driver_enable(bool enable) throw();
|
||||
|
||||
/**
|
||||
* Has the sound system been successfully initialized?
|
||||
*
|
||||
* Returns: True if sound system has successfully initialized, false otherwise.
|
||||
*/
|
||||
bool audioapi_driver_initialized();
|
||||
|
||||
/**
|
||||
* Set sound device (playback).
|
||||
*
|
||||
* - If new sound device is invalid, the sound device is not changed.
|
||||
*
|
||||
* Parameter pdev: The new sound device (playback).
|
||||
* Parameter rdev: The new sound device (recording)
|
||||
*/
|
||||
void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev) throw(std::bad_alloc,
|
||||
std::runtime_error);
|
||||
|
||||
/**
|
||||
* Get current sound device (playback).
|
||||
*
|
||||
* Returns: The current sound device.
|
||||
*/
|
||||
std::string audioapi_driver_get_device(bool rec) throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* Get available sound devices (playback).
|
||||
*
|
||||
* Returns: The map of devices. Keyed by name of the device, values are human-readable names for devices.
|
||||
*/
|
||||
std::map<std::string, std::string> audioapi_driver_get_devices(bool rec) throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* Identification for sound plugin.
|
||||
*/
|
||||
const char* audioapi_driver_name() throw();
|
||||
|
||||
/**
|
||||
* Add an instance to be mixed.
|
||||
*/
|
||||
void audioapi_connect_instance(audioapi_instance& instance);
|
||||
|
||||
/**
|
||||
* Remove an instance from being mixed.
|
||||
*/
|
||||
void audioapi_disconnect_instance(audioapi_instance& instance);
|
||||
|
||||
/**
|
||||
* Send a rate change.
|
||||
*/
|
||||
void audioapi_send_rate_change(unsigned rrate, unsigned prate);
|
||||
|
||||
/**
|
||||
* Broadcast voice input to all instances.
|
||||
*/
|
||||
void audioapi_put_voice(float* samples, size_t count);
|
||||
|
||||
/**
|
||||
* Get mixed music + voice out from all instances.
|
||||
*/
|
||||
void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
|
||||
|
||||
#endif
|
|
@ -1,56 +1,93 @@
|
|||
#ifndef _audioapi__hpp__included__
|
||||
#define _audioapi__hpp__included__
|
||||
|
||||
#include "library/threads.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
class audioapi_instance
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Audio API music buffer.
|
||||
*/
|
||||
struct audioapi_buffer
|
||||
{
|
||||
struct buffer
|
||||
{
|
||||
/**
|
||||
* The samples.
|
||||
*
|
||||
* Note: May be NULL if no samples are available..
|
||||
*/
|
||||
int16_t* samples;
|
||||
int16_t* samples;
|
||||
/**
|
||||
* Playback pointer in samples structure.
|
||||
*/
|
||||
size_t pointer;
|
||||
size_t pointer;
|
||||
/**
|
||||
* Total number of samples in this buffer.
|
||||
*/
|
||||
size_t total;
|
||||
size_t total;
|
||||
/**
|
||||
* True if buffer is stereo, false if mono.
|
||||
*/
|
||||
bool stereo;
|
||||
bool stereo;
|
||||
/**
|
||||
* The rate in samples per second the buffer is supposed to be played at.
|
||||
*/
|
||||
double rate;
|
||||
};
|
||||
|
||||
//Resampler.
|
||||
class audioapi_resampler
|
||||
{
|
||||
public:
|
||||
audioapi_resampler();
|
||||
//After call, either insize or outsize is zero.
|
||||
void resample(float*& in, size_t& insize, float*& out, size_t& outsize, double ratio, bool stereo);
|
||||
private:
|
||||
double position;
|
||||
double vAl, vBl, vCl, vDl, vAr, vBr, vCr, vDr;
|
||||
};
|
||||
double rate;
|
||||
};
|
||||
|
||||
/**
|
||||
* Audio API VU calculator.
|
||||
*/
|
||||
struct vumeter
|
||||
{
|
||||
/**
|
||||
* Initialize.
|
||||
*/
|
||||
vumeter();
|
||||
/**
|
||||
* Submit samples.
|
||||
*
|
||||
* Parameter samples: The samples to submit. If NULL, reads all samples as 0.
|
||||
* Parameter count: Number of samples.
|
||||
* Parameter stereo: If true, read only every other sample (but still read count samples).
|
||||
* Parameter rate: Sound sampling rate.
|
||||
* Parameter scale: Value to scale the samples by.
|
||||
*/
|
||||
void operator()(float* samples, size_t count, bool stereo, double rate, double scale);
|
||||
/**
|
||||
* Get VU value in dB.
|
||||
*/
|
||||
operator float() const throw() { return vu; }
|
||||
private:
|
||||
double accumulator;
|
||||
size_t samples;
|
||||
float vu;
|
||||
void update_vu();
|
||||
};
|
||||
//Resampler.
|
||||
class resampler
|
||||
{
|
||||
public:
|
||||
resampler();
|
||||
//After call, either insize or outsize is zero.
|
||||
void resample(float*& in, size_t& insize, float*& out, size_t& outsize, double ratio, bool stereo);
|
||||
private:
|
||||
double position;
|
||||
double vAl, vBl, vCl, vDl, vAr, vBr, vCr, vDr;
|
||||
};
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
audioapi_instance();
|
||||
~audioapi_instance();
|
||||
//The following are intended to be used by the emulator core.
|
||||
|
||||
/**
|
||||
/**
|
||||
* Submit a buffer for playback on music channel.
|
||||
*
|
||||
* Parameter samples: The samples in the buffer. If stereo is true, each sample takes two elements (L, R).
|
||||
|
@ -58,118 +95,97 @@ private:
|
|||
* Parameter stereo: If true, the signal is stereo. If false, mono.
|
||||
* Parameter rate: Rate of buffer in samples per second.
|
||||
*/
|
||||
void audioapi_submit_buffer(int16_t* samples, size_t count, bool stereo, double rate);
|
||||
|
||||
void submit_buffer(int16_t* samples, size_t count, bool stereo, double rate);
|
||||
/**
|
||||
* Get the voice channel playback/record rate.
|
||||
*
|
||||
* Returns: The rate in samples per second (first for recording, then for playback).
|
||||
*/
|
||||
std::pair<unsigned,unsigned> voice_rate();
|
||||
/**
|
||||
* Get the voice channel nominal playback/record rate.
|
||||
*
|
||||
* Returns: The rate in samples per second.
|
||||
*/
|
||||
unsigned audioapi_voice_rate();
|
||||
|
||||
unsigned orig_voice_rate();
|
||||
/**
|
||||
* Get the voice channel playback status register.
|
||||
*
|
||||
* Returns: The number of samples free for playback.
|
||||
*/
|
||||
unsigned audioapi_voice_p_status();
|
||||
|
||||
unsigned voice_p_status();
|
||||
/**
|
||||
* Get the voice channel playback status register2.
|
||||
*
|
||||
* Returns: The number of samples in playback buffer.
|
||||
*/
|
||||
unsigned audioapi_voice_p_status2();
|
||||
|
||||
unsigned voice_p_status2();
|
||||
/**
|
||||
* Get the voice channel record status register.
|
||||
*
|
||||
* Returns: The number of samples in capture buffer.
|
||||
*/
|
||||
unsigned audioapi_voice_r_status();
|
||||
|
||||
unsigned voice_r_status();
|
||||
/**
|
||||
* Play sound on voice channel.
|
||||
*
|
||||
* Parameter samples: The samples to play.
|
||||
* Parameter count: Number of samples to play. Must be less than number of samples free for playback.
|
||||
*/
|
||||
void audioapi_play_voice(float* samples, size_t count);
|
||||
|
||||
void play_voice(float* samples, size_t count);
|
||||
/**
|
||||
* Capture sound on voice channel.
|
||||
*
|
||||
* Parameter samples: The buffer to store captured samples to.
|
||||
* Parameter count: Number of samples to capture. Must be less than number of samples used for capture.
|
||||
*/
|
||||
void audioapi_record_voice(float* samples, size_t count);
|
||||
|
||||
void record_voice(float* samples, size_t count);
|
||||
/**
|
||||
* Init the audio. Call on emulator startup.
|
||||
*/
|
||||
void audioapi_init();
|
||||
|
||||
void init();
|
||||
/**
|
||||
* Quit the audio. Call on emulator shutdown.
|
||||
*/
|
||||
void audioapi_quit();
|
||||
|
||||
void quit();
|
||||
/**
|
||||
* Set music volume.
|
||||
*
|
||||
* Parameter volume: The volume (0-1).
|
||||
*/
|
||||
void audioapi_music_volume(float volume);
|
||||
|
||||
void music_volume(float volume);
|
||||
/**
|
||||
* Get music volume.
|
||||
*
|
||||
* Returns: The music volume.
|
||||
*/
|
||||
float audioapi_music_volume();
|
||||
|
||||
float music_volume();
|
||||
/**
|
||||
* Set voice playback volume.
|
||||
*
|
||||
* Parameter volume: The volume (0-1).
|
||||
*/
|
||||
void audioapi_voicep_volume(float volume);
|
||||
|
||||
void voicep_volume(float volume);
|
||||
/**
|
||||
* Get voice playback volume.
|
||||
*
|
||||
* Returns: The voice playback volume.
|
||||
*/
|
||||
float audioapi_voicep_volume();
|
||||
|
||||
float voicep_volume();
|
||||
/**
|
||||
* Set voice capture volume.
|
||||
*
|
||||
* Parameter volume: The volume (0-1).
|
||||
*/
|
||||
void audioapi_voicer_volume(float volume);
|
||||
|
||||
void voicer_volume(float volume);
|
||||
/**
|
||||
* Get voice capture volume.
|
||||
*
|
||||
* Returns: The voice capture volume.
|
||||
*/
|
||||
float audioapi_voicer_volume();
|
||||
|
||||
//The following are intender to be used by the driver.
|
||||
|
||||
/**
|
||||
* Set dummy CB enable flag.
|
||||
*
|
||||
* Parameter enable: The new state for enable flag.
|
||||
*
|
||||
* Note: Dummy CB enable should be set when the audio driver itself does not have active CB running.
|
||||
* Note: After negative edge, reprogram voice rate.
|
||||
*/
|
||||
void audioapi_set_dummy_cb(bool enable);
|
||||
float voicer_volume();
|
||||
|
||||
//The following are intended to be used by the driver from the callback
|
||||
|
||||
/**
|
||||
* Get mixed music + voice buffer to play (at voice rate).
|
||||
*
|
||||
|
@ -177,8 +193,7 @@ void audioapi_set_dummy_cb(bool enable);
|
|||
* Parameter count: Number of samples to generate.
|
||||
* Parameter stereo: If true, return stereo buffer, else mono.
|
||||
*/
|
||||
void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
|
||||
|
||||
void get_mixed(int16_t* samples, size_t count, bool stereo);
|
||||
/**
|
||||
* Get music channel buffer to play.
|
||||
*
|
||||
|
@ -187,8 +202,7 @@ void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
|
|||
*
|
||||
* Note: This should only be called from the sound driver.
|
||||
*/
|
||||
struct audioapi_buffer audioapi_get_music(size_t played);
|
||||
|
||||
struct buffer get_music(size_t played);
|
||||
/**
|
||||
* Get voice channel buffer to play.
|
||||
*
|
||||
|
@ -197,8 +211,7 @@ struct audioapi_buffer audioapi_get_music(size_t played);
|
|||
*
|
||||
* Note: This should only be called from the sound driver.
|
||||
*/
|
||||
void audioapi_get_voice(float* samples, size_t count);
|
||||
|
||||
void get_voice(float* samples, size_t count);
|
||||
/**
|
||||
* Put recorded voice channel buffer.
|
||||
*
|
||||
|
@ -208,69 +221,66 @@ void audioapi_get_voice(float* samples, size_t count);
|
|||
* Note: Even if audio driver does not support capture, one should send in silence.
|
||||
* Note: This should only be called from the sound driver.
|
||||
*/
|
||||
void audioapi_put_voice(float* samples, size_t count);
|
||||
|
||||
void put_voice(float* samples, size_t count);
|
||||
/**
|
||||
* Set the voice channel playback/record rate.
|
||||
*
|
||||
* Parameter rate: The rate in samples per second.
|
||||
* Parameter rate_r: The recording rate in samples per second.
|
||||
* Parameter rate_p: The playback rate in samples per second.
|
||||
*
|
||||
* Note: This should only be called from the sound driver.
|
||||
* Note: Setting rate to 0 enables dummy callbacks.
|
||||
*/
|
||||
void audioapi_voice_rate(unsigned rate);
|
||||
|
||||
//All the following need to be implemented by the sound driver itself
|
||||
|
||||
void voice_rate(unsigned rate_r, unsigned rate_p);
|
||||
/**
|
||||
* Initialize the driver.
|
||||
* Suppress all future VU updates.
|
||||
*/
|
||||
void audioapi_driver_init() throw();
|
||||
static void disable_vu_updates();
|
||||
//Vu values.
|
||||
vumeter vu_mleft;
|
||||
vumeter vu_mright;
|
||||
vumeter vu_vout;
|
||||
vumeter vu_vin;
|
||||
private:
|
||||
struct dummy_cb_proc
|
||||
{
|
||||
dummy_cb_proc(audioapi_instance& _parent);
|
||||
int operator()();
|
||||
audioapi_instance& parent;
|
||||
};
|
||||
dummy_cb_proc dummyproc;
|
||||
threads::thread* dummythread;
|
||||
//3 music buffers is not enough due to huge blocksizes used by SDL.
|
||||
const static unsigned MUSIC_BUFFERS = 8;
|
||||
const static unsigned voicep_bufsize = 65536;
|
||||
const static unsigned voicer_bufsize = 65536;
|
||||
const static unsigned music_bufsize = 8192;
|
||||
float voicep_buffer[voicep_bufsize];
|
||||
float voicer_buffer[voicer_bufsize];
|
||||
int16_t music_buffer[MUSIC_BUFFERS * music_bufsize];
|
||||
volatile bool music_stereo[MUSIC_BUFFERS];
|
||||
volatile double music_rate[MUSIC_BUFFERS];
|
||||
volatile size_t music_size[MUSIC_BUFFERS];
|
||||
unsigned music_ptr;
|
||||
unsigned last_complete_music_seen;
|
||||
volatile unsigned last_complete_music;
|
||||
volatile unsigned voicep_get;
|
||||
volatile unsigned voicep_put;
|
||||
volatile unsigned voicer_get;
|
||||
volatile unsigned voicer_put;
|
||||
volatile unsigned voice_rate_play;
|
||||
volatile unsigned orig_voice_rate_play;
|
||||
volatile unsigned voice_rate_rec;
|
||||
volatile bool dummy_cb_active_record;
|
||||
volatile bool dummy_cb_active_play;
|
||||
volatile bool dummy_cb_quit;
|
||||
volatile float _music_volume;
|
||||
volatile float _voicep_volume;
|
||||
volatile float _voicer_volume;
|
||||
resampler music_resampler;
|
||||
bool last_adjust; //Adjusting consequtively is too hard.
|
||||
static bool vu_disabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* Deinitialize the driver.
|
||||
*/
|
||||
void audioapi_driver_quit() throw();
|
||||
|
||||
/**
|
||||
* Enable or disable sound.
|
||||
*
|
||||
* parameter enable: Enable sounds if true, otherwise disable sounds.
|
||||
*/
|
||||
void audioapi_driver_enable(bool enable) throw();
|
||||
|
||||
/**
|
||||
* Has the sound system been successfully initialized?
|
||||
*
|
||||
* Returns: True if sound system has successfully initialized, false otherwise.
|
||||
*/
|
||||
bool audioapi_driver_initialized();
|
||||
|
||||
/**
|
||||
* Set sound device.
|
||||
*
|
||||
* - If new sound device is invalid, the sound device is not changed.
|
||||
*
|
||||
* Parameter dev: The new sound device.
|
||||
*/
|
||||
void audioapi_driver_set_device(const std::string& dev) throw(std::bad_alloc, std::runtime_error);
|
||||
|
||||
/**
|
||||
* Get current sound device.
|
||||
*
|
||||
* Returns: The current sound device.
|
||||
*/
|
||||
std::string audioapi_driver_get_device() throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* Get available sound devices.
|
||||
*
|
||||
* Returns: The map of devices. Keyed by name of the device, values are human-readable names for devices.
|
||||
*/
|
||||
std::map<std::string, std::string> audioapi_driver_get_devices() throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* Identification for sound plugin.
|
||||
*/
|
||||
extern const char* audioapi_driver_name;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,31 @@
|
|||
#ifndef _command__hpp__included__
|
||||
#define _command__hpp__included__
|
||||
|
||||
#include "library/command.hpp"
|
||||
#include "library/threads.hpp"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include "library/commands.hpp"
|
||||
|
||||
extern command_group lsnes_cmd;
|
||||
extern command::set lsnes_cmds;
|
||||
|
||||
namespace keyboard
|
||||
{
|
||||
class mapper;
|
||||
class invbind;
|
||||
}
|
||||
|
||||
class alias_binds_manager
|
||||
{
|
||||
public:
|
||||
alias_binds_manager(keyboard::mapper& _mapper, command::group& _command);
|
||||
~alias_binds_manager();
|
||||
void operator()();
|
||||
private:
|
||||
keyboard::mapper& mapper;
|
||||
command::group& command;
|
||||
threads::lock mut;
|
||||
std::map<std::string, keyboard::invbind*> alias_binds;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,154 @@
|
|||
#ifndef _controller__hpp__included__
|
||||
#define _controller__hpp__included__
|
||||
|
||||
#include "controllerframe.hpp"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "library/dispatch.hpp"
|
||||
#include "library/command.hpp"
|
||||
|
||||
struct project_info;
|
||||
struct controller_state;
|
||||
struct emu_framebuffer;
|
||||
struct emulator_dispatch;
|
||||
struct lua_state;
|
||||
struct core_core;
|
||||
namespace keyboard { class invbind; }
|
||||
namespace keyboard { class ctrlrkey; }
|
||||
namespace keyboard { class mapper; }
|
||||
namespace keyboard { class keyboard; }
|
||||
namespace portctrl { struct type; }
|
||||
namespace portctrl { struct controller; }
|
||||
|
||||
class button_mapping
|
||||
{
|
||||
public:
|
||||
struct controller_bind
|
||||
{
|
||||
std::string cclass;
|
||||
unsigned number;
|
||||
std::string name;
|
||||
int mode; //0 => Button, 1 => Axis pair, 2 => Single axis.
|
||||
bool xrel;
|
||||
bool yrel;
|
||||
unsigned control1;
|
||||
unsigned control2; //Axis only, UINT_MAX if not valid.
|
||||
int16_t rmin;
|
||||
int16_t rmax;
|
||||
bool centered;
|
||||
};
|
||||
struct active_bind
|
||||
{
|
||||
unsigned port;
|
||||
unsigned controller;
|
||||
struct controller_bind bind;
|
||||
};
|
||||
struct controller_triple
|
||||
{
|
||||
std::string cclass;
|
||||
unsigned port;
|
||||
unsigned controller;
|
||||
bool operator<(const struct controller_triple& t) const throw()
|
||||
{
|
||||
if(cclass < t.cclass) return true;
|
||||
if(cclass > t.cclass) return false;
|
||||
if(port < t.port) return true;
|
||||
if(port > t.port) return false;
|
||||
if(controller < t.controller) return true;
|
||||
if(controller > t.controller) return false;
|
||||
return false;
|
||||
}
|
||||
bool operator==(const struct controller_triple& t) const throw()
|
||||
{
|
||||
return (cclass == t.cclass && port == t.port && controller == t.controller);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
button_mapping(controller_state& _controls, keyboard::mapper& mapper, keyboard::keyboard& keyboard,
|
||||
emu_framebuffer& fbuf, emulator_dispatch& _dispatch, lua_state& _lua2, command::group& _cmd);
|
||||
/**
|
||||
* Dtor.
|
||||
*/
|
||||
~button_mapping();
|
||||
/**
|
||||
* Reread active buttons.
|
||||
*/
|
||||
void reread();
|
||||
/**
|
||||
* Reinitialize buttons.
|
||||
*/
|
||||
void reinit();
|
||||
/**
|
||||
* Load macros.
|
||||
*/
|
||||
void load(controller_state& ctrlstate);
|
||||
/**
|
||||
* Load macros (from project).
|
||||
*/
|
||||
void load(controller_state& ctrlstate, project_info& pinfo);
|
||||
/**
|
||||
* Cleanup memory used.
|
||||
*/
|
||||
void cleanup();
|
||||
/**
|
||||
* Lookup button by name.
|
||||
*/
|
||||
std::pair<int, int> byname(const std::string& name);
|
||||
/**
|
||||
* Map of button keys.
|
||||
*/
|
||||
std::map<std::string, std::string> button_keys;
|
||||
private:
|
||||
void do_analog_action(const std::string& a);
|
||||
void do_autofire_action(const std::string& a, int mode);
|
||||
void do_action(const std::string& name, short state, int mode);
|
||||
void promote_key(keyboard::ctrlrkey& k);
|
||||
void add_button(const std::string& name, const controller_bind& binding);
|
||||
void process_controller(portctrl::controller& controller, unsigned number);
|
||||
void process_controller(std::map<std::string, unsigned>& allocated,
|
||||
std::map<controller_triple, unsigned>& assigned, portctrl::controller& controller, unsigned port,
|
||||
unsigned number_in_port);
|
||||
void process_port(std::map<std::string, unsigned>& allocated,
|
||||
std::map<controller_triple, unsigned>& assigned, unsigned port, portctrl::type& ptype);
|
||||
void init();
|
||||
bool check_button_active(const std::string& name);
|
||||
void do_button_action(const std::string& name, short newstate, int mode);
|
||||
void send_analog(const std::string& name, int32_t x, int32_t y);
|
||||
std::map<std::string, keyboard::invbind*> macro_binds;
|
||||
std::map<std::string, keyboard::invbind*> macro_binds2;
|
||||
std::map<std::string, controller_bind> all_buttons;
|
||||
std::map<std::string, active_bind> active_buttons;
|
||||
std::map<std::string, keyboard::ctrlrkey*> added_keys;
|
||||
std::set<core_core*> cores_done;
|
||||
bool promote_autohold;
|
||||
bool promote_autofire;
|
||||
bool promote_typed;
|
||||
controller_state& controls;
|
||||
keyboard::mapper& mapper;
|
||||
keyboard::keyboard& keyboard;
|
||||
emu_framebuffer& fbuf;
|
||||
emulator_dispatch& edispatch;
|
||||
lua_state& lua2;
|
||||
command::group& cmd;
|
||||
struct dispatch::target<> ncore;
|
||||
command::_fnptr<const std::string&> button_p;
|
||||
command::_fnptr<const std::string&> button_r;
|
||||
command::_fnptr<const std::string&> button_h;
|
||||
command::_fnptr<const std::string&> button_t;
|
||||
command::_fnptr<const std::string&> button_d;
|
||||
command::_fnptr<const std::string&> button_ap;
|
||||
command::_fnptr<const std::string&> button_ar;
|
||||
command::_fnptr<const std::string&> button_at;
|
||||
command::_fnptr<const std::string&> button_a;
|
||||
command::_fnptr<> afire_p;
|
||||
command::_fnptr<> afire_n;
|
||||
command::_fnptr<> ahold_p;
|
||||
command::_fnptr<> ahold_n;
|
||||
command::_fnptr<> typed_p;
|
||||
command::_fnptr<> typed_n;
|
||||
};
|
||||
|
||||
|
||||
void reread_active_buttons();
|
||||
void reinitialize_buttonmap();
|
||||
extern controller_state controls;
|
||||
extern std::map<std::string, std::string> button_keys;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,13 +15,15 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include "library/controller-data.hpp"
|
||||
|
||||
/**
|
||||
* Analog indices.
|
||||
*/
|
||||
#define MAX_ANALOG 3
|
||||
#include "library/portctrl-data.hpp"
|
||||
#include "library/command.hpp"
|
||||
#include "library/threads.hpp"
|
||||
|
||||
class project_state;
|
||||
class movie_logic;
|
||||
class button_mapping;
|
||||
class emulator_dispatch;
|
||||
class status_updater;
|
||||
|
||||
/**
|
||||
* Controllers state.
|
||||
|
@ -32,7 +34,8 @@ public:
|
|||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
controller_state() throw();
|
||||
controller_state(project_state& _project, movie_logic& _mlogic, button_mapping& _buttons,
|
||||
emulator_dispatch& _dispatch, status_updater& _supdater, command::group& _cmd) throw();
|
||||
/**
|
||||
* Convert lcid (Logical Controller ID) into pcid (Physical Controler ID).
|
||||
*
|
||||
|
@ -62,37 +65,29 @@ public:
|
|||
* Parameter ptype: The new types for ports.
|
||||
* Throws std::runtime_error: Illegal port type.
|
||||
*/
|
||||
void set_ports(const port_type_set& ptype) throw(std::runtime_error);
|
||||
void set_ports(const portctrl::type_set& ptype) throw(std::runtime_error);
|
||||
/**
|
||||
* Get status of current controls (with autohold/autofire factored in).
|
||||
*
|
||||
* Parameter framenum: Number of current frame (for evaluating autofire).
|
||||
* Returns: The current controls.
|
||||
*/
|
||||
controller_frame get(uint64_t framenum) throw();
|
||||
/**
|
||||
* Commit given controls (autohold/autofire is factored in).
|
||||
*
|
||||
* Parameter framenum: Number of current frame (for evaluating autofire).
|
||||
* Returns: The committed controls.
|
||||
*/
|
||||
controller_frame commit(uint64_t framenum) throw();
|
||||
portctrl::frame get(uint64_t framenum) throw();
|
||||
/**
|
||||
* Commit given controls (autohold/autofire is ignored).
|
||||
*
|
||||
* Parameter controls: The controls to commit
|
||||
* Returns: The committed controls.
|
||||
*/
|
||||
controller_frame commit(controller_frame controls) throw();
|
||||
void commit(portctrl::frame controls) throw();
|
||||
/**
|
||||
* Get status of committed controls.
|
||||
* Returns: The committed controls.
|
||||
*/
|
||||
controller_frame get_committed() throw();
|
||||
portctrl::frame get_committed() throw();
|
||||
/**
|
||||
* Get blank frame.
|
||||
*/
|
||||
controller_frame get_blank() throw();
|
||||
portctrl::frame get_blank() throw();
|
||||
/**
|
||||
* Send analog input to given controller.
|
||||
*
|
||||
|
@ -161,34 +156,95 @@ public:
|
|||
*/
|
||||
bool button2(unsigned port, unsigned controller, unsigned pbid) throw();
|
||||
/**
|
||||
* Set autofire pattern.
|
||||
* Manipulate autofire.
|
||||
*
|
||||
* Parameter pattern: The new pattern.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
* Parameter port: The port.
|
||||
* Parameter controller: The controller.
|
||||
* Parameter pbid: The physical button ID to manipulate.
|
||||
* Parameter duty: The new duty cycle for autofire.
|
||||
* Parameter cyclelen: The new cycle length.
|
||||
*/
|
||||
void autofire(std::vector<controller_frame> pattern) throw(std::bad_alloc);
|
||||
void autofire2(unsigned port, unsigned controller, unsigned pbid, unsigned duty, unsigned cyclelen) throw();
|
||||
/**
|
||||
* Query autofire.
|
||||
*
|
||||
* Parameter port: The port.
|
||||
* Parameter controller: The controller.
|
||||
* Parameter pbid: The physical button ID to query.
|
||||
* Returns: The state of autofire.
|
||||
*/
|
||||
std::pair<unsigned, unsigned> autofire2(unsigned port, unsigned controller, unsigned pbid) throw();
|
||||
/**
|
||||
* Manipulate TASinput.
|
||||
*
|
||||
* Parameter port: The port.
|
||||
* Parameter controller: The controller.
|
||||
* Parameter pbid: The physical button ID to manipulate.
|
||||
* Parameter state: The new state.
|
||||
*/
|
||||
void tasinput(unsigned port, unsigned controller, unsigned pbid, int16_t state) throw();
|
||||
/**
|
||||
* Query tasinput.
|
||||
*
|
||||
* Parameter port: The port.
|
||||
* Parameter controller: The controller.
|
||||
* Parameter pbid: The physical button ID to query.
|
||||
* Returns: The state of tasinput.
|
||||
*/
|
||||
int16_t tasinput(unsigned port, unsigned controller, unsigned pbid) throw();
|
||||
/**
|
||||
* Enage/Disenage tasinput.
|
||||
*/
|
||||
void tasinput_enable(bool enabled);
|
||||
/**
|
||||
* TODO: Document.
|
||||
*/
|
||||
bool is_present(unsigned port, unsigned controller) throw();
|
||||
void erase_macro(const std::string& macro);
|
||||
std::set<std::string> enumerate_macro();
|
||||
portctrl::macro& get_macro(const std::string& macro);
|
||||
void set_macro(const std::string& macro, const portctrl::macro& m);
|
||||
void apply_macro(portctrl::frame& f);
|
||||
void rename_macro(const std::string& old, const std::string& newn);
|
||||
std::set<std::string> active_macro_set();
|
||||
void advance_macros();
|
||||
std::map<std::string, uint64_t> get_macro_frames();
|
||||
void set_macro_frames(const std::map<std::string, uint64_t>& f);
|
||||
private:
|
||||
const port_type_set* types;
|
||||
controller_frame _input;
|
||||
controller_frame _autohold;
|
||||
controller_frame _framehold;
|
||||
controller_frame _committed;
|
||||
std::vector<controller_frame> _autofire;
|
||||
void do_macro(const std::string& a, int mode);
|
||||
struct autofire_info
|
||||
{
|
||||
uint64_t first_frame;
|
||||
unsigned duty;
|
||||
unsigned cyclelen;
|
||||
bool eval_at(uint64_t frame);
|
||||
};
|
||||
struct tasinput_info
|
||||
{
|
||||
int mode;
|
||||
int16_t state;
|
||||
};
|
||||
void reread_tasinput_mode(const portctrl::type_set& ptype);
|
||||
const portctrl::type_set* types;
|
||||
portctrl::frame _input;
|
||||
portctrl::frame _autohold;
|
||||
portctrl::frame _framehold;
|
||||
std::map<unsigned, autofire_info> _autofire;
|
||||
std::map<unsigned, tasinput_info> _tasinput;
|
||||
bool tasinput_enaged;
|
||||
portctrl::frame _committed;
|
||||
std::map<std::string, portctrl::macro> all_macros;
|
||||
std::list<std::pair<uint64_t, portctrl::macro*>> active_macros;
|
||||
threads::lock macro_lock;
|
||||
project_state& project;
|
||||
movie_logic& mlogic;
|
||||
button_mapping& buttons;
|
||||
emulator_dispatch& edispatch;
|
||||
status_updater& supdater;
|
||||
command::group& cmd;
|
||||
command::_fnptr<const std::string&> macro_p;
|
||||
command::_fnptr<const std::string&> macro_r;
|
||||
command::_fnptr<const std::string&> macro_t;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic port controller name function.
|
||||
*/
|
||||
template<unsigned controllers, const char** name>
|
||||
inline const char* generic_controller_name(unsigned controller)
|
||||
{
|
||||
if(controller >= controllers)
|
||||
return NULL;
|
||||
return *name;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
203
include/core/debug.hpp
Normal file
203
include/core/debug.hpp
Normal file
|
@ -0,0 +1,203 @@
|
|||
#ifndef _debug__hpp__included__
|
||||
#define _debug__hpp__included__
|
||||
|
||||
#include <functional>
|
||||
#include <fstream>
|
||||
#include <cstdint>
|
||||
#include "library/command.hpp"
|
||||
#include "library/dispatch.hpp"
|
||||
|
||||
class emulator_dispatch;
|
||||
class loaded_rom;
|
||||
class memory_space;
|
||||
|
||||
/**
|
||||
* Debugging context.
|
||||
*/
|
||||
class debug_context
|
||||
{
|
||||
public:
|
||||
debug_context(emulator_dispatch& _dispatch, loaded_rom& _rom, memory_space& _mspace, command::group& _cmd);
|
||||
/**
|
||||
* Type of event.
|
||||
*/
|
||||
enum etype
|
||||
{
|
||||
DEBUG_READ,
|
||||
DEBUG_WRITE,
|
||||
DEBUG_EXEC,
|
||||
DEBUG_TRACE,
|
||||
DEBUG_FRAME,
|
||||
};
|
||||
/**
|
||||
* Parameters for read/write/execute event.
|
||||
*/
|
||||
struct params_rwx
|
||||
{
|
||||
uint64_t addr; //Address.
|
||||
uint64_t value; //Value/CPU.
|
||||
};
|
||||
/**
|
||||
* Parameters for trace event.
|
||||
*/
|
||||
struct params_trace
|
||||
{
|
||||
uint64_t cpu; //CPU number.
|
||||
const char* decoded_insn; //Decoded instruction
|
||||
bool true_insn; //True instruction flag.
|
||||
};
|
||||
/**
|
||||
* Parameters for frame event.
|
||||
*/
|
||||
struct params_frame
|
||||
{
|
||||
uint64_t frame; //Frame number.
|
||||
bool loadstated; //Loadstate flag.
|
||||
};
|
||||
/**
|
||||
* Parameters for debug callback.
|
||||
*/
|
||||
struct params
|
||||
{
|
||||
etype type;
|
||||
union {
|
||||
params_rwx rwx; //READ/WRITE/EXECUTE
|
||||
params_trace trace; //TRACE.
|
||||
params_frame frame; //FRAME.
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Base class of debugging callbacks.
|
||||
*/
|
||||
struct callback_base
|
||||
{
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~callback_base();
|
||||
/**
|
||||
* Do a callback.
|
||||
*/
|
||||
virtual void callback(const params& p) = 0;
|
||||
/**
|
||||
* Notify about killed callback.
|
||||
*/
|
||||
virtual void killed(uint64_t addr, etype type) = 0;
|
||||
};
|
||||
/**
|
||||
* Placeholder for all addresses.
|
||||
*/
|
||||
static const uint64_t all_addresses;
|
||||
/**
|
||||
* Add a callback.
|
||||
*/
|
||||
void add_callback(uint64_t addr, etype type, callback_base& cb);
|
||||
/**
|
||||
* Remove a callback.
|
||||
*/
|
||||
void remove_callback(uint64_t addr, etype type, callback_base& cb);
|
||||
/**
|
||||
* Fire a read callback.
|
||||
*/
|
||||
void do_callback_read(uint64_t addr, uint64_t value);
|
||||
/**
|
||||
* Fire a write callback.
|
||||
*/
|
||||
void do_callback_write(uint64_t addr, uint64_t value);
|
||||
/**
|
||||
* Fire a exec callback.
|
||||
*/
|
||||
void do_callback_exec(uint64_t addr, uint64_t value);
|
||||
/**
|
||||
* Fire a trace callback.
|
||||
*/
|
||||
void do_callback_trace(uint64_t cpu, const char* str, bool true_insn = true);
|
||||
/**
|
||||
* Fire a frame callback.
|
||||
*/
|
||||
void do_callback_frame(uint64_t frame, bool loadstate);
|
||||
/**
|
||||
* Set a cheat.
|
||||
*/
|
||||
void set_cheat(uint64_t addr, uint64_t value);
|
||||
/**
|
||||
* Clear a cheat.
|
||||
*/
|
||||
void clear_cheat(uint64_t addr);
|
||||
/**
|
||||
* Set execute callback mask.
|
||||
*/
|
||||
void setxmask(uint64_t mask);
|
||||
/**
|
||||
* Set tracelog file.
|
||||
*/
|
||||
void tracelog(uint64_t cpu, const std::string& filename);
|
||||
/**
|
||||
* Tracelogging on?
|
||||
*/
|
||||
bool is_tracelogging(uint64_t cpu);
|
||||
/**
|
||||
* Change tracelog change callback.
|
||||
*/
|
||||
void set_tracelog_change_cb(std::function<void()> cb);
|
||||
/**
|
||||
* Notify a core change.
|
||||
*/
|
||||
void core_change();
|
||||
/**
|
||||
* Request a break.
|
||||
*/
|
||||
void request_break();
|
||||
//These are public only for some debugging stuff.
|
||||
typedef std::list<callback_base*> cb_list;
|
||||
std::map<uint64_t, cb_list> read_cb;
|
||||
std::map<uint64_t, cb_list> write_cb;
|
||||
std::map<uint64_t, cb_list> exec_cb;
|
||||
std::map<uint64_t, cb_list> trace_cb;
|
||||
std::map<uint64_t, cb_list> frame_cb;
|
||||
private:
|
||||
void do_showhooks();
|
||||
void do_genevent(const std::string& a);
|
||||
void do_tracecmd(const std::string& a);
|
||||
cb_list dummy_cb; //Always empty.
|
||||
uint64_t xmask = 1;
|
||||
std::function<void()> tracelog_change_cb;
|
||||
emulator_dispatch& edispatch;
|
||||
loaded_rom& rom;
|
||||
memory_space& mspace;
|
||||
command::group& cmd;
|
||||
struct dispatch::target<> corechange;
|
||||
bool corechange_r = false;
|
||||
bool requesting_break = false;
|
||||
command::_fnptr<> showhooks;
|
||||
command::_fnptr<const std::string&> genevent;
|
||||
command::_fnptr<const std::string&> tracecmd;
|
||||
|
||||
struct tracelog_file : public callback_base
|
||||
{
|
||||
std::ofstream stream;
|
||||
std::string full_filename;
|
||||
unsigned refcnt;
|
||||
tracelog_file(debug_context& parent);
|
||||
~tracelog_file();
|
||||
void callback(const params& p);
|
||||
void killed(uint64_t addr, etype type);
|
||||
private:
|
||||
debug_context& parent;
|
||||
};
|
||||
std::map<uint64_t, tracelog_file*> trace_outputs;
|
||||
|
||||
std::map<uint64_t, cb_list>& get_lists(etype type)
|
||||
{
|
||||
switch(type) {
|
||||
case DEBUG_READ: return read_cb;
|
||||
case DEBUG_WRITE: return write_cb;
|
||||
case DEBUG_EXEC: return exec_cb;
|
||||
case DEBUG_TRACE: return trace_cb;
|
||||
case DEBUG_FRAME: return frame_cb;
|
||||
default: throw std::runtime_error("Invalid debug callback type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _dispatch__hpp__included__
|
||||
#define _dispatch__hpp__included__
|
||||
|
||||
#include "core/keymapper.hpp"
|
||||
#include "library/framebuffer.hpp"
|
||||
#include "library/dispatch.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -10,388 +10,32 @@
|
|||
#include <set>
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* Video data region is NTSC.
|
||||
*/
|
||||
#define VIDEO_REGION_NTSC 0
|
||||
/**
|
||||
* Video data region is PAL.
|
||||
*/
|
||||
#define VIDEO_REGION_PAL 1
|
||||
|
||||
/**
|
||||
* Information about run.
|
||||
*/
|
||||
struct gameinfo_struct
|
||||
struct emulator_dispatch
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct game info.
|
||||
*/
|
||||
gameinfo_struct() throw(std::bad_alloc);
|
||||
/**
|
||||
* Game name.
|
||||
*/
|
||||
std::string gamename;
|
||||
/**
|
||||
* Run length in seconds.
|
||||
*/
|
||||
double length;
|
||||
/**
|
||||
* Rerecord count (base 10 ASCII)
|
||||
*/
|
||||
std::string rerecords;
|
||||
/**
|
||||
* Authors. The first components are real names, the second components are nicknames. Either (but not both) may be
|
||||
* blank.
|
||||
*/
|
||||
std::vector<std::pair<std::string, std::string>> authors;
|
||||
/**
|
||||
* Format human-redable representation of the length.
|
||||
*
|
||||
* Parameter digits: Number of sub-second digits to use.
|
||||
* Returns: The time formated.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
std::string get_readable_time(unsigned digits) const throw(std::bad_alloc);
|
||||
/**
|
||||
* Get number of authors.
|
||||
*
|
||||
* Returns: Number of authors.
|
||||
*/
|
||||
size_t get_author_count() const throw();
|
||||
/**
|
||||
* Get short name of author (nickname if present, otherwise full name).
|
||||
*
|
||||
* Parameter idx: Index of author (0-based).
|
||||
* Returns: The short name.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
std::string get_author_short(size_t idx) const throw(std::bad_alloc);
|
||||
/**
|
||||
* Get rerecord count as a number. If rerecord count is too high, returns the maximum representatible count.
|
||||
*
|
||||
* Returns: The rerecord count.
|
||||
*/
|
||||
uint64_t get_rerecords() const throw();
|
||||
emulator_dispatch();
|
||||
void set_error_streams(std::ostream* stream);
|
||||
dispatch::source<> autohold_reconfigure;
|
||||
dispatch::source<unsigned, unsigned, unsigned, bool> autohold_update;
|
||||
dispatch::source<unsigned, unsigned, unsigned, unsigned, unsigned> autofire_update;
|
||||
dispatch::source<> close;
|
||||
dispatch::source<std::pair<std::string, std::string>> sound_change;
|
||||
dispatch::source<> screen_update;
|
||||
dispatch::source<> status_update;
|
||||
dispatch::source<bool> sound_unmute;
|
||||
dispatch::source<bool> mode_change;
|
||||
dispatch::source<> core_change;
|
||||
dispatch::source<> title_change;
|
||||
dispatch::source<> branch_change;
|
||||
dispatch::source<> mbranch_change;
|
||||
dispatch::source<bool> core_changed;
|
||||
dispatch::source<> voice_stream_change;
|
||||
dispatch::source<> vu_change;
|
||||
dispatch::source<> subtitle_change;
|
||||
dispatch::source<unsigned, unsigned, int> multitrack_change;
|
||||
dispatch::source<> action_update;
|
||||
};
|
||||
|
||||
extern dispatch::source<> notify_new_core;
|
||||
|
||||
/**
|
||||
* Information dispatch.
|
||||
*
|
||||
* This class handles dispatching information between the components of the emulator.
|
||||
*
|
||||
* Each kind of information has virtual method on_foo() which can be overridden to handle events of that type, and
|
||||
* static method do_foo(), which calls on_foo on all known objects.
|
||||
*
|
||||
* The information is delivered to each instance of this class.
|
||||
*/
|
||||
class information_dispatch
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create new object to receive information dispatch events.
|
||||
*
|
||||
* Parameter name: The name for the object.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
information_dispatch(const std::string& name) throw(std::bad_alloc);
|
||||
/**
|
||||
* Destroy object.
|
||||
*/
|
||||
~information_dispatch() throw();
|
||||
/**
|
||||
* Window close event received (this is not emulator close!)
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*/
|
||||
virtual void on_close();
|
||||
/**
|
||||
* Call all on_close() handlers.
|
||||
*/
|
||||
static void do_close() throw();
|
||||
/**
|
||||
* Sound mute/unmute status might have been changed.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter unmuted: If true, the sound is now enabled. If false, the sound is now disabled.
|
||||
*/
|
||||
virtual void on_sound_unmute(bool unmuted);
|
||||
/**
|
||||
* Call all on_sound_unmute() handlers.
|
||||
*/
|
||||
static void do_sound_unmute(bool unmuted) throw();
|
||||
/**
|
||||
* Sound device might have been changed.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter dev: The device name sound is now playing (if enabled) from.
|
||||
*/
|
||||
virtual void on_sound_change(const std::string& dev);
|
||||
/**
|
||||
* Call all on_sound_change() handlers.
|
||||
*/
|
||||
static void do_sound_change(const std::string& dev) throw();
|
||||
/**
|
||||
* Emulator mode might have been changed.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter readonly: True if readonly mode is now active, false if now in readwrite mode.
|
||||
*/
|
||||
virtual void on_mode_change(bool readonly);
|
||||
/**
|
||||
* Call all on_mode_change() handlers.
|
||||
*/
|
||||
static void do_mode_change(bool readonly) throw();
|
||||
/**
|
||||
* Autohold on button might have been changed.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter port: The port.
|
||||
* Parameter controller: The controller
|
||||
* Parameter ctrlnum: Physical control number (0-15).
|
||||
* Parameter newstate: True if autohold is now active, false if autohold is now inactive.
|
||||
*/
|
||||
virtual void on_autohold_update(unsigned port, unsigned controller, unsigned ctrlnum, bool newstate);
|
||||
/**
|
||||
* Call all on_autohold_update() handlers.
|
||||
*/
|
||||
static void do_autohold_update(unsigned port, unsigned controller, unsigned ctrlnum, bool newstate) throw();
|
||||
/**
|
||||
* Controller configuration may have been changed.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*/
|
||||
virtual void on_autohold_reconfigure();
|
||||
/**
|
||||
* Call all on_autohold_reconfigure() handlers.
|
||||
*/
|
||||
static void do_autohold_reconfigure() throw();
|
||||
/**
|
||||
* A raw frame has been received.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter raw: The raw frame data. 512*512 element array.
|
||||
* Parameter hires: True if in hires mode (512 wide), false if not (256-wide).
|
||||
* Parameter interlaced: True if in interlaced mode (448/478 high), false if not (224/239 high).
|
||||
* Parameter overscan: True if overscan is active, false if not.
|
||||
* Parameter region: One of VIDEO_REGION_* contstants, giving the region this frame is from.
|
||||
*/
|
||||
virtual void on_raw_frame(const uint32_t* raw, bool hires, bool interlaced, bool overscan, unsigned region);
|
||||
/**
|
||||
* Call all on_raw_frame() handlers.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*/
|
||||
static void do_raw_frame(const uint32_t* raw, bool hires, bool interlaced, bool overscan, unsigned region)
|
||||
throw();
|
||||
/**
|
||||
* A frame has been received.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter _frame: The frame object.
|
||||
* Parameter fps_n: Numerator of current video fps.
|
||||
* Parameter fps_d: Denominator of current video fps.
|
||||
*/
|
||||
virtual void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d);
|
||||
/**
|
||||
* Call all on_frame() handlers.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*/
|
||||
static void do_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) throw();
|
||||
/**
|
||||
* A sample has been received.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter l: The left channel sample (16 bit signed).
|
||||
* Parameter r: The right channel sample (16 bit signed).
|
||||
*/
|
||||
virtual void on_sample(short l, short r);
|
||||
/**
|
||||
* Call all on_sample() handlers.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*/
|
||||
static void do_sample(short l, short r) throw();
|
||||
/**
|
||||
* Dump is ending.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*/
|
||||
virtual void on_dump_end();
|
||||
/**
|
||||
* Call all on_dump_end() handlers.
|
||||
*/
|
||||
static void do_dump_end() throw();
|
||||
/**
|
||||
* Sound sampling rate is changing
|
||||
*
|
||||
* The default handler prints warning if dumper flag is set.
|
||||
*
|
||||
* Parameter rate_n: Numerator of the new sampling rate in Hz.
|
||||
* Parameter rate_d: Denominator of the new sampling rate in Hz.
|
||||
*/
|
||||
virtual void on_sound_rate(uint32_t rate_n, uint32_t rate_d);
|
||||
/**
|
||||
* Call all on_sound_rate() methods and save the parameters.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*/
|
||||
static void do_sound_rate(uint32_t rate_n, uint32_t rate_d) throw();
|
||||
/**
|
||||
* Get the sound rate most recently set by on_sound_rate().
|
||||
*
|
||||
* Returns: The first component is the numerator, the second is the denominator.
|
||||
*/
|
||||
static std::pair<uint32_t, uint32_t> get_sound_rate() throw();
|
||||
/**
|
||||
* Game information is changing.
|
||||
*
|
||||
* The default handler does nothing.
|
||||
*
|
||||
* Parameter gi: The new game info.
|
||||
*/
|
||||
virtual void on_gameinfo(const struct gameinfo_struct& gi);
|
||||
/**
|
||||
* Call all on_gameinfo() handlers and save the gameinfo.
|
||||
*/
|
||||
static void do_gameinfo(const struct gameinfo_struct& gi) throw();
|
||||
/**
|
||||
* Get the gameinfo most recently set by do_gameinfo().
|
||||
*
|
||||
* Returns: The gameinfo.
|
||||
*/
|
||||
static const struct gameinfo_struct& get_gameinfo() throw();
|
||||
/**
|
||||
* Return the dumper flag for this dispatch target.
|
||||
*
|
||||
* The default implementation returns false.
|
||||
*
|
||||
* If dumper flag is set:
|
||||
* - on_sound_rate() default handler prints a warning.
|
||||
* - All dumping related do_* functions triggers calls to to on_new_dumper() on all handlers the next time they
|
||||
* are called.
|
||||
* - Destroying the handler triggers calls to on_destroy_dumper() on all handlers (if on_new_dumper() has been
|
||||
* called).
|
||||
*/
|
||||
virtual bool get_dumper_flag() throw();
|
||||
/**
|
||||
* Notify that a new dumper is joining.
|
||||
*
|
||||
* Parameter dumper: The name of the dumper object.
|
||||
*/
|
||||
virtual void on_new_dumper(const std::string& dumper);
|
||||
/**
|
||||
* Notify that a dumper is leaving.
|
||||
*
|
||||
* Parameter dumper: The name of the dumper object.
|
||||
*/
|
||||
virtual void on_destroy_dumper(const std::string& dumper);
|
||||
/**
|
||||
* Get number of active dumpers.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*
|
||||
* Returns: The dumper count.
|
||||
*/
|
||||
static unsigned get_dumper_count() throw();
|
||||
/**
|
||||
* Get set of active dumpers.
|
||||
*
|
||||
* Calls on_new_dumper() on dumpers that had that not yet called.
|
||||
*
|
||||
* Returns: The set of dumper names.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
static std::set<std::string> get_dumpers() throw(std::bad_alloc);
|
||||
/**
|
||||
* Get name of target.
|
||||
*/
|
||||
const std::string& get_name() throw();
|
||||
/**
|
||||
* Render buffer needs to be (possibly) resized, so that graphics plugin can update the mappings.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*
|
||||
* parameter scr: The render buffer object.
|
||||
*/
|
||||
virtual void on_set_screen(framebuffer<false>& scr);
|
||||
/**
|
||||
* Call on_set_screen on all objects.
|
||||
*/
|
||||
static void do_set_screen(framebuffer<false>& scr) throw();
|
||||
/**
|
||||
* Notify that new frame is available.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*/
|
||||
virtual void on_screen_update();
|
||||
/**
|
||||
* Call on_screen_update() in all objects.
|
||||
*/
|
||||
static void do_screen_update() throw();
|
||||
/**
|
||||
* Notify that status buffer has been updated.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*/
|
||||
virtual void on_status_update();
|
||||
/**
|
||||
* Call on_status_update() in all objects.
|
||||
*/
|
||||
static void do_status_update() throw();
|
||||
/**
|
||||
* Notify that some dumper has attached, deattached, popped into existence or disappeared.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*/
|
||||
virtual void on_dumper_update();
|
||||
/**
|
||||
* Call on_dumper_update on on all objects.
|
||||
*/
|
||||
static void do_dumper_update() throw();
|
||||
/**
|
||||
* Notify that core changed.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*/
|
||||
virtual void on_core_change();
|
||||
/**
|
||||
* Call on_core_change on on all objects.
|
||||
*/
|
||||
static void do_core_change() throw();
|
||||
/**
|
||||
* Notify that there is a new core.
|
||||
*
|
||||
* Default implementation does nothing.
|
||||
*/
|
||||
virtual void on_new_core();
|
||||
/**
|
||||
* Call on_new_core on on all objects.
|
||||
*/
|
||||
static void do_new_core() throw();
|
||||
protected:
|
||||
/**
|
||||
* Call to indicate this target is interested in sound sample data.
|
||||
*/
|
||||
void enable_send_sound() throw(std::bad_alloc);
|
||||
private:
|
||||
static void update_dumpers(bool nocalls = false) throw();
|
||||
bool known_if_dumper;
|
||||
bool marked_as_dumper;
|
||||
std::string target_name;
|
||||
bool notified_as_dumper;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
99
include/core/emustatus.hpp
Normal file
99
include/core/emustatus.hpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
#ifndef _emustatus__hpp__included__
|
||||
#define _emustatus__hpp__included__
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include "library/command.hpp"
|
||||
#include "library/triplebuffer.hpp"
|
||||
|
||||
class movie_logic;
|
||||
class project_state;
|
||||
class voice_commentary;
|
||||
class emulator_runmode;
|
||||
class master_dumper;
|
||||
class save_jukebox;
|
||||
class slotinfo_cache;
|
||||
class framerate_regulator;
|
||||
class controller_state;
|
||||
class multitrack_edit;
|
||||
class lua_state;
|
||||
class loaded_rom;
|
||||
class memwatch_set;
|
||||
class emulator_dispatch;
|
||||
|
||||
struct _lsnes_status
|
||||
{
|
||||
const static int pause_none; //pause: No pause.
|
||||
const static int pause_normal; //pause: Normal pause.
|
||||
const static int pause_break; //pause: Break pause.
|
||||
const static uint64_t subframe_savepoint; //subframe: Point of save.
|
||||
const static uint64_t subframe_video; //subframe: Point of video output.
|
||||
|
||||
bool valid;
|
||||
bool movie_valid; //The movie state variables are valid?
|
||||
uint64_t curframe; //Current frame number.
|
||||
uint64_t length; //Movie length.
|
||||
uint64_t lag; //Lag counter.
|
||||
uint64_t subframe; //Subframe number.
|
||||
bool dumping; //Video dump active.
|
||||
unsigned speed; //Speed%
|
||||
bool saveslot_valid; //Save slot number/info valid.
|
||||
uint64_t saveslot; //Save slot number.
|
||||
std::u32string slotinfo; //Save slot info.
|
||||
bool branch_valid; //Branch info valid?
|
||||
std::u32string branch; //Current branch.
|
||||
bool mbranch_valid; //Movie branch info valid?
|
||||
std::u32string mbranch; //Current movie branch.
|
||||
std::u32string macros; //Currently active macros.
|
||||
int pause; //Pause mode.
|
||||
char mode; //Movie mode: C:Corrupt, R:Readwrite, P:Readonly, F:Finished.
|
||||
bool rtc_valid; //RTC time valid?
|
||||
std::u32string rtc; //RTC time.
|
||||
std::vector<std::u32string> inputs; //Input display.
|
||||
std::map<std::string, std::u32string> mvars; //Memory watches.
|
||||
std::map<std::string, std::u32string> lvars; //Lua variables.
|
||||
};
|
||||
|
||||
struct slotinfo_cache
|
||||
{
|
||||
slotinfo_cache(movie_logic& _mlogic, command::group& _cmd);
|
||||
std::string get(const std::string& _filename);
|
||||
void flush(const std::string& _filename);
|
||||
void flush();
|
||||
private:
|
||||
std::map<std::string, std::string> cache;
|
||||
movie_logic& mlogic;
|
||||
command::group& cmd;
|
||||
command::_fnptr<> flushcmd;
|
||||
};
|
||||
|
||||
struct status_updater
|
||||
{
|
||||
public:
|
||||
status_updater(project_state& _project, movie_logic& _mlogic, voice_commentary& _commentary,
|
||||
triplebuffer::triplebuffer<_lsnes_status>& _status, emulator_runmode& _runmode, master_dumper& _mdumper,
|
||||
save_jukebox& _jukebox, slotinfo_cache& _slotcache, framerate_regulator& _framerate,
|
||||
controller_state& _controls, multitrack_edit& _mteditor, lua_state& _lua2, loaded_rom& _rom,
|
||||
memwatch_set& _mwatch, emulator_dispatch& _dispatch);
|
||||
void update();
|
||||
private:
|
||||
project_state& project;
|
||||
movie_logic& mlogic;
|
||||
voice_commentary& commentary;
|
||||
triplebuffer::triplebuffer<_lsnes_status>& status;
|
||||
emulator_runmode& runmode;
|
||||
master_dumper& mdumper;
|
||||
save_jukebox& jukebox;
|
||||
slotinfo_cache& slotcache;
|
||||
framerate_regulator& framerate;
|
||||
controller_state& controls;
|
||||
multitrack_edit& mteditor;
|
||||
lua_state& lua2;
|
||||
loaded_rom& rom;
|
||||
memwatch_set& mwatch;
|
||||
emulator_dispatch& dispatch;
|
||||
};
|
||||
|
||||
#endif
|
39
include/core/filedownload.hpp
Normal file
39
include/core/filedownload.hpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#ifndef _filedownload__hpp__included__
|
||||
#define _filedownload__hpp__included__
|
||||
|
||||
#include "library/threads.hpp"
|
||||
#include "library/httpreq.hpp"
|
||||
#include "library/urirewrite.hpp"
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class loaded_rom;
|
||||
|
||||
struct file_download
|
||||
{
|
||||
//Variables.
|
||||
std::string url;
|
||||
std::string target_slot;
|
||||
//Ctor
|
||||
file_download();
|
||||
~file_download();
|
||||
//Lauch.
|
||||
void do_async(loaded_rom& rom);
|
||||
void cancel();
|
||||
//Status.
|
||||
volatile bool finished; //This signals download finishing, call finish().
|
||||
std::string errormsg;
|
||||
http_async_request req;
|
||||
std::string statusmsg();
|
||||
threads::cv cond;
|
||||
threads::lock m;
|
||||
//Internal.
|
||||
void _do_async(loaded_rom& rom);
|
||||
std::string tempname;
|
||||
std::string tempname2;
|
||||
};
|
||||
|
||||
extern urirewrite::rewriter lsnes_uri_rewrite;
|
||||
|
||||
#endif
|
44
include/core/fileupload.hpp
Normal file
44
include/core/fileupload.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef _fileupload__hpp__included__
|
||||
#define _fileupload__hpp__included__
|
||||
|
||||
#include "library/threads.hpp"
|
||||
#include "library/httpreq.hpp"
|
||||
#include "library/httpauth.hpp"
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
struct file_upload
|
||||
{
|
||||
//Variables.
|
||||
std::string base_url;
|
||||
std::vector<char> content;
|
||||
std::string filename;
|
||||
std::string title;
|
||||
std::string description;
|
||||
std::string gamename;
|
||||
bool hidden;
|
||||
//Ctor
|
||||
file_upload();
|
||||
~file_upload();
|
||||
//Lauch.
|
||||
void do_async();
|
||||
void _do_async();
|
||||
void cancel();
|
||||
//Status.
|
||||
std::list<std::string> get_messages();
|
||||
int get_progress_ppm(); //-1 => No progress.
|
||||
volatile bool finished;
|
||||
volatile bool success;
|
||||
std::string final_url;
|
||||
//Vars.
|
||||
dh25519_http_auth* dh25519;
|
||||
http_async_request* req;
|
||||
std::list<std::string> msgs;
|
||||
threads::lock m;
|
||||
void add_msg(const std::string& msg);
|
||||
};
|
||||
|
||||
void get_dh25519_pubkey(uint8_t* out);
|
||||
|
||||
#endif
|
|
@ -2,96 +2,117 @@
|
|||
#define _framebuffer__hpp__included__
|
||||
|
||||
#include "core/window.hpp"
|
||||
#include "core/queue.hpp"
|
||||
#include "library/command.hpp"
|
||||
#include "library/framebuffer.hpp"
|
||||
#include "library/triplebuffer.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
class subtitle_commentary;
|
||||
class memwatch_set;
|
||||
class emulator_dispatch;
|
||||
class lua_state;
|
||||
class loaded_rom;
|
||||
class status_updater;
|
||||
namespace settingvar
|
||||
{
|
||||
class group;
|
||||
}
|
||||
namespace keyboard
|
||||
{
|
||||
class keyboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triple buffering logic.
|
||||
* Emulator frame buffer.
|
||||
*/
|
||||
class triplebuffer_logic
|
||||
class emu_framebuffer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create new triple buffer logic.
|
||||
*/
|
||||
triplebuffer_logic() throw(std::bad_alloc);
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~triplebuffer_logic() throw();
|
||||
/**
|
||||
* Get index for write buffer.Also starts write cycle.
|
||||
*
|
||||
* Returns: Write buffer index (0-2).
|
||||
*/
|
||||
unsigned start_write() throw();
|
||||
/**
|
||||
* Notify that write cycle has ended.
|
||||
*/
|
||||
void end_write() throw();
|
||||
/**
|
||||
* Get index for read buffer. Also starts read cycle.
|
||||
*
|
||||
* Returns: Read buffer index (0-2).
|
||||
*/
|
||||
unsigned start_read() throw();
|
||||
/**
|
||||
* Notify that read cycle has ended.
|
||||
*/
|
||||
void end_read() throw();
|
||||
private:
|
||||
triplebuffer_logic(triplebuffer_logic&);
|
||||
triplebuffer_logic& operator=(triplebuffer_logic&);
|
||||
mutex* mut;
|
||||
unsigned read_active;
|
||||
unsigned write_active;
|
||||
unsigned read_active_slot;
|
||||
unsigned write_active_slot;
|
||||
unsigned last_complete_slot;
|
||||
};
|
||||
|
||||
emu_framebuffer(subtitle_commentary& _subtitles, settingvar::group& _settings, memwatch_set& _mwatch,
|
||||
keyboard::keyboard& _keyboard, emulator_dispatch& _dispatch, lua_state& _lua2, loaded_rom& _rom,
|
||||
status_updater& _supdater, command::group& _cmd, input_queue& _iqueue);
|
||||
/**
|
||||
* The main framebuffer.
|
||||
*/
|
||||
extern framebuffer_raw main_framebuffer;
|
||||
framebuffer::raw main_framebuffer;
|
||||
/**
|
||||
* Special screen: "SYSTEM STATE CORRUPT".
|
||||
*/
|
||||
extern framebuffer_raw screen_corrupt;
|
||||
static framebuffer::raw screen_corrupt;
|
||||
/**
|
||||
* The main screen to draw on.
|
||||
*/
|
||||
extern framebuffer<false> main_screen;
|
||||
framebuffer::fb<false> main_screen;
|
||||
/**
|
||||
* Initialize special screens.
|
||||
*
|
||||
* throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
void init_special_screens() throw(std::bad_alloc);
|
||||
static void init_special_screens() throw(std::bad_alloc);
|
||||
/**
|
||||
* Copy framebuffer to backing store, running Lua hooks if any.
|
||||
*/
|
||||
void redraw_framebuffer(framebuffer_raw& torender, bool no_lua = false, bool spontaneous = false);
|
||||
void redraw_framebuffer(framebuffer::raw& torender, bool no_lua = false, bool spontaneous = false);
|
||||
/**
|
||||
* Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them.
|
||||
*/
|
||||
void redraw_framebuffer();
|
||||
void redraw_framebuffer();
|
||||
/**
|
||||
* Return last complete framebuffer.
|
||||
*/
|
||||
framebuffer_raw get_framebuffer() throw(std::bad_alloc);
|
||||
framebuffer::raw get_framebuffer() throw(std::bad_alloc);
|
||||
/**
|
||||
* Render framebuffer to main screen.
|
||||
*/
|
||||
void render_framebuffer();
|
||||
void render_framebuffer();
|
||||
/**
|
||||
* Get the size of current framebuffer.
|
||||
*/
|
||||
std::pair<uint32_t, uint32_t> get_framebuffer_size();
|
||||
std::pair<uint32_t, uint32_t> get_framebuffer_size();
|
||||
/**
|
||||
* Take a screenshot to specified file.
|
||||
*/
|
||||
void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error);
|
||||
void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error);
|
||||
/**
|
||||
* Kill pending requests associated with object.
|
||||
*/
|
||||
void render_kill_request(void* obj);
|
||||
/**
|
||||
* Get latest screen received from core.
|
||||
*/
|
||||
framebuffer::raw& render_get_latest_screen();
|
||||
void render_get_latest_screen_end();
|
||||
private:
|
||||
void do_screenshot(command::arg_filename a);
|
||||
struct render_info
|
||||
{
|
||||
framebuffer::raw fbuf;
|
||||
framebuffer::queue rq;
|
||||
uint32_t hscl;
|
||||
uint32_t vscl;
|
||||
uint32_t lgap;
|
||||
uint32_t rgap;
|
||||
uint32_t tgap;
|
||||
uint32_t bgap;
|
||||
};
|
||||
render_info buffer1;
|
||||
render_info buffer2;
|
||||
render_info buffer3;
|
||||
triplebuffer::triplebuffer<render_info> buffering;
|
||||
bool last_redraw_no_lua;
|
||||
subtitle_commentary& subtitles;
|
||||
settingvar::group& settings;
|
||||
memwatch_set& mwatch;
|
||||
keyboard::keyboard& keyboard;
|
||||
emulator_dispatch& edispatch;
|
||||
lua_state& lua2;
|
||||
loaded_rom& rom;
|
||||
status_updater& supdater;
|
||||
command::group& cmd;
|
||||
input_queue& iqueue;
|
||||
command::_fnptr<command::arg_filename> screenshot;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,41 +2,75 @@
|
|||
#define _framerate__hpp__included__
|
||||
|
||||
#include <cstdint>
|
||||
#include "library/threads.hpp"
|
||||
#include "library/command.hpp"
|
||||
|
||||
#define FRAMERATE_HISTORY_FRAMES 10
|
||||
|
||||
/**
|
||||
* Framerate regulator.
|
||||
*/
|
||||
class framerate_regulator
|
||||
{
|
||||
public:
|
||||
framerate_regulator(command::group& _cmd);
|
||||
/**
|
||||
* Set the target speed multiplier.
|
||||
*
|
||||
* Parameter multiplier: The multiplier target. May be INFINITE.
|
||||
*/
|
||||
void set_speed_multiplier(double multiplier) throw();
|
||||
|
||||
/**
|
||||
* Increase the speed to next step.
|
||||
*/
|
||||
void increase_speed() throw();
|
||||
|
||||
/**
|
||||
* Decrease the speed to next step.
|
||||
*/
|
||||
void decrease_speed() throw();
|
||||
|
||||
/**
|
||||
* Get the target speed multiplier.
|
||||
*
|
||||
* Returns: The multiplier. May be INFINITE.
|
||||
*/
|
||||
double get_speed_multiplier() throw();
|
||||
|
||||
/**
|
||||
* Sets the nominal frame rate. Framerate limiting tries to maintain the nominal framerate when there is no other
|
||||
* explict framerate to maintain.
|
||||
*/
|
||||
void set_nominal_framerate(double fps) throw();
|
||||
void set_nominal_framerate(double fps) throw();
|
||||
|
||||
/**
|
||||
* Returns the current realized framerate.
|
||||
* Returns the current realized framerate multiplier.
|
||||
*
|
||||
* returns: The framerate the system is currently archiving.
|
||||
* returns: The framerate multiplier the system is currently archiving.
|
||||
*/
|
||||
double get_framerate() throw();
|
||||
double get_realized_multiplier() throw();
|
||||
|
||||
/**
|
||||
* Freeze time.
|
||||
*
|
||||
* Parameter usec: Current time in microseconds.
|
||||
*/
|
||||
void freeze_time(uint64_t usec);
|
||||
void freeze_time(uint64_t usec);
|
||||
|
||||
/**
|
||||
* Unfreeze time.
|
||||
*
|
||||
* Parameter usec: Current time in microseconds.
|
||||
*/
|
||||
void unfreeze_time(uint64_t usec);
|
||||
void unfreeze_time(uint64_t usec);
|
||||
|
||||
/**
|
||||
* Acknowledge frame start for timing purposes. If time is frozen, it is automatically unfrozen.
|
||||
*
|
||||
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
|
||||
*/
|
||||
void ack_frame_tick(uint64_t usec) throw();
|
||||
void ack_frame_tick(uint64_t usec) throw();
|
||||
|
||||
/**
|
||||
* Computes the number of microseconds to wait for next frame.
|
||||
|
@ -44,16 +78,48 @@ void ack_frame_tick(uint64_t usec) throw();
|
|||
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
|
||||
* returns: Number of more microseconds to wait.
|
||||
*/
|
||||
uint64_t to_wait_frame(uint64_t usec) throw();
|
||||
uint64_t to_wait_frame(uint64_t usec) throw();
|
||||
|
||||
/**
|
||||
* Return microsecond-resolution time since unix epoch.
|
||||
*/
|
||||
uint64_t get_utime();
|
||||
static uint64_t get_utime();
|
||||
|
||||
/**
|
||||
* Wait specified number of microseconds.
|
||||
*/
|
||||
void wait_usec(uint64_t usec);
|
||||
void wait_usec(uint64_t usec);
|
||||
/**
|
||||
* Turbo flag.
|
||||
*/
|
||||
bool turboed;
|
||||
private:
|
||||
void set_speed_cmd(const std::string& args);
|
||||
uint64_t get_time(uint64_t curtime, bool update);
|
||||
double get_realized_fps();
|
||||
void add_frame(uint64_t linear_time);
|
||||
std::pair<bool, double> read_fps();
|
||||
//Step should be ODD.
|
||||
void set_speedstep(unsigned step);
|
||||
//Step can be EVEN if between steps.
|
||||
unsigned get_speedstep();
|
||||
uint64_t last_time_update;
|
||||
uint64_t time_at_last_update;
|
||||
bool time_frozen;
|
||||
uint64_t frame_number;
|
||||
uint64_t frame_start_times[FRAMERATE_HISTORY_FRAMES];
|
||||
//Framerate.
|
||||
double nominal_framerate;
|
||||
double multiplier_framerate;
|
||||
bool framerate_realtime_locked;
|
||||
threads::lock framerate_lock;
|
||||
command::group& cmd;
|
||||
command::_fnptr<> turbo_p;
|
||||
command::_fnptr<> turbo_r;
|
||||
command::_fnptr<> turbo_t;
|
||||
command::_fnptr<const std::string&> setspeed_t;
|
||||
command::_fnptr<> spd_inc;
|
||||
command::_fnptr<> spd_dec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
74
include/core/instance-map.hpp
Normal file
74
include/core/instance-map.hpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifndef _instance_map__hpp__included__
|
||||
#define _instance_map__hpp__included__
|
||||
|
||||
#include <map>
|
||||
|
||||
class emulator_instance;
|
||||
|
||||
template<typename T> class instance_map
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destroy a instance map.
|
||||
*/
|
||||
~instance_map()
|
||||
{
|
||||
for(auto i : instances)
|
||||
delete i.second;
|
||||
instances.clear();
|
||||
}
|
||||
/**
|
||||
* Does this instance exist?
|
||||
*/
|
||||
bool exists(emulator_instance& inst)
|
||||
{
|
||||
return instances.count(&inst);
|
||||
}
|
||||
/**
|
||||
* Lookup a instance. Returns NULL if none.
|
||||
*/
|
||||
T* lookup(emulator_instance& inst)
|
||||
{
|
||||
if(!instances.count(&inst))
|
||||
return NULL;
|
||||
return instances[&inst];
|
||||
}
|
||||
/**
|
||||
* Create a new instance.
|
||||
*/
|
||||
template<typename... U> T* create(emulator_instance& inst, U... args)
|
||||
{
|
||||
T* out = NULL;
|
||||
try {
|
||||
out = new T(inst, args...);
|
||||
instances[&inst] = out;
|
||||
return out;
|
||||
} catch(...) {
|
||||
if(out) delete out;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Erase a instance.
|
||||
*/
|
||||
void destroy(emulator_instance& inst)
|
||||
{
|
||||
if(instances.count(&inst)) {
|
||||
delete instances[&inst];
|
||||
instances.erase(&inst);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove a instance.
|
||||
*/
|
||||
void remove(emulator_instance& inst)
|
||||
{
|
||||
if(instances.count(&inst)) {
|
||||
instances.erase(&inst);
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::map<emulator_instance*, T*> instances;
|
||||
};
|
||||
|
||||
#endif
|
142
include/core/instance.hpp
Normal file
142
include/core/instance.hpp
Normal file
|
@ -0,0 +1,142 @@
|
|||
#ifndef _instance__hpp__included__
|
||||
#define _instance__hpp__included__
|
||||
|
||||
#include "library/threads.hpp"
|
||||
|
||||
class movie_logic;
|
||||
class memory_space;
|
||||
class memwatch_set;
|
||||
class voice_commentary;
|
||||
class subtitle_commentary;
|
||||
class movie_branches;
|
||||
class multitrack_edit;
|
||||
class _lsnes_status;
|
||||
class alias_binds_manager;
|
||||
class rrdata;
|
||||
class cart_mappings_refresher;
|
||||
class controller_state;
|
||||
class project_state;
|
||||
class debug_context;
|
||||
class framerate_regulator;
|
||||
class emu_framebuffer;
|
||||
class input_queue;
|
||||
class master_dumper;
|
||||
class button_mapping;
|
||||
class emulator_dispatch;
|
||||
class slotinfo_cache;
|
||||
class lua_state;
|
||||
class audioapi_instance;
|
||||
class loaded_rom;
|
||||
class save_jukebox;
|
||||
class emulator_runmode;
|
||||
class status_updater;
|
||||
namespace command { class group; }
|
||||
namespace lua { class state; }
|
||||
namespace settingvar { class group; }
|
||||
namespace settingvar { class cache; }
|
||||
namespace keyboard { class keyboard; }
|
||||
namespace keyboard { class mapper; }
|
||||
namespace triplebuffer { template<typename T> class triplebuffer; }
|
||||
|
||||
class dtor_list
|
||||
{
|
||||
struct entry
|
||||
{
|
||||
void* ptr;
|
||||
void (*free1)(void* ptr);
|
||||
void (*free2)(void* ptr);
|
||||
entry* prev;
|
||||
};
|
||||
public:
|
||||
dtor_list();
|
||||
~dtor_list();
|
||||
void destroy();
|
||||
template<typename T> void prealloc(T*& ptr)
|
||||
{
|
||||
entry e;
|
||||
e.ptr = ptr = reinterpret_cast<T*>(new char[sizeof(T) + 32]);
|
||||
memset(ptr, 0, sizeof(T) + 32);
|
||||
e.free1 = null;
|
||||
e.free2 = free2;
|
||||
e.prev = list;
|
||||
list = new entry(e);
|
||||
}
|
||||
template<typename T, typename... U> void init(T*& ptr, U&... args)
|
||||
{
|
||||
if(ptr) {
|
||||
//Find the entry.
|
||||
entry* e = list;
|
||||
while(e->ptr != ptr)
|
||||
e = e->prev;
|
||||
new(ptr) T(args...);
|
||||
e->free1 = free1_p<T>;
|
||||
} else {
|
||||
entry e;
|
||||
e.ptr = ptr = new T(args...);
|
||||
e.free1 = free1<T>;
|
||||
e.free2 = null;
|
||||
e.prev = list;
|
||||
list = new entry(e);
|
||||
}
|
||||
}
|
||||
private:
|
||||
entry* list;
|
||||
static void null(void* ptr) {}
|
||||
static void free2(void* ptr) { delete[] reinterpret_cast<char*>(ptr); }
|
||||
template<typename T> static void free1(void* ptr) { delete reinterpret_cast<T*>(ptr); }
|
||||
template<typename T> static void free1_p(void* ptr) { reinterpret_cast<T*>(ptr)->~T(); }
|
||||
};
|
||||
|
||||
struct emulator_instance
|
||||
{
|
||||
emulator_instance();
|
||||
~emulator_instance();
|
||||
emulator_dispatch* dispatch;
|
||||
movie_logic* mlogic;
|
||||
memory_space* memory;
|
||||
lua::state* lua;
|
||||
lua_state* lua2;
|
||||
memwatch_set* mwatch;
|
||||
settingvar::group* settings;
|
||||
settingvar::cache* setcache;
|
||||
voice_commentary* commentary;
|
||||
subtitle_commentary* subtitles;
|
||||
movie_branches* mbranch;
|
||||
controller_state* controls;
|
||||
button_mapping* buttons;
|
||||
multitrack_edit* mteditor;
|
||||
_lsnes_status* status_A;
|
||||
_lsnes_status* status_B;
|
||||
_lsnes_status* status_C;
|
||||
triplebuffer::triplebuffer<_lsnes_status>* status;
|
||||
keyboard::keyboard* keyboard;
|
||||
command::group* command;
|
||||
keyboard::mapper* mapper;
|
||||
alias_binds_manager* abindmanager;
|
||||
rrdata* nrrdata;
|
||||
cart_mappings_refresher* cmapper;
|
||||
project_state* project;
|
||||
debug_context* dbg;
|
||||
framerate_regulator* framerate;
|
||||
emu_framebuffer* fbuf;
|
||||
input_queue* iqueue;
|
||||
master_dumper* mdumper;
|
||||
slotinfo_cache* slotcache;
|
||||
audioapi_instance* audio;
|
||||
loaded_rom* rom;
|
||||
save_jukebox* jukebox;
|
||||
emulator_runmode* runmode;
|
||||
status_updater* supdater;
|
||||
threads::id emu_thread;
|
||||
time_t random_seed_value;
|
||||
dtor_list D;
|
||||
private:
|
||||
emulator_instance(const emulator_instance&);
|
||||
emulator_instance& operator=(const emulator_instance&);
|
||||
};
|
||||
|
||||
extern emulator_instance lsnes_instance;
|
||||
|
||||
emulator_instance& CORE();
|
||||
|
||||
#endif
|
|
@ -4,36 +4,60 @@
|
|||
#include <list>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include "library/command.hpp"
|
||||
|
||||
void voicethread_task();
|
||||
void voicethread_kill();
|
||||
void voice_frame_number(uint64_t newframe, double rate);
|
||||
class emulator_dispatch;
|
||||
|
||||
enum external_stream_format
|
||||
namespace settingvar
|
||||
{
|
||||
EXTFMT_OPUSDEMO,
|
||||
EXTFMT_SOX,
|
||||
EXTFMT_OGGOPUS
|
||||
};
|
||||
class group;
|
||||
}
|
||||
|
||||
struct playback_stream_info
|
||||
class voice_commentary
|
||||
{
|
||||
uint64_t id;
|
||||
uint64_t base;
|
||||
uint64_t length;
|
||||
};
|
||||
public:
|
||||
enum external_stream_format
|
||||
{
|
||||
EXTFMT_SOX,
|
||||
EXTFMT_OGGOPUS
|
||||
};
|
||||
|
||||
bool voicesub_collection_loaded();
|
||||
std::list<playback_stream_info> voicesub_get_stream_info();
|
||||
void voicesub_play_stream(uint64_t id);
|
||||
void voicesub_export_stream(uint64_t id, const std::string& filename, external_stream_format fmt);
|
||||
uint64_t voicesub_import_stream(uint64_t ts, const std::string& filename, external_stream_format fmt);
|
||||
void voicesub_delete_stream(uint64_t id);
|
||||
void voicesub_export_superstream(const std::string& filename);
|
||||
void voicesub_load_collection(const std::string& filename);
|
||||
void voicesub_unload_collection();
|
||||
void voicesub_alter_timebase(uint64_t id, uint64_t ts);
|
||||
uint64_t voicesub_parse_timebase(const std::string& n);
|
||||
double voicesub_ts_seconds(uint64_t ts);
|
||||
struct playback_stream_info
|
||||
{
|
||||
uint64_t id;
|
||||
uint64_t base;
|
||||
uint64_t length;
|
||||
};
|
||||
|
||||
voice_commentary(settingvar::group& _settings, emulator_dispatch& _dispatch, audioapi_instance& _audio,
|
||||
command::group& _cmd);
|
||||
~voice_commentary();
|
||||
void init();
|
||||
void kill();
|
||||
void frame_number(uint64_t newframe, double rate);
|
||||
bool collection_loaded();
|
||||
std::list<playback_stream_info> get_stream_info();
|
||||
void play_stream(uint64_t id);
|
||||
void export_stream(uint64_t id, const std::string& filename, external_stream_format fmt);
|
||||
uint64_t import_stream(uint64_t ts, const std::string& filename, external_stream_format fmt);
|
||||
void delete_stream(uint64_t id);
|
||||
void export_superstream(const std::string& filename);
|
||||
void load_collection(const std::string& filename);
|
||||
void unload_collection();
|
||||
void alter_timebase(uint64_t id, uint64_t ts);
|
||||
uint64_t parse_timebase(const std::string& n);
|
||||
double ts_seconds(uint64_t ts);
|
||||
float get_gain(uint64_t id);
|
||||
void set_gain(uint64_t id, float gain);
|
||||
void set_active_flag(bool flag);
|
||||
private:
|
||||
void* internal;
|
||||
settingvar::group& settings;
|
||||
emulator_dispatch& edispatch;
|
||||
audioapi_instance& audio;
|
||||
command::group& cmd;
|
||||
command::_fnptr<> tangentp;
|
||||
command::_fnptr<> tangentr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
#ifndef _joystick__hpp__included__
|
||||
#define _joystick__hpp__included__
|
||||
|
||||
#include "core/keymapper.hpp"
|
||||
|
||||
/**
|
||||
* Create a new joystick.
|
||||
*
|
||||
* Parameter id: The id of new joystick.
|
||||
* Parameter xname: The name of new joystick.
|
||||
*/
|
||||
void joystick_create(uint64_t id, const std::string& xname);
|
||||
/**
|
||||
* Free all joysticks.
|
||||
*/
|
||||
void joystick_quit();
|
||||
/**
|
||||
* Create a new axis.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The id of the axis.
|
||||
* Parameter minv: The minimal calibration value.
|
||||
* Parameter maxv: The maximal calibration value.
|
||||
* Parameter xname: The name of axis.
|
||||
* Parameter atype: The axis type (-1 => Disabled, 0 => Pressure, 1 => Axis).
|
||||
*/
|
||||
void joystick_new_axis(uint64_t jid, uint64_t id, int64_t minv, int64_t maxv, const std::string& xname, int atype);
|
||||
/**
|
||||
* Create a new button.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The id of button.
|
||||
* Parameter xname: The name of button.
|
||||
* Returns: The number of button.
|
||||
*/
|
||||
void joystick_new_button(uint64_t jid, uint64_t id, const std::string& xname);
|
||||
/**
|
||||
* Create a new hat from pair of axes.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id_x: The id of x axis of the hat.
|
||||
* Parameter id_y: The id of y axis of the hat.
|
||||
* Parameter min_dev: The smallest deviation from zero to react to.
|
||||
* Parameter xname_x: The name of x axis.
|
||||
* Parameter xname_y: The name of y axis.
|
||||
* Returns: The number of hat.
|
||||
*/
|
||||
void joystick_new_hat(uint64_t jid, uint64_t id_x, uint64_t id_y, int64_t min_dev, const std::string& xname_x,
|
||||
const std::string& xname_y);
|
||||
/**
|
||||
* Create a new hat from POV control.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The id of POV control.
|
||||
* Parameter xname: The name of POV control.
|
||||
* Returns: The number of hat.
|
||||
*/
|
||||
void joystick_new_hat(uint64_t jid, uint64_t id, const std::string& xname);
|
||||
/**
|
||||
* Report possible change in axis value.
|
||||
*
|
||||
* Requests to update unknown axes are ignored.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The ID of axis.
|
||||
* Parameter value: The value.
|
||||
*/
|
||||
void joystick_report_axis(uint64_t jid, uint64_t id, int64_t value);
|
||||
/**
|
||||
* Report possible change in button value.
|
||||
*
|
||||
* Requests to update unknown buttons are ignored.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The ID of button.
|
||||
* Parameter value: The value.
|
||||
*/
|
||||
void joystick_report_button(uint64_t jid, uint64_t id, bool value);
|
||||
/**
|
||||
* Report possible change in POV value.
|
||||
*
|
||||
* Requests to update unknown POVs are ignored.
|
||||
*
|
||||
* Parameter jid: The id of joystick.
|
||||
* Parameter id: The ID of POV.
|
||||
* Parameter value: The angle in hundredths of degree clockwise from up, or negative if centered.
|
||||
*/
|
||||
void joystick_report_pov(uint64_t jid, uint64_t id, int angle);
|
||||
/**
|
||||
* Print message about joystick.
|
||||
*
|
||||
* Parameter jid: The joystick id.
|
||||
*/
|
||||
void joystick_message(uint64_t jid);
|
||||
/**
|
||||
* Get set of all joysticks.
|
||||
*/
|
||||
std::set<uint64_t> joystick_set();
|
||||
/**
|
||||
* Flush all pending joystick requests.
|
||||
*/
|
||||
void joystick_flush();
|
||||
|
||||
#endif
|
44
include/core/joystickapi.hpp
Normal file
44
include/core/joystickapi.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef _joystickapi__hpp__included__
|
||||
#define _joystickapi__hpp__included__
|
||||
|
||||
//These correspond to various joystick_driver_* functions.
|
||||
struct _joystick_driver
|
||||
{
|
||||
void (*init)();
|
||||
void (*quit)();
|
||||
void (*thread_fn)();
|
||||
void (*signal)();
|
||||
const char* (*name)();
|
||||
};
|
||||
|
||||
struct joystick_driver
|
||||
{
|
||||
joystick_driver(_joystick_driver drv);
|
||||
};
|
||||
|
||||
/**
|
||||
* Joystick initialization function.
|
||||
*
|
||||
* - The third initialization function to be called by window_init().
|
||||
* - The call occurs in the main thread.
|
||||
* - Implemented by the joystick plugin.
|
||||
*/
|
||||
void joystick_driver_init(bool soft = false) throw();
|
||||
/**
|
||||
* Joystick quit function.
|
||||
*
|
||||
* - The third last quit function to be called by window_quit().
|
||||
* - The call occurs in the main thread.
|
||||
* - Implemented by the joystick plugin.
|
||||
*/
|
||||
void joystick_driver_quit(bool soft = false) throw();
|
||||
/**
|
||||
* Signal the joystick thread to quit.
|
||||
*/
|
||||
void joystick_driver_signal() throw();
|
||||
/**
|
||||
* Identification for joystick plugin.
|
||||
*/
|
||||
const char* joystick_driver_name();
|
||||
|
||||
#endif
|
88
include/core/jukebox.hpp
Normal file
88
include/core/jukebox.hpp
Normal file
|
@ -0,0 +1,88 @@
|
|||
#ifndef _jukebox__hpp__included__
|
||||
#define _jukebox__hpp__included__
|
||||
|
||||
#include <functional>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
namespace settingvar { class group; }
|
||||
|
||||
class save_jukebox_listener;
|
||||
|
||||
/**
|
||||
* Save jukebox.
|
||||
*/
|
||||
class save_jukebox
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
save_jukebox(settingvar::group& _settings, command::group& _cmd);
|
||||
/**
|
||||
* Dtor.
|
||||
*/
|
||||
~save_jukebox();
|
||||
/**
|
||||
* Get current slot.
|
||||
*
|
||||
* Throws std::runtime_exception: No slot selected.
|
||||
*/
|
||||
size_t get_slot();
|
||||
/**
|
||||
* Set current slot.
|
||||
*
|
||||
* Parameter slot: The slot to select.
|
||||
* Throws std::runtime_exception: Slot out of range.
|
||||
*/
|
||||
void set_slot(size_t slot);
|
||||
/**
|
||||
* Cycle next slot.
|
||||
*
|
||||
* Throws std::runtime_exception: No slot selected.
|
||||
*/
|
||||
void cycle_next();
|
||||
/**
|
||||
* Cycle previous slot.
|
||||
*
|
||||
* Throws std::runtime_exception: No slot selected.
|
||||
*/
|
||||
void cycle_prev();
|
||||
/**
|
||||
* Get save as binary flag.
|
||||
*/
|
||||
bool save_binary();
|
||||
/**
|
||||
* Get name of current jukebox slot.
|
||||
*
|
||||
* Throws std::runtime_exception: No slot selected.
|
||||
*/
|
||||
std::string get_slot_name();
|
||||
/**
|
||||
* Set size of jukebox.
|
||||
*
|
||||
* Parameter size: The new size.
|
||||
*/
|
||||
void set_size(size_t size);
|
||||
/**
|
||||
* Set update function.
|
||||
*/
|
||||
void set_update(std::function<void()> _update);
|
||||
/**
|
||||
* Unset update function.
|
||||
*/
|
||||
void unset_update();
|
||||
private:
|
||||
void do_slotsel(const std::string& arg);
|
||||
settingvar::group& settings;
|
||||
size_t current_slot;
|
||||
size_t current_size;
|
||||
std::function<void()> update;
|
||||
save_jukebox_listener* listener;
|
||||
command::group& cmd;
|
||||
command::_fnptr<const std::string&> slotsel;
|
||||
command::_fnptr<> cycleprev;
|
||||
command::_fnptr<> cyclenext;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -10,20 +10,28 @@
|
|||
#include <iostream>
|
||||
#include "misc.hpp"
|
||||
#include "library/keyboard.hpp"
|
||||
#include "library/keymapper.hpp"
|
||||
#include "library/keyboard-mapper.hpp"
|
||||
#include "library/gamepad.hpp"
|
||||
|
||||
/**
|
||||
* Our keyboard
|
||||
* Inverse bindings set.
|
||||
*/
|
||||
extern keyboard lsnes_kbd;
|
||||
extern keyboard::invbind_set lsnes_invbinds;
|
||||
/**
|
||||
* Our key mapper.
|
||||
* Gamepad HW.
|
||||
*/
|
||||
extern keyboard_mapper lsnes_mapper;
|
||||
|
||||
extern gamepad::set lsnes_gamepads;
|
||||
/**
|
||||
* Translate axis calibration into mode name.
|
||||
* Initialize gamepads (need to be called before initializing joysticks).
|
||||
*/
|
||||
std::string calibration_to_mode(keyboard_axis_calibration p);
|
||||
void lsnes_gamepads_init();
|
||||
/**
|
||||
* Deinitialize gamepads (need to be called after deinitializing joysticks).
|
||||
*/
|
||||
void lsnes_gamepads_deinit();
|
||||
/**
|
||||
* Cleanup the keymapper stuff.
|
||||
*/
|
||||
void cleanup_keymapper();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include "library/loadlib.hpp"
|
||||
|
||||
void handle_post_loadlibrary();
|
||||
void autoload_libraries();
|
||||
void autoload_libraries(void(*on_error)(const std::string& libname, const std::string& err, bool system) = NULL);
|
||||
void with_loaded_library(const loadlib::module& l);
|
||||
bool with_unloaded_library(loadlib::module& l);
|
||||
std::string loadlib_debug_get_user_library_dir();
|
||||
std::string loadlib_debug_get_system_library_dir();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _mainloop__hpp__included__
|
||||
#define _mainloop__hpp__included__
|
||||
|
||||
#include "settings.hpp"
|
||||
#include "rom.hpp"
|
||||
#include "moviefile.hpp"
|
||||
#include "movie.hpp"
|
||||
|
@ -12,7 +13,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& settings, bool load_has
|
|||
throw(std::bad_alloc, std::runtime_error);
|
||||
std::vector<std::string> get_jukebox_names();
|
||||
void set_jukebox_names(const std::vector<std::string>& newj);
|
||||
void update_movie_state();
|
||||
void init_main_callbacks();
|
||||
extern std::string msu1_base_path;
|
||||
|
||||
/**
|
||||
|
@ -23,4 +24,15 @@ extern std::string msu1_base_path;
|
|||
*/
|
||||
void mainloop_signal_need_rewind(void* ptr);
|
||||
|
||||
void set_stop_at_frame(uint64_t frame = 0);
|
||||
void switch_projects(const std::string& newproj);
|
||||
void close_rom();
|
||||
void load_new_rom(const romload_request& req);
|
||||
void reload_current_rom();
|
||||
void do_break_pause();
|
||||
void convert_break_to_pause();
|
||||
|
||||
extern settingvar::supervariable<settingvar::model_bool<settingvar::yes_no>> movie_dflt_binary;
|
||||
extern settingvar::supervariable<settingvar::model_bool<settingvar::yes_no>> save_dflt_binary;
|
||||
|
||||
#endif
|
||||
|
|
32
include/core/mbranch.hpp
Normal file
32
include/core/mbranch.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef _mbranch__hpp__included__
|
||||
#define _mbranch__hpp__included__
|
||||
|
||||
#define MBRANCH_IMPORT_TEXT 0
|
||||
#define MBRANCH_IMPORT_BINARY 1
|
||||
#define MBRANCH_IMPORT_MOVIE 2
|
||||
|
||||
class emulator_dispatch;
|
||||
class status_updater;
|
||||
class movie_logic;
|
||||
|
||||
struct movie_branches
|
||||
{
|
||||
movie_branches(movie_logic& _mlogic, emulator_dispatch& _dispatch, status_updater& _supdater);
|
||||
std::string name(const std::string& internal);
|
||||
std::set<std::string> enumerate();
|
||||
std::string get();
|
||||
void set(const std::string& branch);
|
||||
void _new(const std::string& branch, const std::string& from);
|
||||
void rename(const std::string& oldn, const std::string& newn);
|
||||
void _delete(const std::string& branch);
|
||||
std::set<std::string> _movie_branches(const std::string& filename);
|
||||
void import_branch(const std::string& filename, const std::string& ibranch, const std::string& branchname,
|
||||
int mode);
|
||||
void export_branch(const std::string& filename, const std::string& branchname, bool binary);
|
||||
private:
|
||||
movie_logic& mlogic;
|
||||
emulator_dispatch& edispatch;
|
||||
status_updater& supdater;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -6,10 +6,20 @@
|
|||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include "library/memoryspace.hpp"
|
||||
|
||||
extern memory_space lsnes_memory;
|
||||
class memory_space;
|
||||
class movie_logic;
|
||||
class loaded_rom;
|
||||
|
||||
void refresh_cart_mappings() throw(std::bad_alloc);
|
||||
class cart_mappings_refresher
|
||||
{
|
||||
public:
|
||||
cart_mappings_refresher(memory_space& _mspace, movie_logic& _mlogic, loaded_rom& _rom);
|
||||
void operator()() throw(std::bad_alloc);
|
||||
private:
|
||||
memory_space& mspace;
|
||||
movie_logic& mlogic;
|
||||
loaded_rom& rom;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,11 +4,189 @@
|
|||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
#include "library/memorywatch.hpp"
|
||||
#include "library/json.hpp"
|
||||
|
||||
std::string evaluate_watch(const std::string& expr) throw(std::bad_alloc);
|
||||
std::set<std::string> get_watches() throw(std::bad_alloc);
|
||||
std::string get_watchexpr_for(const std::string& w) throw(std::bad_alloc);
|
||||
void set_watchexpr_for(const std::string& w, const std::string& expr) throw(std::bad_alloc);
|
||||
void do_watch_memory();
|
||||
class memory_space;
|
||||
class project_state;
|
||||
class loaded_rom;
|
||||
class emu_framebuffer;
|
||||
namespace framebuffer { class queue; }
|
||||
|
||||
#endif
|
||||
/**
|
||||
* lsnes memory watch printer variables.
|
||||
*/
|
||||
struct memwatch_printer
|
||||
{
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
memwatch_printer();
|
||||
/**
|
||||
* Serialize the printer to JSON value.
|
||||
*/
|
||||
JSON::node serialize();
|
||||
/**
|
||||
* Unserialize the printer from JSON value.
|
||||
*/
|
||||
void unserialize(const JSON::node& node);
|
||||
/**
|
||||
* Get a printer object corresponding to this object.
|
||||
*/
|
||||
GC::pointer<memorywatch::item_printer> get_printer_obj(
|
||||
std::function<GC::pointer<mathexpr::mathexpr>(const std::string& n)> vars);
|
||||
//Fields.
|
||||
enum position_category {
|
||||
PC_DISABLED,
|
||||
PC_MEMORYWATCH,
|
||||
PC_ONSCREEN
|
||||
} position;
|
||||
bool cond_enable; //Ignored for disabled.
|
||||
std::string enabled; //Ignored for disabled.
|
||||
std::string onscreen_xpos;
|
||||
std::string onscreen_ypos;
|
||||
bool onscreen_alt_origin_x;
|
||||
bool onscreen_alt_origin_y;
|
||||
bool onscreen_cliprange_x;
|
||||
bool onscreen_cliprange_y;
|
||||
std::string onscreen_font; //"" is system default.
|
||||
int64_t onscreen_fg_color;
|
||||
int64_t onscreen_bg_color;
|
||||
int64_t onscreen_halo_color;
|
||||
};
|
||||
|
||||
/**
|
||||
* lsnes memory watch item.
|
||||
*/
|
||||
struct memwatch_item
|
||||
{
|
||||
/**
|
||||
* Ctor.
|
||||
*/
|
||||
memwatch_item();
|
||||
/**
|
||||
* Serialize the item to JSON value.
|
||||
*/
|
||||
JSON::node serialize();
|
||||
/**
|
||||
* Unserialize the item from JSON value.
|
||||
*/
|
||||
void unserialize(const JSON::node& node);
|
||||
/**
|
||||
* Get memory read operator.
|
||||
*
|
||||
* If bytes == 0, returns NULL.
|
||||
*/
|
||||
mathexpr::operinfo* get_memread_oper(memory_space& memory, loaded_rom& rom);
|
||||
/**
|
||||
* Translate compatiblity item.
|
||||
*/
|
||||
void compatiblity_unserialize(memory_space& memory, const std::string& item);
|
||||
//Fields
|
||||
memwatch_printer printer; //The printer.
|
||||
std::string expr; //The main expression.
|
||||
std::string format; //Format.
|
||||
unsigned bytes; //Number of bytes to read (0 => Not memory read operator).
|
||||
bool signed_flag; //Is signed?
|
||||
bool float_flag; //Is float?
|
||||
int endianess; //Endianess (-1 => little, 0 => host, 1 => Big).
|
||||
uint64_t scale_div; //Scale divisor.
|
||||
uint64_t addr_base; //Address base.
|
||||
uint64_t addr_size; //Address size (0 => All).
|
||||
};
|
||||
|
||||
struct memwatch_set
|
||||
{
|
||||
memwatch_set(memory_space& _memory, project_state& _project, emu_framebuffer& _fbuf,
|
||||
loaded_rom& rom);
|
||||
/**
|
||||
* Get the specified memory watch item.
|
||||
*/
|
||||
memwatch_item& get(const std::string& name);
|
||||
/**
|
||||
* Get the specified memory watch item as JSON serialization.
|
||||
*
|
||||
* Parameter name: The item name.
|
||||
* Parameter printer: JSON pretty-printer to use.
|
||||
*/
|
||||
std::string get_string(const std::string& name, JSON::printer* printer = NULL);
|
||||
/**
|
||||
* Set the specified memory watch item. Fills the runtime variables.
|
||||
*
|
||||
* Parameter name: The name of the new item.
|
||||
* Parameter item: The item to insert. Fields are shallow-copied.
|
||||
*/
|
||||
void set(const std::string& name, memwatch_item& item);
|
||||
/**
|
||||
* Set the specified memory watch item from JSON serialization. Fills the runtime variables.
|
||||
*
|
||||
* Parameter name: The name of the new item.
|
||||
* Parameter item: The serialization of item to insert.
|
||||
*/
|
||||
void set(const std::string& name, const std::string& item);
|
||||
/**
|
||||
* Set multiple items at once.
|
||||
*
|
||||
* Parameter list: The list of items.
|
||||
*/
|
||||
void set_multi(std::list<std::pair<std::string, memwatch_item>>& list);
|
||||
/**
|
||||
* Set multiple items at once from JSON descriptions.
|
||||
*
|
||||
* Parameter list: The list of items.
|
||||
*/
|
||||
void set_multi(std::list<std::pair<std::string, std::string>>& list);
|
||||
/**
|
||||
* Rename a memory watch item.
|
||||
*
|
||||
* Parameter oname: The old name.
|
||||
* Parameter newname: The new name.
|
||||
* Returns: True on success, false if failed (new item already exists).
|
||||
*/
|
||||
bool rename(const std::string& oname, const std::string& newname);
|
||||
/**
|
||||
* Delete an item.
|
||||
*
|
||||
* Parameter name: The name of the item to delete.
|
||||
*/
|
||||
void clear(const std::string& name);
|
||||
/**
|
||||
* Delete multiple items.
|
||||
*
|
||||
* Parameter names: The names of the items to delete.
|
||||
*/
|
||||
void clear_multi(const std::set<std::string>& name);
|
||||
/**
|
||||
* Enumerate item names.
|
||||
*/
|
||||
std::set<std::string> enumerate();
|
||||
/**
|
||||
* Get value of specified memory watch as a string.
|
||||
*/
|
||||
std::string get_value(const std::string& name);
|
||||
/**
|
||||
* Watch all the items.
|
||||
*
|
||||
* Parameter rq: The render queue to use.
|
||||
*/
|
||||
void watch(struct framebuffer::queue& rq);
|
||||
/**
|
||||
* Get memory watch vars that go to window.
|
||||
*/
|
||||
const std::map<std::string, std::u32string>& get_window_vars() { return window_vars; }
|
||||
private:
|
||||
void rebuild(std::map<std::string, memwatch_item>& nitems);
|
||||
std::map<std::string, memwatch_item> items;
|
||||
std::map<std::string, std::u32string> window_vars;
|
||||
std::map<std::string, bool> used_memorywatches;
|
||||
void erase_unused_watches();
|
||||
void watch_output(const std::string& name, const std::string& value);
|
||||
memorywatch::set watch_set;
|
||||
memory_space& memory;
|
||||
project_state& project;
|
||||
emu_framebuffer& fbuf;
|
||||
loaded_rom& rom;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
25
include/core/messages.hpp
Normal file
25
include/core/messages.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef _messages__hpp__included__
|
||||
#define _messages__hpp__included__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* messages -> window::out().
|
||||
*/
|
||||
class messages_relay_class
|
||||
{
|
||||
public:
|
||||
operator std::ostream&() { return getstream(); }
|
||||
static std::ostream& getstream();
|
||||
};
|
||||
template<typename T> inline std::ostream& operator<<(messages_relay_class& x, T value)
|
||||
{
|
||||
return messages_relay_class::getstream() << value;
|
||||
};
|
||||
inline std::ostream& operator<<(messages_relay_class& x, std::ostream& (*fn)(std::ostream& o))
|
||||
{
|
||||
return fn(messages_relay_class::getstream());
|
||||
};
|
||||
extern messages_relay_class messages;
|
||||
|
||||
#endif
|
|
@ -5,57 +5,7 @@
|
|||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include "library/string.hpp"
|
||||
|
||||
/**
|
||||
* \brief Get random hexes
|
||||
*
|
||||
* Get string of random hex characters of specified length.
|
||||
*
|
||||
* \param length The number of hex characters to return.
|
||||
* \return The random hexadecimal string.
|
||||
* \throws std::bad_alloc Not enough memory.
|
||||
*/
|
||||
std::string get_random_hexstring(size_t length) throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* \brief Set random seed
|
||||
*
|
||||
* This function sets the random seed to use.
|
||||
*
|
||||
* \param seed The value to use as seed.
|
||||
* \throw std::bad_alloc Not enough memory.
|
||||
*/
|
||||
void set_random_seed(const std::string& seed) throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* \brief Set random seed to (hopefully) unique value
|
||||
*
|
||||
* This function sets the random seed to value that should only be used once. Note, the value is not necressarily
|
||||
* crypto-secure, even if it is unique.
|
||||
*
|
||||
* \throw std::bad_alloc Not enough memory.
|
||||
*/
|
||||
void set_random_seed() throw(std::bad_alloc);
|
||||
|
||||
/**
|
||||
* \brief Load a ROM.
|
||||
*
|
||||
* Given commandline arguments, load a ROM.
|
||||
*
|
||||
* \param cmdline The command line.
|
||||
* \return The loaded ROM set.
|
||||
* \throws std::bad_alloc Not enough memory.
|
||||
* \throws std::runtime_error Can't load the ROMset.
|
||||
*/
|
||||
struct loaded_rom load_rom_from_commandline(std::vector<std::string> cmdline) throw(std::bad_alloc,
|
||||
std::runtime_error);
|
||||
|
||||
/**
|
||||
* \brief Dump listing of regions to graphics system messages.
|
||||
*
|
||||
* \throws std::bad_alloc Not enough memory.
|
||||
*/
|
||||
void dump_region_map() throw(std::bad_alloc);
|
||||
#include "library/memtracker.hpp"
|
||||
|
||||
/**
|
||||
* \brief Fatal error.
|
||||
|
@ -77,29 +27,9 @@ std::string get_config_path() throw(std::bad_alloc);
|
|||
*/
|
||||
void OOM_panic();
|
||||
|
||||
/**
|
||||
* messages -> window::out().
|
||||
*/
|
||||
class messages_relay_class
|
||||
{
|
||||
public:
|
||||
operator std::ostream&() { return getstream(); }
|
||||
static std::ostream& getstream();
|
||||
};
|
||||
template<typename T> inline std::ostream& operator<<(messages_relay_class& x, T value)
|
||||
{
|
||||
return messages_relay_class::getstream() << value;
|
||||
};
|
||||
inline std::ostream& operator<<(messages_relay_class& x, std::ostream& (*fn)(std::ostream& o))
|
||||
{
|
||||
return fn(messages_relay_class::getstream());
|
||||
};
|
||||
extern messages_relay_class messages;
|
||||
|
||||
uint32_t gcd(uint32_t a, uint32_t b) throw();
|
||||
|
||||
void create_lsnesrc();
|
||||
|
||||
/**
|
||||
* Return hexadecimal representation of address
|
||||
*/
|
||||
|
@ -114,4 +44,19 @@ bool in_global_ctors();
|
|||
*/
|
||||
void reached_main();
|
||||
|
||||
/**
|
||||
* Clean up filename from dangerous chars
|
||||
*/
|
||||
std::string safe_filename(const std::string& str);
|
||||
|
||||
/**
|
||||
* Mangle some characters ()|/
|
||||
*/
|
||||
std::string mangle_name(const std::string& orig);
|
||||
|
||||
/**
|
||||
* Return a new temporary file. The file will be created.
|
||||
*/
|
||||
std::string get_temp_file();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include "core/controllerframe.hpp"
|
||||
#include "core/moviefile.hpp"
|
||||
#include "library/rrdata.hpp"
|
||||
#include "library/movie.hpp"
|
||||
|
||||
/**
|
||||
* Class encapsulating bridge logic between bsnes interface and movie code.
|
||||
* Class encapsulating bridge logic between core interface and movie code.
|
||||
*/
|
||||
class movie_logic
|
||||
{
|
||||
|
@ -17,13 +19,41 @@ public:
|
|||
* Create new bridge.
|
||||
*/
|
||||
movie_logic() throw();
|
||||
|
||||
/**
|
||||
* Has movie?
|
||||
*/
|
||||
operator bool() throw() { return mov; }
|
||||
bool operator!() throw() { return !mov; }
|
||||
/**
|
||||
* Get the movie instance associated.
|
||||
*
|
||||
* returns: The movie instance.
|
||||
*/
|
||||
movie& get_movie() throw();
|
||||
movie& get_movie() throw(std::runtime_error);
|
||||
|
||||
/**
|
||||
* Set the movie instance associated.
|
||||
*/
|
||||
void set_movie(movie& _mov, bool free_old = false) throw();
|
||||
|
||||
/**
|
||||
* Get the current movie file.
|
||||
*/
|
||||
moviefile& get_mfile() throw(std::runtime_error);
|
||||
|
||||
/**
|
||||
* Set the current movie file.
|
||||
*/
|
||||
void set_mfile(moviefile& _mf, bool free_old = false) throw();
|
||||
/**
|
||||
* Get current rrdata.
|
||||
*/
|
||||
rrdata_set& get_rrdata() throw(std::runtime_error);
|
||||
|
||||
/**
|
||||
* Set current rrdata.
|
||||
*/
|
||||
void set_rrdata(rrdata_set& _rrd, bool free_old = false) throw();
|
||||
|
||||
/**
|
||||
* Notify about new frame starting.
|
||||
|
@ -47,9 +77,24 @@ public:
|
|||
*
|
||||
* parameter subframe: True if this is for subframe update, false if for frame update.
|
||||
*/
|
||||
controller_frame update_controls(bool subframe) throw(std::bad_alloc, std::runtime_error);
|
||||
portctrl::frame update_controls(bool subframe, bool forced = false) throw(std::bad_alloc, std::runtime_error);
|
||||
|
||||
/**
|
||||
* Notify user poll (exit poll advance).
|
||||
*
|
||||
* returns: If true, update_controls is forced.
|
||||
*/
|
||||
bool notify_user_poll() throw(std::bad_alloc, std::runtime_error);
|
||||
/**
|
||||
* Release memory for mov, mf and rrd.
|
||||
*/
|
||||
void release_memory();
|
||||
private:
|
||||
movie mov;
|
||||
movie_logic(const movie_logic&);
|
||||
movie_logic& operator=(const movie_logic&);
|
||||
movie* mov;
|
||||
moviefile* mf;
|
||||
rrdata_set* rrd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,39 +1,48 @@
|
|||
#ifndef _moviedata__hpp__included__
|
||||
#define _moviedata__hpp__included__
|
||||
|
||||
#include "moviefile.hpp"
|
||||
#include "movie.hpp"
|
||||
#include "core/emustatus.hpp"
|
||||
#include "core/moviefile.hpp"
|
||||
#include "core/movie.hpp"
|
||||
#include "library/rrdata.hpp"
|
||||
|
||||
//Load state, always switch to Readwrite.
|
||||
#define LOAD_STATE_RW 0
|
||||
//Load state, never switch to Readwrite.
|
||||
#define LOAD_STATE_RO 1
|
||||
//Load state, don't muck with movie data.
|
||||
#define LOAD_STATE_PRESERVE 2
|
||||
//Load state, ignoring the actual state.
|
||||
#define LOAD_STATE_MOVIE 3
|
||||
//Load state, switch to readwrite if previously there and loaded state is at the end.
|
||||
#define LOAD_STATE_DEFAULT 4
|
||||
//Load state, switch to readwrite if previously there.
|
||||
#define LOAD_STATE_CURRENT 5
|
||||
//No load state, rewind movie to start.
|
||||
#define LOAD_STATE_BEGINNING 6
|
||||
//No load state, reload ROM.
|
||||
#define LOAD_STATE_ROMRELOAD 7
|
||||
//Load state, loading everything, switch to readwrite if loaded state is at the end.
|
||||
#define LOAD_STATE_INITIAL 8
|
||||
//Load state, along with all branches, switch to readwrite if loaded state is at the end.
|
||||
#define LOAD_STATE_ALLBRANCH 9
|
||||
|
||||
#define SAVE_STATE 0
|
||||
#define SAVE_MOVIE 1
|
||||
|
||||
extern struct moviefile our_movie;
|
||||
extern struct loaded_rom* our_rom;
|
||||
extern bool system_corrupt;
|
||||
std::vector<char>& get_host_memory();
|
||||
movie& get_movie();
|
||||
|
||||
std::string resolve_relative_path(const std::string& path);
|
||||
std::pair<std::string, std::string> split_author(const std::string& author) throw(std::bad_alloc,
|
||||
std::runtime_error);
|
||||
|
||||
void do_save_state(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
|
||||
void do_save_movie(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
|
||||
void do_load_beginning(bool reloading = false) throw(std::bad_alloc, std::runtime_error);
|
||||
void do_load_state(struct moviefile& _movie, int lmode);
|
||||
void do_save_state(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error);
|
||||
void do_save_movie(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error);
|
||||
void do_load_rom() throw(std::bad_alloc, std::runtime_error);
|
||||
void do_load_rewind() throw(std::bad_alloc, std::runtime_error);
|
||||
void do_load_state(struct moviefile& _movie, int lmode, bool& used);
|
||||
bool do_load_state(const std::string& filename, int lmode);
|
||||
std::string translate_name_mprefix(std::string original, bool forio = false);
|
||||
std::string translate_name_mprefix(std::string original, int& binary, int save);
|
||||
|
||||
extern std::string last_save;
|
||||
extern movie_logic movb;
|
||||
|
||||
/**
|
||||
* Restore the actual core state from quicksave. Only call in rewind callback.
|
||||
|
@ -42,7 +51,21 @@ extern movie_logic movb;
|
|||
* Parameter secs: The seconds counter.
|
||||
* Parameter ssecs: The subsecond counter.
|
||||
*/
|
||||
void mainloop_restore_state(const std::vector<char>& state, uint64_t secs, uint64_t ssecs);
|
||||
void mainloop_restore_state(const dynamic_state& state);
|
||||
|
||||
std::string get_mprefix_for_project();
|
||||
void set_mprefix_for_project(const std::string& pfx);
|
||||
void set_mprefix_for_project(const std::string& prjid, const std::string& pfx);
|
||||
|
||||
class rrdata
|
||||
{
|
||||
public:
|
||||
rrdata();
|
||||
rrdata_set::instance operator()();
|
||||
static std::string filename(const std::string& projectid);
|
||||
private:
|
||||
bool init;
|
||||
rrdata_set::instance next;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
31
include/core/moviefile-binary.hpp
Normal file
31
include/core/moviefile-binary.hpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef _moviefile_binary__hpp__included__
|
||||
#define _moviefile_binary__hpp__included__
|
||||
|
||||
/**
|
||||
* The binary movie extension tags.
|
||||
*/
|
||||
enum lsnes_movie_tags
|
||||
{
|
||||
TAG_ANCHOR_SAVE = 0xf5e0fad7,
|
||||
TAG_AUTHOR = 0xafff97b4,
|
||||
TAG_CORE_VERSION = 0xe4344c7e,
|
||||
TAG_GAMENAME = 0xe80d6970,
|
||||
TAG_HOSTMEMORY = 0x3bf9d187,
|
||||
TAG_MACRO = 0xd261338f,
|
||||
TAG_MOVIE = 0xf3dca44b,
|
||||
TAG_MOVIE_SRAM = 0xbbc824b7,
|
||||
TAG_MOVIE_TIME = 0x18c3a975,
|
||||
TAG_PROJECT_ID = 0x359bfbab,
|
||||
TAG_ROMHASH = 0x0428acfc,
|
||||
TAG_RRDATA = 0xa3a07f71,
|
||||
TAG_SAVE_SRAM = 0xae9bfb2f,
|
||||
TAG_SAVESTATE = 0x2e5bc2ac,
|
||||
TAG_SCREENSHOT = 0xc6760d0e,
|
||||
TAG_SUBTITLE = 0x6a7054d3,
|
||||
TAG_RAMCONTENT = 0xd3ec3770,
|
||||
TAG_ROMHINT = 0x6f715830,
|
||||
TAG_BRANCH = 0xf2e60707,
|
||||
TAG_BRANCH_NAME = 0x6dcb2155
|
||||
};
|
||||
|
||||
#endif
|
64
include/core/moviefile-common.hpp
Normal file
64
include/core/moviefile-common.hpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef _moviefile_common__hpp__included__
|
||||
#define _moviefile_common__hpp__included__
|
||||
|
||||
#include <functional>
|
||||
#include "core/moviefile.hpp"
|
||||
#define DEFAULT_RTC_SECOND 1000000000ULL
|
||||
#define DEFAULT_RTC_SUBSECOND 0ULL
|
||||
|
||||
template<typename target>
|
||||
static void moviefile_write_settings(target& w, const std::map<std::string, std::string>& settings,
|
||||
core_setting_group& sgroup, std::function<void(target& w, const std::string& name,
|
||||
const std::string& value)> writefn)
|
||||
{
|
||||
for(auto i : settings) {
|
||||
if(!sgroup.settings.count(i.first))
|
||||
continue;
|
||||
if(sgroup.settings.find(i.first)->second.dflt == i.second)
|
||||
continue;
|
||||
writefn(w, i.first, i.second);
|
||||
}
|
||||
}
|
||||
|
||||
struct moviefile_branch_extractor_text : public moviefile::branch_extractor
|
||||
{
|
||||
moviefile_branch_extractor_text(const std::string& filename);
|
||||
~moviefile_branch_extractor_text();
|
||||
std::set<std::string> enumerate();
|
||||
void read(const std::string& name, portctrl::frame_vector& v);
|
||||
private:
|
||||
zip::reader z;
|
||||
};
|
||||
|
||||
struct moviefile_branch_extractor_binary : public moviefile::branch_extractor
|
||||
{
|
||||
moviefile_branch_extractor_binary(const std::string& filename);
|
||||
~moviefile_branch_extractor_binary();
|
||||
std::set<std::string> enumerate();
|
||||
void read(const std::string& name, portctrl::frame_vector& v);
|
||||
private:
|
||||
int s;
|
||||
};
|
||||
|
||||
struct moviefile_sram_extractor_text : public moviefile::sram_extractor
|
||||
{
|
||||
moviefile_sram_extractor_text(const std::string& filename);
|
||||
~moviefile_sram_extractor_text();
|
||||
std::set<std::string> enumerate();
|
||||
void read(const std::string& name, std::vector<char>& v);
|
||||
private:
|
||||
zip::reader z;
|
||||
};
|
||||
|
||||
struct moviefile_sram_extractor_binary : public moviefile::sram_extractor
|
||||
{
|
||||
moviefile_sram_extractor_binary(const std::string& filename);
|
||||
~moviefile_sram_extractor_binary();
|
||||
std::set<std::string> enumerate();
|
||||
void read(const std::string& name, std::vector<char>& v);
|
||||
private:
|
||||
int s;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue