Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixelsuft committed Jun 4, 2024
1 parent cb5d8de commit ff025ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/display-sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,11 @@ void display_init(void)
window = SDL_CreateWindow(
"halfix",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
#ifdef MOBILE_BUILD
800, 480,
#else
640, 480,
#endif
SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN |
#ifdef MOBILE_BUILD
SDL_WINDOW_RESIZABLE |
Expand Down
19 changes: 18 additions & 1 deletion src/ui-mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,24 @@ void mobui_copy_config(void) {
}

void mobui_new_image(size_t size_mb) {

void* buf = h_malloc(1024 * 1024 * 2);
if (buf == NULL)
return;
char out_path[1024 * 10];
size_t path_inp_len = strlen(page.path_inp.text);
memcpy(out_path, page.path_inp.text, path_inp_len);
strcpy(out_path + path_inp_len, "/hd_image.img");
void* out_file = h_fopen(out_path, "wb");
if (out_file == NULL) {
h_free(buf);
return;
}
memset(buf, 0, 1024 * 1024 * 2);
for (size_t i = 0; i < (size_mb / 2); i++) {
h_fwrite(buf, 1, 1024 * 1024 * 2, out_file);
}
h_fclose(out_file);
h_free(buf);
}

void mobui_run_main(void) {
Expand Down

0 comments on commit ff025ba

Please sign in to comment.