@geastack/apple 0.2.30 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -0
- package/generated/ActivityKit.d.ts +1 -0
- package/generated/AppKit.d.ts +1 -0
- package/generated/Foundation.d.ts +1 -0
- package/generated/Metal.d.ts +16 -0
- package/generated/MetalKit.d.ts +1 -0
- package/generated/SwiftData.d.ts +2 -0
- package/generated/UIKit.d.ts +1 -0
- package/package.json +6 -7
- package/targets/ios/Info.plist.in +1 -0
- package/targets/ios/build-ios.sh +14 -2
- package/targets/ios/generate-xcode-project.mjs +23 -3
- package/targets/ios/main/ios_http.mm +181 -0
- package/targets/ios/main/ios_main.mm +6 -1
- package/targets/ios/main/ios_microphone.mm +117 -0
- package/targets/ios/main/ios_websocket.mm +34 -0
- package/targets/macos/README.md +8 -3
- package/targets/macos/build-macos.sh +93 -200
- package/targets/macos/main/font_registry.mm +20 -2
- package/targets/macos/main/macos_app_platform.mm +77 -34
- package/targets/macos/main/macos_display.mm +16 -10
- package/targets/macos/main/macos_main.mm +51 -55
- package/targets/macos/main/macos_prerender.h +3 -1
- package/targets/macos/runtime-glyphs.mjs +1 -1
- package/targets/shared/apple_audio.mm +143 -4
- package/targets/ios/main/ios_apps.c +0 -28
- package/targets/macos/generate-resident-entry.mjs +0 -80
- package/targets/macos/generate-resident-registry.mjs +0 -141
- package/targets/macos/main/macos_apps.c +0 -31
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#include <string.h>
|
|
2
|
-
|
|
3
|
-
int gea_embedded_apps_launch(const char *app_id);
|
|
4
|
-
int gea_embedded_apps_return_to_launcher_on_reset(void);
|
|
5
|
-
void gea_embedded_apps_start_launcher_button_task(void);
|
|
6
|
-
const char *gea_embedded_apps_get_current_id(void);
|
|
7
|
-
|
|
8
|
-
static char s_current_app_id[64] = "";
|
|
9
|
-
|
|
10
|
-
int gea_embedded_apps_launch(const char *app_id)
|
|
11
|
-
{
|
|
12
|
-
if (!app_id || !app_id[0]) return 0;
|
|
13
|
-
strncpy(s_current_app_id, app_id, sizeof(s_current_app_id) - 1);
|
|
14
|
-
s_current_app_id[sizeof(s_current_app_id) - 1] = '\0';
|
|
15
|
-
return 1;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
int gea_embedded_apps_return_to_launcher_on_reset(void)
|
|
19
|
-
{
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
void gea_embedded_apps_start_launcher_button_task(void) {}
|
|
24
|
-
|
|
25
|
-
const char *gea_embedded_apps_get_current_id(void)
|
|
26
|
-
{
|
|
27
|
-
return s_current_app_id;
|
|
28
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Per-resident-app entry.cpp generator (macOS-flavoured).
|
|
3
|
-
// Mirrors the template in targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt
|
|
4
|
-
// but drops ESP-only host integration. Each entry.cpp exposes
|
|
5
|
-
// <prefix>_init/_frame/_settings_toggle/_mirror_*/_lookup_font*/_ble_* so the
|
|
6
|
-
// generated registry can populate a ResidentApp slot for this app.
|
|
7
|
-
|
|
8
|
-
import { writeFileSync } from 'node:fs'
|
|
9
|
-
|
|
10
|
-
const [, , prefix, outPath] = process.argv
|
|
11
|
-
if (!prefix || !outPath) {
|
|
12
|
-
console.error('Usage: generate-resident-entry.mjs <prefix> <out-cpp>')
|
|
13
|
-
process.exit(1)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const code = `// Auto-generated by targets/macos/generate-resident-entry.mjs. Do not edit.
|
|
17
|
-
#include "app.h"
|
|
18
|
-
#include "gea/embedded.h"
|
|
19
|
-
#include "graphics/font.h"
|
|
20
|
-
#include "host/timers.h"
|
|
21
|
-
#include "host/websocket.h"
|
|
22
|
-
#include "host/rtc.h"
|
|
23
|
-
#include "ui/document.h"
|
|
24
|
-
#include "ui/style.h"
|
|
25
|
-
|
|
26
|
-
extern void ${prefix}_top_level();
|
|
27
|
-
extern void ${prefix}_register_styles();
|
|
28
|
-
extern void gea_cpp_clear_microtasks();
|
|
29
|
-
|
|
30
|
-
namespace gea::framework::app::generated::${prefix} {
|
|
31
|
-
void drainMicrotasks();
|
|
32
|
-
} // namespace gea::framework::app::generated::${prefix}
|
|
33
|
-
|
|
34
|
-
void __attribute__((weak)) ${prefix}_register_styles() {}
|
|
35
|
-
|
|
36
|
-
void ${prefix}_init(int w, int h, double devicePixelRatio)
|
|
37
|
-
{
|
|
38
|
-
\tgea::embedded::ui::Document::setPreferredMountSize(w, h);
|
|
39
|
-
\tgea::embedded::ui::setViewportMetrics(w, h, devicePixelRatio);
|
|
40
|
-
\tgea::host::resetAnimationFrameCallbacks();
|
|
41
|
-
\tgea::host::resetScheduledTimers();
|
|
42
|
-
\tgea_cpp_clear_microtasks();
|
|
43
|
-
\tgea::embedded::ui::StyleSheet::instance().clear();
|
|
44
|
-
\t${prefix}_register_styles();
|
|
45
|
-
\tgea::embedded::ui::Document::instance().clear();
|
|
46
|
-
\t${prefix}_top_level();
|
|
47
|
-
\tgea::embedded::ui::Document::instance().refreshMountedIfDirty();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
void ${prefix}_frame(int timestamp_ms)
|
|
51
|
-
{
|
|
52
|
-
\t// Renderer callbacks create many short-lived native references. Keep the
|
|
53
|
-
\t// cycle collector out of those callbacks so their stack-owned references
|
|
54
|
-
\t// unwind before the collector traces the live graph.
|
|
55
|
-
\t{
|
|
56
|
-
\t\tgea::CycleCollectionDeferral deferCycleCollection;
|
|
57
|
-
\t\tgea::framework::app::generated::${prefix}::drainMicrotasks();
|
|
58
|
-
\t\tgea::host::runAnimationFrameCallbacks(timestamp_ms);
|
|
59
|
-
\t\tgea::host::websocket::runCallbacks();
|
|
60
|
-
\t\tgea::host::rtc::runCallbacks();
|
|
61
|
-
\t\tgea::embedded::ui::Document::instance().frame(timestamp_ms);
|
|
62
|
-
\t\tgea::embedded::ui::Document::instance().refreshMountedIfDirty();
|
|
63
|
-
\t}
|
|
64
|
-
\tgea::collectCyclesIfNeeded();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
void ${prefix}_settings_toggle() {}
|
|
68
|
-
int ${prefix}_mirror_begin_snapshot() { return 0; }
|
|
69
|
-
int ${prefix}_mirror_begin_diff() { return 0; }
|
|
70
|
-
int ${prefix}_mirror_next_record(unsigned char *, int) { return 0; }
|
|
71
|
-
void ${prefix}_mirror_clear_dirty() {}
|
|
72
|
-
void ${prefix}_ble_connected() {}
|
|
73
|
-
void ${prefix}_ble_disconnected() {}
|
|
74
|
-
void ${prefix}_ble_bound() {}
|
|
75
|
-
// Note: <prefix>_lookup_font, lookup_font_for_family, lookup_font_family
|
|
76
|
-
// come from each app's gea_embedded_font_generated.cpp — don't emit
|
|
77
|
-
// duplicates here or the link fails with multiple-definition errors.
|
|
78
|
-
`
|
|
79
|
-
|
|
80
|
-
writeFileSync(outPath, code)
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Generates the macOS resident-apps registry .cpp. Mirrors the ESP32
|
|
3
|
-
// generator (scripts/generate-resident-app-registry.mjs) but drops the
|
|
4
|
-
// FreeRTOS / ESP_LOG machinery — macOS uses std::mutex for pending-launch
|
|
5
|
-
// sync and just leaves the swap to be drained from the AppKit main tick.
|
|
6
|
-
//
|
|
7
|
-
// Usage: generate-resident-registry.mjs <out-cpp> <launcher-id> <app-id...>
|
|
8
|
-
// First app-id is treated as the boot/active app.
|
|
9
|
-
|
|
10
|
-
import { writeFileSync } from 'node:fs'
|
|
11
|
-
|
|
12
|
-
const [, , outPath, launcherId, ...appIds] = process.argv
|
|
13
|
-
if (!outPath || !launcherId || appIds.length === 0) {
|
|
14
|
-
console.error('Usage: generate-resident-registry.mjs <out-cpp> <launcher-id> <app-id...>')
|
|
15
|
-
process.exit(1)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const safe = (id) => id.replace(/[^A-Za-z0-9_]/g, '_')
|
|
19
|
-
const prefix = (id) => `gea_resident_${safe(id)}`
|
|
20
|
-
const quote = (s) => s.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
21
|
-
|
|
22
|
-
const lines = []
|
|
23
|
-
lines.push('// Auto-generated by targets/macos/generate-resident-registry.mjs.')
|
|
24
|
-
lines.push('// Do not edit.')
|
|
25
|
-
lines.push('#include "app.h"')
|
|
26
|
-
lines.push('#include "apps.h"')
|
|
27
|
-
lines.push('#include "resident_apps.h"')
|
|
28
|
-
lines.push('#include "graphics/font.h"')
|
|
29
|
-
lines.push('')
|
|
30
|
-
lines.push('#include <cstdio>')
|
|
31
|
-
lines.push('#include <cstring>')
|
|
32
|
-
lines.push('#include <mutex>')
|
|
33
|
-
lines.push('')
|
|
34
|
-
|
|
35
|
-
for (const id of appIds) {
|
|
36
|
-
const p = prefix(id)
|
|
37
|
-
lines.push(`extern void ${p}_init(int w, int h, double devicePixelRatio);`)
|
|
38
|
-
lines.push(`extern void ${p}_frame(int timestamp_ms);`)
|
|
39
|
-
lines.push(`extern void ${p}_settings_toggle();`)
|
|
40
|
-
}
|
|
41
|
-
lines.push('')
|
|
42
|
-
|
|
43
|
-
lines.push('namespace gea::framework::apps {')
|
|
44
|
-
lines.push('namespace {')
|
|
45
|
-
lines.push(`constexpr const char *kLauncherAppId = "${quote(launcherId)}";`)
|
|
46
|
-
lines.push('std::mutex &pendingLock() { static std::mutex m; return m; }')
|
|
47
|
-
lines.push('char pendingLaunchAppId[64] = "";')
|
|
48
|
-
lines.push('bool pendingValid = false;')
|
|
49
|
-
lines.push('')
|
|
50
|
-
lines.push('const ResidentApp residentApps[] = {')
|
|
51
|
-
for (const id of appIds) {
|
|
52
|
-
const p = prefix(id)
|
|
53
|
-
lines.push('\t{')
|
|
54
|
-
lines.push(`\t\t.id = "${quote(id)}",`)
|
|
55
|
-
lines.push(`\t\t.displayFlushChunkRows = 0,`)
|
|
56
|
-
lines.push(`\t\t.displayFlushQueueDepth = 0,`)
|
|
57
|
-
lines.push(`\t\t.init = ${p}_init,`)
|
|
58
|
-
lines.push(`\t\t.frame = ${p}_frame,`)
|
|
59
|
-
lines.push(`\t\t.settingsToggle = ${p}_settings_toggle,`)
|
|
60
|
-
lines.push('\t},')
|
|
61
|
-
}
|
|
62
|
-
lines.push('};')
|
|
63
|
-
lines.push(`constexpr int kResidentAppCount = ${appIds.length};`)
|
|
64
|
-
lines.push('const ResidentApp *activeApp = &residentApps[0];')
|
|
65
|
-
lines.push('')
|
|
66
|
-
lines.push('const ResidentApp *findApp(const char *appId)')
|
|
67
|
-
lines.push('{')
|
|
68
|
-
lines.push("\tif (!appId || appId[0] == '\\0') return nullptr;")
|
|
69
|
-
lines.push('\tfor (int i = 0; i < kResidentAppCount; i++) {')
|
|
70
|
-
lines.push('\t\tif (std::strcmp(residentApps[i].id, appId) == 0) return &residentApps[i];')
|
|
71
|
-
lines.push('\t}')
|
|
72
|
-
lines.push('\treturn nullptr;')
|
|
73
|
-
lines.push('}')
|
|
74
|
-
lines.push('} // namespace')
|
|
75
|
-
lines.push('')
|
|
76
|
-
lines.push('namespace generated {')
|
|
77
|
-
lines.push('const ResidentApp *activeResidentApp() { return activeApp; }')
|
|
78
|
-
lines.push('} // namespace generated')
|
|
79
|
-
lines.push('')
|
|
80
|
-
lines.push('bool ResidentApps::isEnabled() { return kResidentAppCount > 0; }')
|
|
81
|
-
lines.push('const char *ResidentApps::activeId() { return activeApp ? activeApp->id : nullptr; }')
|
|
82
|
-
lines.push('')
|
|
83
|
-
lines.push('bool ResidentApps::select(const char *appId)')
|
|
84
|
-
lines.push('{')
|
|
85
|
-
lines.push('\tconst ResidentApp *next = findApp(appId);')
|
|
86
|
-
lines.push('\tif (!next) return false;')
|
|
87
|
-
lines.push('\tactiveApp = next;')
|
|
88
|
-
lines.push('\treturn true;')
|
|
89
|
-
lines.push('}')
|
|
90
|
-
lines.push('')
|
|
91
|
-
lines.push('bool ResidentApps::requestLaunch(const char *appId)')
|
|
92
|
-
lines.push('{')
|
|
93
|
-
lines.push('\tif (!findApp(appId)) return false;')
|
|
94
|
-
lines.push('\tstd::lock_guard guard(pendingLock());')
|
|
95
|
-
lines.push('\tstd::snprintf(pendingLaunchAppId, sizeof(pendingLaunchAppId), "%s", appId);')
|
|
96
|
-
lines.push('\tpendingValid = true;')
|
|
97
|
-
lines.push('\treturn true;')
|
|
98
|
-
lines.push('}')
|
|
99
|
-
lines.push('')
|
|
100
|
-
lines.push('bool ResidentApps::consumeLaunch(char *dst, std::size_t cap)')
|
|
101
|
-
lines.push('{')
|
|
102
|
-
lines.push('\tstd::lock_guard guard(pendingLock());')
|
|
103
|
-
lines.push('\tif (!pendingValid) return false;')
|
|
104
|
-
lines.push('\tif (dst && cap > 0) std::snprintf(dst, cap, "%s", pendingLaunchAppId);')
|
|
105
|
-
lines.push('\tpendingValid = false;')
|
|
106
|
-
lines.push("\tpendingLaunchAppId[0] = '\\0';")
|
|
107
|
-
lines.push('\treturn true;')
|
|
108
|
-
lines.push('}')
|
|
109
|
-
lines.push('')
|
|
110
|
-
lines.push('bool ResidentApps::returnToLauncher(const char *trigger)')
|
|
111
|
-
lines.push('{')
|
|
112
|
-
lines.push('\t(void)trigger;')
|
|
113
|
-
lines.push('\tif (!activeApp || std::strcmp(activeApp->id, kLauncherAppId) == 0) return false;')
|
|
114
|
-
lines.push('\treturn ResidentApps::requestLaunch(kLauncherAppId);')
|
|
115
|
-
lines.push('}')
|
|
116
|
-
lines.push('')
|
|
117
|
-
lines.push('} // namespace gea::framework::apps')
|
|
118
|
-
lines.push('')
|
|
119
|
-
// Application::init / frame / toggleSettings are normally provided by
|
|
120
|
-
// gea_app_entry.cpp (single-app mode). In multi-app mode the launcher's
|
|
121
|
-
// macOS build drops gea_app_entry.cpp and emits this version instead, so
|
|
122
|
-
// Application::init dispatches to whichever resident is currently active.
|
|
123
|
-
lines.push('namespace gea::framework::app {')
|
|
124
|
-
lines.push('void Application::init(int width, int height, double devicePixelRatio)')
|
|
125
|
-
lines.push('{')
|
|
126
|
-
lines.push('\tconst auto *active = gea::framework::apps::generated::activeResidentApp();')
|
|
127
|
-
lines.push('\tif (active && active->init) active->init(width, height, devicePixelRatio);')
|
|
128
|
-
lines.push('}')
|
|
129
|
-
lines.push('void Application::frame(int timestampMs)')
|
|
130
|
-
lines.push('{')
|
|
131
|
-
lines.push('\tconst auto *active = gea::framework::apps::generated::activeResidentApp();')
|
|
132
|
-
lines.push('\tif (active && active->frame) active->frame(timestampMs);')
|
|
133
|
-
lines.push('}')
|
|
134
|
-
lines.push('void Application::toggleSettings()')
|
|
135
|
-
lines.push('{')
|
|
136
|
-
lines.push('\tconst auto *active = gea::framework::apps::generated::activeResidentApp();')
|
|
137
|
-
lines.push('\tif (active && active->settingsToggle) active->settingsToggle();')
|
|
138
|
-
lines.push('}')
|
|
139
|
-
lines.push('} // namespace gea::framework::app')
|
|
140
|
-
|
|
141
|
-
writeFileSync(outPath, lines.join('\n') + '\n')
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#include <string.h>
|
|
2
|
-
|
|
3
|
-
/* The apps.h header in @geastack/core's include/ is C++-only. The framework
|
|
4
|
-
* itself calls the gea_embedded_apps_* C API via generated app code (and
|
|
5
|
-
* compiles it as C), so we declare the prototypes inline here. */
|
|
6
|
-
int gea_embedded_apps_launch(const char *app_id);
|
|
7
|
-
int gea_embedded_apps_return_to_launcher_on_reset(void);
|
|
8
|
-
void gea_embedded_apps_start_launcher_button_task(void);
|
|
9
|
-
const char *gea_embedded_apps_get_current_id(void);
|
|
10
|
-
|
|
11
|
-
static char s_current_app_id[64] = "";
|
|
12
|
-
|
|
13
|
-
int gea_embedded_apps_launch(const char *app_id)
|
|
14
|
-
{
|
|
15
|
-
if (!app_id || !app_id[0]) return 0;
|
|
16
|
-
strncpy(s_current_app_id, app_id, sizeof(s_current_app_id) - 1);
|
|
17
|
-
s_current_app_id[sizeof(s_current_app_id) - 1] = '\0';
|
|
18
|
-
return 1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
int gea_embedded_apps_return_to_launcher_on_reset(void)
|
|
22
|
-
{
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
void gea_embedded_apps_start_launcher_button_task(void) {}
|
|
27
|
-
|
|
28
|
-
const char *gea_embedded_apps_get_current_id(void)
|
|
29
|
-
{
|
|
30
|
-
return s_current_app_id;
|
|
31
|
-
}
|