Skip to content

Commit

Permalink
Disabled serum
Browse files Browse the repository at this point in the history
  • Loading branch information
syd711 committed Nov 9, 2024
1 parent 980687e commit 9c2431d
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 17 deletions.
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 @@ -4,7 +4,9 @@ public enum ComponentType {
//do not change order of declaration, ordinal is used in DB
vpinmame(1), vpinball(0), b2sbackglass(2), freezy(3), flexdmd(4), serum(5), doflinx(6);

/** The order for display */
/**
* The order for display
*/
private int order;

ComponentType(int order) {
Expand All @@ -15,6 +17,10 @@ public int getOrder() {
return order;
}

public static ComponentType[] getValues() {
return new ComponentType[]{vpinmame, vpinball, b2sbackglass, freezy, flexdmd, doflinx};
}

@Override
public String toString() {
switch (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ComponentService implements InitializingBean {

public List<Component> getComponents() {
List<Component> result = new ArrayList<>();
ComponentType[] values = ComponentType.values();
ComponentType[] values = ComponentType.getValues();
// sort by visibility order
Arrays.sort(values, (a, b) -> a.getOrder() - b.getOrder());

Expand Down Expand Up @@ -291,7 +291,7 @@ public ComponentFacade getComponentFacade(ComponentType type) {

@Override
public void afterPropertiesSet() throws Exception {
ComponentType[] values = ComponentType.values();
ComponentType[] values = ComponentType.getValues();
for (ComponentType value : values) {
this.releaseCache.put(value, new ArrayList<>());
Optional<Component> byName = componentRepository.findByType(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import de.mephisto.vpin.restclient.components.ComponentType;
import de.mephisto.vpin.restclient.components.GithubReleaseRepresentation;
import de.mephisto.vpin.server.components.facades.ComponentFacade;
import de.mephisto.vpin.server.games.GameEmulator;
import de.mephisto.vpin.server.frontend.FrontendService;
import de.mephisto.vpin.server.games.GameEmulator;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -121,9 +122,16 @@ private ComponentRepresentation toComponentRepresentation(Component component) {
if (defaultGameEmulator != null) {
try {
representation.setLastModified(componentFacade.getModificationDate(defaultGameEmulator));
representation.setTargetFolder(componentFacade.getTargetFolder(defaultGameEmulator).getAbsolutePath());
} catch (Exception e) {
LOG.error("Error returning component data: " + e.getMessage(), e);
File targetFolder = componentFacade.getTargetFolder(defaultGameEmulator);
if (targetFolder != null) {
representation.setTargetFolder(targetFolder.getAbsolutePath());
}
else {
LOG.warn("No target folder resolved for {}", component);
}
}
catch (Exception e) {
LOG.error("Error returning component data for " + component + ": " + e.getMessage(), e);
}
}
return representation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public List<GithubRelease> loadReleases() throws IOException {
@Nullable
@Override
public File getTargetFolder(@NonNull GameEmulator gameEmulator) {
File folder = backglassService.getBackglassServerFolder();
if (folder == null) {
folder = new File("c:/vPinball/B2SServer");
}
return folder;
return backglassService.getBackglassServerFolder();
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ default boolean isInstalled() {
return true;
}

/**
* Executed after the installation of an update.
* @param gameEmulator
* @param releaseArtifact
* @param install
*/
default void postProcess(@NonNull GameEmulator gameEmulator, @NonNull ReleaseArtifact releaseArtifact, @NonNull ReleaseArtifactActionLog install) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import de.mephisto.vpin.connectors.github.GithubRelease;
import de.mephisto.vpin.connectors.github.GithubReleaseFactory;
import de.mephisto.vpin.connectors.github.ReleaseArtifact;
import de.mephisto.vpin.connectors.github.ReleaseArtifactActionLog;
import de.mephisto.vpin.restclient.util.FileUtils;
import de.mephisto.vpin.server.games.GameEmulator;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;

import java.io.File;
Expand All @@ -16,6 +20,9 @@

@Service
public class FreezyComponent implements ComponentFacade {

private final static List<String> INVALID_MAME_FILES = Arrays.asList("serum.dll", "serum.exp", "serum.lib", "serum64.dll", "serum64.exp", "serum64.lib");

@NonNull
@Override
public String[] getDiffList() {
Expand Down Expand Up @@ -52,6 +59,13 @@ public Date getModificationDate(@NonNull GameEmulator gameEmulator) {
return null;
}

@Override
public void postProcess(@NotNull GameEmulator gameEmulator, @NotNull ReleaseArtifact releaseArtifact, @NotNull ReleaseArtifactActionLog install) {
for (String deleteFile : INVALID_MAME_FILES) {
FileUtils.delete(new File(gameEmulator.getMameFolder(), deleteFile));
}
}

@Nullable
@Override
public List<String> getExcludedFilenames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ComponentChecksProgressModel extends ProgressModel<ComponentType> {
public ComponentChecksProgressModel(boolean forceDownload) {
super("Fetching Latest Github Releases");
this.forceDownload = forceDownload;
this.iterator = Arrays.asList(ComponentType.values()).iterator();
this.iterator = Arrays.asList(ComponentType.getValues()).iterator();
}

@Override
Expand All @@ -54,7 +54,7 @@ public String nextToString(ComponentType c) {

@Override
public int getMax() {
return ComponentType.values().length;
return ComponentType.getValues().length;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
loadTab(mameTab, "tab-mame.fxml");
loadTab(flexDMDTab, "tab-flexdmd.fxml");
loadTab(freezyTab, "tab-freezy.fxml");
loadTab(serumTab, "tab-serum.fxml");
// loadTab(serumTab, "tab-serum.fxml");
loadTab(doflinxTab, "tab-doflinx.fxml");

tabPane.getSelectionModel().selectedIndexProperty().addListener((observableValue, number, t1) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<Tab fx:id="b2sTab" closable="false" text="B2S Server" />
<Tab fx:id="freezyTab" closable="false" text="Freezy" />
<Tab fx:id="flexDMDTab" closable="false" text="FlexDMD" />
<Tab fx:id="serumTab" closable="false" text="Serum" />
<!-- <Tab fx:id="serumTab" closable="false" text="Serum" />-->
<Tab fx:id="doflinxTab" closable="false" text="DOFLinx" />
</tabs>
</TabPane>
Expand Down

0 comments on commit 9c2431d

Please sign in to comment.