Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@

<jar jarfile="pentedb.jar">
<fileset dir="${dsg.src.build}/target" />
<manifest>
<attribute name="Main-Class" value="org.pente.gameDatabase.swing.Main"/>
</manifest>
</jar>

</target>
Expand Down
Binary file removed build/pentedb.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions java/org/pente/filter/http/HttpConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion java/org/pente/game/AbstractHttpStorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions java/org/pente/gameDatabase/swing/GameReviewBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 5 additions & 4 deletions java/org/pente/gameDatabase/swing/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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";
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -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());
}
Expand Down
17 changes: 11 additions & 6 deletions java/org/pente/gameDatabase/swing/ViewGamePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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() {
Expand Down
25 changes: 25 additions & 0 deletions mac_os/mac_compile_pre-start.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions mac_os/mac_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
java -cp "pentedb.jar:../lib/*" org.pente.gameDatabase.swing.Main ../resources/log4j.properties ./db
Binary file added mac_os/yourturn.wav
Binary file not shown.