diff --git a/DivaBot/DivaBot.jar b/DivaBot/DivaBot.jar index d18c35e..72a70a1 100644 Binary files a/DivaBot/DivaBot.jar and b/DivaBot/DivaBot.jar differ diff --git a/DivaBot/TypeFace_API.jar b/DivaBot/TypeFace_API.jar index 113bb90..be424ff 100644 Binary files a/DivaBot/TypeFace_API.jar and b/DivaBot/TypeFace_API.jar differ diff --git a/DivaBot/calibration_data.txt b/DivaBot/calibration_data.txt index 1abcb5b..af14c5d 100644 --- a/DivaBot/calibration_data.txt +++ b/DivaBot/calibration_data.txt @@ -1,4 +1,4 @@ -438 -290 -1329 -787 +419 +206 +1642 +889 diff --git a/DivaBot/capture.png b/DivaBot/capture.png index 88d9987..1bd5b0b 100644 Binary files a/DivaBot/capture.png and b/DivaBot/capture.png differ diff --git a/DivaBot/capture_2.png b/DivaBot/capture_2.png index 617c8df..a21e7c3 100644 Binary files a/DivaBot/capture_2.png and b/DivaBot/capture_2.png differ diff --git a/DivaBot/capture_3.png b/DivaBot/capture_3.png index 06ab385..19d0b4c 100644 Binary files a/DivaBot/capture_3.png and b/DivaBot/capture_3.png differ diff --git a/DivaBot/capture_4.png b/DivaBot/capture_4.png index 0f5d177..19d0b4c 100644 Binary files a/DivaBot/capture_4.png and b/DivaBot/capture_4.png differ diff --git a/DivaBot/capture_5.png b/DivaBot/capture_5.png index 86f91b9..dde14b7 100644 Binary files a/DivaBot/capture_5.png and b/DivaBot/capture_5.png differ diff --git a/DivaBot/colorData b/DivaBot/colorData index 1341dfe..98ef0f3 100644 --- a/DivaBot/colorData +++ b/DivaBot/colorData @@ -162,3 +162,17 @@ Star Story:1808285827,3434600865,4320953611 夢の続き:9980651028,9269054443,7923490029 MEGANE:12097703860,7865703856,8089571528 Change me:6946360046,4571504089,2910280226 +アドレサンス:5458033068,4389022230,4212580841 +グリーンライツセレナーデ:6422553300,6622495000,6942409156 +サウンド:2350288995,3725672868,3350500213 +Stay with me:6858394047,5138098343,3976139800 +ドラマツルギー:9364452247,9429738184,9396666719 +Nyanyanyanyanyanyanya!:8284558575,7067572325,6713348796 +巴里映画少女:7543881170,6294797933,6122764603 +ファインダー (DSLR remix - re-COLON-edit):5687636652,7373735766,7988148878 +フキゲンワルツ:7878892274,8044206152,6207005607 +Promise:4021169803,4900248262,6497913358 +星屑ユートピア:3370014582,2298015215,925945505 +マージナル:7836108651,8174436060,8267809525 +Last Night, Good Night:3265412964,4528174454,4889449827 +Leia:6765406279,5114086294,4206059909 diff --git a/DivaBot/config.txt b/DivaBot/config.txt index 8cb5640..136eb2f 100644 --- a/DivaBot/config.txt +++ b/DivaBot/config.txt @@ -1,11 +1,11 @@ -DISPLAYDATA -16776961*-13369549*94*Microsoft YaHei UI Bold*600*150*5000*Song Title (Japanese+Romanized)*176*80*~-16776961*-13369549*24*Gulim*400*40*300*Overall Rating|Song Title (Romanized)|FC Count*176*240* -LAST_HEIGHT 150 +DISPLAYDATA -16776961*-13369549*94*Microsoft YaHei UI Bold*600*150*5000*Song Title (Japanese+Romanized)*176*80**~-16776961*-13369549*24*Gulim*400*40*1000*Overall Rating|Song Title (Romanized)|FC Count*176*240**~-16776961*-13369549*24*Dialog.italic*400*40*300*Song Title (Japanese+Romanized+ENG)*0*0*Header: * +LAST_HEIGHT 40 WIDTH 1127 HEIGHT 732 BACKGROUND -6697729 LAST_TEXT -13369549 -LAST_FONT Microsoft YaHei UI Bold -LAST_FONTSIZE 94 +LAST_FONT Dialog.italic +LAST_FONTSIZE 24 LAST_BACKGROUND -16776961 -LAST_WIDTH 600 -LAST_DELAY 5000 +LAST_WIDTH 400 +LAST_DELAY 300 diff --git a/DivaBot/src/sig/Calibrator.java b/DivaBot/src/sig/Calibrator.java index 91ec793..8509043 100644 --- a/DivaBot/src/sig/Calibrator.java +++ b/DivaBot/src/sig/Calibrator.java @@ -9,7 +9,6 @@ import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JOptionPane; -import javax.swing.JPanel; import sig.utils.FileUtils; @@ -19,10 +18,6 @@ public class Calibrator{ Calibrator() throws IOException, InterruptedException { boolean failed=false; - int x = Math.min(MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.x); - int y = Math.min(MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.y); - int width = (Math.max(MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.x)-Math.min(MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.x)); - int height = (Math.max(MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.y)-Math.min(MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.y)); if (MyRobot.STARTDRAG.x>MyRobot.ENDDRAG.x) { int xTemp=MyRobot.STARTDRAG.x; @@ -35,11 +30,6 @@ public class Calibrator{ MyRobot.ENDDRAG.y=yTemp; } - /*Rectangle currentPointer = new Rectangle( - x,y, - (int)Math.floor(x+width*0.03984375d), - (int)Math.floor(y+height*0.30833333333333333333333333333333d)); - calibrationline=currentPointer;*/ img = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_5.png")); failed=CalibrationStage1(); @@ -78,11 +68,6 @@ public class Calibrator{ } MyRobot.FRAME.setAlwaysOnTop(true); -// failed=CalibrationStage3(p); -// if (failed) {return;} -// failed=CalibrationStage4(p); -// if (failed) {return;} - //MyRobot.CALIBRATIONSTATUS="First calibration set done: X"+(x-MyRobot.STARTDRAG.x)+" Y"+(y-MyRobot.STARTDRAG.y); img = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_5.png")); FileUtils.deleteFile("calibration_data.txt"); @@ -96,15 +81,11 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=10000; MyRobot.CALIBRATIONSTATUS="Calibration Stage 1..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.STARTDRAG.x-=1; - //BufferedImage pixel = MYROBOT.getSizedCapture(new Rectangle(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,1,1)); BufferedImage miniImg = img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if (!(col.getRed()>=5&&col.getRed()<=40&& @@ -126,16 +107,11 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=10000; MyRobot.CALIBRATIONSTATUS="Calibration Stage 2..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MYROBOT.getSizedCapture(new Rectangle(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG,height)); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_2.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.STARTDRAG.y-=1; - //currentScreen.setRGB(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y, new Color(0,0,0).getRGB()); BufferedImage miniImg = img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_2_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if (!(col.getRed()>=5&&col.getRed()<=100&& @@ -156,15 +132,11 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=10000; MyRobot.CALIBRATIONSTATUS="Calibration Stage 3..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_3.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.ENDDRAG.x+=1; - //BufferedImage pixel = MYROBOT.getSizedCapture(new Rectangle(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,1,1)); BufferedImage miniImg = img.getSubimage(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if (!(col.getRed()>=40&&col.getRed()<=90&& @@ -186,16 +158,11 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=10000; MyRobot.CALIBRATIONSTATUS="Calibration Stage 4..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MYROBOT.getSizedCapture(new Rectangle(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,MyRobot.ENDDRAG,height)); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_4.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.ENDDRAG.y+=1; - //currentScreen.setRGB(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y, new Color(0,0,0).getRGB()); BufferedImage miniImg = img.getSubimage(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if (!(col.getRed()>=40&&col.getRed()<=90&& @@ -216,16 +183,12 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=100; MyRobot.CALIBRATIONSTATUS="Calibration Stage 5..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.STARTDRAG.x+=1; - //BufferedImage pixel = MYROBOT.getSizedCapture(new Rectangle(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,1,1)); for (int i=0;i<100;i++) { BufferedImage miniImg = img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y+i,1,1); - //ImageIO.write(miniImg,"png",new File("capture_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if ((col.getRed()>=5&&col.getRed()<=75&& @@ -233,7 +196,6 @@ public class Calibrator{ col.getBlue()>=180&&col.getBlue()<=250)) { //This is the max X. Calibration on this side good. MyRobot.STARTDRAG.y=MyRobot.STARTDRAG.y+i; - //MyRobot.STARTDRAG.x--; System.out.println("End at "+MyRobot.STARTDRAG.x); return false; } @@ -248,17 +210,12 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=100; MyRobot.CALIBRATIONSTATUS="Calibration Stage 6..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MYROBOT.getSizedCapture(new Rectangle(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG,height)); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_2.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.STARTDRAG.y+=1; - //currentScreen.setRGB(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y, new Color(0,0,0).getRGB()); for (int i=0;i<100;i++) { BufferedImage miniImg = img.getSubimage(MyRobot.STARTDRAG.x+i,MyRobot.STARTDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_2_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if ((col.getRed()>=5&&col.getRed()<=100&& @@ -280,16 +237,12 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=100; MyRobot.CALIBRATIONSTATUS="Calibration Stage 7..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_3.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.ENDDRAG.x-=1; - //BufferedImage pixel = MYROBOT.getSizedCapture(new Rectangle(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,1,1)); for (int i=0;i<100;i++) { BufferedImage miniImg = img.getSubimage(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y-i,1,1); - //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if ((col.getRed()>=40&&col.getRed()<=90&& @@ -312,17 +265,12 @@ public class Calibrator{ boolean calibrated=false; int MAXTRIES=100; MyRobot.CALIBRATIONSTATUS="Calibration Stage 8..."; - //ImageIO.write(MYROBOT.getSizedCapture(new Rectangle(x,y,width,height)),"png",new File("capture.png")); - //BufferedImage currentScreen = MYROBOT.getSizedCapture(new Rectangle(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y,MyRobot.ENDDRAG,height)); - //BufferedImage currentScreen = MyRobot.MYROBOT.getSizedCapture(new Rectangle(0,0,MyRobot.screenSize.width,MyRobot.screenSize.height)); ImageIO.write(img.getSubimage(MyRobot.STARTDRAG.x,MyRobot.STARTDRAG.y,MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x,MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y),"png",new File("capture_4.png")); while (!calibrated&&MAXTRIES>0) { //Try moving left until the difference is too high or the colors are not right anymore. MyRobot.ENDDRAG.y-=1; - //currentScreen.setRGB(MyRobot.ENDDRAG.x,MyRobot.ENDDRAG.y, new Color(0,0,0).getRGB()); for (int i=0;i<100;i++) { BufferedImage miniImg = img.getSubimage(MyRobot.ENDDRAG.x-i,MyRobot.ENDDRAG.y,1,1); - //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); if ((col.getRed()>=40&&col.getRed()<=90&& diff --git a/DivaBot/src/sig/Display.java b/DivaBot/src/sig/Display.java index 2e5d31d..691df2e 100644 --- a/DivaBot/src/sig/Display.java +++ b/DivaBot/src/sig/Display.java @@ -21,6 +21,7 @@ public class Display { int height=48; int fontHeight=0; int delay=10000; + String header=""; long nextUpdateTime = System.currentTimeMillis(); boolean forceUpdate=false; String[] labels; @@ -43,6 +44,9 @@ public class Display { labels=split[7].split("\\|"); x=Integer.parseInt(split[8]); y=Integer.parseInt(split[9]); + if (split.length>=11) { + header=split[10]; + } } Display() { HashMap config = MyRobot.p.configData; @@ -98,6 +102,7 @@ public class Display { font = new Font("Batang",Font.PLAIN,fontSize); } } + header = ""; labels = new String[]{"Add a label!"}; currentText=interpretLabel(labels[cycle]); Thread t = new Thread() { @@ -172,6 +177,7 @@ public class Display { .append(combineLabels()).append("*") .append(x).append("*") .append(y).append("*") + .append(header).append("*") .toString(); } @@ -194,55 +200,55 @@ public class Display { if (data.bestPlayTime>System.currentTimeMillis()-10000) { return "New Record!"; } else { - return ((data.bestPlay!=null)?data.bestPlay.display():""); + return header+((data.bestPlay!=null)?data.bestPlay.display():"No plays"); } } case "Overall Rating":{ if (data.ratingTime>System.currentTimeMillis()-10000) { return "Rating up! "+data.lastRating+" -> "+data.overallrating; } else { - return Integer.toString(data.overallrating); + return header+Integer.toString(data.overallrating); } } case "Song Difficulty":{ - return data.difficultyRating + " - " + fullNameDifficulty(data.difficulty); + return header+data.difficultyRating + " - " + fullNameDifficulty(data.difficulty); } case "Song Title (Japanese)":{ - return data.songname; + return header+data.songname; } case "Song Title (Romanized)":{ - return ((data.romanizedname.length()>0)?data.romanizedname:data.englishname); + return header+((data.romanizedname.length()>0)?data.romanizedname:data.englishname); } case "Song Title (Japanese+Romanized)":{ if (data.songname.equalsIgnoreCase(((data.romanizedname.length()>0)?data.romanizedname:data.englishname))) { - return data.songname; + return header+data.songname; } else { - return (data.songname + " - " + ((data.romanizedname.length()>0)?data.romanizedname:data.englishname)); + return header+(data.songname + " - " + ((data.romanizedname.length()>0)?data.romanizedname:data.englishname)); } } case "Song Title (English)":{ - return data.englishname; + return header+data.englishname; } case "Song Title (Japanese+Romanized+ENG)":{ if (data.songname.equalsIgnoreCase(((data.romanizedname.length()>0)?data.romanizedname:data.englishname))) { - return data.songname; + return header+data.songname; } else { - return (data.songname + " - " + ((data.romanizedname.length()>0)?(data.romanizedname.equalsIgnoreCase(data.englishname))?data.romanizedname:data.romanizedname+" ("+data.englishname+")":data.englishname)); + return header+(data.songname + " - " + ((data.romanizedname.length()>0)?(data.romanizedname.equalsIgnoreCase(data.englishname))?data.romanizedname:data.romanizedname+" ("+data.englishname+")":data.englishname)); } } case "Song Artist":{ - return "Artist: "+data.artist; + return header+data.artist; } case "Play Count":{ if (data.plays>0) { - return Integer.toString(data.plays)+" play"+((data.plays!=1)?"s":""); + return header+Integer.toString(data.plays)+" play"+((data.plays!=1)?"s":""); } else { return "No Plays"; } } case "Pass/Play Count":{ if (data.plays>0) { - return Integer.toString(data.passes) + "/" + Integer.toString(data.plays)+" play"+((data.plays!=1)?"s":""); + return header+Integer.toString(data.passes) + "/" + Integer.toString(data.plays)+" play"+((data.plays!=1)?"s":""); } else { return "No Plays"; @@ -250,31 +256,31 @@ public class Display { } case "Pass/Play Count (+%)":{ if (data.plays>0) { - return (data.passes)+"/"+(data.plays)+" play"+((data.plays!=1)?"s":"")+" "+"("+((int)(Math.floor(((float)data.passes)/data.plays*100)))+"% pass rate)"; + return header+(data.passes)+"/"+(data.plays)+" play"+((data.plays!=1)?"s":"")+" "+"("+((int)(Math.floor(((float)data.passes)/data.plays*100)))+"% pass rate)"; } else { return "No Plays"; } } case "FC Count":{ if (data.plays>0) { - return data.fcCount +" FC"+(data.fcCount==1?"":"s"); + return header+header+data.fcCount +" FC"+(data.fcCount==1?"":"s"); } else { return "No Plays"; } } case "FC Count (+%)":{ if (data.plays>0) { - return data.fcCount +" FC"+(data.fcCount==1?"":"s")+" "+((int)(Math.floor(((float)data.fcCount)/data.plays*100)))+"% FC rate"; + return header+data.fcCount +" FC"+(data.fcCount==1?"":"s")+" "+((int)(Math.floor(((float)data.fcCount)/data.plays*100)))+"% FC rate"; } else { return "No Plays"; } } default:{ - return string; + return header+string; } } } catch(NullPointerException e) { - return string; + return header+string; } } private String fullNameDifficulty(String difficulty) { @@ -292,7 +298,7 @@ public class Display { return "Extreme"; } case "EXEX":{ - return "Extra Extreme"; + return "EX Extreme"; } } return ""; diff --git a/DivaBot/src/sig/DisplayManager.java b/DivaBot/src/sig/DisplayManager.java index 9559d83..367893d 100644 --- a/DivaBot/src/sig/DisplayManager.java +++ b/DivaBot/src/sig/DisplayManager.java @@ -48,6 +48,7 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio static JTextField widthInput; static JTextField heightInput; static JTextField delayInput; + static JTextField headerInput; static DefaultListModel model = new DefaultListModel(); static DefaultListModel model2 = new DefaultListModel(); static JComboBox fonts; @@ -145,6 +146,8 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio try { selectedDisplay.font=new Font(selectedDisplay.font.getFontName(),Font.PLAIN,Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength()))); selectedDisplay.fontSize=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength())); + selectedDisplay.nextUpdateTime=0; + selectedDisplay.forceUpdate=true; selectedDisplay.updateFont(); MyRobot.p.repaint(); c.setBackground(Color.WHITE); @@ -186,6 +189,8 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio void updateField(JTextField c, DocumentEvent e) { try { selectedDisplay.width=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength())); + selectedDisplay.nextUpdateTime=0; + selectedDisplay.forceUpdate=true; selectedDisplay.updateFont(); MyRobot.p.repaint(); c.setBackground(Color.WHITE); @@ -226,6 +231,8 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio void updateField(JTextField c, DocumentEvent e) { try { selectedDisplay.height=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength())); + selectedDisplay.nextUpdateTime=0; + selectedDisplay.forceUpdate=true; MyRobot.p.repaint(); c.setBackground(Color.WHITE); } catch (NullPointerException | NumberFormatException | BadLocationException e1) { @@ -262,6 +269,8 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio void updateField(JTextField c, DocumentEvent e) { try { selectedDisplay.delay=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength())); + selectedDisplay.nextUpdateTime=0; + selectedDisplay.forceUpdate=true; MyRobot.p.repaint(); c.setBackground(Color.WHITE); } catch (NullPointerException | NumberFormatException | BadLocationException e1) { @@ -289,13 +298,52 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio } g.anchor=GridBagConstraints.WEST; addComponent(6,10,1,1,new JLabel("ms")); - + addComponent(1,2,12,1,new JLabel(" ")); addComponent(1,4,12,1,new JLabel(" ")); addComponent(1,6,12,1,new JLabel(" ")); addComponent(1,8,12,1,new JLabel(" ")); addComponent(1,9,20,1,new JLabel("Label Delay (Time between each Display)")); addComponent(1,11,12,1,new JLabel(" ")); + + g.anchor=GridBagConstraints.EAST; + addComponent(7,7,1,1,new JLabel(" Header:")); + g.anchor=GridBagConstraints.WEST; + headerInput = (JTextField)addComponent(8,7,2,1,new JTextField() { + @Override + public Dimension getPreferredSize() { + return new Dimension(50,20); + } + }); + headerInput.getDocument().addDocumentListener(new DocumentListener() { + + void updateField(JTextField c, DocumentEvent e) { + try { + selectedDisplay.header=e.getDocument().getText(0, e.getDocument().getLength()); + selectedDisplay.nextUpdateTime=0; + selectedDisplay.forceUpdate=true; + MyRobot.p.repaint(); + c.setBackground(Color.WHITE); + } catch (NullPointerException | NumberFormatException | BadLocationException e1) { + c.setBackground(Color.RED); + } + } + + @Override + public void insertUpdate(DocumentEvent e) { + updateField(headerInput,e); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateField(headerInput,e); + } + + @Override + public void changedUpdate(DocumentEvent e) { + } + + }); labels.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -368,6 +416,7 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio MyRobot.p.configData.put("LAST_DELAY",Integer.toString(d.delay)); fontSizeInput.setText(Integer.toString(d.fontSize)); MyRobot.p.configData.put("LAST_FONTSIZE",Integer.toString(d.fontSize)); + headerInput.setText(d.header); model.clear(); model2.clear(); for (int i=0;i=160&&c.getRed()<=185&&c.getGreen()<=15&&c.getBlue()>=170&&c.getBlue()<=200)) { - FUTURETONE=true; - onSongSelect=true; - } - //System.out.println(c); + //TODO FUTURE TONE SUPPORT DISABLED FOR NOW. +// c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0)); +// if (!onSongSelect&&(c.getRed()>=160&&c.getRed()<=185&&c.getGreen()<=15&&c.getBlue()>=170&&c.getBlue()<=200)) { +// FUTURETONE=true; +// onSongSelect=true; +// } + } - //System.out.println(onSongSelect+"/"+c); //777,179 FUTURE TONE return onSongSelect; diff --git a/DivaBot/src/sig/ReloadSong.java b/DivaBot/src/sig/ReloadSong.java index 584a94a..b1f622d 100644 --- a/DivaBot/src/sig/ReloadSong.java +++ b/DivaBot/src/sig/ReloadSong.java @@ -35,16 +35,11 @@ import sig.utils.FileUtils; public class ReloadSong extends JPanel implements ItemListener,MouseListener{ public static JFrame f = new JFrame(); - public static HashMap SONGARRAY = new HashMap<>(); - public static JComboBox songs; + //public static HashMap SONGARRAY = new HashMap<>(); + public static JComboBox songs; static GridBagConstraints g = new GridBagConstraints(); ReloadSong() throws IOException{ - JSONObject obj = FileUtils.readJsonFromUrl("http://projectdivar.com/songs"); - - for (String s : JSONObject.getNames(obj)) { - JSONObject songdata = obj.getJSONObject(s); - SONGARRAY.put(songdata.getString("name"),songdata); - } + //JSONObject obj = FileUtils.readJsonFromUrl("http://projectdivar.com/songs"); f = new JFrame(); f.setIconImage(ImageIO.read(new File("cross.png"))); @@ -53,18 +48,18 @@ public class ReloadSong extends JPanel implements ItemListener,MouseListener{ g.anchor=GridBagConstraints.EAST; addComponent(1,1,2,1,new JLabel("Select correct song:")); - JSONObject[] songList = new JSONObject[SONGARRAY.size()]; + SongInfo[] songList = new SongInfo[MyRobot.SONGNAMES.length]; int count = 0; - for (String s : SONGARRAY.keySet()) { - songList[count++]=SONGARRAY.get(s); + for (SongInfo s : MyRobot.SONGNAMES) { + songList[count++]=s; } for (int i = 0; i < count; i++) { for (int j = i + 1; j < count; j++) { - if (songList[i].getString("english_name").toLowerCase().compareTo(songList[j].getString("english_name").toLowerCase())>0) + if (songList[i].english_name.toLowerCase().compareTo(songList[j].english_name.toLowerCase())>0) { - JSONObject temp = songList[i]; + SongInfo temp = songList[i]; songList[i] = songList[j]; songList[j] = temp; } @@ -98,7 +93,7 @@ public class ReloadSong extends JPanel implements ItemListener,MouseListener{ f.add(this); f.pack(); f.setResizable(false); - f.setVisible(true); + f.setVisible(false); } private Component addComponent(int x, int y, int w, int h,Component component) { g.gridx=x; @@ -124,7 +119,7 @@ public class ReloadSong extends JPanel implements ItemListener,MouseListener{ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - JSONObject selectedSong = ((JSONObject)value); + SongInfo selectedSong = ((SongInfo)value); if (isSelected) { setBackground(list.getSelectionBackground()); @@ -133,11 +128,11 @@ public class ReloadSong extends JPanel implements ItemListener,MouseListener{ setBackground(list.getBackground()); setForeground(list.getForeground()); } - setText(selectedSong.getString("english_name") + setText(selectedSong.english_name +" - " - +((selectedSong.getString("romanized_name").length()>0)? - (!selectedSong.getString("romanized_name").equalsIgnoreCase(selectedSong.getString("name")))? - selectedSong.getString("romanized_name")+"("+selectedSong.getString("name")+")":"":selectedSong.getString("name"))); + +((selectedSong.romanized_name.length()>0)? + (!selectedSong.romanized_name.equalsIgnoreCase(selectedSong.name))? + selectedSong.romanized_name+"("+selectedSong.name+")":"":selectedSong.name)); return this; } @@ -166,7 +161,7 @@ public class ReloadSong extends JPanel implements ItemListener,MouseListener{ } } try { - SongData.saveSongToFile(((JSONObject)songs.getSelectedItem()).getString("name"),totalr,totalg,totalb); + SongData.saveSongToFile(((SongInfo)songs.getSelectedItem()).name,totalr,totalg,totalb); } catch (JSONException | IOException e2) { e2.printStackTrace(); } diff --git a/DivaBot/src/sig/SongData.java b/DivaBot/src/sig/SongData.java index 7a49bb3..d9e01e6 100644 --- a/DivaBot/src/sig/SongData.java +++ b/DivaBot/src/sig/SongData.java @@ -49,7 +49,7 @@ public class SongData { public static void saveSongToFile(String title, long r, long g, long b) throws IOException { boolean found=false; - StringBuilder sb = new StringBuilder(title); + StringBuilder sb = new StringBuilder(title.replaceAll(":", "-COLON-")); sb.append(":"); sb.append(r).append(",") @@ -60,7 +60,7 @@ public class SongData { String[] split = fileData[i].split(":"); if (split.length>0) { //System.out.println(split[0]+"/"+title); - if (split[0].equalsIgnoreCase(title)) { + if (split[0].replaceAll("-COLON-", ":").equalsIgnoreCase(title)) { //System.out.println("Updated color data with new data for "+title+"!"); fileData[i]=sb.toString(); found=true; @@ -88,7 +88,7 @@ public class SongData { public static SongData ParseSong(String s) { String[] split = s.split(":"); - String title = split[0]; + String title = split[0].replaceAll("-COLON-", ":"); String[] data = split[1].split(","); if (Math.pow(Long.parseLong(data[0]),2)+Math.pow(Long.parseLong(data[1]),2)+Math.pow(Long.parseLong(data[2]),2)=0 && currentCol.getRed()<=70 - && currentCol.getGreen()>=0 && currentCol.getGreen()<=100 - && currentCol.getBlue()>=0 && currentCol.getBlue()<=120)) { - img.setRGB(x, y, new Color(8,114,140).getRGB()); - } else { - img.setRGB(x, y, Color.WHITE.getRGB()); - } - } else - if ((currentCol.getRed()>=0 && currentCol.getRed()<=105 - && currentCol.getGreen()>=0 && currentCol.getGreen()<=150 - && currentCol.getBlue()>=0 && currentCol.getBlue()<=150) || - (this.equals(DemoApplication.typeface2) && - currentCol.getRed()>=0 && currentCol.getRed()<=120 - && currentCol.getGreen()>=100 && currentCol.getGreen()<=210 - && currentCol.getBlue()>=120 && currentCol.getBlue()<=230 - && currentCol.getGreen()+5blue_minthreshold && p.getBlue()green_minthreshold && p.getGreen()red_minthreshold && p.getRed()200 && p.getGreen()>200 && p.getRed()>200) { - state=2; - if (DEBUG_IMG) { - try { - BufferedImage img2 = ImageUtils.toCompatibleImage(ImageUtils.copyBufferedImage(img)); - img2.setRGB(X, midY, Color.RED.getRGB()); - ImageIO.write(img2,"png",new File("stage2_"+System.currentTimeMillis()+".png")); - } catch (IOException e) { - e.printStackTrace(); - } - } - //System.out.println("Found light pixel"); - } - }break; - case 2:{ - //Fill algorithm until entire number is filled. - ImgRectangle i = new ImgRectangle(); - success = fill(img,X,midY,0,0,i); - if (!success) { - //We're done. - X=img.getWidth(); - break; - } else { - numberImg = i.createImage(); - if (numberImg.getWidth()>=32) { - state=0; - break; - } - X+=i.maxX; - if (numberImg.getHeight()<10 || numberImg.getWidth()<4) { - //A number should be at least 10 pixels high...This is not satisfactory. - state=4; - break; - } - //X+=numberImg.getWidth(); - state=3; - if (DEBUG_IMG) { - try { - BufferedImage img2 = ImageUtils.toCompatibleImage(ImageUtils.copyBufferedImage(img)); - img2.setRGB(X, midY, Color.RED.getRGB()); - ImageIO.write(img2,"png",new File("stage3_"+System.currentTimeMillis()+".png")); - } catch (IOException e) { - e.printStackTrace(); - } - } - //System.out.println("Moving to next step: "); - } - }break; - case 3:{ - //Figure out which number in the typeface it best represents. - numberImg = ImageUtils.toCompatibleImage(ImageUtils.toBufferedImage(numberImg.getScaledInstance(WIDTH, HEIGHT, Image.SCALE_FAST))); - //System.out.println(numberImg.getWidth()+"x"+numberImg.getHeight()); - int[] hits = new int[NUMBER_COUNT]; - double highestRatio = 0; - int highest = 0; - boolean goNext=false; - boolean foundOne=false; - for (int k=0;khighestRatio) { - highestRatio= (double)(hits[k])/(WIDTH*HEIGHT); - highest=k; - } - } else { - if (pixel.equals(Color.WHITE)) { - img2.setRGB(i, j, Color.BLUE.getRGB()); - } else { - img2.setRGB(i, j, Color.RED.getRGB()); - } - //FileUtils.logToFile("Pixel difference: "+numbers[i*HEIGHT+j][k]+"/"+pixel, new File(saveLoc,(iterations)+".txt").getPath()); - } - } - } - if (goNext) {break;} - } - FileUtils.logToFile(((k+1)%NUMBER_COUNT)+":"+((double)(hits[k])/(WIDTH*HEIGHT)), new File(saveLoc,(iterations)+".txt").getPath()); - try { - ImageIO.write(img2,"png",new File(saveLoc,(iterations)+"_"+((k+1)%NUMBER_COUNT)+".png")); - } catch (IOException e) { - e.printStackTrace(); - } - goNext=false; - } - if (!foundOne) { - state=0; - iterations++; - break; - } - //System.out.println("Matches closest to "+((highest+1)%NUMBER_COUNT)+" with "+highestRatio); - iterations++; - extractedNumbers+=Integer.toString((highest+1)%NUMBER_COUNT); - state=4; - }break; - case 4:{ - //Find light pixels again. - if (p.getBlue()>200 && p.getGreen()>200 && p.getRed()>200) { - X-=2; - state=0; - if (DEBUG_IMG) { - try { - BufferedImage img2 = ImageUtils.toCompatibleImage(ImageUtils.copyBufferedImage(img)); - img2.setRGB(X, midY, Color.RED.getRGB()); - ImageIO.write(img2,"png",new File("stage4_"+System.currentTimeMillis()+".png")); - } catch (IOException e) { - e.printStackTrace(); - } - } - //System.out.println("Found next dark pixel"); - } - }break; - } - X++; - } - //System.out.println("Got "+extractedNumbers); - if (extractedNumbers.length()==0) { - return -1; - } else { - return Integer.parseInt(extractedNumbers); - } - } - - public boolean fillDark(BufferedImage img,int startX,int startY,int x,int y, int iterations) { - //rect.AddPixel(new Point(x,y), Color.BLACK); - if (iterations>Math.max(img.getWidth(),img.getHeight())) { - return false; - } - img.setRGB(startX+x, startY+y, Color.BLACK.getRGB()); - Color p = null; - if (startX+x+1blue_fillminthreshold && p.getBlue()green_fillminthreshold && p.getGreen()red_fillminthreshold && p.getRed()0) { - p = new Color(img.getRGB(startX+x-1, startY+y)); - if (p.getBlue()>blue_fillminthreshold && p.getBlue()green_fillminthreshold && p.getGreen()red_fillminthreshold && p.getRed()blue_fillminthreshold && p.getBlue()green_fillminthreshold && p.getGreen()red_fillminthreshold && p.getRed()0) { - p = new Color(img.getRGB(startX+x, startY+y-1)); - if (p.getBlue()>blue_fillminthreshold && p.getBlue()green_fillminthreshold && p.getGreen()red_fillminthreshold && p.getRed()200 && p.getGreen()>200 && p.getRed()>200) { - fill(img,startX,startY,x+1,y,rect); - } - } else { - return false; - } - if (startX+x-1>0) { - p = new Color(img.getRGB(startX+x-1, startY+y)); - if (p.getBlue()>200 && p.getGreen()>200 && p.getRed()>200) { - fill(img,startX,startY,x-1,y,rect); - } - } else { - return false; - } - if (startY+y+1200 && p.getGreen()>200 && p.getRed()>200) { - fill(img,startX,startY,x,y+1,rect); - } - } else { - return false; - } - if (startY+y-1>0) { - p = new Color(img.getRGB(startX+x, startY+y-1)); - if (p.getBlue()>200 && p.getGreen()>200 && p.getRed()>200) { - fill(img,startX,startY,x,y-1,rect); - } - } else { - return false; - } - return true; - } - - - class ImgRectangle{ - int minX=0,maxX=0,minY=0,maxY=0; - List p = new ArrayList(); - void AddPixel(Point p, Color c) { - this.p.add(new Pixel(p,c)); - if (p.xmaxX) { - maxX=p.x; - } - if (p.ymaxY) { - maxY=p.y; - } - } - BufferedImage createImage() { - int finalWidth = maxX-minX+1; - int offsetX = 0; - int finalHeight = maxY-minY+1; - int offsetY = 0; - /*if (finalWidth > finalHeight) { - //Add padding for height. - offsetY += (finalWidth-finalHeight)/2; - finalHeight+= offsetY*2; - } - if (finalHeight > finalWidth) { - //Add padding for width. - offsetX += (finalHeight-finalWidth)/2; - finalWidth+= offsetX*2; - }*/ - - BufferedImage bufferedImage = ImageUtils.toCompatibleImage(new BufferedImage(finalWidth, finalHeight, - BufferedImage.TYPE_INT_RGB)); - Graphics2D graphics = bufferedImage.createGraphics(); - graphics.setPaint ( new Color ( 255, 255, 255 ) ); - graphics.fillRect ( 0, 0, bufferedImage.getWidth(), bufferedImage.getHeight() ); - for (Pixel pixel : p) { - bufferedImage.setRGB(pixel.p.x-minX+offsetX, pixel.p.y-minY+offsetY, pixel.c.getRGB()); - } - return bufferedImage; - } - } - - - class Pixel{ - Point p; - Color c; - Pixel(Point p,Color c) { - this.p=p; - this.c=c; - } - } -} \ No newline at end of file diff --git a/DivaBot/test.png b/DivaBot/test.png index 177bdd1..343ba40 100644 Binary files a/DivaBot/test.png and b/DivaBot/test.png differ diff --git a/Release/DivaBot/DivaBot/DivaBot.jar b/Release/DivaBot/DivaBot/DivaBot.jar index 9eaee54..72a70a1 100644 Binary files a/Release/DivaBot/DivaBot/DivaBot.jar and b/Release/DivaBot/DivaBot/DivaBot.jar differ diff --git a/Release/DivaBot/DivaBot/colorData b/Release/DivaBot/DivaBot/colorData index 19acfc4..98ef0f3 100644 --- a/Release/DivaBot/DivaBot/colorData +++ b/Release/DivaBot/DivaBot/colorData @@ -8,7 +8,7 @@ Weekender Girl:9603623129,8143536192,7023009997 神曲:4946258494,4475941595,3340301379 カンタレラ:4503782143,3790000754,2513049117 巨大少女:3731017798,4370780514,7413760542 -クローバー♣クラブ:4365468840,5530233610,4779101844 +クローバー♣クラブ:5260193720,6627800391,5551285857 恋スルVOC@LOID:11460873603,10480525867,9425227787 桜ノ雨:8300126301,6096391834,6982464695 39:8911910637,8910841892,7738153876 @@ -113,7 +113,7 @@ Sweet Devil:6634620218,3136086595,6192411098 テオ:1670938584,1119524410,5147341281 初音ミクの消失 -DEAD END-:6701961288,6767316619,6746417217 秘密警察:3262137487,4000164607,3989724890 -妄想スケッチ:5664849812,5303351516,6760495429 +妄想スケッチ:6382410753,5949239568,7533122178 リンちゃんなう!:7136782033,6228041551,4262735136 ローリンガール:6764558530,6758136800,6759135862 ロキ:2406990430,945189166,3873292660 @@ -162,3 +162,17 @@ Star Story:1808285827,3434600865,4320953611 夢の続き:9980651028,9269054443,7923490029 MEGANE:12097703860,7865703856,8089571528 Change me:6946360046,4571504089,2910280226 +アドレサンス:5458033068,4389022230,4212580841 +グリーンライツセレナーデ:6422553300,6622495000,6942409156 +サウンド:2350288995,3725672868,3350500213 +Stay with me:6858394047,5138098343,3976139800 +ドラマツルギー:9364452247,9429738184,9396666719 +Nyanyanyanyanyanyanya!:8284558575,7067572325,6713348796 +巴里映画少女:7543881170,6294797933,6122764603 +ファインダー (DSLR remix - re-COLON-edit):5687636652,7373735766,7988148878 +フキゲンワルツ:7878892274,8044206152,6207005607 +Promise:4021169803,4900248262,6497913358 +星屑ユートピア:3370014582,2298015215,925945505 +マージナル:7836108651,8174436060,8267809525 +Last Night, Good Night:3265412964,4528174454,4889449827 +Leia:6765406279,5114086294,4206059909 diff --git a/Release/DivaBot/DivaBot/reloadSong.png b/Release/DivaBot/DivaBot/reloadSong.png new file mode 100644 index 0000000..6800026 Binary files /dev/null and b/Release/DivaBot/DivaBot/reloadSong.png differ diff --git a/Release/DivaBot02.zip b/Release/DivaBot02.zip deleted file mode 100644 index ac07208..0000000 Binary files a/Release/DivaBot02.zip and /dev/null differ