Skip to content

Commit fc378fe

Browse files
committed
feat: force logback version consistency and add physics/input settings to VN state serialization
1 parent 2b47282 commit fc378fe

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ subprojects {
3939
substitute(module("com.jvn:scripting")).using(project(":scripting"))
4040
substitute(module("com.jvn:audio-integration")).using(project(":audio-integration"))
4141
}
42+
// Force consistent logback to avoid mixed versions at runtime
43+
resolutionStrategy.force(
44+
"ch.qos.logback:logback-classic:1.5.6",
45+
"ch.qos.logback:logback-core:1.5.6"
46+
)
4247
}
4348

4449
extensions.configure<org.gradle.api.publish.PublishingExtension> {

runtime/src/main/java/com/jvn/runtime/JesVnBridge.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private VnScene loadVnScene(String script, VnScene current) throws Exception {
8080
vn.setInterop(new RuntimeVnInterop(engine));
8181
VnSettings settings = new VnSettings();
8282
if (current != null) copySettings(current.getState(), settings);
83-
vn.getState().setSettings(settings);
83+
copySettingsIntoState(settings, vn.getState());
8484
if (current != null && current.getAudioFacade() != null) {
8585
vn.setAudioFacade(current.getAudioFacade());
8686
}
@@ -106,6 +106,29 @@ private static void copySettings(VnState from, VnSettings to) {
106106
to.setAutoPlayDelay(s.getAutoPlayDelay());
107107
to.setSkipUnreadText(s.isSkipUnreadText());
108108
to.setSkipAfterChoices(s.isSkipAfterChoices());
109+
to.setPhysicsFixedStepMs(s.getPhysicsFixedStepMs());
110+
to.setPhysicsMaxSubSteps(s.getPhysicsMaxSubSteps());
111+
to.setPhysicsDefaultFriction(s.getPhysicsDefaultFriction());
112+
to.setInputProfilePath(s.getInputProfilePath());
113+
to.setInputProfileSerialized(s.getInputProfileSerialized());
114+
}
115+
116+
private static void copySettingsIntoState(VnSettings src, VnState state) {
117+
if (src == null || state == null) return;
118+
VnSettings dst = state.getSettings();
119+
if (dst == null) return;
120+
dst.setTextSpeed(src.getTextSpeed());
121+
dst.setBgmVolume(src.getBgmVolume());
122+
dst.setSfxVolume(src.getSfxVolume());
123+
dst.setVoiceVolume(src.getVoiceVolume());
124+
dst.setAutoPlayDelay(src.getAutoPlayDelay());
125+
dst.setSkipUnreadText(src.isSkipUnreadText());
126+
dst.setSkipAfterChoices(src.isSkipAfterChoices());
127+
dst.setPhysicsFixedStepMs(src.getPhysicsFixedStepMs());
128+
dst.setPhysicsMaxSubSteps(src.getPhysicsMaxSubSteps());
129+
dst.setPhysicsDefaultFriction(src.getPhysicsDefaultFriction());
130+
dst.setInputProfilePath(src.getInputProfilePath());
131+
dst.setInputProfileSerialized(src.getInputProfileSerialized());
109132
}
110133

111134
private static String str(Map<String,Object> props, String key, String def) {

0 commit comments

Comments
 (0)