@@ -124,6 +124,102 @@ void SongManager::Reload( bool bAllowFastLoad, LoadingWindow *ld )
124
124
UpdatePreferredSort ();
125
125
}
126
126
127
+ // See InitSongsFromDisk for any comment clarification -mina
128
+ int SongManager::DifferentialReload () {
129
+ int newsongs = 0 ;
130
+ SONGINDEX->delay_save_cache = true ;
131
+ newsongs += DifferentialReloadDir (SpecialFiles::SONGS_DIR);
132
+
133
+ const bool bOldVal = PREFSMAN->m_bFastLoad ;
134
+ PREFSMAN->m_bFastLoad .Set (PREFSMAN->m_bFastLoadAdditionalSongs );
135
+ newsongs += DifferentialReloadDir (ADDITIONAL_SONGS_DIR);
136
+ PREFSMAN->m_bFastLoad .Set (bOldVal);
137
+ LoadEnabledSongsFromPref ();
138
+ SONGINDEX->SaveCacheIndex ();
139
+ SONGINDEX->delay_save_cache = false ;
140
+
141
+ return newsongs;
142
+ }
143
+
144
+ // See LoadStepManiaSongDir for any comment clarification -mina
145
+ int SongManager::DifferentialReloadDir (string dir) {
146
+ if (dir.substr (dir.size ()) != " /" )
147
+ dir += " /" ;
148
+
149
+ int newsongs = 0 ;
150
+
151
+ vector<RString> arrayGroupDirs;
152
+ GetDirListing (dir + " *" , arrayGroupDirs, true );
153
+ StripCvsAndSvn (arrayGroupDirs);
154
+ StripMacResourceForks (arrayGroupDirs);
155
+ SortRStringArray (arrayGroupDirs);
156
+
157
+ vector< vector<RString> > arrayGroupSongDirs;
158
+ int groupIndex, songCount, songIndex;
159
+
160
+ groupIndex = 0 ;
161
+ songCount = 0 ;
162
+ FOREACH_CONST (RString, arrayGroupDirs, s) {
163
+ RString sGroupDirName = *s;
164
+ SanityCheckGroupDir (dir + sGroupDirName );
165
+
166
+ vector<RString> arraySongDirs;
167
+ GetDirListing (dir + sGroupDirName + " /*" , arraySongDirs, true , true );
168
+ StripCvsAndSvn (arraySongDirs);
169
+ StripMacResourceForks (arraySongDirs);
170
+ SortRStringArray (arraySongDirs);
171
+
172
+ arrayGroupSongDirs.push_back (arraySongDirs);
173
+ songCount += arraySongDirs.size ();
174
+ }
175
+
176
+ if (songCount == 0 ) return 0 ;
177
+
178
+ groupIndex = 0 ;
179
+ songIndex = 0 ;
180
+
181
+ FOREACH_CONST (RString, arrayGroupDirs, s) {
182
+ RString sGroupDirName = *s;
183
+ vector<RString> &arraySongDirs = arrayGroupSongDirs[groupIndex++];
184
+ int loaded = 0 ;
185
+
186
+ SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupDirName ];
187
+ RString group_base_name = Basename (sGroupDirName );
188
+ for (size_t j = 0 ; j < arraySongDirs.size (); ++j) {
189
+ RString sSongDirName = arraySongDirs[j];
190
+
191
+ // skip any dir we've already loaded -mina
192
+ RString hur = sSongDirName + " /" ;
193
+ hur.MakeLower ();
194
+ if (m_SongsByDir.count (hur))
195
+ continue ;
196
+
197
+ Song* pNewSong = new Song;
198
+ if (!pNewSong->LoadFromSongDir (sSongDirName )) {
199
+ delete pNewSong;
200
+ continue ;
201
+ }
202
+
203
+ AddSongToList (pNewSong);
204
+ AddKeyedPointers (pNewSong);
205
+
206
+ index_entry.push_back (pNewSong);
207
+
208
+ loaded++;
209
+ songIndex++;
210
+ newsongs++;
211
+ }
212
+
213
+ LOG->Trace (" Differential load of %i songs from \" %s\" " , loaded, (dir + sGroupDirName ).c_str ());
214
+ if (!loaded) continue ;
215
+
216
+ AddGroup (dir, sGroupDirName );
217
+ BANNERCACHE->CacheBanner (GetSongGroupBannerPath (sGroupDirName ));
218
+ LoadGroupSymLinks (dir, sGroupDirName );
219
+ }
220
+ return newsongs;
221
+ }
222
+
127
223
void SongManager::InitSongsFromDisk ( LoadingWindow *ld )
128
224
{
129
225
RageTimer tm;
@@ -140,7 +236,7 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld )
140
236
SONGINDEX->SaveCacheIndex ();
141
237
SONGINDEX->delay_save_cache = false ;
142
238
143
- LOG->Trace ( " Found %d songs in %f seconds." , ( int ) m_pSongs.size (), tm.GetDeltaTime () );
239
+ LOG->Trace ( " Found %i songs in %f seconds." , m_pSongs.size (), tm.GetDeltaTime () );
144
240
}
145
241
146
242
void Chart::FromKey (const string& ck) {
0 commit comments