(path_ptr: *const u8)
| 1352 | |
| 1353 | #[no_mangle] |
| 1354 | pub extern "C" fn bloom_read_file(path_ptr: *const u8) -> *const u8 { |
| 1355 | let path = str_from_header(path_ptr); |
| 1356 | // Always return a valid Perry string. A null pointer would NaN-box into a |
| 1357 | // string-typed value pointing at address 0; subsequent `.length` / |
| 1358 | // `.charCodeAt` reads dereference the bogus StringHeader and segfault. |
| 1359 | // Callers detect "missing file" via `data.length === 0` (e.g. the jump |
| 1360 | // game's discoverLevels probe across level1..level10 / custom_*). |
| 1361 | // Parity with native/linux — Android previously returned null on Err, |
| 1362 | // crashing discoverLevels at the first non-existent level file. |
| 1363 | match std::fs::read_to_string(resolve_path(path)) { |
| 1364 | Ok(contents) => alloc_perry_string(&contents), |
| 1365 | Err(_) => alloc_perry_string(""), |
| 1366 | } |
| 1367 | } |
| 1368 | |
| 1369 | #[no_mangle] |
| 1370 | pub extern "C" fn bloom_get_touch_x(index: f64) -> f64 { engine().input.get_touch_x(index as usize) } |
nothing calls this directly
no test coverage detected