Skip to content

Commit

Permalink
ALT sound fix
Browse files Browse the repository at this point in the history
  • Loading branch information
syd711 committed Feb 13, 2025
1 parent df2191b commit 9b17509
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

## Changes

- **Tables / ALT Sound**: Fixed error during loading of ALT sound bundles, caused by previous lazy-loading optimizations.
- **PinVOL Integration**: Fixed reading/writing of the **PinVolTables.ini** file, which may have caused duplicated entries.
- **VPin Mania**: Added automatic player restoring when you re-install VPin Studio and your cabinet was already registered.
- **VPin Mania**: The registration has been re-implemented so that you can immediately register your players and synchronize your highscores too.


---

Expand Down
2 changes: 1 addition & 1 deletion resources/vpsdb.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public AltSound load() {
AltSound altSound = new AltSound();
altSound.setFormat(AltSoundFormats.altsound);
altSound.setCsvFile(csvFile);
altSound.setFolder(csvFile.getParentFile().getAbsolutePath());
altSound.setName(csvFile.getParentFile().getName());
altSound.setModificationDate(new Date(csvFile.lastModified()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.mephisto.vpin.restclient.altsound.AltSound;
import de.mephisto.vpin.restclient.altsound.AltSoundFormats;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.configuration2.INIConfiguration;
import org.apache.commons.configuration2.SubnodeConfiguration;
import org.slf4j.Logger;
Expand All @@ -14,24 +15,29 @@
public class AltSoundLoaderFactory {
private final static Logger LOG = LoggerFactory.getLogger(AltSoundLoaderFactory.class);

@Nullable
public static AltSound create(@NonNull File altSoundFolder, int emulatorId) {
File ini = new File(altSoundFolder, "altsound.ini");
File gSoundCsv = new File(altSoundFolder, "g-sound.csv");
File altSoundCsv = new File(altSoundFolder, "altsound.csv");

AltSound altSound = new AltSound();
altSound.setName(altSoundFolder.getParentFile().getName());
altSound.setFolder(altSoundFolder.getAbsolutePath());

if (ini.exists() || gSoundCsv.exists() || altSoundCsv.exists()) {
altSound.setEmulatorId(emulatorId);
altSound.setName(altSoundFolder.getParentFile().getName());
altSound.setFolder(altSoundFolder.getAbsolutePath());
return altSound;
}
return null;
}

@NonNull
public static AltSound load(@NonNull AltSound altSound) {
return load(new File(altSound.getFolder()), altSound.getEmulatorId());
String folder = altSound.getFolder();
File altSoundFolder = new File(folder);
return load(altSoundFolder, altSound.getEmulatorId());
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ public boolean delete(@NonNull Game game) {
@NonNull
public AltSound getAltSound(@NonNull Game game) {
if (isAltSoundAvailable(game)) {
AltSound altSound = altSoundFolder2AltSound.get(game.getAltSoundFolder().getAbsolutePath());
String folder = game.getAltSoundFolder().getAbsolutePath();
AltSound altSound = altSoundFolder2AltSound.get(folder);
altSound = AltSoundLoaderFactory.load(altSound);
altSoundFolder2AltSound.put(game.getAltSoundFolder().getAbsolutePath(), altSound);
altSoundFolder2AltSound.put(folder, altSound);
return altSound;
}
return new AltSound();
Expand Down Expand Up @@ -156,7 +157,12 @@ public boolean accept(File dir, String name) {
private void createAltSound(@Nullable File altSoundDir, int emualtorId) {
if (altSoundDir != null) {
AltSound altSound = AltSoundLoaderFactory.create(altSoundDir, emualtorId);
altSoundFolder2AltSound.put(altSoundDir.getAbsolutePath(), altSound);
if (altSound != null) {
altSoundFolder2AltSound.put(altSoundDir.getAbsolutePath(), altSound);
}
else {
LOG.warn("Skipped caching ALT sound '{}'", altSoundDir.getName());
}
}
}

Expand Down

0 comments on commit 9b17509

Please sign in to comment.