Skip to content

Commit cee9a71

Browse files
committed
Prevent sleep during ftp, some fs functions and audio player
1 parent c5e5a7d commit cee9a71

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

source/menus/menu_archive.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ int Archive_ExtractArchive(const char *path) {
136136
ret = archive_write_finish_entry(dst);
137137
count++;
138138
}
139+
140+
appletSetMediaPlaybackState(false);
139141

140142
ret = archive_write_free(dst);
141143
ret = archive_read_free(handle);
@@ -175,8 +177,10 @@ int Archive_ExtractFile(const char *path) {
175177
break;
176178

177179
if (kDown & KEY_A) {
178-
if (dialog_selection == 0)
180+
if (dialog_selection == 0) {
181+
appletSetMediaPlaybackState(true);
179182
return Archive_ExtractArchive(path);
183+
}
180184
else
181185
break;
182186
}

source/menus/menu_fileoptions.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static Result FileOptions_Delete(void) {
169169
}
170170

171171
static void HandleDelete(void) {
172+
appletSetMediaPlaybackState(true);
172173
appletLockExit();
173174

174175
if ((multi_select_index > 0) && (strlen(multi_select_dir) != 0)) {
@@ -192,6 +193,7 @@ static void HandleDelete(void) {
192193
else if (R_FAILED(FileOptions_Delete()))
193194
return;
194195

196+
appletSetMediaPlaybackState(false);
195197
appletUnlockExit();
196198
Dirbrowse_PopulateFiles(true);
197199
MENU_DEFAULT_STATE = MENU_STATE_HOME;
@@ -512,6 +514,7 @@ static Result FileOptions_Paste(void) {
512514
}
513515

514516
static void HandleCopy(void) {
517+
appletSetMediaPlaybackState(true);
515518
appletLockExit();
516519

517520
if ((!copy_status) && (!cut_status )) {
@@ -554,10 +557,12 @@ static void HandleCopy(void) {
554557
MENU_DEFAULT_STATE = MENU_STATE_HOME;
555558
}
556559

560+
appletSetMediaPlaybackState(false);
557561
appletUnlockExit();
558562
}
559563

560564
static void HandleCut(void) {
565+
appletSetMediaPlaybackState(true);
561566
appletLockExit();
562567

563568
if ((!cut_status ) && (!copy_status)) {
@@ -599,6 +604,7 @@ static void HandleCut(void) {
599604
MENU_DEFAULT_STATE = MENU_STATE_HOME;
600605
}
601606

607+
appletSetMediaPlaybackState(false);
602608
appletUnlockExit();
603609
}
604610

source/menus/menu_ftp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ void Menu_FTP(void) {
3434

3535
TouchInfo touchInfo;
3636
Touch_Init(&touchInfo);
37+
38+
appletSetMediaPlaybackState(true);
3739

3840
while(appletMainLoop()) {
3941
ftp_loop();
@@ -81,6 +83,8 @@ void Menu_FTP(void) {
8183
}
8284
}
8385

86+
appletSetMediaPlaybackState(false);
87+
8488
free(hostname_disp);
8589
ftp_exit();
8690
nifmExit();

source/menus/menu_music.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ void Menu_PlayMusic(char *path) {
142142

143143
bool locked = false;
144144

145+
appletSetMediaPlaybackState(true);
146+
145147
while(appletMainLoop()) {
146148
SDL_ClearScreen(MUSIC_STATUS_BG_COLOUR);
147149

@@ -309,6 +311,8 @@ void Menu_PlayMusic(char *path) {
309311
}
310312
}
311313

314+
appletSetMediaPlaybackState(false);
315+
312316
free(filename);
313317
free(length_time);
314318
free(position_time);

0 commit comments

Comments
 (0)