Compare commits
432 Commits
2.5_202005
...
master
Author | SHA1 | Date |
---|---|---|
kanjitalk755 | d7c030312d | |
kanjitalk755 | be389a9f11 | |
kanjitalk755 | a07cc8ae56 | |
kanjitalk755 | 293ef33a28 | |
kanjitalk755 | 979523b5ca | |
Ger Schinkel | 076390e911 | |
Ger Schinkel | db897d0d42 | |
kanjitalk755 | e12789a57e | |
kanjitalk755 | aa9f112de3 | |
chenchijung | 784ac7bb7e | |
chenchijung | 45e3bd1d3e | |
kanjitalk755 | 08707d3a25 | |
kanjitalk755 | 0a1d9c35bf | |
kanjitalk755 | 3176aa887d | |
kanjitalk755 | 9088a674ad | |
kanjitalk755 | 1d8dd979ab | |
kanjitalk755 | 1ddb7d3a42 | |
kanjitalk755 | e059b64ac8 | |
kanjitalk755 | b6d62c2f14 | |
kanjitalk755 | 9395e119af | |
kanjitalk755 | 021bb50149 | |
kanjitalk755 | 3d49e9790b | |
kanjitalk755 | 19308135c3 | |
kanjitalk755 | 2533f7ac05 | |
kanjitalk755 | 9a7751f1a2 | |
kanjitalk755 | 0942bdcbf9 | |
kanjitalk755 | d2c2647e3a | |
kanjitalk755 | 1d8e348e4b | |
kanjitalk755 | 81bdda2a5b | |
kanjitalk755 | e90180a2c3 | |
kanjitalk755 | a94a41885b | |
kanjitalk755 | 6f94fdd7b0 | |
kanjitalk755 | 51fc1905c4 | |
kanjitalk755 | c4c153c49c | |
kanjitalk755 | d66da33874 | |
kanjitalk755 | c4a22a51d6 | |
kanjitalk755 | 1199f8115e | |
kanjitalk755 | ef3f61c30d | |
kanjitalk755 | 36de3833bf | |
kanjitalk755 | aa6f09ec7a | |
kanjitalk755 | 5739ba9e8a | |
kanjitalk755 | cfec811999 | |
kanjitalk755 | 5915d869fa | |
Wesley Moore | 78a4e7212b | |
kanjitalk755 | 92c4c72000 | |
kanjitalk755 | 0365386fa1 | |
kanjitalk755 | d6112f4a30 | |
kanjitalk755 | ed3decddf1 | |
kanjitalk755 | d4ec4e5323 | |
kanjitalk755 | 1a2d818e47 | |
kanjitalk755 | db877c0443 | |
robxnano | 4217fc73cd | |
kanjitalk755 | b3ebcd595c | |
kanjitalk755 | 3f7896976a | |
robxnano | ae9d917d5e | |
robxnano | 0118e99764 | |
robxnano | cb67534d28 | |
robxnano | f61701df3c | |
robxnano | 4b58ce3ea8 | |
robxnano | c727bc0df7 | |
robxnano | fdeb8617da | |
robxnano | 6da609938e | |
robxnano | aaf67fd59a | |
robxnano | af96a51acb | |
robxnano | bf784a2c30 | |
robxnano | 094995722b | |
robxnano | 604baaa289 | |
robxnano | 2a74fdaab6 | |
robxnano | 1dd1d2713d | |
robxnano | 01ba8564ed | |
robxnano | d284e9976b | |
robxnano | 7482de353b | |
robxnano | 3f00759e54 | |
robxnano | a9d1f35cdf | |
robxnano | 0083bc7ea7 | |
kanjitalk755 | 2fa17a0783 | |
kanjitalk755 | 811dddf70b | |
robxnano | 29d0ea13ae | |
robxnano | 249dfc84ae | |
robxnano | 4c1c549ed6 | |
robxnano | 1b36e7e118 | |
Seg | ffb525800b | |
robxnano | 3b7a89aad9 | |
robxnano | 4724ce7aee | |
robxnano | 95f1d46bae | |
robxnano | 92778586de | |
robxnano | 988eef8c5c | |
robxnano | cfb9d5a501 | |
robxnano | 05adbff2f5 | |
robxnano | 1de48de65d | |
robxnano | 36b2862d21 | |
robxnano | e28a9fc3a9 | |
kanjitalk755 | 6edec590ab | |
kanjitalk755 | 75cdbd1d7b | |
robxnano | bfad0d3bba | |
robxnano | dae2be8c48 | |
robxnano | 177a297527 | |
robxnano | b1ab353085 | |
robxnano | 4ac4cbba45 | |
robxnano | ed86a18497 | |
robxnano | 481b675e1a | |
kanjitalk755 | befe6d2db0 | |
heavysink | 03ed87c966 | |
kanjitalk755 | 4b1bc7c38c | |
kanjitalk755 | 756021f267 | |
kanjitalk755 | 5777129302 | |
kanjitalk755 | d9e0761bd9 | |
kanjitalk755 | 11e88dd94f | |
kanjitalk755 | 41648c23c5 | |
Korkman | d36be9168d | |
Korkman | 4f94ef52c1 | |
kanjitalk755 | f017f9df58 | |
kanjitalk755 | 5900e4895a | |
kanjitalk755 | 9009a2741f | |
kanjitalk755 | d7e93d8f37 | |
kanjitalk755 | 2e9eea3201 | |
Leon | d03303cdf7 | |
Leon | b4be0cdbb2 | |
kanjitalk755 | 45578ddd45 | |
Ger Schinkel | e933e7885f | |
Ger Schinkel | 2666bef882 | |
Ger Schinkel | 81ccbfa1e7 | |
kanjitalk755 | a66b73a516 | |
Ger Schinkel | 425dac6a7c | |
kanjitalk755 | d4baa318e4 | |
asvitkine | 1f5465ad77 | |
kanjitalk755 | fcf2c1d9b6 | |
kanjitalk755 | 0f7f1543ed | |
asvitkine | 732029a512 | |
asvitkine | 3b1868ae56 | |
kanjitalk755 | 86665c4c30 | |
kanjitalk755 | 6285165090 | |
asvitkine | 789a39a2c6 | |
asvitkine | 2ea84d86c7 | |
asvitkine | e069d84f5b | |
kanjitalk755 | f07b34a451 | |
kanjitalk755 | 33c3419b08 | |
kanjitalk755 | c359aabc2d | |
kanjitalk755 | d993158df8 | |
kanjitalk755 | 2a5ac90370 | |
kanjitalk755 | d05e5ab711 | |
kanjitalk755 | 88a1fb2921 | |
Doug Brown | 44f6eff928 | |
kanjitalk755 | a3534d2eea | |
Doug Brown | f1502fb6bd | |
kanjitalk755 | a5064455cb | |
kanjitalk755 | f385c22ed2 | |
kanjitalk755 | ad6047ea24 | |
kanjitalk755 | a722785575 | |
kanjitalk755 | b2df4fed1f | |
kanjitalk755 | ab586a5a09 | |
kanjitalk755 | 90edd35246 | |
kanjitalk755 | cce0ed4c87 | |
kanjitalk755 | 763fe81f0d | |
kanjitalk755 | 0538eb0cc0 | |
kanjitalk755 | 56343905e3 | |
kanjitalk755 | ef2f8724fe | |
kanjitalk755 | 15f56749ba | |
kanjitalk755 | ea3832423c | |
aarojun | d346521b92 | |
aarojun | 9621850735 | |
aarojun | 4d16bb88b4 | |
aarojun | 42e70e85c6 | |
aarojun | 6385243609 | |
aarojun | bdcc9d2da4 | |
kanjitalk755 | 1de3d694f2 | |
aarojun | ac68d68920 | |
aarojun | 5d1bfd1059 | |
aarojun | e9a9573a20 | |
aarojun | c28a00f58a | |
kanjitalk755 | 420dc1d504 | |
kanjitalk755 | ba89fc7a72 | |
kanjitalk755 | 78fdb44d02 | |
kanjitalk755 | bc9c7675f9 | |
kanjitalk755 | caf10f1223 | |
kanjitalk755 | 5862662bc9 | |
kanjitalk755 | e42b8f6076 | |
kanjitalk755 | ce00063701 | |
kanjitalk755 | 164aa8c3fe | |
kanjitalk755 | 9cf0c98dd6 | |
kanjitalk755 | 1d710a0cad | |
kanjitalk755 | 1aaeaf05c4 | |
kanjitalk755 | 65028aec4a | |
kanjitalk755 | 8a28ad6e39 | |
kanjitalk755 | 4f0743562e | |
kanjitalk755 | 49eee29597 | |
kanjitalk755 | 20d2de95ce | |
kanjitalk755 | a39eff553c | |
kanjitalk755 | e750aecafe | |
kanjitalk755 | 72989fffe2 | |
Matthias Weiß | 176da65363 | |
kanjitalk755 | 8064215081 | |
kanjitalk755 | 7471c357c3 | |
kanjitalk755 | ce3e2f3693 | |
kanjitalk755 | 6d3fbba4cd | |
kanjitalk755 | 65772919a1 | |
kanjitalk755 | 623abaa243 | |
kanjitalk755 | 2e5654e583 | |
kanjitalk755 | 2f1f196251 | |
kanjitalk755 | 39cbc73a9f | |
kanjitalk755 | e75d2ca5d6 | |
kanjitalk755 | 09046e0a2f | |
kanjitalk755 | 4cf65a3faf | |
kanjitalk755 | fbddf063cb | |
kanjitalk755 | 89e8a05815 | |
kanjitalk755 | 556ec0cf80 | |
kanjitalk755 | 8ebc4c90c3 | |
kanjitalk755 | 73fc469c4c | |
Glenn Anderson | 5620ef8c43 | |
kanjitalk755 | b539de9753 | |
kanjitalk755 | 3f4eed670f | |
kanjitalk755 | 0fd17a98ff | |
Seg | 69bf439fac | |
Seg | 144b117886 | |
Seg | 6d92f13bcd | |
Seg | cad8df587d | |
Seg | eb9142ac14 | |
Seg | 0c8529eca1 | |
kanjitalk755 | 436c5df15f | |
kanjitalk755 | cadd3350ea | |
rakslice | f198632834 | |
rakslice | 85f8971d8d | |
rakslice | 497b5bc5a9 | |
rakslice | e00c6f2091 | |
kanjitalk755 | b6725730f5 | |
kanjitalk755 | 6f6e9b8d82 | |
asvitkine | d684527b27 | |
asvitkine | 6c38946bf0 | |
kanjitalk755 | 0d213f9d00 | |
kanjitalk755 | c151e24bb8 | |
kanjitalk755 | 6a88d08551 | |
kanjitalk755 | a179f00a62 | |
rakslice | 62081d50d1 | |
rakslice | faeb5fa2e1 | |
rakslice | ff0a825356 | |
rakslice | 6d74ff5600 | |
rakslice | 5163e17f14 | |
rakslice | a1ef6be18a | |
rakslice | a453ae105a | |
rakslice | d7215df688 | |
rakslice | cff2024c2e | |
rakslice | 0df082d4e1 | |
rakslice | 991496a4f4 | |
rakslice | c0ceb74931 | |
kanjitalk755 | d547db0648 | |
kanjitalk755 | d0b3dcd623 | |
kanjitalk755 | 271b7322d3 | |
rakslice | 6b4cc38de6 | |
rakslice | c8c1a76381 | |
rakslice | af8e91f446 | |
kanjitalk755 | b1a7f71ef4 | |
rakslice | a897561c11 | |
rakslice | 85da18e38f | |
rakslice | c044312b3c | |
rakslice | 0a79f5d1b1 | |
kanjitalk755 | 6c20f2c4d9 | |
kanjitalk755 | 87d4660aa6 | |
rakslice | 0b9b6401d6 | |
kanjitalk755 | 3ce86cee1f | |
rakslice | a14362b183 | |
kanjitalk755 | cc5d99431f | |
rakslice | 1892cf0a7e | |
kanjitalk755 | 73f194f422 | |
kanjitalk755 | 232efdaa8c | |
kanjitalk755 | edf8d14f09 | |
kanjitalk755 | 83d7702f28 | |
kanjitalk755 | 43cb7718e6 | |
kanjitalk755 | d20ba5d179 | |
kanjitalk755 | dd9cfec0e7 | |
kanjitalk755 | 02c037b5cb | |
rakslice | ca9191fcb1 | |
rakslice | 561f1dfcde | |
kanjitalk755 | 9708089c1e | |
rakslice | 37b36ef332 | |
kanjitalk755 | 4e98699ee1 | |
kanjitalk755 | be17ba9044 | |
kanjitalk755 | 7313b0284c | |
kanjitalk755 | d851a65548 | |
Seth Polsley | 6de9a5032d | |
kanjitalk755 | 21c16f991e | |
kanjitalk755 | 3cf23176f6 | |
Seth Polsley | 25e2d4af6f | |
Seth Polsley | 40e2d3d84b | |
Seth Polsley | 833f21c225 | |
Seth Polsley | 2a904af8e7 | |
Seth Polsley | 177555e0d1 | |
kanjitalk755 | 95437fbf89 | |
kanjitalk755 | 09429e6021 | |
Seth Polsley | 07880c76ed | |
kanjitalk755 | 98e12fbc2e | |
kanjitalk755 | d58aa827a4 | |
kanjitalk755 | 722b777ee8 | |
kanjitalk755 | 3861177919 | |
kanjitalk755 | 6f87eaca84 | |
rakslice | 92a1ee2128 | |
rakslice | 4b93738773 | |
kanjitalk755 | ec032ffd75 | |
kanjitalk755 | 64b38dbec8 | |
Adam Sampson | 413190d12f | |
Adam Sampson | 0eae77599e | |
Adam Sampson | 4da2082c07 | |
uyjulian | bb5caf093a | |
kanjitalk755 | 565c133662 | |
rakslice | e5c4699923 | |
rakslice | 639f05da7e | |
Seth Polsley | d853f9abae | |
rakslice | ba111a5cb7 | |
rakslice | bb080a262e | |
rakslice | b4b652d696 | |
rakslice | d1fcff0a08 | |
rakslice | 792ad5ccff | |
rakslice | ffee1ebad2 | |
kanjitalk755 | 6985ad67fe | |
kanjitalk755 | 630f4ffafb | |
kanjitalk755 | 1f2b35fef2 | |
kanjitalk755 | d906fb23b0 | |
kanjitalk755 | 7c6b9a67f6 | |
kanjitalk755 | 1da83854b0 | |
asvitkine | 29bb3d5a5a | |
Ricky Zhang | 13017f711f | |
Ricky Zhang | 82524ba034 | |
Ricky Zhang | 2e96512f26 | |
Ricky Zhang | 5f1b41eb42 | |
Ricky Zhang | 03ebc5375b | |
asvitkine | 8f12a0fffb | |
Ricky Zhang | 7513fab5ad | |
Ricky Zhang | 342fbbce34 | |
kanjitalk755 | 5b31736785 | |
Seth Polsley | 478fc39650 | |
Seth Polsley | d7fb0ac298 | |
Seth Polsley | 8124b61d2b | |
Seth Polsley | 4191a86895 | |
Seth Polsley | c7a7e034ed | |
Seth Polsley | 2c8678417c | |
Seth Polsley | 059d88ce75 | |
Seth Polsley | 12ac0d3032 | |
Seth Polsley | ed5f7f22b8 | |
Seth Polsley | 7441d04a28 | |
Seth Polsley | 3e32a6da32 | |
Seth Polsley | 47fca465ba | |
Seth Polsley | 084a8fbd74 | |
Seth Polsley | 1775fb3776 | |
Seth Polsley | 80399941b2 | |
Seth Polsley | a5e7e80cda | |
Seth Polsley | c3ccdcec5d | |
Seth Polsley | 30cf26e1f6 | |
Seth Polsley | 66a69dc79b | |
asvitkine | 6d522db16c | |
asvitkine | 245da3b142 | |
Ricky Zhang | 89bcd3dc3e | |
Ricky Zhang | 2595059146 | |
Ricky Zhang | bae7a4d16b | |
Ricky Zhang | e63c6b91dc | |
Ricky Zhang | 40f6c77775 | |
Ricky Zhang | 7e83b9c49e | |
asvitkine | a21ad0d7c4 | |
Ricky Zhang | 98f3cab953 | |
asvitkine | ef57fd2c5f | |
Ricky Zhang | 6f4da45eeb | |
asvitkine | 864b4a1652 | |
asvitkine | b49d9b7485 | |
asvitkine | 03f5cc8c79 | |
Ricky Zhang | 0b38469385 | |
Ricky Zhang | d30528795b | |
Ricky Zhang | bdf5a276d3 | |
Ricky Zhang | 56665d30a3 | |
asvitkine | 16081b2878 | |
Ricky Zhang | 18701c97df | |
Ricky Zhang | 8e88e462ee | |
Ricky Zhang | e6cd178881 | |
Ricky Zhang | 1bfb0e94a3 | |
Ricky Zhang | 9ef2f87adb | |
Ricky Zhang | dc8bb7e2a3 | |
Ricky Zhang | d28599f49d | |
Ricky Zhang | a46759990d | |
asvitkine | 5cbf07e9f5 | |
Ricky Zhang | b0bdceac34 | |
asvitkine | b2d281e5ab | |
Antoine Viallon | f13f25db3e | |
kanjitalk755 | 607f4ed354 | |
kanjitalk755 | 9895200f79 | |
asvitkine | cbad6f95ea | |
asvitkine | 9a905723db | |
Roland Illig | 8a4b84b9d7 | |
asvitkine | 7790aa7e0c | |
bolt | 5670c82b0d | |
bolt | c6e1af7ff4 | |
bolt | 767b97311b | |
asvitkine | a4a2c88ed7 | |
asvitkine | 1918557e78 | |
anabate123 | 00f02d9d0c | |
Simon Howard | 507508b66d | |
uyjulian | 36b6d0769b | |
uyjulian | cfcfde0480 | |
uyjulian | 63ddee1be1 | |
uyjulian | 9dc485c56a | |
uyjulian | 67dd2e6676 | |
uyjulian | 03fc337242 | |
uyjulian | 28bc58ccd2 | |
uyjulian | 48a41966fd | |
uyjulian | 730ca109b7 | |
uyjulian | fcdfd2f799 | |
asvitkine | 01052ca89d | |
asvitkine | 9a3bd0b258 | |
Vladimir Serbinenko | 6267af0315 | |
Adam Sampson | 668c2ba107 | |
asvitkine | 143b0827dd | |
Adam Sampson | 5d77f86575 | |
asvitkine | 507813529e | |
MSharq | e583d05868 | |
MSharq | 242e8af3a7 | |
MSharq | 2bc581d4f6 | |
MSharq | cf406ec953 | |
Christian Bauer | 76c5a97efe | |
Christian Bauer | ddf1bcf094 | |
MSharq | 0c622863cf | |
MSharq | 30fdd103a2 | |
MSharq | 50c98de60f | |
MSharq | 320fae37a4 | |
MSharq | e4332cc72a | |
asvitkine | 5f04c95b79 | |
asvitkine | f7023246d9 | |
MSharq | 90b65715ae | |
uyjulian | 8c0a84c536 | |
uyjulian | e99d4e579c | |
uyjulian | 8353a9ed44 | |
uyjulian | 77e20bda2a | |
uyjulian | 1758ef58b5 | |
uyjulian | 1bf6e93461 | |
uyjulian | 023251dee1 | |
uyjulian | 76d285a6f2 | |
uyjulian | c4b1b1937e |
20
.travis.yml
20
.travis.yml
|
@ -1,20 +0,0 @@
|
|||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl1.2-dev
|
||||
- libgtk2.0-dev
|
||||
|
||||
script:
|
||||
- cd BasiliskII/src/Unix
|
||||
- NO_CONFIGURE=1 ./autogen.sh
|
||||
- ./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon
|
||||
- make -j 4
|
|
@ -274,13 +274,20 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
|
|||
#define SIGSEGV_REGISTER_FILE ((unsigned long *)SIGSEGV_CONTEXT_REGS), SIGSEGV_SPARC_GWINDOWS, SIGSEGV_SPARC_RWINDOW
|
||||
#define SIGSEGV_SKIP_INSTRUCTION sparc_skip_instruction
|
||||
#endif
|
||||
#if defined(__i386__)
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
#include <sys/regset.h>
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[EIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#endif
|
||||
#if (defined(x86_64) || defined(__x86_64__))
|
||||
#include <sys/regset.h>
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
|
@ -302,6 +309,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
|
|||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_EIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
#include <sys/ucontext.h>
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.__gregs)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_RIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#endif
|
||||
#if (defined(powerpc) || defined(__powerpc__))
|
||||
#include <sys/ucontext.h>
|
||||
|
@ -323,12 +336,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
|
|||
#endif
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[14] /* should use REG_EIP instead */
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_EIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[16] /* should use REG_RIP instead */
|
||||
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
|
||||
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
|
||||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#elif (defined(ia64) || defined(__ia64__))
|
||||
|
@ -346,6 +359,11 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
|
|||
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.arm_pc)
|
||||
#define SIGSEGV_REGISTER_FILE (&SIGSEGV_CONTEXT_REGS.arm_r0)
|
||||
#define SIGSEGV_SKIP_INSTRUCTION arm_skip_instruction
|
||||
#elif (defined(aarch64) || defined(__aarch64__))
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.pc)
|
||||
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&SIGSEGV_CONTEXT_REGS.regs)
|
||||
#define SIGSEGV_SKIP_INSTRUCTION aarch64_skip_instruction
|
||||
#elif (defined(mips) || defined(__mips__))
|
||||
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext)
|
||||
#define SIGSEGV_FAULT_INSTRUCTION (SIGSEGV_CONTEXT_REGS.pc)
|
||||
|
@ -747,38 +765,37 @@ handleExceptions(void *priv)
|
|||
|
||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||
// Decode and skip X86 instruction
|
||||
#if (defined(i386) || defined(__i386__) || defined(_M_IX86)) || (defined(__x86_64__) || defined(_M_X64))
|
||||
#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64))
|
||||
#if defined(__linux__)
|
||||
enum {
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
X86_REG_EIP = 14,
|
||||
X86_REG_EAX = 11,
|
||||
X86_REG_ECX = 10,
|
||||
X86_REG_EDX = 9,
|
||||
X86_REG_EBX = 8,
|
||||
X86_REG_ESP = 7,
|
||||
X86_REG_EBP = 6,
|
||||
X86_REG_ESI = 5,
|
||||
X86_REG_EDI = 4
|
||||
#endif
|
||||
#if defined(__x86_64__)
|
||||
X86_REG_R8 = 0,
|
||||
X86_REG_R9 = 1,
|
||||
X86_REG_R10 = 2,
|
||||
X86_REG_R11 = 3,
|
||||
X86_REG_R12 = 4,
|
||||
X86_REG_R13 = 5,
|
||||
X86_REG_R14 = 6,
|
||||
X86_REG_R15 = 7,
|
||||
X86_REG_EDI = 8,
|
||||
X86_REG_ESI = 9,
|
||||
X86_REG_EBP = 10,
|
||||
X86_REG_EBX = 11,
|
||||
X86_REG_EDX = 12,
|
||||
X86_REG_EAX = 13,
|
||||
X86_REG_ECX = 14,
|
||||
X86_REG_ESP = 15,
|
||||
X86_REG_EIP = 16
|
||||
X86_REG_EIP = REG_EIP,
|
||||
X86_REG_EAX = REG_EAX,
|
||||
X86_REG_ECX = REG_ECX,
|
||||
X86_REG_EDX = REG_EDX,
|
||||
X86_REG_EBX = REG_EBX,
|
||||
X86_REG_ESP = REG_ESP,
|
||||
X86_REG_EBP = REG_EBP,
|
||||
X86_REG_ESI = REG_ESI,
|
||||
X86_REG_EDI = REG_EDI
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
X86_REG_R8 = REG_R8,
|
||||
X86_REG_R9 = REG_R9,
|
||||
X86_REG_R10 = REG_R10,
|
||||
X86_REG_R11 = REG_R11,
|
||||
X86_REG_R12 = REG_R12,
|
||||
X86_REG_R13 = REG_R13,
|
||||
X86_REG_R14 = REG_R14,
|
||||
X86_REG_R15 = REG_R15,
|
||||
X86_REG_EDI = REG_RDI,
|
||||
X86_REG_ESI = REG_RSI,
|
||||
X86_REG_EBP = REG_RBP,
|
||||
X86_REG_EBX = REG_RBX,
|
||||
X86_REG_EDX = REG_RDX,
|
||||
X86_REG_EAX = REG_RAX,
|
||||
X86_REG_ECX = REG_RCX,
|
||||
X86_REG_ESP = REG_RSP,
|
||||
X86_REG_EIP = REG_RIP
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -794,6 +811,24 @@ enum {
|
|||
X86_REG_EBP = _REG_EBP,
|
||||
X86_REG_ESI = _REG_ESI,
|
||||
X86_REG_EDI = _REG_EDI
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
X86_REG_EIP = _REG_RIP,
|
||||
X86_REG_EAX = _REG_RAX,
|
||||
X86_REG_ECX = _REG_RCX,
|
||||
X86_REG_EDX = _REG_RDX,
|
||||
X86_REG_EBX = _REG_RBX,
|
||||
X86_REG_ESP = _REG_RSP,
|
||||
X86_REG_EBP = _REG_RBP,
|
||||
X86_REG_ESI = _REG_RSI,
|
||||
X86_REG_EDI = _REG_RDI,
|
||||
X86_REG_R8 = _REG_R8,
|
||||
X86_REG_R9 = _REG_R9,
|
||||
X86_REG_R10 = _REG_R10,
|
||||
X86_REG_R11 = _REG_R11,
|
||||
X86_REG_R12 = _REG_R12,
|
||||
X86_REG_R13 = _REG_R13,
|
||||
X86_REG_R14 = _REG_R14,
|
||||
X86_REG_R15 = _REG_R15
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -809,8 +844,7 @@ enum {
|
|||
X86_REG_EBP = 2,
|
||||
X86_REG_ESI = 1,
|
||||
X86_REG_EDI = 0
|
||||
#endif
|
||||
#if (defined(x86_64) || defined(__x86_64__))
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
X86_REG_EDI = 0,
|
||||
X86_REG_ESI = 1,
|
||||
X86_REG_EDX = 2,
|
||||
|
@ -833,7 +867,7 @@ enum {
|
|||
#endif
|
||||
#if defined(__OpenBSD__)
|
||||
enum {
|
||||
#if defined(__i386__)
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
// EDI is the first register we consider
|
||||
#define OREG(REG) offsetof(struct sigcontext, sc_##REG)
|
||||
#define DREG(REG) ((OREG(REG) - OREG(edi)) / 4)
|
||||
|
@ -854,7 +888,7 @@ enum {
|
|||
#if defined(__sun__)
|
||||
// Same as for Linux, need to check for x86-64
|
||||
enum {
|
||||
#if defined(__i386__)
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
X86_REG_EIP = EIP,
|
||||
X86_REG_EAX = EAX,
|
||||
X86_REG_ECX = ECX,
|
||||
|
@ -864,6 +898,24 @@ enum {
|
|||
X86_REG_EBP = EBP,
|
||||
X86_REG_ESI = ESI,
|
||||
X86_REG_EDI = EDI
|
||||
#elif (defined(x86_64) || defined(__x86_64__))
|
||||
X86_REG_R8 = REG_R8,
|
||||
X86_REG_R9 = REG_R9,
|
||||
X86_REG_R10 = REG_R10,
|
||||
X86_REG_R11 = REG_R11,
|
||||
X86_REG_R12 = REG_R12,
|
||||
X86_REG_R13 = REG_R13,
|
||||
X86_REG_R14 = REG_R14,
|
||||
X86_REG_R15 = REG_R15,
|
||||
X86_REG_EDI = REG_RDI,
|
||||
X86_REG_ESI = REG_RSI,
|
||||
X86_REG_EBP = REG_RBP,
|
||||
X86_REG_EBX = REG_RBX,
|
||||
X86_REG_EDX = REG_RDX,
|
||||
X86_REG_EAX = REG_RAX,
|
||||
X86_REG_ECX = REG_RCX,
|
||||
X86_REG_ESP = REG_RSP,
|
||||
X86_REG_EIP = REG_RIP
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -1018,6 +1070,15 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs)
|
|||
transfer_size = SIZE_WORD;
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
// Address size override
|
||||
if (*eip == 0x67) {
|
||||
// 32-bit address
|
||||
eip++;
|
||||
len++;
|
||||
}
|
||||
#endif
|
||||
|
||||
// REX prefix
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
struct rex_t {
|
||||
|
@ -2499,6 +2560,22 @@ static bool arm_skip_instruction(unsigned long * regs)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef _STRUCT_ARM_THREAD_STATE64
|
||||
static bool aarch64_skip_instruction(unsigned long *regs) {
|
||||
_STRUCT_ARM_THREAD_STATE64 *ts = (_STRUCT_ARM_THREAD_STATE64 *)regs;
|
||||
if (!ts->__pc) return false;
|
||||
ts->__pc += 4;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
static bool aarch64_skip_instruction(unsigned long *regs) {
|
||||
unsigned long long *r = (unsigned long long *)regs;
|
||||
if (!r[32]) return false;
|
||||
r[32] += 4;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fallbacks
|
||||
#ifndef SIGSEGV_FAULT_ADDRESS_FAST
|
||||
|
@ -3230,7 +3307,7 @@ static sigsegv_return_t sigsegv_insn_handler(sigsegv_info_t *sip)
|
|||
// More sophisticated tests for instruction skipper
|
||||
static bool arch_insn_skipper_tests()
|
||||
{
|
||||
#if (defined(i386) || defined(__i386__)) || (defined(__x86_64__) || defined(_M_X64))
|
||||
#if (defined(i386) || defined(__i386__) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64))
|
||||
static const unsigned char code[] = {
|
||||
0x8a, 0x00, // mov (%eax),%al
|
||||
0x8a, 0x2c, 0x18, // mov (%eax,%ebx,1),%ch
|
||||
|
@ -3244,7 +3321,7 @@ static bool arch_insn_skipper_tests()
|
|||
0x8b, 0x0c, 0x18, // mov (%eax,%ebx,1),%ecx
|
||||
0x89, 0x00, // mov %eax,(%eax)
|
||||
0x89, 0x0c, 0x18, // mov %ecx,(%eax,%ebx,1)
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#if defined(x86_64) || defined(__x86_64__) || defined(_M_X64)
|
||||
0x44, 0x8a, 0x00, // mov (%rax),%r8b
|
||||
0x44, 0x8a, 0x20, // mov (%rax),%r12b
|
||||
0x42, 0x8a, 0x3c, 0x10, // mov (%rax,%r10,1),%dil
|
||||
|
|
|
@ -105,6 +105,22 @@ extern "C" {
|
|||
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
|
||||
#define SIGSEGV_REGISTER_FILE ((SIGSEGV_REGISTER_TYPE *)&SIP->thr_state.MACH_FIELD_NAME(rax)) /* RAX is the first GPR we consider */
|
||||
#endif
|
||||
|
||||
#ifdef __aarch64__
|
||||
#if __DARWIN_UNIX03 && defined _STRUCT_ARM_THREAD_STATE64
|
||||
#define MACH_FIELD_NAME(X) __CONCAT(__,X)
|
||||
#endif
|
||||
#define SIGSEGV_EXCEPTION_STATE_TYPE arm_exception_state64_t
|
||||
#define SIGSEGV_EXCEPTION_STATE_FLAVOR ARM_EXCEPTION_STATE64
|
||||
#define SIGSEGV_EXCEPTION_STATE_COUNT ARM_EXCEPTION_STATE64_COUNT
|
||||
#define SIGSEGV_FAULT_ADDRESS SIP->exc_state.MACH_FIELD_NAME(far)
|
||||
#define SIGSEGV_THREAD_STATE_TYPE arm_thread_state64_t
|
||||
#define SIGSEGV_THREAD_STATE_FLAVOR ARM_THREAD_STATE64
|
||||
#define SIGSEGV_THREAD_STATE_COUNT ARM_THREAD_STATE64_COUNT
|
||||
#define SIGSEGV_REGISTER_FILE ((SIGSEGV_REGISTER_TYPE *)&SIP->thr_state.MACH_FIELD_NAME(x[0])) /* x[0] is the first GPR we consider */
|
||||
#define SIGSEGV_SKIP_INSTRUCTION aarch64_skip_instruction
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define SIGSEGV_FAULT_ADDRESS_FAST (((uint64_t)code[1])|0x100000000)
|
||||
#else
|
||||
|
|
|
@ -305,6 +305,7 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length)
|
|||
#define FB_DEPTH 24
|
||||
#include "video_blit.h"
|
||||
|
||||
#if !(REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* --- 1-bit indexed to 8-bit color mode conversion --- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -325,6 +326,7 @@ static void Blit_Expand_1_To_8_Color(uint8 * dest, const uint8 * p, uint32 lengt
|
|||
*q++ = CONVERT_BW(c & 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* --- 1/2/4-bit indexed to 8-bit mode conversion --- */
|
||||
|
@ -507,7 +509,11 @@ static Screen_blit_func_info Screen_blitters[] = {
|
|||
{ 16, 0x00f800, 0x0007e0, 0x00001f, Blit_RGB565_NBO , Blit_RGB565_OBO }, // OK (NBO)
|
||||
{ 24, 0xff0000, 0x00ff00, 0x0000ff, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
|
||||
{ 24, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT
|
||||
#ifdef ENABLE_VOSF
|
||||
{ 32, 0xff0000, 0x00ff00, 0x0000ff, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
|
||||
#else
|
||||
{ 32, 0xff000000, 0x00ff0000, 0x0000ff00, Blit_RGB888_NBO , Blit_Copy_Raw }, // OK (NBO)
|
||||
#endif
|
||||
{ 32, 0x0000ff, 0x00ff00, 0xff0000, Blit_BGR888_NBO , Blit_BGR888_OBO }, // NT
|
||||
#endif
|
||||
{ 32, 0xff00, 0xff0000, 0xff000000, Blit_Copy_Raw , Blit_Copy_Raw } // OK
|
||||
|
@ -529,9 +535,7 @@ bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_or
|
|||
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines
|
||||
Screen_blit = Blit_Copy_Raw;
|
||||
|
||||
#if __MACOSX__ && !defined(SHEEPSHAVER)
|
||||
// dludwig@pobox.com, HACK: This works on OSX (64-bit, at least), but not Linux (32-bit?). Why?
|
||||
// To note, __MACOSX__ is an SDL-declared macro (for platform identification at compile time).
|
||||
#if !DIRECT_ADDRESSING && defined(__aarch64__)
|
||||
} else if (mac_depth == 16) {
|
||||
|
||||
Screen_blit = Blit_Copy_Raw;
|
||||
|
|
|
@ -540,6 +540,7 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
|
|||
|
||||
#ifndef TEST_VOSF_PERFORMANCE
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
|
||||
static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
||||
{
|
||||
VIDEO_MODE_INIT;
|
||||
|
@ -574,8 +575,10 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
|||
const uint32 n_pixels = 64;
|
||||
const uint32 n_chunks = VIDEO_MODE_X / n_pixels;
|
||||
const uint32 n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels);
|
||||
const uint32 src_chunk_size = src_bytes_per_row / n_chunks;
|
||||
const uint32 dst_chunk_size = dst_bytes_per_row / n_chunks;
|
||||
const uint32 src_chunk_size = TrivialBytesPerRow(n_pixels, VIDEO_MODE_DEPTH);
|
||||
const uint32 dst_chunk_size = TrivialBytesPerRow(n_pixels, DepthModeForPixelDepth(VIDEO_DRV_DEPTH));
|
||||
assert(src_chunk_size * n_chunks <= src_bytes_per_row);
|
||||
assert(dst_chunk_size * n_chunks <= dst_bytes_per_row);
|
||||
const uint32 src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size);
|
||||
const uint32 dst_chunk_size_left = dst_bytes_per_row - (n_chunks * dst_chunk_size);
|
||||
|
||||
|
@ -643,8 +646,6 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
|||
memcpy(the_buffer_copy + i1, the_buffer + i1, src_chunk_size_left);
|
||||
Screen_blit(the_host_buffer + i2, the_buffer + i1, src_chunk_size_left);
|
||||
}
|
||||
i1 += src_chunk_size_left;
|
||||
i2 += dst_chunk_size_left;
|
||||
#ifdef USE_SDL_VIDEO
|
||||
const int x = n_chunks * n_pixels;
|
||||
if (x < bb[bbi].x) {
|
||||
|
@ -658,7 +659,8 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
|||
bb[bbi].w = x + n_pixels_left - bb[bbi].x;
|
||||
#endif
|
||||
}
|
||||
i2 += scr_bytes_left;
|
||||
i1 += src_chunk_size_left;
|
||||
i2 += dst_chunk_size_left + scr_bytes_left;
|
||||
#ifdef USE_SDL_VIDEO
|
||||
bb[bbi].h++;
|
||||
if (bb[bbi].w && (j == y1 || j == y2 - 1 || j == y2)) {
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include "vm_alloc.h"
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
|
@ -71,7 +72,7 @@ typedef unsigned long vm_uintptr_t;
|
|||
#ifndef MAP_32BIT
|
||||
#define MAP_32BIT 0
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#define FORCE_MAP_32BIT MAP_FIXED
|
||||
#else
|
||||
#define FORCE_MAP_32BIT MAP_32BIT
|
||||
|
@ -86,7 +87,7 @@ typedef unsigned long vm_uintptr_t;
|
|||
#define MAP_EXTRA_FLAGS (MAP_32BIT)
|
||||
|
||||
#ifdef HAVE_MMAP_VM
|
||||
#if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) || HAVE_LINKER_SCRIPT
|
||||
#if (defined(__linux__) && defined(__i386__)) || defined(__sun__) || defined(__FreeBSD__) || defined(__NetBSD__) || HAVE_LINKER_SCRIPT
|
||||
/* Force a reasonnable address below 0x80000000 on x86 so that we
|
||||
don't get addresses above when the program is run on AMD64.
|
||||
NOTE: this is empirically determined on Linux/x86. */
|
||||
|
@ -222,6 +223,21 @@ void vm_exit(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void *reserved_buf;
|
||||
static const size_t RESERVED_SIZE = 80 * 1024 * 1024; // for 6K Retina
|
||||
|
||||
void *vm_acquire_reserved(size_t size) {
|
||||
assert(reserved_buf && size <= RESERVED_SIZE);
|
||||
return reserved_buf;
|
||||
}
|
||||
|
||||
int vm_init_reserved(void *hostAddress) {
|
||||
int result = vm_acquire_fixed(hostAddress, RESERVED_SIZE);
|
||||
if (result >= 0)
|
||||
reserved_buf = hostAddress;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Allocate zero-filled memory of SIZE bytes. The mapping is private
|
||||
and default protection bits are read / write. The return value
|
||||
is the actual mapping address chosen or VM_MAP_FAILED for errors. */
|
||||
|
@ -243,22 +259,30 @@ void * vm_acquire(size_t size, int options)
|
|||
|
||||
#if defined(HAVE_MACH_VM)
|
||||
// vm_allocate() returns a zero-filled memory region
|
||||
kern_return_t ret_code = vm_allocate(mach_task_self(), (vm_address_t *)&addr, size, TRUE);
|
||||
kern_return_t ret_code = vm_allocate(mach_task_self(), (vm_address_t *)&addr, reserved_buf ? size : size + RESERVED_SIZE, TRUE);
|
||||
if (ret_code != KERN_SUCCESS) {
|
||||
errno = vm_error(ret_code);
|
||||
return VM_MAP_FAILED;
|
||||
}
|
||||
if (!reserved_buf)
|
||||
reserved_buf = (char *)addr + size;
|
||||
#elif defined(HAVE_MMAP_VM)
|
||||
int fd = zero_fd;
|
||||
int the_map_flags = translate_map_flags(options) | map_flags;
|
||||
|
||||
#ifdef __aarch64__
|
||||
if ((addr = mmap((caddr_t)next_address, reserved_buf ? size : size + RESERVED_SIZE, VM_PAGE_DEFAULT, the_map_flags, fd, 0)) == (void *)MAP_FAILED)
|
||||
return VM_MAP_FAILED;
|
||||
if (!reserved_buf)
|
||||
reserved_buf = (char *)addr + size;
|
||||
#else
|
||||
if ((addr = mmap((caddr_t)next_address, size, VM_PAGE_DEFAULT, the_map_flags, fd, 0)) == (void *)MAP_FAILED)
|
||||
return VM_MAP_FAILED;
|
||||
|
||||
#endif
|
||||
#if USE_JIT
|
||||
// Sanity checks for 64-bit platforms
|
||||
if (sizeof(void *) == 8 && (options & VM_MAP_32BIT) && !((char *)addr <= (char *)0xffffffff))
|
||||
return VM_MAP_FAILED;
|
||||
|
||||
#endif
|
||||
next_address = (char *)addr + size;
|
||||
#elif defined(HAVE_WIN32_VM)
|
||||
int alloc_type = MEM_RESERVE | MEM_COMMIT;
|
||||
|
|
|
@ -99,6 +99,10 @@ extern void vm_exit(void);
|
|||
|
||||
extern void * vm_acquire(size_t size, int options = VM_MAP_DEFAULT);
|
||||
|
||||
extern void * vm_acquire_reserved(size_t size);
|
||||
|
||||
extern int vm_init_reserved(void * host_address);
|
||||
|
||||
/* Allocate zero-filled memory at exactly ADDR (which must be page-aligned).
|
||||
Returns 0 if successful, -1 on errors. */
|
||||
|
||||
|
|
|
@ -7,22 +7,11 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5DDE95192255D076004D0E79 /* AudioDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DDE95132255D076004D0E79 /* AudioDevice.cpp */; };
|
||||
5DDE951A2255D076004D0E79 /* audio_macosx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DDE95152255D076004D0E79 /* audio_macosx.cpp */; };
|
||||
5DDE951B2255D076004D0E79 /* MacOSX_sound_if.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DDE95162255D076004D0E79 /* MacOSX_sound_if.cpp */; };
|
||||
5DDE951C2255D076004D0E79 /* AudioBackEnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DDE95172255D076004D0E79 /* AudioBackEnd.cpp */; };
|
||||
5DDE951E2255D0A9004D0E79 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDE951D2255D0A9004D0E79 /* CoreAudio.framework */; };
|
||||
5DDE95202255D0B6004D0E79 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDE951F2255D0B6004D0E79 /* AudioToolbox.framework */; };
|
||||
5DDE95222255D0C2004D0E79 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDE95212255D0C2004D0E79 /* AudioUnit.framework */; };
|
||||
5D5C3B0A24B2DF3500CDAB41 /* bincue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D5C3B0924B2DF3400CDAB41 /* bincue.cpp */; };
|
||||
752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752F26F81F240E51001032B4 /* Foundation.framework */; };
|
||||
752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752F26FA1F240E69001032B4 /* IOKit.framework */; };
|
||||
752F27011F242BAF001032B4 /* prefs_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 752F27001F242BAF001032B4 /* prefs_sdl.cpp */; };
|
||||
752F27031F242F51001032B4 /* xpram_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 752F27021F242F51001032B4 /* xpram_sdl.cpp */; };
|
||||
753253311F5368370024025B /* cpuemu_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532C1F5368370024025B /* cpuemu_nf.cpp */; };
|
||||
753253321F5368370024025B /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532D1F5368370024025B /* cpuemu.cpp */; };
|
||||
753253331F5368370024025B /* cpustbl_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532E1F5368370024025B /* cpustbl_nf.cpp */; };
|
||||
753253341F5368370024025B /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7532532F1F5368370024025B /* cpustbl.cpp */; };
|
||||
753253351F53688D0024025B /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */; };
|
||||
7539E1251F23B25A006B2DF2 /* adb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFC91F23B25A006B2DF2 /* adb.cpp */; };
|
||||
7539E1261F23B25A006B2DF2 /* audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCA1F23B25A006B2DF2 /* audio.cpp */; };
|
||||
7539E1271F23B25A006B2DF2 /* cdrom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539DFCB1F23B25A006B2DF2 /* cdrom.cpp */; };
|
||||
|
@ -47,16 +36,9 @@
|
|||
7539E18D1F23B25A006B2DF2 /* slot_rom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */; };
|
||||
7539E18E1F23B25A006B2DF2 /* sony.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A31F23B25A006B2DF2 /* sony.cpp */; };
|
||||
7539E18F1F23B25A006B2DF2 /* timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A41F23B25A006B2DF2 /* timer.cpp */; };
|
||||
7539E1901F23B25A006B2DF2 /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */; };
|
||||
7539E1981F23B25A006B2DF2 /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0B51F23B25A006B2DF2 /* exceptions.cpp */; };
|
||||
7539E1991F23B25A006B2DF2 /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0B71F23B25A006B2DF2 /* flags.cpp */; };
|
||||
7539E19D1F23B25A006B2DF2 /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C21F23B25A006B2DF2 /* mathlib.cpp */; };
|
||||
7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C41F23B25A006B2DF2 /* rounding.cpp */; };
|
||||
7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E0C91F23B25A006B2DF2 /* memory.cpp */; };
|
||||
7539E1E11F23B25A006B2DF2 /* user_strings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1221F23B25A006B2DF2 /* user_strings.cpp */; };
|
||||
7539E1E21F23B25A006B2DF2 /* video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1231F23B25A006B2DF2 /* video.cpp */; };
|
||||
7539E1E31F23B25A006B2DF2 /* xpram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1241F23B25A006B2DF2 /* xpram.cpp */; };
|
||||
7539E23F1F23B32A006B2DF2 /* bincue_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */; };
|
||||
7539E24A1F23B32A006B2DF2 /* disk_sparsebundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E1FD1F23B32A006B2DF2 /* disk_sparsebundle.cpp */; };
|
||||
7539E2681F23B32A006B2DF2 /* rpc_unix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2241F23B32A006B2DF2 /* rpc_unix.cpp */; };
|
||||
7539E26C1F23B32A006B2DF2 /* sshpty.c in Sources */ = {isa = PBXBuildFile; fileRef = 7539E22A1F23B32A006B2DF2 /* sshpty.c */; };
|
||||
|
@ -68,7 +50,6 @@
|
|||
7539E2911F23C56F006B2DF2 /* prefs_editor_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2881F23C56F006B2DF2 /* prefs_editor_dummy.cpp */; };
|
||||
7539E2921F23C56F006B2DF2 /* scsi_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2891F23C56F006B2DF2 /* scsi_dummy.cpp */; };
|
||||
7539E2931F23C56F006B2DF2 /* serial_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */; };
|
||||
7539E2971F23C5FD006B2DF2 /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2961F23C5FD006B2DF2 /* newcpu.cpp */; };
|
||||
7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */; };
|
||||
756C1B341F252FC100620917 /* utils_macosx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 756C1B331F252FC100620917 /* utils_macosx.mm */; };
|
||||
756C1B391F25306A00620917 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 756C1B381F25306A00620917 /* AppKit.framework */; };
|
||||
|
@ -101,12 +82,42 @@
|
|||
E416BEE82410AA4E00751E6D /* runtool.c in Sources */ = {isa = PBXBuildFile; fileRef = E416BEE72410AA4E00751E6D /* runtool.c */; };
|
||||
E416BEEA2410AA9800751E6D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E416BEE92410AA9800751E6D /* Security.framework */; };
|
||||
E416BEED2410AE0900751E6D /* etherhelpertool in Resources */ = {isa = PBXBuildFile; fileRef = E416BEEC2410AE0000751E6D /* etherhelpertool */; };
|
||||
E447066D25D8FCB400EA2C14 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E447066C25D8FCB400EA2C14 /* Metal.framework */; };
|
||||
E4555EED2354434B00139FCE /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 7539E00A1F23B25A006B2DF2 /* Credits.html */; };
|
||||
E490334E20D3A5890012DD5F /* clip_macosx64.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490334D20D3A5890012DD5F /* clip_macosx64.mm */; };
|
||||
E4D8245323543D9800849B78 /* fpu_ieee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D8245223543D9700849B78 /* fpu_ieee.cpp */; };
|
||||
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E417913123D7D67C0009AD63 /* defs68k.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
E45769AC2643A65B0063BAF1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = E45769A82643A65B0063BAF1 /* uae_cpu.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = E4F537C02642A86D008B27DF;
|
||||
remoteInfo = uae_cpu_x86_64;
|
||||
};
|
||||
E45769B92643A6740063BAF1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = E45769B52643A6740063BAF1 /* uae_cpu_2021.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = E41D7AA12642C004005E8093;
|
||||
remoteInfo = uae_cpu_arm64;
|
||||
};
|
||||
E45769BC2643A6870063BAF1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = E45769A82643A65B0063BAF1 /* uae_cpu.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E4F537BF2642A86D008B27DF;
|
||||
remoteInfo = uae_cpu_x86_64;
|
||||
};
|
||||
E45769BE2643A68B0063BAF1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = E45769B52643A6740063BAF1 /* uae_cpu_2021.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E41D7AA02642C004005E8093;
|
||||
remoteInfo = uae_cpu_arm64;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
752F26F31F240140001032B4 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
|
@ -122,6 +133,8 @@
|
|||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
5D5C3B0924B2DF3400CDAB41 /* bincue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bincue.cpp; path = ../bincue.cpp; sourceTree = "<group>"; };
|
||||
5D5C3B0B24B2DF4200CDAB41 /* bincue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bincue.h; sourceTree = "<group>"; };
|
||||
5DDE95122255D075004D0E79 /* AudioBackEnd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioBackEnd.h; sourceTree = "<group>"; };
|
||||
5DDE95132255D076004D0E79 /* AudioDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioDevice.cpp; sourceTree = "<group>"; };
|
||||
5DDE95142255D076004D0E79 /* AudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDevice.h; sourceTree = "<group>"; };
|
||||
|
@ -129,20 +142,10 @@
|
|||
5DDE95162255D076004D0E79 /* MacOSX_sound_if.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacOSX_sound_if.cpp; sourceTree = "<group>"; };
|
||||
5DDE95172255D076004D0E79 /* AudioBackEnd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioBackEnd.cpp; sourceTree = "<group>"; };
|
||||
5DDE95182255D076004D0E79 /* MacOSX_sound_if.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOSX_sound_if.h; sourceTree = "<group>"; };
|
||||
5DDE951D2255D0A9004D0E79 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
|
||||
5DDE951F2255D0B6004D0E79 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
||||
5DDE95212255D0C2004D0E79 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
|
||||
752F26F81F240E51001032B4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
752F26FA1F240E69001032B4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
752F27001F242BAF001032B4 /* prefs_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prefs_sdl.cpp; sourceTree = "<group>"; };
|
||||
752F27021F242F51001032B4 /* xpram_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpram_sdl.cpp; sourceTree = "<group>"; };
|
||||
753252E51F5359040024025B /* build68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = build68k.c; sourceTree = "<group>"; };
|
||||
753253011F535F210024025B /* gencpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gencpu.c; sourceTree = "<group>"; };
|
||||
7532532C1F5368370024025B /* cpuemu_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu_nf.cpp; path = gencpu_output/cpuemu_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7532532D1F5368370024025B /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7532532E1F5368370024025B /* cpustbl_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl_nf.cpp; path = gencpu_output/cpustbl_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7532532F1F5368370024025B /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
753253301F5368370024025B /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7539DFB21F23B17E006B2DF2 /* BasiliskII.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BasiliskII.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7539DFC91F23B25A006B2DF2 /* adb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = adb.cpp; path = ../adb.cpp; sourceTree = "<group>"; };
|
||||
7539DFCA1F23B25A006B2DF2 /* audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio.cpp; path = ../audio.cpp; sourceTree = "<group>"; };
|
||||
|
@ -211,40 +214,9 @@
|
|||
7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slot_rom.cpp; path = ../slot_rom.cpp; sourceTree = "<group>"; };
|
||||
7539E0A31F23B25A006B2DF2 /* sony.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sony.cpp; path = ../sony.cpp; sourceTree = "<group>"; };
|
||||
7539E0A41F23B25A006B2DF2 /* timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = timer.cpp; path = ../timer.cpp; sourceTree = "<group>"; };
|
||||
7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = basilisk_glue.cpp; sourceTree = "<group>"; };
|
||||
7539E0AB1F23B25A006B2DF2 /* compemu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compemu.h; sourceTree = "<group>"; };
|
||||
7539E0AE1F23B25A006B2DF2 /* flags_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flags_x86.h; sourceTree = "<group>"; };
|
||||
7539E0B11F23B25A006B2DF2 /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_emulation.h; sourceTree = "<group>"; };
|
||||
7539E0B41F23B25A006B2DF2 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = "<group>"; };
|
||||
7539E0B51F23B25A006B2DF2 /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = exceptions.cpp; sourceTree = "<group>"; };
|
||||
7539E0B61F23B25A006B2DF2 /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exceptions.h; sourceTree = "<group>"; };
|
||||
7539E0B71F23B25A006B2DF2 /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flags.cpp; sourceTree = "<group>"; };
|
||||
7539E0B81F23B25A006B2DF2 /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flags.h; sourceTree = "<group>"; };
|
||||
7539E0B91F23B25A006B2DF2 /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu.h; sourceTree = "<group>"; };
|
||||
7539E0BB1F23B25A006B2DF2 /* fpu_ieee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_ieee.h; sourceTree = "<group>"; };
|
||||
7539E0BD1F23B25A006B2DF2 /* fpu_uae.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_uae.h; sourceTree = "<group>"; };
|
||||
7539E0BF1F23B25A006B2DF2 /* fpu_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_x86.h; sourceTree = "<group>"; };
|
||||
7539E0C01F23B25A006B2DF2 /* fpu_x86_asm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpu_x86_asm.h; sourceTree = "<group>"; };
|
||||
7539E0C11F23B25A006B2DF2 /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl.h; sourceTree = "<group>"; };
|
||||
7539E0C21F23B25A006B2DF2 /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mathlib.cpp; sourceTree = "<group>"; };
|
||||
7539E0C31F23B25A006B2DF2 /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathlib.h; sourceTree = "<group>"; };
|
||||
7539E0C41F23B25A006B2DF2 /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rounding.cpp; sourceTree = "<group>"; };
|
||||
7539E0C51F23B25A006B2DF2 /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rounding.h; sourceTree = "<group>"; };
|
||||
7539E0C61F23B25A006B2DF2 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = "<group>"; };
|
||||
7539E0C81F23B25A006B2DF2 /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = m68k.h; sourceTree = "<group>"; };
|
||||
7539E0C91F23B25A006B2DF2 /* memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memory.cpp; sourceTree = "<group>"; };
|
||||
7539E0CA1F23B25A006B2DF2 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
|
||||
7539E0CC1F23B25A006B2DF2 /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = newcpu.h; sourceTree = "<group>"; };
|
||||
7539E0CD1F23B25A006B2DF2 /* noflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = noflags.h; sourceTree = "<group>"; };
|
||||
7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readcpu.cpp; sourceTree = "<group>"; };
|
||||
7539E0CF1F23B25A006B2DF2 /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readcpu.h; sourceTree = "<group>"; };
|
||||
7539E0D01F23B25A006B2DF2 /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spcflags.h; sourceTree = "<group>"; };
|
||||
7539E0D11F23B25A006B2DF2 /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = table68k; sourceTree = "<group>"; };
|
||||
7539E1221F23B25A006B2DF2 /* user_strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = user_strings.cpp; path = ../user_strings.cpp; sourceTree = "<group>"; };
|
||||
7539E1231F23B25A006B2DF2 /* video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = video.cpp; path = ../video.cpp; sourceTree = "<group>"; };
|
||||
7539E1241F23B25A006B2DF2 /* xpram.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xpram.cpp; path = ../xpram.cpp; sourceTree = "<group>"; };
|
||||
7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bincue_unix.cpp; sourceTree = "<group>"; };
|
||||
7539E1F11F23B329006B2DF2 /* bincue_unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bincue_unix.h; sourceTree = "<group>"; };
|
||||
7539E1F81F23B329006B2DF2 /* gtk-osx.patch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "gtk-osx.patch"; sourceTree = "<group>"; };
|
||||
7539E1FA1F23B32A006B2DF2 /* mkstandalone */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = mkstandalone; sourceTree = "<group>"; };
|
||||
7539E1FC1F23B32A006B2DF2 /* testlmem.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = testlmem.sh; sourceTree = "<group>"; };
|
||||
|
@ -284,7 +256,6 @@
|
|||
7539E2881F23C56F006B2DF2 /* prefs_editor_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prefs_editor_dummy.cpp; sourceTree = "<group>"; };
|
||||
7539E2891F23C56F006B2DF2 /* scsi_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scsi_dummy.cpp; sourceTree = "<group>"; };
|
||||
7539E28A1F23C56F006B2DF2 /* serial_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = serial_dummy.cpp; sourceTree = "<group>"; };
|
||||
7539E2961F23C5FD006B2DF2 /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = newcpu.cpp; sourceTree = "<group>"; };
|
||||
7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_darwin.cpp; sourceTree = "<group>"; };
|
||||
7539E2AA1F23CDB7006B2DF2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
756C1B321F252FC100620917 /* utils_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils_macosx.h; sourceTree = "<group>"; };
|
||||
|
@ -301,7 +272,7 @@
|
|||
E413D8FB20D260B900E437D8 /* ip_icmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ip_icmp.c; sourceTree = "<group>"; };
|
||||
E413D8FC20D260B900E437D8 /* bootp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootp.h; sourceTree = "<group>"; };
|
||||
E413D8FD20D260B900E437D8 /* tcpip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tcpip.h; sourceTree = "<group>"; };
|
||||
E413D8FE20D260B900E437D8 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
|
||||
E413D8FE20D260B900E437D8 /* VERSION_ */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION_; sourceTree = "<group>"; };
|
||||
E413D8FF20D260B900E437D8 /* ip_icmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ip_icmp.h; sourceTree = "<group>"; };
|
||||
E413D90020D260B900E437D8 /* slirp_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slirp_config.h; sourceTree = "<group>"; };
|
||||
E413D90120D260B900E437D8 /* tcp_input.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tcp_input.c; sourceTree = "<group>"; };
|
||||
|
@ -344,9 +315,10 @@
|
|||
E416BEE92410AA9800751E6D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||
E416BEEB2410AB0E00751E6D /* etherhelpertool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = etherhelpertool.c; sourceTree = "<group>"; };
|
||||
E416BEEC2410AE0000751E6D /* etherhelpertool */ = {isa = PBXFileReference; lastKnownFileType = text; path = etherhelpertool; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E417913123D7D67C0009AD63 /* defs68k.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E447066C25D8FCB400EA2C14 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
|
||||
E45769A82643A65B0063BAF1 /* uae_cpu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = uae_cpu.xcodeproj; sourceTree = "<group>"; };
|
||||
E45769B52643A6740063BAF1 /* uae_cpu_2021.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = uae_cpu_2021.xcodeproj; sourceTree = "<group>"; };
|
||||
E490334D20D3A5890012DD5F /* clip_macosx64.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clip_macosx64.mm; sourceTree = "<group>"; };
|
||||
E4D8245223543D9700849B78 /* fpu_ieee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fpu_ieee.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -354,13 +326,11 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5DDE95222255D0C2004D0E79 /* AudioUnit.framework in Frameworks */,
|
||||
5DDE95202255D0B6004D0E79 /* AudioToolbox.framework in Frameworks */,
|
||||
5DDE951E2255D0A9004D0E79 /* CoreAudio.framework in Frameworks */,
|
||||
E413D93620D260DA00E437D8 /* SDL2.framework in Frameworks */,
|
||||
E416BEEA2410AA9800751E6D /* Security.framework in Frameworks */,
|
||||
756C1B391F25306A00620917 /* AppKit.framework in Frameworks */,
|
||||
752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */,
|
||||
E447066D25D8FCB400EA2C14 /* Metal.framework in Frameworks */,
|
||||
752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -411,7 +381,7 @@
|
|||
E413D8FA20D260B900E437D8 /* tftp.h */,
|
||||
E413D90720D260BA00E437D8 /* udp.c */,
|
||||
E413D90320D260BA00E437D8 /* udp.h */,
|
||||
E413D8FE20D260B900E437D8 /* VERSION */,
|
||||
E413D8FE20D260B900E437D8 /* VERSION_ */,
|
||||
);
|
||||
name = slirp;
|
||||
path = ../slirp;
|
||||
|
@ -420,6 +390,7 @@
|
|||
752F26F71F240E51001032B4 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E447066C25D8FCB400EA2C14 /* Metal.framework */,
|
||||
E416BEE92410AA9800751E6D /* Security.framework */,
|
||||
E413D93520D260DA00E437D8 /* SDL2.framework */,
|
||||
756C1B381F25306A00620917 /* AppKit.framework */,
|
||||
|
@ -433,27 +404,15 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
E416BEEC2410AE0000751E6D /* etherhelpertool */,
|
||||
7532532B1F53675E0024025B /* gencpu output */,
|
||||
);
|
||||
name = "generated src";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7532532B1F53675E0024025B /* gencpu output */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7532532C1F5368370024025B /* cpuemu_nf.cpp */,
|
||||
7532532D1F5368370024025B /* cpuemu.cpp */,
|
||||
7532532E1F5368370024025B /* cpustbl_nf.cpp */,
|
||||
7532532F1F5368370024025B /* cpustbl.cpp */,
|
||||
753253301F5368370024025B /* cputbl.h */,
|
||||
E417913123D7D67C0009AD63 /* defs68k.c */,
|
||||
);
|
||||
name = "gencpu output";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7539DFA91F23B17E006B2DF2 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E45769A82643A65B0063BAF1 /* uae_cpu.xcodeproj */,
|
||||
E45769B52643A6740063BAF1 /* uae_cpu_2021.xcodeproj */,
|
||||
E4150D1320D559800077C51A /* SDL2.framework */,
|
||||
7539E1E41F23B25E006B2DF2 /* src */,
|
||||
753252FF1F535E5D0024025B /* generated src */,
|
||||
|
@ -492,6 +451,7 @@
|
|||
7539DFD91F23B25A006B2DF2 /* adb.h */,
|
||||
7539DFDA1F23B25A006B2DF2 /* audio.h */,
|
||||
7539DFDB1F23B25A006B2DF2 /* audio_defs.h */,
|
||||
5D5C3B0B24B2DF4200CDAB41 /* bincue.h */,
|
||||
7539DFDC1F23B25A006B2DF2 /* cdrom.h */,
|
||||
7539DFDD1F23B25A006B2DF2 /* clip.h */,
|
||||
7539DFDE1F23B25A006B2DF2 /* debug.h */,
|
||||
|
@ -572,68 +532,12 @@
|
|||
path = ../SDL;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7539E0A51F23B25A006B2DF2 /* uae_cpu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7539E0A61F23B25A006B2DF2 /* basilisk_glue.cpp */,
|
||||
753252E51F5359040024025B /* build68k.c */,
|
||||
7539E0A81F23B25A006B2DF2 /* compiler */,
|
||||
7539E0B11F23B25A006B2DF2 /* cpu_emulation.h */,
|
||||
7539E0B31F23B25A006B2DF2 /* fpu */,
|
||||
753253011F535F210024025B /* gencpu.c */,
|
||||
7539E0C81F23B25A006B2DF2 /* m68k.h */,
|
||||
7539E0C91F23B25A006B2DF2 /* memory.cpp */,
|
||||
7539E0CA1F23B25A006B2DF2 /* memory.h */,
|
||||
7539E2961F23C5FD006B2DF2 /* newcpu.cpp */,
|
||||
7539E0CC1F23B25A006B2DF2 /* newcpu.h */,
|
||||
7539E0CD1F23B25A006B2DF2 /* noflags.h */,
|
||||
7539E0CE1F23B25A006B2DF2 /* readcpu.cpp */,
|
||||
7539E0CF1F23B25A006B2DF2 /* readcpu.h */,
|
||||
7539E0D01F23B25A006B2DF2 /* spcflags.h */,
|
||||
7539E0D11F23B25A006B2DF2 /* table68k */,
|
||||
);
|
||||
name = uae_cpu;
|
||||
path = ../uae_cpu;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7539E0A81F23B25A006B2DF2 /* compiler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7539E0AB1F23B25A006B2DF2 /* compemu.h */,
|
||||
7539E0AE1F23B25A006B2DF2 /* flags_x86.h */,
|
||||
);
|
||||
path = compiler;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7539E0B31F23B25A006B2DF2 /* fpu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4D8245223543D9700849B78 /* fpu_ieee.cpp */,
|
||||
7539E0B41F23B25A006B2DF2 /* core.h */,
|
||||
7539E0B51F23B25A006B2DF2 /* exceptions.cpp */,
|
||||
7539E0B61F23B25A006B2DF2 /* exceptions.h */,
|
||||
7539E0B71F23B25A006B2DF2 /* flags.cpp */,
|
||||
7539E0B81F23B25A006B2DF2 /* flags.h */,
|
||||
7539E0B91F23B25A006B2DF2 /* fpu.h */,
|
||||
7539E0BB1F23B25A006B2DF2 /* fpu_ieee.h */,
|
||||
7539E0BD1F23B25A006B2DF2 /* fpu_uae.h */,
|
||||
7539E0BF1F23B25A006B2DF2 /* fpu_x86.h */,
|
||||
7539E0C01F23B25A006B2DF2 /* fpu_x86_asm.h */,
|
||||
7539E0C11F23B25A006B2DF2 /* impl.h */,
|
||||
7539E0C21F23B25A006B2DF2 /* mathlib.cpp */,
|
||||
7539E0C31F23B25A006B2DF2 /* mathlib.h */,
|
||||
7539E0C41F23B25A006B2DF2 /* rounding.cpp */,
|
||||
7539E0C51F23B25A006B2DF2 /* rounding.h */,
|
||||
7539E0C61F23B25A006B2DF2 /* types.h */,
|
||||
);
|
||||
path = fpu;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7539E1E41F23B25E006B2DF2 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7539DFC91F23B25A006B2DF2 /* adb.cpp */,
|
||||
7539DFCA1F23B25A006B2DF2 /* audio.cpp */,
|
||||
5D5C3B0924B2DF3400CDAB41 /* bincue.cpp */,
|
||||
7539DFCB1F23B25A006B2DF2 /* cdrom.cpp */,
|
||||
7539DFCC1F23B25A006B2DF2 /* CrossPlatform */,
|
||||
7539DFD41F23B25A006B2DF2 /* disk.cpp */,
|
||||
|
@ -657,7 +561,6 @@
|
|||
7539E0A21F23B25A006B2DF2 /* slot_rom.cpp */,
|
||||
7539E0A31F23B25A006B2DF2 /* sony.cpp */,
|
||||
7539E0A41F23B25A006B2DF2 /* timer.cpp */,
|
||||
7539E0A51F23B25A006B2DF2 /* uae_cpu */,
|
||||
7539E1E91F23B329006B2DF2 /* Unix */,
|
||||
7539E1221F23B25A006B2DF2 /* user_strings.cpp */,
|
||||
7539E1231F23B25A006B2DF2 /* video.cpp */,
|
||||
|
@ -669,8 +572,6 @@
|
|||
7539E1E91F23B329006B2DF2 /* Unix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7539E1F01F23B329006B2DF2 /* bincue_unix.cpp */,
|
||||
7539E1F11F23B329006B2DF2 /* bincue_unix.h */,
|
||||
7539E1F71F23B329006B2DF2 /* Darwin */,
|
||||
7539E1FD1F23B32A006B2DF2 /* disk_sparsebundle.cpp */,
|
||||
7539E1FE1F23B32A006B2DF2 /* disk_unix.h */,
|
||||
|
@ -748,6 +649,22 @@
|
|||
path = ../dummy;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E45769A92643A65B0063BAF1 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E45769AD2643A65B0063BAF1 /* libuae_cpu_x86_64.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E45769B62643A6740063BAF1 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E45769BA2643A6740063BAF1 /* libuae_cpu_arm64.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
@ -764,6 +681,8 @@
|
|||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
E45769BF2643A68B0063BAF1 /* PBXTargetDependency */,
|
||||
E45769BD2643A6870063BAF1 /* PBXTargetDependency */,
|
||||
);
|
||||
name = BasiliskII;
|
||||
productName = BasiliskII;
|
||||
|
@ -796,6 +715,16 @@
|
|||
mainGroup = 7539DFA91F23B17E006B2DF2;
|
||||
productRefGroup = 7539DFB31F23B17E006B2DF2 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = E45769A92643A65B0063BAF1 /* Products */;
|
||||
ProjectRef = E45769A82643A65B0063BAF1 /* uae_cpu.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = E45769B62643A6740063BAF1 /* Products */;
|
||||
ProjectRef = E45769B52643A6740063BAF1 /* uae_cpu_2021.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
7539DFB11F23B17E006B2DF2 /* BasiliskII */,
|
||||
|
@ -803,6 +732,23 @@
|
|||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
E45769AD2643A65B0063BAF1 /* libuae_cpu_x86_64.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libuae_cpu_x86_64.a;
|
||||
remoteRef = E45769AC2643A65B0063BAF1 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
E45769BA2643A6740063BAF1 /* libuae_cpu_arm64.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libuae_cpu_arm64.a;
|
||||
remoteRef = E45769B92643A6740063BAF1 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
7539DFB01F23B17E006B2DF2 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
|
@ -826,15 +772,10 @@
|
|||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu_nf.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl_nf.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/defs68k.c,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "make -f Makefile.gencpu\ncc etherhelpertool.c -framework Security -o $BUILT_PRODUCTS_DIR/etherhelpertool\n";
|
||||
shellScript = "cc etherhelpertool.c -framework Security -o $BUILT_PRODUCTS_DIR/etherhelpertool\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
@ -843,48 +784,36 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E4EE777523D7D71400BAE63A /* defs68k.c in Sources */,
|
||||
7539E19E1F23B25A006B2DF2 /* rounding.cpp in Sources */,
|
||||
7539E29D1F23C83F006B2DF2 /* sys_darwin.cpp in Sources */,
|
||||
7539E1291F23B25A006B2DF2 /* video_blit.cpp in Sources */,
|
||||
E413D93320D260BC00E437D8 /* cksum.c in Sources */,
|
||||
E413D92920D260BC00E437D8 /* udp.c in Sources */,
|
||||
E4D8245323543D9800849B78 /* fpu_ieee.cpp in Sources */,
|
||||
7539E1A01F23B25A006B2DF2 /* memory.cpp in Sources */,
|
||||
E40CEEC620D7910E00BCB88D /* SDLMain.m in Sources */,
|
||||
753253351F53688D0024025B /* readcpu.cpp in Sources */,
|
||||
7539E1741F23B25A006B2DF2 /* audio_sdl.cpp in Sources */,
|
||||
E413D93120D260BC00E437D8 /* ip_output.c in Sources */,
|
||||
7539E1E21F23B25A006B2DF2 /* video.cpp in Sources */,
|
||||
7539E18F1F23B25A006B2DF2 /* timer.cpp in Sources */,
|
||||
7539E1711F23B25A006B2DF2 /* rom_patches.cpp in Sources */,
|
||||
7539E1281F23B25A006B2DF2 /* sigsegv.cpp in Sources */,
|
||||
753253341F5368370024025B /* cpustbl.cpp in Sources */,
|
||||
756C1B341F252FC100620917 /* utils_macosx.mm in Sources */,
|
||||
E413D92620D260BC00E437D8 /* misc.c in Sources */,
|
||||
753253321F5368370024025B /* cpuemu.cpp in Sources */,
|
||||
5DDE951C2255D076004D0E79 /* AudioBackEnd.cpp in Sources */,
|
||||
7539E2701F23B32A006B2DF2 /* tinyxml2.cpp in Sources */,
|
||||
7539E1721F23B25A006B2DF2 /* rsrc_patches.cpp in Sources */,
|
||||
5D5C3B0A24B2DF3500CDAB41 /* bincue.cpp in Sources */,
|
||||
7539E2931F23C56F006B2DF2 /* serial_dummy.cpp in Sources */,
|
||||
7539E1981F23B25A006B2DF2 /* exceptions.cpp in Sources */,
|
||||
75CBCF771F5DB65E00830063 /* video_sdl.cpp in Sources */,
|
||||
7539E1901F23B25A006B2DF2 /* basilisk_glue.cpp in Sources */,
|
||||
7539E2801F23C4CA006B2DF2 /* main_unix.cpp in Sources */,
|
||||
7539E1E11F23B25A006B2DF2 /* user_strings.cpp in Sources */,
|
||||
75CBCF751F5DB3AD00830063 /* video_sdl2.cpp in Sources */,
|
||||
752F27011F242BAF001032B4 /* prefs_sdl.cpp in Sources */,
|
||||
7539E2971F23C5FD006B2DF2 /* newcpu.cpp in Sources */,
|
||||
7539E12A1F23B25A006B2DF2 /* vm_alloc.cpp in Sources */,
|
||||
E413D93220D260BC00E437D8 /* if.c in Sources */,
|
||||
753253331F5368370024025B /* cpustbl_nf.cpp in Sources */,
|
||||
7539E16C1F23B25A006B2DF2 /* main.cpp in Sources */,
|
||||
7539E26D1F23B32A006B2DF2 /* strlcpy.c in Sources */,
|
||||
E413D93420D260BC00E437D8 /* tcp_output.c in Sources */,
|
||||
7539E26E1F23B32A006B2DF2 /* sys_unix.cpp in Sources */,
|
||||
7539E1271F23B25A006B2DF2 /* cdrom.cpp in Sources */,
|
||||
E413D92A20D260BC00E437D8 /* sbuf.c in Sources */,
|
||||
753253311F5368370024025B /* cpuemu_nf.cpp in Sources */,
|
||||
7539E1261F23B25A006B2DF2 /* audio.cpp in Sources */,
|
||||
E413D93820D2613500E437D8 /* ether_unix.cpp in Sources */,
|
||||
7539E1701F23B25A006B2DF2 /* prefs.cpp in Sources */,
|
||||
|
@ -893,22 +822,17 @@
|
|||
7539E26C1F23B32A006B2DF2 /* sshpty.c in Sources */,
|
||||
7539E1781F23B25A006B2DF2 /* serial.cpp in Sources */,
|
||||
757A2BF01F5AF9D6003EDB01 /* user_strings_unix.cpp in Sources */,
|
||||
5DDE951B2255D076004D0E79 /* MacOSX_sound_if.cpp in Sources */,
|
||||
5DDE951A2255D076004D0E79 /* audio_macosx.cpp in Sources */,
|
||||
E413D92D20D260BC00E437D8 /* tcp_timer.c in Sources */,
|
||||
E413D92820D260BC00E437D8 /* tcp_subr.c in Sources */,
|
||||
7539E1991F23B25A006B2DF2 /* flags.cpp in Sources */,
|
||||
7539E2921F23C56F006B2DF2 /* scsi_dummy.cpp in Sources */,
|
||||
E413D93A20D2614E00E437D8 /* extfs_macosx.cpp in Sources */,
|
||||
7539E16F1F23B25A006B2DF2 /* prefs_items.cpp in Sources */,
|
||||
7539E18E1F23B25A006B2DF2 /* sony.cpp in Sources */,
|
||||
7539E26F1F23B32A006B2DF2 /* timer_unix.cpp in Sources */,
|
||||
7539E12E1F23B25A006B2DF2 /* extfs.cpp in Sources */,
|
||||
5DDE95192255D076004D0E79 /* AudioDevice.cpp in Sources */,
|
||||
7539E12C1F23B25A006B2DF2 /* emul_op.cpp in Sources */,
|
||||
E413D92720D260BC00E437D8 /* debug.c in Sources */,
|
||||
E413D92220D260BC00E437D8 /* mbuf.c in Sources */,
|
||||
7539E19D1F23B25A006B2DF2 /* mathlib.cpp in Sources */,
|
||||
E416BEE82410AA4E00751E6D /* runtool.c in Sources */,
|
||||
E413D93020D260BC00E437D8 /* ip_input.c in Sources */,
|
||||
752F27031F242F51001032B4 /* xpram_sdl.cpp in Sources */,
|
||||
|
@ -928,12 +852,24 @@
|
|||
7539E2681F23B32A006B2DF2 /* rpc_unix.cpp in Sources */,
|
||||
E413D92F20D260BC00E437D8 /* bootp.c in Sources */,
|
||||
7539E2911F23C56F006B2DF2 /* prefs_editor_dummy.cpp in Sources */,
|
||||
7539E23F1F23B32A006B2DF2 /* bincue_unix.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
E45769BD2643A6870063BAF1 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = uae_cpu_x86_64;
|
||||
targetProxy = E45769BC2643A6870063BAF1 /* PBXContainerItemProxy */;
|
||||
};
|
||||
E45769BF2643A68B0063BAF1 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = uae_cpu_arm64;
|
||||
targetProxy = E45769BE2643A68B0063BAF1 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
7539E00F1F23B25A006B2DF2 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
|
@ -1070,6 +1006,7 @@
|
|||
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = NO;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = NO;
|
||||
ENABLE_NS_ASSERTIONS = YES;
|
||||
ENABLE_TESTABILITY = NO;
|
||||
|
@ -1081,19 +1018,30 @@
|
|||
GCC_C_LANGUAGE_STANDARD = "compiler-default";
|
||||
GCC_ENABLE_PASCAL_STRINGS = NO;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
"GCC_PREPROCESSOR_DEFINITIONS[arch=arm64]" = "$(inherited)";
|
||||
"GCC_PREPROCESSOR_DEFINITIONS[arch=x86_64]" = (
|
||||
"$(inherited)",
|
||||
ENABLE_MACOSX_ETHERHELPER,
|
||||
HAVE_CONFIG_H,
|
||||
"USE_XCODE=1",
|
||||
"DEBUG=1",
|
||||
"USE_SDL_AUDIO=1",
|
||||
"BINCUE=1",
|
||||
CPU_x86_64,
|
||||
JIT,
|
||||
"USE_JIT=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_USE_STANDARD_INCLUDE_SEARCHING = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
"HEADER_SEARCH_PATHS[arch=arm64]" = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
../MacOSX,
|
||||
../include,
|
||||
../uae_cpu_2021,
|
||||
../Unix,
|
||||
../slirp,
|
||||
);
|
||||
"HEADER_SEARCH_PATHS[arch=x86_64]" = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
../MacOSX,
|
||||
../include,
|
||||
|
@ -1104,14 +1052,27 @@
|
|||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
LIBRARY_SEARCH_PATHS = /usr/local/lib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
OTHER_LDFLAGS = "";
|
||||
"OTHER_LDFLAGS[arch=arm64]" = (
|
||||
"-luae_cpu_arm64",
|
||||
"-lgmp",
|
||||
"-lmpfr",
|
||||
);
|
||||
"OTHER_LDFLAGS[arch=x86_64]" = (
|
||||
"-luae_cpu_x86_64",
|
||||
"-Wl,-no_pie",
|
||||
"-pagezero_size",
|
||||
0x1000,
|
||||
);
|
||||
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
USE_HEADERMAP = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
VALID_ARCHS = "x86_64 arm64";
|
||||
WARNING_CFLAGS = "";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -1128,6 +1089,7 @@
|
|||
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = NO;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_NS_ASSERTIONS = YES;
|
||||
|
@ -1142,18 +1104,29 @@
|
|||
GCC_ENABLE_PASCAL_STRINGS = NO;
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
"GCC_PREPROCESSOR_DEFINITIONS[arch=arm64]" = "$(inherited)";
|
||||
"GCC_PREPROCESSOR_DEFINITIONS[arch=x86_64]" = (
|
||||
"$(inherited)",
|
||||
ENABLE_MACOSX_ETHERHELPER,
|
||||
HAVE_CONFIG_H,
|
||||
"USE_XCODE=1",
|
||||
"USE_SDL_AUDIO=1",
|
||||
"BINCUE=1",
|
||||
CPU_x86_64,
|
||||
JIT,
|
||||
"USE_JIT=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_USE_STANDARD_INCLUDE_SEARCHING = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
"HEADER_SEARCH_PATHS[arch=arm64]" = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
../MacOSX,
|
||||
../include,
|
||||
../uae_cpu_2021,
|
||||
../Unix,
|
||||
../slirp,
|
||||
);
|
||||
"HEADER_SEARCH_PATHS[arch=x86_64]" = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
../MacOSX,
|
||||
../include,
|
||||
|
@ -1164,13 +1137,26 @@
|
|||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CFLAGS = "";
|
||||
LIBRARY_SEARCH_PATHS = /usr/local/lib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
OTHER_LDFLAGS = "";
|
||||
"OTHER_LDFLAGS[arch=arm64]" = (
|
||||
"-luae_cpu_arm64",
|
||||
"-lgmp",
|
||||
"-lmpfr",
|
||||
);
|
||||
"OTHER_LDFLAGS[arch=x86_64]" = (
|
||||
"-luae_cpu_x86_64",
|
||||
"-Wl,-no_pie",
|
||||
"-pagezero_size",
|
||||
0x1000,
|
||||
);
|
||||
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.cebix.basilisk;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
USE_HEADERMAP = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
VALID_ARCHS = "x86_64 arm64";
|
||||
WARNING_CFLAGS = "";
|
||||
};
|
||||
name = Release;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7539DFB11F23B17E006B2DF2"
|
||||
BuildableName = "BasiliskII.app"
|
||||
BlueprintName = "BasiliskII"
|
||||
ReferencedContainer = "container:BasiliskII.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7539DFB11F23B17E006B2DF2"
|
||||
BuildableName = "BasiliskII.app"
|
||||
BlueprintName = "BasiliskII"
|
||||
ReferencedContainer = "container:BasiliskII.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
debugAsWhichUser = "root"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7539DFB11F23B17E006B2DF2"
|
||||
BuildableName = "BasiliskII.app"
|
||||
BlueprintName = "BasiliskII"
|
||||
ReferencedContainer = "container:BasiliskII.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7539DFB11F23B17E006B2DF2"
|
||||
BuildableName = "BasiliskII.app"
|
||||
BlueprintName = "BasiliskII"
|
||||
ReferencedContainer = "container:BasiliskII.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,14 +1,16 @@
|
|||
SRC = $(PROJECT_DIR)/../uae_cpu
|
||||
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output
|
||||
VPATH = $(SRC)
|
||||
CFLAGS = -DUSE_XCODE=1 -I. -I../uae_cpu -I../UNIX
|
||||
VPATH = $(SRC) $(SRC)/compiler
|
||||
CFLAGS = -DUSE_XCODE=1 -DUSE_JIT_FPU -I. -I../uae_cpu -I../UNIX
|
||||
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
|
||||
OBJS = $(addprefix $(DST)/, defs68k.o gencpu.o readcpu.o)
|
||||
|
||||
all: $(DST)/gencpu
|
||||
cd $(DST); ./gencpu
|
||||
all: $(DST)/gencpu $(DST)/gencomp
|
||||
cd $(DST); ./gencpu; ./gencomp
|
||||
|
||||
$(DST)/gencpu: $(OBJS)
|
||||
$(DST)/gencpu: $(addprefix $(DST)/, defs68k.o readcpu.o gencpu.o)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
$(DST)/gencomp: $(addprefix $(DST)/, defs68k.o readcpu.o gencomp.o)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
$(DST)/%.o: %.c
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
SRC = $(PROJECT_DIR)/../uae_cpu_2021
|
||||
DST = $(BUILT_PRODUCTS_DIR)/gencpu_output_2021
|
||||
VPATH = $(SRC) $(SRC)/compiler
|
||||
CFLAGS = -DUSE_XCODE=1 -DUSE_JIT_FPU -I. -I../uae_cpu_2021 -I../UNIX
|
||||
CXXFLAGS = -stdlib=libc++ $(CFLAGS)
|
||||
|
||||
all: $(DST)/gencpu $(DST)/gencomp
|
||||
cd $(DST); ./gencpu; ./gencomp
|
||||
|
||||
$(DST)/gencpu: $(addprefix $(DST)/, defs68k.o readcpu.o gencpu.o)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
$(DST)/gencomp: $(addprefix $(DST)/, defs68k.o readcpu.o gencomp.o)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
$(DST)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(DST)/%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(DST)/defs68k.c: $(DST)/build68k
|
||||
$< < $(SRC)/table68k > $@
|
||||
|
||||
$(DST)/build68k: $(SRC)/build68k.c
|
||||
mkdir -p $(DST)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:; rm -fr $(DST)
|
|
@ -59,12 +59,6 @@ static bool should_clear = false;
|
|||
|
||||
static NSMutableDictionary *g_macScrap;
|
||||
|
||||
// flavor UTIs
|
||||
|
||||
static NSString * const UTF16_TEXT_FLAVOR_NAME = @"public.utf16-plain-text";
|
||||
static NSString * const TEXT_FLAVOR_NAME = @"com.apple.traditional-mac-plain-text";
|
||||
static NSString * const STYL_FLAVOR_NAME = @"net.cebix.basilisk.styl-data";
|
||||
|
||||
// font face types
|
||||
|
||||
enum {
|
||||
|
|
|
@ -681,7 +681,11 @@
|
|||
#define SIZEOF_LONG 8
|
||||
|
||||
/* The size of `long double', as computed by sizeof. */
|
||||
#ifdef CPU_x86_64
|
||||
#define SIZEOF_LONG_DOUBLE 16
|
||||
#else
|
||||
#define SIZEOF_LONG_DOUBLE 8
|
||||
#endif
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
@ -815,6 +819,32 @@
|
|||
<inttypes.h> don't define. */
|
||||
/* #undef uintmax_t */
|
||||
|
||||
#ifndef CPU_x86_64
|
||||
#define UPDATE_UAE
|
||||
#endif
|
||||
|
||||
#ifdef UPDATE_UAE
|
||||
#define DIRECT_ADDRESSING 1
|
||||
#define CPU_64_BIT
|
||||
#define USE_INLINING
|
||||
#ifdef CPU_x86_64
|
||||
#define FPU_IEEE
|
||||
#define WINUAE_ARANYM
|
||||
#else
|
||||
#define FPU_MPFR
|
||||
#endif
|
||||
#else
|
||||
#define FPU_IEEE
|
||||
#endif
|
||||
|
||||
#if USE_JIT
|
||||
#define DIRECT_ADDRESSING 1
|
||||
#define USE_JIT_FPU
|
||||
#define X86_64_ASSEMBLY
|
||||
#define OPTIMIZED_FLAGS
|
||||
#endif
|
||||
|
||||
#define ENABLE_MACOSX_ETHERHELPER
|
||||
#define BINCUE 1
|
||||
|
||||
#endif
|
||||
|
|
|
@ -252,7 +252,7 @@ static int open_rsrc(const char *path, int flag)
|
|||
make_rsrc_path(path, rsrc_path);
|
||||
|
||||
int fd = open(rsrc_path, flag);
|
||||
if (fd < 0 && flag == O_WRONLY) fd = open(rsrc_path, O_WRONLY | O_CREAT); // for APFS
|
||||
if (fd < 0 && (flag == O_WRONLY || flag == O_RDWR)) fd = open(rsrc_path, flag | O_CREAT); // for APFS
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -420,9 +420,9 @@ void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir)
|
|||
|
||||
// No native Finder info, translate file name extension to MacOS type/creator
|
||||
if (!is_dir) {
|
||||
int path_len = strlen(path);
|
||||
size_t path_len = strlen(path);
|
||||
for (int i=0; e2t_translation[i].ext; i++) {
|
||||
int ext_len = strlen(e2t_translation[i].ext);
|
||||
size_t ext_len = strlen(e2t_translation[i].ext);
|
||||
if (path_len < ext_len)
|
||||
continue;
|
||||
if (!strcmp(path + path_len - ext_len, e2t_translation[i].ext)) {
|
||||
|
@ -626,11 +626,11 @@ const char *convert_string(const char *str, CFStringEncoding from, CFStringEncod
|
|||
// Convert from the host OS filename encoding to MacRoman
|
||||
const char *host_encoding_to_macroman(const char *filename)
|
||||
{
|
||||
return convert_string(filename, kCFStringEncodingUTF8, kCFStringEncodingMacRoman);
|
||||
return convert_string(filename, kCFStringEncodingUTF8, PrefsFindInt32("name_encoding"));
|
||||
}
|
||||
|
||||
// Convert from MacRoman to host OS filename encoding
|
||||
const char *macroman_to_host_encoding(const char *filename)
|
||||
{
|
||||
return convert_string(filename, kCFStringEncodingMacRoman, kCFStringEncodingUTF8);
|
||||
return convert_string(filename, PrefsFindInt32("name_encoding"), kCFStringEncodingUTF8);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ FILE * run_tool(const char *if_name, const char *tool_name)
|
|||
OSStatus auth_status;
|
||||
FILE *fp = NULL;
|
||||
char *args[] = {NULL, NULL, NULL};
|
||||
int ret;
|
||||
char path_buffer[256];
|
||||
AuthorizationFlags auth_flags;
|
||||
AuthorizationRef auth_ref;
|
||||
|
|
|
@ -350,8 +350,9 @@ void DarwinAddSerialPrefs(void)
|
|||
{
|
||||
D(bug("Modem BSD path: %s\n", bsdPath));
|
||||
|
||||
// Note that if there are multiple modems, we only get the last
|
||||
// Note that if there are multiple modems, we only get the first
|
||||
PrefsAddString("seriala", bsdPath);
|
||||
break;
|
||||
}
|
||||
else
|
||||
D(bug("Could not get BSD device path for modem\n"));
|
||||
|
|
|
@ -0,0 +1,489 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
E4C1B4A32642B05A00EB55A0 /* compemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49A2642B05A00EB55A0 /* compemu.cpp */; };
|
||||
E4C1B4A42642B05A00EB55A0 /* compstbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */; };
|
||||
E4C1B4A52642B05A00EB55A0 /* comptbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C1B49C2642B05A00EB55A0 /* comptbl.h */; };
|
||||
E4C1B4A62642B05A00EB55A0 /* cpuemu_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49D2642B05A00EB55A0 /* cpuemu_nf.cpp */; };
|
||||
E4C1B4A72642B05A00EB55A0 /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */; };
|
||||
E4C1B4A82642B05A00EB55A0 /* cpustbl_nf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */; };
|
||||
E4C1B4A92642B05A00EB55A0 /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */; };
|
||||
E4C1B4AA2642B05A00EB55A0 /* cputbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C1B4A12642B05A00EB55A0 /* cputbl.h */; };
|
||||
E4C1B4AB2642B05A00EB55A0 /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E4C1B4A22642B05A00EB55A0 /* defs68k.c */; };
|
||||
E4F537C92642A8BA008B27DF /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */; };
|
||||
E4F537CD2642A8C2008B27DF /* cpu_emulation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537CB2642A8C2008B27DF /* cpu_emulation.h */; };
|
||||
E4F537DB2642A8CC008B27DF /* m68k.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D02642A8CC008B27DF /* m68k.h */; };
|
||||
E4F537DC2642A8CC008B27DF /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D12642A8CC008B27DF /* memory.cpp */; };
|
||||
E4F537DD2642A8CC008B27DF /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D22642A8CC008B27DF /* memory.h */; };
|
||||
E4F537DE2642A8CC008B27DF /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D32642A8CC008B27DF /* newcpu.cpp */; };
|
||||
E4F537DF2642A8CC008B27DF /* newcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D42642A8CC008B27DF /* newcpu.h */; };
|
||||
E4F537E02642A8CC008B27DF /* noflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D52642A8CC008B27DF /* noflags.h */; };
|
||||
E4F537E12642A8CC008B27DF /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537D62642A8CC008B27DF /* readcpu.cpp */; };
|
||||
E4F537E22642A8CC008B27DF /* readcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D72642A8CC008B27DF /* readcpu.h */; };
|
||||
E4F537E32642A8CC008B27DF /* spcflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537D82642A8CC008B27DF /* spcflags.h */; };
|
||||
E4F537EE2642A8E8008B27DF /* codegen_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537E62642A8E8008B27DF /* codegen_x86.h */; };
|
||||
E4F537EF2642A8E8008B27DF /* compemu_fpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */; };
|
||||
E4F537F02642A8E8008B27DF /* compemu_support.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537E82642A8E8008B27DF /* compemu_support.cpp */; };
|
||||
E4F537F12642A8E8008B27DF /* compemu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537E92642A8E8008B27DF /* compemu.h */; };
|
||||
E4F537F22642A8E8008B27DF /* flags_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537EA2642A8E8008B27DF /* flags_x86.h */; };
|
||||
E4F537F32642A8E8008B27DF /* gencomp.c in Sources */ = {isa = PBXBuildFile; fileRef = E4F537EB2642A8E8008B27DF /* gencomp.c */; };
|
||||
E4F538092642A904008B27DF /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537F62642A904008B27DF /* core.h */; };
|
||||
E4F5380A2642A904008B27DF /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537F72642A904008B27DF /* exceptions.cpp */; };
|
||||
E4F5380B2642A904008B27DF /* exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537F82642A904008B27DF /* exceptions.h */; };
|
||||
E4F5380C2642A904008B27DF /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537F92642A904008B27DF /* flags.cpp */; };
|
||||
E4F5380D2642A904008B27DF /* flags.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537FA2642A904008B27DF /* flags.h */; };
|
||||
E4F5380E2642A904008B27DF /* fpu_ieee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F537FB2642A904008B27DF /* fpu_ieee.cpp */; };
|
||||
E4F5380F2642A904008B27DF /* fpu_ieee.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F537FC2642A904008B27DF /* fpu_ieee.h */; };
|
||||
E4F538152642A904008B27DF /* fpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538022642A904008B27DF /* fpu.h */; };
|
||||
E4F538162642A904008B27DF /* impl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538032642A904008B27DF /* impl.h */; };
|
||||
E4F538172642A904008B27DF /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F538042642A904008B27DF /* mathlib.cpp */; };
|
||||
E4F538182642A904008B27DF /* mathlib.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538052642A904008B27DF /* mathlib.h */; };
|
||||
E4F538192642A904008B27DF /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F538062642A904008B27DF /* rounding.cpp */; };
|
||||
E4F5381A2642A904008B27DF /* rounding.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538072642A904008B27DF /* rounding.h */; };
|
||||
E4F5381B2642A904008B27DF /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F538082642A904008B27DF /* types.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E4C1B49A2642B05A00EB55A0 /* compemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu.cpp; path = gencpu_output/compemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compstbl.cpp; path = gencpu_output/compstbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B49C2642B05A00EB55A0 /* comptbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = comptbl.h; path = gencpu_output/comptbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B49D2642B05A00EB55A0 /* cpuemu_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu_nf.cpp; path = gencpu_output/cpuemu_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl_nf.cpp; path = gencpu_output/cpustbl_nf.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B4A12642B05A00EB55A0 /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4C1B4A22642B05A00EB55A0 /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libuae_cpu_x86_64.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basilisk_glue.cpp; path = ../uae_cpu/basilisk_glue.cpp; sourceTree = "<group>"; };
|
||||
E4F537CB2642A8C2008B27DF /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpu_emulation.h; path = ../uae_cpu/cpu_emulation.h; sourceTree = "<group>"; };
|
||||
E4F537D02642A8CC008B27DF /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m68k.h; path = ../uae_cpu/m68k.h; sourceTree = "<group>"; };
|
||||
E4F537D12642A8CC008B27DF /* memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memory.cpp; path = ../uae_cpu/memory.cpp; sourceTree = "<group>"; };
|
||||
E4F537D22642A8CC008B27DF /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = memory.h; path = ../uae_cpu/memory.h; sourceTree = "<group>"; };
|
||||
E4F537D32642A8CC008B27DF /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = newcpu.cpp; path = ../uae_cpu/newcpu.cpp; sourceTree = "<group>"; };
|
||||
E4F537D42642A8CC008B27DF /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = newcpu.h; path = ../uae_cpu/newcpu.h; sourceTree = "<group>"; };
|
||||
E4F537D52642A8CC008B27DF /* noflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = noflags.h; path = ../uae_cpu/noflags.h; sourceTree = "<group>"; };
|
||||
E4F537D62642A8CC008B27DF /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = readcpu.cpp; path = ../uae_cpu/readcpu.cpp; sourceTree = "<group>"; };
|
||||
E4F537D72642A8CC008B27DF /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = readcpu.h; path = ../uae_cpu/readcpu.h; sourceTree = "<group>"; };
|
||||
E4F537D82642A8CC008B27DF /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spcflags.h; path = ../uae_cpu/spcflags.h; sourceTree = "<group>"; };
|
||||
E4F537D92642A8CC008B27DF /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = table68k; path = ../uae_cpu/table68k; sourceTree = "<group>"; };
|
||||
E4F537E62642A8E8008B27DF /* codegen_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codegen_x86.h; path = ../uae_cpu/compiler/codegen_x86.h; sourceTree = "<group>"; };
|
||||
E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu_fpp.cpp; path = ../uae_cpu/compiler/compemu_fpp.cpp; sourceTree = "<group>"; };
|
||||
E4F537E82642A8E8008B27DF /* compemu_support.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compemu_support.cpp; path = ../uae_cpu/compiler/compemu_support.cpp; sourceTree = "<group>"; };
|
||||
E4F537E92642A8E8008B27DF /* compemu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compemu.h; path = ../uae_cpu/compiler/compemu.h; sourceTree = "<group>"; };
|
||||
E4F537EA2642A8E8008B27DF /* flags_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags_x86.h; path = ../uae_cpu/compiler/flags_x86.h; sourceTree = "<group>"; };
|
||||
E4F537EB2642A8E8008B27DF /* gencomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gencomp.c; path = ../uae_cpu/compiler/gencomp.c; sourceTree = "<group>"; };
|
||||
E4F537F62642A904008B27DF /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../uae_cpu/fpu/core.h; sourceTree = "<group>"; };
|
||||
E4F537F72642A904008B27DF /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exceptions.cpp; path = ../uae_cpu/fpu/exceptions.cpp; sourceTree = "<group>"; };
|
||||
E4F537F82642A904008B27DF /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exceptions.h; path = ../uae_cpu/fpu/exceptions.h; sourceTree = "<group>"; };
|
||||
E4F537F92642A904008B27DF /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flags.cpp; path = ../uae_cpu/fpu/flags.cpp; sourceTree = "<group>"; };
|
||||
E4F537FA2642A904008B27DF /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags.h; path = ../uae_cpu/fpu/flags.h; sourceTree = "<group>"; };
|
||||
E4F537FB2642A904008B27DF /* fpu_ieee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fpu_ieee.cpp; path = ../uae_cpu/fpu/fpu_ieee.cpp; sourceTree = "<group>"; };
|
||||
E4F537FC2642A904008B27DF /* fpu_ieee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu_ieee.h; path = ../uae_cpu/fpu/fpu_ieee.h; sourceTree = "<group>"; };
|
||||
E4F538022642A904008B27DF /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu.h; path = ../uae_cpu/fpu/fpu.h; sourceTree = "<group>"; };
|
||||
E4F538032642A904008B27DF /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = impl.h; path = ../uae_cpu/fpu/impl.h; sourceTree = "<group>"; };
|
||||
E4F538042642A904008B27DF /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlib.cpp; path = ../uae_cpu/fpu/mathlib.cpp; sourceTree = "<group>"; };
|
||||
E4F538052642A904008B27DF /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlib.h; path = ../uae_cpu/fpu/mathlib.h; sourceTree = "<group>"; };
|
||||
E4F538062642A904008B27DF /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rounding.cpp; path = ../uae_cpu/fpu/rounding.cpp; sourceTree = "<group>"; };
|
||||
E4F538072642A904008B27DF /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rounding.h; path = ../uae_cpu/fpu/rounding.h; sourceTree = "<group>"; };
|
||||
E4F538082642A904008B27DF /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../uae_cpu/fpu/types.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
E4F537BD2642A86D008B27DF /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
E4C1B4982642AF3400EB55A0 /* generated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4C1B49A2642B05A00EB55A0 /* compemu.cpp */,
|
||||
E4C1B49B2642B05A00EB55A0 /* compstbl.cpp */,
|
||||
E4C1B49C2642B05A00EB55A0 /* comptbl.h */,
|
||||
E4C1B49D2642B05A00EB55A0 /* cpuemu_nf.cpp */,
|
||||
E4C1B49E2642B05A00EB55A0 /* cpuemu.cpp */,
|
||||
E4C1B49F2642B05A00EB55A0 /* cpustbl_nf.cpp */,
|
||||
E4C1B4A02642B05A00EB55A0 /* cpustbl.cpp */,
|
||||
E4C1B4A12642B05A00EB55A0 /* cputbl.h */,
|
||||
E4C1B4A22642B05A00EB55A0 /* defs68k.c */,
|
||||
);
|
||||
name = generated;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E4F537B72642A86D008B27DF = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4F537C72642A8BA008B27DF /* basilisk_glue.cpp */,
|
||||
E4F537E42642A8D2008B27DF /* compiler */,
|
||||
E4F537CB2642A8C2008B27DF /* cpu_emulation.h */,
|
||||
E4F537F52642A8ED008B27DF /* fpu */,
|
||||
E4F537D02642A8CC008B27DF /* m68k.h */,
|
||||
E4F537D12642A8CC008B27DF /* memory.cpp */,
|
||||
E4F537D22642A8CC008B27DF /* memory.h */,
|
||||
E4F537D32642A8CC008B27DF /* newcpu.cpp */,
|
||||
E4F537D42642A8CC008B27DF /* newcpu.h */,
|
||||
E4F537D52642A8CC008B27DF /* noflags.h */,
|
||||
E4F537D62642A8CC008B27DF /* readcpu.cpp */,
|
||||
E4F537D72642A8CC008B27DF /* readcpu.h */,
|
||||
E4F537D82642A8CC008B27DF /* spcflags.h */,
|
||||
E4F537D92642A8CC008B27DF /* table68k */,
|
||||
E4C1B4982642AF3400EB55A0 /* generated */,
|
||||
E4F537C12642A86D008B27DF /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E4F537C12642A86D008B27DF /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E4F537E42642A8D2008B27DF /* compiler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4F537E62642A8E8008B27DF /* codegen_x86.h */,
|
||||
E4F537E72642A8E8008B27DF /* compemu_fpp.cpp */,
|
||||
E4F537E82642A8E8008B27DF /* compemu_support.cpp */,
|
||||
E4F537E92642A8E8008B27DF /* compemu.h */,
|
||||
E4F537EA2642A8E8008B27DF /* flags_x86.h */,
|
||||
E4F537EB2642A8E8008B27DF /* gencomp.c */,
|
||||
);
|
||||
name = compiler;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E4F537F52642A8ED008B27DF /* fpu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4F537F62642A904008B27DF /* core.h */,
|
||||
E4F537F72642A904008B27DF /* exceptions.cpp */,
|
||||
E4F537F82642A904008B27DF /* exceptions.h */,
|
||||
E4F537F92642A904008B27DF /* flags.cpp */,
|
||||
E4F537FA2642A904008B27DF /* flags.h */,
|
||||
E4F537FB2642A904008B27DF /* fpu_ieee.cpp */,
|
||||
E4F537FC2642A904008B27DF /* fpu_ieee.h */,
|
||||
E4F538022642A904008B27DF /* fpu.h */,
|
||||
E4F538032642A904008B27DF /* impl.h */,
|
||||
E4F538042642A904008B27DF /* mathlib.cpp */,
|
||||
E4F538052642A904008B27DF /* mathlib.h */,
|
||||
E4F538062642A904008B27DF /* rounding.cpp */,
|
||||
E4F538072642A904008B27DF /* rounding.h */,
|
||||
E4F538082642A904008B27DF /* types.h */,
|
||||
);
|
||||
name = fpu;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
E4F537BE2642A86D008B27DF /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E4F538182642A904008B27DF /* mathlib.h in Headers */,
|
||||
E4F538152642A904008B27DF /* fpu.h in Headers */,
|
||||
E4F5380F2642A904008B27DF /* fpu_ieee.h in Headers */,
|
||||
E4F537F12642A8E8008B27DF /* compemu.h in Headers */,
|
||||
E4F538092642A904008B27DF /* core.h in Headers */,
|
||||
E4C1B4AA2642B05A00EB55A0 /* cputbl.h in Headers */,
|
||||
E4F5381B2642A904008B27DF /* types.h in Headers */,
|
||||
E4F537DF2642A8CC008B27DF /* newcpu.h in Headers */,
|
||||
E4F5380D2642A904008B27DF /* flags.h in Headers */,
|
||||
E4F537E22642A8CC008B27DF /* readcpu.h in Headers */,
|
||||
E4F5381A2642A904008B27DF /* rounding.h in Headers */,
|
||||
E4C1B4A52642B05A00EB55A0 /* comptbl.h in Headers */,
|
||||
E4F5380B2642A904008B27DF /* exceptions.h in Headers */,
|
||||
E4F537E32642A8CC008B27DF /* spcflags.h in Headers */,
|
||||
E4F537DB2642A8CC008B27DF /* m68k.h in Headers */,
|
||||
E4F537F22642A8E8008B27DF /* flags_x86.h in Headers */,
|
||||
E4F538162642A904008B27DF /* impl.h in Headers */,
|
||||
E4F537CD2642A8C2008B27DF /* cpu_emulation.h in Headers */,
|
||||
E4F537EE2642A8E8008B27DF /* codegen_x86.h in Headers */,
|
||||
E4F537DD2642A8CC008B27DF /* memory.h in Headers */,
|
||||
E4F537E02642A8CC008B27DF /* noflags.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
E4F537BF2642A86D008B27DF /* uae_cpu_x86_64 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E4F537C42642A86D008B27DF /* Build configuration list for PBXNativeTarget "uae_cpu_x86_64" */;
|
||||
buildPhases = (
|
||||
E4C1B4992642AF5100EB55A0 /* ShellScript */,
|
||||
E4F537BC2642A86D008B27DF /* Sources */,
|
||||
E4F537BD2642A86D008B27DF /* Frameworks */,
|
||||
E4F537BE2642A86D008B27DF /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = uae_cpu_x86_64;
|
||||
productName = uae_cpu;
|
||||
productReference = E4F537C02642A86D008B27DF /* libuae_cpu_x86_64.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E4F537B82642A86D008B27DF /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0820;
|
||||
TargetAttributes = {
|
||||
E4F537BF2642A86D008B27DF = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = E4F537BB2642A86D008B27DF /* Build configuration list for PBXProject "uae_cpu" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = E4F537B72642A86D008B27DF;
|
||||
productRefGroup = E4F537C12642A86D008B27DF /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
E4F537BF2642A86D008B27DF /* uae_cpu_x86_64 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
E4C1B4992642AF5100EB55A0 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpuemu_nf.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/cpustbl_nf.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/defs68k.c,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/compemu.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output/compstbl.cpp,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "make -f Makefile.gencpu\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
E4F537BC2642A86D008B27DF /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E4C1B4A62642B05A00EB55A0 /* cpuemu_nf.cpp in Sources */,
|
||||
E4C1B4A32642B05A00EB55A0 /* compemu.cpp in Sources */,
|
||||
E4F538192642A904008B27DF /* rounding.cpp in Sources */,
|
||||
E4F537E12642A8CC008B27DF /* readcpu.cpp in Sources */,
|
||||
E4F5380C2642A904008B27DF /* flags.cpp in Sources */,
|
||||
E4F537EF2642A8E8008B27DF /* compemu_fpp.cpp in Sources */,
|
||||
E4F538172642A904008B27DF /* mathlib.cpp in Sources */,
|
||||
E4F537F02642A8E8008B27DF /* compemu_support.cpp in Sources */,
|
||||
E4F537DC2642A8CC008B27DF /* memory.cpp in Sources */,
|
||||
E4C1B4A42642B05A00EB55A0 /* compstbl.cpp in Sources */,
|
||||
E4C1B4AB2642B05A00EB55A0 /* defs68k.c in Sources */,
|
||||
E4C1B4A92642B05A00EB55A0 /* cpustbl.cpp in Sources */,
|
||||
E4F537C92642A8BA008B27DF /* basilisk_glue.cpp in Sources */,
|
||||
E4F537F32642A8E8008B27DF /* gencomp.c in Sources */,
|
||||
E4F5380E2642A904008B27DF /* fpu_ieee.cpp in Sources */,
|
||||
E4C1B4A72642B05A00EB55A0 /* cpuemu.cpp in Sources */,
|
||||
E4C1B4A82642B05A00EB55A0 /* cpustbl_nf.cpp in Sources */,
|
||||
E4F537DE2642A8CC008B27DF /* newcpu.cpp in Sources */,
|
||||
E4F5380A2642A904008B27DF /* exceptions.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
E4F537C22642A86D008B27DF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E4F537C32642A86D008B27DF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E4F537C52642A86D008B27DF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = x86_64;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"USE_XCODE=1",
|
||||
CPU_x86_64,
|
||||
JIT,
|
||||
"USE_JIT=1",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../CrossPlatform,
|
||||
../include,
|
||||
../MacOSX,
|
||||
../uae_cpu,
|
||||
../Unix,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E4F537C62642A86D008B27DF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = x86_64;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"USE_XCODE=1",
|
||||
CPU_x86_64,
|
||||
JIT,
|
||||
"USE_JIT=1",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../CrossPlatform,
|
||||
../include,
|
||||
../MacOSX,
|
||||
../uae_cpu,
|
||||
../Unix,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
E4F537BB2642A86D008B27DF /* Build configuration list for PBXProject "uae_cpu" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E4F537C22642A86D008B27DF /* Debug */,
|
||||
E4F537C32642A86D008B27DF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E4F537C42642A86D008B27DF /* Build configuration list for PBXNativeTarget "uae_cpu_x86_64" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E4F537C52642A86D008B27DF /* Debug */,
|
||||
E4F537C62642A86D008B27DF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E4F537B82642A86D008B27DF /* Project object */;
|
||||
}
|
|
@ -0,0 +1,429 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
E41D7AAA2642C070005E8093 /* basilisk_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AA82642C070005E8093 /* basilisk_glue.cpp */; };
|
||||
E41D7AAE2642C07C005E8093 /* cpu_emulation.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AAC2642C07C005E8093 /* cpu_emulation.h */; };
|
||||
E41D7AAF2642C07C005E8093 /* cpummu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AAD2642C07C005E8093 /* cpummu.h */; };
|
||||
E41D7ABB2642C087005E8093 /* m68k.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB12642C087005E8093 /* m68k.h */; };
|
||||
E41D7ABC2642C087005E8093 /* memory.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB22642C087005E8093 /* memory.h */; };
|
||||
E41D7ABD2642C087005E8093 /* newcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AB32642C087005E8093 /* newcpu.cpp */; };
|
||||
E41D7ABE2642C087005E8093 /* newcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB42642C087005E8093 /* newcpu.h */; };
|
||||
E41D7ABF2642C087005E8093 /* readcpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AB52642C087005E8093 /* readcpu.cpp */; };
|
||||
E41D7AC02642C087005E8093 /* readcpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB62642C087005E8093 /* readcpu.h */; };
|
||||
E41D7AC12642C087005E8093 /* registers.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB72642C087005E8093 /* registers.h */; };
|
||||
E41D7AC22642C087005E8093 /* spcflags.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AB82642C087005E8093 /* spcflags.h */; };
|
||||
E41D7AD82642C0A4005E8093 /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC42642C0A4005E8093 /* core.h */; };
|
||||
E41D7AD92642C0A4005E8093 /* exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AC52642C0A4005E8093 /* exceptions.cpp */; };
|
||||
E41D7ADA2642C0A4005E8093 /* exceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC62642C0A4005E8093 /* exceptions.h */; };
|
||||
E41D7ADB2642C0A4005E8093 /* flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AC72642C0A4005E8093 /* flags.cpp */; };
|
||||
E41D7ADC2642C0A4005E8093 /* flags.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AC82642C0A4005E8093 /* flags.h */; };
|
||||
E41D7ADF2642C0A4005E8093 /* fpu_mpfr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */; };
|
||||
E41D7AE52642C0A4005E8093 /* fpu.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD12642C0A4005E8093 /* fpu.h */; };
|
||||
E41D7AE62642C0A4005E8093 /* impl.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD22642C0A4005E8093 /* impl.h */; };
|
||||
E41D7AE72642C0A4005E8093 /* mathlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AD32642C0A4005E8093 /* mathlib.cpp */; };
|
||||
E41D7AE82642C0A4005E8093 /* mathlib.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD42642C0A4005E8093 /* mathlib.h */; };
|
||||
E41D7AE92642C0A4005E8093 /* rounding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41D7AD52642C0A4005E8093 /* rounding.cpp */; };
|
||||
E41D7AEA2642C0A4005E8093 /* rounding.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD62642C0A4005E8093 /* rounding.h */; };
|
||||
E41D7AEB2642C0A4005E8093 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = E41D7AD72642C0A4005E8093 /* types.h */; };
|
||||
E4FC27512642C45E00C64E21 /* cpufunctbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */; };
|
||||
E4FC27522642C45E00C64E21 /* cpuemu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274D2642C45E00C64E21 /* cpuemu.cpp */; };
|
||||
E4FC27532642C45E00C64E21 /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FC274E2642C45E00C64E21 /* cpustbl.cpp */; };
|
||||
E4FC27542642C45E00C64E21 /* cputbl.h in Headers */ = {isa = PBXBuildFile; fileRef = E4FC274F2642C45E00C64E21 /* cputbl.h */; };
|
||||
E4FC27552642C45E00C64E21 /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = E4FC27502642C45E00C64E21 /* defs68k.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libuae_cpu_arm64.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E41D7AA82642C070005E8093 /* basilisk_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basilisk_glue.cpp; path = ../uae_cpu_2021/basilisk_glue.cpp; sourceTree = "<group>"; };
|
||||
E41D7AAC2642C07C005E8093 /* cpu_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpu_emulation.h; path = ../uae_cpu_2021/cpu_emulation.h; sourceTree = "<group>"; };
|
||||
E41D7AAD2642C07C005E8093 /* cpummu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpummu.h; path = ../uae_cpu_2021/cpummu.h; sourceTree = "<group>"; };
|
||||
E41D7AB12642C087005E8093 /* m68k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m68k.h; path = ../uae_cpu_2021/m68k.h; sourceTree = "<group>"; };
|
||||
E41D7AB22642C087005E8093 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = memory.h; path = ../uae_cpu_2021/memory.h; sourceTree = "<group>"; };
|
||||
E41D7AB32642C087005E8093 /* newcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = newcpu.cpp; path = ../uae_cpu_2021/newcpu.cpp; sourceTree = "<group>"; };
|
||||
E41D7AB42642C087005E8093 /* newcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = newcpu.h; path = ../uae_cpu_2021/newcpu.h; sourceTree = "<group>"; };
|
||||
E41D7AB52642C087005E8093 /* readcpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = readcpu.cpp; path = ../uae_cpu_2021/readcpu.cpp; sourceTree = "<group>"; };
|
||||
E41D7AB62642C087005E8093 /* readcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = readcpu.h; path = ../uae_cpu_2021/readcpu.h; sourceTree = "<group>"; };
|
||||
E41D7AB72642C087005E8093 /* registers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = registers.h; path = ../uae_cpu_2021/registers.h; sourceTree = "<group>"; };
|
||||
E41D7AB82642C087005E8093 /* spcflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spcflags.h; path = ../uae_cpu_2021/spcflags.h; sourceTree = "<group>"; };
|
||||
E41D7AB92642C087005E8093 /* table68k */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = table68k; path = ../uae_cpu_2021/table68k; sourceTree = "<group>"; };
|
||||
E41D7AC42642C0A4005E8093 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../uae_cpu_2021/fpu/core.h; sourceTree = "<group>"; };
|
||||
E41D7AC52642C0A4005E8093 /* exceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exceptions.cpp; path = ../uae_cpu_2021/fpu/exceptions.cpp; sourceTree = "<group>"; };
|
||||
E41D7AC62642C0A4005E8093 /* exceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exceptions.h; path = ../uae_cpu_2021/fpu/exceptions.h; sourceTree = "<group>"; };
|
||||
E41D7AC72642C0A4005E8093 /* flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flags.cpp; path = ../uae_cpu_2021/fpu/flags.cpp; sourceTree = "<group>"; };
|
||||
E41D7AC82642C0A4005E8093 /* flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flags.h; path = ../uae_cpu_2021/fpu/flags.h; sourceTree = "<group>"; };
|
||||
E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fpu_mpfr.cpp; path = ../uae_cpu_2021/fpu/fpu_mpfr.cpp; sourceTree = "<group>"; };
|
||||
E41D7AD12642C0A4005E8093 /* fpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fpu.h; path = ../uae_cpu_2021/fpu/fpu.h; sourceTree = "<group>"; };
|
||||
E41D7AD22642C0A4005E8093 /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = impl.h; path = ../uae_cpu_2021/fpu/impl.h; sourceTree = "<group>"; };
|
||||
E41D7AD32642C0A4005E8093 /* mathlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlib.cpp; path = ../uae_cpu_2021/fpu/mathlib.cpp; sourceTree = "<group>"; };
|
||||
E41D7AD42642C0A4005E8093 /* mathlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlib.h; path = ../uae_cpu_2021/fpu/mathlib.h; sourceTree = "<group>"; };
|
||||
E41D7AD52642C0A4005E8093 /* rounding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rounding.cpp; path = ../uae_cpu_2021/fpu/rounding.cpp; sourceTree = "<group>"; };
|
||||
E41D7AD62642C0A4005E8093 /* rounding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rounding.h; path = ../uae_cpu_2021/fpu/rounding.h; sourceTree = "<group>"; };
|
||||
E41D7AD72642C0A4005E8093 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../uae_cpu_2021/fpu/types.h; sourceTree = "<group>"; };
|
||||
E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpufunctbl.cpp; path = gencpu_output_2021/cpufunctbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4FC274D2642C45E00C64E21 /* cpuemu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpuemu.cpp; path = gencpu_output_2021/cpuemu.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4FC274E2642C45E00C64E21 /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpustbl.cpp; path = gencpu_output_2021/cpustbl.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4FC274F2642C45E00C64E21 /* cputbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cputbl.h; path = gencpu_output_2021/cputbl.h; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E4FC27502642C45E00C64E21 /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = defs68k.c; path = gencpu_output_2021/defs68k.c; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
E41D7A9E2642C004005E8093 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
E41D7A982642C004005E8093 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E41D7AA82642C070005E8093 /* basilisk_glue.cpp */,
|
||||
E41D7AC32642C08E005E8093 /* fpu */,
|
||||
E41D7AAC2642C07C005E8093 /* cpu_emulation.h */,
|
||||
E41D7AAD2642C07C005E8093 /* cpummu.h */,
|
||||
E41D7AB12642C087005E8093 /* m68k.h */,
|
||||
E41D7AB22642C087005E8093 /* memory.h */,
|
||||
E41D7AB32642C087005E8093 /* newcpu.cpp */,
|
||||
E41D7AB42642C087005E8093 /* newcpu.h */,
|
||||
E41D7AB52642C087005E8093 /* readcpu.cpp */,
|
||||
E41D7AB62642C087005E8093 /* readcpu.h */,
|
||||
E41D7AB72642C087005E8093 /* registers.h */,
|
||||
E41D7AB82642C087005E8093 /* spcflags.h */,
|
||||
E41D7AB92642C087005E8093 /* table68k */,
|
||||
E4FC274B2642C44A00C64E21 /* generated */,
|
||||
E41D7AA22642C004005E8093 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E41D7AA22642C004005E8093 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E41D7AC32642C08E005E8093 /* fpu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E41D7AC42642C0A4005E8093 /* core.h */,
|
||||
E41D7AC52642C0A4005E8093 /* exceptions.cpp */,
|
||||
E41D7AC62642C0A4005E8093 /* exceptions.h */,
|
||||
E41D7AC72642C0A4005E8093 /* flags.cpp */,
|
||||
E41D7AC82642C0A4005E8093 /* flags.h */,
|
||||
E41D7ACB2642C0A4005E8093 /* fpu_mpfr.cpp */,
|
||||
E41D7AD12642C0A4005E8093 /* fpu.h */,
|
||||
E41D7AD22642C0A4005E8093 /* impl.h */,
|
||||
E41D7AD32642C0A4005E8093 /* mathlib.cpp */,
|
||||
E41D7AD42642C0A4005E8093 /* mathlib.h */,
|
||||
E41D7AD52642C0A4005E8093 /* rounding.cpp */,
|
||||
E41D7AD62642C0A4005E8093 /* rounding.h */,
|
||||
E41D7AD72642C0A4005E8093 /* types.h */,
|
||||
);
|
||||
name = fpu;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E4FC274B2642C44A00C64E21 /* generated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E4FC274D2642C45E00C64E21 /* cpuemu.cpp */,
|
||||
E4FC274C2642C45E00C64E21 /* cpufunctbl.cpp */,
|
||||
E4FC274E2642C45E00C64E21 /* cpustbl.cpp */,
|
||||
E4FC274F2642C45E00C64E21 /* cputbl.h */,
|
||||
E4FC27502642C45E00C64E21 /* defs68k.c */,
|
||||
);
|
||||
path = generated;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
E41D7A9F2642C004005E8093 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E41D7AE82642C0A4005E8093 /* mathlib.h in Headers */,
|
||||
E41D7ADA2642C0A4005E8093 /* exceptions.h in Headers */,
|
||||
E41D7ABB2642C087005E8093 /* m68k.h in Headers */,
|
||||
E41D7AC02642C087005E8093 /* readcpu.h in Headers */,
|
||||
E41D7AEA2642C0A4005E8093 /* rounding.h in Headers */,
|
||||
E41D7AAE2642C07C005E8093 /* cpu_emulation.h in Headers */,
|
||||
E41D7AC22642C087005E8093 /* spcflags.h in Headers */,
|
||||
E41D7AE52642C0A4005E8093 /* fpu.h in Headers */,
|
||||
E41D7AAF2642C07C005E8093 /* cpummu.h in Headers */,
|
||||
E41D7AC12642C087005E8093 /* registers.h in Headers */,
|
||||
E41D7AD82642C0A4005E8093 /* core.h in Headers */,
|
||||
E4FC27542642C45E00C64E21 /* cputbl.h in Headers */,
|
||||
E41D7ABE2642C087005E8093 /* newcpu.h in Headers */,
|
||||
E41D7AE62642C0A4005E8093 /* impl.h in Headers */,
|
||||
E41D7ABC2642C087005E8093 /* memory.h in Headers */,
|
||||
E41D7AEB2642C0A4005E8093 /* types.h in Headers */,
|
||||
E41D7ADC2642C0A4005E8093 /* flags.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
E41D7AA02642C004005E8093 /* uae_cpu_arm64 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E41D7AA52642C004005E8093 /* Build configuration list for PBXNativeTarget "uae_cpu_arm64" */;
|
||||
buildPhases = (
|
||||
E4FC27492642C2E600C64E21 /* ShellScript */,
|
||||
E41D7A9D2642C004005E8093 /* Sources */,
|
||||
E41D7A9E2642C004005E8093 /* Frameworks */,
|
||||
E41D7A9F2642C004005E8093 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = uae_cpu_arm64;
|
||||
productName = uae_cpu_2021;
|
||||
productReference = E41D7AA12642C004005E8093 /* libuae_cpu_arm64.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E41D7A992642C004005E8093 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0820;
|
||||
TargetAttributes = {
|
||||
E41D7AA02642C004005E8093 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = E41D7A9C2642C004005E8093 /* Build configuration list for PBXProject "uae_cpu_2021" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = E41D7A982642C004005E8093;
|
||||
productRefGroup = E41D7AA22642C004005E8093 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
E41D7AA02642C004005E8093 /* uae_cpu_arm64 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
E4FC27492642C2E600C64E21 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpuemu.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpufunctbl.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cpustbl.cpp,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output_2021/cputbl.h,
|
||||
$BUILT_PRODUCTS_DIR/gencpu_output_2021/defs68k.c,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "make -f Makefile.gencpu_2021\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
E41D7A9D2642C004005E8093 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E4FC27512642C45E00C64E21 /* cpufunctbl.cpp in Sources */,
|
||||
E41D7ADB2642C0A4005E8093 /* flags.cpp in Sources */,
|
||||
E41D7ADF2642C0A4005E8093 /* fpu_mpfr.cpp in Sources */,
|
||||
E41D7ABD2642C087005E8093 /* newcpu.cpp in Sources */,
|
||||
E4FC27552642C45E00C64E21 /* defs68k.c in Sources */,
|
||||
E41D7AE72642C0A4005E8093 /* mathlib.cpp in Sources */,
|
||||
E4FC27522642C45E00C64E21 /* cpuemu.cpp in Sources */,
|
||||
E4FC27532642C45E00C64E21 /* cpustbl.cpp in Sources */,
|
||||
E41D7AD92642C0A4005E8093 /* exceptions.cpp in Sources */,
|
||||
E41D7AAA2642C070005E8093 /* basilisk_glue.cpp in Sources */,
|
||||
E41D7ABF2642C087005E8093 /* readcpu.cpp in Sources */,
|
||||
E41D7AE92642C0A4005E8093 /* rounding.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
E41D7AA32642C004005E8093 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E41D7AA42642C004005E8093 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E41D7AA62642C004005E8093 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"USE_XCODE=1",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/usr/local/include,
|
||||
../CrossPlatform,
|
||||
../include,
|
||||
../MacOSX,
|
||||
../uae_cpu_2021,
|
||||
../Unix,
|
||||
);
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VALID_ARCHS = arm64;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E41D7AA72642C004005E8093 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "USE_XCODE=1";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/usr/local/include,
|
||||
../CrossPlatform,
|
||||
../include,
|
||||
../MacOSX,
|
||||
../uae_cpu_2021,
|
||||
../Unix,
|
||||
);
|
||||
OTHER_CFLAGS = "-fwrapv";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VALID_ARCHS = arm64;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
E41D7A9C2642C004005E8093 /* Build configuration list for PBXProject "uae_cpu_2021" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E41D7AA32642C004005E8093 /* Debug */,
|
||||
E41D7AA42642C004005E8093 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E41D7AA52642C004005E8093 /* Build configuration list for PBXNativeTarget "uae_cpu_arm64" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E41D7AA62642C004005E8093 /* Debug */,
|
||||
E41D7AA72642C004005E8093 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E41D7A992642C004005E8093 /* Project object */;
|
||||
}
|
|
@ -24,4 +24,17 @@
|
|||
// Invokes the specified function with an NSAutoReleasePool in place.
|
||||
void NSAutoReleasePool_wrap(void (*fn)(void));
|
||||
|
||||
#ifdef USE_SDL
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
|
||||
bool is_fullscreen_osx(SDL_Window * window);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void set_menu_bar_visible_osx(bool visible);
|
||||
|
||||
void set_current_directory();
|
||||
|
||||
bool MetalIsAvailable();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,13 +20,16 @@
|
|||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include "sysdeps.h"
|
||||
#include "utils_macosx.h"
|
||||
#include <SDL.h>
|
||||
#include "utils_macosx.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#include <SDL_syswm.h>
|
||||
#endif
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <Metal/Metal.h>
|
||||
|
||||
// This is used from video_sdl.cpp.
|
||||
void NSAutoReleasePool_wrap(void (*fn)(void))
|
||||
{
|
||||
|
@ -58,13 +61,16 @@ bool is_fullscreen_osx(SDL_Window * window)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
NSWindow *nswindow = (NSWindow *)SDL_GetProperty(props, "SDL.window.cocoa.window", NULL);
|
||||
#else
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
if (!SDL_GetWindowWMInfo(window, &wmInfo)) {
|
||||
return false;
|
||||
}
|
||||
NSWindow *nswindow = SDL_GetWindowWMInfo(window, &wmInfo) ? wmInfo.info.cocoa.window : nil;
|
||||
#endif
|
||||
|
||||
const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
|
||||
const NSWindowStyleMask styleMask = [nswindow styleMask];
|
||||
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -81,3 +87,14 @@ void set_current_directory()
|
|||
[pool release];
|
||||
}
|
||||
|
||||
bool MetalIsAvailable() {
|
||||
const int EL_CAPITAN = 15; // Darwin major version of El Capitan
|
||||
char s[16];
|
||||
size_t size = sizeof(s);
|
||||
int v;
|
||||
if (sysctlbyname("kern.osrelease", s, &size, NULL, 0) || sscanf(s, "%d", &v) != 1 || v < EL_CAPITAN) return false;
|
||||
id<MTLDevice> dev = MTLCreateSystemDefaultDevice();
|
||||
bool r = dev != nil;
|
||||
[dev release];
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,15 @@
|
|||
#include <SDL_mutex.h>
|
||||
#include <SDL_audio.h>
|
||||
#include <SDL_version.h>
|
||||
#include <SDL_timer.h>
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#if defined(BINCUE)
|
||||
#include "bincue_unix.h"
|
||||
#include "bincue.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -49,11 +52,14 @@ static int audio_channel_count_index = 0;
|
|||
static SDL_sem *audio_irq_done_sem = NULL; // Signal from interrupt to streaming thread: data block read
|
||||
static uint8 silence_byte; // Byte value to use to fill sound buffers with silence
|
||||
static uint8 *audio_mix_buf = NULL;
|
||||
static int audio_volume = SDL_MIX_MAXVOLUME;
|
||||
static bool audio_mute = false;
|
||||
static int main_volume = MAC_MAX_VOLUME;
|
||||
static int speaker_volume = MAC_MAX_VOLUME;
|
||||
static bool main_mute = false;
|
||||
static bool speaker_mute = false;
|
||||
|
||||
// Prototypes
|
||||
static void stream_func(void *arg, uint8 *stream, int stream_len);
|
||||
static int get_audio_volume();
|
||||
|
||||
|
||||
/*
|
||||
|
@ -92,7 +98,7 @@ static bool open_sdl_audio(void)
|
|||
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
|
||||
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? AUDIO_U8 : AUDIO_S16MSB;
|
||||
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
|
||||
audio_spec.samples = 4096;
|
||||
audio_spec.samples = 4096 >> PrefsFindInt32("sound_buffer");
|
||||
audio_spec.callback = stream_func;
|
||||
audio_spec.userdata = NULL;
|
||||
|
||||
|
@ -112,7 +118,7 @@ static bool open_sdl_audio(void)
|
|||
|
||||
#if defined(BINCUE)
|
||||
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels,
|
||||
audio_spec.silence, audio_volume);
|
||||
audio_spec.silence, get_audio_volume());
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
|
@ -228,7 +234,7 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
|
|||
|
||||
// Get size of audio data
|
||||
uint32 apple_stream_info = ReadMacInt32(audio_data + adatStreamInfo);
|
||||
if (apple_stream_info && !audio_mute) {
|
||||
if (apple_stream_info && !main_mute && !speaker_mute) {
|
||||
int work_size = ReadMacInt32(apple_stream_info + scd_sampleCount) * (AudioStatus.sample_size >> 3) * AudioStatus.channels;
|
||||
D(bug("stream: work_size %d\n", work_size));
|
||||
if (work_size > stream_len)
|
||||
|
@ -239,7 +245,7 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
|
|||
// Send data to audio device
|
||||
Mac2Host_memcpy(audio_mix_buf, ReadMacInt32(apple_stream_info + scd_buffer), work_size);
|
||||
memset((uint8 *)stream, silence_byte, stream_len);
|
||||
SDL_MixAudio(stream, audio_mix_buf, work_size, audio_volume);
|
||||
SDL_MixAudio(stream, audio_mix_buf, work_size, get_audio_volume());
|
||||
|
||||
D(bug("stream: data written\n"));
|
||||
|
||||
|
@ -249,11 +255,13 @@ static void stream_func(void *arg, uint8 *stream, int stream_len)
|
|||
} else {
|
||||
|
||||
// Audio not active, play silence
|
||||
silence: memset(stream, silence_byte, stream_len);
|
||||
silence: memset(stream, silence_byte, stream_len);
|
||||
}
|
||||
|
||||
#if defined(BINCUE)
|
||||
MixAudio_bincue(stream, stream_len, audio_volume);
|
||||
MixAudio_bincue(stream, stream_len, get_audio_volume());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -317,43 +325,84 @@ bool audio_set_channels(int index)
|
|||
|
||||
bool audio_get_main_mute(void)
|
||||
{
|
||||
return audio_mute;
|
||||
return main_mute;
|
||||
}
|
||||
|
||||
uint32 audio_get_main_volume(void)
|
||||
{
|
||||
uint32 chan = (audio_volume * MAC_MAX_VOLUME / SDL_MIX_MAXVOLUME);
|
||||
uint32 chan = main_volume;
|
||||
return (chan << 16) + chan;
|
||||
}
|
||||
|
||||
bool audio_get_speaker_mute(void)
|
||||
{
|
||||
return audio_mute;
|
||||
return speaker_mute;
|
||||
}
|
||||
|
||||
uint32 audio_get_speaker_volume(void)
|
||||
{
|
||||
return audio_get_main_volume();
|
||||
uint32 chan = speaker_volume;
|
||||
return (chan << 16) + chan;
|
||||
}
|
||||
|
||||
void audio_set_main_mute(bool mute)
|
||||
{
|
||||
audio_mute = mute;
|
||||
main_mute = mute;
|
||||
}
|
||||
|
||||
void audio_set_main_volume(uint32 vol)
|
||||
{
|
||||
// We only have one-channel volume right now.
|
||||
uint32 avg = ((vol >> 16) + (vol & 0xffff)) / 2;
|
||||
if (avg > MAC_MAX_VOLUME)
|
||||
avg = MAC_MAX_VOLUME;
|
||||
audio_volume = avg * SDL_MIX_MAXVOLUME / MAC_MAX_VOLUME;
|
||||
main_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
|
||||
if (main_volume > MAC_MAX_VOLUME)
|
||||
main_volume = MAC_MAX_VOLUME;
|
||||
}
|
||||
|
||||
void audio_set_speaker_mute(bool mute)
|
||||
{
|
||||
speaker_mute = mute;
|
||||
}
|
||||
|
||||
void audio_set_speaker_volume(uint32 vol)
|
||||
{
|
||||
// We only have one-channel volume right now.
|
||||
speaker_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
|
||||
if (speaker_volume > MAC_MAX_VOLUME)
|
||||
speaker_volume = MAC_MAX_VOLUME;
|
||||
}
|
||||
|
||||
static int get_audio_volume() {
|
||||
return main_volume * speaker_volume * SDL_MIX_MAXVOLUME / (MAC_MAX_VOLUME * MAC_MAX_VOLUME);
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static int play_startup(void *arg) {
|
||||
SDL_AudioSpec wav_spec;
|
||||
Uint8 *wav_buffer;
|
||||
Uint32 wav_length;
|
||||
if (SDL_LoadWAV("startup.wav", &wav_spec, &wav_buffer, &wav_length)) {
|
||||
SDL_AudioSpec obtained;
|
||||
SDL_AudioDeviceID deviceId = SDL_OpenAudioDevice(NULL, 0, &wav_spec, &obtained, 0);
|
||||
if (deviceId) {
|
||||
SDL_QueueAudio(deviceId, wav_buffer, wav_length);
|
||||
SDL_PauseAudioDevice(deviceId, 0);
|
||||
while (SDL_GetQueuedAudioSize(deviceId)) SDL_Delay(10);
|
||||
SDL_Delay(500);
|
||||
SDL_CloseAudioDevice(deviceId);
|
||||
}
|
||||
else printf("play_startup: Audio driver failed to initialize\n");
|
||||
SDL_FreeWAV(wav_buffer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PlayStartupSound() {
|
||||
SDL_CreateThread(play_startup, "", NULL);
|
||||
}
|
||||
#else
|
||||
void PlayStartupSound() {
|
||||
// Not implemented
|
||||
}
|
||||
#endif
|
||||
#endif // SDL_VERSION_ATLEAST
|
||||
|
||||
|
|
|
@ -0,0 +1,388 @@
|
|||
/*
|
||||
* audio_sdl3.cpp - Audio support, SDL implementation
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "cpu_emulation.h"
|
||||
#include "main.h"
|
||||
#include "prefs.h"
|
||||
#include "user_strings.h"
|
||||
#include "audio.h"
|
||||
#include "audio_defs.h"
|
||||
|
||||
#include <SDL_mutex.h>
|
||||
#include <SDL_audio.h>
|
||||
#include <SDL_version.h>
|
||||
#include <SDL_timer.h>
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
#include <SDL_init.h>
|
||||
#include <queue>
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#if defined(BINCUE)
|
||||
#include "bincue.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define MAC_MAX_VOLUME 0x0100
|
||||
|
||||
// The currently selected audio parameters (indices in audio_sample_rates[] etc. vectors)
|
||||
static int audio_sample_rate_index = 0;
|
||||
static int audio_sample_size_index = 0;
|
||||
static int audio_channel_count_index = 0;
|
||||
|
||||
// Global variables
|
||||
static SDL_Semaphore *audio_irq_done_sem = NULL; // Signal from interrupt to streaming thread: data block read
|
||||
static uint8 silence_byte; // Byte value to use to fill sound buffers with silence
|
||||
static int main_volume = MAC_MAX_VOLUME;
|
||||
static int speaker_volume = MAC_MAX_VOLUME;
|
||||
static bool main_mute = false;
|
||||
static bool speaker_mute = false;
|
||||
|
||||
volatile static bool playing_startup, exit_startup;
|
||||
SDL_AudioSpec audio_spec;
|
||||
|
||||
// Prototypes
|
||||
static void SDLCALL stream_func(void *arg, SDL_AudioStream *stream, int additional_amount, int total_amount);
|
||||
static int get_audio_volume();
|
||||
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
// Set AudioStatus to reflect current audio stream format
|
||||
static void set_audio_status_format(void)
|
||||
{
|
||||
AudioStatus.sample_rate = audio_sample_rates[audio_sample_rate_index];
|
||||
AudioStatus.sample_size = audio_sample_sizes[audio_sample_size_index];
|
||||
AudioStatus.channels = audio_channel_counts[audio_channel_count_index];
|
||||
}
|
||||
|
||||
// Init SDL audio system
|
||||
static bool open_sdl_audio(void)
|
||||
{
|
||||
// SDL supports a variety of twisted little audio formats, all different
|
||||
if (audio_sample_sizes.empty()) {
|
||||
audio_sample_rates.push_back(11025 << 16);
|
||||
audio_sample_rates.push_back(22050 << 16);
|
||||
audio_sample_rates.push_back(44100 << 16);
|
||||
audio_sample_sizes.push_back(8);
|
||||
audio_sample_sizes.push_back(16);
|
||||
audio_channel_counts.push_back(1);
|
||||
audio_channel_counts.push_back(2);
|
||||
|
||||
// Default to highest supported values
|
||||
audio_sample_rate_index = (int)audio_sample_rates.size() - 1;
|
||||
audio_sample_size_index = (int)audio_sample_sizes.size() - 1;
|
||||
audio_channel_count_index = (int)audio_channel_counts.size() - 1;
|
||||
}
|
||||
|
||||
//memset(&audio_spec, 0, sizeof(audio_spec));
|
||||
audio_spec.format = (audio_sample_sizes[audio_sample_size_index] == 8) ? SDL_AUDIO_U8 : SDL_AUDIO_S16BE;
|
||||
audio_spec.channels = audio_channel_counts[audio_channel_count_index];
|
||||
audio_spec.freq = audio_sample_rates[audio_sample_rate_index] >> 16;
|
||||
|
||||
// Open the audio device, forcing the desired format
|
||||
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &audio_spec, stream_func, NULL);
|
||||
if (stream == NULL) {
|
||||
fprintf(stderr, "WARNING: Cannot open audio: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
silence_byte = SDL_GetSilenceValueForFormat(audio_spec.format);
|
||||
#if defined(BINCUE)
|
||||
OpenAudio_bincue(audio_spec.freq, audio_spec.format, audio_spec.channels, silence_byte, get_audio_volume());
|
||||
#endif
|
||||
|
||||
printf("Using SDL/%s audio output\n", SDL_GetCurrentAudioDriver());
|
||||
audio_frames_per_block = 4096 >> PrefsFindInt32("sound_buffer");
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool open_audio(void)
|
||||
{
|
||||
// Try to open SDL audio
|
||||
if (!open_sdl_audio()) {
|
||||
WarningAlert(GetString(STR_NO_AUDIO_WARN));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Device opened, set AudioStatus
|
||||
set_audio_status_format();
|
||||
|
||||
// Everything went fine
|
||||
audio_open = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioInit(void)
|
||||
{
|
||||
// Init audio status and feature flags
|
||||
AudioStatus.sample_rate = 44100 << 16;
|
||||
AudioStatus.sample_size = 16;
|
||||
AudioStatus.channels = 2;
|
||||
AudioStatus.mixer = 0;
|
||||
AudioStatus.num_sources = 0;
|
||||
audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut;
|
||||
|
||||
// Sound disabled in prefs? Then do nothing
|
||||
if (PrefsFindBool("nosound"))
|
||||
return;
|
||||
|
||||
// Init semaphore
|
||||
audio_irq_done_sem = SDL_CreateSemaphore(0);
|
||||
|
||||
// Open and initialize audio device
|
||||
open_audio();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Deinitialization
|
||||
*/
|
||||
|
||||
static void close_audio(void)
|
||||
{
|
||||
exit_startup = true;
|
||||
while (playing_startup)
|
||||
SDL_Delay(10);
|
||||
exit_startup = false;
|
||||
// Close audio device
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
audio_open = false;
|
||||
}
|
||||
|
||||
void AudioExit(void)
|
||||
{
|
||||
// Close audio device
|
||||
close_audio();
|
||||
|
||||
// Delete semaphore
|
||||
if (audio_irq_done_sem)
|
||||
SDL_DestroySemaphore(audio_irq_done_sem);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* First source added, start audio stream
|
||||
*/
|
||||
|
||||
void audio_enter_stream()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Last source removed, stop audio stream
|
||||
*/
|
||||
|
||||
void audio_exit_stream()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Streaming function
|
||||
*/
|
||||
|
||||
static void SDLCALL stream_func(void *, SDL_AudioStream *stream, int stream_len, int /*total_amount*/)
|
||||
{
|
||||
static std::queue<uint8> q;
|
||||
if (AudioStatus.num_sources) {
|
||||
while (q.size() < stream_len) {
|
||||
// Trigger audio interrupt to get new buffer
|
||||
D(bug("stream: triggering irq\n"));
|
||||
SetInterruptFlag(INTFLAG_AUDIO);
|
||||
TriggerInterrupt();
|
||||
D(bug("stream: waiting for ack\n"));
|
||||
SDL_WaitSemaphore(audio_irq_done_sem);
|
||||
D(bug("stream: ack received\n"));
|
||||
|
||||
// Get size of audio data
|
||||
uint32 apple_stream_info = ReadMacInt32(audio_data + adatStreamInfo);
|
||||
if (apple_stream_info && !main_mute && !speaker_mute) {
|
||||
int work_size = ReadMacInt32(apple_stream_info + scd_sampleCount) * (AudioStatus.sample_size >> 3) * AudioStatus.channels;
|
||||
uint8 buf[work_size];
|
||||
Mac2Host_memcpy(buf, ReadMacInt32(apple_stream_info + scd_buffer), work_size);
|
||||
for (int i = 0; i < work_size; i++) q.push(buf[i]);
|
||||
}
|
||||
else {
|
||||
while (!q.empty()) q.pop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint8 src[stream_len], dst[stream_len];
|
||||
for (int i = 0; i < stream_len; i++)
|
||||
if (q.empty()) src[i] = silence_byte;
|
||||
else {
|
||||
src[i] = q.front();
|
||||
q.pop();
|
||||
}
|
||||
memset(dst, silence_byte, stream_len);
|
||||
//SDL_AudioSpec audio_spec;
|
||||
//int r = SDL_GetAudioStreamFormat(stream, NULL, &audio_spec);// little endianが帰ってくる
|
||||
SDL_MixAudioFormat(dst, src, audio_spec.format, stream_len, get_audio_volume());
|
||||
#if defined(BINCUE)
|
||||
MixAudio_bincue(dst, stream_len, get_audio_volume());
|
||||
#endif
|
||||
SDL_PutAudioStreamData(stream, dst, stream_len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MacOS audio interrupt, read next data block
|
||||
*/
|
||||
|
||||
void AudioInterrupt(void)
|
||||
{
|
||||
D(bug("AudioInterrupt\n"));
|
||||
|
||||
// Get data from apple mixer
|
||||
if (AudioStatus.mixer) {
|
||||
M68kRegisters r;
|
||||
r.a[0] = audio_data + adatStreamInfo;
|
||||
r.a[1] = AudioStatus.mixer;
|
||||
Execute68k(audio_data + adatGetSourceData, &r);
|
||||
D(bug(" GetSourceData() returns %08lx\n", r.d[0]));
|
||||
} else
|
||||
WriteMacInt32(audio_data + adatStreamInfo, 0);
|
||||
|
||||
// Signal stream function
|
||||
SDL_PostSemaphore(audio_irq_done_sem);
|
||||
D(bug("AudioInterrupt done\n"));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set sampling parameters
|
||||
* "index" is an index into the audio_sample_rates[] etc. vectors
|
||||
* It is guaranteed that AudioStatus.num_sources == 0
|
||||
*/
|
||||
|
||||
bool audio_set_sample_rate(int index)
|
||||
{
|
||||
close_audio();
|
||||
audio_sample_rate_index = index;
|
||||
return open_audio();
|
||||
}
|
||||
|
||||
bool audio_set_sample_size(int index)
|
||||
{
|
||||
close_audio();
|
||||
audio_sample_size_index = index;
|
||||
return open_audio();
|
||||
}
|
||||
|
||||
bool audio_set_channels(int index)
|
||||
{
|
||||
close_audio();
|
||||
audio_channel_count_index = index;
|
||||
return open_audio();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get/set volume controls (volume values received/returned have the left channel
|
||||
* volume in the upper 16 bits and the right channel volume in the lower 16 bits;
|
||||
* both volumes are 8.8 fixed point values with 0x0100 meaning "maximum volume"))
|
||||
*/
|
||||
|
||||
bool audio_get_main_mute(void)
|
||||
{
|
||||
return main_mute;
|
||||
}
|
||||
|
||||
uint32 audio_get_main_volume(void)
|
||||
{
|
||||
uint32 chan = main_volume;
|
||||
return (chan << 16) + chan;
|
||||
}
|
||||
|
||||
bool audio_get_speaker_mute(void)
|
||||
{
|
||||
return speaker_mute;
|
||||
}
|
||||
|
||||
uint32 audio_get_speaker_volume(void)
|
||||
{
|
||||
uint32 chan = speaker_volume;
|
||||
return (chan << 16) + chan;
|
||||
}
|
||||
|
||||
void audio_set_main_mute(bool mute)
|
||||
{
|
||||
main_mute = mute;
|
||||
}
|
||||
|
||||
void audio_set_main_volume(uint32 vol)
|
||||
{
|
||||
// We only have one-channel volume right now.
|
||||
main_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
|
||||
if (main_volume > MAC_MAX_VOLUME)
|
||||
main_volume = MAC_MAX_VOLUME;
|
||||
}
|
||||
|
||||
void audio_set_speaker_mute(bool mute)
|
||||
{
|
||||
speaker_mute = mute;
|
||||
}
|
||||
|
||||
void audio_set_speaker_volume(uint32 vol)
|
||||
{
|
||||
// We only have one-channel volume right now.
|
||||
speaker_volume = ((vol >> 16) + (vol & 0xffff)) / 2;
|
||||
if (speaker_volume > MAC_MAX_VOLUME)
|
||||
speaker_volume = MAC_MAX_VOLUME;
|
||||
}
|
||||
|
||||
static int get_audio_volume() {
|
||||
return main_volume * speaker_volume * SDL_MIX_MAXVOLUME / (MAC_MAX_VOLUME * MAC_MAX_VOLUME);
|
||||
}
|
||||
|
||||
static int play_startup(void *arg) {
|
||||
SDL_AudioSpec wav_spec;
|
||||
Uint8 *wav_buffer;
|
||||
Uint32 wav_length;
|
||||
if (!playing_startup && !SDL_LoadWAV("startup.wav", &wav_spec, &wav_buffer, &wav_length)) {
|
||||
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &wav_spec, NULL, NULL);
|
||||
if (stream) {
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||
SDL_PutAudioStreamData(stream, wav_buffer, wav_length);
|
||||
playing_startup = true;
|
||||
while (!exit_startup && SDL_GetAudioStreamAvailable(stream)) SDL_Delay(10);
|
||||
if (!exit_startup) SDL_Delay(500);
|
||||
SDL_DestroyAudioStream(stream);
|
||||
}
|
||||
else printf("play_startup: Audio driver failed to initialize\n");
|
||||
SDL_free(wav_buffer);
|
||||
playing_startup = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PlayStartupSound() {
|
||||
SDL_CreateThread(play_startup, "play_startup", NULL);
|
||||
}
|
||||
|
||||
#endif // SDL_VERSION_ATLEAST
|
|
@ -67,7 +67,9 @@ void LoadPrefs(const char * vmdir) // TODO: load prefs from 'vmdir'
|
|||
fclose(f);
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef __linux__
|
||||
PrefsAddString("cdrom", "/dev/cdrom");
|
||||
#endif
|
||||
// No prefs file, save defaults
|
||||
SavePrefs();
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <SDL_thread.h>
|
||||
#include <errno.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <malloc.h> /* alloca() */
|
||||
|
@ -118,7 +119,9 @@ static bool use_vosf = false; // Flag: VOSF enabled
|
|||
static const bool use_vosf = false; // VOSF not possible
|
||||
#endif
|
||||
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||
static bool caps_on = false; // Flag: Caps Lock on
|
||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||
|
@ -155,6 +158,11 @@ static SDL_mutex *frame_buffer_lock = NULL;
|
|||
#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock)
|
||||
#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock)
|
||||
|
||||
// Previously set gamma tables
|
||||
static uint16 last_gamma_red[256];
|
||||
static uint16 last_gamma_green[256];
|
||||
static uint16 last_gamma_blue[256];
|
||||
|
||||
// Video refresh function
|
||||
static void VideoRefreshInit(void);
|
||||
static void (*video_refresh)(void);
|
||||
|
@ -360,6 +368,7 @@ public:
|
|||
|
||||
virtual void switch_to_current_mode(void);
|
||||
virtual void set_palette(uint8 *pal, int num);
|
||||
virtual void set_gamma(uint8 *gamma, int num);
|
||||
|
||||
bool video_open(void);
|
||||
void video_close(void);
|
||||
|
@ -515,12 +524,26 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth)
|
|||
}
|
||||
|
||||
// Set window name and class
|
||||
static void set_window_name(int name)
|
||||
static void set_window_name(bool mouse_grabbed)
|
||||
{
|
||||
const char *title = PrefsFindString("title");
|
||||
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
|
||||
int grabbed = 0;
|
||||
if (mouse_grabbed)
|
||||
{
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
hotkey = hotkey ? hotkey : 1;
|
||||
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
|
||||
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
|
||||
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
|
||||
}
|
||||
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
|
||||
if (vi && vi->wm_available) {
|
||||
const char *str = GetString(name);
|
||||
SDL_WM_SetCaption(str, str);
|
||||
if (vi && vi->wm_available)
|
||||
{
|
||||
//The icon name should stay the same
|
||||
SDL_WM_SetCaption(s.c_str(), GetString(STR_WINDOW_TITLE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -731,7 +754,7 @@ void driver_base::adapt_to_video_mode() {
|
|||
SDL_ShowCursor(hardware_cursor);
|
||||
|
||||
// Set window name/class
|
||||
set_window_name(STR_WINDOW_TITLE);
|
||||
set_window_name(false);
|
||||
|
||||
// Everything went well
|
||||
init_ok = true;
|
||||
|
@ -1299,8 +1322,8 @@ void VideoVBL(void)
|
|||
// Setting the window name must happen on the main thread, else it doesn't work on
|
||||
// some platforms - e.g. macOS Sierra.
|
||||
if (mouse_grabbed_window_name_status != mouse_grabbed) {
|
||||
set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE);
|
||||
mouse_grabbed_window_name_status = mouse_grabbed;
|
||||
set_window_name(mouse_grabbed);
|
||||
mouse_grabbed_window_name_status = mouse_grabbed;
|
||||
}
|
||||
|
||||
// Temporarily give up frame buffer lock (this is the point where
|
||||
|
@ -1328,7 +1351,7 @@ void VideoInterrupt(void)
|
|||
// Setting the window name must happen on the main thread, else it doesn't work on
|
||||
// some platforms - e.g. macOS Sierra.
|
||||
if (mouse_grabbed_window_name_status != mouse_grabbed) {
|
||||
set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE);
|
||||
set_window_name(mouse_grabbed);
|
||||
mouse_grabbed_window_name_status = mouse_grabbed;
|
||||
}
|
||||
|
||||
|
@ -1363,9 +1386,51 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||
{
|
||||
const VIDEO_MODE &mode = get_current_mode();
|
||||
|
||||
// FIXME: how can we handle the gamma ramp?
|
||||
if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT)
|
||||
if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT) {
|
||||
// handle the gamma ramp
|
||||
|
||||
if (pal[0] == 127 && pal[num_in*3-1] == 127) // solid grey
|
||||
return; // ignore
|
||||
|
||||
uint16 red[256];
|
||||
uint16 green[256];
|
||||
uint16 blue[256];
|
||||
|
||||
int repeats = 256 / num_in;
|
||||
|
||||
for (int i = 0; i < num_in; i++) {
|
||||
for (int j = 0; j < repeats; j++) {
|
||||
red[i*repeats + j] = pal[i*3 + 0] << 8;
|
||||
green[i*repeats + j] = pal[i*3 + 1] << 8;
|
||||
blue[i*repeats + j] = pal[i*3 + 2] << 8;
|
||||
}
|
||||
}
|
||||
|
||||
// fill remaining entries (if any) with last value
|
||||
for (int i = num_in * repeats; i < 256; i++) {
|
||||
red[i] = pal[(num_in - 1) * 3] << 8;
|
||||
green[i] = pal[(num_in - 1) * 3 + 1] << 8;
|
||||
blue[i] = pal[(num_in - 1) * 3 + 2] << 8;
|
||||
}
|
||||
|
||||
bool changed = (memcmp(red, last_gamma_red, 512) != 0 ||
|
||||
memcmp(green, last_gamma_green, 512) != 0 ||
|
||||
memcmp(blue, last_gamma_blue, 512) != 0);
|
||||
|
||||
if (changed) {
|
||||
int result = SDL_SetGammaRamp(red, green, blue);
|
||||
|
||||
if (result < 0) {
|
||||
fprintf(stderr, "SDL_SetGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
||||
}
|
||||
|
||||
memcpy(last_gamma_red, red, 512);
|
||||
memcpy(last_gamma_green, green, 512);
|
||||
memcpy(last_gamma_blue, blue, 512);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOCK_PALETTE;
|
||||
|
||||
|
@ -1405,6 +1470,10 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||
UNLOCK_PALETTE;
|
||||
}
|
||||
|
||||
void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in)
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
|
@ -1564,11 +1633,29 @@ static bool is_modifier_key(SDL_KeyboardEvent const & e)
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool is_ctrl_down(SDL_keysym const & ks)
|
||||
static bool is_hotkey_down(SDL_keysym const & ks)
|
||||
{
|
||||
return ctrl_down || (ks.mod & KMOD_CTRL);
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
if (!hotkey) hotkey = 1;
|
||||
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
||||
(opt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
|
||||
(cmd_down || (ks.mod & KMOD_META) || !(hotkey & 4));
|
||||
}
|
||||
|
||||
static int modify_opt_cmd(int code) {
|
||||
static bool f, c;
|
||||
if (!f) {
|
||||
f = true;
|
||||
c = PrefsFindBool("swap_opt_cmd");
|
||||
}
|
||||
if (c) {
|
||||
switch (code) {
|
||||
case 0x37: return 0x3a;
|
||||
case 0x3a: return 0x37;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate key event to Mac keycode, returns -1 if no keycode was found
|
||||
|
@ -1628,8 +1715,8 @@ static int kc_decode(SDL_keysym const & ks, bool key_down)
|
|||
case SDLK_PERIOD: case SDLK_GREATER: return 0x2f;
|
||||
case SDLK_SLASH: case SDLK_QUESTION: return 0x2c;
|
||||
|
||||
case SDLK_TAB: if (is_ctrl_down(ks)) {if (!key_down) drv->suspend(); return -2;} else return 0x30;
|
||||
case SDLK_RETURN: if (is_ctrl_down(ks)) {if (!key_down) toggle_fullscreen = true; return -2;} else return 0x24;
|
||||
case SDLK_TAB: if (is_hotkey_down(ks)) {if (!key_down) drv->suspend(); return -2;} else return 0x30;
|
||||
case SDLK_RETURN: if (is_hotkey_down(ks)) {if (!key_down) toggle_fullscreen = true; return -2;} else return 0x24;
|
||||
case SDLK_SPACE: return 0x31;
|
||||
case SDLK_BACKSPACE: return 0x33;
|
||||
|
||||
|
@ -1644,19 +1731,9 @@ static int kc_decode(SDL_keysym const & ks, bool key_down)
|
|||
case SDLK_RCTRL: return 0x36;
|
||||
case SDLK_LSHIFT: return 0x38;
|
||||
case SDLK_RSHIFT: return 0x38;
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
case SDLK_LALT: return 0x3a;
|
||||
case SDLK_RALT: return 0x3a;
|
||||
case SDLK_LMETA: return 0x37;
|
||||
case SDLK_RMETA: return 0x37;
|
||||
#else
|
||||
case SDLK_LALT: return 0x37;
|
||||
case SDLK_RALT: return 0x37;
|
||||
case SDLK_LMETA: return 0x3a;
|
||||
case SDLK_RMETA: return 0x3a;
|
||||
#endif
|
||||
case SDLK_LSUPER: return 0x3a; // "Windows" key
|
||||
case SDLK_RSUPER: return 0x3a;
|
||||
case SDLK_LALT: case SDLK_RALT: return 0x3a;
|
||||
case SDLK_LMETA: case SDLK_RMETA: return 0x37;
|
||||
case SDLK_LSUPER: case SDLK_RSUPER: return 0x37; // "Windows" key
|
||||
case SDLK_MENU: return 0x32;
|
||||
case SDLK_CAPSLOCK: return 0x39;
|
||||
case SDLK_NUMLOCK: return 0x47;
|
||||
|
@ -1666,13 +1743,13 @@ static int kc_decode(SDL_keysym const & ks, bool key_down)
|
|||
case SDLK_LEFT: return 0x3b;
|
||||
case SDLK_RIGHT: return 0x3c;
|
||||
|
||||
case SDLK_ESCAPE: if (is_ctrl_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
|
||||
case SDLK_ESCAPE: if (is_hotkey_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
|
||||
|
||||
case SDLK_F1: if (is_ctrl_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
|
||||
case SDLK_F1: if (is_hotkey_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
|
||||
case SDLK_F2: return 0x78;
|
||||
case SDLK_F3: return 0x63;
|
||||
case SDLK_F4: return 0x76;
|
||||
case SDLK_F5: if (is_ctrl_down(ks)) {if (!key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
|
||||
case SDLK_F5: if (is_hotkey_down(ks)) {if (!key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
|
||||
case SDLK_F6: return 0x61;
|
||||
case SDLK_F7: return 0x62;
|
||||
case SDLK_F8: return 0x64;
|
||||
|
@ -1795,6 +1872,15 @@ static void handle_events(void)
|
|||
code = event2keycode(event.key, true);
|
||||
if (code >= 0) {
|
||||
if (!emul_suspended) {
|
||||
if (code == 0x36) {
|
||||
ctrl_down = true;
|
||||
} else if (code == 0x3a) {
|
||||
opt_down = true;
|
||||
code = modify_opt_cmd(code);
|
||||
} else if (code == 0x37) {
|
||||
cmd_down = true;
|
||||
code = modify_opt_cmd(code);
|
||||
}
|
||||
if (code == 0x39) { // Caps Lock pressed
|
||||
if (caps_on) {
|
||||
ADBKeyUp(code);
|
||||
|
@ -1805,8 +1891,6 @@ static void handle_events(void)
|
|||
}
|
||||
} else
|
||||
ADBKeyDown(code);
|
||||
if (code == 0x36)
|
||||
ctrl_down = true;
|
||||
} else {
|
||||
if (code == 0x31)
|
||||
drv->resume(); // Space wakes us up
|
||||
|
@ -1822,6 +1906,15 @@ static void handle_events(void)
|
|||
} else
|
||||
code = event2keycode(event.key, false);
|
||||
if (code >= 0) {
|
||||
if (code == 0x36) {
|
||||
ctrl_down = false;
|
||||
} else if (code == 0x3a) {
|
||||
opt_down = false;
|
||||
code = modify_opt_cmd(code);
|
||||
} else if (code == 0x37) {
|
||||
cmd_down = false;
|
||||
code = modify_opt_cmd(code);
|
||||
}
|
||||
if (code == 0x39) { // Caps Lock released
|
||||
if (caps_on) {
|
||||
ADBKeyUp(code);
|
||||
|
@ -1832,8 +1925,6 @@ static void handle_events(void)
|
|||
}
|
||||
} else
|
||||
ADBKeyUp(code);
|
||||
if (code == 0x36)
|
||||
ctrl_down = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2290,4 +2381,11 @@ void video_set_dirty_area(int x, int y, int w, int h)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
void video_set_gamma(int n_colors)
|
||||
{
|
||||
// Not supported in SDL 1.2
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ends: SDL version check
|
||||
|
|
|
@ -42,13 +42,18 @@
|
|||
#include "sysdeps.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0) && !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
|
||||
#include <SDL_mutex.h>
|
||||
#include <SDL_thread.h>
|
||||
#include <errno.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __MACOSX__
|
||||
#include "utils_macosx.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <malloc.h> /* alloca() */
|
||||
|
@ -64,6 +69,7 @@
|
|||
#include "video_defs.h"
|
||||
#include "video_blit.h"
|
||||
#include "vm_alloc.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
@ -104,6 +110,7 @@ const char KEYCODE_FILE_NAME2[] = DATADIR "/BasiliskII_keycodes";
|
|||
static uint32 frame_skip; // Prefs items
|
||||
static int16 mouse_wheel_mode;
|
||||
static int16 mouse_wheel_lines;
|
||||
static bool mouse_wheel_reverse;
|
||||
|
||||
static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into)
|
||||
static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes)
|
||||
|
@ -123,9 +130,9 @@ static bool use_vosf = false; // Flag: VOSF enabled
|
|||
static const bool use_vosf = false; // VOSF not possible
|
||||
#endif
|
||||
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
||||
static bool opt_down = false; // Flag: Opt key pressed
|
||||
static bool cmd_down = false; // Flag: Cmd key pressed
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||
static bool emul_suspended = false; // Flag: Emulator suspended
|
||||
|
@ -145,7 +152,9 @@ static SDL_Texture * sdl_texture = NULL; // Handle to a GPU texture, with whic
|
|||
static SDL_Rect sdl_update_video_rect = {0,0,0,0}; // Union of all rects to update, when updating sdl_texture
|
||||
static SDL_mutex * sdl_update_video_mutex = NULL; // Mutex to protect sdl_update_video_rect
|
||||
static int screen_depth; // Depth of current screen
|
||||
#ifdef SHEEPSHAVER
|
||||
static SDL_Cursor *sdl_cursor = NULL; // Copy of Mac cursor
|
||||
#endif
|
||||
static SDL_Palette *sdl_palette = NULL; // Color palette to be used as CLUT and gamma table
|
||||
static bool sdl_palette_changed = false; // Flag: Palette changed, redraw thread must set new colors
|
||||
static bool toggle_fullscreen = false;
|
||||
|
@ -168,6 +177,17 @@ static SDL_mutex *frame_buffer_lock = NULL;
|
|||
#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock)
|
||||
#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock)
|
||||
|
||||
// Initially set gamma tables
|
||||
static uint16 init_gamma_red[256];
|
||||
static uint16 init_gamma_green[256];
|
||||
static uint16 init_gamma_blue[256];
|
||||
static bool init_gamma_valid;
|
||||
|
||||
// Previously set gamma tables
|
||||
static uint16 last_gamma_red[256];
|
||||
static uint16 last_gamma_green[256];
|
||||
static uint16 last_gamma_blue[256];
|
||||
|
||||
// Video refresh function
|
||||
static void VideoRefreshInit(void);
|
||||
static void (*video_refresh)(void);
|
||||
|
@ -215,6 +235,9 @@ extern void SysMountFirstFloppy(void);
|
|||
|
||||
static void *vm_acquire_framebuffer(uint32 size)
|
||||
{
|
||||
#if defined(HAVE_MACH_VM) || defined(HAVE_MMAP_VM) && defined(__aarch64__)
|
||||
return vm_acquire_reserved(size);
|
||||
#else
|
||||
// always try to reallocate framebuffer at the same address
|
||||
static void *fb = VM_MAP_FAILED;
|
||||
if (fb != VM_MAP_FAILED) {
|
||||
|
@ -228,11 +251,14 @@ static void *vm_acquire_framebuffer(uint32 size)
|
|||
if (fb == VM_MAP_FAILED)
|
||||
fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
|
||||
return fb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void vm_release_framebuffer(void *fb, uint32 size)
|
||||
{
|
||||
#if !(defined(HAVE_MACH_VM) || defined(HAVE_MMAP_VM) && defined(__aarch64__))
|
||||
vm_release(fb, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int get_customized_color_depth(int default_depth)
|
||||
|
@ -330,8 +356,10 @@ public:
|
|||
virtual void switch_to_current_mode(void) = 0;
|
||||
|
||||
// Called by the video driver to set the color palette (in indexed modes)
|
||||
// or the gamma table (in direct modes)
|
||||
virtual void set_palette(uint8 *pal, int num) = 0;
|
||||
|
||||
// Called by the video driver to set the gamma table
|
||||
virtual void set_gamma(uint8 *gamma, int num) = 0;
|
||||
};
|
||||
|
||||
// Vector of pointers to available monitor descriptions, filled by VideoInit()
|
||||
|
@ -376,6 +404,7 @@ public:
|
|||
|
||||
virtual void switch_to_current_mode(void);
|
||||
virtual void set_palette(uint8 *pal, int num);
|
||||
virtual void set_gamma(uint8 *gamma, int num);
|
||||
|
||||
bool video_open(void);
|
||||
void video_close(void);
|
||||
|
@ -386,6 +415,7 @@ public:
|
|||
* Utility functions
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
// Find palette size for given color depth
|
||||
static int palette_size(int mode)
|
||||
{
|
||||
|
@ -399,6 +429,7 @@ static int palette_size(int mode)
|
|||
default: return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Map video_mode depth ID to numerical depth value
|
||||
static int mac_depth_of_video_depth(int video_depth)
|
||||
|
@ -522,34 +553,21 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth, bool nati
|
|||
}
|
||||
|
||||
// Set window name and class
|
||||
static void set_window_name(int name)
|
||||
{
|
||||
if (!sdl_window) {
|
||||
return;
|
||||
}
|
||||
const char *str = GetString(name);
|
||||
SDL_SetWindowTitle(sdl_window, str);
|
||||
}
|
||||
|
||||
static void set_window_name_grabbed() {
|
||||
static void set_window_name() {
|
||||
if (!sdl_window) return;
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
if (!hotkey) hotkey = 1;
|
||||
std::string s = GetString(STR_WINDOW_TITLE_GRABBED0);
|
||||
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
|
||||
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
|
||||
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED3);
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED4);
|
||||
SDL_SetWindowTitle(sdl_window, s.c_str());
|
||||
}
|
||||
|
||||
// Set mouse grab mode
|
||||
static void set_grab_mode(bool grab)
|
||||
{
|
||||
if (!sdl_window) {
|
||||
return;
|
||||
const char *title = PrefsFindString("title");
|
||||
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
|
||||
if (mouse_grabbed)
|
||||
{
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
hotkey = hotkey ? hotkey : 1;
|
||||
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
|
||||
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
|
||||
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
|
||||
}
|
||||
SDL_SetWindowGrab(sdl_window, grab ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetWindowTitle(sdl_window, s.c_str());
|
||||
}
|
||||
|
||||
// Migrate preferences items (XXX to be handled in MigratePrefs())
|
||||
|
@ -612,7 +630,7 @@ public:
|
|||
~driver_base();
|
||||
|
||||
void init(); // One-time init
|
||||
void set_video_mode(int flags);
|
||||
void set_video_mode(int flags, int pitch);
|
||||
void adapt_to_video_mode();
|
||||
|
||||
void update_palette(void);
|
||||
|
@ -694,7 +712,13 @@ static void shutdown_sdl_video()
|
|||
delete_sdl_video_window();
|
||||
}
|
||||
|
||||
static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags)
|
||||
static int get_mag_rate()
|
||||
{
|
||||
int m = PrefsFindInt32("mag_rate");
|
||||
return m < 1 ? 1 : m > 4 ? 4 : m;
|
||||
}
|
||||
|
||||
static SDL_Surface *init_sdl_video(int width, int height, int depth, Uint32 flags, int pitch)
|
||||
{
|
||||
if (guest_surface) {
|
||||
delete_sdl_video_surfaces();
|
||||
|
@ -711,11 +735,7 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
shutdown_sdl_video();
|
||||
return NULL;
|
||||
}
|
||||
#ifdef __MACOSX__
|
||||
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
#else
|
||||
window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||
#endif
|
||||
window_width = desktop_mode.w;
|
||||
window_height = desktop_mode.h;
|
||||
}
|
||||
|
@ -734,23 +754,24 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, PrefsFindBool("scale_nearest") ? "nearest" : "linear");
|
||||
|
||||
/*
|
||||
// Always use a resize-able window. This helps allow SDL to manage
|
||||
// transitions involving fullscreen to or from windowed-mode.
|
||||
window_flags |= SDL_WINDOW_RESIZABLE;
|
||||
*/
|
||||
#if defined(__MACOSX__) && SDL_VERSION_ATLEAST(2,0,14)
|
||||
if (MetalIsAvailable()) window_flags |= SDL_WINDOW_METAL;
|
||||
#endif
|
||||
|
||||
if (!sdl_window) {
|
||||
int m = get_mag_rate();
|
||||
sdl_window = SDL_CreateWindow(
|
||||
"Basilisk II",
|
||||
"",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
window_width,
|
||||
window_height,
|
||||
m * window_width,
|
||||
m * window_height,
|
||||
window_flags);
|
||||
if (!sdl_window) {
|
||||
shutdown_sdl_video();
|
||||
return NULL;
|
||||
}
|
||||
set_window_name();
|
||||
}
|
||||
if (flags & SDL_WINDOW_FULLSCREEN) SDL_SetWindowGrab(sdl_window, SDL_TRUE);
|
||||
|
||||
|
@ -770,11 +791,20 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
else {
|
||||
#ifdef WIN32
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
||||
#elif defined(__MACOSX__) && SDL_VERSION_ATLEAST(2,0,14)
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, window_flags & SDL_WINDOW_METAL ? "metal" : "opengl");
|
||||
#else
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool sdl_vsync = PrefsFindBool("sdl_vsync");
|
||||
if (sdl_vsync) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
|
||||
}
|
||||
|
||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||
|
||||
if (!sdl_renderer) {
|
||||
shutdown_sdl_video();
|
||||
return NULL;
|
||||
|
@ -792,7 +822,11 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
}
|
||||
|
||||
SDL_assert(sdl_texture == NULL);
|
||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
#ifdef ENABLE_VOSF
|
||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
#else
|
||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_BGRA8888, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
#endif
|
||||
if (!sdl_texture) {
|
||||
shutdown_sdl_video();
|
||||
return NULL;
|
||||
|
@ -804,19 +838,32 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
|
||||
SDL_assert(guest_surface == NULL);
|
||||
SDL_assert(host_surface == NULL);
|
||||
switch (bpp) {
|
||||
case 8:
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
|
||||
break;
|
||||
case 16:
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 16, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000);
|
||||
switch (depth) {
|
||||
case VIDEO_DEPTH_1BIT:
|
||||
case VIDEO_DEPTH_2BIT:
|
||||
case VIDEO_DEPTH_4BIT:
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
|
||||
break;
|
||||
case 32:
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
||||
host_surface = guest_surface;
|
||||
case VIDEO_DEPTH_8BIT:
|
||||
#ifdef ENABLE_VOSF
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
|
||||
#else
|
||||
guest_surface = SDL_CreateRGBSurfaceFrom(the_buffer, width, height, 8, pitch, 0, 0, 0, 0);
|
||||
#endif
|
||||
break;
|
||||
case VIDEO_DEPTH_16BIT:
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 16, 0xf800, 0x07e0, 0x001f, 0);
|
||||
break;
|
||||
case VIDEO_DEPTH_32BIT:
|
||||
#ifdef ENABLE_VOSF
|
||||
guest_surface = SDL_CreateRGBSurface(0, width, height, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
||||
#else
|
||||
guest_surface = SDL_CreateRGBSurfaceFrom(the_buffer, width, height, 32, pitch, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff);
|
||||
#endif
|
||||
host_surface = guest_surface;
|
||||
break;
|
||||
default:
|
||||
printf("WARNING: An unsupported bpp of %d was used\n", bpp);
|
||||
printf("WARNING: An unsupported depth of %d was used\n", depth);
|
||||
break;
|
||||
}
|
||||
if (!guest_surface) {
|
||||
|
@ -904,14 +951,22 @@ static int present_sdl_video()
|
|||
UNLOCK_PALETTE; // passed potential deadlock, can unlock palette
|
||||
|
||||
// Update the host OS' texture
|
||||
void * srcPixels = (void *)((uint8_t *)host_surface->pixels +
|
||||
sdl_update_video_rect.y * host_surface->pitch +
|
||||
sdl_update_video_rect.x * host_surface->format->BytesPerPixel);
|
||||
uint8_t *srcPixels = (uint8_t *)host_surface->pixels +
|
||||
sdl_update_video_rect.y * host_surface->pitch +
|
||||
sdl_update_video_rect.x * host_surface->format->BytesPerPixel;
|
||||
|
||||
if (SDL_UpdateTexture(sdl_texture, &sdl_update_video_rect, srcPixels, host_surface->pitch) != 0) {
|
||||
SDL_UnlockMutex(sdl_update_video_mutex);
|
||||
uint8_t *dstPixels;
|
||||
int dstPitch;
|
||||
if (SDL_LockTexture(sdl_texture, &sdl_update_video_rect, (void **)&dstPixels, &dstPitch) < 0) {
|
||||
SDL_UnlockMutex(sdl_update_video_mutex);
|
||||
return -1;
|
||||
}
|
||||
for (int y = 0; y < sdl_update_video_rect.h; y++) {
|
||||
memcpy(dstPixels, srcPixels, sdl_update_video_rect.w << 2);
|
||||
srcPixels += host_surface->pitch;
|
||||
dstPixels += dstPitch;
|
||||
}
|
||||
SDL_UnlockTexture(sdl_texture);
|
||||
|
||||
// We are done working with pixels in host_surface. Reset sdl_update_video_rect, then let
|
||||
// other threads modify it, as-needed.
|
||||
|
@ -952,37 +1007,36 @@ void update_sdl_video(SDL_Surface *s, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
|
|||
}
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
static void MagBits(Uint8 *dst, Uint8 *src, int mag) {
|
||||
for (int y = 0; y < 16; y++)
|
||||
for (int x = 0; x < 16; x++) {
|
||||
int sa = 16 * y + x;
|
||||
if (!(src[sa >> 3] & 0x80 >> (sa & 7))) continue;
|
||||
for (int dy = 0; dy < mag; dy++)
|
||||
for (int dx = 0; dx < mag; dx++) {
|
||||
int da = 16 * mag * (mag * y + dy) + mag * x + dx;
|
||||
dst[da >> 3] |= 0x80 >> (da & 7);
|
||||
}
|
||||
static void MagBits(Uint8 *dst, Uint8 *src, int size) {
|
||||
float s = 16.f / size;
|
||||
for (int y = 0; y < size; y++)
|
||||
for (int x = 0; x < size; x++) {
|
||||
int sa = 16 * int(y * s) + int(x * s);
|
||||
if (src[sa >> 3] & 0x80 >> (sa & 7)) {
|
||||
int da = (size + 7 & ~7) * y + x;
|
||||
dst[da >> 3] |= 0x80 >> (da & 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
static SDL_Cursor *MagCursor(bool hot) {
|
||||
int w, h;
|
||||
SDL_GetWindowSize(sdl_window, &w, &h);
|
||||
int mag = std::min(w / drv->VIDEO_MODE_X, h / drv->VIDEO_MODE_Y);
|
||||
Uint8 *data = (Uint8 *)SDL_calloc(1, 32 * mag * mag);
|
||||
Uint8 *mask = (Uint8 *)SDL_calloc(1, 32 * mag * mag);
|
||||
MagBits(data, &MacCursor[4], mag);
|
||||
MagBits(mask, &MacCursor[36], mag);
|
||||
SDL_Cursor *cursor = SDL_CreateCursor(data, mask, 16 * mag, 16 * mag, hot ? MacCursor[2] * mag : 0, hot ? MacCursor[3] * mag : 0);
|
||||
float mag = std::min((float)w / drv->VIDEO_MODE_X, (float)h / drv->VIDEO_MODE_Y);
|
||||
int size = ceilf(16 * mag), n = ((size + 7) >> 3) * size;
|
||||
Uint8 *data = (Uint8 *)SDL_calloc(n, 2);
|
||||
Uint8 *mask = (Uint8 *)SDL_calloc(n, 2);
|
||||
MagBits(data, &MacCursor[4], size);
|
||||
MagBits(mask, &MacCursor[36], size);
|
||||
SDL_Cursor *cursor = SDL_CreateCursor(data, mask, size, size, hot ? MacCursor[2] * mag : 0, hot ? MacCursor[3] * mag : 0);
|
||||
SDL_free(data);
|
||||
SDL_free(mask);
|
||||
return cursor;
|
||||
}
|
||||
#endif
|
||||
|
||||
void driver_base::set_video_mode(int flags)
|
||||
void driver_base::set_video_mode(int flags, int pitch)
|
||||
{
|
||||
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
|
||||
if ((s = init_sdl_video(VIDEO_MODE_X, VIDEO_MODE_Y, depth, flags)) == NULL)
|
||||
if ((s = init_sdl_video(VIDEO_MODE_X, VIDEO_MODE_Y, VIDEO_MODE_DEPTH, flags, pitch)) == NULL)
|
||||
return;
|
||||
#ifdef ENABLE_VOSF
|
||||
the_host_buffer = (uint8 *)s->pixels;
|
||||
|
@ -991,13 +1045,18 @@ void driver_base::set_video_mode(int flags)
|
|||
|
||||
void driver_base::init()
|
||||
{
|
||||
set_video_mode(display_type == DISPLAY_SCREEN ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
int pitch = VIDEO_MODE_X;
|
||||
switch (VIDEO_MODE_DEPTH) {
|
||||
case VIDEO_DEPTH_16BIT: pitch <<= 1; break;
|
||||
case VIDEO_DEPTH_32BIT: pitch <<= 2; break;
|
||||
}
|
||||
|
||||
int aligned_height = (VIDEO_MODE_Y + 15) & ~15;
|
||||
|
||||
#ifdef ENABLE_VOSF
|
||||
use_vosf = true;
|
||||
// Allocate memory for frame buffer (SIZE is extended to page-boundary)
|
||||
the_buffer_size = page_extend((aligned_height + 2) * s->pitch);
|
||||
the_buffer_size = page_extend((aligned_height + 2) * pitch);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
the_buffer_copy = (uint8 *)malloc(the_buffer_size);
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
|
||||
|
@ -1020,16 +1079,26 @@ void driver_base::init()
|
|||
#endif
|
||||
if (!use_vosf) {
|
||||
// Allocate memory for frame buffer
|
||||
the_buffer_size = (aligned_height + 2) * s->pitch;
|
||||
the_buffer_size = (aligned_height + 2) * pitch;
|
||||
the_buffer_copy = (uint8 *)calloc(1, the_buffer_size);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
memset(the_buffer, 0, the_buffer_size);
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy));
|
||||
}
|
||||
|
||||
set_video_mode(display_type == DISPLAY_SCREEN ? SDL_WINDOW_FULLSCREEN : 0, pitch);
|
||||
|
||||
// Set frame buffer base
|
||||
set_mac_frame_buffer(monitor, VIDEO_MODE_DEPTH, true);
|
||||
|
||||
adapt_to_video_mode();
|
||||
|
||||
// set default B/W palette
|
||||
sdl_palette = SDL_AllocPalette(256);
|
||||
sdl_palette->colors[1] = (SDL_Color){ .r = 0, .g = 0, .b = 0, .a = 255 };
|
||||
SDL_SetSurfacePalette(s, sdl_palette);
|
||||
|
||||
if (PrefsFindBool("init_grab") && !PrefsFindBool("hardcursor")) grab_mouse();
|
||||
}
|
||||
|
||||
void driver_base::adapt_to_video_mode() {
|
||||
|
@ -1074,7 +1143,7 @@ void driver_base::adapt_to_video_mode() {
|
|||
SDL_ShowCursor(hardware_cursor);
|
||||
|
||||
// Set window name/class
|
||||
mouse_grabbed ? set_window_name_grabbed() : set_window_name((int)STR_WINDOW_TITLE);
|
||||
set_window_name();
|
||||
|
||||
// Everything went well
|
||||
init_ok = true;
|
||||
|
@ -1174,7 +1243,7 @@ void driver_base::grab_mouse(void)
|
|||
if (!mouse_grabbed) {
|
||||
mouse_grabbed = true;
|
||||
update_mouse_grab();
|
||||
set_window_name_grabbed();
|
||||
set_window_name();
|
||||
disable_mouse_accel();
|
||||
ADBSetRelMouseMode(true);
|
||||
}
|
||||
|
@ -1186,7 +1255,7 @@ void driver_base::ungrab_mouse(void)
|
|||
if (mouse_grabbed) {
|
||||
mouse_grabbed = false;
|
||||
update_mouse_grab();
|
||||
set_window_name(STR_WINDOW_TITLE);
|
||||
set_window_name();
|
||||
restore_mouse_accel();
|
||||
ADBSetRelMouseMode(false);
|
||||
}
|
||||
|
@ -1354,6 +1423,8 @@ bool VideoInit(bool classic)
|
|||
frame_skip = PrefsFindInt32("frameskip");
|
||||
mouse_wheel_mode = PrefsFindInt32("mousewheelmode");
|
||||
mouse_wheel_lines = PrefsFindInt32("mousewheellines");
|
||||
mouse_wheel_reverse = mouse_wheel_lines < 0;
|
||||
if (mouse_wheel_reverse) mouse_wheel_lines = -mouse_wheel_lines;
|
||||
|
||||
// Get screen mode from preferences
|
||||
migrate_screen_prefs();
|
||||
|
@ -1595,6 +1666,26 @@ void VideoQuitFullScreen(void)
|
|||
quit_full_screen = true;
|
||||
}
|
||||
|
||||
static void ApplyGammaRamp() {
|
||||
if (sdl_window) {
|
||||
int result;
|
||||
if (!init_gamma_valid) {
|
||||
result = SDL_GetWindowGammaRamp(sdl_window, init_gamma_red, init_gamma_green, init_gamma_blue);
|
||||
if (result < 0)
|
||||
fprintf(stderr, "SDL_GetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
||||
init_gamma_valid = true;
|
||||
}
|
||||
const char *s = PrefsFindString("gammaramp");
|
||||
if (!s) s = "off";
|
||||
if (strcmp(s, "off") && (strcmp(s, "fullscreen") || display_type == DISPLAY_SCREEN))
|
||||
result = SDL_SetWindowGammaRamp(sdl_window, last_gamma_red, last_gamma_green, last_gamma_blue);
|
||||
else
|
||||
result = SDL_SetWindowGammaRamp(sdl_window, init_gamma_red, init_gamma_green, init_gamma_blue);
|
||||
if (result < 0)
|
||||
fprintf(stderr, "SDL_SetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
static void do_toggle_fullscreen(void)
|
||||
{
|
||||
#ifndef USE_CPU_EMUL_SERVICES
|
||||
|
@ -1610,15 +1701,15 @@ static void do_toggle_fullscreen(void)
|
|||
display_type = DISPLAY_WINDOW;
|
||||
SDL_SetWindowFullscreen(sdl_window, 0);
|
||||
const VIDEO_MODE &mode = drv->mode;
|
||||
SDL_SetWindowSize(sdl_window, VIDEO_MODE_X, VIDEO_MODE_Y);
|
||||
int m = get_mag_rate();
|
||||
SDL_SetWindowSize(sdl_window, m * VIDEO_MODE_X, m * VIDEO_MODE_Y);
|
||||
SDL_SetWindowGrab(sdl_window, SDL_FALSE);
|
||||
#ifndef __MACOSX__
|
||||
SDL_SetWindowPosition(sdl_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
#endif
|
||||
} else {
|
||||
display_type = DISPLAY_SCREEN;
|
||||
#ifdef __MACOSX__
|
||||
SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
#else
|
||||
SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN);
|
||||
#endif
|
||||
SDL_SetWindowGrab(sdl_window, SDL_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -1630,6 +1721,7 @@ static void do_toggle_fullscreen(void)
|
|||
#ifdef SHEEPSHAVER
|
||||
video_set_palette();
|
||||
#endif
|
||||
ApplyGammaRamp();
|
||||
drv->update_palette();
|
||||
|
||||
// reset the video refresh handler
|
||||
|
@ -1662,7 +1754,6 @@ static bool is_fullscreen(SDL_Window * window)
|
|||
// involves fullscreen/windowed toggles via window-manager UI controls).
|
||||
// Until it does, or adds a facility to do so, we'll use a platform-specific
|
||||
// code path to detect fullscreen changes.
|
||||
extern bool is_fullscreen_osx(SDL_Window * window);
|
||||
return is_fullscreen_osx(sdl_window);
|
||||
#else
|
||||
if (!window) {
|
||||
|
@ -1734,16 +1825,25 @@ void video_set_palette(void)
|
|||
}
|
||||
monitor->set_palette(pal, n_colors);
|
||||
}
|
||||
|
||||
void video_set_gamma(int n_colors)
|
||||
{
|
||||
monitor_desc * monitor = VideoMonitors[0];
|
||||
uint8 gamma[256 * 3];
|
||||
for (int c = 0; c < n_colors; c++) {
|
||||
gamma[c*3 + 0] = mac_gamma[c].red;
|
||||
gamma[c*3 + 1] = mac_gamma[c].green;
|
||||
gamma[c*3 + 2] = mac_gamma[c].blue;
|
||||
}
|
||||
monitor->set_gamma(gamma, n_colors);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
||||
{
|
||||
|
||||
const VIDEO_MODE &mode = get_current_mode();
|
||||
|
||||
// FIXME: how can we handle the gamma ramp?
|
||||
if ((int)VIDEO_MODE_DEPTH > VIDEO_DEPTH_8BIT)
|
||||
return;
|
||||
|
||||
|
||||
LOCK_PALETTE;
|
||||
|
||||
// Convert colors to XColor array
|
||||
|
@ -1786,6 +1886,48 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||
|
||||
UNLOCK_PALETTE;
|
||||
}
|
||||
|
||||
void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in)
|
||||
{
|
||||
// handle the gamma ramp
|
||||
|
||||
if (gamma[0] == 127 && gamma[num_in*3-1] == 127) // solid grey
|
||||
return; // ignore
|
||||
|
||||
uint16 red[256];
|
||||
uint16 green[256];
|
||||
uint16 blue[256];
|
||||
|
||||
int repeats = 256 / num_in;
|
||||
|
||||
for (int i = 0; i < num_in; i++) {
|
||||
for (int j = 0; j < repeats; j++) {
|
||||
red[i*repeats + j] = gamma[i*3 + 0] << 8;
|
||||
green[i*repeats + j] = gamma[i*3 + 1] << 8;
|
||||
blue[i*repeats + j] = gamma[i*3 + 2] << 8;
|
||||
}
|
||||
}
|
||||
|
||||
// fill remaining entries (if any) with last value
|
||||
for (int i = num_in * repeats; i < 256; i++) {
|
||||
red[i] = gamma[(num_in - 1) * 3] << 8;
|
||||
green[i] = gamma[(num_in - 1) * 3 + 1] << 8;
|
||||
blue[i] = gamma[(num_in - 1) * 3 + 2] << 8;
|
||||
}
|
||||
|
||||
bool changed = (memcmp(red, last_gamma_red, 512) != 0 ||
|
||||
memcmp(green, last_gamma_green, 512) != 0 ||
|
||||
memcmp(blue, last_gamma_blue, 512) != 0);
|
||||
|
||||
if (changed) {
|
||||
memcpy(last_gamma_red, red, 512);
|
||||
memcpy(last_gamma_green, green, 512);
|
||||
memcpy(last_gamma_blue, blue, 512);
|
||||
ApplyGammaRamp();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1832,6 +1974,40 @@ int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
static bool is_cursor_in_mac_screen()
|
||||
{
|
||||
int windowX, windowY;
|
||||
int cursorX, cursorY;
|
||||
int deltaX, deltaY;
|
||||
bool out;
|
||||
|
||||
// TODO figure out a check for full screen mode
|
||||
if (display_type == DISPLAY_SCREEN)
|
||||
return true;
|
||||
|
||||
if (display_type == DISPLAY_WINDOW) {
|
||||
|
||||
if (sdl_window == NULL || SDL_GetMouseFocus() != sdl_window)
|
||||
return false;
|
||||
|
||||
SDL_GetWindowPosition(sdl_window, &windowX, &windowY);
|
||||
SDL_GetGlobalMouseState(&cursorX, &cursorY);
|
||||
deltaX = cursorX - windowX;
|
||||
deltaY = cursorY - windowY;
|
||||
D(bug("cursor relative {%d,%d}\n", deltaX, deltaY));
|
||||
const VIDEO_MODE &mode = drv->mode;
|
||||
const int m = get_mag_rate();
|
||||
out = deltaX >= 0 && deltaX < VIDEO_MODE_X * m &&
|
||||
deltaY >= 0 && deltaY < VIDEO_MODE_Y * m;
|
||||
D(bug("cursor in window? %s\n", out? "yes" : "no"));
|
||||
return out;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SDL_monitor_desc::switch_to_current_mode(void)
|
||||
{
|
||||
// Close and reopen display
|
||||
|
@ -1854,7 +2030,7 @@ void SDL_monitor_desc::switch_to_current_mode(void)
|
|||
#ifdef SHEEPSHAVER
|
||||
bool video_can_change_cursor(void)
|
||||
{
|
||||
return PrefsFindBool("hardcursor") && (display_type == DISPLAY_WINDOW || PrefsFindBool("scale_integer"));
|
||||
return PrefsFindBool("hardcursor");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1887,10 +2063,14 @@ void video_set_cursor(void)
|
|||
if (move) {
|
||||
int visible = SDL_ShowCursor(-1);
|
||||
if (visible) {
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
printf("WarpMouse to {%d,%d} via video_set_cursor\n", x, y);
|
||||
SDL_WarpMouseGlobal(x, y);
|
||||
bool cursor_in_window = is_cursor_in_mac_screen();
|
||||
|
||||
if (cursor_in_window) {
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
D(bug("WarpMouse to {%d,%d} via video_set_cursor\n", x, y));
|
||||
SDL_WarpMouseInWindow(sdl_window, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1912,6 +2092,20 @@ static bool is_hotkey_down(SDL_Keysym const & ks)
|
|||
(cmd_down || (ks.mod & KMOD_GUI) || !(hotkey & 4));
|
||||
}
|
||||
|
||||
static int modify_opt_cmd(int code) {
|
||||
static bool f, c;
|
||||
if (!f) {
|
||||
f = true;
|
||||
c = PrefsFindBool("swap_opt_cmd");
|
||||
}
|
||||
if (c) {
|
||||
switch (code) {
|
||||
case 0x37: return 0x3a;
|
||||
case 0x3a: return 0x37;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate key event to Mac keycode, returns CODE_INVALID if no keycode was found
|
||||
|
@ -1987,17 +2181,8 @@ static int kc_decode(SDL_Keysym const & ks, bool key_down)
|
|||
case SDLK_RCTRL: return 0x36;
|
||||
case SDLK_LSHIFT: return 0x38;
|
||||
case SDLK_RSHIFT: return 0x38;
|
||||
#ifdef __APPLE__
|
||||
case SDLK_LALT: return 0x3a;
|
||||
case SDLK_RALT: return 0x3a;
|
||||
case SDLK_LGUI: return 0x37;
|
||||
case SDLK_RGUI: return 0x37;
|
||||
#else
|
||||
case SDLK_LALT: return 0x37;
|
||||
case SDLK_RALT: return 0x37;
|
||||
case SDLK_LGUI: return 0x3a;
|
||||
case SDLK_RGUI: return 0x3a;
|
||||
#endif
|
||||
case SDLK_LALT: case SDLK_RALT: return 0x3a;
|
||||
case SDLK_LGUI: case SDLK_RGUI: return 0x37;
|
||||
case SDLK_MENU: return 0x32;
|
||||
case SDLK_CAPSLOCK: return 0x39;
|
||||
case SDLK_NUMLOCKCLEAR: return 0x47;
|
||||
|
@ -2105,6 +2290,7 @@ static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
|||
case SDL_WINDOWEVENT: {
|
||||
switch (event->window.event) {
|
||||
case SDL_WINDOWEVENT_RESIZED: {
|
||||
if (!redraw_thread_active) break;
|
||||
// Handle changes of fullscreen. This is done here, in
|
||||
// on_sdl_event_generated() and not the main SDL_Event-processing
|
||||
// loop, in order to perform this change on the main thread.
|
||||
|
@ -2123,7 +2309,6 @@ static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
|||
// cursor is near the top of the screen, lest the
|
||||
// guest OS' menu bar be obscured.
|
||||
if (is_full) {
|
||||
extern void set_menu_bar_visible_osx(bool);
|
||||
set_menu_bar_visible_osx(false);
|
||||
}
|
||||
#endif
|
||||
|
@ -2183,12 +2368,12 @@ static void handle_events(void)
|
|||
case SDL_MOUSEWHEEL:
|
||||
if (!event.wheel.y) break;
|
||||
if (!mouse_wheel_mode) {
|
||||
int key = event.wheel.y < 0 ? 0x79 : 0x74; // Page up/down
|
||||
int key = (event.wheel.y < 0) ^ mouse_wheel_reverse ? 0x79 : 0x74; // Page up/down
|
||||
ADBKeyDown(key);
|
||||
ADBKeyUp(key);
|
||||
}
|
||||
else {
|
||||
int key = event.wheel.y < 0 ? 0x3d : 0x3e; // Cursor up/down
|
||||
int key = (event.wheel.y < 0) ^ mouse_wheel_reverse ? 0x3d : 0x3e; // Cursor up/down
|
||||
for (int i = 0; i < mouse_wheel_lines; i++) {
|
||||
ADBKeyDown(key);
|
||||
ADBKeyUp(key);
|
||||
|
@ -2198,6 +2383,8 @@ static void handle_events(void)
|
|||
|
||||
// Keyboard
|
||||
case SDL_KEYDOWN: {
|
||||
if (event.key.repeat)
|
||||
break;
|
||||
int code = CODE_INVALID;
|
||||
if (use_keycodes && event2keycode(event.key, true) != CODE_HOTKEY)
|
||||
code = keycode_table[event.key.keysym.scancode & 0xff];
|
||||
|
@ -2205,27 +2392,17 @@ static void handle_events(void)
|
|||
code = event2keycode(event.key, true);
|
||||
if (code >= 0) {
|
||||
if (!emul_suspended) {
|
||||
#ifdef WIN32
|
||||
code = modify_opt_cmd(code);
|
||||
if (code == 0x39)
|
||||
(SDL_GetModState() & KMOD_CAPS ? ADBKeyDown : ADBKeyUp)(code);
|
||||
else
|
||||
ADBKeyDown(code);
|
||||
#else
|
||||
ADBKeyDown(code);
|
||||
#endif
|
||||
if (code == 0x36)
|
||||
ctrl_down = true;
|
||||
#ifdef __APPLE__
|
||||
if (code == 0x3a)
|
||||
opt_down = true;
|
||||
if (code == 0x37)
|
||||
cmd_down = true;
|
||||
#else
|
||||
if (code == 0x37)
|
||||
opt_down = true;
|
||||
if (code == 0x3a)
|
||||
cmd_down = true;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
if (code == 0x31)
|
||||
|
@ -2241,25 +2418,15 @@ static void handle_events(void)
|
|||
if (code == CODE_INVALID)
|
||||
code = event2keycode(event.key, false);
|
||||
if (code >= 0) {
|
||||
#ifdef WIN32
|
||||
code = modify_opt_cmd(code);
|
||||
if (code != 0x39)
|
||||
ADBKeyUp(code);
|
||||
#else
|
||||
ADBKeyUp(code);
|
||||
#endif
|
||||
if (code == 0x36)
|
||||
ctrl_down = false;
|
||||
#ifdef __APPLE__
|
||||
if (code == 0x3a)
|
||||
opt_down = false;
|
||||
if (code == 0x37)
|
||||
cmd_down = false;
|
||||
#else
|
||||
if (code == 0x37)
|
||||
opt_down = false;
|
||||
if (code == 0x3a)
|
||||
cmd_down = false;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2280,6 +2447,11 @@ static void handle_events(void)
|
|||
break;
|
||||
}
|
||||
|
||||
case SDL_DROPFILE:
|
||||
CDROMDrop(event.drop.file);
|
||||
SDL_free(event.drop.file);
|
||||
break;
|
||||
|
||||
// Window "close" widget clicked
|
||||
case SDL_QUIT:
|
||||
if (SDL_GetModState() & (KMOD_LALT | KMOD_RALT)) break;
|
||||
|
@ -2305,6 +2477,7 @@ static void update_display_static(driver_base *drv)
|
|||
const VIDEO_MODE &mode = drv->mode;
|
||||
int bytes_per_row = VIDEO_MODE_ROW_BYTES;
|
||||
uint8 *p, *p2;
|
||||
uint32 x2_clipped, wide_clipped;
|
||||
|
||||
// Check for first line from top and first line from bottom that have changed
|
||||
y1 = 0;
|
||||
|
@ -2328,9 +2501,11 @@ static void update_display_static(driver_base *drv)
|
|||
if ((int)VIDEO_MODE_DEPTH < (int)VIDEO_DEPTH_8BIT) {
|
||||
const int src_bytes_per_row = bytes_per_row;
|
||||
const int dst_bytes_per_row = drv->s->pitch;
|
||||
const int pixels_per_byte = VIDEO_MODE_X / src_bytes_per_row;
|
||||
const int pixels_per_byte = 8/mac_depth_of_video_depth(VIDEO_MODE_DEPTH);
|
||||
|
||||
x1 = VIDEO_MODE_X / pixels_per_byte;
|
||||
const uint32 line_len = TrivialBytesPerRow(VIDEO_MODE_X, VIDEO_MODE_DEPTH);
|
||||
|
||||
x1 = line_len;
|
||||
for (uint32 j = y1; j <= y2; j++) {
|
||||
p = &the_buffer[j * bytes_per_row];
|
||||
p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
|
@ -2348,7 +2523,7 @@ static void update_display_static(driver_base *drv)
|
|||
p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
p += bytes_per_row;
|
||||
p2 += bytes_per_row;
|
||||
for (uint32 i = (VIDEO_MODE_X / pixels_per_byte); i > x2; i--) {
|
||||
for (uint32 i = line_len; i > x2; i--) {
|
||||
p--; p2--;
|
||||
if (*p != *p2) {
|
||||
x2 = i;
|
||||
|
@ -2356,9 +2531,12 @@ static void update_display_static(driver_base *drv)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
x1 *= pixels_per_byte;
|
||||
x2 *= pixels_per_byte;
|
||||
wide = (x2 - x1 + pixels_per_byte - 1) & -pixels_per_byte;
|
||||
wide = x2 - x1;
|
||||
x2_clipped = x2 > VIDEO_MODE_X? VIDEO_MODE_X : x2;
|
||||
wide_clipped = x2_clipped - x1;
|
||||
|
||||
// Update copy of the_buffer
|
||||
if (high && wide) {
|
||||
|
@ -2382,7 +2560,7 @@ static void update_display_static(driver_base *drv)
|
|||
SDL_UnlockSurface(drv->s);
|
||||
|
||||
// Refresh display
|
||||
update_sdl_video(drv->s, x1, y1, wide, high);
|
||||
update_sdl_video(drv->s, x1, y1, wide_clipped, high);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2449,6 +2627,7 @@ static void update_display_static(driver_base *drv)
|
|||
static void update_display_static_bbox(driver_base *drv)
|
||||
{
|
||||
const VIDEO_MODE &mode = drv->mode;
|
||||
bool blit = (int)VIDEO_MODE_DEPTH == VIDEO_DEPTH_16BIT;
|
||||
|
||||
// Allocate bounding boxes for SDL_UpdateRects()
|
||||
const uint32 N_PIXELS = 64;
|
||||
|
@ -2481,7 +2660,7 @@ static void update_display_static_bbox(driver_base *drv)
|
|||
const uint32 dst_yb = j * dst_bytes_per_row;
|
||||
if (memcmp(&the_buffer[yb + xb], &the_buffer_copy[yb + xb], xs) != 0) {
|
||||
memcpy(&the_buffer_copy[yb + xb], &the_buffer[yb + xb], xs);
|
||||
Screen_blit((uint8 *)drv->s->pixels + dst_yb + xb, the_buffer + yb + xb, xs);
|
||||
if (blit) Screen_blit((uint8 *)drv->s->pixels + dst_yb + xb, the_buffer + yb + xb, xs);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
@ -2668,7 +2847,7 @@ static int redraw_func(void *arg)
|
|||
{
|
||||
uint64 start = GetTicks_usec();
|
||||
int64 ticks = 0;
|
||||
uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY;
|
||||
uint64 next = start + VIDEO_REFRESH_DELAY;
|
||||
|
||||
while (!redraw_thread_cancel) {
|
||||
|
||||
|
@ -2691,8 +2870,10 @@ static int redraw_func(void *arg)
|
|||
do_video_refresh();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
uint64 end = GetTicks_usec();
|
||||
D(bug("%lld refreshes in %lld usec = %f refreshes/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,7 @@ cpustbl.cpp
|
|||
cputbl.h
|
||||
cpuemu_nf.cpp
|
||||
cpustbl_nf.cpp
|
||||
cpufunctbl.cpp
|
||||
|
||||
patches/*
|
||||
.pc*
|
||||
|
|
|
@ -135,7 +135,7 @@ static int main_loop(int sd, int use_bpf)
|
|||
|
||||
outgoing = malloc(blen);
|
||||
if (outgoing == NULL) {
|
||||
free(outgoing);
|
||||
free(incoming);
|
||||
fprintf(stderr,
|
||||
"%s: malloc() failed.\n",
|
||||
exec_name);
|
||||
|
|
|
@ -100,7 +100,7 @@ define GUI_SRCS_LIST_TO_OBJS
|
|||
endef
|
||||
GUI_OBJS = $(GUI_SRCS_LIST_TO_OBJS)
|
||||
ifeq ($(USE_BINCUE),yes)
|
||||
GUI_OBJS += bincue_unix.o
|
||||
GUI_OBJS += bincue.o
|
||||
endif
|
||||
GUI_SRCS := $(GUI_SRCS:%=@top_srcdir@/%)
|
||||
|
||||
|
@ -161,7 +161,9 @@ installdirs:
|
|||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(bindir)/$(APP)$(EXEEXT)
|
||||
rm -f $(DESTDIR)$(bindir)/$(GUI_APP)$(EXEEXT)
|
||||
if test -f "$(GUI_APP_EXE)"; then \
|
||||
rm -f $(DESTDIR)$(bindir)/$(GUI_APP_EXE); \
|
||||
fi
|
||||
rm -f $(DESTDIR)$(man1dir)/$(APP).1
|
||||
rm -f $(DESTDIR)$(datadir)/$(APP)/keycodes
|
||||
rm -f $(DESTDIR)$(datadir)/$(APP)/fbdevices
|
||||
|
@ -212,13 +214,16 @@ $(OBJ_DIR)/gencpu$(EXEEXT): $(OBJ_DIR)/gencpu.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/
|
|||
$(OBJ_DIR)/gencomp$(EXEEXT): $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o
|
||||
$(CXX) $(LDFLAGS) -o $(OBJ_DIR)/gencomp$(EXEEXT) $(OBJ_DIR)/gencomp.o $(OBJ_DIR)/readcpu.o $(OBJ_DIR)/cpudefs.o
|
||||
|
||||
cpudefs.cpp: $(OBJ_DIR)/build68k$(EXEEXT) @top_srcdir@/../uae_cpu/table68k
|
||||
$(OBJ_DIR)/build68k$(EXEEXT) <@top_srcdir@/../uae_cpu/table68k >cpudefs.cpp
|
||||
UAE_PATH = @UAE_PATH@
|
||||
|
||||
cpudefs.cpp: $(OBJ_DIR)/build68k$(EXEEXT) @top_srcdir@/$(UAE_PATH)/table68k
|
||||
$(OBJ_DIR)/build68k$(EXEEXT) <@top_srcdir@/$(UAE_PATH)/table68k >cpudefs.cpp
|
||||
cpustbl.cpp: cpuemu.cpp
|
||||
cpustbl_nf.cpp: cpustbl.cpp
|
||||
compstbl.cpp: compemu.cpp
|
||||
cputbl.h: cpuemu.cpp
|
||||
comptbl.h: compemu.cpp
|
||||
cpufunctbl.cpp: cputbl.h
|
||||
|
||||
cpuemu.cpp: $(OBJ_DIR)/gencpu$(EXEEXT)
|
||||
$(OBJ_DIR)/gencpu$(EXEEXT)
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
# serial 1
|
||||
dnl Additional macros for Basilisk II
|
||||
|
||||
dnl Check for libgnomeui
|
||||
dnl B2_PATH_GNOMEUI([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test to see if libgnomeui is installed, and define GNOMEUI_CFLAGS, LIBS
|
||||
AC_DEFUN([B2_PATH_GNOMEUI],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the gnome-config script
|
||||
dnl
|
||||
AC_ARG_WITH(gnome-config,
|
||||
[ --with-gnome-config=GNOME_CONFIG Location of gnome-config],
|
||||
GNOME_CONFIG="$withval")
|
||||
|
||||
AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
|
||||
AC_MSG_CHECKING(for libgnomeui)
|
||||
if test "$GNOME_CONFIG" = "no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
GNOMEUI_CFLAGS=`$GNOME_CONFIG --cflags gnomeui`
|
||||
GNOMEUI_LIBS=`$GNOME_CONFIG --libs gnomeui`
|
||||
ifelse([$1], , :, [$1])
|
||||
fi
|
||||
AC_SUBST(GNOMEUI_CFLAGS)
|
||||
AC_SUBST(GNOMEUI_LIBS)
|
||||
])
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ dnl Video options.
|
|||
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
|
||||
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
|
||||
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
|
||||
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
|
||||
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
|
||||
|
||||
dnl SDL options.
|
||||
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
|
||||
|
@ -37,9 +37,10 @@ AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [defau
|
|||
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
|
||||
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
|
||||
AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], [])
|
||||
AC_ARG_WITH(sdl3, [ --with-sdl3 use SDL 3.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=3], [])
|
||||
|
||||
dnl JIT compiler options.
|
||||
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
|
||||
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
|
||||
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
|
||||
|
||||
dnl FPU emulation core.
|
||||
|
@ -75,12 +76,10 @@ dnl External packages.
|
|||
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
|
||||
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]],
|
||||
[case "$withval" in
|
||||
gtk1) WANT_GTK="gtk";;
|
||||
gtk|gtk2) WANT_GTK="$withval";;
|
||||
yes) WANT_GTK="gtk2 gtk";;
|
||||
yes|gtk2) WANT_GTK="gtk2";;
|
||||
*) WANT_GTK="no";;
|
||||
esac],
|
||||
[WANT_GTK="gtk2 gtk"])
|
||||
[WANT_GTK="gtk2"])
|
||||
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=no]], [WANT_MON=$withval], [WANT_MON=no])
|
||||
|
||||
AC_ARG_WITH(bincue,
|
||||
|
@ -89,6 +88,11 @@ AC_ARG_WITH(bincue,
|
|||
AC_ARG_WITH(libvhd,
|
||||
AS_HELP_STRING([--with-libvhd], [Enable VHD disk images]))
|
||||
|
||||
AC_ARG_WITH(vdeplug,
|
||||
AS_HELP_STRING([--with-vdeplug], [Enable VDE virtual network support]),
|
||||
[],
|
||||
[with_vdeplug=yes])
|
||||
|
||||
|
||||
dnl Cross Compiling results in 'guesses' being made about the target system. These defaults are oftetimes incorrect.
|
||||
dnl The following Environment variables allow you to configure the default guess value for each option in the configure script.
|
||||
|
@ -213,7 +217,7 @@ if [[ "x$HAVE_I386" = "xyes" ]]; then
|
|||
fi
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C99
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_CXX
|
||||
|
@ -326,9 +330,18 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
|
|||
dnl never got defined (bizarrely-enough). -- dludwig@pobox.com
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x3" ]]; then
|
||||
PKG_CHECK_MODULES([sdl3], [sdl3 >= 3.0], [
|
||||
CXXFLAGS="$CXXFLAGS $sdl3_CFLAGS"
|
||||
CXXFLAGS+=`echo " $sdl3_CFLAGS" | sed -e 's/\(-I.*include\)/\1\/SDL3/'`
|
||||
LIBS="$LIBS $sdl3_LIBS"
|
||||
WANT_SDL_VERSION_MAJOR=3
|
||||
], [
|
||||
TEMP_WANT_SDL_VERSION_MAJOR=1
|
||||
])
|
||||
fi
|
||||
if [[ "x$TEMP_WANT_SDL_VERSION_MAJOR" = "x2" ]]; then
|
||||
PKG_CHECK_MODULES([sdl2], [sdl2 >= 2.0], [
|
||||
CFLAGS="$CFLAGS $sdl2_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $sdl2_CFLAGS"
|
||||
LIBS="$LIBS $sdl2_LIBS"
|
||||
WANT_SDL_VERSION_MAJOR=2
|
||||
|
@ -369,6 +382,7 @@ AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
|
|||
AS_IF([test "x$have_bincue" = "xyes" ], [
|
||||
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
|
||||
DEFINES="$DEFINES -DBINCUE"
|
||||
CPPFLAGS="$CPPFLAGS -DBINCUE"
|
||||
AC_SUBST(USE_BINCUE, yes)
|
||||
else
|
||||
AC_MSG_ERROR([You need SDL Audio to use BINCUE support.])
|
||||
|
@ -446,41 +460,13 @@ fi
|
|||
|
||||
dnl We use GTK+ if possible.
|
||||
UISRCS=../dummy/prefs_editor_dummy.cpp
|
||||
case "x$WANT_GTK" in
|
||||
xgtk2*)
|
||||
AM_PATH_GTK_2_0(1.3.15, [
|
||||
if [[ "x$WANT_GTK" = "xgtk2" ]]; then
|
||||
AM_PATH_GTK_2_0(2.6.4, [
|
||||
GUI_CFLAGS="$GTK_CFLAGS"
|
||||
GUI_LIBS="$GTK_LIBS"
|
||||
WANT_GTK=gtk2
|
||||
], [
|
||||
case "x${WANT_GTK}x" in
|
||||
*gtkx)
|
||||
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
|
||||
WANT_GTK=gtk
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
|
||||
WANT_GTK=no
|
||||
;;
|
||||
esac
|
||||
])
|
||||
;;
|
||||
esac
|
||||
if [[ "x$WANT_GTK" = "xgtk" ]]; then
|
||||
AM_PATH_GTK(1.2.0, [
|
||||
GUI_CFLAGS="$GTK_CFLAGS"
|
||||
GUI_LIBS="$GTK_LIBS"
|
||||
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
|
||||
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
|
||||
dnl includes <libintl.h>
|
||||
AM_GNU_GETTEXT
|
||||
B2_PATH_GNOMEUI([
|
||||
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
|
||||
GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS"
|
||||
], [])
|
||||
], [
|
||||
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
|
||||
AC_MSG_WARN([Could not find GTK+ 2.0, disabling user interface.])
|
||||
WANT_GTK=no
|
||||
])
|
||||
fi
|
||||
|
@ -588,7 +574,8 @@ dnl Check for headers and functions related to pty support (sshpty.c)
|
|||
dnl From openssh-3.2.2p1 configure.ac
|
||||
|
||||
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
|
||||
AC_CHECK_FUNCS(_getpty vhangup strlcpy)
|
||||
AC_SEARCH_LIBS([openpty], [util bsd])
|
||||
AC_CHECK_FUNCS(_getpty openpty vhangup strlcpy)
|
||||
|
||||
case "$host" in
|
||||
*-*-hpux10.26)
|
||||
|
@ -611,11 +598,13 @@ mips-sony-bsd|mips-sony-newsos4)
|
|||
;;
|
||||
*-*-darwin*)
|
||||
no_dev_ptmx=1
|
||||
LIBS="$LIBS -lstdc++"
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
no_dev_ptmx=1
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
no_dev_ptmx=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
|
||||
|
@ -725,6 +714,7 @@ AC_CHECK_FRAMEWORK(AppKit, [])
|
|||
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
|
||||
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
|
||||
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
|
||||
AC_CHECK_FRAMEWORK(Metal, [])
|
||||
|
||||
dnl Select system-dependant source files.
|
||||
SERIALSRC=serial_unix.cpp
|
||||
|
@ -768,8 +758,11 @@ netbsd*)
|
|||
ETHERSRC=ether_unix.cpp
|
||||
;;
|
||||
solaris*)
|
||||
AUDIOSRC=Solaris/audio_solaris.cpp
|
||||
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
|
||||
dnl Needed for sys/socket.h
|
||||
LIBS="$LIBS -lsocket -lnsl"
|
||||
dnl Needed for SDL2
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
;;
|
||||
irix*)
|
||||
AUDIOSRC=Irix/audio_irix.cpp
|
||||
|
@ -822,6 +815,13 @@ if [[ -n "$CAN_SLIRP" ]]; then
|
|||
fi
|
||||
AC_SUBST(SLIRP_SRCS)
|
||||
|
||||
dnl Is libvdeplug available?
|
||||
have_vdeplug=no
|
||||
AS_IF([test "x$with_vdeplug" = "xyes"], [
|
||||
have_vdeplug=yes
|
||||
AC_CHECK_LIB(vdeplug, vde_close, [], [have_vdeplug=no])
|
||||
])
|
||||
|
||||
if [[ "x$WANT_MACOSX_GUI" = "xyes" ]]; then
|
||||
CPPFLAGS="$CPPFLAGS -I../MacOSX"
|
||||
LIBS="$LIBS -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
|
||||
|
@ -855,7 +855,7 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
|
|||
fi
|
||||
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
|
||||
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
|
||||
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp"
|
||||
VIDEOSRCS="../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp ../SDL/video_sdl3.cpp "
|
||||
KEYCODES="../SDL/keycodes"
|
||||
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
|
||||
AC_MSG_CHECKING([whether __LP64__ is defined])
|
||||
|
@ -892,13 +892,13 @@ elif [[ "x$WANT_MACOSX_GUI" != "xyes" ]]; then
|
|||
fi
|
||||
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
|
||||
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
|
||||
AUDIOSRC="../SDL/audio_sdl.cpp"
|
||||
AUDIOSRC="../SDL/audio_sdl.cpp ../SDL/audio_sdl3.cpp"
|
||||
fi
|
||||
|
||||
dnl BINCUE overrides
|
||||
|
||||
if [[ "x$have_bincue" = "xyes" ]]; then
|
||||
EXTRASYSSRCS="$EXTRASYSSRCS bincue_unix.cpp"
|
||||
EXTRASYSSRCS="$EXTRASYSSRCS bincue.cpp"
|
||||
fi
|
||||
|
||||
dnl libvhd overrides
|
||||
|
@ -950,6 +950,9 @@ AC_CACHE_CHECK([whether TUN/TAP is supported],
|
|||
#include <net/if.h>
|
||||
#include <net/if_tun.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
], [
|
||||
struct ifreq ifr;
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
@ -1107,42 +1110,37 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
|
|||
|
||||
fi dnl HAVE_MMAP_VM
|
||||
|
||||
if [[ "$OS_TYPE" != "darwin" ]]; then
|
||||
dnl Check if we can disable position-independent code
|
||||
AC_CACHE_CHECK([whether the compiler supports -no-pie],
|
||||
ac_cv_no_pie, [
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -no-pie"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM()],[
|
||||
ac_cv_no_pie="yes"],[
|
||||
ac_cv_no_pie="no"
|
||||
])
|
||||
if [[ "$ac_cv_no_pie" = "no" ]]; then
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
|
||||
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
|
||||
ac_cv_pagezero_hack, [
|
||||
ac_cv_pagezero_hack=no
|
||||
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
|
||||
case $target_os:$target_cpu in
|
||||
darwin*:x86_64)
|
||||
ac_cv_pagezero_hack=yes
|
||||
dnl might as well skip the test for mmap-able low memory
|
||||
ac_cv_can_map_lm=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
])
|
||||
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
|
||||
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
|
||||
|
||||
dnl Check if we can mmap 0x2000 bytes from 0x0000
|
||||
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
|
||||
ac_cv_can_map_lm, [
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_RUN([
|
||||
#include "../CrossPlatform/vm_alloc.cpp"
|
||||
int main(void) { /* returns 0 if we could map the lowmem globals */
|
||||
volatile char * lm = 0;
|
||||
if (vm_init() < 0) exit(1);
|
||||
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
|
||||
lm[0] = 'z';
|
||||
if (vm_release((char *)lm, 0x2000) < 0) exit(1);
|
||||
vm_exit(); exit(0);
|
||||
}
|
||||
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
|
||||
dnl When cross-compiling, do not assume anything.
|
||||
ac_cv_can_map_lm="$BII_CROSS_MAP_LOW_AREA"
|
||||
)
|
||||
AC_LANG_RESTORE
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check signal handlers need to be reinstalled
|
||||
AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
|
||||
ac_cv_signal_need_reinstall, [
|
||||
|
@ -1227,6 +1225,11 @@ AC_CACHE_CHECK([whether your system supports Mach exceptions],
|
|||
AC_LANG_RESTORE
|
||||
]
|
||||
)
|
||||
|
||||
case $target_os:$target_cpu in
|
||||
darwin*:arm) ac_cv_have_mach_exceptions=yes;;
|
||||
esac
|
||||
|
||||
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
|
||||
[Define if your system supports Mach exceptions.])
|
||||
|
||||
|
@ -1363,6 +1366,11 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
|
|||
AC_LANG_RESTORE
|
||||
]
|
||||
)
|
||||
|
||||
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
|
||||
ac_cv_have_skip_instruction=yes
|
||||
fi
|
||||
|
||||
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
|
||||
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
|
||||
|
||||
|
@ -1378,11 +1386,10 @@ AC_PATH_PROG([BLESS], "true")
|
|||
dnl Check for linker script support
|
||||
case $target_os:$target_cpu in
|
||||
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
|
||||
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
|
||||
linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
|
||||
netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
|
||||
freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
|
||||
darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
|
||||
#darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
|
||||
esac
|
||||
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
|
||||
AC_CACHE_CHECK([whether linker script is usable],
|
||||
|
@ -1417,17 +1424,12 @@ else
|
|||
for am in $ADDRESSING_TEST_ORDER; do
|
||||
case $am in
|
||||
real)
|
||||
dnl Requires ability to mmap() Low Memory globals
|
||||
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
|
||||
continue
|
||||
fi
|
||||
dnl Requires VOSF screen updates
|
||||
if [[ "x$CAN_VOSF" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
dnl Real addressing will probably work.
|
||||
ADDRESSING_MODE="real"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DREAL_ADDRESSING"
|
||||
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
|
||||
BLESS=Darwin/lowmem
|
||||
|
@ -1439,7 +1441,6 @@ else
|
|||
dnl Requires VOSF screen updates
|
||||
if [[ "x$CAN_VOSF" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="direct"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DDIRECT_ADDRESSING"
|
||||
break
|
||||
fi
|
||||
|
@ -1462,7 +1463,15 @@ fi
|
|||
|
||||
dnl Banked Memory Addressing mode is not supported by the JIT compiler
|
||||
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
|
||||
AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
|
||||
AC_MSG_WARN([The JIT Compiler requires Direct Addressing, disabling])
|
||||
WANT_JIT="no"
|
||||
fi
|
||||
|
||||
if [[ "x$OS_TYPE" = "xdarwin" ]]; then
|
||||
WANT_VOSF=no
|
||||
if [[ "$target_cpu" != "arm" ]]; then
|
||||
LDFLAGS="$LDFLAGS -Wl,-no_pie -pagezero_size 0x1000"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Enable VOSF screen updates with this feature is requested and feasible
|
||||
|
@ -1638,9 +1647,15 @@ elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
|||
CPUSRCS="asm_support.s"
|
||||
fi
|
||||
|
||||
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
|
||||
UAE_PATH="../uae_cpu_2021"
|
||||
else
|
||||
UAE_PATH="../uae_cpu"
|
||||
fi
|
||||
|
||||
dnl Enable JIT compiler, if possible.
|
||||
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
|
||||
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
|
||||
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" = "xyes" ]]; then
|
||||
JITSRCS="$JITSRCS $UAE_PATH/compiler/compemu_support.cpp $UAE_PATH/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
|
||||
DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
|
||||
|
||||
if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
|
||||
|
@ -1688,7 +1703,19 @@ cat > conftest.$ac_ext <<EOF
|
|||
#include "confdefs.h"
|
||||
$1
|
||||
]EOF
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fno-lto"
|
||||
gcc_ac_compile_ok=0
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
gcc_ac_compile_ok=1
|
||||
else
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
gcc_ac_compile_ok=1
|
||||
fi
|
||||
fi
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
if test "$gcc_ac_compile_ok" = 1; then
|
||||
od -c conftest.o |
|
||||
sed ['s/^[0-7]*[ ]*/ /
|
||||
s/\*/./g
|
||||
|
@ -1810,9 +1837,16 @@ for fpe in $FPE_CORE_TEST_ORDER; do
|
|||
ieee)
|
||||
case $ac_cv_c_float_format in
|
||||
IEEE*)
|
||||
FPE_CORE="IEEE fpu core"
|
||||
DEFINES="$DEFINES -DFPU_IEEE"
|
||||
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
|
||||
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
|
||||
FPE_CORE="IEEE fpu core (MPFR)"
|
||||
DEFINES="$DEFINES -DFPU_MPFR"
|
||||
FPUSRCS="$UAE_PATH/fpu/fpu_mpfr.cpp"
|
||||
LIBS="$LIBS -lmpfr -lgmp"
|
||||
else
|
||||
FPE_CORE="IEEE fpu core"
|
||||
DEFINES="$DEFINES -DFPU_IEEE"
|
||||
FPUSRCS="$UAE_PATH/fpu/fpu_ieee.cpp"
|
||||
fi
|
||||
dnl Math functions not mandated by C99 standard
|
||||
AC_CHECK_FUNCS(isnanl isinfl)
|
||||
dnl Math functions required by C99 standard, but probably not
|
||||
|
@ -1830,14 +1864,14 @@ for fpe in $FPE_CORE_TEST_ORDER; do
|
|||
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
|
||||
FPE_CORE="i387 fpu core"
|
||||
DEFINES="$DEFINES -DFPU_X86"
|
||||
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
|
||||
FPUSRCS="$UAE_PATH/fpu/fpu_x86.cpp"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
uae)
|
||||
FPE_CORE="uae fpu core"
|
||||
DEFINES="$DEFINES -DFPU_UAE"
|
||||
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
|
||||
FPUSRCS="$UAE_PATH/fpu/fpu_uae.cpp"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
|
@ -1855,8 +1889,12 @@ AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
|
|||
|
||||
dnl UAE CPU sources for all non-m68k-native architectures.
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
|
||||
CPUINCLUDES="-I../uae_cpu"
|
||||
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
|
||||
CPUINCLUDES="-I$UAE_PATH"
|
||||
CPUSRCS="$UAE_PATH/basilisk_glue.cpp $UAE_PATH/memory.cpp $UAE_PATH/newcpu.cpp $UAE_PATH/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
|
||||
if [[ "$target_cpu" = "arm" -o "$target_cpu" = "aarch64" ]]; then
|
||||
CPUSRCS="$CPUSRCS cpufunctbl.cpp"
|
||||
DEFINES="$DEFINES -DUPDATE_UAE"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Or if we have -IPA (MIPSPro compilers)
|
||||
|
@ -1867,6 +1905,9 @@ if [[ "x$HAVE_IPA" = "xyes" ]]; then
|
|||
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -fwrapv"
|
||||
CXXFLAGS="$CXXFLAGS -fwrapv"
|
||||
|
||||
dnl Generate Makefile.
|
||||
AC_SUBST(DEFINES)
|
||||
AC_SUBST(SYSSRCS)
|
||||
|
@ -1874,6 +1915,7 @@ AC_SUBST(CPUINCLUDES)
|
|||
AC_SUBST(CPUSRCS)
|
||||
AC_SUBST(BLESS)
|
||||
AC_SUBST(KEYCODES)
|
||||
AC_SUBST(UAE_PATH)
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
@ -1887,6 +1929,7 @@ echo SDL support ............................ : $SDL_SUPPORT
|
|||
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
|
||||
echo BINCUE support ......................... : $have_bincue
|
||||
echo LIBVHD support ......................... : $have_libvhd
|
||||
echo VDE support ............................ : $have_vdeplug
|
||||
echo XFree86 DGA support .................... : $WANT_XF86_DGA
|
||||
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
|
||||
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
#ifdef HAVE_SYS_POLL_H
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
#define BSD_COMP 1
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
@ -66,7 +71,7 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__FreeBSD__) || defined (__sun__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
|
@ -85,6 +90,12 @@
|
|||
#include "ctl.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
extern "C" {
|
||||
#include <libvdeplug.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cpu_emulation.h"
|
||||
#include "main.h"
|
||||
#include "macos_util.h"
|
||||
|
@ -110,6 +121,7 @@ enum {
|
|||
NET_IF_ETHERTAP,
|
||||
NET_IF_TUNTAP,
|
||||
NET_IF_SLIRP,
|
||||
NET_IF_VDE,
|
||||
NET_IF_ETHERHELPER
|
||||
};
|
||||
|
||||
|
@ -139,6 +151,9 @@ static pthread_t slirp_thread; // Slirp reception thread
|
|||
static bool slirp_thread_active = false; // Flag: Slirp reception threadinstalled
|
||||
static int slirp_output_fd = -1; // fd of slirp output pipe
|
||||
static int slirp_input_fds[2] = { -1, -1 }; // fds of slirp input pipe
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
static VDECONN *vde_conn;
|
||||
#endif
|
||||
#ifdef SHEEPSHAVER
|
||||
static bool net_open = false; // Flag: initialization succeeded, network device open
|
||||
static uint8 ether_addr[6]; // Our Ethernet address
|
||||
|
@ -277,22 +292,36 @@ bool ether_init(void)
|
|||
|
||||
// Determine Ethernet device type
|
||||
net_if_type = -1;
|
||||
if (strncmp(name, "tap", 3) == 0)
|
||||
if (strncmp(name, "tap", 3) == 0) {
|
||||
net_if_type = NET_IF_ETHERTAP;
|
||||
printf("selected Ethernet device type tap\n");
|
||||
}
|
||||
#if ENABLE_TUNTAP
|
||||
else if (strcmp(name, "tun") == 0)
|
||||
else if (strcmp(name, "tun") == 0) {
|
||||
net_if_type = NET_IF_TUNTAP;
|
||||
printf("selected Ethernet device type tun\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SLIRP
|
||||
else if (strcmp(name, "slirp") == 0)
|
||||
else if (strcmp(name, "slirp") == 0) {
|
||||
net_if_type = NET_IF_SLIRP;
|
||||
printf("selected Ethernet device type slirp\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
else if (strcmp(name, "vde") == 0) {
|
||||
net_if_type = NET_IF_VDE;
|
||||
printf("selected Ethernet device type VDE\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||
else if (strncmp(name, "etherhelper", 10) == 0)
|
||||
net_if_type = NET_IF_ETHERHELPER;
|
||||
#endif
|
||||
else
|
||||
else {
|
||||
net_if_type = NET_IF_SHEEPNET;
|
||||
printf("selected Ethernet device type sheep_net\n");
|
||||
}
|
||||
|
||||
// Don't raise SIGPIPE, let errno be set to EPIPE
|
||||
struct sigaction sigpipe_sa;
|
||||
|
@ -361,7 +390,35 @@ bool ether_init(void)
|
|||
|
||||
#endif
|
||||
}
|
||||
if (net_if_type != NET_IF_SLIRP) {
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
//vde switch information
|
||||
int port = 0;
|
||||
char *init_group = NULL;
|
||||
mode_t mode = 0700;
|
||||
|
||||
struct vde_open_args args = {
|
||||
.port = port,
|
||||
.group = init_group,
|
||||
.mode = mode,
|
||||
};
|
||||
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
/* calling vde open to open the vde connection to the vde switch */
|
||||
vde_conn = vde_open(vde_sock, (char *)"macemu", &args);
|
||||
|
||||
if (!vde_conn) {
|
||||
D(bug("VDE open failed\n"));
|
||||
return -1;
|
||||
} else {
|
||||
/* for select/poll when this fd receive data, there are
|
||||
* packets to recv(call vde_recv) */
|
||||
fd = vde_datafd(vde_conn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (net_if_type != NET_IF_SLIRP && net_if_type != NET_IF_VDE) {
|
||||
fd = open(dev_name, O_RDWR);
|
||||
if (fd < 0) {
|
||||
sprintf(str, GetString(STR_NO_SHEEP_NET_DRIVER_WARN), dev_name, strerror(errno));
|
||||
|
@ -447,6 +504,15 @@ bool ether_init(void)
|
|||
ether_addr[3] = 0x12;
|
||||
ether_addr[4] = 0x34;
|
||||
ether_addr[5] = 0x56;
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
} else if (net_if_type == NET_IF_VDE) {
|
||||
ether_addr[0] = 0x52;
|
||||
ether_addr[1] = 0x54;
|
||||
ether_addr[2] = 0x00;
|
||||
ether_addr[3] = 0x12;
|
||||
ether_addr[4] = 0x34;
|
||||
ether_addr[5] = 0x56;
|
||||
#endif
|
||||
} else
|
||||
ioctl(fd, SIOCGIFADDR, ether_addr);
|
||||
|
@ -513,6 +579,11 @@ void ether_exit(void)
|
|||
if (slirp_output_fd > 0)
|
||||
close(slirp_output_fd);
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
// Close vde_connection
|
||||
if (net_if_type == NET_IF_VDE)
|
||||
vde_close(vde_conn);
|
||||
#endif
|
||||
#if STATISTICS
|
||||
// Show statistics
|
||||
printf("%ld messages put on write queue\n", num_wput);
|
||||
|
@ -811,6 +882,25 @@ static int16 ether_do_write(uint32 arg)
|
|||
return noErr;
|
||||
} else
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
if (fd == -1) { // which means vde service is not running
|
||||
D(bug("WARNING: Couldn't transmit VDE packet\n"));
|
||||
return excessCollsns;
|
||||
}
|
||||
|
||||
if (vde_conn == NULL) {
|
||||
D(bug("WARNING: vde_conn is NULL\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
do {
|
||||
len = vde_send(vde_conn, packet, sizeof(packet), 0);
|
||||
} while (len < 0);
|
||||
|
||||
return noErr;
|
||||
} else
|
||||
#endif
|
||||
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||
if (net_if_type == NET_IF_ETHERHELPER) {
|
||||
unsigned short pkt_len;
|
||||
|
@ -1019,13 +1109,20 @@ void ether_do_interrupt(void)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
// Read packet from sheep_net device
|
||||
#if defined(__linux__)
|
||||
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
|
||||
#else
|
||||
length = read(fd, Mac2HostAddr(packet), 1514);
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
length = vde_recv(vde_conn, Mac2HostAddr(packet), 1514, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Read packet from sheep_net device
|
||||
#if defined(__linux__)
|
||||
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
|
||||
#else
|
||||
length = read(fd, Mac2HostAddr(packet), 1514);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (length < 14)
|
||||
break;
|
||||
|
||||
|
|
|
@ -2,29 +2,696 @@
|
|||
#
|
||||
# Basilisk II (C) 1997-2005 Christian Bauer
|
||||
#
|
||||
# This file is used to translate the (server-specific) X11 keycodes to Mac
|
||||
# keycodes depending on the X11 server being used.
|
||||
# This file is used to translate the (server-specific) scancodes to
|
||||
# Mac keycodes depending on the window server being used.
|
||||
#
|
||||
# The format of this file is as follows:
|
||||
#
|
||||
# sdl <driver string>
|
||||
# <SDL scancode> <Mac keycode>
|
||||
# <SDL scancode> <Mac keycode>
|
||||
# <SDL scancode> <Mac keycode>
|
||||
# ...
|
||||
# <vendor string>
|
||||
# <X11 keycode> <Mac keycode>
|
||||
# <X11 keycode> <Mac keycode>
|
||||
# <X11 keycode> <Mac keycode>
|
||||
# ...
|
||||
# <vendor string>
|
||||
# <X11 keycode> <Mac keycode>
|
||||
# <X11 keycode> <Mac keycode>
|
||||
# ...
|
||||
#
|
||||
# The "vendor string" must match the first part of the X11 server vendor
|
||||
# description as reported by ServerVendor(). If a match is found, the keycode
|
||||
# translation table is constructed from the following lines. Each line
|
||||
# contains an X11 keycode followed by its associated Mac keycode. Both
|
||||
# keycodes have to be given in decimal. Lines beginning with "#" or ";" are
|
||||
# treated as comments and ignored.
|
||||
# The "driver string" must match the first part of the SDL driver
|
||||
# vendor description as reported by SDL_VideoDriverName(), while the
|
||||
# "vendor string" must match the first part of the X11 server vendor
|
||||
# description as reported by ServerVendor(). If a match is found,
|
||||
# the keycode translation table is constructed from the following
|
||||
# lines. Each line contains an SDL scancode or X11 keycode followed
|
||||
# by its associated Mac keycode. Both keycodes have to be given in
|
||||
# decimal. Lines beginning with "#" or ";" are treated as comments
|
||||
# and ignored.
|
||||
#
|
||||
|
||||
#
|
||||
# X11 server
|
||||
# X.Org
|
||||
# Wayland
|
||||
#
|
||||
sdl x11
|
||||
sdl wayland
|
||||
sdl dga
|
||||
The X.Org Foundation
|
||||
9 53 # Esc
|
||||
67 122 # F1
|
||||
68 120 # F2
|
||||
69 99 # F3
|
||||
70 118 # F4
|
||||
71 96 # F5
|
||||
72 97 # F6
|
||||
73 98 # F7
|
||||
74 100 # F8
|
||||
75 101 # F9
|
||||
76 109 # F10
|
||||
95 103 # F11
|
||||
96 111 # F12
|
||||
111 105 # PrintScrn
|
||||
78 107 # Scroll Lock
|
||||
110 113 # Pause
|
||||
49 50 # `
|
||||
10 18 # 1
|
||||
11 19 # 2
|
||||
12 20 # 3
|
||||
13 21 # 4
|
||||
14 23 # 5
|
||||
15 22 # 6
|
||||
16 26 # 7
|
||||
17 28 # 8
|
||||
18 25 # 9
|
||||
19 29 # 0
|
||||
20 27 # -
|
||||
21 24 # =
|
||||
22 51 # Backspace
|
||||
106 114 # Insert
|
||||
97 115 # Home
|
||||
99 116 # Page Up
|
||||
77 71 # Num Lock
|
||||
112 75 # KP /
|
||||
63 67 # KP *
|
||||
82 78 # KP -
|
||||
23 48 # Tab
|
||||
24 12 # Q
|
||||
25 13 # W
|
||||
26 14 # E
|
||||
27 15 # R
|
||||
28 17 # T
|
||||
29 16 # Y
|
||||
30 32 # U
|
||||
31 34 # I
|
||||
32 31 # O
|
||||
33 35 # P
|
||||
34 33 # [
|
||||
35 30 # ]
|
||||
36 36 # Return
|
||||
107 117 # Delete
|
||||
103 119 # End
|
||||
105 121 # Page Down
|
||||
79 89 # KP 7
|
||||
80 91 # KP 8
|
||||
81 92 # KP 9
|
||||
86 69 # KP +
|
||||
66 57 # Caps Lock
|
||||
38 0 # A
|
||||
39 1 # S
|
||||
40 2 # D
|
||||
41 3 # F
|
||||
42 5 # G
|
||||
43 4 # H
|
||||
44 38 # J
|
||||
45 40 # K
|
||||
46 37 # L
|
||||
47 41 # ;
|
||||
48 39 # '
|
||||
83 86 # KP 4
|
||||
84 87 # KP 5
|
||||
85 88 # KP 6
|
||||
50 56 # Shift Left
|
||||
94 50 # International
|
||||
52 6 # Z
|
||||
53 7 # X
|
||||
54 8 # C
|
||||
55 9 # V
|
||||
56 11 # B
|
||||
57 45 # N
|
||||
58 46 # M
|
||||
59 43 # ,
|
||||
60 47 # .
|
||||
61 44 # /
|
||||
62 56 # Shift Right
|
||||
51 42 # \
|
||||
98 62 # Cursor Up
|
||||
87 83 # KP 1
|
||||
88 84 # KP 2
|
||||
89 85 # KP 3
|
||||
108 76 # KP Enter
|
||||
37 54 # Ctrl Left
|
||||
115 58 # Logo Left (-> Option)
|
||||
64 55 # Alt Left (-> Command)
|
||||
65 49 # Space
|
||||
113 55 # Alt Right (-> Command)
|
||||
116 58 # Logo Right (-> Option)
|
||||
117 50 # Menu (-> International)
|
||||
109 54 # Ctrl Right
|
||||
100 59 # Cursor Left
|
||||
104 61 # Cursor Down
|
||||
102 60 # Cursor Right
|
||||
90 82 # KP 0
|
||||
91 65 # KP .
|
||||
|
||||
#
|
||||
# Linux Framebuffer Console
|
||||
#
|
||||
sdl fbcon
|
||||
1 53 # Esc
|
||||
59 122 # F1
|
||||
60 120 # F2
|
||||
61 99 # F3
|
||||
62 118 # F4
|
||||
63 96 # F5
|
||||
64 97 # F6
|
||||
65 98 # F7
|
||||
66 100 # F8
|
||||
67 101 # F9
|
||||
68 109 # F10
|
||||
87 103 # F11
|
||||
88 111 # F12
|
||||
99 105 # PrintScrn
|
||||
70 107 # Scroll Lock
|
||||
119 113 # Pause
|
||||
41 50 # `
|
||||
2 18 # 1
|
||||
3 19 # 2
|
||||
4 20 # 3
|
||||
5 21 # 4
|
||||
6 23 # 5
|
||||
7 22 # 6
|
||||
8 26 # 7
|
||||
9 28 # 8
|
||||
10 25 # 9
|
||||
11 29 # 0
|
||||
12 27 # -
|
||||
13 24 # =
|
||||
14 51 # Backspace
|
||||
110 114 # Insert
|
||||
102 115 # Home
|
||||
104 116 # Page Up
|
||||
69 71 # Num Lock
|
||||
98 75 # KP /
|
||||
55 67 # KP *
|
||||
74 78 # KP -
|
||||
15 48 # Tab
|
||||
16 12 # Q
|
||||
17 13 # W
|
||||
18 14 # E
|
||||
19 15 # R
|
||||
20 17 # T
|
||||
21 16 # Y
|
||||
22 32 # U
|
||||
23 34 # I
|
||||
24 31 # O
|
||||
25 35 # P
|
||||
26 33 # [
|
||||
27 30 # ]
|
||||
28 36 # Return
|
||||
111 117 # Delete
|
||||
107 119 # End
|
||||
109 121 # Page Down
|
||||
71 89 # KP 7
|
||||
72 91 # KP 8
|
||||
73 92 # KP 9
|
||||
78 69 # KP +
|
||||
58 57 # Caps Lock
|
||||
30 0 # A
|
||||
31 1 # S
|
||||
32 2 # D
|
||||
33 3 # F
|
||||
34 5 # G
|
||||
35 4 # H
|
||||
36 38 # J
|
||||
37 40 # K
|
||||
38 37 # L
|
||||
39 41 # ;
|
||||
40 39 # '
|
||||
75 86 # KP 4
|
||||
76 87 # KP 5
|
||||
77 88 # KP 6
|
||||
42 56 # Shift Left
|
||||
86 50 # International
|
||||
44 6 # Z
|
||||
45 7 # X
|
||||
46 8 # C
|
||||
47 9 # V
|
||||
48 11 # B
|
||||
49 45 # N
|
||||
50 46 # M
|
||||
51 43 # ,
|
||||
52 47 # .
|
||||
53 44 # /
|
||||
54 56 # Shift Right
|
||||
43 42 # \
|
||||
103 62 # Cursor Up
|
||||
79 83 # KP 1
|
||||
80 84 # KP 2
|
||||
81 85 # KP 3
|
||||
96 76 # KP Enter
|
||||
29 54 # Ctrl Left
|
||||
125 58 # Logo Left (-> Option)
|
||||
56 55 # Alt Left (-> Command)
|
||||
57 49 # Space
|
||||
100 55 # Alt Right (-> Command)
|
||||
126 58 # Logo Right (-> Option)
|
||||
97 54 # Ctrl Right
|
||||
105 59 # Cursor Left
|
||||
108 61 # Cursor Down
|
||||
106 60 # Cursor Right
|
||||
82 82 # KP 0
|
||||
83 65 # KP .
|
||||
|
||||
#
|
||||
# Quartz (1:1 translation actually)
|
||||
#
|
||||
sdl Quartz
|
||||
53 53 # Esc
|
||||
122 122 # F1
|
||||
120 120 # F2
|
||||
99 99 # F3
|
||||
118 118 # F4
|
||||
96 96 # F5
|
||||
97 97 # F6
|
||||
98 98 # F7
|
||||
100 100 # F8
|
||||
101 101 # F9
|
||||
109 109 # F10
|
||||
103 103 # F11
|
||||
111 111 # F12
|
||||
105 105 # F13/PrintScrn
|
||||
107 107 # F14/Scroll Lock
|
||||
113 113 # F15/Pause
|
||||
10 10 # `
|
||||
18 18 # 1
|
||||
19 19 # 2
|
||||
20 20 # 3
|
||||
21 21 # 4
|
||||
23 23 # 5
|
||||
22 22 # 6
|
||||
26 26 # 7
|
||||
28 28 # 8
|
||||
25 25 # 9
|
||||
29 29 # 0
|
||||
27 27 # -
|
||||
24 24 # =
|
||||
51 51 # Backspace
|
||||
114 114 # Help/Insert
|
||||
115 115 # Home
|
||||
116 116 # Page Up
|
||||
71 71 # Num Lock
|
||||
81 81 # KP =
|
||||
75 75 # KP /
|
||||
67 67 # KP *
|
||||
48 48 # Tab
|
||||
12 12 # Q
|
||||
13 13 # W
|
||||
14 14 # E
|
||||
15 15 # R
|
||||
17 17 # T
|
||||
16 16 # Y
|
||||
32 32 # U
|
||||
34 34 # I
|
||||
31 31 # O
|
||||
35 35 # P
|
||||
33 33 # [
|
||||
30 30 # ]
|
||||
36 36 # Return
|
||||
117 117 # Delete
|
||||
119 119 # End
|
||||
121 121 # Page Down
|
||||
89 89 # KP 7
|
||||
91 91 # KP 8
|
||||
92 92 # KP 9
|
||||
78 78 # KP -
|
||||
57 57 # Caps Lock
|
||||
0 0 # A
|
||||
1 1 # S
|
||||
2 2 # D
|
||||
3 3 # F
|
||||
5 5 # G
|
||||
4 4 # H
|
||||
38 38 # J
|
||||
40 40 # K
|
||||
37 37 # L
|
||||
41 41 # ;
|
||||
39 39 # '
|
||||
42 42 # \
|
||||
86 86 # KP 4
|
||||
87 87 # KP 5
|
||||
88 88 # KP 6
|
||||
69 69 # KP +
|
||||
56 56 # Shift
|
||||
50 50 # International
|
||||
6 6 # Z
|
||||
7 7 # X
|
||||
8 8 # C
|
||||
9 9 # V
|
||||
11 11 # B
|
||||
45 45 # N
|
||||
46 46 # M
|
||||
43 43 # ,
|
||||
47 47 # .
|
||||
44 44 # /
|
||||
126 62 # Cursor Up
|
||||
123 59 # Cursor Left
|
||||
125 61 # Cursor Down
|
||||
124 60 # Cursor Right
|
||||
83 83 # KP 1
|
||||
84 84 # KP 2
|
||||
85 85 # KP 3
|
||||
76 76 # KP Enter
|
||||
54 54 # Ctrl
|
||||
58 58 # Option
|
||||
55 55 # Command
|
||||
54 54 # Ctrl Left
|
||||
49 49 # Space
|
||||
82 82 # KP 0
|
||||
65 65 # KP .
|
||||
|
||||
#
|
||||
# cocoa (SDL2)
|
||||
#
|
||||
sdl cocoa
|
||||
41 53 # Esc
|
||||
58 122 # F1
|
||||
59 120 # F2
|
||||
60 99 # F3
|
||||
61 118 # F4
|
||||
62 96 # F5
|
||||
63 97 # F6
|
||||
64 98 # F7
|
||||
65 100 # F8
|
||||
66 101 # F9
|
||||
67 109 # F10
|
||||
68 103 # F11
|
||||
69 111 # F12
|
||||
70 105 # F13/PrintScrn
|
||||
71 107 # F14/Scroll Lock
|
||||
72 113 # F15/Pause
|
||||
53 10 # `
|
||||
30 18 # 1
|
||||
31 19 # 2
|
||||
32 20 # 3
|
||||
33 21 # 4
|
||||
34 23 # 5
|
||||
35 22 # 6
|
||||
36 26 # 7
|
||||
37 28 # 8
|
||||
38 25 # 9
|
||||
39 29 # 0
|
||||
45 27 # -
|
||||
46 24 # =
|
||||
42 51 # Backspace
|
||||
73 114 # Help/Insert
|
||||
74 115 # Home
|
||||
75 116 # Page Up
|
||||
83 71 # Num Lock
|
||||
103 81 # KP =
|
||||
84 75 # KP /
|
||||
85 67 # KP *
|
||||
43 48 # Tab
|
||||
20 12 # Q
|
||||
26 13 # W
|
||||
8 14 # E
|
||||
21 15 # R
|
||||
23 17 # T
|
||||
28 16 # Y
|
||||
24 32 # U
|
||||
12 34 # I
|
||||
18 31 # O
|
||||
19 35 # P
|
||||
47 33 # [
|
||||
48 30 # ]
|
||||
40 36 # Return
|
||||
76 117 # Delete
|
||||
77 119 # End
|
||||
78 121 # Page Down
|
||||
95 89 # KP 7
|
||||
96 91 # KP 8
|
||||
97 92 # KP 9
|
||||
86 78 # KP -
|
||||
57 57 # Caps Lock
|
||||
4 0 # A
|
||||
22 1 # S
|
||||
7 2 # D
|
||||
9 3 # F
|
||||
10 5 # G
|
||||
11 4 # H
|
||||
13 38 # J
|
||||
14 40 # K
|
||||
15 37 # L
|
||||
51 41 # ;
|
||||
52 39 # '
|
||||
49 42 # \
|
||||
92 86 # KP 4
|
||||
93 87 # KP 5
|
||||
94 88 # KP 6
|
||||
87 69 # KP +
|
||||
100 50 # International
|
||||
29 6 # Z
|
||||
27 7 # X
|
||||
6 8 # C
|
||||
25 9 # V
|
||||
5 11 # B
|
||||
17 45 # N
|
||||
16 46 # M
|
||||
54 43 # ,
|
||||
55 47 # .
|
||||
56 44 # /
|
||||
82 62 # Cursor Up
|
||||
80 59 # Cursor Left
|
||||
81 61 # Cursor Down
|
||||
79 60 # Cursor Right
|
||||
89 83 # KP 1
|
||||
90 84 # KP 2
|
||||
91 85 # KP 3
|
||||
88 76 # KP Enter
|
||||
225 56 # Shift Left
|
||||
224 54 # Ctrl Left
|
||||
226 58 # Option Left
|
||||
227 55 # Command Left
|
||||
44 49 # Space
|
||||
231 55 # Command Right
|
||||
230 58 # Option Right
|
||||
228 54 # Ctrl Right
|
||||
229 56 # Shift Right
|
||||
98 82 # KP 0
|
||||
99 65 # KP .
|
||||
|
||||
#
|
||||
# Windows (SDL2)
|
||||
#
|
||||
sdl windows
|
||||
41 53 # Esc
|
||||
58 122 # F1
|
||||
59 120 # F2
|
||||
60 99 # F3
|
||||
61 118 # F4
|
||||
62 96 # F5
|
||||
63 97 # F6
|
||||
64 98 # F7
|
||||
65 100 # F8
|
||||
66 101 # F9
|
||||
67 109 # F10
|
||||
68 103 # F11
|
||||
69 111 # F12
|
||||
70 105 # F13/PrintScrn
|
||||
71 107 # F14/Scroll Lock
|
||||
72 113 # F15/Pause
|
||||
53 50 # `
|
||||
30 18 # 1
|
||||
31 19 # 2
|
||||
32 20 # 3
|
||||
33 21 # 4
|
||||
34 23 # 5
|
||||
35 22 # 6
|
||||
36 26 # 7
|
||||
37 28 # 8
|
||||
38 25 # 9
|
||||
39 29 # 0
|
||||
45 27 # -
|
||||
46 24 # =
|
||||
42 51 # Backspace
|
||||
73 114 # Help/Insert
|
||||
74 115 # Home
|
||||
75 116 # Page Up
|
||||
83 71 # Num Lock
|
||||
103 81 # KP =
|
||||
84 75 # KP /
|
||||
85 67 # KP *
|
||||
43 48 # Tab
|
||||
20 12 # Q
|
||||
26 13 # W
|
||||
8 14 # E
|
||||
21 15 # R
|
||||
23 17 # T
|
||||
28 16 # Y
|
||||
24 32 # U
|
||||
12 34 # I
|
||||
18 31 # O
|
||||
19 35 # P
|
||||
47 33 # [
|
||||
48 30 # ]
|
||||
40 36 # Return
|
||||
76 117 # Delete
|
||||
77 119 # End
|
||||
78 121 # Page Down
|
||||
95 89 # KP 7
|
||||
96 91 # KP 8
|
||||
97 92 # KP 9
|
||||
86 78 # KP -
|
||||
57 57 # Caps Lock
|
||||
4 0 # A
|
||||
22 1 # S
|
||||
7 2 # D
|
||||
9 3 # F
|
||||
10 5 # G
|
||||
11 4 # H
|
||||
13 38 # J
|
||||
14 40 # K
|
||||
15 37 # L
|
||||
51 41 # ;
|
||||
52 39 # '
|
||||
49 42 # \
|
||||
92 86 # KP 4
|
||||
93 87 # KP 5
|
||||
94 88 # KP 6
|
||||
87 69 # KP +
|
||||
100 50 # International
|
||||
29 6 # Z
|
||||
27 7 # X
|
||||
6 8 # C
|
||||
25 9 # V
|
||||
5 11 # B
|
||||
17 45 # N
|
||||
16 46 # M
|
||||
54 43 # ,
|
||||
55 47 # .
|
||||
56 44 # /
|
||||
82 62 # Cursor Up
|
||||
80 59 # Cursor Left
|
||||
81 61 # Cursor Down
|
||||
79 60 # Cursor Right
|
||||
89 83 # KP 1
|
||||
90 84 # KP 2
|
||||
91 85 # KP 3
|
||||
88 76 # KP Enter
|
||||
225 56 # Shift Left
|
||||
224 58 # Ctrl Left (--> Option)
|
||||
# 227 # Logo Left
|
||||
226 55 # Alt Left (--> Command)
|
||||
44 49 # Space
|
||||
230 58 # Alt Right (--> Option)
|
||||
# 231 # Logo Right
|
||||
101 50 # Menu (--> International)
|
||||
228 54 # Ctrl Right
|
||||
229 56 # Shift Right
|
||||
98 82 # KP 0
|
||||
99 65 # KP .
|
||||
|
||||
#
|
||||
# Windows
|
||||
#
|
||||
sdl windib
|
||||
sdl directx
|
||||
1 53 # Esc
|
||||
59 122 # F1
|
||||
60 120 # F2
|
||||
61 99 # F3
|
||||
62 118 # F4
|
||||
63 96 # F5
|
||||
64 97 # F6
|
||||
65 98 # F7
|
||||
66 100 # F8
|
||||
67 101 # F9
|
||||
68 109 # F10
|
||||
87 103 # F11
|
||||
88 111 # F12
|
||||
183 105 # PrintScrn
|
||||
70 107 # Scroll Lock
|
||||
197 113 # Pause
|
||||
41 50 # `
|
||||
2 18 # 1
|
||||
3 19 # 2
|
||||
4 20 # 3
|
||||
5 21 # 4
|
||||
6 23 # 5
|
||||
7 22 # 6
|
||||
8 26 # 7
|
||||
9 28 # 8
|
||||
10 25 # 9
|
||||
11 29 # 0
|
||||
12 27 # -
|
||||
13 24 # =
|
||||
14 51 # Backspace
|
||||
210 114 # Insert
|
||||
199 115 # Home
|
||||
201 116 # Page Up
|
||||
69 71 # Num Lock
|
||||
181 75 # KP /
|
||||
55 67 # KP *
|
||||
74 78 # KP -
|
||||
15 48 # Tab
|
||||
16 12 # Q
|
||||
17 13 # W
|
||||
18 14 # E
|
||||
19 15 # R
|
||||
20 17 # T
|
||||
21 16 # Y
|
||||
22 32 # U
|
||||
23 34 # I
|
||||
24 31 # O
|
||||
25 35 # P
|
||||
26 33 # [
|
||||
27 30 # ]
|
||||
28 36 # Return
|
||||
211 117 # Delete
|
||||
207 119 # End
|
||||
209 121 # Page Down
|
||||
71 89 # KP 7
|
||||
72 91 # KP 8
|
||||
73 92 # KP 9
|
||||
78 69 # KP +
|
||||
58 57 # Caps Lock
|
||||
30 0 # A
|
||||
31 1 # S
|
||||
32 2 # D
|
||||
33 3 # F
|
||||
34 5 # G
|
||||
35 4 # H
|
||||
36 38 # J
|
||||
37 40 # K
|
||||
38 37 # L
|
||||
39 41 # ;
|
||||
40 39 # '
|
||||
75 86 # KP 4
|
||||
76 87 # KP 5
|
||||
77 88 # KP 6
|
||||
42 56 # Shift Left
|
||||
86 50 # International
|
||||
44 6 # Z
|
||||
45 7 # X
|
||||
46 8 # C
|
||||
47 9 # V
|
||||
48 11 # B
|
||||
49 45 # N
|
||||
50 46 # M
|
||||
51 43 # ,
|
||||
52 47 # .
|
||||
53 44 # /
|
||||
54 56 # Shift Right
|
||||
43 42 # \
|
||||
200 62 # Cursor Up
|
||||
79 83 # KP 1
|
||||
80 84 # KP 2
|
||||
81 85 # KP 3
|
||||
156 76 # KP Enter
|
||||
29 54 # Ctrl Left
|
||||
219 58 # Logo Left (-> Option)
|
||||
56 55 # Alt Left (-> Command)
|
||||
57 49 # Space
|
||||
184 55 # Alt Right (-> Command)
|
||||
220 58 # Logo Right (-> Option)
|
||||
221 50 # Menu (-> International)
|
||||
157 54 # Ctrl Right
|
||||
203 59 # Cursor Left
|
||||
208 61 # Cursor Down
|
||||
205 60 # Cursor Right
|
||||
82 82 # KP 0
|
||||
83 65 # KP .
|
||||
|
||||
#
|
||||
# XFree86
|
||||
#
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#ifdef USE_SDL
|
||||
# include <SDL.h>
|
||||
# include <SDL_main.h>
|
||||
#if !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
#define __MACOS__ __MACOSX__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef USE_SDL_VIDEO
|
||||
|
@ -43,6 +46,10 @@
|
|||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if __MACOS__
|
||||
# include "utils_macosx.h"
|
||||
#endif
|
||||
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
# include <m68k/sync_icache.h>
|
||||
# include <m68k/frame.h>
|
||||
|
@ -60,9 +67,6 @@ struct sigstate {
|
|||
#ifdef ENABLE_GTK
|
||||
# include <gtk/gtk.h>
|
||||
# include <gdk/gdk.h>
|
||||
# ifdef HAVE_GNOMEUI
|
||||
# include <gnome.h>
|
||||
# endif
|
||||
# if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
|
||||
# include <X11/Xlib.h>
|
||||
# endif
|
||||
|
@ -94,8 +98,13 @@ using std::string;
|
|||
#include "rpc.h"
|
||||
|
||||
#if USE_JIT
|
||||
#ifdef UPDATE_UAE
|
||||
extern void (*flush_icache)(void); // from compemu_support.cpp
|
||||
extern bool UseJIT;
|
||||
#else
|
||||
extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_support.cpp
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MON
|
||||
# include "mon.h"
|
||||
|
@ -211,6 +220,8 @@ static void sigill_handler(int sig, int code, struct sigcontext *scp);
|
|||
extern "C" void EmulOpTrampoline(void);
|
||||
#endif
|
||||
|
||||
// vde switch variable
|
||||
char* vde_sock;
|
||||
|
||||
/*
|
||||
* Ersatz functions
|
||||
|
@ -240,11 +251,12 @@ void *vm_acquire_mac(size_t size)
|
|||
return vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
|
||||
}
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
static int vm_acquire_mac_fixed(void *addr, size_t size)
|
||||
{
|
||||
return vm_acquire_fixed(addr, size, VM_MAP_DEFAULT | VM_MAP_32BIT);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SIGSEGV handler
|
||||
|
@ -287,9 +299,14 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
|
|||
fprintf(stderr, "\n");
|
||||
#if EMULATED_68K
|
||||
uaecptr nextpc;
|
||||
#ifdef UPDATE_UAE
|
||||
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
|
||||
m68k_dumpstate(stderr, &nextpc);
|
||||
#else
|
||||
extern void m68k_dumpstate(uaecptr *nextpc);
|
||||
m68k_dumpstate(&nextpc);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_JIT && JIT_DEBUG
|
||||
extern void compiler_dumpstate(void);
|
||||
compiler_dumpstate();
|
||||
|
@ -362,6 +379,16 @@ void cpu_do_check_ticks(void)
|
|||
if (emulated_ticks <= 0)
|
||||
emulated_ticks += emulated_ticks_quantum;
|
||||
}
|
||||
#else
|
||||
uint16 emulated_ticks;
|
||||
void cpu_do_check_ticks(void)
|
||||
{
|
||||
static int delay = -1;
|
||||
if (delay < 0)
|
||||
delay = PrefsFindInt32("delay");
|
||||
if (delay)
|
||||
usleep(delay);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -378,10 +405,12 @@ static void usage(const char *prg_name)
|
|||
" --display STRING\n X display to use\n"
|
||||
" --break ADDRESS\n set ROM breakpoint in hexadecimal\n"
|
||||
" --loadbreak FILE\n load breakpoint from FILE\n"
|
||||
" --rominfo\n dump ROM information\n", prg_name
|
||||
" --rominfo\n dump ROM information\n"
|
||||
" --switch SWITCH_PATH\n vde_switch address\n", prg_name
|
||||
);
|
||||
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
PrefsPrintUsage();
|
||||
printf("\nBuild Date: %s\n", __DATE__);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -443,19 +472,27 @@ int main(int argc, char **argv)
|
|||
} else if (strcmp(argv[i], "--rominfo") == 0) {
|
||||
argv[i] = NULL;
|
||||
PrintROMInfo = true;
|
||||
} else if (strcmp(argv[i], "--switch") == 0) {
|
||||
argv[i] = NULL;
|
||||
if (argv[++i] == NULL) {
|
||||
printf("switch address not defined\n");
|
||||
usage(argv[0]);
|
||||
}
|
||||
vde_sock = argv[i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
// Mac OS X likes to pass in various options of its own, when launching an app.
|
||||
// Attempt to ignore these.
|
||||
if (argv[i]) {
|
||||
const char * mac_psn_prefix = "-psn_";
|
||||
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
|
||||
argv[i] = NULL;
|
||||
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
|
||||
argv[i] = NULL;
|
||||
}
|
||||
}
|
||||
if (argv[i]) {
|
||||
const char * mac_psn_prefix = "-psn_";
|
||||
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
|
||||
argv[i] = NULL;
|
||||
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
|
||||
argv[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -483,16 +520,9 @@ int main(int argc, char **argv)
|
|||
|
||||
#ifdef ENABLE_GTK
|
||||
if (!gui_connection) {
|
||||
#ifdef HAVE_GNOMEUI
|
||||
// Init GNOME/GTK
|
||||
char version[16];
|
||||
sprintf(version, "%d.%d", VERSION_MAJOR, VERSION_MINOR);
|
||||
gnome_init("Basilisk II", version, argc, argv);
|
||||
#else
|
||||
// Init GTK
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -541,14 +571,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
atexit(SDL_Quit);
|
||||
|
||||
#if __MACOSX__ && SDL_VERSION_ATLEAST(2,0,0)
|
||||
#if __MACOS__ && SDL_VERSION_ATLEAST(2,0,0)
|
||||
// On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK,
|
||||
// except that it will also install keyboard shortcuts, such as Command + Q,
|
||||
// which can interfere with keyboard shortcuts in the guest OS.
|
||||
//
|
||||
// HACK: disable these shortcuts, while leaving all other pieces of SDL2's
|
||||
// menu bar in-place.
|
||||
extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
|
||||
disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
|
||||
#endif
|
||||
|
||||
|
@ -665,10 +694,8 @@ int main(int argc, char **argv)
|
|||
RAMBaseMac = Host2MacAddr(RAMBaseHost);
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
#if __MACOSX__
|
||||
|
||||
#if __MACOS__
|
||||
extern void set_current_directory();
|
||||
set_current_directory();
|
||||
#endif
|
||||
|
@ -730,6 +757,9 @@ int main(int argc, char **argv)
|
|||
QuitEmulator();
|
||||
D(bug("Initialization complete\n"));
|
||||
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
#if !EMULATED_68K
|
||||
// (Virtual) supervisor mode, disable interrupts
|
||||
EmulatedSR = 0x2700;
|
||||
|
@ -978,8 +1008,12 @@ void FlushCodeCache(void *start, uint32 size)
|
|||
{
|
||||
#if USE_JIT
|
||||
if (UseJIT)
|
||||
#ifdef UPDATE_UAE
|
||||
flush_icache();
|
||||
#else
|
||||
flush_icache_range((uint8 *)start, size);
|
||||
#endif
|
||||
#endif
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
m68k_sync_icache(start, size);
|
||||
#endif
|
||||
|
@ -995,8 +1029,13 @@ static void sigint_handler(...)
|
|||
{
|
||||
#if EMULATED_68K
|
||||
uaecptr nextpc;
|
||||
#ifdef UPDATE_UAE
|
||||
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
|
||||
m68k_dumpstate(stderr, &nextpc);
|
||||
#else
|
||||
extern void m68k_dumpstate(uaecptr *nextpc);
|
||||
m68k_dumpstate(&nextpc);
|
||||
#endif
|
||||
#endif
|
||||
VideoQuitFullScreen();
|
||||
const char *arg[4] = {"mon", "-m", "-r", NULL};
|
||||
|
@ -1229,13 +1268,15 @@ static void one_tick(...)
|
|||
}
|
||||
|
||||
#ifdef USE_PTHREADS_SERVICES
|
||||
bool tick_inhibit;
|
||||
static void *tick_func(void *arg)
|
||||
{
|
||||
uint64 start = GetTicks_usec();
|
||||
int64 ticks = 0;
|
||||
uint64 next = GetTicks_usec();
|
||||
uint64 next = start;
|
||||
while (!tick_thread_cancel) {
|
||||
one_tick();
|
||||
if (!tick_inhibit)
|
||||
one_tick();
|
||||
next += 16625;
|
||||
int64 delay = next - GetTicks_usec();
|
||||
if (delay > 0)
|
||||
|
@ -1244,8 +1285,10 @@ static void *tick_func(void *arg)
|
|||
next = GetTicks_usec();
|
||||
ticks++;
|
||||
}
|
||||
#if DEBUG
|
||||
uint64 end = GetTicks_usec();
|
||||
D(bug("%lld ticks in %lld usec = %f ticks/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* prefs_unix.cpp - Preferences handling, Unix specific stuff
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
* Basilisk II, SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,24 +19,27 @@
|
|||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
using std::string;
|
||||
|
||||
#include "prefs.h"
|
||||
|
||||
|
||||
// Platform-specific preferences items
|
||||
prefs_desc platform_prefs_items[] = {
|
||||
#ifdef SHEEPSHAVER
|
||||
{"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"},
|
||||
{"etherconfig", TYPE_STRING, false, "path of network config script"},
|
||||
{"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"},
|
||||
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"},
|
||||
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"},
|
||||
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
|
||||
#else
|
||||
{"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"},
|
||||
#endif
|
||||
{"dsp", TYPE_STRING, false, "audio output (dsp) device name"},
|
||||
{"mixer", TYPE_STRING, false, "audio mixer device name"},
|
||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||
#endif
|
||||
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
||||
#ifdef USE_SDL_VIDEO
|
||||
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
|
||||
|
@ -45,8 +48,222 @@ prefs_desc platform_prefs_items[] = {
|
|||
};
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
|
||||
// Standard file names and paths
|
||||
#ifdef SHEEPSHAVER
|
||||
static const char PREFS_FILE_NAME[] = "/.sheepshaver_prefs";
|
||||
static const char XDG_PREFS_FILE_NAME[] = "/prefs";
|
||||
static const char XPRAM_FILE_NAME[] = "/.sheepshaver_nvram";
|
||||
static const char XDG_XPRAM_FILE_NAME[] = "/nvram";
|
||||
static const char XDG_CONFIG_SUBDIR[] = "/SheepShaver";
|
||||
#else
|
||||
static const char PREFS_FILE_NAME[] = "/.basilisk_ii_prefs";
|
||||
static const char XDG_PREFS_FILE_NAME[] = "/prefs";
|
||||
static const char XPRAM_FILE_NAME[] = "/.basilisk_ii_xpram";
|
||||
static const char XDG_XPRAM_FILE_NAME[] = "/xpram";
|
||||
static const char XDG_CONFIG_SUBDIR[] = "/BasiliskII";
|
||||
#endif
|
||||
|
||||
// Prefs file name and path
|
||||
const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs";
|
||||
string UserPrefsPath;
|
||||
static string home_dir;
|
||||
static string xdg_config_dir;
|
||||
static string prefs_name;
|
||||
extern string xpram_name;
|
||||
|
||||
static string get_xdg_config_dir(void)
|
||||
{
|
||||
char *env;
|
||||
if (env = getenv("XDG_CONFIG_HOME"))
|
||||
return string(env) + XDG_CONFIG_SUBDIR;
|
||||
if (env = getenv("HOME"))
|
||||
return string(env) + "/.config" + XDG_CONFIG_SUBDIR;
|
||||
return "";
|
||||
}
|
||||
|
||||
static string get_home_dir(void)
|
||||
{
|
||||
char *env;
|
||||
if(env = getenv("HOME"))
|
||||
return string(env);
|
||||
return "."; // last resort, use the current directory
|
||||
}
|
||||
|
||||
static string get_dir(string *path)
|
||||
{
|
||||
int pos = path->find_last_of('/');
|
||||
if (pos == 0)
|
||||
return ""; // file is in root folder
|
||||
if (pos == std::string::npos)
|
||||
return "."; // file is in current folder
|
||||
return path->substr(0, pos);
|
||||
}
|
||||
|
||||
static void exit_if_dir(const string& path)
|
||||
{
|
||||
struct stat info;
|
||||
if (stat(path.c_str(), &info) != 0){
|
||||
return;
|
||||
}
|
||||
if ((info.st_mode & S_IFDIR) != 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Cannot open %s (Is a directory)\n", prefs_name.c_str());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static bool load_prefs_file(const string& path, bool exit_on_failure)
|
||||
{
|
||||
exit_if_dir(path);
|
||||
FILE *prefs = fopen(path.c_str(), "r");
|
||||
if (prefs != NULL)
|
||||
{
|
||||
LoadPrefsFromStream(prefs);
|
||||
fclose(prefs);
|
||||
printf("Using prefs file at %s\n", prefs_name.c_str());
|
||||
return true;
|
||||
}
|
||||
else if (exit_on_failure)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Could not load prefs file from %s (%s)\n",
|
||||
path.c_str(), strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for prefs file in the following locations (in order of priority):
|
||||
* 1. From vmdir/.basilisk_ii_prefs if a vmdir has been specified
|
||||
* 2. From path specified with --config command line
|
||||
* 3. From $HOME/.basilisk_ii_prefs if it exists
|
||||
* 4. From $XDG_CONFIG_HOME/BasiliskII/prefs if it exists
|
||||
* 5. Create a new prefs file at $XDG_CONFIG_HOME/BasiliskII/prefs
|
||||
* (or the equivalent paths for SheepShaver)
|
||||
* If $XDG_CONFIG_HOME doesn't exist, $HOME/.config is used instead,
|
||||
* in accordance with XDG Base Directory Specification:
|
||||
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
*/
|
||||
|
||||
void LoadPrefs(const char* vmdir)
|
||||
{
|
||||
home_dir = get_home_dir();
|
||||
xdg_config_dir = get_xdg_config_dir();
|
||||
|
||||
// vmdir was specified on the command line
|
||||
if (vmdir)
|
||||
{
|
||||
prefs_name = string(vmdir) + XDG_PREFS_FILE_NAME;
|
||||
xpram_name = string(vmdir) + XDG_XPRAM_FILE_NAME;
|
||||
if (load_prefs_file(prefs_name, true))
|
||||
return;
|
||||
}
|
||||
|
||||
// --config was specified
|
||||
if (!UserPrefsPath.empty())
|
||||
{
|
||||
prefs_name = UserPrefsPath;
|
||||
xpram_name = get_dir(&prefs_name) + XPRAM_FILE_NAME;
|
||||
if (load_prefs_file(prefs_name, true))
|
||||
return;
|
||||
}
|
||||
|
||||
// Load .basilisk_ii_prefs from $HOME if it exists
|
||||
if (!home_dir.empty())
|
||||
{
|
||||
prefs_name = home_dir + PREFS_FILE_NAME;
|
||||
xpram_name = home_dir + XPRAM_FILE_NAME;
|
||||
if (load_prefs_file(prefs_name, false))
|
||||
return;
|
||||
}
|
||||
|
||||
// If no other prefs file exists, try the $XDG_CONFIG_HOME directory
|
||||
if (!xdg_config_dir.empty())
|
||||
{
|
||||
prefs_name = xdg_config_dir + XDG_PREFS_FILE_NAME;
|
||||
xpram_name = xdg_config_dir + XDG_XPRAM_FILE_NAME;
|
||||
if (load_prefs_file(prefs_name, false))
|
||||
return;
|
||||
}
|
||||
|
||||
// No prefs file, save defaults in $XDG_CONFIG_HOME directory
|
||||
//#ifdef __linux__
|
||||
PrefsAddString("cdrom", "/dev/cdrom");
|
||||
//#endif
|
||||
printf("No prefs file found, creating new one at %s\n", prefs_name.c_str());
|
||||
SavePrefs();
|
||||
}
|
||||
|
||||
static bool is_dir(const string& path)
|
||||
{
|
||||
struct stat info;
|
||||
if (stat(path.c_str(), &info) != 0){
|
||||
return false;
|
||||
}
|
||||
return (info.st_mode & S_IFDIR) != 0;
|
||||
}
|
||||
|
||||
static bool create_directories(const string& path, mode_t mode)
|
||||
{
|
||||
if (mkdir(path.c_str(), mode) == 0)
|
||||
return true;
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
case ENOENT:
|
||||
{
|
||||
int pos = path.find_last_of('/');
|
||||
if (pos == std::string::npos)
|
||||
return false;
|
||||
if (!create_directories(path.substr(0,pos),mode))
|
||||
return false;
|
||||
}
|
||||
return 0 == mkdir(path.c_str(),mode);
|
||||
|
||||
case EEXIST:
|
||||
return is_dir(path);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save preferences to settings file
|
||||
*/
|
||||
|
||||
|
||||
void SavePrefs(void)
|
||||
{
|
||||
FILE *f;
|
||||
string prefs_dir = get_dir(&prefs_name);
|
||||
if (!prefs_dir.empty() && !is_dir(prefs_dir))
|
||||
{
|
||||
create_directories(prefs_dir, 0700);
|
||||
}
|
||||
if ((f = fopen(prefs_name.c_str(), "w")) != NULL)
|
||||
{
|
||||
SavePrefsToStream(f);
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "WARNING: Unable to save %s (%s)\n",
|
||||
prefs_name.c_str(), strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else // __linux__
|
||||
|
||||
|
||||
// Prefs file name and path
|
||||
#ifdef SHEEPSHAVER
|
||||
static const char PREFS_FILE_NAME[] = ".sheepshaver_prefs";
|
||||
#else
|
||||
static const char PREFS_FILE_NAME[] = ".basilisk_ii_prefs";
|
||||
#endif
|
||||
string UserPrefsPath;
|
||||
static string prefs_path;
|
||||
|
||||
|
@ -87,7 +304,9 @@ void LoadPrefs(const char *vmdir)
|
|||
fclose(f);
|
||||
|
||||
} else {
|
||||
|
||||
//#ifdef __linux__
|
||||
// PrefsAddString("cdrom", "/dev/cdrom");
|
||||
//#endif
|
||||
// No prefs file, save defaults
|
||||
SavePrefs();
|
||||
}
|
||||
|
@ -108,6 +327,9 @@ void SavePrefs(void)
|
|||
}
|
||||
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
|
||||
/*
|
||||
* Add defaults of platform-specific prefs items
|
||||
* You may also override the defaults set in PrefsInit()
|
||||
|
@ -120,22 +342,28 @@ void AddPlatformPrefsDefaults(void)
|
|||
PrefsReplaceInt32("mousewheelmode", 1);
|
||||
PrefsReplaceInt32("mousewheellines", 3);
|
||||
#ifdef __linux__
|
||||
if (access("/dev/sound/dsp", F_OK) == 0) {
|
||||
if (access("/dev/sound/dsp", F_OK) == 0)
|
||||
{
|
||||
PrefsReplaceString("dsp", "/dev/sound/dsp");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
PrefsReplaceString("dsp", "/dev/dsp");
|
||||
}
|
||||
if (access("/dev/sound/mixer", F_OK) == 0) {
|
||||
if (access("/dev/sound/mixer", F_OK) == 0)
|
||||
{
|
||||
PrefsReplaceString("mixer", "/dev/sound/mixer");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
PrefsReplaceString("mixer", "/dev/mixer");
|
||||
}
|
||||
#elif defined (__NetBSD__)
|
||||
PrefsReplaceString("dsp", "/dev/audio");
|
||||
PrefsReplaceString("mixer", "/dev/mixer");
|
||||
#else
|
||||
PrefsReplaceString("dsp", "/dev/dsp");
|
||||
PrefsReplaceString("mixer", "/dev/mixer");
|
||||
#endif
|
||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||
PrefsAddBool("ignoresegv", false);
|
||||
#endif
|
||||
PrefsAddBool("idlewait", true);
|
||||
}
|
||||
|
|
|
@ -21,12 +21,18 @@
|
|||
#include "sysdeps.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef HAVE_SYS_FILIO_H
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <termios.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/lp.h>
|
||||
#include <linux/major.h>
|
||||
|
@ -648,16 +654,16 @@ bool XSERDPort::configure(uint16 config)
|
|||
// Set number of data bits
|
||||
switch (config & 0x0c00) {
|
||||
case data5:
|
||||
mode.c_cflag = mode.c_cflag & ~CSIZE | CS5;
|
||||
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS5;
|
||||
break;
|
||||
case data6:
|
||||
mode.c_cflag = mode.c_cflag & ~CSIZE | CS6;
|
||||
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS6;
|
||||
break;
|
||||
case data7:
|
||||
mode.c_cflag = mode.c_cflag & ~CSIZE | CS7;
|
||||
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS7;
|
||||
break;
|
||||
case data8:
|
||||
mode.c_cflag = mode.c_cflag & ~CSIZE | CS8;
|
||||
mode.c_cflag = (mode.c_cflag & ~CSIZE) | CS8;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h> /* For O_NONBLOCK */
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
|
@ -45,10 +50,6 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
|
|||
# include <sys/bsdtty.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h> /* For S_* constants and macros */
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_TTY
|
||||
# define _PATH_TTY "/dev/tty"
|
||||
#endif
|
||||
|
@ -73,7 +74,12 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
|
|||
#define fatal(x) do { printf("Fatal error: %s", x); return 0; } while(0)
|
||||
#endif /* not in BasiliskII */
|
||||
|
||||
#ifdef __sun__
|
||||
#define mysig_t void*
|
||||
#else
|
||||
#define mysig_t sig_t
|
||||
#endif
|
||||
|
||||
#define mysignal signal
|
||||
#include <signal.h>
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "disk_unix.h"
|
||||
|
||||
#if defined(BINCUE)
|
||||
#include "bincue_unix.h"
|
||||
#include "bincue.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -369,6 +369,9 @@ void SysAddCDROMPrefs(void)
|
|||
closedir(cd_dir);
|
||||
}
|
||||
}
|
||||
#elif defined __FreeBSD__
|
||||
if (access("/cdrom", F_OK) == 0)
|
||||
PrefsAddString("cdrom", "/cdrom");
|
||||
#elif defined __MACOSX__
|
||||
// There is no predefined path for CD-ROMs on MacOS X. Rather, we
|
||||
// define a single fake CD-ROM entry for the emulated MacOS.
|
||||
|
@ -396,8 +399,8 @@ void SysAddSerialPrefs(void)
|
|||
PrefsAddString("serialb", "/dev/tts/1");
|
||||
}
|
||||
#elif defined(__FreeBSD__)
|
||||
PrefsAddString("seriala", "/dev/cuaa0");
|
||||
PrefsAddString("serialb", "/dev/cuaa1");
|
||||
PrefsAddString("seriala", "/dev/cuau0");
|
||||
PrefsAddString("serialb", "/dev/cuau1");
|
||||
#elif defined(__NetBSD__)
|
||||
PrefsAddString("seriala", "/dev/tty00");
|
||||
PrefsAddString("serialb", "/dev/tty01");
|
||||
|
@ -537,14 +540,14 @@ static mac_file_handle *open_filehandle(const char *name)
|
|||
return fh;
|
||||
}
|
||||
|
||||
void *Sys_open(const char *name, bool read_only)
|
||||
void *Sys_open(const char *name, bool read_only, bool is_cdrom)
|
||||
{
|
||||
bool is_file = strncmp(name, "/dev/", 5) != 0;
|
||||
#if defined(__FreeBSD__)
|
||||
// SCSI IDE
|
||||
bool is_cdrom = strncmp(name, "/dev/cd", 7) == 0 || strncmp(name, "/dev/acd", 8) == 0;
|
||||
is_cdrom |= strncmp(name, "/dev/cd", 7) == 0 || strncmp(name, "/dev/acd", 8) == 0;
|
||||
#else
|
||||
bool is_cdrom = strncmp(name, "/dev/cd", 7) == 0;
|
||||
is_cdrom |= strncmp(name, "/dev/cd", 7) == 0;
|
||||
#endif
|
||||
bool is_floppy = strncmp(name, "/dev/fd", 7) == 0;
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include <config.h>
|
||||
#include "user_strings_unix.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
#error "You don't have ANSI C header files."
|
||||
#endif
|
||||
//#ifndef STDC_HEADERS
|
||||
//#error "You don't have ANSI C header files."
|
||||
//#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <sys/types.h>
|
||||
|
@ -42,6 +42,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_PTHREADS
|
||||
# include <pthread.h>
|
||||
|
@ -51,6 +52,10 @@
|
|||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h> /* For S_* constants and macros */
|
||||
#endif
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
|
@ -117,11 +122,6 @@
|
|||
#ifdef HAVE_PTHREADS
|
||||
#define USE_PTHREADS_SERVICES
|
||||
#endif
|
||||
#if EMULATED_68K
|
||||
#if defined(__NetBSD__)
|
||||
#define USE_CPU_EMUL_SERVICES
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_CPU_EMUL_SERVICES
|
||||
#undef USE_PTHREADS_SERVICES
|
||||
#endif
|
||||
|
@ -184,96 +184,6 @@ typedef off_t loff_t;
|
|||
typedef char * caddr_t;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Helper functions to byteswap data
|
||||
**/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
// Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h>
|
||||
#define opt_bswap_32 do_opt_bswap_32
|
||||
static inline uint32 do_opt_bswap_32(uint32 x)
|
||||
{
|
||||
uint32 v;
|
||||
__asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x));
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
|
||||
#ifdef opt_bswap_16
|
||||
#undef bswap_16
|
||||
#define bswap_16 opt_bswap_16
|
||||
#endif
|
||||
#ifndef bswap_16
|
||||
#define bswap_16 generic_bswap_16
|
||||
#endif
|
||||
|
||||
static inline uint16 generic_bswap_16(uint16 x)
|
||||
{
|
||||
return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
|
||||
}
|
||||
|
||||
#ifdef opt_bswap_32
|
||||
#undef bswap_32
|
||||
#define bswap_32 opt_bswap_32
|
||||
#endif
|
||||
#ifndef bswap_32
|
||||
#define bswap_32 generic_bswap_32
|
||||
#endif
|
||||
|
||||
static inline uint32 generic_bswap_32(uint32 x)
|
||||
{
|
||||
return (((x & 0xff000000) >> 24) |
|
||||
((x & 0x00ff0000) >> 8) |
|
||||
((x & 0x0000ff00) << 8) |
|
||||
((x & 0x000000ff) << 24) );
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
#define opt_bswap_64 do_opt_bswap_64
|
||||
static inline uint64 do_opt_bswap_64(uint64 x)
|
||||
{
|
||||
return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef opt_bswap_64
|
||||
#undef bswap_64
|
||||
#define bswap_64 opt_bswap_64
|
||||
#endif
|
||||
#ifndef bswap_64
|
||||
#define bswap_64 generic_bswap_64
|
||||
#endif
|
||||
|
||||
static inline uint64 generic_bswap_64(uint64 x)
|
||||
{
|
||||
return (((x & UVAL64(0xff00000000000000)) >> 56) |
|
||||
((x & UVAL64(0x00ff000000000000)) >> 40) |
|
||||
((x & UVAL64(0x0000ff0000000000)) >> 24) |
|
||||
((x & UVAL64(0x000000ff00000000)) >> 8) |
|
||||
((x & UVAL64(0x00000000ff000000)) << 8) |
|
||||
((x & UVAL64(0x0000000000ff0000)) << 24) |
|
||||
((x & UVAL64(0x000000000000ff00)) << 40) |
|
||||
((x & UVAL64(0x00000000000000ff)) << 56) );
|
||||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
static inline uint16 tswap16(uint16 x) { return x; }
|
||||
static inline uint32 tswap32(uint32 x) { return x; }
|
||||
static inline uint64 tswap64(uint64 x) { return x; }
|
||||
#else
|
||||
static inline uint16 tswap16(uint16 x) { return bswap_16(x); }
|
||||
static inline uint32 tswap32(uint32 x) { return bswap_32(x); }
|
||||
static inline uint64 tswap64(uint64 x) { return bswap_64(x); }
|
||||
#endif
|
||||
|
||||
|
||||
/* Time data type for Time Manager emulation */
|
||||
#if defined(__MACH__)
|
||||
typedef mach_timespec_t tm_time_t;
|
||||
|
@ -580,4 +490,21 @@ static inline uae_u32 do_byteswap_16(uae_u32 v)
|
|||
#endif
|
||||
#define REGPARAM2
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(x) ((void)x)
|
||||
#endif
|
||||
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#define ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
#define memptr uint32
|
||||
|
||||
// High-precision timing
|
||||
#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP)
|
||||
#define PRECISE_TIMING 1
|
||||
#define PRECISE_TIMING_POSIX 1
|
||||
#elif defined(HAVE_PTHREADS) && defined(__MACH__)
|
||||
#define PRECISE_TIMING 1
|
||||
#define PRECISE_TIMING_MACH 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,7 @@ user_string_def platform_strings[] = {
|
|||
|
||||
{STR_PREFS_MENU_FILE_GTK, "/_File"},
|
||||
{STR_PREFS_ITEM_START_GTK, "/File/_Start Basilisk II"},
|
||||
{STR_PREFS_ITEM_SAVE_GTK, "/File/Save _Preferences"},
|
||||
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
|
||||
{STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
|
||||
{STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit Basilisk II"},
|
||||
|
@ -73,7 +74,8 @@ user_string_def platform_strings[] = {
|
|||
{STR_DSPDEVICE_FILE_CTRL, "Audio Output Device"},
|
||||
{STR_MIXERDEVICE_FILE_CTRL, "Audio Mixer Device"},
|
||||
|
||||
{STR_BROWSE_TITLE, "Browse file"},
|
||||
{STR_BROWSE_TITLE, "Select File"},
|
||||
{STR_BROWSE_FOLDER_TITLE, "Select Folder"},
|
||||
{STR_BROWSE_CTRL, "Browse..."},
|
||||
{STR_INPUT_PANE_TITLE, "Keyboard/Mouse"},
|
||||
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
||||
|
@ -87,6 +89,22 @@ user_string_def platform_strings[] = {
|
|||
|
||||
{STR_NO_B2_EXE_FOUND, "Could not start %s (%s)."},
|
||||
|
||||
{STR_ABOUT_COPYRIGHT, "© 1997-2008 Christian Bauer et al."},
|
||||
{STR_ABOUT_LICENSE, "This program is free software; you can redistribute it and/or modify \
|
||||
it under the terms of the GNU General Public License as published by \
|
||||
the Free Software Foundation; either version 2 of the License, or \
|
||||
(at your option) any later version.\n\n\
|
||||
This program is distributed in the hope that it will be useful, \
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of \
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
|
||||
GNU General Public License for more details.\n\n\
|
||||
You should have received a copy of the GNU General Public License \
|
||||
along with this program; if not, write to the Free Software \
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"},
|
||||
{STR_ABOUT_COMMENTS, "Open source 68k Mac emulator"},
|
||||
{STR_ABOUT_WEBSITE, "http://basilisk.cebix.net"},
|
||||
{STR_ABOUT_WEBSITE_LABEL, "Website"},
|
||||
|
||||
{-1, NULL} // End marker
|
||||
};
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ enum {
|
|||
|
||||
STR_PREFS_MENU_FILE_GTK,
|
||||
STR_PREFS_ITEM_START_GTK,
|
||||
STR_PREFS_ITEM_SAVE_GTK,
|
||||
STR_PREFS_ITEM_ZAP_PRAM_GTK,
|
||||
STR_PREFS_ITEM_SEPL_GTK,
|
||||
STR_PREFS_ITEM_QUIT_GTK,
|
||||
|
@ -66,6 +67,7 @@ enum {
|
|||
|
||||
STR_BROWSE_CTRL,
|
||||
STR_BROWSE_TITLE,
|
||||
STR_BROWSE_FOLDER_TITLE,
|
||||
STR_INPUT_PANE_TITLE,
|
||||
STR_KEYCODES_CTRL,
|
||||
STR_KEYCODE_FILE_CTRL,
|
||||
|
@ -76,7 +78,13 @@ enum {
|
|||
|
||||
STR_IGNORESEGV_CTRL,
|
||||
|
||||
STR_NO_B2_EXE_FOUND
|
||||
STR_NO_B2_EXE_FOUND,
|
||||
|
||||
STR_ABOUT_COPYRIGHT,
|
||||
STR_ABOUT_LICENSE,
|
||||
STR_ABOUT_COMMENTS,
|
||||
STR_ABOUT_WEBSITE,
|
||||
STR_ABOUT_WEBSITE_LABEL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -113,7 +114,9 @@ static bool use_vosf = true; // Flag: VOSF enabled
|
|||
static const bool use_vosf = false; // VOSF not possible
|
||||
#endif
|
||||
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
||||
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||
static bool caps_on = false; // Flag: Caps Lock on
|
||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||
|
@ -215,6 +218,7 @@ public:
|
|||
|
||||
virtual void switch_to_current_mode(void);
|
||||
virtual void set_palette(uint8 *pal, int num);
|
||||
virtual void set_gamma(uint8 *gamma, int num);
|
||||
|
||||
bool video_open(void);
|
||||
void video_close(void);
|
||||
|
@ -225,6 +229,30 @@ public:
|
|||
* Utility functions
|
||||
*/
|
||||
|
||||
static bool is_hotkey_down()
|
||||
{
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
if (!hotkey) hotkey = 1;
|
||||
return (ctrl_down || !(hotkey & 1)) &&
|
||||
(opt_down || !(hotkey & 2)) &&
|
||||
(cmd_down || !(hotkey & 4));
|
||||
}
|
||||
|
||||
static int modify_opt_cmd(int code) {
|
||||
static bool f, c;
|
||||
if (!f) {
|
||||
f = true;
|
||||
c = PrefsFindBool("swap_opt_cmd");
|
||||
}
|
||||
if (c) {
|
||||
switch (code) {
|
||||
case 0x37: return 0x3a;
|
||||
case 0x3a: return 0x37;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
// Map video_mode depth ID to numerical depth value
|
||||
static inline int depth_of_video_mode(video_mode const & mode)
|
||||
{
|
||||
|
@ -439,8 +467,35 @@ static void set_window_name(Window w, int name)
|
|||
XClassHint *hints;
|
||||
hints = XAllocClassHint();
|
||||
if (hints) {
|
||||
hints->res_name = "BasiliskII";
|
||||
hints->res_class = "BasiliskII";
|
||||
hints->res_name = (char*) GetString(STR_WINDOW_TITLE);
|
||||
hints->res_class = (char*) GetString(STR_WINDOW_TITLE);
|
||||
XSetClassHint(x_display, w, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
}
|
||||
|
||||
// Set window name and class (ported from SDL implementation)
|
||||
static void set_window_name(Window w, bool mouse_grabbed) {
|
||||
const char *title = PrefsFindString("title");
|
||||
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
|
||||
if (mouse_grabbed)
|
||||
{
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
hotkey = hotkey ? hotkey : 1;
|
||||
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
|
||||
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
|
||||
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
|
||||
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
|
||||
}
|
||||
XStoreName(x_display, w, s.c_str());
|
||||
XSetIconName(x_display, w, GetString(STR_WINDOW_TITLE));
|
||||
|
||||
XClassHint *hints;
|
||||
hints = XAllocClassHint();
|
||||
if (hints) {
|
||||
hints->res_name = (char*) GetString(STR_WINDOW_TITLE);
|
||||
hints->res_class = (char*) GetString(STR_WINDOW_TITLE);
|
||||
XSetClassHint(x_display, w, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
|
@ -732,10 +787,7 @@ driver_window::driver_window(X11_monitor_desc &m)
|
|||
D(bug(" window created\n"));
|
||||
|
||||
// Set window name/class
|
||||
set_window_name(w, STR_WINDOW_TITLE);
|
||||
|
||||
// Set window icons
|
||||
set_window_icons(w);
|
||||
set_window_name(w, mouse_grabbed);
|
||||
|
||||
// Indicate that we want keyboard input
|
||||
set_window_focus(w);
|
||||
|
@ -891,7 +943,7 @@ void driver_window::grab_mouse(void)
|
|||
Delay_usec(100000);
|
||||
}
|
||||
if (result == GrabSuccess) {
|
||||
XStoreName(x_display, w, GetString(STR_WINDOW_TITLE_GRABBED));
|
||||
set_window_name(w, true);
|
||||
ADBSetRelMouseMode(mouse_grabbed = true);
|
||||
disable_mouse_accel();
|
||||
}
|
||||
|
@ -902,7 +954,7 @@ void driver_window::ungrab_mouse(void)
|
|||
{
|
||||
if (mouse_grabbed) {
|
||||
XUngrabPointer(x_display, CurrentTime);
|
||||
XStoreName(x_display, w, GetString(STR_WINDOW_TITLE));
|
||||
set_window_name(w, false);
|
||||
ADBSetRelMouseMode(mouse_grabbed = false);
|
||||
restore_mouse_accel();
|
||||
}
|
||||
|
@ -972,9 +1024,13 @@ driver_dga::~driver_dga()
|
|||
// Suspend emulation
|
||||
void driver_dga::suspend(void)
|
||||
{
|
||||
// Release ctrl key
|
||||
// Release hotkeys
|
||||
ADBKeyUp(0x36);
|
||||
ctrl_down = false;
|
||||
ADBKeyUp(0x37);
|
||||
cmd_down = false;
|
||||
ADBKeyUp(0x3a);
|
||||
opt_down = false;
|
||||
|
||||
// Lock frame buffer (this will stop the MacOS thread)
|
||||
LOCK_FRAME_BUFFER;
|
||||
|
@ -1152,7 +1208,7 @@ driver_fbdev::driver_fbdev(X11_monitor_desc &m) : driver_dga(m)
|
|||
&wattr);
|
||||
|
||||
// Set window name/class
|
||||
set_window_name(w, STR_WINDOW_TITLE);
|
||||
set_window_name(w, false);
|
||||
|
||||
// Indicate that we want keyboard input
|
||||
set_window_focus(w);
|
||||
|
@ -1289,7 +1345,7 @@ driver_xf86dga::driver_xf86dga(X11_monitor_desc &m)
|
|||
(color_class == DirectColor ? CWColormap : 0), &wattr);
|
||||
|
||||
// Set window name/class
|
||||
set_window_name(w, STR_WINDOW_TITLE);
|
||||
set_window_name(w, false);
|
||||
|
||||
// Indicate that we want keyboard input
|
||||
set_window_focus(w);
|
||||
|
@ -1699,7 +1755,7 @@ bool VideoInit(bool classic)
|
|||
default_width = -1; default_height = -1; // use entire screen
|
||||
#endif
|
||||
#ifdef ENABLE_XF86_DGA
|
||||
} else if (has_dga && sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) {
|
||||
} else if (has_dga & sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) {
|
||||
display_type = DISPLAY_DGA;
|
||||
#endif
|
||||
}
|
||||
|
@ -1934,6 +1990,10 @@ void X11_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||
UNLOCK_PALETTE;
|
||||
}
|
||||
|
||||
void X11_monitor_desc::set_gamma(uint8* gamma, int num)
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
|
@ -2010,7 +2070,7 @@ static int kc_decode(KeySym ks, bool key_down)
|
|||
case XK_period: case XK_greater: return 0x2f;
|
||||
case XK_slash: case XK_question: return 0x2c;
|
||||
|
||||
case XK_Tab: if (ctrl_down) {if (key_down) drv->suspend(); return -2;} else return 0x30;
|
||||
case XK_Tab: if (is_hotkey_down()) {if (key_down) drv->suspend(); return -2;} else return 0x30;
|
||||
case XK_Return: return 0x24;
|
||||
case XK_space: return 0x31;
|
||||
case XK_BackSpace: return 0x33;
|
||||
|
@ -2031,10 +2091,10 @@ static int kc_decode(KeySym ks, bool key_down)
|
|||
case XK_Control_R: return 0x36;
|
||||
case XK_Shift_L: return 0x38;
|
||||
case XK_Shift_R: return 0x38;
|
||||
case XK_Alt_L: return 0x37;
|
||||
case XK_Alt_R: return 0x37;
|
||||
case XK_Meta_L: return 0x3a;
|
||||
case XK_Meta_R: return 0x3a;
|
||||
case XK_Alt_L: return 0x3a;
|
||||
case XK_Alt_R: return 0x3a;
|
||||
case XK_Meta_L: return 0x37;
|
||||
case XK_Meta_R: return 0x37;
|
||||
case XK_Menu: return 0x32;
|
||||
case XK_Caps_Lock: return 0x39;
|
||||
case XK_Num_Lock: return 0x47;
|
||||
|
@ -2044,13 +2104,13 @@ static int kc_decode(KeySym ks, bool key_down)
|
|||
case XK_Left: return 0x3b;
|
||||
case XK_Right: return 0x3c;
|
||||
|
||||
case XK_Escape: if (ctrl_down) {if (key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
|
||||
case XK_Escape: if (is_hotkey_down()) {if (key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
|
||||
|
||||
case XK_F1: if (ctrl_down) {if (key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
|
||||
case XK_F1: if (is_hotkey_down()) {if (key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
|
||||
case XK_F2: return 0x78;
|
||||
case XK_F3: return 0x63;
|
||||
case XK_F4: return 0x76;
|
||||
case XK_F5: if (ctrl_down) {if (key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
|
||||
case XK_F5: if (is_hotkey_down()) {if (key_down) drv->toggle_mouse_grab(); return -2;} else return 0x60;
|
||||
case XK_F6: return 0x61;
|
||||
case XK_F7: return 0x62;
|
||||
case XK_F8: return 0x64;
|
||||
|
@ -2186,12 +2246,23 @@ static void handle_events(void)
|
|||
|
||||
// Keyboard
|
||||
case KeyPress: {
|
||||
int code = -1;
|
||||
int code = event2keycode(event.xkey, true);
|
||||
if(!emul_suspended)
|
||||
{
|
||||
if (code == 0x36) {
|
||||
ctrl_down = true;
|
||||
} else if (code == 0x3a) {
|
||||
opt_down = true;
|
||||
code = modify_opt_cmd(code);
|
||||
} else if (code == 0x37) {
|
||||
cmd_down = true;
|
||||
code = modify_opt_cmd(code);
|
||||
}
|
||||
}
|
||||
if (use_keycodes) {
|
||||
if (event2keycode(event.xkey, true) != -2) // This is called to process the hotkeys
|
||||
if (code != -2) // This is called to process the hotkeys
|
||||
code = keycode_table[event.xkey.keycode & 0xff];
|
||||
} else
|
||||
code = event2keycode(event.xkey, true);
|
||||
}
|
||||
if (code >= 0) {
|
||||
if (!emul_suspended) {
|
||||
if (code == 0x39) { // Caps Lock pressed
|
||||
|
@ -2204,8 +2275,6 @@ static void handle_events(void)
|
|||
}
|
||||
} else
|
||||
ADBKeyDown(code);
|
||||
if (code == 0x36)
|
||||
ctrl_down = true;
|
||||
} else {
|
||||
if (code == 0x31)
|
||||
drv->resume(); // Space wakes us up
|
||||
|
@ -2214,16 +2283,25 @@ static void handle_events(void)
|
|||
break;
|
||||
}
|
||||
case KeyRelease: {
|
||||
int code = -1;
|
||||
int code = event2keycode(event.xkey, false);
|
||||
if(!emul_suspended)
|
||||
{
|
||||
if (code == 0x36) {
|
||||
ctrl_down = false;
|
||||
} else if (code == 0x3a) {
|
||||
opt_down = false;
|
||||
code = modify_opt_cmd(code);
|
||||
} else if (code == 0x37) {
|
||||
cmd_down = false;
|
||||
code = modify_opt_cmd(code);
|
||||
}
|
||||
}
|
||||
if (use_keycodes) {
|
||||
if (event2keycode(event.xkey, false) != -2) // This is called to process the hotkeys
|
||||
if (code != -2) // This is called to process the hotkeys
|
||||
code = keycode_table[event.xkey.keycode & 0xff];
|
||||
} else
|
||||
code = event2keycode(event.xkey, false);
|
||||
}
|
||||
if (code >= 0 && code != 0x39) { // Don't propagate Caps Lock releases
|
||||
ADBKeyUp(code);
|
||||
if (code == 0x36)
|
||||
ctrl_down = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2278,10 +2356,10 @@ static void update_display_dynamic(int ticker, driver_window *drv)
|
|||
y2s = sm_uptd[ticker % 8];
|
||||
y2a = 8;
|
||||
for (i = 0; i < 6; i++) {
|
||||
max_box = sm_no_boxes[i];
|
||||
if (ticker % (2 << i))
|
||||
break;
|
||||
}
|
||||
max_box = sm_no_boxes[i];
|
||||
|
||||
if (y2a) {
|
||||
for (y1=0; y1<16; y1++) {
|
||||
|
|
|
@ -20,11 +20,68 @@
|
|||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
using std::string;
|
||||
|
||||
#include "xpram.h"
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
|
||||
// XPRAM file name, set by LoadPrefs() in prefs_unix.cpp
|
||||
string xpram_name;
|
||||
|
||||
/*
|
||||
* Load XPRAM from settings file
|
||||
*/
|
||||
|
||||
void LoadXPRAM(const char* vmdir)
|
||||
{
|
||||
assert(!xpram_name.empty());
|
||||
int fd;
|
||||
if ((fd = open(xpram_name.c_str(), O_RDONLY)) >= 0)
|
||||
{
|
||||
read(fd, XPRAM, XPRAM_SIZE);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save XPRAM to settings file
|
||||
*/
|
||||
|
||||
void SaveXPRAM(void)
|
||||
{
|
||||
assert(!xpram_name.empty());
|
||||
int fd;
|
||||
if ((fd = open(xpram_name.c_str(), O_WRONLY | O_CREAT, 0666)) >= 0)
|
||||
{
|
||||
write(fd, XPRAM, XPRAM_SIZE);
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "WARNING: Unable to save %s (%s)\n",
|
||||
xpram_name.c_str(), strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete PRAM file
|
||||
*/
|
||||
|
||||
void ZapPRAM(void)
|
||||
{
|
||||
// Delete file
|
||||
assert(!xpram_name.empty());
|
||||
unlink(xpram_name.c_str());
|
||||
}
|
||||
|
||||
|
||||
#else // __linux__
|
||||
|
||||
|
||||
// XPRAM file name and path
|
||||
#if POWERPC_ROM
|
||||
const char XPRAM_FILE_NAME[] = ".sheepshaver_nvram";
|
||||
|
@ -98,3 +155,7 @@ void ZapPRAM(void)
|
|||
// Delete file
|
||||
unlink(xpram_path);
|
||||
}
|
||||
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ SLIRP_SRCS = \
|
|||
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c
|
||||
SLIRP_OBJS = $(SLIRP_SRCS:../slirp/%.c=$(OBJ_DIR)/slirp-%.o)
|
||||
|
||||
USE_BINCUE = @USE_BINCUE@
|
||||
|
||||
LN_S = @LN_S@
|
||||
WINDRES = @WINDRES@
|
||||
CC = @CC@
|
||||
|
@ -42,6 +44,7 @@ DEFS = @DEFS@ @DEFINES@
|
|||
LDFLAGS = @LDFLAGS@ -Wl,-Bstatic
|
||||
LIBS = @LIBS@ -lws2_32 -lwsock32 -liphlpapi
|
||||
CPUSRCS = @CPUSRCS@
|
||||
EXTRASRCS = @EXTRASRCS@
|
||||
|
||||
HOST_CC = gcc
|
||||
HOST_CXX = g++
|
||||
|
@ -63,12 +66,13 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
|
|||
../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_windows.cpp ../timer.cpp \
|
||||
timer_windows.cpp ../adb.cpp ../serial.cpp serial_windows.cpp \
|
||||
../ether.cpp ether_windows.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp \
|
||||
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp \
|
||||
video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \
|
||||
../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp \
|
||||
../SDL/video_sdl.cpp ../SDL/video_sdl2.cpp ../SDL/video_sdl3.cpp \
|
||||
video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp ../SDL/audio_sdl3.cpp clip_windows.cpp \
|
||||
../extfs.cpp extfs_windows.cpp ../user_strings.cpp user_strings_windows.cpp \
|
||||
vm_alloc.cpp sigsegv.cpp posix_emu.cpp util_windows.cpp \
|
||||
../dummy/prefs_editor_dummy.cpp BasiliskII.rc \
|
||||
$(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(SLIRP_OBJS)
|
||||
$(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(EXTRASRCS) $(SLIRP_OBJS)
|
||||
|
||||
UI_SRCS = ../prefs.cpp prefs_windows.cpp prefs_editor_gtk.cpp xpram_windows.cpp \
|
||||
../prefs_items.cpp ../user_strings.cpp user_strings_windows.cpp util_windows.cpp \
|
||||
|
|
|
@ -11,9 +11,6 @@ dnl Aliases for PACKAGE and VERSION macros.
|
|||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
|
||||
|
||||
dnl SDL options.
|
||||
#AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
|
||||
|
||||
dnl JIT compiler options.
|
||||
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
|
||||
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
|
||||
|
@ -35,6 +32,10 @@ AC_ARG_ENABLE(fpe,
|
|||
|
||||
dnl External packages.
|
||||
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
|
||||
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
|
||||
|
||||
AC_ARG_WITH(bincue,
|
||||
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
|
||||
|
||||
dnl Addressing modes.
|
||||
AC_ARG_ENABLE(addressing,
|
||||
|
@ -49,6 +50,8 @@ AC_ARG_ENABLE(addressing,
|
|||
[ ADDRESSING_TEST_ORDER="direct banks"
|
||||
])
|
||||
|
||||
AC_ARG_WITH(sdl3, [ --with-sdl3 use SDL 3.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=3], [WANT_SDL_VERSION_MAJOR=2])
|
||||
|
||||
dnl Canonical system information.
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
@ -85,6 +88,14 @@ AC_SUBST(WANT_GTK)
|
|||
dnl We use 64-bit file size support if possible.
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl BINCUE
|
||||
AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
|
||||
AS_IF([test "x$have_bincue" = "xyes" ], [
|
||||
DEFINES="$DEFINES -DBINCUE"
|
||||
CPPFLAGS="$CPPFLAGS -DBINCUE"
|
||||
AC_SUBST(USE_BINCUE, yes)
|
||||
], [AC_SUBST(USE_BINCUE, no)])
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
|
@ -200,8 +211,12 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
|
|||
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
|
||||
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
|
||||
|
||||
dnl We really want VOSF (Video on SEGV Signals) screen updates acceleration
|
||||
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
|
||||
dnl Enable VOSF screen updates with this feature is requested
|
||||
if [[ "x$WANT_VOSF" = "xyes" ]]; then
|
||||
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
|
||||
else
|
||||
WANT_VOSF=no
|
||||
fi
|
||||
|
||||
dnl Determine the addressing mode to use
|
||||
ADDRESSING_MODE=""
|
||||
|
@ -269,10 +284,13 @@ if [[ "x$HAVE_GCC30" = "xyes" ]]; then
|
|||
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
|
||||
ac_cv_gcc_no_strict_aliasing, [
|
||||
AC_TRY_COMPILE([],[],
|
||||
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
|
||||
[ac_cv_gcc_no_strict_aliasing=yes],
|
||||
[ac_cv_gcc_no_strict_aliasing=no])
|
||||
])
|
||||
CFLAGS="$SAVED_CFLAGS"
|
||||
if test "x$ac_cv_gcc_no_strict_aliasing" = xyes; then
|
||||
AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Select appropriate CPU source and REGPARAM define.
|
||||
|
@ -304,6 +322,11 @@ elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl BINCUE overrides
|
||||
if [[ "x$have_bincue" = "xyes" ]]; then
|
||||
EXTRASRCS="$EXTRASRCS bincue.cpp"
|
||||
fi
|
||||
|
||||
dnl Enable JIT compiler, if possible.
|
||||
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
|
||||
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
|
||||
|
@ -524,19 +547,15 @@ CPUINCLUDES="-I../uae_cpu"
|
|||
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
|
||||
|
||||
dnl We really want SDL for now
|
||||
AC_CHECK_TOOL(sdl_config, sdl2-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])])
|
||||
SDL_CFLAGS=`$sdl_config --cflags`
|
||||
if [[ "x$WANT_SDL_VERSION_MAJOR" = "x3" ]]; then
|
||||
SDL_CFLAGS=`pkg-config sdl3 --cflags`
|
||||
SDL_CFLAGS+=`echo " $SDL_CFLAGS" | sed -e 's/\(-I.*include\)/\1\/SDL3/'`
|
||||
SDL_LIBS=`pkg-config sdl3 --libs | sed -e 's/-lSDL3/-lSDL3.dll/'`
|
||||
else
|
||||
SDL_CFLAGS=`sdl2-config --cflags`
|
||||
SDL_LIBS=`sdl2-config --static-libs`
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
#if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
|
||||
SDL_LIBS=`$sdl_config --static-libs`
|
||||
# sdl_prefix=`$sdl_config --exec-prefix`
|
||||
# if [[ -n "$sdl_prefix" ]]; then
|
||||
# SDL_LIBS=`echo "$SDL_LIBS" | sed -e "s,-l\(SDLmain\|SDL\),$sdl_prefix/lib/lib\1.a,g"`
|
||||
# fi
|
||||
# SDL_LIBS="$SDL_LIBS -lwinmm"
|
||||
#else
|
||||
# SDL_LIBS=`$sdl_config --libs`
|
||||
#fi
|
||||
AC_SUBST(SDL_LIBS)
|
||||
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
|
||||
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
|
||||
|
@ -548,10 +567,14 @@ if [[ "x$HAVE_GCC27" = "xyes" ]]; then
|
|||
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -fwrapv"
|
||||
CXXFLAGS="$CXXFLAGS -fwrapv"
|
||||
|
||||
dnl Generate Makefile.
|
||||
AC_SUBST(DEFINES)
|
||||
AC_SUBST(CPUINCLUDES)
|
||||
AC_SUBST(CPUSRCS)
|
||||
AC_SUBST(EXTRASRCS)
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
@ -559,11 +582,14 @@ dnl Print summary.
|
|||
echo
|
||||
echo Basilisk II configuration summary:
|
||||
echo
|
||||
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
|
||||
echo Use JIT compiler ....................... : $WANT_JIT
|
||||
echo JIT debug mode ......................... : $WANT_JIT_DEBUG
|
||||
echo Floating-Point emulation core .......... : $FPE_CORE
|
||||
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
|
||||
echo Addressing mode ........................ : $ADDRESSING_MODE
|
||||
echo BINCUE support ......................... : $have_bincue
|
||||
echo GTK user interface ..................... : $WANT_GTK
|
||||
echo Enable VOSF ............................ : $WANT_VOSF
|
||||
echo
|
||||
echo "Configuration done. Now type \"make\" (or \"gmake\")."
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
// somehow util_windows undefines min
|
||||
#define min(x,y) ((x) < (y) ? (x) : (y))
|
||||
#include "libslirp.h"
|
||||
#include "ctl.h"
|
||||
|
||||
// Define to let the slirp library determine the right timeout for select()
|
||||
#define USE_SLIRP_TIMEOUT 1
|
||||
|
@ -144,6 +145,8 @@ static LPPACKET send_queue = 0;
|
|||
static CRITICAL_SECTION wpool_csection;
|
||||
static LPPACKET write_packet_pool = 0;
|
||||
|
||||
// Calling slirp functions from multiple threads concurrently is unsafe; guard it
|
||||
static CRITICAL_SECTION slirp_single_call_csection;
|
||||
|
||||
|
||||
// Try to deal with echos. Protected by fetch_csection.
|
||||
|
@ -198,6 +201,8 @@ static int16 ether_do_add_multicast(uint8 *addr);
|
|||
static int16 ether_do_del_multicast(uint8 *addr);
|
||||
static int16 ether_do_write(uint32 arg);
|
||||
static void ether_do_interrupt(void);
|
||||
static void slirp_add_redirs();
|
||||
static int slirp_add_redir(const char *redir_str);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -261,6 +266,7 @@ bool ether_init(void)
|
|||
WarningAlert(GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
|
||||
return false;
|
||||
}
|
||||
slirp_add_redirs();
|
||||
}
|
||||
|
||||
// Open ethernet device
|
||||
|
@ -416,6 +422,8 @@ bool ether_init(void)
|
|||
InitializeCriticalSectionAndSpinCount( &send_csection, 5000 );
|
||||
InitializeCriticalSectionAndSpinCount( &wpool_csection, 5000 );
|
||||
|
||||
InitializeCriticalSection( &slirp_single_call_csection );
|
||||
|
||||
ether_th = (HANDLE)_beginthreadex( 0, 0, ether_thread_feed_int, 0, 0, ðer_tid );
|
||||
if (!ether_th) {
|
||||
D(bug("Failed to create ethernet thread\n"));
|
||||
|
@ -565,6 +573,7 @@ void ether_exit(void)
|
|||
DeleteCriticalSection( &queue_csection );
|
||||
DeleteCriticalSection( &send_csection );
|
||||
DeleteCriticalSection( &wpool_csection );
|
||||
DeleteCriticalSection( &slirp_single_call_csection );
|
||||
|
||||
D(bug("Freeing read packets\n"));
|
||||
free_read_packets();
|
||||
|
@ -1018,7 +1027,9 @@ unsigned int WINAPI ether_thread_write_packets(void *arg)
|
|||
}
|
||||
break;
|
||||
case NET_IF_SLIRP:
|
||||
EnterCriticalSection( &slirp_single_call_csection );
|
||||
slirp_input((uint8 *)Packet->Buffer, Packet->Length);
|
||||
LeaveCriticalSection( &slirp_single_call_csection );
|
||||
Packet->bIoComplete = TRUE;
|
||||
recycle_write_packet(Packet);
|
||||
break;
|
||||
|
@ -1372,7 +1383,9 @@ unsigned int WINAPI slirp_receive_func(void *arg)
|
|||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&wfds);
|
||||
FD_ZERO(&xfds);
|
||||
EnterCriticalSection( &slirp_single_call_csection );
|
||||
timeout = slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
|
||||
LeaveCriticalSection( &slirp_single_call_csection );
|
||||
#if ! USE_SLIRP_TIMEOUT
|
||||
timeout = 10000;
|
||||
#endif
|
||||
|
@ -1388,8 +1401,11 @@ unsigned int WINAPI slirp_receive_func(void *arg)
|
|||
tv.tv_usec = timeout;
|
||||
ret = select(0, &rfds, &wfds, &xfds, &tv);
|
||||
}
|
||||
if (ret >= 0)
|
||||
if (ret >= 0) {
|
||||
EnterCriticalSection( &slirp_single_call_csection );
|
||||
slirp_select_poll(&rfds, &wfds, &xfds);
|
||||
LeaveCriticalSection( &slirp_single_call_csection );
|
||||
}
|
||||
}
|
||||
|
||||
D(bug("slirp_receive_func exit\n"));
|
||||
|
@ -1628,6 +1644,97 @@ static void ether_do_interrupt(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Helper function for port forwarding
|
||||
static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
|
||||
{
|
||||
const char *p, *p1;
|
||||
int len;
|
||||
p = *pp;
|
||||
p1 = strchr(p, sep);
|
||||
if (!p1)
|
||||
return -1;
|
||||
len = p1 - p;
|
||||
p1++;
|
||||
if (buf_size > 0) {
|
||||
if (len > buf_size - 1)
|
||||
len = buf_size - 1;
|
||||
memcpy(buf, p, len);
|
||||
buf[len] = '\0';
|
||||
}
|
||||
*pp = p1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set up port forwarding for slirp
|
||||
static void slirp_add_redirs()
|
||||
{
|
||||
int index = 0;
|
||||
const char *str;
|
||||
while ((str = PrefsFindString("redir", index++)) != NULL) {
|
||||
slirp_add_redir(str);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a port forward/redirection for slirp
|
||||
static int slirp_add_redir(const char *redir_str)
|
||||
{
|
||||
// code adapted from qemu source
|
||||
struct in_addr guest_addr = {0};
|
||||
int host_port, guest_port;
|
||||
const char *p;
|
||||
char buf[256];
|
||||
int is_udp;
|
||||
char *end;
|
||||
char str[256];
|
||||
|
||||
p = redir_str;
|
||||
if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
if (!strcmp(buf, "tcp") || buf[0] == '\0') {
|
||||
is_udp = 0;
|
||||
} else if (!strcmp(buf, "udp")) {
|
||||
is_udp = 1;
|
||||
} else {
|
||||
goto fail_syntax;
|
||||
}
|
||||
|
||||
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
host_port = strtol(buf, &end, 0);
|
||||
if (*end != '\0' || host_port < 1 || host_port > 65535) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
|
||||
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
// 0.0.0.0 doesn't seem to work, so default to a client address
|
||||
// if none is specified
|
||||
if (buf[0] == '\0' ?
|
||||
!inet_pton(AF_INET, CTL_LOCAL, &guest_addr) :
|
||||
!inet_pton(AF_INET, buf, &guest_addr)) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
|
||||
guest_port = strtol(p, &end, 0);
|
||||
if (*end != '\0' || guest_port < 1 || guest_port > 65535) {
|
||||
goto fail_syntax;
|
||||
}
|
||||
|
||||
if (slirp_redir(is_udp, host_port, guest_addr, guest_port) < 0) {
|
||||
sprintf(str, "could not set up host forwarding rule '%s'", redir_str);
|
||||
WarningAlert(str);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
fail_syntax:
|
||||
sprintf(str, "invalid host forwarding rule '%s'", redir_str);
|
||||
WarningAlert(str);
|
||||
return -1;
|
||||
}
|
||||
#if DEBUG
|
||||
#pragma optimize("",on)
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,11 @@ extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_suppo
|
|||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
#define SDL_Mutex SDL_mutex
|
||||
#define SDL_EVENT_KEY_UP SDL_KEYUP
|
||||
#define SDL_EVENT_KEY_DOWN SDL_KEYDOWN
|
||||
#endif
|
||||
|
||||
// Constants
|
||||
const TCHAR ROM_FILE_NAME[] = TEXT("ROM");
|
||||
|
@ -86,7 +91,7 @@ static bool tick_thread_active = false; // Flag: 60Hz thread installed
|
|||
static volatile bool tick_thread_cancel = false; // Flag: Cancel 60Hz thread
|
||||
static SDL_Thread *tick_thread; // 60Hz thread
|
||||
|
||||
static SDL_mutex *intflag_lock = NULL; // Mutex to protect InterruptFlags
|
||||
static SDL_Mutex *intflag_lock = NULL; // Mutex to protect InterruptFlags
|
||||
#define LOCK_INTFLAGS SDL_LockMutex(intflag_lock)
|
||||
#define UNLOCK_INTFLAGS SDL_UnlockMutex(intflag_lock)
|
||||
|
||||
|
@ -98,11 +103,14 @@ uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
|
|||
static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped
|
||||
#endif
|
||||
|
||||
static HHOOK keyboard_hook; // Hook for intercepting windows key events
|
||||
|
||||
|
||||
// Prototypes
|
||||
static int xpram_func(void *arg);
|
||||
static int tick_func(void *arg);
|
||||
static void one_tick(...);
|
||||
static LRESULT CALLBACK low_level_keyboard_hook(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -187,6 +195,16 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
|
|||
#endif
|
||||
}
|
||||
|
||||
uint16 emulated_ticks;
|
||||
void cpu_do_check_ticks(void)
|
||||
{
|
||||
static int delay = -1;
|
||||
if (delay < 0)
|
||||
delay = PrefsFindInt32("delay");
|
||||
if (delay)
|
||||
usleep(delay);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main program
|
||||
|
@ -204,6 +222,7 @@ static void usage(const char *prg_name)
|
|||
);
|
||||
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
PrefsPrintUsage();
|
||||
printf("\nBuild Date: %s\n", __DATE__);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -283,6 +302,12 @@ int main(int argc, char **argv)
|
|||
QuitEmulator();
|
||||
#endif
|
||||
|
||||
// Install keyboard hook to block Windows key if enabled in prefs
|
||||
if (PrefsFindBool("reservewindowskey"))
|
||||
{
|
||||
keyboard_hook = SetWindowsHookEx(WH_KEYBOARD_LL, low_level_keyboard_hook, GetModuleHandle(NULL), 0);
|
||||
}
|
||||
|
||||
// Initialize SDL system
|
||||
int sdl_flags = 0;
|
||||
#ifdef USE_SDL_VIDEO
|
||||
|
@ -361,10 +386,10 @@ int main(int argc, char **argv)
|
|||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
// Get rom file path from preferences
|
||||
auto rom_path = tstr(PrefsFindString("rom"));
|
||||
const char* rom_path = PrefsFindString("rom");
|
||||
|
||||
// Load Mac ROM
|
||||
HANDLE rom_fh = CreateFile(rom_path ? rom_path.get() : ROM_FILE_NAME,
|
||||
HANDLE rom_fh = CreateFile((rom_path != NULL) ? rom_path : ROM_FILE_NAME,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING,
|
||||
|
@ -500,7 +525,7 @@ void FlushCodeCache(void *start, uint32 size)
|
|||
struct B2_mutex {
|
||||
B2_mutex() { m = SDL_CreateMutex(); }
|
||||
~B2_mutex() { if (m) SDL_DestroyMutex(m); }
|
||||
SDL_mutex *m;
|
||||
SDL_Mutex *m;
|
||||
};
|
||||
|
||||
B2_mutex *B2_create_mutex(void)
|
||||
|
@ -598,13 +623,15 @@ static void one_tick(...)
|
|||
}
|
||||
}
|
||||
|
||||
bool tick_inhibit;
|
||||
static int tick_func(void *arg)
|
||||
{
|
||||
uint64 start = GetTicks_usec();
|
||||
int64 ticks = 0;
|
||||
uint64 next = GetTicks_usec();
|
||||
while (!tick_thread_cancel) {
|
||||
one_tick();
|
||||
if (!tick_inhibit)
|
||||
one_tick();
|
||||
next += 16625;
|
||||
int64 delay = next - GetTicks_usec();
|
||||
if (delay > 0)
|
||||
|
@ -624,22 +651,25 @@ static int tick_func(void *arg)
|
|||
*/
|
||||
|
||||
#ifdef USE_SDL_VIDEO
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
#include <SDL_video.h>
|
||||
#else
|
||||
#include <SDL_syswm.h>
|
||||
#endif
|
||||
extern SDL_Window *sdl_window;
|
||||
HWND GetMainWindowHandle(void)
|
||||
{
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
if (!sdl_window) {
|
||||
return NULL;
|
||||
}
|
||||
if (!SDL_GetWindowWMInfo(sdl_window, &wmInfo)) {
|
||||
return NULL;
|
||||
}
|
||||
if (wmInfo.subsystem != SDL_SYSWM_WINDOWS) {
|
||||
return NULL;
|
||||
}
|
||||
return wmInfo.info.win.window;
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(sdl_window);
|
||||
return (HWND)SDL_GetProperty(props, "SDL.window.cocoa.window", NULL);
|
||||
#else
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
return SDL_GetWindowWMInfo(sdl_window, &wmInfo) ? wmInfo.info.win.window : NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -711,3 +741,43 @@ bool ChoiceAlert(const char *text, const char *pos, const char *neg)
|
|||
printf(GetString(STR_SHELL_WARNING_PREFIX), text);
|
||||
return false; //!!
|
||||
}
|
||||
|
||||
/*
|
||||
* Low level keyboard hook allowing us to intercept events involving the Windows key
|
||||
*/
|
||||
static LRESULT CALLBACK low_level_keyboard_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Not a relevant event, immediately pass it on
|
||||
if (nCode != HC_ACTION)
|
||||
return CallNextHookEx(keyboard_hook, nCode, wParam, lParam);
|
||||
|
||||
KBDLLHOOKSTRUCT *p = (KBDLLHOOKSTRUCT *)lParam;
|
||||
switch (wParam) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
// Intercept left/right windows keys when we have keyboard focus so Windows doesn't handle them
|
||||
if (p->vkCode == VK_LWIN || p->vkCode == VK_RWIN) {
|
||||
bool intercept_event = false;
|
||||
#ifdef USE_SDL_VIDEO
|
||||
if (sdl_window && (SDL_GetWindowFlags(sdl_window) & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
intercept_event = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we've determined we should intercept the event, intercept it. But pass the event onto SDL so Basilisk handles it.
|
||||
if (intercept_event) {
|
||||
SDL_Event e;
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.type = (wParam == WM_KEYDOWN) ? SDL_EVENT_KEY_DOWN : SDL_EVENT_KEY_UP;
|
||||
e.key.keysym.sym = (p->vkCode == VK_LWIN) ? SDLK_LGUI : SDLK_RGUI;
|
||||
e.key.keysym.scancode = (p->vkCode == VK_LWIN) ? SDL_SCANCODE_LGUI : SDL_SCANCODE_RGUI;
|
||||
SDL_PushEvent(&e);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If we fall here, we weren't supposed to intercept it.
|
||||
return CallNextHookEx(keyboard_hook, nCode, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -975,30 +975,14 @@ static int dis_width, dis_height;
|
|||
// Hide/show graphics widgets
|
||||
static void hide_show_graphics_widgets(void)
|
||||
{
|
||||
switch (display_type) {
|
||||
case DISPLAY_WINDOW:
|
||||
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip);
|
||||
break;
|
||||
case DISPLAY_SCREEN:
|
||||
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// "Window" video type selected
|
||||
static void mn_window(...)
|
||||
{
|
||||
display_type = DISPLAY_WINDOW;
|
||||
hide_show_graphics_widgets();
|
||||
}
|
||||
static void mn_window(...) {display_type = DISPLAY_WINDOW;}
|
||||
|
||||
// "Fullscreen" video type selected
|
||||
static void mn_fullscreen(...)
|
||||
{
|
||||
display_type = DISPLAY_SCREEN;
|
||||
hide_show_graphics_widgets();
|
||||
PrefsReplaceInt32("frameskip", 1);
|
||||
}
|
||||
static void mn_fullscreen(...) {display_type = DISPLAY_SCREEN;}
|
||||
|
||||
// "5 Hz".."60Hz" selected
|
||||
static void mn_5hz(...) {PrefsReplaceInt32("frameskip", 12);}
|
||||
|
@ -1030,6 +1014,33 @@ static void tb_nosound(GtkWidget *widget)
|
|||
set_graphics_sensitive();
|
||||
}
|
||||
|
||||
// SDL Graphics
|
||||
#ifdef USE_SDL_VIDEO
|
||||
// SDL Renderer Render Driver
|
||||
enum {
|
||||
RENDER_SOFTWARE = 0,
|
||||
RENDER_OPENGL = 1,
|
||||
RENDER_DIRECT3D = 2
|
||||
};
|
||||
|
||||
GtkWidget *w_render_driver;
|
||||
GtkWidget *l_render_driver;
|
||||
static int render_driver;
|
||||
static int sdl_vsync;
|
||||
|
||||
// Render Driver selected
|
||||
static void mn_sdl_software(...) {render_driver = RENDER_SOFTWARE;}
|
||||
static void mn_sdl_opengl(...) {render_driver = RENDER_OPENGL;}
|
||||
static void mn_sdl_direct3d(...) {render_driver = RENDER_DIRECT3D;}
|
||||
|
||||
// SDL Renderer Vertical Sync
|
||||
static void tb_sdl_vsync(GtkWidget *widget)
|
||||
{
|
||||
PrefsReplaceBool("sdl_vsync", GTK_TOGGLE_BUTTON(widget)->active);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Read graphics preferences
|
||||
static void parse_graphics_prefs(void)
|
||||
{
|
||||
|
@ -1049,6 +1060,40 @@ static void parse_graphics_prefs(void)
|
|||
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2)
|
||||
display_type = DISPLAY_SCREEN;
|
||||
}
|
||||
|
||||
#ifdef USE_SDL_VIDEO
|
||||
render_driver = RENDER_SOFTWARE;
|
||||
|
||||
const char *drv = PrefsFindString("sdlrender");
|
||||
if (drv && drv[0]) {
|
||||
if (strcmp(drv, "software") == 0)
|
||||
render_driver = RENDER_SOFTWARE;
|
||||
else if (strcmp(drv, "opengl") == 0)
|
||||
render_driver = RENDER_OPENGL;
|
||||
else if (strcmp(drv, "direct3d") == 0)
|
||||
render_driver = RENDER_DIRECT3D;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void read_SDL_graphics_settings(void)
|
||||
{
|
||||
const char *rpref;
|
||||
switch (render_driver) {
|
||||
case RENDER_SOFTWARE:
|
||||
rpref = "software";
|
||||
break;
|
||||
case RENDER_OPENGL:
|
||||
rpref = "opengl";
|
||||
break;
|
||||
case RENDER_DIRECT3D:
|
||||
rpref = "direct3d";
|
||||
break;
|
||||
default:
|
||||
PrefsRemoveItem("sdlrender");
|
||||
return;
|
||||
}
|
||||
PrefsReplaceString("sdlrender", rpref);
|
||||
}
|
||||
|
||||
// Read settings from widgets and set preferences
|
||||
|
@ -1075,6 +1120,10 @@ static void read_graphics_settings(void)
|
|||
return;
|
||||
}
|
||||
PrefsReplaceString("screen", pref);
|
||||
|
||||
#ifdef USE_SDL_VIDEO
|
||||
read_SDL_graphics_settings();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create "Graphics/Sound" pane
|
||||
|
@ -1184,6 +1233,39 @@ static void create_graphics_pane(GtkWidget *top)
|
|||
make_checkbox(box, STR_GFXACCEL_CTRL, "gfxaccel", GTK_SIGNAL_FUNC(tb_gfxaccel));
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL_VIDEO
|
||||
make_separator(box);
|
||||
|
||||
table = make_table(box, 2, 5);
|
||||
|
||||
l_render_driver = gtk_label_new(GetString(STR_GRAPHICS_SDL_RENDER_DRIVER_CTRL));
|
||||
gtk_widget_show(l_render_driver);
|
||||
gtk_table_attach(GTK_TABLE(table), l_render_driver, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
|
||||
|
||||
w_render_driver = gtk_option_menu_new();
|
||||
gtk_widget_show(w_render_driver);
|
||||
menu = gtk_menu_new();
|
||||
|
||||
add_menu_item(menu, STR_SOFTWARE_LAB, GTK_SIGNAL_FUNC(mn_sdl_software));
|
||||
add_menu_item(menu, STR_OPENGL_LAB, GTK_SIGNAL_FUNC(mn_sdl_opengl));
|
||||
add_menu_item(menu, STR_DIRECT3D_LAB, GTK_SIGNAL_FUNC(mn_sdl_direct3d));
|
||||
switch (render_driver) {
|
||||
case RENDER_SOFTWARE:
|
||||
gtk_menu_set_active(GTK_MENU(menu), 0);
|
||||
break;
|
||||
case RENDER_OPENGL:
|
||||
gtk_menu_set_active(GTK_MENU(menu), 1);
|
||||
break;
|
||||
case RENDER_DIRECT3D:
|
||||
gtk_menu_set_active(GTK_MENU(menu), 2);
|
||||
break;
|
||||
}
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_render_driver), menu);
|
||||
gtk_table_attach(GTK_TABLE(table), w_render_driver, 1, 2, 0, 1, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
|
||||
|
||||
opt = make_checkbox(box, STR_GRAPHICS_SDL_VSYNC_CTRL, "sdl_vsync", GTK_SIGNAL_FUNC(tb_sdl_vsync));
|
||||
#endif
|
||||
|
||||
make_separator(box);
|
||||
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
|
||||
|
||||
|
@ -1216,6 +1298,12 @@ static void tb_keycodes(GtkWidget *widget)
|
|||
set_input_sensitive();
|
||||
}
|
||||
|
||||
// "Reserve Windows Key" button toggled
|
||||
static void tb_reservewindowskey(GtkWidget *widget)
|
||||
{
|
||||
PrefsReplaceBool("reservewindowskey", GTK_TOGGLE_BUTTON(widget)->active);
|
||||
}
|
||||
|
||||
// "Mouse Wheel Mode" selected
|
||||
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();}
|
||||
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();}
|
||||
|
@ -1263,6 +1351,8 @@ static void create_input_pane(GtkWidget *top)
|
|||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
g_object_set_data(G_OBJECT(w_keycode_file), "chooser_button", button);
|
||||
|
||||
make_checkbox(box, STR_RESERVE_WINDOWS_KEY_CTRL, "reservewindowskey", GTK_SIGNAL_FUNC(tb_reservewindowskey));
|
||||
|
||||
make_separator(box);
|
||||
|
||||
static const opt_desc options[] = {
|
||||
|
|
|
@ -35,9 +35,6 @@ prefs_desc platform_prefs_items[] = {
|
|||
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"},
|
||||
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"},
|
||||
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
|
||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||
#endif
|
||||
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
||||
{"enableextfs", TYPE_BOOLEAN, false, "enable extfs system"},
|
||||
{"debugextfs", TYPE_BOOLEAN, false, "debug extfs system"},
|
||||
|
@ -52,6 +49,12 @@ prefs_desc platform_prefs_items[] = {
|
|||
{"tcp_port", TYPE_STRING, false, "TCP ports list"},
|
||||
{"portfile0", TYPE_STRING, false, "output file for serial port 0"},
|
||||
{"portfile1", TYPE_STRING, false, "output file for serial port 1"},
|
||||
#ifdef USE_SDL_VIDEO
|
||||
{"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"},
|
||||
{"sdl_vsync", TYPE_BOOLEAN, false, "Make SDL_Renderer vertical sync frames to host (eg. with software renderer)"},
|
||||
#endif
|
||||
{"reservewindowskey", TYPE_BOOLEAN, false, "block Windows key from activating start menu"},
|
||||
|
||||
|
||||
{NULL, TYPE_END, false, NULL} // End of list
|
||||
};
|
||||
|
@ -123,9 +126,6 @@ void AddPlatformPrefsDefaults(void)
|
|||
PrefsReplaceString("extdrives", "CDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
PrefsReplaceInt32("mousewheelmode", 1);
|
||||
PrefsReplaceInt32("mousewheellines", 3);
|
||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||
PrefsAddBool("ignoresegv", false);
|
||||
#endif
|
||||
PrefsAddBool("idlewait", true);
|
||||
PrefsReplaceBool("etherpermanentaddress", true);
|
||||
PrefsReplaceInt32("ethermulticastmode", 0);
|
||||
|
@ -134,4 +134,9 @@ void AddPlatformPrefsDefaults(void)
|
|||
PrefsReplaceString("serialb", "COM2");
|
||||
PrefsReplaceString("portfile0", "C:\\B2TEMP0.OUT");
|
||||
PrefsReplaceString("portfile1", "C:\\B2TEMP1.OUT");
|
||||
#ifdef USE_SDL_VIDEO
|
||||
PrefsReplaceString("sdlrender", "software");
|
||||
PrefsReplaceBool("sdl_vsync", false);
|
||||
#endif
|
||||
PrefsAddBool("reservewindowskey", false);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ using std::min;
|
|||
#include "cdenable/cache.h"
|
||||
#include "cdenable/eject_nt.h"
|
||||
|
||||
#if defined(BINCUE)
|
||||
#include "bincue.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
|
@ -56,6 +60,12 @@ struct file_handle {
|
|||
loff_t file_size; // Size of file data (only valid if is_file is true)
|
||||
cachetype cache;
|
||||
bool is_media_present;
|
||||
|
||||
#if defined(BINCUE)
|
||||
bool is_bincue; // Flag: BIN CUE file
|
||||
void *bincue_fd;
|
||||
file_handle() {is_bincue = false;} // default bincue false
|
||||
#endif
|
||||
};
|
||||
|
||||
// Open file handles
|
||||
|
@ -74,7 +84,7 @@ static char *sector_buffer = NULL;
|
|||
|
||||
// Prototypes
|
||||
static bool is_cdrom_readable(file_handle *fh);
|
||||
|
||||
static DWORD file_offset_read(HANDLE fh, loff_t offset, int count, char *buf);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
|
@ -256,12 +266,42 @@ void SysAddSerialPrefs(void)
|
|||
* Can't give too much however, would be annoying, this is difficult..
|
||||
*/
|
||||
|
||||
static inline int cd_read_with_retry(file_handle *fh, ULONG LBA, int count, char *buf )
|
||||
static inline int cd_read_with_retry(file_handle *fh, ULONG offset, int count, char *buf )
|
||||
{
|
||||
if (!fh || !fh->fh)
|
||||
return 0;
|
||||
|
||||
return CdenableSysReadCdBytes(fh->fh, LBA, count, buf);
|
||||
DWORD bytes_read = CdenableSysReadCdBytes(fh->fh, offset, count, buf);
|
||||
|
||||
if (bytes_read == 0) {
|
||||
// fall back to logical volume handle read in the case where there's no cdenable
|
||||
bytes_read = file_offset_read(fh->fh, offset, count, buf);
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic offset read function for a file or a device that behaves like one
|
||||
*/
|
||||
|
||||
static DWORD file_offset_read(HANDLE fh, loff_t offset, int count, char *buf)
|
||||
{
|
||||
// Seek to position
|
||||
LONG lo = (LONG)offset;
|
||||
LONG hi = (LONG)(offset >> 32);
|
||||
DWORD r = SetFilePointer(fh, lo, &hi, FILE_BEGIN);
|
||||
if (r == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD bytes_read;
|
||||
|
||||
// Read data
|
||||
if (ReadFile(fh, buf, count, &bytes_read, NULL) == 0)
|
||||
bytes_read = 0;
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
static int cd_read(file_handle *fh, cachetype *cptr, ULONG LBA, int count, char *buf)
|
||||
|
@ -406,7 +446,7 @@ static bool is_read_only_path(const TCHAR *name)
|
|||
* Open file/device, create new file handle (returns NULL on error)
|
||||
*/
|
||||
|
||||
void *Sys_open(const char *path_name, bool read_only)
|
||||
void *Sys_open(const char *path_name, bool read_only, bool is_cdrom)
|
||||
{
|
||||
file_handle * fh = NULL;
|
||||
|
||||
|
@ -462,6 +502,11 @@ void *Sys_open(const char *path_name, bool read_only)
|
|||
read_only = true;
|
||||
|
||||
// Open file
|
||||
|
||||
#if defined(BINCUE)
|
||||
void *binfd = open_bincue(name); // check if bincue
|
||||
#endif
|
||||
|
||||
HANDLE h = CreateFile(
|
||||
name,
|
||||
read_only ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
|
||||
|
@ -486,6 +531,16 @@ void *Sys_open(const char *path_name, bool read_only)
|
|||
fh->is_floppy = false;
|
||||
fh->is_cdrom = false;
|
||||
|
||||
#if defined(BINCUE)
|
||||
if (binfd) {
|
||||
fh->bincue_fd = binfd;
|
||||
fh->is_bincue = true;
|
||||
fh->is_media_present = true;
|
||||
sys_add_file_handle(fh);
|
||||
return fh;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Detect disk image file layout
|
||||
loff_t size = GetFileSize(h, NULL);
|
||||
DWORD bytes_read;
|
||||
|
@ -517,6 +572,11 @@ void Sys_close(void *arg)
|
|||
|
||||
sys_remove_file_handle(fh);
|
||||
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
close_bincue(fh->bincue_fd);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
cache_final(&fh->cache);
|
||||
SysAllowRemoval((void *)fh);
|
||||
|
@ -543,19 +603,15 @@ size_t Sys_read(void *arg, void *buffer, loff_t offset, size_t length)
|
|||
if (!fh)
|
||||
return 0;
|
||||
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return read_bincue(fh->bincue_fd, buffer, offset, length);
|
||||
#endif
|
||||
|
||||
DWORD bytes_read = 0;
|
||||
|
||||
if (fh->is_file) {
|
||||
// Seek to position
|
||||
LONG lo = (LONG)offset;
|
||||
LONG hi = (LONG)(offset >> 32);
|
||||
DWORD r = SetFilePointer(fh->fh, lo, &hi, FILE_BEGIN);
|
||||
if (r == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
|
||||
return 0;
|
||||
|
||||
// Read data
|
||||
if (ReadFile(fh->fh, buffer, length, &bytes_read, NULL) == 0)
|
||||
bytes_read = 0;
|
||||
bytes_read = file_offset_read(fh->fh, offset, length, (char *)buffer);
|
||||
}
|
||||
else if (fh->is_cdrom) {
|
||||
int bytes_left, try_bytes, got_bytes;
|
||||
|
@ -623,6 +679,11 @@ loff_t SysGetFileSize(void *arg)
|
|||
if (!fh)
|
||||
return true;
|
||||
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return size_bincue(fh->bincue_fd);
|
||||
#endif
|
||||
|
||||
if (fh->is_file)
|
||||
return fh->file_size;
|
||||
else if (fh->is_cdrom)
|
||||
|
@ -644,6 +705,13 @@ void SysEject(void *arg)
|
|||
if (!fh)
|
||||
return;
|
||||
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue) {
|
||||
fh->is_media_present = false;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom && fh->fh) {
|
||||
fh->is_media_present = false;
|
||||
// Commented out because there was some problems, but can't remember
|
||||
|
@ -782,16 +850,26 @@ void SysAllowRemoval(void *arg)
|
|||
bool SysCDReadTOC(void *arg, uint8 *toc)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
DWORD dummy;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_READ_TOC,
|
||||
NULL, 0,
|
||||
toc, min((int)sizeof(CDROM_TOC), 804),
|
||||
&dummy,
|
||||
NULL) != FALSE;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return readtoc_bincue(fh->bincue_fd, toc);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
|
||||
DWORD dummy;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_READ_TOC,
|
||||
NULL, 0,
|
||||
toc, min((int)sizeof(CDROM_TOC), 804),
|
||||
&dummy,
|
||||
NULL) != FALSE;
|
||||
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -802,26 +880,34 @@ bool SysCDReadTOC(void *arg, uint8 *toc)
|
|||
bool SysCDGetPosition(void *arg, uint8 *pos)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
SUB_Q_CHANNEL_DATA q_data;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return GetPosition_bincue(fh->bincue_fd, pos);
|
||||
#endif
|
||||
|
||||
CDROM_SUB_Q_DATA_FORMAT q_format;
|
||||
q_format.Format = IOCTL_CDROM_CURRENT_POSITION;
|
||||
q_format.Track = 0; // used only by ISRC reads
|
||||
if (fh->is_cdrom) {
|
||||
SUB_Q_CHANNEL_DATA q_data;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
bool ok = DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_READ_Q_CHANNEL,
|
||||
&q_format, sizeof(CDROM_SUB_Q_DATA_FORMAT),
|
||||
&q_data, sizeof(SUB_Q_CHANNEL_DATA),
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
if (ok)
|
||||
memcpy(pos, &q_data.CurrentPosition, sizeof(SUB_Q_CURRENT_POSITION));
|
||||
CDROM_SUB_Q_DATA_FORMAT q_format;
|
||||
q_format.Format = IOCTL_CDROM_CURRENT_POSITION;
|
||||
q_format.Track = 0; // used only by ISRC reads
|
||||
|
||||
return ok;
|
||||
DWORD dwBytesReturned = 0;
|
||||
bool ok = DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_READ_Q_CHANNEL,
|
||||
&q_format, sizeof(CDROM_SUB_Q_DATA_FORMAT),
|
||||
&q_data, sizeof(SUB_Q_CHANNEL_DATA),
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
if (ok)
|
||||
memcpy(pos, &q_data.CurrentPosition, sizeof(SUB_Q_CURRENT_POSITION));
|
||||
|
||||
return ok;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -832,24 +918,32 @@ bool SysCDGetPosition(void *arg, uint8 *pos)
|
|||
bool SysCDPlay(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, uint8 end_m, uint8 end_s, uint8 end_f)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
CDROM_PLAY_AUDIO_MSF msf;
|
||||
msf.StartingM = start_m;
|
||||
msf.StartingS = start_s;
|
||||
msf.StartingF = start_f;
|
||||
msf.EndingM = end_m;
|
||||
msf.EndingS = end_s;
|
||||
msf.EndingF = end_f;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return CDPlay_bincue(fh->bincue_fd, start_m, start_s, start_f, end_m, end_s, end_f);
|
||||
#endif
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_PLAY_AUDIO_MSF,
|
||||
&msf, sizeof(CDROM_PLAY_AUDIO_MSF),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
if (fh->is_cdrom) {
|
||||
CDROM_PLAY_AUDIO_MSF msf;
|
||||
msf.StartingM = start_m;
|
||||
msf.StartingS = start_s;
|
||||
msf.StartingF = start_f;
|
||||
msf.EndingM = end_m;
|
||||
msf.EndingS = end_s;
|
||||
msf.EndingF = end_f;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_PLAY_AUDIO_MSF,
|
||||
&msf, sizeof(CDROM_PLAY_AUDIO_MSF),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -860,16 +954,24 @@ bool SysCDPlay(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, uint8 end
|
|||
bool SysCDPause(void *arg)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_PAUSE_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return CDPause_bincue(fh->bincue_fd);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_PAUSE_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -880,15 +982,23 @@ bool SysCDPause(void *arg)
|
|||
bool SysCDResume(void *arg)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_RESUME_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned, NULL) != FALSE;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return CDResume_bincue(fh->bincue_fd);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_RESUME_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned, NULL) != FALSE;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -899,16 +1009,24 @@ bool SysCDResume(void *arg)
|
|||
bool SysCDStop(void *arg, uint8 lead_out_m, uint8 lead_out_s, uint8 lead_out_f)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_STOP_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return CDStop_bincue(fh->bincue_fd);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_STOP_AUDIO,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -919,21 +1037,30 @@ bool SysCDStop(void *arg, uint8 lead_out_m, uint8 lead_out_s, uint8 lead_out_f)
|
|||
bool SysCDScan(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, bool reverse)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return false;
|
||||
|
||||
CDROM_SEEK_AUDIO_MSF msf;
|
||||
msf.M = start_m;
|
||||
msf.S = start_s;
|
||||
msf.F = start_f;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
return CDScan_bincue(fh->bincue_fd,start_m,start_s,start_f,reverse);
|
||||
#endif
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_SEEK_AUDIO_MSF,
|
||||
&msf, sizeof(CDROM_SEEK_AUDIO_MSF),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
if (fh->is_cdrom) {
|
||||
|
||||
CDROM_SEEK_AUDIO_MSF msf;
|
||||
msf.M = start_m;
|
||||
msf.S = start_s;
|
||||
msf.F = start_f;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
return DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_SEEK_AUDIO_MSF,
|
||||
&msf, sizeof(CDROM_SEEK_AUDIO_MSF),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL) != FALSE;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -944,22 +1071,30 @@ bool SysCDScan(void *arg, uint8 start_m, uint8 start_s, uint8 start_f, bool reve
|
|||
void SysCDSetVolume(void *arg, uint8 left, uint8 right)
|
||||
{
|
||||
file_handle *fh = (file_handle *)arg;
|
||||
if (!fh || !fh->fh || !fh->is_cdrom)
|
||||
if (!fh)
|
||||
return;
|
||||
|
||||
VOLUME_CONTROL vc;
|
||||
vc.PortVolume[0] = left;
|
||||
vc.PortVolume[1] = right;
|
||||
vc.PortVolume[2] = left;
|
||||
vc.PortVolume[3] = right;
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
CDSetVol_bincue(fh->bincue_fd,left,right);
|
||||
#endif
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_SET_VOLUME,
|
||||
&vc, sizeof(VOLUME_CONTROL),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL);
|
||||
if (fh->is_cdrom) {
|
||||
|
||||
VOLUME_CONTROL vc;
|
||||
vc.PortVolume[0] = left;
|
||||
vc.PortVolume[1] = right;
|
||||
vc.PortVolume[2] = left;
|
||||
vc.PortVolume[3] = right;
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_SET_VOLUME,
|
||||
&vc, sizeof(VOLUME_CONTROL),
|
||||
NULL, 0,
|
||||
&dwBytesReturned,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -974,21 +1109,27 @@ void SysCDGetVolume(void *arg, uint8 &left, uint8 &right)
|
|||
return;
|
||||
|
||||
left = right = 0;
|
||||
if (!fh->fh || !fh->is_cdrom)
|
||||
return;
|
||||
|
||||
VOLUME_CONTROL vc;
|
||||
memset(&vc, 0, sizeof(vc));
|
||||
#if defined(BINCUE)
|
||||
if (fh->is_bincue)
|
||||
CDGetVol_bincue(fh->bincue_fd,&left,&right);
|
||||
#endif
|
||||
|
||||
if (fh->is_cdrom) {
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
if (DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_GET_VOLUME,
|
||||
NULL, 0,
|
||||
&vc, sizeof(VOLUME_CONTROL),
|
||||
&dwBytesReturned,
|
||||
NULL))
|
||||
{
|
||||
left = vc.PortVolume[0];
|
||||
right = vc.PortVolume[1];
|
||||
VOLUME_CONTROL vc;
|
||||
memset(&vc, 0, sizeof(vc));
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
if (DeviceIoControl(fh->fh,
|
||||
IOCTL_CDROM_GET_VOLUME,
|
||||
NULL, 0,
|
||||
&vc, sizeof(VOLUME_CONTROL),
|
||||
&dwBytesReturned,
|
||||
NULL))
|
||||
{
|
||||
left = vc.PortVolume[0];
|
||||
right = vc.PortVolume[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
#ifndef SYSDEPS_H
|
||||
#define SYSDEPS_H
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define _UNICODE
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#if !defined _MSC_VER && !defined __STDC__
|
||||
#error "Your compiler is not ANSI. Get a real one."
|
||||
#endif
|
||||
|
@ -33,9 +28,9 @@
|
|||
#include "config.h"
|
||||
#include "user_strings_windows.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
#error "You don't have ANSI C header files."
|
||||
#endif
|
||||
//#ifndef STDC_HEADERS
|
||||
//#error "You don't have ANSI C header files."
|
||||
//#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define WIN32
|
||||
|
|
|
@ -56,6 +56,7 @@ user_string_def platform_strings[] = {
|
|||
{STR_INPUT_PANE_TITLE, "Keyboard/Mouse"},
|
||||
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
||||
{STR_KEYCODE_FILE_CTRL, "Keycode Translation File"},
|
||||
{STR_RESERVE_WINDOWS_KEY_CTRL, "Reserve Windows Key"},
|
||||
{STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"},
|
||||
{STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"},
|
||||
{STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"},
|
||||
|
|
|
@ -58,6 +58,7 @@ enum {
|
|||
STR_INPUT_PANE_TITLE,
|
||||
STR_KEYCODES_CTRL,
|
||||
STR_KEYCODE_FILE_CTRL,
|
||||
STR_RESERVE_WINDOWS_KEY_CTRL,
|
||||
STR_MOUSEWHEELMODE_CTRL,
|
||||
STR_MOUSEWHEELMODE_PAGE_LAB,
|
||||
STR_MOUSEWHEELMODE_CURSOR_LAB,
|
||||
|
|
|
@ -401,7 +401,7 @@ const TCHAR *ether_guid_to_name(const TCHAR *guid)
|
|||
|
||||
#define ADAPTER_KEY TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
|
||||
|
||||
const _TCHAR * tap_component_ids[] = { TEXT("tap0801"), TEXT("tap0901"), 0 };
|
||||
const _TCHAR * tap_component_ids[] = { TEXT("root\\tap0801"), TEXT("root\\tap0901"), 0 };
|
||||
|
||||
const TCHAR *ether_tap_devices(void)
|
||||
{
|
||||
|
|
|
@ -353,7 +353,6 @@ void ADBInterrupt(void)
|
|||
int my = mouse_y;
|
||||
if (relative_mouse)
|
||||
mouse_x = mouse_y = 0;
|
||||
bool mb[3] = {mouse_button[0], mouse_button[1], mouse_button[2]};
|
||||
B2_unlock_mutex(mouse_lock);
|
||||
|
||||
uint32 key_base = adb_base + 4;
|
||||
|
|
|
@ -53,6 +53,9 @@ static int open_count = 0; // Open/close nesting count
|
|||
|
||||
bool AudioAvailable = false; // Flag: audio output available (from the software point of view)
|
||||
|
||||
int SoundInSource = 2;
|
||||
int SoundInPlaythrough = 7;
|
||||
int SoundInGain = 65536; // FIXED 4-byte from 0.5 to 1.5; this is middle value (1) as int
|
||||
|
||||
/*
|
||||
* Reset audio emulation
|
||||
|
@ -408,8 +411,8 @@ adat_error: printf("FATAL: audio component data block initialization error\n");
|
|||
// Close Apple Mixer
|
||||
r.a[0] = AudioStatus.mixer;
|
||||
Execute68k(audio_data + adatCloseMixer, &r);
|
||||
D(bug(" CloseMixer() returns %08lx, mixer %08lx\n", r.d[0], AudioStatus.mixer));
|
||||
AudioStatus.mixer = 0;
|
||||
return r.d[0];
|
||||
}
|
||||
r.a[0] = audio_data;
|
||||
Execute68kTrap(0xa01f, &r); // DisposePtr()
|
||||
|
@ -603,6 +606,25 @@ int16 SoundInControl(uint32 pb, uint32 dce)
|
|||
return noErr;
|
||||
}
|
||||
|
||||
case siInputSource: {
|
||||
SoundInSource = ReadMacInt16(pb + csParam + 4);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siPlayThruOnOff: {
|
||||
SoundInPlaythrough = ReadMacInt16(pb + csParam + 4);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siOptionsDialog: {
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siInputGain: {
|
||||
SoundInGain = ReadMacInt32(pb + csParam + 4);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
default:
|
||||
return -231; // siUnknownInfoType
|
||||
}
|
||||
|
@ -622,12 +644,11 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame
|
|||
|
||||
// two choices on return
|
||||
// 1: if under 18 bytes, place # of bytes at (pb+csParam) and write from (pb+csParam+4) on
|
||||
// 2: if over 18 bytes, place 0 at (pb+csParam) and directly write into buffer pointed to by bufferptr
|
||||
// 2: if over 18 bytes, place 0 at (pb+csParam) and directly write into address pointed to by (pb+csParam+4)
|
||||
uint32 selector = ReadMacInt32(pb + csParam); // 4-byte selector (should match via FOURCC above)
|
||||
uint32 bufferptr = ReadMacInt32(pb + csParam + 4); // 4-byte address to the buffer in vm memory
|
||||
|
||||
switch (selector) {
|
||||
//#if 0
|
||||
case siDeviceName: { // return name in STR255 format
|
||||
const uint8 str[] = { // size 9
|
||||
0x08, // 1-byte length
|
||||
|
@ -636,16 +657,35 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame
|
|||
0x74, 0x2d, // t-
|
||||
0x69, 0x6e // in
|
||||
};
|
||||
WriteMacInt32(pb + csParam, 0); // response will directly be written into buffer
|
||||
// vm_memcpy(bufferptr, str, 9);
|
||||
memcpy(Mac2HostAddr(bufferptr),str,9);
|
||||
// const uint8 str[] = { // size 12
|
||||
// 0x0b, // 1-byte length
|
||||
// 0x53, 0x68, // Sh
|
||||
// 0x65, 0x65, // ee
|
||||
// 0x70, 0x73, // ps
|
||||
// 0x68, 0x61, // ha
|
||||
// 0x76, 0x65, // ve
|
||||
// 0x72 // r
|
||||
// };
|
||||
WriteMacInt32(pb + csParam, 0); // response will be written directly into buffer
|
||||
Host2Mac_memcpy(bufferptr, str, sizeof(str));
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siDeviceIcon: {
|
||||
// Borrow ICN resource from cd rom driver, just a hack since loading a true ICN would be better
|
||||
// todo: add soundin ICN, borrow from CD ROM for now
|
||||
WriteMacInt32(pb + csParam, 0);
|
||||
WriteMacInt32(bufferptr, CDROMIconAddr);
|
||||
|
||||
M68kRegisters r;
|
||||
r.d[0] = sizeof(CDROMIcon);
|
||||
Execute68kTrap(0xa122, &r); // NewHandle()
|
||||
uint32 h = r.a[0];
|
||||
if (h == 0)
|
||||
return memFullErr;
|
||||
WriteMacInt32(bufferptr, h);
|
||||
uint32 sp = ReadMacInt32(h);
|
||||
Host2Mac_memcpy(sp, CDROMIcon, sizeof(CDROMIcon));
|
||||
|
||||
return noErr;
|
||||
|
||||
// 68k code causes crash in sheep and link error in basilisk
|
||||
|
@ -682,54 +722,100 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame
|
|||
}
|
||||
|
||||
case siInputSource: {
|
||||
// return -231 if only 1 or index if more
|
||||
return -231;
|
||||
|
||||
// WriteMacInt32(pb + csParam, 4);
|
||||
// WriteMacInt32(pb + csParam + 4, 1); // index 1
|
||||
// return noErr;
|
||||
// return -231 if only 1 or index of current source if more
|
||||
|
||||
WriteMacInt32(pb + csParam, 2);
|
||||
WriteMacInt16(pb + csParam + 4, SoundInSource); // index of selected source
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siInputSourceNames: { // list of sources in STR# resource format
|
||||
case siInputSourceNames: {
|
||||
// return -231 if only 1 or handle to STR# resource if more
|
||||
return -231;
|
||||
|
||||
// const uint8 str[] = {
|
||||
// 0x00, 0x02, // 2-byte count of #strings
|
||||
// 0x0b, // byte size indicator (up to 255 length supported)
|
||||
// 0x49, 0x6e, // start of string in ASCII, In
|
||||
// 0x74, 0x65, // te
|
||||
// 0x72, 0x6e, // rn
|
||||
// 0x61, 0x6c, // al
|
||||
// 0x20, 0x43, // C
|
||||
// 0x44, // D
|
||||
// 0x0a, // size is 10
|
||||
// 0x4d, 0x69, // Mi
|
||||
// 0x63, 0x72, // cr
|
||||
// 0x6f, 0x70, // op
|
||||
// 0x68, 0x6f, // ho
|
||||
// 0x6e, 0x65, // ne
|
||||
// };
|
||||
//
|
||||
// WriteMacInt32(pb + csParam, 0);
|
||||
// vm_memcpy(bufferptr, str, 25);
|
||||
// return noErr;
|
||||
const uint8 str[] = {
|
||||
0x00, 0x02, // 2-byte count of #strings
|
||||
// byte size indicator (up to 255 length supported)
|
||||
0x0a, // size is 10
|
||||
0x4d, 0x69, // Mi
|
||||
0x63, 0x72, // cr
|
||||
0x6f, 0x70, // op
|
||||
0x68, 0x6f, // ho
|
||||
0x6e, 0x65, // ne
|
||||
0x0b, // size is 11
|
||||
0x49, 0x6e, // start of string in ASCII, In
|
||||
0x74, 0x65, // te
|
||||
0x72, 0x6e, // rn
|
||||
0x61, 0x6c, // al
|
||||
0x20, 0x43, // C
|
||||
0x44, // D
|
||||
};
|
||||
|
||||
WriteMacInt32(pb + csParam, 0);
|
||||
|
||||
M68kRegisters r;
|
||||
r.d[0] = sizeof(str);
|
||||
Execute68kTrap(0xa122, &r); // NewHandle()
|
||||
uint32 h = r.a[0];
|
||||
if (h == 0)
|
||||
return memFullErr;
|
||||
WriteMacInt32(bufferptr, h);
|
||||
uint32 sp = ReadMacInt32(h);
|
||||
Host2Mac_memcpy(sp, str, sizeof(str));
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siOptionsDialog: {
|
||||
// 0 if no options box supported and 1 if so
|
||||
WriteMacInt32(pb + csParam, 4);
|
||||
WriteMacInt32(pb + csParam + 4, 0);
|
||||
WriteMacInt32(pb + csParam, 2); // response not in buffer, need to copy integer
|
||||
WriteMacInt16(pb + csParam + 4, 1); // Integer data type
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siPlayThruOnOff: {
|
||||
// playthrough volume, 0 is off and 7 is max
|
||||
WriteMacInt32(pb + csParam, 4);
|
||||
WriteMacInt32(pb + csParam + 4, 0);
|
||||
WriteMacInt32(pb + csParam, 2);
|
||||
WriteMacInt16(pb + csParam + 4, SoundInPlaythrough);
|
||||
return noErr;
|
||||
}
|
||||
//#endif
|
||||
|
||||
case siNumberChannels: {
|
||||
// 1 is mono and 2 is stereo
|
||||
WriteMacInt32(pb + csParam, 2);
|
||||
WriteMacInt16(pb + csParam + 4, 2);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siSampleRate: {
|
||||
WriteMacInt32(pb + csParam, 0);
|
||||
WriteMacInt32(bufferptr, 0xac440000); // 44100.00000 Hz, of Fixed data type
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siSampleRateAvailable: {
|
||||
WriteMacInt32(pb + csParam, 0);
|
||||
|
||||
M68kRegisters r;
|
||||
r.d[0] = 4;
|
||||
Execute68kTrap(0xa122, &r); // NewHandle()
|
||||
uint32 h = r.a[0];
|
||||
if (h == 0)
|
||||
return memFullErr;
|
||||
WriteMacInt16(bufferptr, 1); // 1 sample rate available
|
||||
WriteMacInt32(bufferptr + 2, h); // handle to sample rate list
|
||||
uint32 sp = ReadMacInt32(h);
|
||||
WriteMacInt32(sp, 0xac440000); // 44100.00000 Hz, of Fixed data type
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case siInputGain: {
|
||||
WriteMacInt32(pb + csParam, 4);
|
||||
WriteMacInt32(pb + csParam + 4, SoundInGain);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
return -231; // siUnknownInfoType
|
||||
}
|
||||
|
|
|
@ -53,7 +53,12 @@ static int bincue_core_audio_callback(void);
|
|||
#include <SDL_audio.h>
|
||||
#endif
|
||||
|
||||
#include "bincue_unix.h"
|
||||
#ifdef WIN32
|
||||
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
|
||||
#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
|
||||
#endif
|
||||
|
||||
#include "bincue.h"
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
|
@ -108,7 +113,7 @@ typedef struct {
|
|||
int header_size; // Number of bytes used in header
|
||||
} CueSheet;
|
||||
|
||||
typedef struct {
|
||||
typedef struct CDPlayer {
|
||||
CueSheet *cs; // cue sheet to play from
|
||||
int audiofh; // file handle for audio data
|
||||
unsigned int audioposition; // current position from audiostart (bytes)
|
||||
|
@ -149,6 +154,8 @@ static uint8 silence_byte;
|
|||
|
||||
std::vector<CDPlayer*> players;
|
||||
|
||||
CDPlayer* currently_playing = NULL;
|
||||
|
||||
CDPlayer* CSToPlayer(CueSheet* cs)
|
||||
{
|
||||
for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
|
||||
|
@ -256,6 +263,11 @@ static bool ParseCueSheet(FILE *fh, CueSheet *cs, const char *cuefile)
|
|||
|
||||
totalPregap = 0;
|
||||
prestart = 0;
|
||||
|
||||
// Use Audio CD settings by default, otherwise data mode will be specified
|
||||
cs->raw_sector_size = 2352;
|
||||
cs->cooked_sector_size = 2352;
|
||||
cs->header_size = 0;
|
||||
|
||||
while (fgets(line, MAXLINE, fh) != NULL) {
|
||||
Track *curr = &cs->tracks[cs->tcnt];
|
||||
|
@ -314,7 +326,7 @@ static bool ParseCueSheet(FILE *fh, CueSheet *cs, const char *cuefile)
|
|||
}
|
||||
curr->number = i_track;
|
||||
|
||||
// parse track type
|
||||
// parse track type and update sector size for data discs if applicable
|
||||
|
||||
field = strtok(NULL, " \t\n\r");
|
||||
if (!strcmp("MODE1/2352", field)) { // red-book CD-ROM standard
|
||||
|
@ -420,8 +432,12 @@ static bool LoadCueSheet(const char *cuefile, CueSheet *cs)
|
|||
if (!ParseCueSheet(fh, cs, cuefile)) goto fail;
|
||||
|
||||
// Open bin file and find length
|
||||
|
||||
if ((binfh = open(cs->binfile,O_RDONLY)) < 0) {
|
||||
#ifdef WIN32
|
||||
binfh = open(cs->binfile,O_RDONLY|O_BINARY);
|
||||
#else
|
||||
binfh = open(cs->binfile,O_RDONLY);
|
||||
#endif
|
||||
if (binfh < 0) {
|
||||
D(bug("Can't read bin file %s\n", cs->binfile));
|
||||
goto fail;
|
||||
}
|
||||
|
@ -506,8 +522,11 @@ void close_bincue(void *fh)
|
|||
if (cs && player) {
|
||||
free(cs);
|
||||
#ifdef USE_SDL_AUDIO
|
||||
#if !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
#define SDL_DestroyAudioStream SDL_FreeAudioStream
|
||||
#endif
|
||||
if (player->stream) // if audiostream has been opened, free it as well
|
||||
free(player->stream);
|
||||
SDL_DestroyAudioStream(player->stream);
|
||||
#endif
|
||||
free(player);
|
||||
}
|
||||
|
@ -670,7 +689,7 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
|
|||
*pos++ = rel.m;
|
||||
*pos++ = rel.s;
|
||||
*pos++ = rel.f;
|
||||
*pos++ = 0;
|
||||
// *pos++ = 0;
|
||||
// D(bug("CDROM position %02d:%02d:%02d track %02d\n", abs.m, abs.s, abs.f, trackno));
|
||||
return true;
|
||||
}
|
||||
|
@ -678,14 +697,25 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CDPause_playing(CDPlayer* player) {
|
||||
if (currently_playing && currently_playing != player) {
|
||||
currently_playing->audiostatus = CDROM_AUDIO_PAUSED;
|
||||
currently_playing = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool CDPause_bincue(void *fh)
|
||||
{
|
||||
CueSheet *cs = (CueSheet *) fh;
|
||||
CDPlayer *player = CSToPlayer(cs);
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_playing(player);
|
||||
|
||||
// doesn't matter if it was playing, just ensure it's now paused
|
||||
player->audiostatus = CDROM_AUDIO_PAUSED;
|
||||
currently_playing = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -697,11 +727,16 @@ bool CDStop_bincue(void *fh)
|
|||
CDPlayer *player = CSToPlayer(cs);
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_playing(player);
|
||||
|
||||
#ifdef OSX_CORE_AUDIO
|
||||
player->soundoutput.stop();
|
||||
#endif
|
||||
if (player->audiostatus != CDROM_AUDIO_INVALID)
|
||||
player->audiostatus = CDROM_AUDIO_NO_STATUS;
|
||||
|
||||
currently_playing = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -713,8 +748,12 @@ bool CDResume_bincue(void *fh)
|
|||
CDPlayer *player = CSToPlayer(cs);
|
||||
|
||||
if (cs && player) {
|
||||
// doesn't matter if it was paused, just ensure it now plays
|
||||
// Pause another player if needed
|
||||
CDPause_playing(player);
|
||||
|
||||
// doesn't matter if it was paused, just ensure this one plays now
|
||||
player->audiostatus = CDROM_AUDIO_PLAY;
|
||||
currently_playing = player;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -727,10 +766,13 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
|||
CDPlayer *player = CSToPlayer(cs);
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_playing(player);
|
||||
|
||||
int track;
|
||||
MSF msf;
|
||||
|
||||
#ifdef USE_SDL_AUDIO
|
||||
#if defined(USE_SDL_AUDIO) && !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_LockAudio();
|
||||
#endif
|
||||
|
||||
|
@ -775,7 +817,7 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
|||
else
|
||||
D(bug("CDPlay_bincue: play beyond last track !\n"));
|
||||
|
||||
#ifdef USE_SDL_AUDIO
|
||||
#if defined(USE_SDL_AUDIO) && !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_UnlockAudio();
|
||||
#endif
|
||||
|
||||
|
@ -787,6 +829,7 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
|||
// should be from current track !
|
||||
player->soundoutput.start(16, 2, 44100);
|
||||
#endif
|
||||
currently_playing = player;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -881,7 +924,6 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player)
|
|||
player->audioposition += remaining_silence;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
int available = ((player->audioend - player->audiostart) *
|
||||
player->cs->raw_sector_size) - player->audioposition;
|
||||
if (available > (stream_len - offset))
|
||||
|
@ -897,6 +939,7 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player)
|
|||
available = 0;
|
||||
}
|
||||
|
||||
ssize_t ret = 0;
|
||||
if ((ret = read(player->audiofh, &buf[offset], available)) >= 0) {
|
||||
player->audioposition += ret;
|
||||
offset += ret;
|
||||
|
@ -917,12 +960,23 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player)
|
|||
#ifdef USE_SDL_AUDIO
|
||||
void MixAudio_bincue(uint8 *stream, int stream_len, int volume)
|
||||
{
|
||||
for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
|
||||
{
|
||||
CDPlayer *player = *it;
|
||||
if (currently_playing) {
|
||||
|
||||
if (player->audio_enabled && (player->audiostatus == CDROM_AUDIO_PLAY)) {
|
||||
CDPlayer *player = currently_playing;
|
||||
|
||||
if (player->audiostatus == CDROM_AUDIO_PLAY) {
|
||||
uint8 *buf = fill_buffer(stream_len, player);
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
if (buf)
|
||||
SDL_PutAudioStreamData(player->stream, buf, stream_len);
|
||||
int avail = SDL_GetAudioStreamAvailable(player->stream);
|
||||
if (avail >= stream_len) {
|
||||
extern SDL_AudioSpec audio_spec;
|
||||
uint8 converted[stream_len];
|
||||
SDL_GetAudioStreamData(player->stream, converted, stream_len);
|
||||
SDL_MixAudioFormat(stream, converted, audio_spec.format, stream_len, player->volume_mono);
|
||||
}
|
||||
#else
|
||||
if (buf)
|
||||
SDL_AudioStreamPut(player->stream, buf, stream_len);
|
||||
int avail = SDL_AudioStreamAvailable(player->stream);
|
||||
|
@ -931,7 +985,9 @@ void MixAudio_bincue(uint8 *stream, int stream_len, int volume)
|
|||
SDL_AudioStreamGet(player->stream, converted, stream_len);
|
||||
SDL_MixAudio(stream, converted, stream_len, player->volume_mono);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -948,7 +1004,12 @@ void OpenAudio_bincue(int freq, int format, int channels, uint8 silence, int vol
|
|||
// set player volume based on SDL volume
|
||||
player->volume_left = player->volume_right = player->volume_mono = volume;
|
||||
// audio stream handles converting cd audio to destination output
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
SDL_AudioSpec src = { SDL_AUDIO_S16LE, 2, 44100 }, dst = { (SDL_AudioFormat)format, channels, freq };
|
||||
player->stream = SDL_CreateAudioStream(&src, &dst);
|
||||
#else
|
||||
player->stream = SDL_NewAudioStream(AUDIO_S16LSB, 2, 44100, format, channels, freq);
|
||||
#endif
|
||||
if (player->stream == NULL) {
|
||||
D(bug("Failed to open CD player audio stream using SDL!"));
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#ifndef NO_STD_NAMESPACE
|
||||
using std::vector;
|
||||
|
@ -124,8 +125,8 @@ static const uint8 bcd2bin[256] = {
|
|||
|
||||
// Struct for each drive
|
||||
struct cdrom_drive_info {
|
||||
cdrom_drive_info() : num(0), fh(NULL), start_byte(0), status(0) {}
|
||||
cdrom_drive_info(void *fh_) : num(0), fh(fh_), start_byte(0), status(0) {}
|
||||
cdrom_drive_info() : num(0), fh(NULL), start_byte(0), status(0), drop(false) {}
|
||||
cdrom_drive_info(void *fh_) : num(0), fh(fh_), start_byte(0), status(0), drop(false) {}
|
||||
|
||||
void close_fh(void) { SysAllowRemoval(fh); Sys_close(fh); }
|
||||
|
||||
|
@ -147,6 +148,7 @@ struct cdrom_drive_info {
|
|||
bool repeat; // Repeat flag
|
||||
uint8 power_mode; // Power mode
|
||||
uint32 status; // Mac address of drive status record
|
||||
bool drop;
|
||||
};
|
||||
|
||||
// List of drives handled by this driver
|
||||
|
@ -161,6 +163,7 @@ uint32 CDROMIconAddr;
|
|||
// Flag: Control(accRun) has been called, interrupt routine is now active
|
||||
static bool acc_run_called = false;
|
||||
|
||||
static std::map<int, void *> remount_map;
|
||||
|
||||
/*
|
||||
* Get pointer to drive info or drives.end() if not found
|
||||
|
@ -203,8 +206,10 @@ static void find_hfs_partition(cdrom_drive_info &info)
|
|||
// Partition map block found, Apple HFS partition?
|
||||
if (strcmp((char *)(map + 48), "Apple_HFS") == 0) {
|
||||
info.start_byte = (loff_t)((map[8] << 24) | (map[9] << 16) | (map[10] << 8) | map[11]) << 9;
|
||||
#if DEBUG
|
||||
uint32 num_blocks = (map[12] << 24) | (map[13] << 16) | (map[14] << 8) | map[15];
|
||||
D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, num_blocks));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -234,6 +239,11 @@ static void read_toc(cdrom_drive_info &info)
|
|||
}
|
||||
#endif
|
||||
|
||||
// Default start
|
||||
info.start_at[0] = 0;
|
||||
info.start_at[1] = 0;
|
||||
info.start_at[2] = 0;
|
||||
|
||||
// Find lead-out track
|
||||
info.lead_out[0] = 0;
|
||||
info.lead_out[1] = 0;
|
||||
|
@ -294,19 +304,15 @@ static bool position2msf(const cdrom_drive_info &info, uint16 postype, uint32 po
|
|||
|
||||
void CDROMInit(void)
|
||||
{
|
||||
// No drives specified in prefs? Then add defaults
|
||||
if (PrefsFindString("cdrom", 0) == NULL) {
|
||||
SysAddCDROMPrefs();
|
||||
}
|
||||
else {
|
||||
// Add drives specified in preferences
|
||||
int index = 0;
|
||||
const char *str;
|
||||
while ((str = PrefsFindString("cdrom", index++)) != NULL) {
|
||||
void *fh = Sys_open(str, true);
|
||||
if (fh)
|
||||
drives.push_back(cdrom_drive_info(fh));
|
||||
}
|
||||
SysAddCDROMPrefs();
|
||||
|
||||
// Add drives specified in preferences
|
||||
int index = 0;
|
||||
const char *str;
|
||||
while ((str = PrefsFindString("cdrom", index++)) != NULL) {
|
||||
void *fh = Sys_open(str, true, true);
|
||||
if (fh)
|
||||
drives.push_back(cdrom_drive_info(fh));
|
||||
}
|
||||
|
||||
if (!drives.empty()) { // set to first drive by default
|
||||
|
@ -317,6 +323,16 @@ void CDROMInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
void CDROMDrop(const char *path) {
|
||||
if (!drives.empty()) {
|
||||
cdrom_drive_info &info = drives.back();
|
||||
if (!info.drop) {
|
||||
info.fh = Sys_open(path, true, true);
|
||||
if (info.fh)
|
||||
info.drop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Deinitialization
|
||||
|
@ -354,6 +370,17 @@ bool CDROMMountVolume(void *fh)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CDROMRemount() {
|
||||
for (std::map<int, void *>::iterator i = remount_map.begin(); i != remount_map.end(); ++i)
|
||||
for (drive_vec::iterator info = drives.begin(); info != drives.end(); ++info)
|
||||
if (info->num == i->first) {
|
||||
last_drive_num = i->first;
|
||||
info->fh = i->second;
|
||||
break;
|
||||
}
|
||||
remount_map.clear();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Mount volumes for which the to_be_mounted flag is set
|
||||
|
@ -410,6 +437,8 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
|
|||
info->block_size = 512;
|
||||
info->twok_offset = -1;
|
||||
info->play_mode = 0x09;
|
||||
info->play_order = 0;
|
||||
info->repeat = 0;
|
||||
info->power_mode = 0;
|
||||
|
||||
// Allocate drive status record
|
||||
|
@ -442,6 +471,9 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
|
|||
Execute68kTrap(0xa04e, &r); // AddDrive()
|
||||
}
|
||||
}
|
||||
|
||||
CDROMOpenDone();
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
@ -532,6 +564,7 @@ int16 CDROMControl(uint32 pb, uint32 dce)
|
|||
// Audio calls tend to end up without correct reference
|
||||
// Real mac would just play first disc, but we can guess correct one from last data call
|
||||
info = get_drive_info(last_drive_num);
|
||||
if (info == drives.end()) return nsDrvErr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,10 +581,16 @@ int16 CDROMControl(uint32 pb, uint32 dce)
|
|||
|
||||
case 7: // EjectTheDisc
|
||||
if (ReadMacInt8(info->status + dsDiskInPlace) > 0) {
|
||||
SysAllowRemoval(info->fh);
|
||||
SysEject(info->fh);
|
||||
if (info->drop) {
|
||||
SysAllowRemoval(info->fh);
|
||||
SysEject(info->fh);
|
||||
info->twok_offset = -1;
|
||||
info->close_fh();
|
||||
info->drop = false;
|
||||
}
|
||||
else remount_map.insert(std::make_pair(ReadMacInt16(pb + ioVRefNum), info->fh));
|
||||
info->fh = NULL;
|
||||
WriteMacInt8(info->status + dsDiskInPlace, 0);
|
||||
info->twok_offset = -1;
|
||||
return noErr;
|
||||
} else {
|
||||
return offLinErr;
|
||||
|
@ -1064,6 +1103,7 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
|
|||
return nsDrvErr;
|
||||
} else {
|
||||
info = get_drive_info(last_drive_num);
|
||||
if (info == drives.end()) return nsDrvErr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
extern bool tick_inhibit;
|
||||
|
||||
void PlayStartupSound();
|
||||
|
||||
/*
|
||||
* Execute EMUL_OP opcode (called by 68k emulator or Illegal Instruction trap handler)
|
||||
|
@ -83,10 +86,14 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||
|
||||
case M68K_EMUL_OP_RESET: { // MacOS reset
|
||||
D(bug("*** RESET ***\n"));
|
||||
tick_inhibit = true;
|
||||
CDROMRemount(); // for System 7.x
|
||||
TimerReset();
|
||||
EtherReset();
|
||||
AudioReset();
|
||||
|
||||
#ifdef USE_SDL_AUDIO
|
||||
PlayStartupSound();
|
||||
#endif
|
||||
// Create BootGlobs at top of memory
|
||||
Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096);
|
||||
uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c;
|
||||
|
@ -107,6 +114,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||
r->a[1] = ROMBaseMac + UniversalInfo; // UniversalInfo
|
||||
r->a[6] = boot_globs; // BootGlobs
|
||||
r->a[7] = RAMBaseMac + 0x10000; // Boot stack
|
||||
tick_inhibit = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -114,7 +122,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||
bool is_read = (r->d[1] & 0x80) != 0;
|
||||
if ((r->d[1] & 0x78) == 0x38) {
|
||||
// XPRAM
|
||||
uint8 reg = (r->d[1] << 5) & 0xe0 | (r->d[1] >> 10) & 0x1f;
|
||||
uint8 reg = ((r->d[1] << 5) & 0xe0) | ((r->d[1] >> 10) & 0x1f);
|
||||
if (is_read) {
|
||||
r->d[2] = XPRAM[reg];
|
||||
bool localtalk = !(XPRAM[0xe0] || XPRAM[0xe1]); // LocalTalk enabled?
|
||||
|
@ -453,7 +461,9 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||
if (HasMacStarted()) {
|
||||
|
||||
// Mac has started, execute all 60Hz interrupt functions
|
||||
#if !PRECISE_TIMING
|
||||
TimerInterrupt();
|
||||
#endif
|
||||
VideoInterrupt();
|
||||
|
||||
// Call DoVBLTask(0)
|
||||
|
@ -485,7 +495,12 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||
ClearInterruptFlag(INTFLAG_ETHER);
|
||||
EtherInterrupt();
|
||||
}
|
||||
|
||||
#if PRECISE_TIMING
|
||||
if (InterruptFlags & INTFLAG_TIMER) {
|
||||
ClearInterruptFlag(INTFLAG_TIMER);
|
||||
TimerInterrupt();
|
||||
}
|
||||
#endif
|
||||
if (InterruptFlags & INTFLAG_AUDIO) {
|
||||
ClearInterruptFlag(INTFLAG_AUDIO);
|
||||
AudioInterrupt();
|
||||
|
|
|
@ -82,6 +82,7 @@ const uint32 siDeviceName = FOURCC('n','a','m','e'); // sound input name
|
|||
const uint32 siDeviceIcon = FOURCC('i','c','o','n'); // sound input icon resource location
|
||||
const uint32 siInputSourceNames = FOURCC('s','n','a','m'); // sound input source names
|
||||
const uint32 siInputSource = FOURCC('s','o','u','r'); // sound input source selector
|
||||
const uint32 siInputGain = FOURCC('g','a','i','n'); // sound input gain
|
||||
const uint32 siOptionsDialog = FOURCC('o','p','t','d'); // display options dialog box
|
||||
const uint32 siPlayThruOnOff = FOURCC('p','l','t','h'); // play-through state
|
||||
const uint32 siInitializeDriver = FOURCC('i','n','i','t'); // open sound input device
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* bincue_unix.h -- support for cdrom image files in bin/cue format
|
||||
* bincue.h -- support for cdrom image files in bin/cue format
|
||||
*
|
||||
* (C) 2010 Geoffrey Brown
|
||||
*
|
|
@ -40,4 +40,9 @@ extern int16 CDROMPrime(uint32 pb, uint32 dce);
|
|||
extern int16 CDROMControl(uint32 pb, uint32 dce);
|
||||
extern int16 CDROMStatus(uint32 pb, uint32 dce);
|
||||
|
||||
extern void CDROMOpenDone(void); // Called by CDROMOpen() once drives have been to the drive queue
|
||||
|
||||
void CDROMDrop(const char *path);
|
||||
void CDROMRemount();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,8 +34,15 @@ extern bool TwentyFourBitAddressing;
|
|||
// 68k register structure (for Execute68k())
|
||||
struct M68kRegisters {
|
||||
uint32 d[8];
|
||||
#ifdef UPDATE_UAE
|
||||
memptr a[8];
|
||||
uint16 sr;
|
||||
memptr usp, isp, msp;
|
||||
memptr pc;
|
||||
#else
|
||||
uint32 a[8];
|
||||
uint16 sr;
|
||||
#endif
|
||||
};
|
||||
|
||||
// General functions
|
||||
|
@ -74,6 +81,9 @@ extern uint32 InterruptFlags; // Currently pending interrupts
|
|||
extern void SetInterruptFlag(uint32 flag); // Set/clear interrupt flags
|
||||
extern void ClearInterruptFlag(uint32 flag);
|
||||
|
||||
// vde switch variable
|
||||
extern char* vde_sock;
|
||||
|
||||
// Array length
|
||||
#if __cplusplus >= 201103L || (_MSC_VER >= 1900 && defined __cplusplus)
|
||||
template <typename T, size_t size>
|
||||
|
|
|
@ -48,6 +48,7 @@ extern void PrefsReplaceBool(const char *name, bool b);
|
|||
extern void PrefsReplaceInt32(const char *name, int32 val);
|
||||
|
||||
extern const char *PrefsFindString(const char *name, int index = 0);
|
||||
extern "C" const char *PrefsFindStringC(const char *name, int index = 0);
|
||||
extern bool PrefsFindBool(const char *name);
|
||||
extern int32 PrefsFindInt32(const char *name);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ extern void SysAddSerialPrefs(void);
|
|||
* that is freed by Sys_close().
|
||||
*/
|
||||
|
||||
extern void *Sys_open(const char *name, bool read_only);
|
||||
extern void *Sys_open(const char *name, bool read_only, bool is_cdrom = false);
|
||||
extern void Sys_close(void *fh);
|
||||
extern size_t Sys_read(void *fh, void *buffer, loff_t offset, size_t length);
|
||||
extern size_t Sys_write(void *fh, void *buffer, loff_t offset, size_t length);
|
||||
|
|
|
@ -162,6 +162,12 @@ enum {
|
|||
STR_24_BIT_1600x1200_LAB,
|
||||
STR_SOUND_CTRL,
|
||||
STR_NOSOUND_CTRL,
|
||||
STR_GRAPHICS_SDL_RENDER_DRIVER_CTRL,
|
||||
STR_SOFTWARE_LAB,
|
||||
STR_OPENGL_LAB,
|
||||
STR_DIRECT3D_LAB,
|
||||
STR_GRAPHICS_SDL_VSYNC_CTRL,
|
||||
STR_DEFAULT_LAB,
|
||||
|
||||
STR_SERIAL_NETWORK_PANE_TITLE = 3500, // Serial/Networking pane
|
||||
STR_SERIALA_CTRL,
|
||||
|
@ -212,13 +218,11 @@ enum {
|
|||
|
||||
// Mac window
|
||||
STR_WINDOW_TITLE = 4000,
|
||||
STR_WINDOW_TITLE_FROZEN,
|
||||
STR_WINDOW_TITLE_GRABBED,
|
||||
STR_WINDOW_TITLE_GRABBED0,
|
||||
STR_WINDOW_TITLE_GRABBED_PRE,
|
||||
STR_WINDOW_TITLE_GRABBED1,
|
||||
STR_WINDOW_TITLE_GRABBED2,
|
||||
STR_WINDOW_TITLE_GRABBED3,
|
||||
STR_WINDOW_TITLE_GRABBED4,
|
||||
STR_WINDOW_TITLE_GRABBED_POST,
|
||||
STR_WINDOW_MENU = 4050,
|
||||
STR_WINDOW_ITEM_ABOUT,
|
||||
STR_WINDOW_ITEM_REFRESH,
|
||||
|
|
|
@ -79,13 +79,13 @@ inline video_depth DepthModeForPixelDepth(int depth)
|
|||
// Returns the name of a video_depth, or an empty string if the depth is unknown
|
||||
const char * NameOfDepth(video_depth depth);
|
||||
|
||||
// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width
|
||||
// Return a bytes-per-row value (assuming enough bytes to fit the bits but no further padding) for the specified depth and pixel width
|
||||
inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth)
|
||||
{
|
||||
switch (depth) {
|
||||
case VDEPTH_1BIT: return width / 8;
|
||||
case VDEPTH_2BIT: return width / 4;
|
||||
case VDEPTH_4BIT: return width / 2;
|
||||
case VDEPTH_1BIT: return (width + 7) / 8;
|
||||
case VDEPTH_2BIT: return (width + 3) / 4;
|
||||
case VDEPTH_4BIT: return (width + 1) / 2;
|
||||
case VDEPTH_8BIT: return width;
|
||||
case VDEPTH_16BIT: return width * 2;
|
||||
case VDEPTH_32BIT: return width * 4;
|
||||
|
@ -205,8 +205,8 @@ private:
|
|||
// Set palette to 50% gray
|
||||
void set_gray_palette(void);
|
||||
|
||||
// Load gamma-corrected black-to-white ramp to palette for direct-color mode
|
||||
void load_ramp_palette(void);
|
||||
// Load gamma-corrected black-to-white ramp
|
||||
void load_gamma_ramp(void);
|
||||
|
||||
// Allocate gamma table of specified size
|
||||
bool allocate_gamma_table(int size);
|
||||
|
@ -250,8 +250,10 @@ public:
|
|||
virtual void switch_to_current_mode(void) = 0;
|
||||
|
||||
// Called by the video driver to set the color palette (in indexed modes)
|
||||
// or the gamma table (in direct modes)
|
||||
virtual void set_palette(uint8 *pal, int num) = 0;
|
||||
|
||||
// Called by the video driver to set the gamma table
|
||||
virtual void set_gamma(uint8 *gamma, int num) = 0;
|
||||
};
|
||||
|
||||
// Vector of pointers to available monitor descriptions, filled by VideoInit()
|
||||
|
|
|
@ -202,6 +202,8 @@ bool InitAll(const char *vmdir)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CDROMOpenDone() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Deinitialize everything
|
||||
|
|
|
@ -328,6 +328,11 @@ const char *PrefsFindString(const char *name, int index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
extern "C" const char *PrefsFindStringC(const char *name, int index)
|
||||
{
|
||||
return PrefsFindString(name, index);
|
||||
}
|
||||
|
||||
bool PrefsFindBool(const char *name)
|
||||
{
|
||||
prefs_node *p = find_node(name, TYPE_BOOLEAN, 0);
|
||||
|
|
|
@ -77,6 +77,16 @@ prefs_desc common_prefs_items[] = {
|
|||
{"scale_integer",TYPE_BOOLEAN,false,"integer scaling"},
|
||||
{"yearofs", TYPE_INT32, 0, "year offset"},
|
||||
{"dayofs", TYPE_INT32, 0, "day offset"},
|
||||
{"mag_rate", TYPE_INT32, 0, "rate of magnification"},
|
||||
{"gammaramp", TYPE_STRING, false, "gamma ramp (on, off or fullscreen)"},
|
||||
{"swap_opt_cmd", TYPE_BOOLEAN, false, "swap option and command key"},
|
||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||
{"host_domain", TYPE_STRING, true, "handle DNS requests for this domain on the host (slirp only)"},
|
||||
{"title", TYPE_STRING, false, "window title"},
|
||||
{"sound_buffer", TYPE_INT32, false, "sound buffer length"},
|
||||
{"name_encoding", TYPE_INT32, false, "file name encoding"},
|
||||
{"delay", TYPE_INT32, false, "additional delay [uS] every 64k instructions"},
|
||||
{"init_grab", TYPE_BOOLEAN, false, "initially grabbing mouse"},
|
||||
{NULL, TYPE_END, false, NULL} // End of list
|
||||
};
|
||||
|
||||
|
@ -105,7 +115,7 @@ void AddPrefsDefaults(void)
|
|||
|
||||
#if USE_JIT
|
||||
// JIT compiler specific options
|
||||
PrefsAddBool("jit", true);
|
||||
// PrefsAddBool("jit", true);
|
||||
PrefsAddBool("jitfpu", true);
|
||||
PrefsAddBool("jitdebug", false);
|
||||
PrefsAddInt32("jitcachesize", 8192);
|
||||
|
@ -116,4 +126,11 @@ void AddPrefsDefaults(void)
|
|||
#endif
|
||||
|
||||
PrefsAddInt32("keyboardtype", 5);
|
||||
|
||||
#ifdef __APPLE__
|
||||
PrefsAddBool("swap_opt_cmd", false);
|
||||
#else
|
||||
PrefsAddBool("swap_opt_cmd", true);
|
||||
#endif
|
||||
PrefsAddBool("ignoresegv", true);
|
||||
}
|
||||
|
|
|
@ -695,7 +695,8 @@ static const uint8 adbop_patch[] = { // Call ADBOp() completion procedure
|
|||
0x4e, 0x91, // jsr (a1)
|
||||
0x70, 0x00, // moveq #0,d0
|
||||
0x60, 0x00, 0x00, 0x04, // bra 2
|
||||
0x70, 0xff, //1 moveq #-1,d0
|
||||
// 0x70, 0xff, //1 moveq #-1,d0
|
||||
0x70, 0x00, //1 moveq #0,d0 copy from BasiliskII-build142
|
||||
0x4c, 0xdf, 0x0f, 0x0e, //2 movem.l (sp)+,d1-d3/a0-a3
|
||||
0x46, 0xdf, // move (sp)+,sr
|
||||
0x4e, 0x75 // rts
|
||||
|
|
|
@ -201,12 +201,12 @@ end_error:
|
|||
|
||||
#define ICMP_MAXDATALEN (IP_MSS-28)
|
||||
void
|
||||
icmp_error(msrc, type, code, minsize, message)
|
||||
struct mbuf *msrc;
|
||||
u_char type;
|
||||
u_char code;
|
||||
int minsize;
|
||||
char *message;
|
||||
icmp_error(
|
||||
struct mbuf *msrc,
|
||||
u_char type,
|
||||
u_char code,
|
||||
int minsize,
|
||||
char *message)
|
||||
{
|
||||
unsigned hlen, shlen, s_ip_len;
|
||||
register struct ip *ip;
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <slirp.h>
|
||||
#include "ip_icmp.h"
|
||||
|
||||
static struct ip *ip_reass(register struct ip *ip, register struct ipq *fp);
|
||||
|
||||
int ip_defttl;
|
||||
struct ipstat ipstat;
|
||||
struct ipq ipq;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* terms and conditions of the copyright.
|
||||
*/
|
||||
|
||||
// #include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <slirp.h>
|
||||
|
||||
/* Done as a macro in socket.h */
|
||||
|
|
|
@ -87,7 +87,7 @@ static int get_dns_addr(struct in_addr *pdns_addr)
|
|||
static int get_dns_addr(struct in_addr *pdns_addr)
|
||||
{
|
||||
char buff[512];
|
||||
char buff2[256];
|
||||
char buff2[257];
|
||||
FILE *f;
|
||||
int found = 0;
|
||||
struct in_addr tmp_addr;
|
||||
|
@ -127,12 +127,15 @@ static int get_dns_addr(struct in_addr *pdns_addr)
|
|||
void slirp_cleanup(void)
|
||||
{
|
||||
WSACleanup();
|
||||
unload_host_domains();
|
||||
}
|
||||
#endif
|
||||
|
||||
int slirp_init(void)
|
||||
{
|
||||
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
|
||||
|
||||
load_host_domains();
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
|
|
|
@ -332,8 +332,6 @@ void if_output _P((struct socket *, struct mbuf *));
|
|||
/* ip_input.c */
|
||||
void ip_init _P((void));
|
||||
void ip_input _P((struct mbuf *));
|
||||
static struct ip *
|
||||
ip_reass(register struct ip *ip, register struct ipq *);
|
||||
void ip_freef _P((struct ipq *));
|
||||
void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
|
||||
void ip_deq _P((register struct ipasfrag *));
|
||||
|
@ -370,6 +368,9 @@ int tcp_emu _P((struct socket *, struct mbuf *));
|
|||
int tcp_ctl _P((struct socket *));
|
||||
struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
|
||||
|
||||
void load_host_domains();
|
||||
void unload_host_domains();
|
||||
|
||||
#ifdef USE_PPP
|
||||
#define MIN_MRU MINMRU
|
||||
#define MAX_MRU MAXMRU
|
||||
|
|
|
@ -13,6 +13,106 @@
|
|||
#ifdef __sun__
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define DEBUG_HOST_RESOLVED_DNS 0
|
||||
|
||||
/**
|
||||
* DNS requests for these domain suffixes will be
|
||||
* looked up on the host to allow for host-supported DNS alternatives
|
||||
* (e.g. MDNS, hosts file, etc.)
|
||||
**/
|
||||
static const char ** host_resolved_domain_suffixes = NULL;
|
||||
|
||||
#define HOST_DOMAIN_TTL 60 // In seconds.
|
||||
|
||||
#if DEBUG_HOST_RESOLVED_DNS
|
||||
#define D(...) printf(__VA_ARGS__); fflush(stdout);
|
||||
#else
|
||||
#define D(...)
|
||||
#endif
|
||||
|
||||
const char *PrefsFindStringC(const char *name, int index);
|
||||
|
||||
int prepare_host_domain_suffixes(char * buf) {
|
||||
/**
|
||||
* Set up the list of domain suffixes to match from the host_domain prefs.
|
||||
* Call first with buf NULL to figure out the size of buffer needed.
|
||||
**/
|
||||
int pos = 0;
|
||||
const char ** host_resolved_domain_suffixes_pos = NULL;
|
||||
|
||||
if (buf) {
|
||||
D("Setting up slirp host domain suffixes for matching:\n");
|
||||
host_resolved_domain_suffixes_pos = (const char **) buf;
|
||||
}
|
||||
|
||||
// find out how many values there are
|
||||
int host_domain_count = 0;
|
||||
while (PrefsFindStringC("host_domain", host_domain_count) != NULL) {
|
||||
host_domain_count ++;
|
||||
}
|
||||
|
||||
// leave space for the top array
|
||||
pos += (host_domain_count + 1) * sizeof(const char *);
|
||||
|
||||
const char *str;
|
||||
int host_domain_num = 0;
|
||||
while ((str = PrefsFindStringC("host_domain", host_domain_num++)) != NULL) {
|
||||
if (str[0] == '\0') continue;
|
||||
if (buf) {
|
||||
const char * cur_entry = (const char *) (buf + pos);
|
||||
*host_resolved_domain_suffixes_pos = cur_entry;
|
||||
host_resolved_domain_suffixes_pos++;
|
||||
}
|
||||
|
||||
// this is a suffix to match so it must have a leading dot
|
||||
if (str[0] != '.') {
|
||||
if (buf) buf[pos] = '.';
|
||||
pos++;
|
||||
}
|
||||
const char * str_pos = str;
|
||||
while (*str_pos != '\0') {
|
||||
if (buf) buf[pos] = tolower(*str_pos);
|
||||
++pos;
|
||||
++str_pos;
|
||||
}
|
||||
// domain to be checked will be FQDN so suffix must have a trailing dot
|
||||
if (str[strlen(str) - 1] != '.') {
|
||||
if (buf) buf[pos] = '.';
|
||||
pos++;
|
||||
}
|
||||
if (buf) {
|
||||
buf[pos] = '\0';
|
||||
D(" %d. %s\n", host_domain_num, *(host_resolved_domain_suffixes_pos-1));
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
// end of list marker
|
||||
if (buf) *host_resolved_domain_suffixes_pos = NULL;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void load_host_domains() {
|
||||
const int size = prepare_host_domain_suffixes(NULL);
|
||||
char * buf = malloc(size);
|
||||
if (buf) {
|
||||
const int second_size = prepare_host_domain_suffixes(buf);
|
||||
assert(size == second_size);
|
||||
host_resolved_domain_suffixes = (const char **) buf;
|
||||
}
|
||||
}
|
||||
|
||||
void unload_host_domains() {
|
||||
if (host_resolved_domain_suffixes) {
|
||||
free((char *) host_resolved_domain_suffixes);
|
||||
host_resolved_domain_suffixes = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
so_init()
|
||||
|
@ -482,6 +582,300 @@ sorecvfrom(so)
|
|||
} /* if ping packet */
|
||||
}
|
||||
|
||||
// Commented structs from silv3rm00n's example code
|
||||
// https://www.binarytides.com/dns-query-code-in-c-with-linux-sockets/
|
||||
|
||||
struct DNS_HEADER
|
||||
{
|
||||
unsigned short id; // identification number
|
||||
|
||||
unsigned char rd :1; // recursion desired
|
||||
unsigned char tc :1; // truncated message
|
||||
unsigned char aa :1; // authoritive answer
|
||||
unsigned char opcode :4; // purpose of message
|
||||
unsigned char qr :1; // query/response flag
|
||||
|
||||
unsigned char rcode :4; // response code
|
||||
unsigned char cd :1; // checking disabled
|
||||
unsigned char ad :1; // authenticated data
|
||||
unsigned char z :1; // its z! reserved
|
||||
unsigned char ra :1; // recursion available
|
||||
|
||||
unsigned short q_count; // number of question entries
|
||||
unsigned short ans_count; // number of answer entries
|
||||
unsigned short auth_count; // number of authority entries
|
||||
unsigned short add_count; // number of resource entries
|
||||
};
|
||||
|
||||
struct QUESTION
|
||||
{
|
||||
unsigned short qtype;
|
||||
unsigned short qclass;
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct R_DATA
|
||||
{
|
||||
unsigned short type;
|
||||
unsigned short _class;
|
||||
unsigned int ttl;
|
||||
unsigned short data_len;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/** Create local variable varname of type vartype,
|
||||
* fill it from the buffer data, observing its length len,
|
||||
* and adjust data and len to reflect the remaining data */
|
||||
#define POP_DATA(vartype, varname, data, len) \
|
||||
assert(len >= sizeof(vartype)); \
|
||||
vartype varname; \
|
||||
memcpy(&varname, data, sizeof(vartype)); \
|
||||
data += sizeof(vartype); \
|
||||
len -= sizeof(vartype)
|
||||
|
||||
|
||||
/** Create local const char * varname pointing
|
||||
* to the C string in the buffer data, observing its length len,
|
||||
* and adjust data and len to reflect the remaining data */
|
||||
#define POP_STR(varname, data, len) \
|
||||
const char * varname; \
|
||||
{ \
|
||||
int pop_str_len = strnlen(data, len); \
|
||||
if (pop_str_len == len) { \
|
||||
varname = NULL; \
|
||||
} else { \
|
||||
varname = data; \
|
||||
} \
|
||||
data += pop_str_len + 1; \
|
||||
len -= pop_str_len + 1; \
|
||||
}
|
||||
|
||||
|
||||
static void inject_udp_packet_to_guest(struct socket * so, struct sockaddr_in addr, caddr_t packet_data, int packet_len) {
|
||||
struct mbuf *m;
|
||||
int len;
|
||||
|
||||
/** This is like sorecvfrom(), but just adds a packet with the
|
||||
* supplied data instead of reading the packet to add from the socket */
|
||||
|
||||
if (!(m = m_get())) return;
|
||||
m->m_data += if_maxlinkhdr;
|
||||
|
||||
len = M_FREEROOM(m);
|
||||
|
||||
if (packet_len > len) {
|
||||
packet_len = (m->m_data - m->m_dat) + m->m_len + packet_len + 1;
|
||||
m_inc(m, packet_len);
|
||||
len = M_FREEROOM(m);
|
||||
}
|
||||
|
||||
assert(len >= packet_len);
|
||||
m->m_len = packet_len;
|
||||
memcpy(m->m_data, packet_data, packet_len);
|
||||
|
||||
udp_output(so, m, &addr);
|
||||
}
|
||||
|
||||
/* Decode hostname from the format used in DNS
|
||||
e.g. "\009something\004else\003com" for "something.else.com." */
|
||||
static char * decode_dns_name(const char * data) {
|
||||
|
||||
int query_str_len = strlen(data);
|
||||
char * decoded_name_str = malloc(query_str_len + 1);
|
||||
if (decoded_name_str == NULL) {
|
||||
D("decode_dns_name(): out of memory\n");
|
||||
return NULL; // oom
|
||||
}
|
||||
|
||||
char * decoded_name_str_pos = decoded_name_str;
|
||||
while (*data != '\0') {
|
||||
int part_len = *data++;
|
||||
query_str_len--;
|
||||
if (query_str_len < part_len) {
|
||||
D("decode_dns_name(): part went off the end of the string\n");
|
||||
free(decoded_name_str);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(decoded_name_str_pos, data, part_len);
|
||||
decoded_name_str_pos[part_len] = '.';
|
||||
decoded_name_str_pos += part_len + 1;
|
||||
query_str_len -= part_len;
|
||||
data += part_len;
|
||||
}
|
||||
*decoded_name_str_pos = '\0';
|
||||
return decoded_name_str;
|
||||
}
|
||||
|
||||
/** Take a look at a UDP DNS request the client has made and see if we want to resolve it internally.
|
||||
* Returns true if the request has been internally and can be dropped,
|
||||
* false otherwise
|
||||
**/
|
||||
static bool resolve_dns_request(struct socket * so, struct sockaddr_in addr, caddr_t data, int len) {
|
||||
bool drop_dns_request = false;
|
||||
|
||||
D("Checking outgoing DNS UDP packet\n");
|
||||
|
||||
if (len < sizeof(struct DNS_HEADER)) {
|
||||
D("Packet too short for DNS header\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
const caddr_t packet = data;
|
||||
const int packet_len = len;
|
||||
|
||||
POP_DATA(struct DNS_HEADER, h, data, len);
|
||||
|
||||
if (h.qr != 0) {
|
||||
D("DNS packet is not a request\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ntohs(h.q_count) == 0) {
|
||||
D("DNS request has no queries\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ntohs(h.q_count) > 1) {
|
||||
D("DNS request has multiple queries (not supported)\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ntohs(h.ans_count != 0) || ntohs(h.auth_count != 0) || ntohs(h.add_count != 0)) {
|
||||
D("DNS request has unsupported extra contents\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
D("Packet too short for DNS query string\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
POP_STR(original_query_str, data, len);
|
||||
if (original_query_str == NULL) {
|
||||
// went off end of packet
|
||||
D("Unterminated DNS query string\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
char * decoded_name_str = decode_dns_name(original_query_str);
|
||||
if (decoded_name_str == NULL) {
|
||||
D("Error while decoding DNS query string");
|
||||
return false;
|
||||
}
|
||||
|
||||
D("DNS host query for %s\n", decoded_name_str);
|
||||
|
||||
POP_DATA(struct QUESTION, qinfo, data, len);
|
||||
|
||||
if (ntohs(qinfo.qtype) != 1 /* type A */ || ntohs(qinfo.qclass) != 1 /* class IN */ ) {
|
||||
D("DNS host query for %s: Request isn't the supported type (INET A query)\n", decoded_name_str);
|
||||
free(decoded_name_str);
|
||||
return false;
|
||||
}
|
||||
|
||||
D("DNS host query for %s: Request is eligible to check for host resolution suffix\n", decoded_name_str);
|
||||
|
||||
const char * matched_suffix = NULL;
|
||||
|
||||
for (const char ** suffix_ptr = host_resolved_domain_suffixes; *suffix_ptr != NULL; suffix_ptr++) {
|
||||
const char * suffix = *suffix_ptr;
|
||||
|
||||
// ends with suffix?
|
||||
int suffix_pos = strlen(decoded_name_str) - strlen(suffix);
|
||||
if (suffix_pos > 0 && strcmp(decoded_name_str + suffix_pos, suffix) == 0) {
|
||||
matched_suffix = suffix;
|
||||
break;
|
||||
}
|
||||
|
||||
// also check if the domain exactly matched the one the suffix is for
|
||||
if (strcmp(decoded_name_str, suffix + 1) == 0) {
|
||||
matched_suffix = suffix;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matched_suffix == NULL) {
|
||||
D("DNS host query for %s: No suffix matched\n", decoded_name_str);
|
||||
} else {
|
||||
|
||||
D("DNS host query for %s: Matched for suffix: %s\n", decoded_name_str, matched_suffix);
|
||||
|
||||
// we are going to take this request and resolve it on the host
|
||||
drop_dns_request = true;
|
||||
|
||||
D("DNS host query for %s: Doing lookup on host\n", decoded_name_str);
|
||||
|
||||
int results_count = 0;
|
||||
struct hostent * host_lookup_result = gethostbyname(decoded_name_str);
|
||||
|
||||
if (host_lookup_result && host_lookup_result->h_addrtype == AF_INET) {
|
||||
|
||||
D("DNS host query for %s: Host response has results for AF_INET\n", decoded_name_str);
|
||||
|
||||
for (char ** addr_entry = host_lookup_result->h_addr_list; *addr_entry != NULL; addr_entry++) {
|
||||
++results_count;
|
||||
}
|
||||
}
|
||||
|
||||
D("DNS host query for %s: result count %d\n", decoded_name_str, results_count);
|
||||
|
||||
int original_query_str_size = strlen(original_query_str) + 1;
|
||||
int response_size = packet_len + results_count * (original_query_str_size + sizeof(struct R_DATA) + sizeof(struct in_addr));
|
||||
|
||||
caddr_t response_packet = malloc(response_size);
|
||||
if (response_packet == NULL) {
|
||||
D("DNS host query for %s: Out of memory while allocating DNS response packet\n", decoded_name_str);
|
||||
} else {
|
||||
D("DNS host query for %s: Preparing DNS response\n", decoded_name_str);
|
||||
|
||||
// use the request DNS header as our starting point for the response
|
||||
h.qr = 1;
|
||||
h.ans_count = htons(results_count);
|
||||
memcpy(response_packet, &h, sizeof(struct DNS_HEADER));
|
||||
|
||||
// other sections verbatim out of the request
|
||||
memcpy(response_packet + sizeof(struct DNS_HEADER), packet + sizeof(struct DNS_HEADER), packet_len - sizeof(struct DNS_HEADER));
|
||||
|
||||
int response_pos = packet_len;
|
||||
|
||||
if (results_count > 0) {
|
||||
for (char ** addr_entry = host_lookup_result->h_addr_list; *addr_entry != NULL; addr_entry++) {
|
||||
// answer string is verbatim from question
|
||||
memcpy(response_packet + response_pos, original_query_str, original_query_str_size);
|
||||
|
||||
response_pos += original_query_str_size;
|
||||
|
||||
struct R_DATA resource;
|
||||
resource.type = htons(1);
|
||||
resource._class = htons(1);
|
||||
resource.ttl = htonl(HOST_DOMAIN_TTL);
|
||||
resource.data_len = htons(sizeof(struct in_addr));
|
||||
|
||||
memcpy(response_packet + response_pos, &resource, sizeof(struct R_DATA));
|
||||
response_pos += sizeof(struct R_DATA);
|
||||
|
||||
struct in_addr * cur_addr = (struct in_addr *)*addr_entry;
|
||||
memcpy(response_packet + response_pos, cur_addr, sizeof(struct in_addr));
|
||||
response_pos += sizeof(struct in_addr);
|
||||
}
|
||||
}
|
||||
|
||||
assert(response_pos == response_size);
|
||||
|
||||
D("DNS host query for %s: Injecting DNS response directly to guest\n", decoded_name_str);
|
||||
inject_udp_packet_to_guest(so, addr, response_packet, response_size);
|
||||
|
||||
free(response_packet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(decoded_name_str);
|
||||
|
||||
D("DNS host request drop: %s\n", drop_dns_request? "yes" : "no");
|
||||
return drop_dns_request;
|
||||
}
|
||||
|
||||
/*
|
||||
* sendto() a socket
|
||||
*/
|
||||
|
@ -503,6 +897,10 @@ sosendto(so, m)
|
|||
switch(ntohl(so->so_faddr.s_addr) & 0xff) {
|
||||
case CTL_DNS:
|
||||
addr.sin_addr = dns_addr;
|
||||
if (host_resolved_domain_suffixes != NULL) {
|
||||
if (resolve_dns_request(so, addr, m->m_data, m->m_len))
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case CTL_ALIAS:
|
||||
default:
|
||||
|
|
|
@ -644,8 +644,8 @@ tcp_emu(so, m)
|
|||
DEBUG_ARG("so = %lx", (long)so);
|
||||
DEBUG_ARG("m = %lx", (long)m);
|
||||
|
||||
int x, i;
|
||||
switch(so->so_emu) {
|
||||
int x, i;
|
||||
|
||||
case EMU_IDENT:
|
||||
/*
|
||||
|
|
|
@ -263,7 +263,7 @@ int16 SonyOpen(uint32 pb, uint32 dce)
|
|||
|
||||
// Set up DCE
|
||||
WriteMacInt32(dce + dCtlPosition, 0);
|
||||
WriteMacInt16(dce + dCtlQHdr + qFlags, ReadMacInt16(dce + dCtlQHdr + qFlags) & 0xff00 | 3); // Version number, must be >=3 or System 8 will replace us
|
||||
WriteMacInt16(dce + dCtlQHdr + qFlags, (ReadMacInt16(dce + dCtlQHdr + qFlags) & 0xff00) | 3); // Version number, must be >=3 or System 8 will replace us
|
||||
acc_run_called = false;
|
||||
|
||||
// Install driver again with refnum -2 (HD20)
|
||||
|
@ -520,7 +520,7 @@ int16 SonyStatus(uint32 pb, uint32 dce)
|
|||
break;
|
||||
|
||||
case 10: // Get disk type and MFM info
|
||||
WriteMacInt32(pb + csParam, ReadMacInt32(info->status + dsMFMDrive) & 0xffffff00 | 0xfe); // 0xfe = SWIM2 controller
|
||||
WriteMacInt32(pb + csParam, (ReadMacInt32(info->status + dsMFMDrive) & 0xffffff00) | 0xfe); // 0xfe = SWIM2 controller
|
||||
break;
|
||||
|
||||
// case 0x4350: // Measure disk speed at a given track ('CP') (not supported)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* timer.cpp - Time Manager emulation
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer and Marc Hellwig
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,26 +18,26 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* SEE ALSO
|
||||
* Inside Macintosh: Processes, chapter 3 "Time Manager"
|
||||
* Technote 1063: "Inside Macintosh: Processes: Time Manager Addenda"
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "cpu_emulation.h"
|
||||
#include "main.h"
|
||||
#include "macos_util.h"
|
||||
#include "timer.h"
|
||||
#include "macos_util.h"
|
||||
#include "main.h"
|
||||
#include "cpu_emulation.h"
|
||||
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
// Set this to 1 to enable TMQueue management (doesn't work)
|
||||
#define TM_QUEUE 0
|
||||
#define TM_QUEUE 0 // Enable TMQueue management (doesn't work)
|
||||
|
||||
|
||||
// Definitions for Time Manager
|
||||
|
@ -53,50 +53,70 @@ enum { // TMTask struct
|
|||
struct TMDesc {
|
||||
uint32 task; // Mac address of associated TMTask
|
||||
tm_time_t wakeup; // Time this task is scheduled for execution
|
||||
bool in_use; // Flag: descriptor in use
|
||||
TMDesc *next;
|
||||
};
|
||||
|
||||
const int NUM_DESCS = 64; // Maximum number of descriptors
|
||||
static TMDesc desc[NUM_DESCS];
|
||||
static TMDesc *tmDescList;
|
||||
|
||||
#if PRECISE_TIMING
|
||||
#ifdef PRECISE_TIMING_BEOS
|
||||
static thread_id timer_thread = -1;
|
||||
static bool thread_active = true;
|
||||
static const tm_time_t wakeup_time_max = 0x7fffffffffffffff;
|
||||
static volatile tm_time_t wakeup_time = wakeup_time_max;
|
||||
static sem_id wakeup_time_sem = -1;
|
||||
static int32 timer_func(void *arg);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
static pthread_t timer_thread;
|
||||
static bool timer_thread_active = false;
|
||||
static volatile bool timer_thread_cancel = false;
|
||||
static tm_time_t wakeup_time_max = { 0x7fffffff, 999999999 };
|
||||
static tm_time_t wakeup_time = wakeup_time_max;
|
||||
static pthread_mutex_t wakeup_time_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static void *timer_func(void *arg);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
static clock_serv_t system_clock;
|
||||
static thread_act_t timer_thread;
|
||||
static bool timer_thread_active = false;
|
||||
static tm_time_t wakeup_time_max = { 0x7fffffff, 999999999 };
|
||||
static tm_time_t wakeup_time = wakeup_time_max;
|
||||
static semaphore_t wakeup_time_sem;
|
||||
static void *timer_func(void *arg);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Allocate descriptor for given TMTask in list
|
||||
*/
|
||||
|
||||
static int alloc_desc(uint32 tm)
|
||||
inline static void free_desc(TMDesc *desc)
|
||||
{
|
||||
// Search for first free descriptor
|
||||
for (int i=0; i<NUM_DESCS; i++)
|
||||
if (!desc[i].in_use) {
|
||||
desc[i].task = tm;
|
||||
desc[i].in_use = true;
|
||||
return i;
|
||||
if (desc == tmDescList) {
|
||||
tmDescList = desc->next;
|
||||
} else {
|
||||
for (TMDesc *d = tmDescList; d; d = d->next) {
|
||||
if (d->next == desc) {
|
||||
d->next = desc->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
delete desc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free descriptor in list
|
||||
*/
|
||||
|
||||
inline static void free_desc(int i)
|
||||
{
|
||||
desc[i].in_use = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find descriptor associated with given TMTask
|
||||
*/
|
||||
|
||||
inline static int find_desc(uint32 tm)
|
||||
inline static TMDesc *find_desc(uint32 tm)
|
||||
{
|
||||
for (int i=0; i<NUM_DESCS; i++)
|
||||
if (desc[i].in_use && desc[i].task == tm)
|
||||
return i;
|
||||
return -1;
|
||||
TMDesc *desc = tmDescList;
|
||||
while (desc) {
|
||||
if (desc->task == tm) {
|
||||
return desc;
|
||||
}
|
||||
desc = desc->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,15 +153,135 @@ static void dequeue_tm(uint32 tm)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Timer thread operations
|
||||
*/
|
||||
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
const int SIGSUSPEND = SIGRTMIN + 6;
|
||||
const int SIGRESUME = SIGRTMIN + 7;
|
||||
static struct sigaction sigsuspend_action;
|
||||
static struct sigaction sigresume_action;
|
||||
|
||||
static int suspend_count = 0;
|
||||
static pthread_mutex_t suspend_count_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static sem_t suspend_ack_sem;
|
||||
static sigset_t suspend_handler_mask;
|
||||
|
||||
// Signal handler for suspended thread
|
||||
static void sigsuspend_handler(int sig)
|
||||
{
|
||||
sem_post(&suspend_ack_sem);
|
||||
sigsuspend(&suspend_handler_mask);
|
||||
}
|
||||
|
||||
// Signal handler for resumed thread
|
||||
static void sigresume_handler(int sig)
|
||||
{
|
||||
/* simply trigger a signal to stop clock_nanosleep() */
|
||||
}
|
||||
|
||||
// Initialize timer thread
|
||||
static bool timer_thread_init(void)
|
||||
{
|
||||
// Install suspend signal handler
|
||||
sigemptyset(&sigsuspend_action.sa_mask);
|
||||
sigaddset(&sigsuspend_action.sa_mask, SIGRESUME);
|
||||
sigsuspend_action.sa_handler = sigsuspend_handler;
|
||||
sigsuspend_action.sa_flags = SA_RESTART;
|
||||
#ifdef HAVE_SIGNAL_SA_RESTORER
|
||||
sigsuspend_action.sa_restorer = NULL;
|
||||
#endif
|
||||
if (sigaction(SIGSUSPEND, &sigsuspend_action, NULL) < 0)
|
||||
return false;
|
||||
|
||||
// Install resume signal handler
|
||||
sigemptyset(&sigresume_action.sa_mask);
|
||||
sigresume_action.sa_handler = sigresume_handler;
|
||||
sigresume_action.sa_flags = SA_RESTART;
|
||||
#ifdef HAVE_SIGNAL_SA_RESTORER
|
||||
sigresume_action.sa_restorer = NULL;
|
||||
#endif
|
||||
if (sigaction(SIGRESUME, &sigresume_action, NULL) < 0)
|
||||
return false;
|
||||
|
||||
// Initialize semaphore
|
||||
if (sem_init(&suspend_ack_sem, 0, 0) < 0)
|
||||
return false;
|
||||
|
||||
// Initialize suspend_handler_mask, it excludes SIGRESUME
|
||||
if (sigfillset(&suspend_handler_mask) != 0)
|
||||
return false;
|
||||
if (sigdelset(&suspend_handler_mask, SIGRESUME) != 0)
|
||||
return false;
|
||||
|
||||
// Create thread in running state
|
||||
suspend_count = 0;
|
||||
return (pthread_create(&timer_thread, NULL, timer_func, NULL) == 0);
|
||||
}
|
||||
|
||||
// Kill timer thread
|
||||
static void timer_thread_kill(void)
|
||||
{
|
||||
timer_thread_cancel = true;
|
||||
#ifdef HAVE_PTHREAD_CANCEL
|
||||
pthread_cancel(timer_thread);
|
||||
#endif
|
||||
pthread_join(timer_thread, NULL);
|
||||
}
|
||||
|
||||
// Suspend timer thread
|
||||
static void timer_thread_suspend(void)
|
||||
{
|
||||
pthread_mutex_lock(&suspend_count_lock);
|
||||
if (suspend_count == 0) {
|
||||
suspend_count ++;
|
||||
if (pthread_kill(timer_thread, SIGSUSPEND) == 0)
|
||||
sem_wait(&suspend_ack_sem);
|
||||
}
|
||||
pthread_mutex_unlock(&suspend_count_lock);
|
||||
}
|
||||
|
||||
// Resume timer thread
|
||||
static void timer_thread_resume(void)
|
||||
{
|
||||
pthread_mutex_lock(&suspend_count_lock);
|
||||
assert(suspend_count > 0);
|
||||
if (suspend_count == 1) {
|
||||
suspend_count = 0;
|
||||
pthread_kill(timer_thread, SIGRESUME);
|
||||
}
|
||||
pthread_mutex_unlock(&suspend_count_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Initialize Time Manager
|
||||
*/
|
||||
|
||||
void TimerInit(void)
|
||||
{
|
||||
// Mark all descriptors as inactive
|
||||
for (int i=0; i<NUM_DESCS; i++)
|
||||
free_desc(i);
|
||||
TimerReset();
|
||||
|
||||
#if PRECISE_TIMING
|
||||
// Start timer thread
|
||||
#ifdef PRECISE_TIMING_BEOS
|
||||
wakeup_time_sem = create_sem(1, "Wakeup Time");
|
||||
timer_thread = spawn_thread(timer_func, "Time Manager", B_REAL_TIME_PRIORITY, NULL);
|
||||
resume_thread(timer_thread);
|
||||
#elif PRECISE_TIMING_MACH
|
||||
pthread_t pthread;
|
||||
|
||||
host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &system_clock);
|
||||
semaphore_create(mach_task_self(), &wakeup_time_sem, SYNC_POLICY_FIFO, 1);
|
||||
|
||||
pthread_create(&pthread, NULL, &timer_func, NULL);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
timer_thread_active = timer_thread_init();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,6 +291,26 @@ void TimerInit(void)
|
|||
|
||||
void TimerExit(void)
|
||||
{
|
||||
#if PRECISE_TIMING
|
||||
// Quit timer thread
|
||||
if (timer_thread > 0) {
|
||||
#ifdef PRECISE_TIMING_BEOS
|
||||
status_t l;
|
||||
thread_active = false;
|
||||
suspend_thread(timer_thread);
|
||||
resume_thread(timer_thread);
|
||||
wait_for_thread(timer_thread, &l);
|
||||
delete_sem(wakeup_time_sem);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
timer_thread_active = false;
|
||||
semaphore_destroy(mach_task_self(), wakeup_time_sem);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
timer_thread_kill();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,9 +320,13 @@ void TimerExit(void)
|
|||
|
||||
void TimerReset(void)
|
||||
{
|
||||
// Mark all descriptors as inactive
|
||||
for (int i=0; i<NUM_DESCS; i++)
|
||||
free_desc(i);
|
||||
TMDesc *desc = tmDescList;
|
||||
while (desc) {
|
||||
TMDesc *next = desc->next;
|
||||
delete desc;
|
||||
desc = next;
|
||||
}
|
||||
tmDescList = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,12 +338,13 @@ int16 InsTime(uint32 tm, uint16 trap)
|
|||
{
|
||||
D(bug("InsTime %08lx, trap %04x\n", tm, trap));
|
||||
WriteMacInt16(tm + qType, (ReadMacInt16(tm + qType) & 0x1fff) | ((trap << 4) & 0x6000));
|
||||
if (find_desc(tm) >= 0)
|
||||
printf("WARNING: InsTime(): Task re-inserted\n");
|
||||
if (find_desc(tm))
|
||||
printf("WARNING: InsTime(%08x): Task re-inserted\n", tm);
|
||||
else {
|
||||
int i = alloc_desc(tm);
|
||||
if (i < 0)
|
||||
printf("FATAL: InsTime(): No free Time Manager descriptor\n");
|
||||
TMDesc *desc = new TMDesc;
|
||||
desc->task = tm;
|
||||
desc->next = tmDescList;
|
||||
tmDescList = desc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -194,30 +359,68 @@ int16 RmvTime(uint32 tm)
|
|||
D(bug("RmvTime %08lx\n", tm));
|
||||
|
||||
// Find descriptor
|
||||
int i = find_desc(tm);
|
||||
if (i < 0) {
|
||||
TMDesc *desc = find_desc(tm);
|
||||
if (!desc) {
|
||||
printf("WARNING: RmvTime(%08x): Descriptor not found\n", tm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Task active?
|
||||
#if PRECISE_TIMING_BEOS
|
||||
while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ;
|
||||
suspend_thread(timer_thread);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
semaphore_wait(wakeup_time_sem);
|
||||
thread_suspend(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_POSIX
|
||||
pthread_mutex_lock(&wakeup_time_lock);
|
||||
timer_thread_suspend();
|
||||
#endif
|
||||
if (ReadMacInt16(tm + qType) & 0x8000) {
|
||||
|
||||
// Yes, make task inactive and remove it from the Time Manager queue
|
||||
WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x7fff);
|
||||
dequeue_tm(tm);
|
||||
#if PRECISE_TIMING
|
||||
// Look for next task to be called and set wakeup_time
|
||||
wakeup_time = wakeup_time_max;
|
||||
for (TMDesc *d = tmDescList; d; d = d->next)
|
||||
if ((ReadMacInt16(d->task + qType) & 0x8000))
|
||||
if (timer_cmp_time(d->wakeup, wakeup_time) < 0)
|
||||
wakeup_time = d->wakeup;
|
||||
#endif
|
||||
|
||||
// Compute remaining time
|
||||
tm_time_t remaining, current;
|
||||
timer_current_time(current);
|
||||
timer_sub_time(remaining, desc[i].wakeup, current);
|
||||
timer_sub_time(remaining, desc->wakeup, current);
|
||||
WriteMacInt32(tm + tmCount, timer_host2mac_time(remaining));
|
||||
} else
|
||||
WriteMacInt32(tm + tmCount, 0);
|
||||
D(bug(" tmCount %d\n", ReadMacInt32(tm + tmCount)));
|
||||
#if PRECISE_TIMING_BEOS
|
||||
release_sem(wakeup_time_sem);
|
||||
thread_info info;
|
||||
do {
|
||||
resume_thread(timer_thread); // This will unblock the thread
|
||||
get_thread_info(timer_thread, &info);
|
||||
} while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?)
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
semaphore_signal(wakeup_time_sem);
|
||||
thread_abort(timer_thread);
|
||||
thread_resume(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_POSIX
|
||||
pthread_mutex_unlock(&wakeup_time_lock);
|
||||
timer_thread_resume();
|
||||
assert(suspend_count == 0);
|
||||
#endif
|
||||
|
||||
// Free descriptor
|
||||
free_desc(i);
|
||||
free_desc(desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -231,38 +434,41 @@ int16 PrimeTime(uint32 tm, int32 time)
|
|||
D(bug("PrimeTime %08x, time %d\n", tm, time));
|
||||
|
||||
// Find descriptor
|
||||
int i = find_desc(tm);
|
||||
if (i < 0) {
|
||||
printf("FATAL: PrimeTime(): Descriptor not found\n");
|
||||
TMDesc *desc = find_desc(tm);
|
||||
if (!desc) {
|
||||
printf("FATAL: PrimeTime(%08x): Descriptor not found\n", tm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Convert delay time
|
||||
tm_time_t delay;
|
||||
timer_mac2host_time(delay, time);
|
||||
|
||||
// Extended task?
|
||||
if (ReadMacInt16(tm + qType) & 0x4000) {
|
||||
|
||||
// Convert delay time
|
||||
tm_time_t delay;
|
||||
timer_mac2host_time(delay, time);
|
||||
|
||||
// Yes, tmWakeUp set?
|
||||
if (ReadMacInt32(tm + tmWakeUp)) {
|
||||
|
||||
//!! PrimeTime(0) means continue previous delay
|
||||
// (save wakeup time in RmvTime?)
|
||||
if (time == 0)
|
||||
printf("WARNING: Unsupported PrimeTime(0)\n");
|
||||
// PrimeTime(0) can either mean (a) "the task runs as soon as interrupts are enabled"
|
||||
// or (b) "continue previous delay" if an expired task was stopped via RmvTime() and
|
||||
// then re-installed using InsXTime(). Since tmWakeUp was set, this is case (b).
|
||||
// The remaining time was saved in tmCount by RmvTime().
|
||||
if (time == 0) {
|
||||
timer_mac2host_time(delay, ReadMacInt16(tm + tmCount));
|
||||
}
|
||||
|
||||
// Yes, calculate wakeup time relative to last scheduled time
|
||||
tm_time_t wakeup;
|
||||
timer_add_time(wakeup, desc[i].wakeup, delay);
|
||||
desc[i].wakeup = wakeup;
|
||||
timer_add_time(wakeup, desc->wakeup, delay);
|
||||
desc->wakeup = wakeup;
|
||||
|
||||
} else {
|
||||
|
||||
// No, calculate wakeup time relative to current time
|
||||
tm_time_t now;
|
||||
timer_current_time(now);
|
||||
timer_add_time(desc[i].wakeup, now, delay);
|
||||
timer_add_time(desc->wakeup, now, delay);
|
||||
}
|
||||
|
||||
// Set tmWakeUp to indicate that task was scheduled
|
||||
|
@ -271,19 +477,130 @@ int16 PrimeTime(uint32 tm, int32 time)
|
|||
} else {
|
||||
|
||||
// Not extended task, calculate wakeup time relative to current time
|
||||
tm_time_t delay;
|
||||
timer_mac2host_time(delay, time);
|
||||
timer_current_time(desc[i].wakeup);
|
||||
timer_add_time(desc[i].wakeup, desc[i].wakeup, delay);
|
||||
tm_time_t now;
|
||||
timer_current_time(now);
|
||||
timer_add_time(desc->wakeup, now, delay);
|
||||
}
|
||||
|
||||
// Make task active and enqueue it in the Time Manager queue
|
||||
#if PRECISE_TIMING_BEOS
|
||||
while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ;
|
||||
suspend_thread(timer_thread);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
semaphore_wait(wakeup_time_sem);
|
||||
thread_suspend(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_POSIX
|
||||
pthread_mutex_lock(&wakeup_time_lock);
|
||||
timer_thread_suspend();
|
||||
#endif
|
||||
WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) | 0x8000);
|
||||
enqueue_tm(tm);
|
||||
#if PRECISE_TIMING
|
||||
// Look for next task to be called and set wakeup_time
|
||||
wakeup_time = wakeup_time_max;
|
||||
for (TMDesc *d = tmDescList; d; d = d->next)
|
||||
if ((ReadMacInt16(d->task + qType) & 0x8000))
|
||||
if (timer_cmp_time(d->wakeup, wakeup_time) < 0)
|
||||
wakeup_time = d->wakeup;
|
||||
#ifdef PRECISE_TIMING_BEOS
|
||||
release_sem(wakeup_time_sem);
|
||||
thread_info info;
|
||||
do {
|
||||
resume_thread(timer_thread); // This will unblock the thread
|
||||
get_thread_info(timer_thread, &info);
|
||||
} while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?)
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
semaphore_signal(wakeup_time_sem);
|
||||
thread_abort(timer_thread);
|
||||
thread_resume(timer_thread);
|
||||
#endif
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
pthread_mutex_unlock(&wakeup_time_lock);
|
||||
timer_thread_resume();
|
||||
assert(suspend_count == 0);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Time Manager thread
|
||||
*/
|
||||
|
||||
#ifdef PRECISE_TIMING_BEOS
|
||||
static int32 timer_func(void *arg)
|
||||
{
|
||||
while (thread_active) {
|
||||
|
||||
// Wait until time specified by wakeup_time
|
||||
snooze_until(wakeup_time, B_SYSTEM_TIMEBASE);
|
||||
|
||||
while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ;
|
||||
if (wakeup_time < system_time()) {
|
||||
|
||||
// Timer expired, trigger interrupt
|
||||
wakeup_time = 0x7fffffffffffffff;
|
||||
SetInterruptFlag(INTFLAG_TIMER);
|
||||
TriggerInterrupt();
|
||||
}
|
||||
release_sem(wakeup_time_sem);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PRECISE_TIMING_MACH
|
||||
static void *timer_func(void *arg)
|
||||
{
|
||||
timer_thread = mach_thread_self();
|
||||
timer_thread_active = true;
|
||||
|
||||
while (timer_thread_active) {
|
||||
clock_sleep(system_clock, TIME_ABSOLUTE, wakeup_time, NULL);
|
||||
semaphore_wait(wakeup_time_sem);
|
||||
|
||||
tm_time_t system_time;
|
||||
|
||||
timer_current_time(system_time);
|
||||
if (timer_cmp_time(wakeup_time, system_time) < 0) {
|
||||
wakeup_time = wakeup_time_max;
|
||||
SetInterruptFlag(INTFLAG_TIMER);
|
||||
TriggerInterrupt();
|
||||
}
|
||||
semaphore_signal(wakeup_time_sem);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PRECISE_TIMING_POSIX
|
||||
static void *timer_func(void *arg)
|
||||
{
|
||||
while (!timer_thread_cancel) {
|
||||
// Wait until time specified by wakeup_time
|
||||
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &wakeup_time, NULL);
|
||||
|
||||
tm_time_t system_time;
|
||||
timer_current_time(system_time);
|
||||
if (timer_cmp_time(wakeup_time, system_time) < 0) {
|
||||
|
||||
// Timer expired, trigger interrupt
|
||||
pthread_mutex_lock(&wakeup_time_lock);
|
||||
wakeup_time = wakeup_time_max;
|
||||
pthread_mutex_unlock(&wakeup_time_lock);
|
||||
SetInterruptFlag(INTFLAG_TIMER);
|
||||
TriggerInterrupt();
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Timer interrupt function (executed as part of 60Hz interrupt)
|
||||
*/
|
||||
|
@ -293,24 +610,66 @@ void TimerInterrupt(void)
|
|||
// Look for active TMTasks that have expired
|
||||
tm_time_t now;
|
||||
timer_current_time(now);
|
||||
for (int i=0; i<NUM_DESCS; i++)
|
||||
if (desc[i].in_use) {
|
||||
uint32 tm = desc[i].task;
|
||||
if ((ReadMacInt16(tm + qType) & 0x8000) && timer_cmp_time(desc[i].wakeup, now) < 0) {
|
||||
TMDesc *desc = tmDescList;
|
||||
while (desc) {
|
||||
TMDesc *next = desc->next;
|
||||
uint32 tm = desc->task;
|
||||
if ((ReadMacInt16(tm + qType) & 0x8000) && timer_cmp_time(desc->wakeup, now) <= 0) {
|
||||
|
||||
// Found one, mark as inactive and remove it from the Time Manager queue
|
||||
WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x7fff);
|
||||
dequeue_tm(tm);
|
||||
// Found one, mark as inactive and remove it from the Time Manager queue
|
||||
WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x7fff);
|
||||
dequeue_tm(tm);
|
||||
|
||||
// Call timer function
|
||||
uint32 addr = ReadMacInt32(tm + tmAddr);
|
||||
if (addr) {
|
||||
D(bug("Calling TimeTask %08lx, addr %08lx\n", tm, addr));
|
||||
M68kRegisters r;
|
||||
r.a[0] = addr;
|
||||
r.a[1] = tm;
|
||||
Execute68k(addr, &r);
|
||||
}
|
||||
// Call timer function
|
||||
uint32 addr = ReadMacInt32(tm + tmAddr);
|
||||
if (addr) {
|
||||
D(bug("Calling TimeTask %08lx, addr %08lx\n", tm, addr));
|
||||
M68kRegisters r;
|
||||
r.a[0] = addr;
|
||||
r.a[1] = tm;
|
||||
Execute68k(r.a[0], &r);
|
||||
D(bug(" returned from TimeTask\n"));
|
||||
}
|
||||
}
|
||||
desc = next;
|
||||
}
|
||||
|
||||
#if PRECISE_TIMING
|
||||
// Look for next task to be called and set wakeup_time
|
||||
#if PRECISE_TIMING_BEOS
|
||||
while (acquire_sem(wakeup_time_sem) == B_INTERRUPTED) ;
|
||||
suspend_thread(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_MACH
|
||||
semaphore_wait(wakeup_time_sem);
|
||||
thread_suspend(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_POSIX
|
||||
pthread_mutex_lock(&wakeup_time_lock);
|
||||
timer_thread_suspend();
|
||||
#endif
|
||||
wakeup_time = wakeup_time_max;
|
||||
for (TMDesc *d = tmDescList; d; d = d->next)
|
||||
if ((ReadMacInt16(d->task + qType) & 0x8000))
|
||||
if (timer_cmp_time(d->wakeup, wakeup_time) < 0)
|
||||
wakeup_time = d->wakeup;
|
||||
#if PRECISE_TIMING_BEOS
|
||||
release_sem(wakeup_time_sem);
|
||||
thread_info info;
|
||||
do {
|
||||
resume_thread(timer_thread); // This will unblock the thread
|
||||
get_thread_info(timer_thread, &info);
|
||||
} while (info.state == B_THREAD_SUSPENDED); // Sometimes, resume_thread() doesn't work (BeOS bug?)
|
||||
#endif
|
||||
#if PRECISE_TIMING_MACH
|
||||
semaphore_signal(wakeup_time_sem);
|
||||
thread_abort(timer_thread);
|
||||
thread_resume(timer_thread);
|
||||
#endif
|
||||
#if PRECISE_TIMING_POSIX
|
||||
pthread_mutex_unlock(&wakeup_time_lock);
|
||||
timer_thread_resume();
|
||||
assert(suspend_count == 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#if USE_JIT
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -1635,3 +1637,5 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra)
|
|||
m68k_setpc (m68k_getpc () - 4);
|
||||
fpuop_illg (opcode,extra);
|
||||
}
|
||||
|
||||
#endif //USE_JIT
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#if USE_JIT
|
||||
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
#error "Only Real or Direct Addressing is supported with the JIT Compiler"
|
||||
#endif
|
||||
|
@ -45,7 +47,11 @@
|
|||
#define USE_MATCH 0
|
||||
|
||||
/* kludge for Brian, so he can compile under MSVC++ */
|
||||
#define USE_NORMAL_CALLING_CONVENTION 1 && defined(_MSC_VER)
|
||||
#if defined(_MSC_VER)
|
||||
#define USE_NORMAL_CALLING_CONVENTION 1
|
||||
#else
|
||||
#define USE_NORMAL_CALLING_CONVENTION 0
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
|
@ -364,12 +370,6 @@ static __inline__ void remove_from_list(blockinfo* bi)
|
|||
bi->next->prev_p=bi->prev_p;
|
||||
}
|
||||
|
||||
static __inline__ void remove_from_lists(blockinfo* bi)
|
||||
{
|
||||
remove_from_list(bi);
|
||||
remove_from_cl_list(bi);
|
||||
}
|
||||
|
||||
static __inline__ void add_to_cl_list(blockinfo* bi)
|
||||
{
|
||||
uae_u32 cl=cacheline(bi->pc_p);
|
||||
|
@ -721,10 +721,6 @@ static __inline__ void alloc_blockinfos(void)
|
|||
|
||||
static uae_u8* target;
|
||||
|
||||
static void emit_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
static __inline__ void emit_byte(uae_u8 x)
|
||||
{
|
||||
*target++=x;
|
||||
|
@ -742,12 +738,6 @@ static __inline__ void emit_long(uae_u32 x)
|
|||
target+=4;
|
||||
}
|
||||
|
||||
static __inline__ void emit_quad(uae_u64 x)
|
||||
{
|
||||
*((uae_u64*)target)=x;
|
||||
target+=8;
|
||||
}
|
||||
|
||||
static __inline__ void emit_block(const uae_u8 *block, uae_u32 blocklen)
|
||||
{
|
||||
memcpy((uae_u8 *)target,block,blocklen);
|
||||
|
@ -885,16 +875,6 @@ static inline void ru_set_write(regusage *ru, int reg)
|
|||
ru_set(&ru->wmask, reg);
|
||||
}
|
||||
|
||||
static inline bool ru_read_p(const regusage *ru, int reg)
|
||||
{
|
||||
return ru_get(&ru->rmask, reg);
|
||||
}
|
||||
|
||||
static inline bool ru_write_p(const regusage *ru, int reg)
|
||||
{
|
||||
return ru_get(&ru->wmask, reg);
|
||||
}
|
||||
|
||||
static void ru_fill_ea(regusage *ru, int reg, amodes mode,
|
||||
wordsizes size, int write_mode)
|
||||
{
|
||||
|
@ -1097,6 +1077,7 @@ static uae_s8 nstate[N_REGS];
|
|||
#define L_NEEDED -2
|
||||
#define L_UNNEEDED -3
|
||||
|
||||
#if USE_MATCH
|
||||
static __inline__ void big_to_small_state(bigstate * b, smallstate * s)
|
||||
{
|
||||
int i;
|
||||
|
@ -1129,6 +1110,7 @@ static __inline__ int callers_need_recompile(bigstate * b, smallstate * s)
|
|||
* callers */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline__ void log_startblock(void)
|
||||
{
|
||||
|
@ -1165,11 +1147,6 @@ static __inline__ void do_load_reg(int n, int r)
|
|||
raw_mov_l_rm(n, (uintptr) live.state[r].mem);
|
||||
}
|
||||
|
||||
static __inline__ void check_load_reg(int n, int r)
|
||||
{
|
||||
raw_mov_l_rm(n, (uintptr) live.state[r].mem);
|
||||
}
|
||||
|
||||
static __inline__ void log_vwrite(int r)
|
||||
{
|
||||
vwritten[r] = 1;
|
||||
|
@ -1516,11 +1493,6 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint)
|
|||
return bestreg;
|
||||
}
|
||||
|
||||
static int alloc_reg(int r, int size, int willclobber)
|
||||
{
|
||||
return alloc_reg_hinted(r,size,willclobber,-1);
|
||||
}
|
||||
|
||||
static void unlock2(int r)
|
||||
{
|
||||
Dif (!live.nat[r].locked)
|
||||
|
@ -5435,14 +5407,6 @@ void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond)
|
|||
branch_cc=cond;
|
||||
}
|
||||
|
||||
|
||||
static uae_u32 get_handler_address(uae_u32 addr)
|
||||
{
|
||||
uae_u32 cl=cacheline(addr);
|
||||
blockinfo* bi=get_blockinfo_addr_new((void*)(uintptr)addr,0);
|
||||
return (uintptr)&(bi->direct_handler_to_use);
|
||||
}
|
||||
|
||||
static uae_u32 get_handler(uae_u32 addr)
|
||||
{
|
||||
uae_u32 cl=cacheline(addr);
|
||||
|
@ -5450,11 +5414,6 @@ static uae_u32 get_handler(uae_u32 addr)
|
|||
return (uintptr)bi->direct_handler_to_use;
|
||||
}
|
||||
|
||||
static void load_handler(int reg, uae_u32 addr)
|
||||
{
|
||||
mov_l_rm(reg,get_handler_address(addr));
|
||||
}
|
||||
|
||||
/* This version assumes that it is writing *real* memory, and *will* fail
|
||||
* if that assumption is wrong! No branches, no second chances, just
|
||||
* straight go-for-it attitude */
|
||||
|
@ -6476,11 +6435,6 @@ void flush_icache_range(uae_u8 *start_p, uae_u32 length)
|
|||
flush_icache(-1);
|
||||
}
|
||||
|
||||
static void catastrophe(void)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
int failure;
|
||||
|
||||
#define TARGET_M68K 0
|
||||
|
@ -6539,6 +6493,7 @@ void disasm_block(int target, uint8 * start, size_t length)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if JIT_DEBUG
|
||||
static void disasm_native_block(uint8 *start, size_t length)
|
||||
{
|
||||
disasm_block(TARGET_NATIVE, start, length);
|
||||
|
@ -6548,6 +6503,7 @@ static void disasm_m68k_block(uint8 *start, size_t length)
|
|||
{
|
||||
disasm_block(TARGET_M68K, start, length);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GET_WORD_UNSWAPPED
|
||||
# define DO_GET_OPCODE(a) (do_get_mem_word_unswapped((uae_u16 *)(a)))
|
||||
|
@ -7125,3 +7081,5 @@ void m68k_compile_execute (void)
|
|||
m68k_do_compile_execute();
|
||||
}
|
||||
}
|
||||
|
||||
#endif //USE_JIT
|
||||
|
|
|
@ -163,47 +163,6 @@ finish_braces (void)
|
|||
close_brace ();
|
||||
}
|
||||
|
||||
static void
|
||||
pop_braces (int to)
|
||||
{
|
||||
while (n_braces > to)
|
||||
close_brace ();
|
||||
}
|
||||
|
||||
static int
|
||||
bit_size (int size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case sz_byte:
|
||||
return 8;
|
||||
case sz_word:
|
||||
return 16;
|
||||
case sz_long:
|
||||
return 32;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
bit_mask (int size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case sz_byte:
|
||||
return "0xff";
|
||||
case sz_word:
|
||||
return "0xffff";
|
||||
case sz_long:
|
||||
return "0xffffffff";
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline__ void gen_update_next_handler(void)
|
||||
{
|
||||
return; /* Can anything clever be done here? */
|
||||
|
@ -1136,49 +1095,6 @@ genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
force_range_for_rox (const char *var, wordsizes size)
|
||||
{
|
||||
/* Could do a modulo operation here... which one is faster? */
|
||||
switch (size)
|
||||
{
|
||||
case sz_long:
|
||||
comprintf ("\tif (%s >= 33) %s -= 33;\n", var, var);
|
||||
break;
|
||||
case sz_word:
|
||||
comprintf ("\tif (%s >= 34) %s -= 34;\n", var, var);
|
||||
comprintf ("\tif (%s >= 17) %s -= 17;\n", var, var);
|
||||
break;
|
||||
case sz_byte:
|
||||
comprintf ("\tif (%s >= 36) %s -= 36;\n", var, var);
|
||||
comprintf ("\tif (%s >= 18) %s -= 18;\n", var, var);
|
||||
comprintf ("\tif (%s >= 9) %s -= 9;\n", var, var);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
cmask (wordsizes size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case sz_byte:
|
||||
return "0x80";
|
||||
case sz_word:
|
||||
return "0x8000";
|
||||
case sz_long:
|
||||
return "0x80000000";
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
source_is_imm1_8 (struct instr *i)
|
||||
{
|
||||
return i->stype == 3;
|
||||
}
|
||||
|
||||
static int /* returns zero for success, non-zero for failure */
|
||||
gen_opcode (unsigned long int opcode)
|
||||
{
|
||||
|
@ -1359,7 +1275,7 @@ gen_opcode (unsigned long int opcode)
|
|||
case i_BCLR:
|
||||
case i_BSET:
|
||||
case i_BTST:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
|
||||
start_brace();
|
||||
|
@ -1541,7 +1457,7 @@ gen_opcode (unsigned long int opcode)
|
|||
failure;
|
||||
break;
|
||||
case i_RTD:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
genamode (curi->smode, "srcreg", curi->size, "offs", 1, 0);
|
||||
/* offs is constant */
|
||||
comprintf("\tadd_l_ri(offs,4);\n");
|
||||
|
@ -1557,7 +1473,7 @@ gen_opcode (unsigned long int opcode)
|
|||
isjump;
|
||||
break;
|
||||
case i_LINK:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0);
|
||||
comprintf("\tsub_l_ri(15,4);\n"
|
||||
|
@ -1569,7 +1485,7 @@ gen_opcode (unsigned long int opcode)
|
|||
genastore ("src", curi->smode, "srcreg", sz_long, "src");
|
||||
break;
|
||||
case i_UNLK:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
|
||||
comprintf("\tmov_l_rr(15,src);\n"
|
||||
"\treadlong(15,src,scratchie);\n"
|
||||
|
@ -1790,7 +1706,7 @@ gen_opcode (unsigned long int opcode)
|
|||
break;
|
||||
|
||||
case i_Scc:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
|
||||
start_brace ();
|
||||
comprintf ("\tint val = scratchie++;\n");
|
||||
|
@ -1837,7 +1753,7 @@ gen_opcode (unsigned long int opcode)
|
|||
failure;
|
||||
break;
|
||||
case i_MULU:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
comprintf("\tdont_care_flags();\n");
|
||||
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
|
||||
|
@ -1852,7 +1768,7 @@ gen_opcode (unsigned long int opcode)
|
|||
genastore ("dst", curi->dmode, "dstreg", sz_long, "dst");
|
||||
break;
|
||||
case i_MULS:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
comprintf("\tdont_care_flags();\n");
|
||||
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
|
||||
|
@ -1886,7 +1802,7 @@ gen_opcode (unsigned long int opcode)
|
|||
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
|
||||
if (curi->smode!=immi) {
|
||||
/* failure; /* UNTESTED: NEW: from "Ipswitch Town" release */
|
||||
/* failure; UNTESTED: NEW: from "Ipswitch Town" release */
|
||||
if (!noflags) {
|
||||
uses_cmov;
|
||||
start_brace();
|
||||
|
@ -2039,7 +1955,7 @@ gen_opcode (unsigned long int opcode)
|
|||
break;
|
||||
|
||||
case i_ASL:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
mayfail;
|
||||
if (curi->smode==Dreg) {
|
||||
comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
|
||||
|
@ -2186,7 +2102,7 @@ gen_opcode (unsigned long int opcode)
|
|||
break;
|
||||
|
||||
case i_LSR:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
mayfail;
|
||||
if (curi->smode==Dreg) {
|
||||
comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n"
|
||||
|
@ -2337,7 +2253,7 @@ gen_opcode (unsigned long int opcode)
|
|||
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
|
||||
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
|
||||
if (curi->smode!=immi) {
|
||||
/* failure; /* UNTESTED: NEW: from "Ipswitch Town" release */
|
||||
/* failure; UNTESTED: NEW: from "Ipswitch Town" release */
|
||||
if (!noflags) {
|
||||
uses_cmov;
|
||||
start_brace();
|
||||
|
@ -2609,7 +2525,7 @@ gen_opcode (unsigned long int opcode)
|
|||
failure;
|
||||
break;
|
||||
case i_MULL:
|
||||
/* failure; /* NEW: from "Ipswitch Town" release */
|
||||
/* failure; NEW: from "Ipswitch Town" release */
|
||||
if (!noflags) {
|
||||
failure;
|
||||
break;
|
||||
|
@ -3038,6 +2954,9 @@ main (int argc, char **argv)
|
|||
stblfile = fopen ("compstbl.cpp", "wb");
|
||||
freopen ("compemu.cpp", "wb", stdout);
|
||||
|
||||
fprintf(stblfile, "#if USE_JIT\n");
|
||||
printf("#if USE_JIT\n");
|
||||
|
||||
generate_includes (stdout);
|
||||
generate_includes (stblfile);
|
||||
|
||||
|
@ -3059,6 +2978,9 @@ main (int argc, char **argv)
|
|||
noflags=1;
|
||||
generate_func (noflags);
|
||||
|
||||
fprintf(stblfile, "#endif //USE_JIT\n");
|
||||
printf("#endif //USE_JIT\n");
|
||||
|
||||
free(opcode_map);
|
||||
free(opcode_last_postfix);
|
||||
free(opcode_next_clev);
|
||||
|
|
|
@ -1768,13 +1768,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
|
|||
FPU registers[reg] = (double)(FPU registers[reg] * src);
|
||||
}
|
||||
else if (fl_dest.nan || fl_source.nan ||
|
||||
fl_dest.zero && fl_source.infinity ||
|
||||
fl_dest.infinity && fl_source.zero ) {
|
||||
(fl_dest.zero && fl_source.infinity) ||
|
||||
(fl_dest.infinity && fl_source.zero)) {
|
||||
make_nan( FPU registers[reg] );
|
||||
}
|
||||
else if (fl_dest.zero || fl_source.zero ) {
|
||||
if (fl_dest.negative && !fl_source.negative ||
|
||||
!fl_dest.negative && fl_source.negative) {
|
||||
if ((fl_dest.negative && !fl_source.negative) ||
|
||||
(!fl_dest.negative && fl_source.negative)) {
|
||||
make_zero_negative(FPU registers[reg]);
|
||||
}
|
||||
else {
|
||||
|
@ -1782,8 +1782,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if( fl_dest.negative && !fl_source.negative ||
|
||||
!fl_dest.negative && fl_source.negative) {
|
||||
if ((fl_dest.negative && !fl_source.negative) ||
|
||||
(!fl_dest.negative && fl_source.negative)) {
|
||||
make_inf_negative(FPU registers[reg]);
|
||||
}
|
||||
else {
|
||||
|
@ -1971,13 +1971,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
|
|||
FPU registers[reg] *= src;
|
||||
}
|
||||
else if (fl_dest.nan || fl_source.nan ||
|
||||
fl_dest.zero && fl_source.infinity ||
|
||||
fl_dest.infinity && fl_source.zero ) {
|
||||
(fl_dest.zero && fl_source.infinity) ||
|
||||
(fl_dest.infinity && fl_source.zero)) {
|
||||
make_nan( FPU registers[reg] );
|
||||
}
|
||||
else if (fl_dest.zero || fl_source.zero ) {
|
||||
if (fl_dest.negative && !fl_source.negative ||
|
||||
!fl_dest.negative && fl_source.negative) {
|
||||
if ((fl_dest.negative && !fl_source.negative) ||
|
||||
(!fl_dest.negative && fl_source.negative)) {
|
||||
make_zero_negative(FPU registers[reg]);
|
||||
}
|
||||
else {
|
||||
|
@ -1985,8 +1985,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if( fl_dest.negative && !fl_source.negative ||
|
||||
!fl_dest.negative && fl_source.negative) {
|
||||
if ((fl_dest.negative && !fl_source.negative) ||
|
||||
(!fl_dest.negative && fl_source.negative)) {
|
||||
make_inf_negative(FPU registers[reg]);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -831,7 +831,7 @@ static int movec_illg (int regno)
|
|||
case 3:
|
||||
if ((regno & 0x7ff) <= 2)
|
||||
return 0;
|
||||
if (regno == 3 || regno == 4)
|
||||
if (regno == 0x803 || regno == 0x804)
|
||||
return 0;
|
||||
break;
|
||||
case 4:
|
||||
|
@ -919,6 +919,7 @@ int m68k_movec2 (int regno, uae_u32 *regp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(uae_s64)
|
||||
static __inline__ int
|
||||
div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem)
|
||||
{
|
||||
|
@ -943,6 +944,7 @@ div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32
|
|||
*rem = src_hi;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc)
|
||||
{
|
||||
|
@ -1065,6 +1067,7 @@ void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(uae_s64)
|
||||
static __inline__ void
|
||||
mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo)
|
||||
{
|
||||
|
@ -1083,6 +1086,7 @@ mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo)
|
|||
*dst_lo = lo;
|
||||
*dst_hi = r3;
|
||||
}
|
||||
#endif
|
||||
|
||||
void m68k_mull (uae_u32 opcode, uae_u32 src, uae_u16 extra)
|
||||
{
|
||||
|
|
|
@ -338,9 +338,9 @@ extern void m68k_execute(void);
|
|||
#if USE_JIT
|
||||
extern void m68k_compile_execute(void);
|
||||
#endif
|
||||
extern void cpu_do_check_ticks(void);
|
||||
#ifdef USE_CPU_EMUL_SERVICES
|
||||
extern int32 emulated_ticks;
|
||||
extern void cpu_do_check_ticks(void);
|
||||
|
||||
static inline void cpu_check_ticks(void)
|
||||
{
|
||||
|
@ -348,8 +348,12 @@ static inline void cpu_check_ticks(void)
|
|||
cpu_do_check_ticks();
|
||||
}
|
||||
#else
|
||||
#define cpu_check_ticks()
|
||||
#define cpu_do_check_ticks()
|
||||
extern uint16 emulated_ticks;
|
||||
static inline void cpu_check_ticks(void)
|
||||
{
|
||||
if (!++emulated_ticks)
|
||||
cpu_do_check_ticks();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NEWCPU_H */
|
||||
|
|
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
* basilisk_glue.cpp - Glue UAE CPU to Basilisk II CPU engine interface
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include "cpu_emulation.h"
|
||||
#include "main.h"
|
||||
#include "prefs.h"
|
||||
#include "emul_op.h"
|
||||
#include "rom_patches.h"
|
||||
#include "timer.h"
|
||||
#include "m68k.h"
|
||||
#include "memory.h"
|
||||
#include "readcpu.h"
|
||||
#include "newcpu.h"
|
||||
#include "compiler/compemu.h"
|
||||
|
||||
|
||||
// RAM and ROM pointers
|
||||
uint32 RAMBaseMac = 0; // RAM base (Mac address space) gb-- initializer is important
|
||||
uint8 *RAMBaseHost; // RAM base (host address space)
|
||||
uint32 RAMSize; // Size of RAM
|
||||
uint32 ROMBaseMac; // ROM base (Mac address space)
|
||||
uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
uint32 ROMSize; // Size of ROM
|
||||
|
||||
#if !REAL_ADDRESSING
|
||||
// Mac frame buffer
|
||||
uint8 *MacFrameBaseHost; // Frame buffer base (host address space)
|
||||
uint32 MacFrameSize; // Size of frame buffer
|
||||
int MacFrameLayout; // Frame buffer layout
|
||||
#endif
|
||||
|
||||
#if DIRECT_ADDRESSING
|
||||
uintptr MEMBaseDiff; // Global offset between a Mac address and its Host equivalent
|
||||
#endif
|
||||
|
||||
#if USE_JIT
|
||||
bool UseJIT = false;
|
||||
#endif
|
||||
|
||||
// #if defined(ENABLE_EXCLUSIVE_SPCFLAGS) && !defined(HAVE_HARDWARE_LOCKS)
|
||||
B2_mutex *spcflags_lock = NULL;
|
||||
// #endif
|
||||
|
||||
// From newcpu.cpp
|
||||
extern int quit_program;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize 680x0 emulation, CheckROM() must have been called first
|
||||
*/
|
||||
|
||||
bool Init680x0(void)
|
||||
{
|
||||
spcflags_lock = B2_create_mutex();
|
||||
#if REAL_ADDRESSING
|
||||
// Mac address space = host address space
|
||||
RAMBaseMac = (uintptr)RAMBaseHost;
|
||||
ROMBaseMac = (uintptr)ROMBaseHost;
|
||||
#elif DIRECT_ADDRESSING
|
||||
// Mac address space = host address space minus constant offset (MEMBaseDiff)
|
||||
// NOTE: MEMBaseDiff is set up in main_unix.cpp/main()
|
||||
RAMBaseMac = 0;
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#else
|
||||
// Initialize UAE memory banks
|
||||
RAMBaseMac = 0;
|
||||
switch (ROMVersion) {
|
||||
case ROM_VERSION_64K:
|
||||
case ROM_VERSION_PLUS:
|
||||
case ROM_VERSION_CLASSIC:
|
||||
ROMBaseMac = 0x00400000;
|
||||
break;
|
||||
case ROM_VERSION_II:
|
||||
ROMBaseMac = 0x00a00000;
|
||||
break;
|
||||
case ROM_VERSION_32:
|
||||
ROMBaseMac = 0x40800000;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
memory_init();
|
||||
#endif
|
||||
|
||||
init_m68k();
|
||||
#if USE_JIT
|
||||
UseJIT = compiler_use_jit();
|
||||
if (UseJIT)
|
||||
compiler_init();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Deinitialize 680x0 emulation
|
||||
*/
|
||||
|
||||
void Exit680x0(void)
|
||||
{
|
||||
#if USE_JIT
|
||||
if (UseJIT)
|
||||
compiler_exit();
|
||||
#endif
|
||||
exit_m68k();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize memory mapping of frame buffer (called upon video mode change)
|
||||
*/
|
||||
|
||||
void InitFrameBufferMapping(void)
|
||||
{
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
memory_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset and start 680x0 emulation (doesn't return)
|
||||
*/
|
||||
|
||||
void Start680x0(void)
|
||||
{
|
||||
m68k_reset();
|
||||
#if USE_JIT
|
||||
if (UseJIT)
|
||||
m68k_compile_execute();
|
||||
else
|
||||
#endif
|
||||
m68k_execute();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Trigger interrupt
|
||||
*/
|
||||
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
idle_resume();
|
||||
SPCFLAGS_SET( SPCFLAG_INT );
|
||||
}
|
||||
|
||||
void TriggerNMI(void)
|
||||
{
|
||||
//!! not implemented yet
|
||||
// SPCFLAGS_SET( SPCFLAG_BRK ); // use _BRK for NMI
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get 68k interrupt level
|
||||
*/
|
||||
|
||||
int intlev(void)
|
||||
{
|
||||
return InterruptFlags ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Execute MacOS 68k trap
|
||||
* r->a[7] and r->sr are unused!
|
||||
*/
|
||||
|
||||
void Execute68kTrap(uint16 trap, struct M68kRegisters *r)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Save old PC
|
||||
uaecptr oldpc = m68k_getpc();
|
||||
|
||||
// Set registers
|
||||
for (i=0; i<8; i++)
|
||||
m68k_dreg(regs, i) = r->d[i];
|
||||
for (i=0; i<7; i++)
|
||||
m68k_areg(regs, i) = r->a[i];
|
||||
|
||||
// Push trap and EXEC_RETURN on stack
|
||||
m68k_areg(regs, 7) -= 2;
|
||||
put_word(m68k_areg(regs, 7), M68K_EXEC_RETURN);
|
||||
m68k_areg(regs, 7) -= 2;
|
||||
put_word(m68k_areg(regs, 7), trap);
|
||||
|
||||
// Execute trap
|
||||
m68k_setpc(m68k_areg(regs, 7));
|
||||
fill_prefetch_0();
|
||||
quit_program = 0;
|
||||
m68k_execute();
|
||||
|
||||
// Clean up stack
|
||||
m68k_areg(regs, 7) += 4;
|
||||
|
||||
// Restore old PC
|
||||
m68k_setpc(oldpc);
|
||||
fill_prefetch_0();
|
||||
|
||||
// Get registers
|
||||
for (i=0; i<8; i++)
|
||||
r->d[i] = m68k_dreg(regs, i);
|
||||
for (i=0; i<7; i++)
|
||||
r->a[i] = m68k_areg(regs, i);
|
||||
quit_program = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Execute 68k subroutine
|
||||
* The executed routine must reside in UAE memory!
|
||||
* r->a[7] and r->sr are unused!
|
||||
*/
|
||||
|
||||
void Execute68k(uint32 addr, struct M68kRegisters *r)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Save old PC
|
||||
uaecptr oldpc = m68k_getpc();
|
||||
|
||||
// Set registers
|
||||
for (i=0; i<8; i++)
|
||||
m68k_dreg(regs, i) = r->d[i];
|
||||
for (i=0; i<7; i++)
|
||||
m68k_areg(regs, i) = r->a[i];
|
||||
|
||||
// Push EXEC_RETURN and faked return address (points to EXEC_RETURN) on stack
|
||||
m68k_areg(regs, 7) -= 2;
|
||||
put_word(m68k_areg(regs, 7), M68K_EXEC_RETURN);
|
||||
m68k_areg(regs, 7) -= 4;
|
||||
put_long(m68k_areg(regs, 7), m68k_areg(regs, 7) + 4);
|
||||
|
||||
// Execute routine
|
||||
m68k_setpc(addr);
|
||||
fill_prefetch_0();
|
||||
quit_program = 0;
|
||||
m68k_execute();
|
||||
|
||||
// Clean up stack
|
||||
m68k_areg(regs, 7) += 2;
|
||||
|
||||
// Restore old PC
|
||||
m68k_setpc(oldpc);
|
||||
fill_prefetch_0();
|
||||
|
||||
// Get registers
|
||||
for (i=0; i<8; i++)
|
||||
r->d[i] = m68k_dreg(regs, i);
|
||||
for (i=0; i<7; i++)
|
||||
r->a[i] = m68k_areg(regs, i);
|
||||
quit_program = 0;
|
||||
}
|
||||
|
||||
void report_double_bus_error()
|
||||
{
|
||||
#if 0
|
||||
panicbug("CPU: Double bus fault detected !");
|
||||
/* would be cool to open SDL dialog here: */
|
||||
/* [Double bus fault detected. The emulated system crashed badly.
|
||||
Do you want to reset ARAnyM or quit ?] [Reset] [Quit]"
|
||||
*/
|
||||
panicbug(CPU_MSG);
|
||||
CPU_ACTION;
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,292 @@
|
|||
/*
|
||||
* build68k.c - m68k CPU builder
|
||||
*
|
||||
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
|
||||
*
|
||||
* Inspired by Christian Bauer's Basilisk II
|
||||
*
|
||||
* This file is part of the ARAnyM project which builds a new and powerful
|
||||
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
|
||||
*
|
||||
* ARAnyM is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ARAnyM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ARAnyM; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/*
|
||||
* UAE - The Un*x Amiga Emulator
|
||||
*
|
||||
* Read 68000 CPU specs from file "table68k" and build table68k.c
|
||||
*
|
||||
* Copyright 1995,1996 Bernd Schmidt
|
||||
*/
|
||||
|
||||
#include "readcpu.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#undef abort
|
||||
|
||||
static FILE *tablef;
|
||||
static int nextch = 0;
|
||||
|
||||
static void getnextch(void)
|
||||
{
|
||||
do {
|
||||
nextch = fgetc(tablef);
|
||||
if (nextch == '%') {
|
||||
do {
|
||||
nextch = fgetc(tablef);
|
||||
} while (nextch != EOF && nextch != '\n');
|
||||
}
|
||||
} while (nextch != EOF && isspace(nextch));
|
||||
}
|
||||
|
||||
static int nextchtohex(void)
|
||||
{
|
||||
switch (isupper (nextch) ? tolower (nextch) : nextch) {
|
||||
case '0': return 0;
|
||||
case '1': return 1;
|
||||
case '2': return 2;
|
||||
case '3': return 3;
|
||||
case '4': return 4;
|
||||
case '5': return 5;
|
||||
case '6': return 6;
|
||||
case '7': return 7;
|
||||
case '8': return 8;
|
||||
case '9': return 9;
|
||||
case 'a': return 10;
|
||||
case 'b': return 11;
|
||||
case 'c': return 12;
|
||||
case 'd': return 13;
|
||||
case 'e': return 14;
|
||||
case 'f': return 15;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int no_insns = 0;
|
||||
|
||||
printf ("#include \"sysdeps.h\"\n");
|
||||
printf ("#include \"readcpu.h\"\n");
|
||||
printf ("struct instr_def defs68k[] = {\n");
|
||||
#if 0
|
||||
tablef = fopen("table68k","r");
|
||||
if (tablef == NULL) {
|
||||
fprintf(stderr, "table68k not found\n");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
tablef = stdin;
|
||||
#endif
|
||||
getnextch();
|
||||
while (nextch != EOF) {
|
||||
int cpulevel, plevel, sduse;
|
||||
int i;
|
||||
|
||||
char patbits[16];
|
||||
char opcstr[256];
|
||||
int bitpos[16];
|
||||
int flagset[5], flaguse[5];
|
||||
char cflow;
|
||||
|
||||
unsigned int bitmask,bitpattern;
|
||||
int n_variable;
|
||||
|
||||
n_variable = 0;
|
||||
bitmask = bitpattern = 0;
|
||||
memset (bitpos, 0, sizeof(bitpos));
|
||||
for(i=0; i<16; i++) {
|
||||
int currbit;
|
||||
bitmask <<= 1;
|
||||
bitpattern <<= 1;
|
||||
|
||||
switch (nextch) {
|
||||
case '0': currbit = bit0; bitmask |= 1; break;
|
||||
case '1': currbit = bit1; bitmask |= 1; bitpattern |= 1; break;
|
||||
case 'c': currbit = bitc; break;
|
||||
case 'C': currbit = bitC; break;
|
||||
case 'f': currbit = bitf; break;
|
||||
case 'i': currbit = biti; break;
|
||||
case 'I': currbit = bitI; break;
|
||||
case 'j': currbit = bitj; break;
|
||||
case 'J': currbit = bitJ; break;
|
||||
case 'k': currbit = bitk; break;
|
||||
case 'K': currbit = bitK; break;
|
||||
case 's': currbit = bits; break;
|
||||
case 'S': currbit = bitS; break;
|
||||
case 'd': currbit = bitd; break;
|
||||
case 'D': currbit = bitD; break;
|
||||
case 'r': currbit = bitr; break;
|
||||
case 'R': currbit = bitR; break;
|
||||
case 'z': currbit = bitz; break;
|
||||
case 'E': currbit = bitE; break;
|
||||
case 'p': currbit = bitp; break;
|
||||
default: abort();
|
||||
}
|
||||
if (!(bitmask & 1)) {
|
||||
bitpos[n_variable] = currbit;
|
||||
n_variable++;
|
||||
}
|
||||
|
||||
if (nextch == '0' || nextch == '1')
|
||||
bitmask |= 1;
|
||||
if (nextch == '1')
|
||||
bitpattern |= 1;
|
||||
patbits[i] = nextch;
|
||||
getnextch();
|
||||
}
|
||||
(void) patbits;
|
||||
|
||||
while (isspace(nextch) || nextch == ':') /* Get CPU and privilege level */
|
||||
getnextch();
|
||||
|
||||
switch (nextch) {
|
||||
case '0': cpulevel = 0; break;
|
||||
case '1': cpulevel = 1; break;
|
||||
case '2': cpulevel = 2; break;
|
||||
case '3': cpulevel = 3; break;
|
||||
case '4': cpulevel = 4; break;
|
||||
case '5': cpulevel = 5; break;
|
||||
default: abort();
|
||||
}
|
||||
getnextch();
|
||||
|
||||
switch (nextch) {
|
||||
case '0': plevel = 0; break;
|
||||
case '1': plevel = 1; break;
|
||||
case '2': plevel = 2; break;
|
||||
case '3': plevel = 3; break;
|
||||
default: abort();
|
||||
}
|
||||
getnextch();
|
||||
|
||||
while (isspace(nextch)) /* Get flag set information */
|
||||
getnextch();
|
||||
|
||||
if (nextch != ':')
|
||||
abort();
|
||||
|
||||
for(i = 0; i < 5; i++) {
|
||||
getnextch();
|
||||
switch(nextch){
|
||||
case '-': flagset[i] = fa_unset; break;
|
||||
case '/': flagset[i] = fa_isjmp; break;
|
||||
case '+': flagset[i] = fa_isbranch; break;
|
||||
case '0': flagset[i] = fa_zero; break;
|
||||
case '1': flagset[i] = fa_one; break;
|
||||
case 'x': flagset[i] = fa_dontcare; break;
|
||||
case '?': flagset[i] = fa_unknown; break;
|
||||
default: flagset[i] = fa_set; break;
|
||||
}
|
||||
}
|
||||
|
||||
getnextch();
|
||||
while (isspace(nextch))
|
||||
getnextch();
|
||||
|
||||
if (nextch != ':') /* Get flag used information */
|
||||
abort();
|
||||
|
||||
for(i = 0; i < 5; i++) {
|
||||
getnextch();
|
||||
switch(nextch){
|
||||
case '-': flaguse[i] = fu_unused; break;
|
||||
case '/': flaguse[i] = fu_isjmp; break;
|
||||
case '+': flaguse[i] = fu_maybecc; break;
|
||||
case '?': flaguse[i] = fu_unknown; break;
|
||||
default: flaguse[i] = fu_used; break;
|
||||
}
|
||||
}
|
||||
|
||||
getnextch();
|
||||
while (isspace(nextch))
|
||||
getnextch();
|
||||
|
||||
if (nextch != ':') /* Get control flow information */
|
||||
abort();
|
||||
|
||||
cflow = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
getnextch();
|
||||
switch(nextch){
|
||||
case '-': break;
|
||||
case 'R': cflow |= fl_return; break;
|
||||
case 'B': cflow |= fl_branch; break;
|
||||
case 'J': cflow |= fl_jump; break;
|
||||
case 'T': cflow |= fl_trap; break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
|
||||
getnextch();
|
||||
while (isspace(nextch))
|
||||
getnextch();
|
||||
|
||||
if (nextch != ':') /* Get source/dest usage information */
|
||||
abort();
|
||||
|
||||
getnextch();
|
||||
sduse = nextchtohex() << 4;
|
||||
getnextch();
|
||||
sduse |= nextchtohex();
|
||||
|
||||
getnextch();
|
||||
while (isspace(nextch))
|
||||
getnextch();
|
||||
|
||||
if (nextch != ':')
|
||||
abort();
|
||||
|
||||
assert(fgets(opcstr, 250, tablef) != NULL);
|
||||
getnextch();
|
||||
{
|
||||
int j;
|
||||
/* Remove superfluous spaces from the string */
|
||||
char *opstrp = opcstr, *osendp;
|
||||
int slen = 0;
|
||||
|
||||
while (isspace((int)*opstrp))
|
||||
opstrp++;
|
||||
|
||||
osendp = opstrp;
|
||||
while (*osendp) {
|
||||
if (!isspace ((int)*osendp))
|
||||
slen = osendp - opstrp + 1;
|
||||
osendp++;
|
||||
}
|
||||
opstrp[slen] = 0;
|
||||
|
||||
if (no_insns > 0)
|
||||
printf(",\n");
|
||||
no_insns++;
|
||||
printf("{ %d, %d, {", bitpattern, n_variable);
|
||||
for (j = 0; j < 16; j++) {
|
||||
printf("%d", bitpos[j]);
|
||||
if (j < 15)
|
||||
printf(",");
|
||||
}
|
||||
printf ("}, %d, %d, %d, { ", bitmask, cpulevel, plevel);
|
||||
for(i = 0; i < 5; i++) {
|
||||
printf("{ %d, %d }%c ", flaguse[i], flagset[i], i == 4 ? ' ' : ',');
|
||||
}
|
||||
printf("}, %d, %d, \"%s\"}", cflow, sduse, opstrp);
|
||||
}
|
||||
}
|
||||
printf("};\nint n_defs68k = %d;\n", no_insns);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,606 @@
|
|||
/*
|
||||
* compiler/compemu.h - Public interface and definitions
|
||||
*
|
||||
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
|
||||
*
|
||||
* Inspired by Christian Bauer's Basilisk II
|
||||
*
|
||||
* This file is part of the ARAnyM project which builds a new and powerful
|
||||
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
|
||||
*
|
||||
* JIT compiler m68k -> IA-32 and AMD64
|
||||
*
|
||||
* Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer
|
||||
* Adaptation for Basilisk II and improvements, copyright 2000-2004 Gwenole Beauchesne
|
||||
* Portions related to CPU detection come from linux/arch/i386/kernel/setup.c
|
||||
*
|
||||
* ARAnyM is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ARAnyM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ARAnyM; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMPEMU_H
|
||||
#define COMPEMU_H
|
||||
|
||||
// #include "sysconfig.h"
|
||||
#include "newcpu.h"
|
||||
|
||||
#ifdef UAE
|
||||
#ifdef CPU_64_BIT
|
||||
typedef uae_u64 uintptr;
|
||||
#else
|
||||
typedef uae_u32 uintptr;
|
||||
#endif
|
||||
/* FIXME: cpummu.cpp also checks for USE_JIT, possibly others */
|
||||
#define USE_JIT
|
||||
#endif
|
||||
|
||||
#ifdef USE_JIT
|
||||
|
||||
#ifdef JIT_DEBUG
|
||||
/* dump some information (m68k block, x86 block addresses) about the compiler state */
|
||||
extern void compiler_dumpstate(void);
|
||||
#endif
|
||||
|
||||
/* Now that we do block chaining, and also have linked lists on each tag,
|
||||
TAGMASK can be much smaller and still do its job. Saves several megs
|
||||
of memory! */
|
||||
#define TAGMASK 0x0000ffff
|
||||
#define TAGSIZE (TAGMASK+1)
|
||||
#define MAXRUN 1024
|
||||
#define cacheline(x) (((uintptr)x)&TAGMASK)
|
||||
|
||||
extern uae_u8* start_pc_p;
|
||||
extern uae_u32 start_pc;
|
||||
|
||||
struct blockinfo_t;
|
||||
|
||||
struct cpu_history {
|
||||
uae_u16* location;
|
||||
#ifdef UAE
|
||||
uae_u8 specmem;
|
||||
#endif
|
||||
};
|
||||
|
||||
union cacheline {
|
||||
cpuop_func* handler;
|
||||
blockinfo_t * bi;
|
||||
};
|
||||
|
||||
/* Use new spill/reload strategy when calling external functions */
|
||||
#define USE_OPTIMIZED_CALLS 0
|
||||
#if USE_OPTIMIZED_CALLS
|
||||
#error implementation in progress
|
||||
#endif
|
||||
|
||||
/* (gb) When on, this option can save save up to 30% compilation time
|
||||
* when many lazy flushes occur (e.g. apps in MacOS 8.x).
|
||||
*/
|
||||
#define USE_SEPARATE_BIA 1
|
||||
|
||||
/* Use chain of checksum_info_t to compute the block checksum */
|
||||
#define USE_CHECKSUM_INFO 1
|
||||
|
||||
/* Use code inlining, aka follow-up of constant jumps */
|
||||
#define USE_INLINING 1
|
||||
|
||||
/* Inlining requires the chained checksuming information */
|
||||
#if USE_INLINING
|
||||
#undef USE_CHECKSUM_INFO
|
||||
#define USE_CHECKSUM_INFO 1
|
||||
#endif
|
||||
|
||||
/* Does flush_icache_range() only check for blocks falling in the requested range? */
|
||||
#define LAZY_FLUSH_ICACHE_RANGE 0
|
||||
|
||||
#define USE_F_ALIAS 1
|
||||
#define USE_OFFSET 1
|
||||
#define COMP_DEBUG 1
|
||||
|
||||
#if COMP_DEBUG
|
||||
#define Dif(x) if (x)
|
||||
#else
|
||||
#define Dif(x) if (0)
|
||||
#endif
|
||||
|
||||
#define SCALE 2
|
||||
|
||||
#define BYTES_PER_INST 10240 /* paranoid ;-) */
|
||||
#if defined(CPU_arm)
|
||||
#define LONGEST_68K_INST 256 /* The number of bytes the longest possible
|
||||
68k instruction takes */
|
||||
#else
|
||||
#define LONGEST_68K_INST 16 /* The number of bytes the longest possible
|
||||
68k instruction takes */
|
||||
#endif
|
||||
#define MAX_CHECKSUM_LEN 2048 /* The maximum size we calculate checksums
|
||||
for. Anything larger will be flushed
|
||||
unconditionally even with SOFT_FLUSH */
|
||||
#define MAX_HOLD_BI 3 /* One for the current block, and up to two
|
||||
for jump targets */
|
||||
|
||||
#define INDIVIDUAL_INST 0
|
||||
#ifdef WINUAE_ARANYM
|
||||
#define FLAG_X 0x0010
|
||||
#define FLAG_N 0x0008
|
||||
#define FLAG_Z 0x0004
|
||||
#define FLAG_V 0x0002
|
||||
#define FLAG_C 0x0001
|
||||
#else
|
||||
#define FLAG_C 0x0010
|
||||
#define FLAG_V 0x0008
|
||||
#define FLAG_Z 0x0004
|
||||
#define FLAG_N 0x0002
|
||||
#define FLAG_X 0x0001
|
||||
#endif
|
||||
#define FLAG_CZNV (FLAG_C | FLAG_Z | FLAG_N | FLAG_V)
|
||||
#define FLAG_ALL (FLAG_C | FLAG_Z | FLAG_N | FLAG_V | FLAG_X)
|
||||
#define FLAG_ZNV (FLAG_Z | FLAG_N | FLAG_V)
|
||||
|
||||
#define KILLTHERAT 1 /* Set to 1 to avoid some partial_rat_stalls */
|
||||
|
||||
#if defined(CPU_arm)
|
||||
#define USE_DATA_BUFFER
|
||||
#define N_REGS 13 /* really 16, but 13 to 15 are SP, LR, PC */
|
||||
#else
|
||||
#if defined(CPU_x86_64)
|
||||
#define N_REGS 16 /* really only 15, but they are numbered 0-3,5-15 */
|
||||
#else
|
||||
#define N_REGS 8 /* really only 7, but they are numbered 0,1,2,3,5,6,7 */
|
||||
#endif
|
||||
#endif
|
||||
#define N_FREGS 6 /* That leaves us two positions on the stack to play with */
|
||||
|
||||
/* Functions exposed to newcpu, or to what was moved from newcpu.c to
|
||||
* compemu_support.c */
|
||||
#ifdef WINUAE_ARANYM
|
||||
extern void compiler_init(void);
|
||||
extern void compiler_exit(void);
|
||||
extern bool compiler_use_jit(void);
|
||||
#endif
|
||||
extern void flush(int save_regs);
|
||||
void flush_reg(int reg);
|
||||
extern void set_target(uae_u8* t);
|
||||
extern uae_u8* get_target(void);
|
||||
#ifdef UAE
|
||||
extern void build_comp(void);
|
||||
#endif
|
||||
extern void set_cache_state(int enabled);
|
||||
extern int get_cache_state(void);
|
||||
extern uae_u32 get_jitted_size(void);
|
||||
#ifdef JIT
|
||||
extern void (*flush_icache)(void);
|
||||
#endif
|
||||
extern void alloc_cache(void);
|
||||
extern int check_for_cache_miss(void);
|
||||
|
||||
/* JIT FPU compilation */
|
||||
struct jit_disable_opcodes {
|
||||
bool fbcc;
|
||||
bool fdbcc;
|
||||
bool fscc;
|
||||
bool ftrapcc;
|
||||
bool fsave;
|
||||
bool frestore;
|
||||
bool fmove;
|
||||
bool fmovem;
|
||||
bool fmovec; /* for move control register */
|
||||
bool fmovecr; /* for move from constant rom */
|
||||
bool fint;
|
||||
bool fsinh;
|
||||
bool fintrz;
|
||||
bool fsqrt;
|
||||
bool flognp1;
|
||||
bool fetoxm1;
|
||||
bool ftanh;
|
||||
bool fatan;
|
||||
bool fasin;
|
||||
bool fatanh;
|
||||
bool fsin;
|
||||
bool ftan;
|
||||
bool fetox;
|
||||
bool ftwotox;
|
||||
bool ftentox;
|
||||
bool flogn;
|
||||
bool flog10;
|
||||
bool flog2;
|
||||
bool fabs;
|
||||
bool fcosh;
|
||||
bool fneg;
|
||||
bool facos;
|
||||
bool fcos;
|
||||
bool fgetexp;
|
||||
bool fgetman;
|
||||
bool fdiv;
|
||||
bool fmod;
|
||||
bool fadd;
|
||||
bool fmul;
|
||||
bool fsgldiv;
|
||||
bool frem;
|
||||
bool fscale;
|
||||
bool fsglmul;
|
||||
bool fsub;
|
||||
bool fsincos;
|
||||
bool fcmp;
|
||||
bool ftst;
|
||||
};
|
||||
extern struct jit_disable_opcodes jit_disable;
|
||||
|
||||
|
||||
extern void comp_fpp_opp (uae_u32 opcode, uae_u16 extra);
|
||||
extern void comp_fbcc_opp (uae_u32 opcode);
|
||||
extern void comp_fscc_opp (uae_u32 opcode, uae_u16 extra);
|
||||
void comp_fdbcc_opp (uae_u32 opcode, uae_u16 extra);
|
||||
void comp_ftrapcc_opp (uae_u32 opcode, uaecptr oldpc);
|
||||
void comp_fsave_opp (uae_u32 opcode);
|
||||
void comp_frestore_opp (uae_u32 opcode);
|
||||
|
||||
extern uae_u32 needed_flags;
|
||||
extern uae_u8* comp_pc_p;
|
||||
extern void* pushall_call_handler;
|
||||
|
||||
#define VREGS 32
|
||||
#define VFREGS 16
|
||||
|
||||
#define INMEM 1
|
||||
#define CLEAN 2
|
||||
#define DIRTY 3
|
||||
#define UNDEF 4
|
||||
#define ISCONST 5
|
||||
|
||||
typedef struct {
|
||||
uae_u32* mem;
|
||||
uae_u32 val;
|
||||
uae_u8 is_swapped;
|
||||
uae_u8 status;
|
||||
uae_s8 realreg; /* gb-- realreg can hold -1 */
|
||||
uae_u8 realind; /* The index in the holds[] array */
|
||||
uae_u8 needflush;
|
||||
uae_u8 validsize;
|
||||
uae_u8 dirtysize;
|
||||
uae_u8 dummy;
|
||||
} reg_status;
|
||||
|
||||
typedef struct {
|
||||
uae_u32* mem;
|
||||
double val;
|
||||
uae_u8 status;
|
||||
uae_s8 realreg; /* gb-- realreg can hold -1 */
|
||||
uae_u8 realind;
|
||||
uae_u8 needflush;
|
||||
} freg_status;
|
||||
|
||||
#define SP_REG 15
|
||||
#define PC_P 16
|
||||
#define FLAGX 17
|
||||
#define FLAGTMP 18
|
||||
#define NEXT_HANDLER 19
|
||||
#define S1 20
|
||||
#define S2 21
|
||||
#define S3 22
|
||||
#define S4 23
|
||||
#define S5 24
|
||||
#define S6 25
|
||||
#define S7 26
|
||||
#define S8 27
|
||||
#define S9 28
|
||||
#define S10 29
|
||||
#define S11 30
|
||||
#define S12 31
|
||||
|
||||
#define FP_RESULT 8
|
||||
#define FS1 9
|
||||
#define FS2 10
|
||||
#define FS3 11
|
||||
|
||||
typedef struct {
|
||||
uae_u32 touched;
|
||||
uae_s8 holds[VREGS];
|
||||
uae_u8 nholds;
|
||||
uae_u8 canbyte;
|
||||
uae_u8 canword;
|
||||
uae_u8 locked;
|
||||
} n_status;
|
||||
|
||||
typedef struct {
|
||||
uae_u32 touched;
|
||||
uae_s8 holds[VFREGS];
|
||||
uae_u8 nholds;
|
||||
uae_u8 locked;
|
||||
} fn_status;
|
||||
|
||||
/* For flag handling */
|
||||
#define NADA 1
|
||||
#define TRASH 2
|
||||
#define VALID 3
|
||||
|
||||
/* needflush values */
|
||||
#define NF_SCRATCH 0
|
||||
#define NF_TOMEM 1
|
||||
#define NF_HANDLER 2
|
||||
|
||||
typedef struct {
|
||||
/* Integer part */
|
||||
reg_status state[VREGS];
|
||||
n_status nat[N_REGS];
|
||||
uae_u32 flags_on_stack;
|
||||
uae_u32 flags_in_flags;
|
||||
uae_u32 flags_are_important;
|
||||
/* FPU part */
|
||||
freg_status fate[VFREGS];
|
||||
fn_status fat[N_FREGS];
|
||||
|
||||
/* x86 FPU part */
|
||||
uae_s8 spos[N_FREGS];
|
||||
uae_s8 onstack[6];
|
||||
uae_s8 tos;
|
||||
} bigstate;
|
||||
|
||||
typedef struct {
|
||||
/* Integer part */
|
||||
uae_s8 virt[VREGS];
|
||||
uae_s8 nat[N_REGS];
|
||||
} smallstate;
|
||||
|
||||
extern int touchcnt;
|
||||
|
||||
#define IMM uae_s32
|
||||
#define RR1 uae_u32
|
||||
#define RR2 uae_u32
|
||||
#define RR4 uae_u32
|
||||
/*
|
||||
R1, R2, R4 collides with ARM registers defined in ucontext
|
||||
#define R1 uae_u32
|
||||
#define R2 uae_u32
|
||||
#define R4 uae_u32
|
||||
*/
|
||||
#define W1 uae_u32
|
||||
#define W2 uae_u32
|
||||
#define W4 uae_u32
|
||||
#define RW1 uae_u32
|
||||
#define RW2 uae_u32
|
||||
#define RW4 uae_u32
|
||||
#define MEMR uae_u32
|
||||
#define MEMW uae_u32
|
||||
#define MEMRW uae_u32
|
||||
#define MEMPTR uintptr
|
||||
#define MEMPTRR MEMPTR
|
||||
#define MEMPTRW MEMPTR
|
||||
#define MEMPTRRW MEMPTR
|
||||
|
||||
#define FW uae_u32
|
||||
#define FR uae_u32
|
||||
#define FRW uae_u32
|
||||
|
||||
#define MIDFUNC(nargs,func,args) void func args
|
||||
#define COMPCALL(func) func
|
||||
|
||||
#define LOWFUNC(flags,mem,nargs,func,args) static inline void func args
|
||||
|
||||
/* What we expose to the outside */
|
||||
#define DECLARE_MIDFUNC(func) extern void func
|
||||
|
||||
#if defined(CPU_arm)
|
||||
|
||||
#include "compemu_midfunc_arm.h"
|
||||
|
||||
#if defined(USE_JIT2)
|
||||
#include "compemu_midfunc_arm2.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPU_i386) || defined(CPU_x86_64)
|
||||
#include "compemu_midfunc_x86.h"
|
||||
#endif
|
||||
|
||||
#undef DECLARE_MIDFUNC
|
||||
|
||||
extern int failure;
|
||||
#define FAIL(x) do { failure|=x; } while (0)
|
||||
|
||||
/* Convenience functions exposed to gencomp */
|
||||
extern uae_u32 m68k_pc_offset;
|
||||
extern void readbyte(int address, int dest, int tmp);
|
||||
extern void readword(int address, int dest, int tmp);
|
||||
extern void readlong(int address, int dest, int tmp);
|
||||
extern void writebyte(int address, int source, int tmp);
|
||||
extern void writeword(int address, int source, int tmp);
|
||||
extern void writelong(int address, int source, int tmp);
|
||||
extern void writeword_clobber(int address, int source, int tmp);
|
||||
extern void writelong_clobber(int address, int source, int tmp);
|
||||
extern void get_n_addr(int address, int dest, int tmp);
|
||||
extern void get_n_addr_jmp(int address, int dest, int tmp);
|
||||
extern void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp);
|
||||
/* Set native Z flag only if register is zero */
|
||||
extern void set_zero(int r, int tmp);
|
||||
extern int kill_rodent(int r);
|
||||
#define SYNC_PC_OFFSET 100
|
||||
extern void sync_m68k_pc(void);
|
||||
extern uae_u32 get_const(int r);
|
||||
extern int is_const(int r);
|
||||
extern void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond);
|
||||
void compemu_make_sr(int sr, int tmp);
|
||||
void compemu_enter_super(int sr);
|
||||
void compemu_exc_make_frame(int format, int sr, int currpc, int nr, int tmp);
|
||||
void compemu_bkpt(void);
|
||||
extern bool disasm_this_inst;
|
||||
|
||||
#define comp_get_ibyte(o) do_get_mem_byte((uae_u8 *)(comp_pc_p + (o) + 1))
|
||||
#define comp_get_iword(o) do_get_mem_word((uae_u16 *)(comp_pc_p + (o)))
|
||||
#define comp_get_ilong(o) do_get_mem_long((uae_u32 *)(comp_pc_p + (o)))
|
||||
|
||||
struct blockinfo_t;
|
||||
|
||||
typedef struct dep_t {
|
||||
uae_u32* jmp_off;
|
||||
struct blockinfo_t* target;
|
||||
struct blockinfo_t* source;
|
||||
struct dep_t** prev_p;
|
||||
struct dep_t* next;
|
||||
} dependency;
|
||||
|
||||
typedef struct checksum_info_t {
|
||||
uae_u8 *start_p;
|
||||
uae_u32 length;
|
||||
struct checksum_info_t *next;
|
||||
} checksum_info;
|
||||
|
||||
typedef struct blockinfo_t {
|
||||
uae_s32 count;
|
||||
cpuop_func* direct_handler_to_use;
|
||||
cpuop_func* handler_to_use;
|
||||
/* The direct handler does not check for the correct address */
|
||||
|
||||
cpuop_func* handler;
|
||||
cpuop_func* direct_handler;
|
||||
|
||||
cpuop_func* direct_pen;
|
||||
cpuop_func* direct_pcc;
|
||||
|
||||
#ifdef UAE
|
||||
uae_u8* nexthandler;
|
||||
#endif
|
||||
uae_u8* pc_p;
|
||||
|
||||
uae_u32 c1;
|
||||
uae_u32 c2;
|
||||
#if USE_CHECKSUM_INFO
|
||||
checksum_info *csi;
|
||||
#else
|
||||
uae_u32 len;
|
||||
uae_u32 min_pcp;
|
||||
#endif
|
||||
|
||||
struct blockinfo_t* next_same_cl;
|
||||
struct blockinfo_t** prev_same_cl_p;
|
||||
struct blockinfo_t* next;
|
||||
struct blockinfo_t** prev_p;
|
||||
|
||||
uae_u8 optlevel;
|
||||
uae_u8 needed_flags;
|
||||
uae_u8 status;
|
||||
uae_u8 havestate;
|
||||
|
||||
dependency dep[2]; /* Holds things we depend on */
|
||||
dependency* deplist; /* List of things that depend on this */
|
||||
smallstate env;
|
||||
|
||||
#ifdef JIT_DEBUG
|
||||
/* (gb) size of the compiled block (direct handler) */
|
||||
uae_u32 direct_handler_size;
|
||||
#endif
|
||||
} blockinfo;
|
||||
|
||||
#define BI_INVALID 0
|
||||
#define BI_ACTIVE 1
|
||||
#define BI_NEED_RECOMP 2
|
||||
#define BI_NEED_CHECK 3
|
||||
#define BI_CHECKING 4
|
||||
#define BI_COMPILING 5
|
||||
#define BI_FINALIZING 6
|
||||
|
||||
void execute_normal(void);
|
||||
void exec_nostats(void);
|
||||
void do_nothing(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline void flush_icache(void) { }
|
||||
|
||||
#endif /* !USE_JIT */
|
||||
|
||||
#ifdef UAE
|
||||
|
||||
typedef struct {
|
||||
uae_u8 type;
|
||||
uae_u8 reg;
|
||||
uae_u32 next;
|
||||
} regacc;
|
||||
|
||||
#define JIT_EXCEPTION_HANDLER
|
||||
// #define JIT_ALWAYS_DISTRUST
|
||||
|
||||
/* ARAnyM uses fpu_register name, used in scratch_t */
|
||||
/* FIXME: check that no ARAnyM code assumes different floating point type */
|
||||
typedef fptype fpu_register;
|
||||
|
||||
extern void compile_block(cpu_history* pc_hist, int blocklen, int totcyles);
|
||||
|
||||
#define MAXCYCLES (1000 * CYCLE_UNIT)
|
||||
#define scaled_cycles(x) (currprefs.m68k_speed<0?(((x)/SCALE)?(((x)/SCALE<MAXCYCLES?((x)/SCALE):MAXCYCLES)):1):(x))
|
||||
|
||||
/* Flags for Bernie during development/debugging. Should go away eventually */
|
||||
#define DISTRUST_CONSISTENT_MEM 0
|
||||
|
||||
typedef struct {
|
||||
uae_u8 use_flags;
|
||||
uae_u8 set_flags;
|
||||
uae_u8 is_jump;
|
||||
uae_u8 is_addx;
|
||||
uae_u8 is_const_jump;
|
||||
} op_properties;
|
||||
|
||||
extern op_properties prop[65536];
|
||||
|
||||
STATIC_INLINE int end_block(uae_u16 opcode)
|
||||
{
|
||||
return prop[opcode].is_jump ||
|
||||
(prop[opcode].is_const_jump && !currprefs.comp_constjump);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
LONG WINAPI EvalException(LPEXCEPTION_POINTERS info);
|
||||
#if defined(_MSC_VER) && !defined(NO_WIN32_EXCEPTION_HANDLER)
|
||||
#ifdef _WIN64
|
||||
/* Structured exception handling is table based for Windows x86-64, so
|
||||
* Windows will not be able to find the exception handler. */
|
||||
#else
|
||||
#define USE_STRUCTURED_EXCEPTION_HANDLING
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void jit_abort(const char *format,...);
|
||||
#if SIZEOF_TCHAR != 1
|
||||
void jit_abort(const TCHAR *format, ...);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef WINUAE_ARANYM
|
||||
#define jit_log(format, ...) D(bug(format, ##__VA_ARGS__))
|
||||
#define jit_log2(format, ...) D2(bug(format, ##__VA_ARGS__))
|
||||
void jit_abort(const char *format,...) __attribute__((format(printf, 1, 2))) __attribute__((__noreturn__));
|
||||
#else
|
||||
#define jit_abort(...) abort()
|
||||
#define jit_log panicbug
|
||||
#define jit_log2(...)
|
||||
#endif
|
||||
|
||||
#endif /* UAE */
|
||||
|
||||
#ifdef CPU_64_BIT
|
||||
static inline uae_u32 check_uae_p32(uintptr address, const char *file, int line)
|
||||
{
|
||||
if (address > (uintptr_t) 0xffffffff) {
|
||||
jit_abort("JIT: 64-bit pointer (0x%llx) at %s:%d (fatal)",
|
||||
(unsigned long long)address, file, line);
|
||||
}
|
||||
return (uae_u32) address;
|
||||
}
|
||||
#define uae_p32(x) (check_uae_p32((uintptr)(x), __FILE__, __LINE__))
|
||||
#else
|
||||
#define uae_p32(x) ((uae_u32)(x))
|
||||
#endif
|
||||
|
||||
#endif /* COMPEMU_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue