(Splash splash)
| 43 | private static Logger logger = LoggerFactory.getLogger(Start.class); |
| 44 | |
| 45 | private void kickLoading(Splash splash) { |
| 46 | // Do this work in a different thread, or it will stop the splash screen from showing/animating. |
| 47 | Thread kickThread = new Thread(() -> { |
| 48 | try { |
| 49 | // A terrible hack as an attempt to avoid a deadlock when loading native libraries. |
| 50 | // Prism might be loading native libraries at this point, although we kick this loading after the splash has been shown. |
| 51 | // The current hypothesis is that the splash is "onShown" before the loading has finished and rendering can start. |
| 52 | // Ocular inspection shows the splash as grey for a few frames (1-3?) before filled in with graphics. That grey-time also seems to differ between runs. |
| 53 | // This is an attempt to make the deadlock less likely to happen and hopefully avoid it altogether. No guarantees. |
| 54 | Thread.sleep(200); |
| 55 | ResourceUnpacker.unpackResources(); |
| 56 | |
| 57 | try { |
| 58 | ClassLoader classLoader = ClassLoader.getSystemClassLoader(); |
| 59 | Class<?> glprofile = classLoader.loadClass("com.jogamp.opengl.GLProfile"); |
| 60 | Method init = glprofile.getMethod("initSingleton"); |
| 61 | init.invoke(null); |
| 62 | } catch (Throwable t) { |
| 63 | t.printStackTrace(); |
| 64 | logger.error("failed to initialize GLProfile singleton", t); |
| 65 | } |
| 66 | |
| 67 | // Boot the editor. |
| 68 | final EditorApplication app = new EditorApplication(Thread.currentThread().getContextClassLoader()); |
| 69 | try { |
| 70 | app.waitForClojureNamespaces(); |
| 71 | Platform.runLater(() -> { |
| 72 | try { |
| 73 | List<String> params = getParameters().getRaw(); |
| 74 | app.run(params.toArray(new String[0])); |
| 75 | splash.close(); |
| 76 | } catch (Throwable t) { |
| 77 | t.printStackTrace(); |
| 78 | logger.error("failed to open editor", t); |
| 79 | } |
| 80 | }); |
| 81 | } catch (Throwable t) { |
| 82 | t.printStackTrace(); |
| 83 | final String message = t.getMessage(); |
| 84 | logger.error(message, t); |
| 85 | Platform.runLater(() -> { |
| 86 | splash.setLaunchError(message); |
| 87 | splash.setErrorShowing(true); |
| 88 | }); |
| 89 | } |
| 90 | } catch (Throwable t) { |
| 91 | t.printStackTrace(); |
| 92 | logger.error("failed to initialize bundled native libraries", t); |
| 93 | } |
| 94 | }); |
| 95 | kickThread.start(); |
| 96 | } |
| 97 | |
| 98 | private void prunePackages() { |
| 99 | String sha1 = System.getProperty("defold.editor.sha1"); |
no test coverage detected