/**
 * This file is part of Client, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2013-2014 Spoutcraft <http://spoutcraft.org/>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spoutcraft.client;

import java.io.File;
import java.nio.file.Files;

import org.apache.commons.lang3.SystemUtils;

public class Main {
    public static void main(String[] args) throws Exception {
        deploy();
        new Game().open();
    }

    private static void deploy() throws Exception {
        final File configFile = new File("config.yml");
        if (!configFile.exists()) {
            Files.copy(Main.class.getResourceAsStream("/config.yml"), configFile.toPath());
        }
        final String osPath;
        final String[] nativeLibs;
        if (SystemUtils.IS_OS_WINDOWS) {
            nativeLibs = new String[]{
                    "jinput-dx8_64.dll", "jinput-dx8.dll", "jinput-raw_64.dll", "jinput-raw.dll",
                    "jinput-wintab.dll", "lwjgl.dll", "lwjgl64.dll", "OpenAL32.dll", "OpenAL64.dll"
            };
            osPath = "windows/";
        } else if (SystemUtils.IS_OS_MAC) {
            nativeLibs = new String[]{
                    "libjinput-osx.jnilib", "liblwjgl.jnilib", "openal.dylib"
            };
            osPath = "mac/";
        } else if (SystemUtils.IS_OS_LINUX) {
            nativeLibs = new String[]{
                    "liblwjgl.so", "liblwjgl64.so", "libopenal.so", "libopenal64.so", "libjinput-linux.so",
                    "libjinput-linux64.so"
            };
            osPath = "linux/";
        } else {
            throw new IllegalStateException("Could not get lwjgl natives for OS \"" + SystemUtils.OS_NAME + "\".");
        }
        final File nativesDir = new File("natives" + File.separator + osPath);
        nativesDir.mkdirs();
        for (String nativeLib : nativeLibs) {
            final File nativeFile = new File(nativesDir, nativeLib);
            if (!nativeFile.exists()) {
                Files.copy(Main.class.getResourceAsStream("/" + nativeLib), nativeFile.toPath());
            }
        }
        final String nativesPath = nativesDir.getAbsolutePath();
        System.setProperty("org.lwjgl.librarypath", nativesPath);
        System.setProperty("net.java.games.input.librarypath", nativesPath);
    }
}

@@ -1309,40 +1309,38 @@
 org.
-apache.commons.lang3.System
+spout.renderer.lwjgl.LWJGL
 Util
-s
 ;%0A%0Ap
@@ -1730,1610 +1730,36 @@
     
-final String osPath;%0A        final String%5B%5D nativeLibs;%0A        if (SystemUtils.IS_OS_WINDOWS) %7B%0A            nativeLibs = new String%5B%5D%7B%0A                    %22jinput-dx8_64.dll%22, %22jinput-dx8.dll%22, %22jinput-raw_64.dll%22, %22jinput-raw.dll%22,%0A                    %22jinput-wintab.dll%22, %22lwjgl.dll%22, %22lwjgl64.dll%22, %22OpenAL32.dll%22, %22OpenAL64.dll%22%0A            %7D;%0A            osPath = %22windows/%22;%0A        %7D else if (SystemUtils.IS_OS_MAC) %7B%0A            nativeLibs = new String%5B%5D%7B%0A                    %22libjinput-osx.jnilib%22, %22liblwjgl.jnilib%22, %22openal.dylib%22%0A            %7D;%0A            osPath = %22mac/%22;%0A        %7D else if (SystemUtils.IS_OS_LINUX) %7B%0A            nativeLibs = new String%5B%5D%7B%0A                    %22liblwjgl.so%22, %22liblwjgl64.so%22, %22libopenal.so%22, %22libopenal64.so%22, %22libjinput-linux.so%22,%0A                    %22libjinput-linux64.so%22%0A            %7D;%0A            osPath = %22linux/%22;%0A        %7D else %7B%0A            throw new IllegalStateException(%22Could not get lwjgl natives for OS %5C%22%22 + SystemUtils.OS_NAME + %22%5C%22.%22);%0A        %7D%0A        final File nativesDir = new File(%22natives%22 + File.separator + osPath);%0A        nativesDir.mkdirs();%0A        for (String nativeLib : nativeLibs) %7B%0A            final File nativeFile = new File(nativesDir, nativeLib);%0A            if (!nativeFile.exists()) %7B%0A                Files.copy(Main.class.getResourceAsStream(%22/%22 + nativeLib), nativeFile.toPath());%0A            %7D%0A        %7D%0A        final String nativesPath = nativesDir.getAbsolutePath();%0A        System.setProperty(%22org.lwjgl.librarypath%22, nativesPath);%0A        System.setProperty(%22net.java.games.input.librarypath%22, nativesPath
+LWJGLUtil.deployNatives(null
 );%0A 

Move native deployment method to Caustic