diff --git a/src/itdelatrisu/opsu/GameImage.java b/src/itdelatrisu/opsu/GameImage.java index 411188d0..c8cb3bfb 100644 --- a/src/itdelatrisu/opsu/GameImage.java +++ b/src/itdelatrisu/opsu/GameImage.java @@ -390,7 +390,7 @@ public enum GameImage { private static final int UNSCALED_HEIGHT = 768; /** Filename suffix for HD images. */ - private static final String HD_SUFFIX = "@2x"; + public static final String HD_SUFFIX = "@2x"; /** Image HD/SD suffixes. */ private static final String[] diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 292aa951..83232825 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -284,7 +284,7 @@ public class Options { }, ENABLE_THEME_SONG ("Enable Theme Song", "Whether to play the theme song upon starting opsu!", true), SHOW_HIT_ERROR_BAR ("Show Hit Error Bar", "Shows precisely how accurate you were with each hit.", false), - LOAD_HD_IMAGES ("Load HD Images", "Loads HD (@2x) images when available. Increases memory usage and loading times.", true), + LOAD_HD_IMAGES ("Load HD Images", String.format("Loads HD (%s) images when available. Increases memory usage and loading times.", GameImage.HD_SUFFIX), true), DISABLE_MOUSE_WHEEL ("Disable mouse wheel in play mode", "During play, you can use the mouse wheel to adjust the volume and pause the game.\nThis will disable that functionality.", false), DISABLE_MOUSE_BUTTONS ("Disable mouse buttons in play mode", "This option will disable all mouse buttons.\nSpecifically for people who use their keyboard to click.", false); diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapImageCache.java b/src/itdelatrisu/opsu/beatmap/BeatmapImageCache.java index 95e05c85..fdf502f9 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapImageCache.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapImageCache.java @@ -63,7 +63,7 @@ public class BeatmapImageCache { /** * Returns the image mapped to the specified beatmap. - * @param beatmap the Beatmap + * @param beatmap the Beatmap * @return the Image, or {@code null} if no such mapping exists */ public Image get(Beatmap beatmap) { return cache.get(beatmap.bg); } diff --git a/src/itdelatrisu/opsu/db/BeatmapDB.java b/src/itdelatrisu/opsu/db/BeatmapDB.java index fc7a160c..6f0fcca0 100644 --- a/src/itdelatrisu/opsu/db/BeatmapDB.java +++ b/src/itdelatrisu/opsu/db/BeatmapDB.java @@ -335,7 +335,7 @@ public class BeatmapDB { stmt.setBoolean(33, beatmap.letterboxInBreaks); stmt.setBoolean(34, beatmap.widescreenStoryboard); stmt.setBoolean(35, beatmap.epilepsyWarning); - stmt.setString(36, beatmap.bg.getName()); + stmt.setString(36, (beatmap.bg == null) ? null : beatmap.bg.getName()); stmt.setString(37, beatmap.sliderBorderToString()); stmt.setString(38, beatmap.timingPointsToString()); stmt.setString(39, beatmap.breaksToString()); @@ -444,6 +444,7 @@ public class BeatmapDB { */ private static void setBeatmapFields(ResultSet rs, Beatmap beatmap) throws SQLException { try { + File dir = beatmap.getFile().getParentFile(); beatmap.beatmapID = rs.getInt(4); beatmap.beatmapSetID = rs.getInt(5); beatmap.title = BeatmapParser.getDBString(rs.getString(6)); @@ -466,7 +467,7 @@ public class BeatmapDB { beatmap.bpmMin = rs.getInt(23); beatmap.bpmMax = rs.getInt(24); beatmap.endTime = rs.getInt(25); - beatmap.audioFilename = new File(beatmap.getFile().getParentFile(), BeatmapParser.getDBString(rs.getString(26))); + beatmap.audioFilename = new File(dir, BeatmapParser.getDBString(rs.getString(26))); beatmap.audioLeadIn = rs.getInt(27); beatmap.previewTime = rs.getInt(28); beatmap.countdown = rs.getByte(29); @@ -476,7 +477,9 @@ public class BeatmapDB { beatmap.letterboxInBreaks = rs.getBoolean(33); beatmap.widescreenStoryboard = rs.getBoolean(34); beatmap.epilepsyWarning = rs.getBoolean(35); - beatmap.bg = new File(beatmap.getFile().getParentFile(), BeatmapParser.getDBString(rs.getString(36))); + String bg = rs.getString(36); + if (bg != null) + beatmap.bg = new File(dir, BeatmapParser.getDBString(rs.getString(36))); beatmap.sliderBorderFromString(rs.getString(37)); } catch (SQLException e) { throw e; diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index d1b3003e..1cb85431 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -59,6 +59,7 @@ public class OptionsMenu extends BasicGameState { GameOption.SCREENSHOT_FORMAT, GameOption.NEW_CURSOR, GameOption.DYNAMIC_BACKGROUND, + GameOption.LOAD_HD_IMAGES, GameOption.LOAD_VERBOSE }), MUSIC ("Music", new GameOption[] { @@ -91,8 +92,7 @@ public class OptionsMenu extends BasicGameState { GameOption.FIXED_HP, GameOption.FIXED_AR, GameOption.FIXED_OD, - GameOption.CHECKPOINT, - GameOption.LOAD_HD_IMAGES + GameOption.CHECKPOINT }); /** Total number of tabs. */