Index: main_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/main_menu.c,v
retrieving revision 1.53
diff -u -b -r1.53 main_menu.c
--- main_menu.c	28 Aug 2002 18:01:55 -0000	1.53
+++ main_menu.c	30 Aug 2002 06:10:44 -0000
@@ -186,6 +186,12 @@
     return MENU_OK;
 }
 
+Menu resume_now(void)
+{
+    start_resume();
+    return MENU_OK;
+}
+
 Menu main_menu(void)
 {
     int m;
@@ -206,6 +212,7 @@
 #else
         { "USB (sim)",          simulate_usb      },
 #endif
+        { "Resume Now",         resume_now        },
     };
 
     m=menu_init( items, sizeof items / sizeof(struct menu_items) );
Index: tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.104
diff -u -b -r1.104 tree.c
--- tree.c	28 Aug 2002 14:03:55 -0000	1.104
+++ tree.c	30 Aug 2002 06:10:45 -0000
@@ -337,6 +337,7 @@
 
 void start_resume(void)
 {
+    int rc;
     if ( global_settings.resume &&
          global_settings.resume_index != -1 ) {
         int len = strlen(global_settings.resume_file);
@@ -408,7 +409,11 @@
 
         status_set_playmode(STATUS_PLAY);
         status_draw();
-        wps_show();
+        rc = wps_show();
+        if(rc == SYS_USB_CONNECTED)
+        {
+            start_resume();
+        }
     }
 }
 
@@ -519,7 +524,6 @@
                     lcd_stop_scroll();
                     if(dircache[dircursor+start].attr & TREE_ATTR_M3U )
                     {
-                        if ( global_settings.resume )
                             snprintf(global_settings.resume_file,
                                      MAX_PATH, "%s/%s",
                                      currdir,
@@ -532,7 +536,6 @@
                         start_index = 0;
                     }
                     else if (dircache[dircursor+start].attr & TREE_ATTR_MPA ) {
-                        if ( global_settings.resume )
                             strncpy(global_settings.resume_file,
                                     currdir, MAX_PATH);
                         start_index = build_playlist(dircursor+start);
@@ -545,12 +548,12 @@
                     else
                         break;
 
-                    if ( global_settings.resume ) {
                         /* the resume_index must always be the index in the
                            shuffled list in case shuffle is enabled */
                         global_settings.resume_index = start_index;
                         global_settings.resume_offset = 0;
                         global_settings.resume_seed = seed;
+                    if ( global_settings.resume ) {
                         settings_save();
                     }
 
@@ -566,7 +569,8 @@
                         dirlevel = 0;
                         dircursor = 0;
                         start = 0;
-                        global_settings.resume_index = -1;
+                    
+                        start_resume();
                     }
                 }
                 restore = true;
@@ -674,6 +678,8 @@
                         dirlevel = 0;
                         dircursor = 0;
                         start = 0;
+                    
+                        start_resume();
                     }
                     restore = true;
                 }
@@ -699,6 +705,8 @@
 #ifdef HAVE_LCD_BITMAP
                 bool laststate=statusbar(false);
 #endif
+                bool was_playing = mpeg_is_playing();
+
                 /* Tell the USB thread that we are safe */
                 DEBUGF("dirbrowse got SYS_USB_CONNECTED\n");
                 usb_acknowledge(SYS_USB_CONNECTED_ACK);
@@ -716,6 +724,9 @@
 #ifdef HAVE_LCD_BITMAP
                 statusbar(laststate);
 #endif
+                if (was_playing) {
+                    start_resume();
+                }
             }
             break;
 #endif
Index: tree.h
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.h,v
retrieving revision 1.1.1.1
diff -u -b -r1.1.1.1 tree.h
--- tree.h	16 May 2002 12:53:41 -0000	1.1.1.1
+++ tree.h	30 Aug 2002 06:10:45 -0000
@@ -23,5 +23,6 @@
 
 void browse_root(void);
 bool dirbrowse(char *root);
+void start_resume(void);
 
 #endif

