More optimizations: don't load OsuFile array fields until needed.

When cached, defer loading of timing points, breaks, and combo colors until directly before a game.  Potentially cuts loading time by 50%, and saves a bit of memory.

Other changes:
- Don't store the default combo colors in the cache.
- Removed some PreparedStatements that only get executed once.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-03-08 03:05:01 -04:00
parent f8e91cba64
commit f9878f4fa4
4 changed files with 54 additions and 22 deletions

View File

@@ -1284,8 +1284,13 @@ public class SongMenu extends BasicGameState {
SoundController.playSound(SoundEffect.MENUHIT);
OsuFile osu = MusicController.getOsuFile();
Display.setTitle(String.format("%s - %s", game.getTitle(), osu.toString()));
// load any missing data
if (osu.timingPoints == null || osu.combo == null)
OsuDB.load(osu, OsuDB.LOAD_ARRAY);
OsuParser.parseHitObjects(osu);
HitSound.setDefaultSampleSet(osu.sampleSet);
MultiClip.destroyExtraClips();
((Game) game.getState(Opsu.STATE_GAME)).setRestart(Game.Restart.NEW);
game.enterState(Opsu.STATE_GAME, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));