yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.45k stars 1.56k forks source link

Pressing the "Mods" button causes the game to crash #5154

Closed not-navyblue closed 3 years ago

not-navyblue commented 3 years ago

Platform Operating system type, major version, architecture (64/32 bit).

Version Where you got the game and the exact version number.

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Press the "Mods" button
  2. Crash happens

If game data is required, please add it here. From the menu, choose save game (or map), copy to clipboard, and paste here between the backtick blocks (or, if no such save is required, you may delete this):

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

SomeTroglodyte commented 3 years ago

Friggin' nasty to repro. I dug out a medieval Java 8 201 to even get console logging, the built-in eats all helpful output.

dump ``` Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ExceptionInInitializerError at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:134) Caused by: java.lang.ExceptionInInitializerError at com.unciv.MainMenuScreen$modsTable$1.invoke(MainMenuScreen.kt:126) at com.unciv.MainMenuScreen$modsTable$1.invoke(MainMenuScreen.kt:125) at com.unciv.ui.utils.ExtensionFunctionsKt$onClick$1.invoke(ExtensionFunctions.kt:64) at com.unciv.ui.utils.ExtensionFunctionsKt$onClick$1.invoke(ExtensionFunctions.kt:64) at com.unciv.ui.utils.ExtensionFunctionsKt$onClickEvent$1.clicked(ExtensionFunctions.kt:57) at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:88) at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:71) at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:355) at com.badlogic.gdx.InputEventQueue.drain(InputEventQueue.java:70) at com.badlogic.gdx.backends.lwjgl.DefaultLwjglInput.processEvents(DefaultLwjglInput.java:255) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:220) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: jsons\ManuallyBlockedMods.json (Absolute) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:150) at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:210) at com.unciv.JsonParser.getFromJson(JsonParser.kt:14) at com.unciv.ui.pickerscreens.ModManagementScreen.(ModManagementScreen.kt:514) ... 12 more Caused by: java.io.FileNotFoundException: jsons\ManuallyBlockedMods.json (Le système ne trouve pas ce fichier) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(Unknown Source) at java.io.FileInputStream.(Unknown Source) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:146) ... 15 more Exception in thread "Sound" com.badlogic.gdx.utils.GdxRuntimeException: Error creating sound com.badlogic.gdx.backends.lwjgl.audio.Mp3$Sound for file: sounds/click.mp3 at com.badlogic.gdx.backends.lwjgl.audio.OpenALLwjglAudio.newSound(OpenALLwjglAudio.java:122) at com.badlogic.gdx.backends.lwjgl.audio.OpenALLwjglAudio.newSound(OpenALLwjglAudio.java:41) at com.unciv.ui.utils.Sounds.get(Sounds.kt:143) at com.unciv.ui.utils.Sounds.play(Sounds.kt:163) at com.unciv.ui.utils.ExtensionFunctionsKt$onClickEvent$1$clicked$1.invoke(ExtensionFunctions.kt:56) at com.unciv.ui.utils.ExtensionFunctionsKt$onClickEvent$1$clicked$1.invoke(ExtensionFunctions.kt:56) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.badlogic.gdx.backends.lwjgl.audio.OpenALLwjglAudio.newSound(OpenALLwjglAudio.java:120) ... 6 more Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading audio data. at com.badlogic.gdx.backends.lwjgl.audio.Mp3$Sound.(Mp3.java:138) ... 11 more Caused by: java.lang.UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalBufferData(IIJII)V at org.lwjgl.openal.AL10.nalBufferData(Native Method) at org.lwjgl.openal.AL10.alBufferData(AL10.java:1161) at com.badlogic.gdx.backends.lwjgl.audio.OpenALSound.setup(OpenALSound.java:52) at com.badlogic.gdx.backends.lwjgl.audio.Mp3$Sound.(Mp3.java:136) ... 11 more ```

... still analyzing. Looks like an internal/external mismatch, but better look thoroughly.

xlenstra commented 3 years ago

This part looks interesting:

Caused by: java.io.FileNotFoundException: jsons\ManuallyBlockedMods.json (Le système ne trouve pas ce fichier)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:146)

Wrong slash symbol maybe? Can't debug myself now

SomeTroglodyte commented 3 years ago

No no it's using the FileHandle constructor which doesn't have access to assets - it even says "Creates a new absolute FileHandle for the file name. Use this for tools on the desktop that don't need any of the backends. Do not use this constructor in case you write something cross-platform. Use the Files interface instead."

Gdx.files.internal is obvious, just building on a win-vomit box and testing is a bummer.

SomeTroglodyte commented 3 years ago

Holy Monstrance! How can a so-called OS be that dumb. It asks for elevation when asked to replace a file with a lock on it... idiotic...

Anyway, test succesful. @ Everybody remember: use File() for stuff in DesktopLauncher, Gdx.files.* for everything else, never the FileHandle(String) constructor.

P.S.: Likely also affects Android, and likely could have been reproed also on a more comfortable box.