wired up empty-app-mode to be more functional

This commit is contained in:
Eric 2023-06-19 14:34:55 -07:00
parent c58f93e9c4
commit 03bef6050b
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
26 changed files with 238 additions and 144 deletions

56
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/7f/b0/d7426f678c1fee642855e391f1b9",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/21/26/7a4f7252ef70fdb86c734acacc42",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/53/0b/df2f7aaaf3cf4d9578c2bc5d4ad9",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a0/93/97d65f33fbdb4290fcd2504ea7dc",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fb/63/db9b48b5866ed27bda8d04cae2ad",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d9/2c/d9ae9941824a784320da1d0e5924",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cb/95/f5baa206619fbb82091727394cd4",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/cb/59/2182ab4f9e586198f19b6ef40721",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/d8/8f/45fc7a9b303abf7236d92e75426f",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/b1/1aa0bc8bc5e967423dcbb7c2a09b",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/11/e1/ab5afe174e47070e8c80d3ff4a1d",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a1/fe/00ed542d105de6d3bf3e13661f84",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f6/6f/b3856ec3abd226e151739d2b4934",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/6c/37126b3889cce46b84ecd0e6f51b",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1e/21/60608e5de9cd5cc78f49745eff30",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0d/0d/614782a81abb93f61dbc0f2baa72",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f1/10/968f7b0aa4ca47a540c6b9433559",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/dd/e3/0d5f59619889591ed394a63dd5b8",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/64/0d/1d74089ac614697b7bd845b90491",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/0d/15/0bad144e460a0f2e70776ed6efdf",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/75/e0/f9fb47e7a46ac227dc7d24f17a9b",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/8d/85/61148b796a8b7cd6782b9923889a",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/9e/7d/f4ae27371d6f34b23de7ffdd4bc5",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/20/89/46c89da9adf1e1ec6928b8a68c1b",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/d9/a3/4cbb63acae25be6b7491f0f25cea",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/51/9e/ee206a64930f99d3ea524489fbec",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4f/23/d629858f1883e04f2dcade7beddb",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a9/44/470572d4e8feca17ae3b11138e83",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7a/66/601d3687a215a1cdfa9295783039",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c9/96/90513f943a203befb42d6cb5d6ea",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/dc/ab/128bcd29709e63413bba49433294",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/25/0b/8d6e24a7765a39917dbd3dcaa2c4",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fc/6c/20e1c02863da7156392b97d65cbb",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8a/1b/8717e8d7e6a687d49a9a97432bba",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cd/96/996309bf44df4bd8260d6ca6b38a",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4a/a0/7b8b1fa55933cf842e3f26330ebd",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fe/99/cbfe50067337a90266bbc7041ef5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/eb/85/377c47f51a123d46a41d161f42f7",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ac/2e/6ef743fe72e01d45d5440af9a529",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/61/60/29ab0e2137b45322a1af2aa87e49",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/fe/4b/436bfaa5f5d43eb0d4ca0c58eccc",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/7e/0e/aef70e16a90c9669e8586dd8b13f",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f5/72/b1a3d1858a74d844642483845325",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/82/23/3da9e812f6d9d83e9c4678645792",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235",
@ -4108,14 +4108,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/65/49/cdbaca8ea343d79992618514438c",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/8e/37/b82ca02d65ee86100b7a23ad3129",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/f5/c8/b094cb9809c616a8394b8a4072ec",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/18/b5/3b8d3c278e56cb4522de22424387",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ba/bb/6f496b8e0021722857db52c75de0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/e8/7b/8b1e320760841fa3d173b1cead88",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/33/6a/b5c4ae400d21448e783f202c31d3",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/7c/5a/8389337316014fb973526a3f04a8",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/e8/cc/7279ec93c3d7da736c8439c2dc70",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/73/9f/50466e17d044b4cd6da6e0dd610f",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/46/63/085d9d8496290a996721b0185a1e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/37/bd/0df0e27deb695a1a6af2841ab18e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/67/90/92c58874800469b14cdb8514b423",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/97/73/a5aef2dba917b34b6b2bc82733e9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/df/d2/6950b10723420d9e2f1c512a0e07",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/a6/5a/b123237539e57c9e68f5b36a22bd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/3b/81/cbf61791b0fab0ec541b4a7df703",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/48/4b/e6974f0a4d14be8213dc00d971c3",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/3e/7a/203e2a5d2b5bb42cfe3fd2fe16c2",

View File

@ -660,6 +660,7 @@
<w>darwiinremote</w>
<w>datab</w>
<w>databytes</w>
<w>datac</w>
<w>dataclassio</w>
<w>dataclassutils</w>
<w>datamodule</w>
@ -836,6 +837,7 @@
<w>editcontroller</w>
<w>editgame</w>
<w>editorconfig</w>
<w>efca</w>
<w>effmult</w>
<w>efgrd</w>
<w>efile</w>
@ -861,6 +863,7 @@
<w>emitfx</w>
<w>emoji</w>
<w>emojis</w>
<w>emptyappmode</w>
<w>enablexinput</w>
<w>ename</w>
<w>encerr</w>
@ -971,6 +974,7 @@
<w>fcontents</w>
<w>fcount</w>
<w>fdata</w>
<w>fdataraw</w>
<w>fdcount</w>
<w>fdesc</w>
<w>fdict</w>
@ -1721,6 +1725,9 @@
<w>meryu</w>
<w>mesh</w>
<w>messagetype</w>
<w>metabytes</w>
<w>metajson</w>
<w>metalen</w>
<w>metallink</w>
<w>metamakefile</w>
<w>metaprogramming</w>
@ -1897,6 +1904,7 @@
<w>nodename</w>
<w>nodepos</w>
<w>nodpi</w>
<w>noexec</w>
<w>nofiles</w>
<w>noinspect</w>
<w>nondeterministic</w>

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21128, api 8, 2023-06-19)
### 1.7.20 (build 21129, api 8, 2023-06-19)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be

View File

@ -396,6 +396,7 @@
<w>cvar</w>
<w>data</w>
<w>databytes</w>
<w>datac</w>
<w>dataclassio</w>
<w>datadata</w>
<w>dataout</w>
@ -506,6 +507,7 @@
<w>echofile</w>
<w>echotime</w>
<w>edef</w>
<w>efca</w>
<w>effmult</w>
<w>efro</w>
<w>efrocaching</w>
@ -519,6 +521,7 @@
<w>embconnect</w>
<w>emitfx</w>
<w>emojis</w>
<w>emptyappmode</w>
<w>enablexinput</w>
<w>endblock</w>
<w>endcall</w>
@ -581,6 +584,7 @@
<w>fcntl</w>
<w>fcodefin</w>
<w>fdata</w>
<w>fdataraw</w>
<w>fdcount</w>
<w>fdirs</w>
<w>fdirx</w>
@ -996,6 +1000,9 @@
<w>meshdata</w>
<w>messagebox</w>
<w>messagetype</w>
<w>metabytes</w>
<w>metajson</w>
<w>metalen</w>
<w>metallink</w>
<w>metamakefile</w>
<w>meth</w>
@ -1098,6 +1105,7 @@
<w>noassets</w>
<w>nodename</w>
<w>nodetype</w>
<w>noexec</w>
<w>nofilename</w>
<w>noglobs</w>
<w>nointhash</w>
@ -1851,6 +1859,7 @@
<w>xmax</w>
<w>xmin</w>
<w>xmmintrin</w>
<w>xoffs</w>
<w>xoffset</w>
<w>xors</w>
<w>xtweak</w>

View File

@ -68,34 +68,36 @@ def should_submit_debug_info() -> bool:
def handle_v1_cloud_log() -> None:
"""Called on debug log prints.
"""Called when new messages have been added to v1-cloud-log.
When this happens, we can upload our log to the server
after a short bit if desired.
When this happens, we can upload our log to the server after a short
bit if desired.
"""
app = _babase.app
classic = app.classic
plus = app.plus
if app.classic is None or app.plus is None:
if classic is None or plus is None:
if _babase.do_once():
logging.warning(
'handle_v1_cloud_log should not be called'
'handle_v1_cloud_log should not be getting called'
' without classic and plus present.'
)
return
app.classic.log_have_new = True
if not app.classic.log_upload_timer_started:
classic.log_have_new = True
if not classic.log_upload_timer_started:
def _put_log() -> None:
assert app.plus is not None
assert app.classic is not None
assert plus is not None
assert classic is not None
try:
sessionname = str(app.classic.get_foreground_host_session())
sessionname = str(classic.get_foreground_host_session())
except Exception:
sessionname = 'unavailable'
try:
activityname = str(app.classic.get_foreground_host_activity())
activityname = str(classic.get_foreground_host_activity())
except Exception:
activityname = 'unavailable'
@ -103,28 +105,28 @@ def handle_v1_cloud_log() -> None:
'log': _babase.get_v1_cloud_log(),
'version': app.version,
'build': app.build_number,
'userAgentString': app.classic.legacy_user_agent_string,
'userAgentString': classic.legacy_user_agent_string,
'session': sessionname,
'activity': activityname,
'fatal': 0,
'userRanCommands': _babase.has_user_run_commands(),
'time': _babase.apptime(),
'userModded': _babase.workspaces_in_use(),
'newsShow': app.plus.get_news_show(),
'newsShow': plus.get_news_show(),
}
def response(data: Any) -> None:
assert app.classic is not None
assert classic is not None
# A non-None response means success; lets
# take note that we don't need to report further
# log info this run
if data is not None:
app.classic.log_have_new = False
classic.log_have_new = False
_babase.mark_log_sent()
app.classic.master_server_v1_post('bsLog', info, response)
classic.master_server_v1_post('bsLog', info, response)
app.classic.log_upload_timer_started = True
classic.log_upload_timer_started = True
# Delay our log upload slightly in case other
# pertinent info gets printed between now and then.
@ -133,9 +135,9 @@ def handle_v1_cloud_log() -> None:
# After a while, allow another log-put.
def _reset() -> None:
assert app.classic is not None
app.classic.log_upload_timer_started = False
if app.classic.log_have_new:
assert classic is not None
classic.log_upload_timer_started = False
if classic.log_have_new:
handle_v1_cloud_log()
if not _babase.is_log_full():

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21128
TARGET_BALLISTICA_BUILD = 21129
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -2,6 +2,11 @@
#include "ballistica/base/app/app_mode_empty.h"
#include "ballistica/base/graphics/component/simple_component.h"
#include "ballistica/base/graphics/graphics.h"
#include "ballistica/base/graphics/support/frame_def.h"
#include "ballistica/base/graphics/text/text_group.h"
namespace ballistica::base {
static AppModeEmpty* g_app_mode_empty{};
@ -18,7 +23,49 @@ auto AppModeEmpty::GetSingleton() -> AppModeEmpty* {
}
void AppModeEmpty::Reset() {
// Nothing here currently.
// When we are first created (for use as a placeholder before any app-modes
// are set) we just draw nothing. However once we actually get reset for use
// as a an explicit app mode, we do our hello thing.
hello_mode_ = true;
// Fade in if we currently aren't.
g_base->graphics->FadeScreen(true, 250, nullptr);
}
void AppModeEmpty::DrawWorld(base::FrameDef* frame_def) {
if (!hello_mode_) {
return;
}
// Just draw our spinning hello text.
if (!hello_text_group_.Exists()) {
hello_text_group_ = Object::New<TextGroup>();
hello_text_group_->set_text("Potato!");
}
auto& grp(*hello_text_group_);
auto* pass = frame_def->overlay_pass();
SimpleComponent c(pass);
c.SetTransparent(true);
c.SetColor(0.7f, 0.0f, 1.0f, 1.0f);
c.PushTransform();
auto xoffs =
sinf(static_cast<float>(frame_def->display_time_millisecs()) / 600.0f);
auto yoffs =
cosf(static_cast<float>(frame_def->display_time_millisecs()) / 600.0f);
c.Translate(pass->virtual_width() * 0.5f - 70.0f + xoffs * 200.0f,
pass->virtual_height() * 0.5f - 20.0f + yoffs * 200.0f);
c.Scale(2.0, 2.0);
int text_elem_count = grp.GetElementCount();
for (int e = 0; e < text_elem_count; e++) {
c.SetTexture(grp.GetElementTexture(e));
c.SetFlatness(1.0f);
c.DrawMesh(grp.GetElementMesh(e));
}
c.PopTransform();
c.Submit();
}
} // namespace ballistica::base

View File

@ -6,6 +6,7 @@
#include <vector>
#include "ballistica/base/app/app_mode.h"
#include "ballistica/shared/foundation/object.h"
namespace ballistica::base {
@ -15,6 +16,11 @@ class AppModeEmpty : public AppMode {
static auto GetSingleton() -> AppModeEmpty*;
void Reset();
void DrawWorld(base::FrameDef* frame_def) override;
private:
Object::Ref<TextGroup> hello_text_group_;
bool hello_mode_{};
};
} // namespace ballistica::base

View File

@ -483,42 +483,59 @@ void BaseFeatureSet::ScreenMessage(const std::string& s,
[this, s, color] { graphics->AddScreenMessage(s, color); });
}
void BaseFeatureSet::V1CloudLog(const std::string& msg) {
// If we've got a fully running app environment, let the Python layer
// handle this. It will group log messages intelligently and ship them
// to the master server with various other context info included.
void BaseFeatureSet::DoV1CloudLog(const std::string& msg) {
// We may attempt to import stuff and that should *never* happen before
// base is fully imported.
if (!IsBaseCompletelyImported()) {
printf(
"WARNING: V1CloudLog called before babase import complete; will be "
"ignored.\n");
"WARNING: V1CloudLog called before babase fully imported; ignoring.\n");
return;
}
// PushCall functionality requires the app to be running.
if (app_running_) {
python->objs().PushCall(BasePython::ObjID::kHandleV1CloudLogCall);
} else {
if (HavePlus()) {
// For log messages before that time we ship them immediately since
// we don't know if the Python layer is (or will be) able to.
// NOTE: Currently short-circuiting this for basn to avoid
// shipping early logs that have no errors/warnings. Should clean
// this up.
if (g_early_v1_cloud_log_writes > 0 && !basn_log_behavior_) {
g_early_v1_cloud_log_writes -= 1;
std::string logprefix = "EARLY-LOG:";
std::string logsuffix;
// If we're an early enough error, our global log isn't even available,
// so include this specific message as a suffix instead.
if (g_core == nullptr) {
logsuffix = msg;
}
plus()->DirectSendV1CloudLogs(logprefix, logsuffix, false, nullptr);
}
}
// Even though this part lives here in 'base', this is considered 'classic'
// functionality, so silently no-op if classic isn't present.
if (!HaveClassic()) {
return;
}
// Let the Python layer handle this if possible. PushCall functionality
// requires the app to be running, and the call itself requires plus.
if (app_running_ && HavePlus()) {
python->objs().PushCall(BasePython::ObjID::kHandleV1CloudLogCall);
return;
}
// Ok; Python path not available. We might be able to do a direct send.
// Hack: Currently disabling direct sends for basn to avoid shipping early
// logs not containing errors or warnings. Need to clean this system up;
// this shouldn't be necessary.
if (basn_log_behavior_) {
return;
}
// Need plus for direct sends.
if (!HavePlus()) {
printf("WARNING: V1CloudLog direct-sends not available; ignoring.\n");
return;
}
// Only attempt direct sends a few times.
if (g_early_v1_cloud_log_writes <= 0) {
return;
}
// Ok; going ahead with the direct send.
g_early_v1_cloud_log_writes -= 1;
std::string logprefix = "EARLY-LOG:";
std::string logsuffix;
// If we're an early enough error, our global log isn't even available,
// so include this whole message as a suffix instead.
if (g_core == nullptr) {
logsuffix = msg;
}
plus()->DirectSendV1CloudLogs(logprefix, logsuffix, false, nullptr);
}
void BaseFeatureSet::PushConsolePrintCall(const std::string& msg) {

View File

@ -676,7 +676,7 @@ class BaseFeatureSet : public FeatureSetNativeComponent,
auto CreateFeatureSetData(FeatureSetNativeComponent* featureset)
-> PyObject* override;
auto FeatureSetFromData(PyObject* obj) -> FeatureSetNativeComponent* override;
void V1CloudLog(const std::string& msg) override;
void DoV1CloudLog(const std::string& msg) override;
void PushConsolePrintCall(const std::string& msg) override;
auto GetPyExceptionType(PyExcType exctype) -> PyObject* override;
auto PrintPythonStackTrace() -> bool override;

View File

@ -1081,7 +1081,7 @@ void Graphics::UpdateGyro(millisecs_t real_time, millisecs_t elapsed) {
}
void Graphics::ApplyCamera(FrameDef* frame_def) {
camera_->Update(frame_def->base_time_elapsed());
camera_->Update(frame_def->display_time_elapsed_millisecs());
camera_->UpdatePosition();
camera_->ApplyToFrameDef(frame_def);
}
@ -1133,9 +1133,9 @@ void Graphics::BuildAndPushFrameDef() {
FrameDef* frame_def = GetEmptyFrameDef();
frame_def->set_app_time_millisecs(app_time_millisecs);
frame_def->set_base_time(
frame_def->set_display_time_millisecs(
static_cast<millisecs_t>(g_base->logic->display_time() * 1000.0));
frame_def->set_base_time_elapsed(elapsed);
frame_def->set_display_time_elapsed_millisecs(elapsed);
frame_def->set_frame_number(frame_def_count_++);
if (!internal_components_inited_) {
@ -1158,9 +1158,7 @@ void Graphics::BuildAndPushFrameDef() {
} else {
// Ok, we're drawing a real frame.
bool session_fills_screen = g_base->app_mode()->DoesWorldFillScreen();
frame_def->set_needs_clear(!session_fills_screen);
frame_def->set_needs_clear(!g_base->app_mode()->DoesWorldFillScreen());
DrawWorld(frame_def);
DrawUI(frame_def);
@ -1393,8 +1391,10 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) {
cam_pt =
Vector3f(frame_def->cam_original().x, frame_def->cam_original().y,
frame_def->cam_original().z);
// in vr follow-mode the cam point gets tweaked.. (fixme should probably
// just do this on the camera end)
// In vr follow-mode the cam point gets tweaked.
//
// FIXME: should probably just do this on the camera end.
if (frame_def->camera_mode() == CameraMode::kOrbit) {
// fudge this one up a bit; looks better that way..
cam_target_pt = Vector3f(frame_def->cam_target_original().x,
@ -1425,9 +1425,9 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) {
c.DrawMeshAsset(g_base->assets->SysMesh(SysMeshID::kVRFade));
c.PopTransform();
c.Submit();
#else // BA_VR_BUILD
#else // BA_VR_BUILD
throw Exception();
#endif // BA_VR_BUILD
#endif
} else {
SimpleComponent c(overlay_pass);
c.SetTransparent(a < 1.0f);
@ -1493,45 +1493,43 @@ void Graphics::DrawCursor(RenderPass* pass, millisecs_t real_time) {
}
void Graphics::DrawBlotches(FrameDef* frame_def) {
if (!this->blotch_verts_.empty()) {
if (!this->shadow_blotch_mesh_.Exists())
this->shadow_blotch_mesh_ = Object::New<SpriteMesh>();
this->shadow_blotch_mesh_->SetIndexData(Object::New<MeshIndexBuffer16>(
this->blotch_indices_.size(), &this->blotch_indices_[0]));
this->shadow_blotch_mesh_->SetData(Object::New<MeshBuffer<VertexSprite>>(
this->blotch_verts_.size(), &this->blotch_verts_[0]));
if (!blotch_verts_.empty()) {
if (!shadow_blotch_mesh_.Exists()) {
shadow_blotch_mesh_ = Object::New<SpriteMesh>();
}
shadow_blotch_mesh_->SetIndexData(Object::New<MeshIndexBuffer16>(
blotch_indices_.size(), &blotch_indices_[0]));
shadow_blotch_mesh_->SetData(Object::New<MeshBuffer<VertexSprite>>(
blotch_verts_.size(), &blotch_verts_[0]));
SpriteComponent c(frame_def->light_shadow_pass());
c.SetTexture(g_base->assets->SysTexture(SysTextureID::kLight));
c.DrawMesh(this->shadow_blotch_mesh_.Get());
c.DrawMesh(shadow_blotch_mesh_.Get());
c.Submit();
}
if (!this->blotch_soft_verts_.empty()) {
if (!this->shadow_blotch_soft_mesh_.Exists())
this->shadow_blotch_soft_mesh_ = Object::New<SpriteMesh>();
this->shadow_blotch_soft_mesh_->SetIndexData(Object::New<MeshIndexBuffer16>(
this->blotch_soft_indices_.size(), &this->blotch_soft_indices_[0]));
this->shadow_blotch_soft_mesh_->SetData(
Object::New<MeshBuffer<VertexSprite>>(this->blotch_soft_verts_.size(),
&this->blotch_soft_verts_[0]));
if (!blotch_soft_verts_.empty()) {
if (!shadow_blotch_soft_mesh_.Exists()) {
shadow_blotch_soft_mesh_ = Object::New<SpriteMesh>();
}
shadow_blotch_soft_mesh_->SetIndexData(Object::New<MeshIndexBuffer16>(
blotch_soft_indices_.size(), &blotch_soft_indices_[0]));
shadow_blotch_soft_mesh_->SetData(Object::New<MeshBuffer<VertexSprite>>(
blotch_soft_verts_.size(), &blotch_soft_verts_[0]));
SpriteComponent c(frame_def->light_shadow_pass());
c.SetTexture(g_base->assets->SysTexture(SysTextureID::kLightSoft));
c.DrawMesh(this->shadow_blotch_soft_mesh_.Get());
c.DrawMesh(shadow_blotch_soft_mesh_.Get());
c.Submit();
}
if (!this->blotch_soft_obj_verts_.empty()) {
if (!this->shadow_blotch_soft_obj_mesh_.Exists()) {
this->shadow_blotch_soft_obj_mesh_ = Object::New<SpriteMesh>();
if (!blotch_soft_obj_verts_.empty()) {
if (!shadow_blotch_soft_obj_mesh_.Exists()) {
shadow_blotch_soft_obj_mesh_ = Object::New<SpriteMesh>();
}
this->shadow_blotch_soft_obj_mesh_->SetIndexData(
Object::New<MeshIndexBuffer16>(this->blotch_soft_obj_indices_.size(),
&this->blotch_soft_obj_indices_[0]));
this->shadow_blotch_soft_obj_mesh_->SetData(
Object::New<MeshBuffer<VertexSprite>>(
this->blotch_soft_obj_verts_.size(),
&this->blotch_soft_obj_verts_[0]));
shadow_blotch_soft_obj_mesh_->SetIndexData(Object::New<MeshIndexBuffer16>(
blotch_soft_obj_indices_.size(), &blotch_soft_obj_indices_[0]));
shadow_blotch_soft_obj_mesh_->SetData(Object::New<MeshBuffer<VertexSprite>>(
blotch_soft_obj_verts_.size(), &blotch_soft_obj_verts_[0]));
SpriteComponent c(frame_def->light_pass());
c.SetTexture(g_base->assets->SysTexture(SysTextureID::kLightSoft));
c.DrawMesh(this->shadow_blotch_soft_obj_mesh_.Get());
c.DrawMesh(shadow_blotch_soft_obj_mesh_.Get());
c.Submit();
}
}

View File

@ -50,8 +50,8 @@ auto FrameDef::GetOverlayFlatPass() -> RenderPass* {
void FrameDef::Reset() {
assert(g_base->InLogicThread());
app_time_millisecs_ = 0;
base_time_ = 0;
base_time_elapsed_ = 0;
display_time_millisecs_ = 0;
display_time_elapsed_millisecs_ = 0;
frame_number_ = 0;
#if BA_DEBUG_BUILD

View File

@ -46,10 +46,14 @@ class FrameDef {
// Returns the bsGame master-net-time when this was made
// (tries to match real time but is incremented more smoothly
// so is better for drawing purposes)
auto base_time() const -> millisecs_t { return base_time_; }
auto display_time_millisecs() const -> millisecs_t {
return display_time_millisecs_;
}
// How much base time does this frame-def represent.
auto base_time_elapsed() const -> millisecs_t { return base_time_elapsed_; }
auto display_time_elapsed_millisecs() const -> millisecs_t {
return display_time_elapsed_millisecs_;
}
auto quality() const -> GraphicsQuality { return quality_; }
auto orbiting() const -> bool { return orbiting_; }
@ -105,9 +109,13 @@ class FrameDef {
void Reset();
void Finalize();
void set_base_time_elapsed(millisecs_t val) { base_time_elapsed_ = val; }
void set_display_time_elapsed_millisecs(millisecs_t val) {
display_time_elapsed_millisecs_ = val;
}
void set_app_time_millisecs(millisecs_t val) { app_time_millisecs_ = val; }
void set_base_time(millisecs_t val) { base_time_ = val; }
void set_display_time_millisecs(millisecs_t val) {
display_time_millisecs_ = val;
}
void set_frame_number(int64_t val) { frame_number_ = val; }
auto overlay_flat_pass() const -> RenderPass* {
@ -198,8 +206,8 @@ class FrameDef {
GraphicsQuality quality_{GraphicsQuality::kLow};
bool orbiting_{};
millisecs_t app_time_millisecs_{};
millisecs_t base_time_{};
millisecs_t base_time_elapsed_{};
millisecs_t display_time_millisecs_{};
millisecs_t display_time_elapsed_millisecs_{};
int64_t frame_number_{};
Vector3f shadow_offset_{0.0f, 0.0f, 0.0f};
Vector2f shadow_scale_{1.0f, 1.0f};

View File

@ -1362,6 +1362,8 @@ static auto PyEmptyAppModeActivate(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
BA_PRECONDITION(g_base->InLogicThread());
g_base->set_app_mode(AppModeEmpty::GetSingleton());
AppModeEmpty::GetSingleton()->Reset();
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
@ -1401,7 +1403,6 @@ static PyMethodDef PyEmptyAppModeDeactivateDef = {
static auto PyEmptyAppModeHandleIntentDefault(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
BA_PRECONDITION(g_base->InLogicThread());
AppModeEmpty::GetSingleton()->Reset();
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}

View File

@ -33,7 +33,7 @@ class BaseSoftInterface {
-> PyObject* = 0;
virtual auto FeatureSetFromData(PyObject* obj)
-> FeatureSetNativeComponent* = 0;
virtual void V1CloudLog(const std::string& msg) = 0;
virtual void DoV1CloudLog(const std::string& msg) = 0;
virtual void PushConsolePrintCall(const std::string& msg) = 0;
virtual auto GetPyExceptionType(PyExcType exctype) -> PyObject* = 0;
virtual auto PrintPythonStackTrace() -> bool = 0;

View File

@ -1325,8 +1325,6 @@ auto SceneV1AppMode::DoesWorldFillScreen() -> bool {
}
void SceneV1AppMode::DrawWorld(base::FrameDef* frame_def) {
AppMode::DrawWorld(frame_def);
if (auto* session = GetForegroundSession()) {
session->Draw(frame_def);
frame_def->set_benchmark_type(session->benchmark_type());

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21128;
const int kEngineBuildNumber = 21129;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -58,7 +58,7 @@ void Logging::V1CloudLog(const std::string& msg) {
// If the base feature-set is up, ship it off there for further handling.
if (g_base_soft) {
g_base_soft->V1CloudLog(msg);
g_base_soft->DoV1CloudLog(msg);
}
}

View File

@ -249,7 +249,7 @@ void RootUI::Draw(base::FrameDef* frame_def) {
+ connected_client_extra_offset_smoothed_,
height - menu_button_size_ * 0.35f, kMenuButtonDrawDepth);
c.Scale(menu_button_size_ * 0.8f, menu_button_size_ * 0.8f);
if (flash && frame_def->base_time() % 250 < 125) {
if (flash && frame_def->display_time_millisecs() % 250 < 125) {
c.SetColor(1.0f, 1.4f, 1.0f);
}
c.DrawMeshAsset(g_base->assets->SysMesh(base::SysMeshID::kImage1x1));
@ -336,7 +336,7 @@ void RootUI::Draw(base::FrameDef* frame_def) {
-0.003f * party_size_text_group_->GetElementVScale(e),
0.0f, 1.0f);
c.SetFlatness(1.0f);
if (flash && frame_def->base_time() % 250 < 125) {
if (flash && frame_def->display_time_millisecs() % 250 < 125) {
c.SetColor(1, 1, 0);
} else {
if (party_size > 0) {
@ -379,7 +379,7 @@ void RootUI::Draw(base::FrameDef* frame_def) {
-0.003f * start_a_game_text_group_->GetElementVScale(e),
0.0f, 1.0f);
c.SetFlatness(1.0f);
if (flash && frame_def->base_time() % 250 < 125) {
if (flash && frame_def->display_time_millisecs() % 250 < 125) {
c.SetColor(1, 1, 0);
} else {
c.SetColor(0, 1, 0);

View File

@ -116,7 +116,7 @@ auto ButtonWidget::GetDrawBrightness(millisecs_t time) const -> float {
}
void ButtonWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
Vector3f tilt = 0.02f * g_base->graphics->tilt();
float extra_offs_x = -tilt.y;

View File

@ -783,7 +783,7 @@ void ContainerWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
BA_DEBUG_UI_READ_LOCK;
CheckLayout();
millisecs_t net_time = pass->frame_def()->base_time();
millisecs_t net_time = pass->frame_def()->display_time_millisecs();
float offset_h = 0.0f;
// If we're transitioning, update our offsets in the first (opaque) pass.

View File

@ -514,7 +514,7 @@ void HScrollWidget::UpdateLayout() {
void HScrollWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
have_drawn_ = true;
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
float prev_child_offset_h_smoothed = child_offset_h_smoothed_;
// Ok, lets update our inertial scrolling during the opaque pass.

View File

@ -21,7 +21,7 @@ void ImageWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
return;
}
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
Vector3f tilt = tilt_scale_ * 0.01f * g_base->graphics->tilt();
if (draw_control_parent()) tilt += 0.02f * g_base->graphics->tilt();

View File

@ -800,7 +800,7 @@ void RootWidget::Draw(base::RenderPass* pass, bool transparent) {
// Opaque pass gets drawn first; use that as an opportunity to step up our
// motion.
if (!transparent) {
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
millisecs_t time_diff =
std::min(millisecs_t{100}, current_time - update_time_);
StepPositions(static_cast<float>(time_diff));

View File

@ -591,7 +591,7 @@ void ScrollWidget::UpdateLayout() {
void ScrollWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
have_drawn_ = true;
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
float prev_child_offset_v_smoothed = child_offset_v_smoothed_;
// ok lets update our inertial scrolling during the opaque pass

View File

@ -89,7 +89,7 @@ void TextWidget::SetEnabled(bool val) {
}
void TextWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
millisecs_t current_time = pass->frame_def()->base_time();
millisecs_t current_time = pass->frame_def()->display_time_millisecs();
// All our stuff currently happens in the transparent pass.
if (!draw_transparent) {