Mobile step 7b: iOS packaging (simulator verified to the game scene)
- ios/build.sh builds static SDL3 + FreeType, then the .app (code only, embedded Python); signs ad hoc and runs on a simulator, or signs with a development profile and installs with devicectl (device path untested). Simulator-only SDL patch: accept the simulator Metal device for SDL_GPU. - ios/Info.plist.in: landscape, full screen, launch screen, file sharing. - Data dir is Documents on iOS; ios/push_assets.py stages the client root lower-cased (iOS is case-sensitive, the client opens lower-cased paths) and copies it into the app container. - EffectData path normalisation folds A-Z like the effect cache key. - android/push_assets.py: test-rundir base layer + svside/, which the game phase needs (also fixes Android); --lowercase (ASCII only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f973b24abc
commit
908838c8f9
@@ -294,10 +294,15 @@ ava2::app::AppLoop::Frame RunClient(ava2::app::AppLoop* loop, int argc, char** a
|
||||
// A flattened client root (scripts beside the assets), e.g. the Android data directory.
|
||||
else if (std::filesystem::exists("game.py") && std::filesystem::exists("uiscript")) script_root = ".";
|
||||
}
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(SDL_PLATFORM_IOS)
|
||||
if (stdlib.empty() || script_root.empty()) {
|
||||
#ifdef __ANDROID__
|
||||
const char* push = "android/push_assets.py";
|
||||
#else
|
||||
const char* push = "ios/push_assets.py";
|
||||
#endif
|
||||
const std::string message = "Game data not found in " + std::filesystem::current_path().string()
|
||||
+ ".\nPush it with android/push_assets.py.";
|
||||
+ ".\nPush it with " + push + ".";
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "AVA2", message.c_str(), nullptr);
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,18 @@
|
||||
namespace ava2::platform {
|
||||
|
||||
bool EnterClientDataDirectory(std::string* error) {
|
||||
#if defined(__APPLE__)
|
||||
#if defined(SDL_PLATFORM_IOS)
|
||||
// Like the APK, the .app holds code only. The flattened client root (ios/push_assets.py, or
|
||||
// copied in with Finder / the Files app — Info.plist enables file sharing) lives in Documents.
|
||||
const char* data = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
|
||||
std::error_code ec;
|
||||
if (data) std::filesystem::current_path(data, ec);
|
||||
if (!data || ec) {
|
||||
if (error) *error = std::string("Cannot enter client data directory: ") + (data ? ec.message() : SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
SDL_Log("Client data: %s", data);
|
||||
#elif defined(__APPLE__)
|
||||
// Keep legacy Python's relative config/chat writes outside the signed application.
|
||||
try {
|
||||
std::filesystem::path base = std::filesystem::path(SDL_GetBasePath()).lexically_normal();
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace ava2::platform {
|
||||
|
||||
// Enters the client root the legacy code reads relative paths from: on macOS the per-user data
|
||||
// directory that links the bundle Resources (config/chat writes stay outside the signed app); on
|
||||
// Android the app's external files directory (android/push_assets.py). Elsewhere a no-op.
|
||||
// Android the app's external files directory (android/push_assets.py); on iOS the app's Documents
|
||||
// folder (ios/push_assets.py). Elsewhere a no-op.
|
||||
// False with *error set when the directory cannot be entered.
|
||||
bool EnterClientDataDirectory(std::string* error);
|
||||
|
||||
|
||||
@@ -34,9 +34,13 @@ float InterpolateTimeEvent(const std::vector<TimeEvent>& events, float time, flo
|
||||
EffectData::EffectData() = default;
|
||||
EffectData::~EffectData() = default;
|
||||
|
||||
// Slashes forward and A-Z lower-cased, like ResourceManager::NormalizePath: the client root is
|
||||
// staged lower-case on case-sensitive file systems (iOS), and scripts spell names in mixed case
|
||||
// (d:/ymir work/effect/etc/empire/empire_A.mse).
|
||||
static std::string NormalizePath(std::string path) {
|
||||
for (char& c : path) {
|
||||
if (c == '\\') c = '/';
|
||||
else if (c >= 'A' && c <= 'Z') c = static_cast<char>(c - 'A' + 'a');
|
||||
}
|
||||
if (path.size() >= 3 && (path[0] == 'd' || path[0] == 'D') && path[1] == ':' && path[2] == '/') {
|
||||
path = path.substr(3);
|
||||
|
||||
Reference in New Issue
Block a user