|
63 | 63 | #define MD5_HASHSIZE 16 |
64 | 64 | #define BG_ANIMATION_COLOR tic_color_dark_grey |
65 | 65 |
|
66 | | -static const char VideoGif[] = "video.gif"; |
67 | | -static const char ScreenGif[] = "screen.gif"; |
| 66 | +static const char VideoGif[] = "video%i.gif"; |
| 67 | +static const char ScreenGif[] = "screen%i.gif"; |
68 | 68 |
|
69 | 69 | typedef struct |
70 | 70 | { |
@@ -1454,16 +1454,26 @@ static void stopVideoRecord(const char* name) |
1454 | 1454 | { |
1455 | 1455 | s32 size = 0; |
1456 | 1456 | u8* data = malloc(FRAME_SIZE * impl.video.frame); |
| 1457 | + int i = 0; |
| 1458 | + char filename[TICNAME_MAX]; |
1457 | 1459 |
|
1458 | 1460 | gif_write_animation(data, &size, TIC80_FULLWIDTH, TIC80_FULLHEIGHT, (const u8*)impl.video.buffer, impl.video.frame, TIC80_FRAMERATE, getConfig()->gifScale); |
1459 | 1461 |
|
1460 | | - if(fsSaveFile(impl.fs, name, data, size, true)) |
| 1462 | + // Find an available filename to save. |
| 1463 | + do |
| 1464 | + { |
| 1465 | + snprintf(filename, sizeof filename, name, ++i); |
| 1466 | + } |
| 1467 | + while(fsExistsFile(impl.fs, filename)); |
| 1468 | + |
| 1469 | + // Now that it has found an available filename, save it. |
| 1470 | + if(fsSaveFile(impl.fs, filename, data, size, true)) |
1461 | 1471 | { |
1462 | 1472 | char msg[TICNAME_MAX]; |
1463 | | - sprintf(msg, "%s saved :)", name); |
| 1473 | + sprintf(msg, "%s saved :)", filename); |
1464 | 1474 | showPopupMessage(msg); |
1465 | 1475 |
|
1466 | | - getSystem()->openSystemPath(fsGetFilePath(impl.fs, name)); |
| 1476 | + getSystem()->openSystemPath(fsGetFilePath(impl.fs, filename)); |
1467 | 1477 | } |
1468 | 1478 | else showPopupMessage("error: file not saved :("); |
1469 | 1479 | } |
|
0 commit comments