mooooore tidying

This commit is contained in:
Eric 2022-09-10 12:33:36 -07:00
parent 8c4a23f90c
commit 1cac234fc5
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
20 changed files with 111 additions and 132 deletions

View File

@ -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/__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", "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", "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/0f/0d/94aa62be2e76dcb835736c843b47", "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/91/e4/e85f3feee6640ce65027660e5590",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9f/00/962eaa0e2f394c4b25e230da0a26", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/50/db8d4e087b3fe272e9575b95996b",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f6/ad/8d342629f0c302ecc232b53f2357", "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e8/2f/1c8653ee8f0bad9cded74ebf5100",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/eb/d9/2defa7dc3c271a3bd83effc7a133", "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/86/b9fb1d80caf79d23b785327a0cc7",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/19/2d/29e867f238863c66ce9b2de56223", "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/0f/4e/67f2eea7fa848b12994d487893dc",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/6f/59/0a568faf3726bb40200d9d580762", "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b2/c4/d9555b8a060d11e6b1346cd82d12",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/98/5e/d4792f38ddfd1939148b12dac3e6", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/41/3aafb5bd7c6dddad37c89f304fb9",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2d/be/381047cad3bf61c09920f6e7e39e", "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cc/c1/a7cbdc71810ee752746eda33dd31",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/23/98/31f1209b0dab20d649a91efe6b33", "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/36/67/6a8b809011b4023533712d2df7b6",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/17/f9/9a50487bd39dbebe8236644446db", "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/11/8c/172381e8a477cc11ee0e24460901",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ce/15/1e812f031786c676b482cb83f3a4", "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/ab/05c53d0807929316235d6e7382cd",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/41/2b/647bcbdc19cb3d673ad1a05ab7e5", "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/18/c2/415efdababdd14553c3adbeaaf7b",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/96/1ee470994dd104269bcc422f3163", "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/3a/2d/863cc304f4856e34c81093b59db1",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f4/de/d89484b8903b14ebb56355e6021f", "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/33/fd/00a992c1d496ff85a99d381c6498",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/f4/3c95ba3ea5922813e2cef8af9019", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e4/58/ac07183ee59eedbb78dcf2f0e91f",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a7/1c/6003d3470a403c5107abffcbcf36", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cf/cb/91d2181102f6045e4d19cc73a18d",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d1/0a/6621e3505c513ba0b976ebc9d896", "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ce/f8/3e7a2452dae94b5cd857424e31fa",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ef/de/110b3f2961f088524a9913975f5a", "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/04/f8/46d2bcc4f5d5b7c7d9bcc7b91418",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ed/a5/e01a9d56f095b855f29cf7bf5ed3", "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/3b/10/9c15dbfbca54c1260b146de3029b",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/55/80/b022e845d983777a9244c0595a58", "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/26/90/d2f4b8212b12508ed222609c7a7d",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/b3/7ccccfd8721033582cabdfe11f73", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/b3/7ccccfd8721033582cabdfe11f73",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/d2/d18cbc017a7d64001f96718cc5ed", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/d2/d18cbc017a7d64001f96718cc5ed",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/9b/78cdb9eda7b30611774769859caa", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/9b/78cdb9eda7b30611774769859caa",
@ -4031,14 +4031,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/d2/5df66f66e26c1beb8a1e2b1f0613", "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/d2/5df66f66e26c1beb8a1e2b1f0613",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/57/593e8ceeee37a65972f1fb30d2cd", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/57/593e8ceeee37a65972f1fb30d2cd",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/fc/a2ac394899e6527f8def0cad4d8a", "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/fc/a2ac394899e6527f8def0cad4d8a",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/0e/b9/eb1339fc3c692095400631c081e3", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/20/4e/9afc0e73bb26d63032c3525d9373",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/07/30/90e690ff7358463d6a251e242138", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/f2/ab/eac71319d5184a3dd6b2ad74cf92",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/0e/c5/d5607da49974e3aeb55a000e3ea5", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ad/20/97feffa58fcbc8ac2ed2d9892326",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/f4/8b/99e574ea4ea13187fb401d7ae46f", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0a/d8/6e58979b57cf74c0d675508b207f",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c1/53/683aef250370cb33bc8779ba1f83", "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/79/c7/cb4590d0e233fa0455f9bd3158b0",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/f4/33/0338c8271f7c9d75f947528023b7", "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/2a/14/99b6932f7e20e988d67faa4327d9",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ad/7a/9adff320f5a0f68be025aabf36a0", "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/b0/77/b85ef1b5a280aa2426a613e76ec5",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/19/bd/bb787a4eb97ae97e7555de01ef49", "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b9/22/020a23ba4dba0b5871f78622bd67",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7", "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" "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
} }

View File

@ -1,4 +1,4 @@
### 1.7.7 (build 20800, api 7, 2022-09-10) ### 1.7.7 (build 20803, api 7, 2022-09-10)
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread. - 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. - Improved logging of missing playlist game types.
- Some ba.Lstr functionality can now be used in background threads. - Some ba.Lstr functionality can now be used in background threads.

View File

@ -38,7 +38,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary # Give a soft warning if we're being used with a different binary
# version than we expect. # version than we expect.
expected_build = 20800 expected_build = 20803
running_build: int = env['build_number'] running_build: int = env['build_number']
if running_build != expected_build: if running_build != expected_build:
print( print(

View File

@ -502,8 +502,8 @@ add_executable(ballisticacore
${BA_SRC_ROOT}/ballistica/media/media_server.h ${BA_SRC_ROOT}/ballistica/media/media_server.h
${BA_SRC_ROOT}/ballistica/networking/network_reader.cc ${BA_SRC_ROOT}/ballistica/networking/network_reader.cc
${BA_SRC_ROOT}/ballistica/networking/network_reader.h ${BA_SRC_ROOT}/ballistica/networking/network_reader.h
${BA_SRC_ROOT}/ballistica/networking/network_write_module.cc ${BA_SRC_ROOT}/ballistica/networking/network_writer.cc
${BA_SRC_ROOT}/ballistica/networking/network_write_module.h ${BA_SRC_ROOT}/ballistica/networking/network_writer.h
${BA_SRC_ROOT}/ballistica/networking/networking.cc ${BA_SRC_ROOT}/ballistica/networking/networking.cc
${BA_SRC_ROOT}/ballistica/networking/networking.h ${BA_SRC_ROOT}/ballistica/networking/networking.h
${BA_SRC_ROOT}/ballistica/networking/networking_sys.h ${BA_SRC_ROOT}/ballistica/networking/networking_sys.h

View File

@ -493,8 +493,8 @@
<ClInclude Include="..\..\src\ballistica\media\media_server.h" /> <ClInclude Include="..\..\src\ballistica\media\media_server.h" />
<ClCompile Include="..\..\src\ballistica\networking\network_reader.cc" /> <ClCompile Include="..\..\src\ballistica\networking\network_reader.cc" />
<ClInclude Include="..\..\src\ballistica\networking\network_reader.h" /> <ClInclude Include="..\..\src\ballistica\networking\network_reader.h" />
<ClCompile Include="..\..\src\ballistica\networking\network_write_module.cc" /> <ClCompile Include="..\..\src\ballistica\networking\network_writer.cc" />
<ClInclude Include="..\..\src\ballistica\networking\network_write_module.h" /> <ClInclude Include="..\..\src\ballistica\networking\network_writer.h" />
<ClCompile Include="..\..\src\ballistica\networking\networking.cc" /> <ClCompile Include="..\..\src\ballistica\networking\networking.cc" />
<ClInclude Include="..\..\src\ballistica\networking\networking.h" /> <ClInclude Include="..\..\src\ballistica\networking\networking.h" />
<ClInclude Include="..\..\src\ballistica\networking\networking_sys.h" /> <ClInclude Include="..\..\src\ballistica\networking\networking_sys.h" />

View File

@ -913,10 +913,10 @@
<ClInclude Include="..\..\src\ballistica\networking\network_reader.h"> <ClInclude Include="..\..\src\ballistica\networking\network_reader.h">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\networking\network_write_module.cc"> <ClCompile Include="..\..\src\ballistica\networking\network_writer.cc">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\networking\network_write_module.h"> <ClInclude Include="..\..\src\ballistica\networking\network_writer.h">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\networking\networking.cc"> <ClCompile Include="..\..\src\ballistica\networking\networking.cc">

View File

@ -488,8 +488,8 @@
<ClInclude Include="..\..\src\ballistica\media\media_server.h" /> <ClInclude Include="..\..\src\ballistica\media\media_server.h" />
<ClCompile Include="..\..\src\ballistica\networking\network_reader.cc" /> <ClCompile Include="..\..\src\ballistica\networking\network_reader.cc" />
<ClInclude Include="..\..\src\ballistica\networking\network_reader.h" /> <ClInclude Include="..\..\src\ballistica\networking\network_reader.h" />
<ClCompile Include="..\..\src\ballistica\networking\network_write_module.cc" /> <ClCompile Include="..\..\src\ballistica\networking\network_writer.cc" />
<ClInclude Include="..\..\src\ballistica\networking\network_write_module.h" /> <ClInclude Include="..\..\src\ballistica\networking\network_writer.h" />
<ClCompile Include="..\..\src\ballistica\networking\networking.cc" /> <ClCompile Include="..\..\src\ballistica\networking\networking.cc" />
<ClInclude Include="..\..\src\ballistica\networking\networking.h" /> <ClInclude Include="..\..\src\ballistica\networking\networking.h" />
<ClInclude Include="..\..\src\ballistica\networking\networking_sys.h" /> <ClInclude Include="..\..\src\ballistica\networking\networking_sys.h" />

View File

@ -913,10 +913,10 @@
<ClInclude Include="..\..\src\ballistica\networking\network_reader.h"> <ClInclude Include="..\..\src\ballistica\networking\network_reader.h">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\networking\network_write_module.cc"> <ClCompile Include="..\..\src\ballistica\networking\network_writer.cc">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\networking\network_write_module.h"> <ClInclude Include="..\..\src\ballistica\networking\network_writer.h">
<Filter>ballistica\networking</Filter> <Filter>ballistica\networking</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\networking\networking.cc"> <ClCompile Include="..\..\src\ballistica\networking\networking.cc">

View File

@ -13,8 +13,9 @@
#include "ballistica/game/v1_account.h" #include "ballistica/game/v1_account.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/media/media.h"
#include "ballistica/media/media_server.h" #include "ballistica/media/media_server.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/scene/scene.h" #include "ballistica/scene/scene.h"
@ -22,7 +23,7 @@
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20800; const int kAppBuildNumber = 20803;
const char* kAppVersion = "1.7.7"; const char* kAppVersion = "1.7.7";
// Our standalone globals. // Our standalone globals.
@ -48,7 +49,7 @@ Media* g_media{};
MediaServer* g_media_server{}; MediaServer* g_media_server{};
NetworkReader* g_network_reader{}; NetworkReader* g_network_reader{};
Networking* g_networking{}; Networking* g_networking{};
NetworkWriteModule* g_network_write_module{}; NetworkWriteModule* g_network_writer{};
Platform* g_platform{}; Platform* g_platform{};
Python* g_python{}; Python* g_python{};
StdInputModule* g_std_input_module{}; StdInputModule* g_std_input_module{};
@ -90,8 +91,8 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_app = new App(argc, argv); g_app = new App(argc, argv);
g_platform = Platform::Create(); g_platform = Platform::Create();
// If we're not running under a Python executable, we need to set up // Bootstrap our Python environment as early as we can (depends on
// our own Python environment. // g_platform for locating OS-specific paths).
assert(g_python == nullptr); assert(g_python == nullptr);
g_python = new Python(); g_python = new Python();
@ -103,8 +104,10 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_app_flavor = g_platform->CreateAppFlavor(); g_app_flavor = g_platform->CreateAppFlavor();
g_app_flavor->PostInit(); g_app_flavor->PostInit();
// Various other subsystems.
g_v1_account = new V1Account(); g_v1_account = new V1Account();
g_utils = new Utils(); g_utils = new Utils();
g_media = new Media();
Scene::Init(); Scene::Init();
// Spin up our other standard threads. // Spin up our other standard threads.
@ -279,8 +282,7 @@ auto InMediaThread() -> bool {
} }
auto InNetworkWriteThread() -> bool { auto InNetworkWriteThread() -> bool {
return (g_network_write_module return (g_network_writer && g_network_writer->thread()->IsCurrent());
&& g_network_write_module->thread()->IsCurrent());
} }
auto Log(const std::string& msg, bool to_stdout, bool to_server) -> void { auto Log(const std::string& msg, bool to_stdout, bool to_server) -> void {

View File

@ -122,7 +122,7 @@ extern Media* g_media;
extern MediaServer* g_media_server; extern MediaServer* g_media_server;
extern Networking* g_networking; extern Networking* g_networking;
extern NetworkReader* g_network_reader; extern NetworkReader* g_network_reader;
extern NetworkWriteModule* g_network_write_module; extern NetworkWriteModule* g_network_writer;
extern Platform* g_platform; extern Platform* g_platform;
extern Python* g_python; extern Python* g_python;
extern StdInputModule* g_std_input_module; extern StdInputModule* g_std_input_module;

View File

@ -9,7 +9,7 @@
#include "ballistica/game/player.h" #include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h" #include "ballistica/game/session/host_session.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"
@ -463,7 +463,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
PushClientDisconnectedCall(client_id); PushClientDisconnectedCall(client_id);
// Now send an ack so they know it's been taken care of. // Now send an ack so they know it's been taken care of.
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall(
{BA_PACKET_DISCONNECT_FROM_CLIENT_ACK, client_id}, addr); {BA_PACKET_DISCONNECT_FROM_CLIENT_ACK, client_id}, addr);
} }
break; break;
@ -490,7 +490,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
} }
// Now send an ack so they know it's been taken care of. // Now send an ack so they know it's been taken care of.
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall(
{BA_PACKET_DISCONNECT_FROM_HOST_ACK, client_id}, addr); {BA_PACKET_DISCONNECT_FROM_HOST_ACK, client_id}, addr);
} }
break; break;
@ -516,7 +516,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
return; return;
} else { } else {
// Send a disconnect request aimed at them. // Send a disconnect request aimed at them.
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall(
{BA_PACKET_DISCONNECT_FROM_HOST_REQUEST, client_id}, addr); {BA_PACKET_DISCONNECT_FROM_HOST_REQUEST, client_id}, addr);
} }
} }
@ -621,15 +621,15 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
// Newer version have a specific party-full message; send that first // Newer version have a specific party-full message; send that first
// but also follow up with a generic deny message for older clients. // but also follow up with a generic deny message for older clients.
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall(
{BA_PACKET_CLIENT_DENY_PARTY_FULL, request_id}, addr); {BA_PACKET_CLIENT_DENY_PARTY_FULL, request_id}, addr);
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall({BA_PACKET_CLIENT_DENY, request_id},
{BA_PACKET_CLIENT_DENY, request_id}, addr); addr);
} else if (connection_to_host_.exists()) { } else if (connection_to_host_.exists()) {
// If we're connected to someone else, we can't have clients. // If we're connected to someone else, we can't have clients.
g_network_write_module->PushSendToCall( g_network_writer->PushSendToCall(
{BA_PACKET_CLIENT_DENY_ALREADY_IN_PARTY, request_id}, addr); {BA_PACKET_CLIENT_DENY_ALREADY_IN_PARTY, request_id}, addr);
} else { } else {
// Otherwise go ahead and make them a new client connection. // Otherwise go ahead and make them a new client connection.
@ -666,7 +666,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
std::vector<uint8_t> msg_out(2); std::vector<uint8_t> msg_out(2);
msg_out[0] = BA_PACKET_CLIENT_DENY; msg_out[0] = BA_PACKET_CLIENT_DENY;
msg_out[1] = request_id; msg_out[1] = request_id;
g_network_write_module->PushSendToCall(msg_out, addr); g_network_writer->PushSendToCall(msg_out, addr);
Log("All client slots full; really?.."); Log("All client slots full; really?..");
break; break;
} }
@ -684,7 +684,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
msg_out[1] = msg_out[1] =
static_cast_check_fit<uint8_t>(connection_to_client->id()); static_cast_check_fit<uint8_t>(connection_to_client->id());
msg_out[2] = request_id; msg_out[2] = request_id;
g_network_write_module->PushSendToCall(msg_out, addr); g_network_writer->PushSendToCall(msg_out, addr);
} }
} }
break; break;

View File

@ -4,7 +4,7 @@
#include "ballistica/game/connection/connection_set.h" #include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/game.h" #include "ballistica/game/game.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
namespace ballistica { namespace ballistica {
@ -39,8 +39,8 @@ void ConnectionToClientUDP::SendGamePacketCompressed(
// Ship this off to the net-out thread to send; at this point we don't know // Ship this off to the net-out thread to send; at this point we don't know
// or case what happens to it. // or case what happens to it.
assert(g_network_write_module); assert(g_network_writer);
g_network_write_module->PushSendToCall(data_full, *addr_); g_network_writer->PushSendToCall(data_full, *addr_);
} }
void ConnectionToClientUDP::Update() { void ConnectionToClientUDP::Update() {
@ -89,7 +89,7 @@ void ConnectionToClientUDP::SendDisconnectRequest() {
std::vector<uint8_t> data(2); std::vector<uint8_t> data(2);
data[0] = BA_PACKET_DISCONNECT_FROM_HOST_REQUEST; data[0] = BA_PACKET_DISCONNECT_FROM_HOST_REQUEST;
data[1] = static_cast<uint8_t>(id()); data[1] = static_cast<uint8_t>(id());
g_network_write_module->PushSendToCall(data, *addr_); g_network_writer->PushSendToCall(data, *addr_);
} }
} // namespace ballistica } // namespace ballistica

View File

@ -5,7 +5,7 @@
#include "ballistica/game/connection/connection_set.h" #include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/game.h" #include "ballistica/game/game.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
namespace ballistica { namespace ballistica {
@ -71,7 +71,7 @@ void ConnectionToHostUDP::Update() {
memcpy(&(msg[1]), &p_version, 2); memcpy(&(msg[1]), &p_version, 2);
msg[3] = request_id_; msg[3] = request_id_;
memcpy(&(msg[4]), uuid.c_str(), uuid.size()); memcpy(&(msg[4]), uuid.c_str(), uuid.size());
g_network_write_module->PushSendToCall(msg, *addr_); g_network_writer->PushSendToCall(msg, *addr_);
} }
} }
@ -128,7 +128,7 @@ void ConnectionToHostUDP::SendDisconnectRequest() {
std::vector<uint8_t> data(2); std::vector<uint8_t> data(2);
data[0] = BA_PACKET_DISCONNECT_FROM_CLIENT_REQUEST; data[0] = BA_PACKET_DISCONNECT_FROM_CLIENT_REQUEST;
data[1] = static_cast_check_fit<uint8_t>(client_id_); data[1] = static_cast_check_fit<uint8_t>(client_id_);
g_network_write_module->PushSendToCall(data, *addr_); g_network_writer->PushSendToCall(data, *addr_);
} }
} }
@ -152,8 +152,8 @@ void ConnectionToHostUDP::SendGamePacketCompressed(
// Ship this off to the net-out thread to send; at this point we don't know // Ship this off to the net-out thread to send; at this point we don't know
// or care what happens to it. // or care what happens to it.
assert(g_network_write_module); assert(g_network_writer);
g_network_write_module->PushSendToCall(data_full, *addr_); g_network_writer->PushSendToCall(data_full, *addr_);
} }
void ConnectionToHostUDP::Error(const std::string& msg) { void ConnectionToHostUDP::Error(const std::string& msg) {

View File

@ -28,7 +28,7 @@
#include "ballistica/input/device/keyboard_input.h" #include "ballistica/input/device/keyboard_input.h"
#include "ballistica/input/device/touch_input.h" #include "ballistica/input/device/touch_input.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/networking/telnet_server.h" #include "ballistica/networking/telnet_server.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -79,7 +79,6 @@ Game::Game(Thread* thread)
assert(g_graphics == nullptr); assert(g_graphics == nullptr);
g_graphics = g_platform->CreateGraphics(); g_graphics = g_platform->CreateGraphics();
TextGraphics::Init(); TextGraphics::Init();
Media::Init();
Audio::Init(); Audio::Init();
if (!HeadlessMode()) { if (!HeadlessMode()) {
BGDynamics::Init(); BGDynamics::Init();

View File

@ -22,7 +22,7 @@
namespace ballistica { namespace ballistica {
// Debug printing. // Debug printing:
#define BA_SHOW_LOADS_UNLOADS 0 #define BA_SHOW_LOADS_UNLOADS 0
#define SHOW_PRUNING_INFO 0 #define SHOW_PRUNING_INFO 0
@ -38,12 +38,6 @@ namespace ballistica {
// How long we should spend loading media in each runPendingLoads() call. // How long we should spend loading media in each runPendingLoads() call.
#define PENDING_LOAD_PROCESS_TIME 5 #define PENDING_LOAD_PROCESS_TIME 5
void Media::Init() {
// Just create our singleton.
assert(g_media == nullptr);
g_media = new Media();
}
Media::Media() { Media::Media() {
media_paths_.emplace_back("ba_data"); media_paths_.emplace_back("ba_data");
for (bool& have_pending_load : have_pending_loads_) { for (bool& have_pending_load : have_pending_loads_) {
@ -289,8 +283,6 @@ void Media::LoadSystemMedia() {
system_media_loaded_ = true; system_media_loaded_ = true;
} }
Media::~Media() = default;
void Media::PrintLoadInfo() { void Media::PrintLoadInfo() {
std::string s; std::string s;
char buffer[256]; char buffer[256];
@ -615,8 +607,19 @@ void Media::MarkComponentForLoad(MediaComponentData* c) {
// ClearPendingLoadsDoneList) // ClearPendingLoadsDoneList)
auto media_ptr = new Object::Ref<MediaComponentData>(c); auto media_ptr = new Object::Ref<MediaComponentData>(c);
g_media_server->thread()->PushRunnable(
Object::NewDeferred<PreloadRunnable>(media_ptr)); g_media_server->thread()->PushCall([media_ptr] {
assert(InMediaThread());
// add our pointer to one of the preload lists and shake our preload thread
// to wake it up
if ((**media_ptr).GetMediaType() == MediaType::kSound) {
g_media_server->pending_preloads_audio_.push_back(media_ptr);
} else {
g_media_server->pending_preloads_.push_back(media_ptr);
}
g_media_server->process_timer_->SetLength(0);
});
} }
#pragma clang diagnostic push #pragma clang diagnostic push
@ -1216,19 +1219,6 @@ void Media::ClearPendingLoadsDoneList() {
pending_loads_done_.clear(); pending_loads_done_.clear();
} }
void Media::PreloadRunnable::Run() {
assert(InMediaThread());
// add our pointer to one of the preload lists and shake our preload thread to
// wake it up
if ((**c).GetMediaType() == MediaType::kSound) {
g_media_server->pending_preloads_audio_.push_back(c);
} else {
g_media_server->pending_preloads_.push_back(c);
}
g_media_server->process_timer_->SetLength(0);
}
void Media::AddPackage(const std::string& name, const std::string& path) { void Media::AddPackage(const std::string& name, const std::string& path) {
// we don't protect package-path access so make sure its always from here.. // we don't protect package-path access so make sure its always from here..
assert(InLogicThread()); assert(InLogicThread());

View File

@ -8,17 +8,14 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "ballistica/core/context.h"
#include "ballistica/core/object.h" #include "ballistica/core/object.h"
#include "ballistica/generic/runnable.h"
namespace ballistica { namespace ballistica {
/// Global media wrangling class. /// Global media wrangling class.
class Media { class Media {
public: public:
static void Init(); Media();
~Media();
/// Handy function to try to return a bit of media from a std::unordered_map /// Handy function to try to return a bit of media from a std::unordered_map
/// of weak-refs, loading/adding it if need be. /// of weak-refs, loading/adding it if need be.
@ -43,8 +40,8 @@ class Media {
} }
} }
void AddPackage(const std::string& name, const std::string& path); auto AddPackage(const std::string& name, const std::string& path) -> void;
void Prune(int level = 0); auto Prune(int level = 0) -> void;
/// Finish loading any media that has been preloaded but still needs to be /// Finish loading any media that has been preloaded but still needs to be
/// loaded by the proper thread. /// loaded by the proper thread.
@ -55,26 +52,25 @@ class Media {
/// Return true if graphics loads remain to be done. /// Return true if graphics loads remain to be done.
auto RunPendingGraphicsLoads() -> bool; auto RunPendingGraphicsLoads() -> bool;
void ClearPendingLoadsDoneList(); auto ClearPendingLoadsDoneList() -> void;
template <class T> template <class T>
auto RunPendingLoadList(std::vector<Object::Ref<T>*>* cList) -> bool; auto RunPendingLoadList(std::vector<Object::Ref<T>*>* cList) -> bool;
/// This function takes a newly allocated pointer which /// This function takes a newly allocated pointer which
/// is deleted once the load is completed. /// is deleted once the load is completed.
void AddPendingLoad(Object::Ref<MediaComponentData>* c); auto AddPendingLoad(Object::Ref<MediaComponentData>* c) -> void;
struct PreloadRunnable;
enum class FileType { kModel, kCollisionModel, kTexture, kSound, kData }; enum class FileType { kModel, kCollisionModel, kTexture, kSound, kData };
auto FindMediaFile(FileType fileType, const std::string& file_in) auto FindMediaFile(FileType fileType, const std::string& file_in)
-> std::string; -> std::string;
/// Unload renderer-specific bits only (gl display lists, etc) - used when /// Unload renderer-specific bits only (gl display lists, etc) - used when
/// recreating/adjusting the renderer. /// recreating/adjusting the renderer.
void UnloadRendererBits(bool textures, bool models); auto UnloadRendererBits(bool textures, bool models) -> void;
/// Should be called from the game thread after UnloadRendererBits(); /// Should be called from the game thread after UnloadRendererBits();
/// kicks off bg loads for all existing unloaded media. /// kicks off bg loads for all existing unloaded media.
void MarkAllMediaForLoad(); auto MarkAllMediaForLoad() -> void;
void PrintLoadInfo(); auto PrintLoadInfo() -> void;
auto GetModelPendingLoadCount() -> int; auto GetModelPendingLoadCount() -> int;
auto GetTexturePendingLoadCount() -> int; auto GetTexturePendingLoadCount() -> int;
@ -135,7 +131,7 @@ class Media {
} }
/// Load up hard-coded media for interface, etc. /// Load up hard-coded media for interface, etc.
void LoadSystemMedia(); auto LoadSystemMedia() -> void;
auto total_model_count() const -> uint32_t { auto total_model_count() const -> uint32_t {
return static_cast<uint32_t>(models_.size()); return static_cast<uint32_t>(models_.size());
@ -150,20 +146,15 @@ class Media {
auto total_collide_model_count() const -> uint32_t { auto total_collide_model_count() const -> uint32_t {
return static_cast<uint32_t>(collide_models_.size()); return static_cast<uint32_t>(collide_models_.size());
} }
struct PreloadRunnable : public Runnable {
explicit PreloadRunnable(Object::Ref<MediaComponentData>* c_in) : c(c_in) {}
void Run() override;
Object::Ref<MediaComponentData>* c;
};
private: private:
Media(); static auto MarkComponentForLoad(MediaComponentData* c) -> void;
static void MarkComponentForLoad(MediaComponentData* c); auto LoadSystemTexture(SystemTextureID id, const char* name) -> void;
void LoadSystemTexture(SystemTextureID id, const char* name); auto LoadSystemCubeMapTexture(SystemCubeMapTextureID id, const char* name)
void LoadSystemCubeMapTexture(SystemCubeMapTextureID id, const char* name); -> void;
void LoadSystemSound(SystemSoundID id, const char* name); auto LoadSystemSound(SystemSoundID id, const char* name) -> void;
void LoadSystemData(SystemDataID id, const char* name); auto LoadSystemData(SystemDataID id, const char* name) -> void;
void LoadSystemModel(SystemModelID id, const char* name); auto LoadSystemModel(SystemModelID id, const char* name) -> void;
template <class T> template <class T>
auto GetComponentPendingLoadCount( auto GetComponentPendingLoadCount(

View File

@ -8,7 +8,7 @@
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/input/remote_app.h" #include "ballistica/input/remote_app.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -158,7 +158,7 @@ static auto HandleGameQuery(const char* buffer, size_t size,
std::vector<uint8_t> msg_buffer(msg_len); std::vector<uint8_t> msg_buffer(msg_len);
memcpy(msg_buffer.data(), msg, msg_len); memcpy(msg_buffer.data(), msg, msg_len);
g_network_write_module->PushSendToCall(msg_buffer, SockAddr(*from)); g_network_writer->PushSendToCall(msg_buffer, SockAddr(*from));
} else { } else {
Log("Error: Got invalid game-query packet of len " + std::to_string(size) Log("Error: Got invalid game-query packet of len " + std::to_string(size)
@ -505,6 +505,4 @@ auto NetworkReader::OpenSockets() -> void {
} }
} }
NetworkReader::~NetworkReader() = default;
} // namespace ballistica } // namespace ballistica

View File

@ -13,8 +13,8 @@
namespace ballistica { namespace ballistica {
// This is a special thread that manages the game's main network sockets; // A subsystem that manages the game's main network sockets.
// it handles creating/destroying them as well as listening for incoming // It handles creating/destroying them as well as listening for incoming
// packets. it is not a normal BA thread so doesn't have the ability to receive // packets. it is not a normal BA thread so doesn't have the ability to receive
// messages (it generally sits blocked in a select() call). Writing to these // messages (it generally sits blocked in a select() call). Writing to these
// sockets takes place in other threads; just make sure to lock the mutex and // sockets takes place in other threads; just make sure to lock the mutex and
@ -22,7 +22,6 @@ namespace ballistica {
class NetworkReader { class NetworkReader {
public: public:
explicit NetworkReader(int port); explicit NetworkReader(int port);
~NetworkReader();
auto Pause() -> void; auto Pause() -> void;
auto Resume() -> void; auto Resume() -> void;
auto port4() const { return port4_; } auto port4() const { return port4_; }

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/networking/network_write_module.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
@ -10,8 +10,8 @@ namespace ballistica {
NetworkWriteModule::NetworkWriteModule(Thread* thread) : thread_(thread) { NetworkWriteModule::NetworkWriteModule(Thread* thread) : thread_(thread) {
// we're a singleton // we're a singleton
assert(g_network_write_module == nullptr); assert(g_network_writer == nullptr);
g_network_write_module = this; g_network_writer = this;
} }
void NetworkWriteModule::PushSendToCall(const std::vector<uint8_t>& msg, void NetworkWriteModule::PushSendToCall(const std::vector<uint8_t>& msg,

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_NETWORKING_NETWORK_WRITE_MODULE_H_ #ifndef BALLISTICA_NETWORKING_NETWORK_WRITER_H_
#define BALLISTICA_NETWORKING_NETWORK_WRITE_MODULE_H_ #define BALLISTICA_NETWORKING_NETWORK_WRITER_H_
#include <vector> #include <vector>
@ -9,7 +9,7 @@
namespace ballistica { namespace ballistica {
// this thread handles network output and whatnot // A subsystem handling outbound network traffic.
class NetworkWriteModule { class NetworkWriteModule {
public: public:
void PushSendToCall(const std::vector<uint8_t>& msg, const SockAddr& addr); void PushSendToCall(const std::vector<uint8_t>& msg, const SockAddr& addr);
@ -22,4 +22,4 @@ class NetworkWriteModule {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_NETWORKING_NETWORK_WRITE_MODULE_H_ #endif // BALLISTICA_NETWORKING_NETWORK_WRITER_H_