diff --git a/.editorconfig b/.editorconfig index 439c21cc..7fa149a3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -37,3 +37,8 @@ indent_style = space indent_size = 2 max_line_length = 80 +# Java overrides. +[*.{java}] +indent_style = space +indent_size = 2 +max_line_length = 80 diff --git a/.efrocachemap b/.efrocachemap index 9c6ef01f..e7ffc533 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -421,10 +421,10 @@ "build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26", "build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8", "build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55", - "build/assets/ba_data/data/langdata.json": "229f9ecdddd777a0be2471979a0a01d6", - "build/assets/ba_data/data/languages/arabic.json": "e0001d8542c904bc3c98a174f256efd9", + "build/assets/ba_data/data/langdata.json": "c6f94f9c1dc833c537d16672d9018b94", + "build/assets/ba_data/data/languages/arabic.json": "00ba700de6c672a56658a6bd1ad27523", "build/assets/ba_data/data/languages/belarussian.json": "7fe38341815ca6ff4d95224196e7a67e", - "build/assets/ba_data/data/languages/chinese.json": "4e2f4f1f38216940953fcbee4da1563e", + "build/assets/ba_data/data/languages/chinese.json": "5761468d25f2bd4e79921826cebd572b", "build/assets/ba_data/data/languages/chinesetraditional.json": "f858da49be0a5374157c627857751078", "build/assets/ba_data/data/languages/croatian.json": "766532c67af5bd0144c2d63cab0516fa", "build/assets/ba_data/data/languages/czech.json": "93c5fe0d884d95435da6c675f64e30e0", @@ -439,11 +439,11 @@ "build/assets/ba_data/data/languages/greek.json": "287c0ec437b38772284ef9d3e4fb2fc3", "build/assets/ba_data/data/languages/hindi.json": "8848f6b0caec0fcf9d85bc6e683809ec", "build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e", - "build/assets/ba_data/data/languages/indonesian.json": "97657eb2ab75d821045387b6d7a2b52d", - "build/assets/ba_data/data/languages/italian.json": "cda5760f247500657722c279bc2f2bc7", - "build/assets/ba_data/data/languages/korean.json": "ca1122a9ee551da3f75ae632012bd0e2", + "build/assets/ba_data/data/languages/indonesian.json": "408fb026e84c24a8dd7a43cb2b794541", + "build/assets/ba_data/data/languages/italian.json": "f2f5641bc924dfba37af2aac03e469e0", + "build/assets/ba_data/data/languages/korean.json": "ae179765711bead59d0de7fb15fac72f", "build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38", - "build/assets/ba_data/data/languages/persian.json": "4f448b29ba04f2b789329600cb7f9ab7", + "build/assets/ba_data/data/languages/persian.json": "d742f4a6d3c3555031102b21abdcbb5b", "build/assets/ba_data/data/languages/polish.json": "b9a58b70ed5e99d8b7fa2392b2eb0cda", "build/assets/ba_data/data/languages/portuguese.json": "556af4e8170356ad239412e1743e20d5", "build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826", @@ -946,11 +946,11 @@ "build/assets/ba_data/meshes/zoeUpperArm.bob": "a8a881010ac1ee9ec5ca872d5c5e853a", "build/assets/ba_data/meshes/zoeUpperLeg.bob": "95b2502f74c70f934927f67cd505c3ad", "build/assets/ba_data/python-site-packages/_yaml/__init__.py": "b09d1968d73a04d6cf20e4e79657a6e7", - "build/assets/ba_data/python-site-packages/certifi/__init__.py": "6337efa17f5b457b793332df33904162", + "build/assets/ba_data/python-site-packages/certifi/__init__.py": "b1fb6436db400125ecbb288262d00f0f", "build/assets/ba_data/python-site-packages/certifi/__main__.py": "ef02e73f8581609df189a9f61aca365b", - "build/assets/ba_data/python-site-packages/certifi/cacert.pem": "6ac29a6bccca11cd2ed7e16e27dfccec", + "build/assets/ba_data/python-site-packages/certifi/cacert.pem": "4422aed09ab445f7290df7d72a301a47", "build/assets/ba_data/python-site-packages/certifi/core.py": "1b505388f1475fabd1b60031f985271c", - "build/assets/ba_data/python-site-packages/typing_extensions.py": "084d93bb609d798a3930dfb5e25eba59", + "build/assets/ba_data/python-site-packages/typing_extensions.py": "2d974cad17a71505d86513d1322976a5", "build/assets/ba_data/python-site-packages/yaml/__init__.py": "2b747e5772c203377222afc888ac6b71", "build/assets/ba_data/python-site-packages/yaml/composer.py": "cef871e1f5f99ba2a7c44941b70afb06", "build/assets/ba_data/python-site-packages/yaml/constructor.py": "8a15e361e34b79491c81553bb3534062", @@ -2586,21 +2586,21 @@ "build/assets/pylib-android/_pyio.py": "a6e88d66fbca88b13213cdd2177390b8", "build/assets/pylib-android/_sitebuiltins.py": "8b5e3f6e73917962fa014ad2c4a55e61", "build/assets/pylib-android/_strptime.py": "ff699c3f7647db7621bb88c43cc282d3", - "build/assets/pylib-android/_sysconfigdata__linux_aarch64-linux-android.py": "cb9a77b04173c8776365999b57186e36", - "build/assets/pylib-android/_sysconfigdata__linux_arm-linux-androideabi.py": "6d50596ec7f4858a0c6a5edefde21f7a", - "build/assets/pylib-android/_sysconfigdata__linux_i686-linux-android.py": "bf9358a2243aa7884b8e80d85c969fa5", - "build/assets/pylib-android/_sysconfigdata__linux_x86_64-linux-android.py": "45eee0efbc2441535b94a8ad5acf4d2e", - "build/assets/pylib-android/_sysconfigdata_d_linux_aarch64-linux-android.py": "f8ff271cf6df0b5b4d46d9c548abb84e", - "build/assets/pylib-android/_sysconfigdata_d_linux_arm-linux-androideabi.py": "da171b290c06a34d6a5cfbb296c22c34", - "build/assets/pylib-android/_sysconfigdata_d_linux_i686-linux-android.py": "dde2516b5ac29412dfbebaa7b3de0d0d", - "build/assets/pylib-android/_sysconfigdata_d_linux_x86_64-linux-android.py": "7df452144c6630afb96951487c1257a0", + "build/assets/pylib-android/_sysconfigdata__linux_aarch64-linux-android.py": "b1a9ca985ff6a159aa5ef94abd287f46", + "build/assets/pylib-android/_sysconfigdata__linux_arm-linux-androideabi.py": "21a5842f39c86fccaaa0a30e0e4ab347", + "build/assets/pylib-android/_sysconfigdata__linux_i686-linux-android.py": "9349023049d7599da61456b3f9a9687b", + "build/assets/pylib-android/_sysconfigdata__linux_x86_64-linux-android.py": "4151fa62c11c32cddf538e5cc7647160", + "build/assets/pylib-android/_sysconfigdata_d_linux_aarch64-linux-android.py": "d9f7f1d3f5b89b08150dfa00cf243901", + "build/assets/pylib-android/_sysconfigdata_d_linux_arm-linux-androideabi.py": "f4b99d4501a1cf1eb20fbc8973fa0040", + "build/assets/pylib-android/_sysconfigdata_d_linux_i686-linux-android.py": "454094da5fe52a969b53bb46d360da84", + "build/assets/pylib-android/_sysconfigdata_d_linux_x86_64-linux-android.py": "1e23f45f4243c1aacc83f23ad5852390", "build/assets/pylib-android/_threading_local.py": "4a9688e3987d7d692db46feb9214945e", "build/assets/pylib-android/_weakrefset.py": "e4fa8532ace46dfbc35149c41ea497f7", "build/assets/pylib-android/abc.py": "a0daa1ed187eee8690c1e8438b97da90", "build/assets/pylib-android/aifc.py": "1b9134c72b1e542417bee5bf345a1d0a", "build/assets/pylib-android/antigravity.py": "6d56bedf73be574cb6d7117caf5d334c", "build/assets/pylib-android/argparse.py": "e22cac9b12c09592929d57eb982fc554", - "build/assets/pylib-android/ast.py": "3aaa1b0e56b21b28155707c54bc225a8", + "build/assets/pylib-android/ast.py": "f287ccaa1cd7cb0ea256e3984fd4ce4d", "build/assets/pylib-android/asynchat.py": "2ef3a0ce322332fabbf8fad4e133c6a3", "build/assets/pylib-android/asyncio/__init__.py": "edf0e79e2b8b85c08f09fd14668e4822", "build/assets/pylib-android/asyncio/__main__.py": "8e391b47f448ad922dc2614dbd93011e", @@ -2624,10 +2624,10 @@ "build/assets/pylib-android/asyncio/selector_events.py": "a108fbd3a49f967da245f39cebf7694e", "build/assets/pylib-android/asyncio/sslproto.py": "2ec1b21e523055147d94c8c634154aab", "build/assets/pylib-android/asyncio/staggered.py": "f5056f0a56b73b477a9fa65e71145366", - "build/assets/pylib-android/asyncio/streams.py": "f00ddd2b2fd74554ae1d3088bd9d2bfd", - "build/assets/pylib-android/asyncio/subprocess.py": "edb8d98278300b6c99f36cd08643c743", + "build/assets/pylib-android/asyncio/streams.py": "8cc026c067fc9245568199ea659167df", + "build/assets/pylib-android/asyncio/subprocess.py": "46e8b0ba32b4ac7bb5f840c49c89c85a", "build/assets/pylib-android/asyncio/taskgroups.py": "5162e5b1806d9b647383d34ba1b21b56", - "build/assets/pylib-android/asyncio/tasks.py": "234550593cd4928e6ee2c9591b6928ca", + "build/assets/pylib-android/asyncio/tasks.py": "c1bc59c01792bac43b79b425bb61e10e", "build/assets/pylib-android/asyncio/threads.py": "7bbf81d424901524510e07b5d20e4a50", "build/assets/pylib-android/asyncio/timeouts.py": "c7cb81c7ee938bc47ff75342befc872a", "build/assets/pylib-android/asyncio/transports.py": "04598090d813bb363cea9bf714b97c3f", @@ -2641,13 +2641,13 @@ "build/assets/pylib-android/bisect.py": "9b70437e327d5176da41192567ad0064", "build/assets/pylib-android/bz2.py": "cd6a5f2491bc52afd8fc180097371473", "build/assets/pylib-android/cProfile.py": "9e9c07ac3b9e4195a62b74e4f2b9489f", - "build/assets/pylib-android/calendar.py": "4ef3d6d85d44e36212e5d784051c80b6", + "build/assets/pylib-android/calendar.py": "18df862e8e3c3fcbe4ab8a0b0348e339", "build/assets/pylib-android/cgi.py": "090c5cfc8b4b92a730beec975159bd2a", "build/assets/pylib-android/cgitb.py": "2bcff1cec7f3a3a9c96de7a55ebb4ea3", "build/assets/pylib-android/chunk.py": "13d7633b1ff28f5aed4eb043c65c99c5", "build/assets/pylib-android/cmd.py": "8befee2654b0954af7886e24e2e7871f", "build/assets/pylib-android/code.py": "5d47099984013b933c96b02ef16981b8", - "build/assets/pylib-android/codecs.py": "6fac5e2969e98ceaba92d3b8e42cb2ec", + "build/assets/pylib-android/codecs.py": "e11eabe4824899dea4b26a89a568a361", "build/assets/pylib-android/codeop.py": "d375467fb29fccd43ab94d15a2e63085", "build/assets/pylib-android/collections/__init__.py": "dcffbb6ee2cadd0c05ad22f2ef41f89b", "build/assets/pylib-android/collections/abc.py": "15f410d3821352033a90a04539c99060", @@ -2656,7 +2656,7 @@ "build/assets/pylib-android/concurrent/__init__.py": "aa990702e8f3a7af205efb5ae23a7c85", "build/assets/pylib-android/concurrent/futures/__init__.py": "3e46fadb9de9c995c37dca4311641d6a", "build/assets/pylib-android/concurrent/futures/_base.py": "a1cd37aea6fe0efff1bc00a39543609e", - "build/assets/pylib-android/concurrent/futures/process.py": "a44e8618e158f8f351dafcb566a02544", + "build/assets/pylib-android/concurrent/futures/process.py": "1d1bb7b14e3999b383ba8bd11aa8951c", "build/assets/pylib-android/concurrent/futures/thread.py": "e63753b8201f1392dbebc84a15054a13", "build/assets/pylib-android/configparser.py": "914afd2b2cec90bbca0b94fd176b5176", "build/assets/pylib-android/contextlib.py": "6f52eac914e438ef54407760def8305f", @@ -2680,7 +2680,7 @@ "build/assets/pylib-android/curses/panel.py": "8f36fdade9588f8a4362d2cc057a6eff", "build/assets/pylib-android/curses/textpad.py": "94aa9ebc47a6068d4461652346646dbb", "build/assets/pylib-android/dataclasses.py": "febeea138bff21dbed88762be772514e", - "build/assets/pylib-android/datetime.py": "5dcfd7f3b1a4db8214c1442164ac999c", + "build/assets/pylib-android/datetime.py": "521d6767afcfef887ac4c3719386b8fd", "build/assets/pylib-android/decimal.py": "f57d255d45b5d1d7d8e13c41a283c3e4", "build/assets/pylib-android/difflib.py": "6b3c8fd541b2b8d0320727025cd25275", "build/assets/pylib-android/dis.py": "cecdc0c02aa3d70a7f550e60ebc9b3ba", @@ -2836,7 +2836,7 @@ "build/assets/pylib-android/encodings/utf_8_sig.py": "8f3542863ef311d8b970a37c0d66b0de", "build/assets/pylib-android/encodings/uu_codec.py": "4ef8a65413574c017a96b97fc1638ba6", "build/assets/pylib-android/encodings/zlib_codec.py": "1388fb103fdf395451bfc8a2d60933a9", - "build/assets/pylib-android/enum.py": "73b214a43ceef88aff7098b83623ed09", + "build/assets/pylib-android/enum.py": "e2a5734675e418870d7b379b5dba1ed3", "build/assets/pylib-android/filecmp.py": "7648fdc6d0fc8bae7429d5e4081cf353", "build/assets/pylib-android/fileinput.py": "c3def1041e6b12dd5f1906c9dbbd1101", "build/assets/pylib-android/fnmatch.py": "a1bc67633695d4defd4c0886428c5363", @@ -2916,7 +2916,7 @@ "build/assets/pylib-android/optparse.py": "5f65f891612b68c71a2846da86254285", "build/assets/pylib-android/os.py": "36f9692131ffb9ba4db510de31afc651", "build/assets/pylib-android/pathlib.py": "095ec821fec243124d0a286b4de3848a", - "build/assets/pylib-android/pdb.py": "117b0d24ccb89edc5f183c94f6722f70", + "build/assets/pylib-android/pdb.py": "c44527d9e905ca3b1b45d3c158df730a", "build/assets/pylib-android/pickle.py": "e6f9f53d29988454690ccde3279c7c38", "build/assets/pylib-android/pickletools.py": "85b30fba86d32dfc4a588300dedf5f01", "build/assets/pylib-android/pipes.py": "2dd796bdbb87982034234fec50d4526c", @@ -2945,10 +2945,10 @@ "build/assets/pylib-android/runpy.py": "3a2dd98314791c7e36b6bd3585f6ad82", "build/assets/pylib-android/sched.py": "f5579c8c711dd3e89da70ec9e1788c9c", "build/assets/pylib-android/secrets.py": "bbf9ed672044ef3ab4b83ca2aea1644e", - "build/assets/pylib-android/selectors.py": "98e0d83849452cbc2cc1381555bd5024", + "build/assets/pylib-android/selectors.py": "3c94b3b678c473543cdc7f1d2b20a6f6", "build/assets/pylib-android/shelve.py": "3e569c07c863ecbd7f35a6c382d1785a", "build/assets/pylib-android/shlex.py": "0873fac90a491702950816ead0e59dd0", - "build/assets/pylib-android/shutil.py": "a5d0ee9f28244b42a06e682312d0e3fa", + "build/assets/pylib-android/shutil.py": "aa636d67785c2e92d34c7c5c81f9e8c5", "build/assets/pylib-android/signal.py": "114ef47b1798fca6f56ac8a250974b3e", "build/assets/pylib-android/site.py": "2a99f7de2702aa8411d35acbb91fe926", "build/assets/pylib-android/smtpd.py": "0602b6a39c4e37133303bee16c3e28a4", @@ -2958,7 +2958,7 @@ "build/assets/pylib-android/socketserver.py": "98e33643181a54765e6d0b9e01b03d53", "build/assets/pylib-android/sqlite3/__init__.py": "8838d75ad0e465e25bb0c8dfeab7a9ab", "build/assets/pylib-android/sqlite3/dbapi2.py": "c85f3ff9ddbd56683a8c801885dc5e53", - "build/assets/pylib-android/sqlite3/dump.py": "8364bd18be01acf7e56e168db98c0e6f", + "build/assets/pylib-android/sqlite3/dump.py": "8d2085ec40031d544694759608e53178", "build/assets/pylib-android/sre_compile.py": "a1784e9ccbea7d9963cab75b536b40c8", "build/assets/pylib-android/sre_constants.py": "5c5be32a5334d9b0a848dad520746a63", "build/assets/pylib-android/sre_parse.py": "cca15b9ab31509e6642f9d2fd4fb9d91", @@ -2978,8 +2978,8 @@ "build/assets/pylib-android/tempfile.py": "436007fbe6821c864a53861bd73b4d43", "build/assets/pylib-android/textwrap.py": "3eb16a40553205dc96be5cb9039f3c8c", "build/assets/pylib-android/this.py": "8b0a9a1fa0a45a37e6c656eca1922277", - "build/assets/pylib-android/threading.py": "dda98a9e1169adb496655300454ecc09", - "build/assets/pylib-android/timeit.py": "8dc6f4245abf1d44814745e22a2f78b1", + "build/assets/pylib-android/threading.py": "3354bf0cad72286a0532b0754de78704", + "build/assets/pylib-android/timeit.py": "c918c7dee7538ff6e5a92288f55b4327", "build/assets/pylib-android/token.py": "d8ff4e6c8eb59896891d01148f481e27", "build/assets/pylib-android/tokenize.py": "3056f048c07e6c5a6442a5ef4f38e54c", "build/assets/pylib-android/tomllib/__init__.py": "253ecf9dd67cb81a3e19911a4a39f930", @@ -2987,7 +2987,7 @@ "build/assets/pylib-android/tomllib/_re.py": "0e509117e16c41c491615e06bb98861d", "build/assets/pylib-android/tomllib/_types.py": "07be9616d6f5e401fd31fbeea619fc97", "build/assets/pylib-android/trace.py": "3d8698a2c3ec03dc0f394a2f48c2ffbc", - "build/assets/pylib-android/traceback.py": "91f67818e621e3b2f5bf583ed6863ef8", + "build/assets/pylib-android/traceback.py": "668bd36fc103a89554d2f9202a07f56d", "build/assets/pylib-android/tracemalloc.py": "e4d10d2bee7773566e46797a939e5cbf", "build/assets/pylib-android/tty.py": "271c7d61005a0a3c2c0952efc60dcb6d", "build/assets/pylib-android/types.py": "78f8942c08dbfc9c582f1bb8d5206639", @@ -4056,50 +4056,50 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "19f758d463a96209e647e651c611d1b9", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "49506eff59a21d3cfb6fc55db4edeeae", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "1cd9dfdc832995ba84386803c2eb3d7e", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "f9786e628a44b5d14dbd842e29f37b4d", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "a21e3ab1ec336eb8f957deeee96926e4", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "e93a34b23530cf29d443529af6a42d4c", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "2ecbe46fb8b6ddb96340e35e53d7e73e", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "37d5f679d73736214f8d12980028511d", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "b09fbdc4f44383ed0111ac19b13371dd", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "b8332772459f472a559e05002ce6921c", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "5e0cfb078710084739280d17cbc86732", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "6b25f48718896540a46e9aef9f993c51", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "940db05971335a1a8a84e96adc948a84", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "98ab1223c634600b44e2c407b3cee6e2", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "3c1be40378854bffa24a2e118979e252", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "a1a8830a0892b6a8ed8827241cf848aa", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "27b755855aa9ebe54e536ad04a82b867", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f291bcc463de9b5172904304774d1c12", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "16bb769fd794945b09d6ed40ab11a411", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "83a5455b631ececcddf5330693c2d38a", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "ac33b224e5b4e35712eb98fcc20cab5b", - "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "81ac92010f7957feffde3573745976d2", - "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ac33b224e5b4e35712eb98fcc20cab5b", - "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "81ac92010f7957feffde3573745976d2", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "1d2d67df52456863593f5a32ee591c5f", - "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "4360984cf0a0e1664bd052894ebc522e", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "1d2d67df52456863593f5a32ee591c5f", - "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "4360984cf0a0e1664bd052894ebc522e", - "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "f86bc9554c44e6a3041ee06ff7690ae2", - "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "c6815480bdfcbbb30ffe06bfc25a3fd2", - "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "f86bc9554c44e6a3041ee06ff7690ae2", - "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "c6815480bdfcbbb30ffe06bfc25a3fd2", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "8e3f285a0d05918175c6054b3841621e", - "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "5ec40f0445bc6415d9327c5b1cb0f645", - "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "2793d3aea54fc937322393dd779412a7", - "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "5ec40f0445bc6415d9327c5b1cb0f645", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "d254bb364aa44360cac2003934af76f6", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "0db2f48d7a46826de315df7ce473ab52", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "5ec488e800f024c0827deb229e4e1efc", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "430045c8d5f966488628ab5de5452e10", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "892c0eb2ec182ccbdcb604713d5d5ba9", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "3b2917f0882ac5889c12f2ca83269063", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "bef209af05f0af8ee5fe6d33246d846d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "93a8f27c51283913e35b0e2d8b8a37b0", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ead20e58b2cf88e71b324dba1468a5ec", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "80fd8e740193e6f7ff47aafdb29beb99", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "669fef14d4eb8f939a6da857808cc834", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ee04459b54e94495a1aefd67628f7a01", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "4faea0209f862b3b3efbf8ef570d0ae0", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "d6265890c3e384917e7979325be5a7af", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "9d9365749d358cd3543f72b07b5416cc", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "730dd0cb27af4dee2e42174718dc36a6", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "30bf588730c95523b6891a9431ad9897", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "a0e734e97483f608b0da91721c42f416", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b44c311262ed6958da11b9143b4747ea", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "c576e665ed6fbccb14d5591dcfef2560", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "b8095344948530377d5c4147cfaad3ec", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "1d4f2efd3d2d9e718fd30da5972e605e", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "331d85d66cc8e3707401ff847239a973", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "20d4ff570dcbdc53162cd03a2bc5127a", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "58dc3dcaf0e5da291ffaa728c42d080c", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "e2d33100dd91a8526168246e693008cd", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "616cab068c995c4e70b0f173662565cf", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "7a26ee8376f752ffb010f6360ba090c7", + "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "c22901e06e88a55cce0b4e08bbf41a4c", + "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "a27963487e346338e4c216bd4fbb9e2a", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "c22901e06e88a55cce0b4e08bbf41a4c", + "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "a27963487e346338e4c216bd4fbb9e2a", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "2663c888aec894656bd8c49932bd7729", + "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "5e57d12a3cfcfbc47b0293c3cb9fdca9", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "2663c888aec894656bd8c49932bd7729", + "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "5e57d12a3cfcfbc47b0293c3cb9fdca9", + "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "0f7dbe6fb3e28a51904aa822b509da0f", + "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "081b766945b52460a4f1afc01faa0652", + "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "0f7dbe6fb3e28a51904aa822b509da0f", + "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "081b766945b52460a4f1afc01faa0652", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "ad609c63f68417d5211bbfb23ce4affe", + "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "852fe46c736082611a831a618923c241", + "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "36fbda7829ed5c2862c34feb09b03402", + "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "852fe46c736082611a831a618923c241", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "b497de63fb2370a7e893a4dd93c3e020", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "210cb0d4ec77da138c08ed5428a4ce1e", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "615cc61b2431de1ee68f4c12210d3174", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "42ddbc2ec78390ec90d584b667fb21fd", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "5af8897e9a047b1b80404c22e0e50123", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "6c6e15126d40ed6839e0fdf2fdfc7018", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "5a70719bd76a7553fcc849472eb71875", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "0f2ec390a0306d1a9003cceb972fddee", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "28323912b56ec07701eda3d41a6a4101", "src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f", diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d91285..d6461787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,30 @@ -### 1.7.29 (build 21612, api 8, 2023-11-20) +### 1.7.30 (build 21623, api 8, 2023-11-28) +- Continued work on the big 1.7.28 update. +- Got the Android version back up and running. There's been lots of cleanup and + simplification on the Android layer, cleaning out years of cruft. This should + put things in a better more maintainable place, but there will probably be + some bugs to iron out, so please holler if you run into any. +- Minimum supported Android version has been bumped from 5.0 to 6.0. Some + upcoming tech such as ASTC textures will likely not be well supported on such + old devices, so I think it is better to leave them running an older version + that performs decently instead of a newer version that performs poorly. And + letting go of old Android versions lets us better support new ones. +- Android version now uses the 'Oboe' library as an audio back-end instead of + OpenSL. This should result in better behaving audio in general. Please holler + if you experience otherwise. +- Bundled Android Python has been bumped to version 3.11.6. +- Android app suspend behavior has been revamped. The app should stay running + more often and be quicker to respond when dialogs or other activities + temporarily pop up in front of it. Please holler if you run into strange side + effects such as the app continuing to play audio when it should not be. + +### 1.7.29 (build 21619, api 8, 2023-11-21) -- Simply continued work on the big 1.7.28 update. I finally got the Mac App - Store version of the game updated (it had been stuck at 1.4!), and it turns - out that Apple AppStore submissions require the version number to increase - each time and not just the build number, so we may start seeing more minor - version bumps for that reason. +- Simply continued work on the big 1.7.28 update. I was able to finally start + updating the Mac App Store version of the game again (it had been stuck at + 1.4!), and it turns out that Apple AppStore submissions require the version + number to increase each time and not just the build number, so we may start + seeing more minor version number bumps for that reason. - Windows builds should now die with a clear error when the OpenGL version is too old (OpenGL 3.0 or newer is required). Previously they could die with more cryptic error messages such as "OpenGL function 'glActiveTexture2D' not diff --git a/src/assets/ba_data/python/baclassic/_benchmark.py b/src/assets/ba_data/python/baclassic/_benchmark.py index 6bb22743..569f9d64 100644 --- a/src/assets/ba_data/python/baclassic/_benchmark.py +++ b/src/assets/ba_data/python/baclassic/_benchmark.py @@ -55,7 +55,6 @@ def run_stress_test( round_duration: int = 30, ) -> None: """Run a stress test.""" - from babase import modutils babase.screenmessage( "Beginning stress test.. use 'End Test' to stop testing.", @@ -70,17 +69,6 @@ def run_stress_test( 'round_duration': round_duration, } ) - babase.apptimer( - 7.0, - babase.Call( - babase.screenmessage, - ( - 'stats will be written to ' - + modutils.get_human_readable_user_scripts_path() - + '/stress_test_stats.csv' - ), - ), - ) def stop_stress_test() -> None: diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 837fa6a7..e2561304 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -52,8 +52,8 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21612 -TARGET_BALLISTICA_VERSION = '1.7.29' +TARGET_BALLISTICA_BUILD = 21623 +TARGET_BALLISTICA_VERSION = '1.7.30' @dataclass diff --git a/src/assets/ba_data/python/bauiv1lib/settings/graphics.py b/src/assets/ba_data/python/bauiv1lib/settings/graphics.py index 1c235095..7e20a537 100644 --- a/src/assets/ba_data/python/bauiv1lib/settings/graphics.py +++ b/src/assets/ba_data/python/bauiv1lib/settings/graphics.py @@ -267,9 +267,7 @@ class GraphicsSettingsWindow(bui.Window): bui.Lstr(resource='nativeText'), ] for res in [1440, 1080, 960, 720, 480]: - # Nav bar is 72px so lets allow for that in what - # choices we show. - if native_res[1] >= res - 72: + if native_res[1] >= res: res_str = f'{res}p' choices.append(res_str) choices_display.append(bui.Lstr(value=res_str)) diff --git a/src/ballistica/base/app_adapter/app_adapter.cc b/src/ballistica/base/app_adapter/app_adapter.cc index 5f0a8b59..891f0fe8 100644 --- a/src/ballistica/base/app_adapter/app_adapter.cc +++ b/src/ballistica/base/app_adapter/app_adapter.cc @@ -67,15 +67,15 @@ void AppAdapter::OnAppUnsuspend_() { // menu doesn't really accomplish anything there. // // In general this probably should be handled at a higher level. - if (g_core->should_pause_active_game) { - g_core->should_pause_active_game = false; + // if (g_core->should_pause_active_game) { + // g_core->should_pause_active_game = false; - // If we've been completely backgrounded, send a menu-press command to - // the game; this will bring up a pause menu if we're in the game/etc. - if (!g_base->ui->MainMenuVisible()) { - g_base->ui->PushMainMenuPressCall(nullptr); - } - } + // // If we've been completely backgrounded, send a menu-press command to + // // the game; this will bring up a pause menu if we're in the game/etc. + // if (!g_base->ui->MainMenuVisible()) { + // g_base->ui->PushMainMenuPressCall(nullptr); + // } + // } } void AppAdapter::SuspendApp() { @@ -142,7 +142,7 @@ void AppAdapter::UnsuspendApp() { if (!app_suspended_) { Log(LogLevel::kWarning, - "AppAdapter::UnsuspendApp() called with app not in paused state."); + "AppAdapter::UnsuspendApp() called with app not in suspendedstate."); return; } millisecs_t start_time{core::CorePlatform::GetCurrentMillisecs()}; diff --git a/src/ballistica/base/app_adapter/app_adapter.h b/src/ballistica/base/app_adapter/app_adapter.h index 7ae86045..f62ae114 100644 --- a/src/ballistica/base/app_adapter/app_adapter.h +++ b/src/ballistica/base/app_adapter/app_adapter.h @@ -106,7 +106,7 @@ class AppAdapter { /// values. virtual void CursorPositionForDraw(float* x, float* y); - /// Put the app into a paused state. Should be called from the main + /// Put the app into a suspended state. Should be called from the main /// thread. Pauses work, closes network sockets, etc. May correspond to /// being backgrounded on mobile, being minimized on desktop, etc. It is /// assumed that, as soon as this call returns, all work is finished and @@ -114,9 +114,9 @@ class AppAdapter { /// effects. void SuspendApp(); - /// Resume the app; can correspond to foregrounding on mobile, - /// unminimizing on desktop, etc. Spins threads back up, re-opens network - /// sockets, etc. + /// Return the app to a running state from a suspended one. Can correspond + /// to foregrounding on mobile, unminimizing on desktop, etc. Spins + /// threads back up, re-opens network sockets, etc. void UnsuspendApp(); auto app_suspended() const { return app_suspended_; } @@ -255,9 +255,9 @@ class AppAdapter { void OnAppSuspend_(); void OnAppUnsuspend_(); - bool app_suspended_ : 1 {}; - bool have_clipboard_is_supported_ : 1 {}; - bool clipboard_is_supported_ : 1 {}; + bool app_suspended_{}; + bool have_clipboard_is_supported_{}; + bool clipboard_is_supported_{}; }; } // namespace ballistica::base diff --git a/src/ballistica/base/app_adapter/app_adapter_apple.cc b/src/ballistica/base/app_adapter/app_adapter_apple.cc index 018f72db..515eb046 100644 --- a/src/ballistica/base/app_adapter/app_adapter_apple.cc +++ b/src/ballistica/base/app_adapter/app_adapter_apple.cc @@ -102,10 +102,6 @@ void AppAdapterApple::ReloadRenderer_(const GraphicsSettings* settings) { gs->LoadRenderer(); } -// void AppAdapterApple::UpdateScreenSizes_() { -// assert(g_base->app_adapter->InGraphicsContext()); -// } - auto AppAdapterApple::TryRender() -> bool { auto allow = ScopedAllowGraphics_(this); diff --git a/src/ballistica/base/app_adapter/app_adapter_apple.h b/src/ballistica/base/app_adapter/app_adapter_apple.h index 520adaf8..fa0ee058 100644 --- a/src/ballistica/base/app_adapter/app_adapter_apple.h +++ b/src/ballistica/base/app_adapter/app_adapter_apple.h @@ -70,7 +70,7 @@ class AppAdapterApple : public AppAdapter { void ReloadRenderer_(const GraphicsSettings* settings); std::thread::id graphics_thread_{}; - bool graphics_allowed_ : 1 {}; + bool graphics_allowed_{}; uint8_t resize_friendly_frames_{}; Vector2f resize_target_resolution_{-1.0f, -1.0f}; std::mutex graphics_calls_mutex_; diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.cc b/src/ballistica/base/app_adapter/app_adapter_sdl.cc index f5d4ceb4..13b2b698 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.cc +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.cc @@ -112,14 +112,6 @@ struct AppAdapterSDL::GraphicsSettings_ : public GraphicsSettings { int max_fps = g_base->app_config->Resolve(AppConfig::IntID::kMaxFPS); }; -void AppAdapterSDL::DoApplyAppConfig() { - assert(g_base->InLogicThread()); - - // Android res string. - // std::string android_res = - // g_base->app_config->Resolve(AppConfig::StringID::kResolutionAndroid); -} - auto AppAdapterSDL::GetGraphicsSettings() -> GraphicsSettings* { assert(g_base->InLogicThread()); return new GraphicsSettings_(); diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.h b/src/ballistica/base/app_adapter/app_adapter_sdl.h index 0219ae07..2f9b6f29 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.h +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.h @@ -30,7 +30,6 @@ class AppAdapterSDL : public AppAdapter { AppAdapterSDL(); void OnMainThreadStartApp() override; - void DoApplyAppConfig() override; auto TryRender() -> bool; @@ -77,11 +76,11 @@ class AppAdapterSDL : public AppAdapter { void SleepUntilNextEventCycle_(microsecs_t cycle_start_time); int max_fps_{60}; - bool done_ : 1 {}; - bool fullscreen_ : 1 {}; - bool vsync_actually_enabled_ : 1 {}; - bool debug_log_sdl_frame_timing_ : 1 {}; - bool hidden_ : 1 {}; + bool done_{}; + bool fullscreen_{}; + bool vsync_actually_enabled_{}; + bool debug_log_sdl_frame_timing_{}; + bool hidden_{}; /// With this off, graphics call pushes simply get pushed to the main /// thread and graphics code is allowed to run any time in the main @@ -90,8 +89,8 @@ class AppAdapterSDL : public AppAdapter { /// allowed during draws. This strictness is generally not needed here but /// can be useful to test with, as it more closely matches other platforms /// that require such a setup. - bool strict_graphics_context_ : 1 {}; - bool strict_graphics_allowed_ : 1 {}; + bool strict_graphics_context_{}; + bool strict_graphics_allowed_{}; VSync vsync_{VSync::kUnset}; uint32_t sdl_runnable_event_id_{}; std::mutex strict_graphics_calls_mutex_; diff --git a/src/ballistica/base/assets/assets.h b/src/ballistica/base/assets/assets.h index 0dc756ec..8fa05722 100644 --- a/src/ballistica/base/assets/assets.h +++ b/src/ballistica/base/assets/assets.h @@ -143,9 +143,9 @@ class Assets { // Will be true while a AssetListLock exists. Good to debug-verify this // during any asset list access. - bool asset_lists_locked_ : 1 {}; - bool asset_loads_allowed_ : 1 {}; - bool sys_assets_loaded_ : 1 {}; + bool asset_lists_locked_{}; + bool asset_loads_allowed_{}; + bool sys_assets_loaded_{}; std::vector asset_paths_; std::unordered_map packages_; diff --git a/src/ballistica/base/audio/audio.cc b/src/ballistica/base/audio/audio.cc index f1ddb876..dc1823f2 100644 --- a/src/ballistica/base/audio/audio.cc +++ b/src/ballistica/base/audio/audio.cc @@ -173,7 +173,7 @@ auto Audio::PlaySound(SoundAsset* sound, float volume) if (s) { // In vr mode, play non-positional sounds positionally in space roughly // where the menu is. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { s->SetGain(volume); s->SetPositional(true); float x = 0.0f; diff --git a/src/ballistica/base/audio/audio_server.cc b/src/ballistica/base/audio/audio_server.cc index a7a9ad1a..b543de39 100644 --- a/src/ballistica/base/audio/audio_server.cc +++ b/src/ballistica/base/audio/audio_server.cc @@ -172,7 +172,7 @@ void AudioServer::OnAppStartInThread_() { // On the rift build in vr mode we need to make sure we open the rift audio // device. #if BA_RIFT_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { ALboolean enumeration = alcIsExtensionPresent(nullptr, "ALC_ENUMERATE_ALL_EXT"); if (enumeration == AL_FALSE) { @@ -777,7 +777,7 @@ AudioServer::ThreadSource_::ThreadSource_(AudioServer* audio_thread_in, } else { // In vr mode we keep the microphone a bit closer to the camera // for realism purposes, so we need stuff louder in general. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { alSourcef(source_, AL_MAX_DISTANCE, 100); alSourcef(source_, AL_REFERENCE_DISTANCE, 7.5f); } else { @@ -1060,7 +1060,7 @@ void AudioServer::ThreadSource_::ExecPlay() { bool do_normal = true; // In vr mode, play non-positional sounds positionally in space roughly // where the menu is. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { do_normal = false; SetPositional(true); SetPosition(0.0f, 4.5f, -3.0f); diff --git a/src/ballistica/base/audio/audio_server.h b/src/ballistica/base/audio/audio_server.h index a47bf68a..610b53bd 100644 --- a/src/ballistica/base/audio/audio_server.h +++ b/src/ballistica/base/audio/audio_server.h @@ -116,10 +116,10 @@ class AudioServer { float sound_pitch_{1.0f}; float music_volume_{1.0f}; - bool have_pending_loads_ : 1 {}; - bool suspended_ : 1 {}; - bool shutdown_completed_ : 1 {}; - bool shutting_down_ : 1 {}; + bool have_pending_loads_{}; + bool suspended_{}; + bool shutdown_completed_{}; + bool shutting_down_{}; seconds_t shutdown_start_time_{}; millisecs_t last_sound_fade_process_time_{}; diff --git a/src/ballistica/base/audio/audio_streamer.h b/src/ballistica/base/audio/audio_streamer.h index 934a5ee6..37467d15 100644 --- a/src/ballistica/base/audio/audio_streamer.h +++ b/src/ballistica/base/audio/audio_streamer.h @@ -48,9 +48,9 @@ class AudioStreamer : public Object { private: Format format_{Format::kInvalid}; - bool playing_ : 1 {}; - bool loops_ : 1 {}; - bool eof_ : 1 {}; + bool playing_{}; + bool loops_{}; + bool eof_{}; ALuint buffers_[kAudioStreamBufferCount]{}; ALuint source_{}; std::string file_name_; diff --git a/src/ballistica/base/base.cc b/src/ballistica/base/base.cc index 1819474f..dc696467 100644 --- a/src/ballistica/base/base.cc +++ b/src/ballistica/base/base.cc @@ -730,7 +730,7 @@ void BaseFeatureSet::ShutdownSuppressDisallow() { shutdown_suppress_disallowed_ = true; } -auto BaseFeatureSet::GetReturnValue() const -> int { return return_value(); } +// auto BaseFeatureSet::GetReturnValue() const -> int { return return_value(); } void BaseFeatureSet::QuitApp(bool confirm, QuitType quit_type) { // If they want a confirm dialog and we're able to present one, do that. diff --git a/src/ballistica/base/base.h b/src/ballistica/base/base.h index 707d70a2..a14ddee1 100644 --- a/src/ballistica/base/base.h +++ b/src/ballistica/base/base.h @@ -272,6 +272,7 @@ enum class TextureCompressionType : uint8_t { kPVR, kETC1, kETC2, + kASTC, }; enum class TextureMinQuality : uint8_t { @@ -611,10 +612,10 @@ class BaseFeatureSet : public FeatureSetNativeComponent, /// Issue a high level app quit request. Can be called from any thread and /// can be safely called repeatedly. If 'confirm' is true, a confirmation /// dialog will be presented if the environment and situation allows; - /// otherwise the quit will be immediate. A QuitType arg can optionally be - /// passed to influence quit behavior; on some platforms such as mobile - /// the default is for the app to recede to the background but physically - /// remain running. + /// otherwise the quit process will start immediately. A QuitType arg can + /// optionally be passed to influence quit behavior; on some platforms + /// such as mobile the default is for the app to recede to the background + /// but physically remain running. void QuitApp(bool confirm = false, QuitType quit_type = QuitType::kSoft); /// Called when app shutdown process completes. Sets app to exit. @@ -773,10 +774,10 @@ class BaseFeatureSet : public FeatureSetNativeComponent, // Non-const bits (fixme: clean up access to these). TouchInput* touch_input{}; - auto return_value() const { return return_value_; } - void set_return_value(int val) { return_value_ = val; } + // auto return_value() const { return return_value_; } + // void set_return_value(int val) { return_value_ = val; } - auto GetReturnValue() const -> int override; + // auto GetReturnValue() const -> int override; private: BaseFeatureSet(); @@ -791,7 +792,6 @@ class BaseFeatureSet : public FeatureSetNativeComponent, std::mutex shutdown_suppress_lock_; bool shutdown_suppress_disallowed_{}; - int shutdown_suppress_count_{}; bool tried_importing_plus_{}; bool tried_importing_classic_{}; bool tried_importing_ui_v1_{}; @@ -802,7 +802,8 @@ class BaseFeatureSet : public FeatureSetNativeComponent, bool base_native_import_completed_{}; bool basn_log_behavior_{}; bool server_wrapper_managed_{}; - int return_value_{}; + int shutdown_suppress_count_{}; + // int return_value_{}; }; } // namespace ballistica::base diff --git a/src/ballistica/base/graphics/component/object_component.h b/src/ballistica/base/graphics/component/object_component.h index 6078ada9..1038cb98 100644 --- a/src/ballistica/base/graphics/component/object_component.h +++ b/src/ballistica/base/graphics/component/object_component.h @@ -115,12 +115,12 @@ class ObjectComponent : public RenderComponent { protected: ReflectionType reflection_{ReflectionType::kNone}; LightShadowType light_shadow_{LightShadowType::kObject}; - bool world_space_ : 1 {}; - bool transparent_ : 1 {}; - bool premultiplied_ : 1 {}; - bool have_color_add_ : 1 {}; - bool double_sided_ : 1 {}; - bool do_colorize_2_ : 1 {}; + bool world_space_{}; + bool transparent_{}; + bool premultiplied_{}; + bool have_color_add_{}; + bool double_sided_{}; + bool do_colorize_2_{}; float color_r_{1.0f}; float color_g_{1.0f}; float color_b_{1.0f}; diff --git a/src/ballistica/base/graphics/component/post_process_component.h b/src/ballistica/base/graphics/component/post_process_component.h index 3deff54a..3c671c20 100644 --- a/src/ballistica/base/graphics/component/post_process_component.h +++ b/src/ballistica/base/graphics/component/post_process_component.h @@ -21,7 +21,7 @@ class PostProcessComponent : public RenderComponent { protected: void WriteConfig() override; - bool eyes_ : 1 {}; + bool eyes_{}; float normal_distort_{}; }; diff --git a/src/ballistica/base/graphics/component/simple_component.h b/src/ballistica/base/graphics/component/simple_component.h index 384ade43..1585edbb 100644 --- a/src/ballistica/base/graphics/component/simple_component.h +++ b/src/ballistica/base/graphics/component/simple_component.h @@ -122,11 +122,11 @@ class SimpleComponent : public RenderComponent { void WriteConfig() override; protected: - bool do_colorize_2_ : 1 {}; - bool transparent_ : 1 {}; - bool premultiplied_ : 1 {}; - bool have_color_ : 1 {}; - bool double_sided_ : 1 {}; + bool do_colorize_2_{}; + bool transparent_{}; + bool premultiplied_{}; + bool have_color_{}; + bool double_sided_{}; float color_r_{1.0f}; float color_g_{1.0f}; float color_b_{1.0f}; diff --git a/src/ballistica/base/graphics/component/smoke_component.h b/src/ballistica/base/graphics/component/smoke_component.h index bb81bfb7..d174e643 100644 --- a/src/ballistica/base/graphics/component/smoke_component.h +++ b/src/ballistica/base/graphics/component/smoke_component.h @@ -27,7 +27,7 @@ class SmokeComponent : public RenderComponent { protected: void WriteConfig() override; - bool overlay_ : 1 {}; + bool overlay_{}; float color_r_{1.0f}; float color_g_{1.0f}; float color_b_{1.0f}; diff --git a/src/ballistica/base/graphics/component/sprite_component.h b/src/ballistica/base/graphics/component/sprite_component.h index f1f3c7e7..01f67e10 100644 --- a/src/ballistica/base/graphics/component/sprite_component.h +++ b/src/ballistica/base/graphics/component/sprite_component.h @@ -37,9 +37,9 @@ class SpriteComponent : public RenderComponent { protected: void WriteConfig() override; - bool have_color_ : 1 {}; - bool camera_aligned_ : 1 {}; - bool overlay_ : 1 {}; + bool have_color_{}; + bool camera_aligned_{}; + bool overlay_{}; uint8_t exponent_{1}; float color_r_{1.0f}; float color_g_{1.0f}; diff --git a/src/ballistica/base/graphics/gl/renderer_gl.cc b/src/ballistica/base/graphics/gl/renderer_gl.cc index 75fa0dae..c5cd9bd1 100644 --- a/src/ballistica/base/graphics/gl/renderer_gl.cc +++ b/src/ballistica/base/graphics/gl/renderer_gl.cc @@ -57,11 +57,6 @@ namespace ballistica::base { bool RendererGL::funky_depth_issue_set_{}; bool RendererGL::funky_depth_issue_{}; -#if BA_OSTYPE_ANDROID -bool RendererGL::is_speedy_android_device_{}; -bool RendererGL::is_extra_speedy_android_device_{}; -#endif - RendererGL::RendererGL() { assert(g_base->app_adapter->InGraphicsContext()); @@ -121,11 +116,15 @@ auto RendererGL::GLErrorToString(GLenum err) -> std::string { static auto CheckGLExtension(const std::vector& exts, const char* ext) -> bool { assert(strlen(ext) < 100); - const int variant_count{8}; + const int variant_count{10}; char variants[variant_count][128]; int i = 0; snprintf(variants[i], sizeof(variants[i]), "OES_%s", ext); i++; + snprintf(variants[i], sizeof(variants[i]), "GL_OES_%s", ext); + i++; + snprintf(variants[i], sizeof(variants[i]), "GL_KHR_%s", ext); + i++; snprintf(variants[i], sizeof(variants[i]), "GL_ARB_%s", ext); i++; snprintf(variants[i], sizeof(variants[i]), "GL_APPLE_%s", ext); @@ -162,12 +161,28 @@ void RendererGL::CheckGLVersion() { } const char* version_str = (const char*)glGetString(GL_VERSION); BA_PRECONDITION_FATAL(version_str); - // Do a rough check to make sure we're running 3 or newer of GL/GLES. - // This query should be available even on older versions. - if (version_str[0] != '3' && version_str[0] != '4') { - FatalError( - std::string("Your OpenGL version is too old (") + version_str - + "). We require 3.0 or later. Try updating your graphics drivers."); + + // Do a rough check to make sure we're running 3 or newer of GL/GLES. This + // query should be available even on older versions which is why we do it + // before the GL_MAJOR_VERSION/GL_MINOR_VERSION business which is not. + if (gl_is_es()) { + // GL ES version strings start with 'OpenGL ES X' with X being version. + const char* prefix = "OpenGL ES "; + int prefixlen = strlen(prefix); + BA_PRECONDITION_FATAL(!strncmp(version_str, prefix, prefixlen)); + if (version_str[prefixlen] != '3') { + FatalError( + std::string("Your OpenGL ES version is too old (") + version_str + + "). We require 3.0 or later. Try updating your graphics drivers."); + } + } else { + // Regular GL version strings start with numeric version. + + if (version_str[0] != '3' && version_str[0] != '4') { + FatalError( + std::string("Your OpenGL version is too old (") + version_str + + "). We require 3.0 or later. Try updating your graphics drivers."); + } } checked_gl_version_ = true; } @@ -280,8 +295,12 @@ void RendererGL::CheckGLCapabilities_() { // Flag certain devices as 'speedy' - we use this to enable high/higher // quality and whatnot (even in cases where ES3 isnt available). - is_speedy_android_device_ = true; - is_extra_speedy_android_device_ = false; + + // Let just consider ES 3.2 stuff speedy. + assert(gl_version_major() == 3); + is_speedy_android_device_ = gl_version_minor() >= 2; + + // is_extra_speedy_android_device_ = false; is_adreno_ = (strstr(renderer, "Adreno") != nullptr); // draws_shields_funny_ = false; // Start optimistic. @@ -347,9 +366,9 @@ void RendererGL::CheckGLCapabilities_() { // g_core->platform->set_is_tegra_k1(is_tegra_k1_); // Extra-speedy implies speedy too.. - if (is_extra_speedy_android_device_) { - is_speedy_android_device_ = true; - } + // if (is_extra_speedy_android_device_) { + // is_speedy_android_device_ = true; + // } #endif // BA_OSTYPE_ANDROID @@ -366,12 +385,12 @@ void RendererGL::CheckGLCapabilities_() { } } - // All android devices should support etc1. + // Pretty much all Android devices should support ETC1. if (CheckGLExtension(extensions, "compressed_ETC1_RGB8_texture")) { c_types.push_back(TextureCompressionType::kETC1); } else { if (g_buildconfig.ostype_android()) { - Log(LogLevel::kError, "Android device missing ETC1 support"); + Log(LogLevel::kError, "Android device missing ETC1 support."); } } @@ -381,6 +400,11 @@ void RendererGL::CheckGLCapabilities_() { c_types.push_back(TextureCompressionType::kETC2); } + // ASTC is generally available on newer mobile hardware. + if (CheckGLExtension(extensions, "texture_compression_astc_ldr")) { + c_types.push_back(TextureCompressionType::kASTC); + } + g_base->graphics_server->SetTextureCompressionTypes(c_types); // Both GL 3 and GL ES 3.0 support depth textures (and thus our high @@ -822,7 +846,7 @@ void RendererGL::SyncGLState_() { BA_DEBUG_CHECK_GL_ERROR; #if BA_RIFT_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { glFrontFace(GL_CCW); } BA_DEBUG_CHECK_GL_ERROR; @@ -862,7 +886,7 @@ void RendererGL::SyncGLState_() { // texture, and in that case we need alpha to accumulate; not get // overwritten. could probably enable this everywhere but I don't know if // it's supported on all hardware or slower. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { #if BA_OSTYPE_WINDOWS if (glBlendFuncSeparate == nullptr) { FatalError( @@ -2374,7 +2398,7 @@ void RendererGL::SetBlendPremult(bool b) { // texture, and in that case we need alpha to accumulate; not get // overwritten. could probably enable this everywhere but I don't know if // it's supported on all hardware or is slower or whatnot.. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { @@ -2543,26 +2567,12 @@ auto RendererGL::GetFunkyDepthIssue_() -> bool { std::string RendererGL::GetAutoAndroidRes() { assert(g_base->app_adapter->InGraphicsContext()); - const char* renderer = (const char*)glGetString(GL_RENDERER); - - // On the adreno 4xxx or 5xxx series we should be able to do anything. - if (strstr(renderer, "Adreno (TM) 4") || strstr(renderer, "Adreno (TM) 5")) { + // Simplifying this to just 1080p for anything we label 'speedy' and 720p + // for everything else. + if (is_speedy_android_device_) { return "1080p"; } - - // On extra-speedy devices we should be able to do 1920x1200. - if (is_extra_speedy_android_device_) { - return "1080p"; - } - - // Amazon Fire tablet (as of Jan '18) needs REAL low res to feel smooth. - if (g_core->platform->GetDeviceName() == "Amazon KFAUWI") { - return "480p"; - } - - // fall back to the old 'Auto' values elsewhere - // - this is generally 720p (but varies in a few cases) - return "Auto"; + return "720p"; } #endif // BA_OSTYPE_ANDROID @@ -2574,18 +2584,10 @@ auto RendererGL::GetAutoTextureQuality() -> TextureQuality { #if BA_OSTYPE_ANDROID { // Lets be cheaper in VR mode since we have to draw twice. - if (g_core->IsVRMode()) { - qual = TextureQuality::kMedium; + if (g_core->vr_mode()) { + qual = TextureQuality::kHigh; } else { - // On android we default to high quality mode if we support ETC2; - // otherwise go with medium. - if (g_base->graphics_server->SupportsTextureCompressionType( - TextureCompressionType::kETC2) - || is_speedy_android_device_) { - qual = TextureQuality::kHigh; - } else { - qual = TextureQuality::kMedium; - } + qual = TextureQuality::kHigh; } } #else // BA_OSTYPE_ANDROID @@ -2603,10 +2605,10 @@ auto RendererGL::GetAutoGraphicsQuality() -> GraphicsQuality { GraphicsQuality q{GraphicsQuality::kMedium}; #if BA_OSTYPE_ANDROID // lets be cheaper in VR mode since we draw twice.. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { q = GraphicsQuality::kMedium; } else { - if (is_extra_speedy_android_device_) { + if (is_speedy_android_device_) { q = GraphicsQuality::kHigher; } else { q = GraphicsQuality::kHigh; @@ -3262,7 +3264,7 @@ void RendererGL::CardboardDisableScissor() { glDisable(GL_SCISSOR_TEST); } void RendererGL::CardboardEnableScissor() { glEnable(GL_SCISSOR_TEST); } void RendererGL::VREyeRenderBegin() { - assert(g_core->IsVRMode()); + assert(g_core->vr_mode()); // On rift we need to turn off srgb conversion for each eye render // so we can dump our linear data into oculus' srgb buffer as-is. @@ -3284,7 +3286,7 @@ void RendererGL::VRSyncRenderStates() { void RendererGL::RenderFrameDefEnd() { // Need to set some states to keep cardboard happy. #if BA_CARDBOARD_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { SyncGLState_(); glEnable(GL_SCISSOR_TEST); } diff --git a/src/ballistica/base/graphics/gl/renderer_gl.h b/src/ballistica/base/graphics/gl/renderer_gl.h index bc0a3cf7..16917d81 100644 --- a/src/ballistica/base/graphics/gl/renderer_gl.h +++ b/src/ballistica/base/graphics/gl/renderer_gl.h @@ -261,23 +261,23 @@ class RendererGL : public Renderer { void SetBlendPremult(bool b); GraphicsQuality vignette_quality_{}; - bool blend_ : 1 {}; - bool blend_premult_ : 1 {}; - bool first_extension_check_ : 1 {true}; - bool is_tegra_4_ : 1 {}; - bool is_tegra_k1_ : 1 {}; - bool is_recent_adreno_ : 1 {}; - bool is_adreno_ : 1 {}; - bool enable_msaa_ : 1 {}; - bool draw_at_equal_depth_ : 1 {}; - bool depth_writing_enabled_ : 1 {}; - bool depth_testing_enabled_ : 1 {}; - bool data_loaded_ : 1 {}; - bool draw_front_ : 1 {}; - bool got_screen_framebuffer_ : 1 {}; - bool double_sided_ : 1 {}; - bool invalidate_framebuffer_support_ : 1 {}; - bool checked_gl_version_ : 1 {}; + bool blend_{}; + bool blend_premult_{}; + bool first_extension_check_{true}; + bool is_tegra_4_{}; + bool is_tegra_k1_{}; + bool is_recent_adreno_{}; + bool is_adreno_{}; + bool enable_msaa_{}; + bool draw_at_equal_depth_{}; + bool depth_writing_enabled_{}; + bool depth_testing_enabled_{}; + bool data_loaded_{}; + bool draw_front_{}; + bool got_screen_framebuffer_{}; + bool double_sided_{}; + bool invalidate_framebuffer_support_{}; + bool checked_gl_version_{}; GLint gl_version_major_{}; GLint gl_version_minor_{}; int last_blur_res_count_{}; @@ -342,8 +342,7 @@ class RendererGL : public Renderer { static bool funky_depth_issue_set_; static bool funky_depth_issue_; #if BA_OSTYPE_ANDROID - static bool is_speedy_android_device_; - static bool is_extra_speedy_android_device_; + bool is_speedy_android_device_{}; #endif ProgramGL* current_program_{}; std::vector scissor_rects_; diff --git a/src/ballistica/base/graphics/graphics.cc b/src/ballistica/base/graphics/graphics.cc index 6fc3c216..03402bc9 100644 --- a/src/ballistica/base/graphics/graphics.cc +++ b/src/ballistica/base/graphics/graphics.cc @@ -371,7 +371,7 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) { } SimpleComponent c(pass); c.SetTransparent(true); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { c.SetColor(1, 1, 1, 1); } else { c.SetColor(0.8f, 0.8f, 0.8f, 1.0f); @@ -379,7 +379,7 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) { int text_elem_count = fps_text_group_->GetElementCount(); for (int e = 0; e < text_elem_count; e++) { c.SetTexture(fps_text_group_->GetElementTexture(e)); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { c.SetShadow(-0.003f * fps_text_group_->GetElementUScale(e), -0.003f * fps_text_group_->GetElementVScale(e), 0.0f, 1.0f); c.SetMaskUV2Texture(fps_text_group_->GetElementMaskUV2Texture(e)); @@ -540,7 +540,7 @@ void Graphics::InitInternalComponents(FrameDef* frame_def) { // Let's draw a bit bigger than screen to account for tv-border-mode. float w = pass->virtual_width(); float h = pass->virtual_height(); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { screen_mesh_->SetPositionAndSize( -(0.5f * kVRBorder) * w, (-0.5f * kVRBorder) * h, kScreenMeshZDepth, (1.0f + kVRBorder) * w, (1.0f + kVRBorder) * h); @@ -837,7 +837,7 @@ void Graphics::BuildAndPushFrameDef() { // Sanity test: If we're in VR, the only reason we should have stuff in // the flat overlay pass is if there's windows present (we want to avoid // drawing/blitting the 2d UI buffer during gameplay for efficiency). - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { if (frame_def->GetOverlayFlatPass()->HasDrawCommands()) { if (!g_base->ui->MainMenuVisible()) { BA_LOG_ONCE(LogLevel::kError, @@ -1518,7 +1518,7 @@ void Graphics::SetScreenResolution(float x, float y) { // Calc virtual res. In vr mode our virtual res is independent of our // screen size (since it gets drawn to an overlay). - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { res_x_virtual_ = kBaseVirtualResX; res_y_virtual_ = kBaseVirtualResY; } else { diff --git a/src/ballistica/base/graphics/graphics.h b/src/ballistica/base/graphics/graphics.h index 58d24e83..c56ae98f 100644 --- a/src/ballistica/base/graphics/graphics.h +++ b/src/ballistica/base/graphics/graphics.h @@ -390,32 +390,32 @@ class Graphics { int frame_def_count_filtered_{}; int next_settings_index_{}; TextureQuality texture_quality_placeholder_{}; - bool drawing_transparent_only_ : 1 {}; - bool drawing_opaque_only_ : 1 {}; - bool internal_components_inited_ : 1 {}; - bool fade_out_ : 1 {true}; - bool progress_bar_ : 1 {}; - bool progress_bar_fade_in_ : 1 {}; - bool debug_draw_ : 1 {}; - bool network_debug_display_enabled_ : 1 {}; - bool hardware_cursor_visible_ : 1 {}; - bool camera_shake_disabled_ : 1 {}; - bool camera_gyro_explicitly_disabled_ : 1 {}; - bool gyro_enabled_ : 1 {true}; - bool show_fps_ : 1 {}; - bool show_ping_ : 1 {}; - bool show_net_info_ : 1 {}; - bool tv_border_ : 1 {}; - bool floor_reflection_ : 1 {}; - bool building_frame_def_ : 1 {}; - bool shadow_ortho_ : 1 {}; - bool fetched_overlay_node_z_depth_ : 1 {}; - bool gyro_broken_ : 1 {}; - bool set_fade_start_on_next_draw_ : 1 {}; - bool graphics_settings_dirty_ : 1 {true}; - bool applied_app_config_ : 1 {}; - bool sent_initial_graphics_settings_ : 1 {}; - bool got_screen_resolution_ : 1 {}; + bool drawing_transparent_only_{}; + bool drawing_opaque_only_{}; + bool internal_components_inited_{}; + bool fade_out_{true}; + bool progress_bar_{}; + bool progress_bar_fade_in_{}; + bool debug_draw_{}; + bool network_debug_display_enabled_{}; + bool hardware_cursor_visible_{}; + bool camera_shake_disabled_{}; + bool camera_gyro_explicitly_disabled_{}; + bool gyro_enabled_{true}; + bool show_fps_{}; + bool show_ping_{}; + bool show_net_info_{}; + bool tv_border_{}; + bool floor_reflection_{}; + bool building_frame_def_{}; + bool shadow_ortho_{}; + bool fetched_overlay_node_z_depth_{}; + bool gyro_broken_{}; + bool set_fade_start_on_next_draw_{}; + bool graphics_settings_dirty_{true}; + bool applied_app_config_{}; + bool sent_initial_graphics_settings_{}; + bool got_screen_resolution_{}; Vector3f shadow_offset_{0.0f, 0.0f, 0.0f}; Vector2f shadow_scale_{1.0f, 1.0f}; Vector3f tint_{1.0f, 1.0f, 1.0f}; diff --git a/src/ballistica/base/graphics/graphics_server.cc b/src/ballistica/base/graphics/graphics_server.cc index 0082f125..4e076291 100644 --- a/src/ballistica/base/graphics/graphics_server.cc +++ b/src/ballistica/base/graphics/graphics_server.cc @@ -140,16 +140,16 @@ auto GraphicsServer::WaitForRenderFrameDef_() -> FrameDef* { assert(g_base->app_adapter->InGraphicsContext()); millisecs_t start_time = g_core->GetAppTimeMillisecs(); - // Don't bother waiting if we can't/shouldn't render anyway. - if (!renderer_ || shutting_down_ || g_base->app_adapter->app_suspended()) { - return nullptr; - } - - // Do some incremental loading every time we try to render. - g_base->assets->RunPendingGraphicsLoads(); - // Spin and wait for a short bit for a frame_def to appear. while (true) { + // Stop waiting if we can't/shouldn't render anyway. + if (!renderer_ || shutting_down_ || g_base->app_adapter->app_suspended()) { + return nullptr; + } + + // Do a bit of incremental loading every time through. + g_base->assets->RunPendingGraphicsLoads(); + FrameDef* frame_def{}; { std::scoped_lock llock(frame_def_mutex_); @@ -166,10 +166,7 @@ auto GraphicsServer::WaitForRenderFrameDef_() -> FrameDef* { return frame_def; } - // If there's no frame_def for us, sleep for a bit and wait for it. But - // if we've been waiting for too long, give up. On some platforms such - // as Android, this frame will still get flipped whether we draw in it - // or not, so we *really* want to not skip drawing if we can help it. + // If there's no frame_def for us, sleep for a bit and wait for it. millisecs_t t = g_core->GetAppTimeMillisecs() - start_time; if (t >= 1000) { if (g_buildconfig.debug_build()) { @@ -388,29 +385,6 @@ void GraphicsServer::UnloadRenderer() { renderer_loaded_ = false; } -// FIXME: Shouldn't have android-specific code in here. -void GraphicsServer::HandlePushAndroidRes(const std::string& android_res) { - if (g_buildconfig.ostype_android()) { - assert(renderer_); - if (renderer_ == nullptr) { - return; - } - // We push android res to the java layer here. We don't actually worry - // about screen-size-changed callbacks and whatnot, since those will - // happen automatically once things actually change. We just want to be - // sure that we have a renderer so we can calc what our auto res should - // be. - assert(renderer_); - std::string fin_res; - if (android_res == "Auto") { - fin_res = renderer_->GetAutoAndroidRes(); - } else { - fin_res = android_res; - } - g_core->platform->AndroidSetResString(fin_res); - } -} - void GraphicsServer::SetTextureCompressionTypes( const std::list& types) { assert(g_base->app_adapter->InGraphicsContext()); diff --git a/src/ballistica/base/graphics/graphics_server.h b/src/ballistica/base/graphics/graphics_server.h index 54efe05a..08f21c4f 100644 --- a/src/ballistica/base/graphics/graphics_server.h +++ b/src/ballistica/base/graphics/graphics_server.h @@ -270,8 +270,6 @@ class GraphicsServer { return texture_quality_requested_; } - void HandlePushAndroidRes(const std::string& android_res); - auto texture_compression_types() const { assert(texture_compression_types_set_); return texture_compression_types_; @@ -321,15 +319,15 @@ class GraphicsServer { TextureQuality texture_quality_{}; GraphicsQualityRequest graphics_quality_requested_{}; GraphicsQuality graphics_quality_{}; - bool renderer_loaded_ : 1 {}; - bool model_view_projection_matrix_dirty_ : 1 {true}; - bool model_world_matrix_dirty_ : 1 {true}; - bool tv_border_ : 1 {}; - bool renderer_context_lost_ : 1 {}; - bool texture_compression_types_set_ : 1 {}; - bool cam_orient_matrix_dirty_ : 1 {true}; - bool shutting_down_ : 1 {}; - bool shutdown_completed_ : 1 {}; + bool renderer_loaded_{}; + bool model_view_projection_matrix_dirty_{true}; + bool model_world_matrix_dirty_{true}; + bool tv_border_{}; + bool renderer_context_lost_{}; + bool texture_compression_types_set_{}; + bool cam_orient_matrix_dirty_{true}; + bool shutting_down_{}; + bool shutdown_completed_{}; float res_x_{}; float res_y_{}; float res_x_virtual_{}; diff --git a/src/ballistica/base/graphics/graphics_vr.cc b/src/ballistica/base/graphics/graphics_vr.cc index 3b5191d1..386825e5 100644 --- a/src/ballistica/base/graphics/graphics_vr.cc +++ b/src/ballistica/base/graphics/graphics_vr.cc @@ -151,7 +151,7 @@ void GraphicsVR::DrawUI(FrameDef* frame_def) { void GraphicsVR::CalcVROverlayMatrices(FrameDef* frame_def) { // For VR mode, calc our overlay matrix for use in positioning overlay // elements. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { Vector3f cam_target_pt(frame_def->cam_target_original()); Matrix44f vr_overlay_matrix{kMatrix44fIdentity}; Matrix44f vr_overlay_matrix_fixed{kMatrix44fIdentity}; @@ -278,7 +278,7 @@ void GraphicsVR::DrawVROverlay(FrameDef* frame_def) { // the overlay-flat pass (otherwise it may get skipped). // This should be a safe assumption since this is pretty much just for // widgets. - if (g_core->IsVRMode() && frame_def->overlay_flat_pass()->HasDrawCommands()) { + if (g_core->vr_mode() && frame_def->overlay_flat_pass()->HasDrawCommands()) { // Draw our overlay-flat stuff into our overlay pass. SpecialComponent c(frame_def->overlay_pass(), SpecialComponent::Source::kVROverlayBuffer); @@ -314,7 +314,7 @@ void GraphicsVR::DrawOverlayBounds(RenderPass* pass) { } void GraphicsVR::DrawVRControllers(FrameDef* frame_def) { - if (!g_core->IsVRMode()) { + if (!g_core->vr_mode()) { return; } diff --git a/src/ballistica/base/graphics/renderer/render_pass.cc b/src/ballistica/base/graphics/renderer/render_pass.cc index 39a265b1..39446f9c 100644 --- a/src/ballistica/base/graphics/renderer/render_pass.cc +++ b/src/ballistica/base/graphics/renderer/render_pass.cc @@ -126,7 +126,7 @@ void RenderPass::Render(RenderTarget* render_target, bool transparent) { case Type::kOverlayFlatPass: { // In vr mode we draw the flat-overlay into its own buffer so can use // the full depth range (shouldn't matter but why not?...) shouldn't. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // In vr mode, our overlay-flat pass is ortho-projected // while our regular overlay is just rendered in world space using // the vr-overlay matrix. diff --git a/src/ballistica/base/graphics/renderer/render_target.cc b/src/ballistica/base/graphics/renderer/render_target.cc index 10493961..b1e5b786 100644 --- a/src/ballistica/base/graphics/renderer/render_target.cc +++ b/src/ballistica/base/graphics/renderer/render_target.cc @@ -21,7 +21,7 @@ void RenderTarget::OnScreenSizeChange() { auto RenderTarget::GetScissorX(float x) const -> float { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // map -0.05f to 1.1f in logical coordinates to 0 to 1 physical ones float res_x_virtual = g_base->graphics_server->screen_virtual_width(); return physical_width_ @@ -41,7 +41,7 @@ auto RenderTarget::GetScissorX(float x) const -> float { } auto RenderTarget::GetScissorY(float y) const -> float { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // map -0.05f to 1.1f in logical coordinates to 0 to 1 physical ones float res_y_virtual = g_base->graphics_server->screen_virtual_height(); return physical_height_ @@ -62,7 +62,7 @@ auto RenderTarget::GetScissorY(float y) const -> float { } auto RenderTarget::GetScissorScaleX() const -> float { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { float f = physical_width_ / g_base->graphics_server->screen_virtual_width(); return f / (1.0f + kVRBorder); } else { @@ -76,7 +76,7 @@ auto RenderTarget::GetScissorScaleX() const -> float { auto RenderTarget::GetScissorScaleY() const -> float { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { float f = physical_height_ / g_base->graphics_server->screen_virtual_height(); return f / (1.0f + kVRBorder); diff --git a/src/ballistica/base/graphics/renderer/renderer.cc b/src/ballistica/base/graphics/renderer/renderer.cc index 9aeae8f0..813b45e4 100644 --- a/src/ballistica/base/graphics/renderer/renderer.cc +++ b/src/ballistica/base/graphics/renderer/renderer.cc @@ -46,7 +46,7 @@ void Renderer::PreprocessFrameDef(FrameDef* frame_def) { // Some VR environments muck with render states before/after // they call us; resync as needed.... #if BA_VR_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { VRSyncRenderStates(); } #endif // BA_VR_BUILD @@ -138,7 +138,7 @@ void Renderer::RenderFrameDef(FrameDef* frame_def) { #endif backing->DrawBegin(backing_needs_clear); - bool overlays_in_3d = g_core->IsVRMode(); + bool overlays_in_3d = g_core->vr_mode(); bool overlays_in_2d = !overlays_in_3d; // Draw opaque stuff front-to-back. @@ -245,7 +245,7 @@ void Renderer::FinishFrameDef(FrameDef* frame_def) { #if BA_VR_BUILD void Renderer::VRPreprocess(FrameDef* frame_def) { - if (!g_core->IsVRMode()) { + if (!g_core->vr_mode()) { return; } @@ -330,7 +330,7 @@ void Renderer::VRPreprocess(FrameDef* frame_def) { } void Renderer::VRUpdateForEyeRender(FrameDef* frame_def) { - if (!g_core->IsVRMode()) { + if (!g_core->vr_mode()) { return; } VREyeRenderBegin(); @@ -381,7 +381,7 @@ void Renderer::VRUpdateForEyeRender(FrameDef* frame_def) { } void Renderer::VRDrawOverlayFlatPass(FrameDef* frame_def) { - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // The overlay-flat pass should generally only have commands in it // when UI is visible; skip rendering it if not. if (frame_def->overlay_flat_pass()->HasDrawCommands()) { @@ -437,7 +437,7 @@ void Renderer::UpdateSizesQualitiesAndColors(FrameDef* frame_def) { if (last_render_quality_ != frame_def->quality()) { light_render_target_.Clear(); light_shadow_render_target_.Clear(); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { vr_overlay_flat_render_target_.Clear(); } } @@ -450,7 +450,7 @@ void Renderer::UpdateSizesQualitiesAndColors(FrameDef* frame_def) { set_tint(1.5f * frame_def->tint()); // FIXME; why the 1.5? set_ambient_color(frame_def->ambient_color()); set_vignette_inner(frame_def->vignette_inner()); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // In VR mode we dont want vignetting; // just use the inner color for both in and out. set_vignette_outer(frame_def->vignette_inner()); diff --git a/src/ballistica/base/graphics/support/camera.cc b/src/ballistica/base/graphics/support/camera.cc index 050057b1..c8406c33 100644 --- a/src/ballistica/base/graphics/support/camera.cc +++ b/src/ballistica/base/graphics/support/camera.cc @@ -23,8 +23,8 @@ const float kPanMax = 9.0f; const float kPanMin = -9.0f; Camera::Camera() - : lock_panning_(g_core->IsVRMode()), - pan_speed_scale_(g_core->IsVRMode() ? 0.3f : 1.0f) {} + : lock_panning_(g_core->vr_mode()), + pan_speed_scale_(g_core->vr_mode() ? 0.3f : 1.0f) {} Camera::~Camera() = default; @@ -201,7 +201,7 @@ void Camera::UpdatePosition() { if (explicit_bool(true)) { float lr_jitter; { - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { lr_jitter = 0.0f; } else { lr_jitter = @@ -492,7 +492,7 @@ void Camera::UpdatePosition() { // our fixed-overlay matrix and our regular overlay matrix come out // the same. if (g_buildconfig.vr_build()) { - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { // Only apply map's X offset if camera is locked. x_min = x_max = position_.x @@ -614,7 +614,7 @@ void Camera::Update(millisecs_t elapsed) { auto elapsedf{static_cast(elapsed)}; // In normal mode we orbit; in vr mode we don't. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { heading_ = -0.3f; } else { heading_ += static_cast(elapsed) / 10000.0f; @@ -652,7 +652,7 @@ void Camera::Update(millisecs_t elapsed) { xy_constrain_blend_ = std::max(0.0f, xy_constrain_blend_); } - if (!g_core->IsVRMode()) { + if (!g_core->vr_mode()) { smooth_speed_.x += elapsedf * rand_component * (-0.5f @@ -667,7 +667,7 @@ void Camera::Update(millisecs_t elapsed) { + Utils::precalc_rand_3((time_ / rand_incr_3) % kPrecalcRandsCount)); } - if (RandomFloat() < 0.1f && !g_core->IsVRMode()) { + if (RandomFloat() < 0.1f && !g_core->vr_mode()) { smooth_speed_2_.x += elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat()); smooth_speed_2_.y += @@ -736,13 +736,13 @@ void Camera::Update(millisecs_t elapsed) { } // Update audio position more often in vr since we can whip our head around. - uint32_t interval = g_core->IsVRMode() ? 50 : 100; + uint32_t interval = g_core->vr_mode() ? 50 : 100; // Occasionally, update microphone position for audio. if (time_ - last_listener_update_time_ > interval) { last_listener_update_time_ = time_; bool do_regular_update = true; - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { #if BA_VR_MODE GraphicsVR* vrgraphics = GraphicsVR::get(); do_regular_update = false; @@ -984,7 +984,7 @@ void Camera::ApplyToFrameDef(FrameDef* frame_def) { // If we're vr, apply current vr offsets. // FIXME: should create a VRCamera subclass or whatnot. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { if (mode_ == CameraMode::kFollow) { Vector3f cam_original = frame_def->cam_original(); diff --git a/src/ballistica/base/graphics/support/camera.h b/src/ballistica/base/graphics/support/camera.h index f6fe6504..62d5a524 100644 --- a/src/ballistica/base/graphics/support/camera.h +++ b/src/ballistica/base/graphics/support/camera.h @@ -93,25 +93,25 @@ class Camera : public Object { private: CameraMode mode_{CameraMode::kFollow}; - bool manual_ : 1 {}; - bool smooth_next_frame_ : 1 {}; - bool have_real_areas_of_interest_ : 1 {}; - bool lock_panning_ : 1 {}; + bool manual_{}; + bool smooth_next_frame_{}; + bool have_real_areas_of_interest_{}; + bool lock_panning_{}; // Manual stuff. - bool panning_ : 1 {}; - bool orbiting_ : 1 {}; - bool rolling_ : 1 {}; - bool trucking_ : 1 {}; - bool alt_down_ : 1 {}; - bool cmd_down_ : 1 {}; - bool ctrl_down_ : 1 {}; - bool mouse_left_down_ : 1 {}; - bool mouse_middle_down_ : 1 {}; - bool mouse_right_down_ : 1 {}; + bool panning_{}; + bool orbiting_{}; + bool rolling_{}; + bool trucking_{}; + bool alt_down_{}; + bool cmd_down_{}; + bool ctrl_down_{}; + bool mouse_left_down_{}; + bool mouse_middle_down_{}; + bool mouse_right_down_{}; - bool happy_thoughts_mode_ : 1 {}; - bool x_constrained_ : 1 {true}; + bool happy_thoughts_mode_{}; + bool x_constrained_{true}; float pan_speed_scale_{1.0f}; float heading_{kInitialHeading}; float area_of_interest_bounds_[6]{-9999, -9999, -9999, 9999, 9999, 9999}; diff --git a/src/ballistica/base/graphics/support/frame_def.cc b/src/ballistica/base/graphics/support/frame_def.cc index 52c2ed80..99d7e2a3 100644 --- a/src/ballistica/base/graphics/support/frame_def.cc +++ b/src/ballistica/base/graphics/support/frame_def.cc @@ -31,7 +31,7 @@ FrameDef::~FrameDef() { assert(g_base->InLogicThread()); } auto FrameDef::GetOverlayFixedPass() -> RenderPass* { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { return overlay_fixed_pass_.get(); } else { return overlay_pass_.get(); @@ -40,7 +40,7 @@ auto FrameDef::GetOverlayFixedPass() -> RenderPass* { auto FrameDef::GetOverlayFlatPass() -> RenderPass* { assert(g_core); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { return overlay_flat_pass_.get(); } else { return overlay_pass_.get(); @@ -102,7 +102,7 @@ void FrameDef::Reset() { beauty_pass_bg_->Reset(); overlay_pass_->Reset(); overlay_front_pass_->Reset(); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { overlay_flat_pass_->Reset(); overlay_fixed_pass_->Reset(); vr_cover_pass_->Reset(); @@ -120,7 +120,7 @@ void FrameDef::Complete() { beauty_pass_bg_->Complete(); overlay_pass_->Complete(); overlay_front_pass_->Complete(); - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { overlay_fixed_pass_->Complete(); overlay_flat_pass_->Complete(); vr_cover_pass_->Complete(); diff --git a/src/ballistica/base/graphics/support/frame_def.h b/src/ballistica/base/graphics/support/frame_def.h index 828095fa..8ad5b9d2 100644 --- a/src/ballistica/base/graphics/support/frame_def.h +++ b/src/ballistica/base/graphics/support/frame_def.h @@ -222,11 +222,11 @@ class FrameDef { private: Object::Ref> settings_snapshot_; - bool needs_clear_ : 1 {}; - bool rendering_ : 1 {}; - bool orbiting_ : 1 {}; - // bool tv_border_ : 1 {}; - bool shadow_ortho_ : 1 {}; + bool needs_clear_{}; + bool rendering_{}; + bool orbiting_{}; + // bool tv_border_{}; + bool shadow_ortho_{}; BenchmarkType benchmark_type_{BenchmarkType::kNone}; CameraMode camera_mode_{CameraMode::kFollow}; Vector3f cam_original_{0.0f, 0.0f, 0.0f}; diff --git a/src/ballistica/base/graphics/support/screen_messages.cc b/src/ballistica/base/graphics/support/screen_messages.cc index 4dcebfd0..4ebe74ae 100644 --- a/src/ballistica/base/graphics/support/screen_messages.cc +++ b/src/ballistica/base/graphics/support/screen_messages.cc @@ -81,7 +81,7 @@ void ScreenMessages::DrawMiscOverlays(FrameDef* frame_def) { // Draw all existing. if (!screen_messages_.empty()) { - bool vr = g_core->IsVRMode(); + bool vr = g_core->vr_mode(); // These are less disruptive in the middle for menus but at the bottom // during gameplay. diff --git a/src/ballistica/base/input/device/joystick_input.cc b/src/ballistica/base/input/device/joystick_input.cc index be7e4ab4..b9dc6e3f 100644 --- a/src/ballistica/base/input/device/joystick_input.cc +++ b/src/ballistica/base/input/device/joystick_input.cc @@ -683,7 +683,7 @@ void JoystickInput::HandleSDLEvent(const SDL_Event* e) { } // On our Oculus build, select presses reset the orientation. - if (e->jbutton.button == vr_reorient_button_ && g_core->IsVRMode()) { + if (e->jbutton.button == vr_reorient_button_ && g_core->vr_mode()) { ScreenMessage(g_base->assets->GetResourceString("vrOrientationResetText"), {0, 1, 0}); g_core->reset_vr_orientation = true; diff --git a/src/ballistica/base/input/device/joystick_input.h b/src/ballistica/base/input/device/joystick_input.h index 985fc78c..e7cd79b7 100644 --- a/src/ballistica/base/input/device/joystick_input.h +++ b/src/ballistica/base/input/device/joystick_input.h @@ -102,34 +102,34 @@ class JoystickInput : public InputDevice { // constructor) SDL_Joystick* sdl_joystick_{}; - bool ui_only_ : 1 {}; - bool unassigned_buttons_run_ : 1 {true}; - bool start_button_activates_default_widget_ : 1 {true}; - bool auto_recalibrate_analog_stick_ : 1 {}; - bool did_initial_reset_ : 1 {}; - bool is_test_input_ : 1 {}; - bool is_remote_control_ : 1 {}; - bool is_remote_app_ : 1 {}; - bool is_mfi_controller_ : 1 {}; + bool ui_only_{}; + bool unassigned_buttons_run_{true}; + bool start_button_activates_default_widget_{true}; + bool auto_recalibrate_analog_stick_{}; + bool did_initial_reset_{}; + bool is_test_input_{}; + bool is_remote_control_{}; + bool is_remote_app_{}; + bool is_mfi_controller_{}; // For dialogs. - bool left_held_ : 1 {}; - bool right_held_ : 1 {}; - bool up_held_ : 1 {}; - bool down_held_ : 1 {}; - bool hold_position_held_ : 1 {}; - bool need_to_send_held_state_ : 1 {}; + bool left_held_{}; + bool right_held_{}; + bool up_held_{}; + bool down_held_{}; + bool hold_position_held_{}; + bool need_to_send_held_state_{}; - bool hat_held_ : 1 {}; - bool dpad_right_held_ : 1 {}; - bool dpad_left_held_ : 1 {}; - bool dpad_up_held_ : 1 {}; - bool dpad_down_held_ : 1 {}; + bool hat_held_{}; + bool dpad_right_held_{}; + bool dpad_left_held_{}; + bool dpad_up_held_{}; + bool dpad_down_held_{}; - bool ignore_completely_ : 1 {}; - bool resetting_ : 1 {}; - bool calibrate_ : 1 {}; - bool can_configure_ : 1 {}; + bool ignore_completely_{}; + bool resetting_{}; + bool calibrate_{}; + bool can_configure_{}; int hat_{0}; int analog_lr_{0}; diff --git a/src/ballistica/base/input/device/keyboard_input.h b/src/ballistica/base/input/device/keyboard_input.h index 8138b5c6..a210f4e2 100644 --- a/src/ballistica/base/input/device/keyboard_input.h +++ b/src/ballistica/base/input/device/keyboard_input.h @@ -32,15 +32,15 @@ class KeyboardInput : public InputDevice { private: void UpdateArrowKeys_(SDL_Keycode key); void UpdateRun_(SDL_Keycode key, bool down); - bool down_held_ : 1 {}; - bool up_held_ : 1 {}; - bool left_held_ : 1 {}; - bool right_held_ : 1 {}; - bool enable_child_ : 1 {}; - bool left_key_assigned_ : 1 {}; - bool right_key_assigned_ : 1 {}; - bool up_key_assigned_ : 1 {}; - bool down_key_assigned_ : 1 {}; + bool down_held_{}; + bool up_held_{}; + bool left_held_{}; + bool right_held_{}; + bool enable_child_{}; + bool left_key_assigned_{}; + bool right_key_assigned_{}; + bool up_key_assigned_{}; + bool down_key_assigned_{}; SDL_Keycode up_key_{}; SDL_Keycode down_key_{}; SDL_Keycode left_key_{}; diff --git a/src/ballistica/base/input/device/test_input.h b/src/ballistica/base/input/device/test_input.h index b89accf4..2bd83459 100644 --- a/src/ballistica/base/input/device/test_input.h +++ b/src/ballistica/base/input/device/test_input.h @@ -20,13 +20,13 @@ class TestInput { int lr_{}; int ud_{}; int join_press_count_{}; - bool jump_pressed_ : 1 {}; - bool bomb_pressed_ : 1 {}; - bool pickup_pressed_ : 1 {}; - bool punch_pressed_ : 1 {}; - bool print_non_join_ : 1 {}; - bool print_already_did2_ : 1 {}; - bool reset_ : 1 {true}; + bool jump_pressed_{}; + bool bomb_pressed_{}; + bool pickup_pressed_{}; + bool punch_pressed_{}; + bool print_non_join_{}; + bool print_already_did2_{}; + bool reset_{true}; millisecs_t next_event_time_{}; millisecs_t join_start_time_{}; millisecs_t join_end_time_{9999}; diff --git a/src/ballistica/base/input/input.h b/src/ballistica/base/input/input.h index a201dfb7..e4819753 100644 --- a/src/ballistica/base/input/input.h +++ b/src/ballistica/base/input/input.h @@ -185,10 +185,10 @@ class Input { int mouse_move_count_{}; int input_lock_count_temp_{}; int input_lock_count_permanent_{}; - bool input_active_ : 1 {}; - bool have_button_using_inputs_ : 1 {}; - bool have_start_activated_default_button_inputs_ : 1 {}; - bool have_non_touch_inputs_ : 1 {}; + bool input_active_{}; + bool have_button_using_inputs_{}; + bool have_start_activated_default_button_inputs_{}; + bool have_non_touch_inputs_{}; millisecs_t input_idle_time_{}; millisecs_t last_get_local_active_input_device_count_check_time_{}; float cursor_pos_x_{}; diff --git a/src/ballistica/base/logic/logic.h b/src/ballistica/base/logic/logic.h index 2e21436e..06e29f69 100644 --- a/src/ballistica/base/logic/logic.h +++ b/src/ballistica/base/logic/logic.h @@ -140,13 +140,13 @@ class Logic { seconds_t recent_display_time_increments_[kDisplayTimeSampleCount]{}; int recent_display_time_increments_index_{-1}; - bool app_bootstrapping_complete_ : 1 {}; - bool have_pending_loads_ : 1 {}; - bool debug_log_display_time_ : 1 {}; - bool applied_app_config_ : 1 {}; - bool shutting_down_ : 1 {}; - bool shutdown_completed_ : 1 {}; - bool graphics_ready_ : 1 {}; + bool app_bootstrapping_complete_{}; + bool have_pending_loads_{}; + bool debug_log_display_time_{}; + bool applied_app_config_{}; + bool shutting_down_{}; + bool shutdown_completed_{}; + bool graphics_ready_{}; Timer* process_pending_work_timer_{}; EventLoop* event_loop_{}; std::unique_ptr display_timers_; diff --git a/src/ballistica/base/platform/base_platform.cc b/src/ballistica/base/platform/base_platform.cc index 3bbc202d..0af9a65b 100644 --- a/src/ballistica/base/platform/base_platform.cc +++ b/src/ballistica/base/platform/base_platform.cc @@ -107,7 +107,7 @@ void BasePlatform::PurchaseAck(const std::string& purchase, void BasePlatform::OpenURL(const std::string& url) { // Can't open URLs in VR - just tell the Python layer to show the url in the // gui. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { g_base->ui->ShowURL(url); return; } diff --git a/src/ballistica/base/platform/base_platform.h b/src/ballistica/base/platform/base_platform.h index 35d9bfa6..3609e9cb 100644 --- a/src/ballistica/base/platform/base_platform.h +++ b/src/ballistica/base/platform/base_platform.h @@ -119,7 +119,7 @@ class BasePlatform { virtual ~BasePlatform(); private: - bool ran_base_post_init_ : 1 {}; + bool ran_base_post_init_{}; PythonRef string_edit_adapter_{}; std::string public_device_uuid_; }; diff --git a/src/ballistica/base/python/class/python_class_env.cc b/src/ballistica/base/python/class/python_class_env.cc index af1cea48..08ac7bef 100644 --- a/src/ballistica/base/python/class/python_class_env.cc +++ b/src/ballistica/base/python/class/python_class_env.cc @@ -149,7 +149,7 @@ void PythonClassEnv::SetupType(PyTypeObject* cls) { BoolEntry_(g_core->platform->IsRunningOnTV(), "Whether the app is targeting a TV-centric experience."); - envs["vr"] = BoolEntry_(g_core->IsVRMode(), + envs["vr"] = BoolEntry_(g_core->vr_mode(), "Whether the app is currently running in VR."); envs["arcade"] = diff --git a/src/ballistica/base/python/methods/python_methods_app.cc b/src/ballistica/base/python/methods/python_methods_app.cc index 2d13c813..44055fd7 100644 --- a/src/ballistica/base/python/methods/python_methods_app.cc +++ b/src/ballistica/base/python/methods/python_methods_app.cc @@ -751,7 +751,7 @@ static auto PyEnv(PyObject* self) -> PyObject* { "subplatform", g_core->platform->GetSubplatformName().c_str(), "ui_scale", ui_scale, "on_tv", g_core->platform->IsRunningOnTV() ? Py_True : Py_False, - "vr_mode", g_core->IsVRMode() ? Py_True : Py_False, + "vr_mode", g_core->vr_mode() ? Py_True : Py_False, "demo_mode", g_buildconfig.demo_build() ? Py_True : Py_False, "arcade_mode", g_buildconfig.arcade_build() ? Py_True : Py_False, "headless_mode", g_core->HeadlessMode() ? Py_True : Py_False, diff --git a/src/ballistica/base/python/methods/python_methods_graphics.cc b/src/ballistica/base/python/methods/python_methods_graphics.cc index d2ab871f..46215776 100644 --- a/src/ballistica/base/python/methods/python_methods_graphics.cc +++ b/src/ballistica/base/python/methods/python_methods_graphics.cc @@ -349,13 +349,7 @@ static PyMethodDef PySafeColorDef = { static auto PyGetMaxGraphicsQuality(PyObject* self) -> PyObject* { BA_PYTHON_TRY; - // if (g_base->graphics - // && g_base->graphics->has_supports_high_quality_graphics_value() - // && g_base->graphics->supports_high_quality_graphics()) { - // return Py_BuildValue("s", "High"); - // } else { - // return Py_BuildValue("s", "Medium"); - // } + // Currently all our supported devices can go up to higher. return Py_BuildValue("s", "Higher"); BA_PYTHON_CATCH; } diff --git a/src/ballistica/base/support/base_build_switches.cc b/src/ballistica/base/support/base_build_switches.cc index 96abc907..acd1e339 100644 --- a/src/ballistica/base/support/base_build_switches.cc +++ b/src/ballistica/base/support/base_build_switches.cc @@ -100,7 +100,7 @@ auto BaseBuildSwitches::CreateAppAdapter() -> AppAdapter* { app_adapter = new AppAdapterApple(); #elif BA_RIFT_BUILD // Rift build can spin up in either VR or regular mode. - if (g_core->vr_mode) { + if (g_core->vr_mode()) { app_adapter = new AppAdapterVR(); } else { app_adapter = new AppAdapterSDL(); diff --git a/src/ballistica/base/ui/dev_console.h b/src/ballistica/base/ui/dev_console.h index 21672985..61b778cf 100644 --- a/src/ballistica/base/ui/dev_console.h +++ b/src/ballistica/base/ui/dev_console.h @@ -92,13 +92,13 @@ class DevConsole { int carat_char_{0}; State_ state_{State_::kInactive}; State_ state_prev_{State_::kInactive}; - bool input_text_dirty_ : 1 {true}; - bool input_enabled_ : 1 {}; - bool last_line_mesh_dirty_ : 1 {true}; - bool python_terminal_visible_ : 1 {}; - bool python_terminal_pressed_ : 1 {}; - bool refresh_pending_ : 1 {}; - bool carat_dirty_ : 1 {true}; + bool input_text_dirty_{true}; + bool input_enabled_{}; + bool last_line_mesh_dirty_{true}; + bool python_terminal_visible_{}; + bool python_terminal_pressed_{}; + bool refresh_pending_{}; + bool carat_dirty_{true}; float carat_x_{}; seconds_t transition_start_{}; millisecs_t last_carat_x_change_time_{}; diff --git a/src/ballistica/base/ui/ui.cc b/src/ballistica/base/ui/ui.cc index 06930e4c..dda9bd0d 100644 --- a/src/ballistica/base/ui/ui.cc +++ b/src/ballistica/base/ui/ui.cc @@ -39,7 +39,7 @@ UI::UI() { } if (!force_scale_) { // Use automatic val. - if (g_core->IsVRMode() || g_core->platform->IsRunningOnTV()) { + if (g_core->vr_mode() || g_core->platform->IsRunningOnTV()) { // VR and TV modes always use medium. scale_ = UIScale::kMedium; } else { diff --git a/src/ballistica/classic/support/stress_test.cc b/src/ballistica/classic/support/stress_test.cc index b92e6074..0debd86e 100644 --- a/src/ballistica/classic/support/stress_test.cc +++ b/src/ballistica/classic/support/stress_test.cc @@ -20,7 +20,7 @@ void StressTest::Set(bool enable, int player_count) { // If we're turning on, reset our intervals and things. if (!was_stress_testing && stress_testing_) { // So our first sample is 1 interval from now. - last_stress_test_update_time_ = g_core->GetAppTimeMillisecs(); + // last_stress_test_update_time_ = g_core->GetAppTimeMillisecs(); // Reset our frames-rendered tally. if (g_base && g_base->graphics_server @@ -47,62 +47,6 @@ void StressTest::Update() { if (stress_testing_ && g_base->input) { // Update our fake inputs to make our dudes run around. ProcessInputs(stress_test_player_count_); - - // Every 10 seconds update our stress-test stats. - millisecs_t t = g_core->GetAppTimeMillisecs(); - if (t - last_stress_test_update_time_ >= 10000) { - if (stress_test_stats_file_ == nullptr) { - assert(g_core); - auto user_python_dir = g_core->GetUserPythonDirectory(); - if (user_python_dir) { - std::string f_name = *user_python_dir + "/stress_test_stats.csv"; - stress_test_stats_file_ = - g_core->platform->FOpen(f_name.c_str(), "wb"); - if (stress_test_stats_file_ != nullptr) { - fprintf(stress_test_stats_file_, - "time,averageFps,nodes,meshes,collision_meshes,textures," - "sounds," - "pssMem,sharedDirtyMem,privateDirtyMem\n"); - fflush(stress_test_stats_file_); - } - } - } - if (stress_test_stats_file_ != nullptr) { - // See how many frames we've rendered this past interval. - int total_frames_rendered; - if (g_base && g_base->graphics_server - && g_base->graphics_server->renderer()) { - total_frames_rendered = - g_base->graphics_server->renderer()->total_frames_rendered(); - } else { - total_frames_rendered = last_total_frames_rendered_; - } - float avg = - static_cast(total_frames_rendered - - last_total_frames_rendered_) - / (static_cast(t - last_stress_test_update_time_) / 1000.0f); - last_total_frames_rendered_ = total_frames_rendered; - uint32_t mesh_count = 0; - uint32_t collision_mesh_count = 0; - uint32_t texture_count = 0; - uint32_t sound_count = 0; - uint32_t node_count = 0; - if (g_base) { - mesh_count = g_base->assets->total_mesh_count(); - collision_mesh_count = g_base->assets->total_collision_mesh_count(); - texture_count = g_base->assets->total_texture_count(); - sound_count = g_base->assets->total_sound_count(); - } - assert(g_base->logic); - std::string mem_usage = g_core->platform->GetMemUsageInfo(); - fprintf(stress_test_stats_file_, "%d,%.1f,%d,%d,%d,%d,%d,%s\n", - static_cast_check_fit(g_core->GetAppTimeMillisecs()), avg, - node_count, mesh_count, collision_mesh_count, texture_count, - sound_count, mem_usage.c_str()); - fflush(stress_test_stats_file_); - } - last_stress_test_update_time_ = t; - } } } diff --git a/src/ballistica/classic/support/stress_test.h b/src/ballistica/classic/support/stress_test.h index 96c5fd71..6c848208 100644 --- a/src/ballistica/classic/support/stress_test.h +++ b/src/ballistica/classic/support/stress_test.h @@ -22,9 +22,9 @@ class StressTest { millisecs_t stress_test_last_leave_time_{}; int stress_test_player_count_{8}; int last_total_frames_rendered_{}; - bool stress_testing_ : 1 {}; - millisecs_t last_stress_test_update_time_{}; - FILE* stress_test_stats_file_{}; + bool stress_testing_{}; + // millisecs_t last_stress_test_update_time_{}; + // FILE* stress_test_stats_file_{}; Object::Ref update_timer_{}; }; diff --git a/src/ballistica/core/core.cc b/src/ballistica/core/core.cc index 43bf1b9e..002a4388 100644 --- a/src/ballistica/core/core.cc +++ b/src/ballistica/core/core.cc @@ -82,12 +82,12 @@ void CoreFeatureSet::DoImport(const CoreConfig& config) { } CoreFeatureSet::CoreFeatureSet(CoreConfig config) - : main_thread_id{std::this_thread::get_id()}, + : main_thread_id_{std::this_thread::get_id()}, python{new CorePython()}, platform{CorePlatform::Create()}, core_config_{std::move(config)}, last_app_time_measure_microsecs_{CorePlatform::GetCurrentMicrosecs()}, - vr_mode{config.vr_mode} { + vr_mode_{config.vr_mode} { // We're a singleton. If there's already one of us, something's wrong. assert(g_core == nullptr); } @@ -103,11 +103,6 @@ void CoreFeatureSet::PostInit() { build_src_dir_ = CalcBuildSrcDir(); - // Note: this checks g_core->main_thread_id which is why it must run in - // PostInit and not our constructor. - // main_event_loop_ = new EventLoop(EventLoopID::kMain, - // ThreadSource::kWrapCurrent); - // On monolithic builds we need to bring up Python itself. if (g_buildconfig.monolithic_build()) { python->InitPython(); @@ -277,7 +272,7 @@ void CoreFeatureSet::RunSanityChecks() { + static_type_name(true) + "'"); } - if (vr_mode && !g_buildconfig.vr_build()) { + if (vr_mode_ && !g_buildconfig.vr_build()) { FatalError("vr_mode enabled in core-config but we are not a vr build."); } } @@ -308,7 +303,7 @@ auto CoreFeatureSet::HeadlessMode() -> bool { return g_buildconfig.headless_build(); } -auto CoreFeatureSet::IsVRMode() -> bool { return core_config_.vr_mode; } +// auto CoreFeatureSet::vr_mode() -> bool { return core_config_.vr_mode; } static void WaitThenDie(millisecs_t wait, const std::string& action) { CorePlatform::SleepMillisecs(wait); diff --git a/src/ballistica/core/core.h b/src/ballistica/core/core.h index b4057ebe..4c0cb1ca 100644 --- a/src/ballistica/core/core.h +++ b/src/ballistica/core/core.h @@ -66,13 +66,6 @@ class CoreFeatureSet { /// Apply the config set up by baenv to the engine. void ApplyBaEnvConfig(); - // Call this if the main thread changes. - // Fixme: Should come up with something less hacky feeling. - // void UpdateMainThreadID(); - - // auto* main_event_loop() const { return main_event_loop_; } - auto IsVRMode() -> bool; - /// Are we running headless? auto HeadlessMode() -> bool; @@ -101,7 +94,7 @@ class CoreFeatureSet { /// considered the 'main' thread; on most platforms it is the one where /// UI calls must be run/etc. auto InMainThread() -> bool { - return std::this_thread::get_id() == main_thread_id; + return std::this_thread::get_id() == main_thread_id(); } /// Log a boot-related message (only if core_config.lifecycle_log is true). @@ -156,23 +149,17 @@ class CoreFeatureSet { CorePlatform* const platform; // The following are misc values that should be migrated to applicable - // subsystem classes. - bool event_loops_suspended{}; + // subsystem classes or private vars. bool workspaces_in_use{}; - bool replay_open{}; - std::vector suspendable_event_loops; - std::mutex v1_cloud_log_mutex; - std::string v1_cloud_log; + bool have_incentivized_ad{false}; + bool reset_vr_orientation{}; + bool user_ran_commands{}; bool did_put_v1_cloud_log{}; bool v1_cloud_log_full{}; int master_server_source{}; - int session_count{}; - bool have_incentivized_ad{false}; - bool should_pause_active_game{}; - bool reset_vr_orientation{}; - bool user_ran_commands{}; - std::thread::id main_thread_id{}; - bool vr_mode; + std::vector suspendable_event_loops; + std::mutex v1_cloud_log_mutex; + std::string v1_cloud_log; std::mutex thread_name_map_mutex; std::unordered_map thread_name_map; @@ -182,6 +169,11 @@ class CoreFeatureSet { int object_count{}; #endif + std::thread::id main_thread_id() const { return main_thread_id_; } + auto vr_mode() const { return vr_mode_; } + auto event_loops_suspended() const { return event_loops_suspended_; } + void set_event_loops_suspended(bool val) { event_loops_suspended_ = val; } + private: explicit CoreFeatureSet(CoreConfig config); static void DoImport(const CoreConfig& config); @@ -189,23 +181,29 @@ class CoreFeatureSet { void RunSanityChecks(); void UpdateAppTime(); void PostInit(); + + // Note to self: don't use single bits for these as they may be owned by + // different threads. + bool event_loops_suspended_{}; bool tried_importing_base_{}; - // EventLoop* main_event_loop_{}; - CoreConfig core_config_; bool started_suicide_{}; + bool have_ba_env_vals_{}; + bool vr_mode_{}; + bool using_custom_app_python_dir_{}; + + std::thread::id main_thread_id_{}; + CoreConfig core_config_; std::string build_src_dir_; microsecs_t app_time_microsecs_{}; microsecs_t last_app_time_measure_microsecs_; std::mutex app_time_mutex_; std::string legacy_user_agent_string_{ "BA_USER_AGENT_UNSET (" BA_PLATFORM_STRING ")"}; - bool have_ba_env_vals_{}; std::optional ba_env_app_python_dir_; std::string ba_env_config_dir_; std::optional ba_env_user_python_dir_; std::optional ba_env_site_python_dir_; std::string ba_env_data_dir_; - bool using_custom_app_python_dir_{}; }; } // namespace ballistica::core diff --git a/src/ballistica/core/platform/core_platform.cc b/src/ballistica/core/platform/core_platform.cc index c8de561d..0c31a5d7 100644 --- a/src/ballistica/core/platform/core_platform.cc +++ b/src/ballistica/core/platform/core_platform.cc @@ -732,20 +732,12 @@ auto CorePlatform::DemangleCXXSymbol(const std::string& s) -> std::string { #endif } -// auto CorePlatform::NewAutoReleasePool() -> void* { throw Exception(); } - -// void CorePlatform::DrainAutoReleasePool(void* pool) { throw Exception(); } - void CorePlatform::ResetAchievements() { Log(LogLevel::kError, "ResetAchievements() unimplemented"); } -// void CorePlatform::GameCenterLogin() { throw Exception(); } - void CorePlatform::RunEvents() {} -auto CorePlatform::GetMemUsageInfo() -> std::string { return "0,0,0"; } - void CorePlatform::MusicPlayerPlay(PyObject* target) { Log(LogLevel::kError, "MusicPlayerPlay() unimplemented on this platform"); } diff --git a/src/ballistica/core/platform/core_platform.h b/src/ballistica/core/platform/core_platform.h index 250708d8..1d1e1e73 100644 --- a/src/ballistica/core/platform/core_platform.h +++ b/src/ballistica/core/platform/core_platform.h @@ -301,9 +301,6 @@ class CorePlatform { /// return nullptr. virtual auto GetStackTrace() -> PlatformStackTrace*; - // Called during stress testing. - virtual auto GetMemUsageInfo() -> std::string; - /// Optionally override fatal error reporting. If true is returned, default /// fatal error reporting will not run. virtual auto ReportFatalError(const std::string& message, @@ -458,13 +455,13 @@ class CorePlatform { virtual ~CorePlatform(); private: - bool is_stdin_a_terminal_ : 1 {}; - bool have_has_touchscreen_value_ : 1 {}; - bool have_touchscreen_ : 1 {}; - bool is_tegra_k1_ : 1 {}; - bool made_volatile_data_dir_ : 1 {}; - bool have_device_uuid_ : 1 {}; - bool ran_base_post_init_ : 1 {}; + bool is_stdin_a_terminal_{}; + bool have_has_touchscreen_value_{}; + bool have_touchscreen_{}; + bool is_tegra_k1_{}; + bool made_volatile_data_dir_{}; + bool have_device_uuid_{}; + bool ran_base_post_init_{}; millisecs_t start_time_millisecs_{}; std::string device_name_; std::string device_description_; diff --git a/src/ballistica/core/support/base_soft.h b/src/ballistica/core/support/base_soft.h index 1a9ba259..f45d661d 100644 --- a/src/ballistica/core/support/base_soft.h +++ b/src/ballistica/core/support/base_soft.h @@ -43,7 +43,7 @@ class BaseSoftInterface { const std::string& arg) = 0; virtual auto IsAppStarted() const -> bool = 0; virtual auto IsAppBootstrapped() const -> bool = 0; - virtual auto GetReturnValue() const -> int = 0; + // virtual auto GetReturnValue() const -> int = 0; virtual void PushMainThreadRunnable(Runnable* runnable) = 0; }; diff --git a/src/ballistica/core/support/core_config.h b/src/ballistica/core/support/core_config.h index ddcd5450..a74aabf0 100644 --- a/src/ballistica/core/support/core_config.h +++ b/src/ballistica/core/support/core_config.h @@ -29,6 +29,23 @@ class CoreConfig { /// Enable vr mode on supported platforms. bool vr_mode{}; + /// Log various stages/times in the bootstrapping process. + bool lifecycle_log{}; + + /// Normally early C++ Log() calls are held until babase has been imported + /// so that when they are pushed out to the Python logging calls they are + /// properly routed through the full engine. If you are not using babase + /// or are trying to debug early issues you can flip this off to push + /// things to Python as soon as technically possible. + bool hold_early_logs{true}; + + /// Let the engine know there's a debugger attached so it should do things + /// like abort() instead of exiting with error codes. + bool debugger_attached{}; + + /// Enables some extra timing logs/prints. + bool debug_timing{}; + /// If set, the app should exit immediately with this return code (on /// applicable platforms). This can be set by command-line parsing in /// response to arguments such as 'version' or 'help' which are processed @@ -50,23 +67,6 @@ class CoreConfig { /// Explicitly passed user-python (mods) dir. std::optional user_python_dir{}; - - /// Log various stages/times in the bootstrapping process. - bool lifecycle_log{}; - - /// Normally early C++ Log() calls are held until babase has been imported - /// so that when they are pushed out to the Python logging calls they are - /// properly routed through the full engine. If you are not using babase - /// or are trying to debug early issues you can flip this off to push - /// things to Python as soon as technically possible. - bool hold_early_logs{true}; - - /// Let the engine know there's a debugger attached so it should do things - /// like abort() instead of exiting with error codes. - bool debugger_attached{}; - - /// Enables some extra timing logs/prints. - bool debug_timing{}; }; } // namespace ballistica::core diff --git a/src/ballistica/scene_v1/connection/connection_to_host.h b/src/ballistica/scene_v1/connection/connection_to_host.h index 56669055..4d893443 100644 --- a/src/ballistica/scene_v1/connection/connection_to_host.h +++ b/src/ballistica/scene_v1/connection/connection_to_host.h @@ -34,9 +34,9 @@ class ConnectionToHost : public Connection { std::string peer_hash_input_; std::string peer_hash_; // Can remove once back-compat protocol is > 29 - bool ignore_old_attach_remote_player_packets_ : 1 {}; - bool printed_connect_message_ : 1 {}; - bool got_host_info_ : 1 {}; + bool ignore_old_attach_remote_player_packets_{}; + bool printed_connect_message_{}; + bool got_host_info_{}; int protocol_version_{-1}; int build_number_{}; millisecs_t last_ping_send_time_{}; diff --git a/src/ballistica/scene_v1/dynamics/dynamics.h b/src/ballistica/scene_v1/dynamics/dynamics.h index 413b3b2b..86b6c2d5 100644 --- a/src/ballistica/scene_v1/dynamics/dynamics.h +++ b/src/ballistica/scene_v1/dynamics/dynamics.h @@ -99,10 +99,10 @@ class Dynamics : public Object { int skid_sound_count_{}; int roll_sound_count_{}; int collision_count_{}; - bool in_process_ : 1 {}; - bool in_collide_message_ : 1 {}; - bool collide_message_reverse_order_ : 1 {}; - bool processing_collisions_ : 1 {}; + bool in_process_{}; + bool in_collide_message_{}; + bool collide_message_reverse_order_{}; + bool processing_collisions_{}; dWorldID ode_world_{}; dJointGroupID ode_contact_group_{}; dSpaceID ode_space_{}; diff --git a/src/ballistica/scene_v1/node/flag_node.h b/src/ballistica/scene_v1/node/flag_node.h index 3dbd9a52..198f0b2a 100644 --- a/src/ballistica/scene_v1/node/flag_node.h +++ b/src/ballistica/scene_v1/node/flag_node.h @@ -48,8 +48,8 @@ class FlagNode : public Node { void UpdateSpringPoint(int p1, int p2, float rest_length); base::GraphicsQuality graphics_quality_{}; - bool light_weight_ : 1 {}; - bool have_flag_impulse_ : 1 {}; + bool light_weight_{}; + bool have_flag_impulse_{}; base::AreaOfInterest* area_of_interest_{}; Part part_; std::vector color_ = {1.0f, 1.0f, 1.0f}; diff --git a/src/ballistica/scene_v1/node/globals_node.cc b/src/ballistica/scene_v1/node/globals_node.cc index 1ccc4e60..afa3a5dc 100644 --- a/src/ballistica/scene_v1/node/globals_node.cc +++ b/src/ballistica/scene_v1/node/globals_node.cc @@ -169,7 +169,7 @@ void GlobalsNode::SetAsForeground() { g_base->graphics->set_vignette_inner(Vector3f(vignette_inner())); #if BA_VR_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { auto* graphics_vr = base::GraphicsVR::get(); graphics_vr->set_vr_near_clip(vr_near_clip()); graphics_vr->set_vr_overlay_center(Vector3f(vr_overlay_center())); @@ -219,7 +219,7 @@ void GlobalsNode::SetDebrisFriction(float val) { void GlobalsNode::SetVRNearClip(float val) { vr_near_clip_ = val; #if BA_VR_BUILD - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { if (IsCurrentGlobals()) { base::GraphicsVR::get()->set_vr_near_clip(vr_near_clip_); } diff --git a/src/ballistica/scene_v1/node/image_node.cc b/src/ballistica/scene_v1/node/image_node.cc index b20c5f70..20586f65 100644 --- a/src/ballistica/scene_v1/node/image_node.cc +++ b/src/ballistica/scene_v1/node/image_node.cc @@ -211,7 +211,7 @@ void ImageNode::Draw(base::FrameDef* frame_def) { if (host_only_ && !context_ref().GetHostSession()) { return; } - bool vr = g_core->IsVRMode(); + bool vr = g_core->vr_mode(); // In vr mode we use the fixed overlay position if our scene // is set for that. diff --git a/src/ballistica/scene_v1/node/image_node.h b/src/ballistica/scene_v1/node/image_node.h index 40029933..ee22ba90 100644 --- a/src/ballistica/scene_v1/node/image_node.h +++ b/src/ballistica/scene_v1/node/image_node.h @@ -84,13 +84,13 @@ class ImageNode : public Node { CENTER_LEFT }; - bool host_only_ : 1 {}; - bool front_ : 1 {}; - bool absolute_scale_ : 1 {true}; - bool premultiplied_ : 1 {}; - bool fill_screen_ : 1 {}; - bool has_alpha_channel_ : 1 {true}; - bool dirty_ : 1 {true}; + bool host_only_{}; + bool front_{}; + bool absolute_scale_{true}; + bool premultiplied_{}; + bool fill_screen_{}; + bool has_alpha_channel_{true}; + bool dirty_{true}; Attach attach_{Attach::CENTER}; float vr_depth_{}; diff --git a/src/ballistica/scene_v1/node/spaz_node.cc b/src/ballistica/scene_v1/node/spaz_node.cc index b316888c..8efa91ea 100644 --- a/src/ballistica/scene_v1/node/spaz_node.cc +++ b/src/ballistica/scene_v1/node/spaz_node.cc @@ -4971,8 +4971,8 @@ void SpazNode::Draw(base::FrameDef* frame_def) { int elem_count = name_text_group_.GetElementCount(); float s_extra = - (g_core->IsVRMode() || g_base->ui->scale() == UIScale::kSmall) ? 1.2f - : 1.0f; + (g_core->vr_mode() || g_base->ui->scale() == UIScale::kSmall) ? 1.2f + : 1.0f; for (int e = 0; e < elem_count; e++) { // Gracefully skip unloaded textures. diff --git a/src/ballistica/scene_v1/node/terrain_node.cc b/src/ballistica/scene_v1/node/terrain_node.cc index ccf6f3ca..5a748230 100644 --- a/src/ballistica/scene_v1/node/terrain_node.cc +++ b/src/ballistica/scene_v1/node/terrain_node.cc @@ -222,7 +222,7 @@ void TerrainNode::Draw(base::FrameDef* frame_def) { if (!mesh_.Exists()) { return; } - if (vr_only_ && !g_core->IsVRMode()) { + if (vr_only_ && !g_core->vr_mode()) { return; } base::ObjectComponent c(overlay_ ? frame_def->overlay_3d_pass() diff --git a/src/ballistica/scene_v1/node/text_node.cc b/src/ballistica/scene_v1/node/text_node.cc index f111bedb..94f72cb9 100644 --- a/src/ballistica/scene_v1/node/text_node.cc +++ b/src/ballistica/scene_v1/node/text_node.cc @@ -367,11 +367,11 @@ void TextNode::Draw(base::FrameDef* frame_def) { text_width_dirty_ = false; } - bool vr_2d_text = (g_core->IsVRMode() && !in_world_); + bool vr_2d_text = (g_core->vr_mode() && !in_world_); // in vr mode we use the fixed overlay position if our scene is set for // that - bool vr_use_fixed = (g_core->IsVRMode() && scene()->use_fixed_vr_overlay()); + bool vr_use_fixed = (g_core->vr_mode() && scene()->use_fixed_vr_overlay()); // FIXME - in VR, fixed and front are currently mutually exclusive; need to // implement that. @@ -635,7 +635,7 @@ void TextNode::Draw(base::FrameDef* frame_def) { } else { c.SetColor(1, 1, 1, fin_a); } - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { c.SetFlatness(text_group_.GetElementMaxFlatness(e)); } else { c.SetFlatness( diff --git a/src/ballistica/scene_v1/scene_v1.h b/src/ballistica/scene_v1/scene_v1.h index ae8c78bf..3cb60954 100644 --- a/src/ballistica/scene_v1/scene_v1.h +++ b/src/ballistica/scene_v1/scene_v1.h @@ -388,6 +388,10 @@ class SceneV1FeatureSet : public FeatureSetNativeComponent { // Our subcomponents. SceneV1Python* const python; + // FIXME: should be private. + int session_count{}; + bool replay_open{}; + private: void SetupNodeMessageType_(const std::string& name, NodeMessageType val, const std::string& format); diff --git a/src/ballistica/scene_v1/support/client_session_net.cc b/src/ballistica/scene_v1/support/client_session_net.cc index a7d7c41f..467735c1 100644 --- a/src/ballistica/scene_v1/support/client_session_net.cc +++ b/src/ballistica/scene_v1/support/client_session_net.cc @@ -13,26 +13,28 @@ namespace ballistica::scene_v1 { ClientSessionNet::ClientSessionNet() { // Sanity check: we should only ever be writing one replay at once. - if (g_core->replay_open) { + if (g_scene_v1->replay_open) { Log(LogLevel::kError, - "g_replay_open true at netclient start; shouldn't happen."); + "g_scene_v1->replay_open true at netclient start;" + " shouldn't happen."); } assert(g_base->assets_server); // We always write replays as the highest protocol version we support. g_base->assets_server->PushBeginWriteReplayCall(kProtocolVersionMax); writing_replay_ = true; - g_core->replay_open = true; + g_scene_v1->replay_open = true; } ClientSessionNet::~ClientSessionNet() { if (writing_replay_) { // Sanity check: we should only ever be writing one replay at once. - if (!g_core->replay_open) { + if (!g_scene_v1->replay_open) { Log(LogLevel::kError, - "g_replay_open false at net-client close; shouldn't happen."); + "g_scene_v1->replay_open false at net-client close;" + " shouldn't happen."); } - g_core->replay_open = false; + g_scene_v1->replay_open = false; assert(g_base->assets_server); g_base->assets_server->PushEndWriteReplayCall(); writing_replay_ = false; diff --git a/src/ballistica/scene_v1/support/scene_v1_app_mode.cc b/src/ballistica/scene_v1/support/scene_v1_app_mode.cc index 59b25ae8..5daf266c 100644 --- a/src/ballistica/scene_v1/support/scene_v1_app_mode.cc +++ b/src/ballistica/scene_v1/support/scene_v1_app_mode.cc @@ -1070,9 +1070,9 @@ void SceneV1AppMode::Reset_() { PruneSessions_(); // If all is well our sessions should all be dead. - if (g_core->session_count != 0) { + if (g_scene_v1->session_count != 0) { Log(LogLevel::kError, "Session-count is non-zero (" - + std::to_string(g_core->session_count) + + std::to_string(g_scene_v1->session_count) + ") on Logic::Reset."); } diff --git a/src/ballistica/scene_v1/support/scene_v1_app_mode.h b/src/ballistica/scene_v1/support/scene_v1_app_mode.h index 7c98470c..0d9bd6f7 100644 --- a/src/ballistica/scene_v1/support/scene_v1_app_mode.h +++ b/src/ballistica/scene_v1/support/scene_v1_app_mode.h @@ -213,16 +213,16 @@ class SceneV1AppMode : public base::AppMode { Object::WeakRef foreground_scene_; Object::WeakRef foreground_session_; - bool chat_muted_ : 1 {}; - bool in_update_ : 1 {}; - bool kick_idle_players_ : 1 {}; - bool public_party_enabled_ : 1 {}; - bool public_party_queue_enabled_ : 1 {true}; - bool require_client_authentication_ : 1 {}; - bool idle_exiting_ : 1 {}; - bool game_roster_dirty_ : 1 {}; - bool kick_vote_in_progress_ : 1 {}; - bool kick_voting_enabled_ : 1 {true}; + bool chat_muted_{}; + bool in_update_{}; + bool kick_idle_players_{}; + bool public_party_enabled_{}; + bool public_party_queue_enabled_{true}; + bool require_client_authentication_{}; + bool idle_exiting_{}; + bool game_roster_dirty_{}; + bool kick_vote_in_progress_{}; + bool kick_voting_enabled_{true}; cJSON* game_roster_{}; millisecs_t last_game_roster_send_time_{}; diff --git a/src/ballistica/scene_v1/support/session.cc b/src/ballistica/scene_v1/support/session.cc index 5ddde60e..5b00bf0a 100644 --- a/src/ballistica/scene_v1/support/session.cc +++ b/src/ballistica/scene_v1/support/session.cc @@ -7,7 +7,7 @@ namespace ballistica::scene_v1 { Session::Session() { - g_core->session_count++; + g_scene_v1->session_count++; auto* appmode = SceneV1AppMode::GetActiveOrThrow(); @@ -15,7 +15,7 @@ Session::Session() { appmode->SetForegroundSession(this); } -Session::~Session() { g_core->session_count--; } +Session::~Session() { g_scene_v1->session_count--; } void Session::Update(int time_advance_millisecs, double time_advance) {} diff --git a/src/ballistica/scene_v1/support/session_stream.cc b/src/ballistica/scene_v1/support/session_stream.cc index 32ff4bc3..b2298514 100644 --- a/src/ballistica/scene_v1/support/session_stream.cc +++ b/src/ballistica/scene_v1/support/session_stream.cc @@ -27,15 +27,16 @@ SessionStream::SessionStream(HostSession* host_session, bool save_replay) host_session_{host_session} { if (save_replay) { // Sanity check - we should only ever be writing one replay at once. - if (g_core->replay_open) { + if (g_scene_v1->replay_open) { Log(LogLevel::kError, - "g_replay_open true at replay start; shouldn't happen."); + "g_scene_v1->replay_open true at replay start;" + " shouldn't happen."); } // We always write replays as the max protocol version we support. assert(g_base->assets_server); g_base->assets_server->PushBeginWriteReplayCall(kProtocolVersionMax); writing_replay_ = true; - g_core->replay_open = true; + g_scene_v1->replay_open = true; } // If we're the live output-stream from a host-session, @@ -52,11 +53,12 @@ SessionStream::~SessionStream() { if (writing_replay_) { // Sanity check: We should only ever be writing one replay at once. - if (!g_core->replay_open) { + if (!g_scene_v1->replay_open) { Log(LogLevel::kError, - "g_replay_open false at replay close; shouldn't happen."); + "g_scene_v1->replay_open false at replay close;" + " shouldn't happen."); } - g_core->replay_open = false; + g_scene_v1->replay_open = false; assert(g_base->assets_server); g_base->assets_server->PushEndWriteReplayCall(); writing_replay_ = false; @@ -186,14 +188,15 @@ void SessionStream::Fail() { Log(LogLevel::kError, "Error writing replay file"); if (writing_replay_) { // Sanity check: We should only ever be writing one replay at once. - if (!g_core->replay_open) { + if (!g_scene_v1->replay_open) { Log(LogLevel::kError, - "g_replay_open false at replay close; shouldn't happen."); + "g_scene_v1->replay_open false at replay close;" + " shouldn't happen."); } assert(g_base->assets_server); g_base->assets_server->PushEndWriteReplayCall(); writing_replay_ = false; - g_core->replay_open = false; + g_scene_v1->replay_open = false; } } diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 197a4514..ad796f60 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -13,7 +13,7 @@ #include "ballistica/shared/python/python.h" #include "ballistica/shared/python/python_command.h" -// Make sure min_sdl.h stays in here even though this file compile fine +// Make sure min_sdl.h stays in here even though this file compiles fine // without it. On some platforms it does a bit of magic to redefine main as // SDL_main which leads us to a tricky-to-diagnose linker error if it // removed from here. @@ -39,8 +39,8 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21612; -const char* kEngineVersion = "1.7.29"; +const int kEngineBuildNumber = 21623; +const char* kEngineVersion = "1.7.30"; const int kEngineApiVersion = 8; #if BA_MONOLITHIC_BUILD @@ -69,7 +69,7 @@ auto MonolithicMain(const core::CoreConfig& core_config) -> int { // If a command was passed, simply run it and exit. We want to act // simply as a Python interpreter in that case; we don't do any // environment setup (aside from the bits core does automatically such - // as making our built in binary modules available). + // as making our built-in binary modules available). if (l_core->core_config().call_command.has_value()) { auto gil{Python::ScopedInterpreterLock()}; bool success = PythonCommand(*l_core->core_config().call_command, @@ -152,10 +152,7 @@ auto MonolithicMain(const core::CoreConfig& core_config) -> int { } } } - if (l_base) { - return l_base->GetReturnValue(); - } - return -1; // Didn't even get core; something clearly wrong. + return 0; } #endif // BA_MONOLITHIC_BUILD diff --git a/src/ballistica/shared/foundation/event_loop.cc b/src/ballistica/shared/foundation/event_loop.cc index 88b7ad5b..24c5ca92 100644 --- a/src/ballistica/shared/foundation/event_loop.cc +++ b/src/ballistica/shared/foundation/event_loop.cc @@ -174,7 +174,7 @@ auto EventLoop::ThreadMainAssetsP_(void* data) -> void* { void EventLoop::PushSetSuspended(bool suspended) { assert(g_core); // Can be toggled from the main thread only. - assert(std::this_thread::get_id() == g_core->main_thread_id); + assert(std::this_thread::get_id() == g_core->main_thread_id()); PushThreadMessage_(ThreadMessage_(suspended ? ThreadMessage_::Type::kSuspend : ThreadMessage_::Type::kUnsuspend)); @@ -538,7 +538,8 @@ void EventLoop::PushThreadMessage_(const ThreadMessage_& t) { } // Show count periodically. - if ((std::this_thread::get_id() == g_core->main_thread_id) && foo > 100) { + if ((std::this_thread::get_id() == g_core->main_thread_id()) + && foo > 100) { foo = 0; log_entries.emplace_back( LogLevel::kInfo, @@ -577,8 +578,8 @@ void EventLoop::PushThreadMessage_(const ThreadMessage_& t) { void EventLoop::SetEventLoopsSuspended(bool suspended) { assert(g_core); - assert(std::this_thread::get_id() == g_core->main_thread_id); - g_core->event_loops_suspended = suspended; + assert(std::this_thread::get_id() == g_core->main_thread_id()); + g_core->set_event_loops_suspended(suspended); for (auto&& i : g_core->suspendable_event_loops) { i->PushSetSuspended(suspended); } @@ -587,10 +588,10 @@ void EventLoop::SetEventLoopsSuspended(bool suspended) { auto EventLoop::GetStillSuspendingEventLoops() -> std::vector { assert(g_core); std::vector threads; - assert(std::this_thread::get_id() == g_core->main_thread_id); + assert(std::this_thread::get_id() == g_core->main_thread_id()); // Only return results if an actual suspend is in effect. - if (g_core->event_loops_suspended) { + if (g_core->event_loops_suspended()) { for (auto&& i : g_core->suspendable_event_loops) { if (!i->suspended()) { threads.push_back(i); @@ -602,7 +603,7 @@ auto EventLoop::GetStillSuspendingEventLoops() -> std::vector { auto EventLoop::AreEventLoopsSuspended() -> bool { assert(g_core); - return g_core->event_loops_suspended; + return g_core->event_loops_suspended(); } auto EventLoop::NewTimer(microsecs_t length, bool repeat, Runnable* runnable) diff --git a/src/ballistica/shared/foundation/event_loop.h b/src/ballistica/shared/foundation/event_loop.h index 9bb2d057..6b68b51d 100644 --- a/src/ballistica/shared/foundation/event_loop.h +++ b/src/ballistica/shared/foundation/event_loop.h @@ -158,11 +158,11 @@ class EventLoop { EventLoopID identifier_{EventLoopID::kInvalid}; ThreadSource source_{}; - bool bootstrapped_ : 1 {}; - bool writing_tally_ : 1 {}; - bool suspended_ : 1 {}; - bool done_ : 1 {}; - bool acquires_python_gil_ : 1 {}; + bool bootstrapped_{}; + bool writing_tally_{}; + bool suspended_{}; + bool done_{}; + bool acquires_python_gil_{}; std::thread::id thread_id_{}; std::condition_variable thread_message_cv_; std::condition_variable client_listener_cv_; diff --git a/src/ballistica/shared/foundation/object.h b/src/ballistica/shared/foundation/object.h index 53b9eeea..04418b35 100644 --- a/src/ballistica/shared/foundation/object.h +++ b/src/ballistica/shared/foundation/object.h @@ -672,12 +672,12 @@ class Object { auto operator new(size_t size) -> void* { return new char[size]; } void ObjectUpdateForAcquire(); - bool object_is_static_allocated_ : 1 {true}; - bool object_has_been_strong_reffed_ : 1 {}; - bool object_is_ref_counted_ : 1 {}; - bool object_is_pending_deferred_ : 1 {}; - bool object_is_unmanaged_ : 1 {}; - bool object_is_dead_ : 1 {}; + bool object_is_static_allocated_{true}; + bool object_has_been_strong_reffed_{}; + bool object_is_ref_counted_{}; + bool object_is_pending_deferred_{}; + bool object_is_unmanaged_{}; + bool object_is_dead_{}; Object* object_next_{}; Object* object_prev_{}; ThreadOwnership thread_ownership_{ThreadOwnership::kClassDefault}; diff --git a/src/ballistica/ui_v1/support/root_ui.cc b/src/ballistica/ui_v1/support/root_ui.cc index 4e5df417..255b56b2 100644 --- a/src/ballistica/ui_v1/support/root_ui.cc +++ b/src/ballistica/ui_v1/support/root_ui.cc @@ -173,7 +173,7 @@ void RootUI::Draw(base::FrameDef* frame_def) { draw_menu_button = false; } } else if (g_buildconfig.rift_build()) { - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { draw_menu_button = false; } } diff --git a/src/ballistica/ui_v1/widget/root_widget.cc b/src/ballistica/ui_v1/widget/root_widget.cc index 99e47e61..51c34b84 100644 --- a/src/ballistica/ui_v1/widget/root_widget.cc +++ b/src/ballistica/ui_v1/widget/root_widget.cc @@ -111,7 +111,7 @@ RootWidget::~RootWidget() = default; auto RootWidget::AddCover(float h_align, VAlign v_align, float x, float y, float w, float h, float o) -> RootWidget::Button* { // Currently just not doing these in vr mode. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { return nullptr; } diff --git a/src/ballistica/ui_v1/widget/text_widget.cc b/src/ballistica/ui_v1/widget/text_widget.cc index a40f15d4..67474f50 100644 --- a/src/ballistica/ui_v1/widget/text_widget.cc +++ b/src/ballistica/ui_v1/widget/text_widget.cc @@ -429,7 +429,7 @@ void TextWidget::DoDrawText_(base::RenderPass* pass, float x_offset, } // In VR, draw everything flat because it's generally harder to read. - if (g_core->IsVRMode()) { + if (g_core->vr_mode()) { c.SetFlatness(text_group_->GetElementMaxFlatness(e)); } else { c.SetFlatness(std::min(text_group_->GetElementMaxFlatness(e), flatness_)); diff --git a/src/ballistica/ui_v1/widget/text_widget.h b/src/ballistica/ui_v1/widget/text_widget.h index c247e3aa..7c3cb3c6 100644 --- a/src/ballistica/ui_v1/widget/text_widget.h +++ b/src/ballistica/ui_v1/widget/text_widget.h @@ -113,24 +113,24 @@ class TextWidget : public Widget { HAlign alignment_h_{HAlign::kLeft}; VAlign alignment_v_{VAlign::kTop}; GlowType glow_type_{GlowType::kGradient}; - bool enabled_ : 1 {true}; - bool big_ : 1 {}; - bool force_internal_editing_ : 1 {}; - bool always_show_carat_ : 1 {}; - bool highlight_dirty_ : 1 {true}; - bool text_translation_dirty_ : 1 {true}; - bool text_group_dirty_ : 1 {true}; - bool outline_dirty_ : 1 {true}; - bool click_activate_ : 1 {}; - bool mouse_over_ : 1 {}; - bool pressed_ : 1 {}; - bool pressed_activate_ : 1 {}; - bool always_highlight_ : 1 {}; - bool editable_ : 1 {}; - bool selectable_ : 1 {}; - bool clear_pressed_ : 1 {}; - bool clear_mouse_over_ : 1 {}; - bool do_clear_button_ : 1 {true}; + bool enabled_{true}; + bool big_{}; + bool force_internal_editing_{}; + bool always_show_carat_{}; + bool highlight_dirty_{true}; + bool text_translation_dirty_{true}; + bool text_group_dirty_{true}; + bool outline_dirty_{true}; + bool click_activate_{}; + bool mouse_over_{}; + bool pressed_{}; + bool pressed_activate_{}; + bool always_highlight_{}; + bool editable_{}; + bool selectable_{}; + bool clear_pressed_{}; + bool clear_mouse_over_{}; + bool do_clear_button_{true}; int carat_position_{9999}; int max_chars_{99999}; float res_scale_{1.0f}; diff --git a/src/tools/pcommandbatch/pcommandbatch.c b/src/tools/pcommandbatch/pcommandbatch.c index 1137ac10..4e1c6991 100644 --- a/src/tools/pcommandbatch/pcommandbatch.c +++ b/src/tools/pcommandbatch/pcommandbatch.c @@ -36,10 +36,10 @@ struct Context_ { }; int path_exists_(const char* path); -int establish_connection_(const struct Context_* ctx); +int establish_connection_(struct Context_* ctx); int calc_paths_(struct Context_* ctx); int send_command_(struct Context_* ctx, int argc, char** argv); -int handle_response_(const struct Context_* ctx); +int handle_response_(struct Context_* ctx); // Read all data from a socket and return as a malloc'ed null-terminated // string. @@ -192,7 +192,7 @@ int path_exists_(const char* path) { return (stat(path, &file_stat) != -1); } -int establish_connection_(const struct Context_* ctx) { +int establish_connection_(struct Context_* ctx) { char state_file_path_full[256]; snprintf(state_file_path_full, sizeof(state_file_path_full), "%s/worker_state_%s_%d", ctx->state_dir_path, ctx->instance_prefix, @@ -338,7 +338,8 @@ int establish_connection_(const struct Context_* ctx) { return -1; } } - if (retry_attempt >= 10) { + // Let's stop at 5, which will be about a minute of waiting total. + if (retry_attempt >= 5) { fprintf(stderr, "Error: pcommandbatch client %s_%d (pid %d): too many " "retry attempts; giving up.\n", @@ -346,6 +347,11 @@ int establish_connection_(const struct Context_* ctx) { close(sockfd); return -1; } + + // Am currently seeing the occasional hang in this loop. Let's flip + // into verbose if that might be happening to diagnose. + ctx->verbose = 1; + if (ctx->verbose) { fprintf( stderr, @@ -493,7 +499,7 @@ int send_command_(struct Context_* ctx, int argc, char** argv) { return 0; } -int handle_response_(const struct Context_* ctx) { +int handle_response_(struct Context_* ctx) { char* inbuf = read_string_from_socket_(ctx); // Getting null or an empty string response imply something is broken. diff --git a/tools/efrotools/openalbuild.py b/tools/efrotools/openalbuild.py index bfbfa061..7d00ed80 100644 --- a/tools/efrotools/openalbuild.py +++ b/tools/efrotools/openalbuild.py @@ -29,7 +29,7 @@ def _build_dir(arch: str, mode: str) -> str: return f'build/openal_build_android_{arch}_{mode}' -def build(arch: str, mode: str) -> None: +def build_openal(arch: str, mode: str) -> None: """Do the thing.""" from efrotools import replace_exact @@ -39,6 +39,8 @@ def build(arch: str, mode: str) -> None: if mode not in MODES: raise CleanError(f"Invalid mode '{mode}'.") + enable_oboe = True + # Get ndk path. ndk_path = ( subprocess.run( @@ -49,6 +51,7 @@ def build(arch: str, mode: str) -> None: .stdout.decode() .strip() ) + # os.environ['NDK_ROOT'] = ndk_path # Grab from git and build. builddir = _build_dir(arch, mode) @@ -58,9 +61,27 @@ def build(arch: str, mode: str) -> None: ['git', 'clone', 'https://github.com/kcat/openal-soft.git', builddir], check=True, ) + subprocess.run(['git', 'checkout', '1.23.1'], check=True, cwd=builddir) - commit = 'd3875f3' # Version 1.23.1 - subprocess.run(['git', 'checkout', commit], check=True, cwd=builddir) + if enable_oboe: + builddir_oboe = f'{builddir}_oboe' + subprocess.run(['rm', '-rf', builddir_oboe], check=True) + subprocess.run( + ['mkdir', '-p', os.path.dirname(builddir_oboe)], check=True + ) + subprocess.run( + [ + 'git', + 'clone', + 'https://github.com/google/oboe', + builddir_oboe, + ], + check=True, + ) + subprocess.run( + ['git', 'checkout', '1.8.0'], check=True, cwd=builddir_oboe + ) + print(f'FULLY GOT {builddir_oboe}') # One bit of filtering: by default, openalsoft sends all sorts of # log messages to the android log. This is reasonable since its @@ -85,16 +106,38 @@ def build(arch: str, mode: str) -> None: with open(loggingpath, 'w', encoding='utf-8') as outfile: outfile.write(txt) + android_platform = 23 + subprocess.run( [ 'cmake', '.', f'-DANDROID_ABI={ARCHS[arch]}', - '-DANDROID_NATIVE_API_LEVEL=21', + f'-DCMAKE_BUILD_TYPE={mode}', + '-DCMAKE_TOOLCHAIN_FILE=' + f'{ndk_path}/build/cmake/android.toolchain.cmake', + f'-DANDROID_PLATFORM={android_platform}', + ], + cwd=builddir_oboe, + check=True, + ) + subprocess.run(['make'], cwd=builddir_oboe, check=True) + + subprocess.run( + [ + 'cmake', + '.', + f'-DANDROID_ABI={ARCHS[arch]}', + '-DALSOFT_INSTALL=0', # Prevents odd error. + '-DALSOFT_REQUIRE_OBOE=1', + '-DALSOFT_BACKEND_OPENSL=0', + '-DALSOFT_BACKEND_WAVE=0', f'-DCMAKE_BUILD_TYPE={mode}', '-DLIBTYPE=STATIC', '-DCMAKE_TOOLCHAIN_FILE=' f'{ndk_path}/build/cmake/android.toolchain.cmake', + f'-DOBOE_SOURCE={os.path.abspath(builddir_oboe)}', + f'-DANDROID_PLATFORM={android_platform}', ], cwd=builddir, check=True, @@ -129,9 +172,13 @@ def gather() -> None: for arch, andrarch in ARCHS.items(): for mode in MODES: builddir = _build_dir(arch, mode) + builddir_oboe = f'{builddir}_oboe' installdir = f'{outdir}/lib/{andrarch}_{mode}' subprocess.run(['mkdir', '-p', installdir], check=True) subprocess.run( ['cp', f'{builddir}/libopenal.a', installdir], check=True ) + subprocess.run( + ['cp', f'{builddir_oboe}/liboboe.a', installdir], check=True + ) print('OpenAL gather successful!') diff --git a/tools/efrotools/pcommands2.py b/tools/efrotools/pcommands2.py index 5216560e..76beef8a 100644 --- a/tools/efrotools/pcommands2.py +++ b/tools/efrotools/pcommands2.py @@ -51,7 +51,7 @@ def sortlines() -> None: def openal_build_android() -> None: """Build openalsoft for android.""" from efro.error import CleanError - from efrotools.openalbuild import build + from efrotools.openalbuild import build_openal pcommand.disallow_in_batch() @@ -62,7 +62,7 @@ def openal_build_android() -> None: ' and one arg: debug, release' ) - build(args[0], args[1]) + build_openal(args[0], args[1]) def openal_gather() -> None: diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 6d5a2a83..50d5ac8c 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -466,7 +466,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: # Ok; let 'er rip! exargs = ' --with-pydebug' if debug else '' subprocess.run( - f'ARCH={arch} ANDROID_API=21 ./build.sh{exargs} --without-ensurepip' + f'ARCH={arch} ANDROID_API=23 ./build.sh{exargs} --without-ensurepip' f' --with-build-python=/home/ubuntu/.py311/bin/python3.11', shell=True, check=True,