From e2dbe80bc513d185c98b6af581c72c04a5337f8d Mon Sep 17 00:00:00 2001 From: Matthias Faust Date: Mon, 23 Dec 2024 14:52:15 +0100 Subject: [PATCH] Improved highscore parser --- RELEASE_NOTES.md | 8 +++++++ .../server/highscores/HighscoreResolver.java | 5 ++++ .../highscores/parsing/vpreg/VPReg.java | 23 +++++++++---------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c91a43f33..d8fca0a5a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,11 @@ +## Release Notes 3.11.2 + +## Bugfixes + +- **Tables / Highscore Parsing**: Improved detection of VPReg.stg based highscore entries. The lookup is now completely case-insensitive. Also, an additional lookup is made using the ROM name plus the **_VPX** suffix which some tables use to store the highscore. + +--- + ## Release Notes 3.11.1 ## Bugfixes diff --git a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/HighscoreResolver.java b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/HighscoreResolver.java index 10bdbff91..71d4ecdd9 100644 --- a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/HighscoreResolver.java +++ b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/HighscoreResolver.java @@ -152,6 +152,11 @@ private String readVPRegHighscore(Game game, HighscoreMetadata metadata) throws File vpRegFile = game.getEmulator().getVPRegFile(); VPReg reg = new VPReg(vpRegFile, game.getRom(), tableName); + + if (!reg.containsGame()) { + reg = new VPReg(vpRegFile, game.getRom() + "_VPX", tableName); + } + if (reg.containsGame()) { metadata.setType(HighscoreType.VPReg); metadata.setFilename(vpRegFile.getCanonicalPath()); diff --git a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/parsing/vpreg/VPReg.java b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/parsing/vpreg/VPReg.java index 4ee56df31..f97c33ae6 100644 --- a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/parsing/vpreg/VPReg.java +++ b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/highscores/parsing/vpreg/VPReg.java @@ -312,20 +312,19 @@ public ScoreParsingSummary readHighscores() { * @throws FileNotFoundException */ private DirectoryEntry getGameDirectory(DirectoryEntry root) throws FileNotFoundException { - if (root.hasEntry(rom)) { - return (DirectoryEntry) root.getEntry(rom); - } - - if (root.hasEntry(rom.toLowerCase())) { - return (DirectoryEntry) root.getEntry(rom.toLowerCase()); - } - - if (tablename != null && root.hasEntry(tablename)) { - return (DirectoryEntry) root.getEntry(tablename); + Set entryNames = root.getEntryNames(); + for (String entryName : entryNames) { + if (entryName.equalsIgnoreCase(rom)) { + return (DirectoryEntry) root.getEntry(entryName); + } } - if (tablename != null && root.hasEntry(tablename.toLowerCase())) { - return (DirectoryEntry) root.getEntry(tablename.toLowerCase()); + if (tablename != null) { + for (String entryName : entryNames) { + if (entryName.equalsIgnoreCase(tablename)) { + return (DirectoryEntry) root.getEntry(entryName); + } + } } return null;