diff --git a/ArcadeReader.java b/ArcadeReader.java index 5d34a90..d288478 100644 --- a/ArcadeReader.java +++ b/ArcadeReader.java @@ -59,6 +59,6 @@ public class ArcadeReader { * */ public static void retrieveData(Path img) { - new ITGReader().interpretBoxes(img); + new LoveLiveReader().interpretBoxes(img); } } diff --git a/readers/LoveLiveReader.java b/readers/LoveLiveReader.java index de0d9d2..af9d80b 100644 --- a/readers/LoveLiveReader.java +++ b/readers/LoveLiveReader.java @@ -2,6 +2,7 @@ package readers; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; @@ -12,27 +13,31 @@ import java.util.regex.Pattern; import javax.imageio.ImageIO; +import readers.fonts.Font; +import readers.fonts.Glyph; + public class LoveLiveReader extends Reader{ List extraRegions = new ArrayList<>(); static int lastJump=0; public LoveLiveReader(){ - readRegions.add(new Box(713,401,232,50)); //score[0] - readRegions.add(new Box(613,290,65,36)); //rank[1] + addRegion(new Box(713,401,232,50),NUMBER); //score[0] + addRegion(new Box(613,290,65,36)); //rank[1] extraRegions.add(new Box(65,604,250,53)); //perfect outline[0] extraRegions.add(new Box(65,680,250,53)); //great outline[1] extraRegions.add(new Box(65,760,250,53)); //good outline[2] extraRegions.add(new Box(65,840,250,53)); //bad outline[3] extraRegions.add(new Box(65,920,250,53)); //miss outline[4] - readRegions.add(new Box(509,604,190,54)); //notes[2] - readRegions.add(new Box(509,680,190,54)); //notes[3] - readRegions.add(new Box(509,760,190,54)); //notes[4] - readRegions.add(new Box(509,840,190,54)); //notes[5] - readRegions.add(new Box(509,920,190,54)); //notes[6] - readRegions.add(new Box(26,374,265,36)); //difficulty[7] - readRegions.add(new Box(277,165,572,40)); //title[8] - readRegions.add(new Box(716,502,226,45)); //pct[9] - readRegions.add(new Box(782,452,158,50)); //maxcombo[10] - readRegions.add(new Box(100,470,84,42)); //difficultylv[11] + addRegion(new Box(509,604,190,54),NUMBER); //notes[2] + addRegion(new Box(509,680,190,54),NUMBER); //notes[3] + addRegion(new Box(509,760,190,54),NUMBER); //notes[4] + addRegion(new Box(509,840,190,54),NUMBER); //notes[5] + addRegion(new Box(509,920,190,54),NUMBER); //notes[6] + addRegion(new Box(26,374,265,36)); //difficulty[7] + addRegion(new Box(277,165,572,40)); //title[8] + addRegion(new Box(716,502,226,45),NUMBER); //pct[9] + addRegion(new Box(782,452,158,50),NUMBER); //maxcombo[10] + addRegion(new Box(100,470,84,42)); //difficultylv[11] + init(); } void ColorFilter(int[] arr,int region,int width) { @@ -187,6 +192,7 @@ public class LoveLiveReader extends Reader{ int regionHeights = 0; int maxWidth = 0; + int counter = 0; for (int i=0;imaxWidth) { @@ -199,35 +205,21 @@ public class LoveLiveReader extends Reader{ Graphics2D g = cutImg.createGraphics(); int currentHeight=0; for (int i=0;i=2&&i<=6) { - int[] arr2 = originalImg.getRGB(extraRegions.get(i-2).x, extraRegions.get(i-2).y, extraRegions.get(i-2).w, extraRegions.get(i-2).h, null, 0, extraRegions.get(i-2).w); - int rightMost=0; - ColorFilter(arr2,400+i-2,extraRegions.get(i-2).w); - for (int j=0;jrightMost) { - rightMost=j%extraRegions.get(i-2).w; - } - } - //cutImg.setRGB(rightMost-leftMost,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); - cutImg.setRGB(0,currentHeight,extraRegions.get(i-2).w,extraRegions.get(i-2).h,arr2,0,extraRegions.get(i-2).w); - final int PADDING = 8; - for (int x=leftMost;x glyphs = Glyph.split(cutImg); + return f.convertGlyphs(glyphs); + } + case 2: + case 3: + case 4: + case 5: + case 6:{ + Font f = Font.FONT_LOVELIVE_NOTECOUNT; + List glyphs = Glyph.split(cutImg); + return f.convertGlyphs(glyphs); + } + case 9:{ + Font f = Font.FONT_LOVELIVE_PCT; + List glyphs = Glyph.split(cutImg); + glyphs.remove(glyphs.size()-3); + glyphs.remove(glyphs.size()-1); + String res = f.convertGlyphs(glyphs,true); + return res.substring(0,glyphs.size()-1)+"."+res.substring(glyphs.size()-1,glyphs.size()); + } + } + return ""; + } + void interpretResults(String[] finalData) { for (int i=0;i glyphs) { + return convertGlyphs(glyphs,false); + } + + public String convertGlyphs(List glyphs,boolean debug) { StringBuilder sb = new StringBuilder(); for (int i=0;ibestScore) { bestScore=score; bestGlyph=j; - //System.out.println("Glyph "+j+" has a score of "+bestScore+"."); + if (debug) { + System.out.println("Glyph "+j+" has a score of "+bestScore+"."); + } } } sb.append(bestGlyph); diff --git a/result.png b/result.png index 8de097c..396c7cf 100644 Binary files a/result.png and b/result.png differ diff --git a/sigPlace.java b/sigPlace.java index bafa6ba..e0ae3b7 100644 --- a/sigPlace.java +++ b/sigPlace.java @@ -115,7 +115,7 @@ public class sigPlace { // TODO Auto-generated catch block e.printStackTrace(); }*/ - ArcadeReader.retrieveData(Paths.get("itg11.png")); + ArcadeReader.retrieveData(Paths.get("lovelive2.png")); /* Path secretFile = Paths.get(".clientsecret"); List data; try { diff --git a/sub.png b/sub.png index c564cfa..83bd239 100644 Binary files a/sub.png and b/sub.png differ