mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-24 07:53:30 +08:00
yup, even more c++ tidying
This commit is contained in:
parent
2a43584d5a
commit
175232037c
@ -3995,26 +3995,26 @@
|
||||
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
|
||||
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
|
||||
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/08/c51a835abdfb830800214b5d4ee2",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/29/86/d7dbef8da1cbf6a2227679baab80",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0a/a1/7fc60dfb937f3aac13386368dc56",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f3/4f/90c63ed7c3ac40a666946d83e61c",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/02/fc/63aaa0249b27e36c5e33391ac301",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d3/ad/5788ce11e94538cea04c48dc3ef0",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/69/12/9dbc452fe20c0f092cf39d50c77f",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f9/33/cf16d5d6c40efbc185a474b9a701",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/10/e6/5c8896149d987ea44b4daf8a6b30",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2f/46/22652fbf1e6d8644381fa6907fa2",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7a/08/d71c945cffd15214e889af6ae86d",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/9f/8fdc621bd6589bf85dad88cb1e7c",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/25/f58dd573f8fd0ed2bce92468d2eb",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a2/c8/8abb7f6cf9cca43d4341ba4a0359",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bc/ed/796ba1a0004b208ac462e7fc022b",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/21/38/dff36d635433f885c46fed606956",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a0/e3/8a438b7be97ea9b5e3a3108014bf",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f8/8a/33f28e4746adac552e0f65d85b06",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/d0/1b/56a99ad953586b701e238a341d51",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/5e/4c/5082c1b732784f50b30d453bbed9",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c9/9b/1988356c188605d63adfd726ae70",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/90/20/7847611202aae8f7f25f81e11798",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f1/d3/8b4f9456fde946a6f832a0a2ed56",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/f3/a87ed66a967361270c38501207ca",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/53/2d/f237861e70f755bd2a1bc3ff0bc9",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1d/c0/f17e88adfa27445f56f349c08e1e",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/33/48/b87e86d797ea65f9088cebf19c41",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1d/7d/f7666c243f12b032e0473fe96c8e",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/16/ab/b98796b9f947d710cef4f69e1e54",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/28/ba/6ce4a4dd0c164173746b8890f7e9",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ba/c2/da7fc794b8d1b2a3c507acc05c74",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5c/6e/3b8ab35122b48710216c3331ed4a",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9d/6d/9c828387ca8ce579e2eb04ac60e9",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/3c/8d/7e5873dfcb1a7d7afedb4931b4ef",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/93/15/13337ede73eb44cbdf1bd3b33b30",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/28/c4/369e1ee38f63fba86bde9b62d1a8",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8f/14/c9302e20d2959adc852dc375bdce",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c5/cf/220527d9a07378862117ebde3bf4",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/99/4d/6db8b3fb6d3cb45154312bb59cd2",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/43/64/57681573e37a5c29801ca7e931a4",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/81/60/37044e17e52ca125c1d48af83d03",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fb/47/d505c3feea40888985dd335dc8c4",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/3d/20c78e744ac26a13b7418166d675",
|
||||
@ -4031,14 +4031,14 @@
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3b/79/592c41691e94807d23a783723861",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/d9/36f4cf8527494f419db74ae6c78f",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/e5/7f0677e6fb8d7cfa169930579712",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/9f/5f/8e3d43b1d7c21afc621998c549da",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/33/b5/23da6c12e960e583cb98072ad637",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/43/04/136cab4b0edf4feafae6c279c977",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/95/f7/41e8fe3e7a8ab6786ee5ed4956c2",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/b4/a1/2a5fa558d0bdcc34e6c14b819bea",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/1c/c9/aa2a975716b79c79801d61ecfb54",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/d5/8c/e96d8b68d3c217fa43ce357980df",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0d/d2/3c11d620c85cc775d284cc9d79c1",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/77/3f/53e29b476834c1e00b1ed0934b82",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/0a/6f/612238de640a2da2501e4bd29d3d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/bf/36/218291ca0b4fd005e76261fc2279",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/42/13/58a6b20bbe3e72ff3b055e025fb8",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/7d/a6/268f90b14807bb1740cd2ac65bd5",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/fe/78/35e0537296a08c6516a82417fba4",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/b7/5f/41d33fe421bd61e85e54a967c1b4",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/1f/b1/6897e3bb590a95dcf85316f286e1",
|
||||
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
|
||||
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.7 (build 20833, api 7, 2022-09-12)
|
||||
### 1.7.7 (build 20835, api 7, 2022-09-12)
|
||||
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
|
||||
- Improved logging of missing playlist game types.
|
||||
- Some ba.Lstr functionality can now be used in background threads.
|
||||
|
||||
@ -38,7 +38,7 @@ def bootstrap() -> None:
|
||||
|
||||
# Give a soft warning if we're being used with a different binary
|
||||
# version than we expect.
|
||||
expected_build = 20833
|
||||
expected_build = 20835
|
||||
running_build: int = env['build_number']
|
||||
if running_build != expected_build:
|
||||
print(
|
||||
|
||||
@ -17,7 +17,7 @@ AssetsServer::AssetsServer() {
|
||||
assert(g_assets_server == nullptr);
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kAssets);
|
||||
thread_ = new Thread(ThreadTag::kAssets);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ namespace ballistica {
|
||||
// this is provided by the renderer
|
||||
class ModelRendererData : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kMain;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kMain;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@ namespace ballistica {
|
||||
// this is extended by the renderer
|
||||
class TextureRendererData : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kMain;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kMain;
|
||||
}
|
||||
|
||||
// Create the renderer data but don't load it in yet.
|
||||
|
||||
@ -87,7 +87,7 @@ class AudioServer::ThreadSource : public Object {
|
||||
return (play_count_ << 16u) | (static_cast<uint32_t>(id_) & 0xFFFFu);
|
||||
}
|
||||
void UpdateAvailability();
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override;
|
||||
auto client_source() const -> AudioSource* { return client_source_.get(); }
|
||||
auto source_sound() const -> SoundData* {
|
||||
return source_sound_ ? source_sound_->get() : nullptr;
|
||||
@ -326,7 +326,7 @@ AudioServer::AudioServer() : impl_{new AudioServer::Impl()} {
|
||||
assert(g_audio_server == nullptr);
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kAudio);
|
||||
thread_ = new Thread(ThreadTag::kAudio);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
}
|
||||
|
||||
@ -746,9 +746,8 @@ AudioServer::ThreadSource::~ThreadSource() {
|
||||
#endif // BA_ENABLE_AUDIO
|
||||
}
|
||||
|
||||
auto AudioServer::ThreadSource::GetDefaultOwnerThread() const
|
||||
-> ThreadIdentifier {
|
||||
return ThreadIdentifier::kAudio;
|
||||
auto AudioServer::ThreadSource::GetDefaultOwnerThread() const -> ThreadTag {
|
||||
return ThreadTag::kAudio;
|
||||
}
|
||||
|
||||
void AudioServer::ThreadSource::UpdateAvailability() {
|
||||
|
||||
@ -15,8 +15,8 @@ namespace ballistica {
|
||||
// Provider for streamed audio data.
|
||||
class AudioStreamer : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kAudio;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kAudio;
|
||||
}
|
||||
AudioStreamer(const char* file_name, ALuint source, bool loop);
|
||||
~AudioStreamer() override;
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kAppBuildNumber = 20833;
|
||||
const int kAppBuildNumber = 20835;
|
||||
const char* kAppVersion = "1.7.7";
|
||||
|
||||
// Our standalone globals.
|
||||
@ -39,23 +39,22 @@ const char* kAppVersion = "1.7.7";
|
||||
// Everything else should go into App (or more ideally into a class).
|
||||
int g_early_log_writes{10};
|
||||
|
||||
V1Account* g_v1_account{};
|
||||
AppConfig* g_app_config{};
|
||||
App* g_app{};
|
||||
AppConfig* g_app_config{};
|
||||
AppInternal* g_app_internal{};
|
||||
AppFlavor* g_app_flavor{};
|
||||
Assets* g_assets{};
|
||||
AssetsServer* g_assets_server{};
|
||||
Audio* g_audio{};
|
||||
AudioServer* g_audio_server{};
|
||||
BGDynamics* g_bg_dynamics{};
|
||||
BGDynamicsServer* g_bg_dynamics_server{};
|
||||
Context* g_context{};
|
||||
Logic* g_logic{};
|
||||
Graphics* g_graphics{};
|
||||
GraphicsServer* g_graphics_server{};
|
||||
Input* g_input{};
|
||||
Logic* g_logic{};
|
||||
Thread* g_main_thread{};
|
||||
Assets* g_assets{};
|
||||
AssetsServer* g_assets_server{};
|
||||
Networking* g_networking{};
|
||||
NetworkReader* g_network_reader{};
|
||||
NetworkWriter* g_network_writer{};
|
||||
@ -66,22 +65,7 @@ StdioConsole* g_stdio_console{};
|
||||
TextGraphics* g_text_graphics{};
|
||||
UI* g_ui{};
|
||||
Utils* g_utils{};
|
||||
|
||||
// Basic overview of our bootstrapping process:
|
||||
// 1: All threads and globals are created and provisioned. Everything above
|
||||
// should exist at the end of this step (if it is going to exist).
|
||||
// Threads should not be talking to each other yet at this point.
|
||||
// 2: The system is set in motion. The logic thread is told to load/apply the
|
||||
// config. This event kicks off an initial-screen-creation message sent to
|
||||
// the graphics-server thread. Other systems are informed that bootstrapping
|
||||
// is complete and that they are free to talk to each other. Initial
|
||||
// input-devices are added, asset loads can begin (at least ones not
|
||||
// dependent on the screen/renderer), etc.
|
||||
// 3: The initial screen is created on the graphics-server thread in response
|
||||
// to the message sent from the game thread. A completion notice is sent
|
||||
// back to the game thread when done.
|
||||
// 4: Back on the game thread, any renderer-dependent asset-loads/etc. can begin
|
||||
// and lastly the initial game session is kicked off.
|
||||
V1Account* g_v1_account{};
|
||||
|
||||
auto BallisticaMain(int argc, char** argv) -> int {
|
||||
try {
|
||||
@ -94,26 +78,19 @@ auto BallisticaMain(int argc, char** argv) -> int {
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Phase 1: Create and provision all globals.
|
||||
// Phase 1: "The board is set."
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// Absolute bare-bones basics.
|
||||
// Here we instantiate all of our globals. Code here should
|
||||
// avoid any logic that accesses other globals since they may
|
||||
// not yet exist.
|
||||
|
||||
g_platform = Platform::Create();
|
||||
g_app = new App(argc, argv);
|
||||
|
||||
// Create a Thread wrapper around the current (main) thread.
|
||||
g_main_thread =
|
||||
new Thread(ThreadIdentifier::kMain, ThreadSource::kWrapMain);
|
||||
|
||||
// Bootstrap our Python environment as early as we can (depends on
|
||||
// g_platform for locating OS-specific paths).
|
||||
g_main_thread = new Thread(ThreadTag::kMain, ThreadSource::kWrapMain);
|
||||
g_python = new Python();
|
||||
|
||||
// Spin up our specific app and graphics variations (VR, headless, etc.)
|
||||
g_app_flavor = g_platform->CreateAppFlavor();
|
||||
g_graphics = g_platform->CreateGraphics();
|
||||
|
||||
// Various other subsystems.
|
||||
g_graphics_server = new GraphicsServer();
|
||||
g_audio = new Audio();
|
||||
g_audio_server = new AudioServer();
|
||||
@ -138,14 +115,19 @@ auto BallisticaMain(int argc, char** argv) -> int {
|
||||
if (g_buildconfig.enable_stdio_console()) {
|
||||
g_stdio_console = new StdioConsole();
|
||||
}
|
||||
|
||||
// At this point all of our globals should exist.
|
||||
g_app->is_bootstrapped = true;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Phase 2: Set things in motion.
|
||||
// Phase 2: "The pieces are moving."
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// Allow our subsystems to start doing work in their own threads
|
||||
// and communicating with other subsystems. Note that we may still
|
||||
// want to run some things serially here and ordering may be important
|
||||
// (for instance we want to give our main thread a chance to register
|
||||
// all initial input devices with the logic thread before the logic
|
||||
// thread applies the current config to them).
|
||||
|
||||
g_logic->OnAppStart();
|
||||
g_audio_server->OnAppStart();
|
||||
g_assets_server->OnAppStart();
|
||||
@ -154,14 +136,19 @@ auto BallisticaMain(int argc, char** argv) -> int {
|
||||
if (g_stdio_console) {
|
||||
g_stdio_console->OnAppStart();
|
||||
}
|
||||
// Ok; now that we're bootstrapped, tell the game thread to read and apply
|
||||
// the config which should kick off the real action.
|
||||
|
||||
// As the last step of this phase, tell the logic thread to apply
|
||||
// the app config which will kick off screen creation and otherwise
|
||||
// get the ball rolling.
|
||||
g_logic->PushApplyConfigCall();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Phase 3/4: Create a screen and/or kick off game (in other threads).
|
||||
// Phase 3: "We come to it at last; the great battle of our time."
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// At this point all threads are off and running and we simply
|
||||
// feed events until things end (or return and let the OS do that).
|
||||
|
||||
if (g_app_flavor->ManagesEventLoop()) {
|
||||
// On our event-loop-managing platforms we now simply sit in our event
|
||||
// loop until the app is quit.
|
||||
|
||||
@ -126,8 +126,8 @@ auto Object::GetObjectDescription() const -> std::string {
|
||||
+ ">";
|
||||
}
|
||||
|
||||
auto Object::GetDefaultOwnerThread() const -> ThreadIdentifier {
|
||||
return ThreadIdentifier::kLogic;
|
||||
auto Object::GetDefaultOwnerThread() const -> ThreadTag {
|
||||
return ThreadTag::kLogic;
|
||||
}
|
||||
|
||||
auto Object::GetThreadOwnership() const -> Object::ThreadOwnership {
|
||||
@ -141,19 +141,19 @@ auto Object::GetThreadOwnership() const -> Object::ThreadOwnership {
|
||||
|
||||
#if BA_DEBUG_BUILD
|
||||
|
||||
static auto GetCurrentThreadIdentifier() -> ThreadIdentifier {
|
||||
static auto GetCurrentThreadTag() -> ThreadTag {
|
||||
if (InMainThread()) {
|
||||
return ThreadIdentifier::kMain;
|
||||
return ThreadTag::kMain;
|
||||
} else if (InLogicThread()) {
|
||||
return ThreadIdentifier::kLogic;
|
||||
return ThreadTag::kLogic;
|
||||
} else if (InAudioThread()) {
|
||||
return ThreadIdentifier::kAudio;
|
||||
return ThreadTag::kAudio;
|
||||
} else if (InNetworkWriteThread()) {
|
||||
return ThreadIdentifier::kNetworkWrite;
|
||||
return ThreadTag::kNetworkWrite;
|
||||
} else if (InAssetsThread()) {
|
||||
return ThreadIdentifier::kAssets;
|
||||
return ThreadTag::kAssets;
|
||||
} else if (InBGDynamicsThread()) {
|
||||
return ThreadIdentifier::kBGDynamics;
|
||||
return ThreadTag::kBGDynamics;
|
||||
} else {
|
||||
throw Exception(std::string("unrecognized thread: ")
|
||||
+ GetCurrentThreadName());
|
||||
@ -166,8 +166,8 @@ auto Object::ObjectUpdateForAcquire() -> void {
|
||||
// If we're set to use the next-referencing thread and haven't set one
|
||||
// yet, do so.
|
||||
if (thread_ownership == ThreadOwnership::kNextReferencing
|
||||
&& owner_thread_ == ThreadIdentifier::kInvalid) {
|
||||
owner_thread_ = GetCurrentThreadIdentifier();
|
||||
&& owner_thread_ == ThreadTag::kInvalid) {
|
||||
owner_thread_ = GetCurrentThreadTag();
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ auto Object::ObjectThreadCheck() -> void {
|
||||
|
||||
ThreadOwnership thread_ownership = GetThreadOwnership();
|
||||
|
||||
ThreadIdentifier t;
|
||||
ThreadTag t;
|
||||
if (thread_ownership == ThreadOwnership::kClassDefault) {
|
||||
t = GetDefaultOwnerThread();
|
||||
} else {
|
||||
@ -189,32 +189,32 @@ auto Object::ObjectThreadCheck() -> void {
|
||||
+ "; expected " THREADNAME " thread; got " \
|
||||
+ GetCurrentThreadName())
|
||||
switch (t) {
|
||||
case ThreadIdentifier::kMain:
|
||||
case ThreadTag::kMain:
|
||||
if (!InMainThread()) {
|
||||
DO_FAIL("Main");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kLogic:
|
||||
case ThreadTag::kLogic:
|
||||
if (!InLogicThread()) {
|
||||
DO_FAIL("Logic");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kAudio:
|
||||
case ThreadTag::kAudio:
|
||||
if (!InAudioThread()) {
|
||||
DO_FAIL("Audio");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kNetworkWrite:
|
||||
case ThreadTag::kNetworkWrite:
|
||||
if (!InNetworkWriteThread()) {
|
||||
DO_FAIL("NetworkWrite");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kAssets:
|
||||
case ThreadTag::kAssets:
|
||||
if (!InAssetsThread()) {
|
||||
DO_FAIL("Assets");
|
||||
}
|
||||
break;
|
||||
case ThreadIdentifier::kBGDynamics:
|
||||
case ThreadTag::kBGDynamics:
|
||||
if (!InBGDynamicsThread()) {
|
||||
DO_FAIL("BGDynamics");
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ class Object {
|
||||
/// it can perform sanity-tests to make sure references are not being
|
||||
/// added at incorrect times or from incorrect threads.
|
||||
/// The default implementation uses the per-object
|
||||
/// ThreadOwnership/ThreadIdentifier values accessible below. NOTE: this
|
||||
/// ThreadOwnership/ThreadTag values accessible below. NOTE: this
|
||||
/// check runs only in the debug build so don't add any logical side-effects!
|
||||
virtual void ObjectThreadCheck();
|
||||
|
||||
@ -59,15 +59,15 @@ class Object {
|
||||
|
||||
/// Return the exact thread to check for with ThreadOwnership::kClassDefault
|
||||
/// (in the default ObjectThreadCheck implementation at least).
|
||||
/// Default returns ThreadIdentifier::kLogic
|
||||
virtual auto GetDefaultOwnerThread() const -> ThreadIdentifier;
|
||||
/// Default returns ThreadTag::kLogic
|
||||
virtual auto GetDefaultOwnerThread() const -> ThreadTag;
|
||||
|
||||
/// Set thread ownership for an individual object.
|
||||
void SetThreadOwnership(ThreadOwnership ownership) {
|
||||
#if BA_DEBUG_BUILD
|
||||
thread_ownership_ = ownership;
|
||||
if (thread_ownership_ == ThreadOwnership::kNextReferencing) {
|
||||
owner_thread_ = ThreadIdentifier::kInvalid;
|
||||
owner_thread_ = ThreadTag::kInvalid;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -560,7 +560,7 @@ class Object {
|
||||
Object* object_next_{};
|
||||
Object* object_prev_{};
|
||||
ThreadOwnership thread_ownership_{ThreadOwnership::kClassDefault};
|
||||
ThreadIdentifier owner_thread_{ThreadIdentifier::kInvalid};
|
||||
ThreadTag owner_thread_{ThreadTag::kInvalid};
|
||||
bool thread_checks_enabled_{true};
|
||||
millisecs_t object_birth_time_{};
|
||||
bool object_printed_warning_{};
|
||||
|
||||
@ -208,31 +208,31 @@ void Thread::GetThreadMessages(std::list<ThreadMessage>* messages) {
|
||||
}
|
||||
}
|
||||
|
||||
Thread::Thread(ThreadIdentifier identifier_in, ThreadSource source)
|
||||
Thread::Thread(ThreadTag identifier_in, ThreadSource source)
|
||||
: source_(source), identifier_(identifier_in) {
|
||||
switch (source_) {
|
||||
case ThreadSource::kCreate: {
|
||||
int (*func)(void*);
|
||||
switch (identifier_) {
|
||||
case ThreadIdentifier::kLogic:
|
||||
case ThreadTag::kLogic:
|
||||
func = RunLogicThread;
|
||||
break;
|
||||
case ThreadIdentifier::kAssets:
|
||||
case ThreadTag::kAssets:
|
||||
func = RunAssetsThread;
|
||||
break;
|
||||
case ThreadIdentifier::kMain:
|
||||
case ThreadTag::kMain:
|
||||
// Shouldn't happen; this thread gets wrapped; not launched.
|
||||
throw Exception();
|
||||
case ThreadIdentifier::kAudio:
|
||||
case ThreadTag::kAudio:
|
||||
func = RunAudioThread;
|
||||
break;
|
||||
case ThreadIdentifier::kBGDynamics:
|
||||
case ThreadTag::kBGDynamics:
|
||||
func = RunBGDynamicThread;
|
||||
break;
|
||||
case ThreadIdentifier::kNetworkWrite:
|
||||
case ThreadTag::kNetworkWrite:
|
||||
func = RunNetworkWriteThread;
|
||||
break;
|
||||
case ThreadIdentifier::kStdin:
|
||||
case ThreadTag::kStdin:
|
||||
func = RunStdInputThread;
|
||||
break;
|
||||
default:
|
||||
@ -276,35 +276,35 @@ auto Thread::ThreadMain() -> int {
|
||||
const char* id_string;
|
||||
|
||||
switch (identifier_) {
|
||||
case ThreadIdentifier::kLogic:
|
||||
case ThreadTag::kLogic:
|
||||
name = "logic";
|
||||
id_string = "ballistica logic";
|
||||
break;
|
||||
case ThreadIdentifier::kStdin:
|
||||
case ThreadTag::kStdin:
|
||||
name = "stdin";
|
||||
id_string = "ballistica stdin";
|
||||
break;
|
||||
case ThreadIdentifier::kAssets:
|
||||
case ThreadTag::kAssets:
|
||||
name = "assets";
|
||||
id_string = "ballistica assets";
|
||||
break;
|
||||
case ThreadIdentifier::kFileOut:
|
||||
case ThreadTag::kFileOut:
|
||||
name = "fileout";
|
||||
id_string = "ballistica file-out";
|
||||
break;
|
||||
case ThreadIdentifier::kMain:
|
||||
case ThreadTag::kMain:
|
||||
name = "main";
|
||||
id_string = "ballistica main";
|
||||
break;
|
||||
case ThreadIdentifier::kAudio:
|
||||
case ThreadTag::kAudio:
|
||||
name = "audio";
|
||||
id_string = "ballistica audio";
|
||||
break;
|
||||
case ThreadIdentifier::kBGDynamics:
|
||||
case ThreadTag::kBGDynamics:
|
||||
name = "bgdynamics";
|
||||
id_string = "ballistica bg-dynamics";
|
||||
break;
|
||||
case ThreadIdentifier::kNetworkWrite:
|
||||
case ThreadTag::kNetworkWrite:
|
||||
name = "networkwrite";
|
||||
id_string = "ballistica network writing";
|
||||
break;
|
||||
|
||||
@ -23,8 +23,7 @@ const int kThreadMessageSafetyThreshold{500};
|
||||
// A thread with a built-in event loop.
|
||||
class Thread {
|
||||
public:
|
||||
explicit Thread(ThreadIdentifier id,
|
||||
ThreadSource source = ThreadSource::kCreate);
|
||||
explicit Thread(ThreadTag id, ThreadSource source = ThreadSource::kCreate);
|
||||
virtual ~Thread();
|
||||
|
||||
auto ClearCurrentThreadName() -> void;
|
||||
@ -55,7 +54,7 @@ class Thread {
|
||||
void set_thread_id(std::thread::id id) { thread_id_ = id; }
|
||||
|
||||
auto RunEventLoop(bool single_cycle = false) -> int;
|
||||
auto identifier() const -> ThreadIdentifier { return identifier_; }
|
||||
auto identifier() const -> ThreadTag { return identifier_; }
|
||||
|
||||
// Register a timer to run on the thread.
|
||||
auto NewTimer(millisecs_t length, bool repeat,
|
||||
@ -129,7 +128,7 @@ class Thread {
|
||||
ThreadSource source_;
|
||||
int listen_sd_{};
|
||||
std::thread::id thread_id_{};
|
||||
ThreadIdentifier identifier_{ThreadIdentifier::kInvalid};
|
||||
ThreadTag identifier_{ThreadTag::kInvalid};
|
||||
millisecs_t last_complaint_time_{};
|
||||
bool acquires_python_gil_{};
|
||||
|
||||
|
||||
@ -997,7 +997,7 @@ enum class ThreadSource {
|
||||
/// Used for module-thread identification.
|
||||
/// Mostly just for debugging, through a few things are affected by this
|
||||
/// (the Logic thread manages the python GIL, etc).
|
||||
enum class ThreadIdentifier {
|
||||
enum class ThreadTag {
|
||||
kInvalid,
|
||||
kLogic,
|
||||
kAssets,
|
||||
|
||||
@ -667,7 +667,7 @@ BGDynamicsServer::BGDynamicsServer()
|
||||
BA_PRECONDITION(g_bg_dynamics_server == nullptr);
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kBGDynamics);
|
||||
thread_ = new Thread(ThreadTag::kBGDynamics);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
|
||||
|
||||
@ -66,8 +66,8 @@ class BGDynamicsServer {
|
||||
};
|
||||
class StepData : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kBGDynamics;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kBGDynamics;
|
||||
}
|
||||
Vector3f cam_pos{0.0f, 0.0f, 0.0f};
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ namespace ballistica {
|
||||
// A component of a material - comprises one or more conditions and actions.
|
||||
class MaterialComponent : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kLogic;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kLogic;
|
||||
}
|
||||
|
||||
auto GetFlattenedSize() -> size_t;
|
||||
|
||||
@ -9,8 +9,8 @@ namespace ballistica {
|
||||
|
||||
class Framebuffer : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kMain;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kMain;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1001,8 +1001,8 @@ class RendererGL::FramebufferObjectGL : public Framebuffer {
|
||||
// Base class for fragment/vertex shaders.
|
||||
class RendererGL::ShaderGL : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kMain;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kMain;
|
||||
}
|
||||
|
||||
ShaderGL(GLenum type_in, const std::string& src_in) : type_(type_in) {
|
||||
|
||||
@ -11,8 +11,8 @@ namespace ballistica {
|
||||
// Encapsulates framebuffers, main windows, etc.
|
||||
class RenderTarget : public Object {
|
||||
public:
|
||||
auto GetDefaultOwnerThread() const -> ThreadIdentifier override {
|
||||
return ThreadIdentifier::kMain;
|
||||
auto GetDefaultOwnerThread() const -> ThreadTag override {
|
||||
return ThreadTag::kMain;
|
||||
}
|
||||
enum class Type { kScreen, kFramebuffer };
|
||||
explicit RenderTarget(Type type);
|
||||
|
||||
@ -74,7 +74,7 @@ Logic::Logic()
|
||||
InitSpecialChars();
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kLogic);
|
||||
thread_ = new Thread(ThreadTag::kLogic);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
}
|
||||
auto Logic::OnAppStart() -> void {
|
||||
@ -1241,6 +1241,10 @@ void Logic::PushOnAppResumeCall() {
|
||||
});
|
||||
}
|
||||
|
||||
void Logic::PushApplyConfigCall() {
|
||||
thread()->PushCall([this] { ApplyConfig(); });
|
||||
}
|
||||
|
||||
// Look through everything in our config dict and act on it.
|
||||
void Logic::ApplyConfig() {
|
||||
assert(InLogicThread());
|
||||
@ -1400,10 +1404,6 @@ void Logic::ApplyConfig() {
|
||||
g_platform->ApplyConfig();
|
||||
}
|
||||
|
||||
void Logic::PushApplyConfigCall() {
|
||||
thread()->PushCall([this] { ApplyConfig(); });
|
||||
}
|
||||
|
||||
void Logic::PushRemoveGraphicsServerRenderHoldCall() {
|
||||
thread()->PushCall([] {
|
||||
// This call acts as a flush of sorts; when it goes through,
|
||||
|
||||
@ -13,7 +13,7 @@ NetworkWriter::NetworkWriter() {
|
||||
assert(g_network_writer == nullptr);
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kNetworkWrite);
|
||||
thread_ = new Thread(ThreadTag::kNetworkWrite);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ StdioConsole::StdioConsole() {
|
||||
assert(g_stdio_console == nullptr);
|
||||
|
||||
// Spin up our thread.
|
||||
thread_ = new Thread(ThreadIdentifier::kAssets);
|
||||
thread_ = new Thread(ThreadTag::kAssets);
|
||||
g_app->pausable_threads.push_back(thread_);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user