Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/src/bms/player/beatoraja/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ public class Config implements Validatable {
private HashMap<String, String> obsScenes = new HashMap<>();
private HashMap<String, String> obsActions = new HashMap<>();

private boolean keepSilentWhenRenderFailed = false;

/**
* Bank of available tables
*
Expand Down Expand Up @@ -826,7 +828,15 @@ public void setObsAction(String stateName, String actionName) {
}
}

public boolean validate() {
public boolean isKeepSilentWhenRenderFailed() {
return keepSilentWhenRenderFailed;
}

public void setKeepSilentWhenRenderFailed(boolean keepSilentWhenRenderFailed) {
this.keepSilentWhenRenderFailed = keepSilentWhenRenderFailed;
}

public boolean validate() {
displaymode = (displaymode != null) ? displaymode : DisplayMode.WINDOW;
resolution = (resolution != null) ? resolution : Resolution.HD;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<CheckBox fx:id="usecim" mnemonicParsing="false" prefHeight="25.0" text="%CACHE_SKIN_IMAGE" />
<CheckBox fx:id="clipboardScreenshot" mnemonicParsing="false" prefHeight="25.0" text="%CLIPBOARD_SCREENSHOT" />
<CheckBox fx:id="keepSilentWhenRenderFailed" mnemonicParsing="false" prefHeight="25.0" text="%IGNORE_SKIN_OBJECT_RENDER_ERROR" />

<Button mnemonicParsing="false" onAction="#importScoreDataFromLR2" text="%IMPORT_LR2_SCORE">
<VBox.margin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ public class PlayConfigurationView implements Initializable {
@FXML
public CheckBox clipboardScreenshot;

@FXML
private CheckBox keepSilentWhenRenderFailed;

static void initComboBox(ComboBox<Integer> combo, final String[] values) {
combo.setCellFactory((param) -> new OptionListCell(values));
combo.setButtonCell(new OptionListCell(values));
Expand Down Expand Up @@ -477,6 +480,7 @@ public void update(Config config) {

usecim.setSelected(config.isCacheSkinImage());
clipboardScreenshot.setSelected(config.isSetClipboardWhenScreenshot());
keepSilentWhenRenderFailed.setSelected(config.isKeepSilentWhenRenderFailed());

enableIpfs.setSelected(config.isEnableIpfs());
ipfsurl.setText(config.getIpfsUrl());
Expand Down Expand Up @@ -625,6 +629,7 @@ public void commit() {
// jkoc_hack is integer but *.setJKOC needs boolean type

config.setCacheSkinImage(usecim.isSelected());
config.setKeepSilentWhenRenderFailed(keepSilentWhenRenderFailed.isSelected());

config.setEnableIpfs(enableIpfs.isSelected());
config.setIpfsUrl(ipfsurl.getText());
Expand Down
14 changes: 14 additions & 0 deletions core/src/bms/player/beatoraja/modmenu/SkinWidgetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import imgui.type.ImBoolean;
import imgui.type.ImFloat;

import java.awt.*;
import java.text.DecimalFormat;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
Expand Down Expand Up @@ -162,7 +164,15 @@ private static void renderSkinWidgetsTable() {
if (!isWidgetDrawingOnScreen) {
ImGui.pushStyleColor(ImGuiCol.Text, ImColor.rgb(128, 128, 128));
}
Exception error = widget.getError();
if (error != null) {
ImGui.pushStyleColor(ImGuiCol.Text, ImColor.rgb(Color.RED));
}
boolean isOpen = ImGui.treeNodeEx(widget.name);
if (error != null) {
ImGui.setItemTooltip(error.getMessage());
ImGui.popStyleColor();
}
if (!isWidgetDrawingOnScreen) {
ImGui.popStyleColor();
}
Expand Down Expand Up @@ -424,6 +434,10 @@ public boolean isDrawingOnScreen() {
return skinObject.draw && skinObject.visible;
}

public Exception getError() {
return skinObject.error;
}

public void toggleVisible() {
toggleVisible(true);
}
Expand Down
15 changes: 13 additions & 2 deletions core/src/bms/player/beatoraja/skin/Skin.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import bms.player.beatoraja.Resolution;
import bms.player.beatoraja.ShaderManager;
import bms.player.beatoraja.SkinConfig.Offset;
import bms.player.beatoraja.modmenu.ImGuiNotify;
import bms.player.beatoraja.skin.SkinObject.SkinOffset;
import bms.player.beatoraja.skin.property.BooleanProperty;
import bms.player.beatoraja.play.BMSPlayer;
Expand Down Expand Up @@ -309,8 +310,18 @@ public void drawAllObjects(SpriteBatch sprite, MainState state) {
}

for (SkinObject obj : objectarray) {
if (obj.draw && obj.visible) {
obj.draw(renderer);
if (obj.draw && obj.visible && obj.error == null) {
try {
obj.draw(renderer);
} catch (Exception e) {
logger.error("Error while rendering object", e);
if (state.main.getConfig().isKeepSilentWhenRenderFailed()) {
obj.error = e;
ImGuiNotify.error(String.format("Suppressing fatal error while rendering object: %s: %s", obj.getName(), e.getMessage()));
} else {
throw e;
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions core/src/bms/player/beatoraja/skin/SkinObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public abstract class SkinObject extends DisposableObject {
public boolean draw;
// Controlled by debugger instead of constraints defined by skin
public boolean visible = true;
public Exception error = null;
public Rectangle region = new Rectangle();
public Color color = new Color();
public int angle;
Expand Down
3 changes: 2 additions & 1 deletion core/src/resources/UIResources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,5 @@ PROGRESS_BMS_TITLE=Loading BMS
PROGRESS_TABLE_LABEL=Loading Table Info. Please wait warmly...
PROGRESS_TABLE_TITLE=Loading Table Info
MARK_AS_DOWNLOAD_DIRECTORY=Set DL Directory
MARK_AS_DOWNLOAD_DIRECTORY_HINT=Mark this directory as download directory
MARK_AS_DOWNLOAD_DIRECTORY_HINT=Mark this directory as download directory
IGNORE_SKIN_OBJECT_RENDER_ERROR=Keep running when errors occurred while rendering a skin object