Merge branch 'master' of github.com:limelight-stream/limelight-pc

# By Cameron Gutman
# Via Cameron Gutman
* 'master' of github.com:limelight-stream/limelight-pc:
  Extract AVC dependencies on all platforms
  Fix unused import warnings
  Log to a file if running from a JAR
  Remove the native gamepad cleanup on application close. We don't want native code in the critical closing path because it could mean that the program can't be closed if someone chooses the wrong platform JAR.
  Link the gamepad library to Xinput9_1_0.dll so the DirectX Runtime Installer isn't required for Vista and later
This commit is contained in:
Diego Waxemberg
2014-01-01 18:45:36 -05:00
6 changed files with 22 additions and 17 deletions

View File

@@ -1,4 +1,3 @@
rm gamepad_jni.dll gamepad_jni64.dll
/C/MinGW/bin/gcc -shared -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include" -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include/win32" *.c -L./win32 -lstem_gamepad -lxinput1_3 -Wl,--no-undefined -Wl,--kill-at -o gamepad_jni.dll
/C/MinGW-w64/bin/gcc -shared -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include" -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include/win32" *.c -L./win64 -lstem_gamepad -lxinput1_3 -Wl,--no-undefined -Wl,--kill-at -o gamepad_jni64.dll
/C/MinGW/bin/gcc -m32 -shared -Wall -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include" -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include/win32" *.c -L./win32 -lstem_gamepad -lxinput9_1_0 -Wl,--no-undefined -Wl,--kill-at -o gamepad_jni.dll
/C/MinGW-w64/bin/gcc -m64 -shared -Wall -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include" -I"/C/Program Files (x86)/Java/jdk1.7.0_45/include/win32" *.c -L./win64 -lstem_gamepad -lxinput9_1_0 -Wl,--no-undefined -Wl,--kill-at -o gamepad_jni64.dll

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,9 @@
package com.limelight;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
@@ -107,6 +111,15 @@ public class Limelight implements NvConnectionListener {
* @param args unused.
*/
public static void main(String args[]) {
// Redirect logging to a file if we're running from a JAR
if (LibraryHelper.isRunningFromJar()) {
try {
System.setErr(new PrintStream(new File("error.log")));
System.setOut(new PrintStream(new File("output.log")));
} catch (IOException e) {
}
}
//fix the menu bar if we are running in osx
if (System.getProperty("os.name").contains("Mac OS X")) {
// take the menu bar off the jframe

View File

@@ -15,7 +15,8 @@ public class LibraryHelper {
private static boolean librariesExtracted = false;
static {
needsDependencyExtraction = System.getProperty("os.name", "").contains("Windows");
// Windows and OS X need this, but we might as well do it for everybody
needsDependencyExtraction = true;
libraryExtractionFolder = System.getProperty("java.io.tmpdir", ".");
// FFMPEG libraries
@@ -94,4 +95,9 @@ public class LibraryHelper {
}
}
}
public static boolean isRunningFromJar() {
String classPath = LibraryHelper.class.getResource("LibraryHelper.class").toString();
return classPath.startsWith("jar:");
}
}

View File

@@ -6,8 +6,6 @@ import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
@@ -28,7 +26,6 @@ import org.xmlpull.v1.XmlPullParserException;
import com.limelight.Limelight;
import com.limelight.binding.PlatformBinding;
import com.limelight.input.gamepad.NativeGamepad;
import com.limelight.nvstream.NvConnection;
import com.limelight.nvstream.http.NvHTTP;
import com.limelight.settings.PreferencesManager;
@@ -59,16 +56,6 @@ public class MainFrame {
public void build() {
limeFrame = new JFrame("Limelight");
limeFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
limeFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
if (NativeGamepad.isRunning()) {
NativeGamepad.stop();
}
}
});
Container mainPane = limeFrame.getContentPane();
mainPane.setLayout(new BorderLayout());