Skip to content

Commit f8bfe44

Browse files
committed
4.6.3
1 parent ff16670 commit f8bfe44

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
## Release Notes 4.6.3
22

3-
## Changes
3+
## Changes (including a breaking one!)
44

55
- **Server Startup**: Handled possible error in the screen resolving which caused the server not to start for some users.
66
- **File Uploads** Fixed issue that various files have been locked from the Studio client after uploading.
7+
- **Monitor Detection**: Fixed possible issue where the order of monitors changed. **Unfortunately this is a breaking change and you might need to reconfigure the monitor for the overlay, pause menu and notifications!**
78

89
---
910

resources/vpsdb.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

vpin-studio-server/src/main/java/de/mephisto/vpin/server/mania/ManiaService.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@
3636
import org.springframework.context.ApplicationListener;
3737
import org.springframework.stereotype.Service;
3838

39-
import javax.annotation.PreDestroy;
4039
import javax.imageio.ImageIO;
4140
import java.awt.image.BufferedImage;
4241
import java.io.ByteArrayInputStream;
42+
import java.io.File;
43+
import java.nio.file.Files;
44+
import java.nio.file.Path;
45+
import java.nio.file.Paths;
4346
import java.util.ArrayList;
4447
import java.util.Collections;
4548
import java.util.Date;
@@ -52,6 +55,9 @@
5255
public class ManiaService implements InitializingBean, FrontendStatusChangeListener, PreferenceChangedListener, TableStatusChangeListener, GameDataChangedListener, GameLifecycleListener, ApplicationListener<ApplicationReadyEvent> {
5356
private final static Logger LOG = LoggerFactory.getLogger(ManiaService.class);
5457

58+
//the file contains the UUID of the cabinet
59+
public static final String VPIN_MANIA_ID_TXT = ".vpin-mania-id.txt";
60+
5561
@Value("${vpinmania.server.host}")
5662
private String maniaHost;
5763

@@ -493,6 +499,9 @@ public void preferenceChanged(String propertyName, Object oldValue, Object newVa
493499
if (propertyName.equals(PreferenceNames.MANIA_SETTINGS)) {
494500
maniaSettings = preferencesService.getJsonPreference(PreferenceNames.MANIA_SETTINGS, ManiaSettings.class);
495501
cabinet = maniaClient.getCabinetClient().getCabinet();
502+
if (cabinet != null) {
503+
updateIdFile(cabinet.getUuid());
504+
}
496505
}
497506
}
498507

@@ -577,6 +586,11 @@ public void afterPropertiesSet() throws Exception {
577586

578587
preferencesService.addChangeListener(this);
579588
maniaSettings = preferencesService.getJsonPreference(PreferenceNames.MANIA_SETTINGS, ManiaSettings.class);
589+
590+
if (cabinet != null) {
591+
updateIdFile(cabinet.getUuid());
592+
}
593+
580594
new Thread(() -> {
581595
setOnline(cabinet);
582596
}).start();
@@ -589,6 +603,23 @@ public void afterPropertiesSet() throws Exception {
589603
LOG.info("{} initialization finished.", this.getClass().getSimpleName());
590604
}
591605

606+
private static void updateIdFile(@NonNull String uuid) {
607+
try {
608+
String localAppData = System.getenv("LOCALAPPDATA");
609+
Path appDataPath = Paths.get(localAppData, "VPin-Studio");
610+
Files.createDirectories(appDataPath);
611+
File idFile = new File(appDataPath.toFile(), VPIN_MANIA_ID_TXT);
612+
if (idFile.exists() && !idFile.delete()) {
613+
LOG.error("Failed to delete mania id file");
614+
return;
615+
}
616+
Files.writeString(idFile.toPath(), uuid);
617+
}
618+
catch (Exception e) {
619+
LOG.error("Failed to write mania id file: {}", e.getMessage());
620+
}
621+
}
622+
592623
public Cabinet getCabinet() {
593624
return this.cabinet;
594625
}

0 commit comments

Comments
 (0)