diff --git a/.gitignore b/.gitignore index 7e8e094..510bab3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,12 @@ build/target build/pentedb.jar bin *.exe +<<<<<<< Updated upstream +.idea +======= +db +mac_os/images +mac_os/pente.tbl +mac_os/pente.scs +mac_os/images +>>>>>>> Stashed changes diff --git a/build/build.xml b/build/build.xml index 42f30c0..5bb47b3 100644 --- a/build/build.xml +++ b/build/build.xml @@ -36,6 +36,9 @@ + + + diff --git a/build/pentedb.jar b/build/pentedb.jar deleted file mode 100644 index ebab920..0000000 Binary files a/build/pentedb.jar and /dev/null differ diff --git a/java/org/pente/filter/http/HttpConstants.java b/java/org/pente/filter/http/HttpConstants.java index dc2d7ed..0957e19 100644 --- a/java/org/pente/filter/http/HttpConstants.java +++ b/java/org/pente/filter/http/HttpConstants.java @@ -11,12 +11,12 @@ private HttpConstants() { } /** Protocol header */ - public static final String HTTP = "http://"; + public static final String HTTP = "https://"; /** End line string */ public static final String END_LINE = "\r\n"; /** The default http web server port */ - public static final int HTTP_PORT = 80; + public static final int HTTP_PORT = 443; public static final int STATUS_OK = 200; public static final int STATUS_BAD_REQUEST = 400; diff --git a/java/org/pente/game/AbstractHttpStorer.java b/java/org/pente/game/AbstractHttpStorer.java index 0dec4d6..846ad15 100644 --- a/java/org/pente/game/AbstractHttpStorer.java +++ b/java/org/pente/game/AbstractHttpStorer.java @@ -9,6 +9,9 @@ import org.pente.gameDatabase.*; import org.pente.filter.http.*; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + /** This class provides common methods needed by classes which plan on * sending/receiving information to/from a http interface which provides access * to the dsg database. This simplifies the work that individual storers @@ -74,7 +77,9 @@ public AbstractHttpStorer(String host, int port, String userName, String passwor * @exception Exception If the connection cannot be made */ private Socket getConnection() throws Exception { - return new Socket(host, port); + SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault(); + SSLSocket socket = (SSLSocket) factory.createSocket(host, port); + return socket; } /** Creates the request to send to the http server diff --git a/java/org/pente/gameDatabase/swing/GameReviewBoard.java b/java/org/pente/gameDatabase/swing/GameReviewBoard.java index cb5f870..d49d025 100644 --- a/java/org/pente/gameDatabase/swing/GameReviewBoard.java +++ b/java/org/pente/gameDatabase/swing/GameReviewBoard.java @@ -104,8 +104,9 @@ import org.pente.mmai.Ai; import org.pente.mmai.AiListener; -import sun.audio.AudioPlayer; -import sun.audio.AudioStream; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; /** * @author dweebo @@ -667,11 +668,15 @@ public void moveReady(int[] moves, int newMove) { addMove(newMove); - try { - InputStream in = new FileInputStream("yourturn.au"); - AudioStream as = new AudioStream(in); - AudioPlayer.player.start(as); - } catch (Exception e) { e.printStackTrace(); } + try { + AudioInputStream audioInputStream = + AudioSystem.getAudioInputStream(new File("yourturn.wav")); + Clip clip = AudioSystem.getClip(); + clip.open(audioInputStream); + clip.start(); + } catch (Exception e) { + e.printStackTrace(); + } } public void aiEvaluateCallBack() { diff --git a/java/org/pente/gameDatabase/swing/Main.java b/java/org/pente/gameDatabase/swing/Main.java index 0d9c8f5..37c82a8 100644 --- a/java/org/pente/gameDatabase/swing/Main.java +++ b/java/org/pente/gameDatabase/swing/Main.java @@ -1100,7 +1100,7 @@ public void drop(DropTargetDropEvent drop) { drop.acceptDrop(DnDConstants.ACTION_COPY); URL url = (URL) tr.getTransferData(df); - if (!url.getProtocol().equals("http")) { + if (!url.getProtocol().equals("https")) { continue; } @@ -1508,7 +1508,8 @@ private String getHost() { if (System.getProperty("host") != null) { return System.getProperty("host"); } else { - return "pente.org"; + return "pente.org"; +// return "development.pente.org"; } } @@ -1554,7 +1555,7 @@ public boolean login(boolean loadFromDb) { StringBuffer encryptedPasswordBuf = new StringBuffer(); StringBuffer sessionIdBuf = new StringBuffer(); - httpLoader = new PlunkHttpLoader(getHost(), 80, localName, localPassword); + httpLoader = new PlunkHttpLoader(getHost(), 443, localName, localPassword); int loginStatus = 500; try { loginStatus = httpLoader.remoteLogin(encryptedPasswordBuf, sessionIdBuf); @@ -1580,7 +1581,7 @@ else if (loginStatus == 200) { password = localPassword; penteOrgGameSearcher = new HttpGameStorerSearcher( - getHost(), 80, new PGNGameFormat(), + getHost(), 443, new PGNGameFormat(), "/gameServer/controller", name, password); ((HttpGameStorerSearcher) penteOrgGameSearcher).setCookie(sessionIdBuf.toString()); } diff --git a/java/org/pente/gameDatabase/swing/ViewGamePanel.java b/java/org/pente/gameDatabase/swing/ViewGamePanel.java index bb907a2..b81a789 100644 --- a/java/org/pente/gameDatabase/swing/ViewGamePanel.java +++ b/java/org/pente/gameDatabase/swing/ViewGamePanel.java @@ -2,8 +2,9 @@ import java.awt.*; -import sun.audio.*; - +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; import javax.swing.border.*; import java.awt.event.*; @@ -585,10 +586,14 @@ public void moveReady(int[] moves, int newMove) { makeMove(newMove); try { - InputStream in = new FileInputStream("yourturn.au"); - AudioStream as = new AudioStream(in); - AudioPlayer.player.start(as); - } catch (Exception e) { e.printStackTrace(); } + AudioInputStream audioInputStream = + AudioSystem.getAudioInputStream(new File("yourturn.wav")); + Clip clip = AudioSystem.getClip(); + clip.open(audioInputStream); + clip.start(); + } catch (Exception e) { + e.printStackTrace(); + } } public void aiEvaluateCallBack() { diff --git a/mac_os/mac_compile_pre-start.sh b/mac_os/mac_compile_pre-start.sh new file mode 100644 index 0000000..041f2bd --- /dev/null +++ b/mac_os/mac_compile_pre-start.sh @@ -0,0 +1,25 @@ +#!/bin/bash +cd ../build +rm -r target +ant +mv pentedb.jar ../mac_os +cd ../resources/pro +if [ -d ../../mac_os/db ] ; +then + echo db exists, leaving.. + rm -rf ./db +else + java -cp "../../mac_os/pentedb.jar:../../lib/*" org.pente.gameDatabase.swing.install.FirstInstall + rm -rf ../../mac_os/db + mv db ../../mac_os +fi +cd .. +cp -r images ../mac_os +cd ../mmai64 +g++ -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin -shared CPoint.c Ai.cpp AiWrapper.cpp -o libAi.jnilib +mv libAi.jnilib ../mac_os +cd ../mmai +cp pente.scs ../mac_os +cp pente.tbl ../mac_os +cd ../mac_os + diff --git a/mac_os/mac_start.sh b/mac_os/mac_start.sh new file mode 100644 index 0000000..179d8e0 --- /dev/null +++ b/mac_os/mac_start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +java -cp "pentedb.jar:../lib/*" org.pente.gameDatabase.swing.Main ../resources/log4j.properties ./db diff --git a/mac_os/yourturn.wav b/mac_os/yourturn.wav new file mode 100644 index 0000000..04cc47b Binary files /dev/null and b/mac_os/yourturn.wav differ