| 423 | } |
| 424 | |
| 425 | cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* save_args) { |
| 426 | JNIEnv* env; |
| 427 | jvalue args[2]; |
| 428 | Java_GetCurrentEnv(env); |
| 429 | if (!save_args->defaultName.length) return SFD_ERR_NEED_DEFAULT_NAME; |
| 430 | |
| 431 | // save the item to a temp file, which is then (usually) later deleted by intent callback |
| 432 | Directory_Create2(FILEPATH_RAW("Exported")); |
| 433 | |
| 434 | cc_string path; char pathBuffer[FILENAME_SIZE]; |
| 435 | String_InitArray(path, pathBuffer); |
| 436 | String_Format2(&path, "Exported/%s%c", &save_args->defaultName, save_args->filters[0]); |
| 437 | save_args->Callback(&path); |
| 438 | // TODO kinda ugly, maybe a better way? |
| 439 | cc_string file = String_UNSAFE_SubstringAt(&path, String_IndexOf(&path, '/') + 1); |
| 440 | |
| 441 | args[0].l = Java_AllocString(env, &path); |
| 442 | args[1].l = Java_AllocString(env, &file); |
| 443 | int OK = Java_ICall_Int(env, JAVA_saveFileDialog, args); |
| 444 | Java_DeleteLocalRef(env, args[0].l); |
| 445 | Java_DeleteLocalRef(env, args[1].l); |
| 446 | |
| 447 | // TODO: Better error handling |
| 448 | return OK ? 0 : ERR_INVALID_ARGUMENT; |
| 449 | } |
| 450 | |
| 451 | void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) { |
| 452 | bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window pixels"); |
nothing calls this directly
no test coverage detected