|
@@ -4,12 +4,28 @@
|
|
*/
|
|
*/
|
|
package de.nplusc.izc.iZpl;
|
|
package de.nplusc.izc.iZpl;
|
|
|
|
|
|
|
|
+import com.sun.jna.Native;
|
|
|
|
+import com.sun.jna.PointerType;
|
|
|
|
+import com.sun.jna.Structure;
|
|
|
|
+import com.sun.jna.WString;
|
|
import com.sun.jna.platform.win32.User32;
|
|
import com.sun.jna.platform.win32.User32;
|
|
import com.sun.jna.platform.win32.WinDef.HWND;
|
|
import com.sun.jna.platform.win32.WinDef.HWND;
|
|
|
|
+import com.sun.jna.platform.win32.WinUser.MSG;
|
|
import de.nplusc.izc.tools.IOtools.FileTK;
|
|
import de.nplusc.izc.tools.IOtools.FileTK;
|
|
|
|
+import de.nplusc.izc.tools.WinToolz.User32Extended;
|
|
import de.nplusc.izc.tools.baseTools.Tools;
|
|
import de.nplusc.izc.tools.baseTools.Tools;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
import java.util.prefs.Preferences;
|
|
import java.util.prefs.Preferences;
|
|
|
|
+import javax.swing.JFrame;
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.JTextArea;
|
|
|
|
+import org.jawin.COMException;
|
|
|
|
+//import org.jawin.donated.win32.MiscellaneousConstants;
|
|
|
|
+//import org.jawin.donated.win32.User32;
|
|
|
|
+//import org.jawin.donated.win32.W32Process;
|
|
|
|
+//import org.jawin.donated.win32.WS_Constants;
|
|
|
|
+//import org.jawin.donated.win32.User32;
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@@ -17,44 +33,137 @@ import javax.swing.JTextArea;
|
|
*/
|
|
*/
|
|
public class AudioSurfCore
|
|
public class AudioSurfCore
|
|
{
|
|
{
|
|
- private static HWND AudioSurf;
|
|
|
|
|
|
+
|
|
|
|
+ private static HWND AudioSurf;
|
|
|
|
+ private static JFrame target;
|
|
|
|
+
|
|
public static void getAudioSurfWindow()
|
|
public static void getAudioSurfWindow()
|
|
{
|
|
{
|
|
- AudioSurf= User32.INSTANCE.FindWindow(null, "Audiosurf");
|
|
|
|
|
|
+ AudioSurf = User32Extended.INSTANCE.FindWindow(null, "Audiosurf");//new WString("Audiosurf"));
|
|
}
|
|
}
|
|
|
|
|
|
- public static void launchAudioSurf()
|
|
|
|
|
|
+ public static void launchAudioSurf(JFrame t)
|
|
{
|
|
{
|
|
- new Thread(new Runnable()
|
|
|
|
- {
|
|
|
|
- @SuppressWarnings("ResultOfObjectAllocationIgnored")
|
|
|
|
- @Override
|
|
|
|
- public void run()
|
|
|
|
|
|
+ target=t;
|
|
|
|
+ new Thread(new Runnable()
|
|
{
|
|
{
|
|
- if(Preferences.userRoot().get("izpl.audioSurfPath", "...").equals("..."))
|
|
|
|
|
|
+ @SuppressWarnings("ResultOfObjectAllocationIgnored")
|
|
|
|
+ @Override
|
|
|
|
+ public void run()
|
|
{
|
|
{
|
|
- String targetDirectory = Tools.FileChooseDlg(null, true, false, new String[]{"exe"});
|
|
|
|
- Preferences.userRoot().put("izpl.audioSurfPath", targetDirectory);
|
|
|
|
|
|
+ if (Preferences.userRoot().get("izpl.audioSurfPath", "...").equals("..."))
|
|
|
|
+ {
|
|
|
|
+ String targetDirectory = Tools.FileChooseDlg(null, true, false, new String[]
|
|
|
|
+ {
|
|
|
|
+ "exe"
|
|
|
|
+ });
|
|
|
|
+ Preferences.userRoot().put("izpl.audioSurfPath", targetDirectory);
|
|
|
|
+ }
|
|
|
|
+ String tdir = Preferences.userRoot().get("izpl.audioSurfPath", "...");
|
|
|
|
+ System.out.println(tdir);
|
|
|
|
+ //HAXTST
|
|
|
|
+ tdir = FileTK.getFilePath(tdir);
|
|
|
|
+ //tdir+="\\engine";
|
|
|
|
+ String texe = tdir + "\\Audiosurf.exe";
|
|
|
|
+ Tools.runSingleCmd(true, true, false, true, new JTextArea(), System.out, tdir, true, texe);
|
|
}
|
|
}
|
|
- String tdir = Preferences.userRoot().get("izpl.audioSurfPath", "...");
|
|
|
|
- System.out.println(tdir);
|
|
|
|
- //HAXTST
|
|
|
|
- tdir=FileTK.getFilePath(tdir);
|
|
|
|
- //tdir+="\\engine";
|
|
|
|
- String texe = tdir+"\\engine\\QuestViewer.exe";
|
|
|
|
- System.out.println("cmd.exe"+" "+"/c"+" "+"cd"+" "+ tdir+" "+"&&"+" "+ texe+" "+ "\\engine\\Q3DStart.q3d");
|
|
|
|
- Tools.runSingleCmd(true, true, false, true, new JTextArea(),"cmd.exe","/c","cd", tdir,"&&", texe, "engine\\Q3DStart.q3d");
|
|
|
|
|
|
+ }).start();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ Thread.sleep(4500);
|
|
}
|
|
}
|
|
- }).start();
|
|
|
|
- try
|
|
|
|
|
|
+ catch (InterruptedException ex)
|
|
|
|
+ {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ Thread.sleep(500);
|
|
|
|
+ }
|
|
|
|
+ catch (InterruptedException ex)
|
|
|
|
+ {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * int hInst = W32Process.GetModuleHandleW(null);
|
|
|
|
+ int hwnd = User32.CreateWindowExW(0, "Communicator", // window class name
|
|
|
|
+ "Communicating with AudioSurf. . .", // window caption
|
|
|
|
+ WS_Constants.WS_OVERLAPPEDWINDOW, // window style
|
|
|
|
+ MiscellaneousConstants.CW_USEDEFAULT, // initial x position
|
|
|
|
+ MiscellaneousConstants.CW_USEDEFAULT, // initial y position
|
|
|
|
+ MiscellaneousConstants.CW_USEDEFAULT, // initial x size
|
|
|
|
+ MiscellaneousConstants.CW_USEDEFAULT, // initial y size
|
|
|
|
+ MiscellaneousConstants.NULL, // parent window handle
|
|
|
|
+ MiscellaneousConstants.NULL, // window menu handle
|
|
|
|
+ hInst, // program instance handle
|
|
|
|
+ MiscellaneousConstants.NULL); // creation parameters*/
|
|
|
|
+
|
|
|
|
+ getAudioSurfWindow();
|
|
|
|
+ System.out.println(AudioSurf);
|
|
|
|
+ //System.out.println(AudioSurf.getPointer().getLong(0));
|
|
|
|
+ startSong("D:\\mp3\\assorted Earworms\\22 - StarDisc - Fernando Pepe.flac", "eraser");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void startSong(String songPath, String charaname)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ String message_i = "ascommand quickstartqueuecommand ascommand playsongmono"/*+charaname*/ + " " + songPath;
|
|
|
|
+ WString message = new WString(message_i);
|
|
|
|
+ System.out.println(message_i);
|
|
|
|
+ WM_COPYDATA.ByReference data = new WM_COPYDATA.ByReference();
|
|
|
|
+ data.dwData = 1;
|
|
|
|
+ data.lpData = message;
|
|
|
|
+ data.cbData = (message.length() * 2) + 2;
|
|
|
|
+ System.out.println(User32Extended.INSTANCE.SendMessageW(AudioSurf, 74, (int)Native.getWindowID(target), data));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //repeat: ascommand playsongcurrentcharacter c:\my music\nin\the way out is through.mp3
|
|
|
|
+ ///init
|
|
|
|
+ /*
|
|
|
|
+ ascommand playsongmono c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongpointman c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongdoublevision c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongmonopro c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongvegas c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongeraser c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongpointmanpro c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongpusher c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongdoublevisionpro c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongninjamono c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongeraserelite c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongpointmanelite c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongpusherelite c:\music\somesong.mp3
|
|
|
|
+ ascommand playsongdoublevisionelite c:\music\somesong.mp3
|
|
|
|
+ // backgroundmode
|
|
|
|
+ ascommand playsongfreeride d:\music\09 Eternal Life.wma
|
|
|
|
+ */
|
|
|
|
+ public static boolean isReadyForSong()
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static class WM_COPYDATA extends Structure
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected List getFieldOrder()
|
|
{
|
|
{
|
|
- Thread.sleep(500);
|
|
|
|
|
|
+ return Arrays.asList(new String[]
|
|
|
|
+ {
|
|
|
|
+ "dwData", "cbData", "lpData"
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- catch (InterruptedException ex)
|
|
|
|
|
|
+
|
|
|
|
+ public static class ByReference extends WM_COPYDATA implements Structure.ByReference
|
|
|
|
+ {
|
|
|
|
+ };
|
|
|
|
+ public int dwData;
|
|
|
|
+ public int cbData;
|
|
|
|
+ public WString lpData;
|
|
|
|
+
|
|
|
|
+ protected ByReference newByReference()
|
|
{
|
|
{
|
|
- ex.printStackTrace();
|
|
|
|
|
|
+ return new ByReference();
|
|
}
|
|
}
|
|
- getAudioSurfWindow();
|
|
|
|
- System.out.println(AudioSurf);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|