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; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import javax.imageio.ImageIO; import readers.fonts.Font; import readers.fonts.Glyph; public class SoundVoltexReader extends Reader{ final static int REGION_PADDING = 32; List extraRegions = new ArrayList<>(); static int lastJump=0; boolean effectiveRate=false; boolean failed=false; public SoundVoltexReader(){ addRegion(new Box(385,1006,454,29)); //title[0] addRegion(new Box(476,1075,242,57),NUMBER); //bigscore[1] addRegion(new Box(717,1096,146,34),NUMBER); //score[2] addRegion(new Box(630,1142,110,16),NUMBER); //exscore[3] addRegion(new Box(932,1194,55,19)); //health percentage[4] addRegion(new Box(617,1237,70,23),NUMBER); //early error[5] addRegion(new Box(617,1268,70,23),NUMBER); //early near[6] addRegion(new Box(617,1300,70,23),NUMBER); //early critical[7] addRegion(new Box(617,1330,70,23),NUMBER); //s-critical[8] addRegion(new Box(617,1362,70,23),NUMBER); //late critical[9] addRegion(new Box(617,1393,70,23),NUMBER); //late near[10] addRegion(new Box(617,1424,70,23),NUMBER); //late error[11] addRegion(new Box(188,1231,70,23),NUMBER); //chip s-critical[12] addRegion(new Box(188,1262,70,23),NUMBER); //chip critical[13] addRegion(new Box(188,1294,70,23),NUMBER); //chip near[14] addRegion(new Box(188,1324,70,23),NUMBER); //chip error[15] addRegion(new Box(266,1231,70,23),NUMBER); //long s-critical[16] addRegion(new Box(266,1324,70,23),NUMBER); //long error[17] addRegion(new Box(345,1231,70,23),NUMBER); //vol s-critical[18] addRegion(new Box(345,1324,70,23),NUMBER); //vol error[19] addRegion(new Box(304,1364,70,23),NUMBER); //max combo[20] addRegion(new Box(58,862,132,26)); //difficulty[21] addRegion(new Box(875,1046,125,82)); //rating[22] extraRegions.add(new Box(531,1152,75,16)); //EX Score text[0] extraRegions.add(new Box(753,1197,150,16)); //effective rate text[1] extraRegions.add(new Box(499,1238,78,23)); //early error text[2] extraRegions.add(new Box(499,1268,78,23)); //early near text[3] extraRegions.add(new Box(499,1300,93,23)); //early critical text[4] extraRegions.add(new Box(499,1332,108,23)); //s-critical text[5] extraRegions.add(new Box(499,1362,93,23)); //late critical text[6] extraRegions.add(new Box(499,1393,78,23)); //late near text[7] extraRegions.add(new Box(499,1424,78,23)); //late error text[8] extraRegions.add(new Box(62,1230,119,24)); //s-critical extra text[9] extraRegions.add(new Box(62,1262,119,24)); //critical extra text[10] extraRegions.add(new Box(62,1294,119,24)); //near extra text[11] extraRegions.add(new Box(62,1325,119,24)); //error extra text[12] extraRegions.add(new Box(62,1230,119,24)); //s-critical extra text[13] extraRegions.add(new Box(62,1325,119,24)); //error extra text[14] extraRegions.add(new Box(62,1230,119,24)); //s-critical extra text[15] extraRegions.add(new Box(62,1325,119,24)); //error extra text[16] extraRegions.add(new Box(71,1365,171,22)); //maximum chain text[17] init(); } void ColorFilter(int[] arr,int region,int width) { switch (region) { case 0:{ final ColorRange TARGETCOLOR = new ColorRange(240,255,240,255,240,255); final ColorRange SEEKINGCOLOR = new ColorRange(100,255,100,255,100,255); final Color FINALCOLOR = Color.MAGENTA; for (int i=0;imaxWidth) { maxWidth=readRegions.get(i).w; } } try { BufferedImage originalImg = ImageIO.read(img.toFile()); BufferedImage cutImg = new BufferedImage(maxWidth,regionHeights,BufferedImage.TYPE_INT_ARGB); Graphics2D g = cutImg.createGraphics(); int currentHeight=0; for (int i=0;i glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } case 2:{ Font f = Font.FONT_SDVX_LITTLESCORE; List glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } case 3:{ Font f = Font.FONT_SDVX_EXSCORE; List glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:{ Font f = Font.FONT_SDVX_NOTECOUNT; List glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } } return ""; } String interpretResults(String[] finalData) { for (int i=0;i=9900000) {rank=0;/*S*/} else if (score>=9800000) {rank=1;/*AAA+*/} else if (score>=9700000) {rank=2;/*AAA*/} else if (score>=9500000) {rank=3;/*AA+*/} else if (score>=9300000) {rank=4;/*AA*/} else if (score>=9000000) {rank=5;/*A+*/} else if (score>=8700000) {rank=6;/*A*/} else if (score>=8000000) {rank=7;/*B*/} else if (score>=7000000) {rank=8;/*C*/} else {rank=9;/*D*/} }break; } } return toString(); } }