only sound voltex tests remain (#7)

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent 70caf2749d
commit e68dee75f3
  1. 153
      ArcadeReader.java
  2. 16
      readers/DDRReader.java
  3. 21
      readers/ITGReader.java
  4. 14
      readers/LoveLiveReader.java
  5. 16
      readers/PopnReader.java
  6. 18
      readers/Reader.java
  7. 6
      readers/SoundVoltexReader.java
  8. 2
      readers/TestReader.java
  9. 4
      readers/fonts/Font.java
  10. 20
      readers/fonts/lovelive_score
  11. BIN
      result.png
  12. 12
      sigPlace.java
  13. BIN
      sub.png
  14. BIN
      test.png

@ -1,6 +1,9 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.imageio.ImageIO;
import readers.ColorRange;
import readers.DDRReader;
import readers.ITGReader;
import readers.LoveLiveReader;
@ -9,6 +12,10 @@ import readers.Reader;
import readers.SoundVoltexReader;
import readers.TestReader;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.awt.Color;
public class ArcadeReader {
/*
* Important data we would like to know for all games:
@ -62,6 +69,9 @@ public class ArcadeReader {
*
*/
static int testCount=0;
static int testsSucceeded=0;
final static int DDR_AAA=0;
final static int DDR_AAPLUS=1;
final static int DDR_AA=2;
@ -121,16 +131,61 @@ public class ArcadeReader {
final static int SDVX_B=7;
final static int SDVX_C=8;
final static int SDVX_D=9;
boolean test(String filename,Class<Reader> reader,int score,int rank,int[] notes,int diff,double pct,int maxcombo) {
return test(filename,reader,score,rank,notes,diff,pct,maxcombo,"");
static Reader interpret(String filename) {
try {
BufferedImage img = ImageIO.read(Paths.get("tests",filename).toFile());
if (img.getHeight()>img.getWidth()) {
return new SoundVoltexReader();
} else {
Color col1 = new Color(img.getRGB(31, 41),true);
ColorRange range1 = new ColorRange(245,255,235,240,70,80);
Color col2 = new Color(img.getRGB(27, 1012),true);
ColorRange range2 = new ColorRange(245,255,160,170,195,205);
if (range1.colorInRange(col1)) {
return new PopnReader();
}
if (col1.equals(Color.BLACK)) {
return new DDRReader();
}
if (col1.equals(Color.WHITE)) {
return new ITGReader();
}
if (range2.colorInRange(col2)) {
return new LoveLiveReader();
}
}
boolean test(String filename,Class<Reader> reader,int score,int rank,int[] notes,int diff,double pct,int maxcombo,String other) {
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
static void test(String filename,Class<?> reader,int score,int rank,int[] notes,int diff,double pct,int maxcombo){
test(filename,reader,score,rank,notes,diff,pct,maxcombo,"");
}
static void test(String filename,Class<?> reader,int score,int rank,int[] notes,int diff,double pct,int maxcombo,String other){
testCount++;
Reader r = interpret(filename);
r.interpretBoxes(Paths.get("tests",filename));
r.interpretBoxes(Paths.get("tests",filename),true);
Reader compare = new TestReader(score,rank,notes,diff,pct,maxcombo,other);
if (!reader.isInstance(r)) {
ArcadeReader.err(new Exception("Test \""+filename+"\" Failed:\nExpected class type: "+reader+" \nActual:"+r.getClass()));
return;
}
if (!compare.equals(r)) {
throw new Exception("Test Failed:\nExpected:"+compare+"\nActual:"+r);
ArcadeReader.err(new Exception("Test \""+filename+"\" Failed:\nExpected:"+compare+"\nActual:"+r));
return;
}
ArcadeReader.success();
}
public static void err(Exception e){
System.out.println(e.getStackTrace()[0]);
System.out.println(e.getMessage());
System.exit(1);
}
public static void success(){
testsSucceeded++;
System.out.println(testsSucceeded+"/"+testCount+"passed!");
}
public static void runTests() {
@ -141,7 +196,7 @@ public class ArcadeReader {
9/*difficulty*/,
0.0/*pct*/,
287/*maxcombo*/,
"{ex:1411,fast:18,slow:62,playstyle:\"SINGLE\",diff:\"CHALLENGE\"}"/*other*/);
"{ex:1411,fast:18,slow:62,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr2.png",DDRReader.class,
875800/*score*/,
DDR_APLUS/*rank*/,
@ -149,7 +204,7 @@ public class ArcadeReader {
11/*difficulty*/,
0.0/*pct*/,
230/*maxcombo*/,
"{ex:1529,fast:105,slow:217,playstyle:\"SINGLE\",diff:\"CHALLENGE\"}"/*other*/);
"{ex:1529,fast:105,slow:217,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr3.png",DDRReader.class,
991000/*score*/,
DDR_AAA/*rank*/,
@ -157,7 +212,7 @@ public class ArcadeReader {
9/*difficulty*/,
0.0/*pct*/,
526/*maxcombo*/,
"{ex:1701,fast:16,slow:95,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:1701,fast:16,slow:95,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr4.png",DDRReader.class,
959410/*score*/,
DDR_AAPLUS/*rank*/,
@ -165,7 +220,7 @@ public class ArcadeReader {
10/*difficulty*/,
0.0/*pct*/,
310/*maxcombo*/,
"{ex:2128,fast:158,slow:82,playstyle:\"SINGLE\",diff:\"CHALLENGE\"}"/*other*/);
"{ex:2128,fast:158,slow:82,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr5.png",DDRReader.class,
996070/*score*/,
DDR_AAA/*rank*/,
@ -173,7 +228,7 @@ public class ArcadeReader {
12/*difficulty*/,
0.0/*pct*/,
339/*maxcombo*/,
"{ex:997,fast:14,slow:36,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:997,fast:14,slow:36,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr6.png",DDRReader.class,
995410/*score*/,
DDR_AAA/*rank*/,
@ -181,7 +236,7 @@ public class ArcadeReader {
13/*difficulty*/,
0.0/*pct*/,
779/*maxcombo*/,
"{ex:1322,fast:20,slow:54,playstyle:\"SINGLE\",diff:\"CHALLENGE\"}"/*other*/);
"{ex:1322,fast:20,slow:54,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr7.png",DDRReader.class,
940300/*score*/,
DDR_AA/*rank*/,
@ -189,7 +244,7 @@ public class ArcadeReader {
14/*difficulty*/,
0.0/*pct*/,
100/*maxcombo*/,
"{ex:1258,fast:51,slow:82,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:1258,fast:51,slow:82,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr8.png",DDRReader.class,
978970/*score*/,
DDR_AAPLUS/*rank*/,
@ -197,7 +252,7 @@ public class ArcadeReader {
15/*difficulty*/,
0.0/*pct*/,
320/*maxcombo*/,
"{ex:1541,fast:72,slow:83,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:1541,fast:72,slow:83,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr9.png",DDRReader.class,
891770/*score*/,
DDR_APLUS/*rank*/,
@ -205,7 +260,7 @@ public class ArcadeReader {
16/*difficulty*/,
0.0/*pct*/,
211/*maxcombo*/,
"{ex:1633,fast:186,slow:99,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:1633,fast:186,slow:99,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr10.png",DDRReader.class,
867270/*score*/,
DDR_APLUS/*rank*/,
@ -213,7 +268,7 @@ public class ArcadeReader {
17/*difficulty*/,
0.0/*pct*/,
80/*maxcombo*/,
"{ex:1457,fast:166,slow:110,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:1457,fast:166,slow:110,playstyle:\"\",diff:\"\"}"/*other*/);
test("ddr11.png",DDRReader.class,
201760/*score*/,
DDR_E/*rank*/,
@ -221,7 +276,7 @@ public class ArcadeReader {
18/*difficulty*/,
0.0/*pct*/,
65/*maxcombo*/,
"{ex:329,fast:62,slow:10,playstyle:\"SINGLE\",diff:\"EXPERT\"}"/*other*/);
"{ex:329,fast:62,slow:10,playstyle:\"\",diff:\"\"}"/*other*/);
test("itg1.png",ITGReader.class,
8020/*score*/,
ITG_APLUS/*rank*/,
@ -331,91 +386,91 @@ public class ArcadeReader {
325415/*score*/,
LOVELIVE_SSS/*rank*/,
new int[]{539,4,0,0,0,0,0}/*notes*/,
10/*difficulty*/,
0/*difficulty*/,
119.8/*pct*/,
543/*maxcombo*/);
test("lovelive2.png",LoveLiveReader.class,
331923/*score*/,
LOVELIVE_SS/*rank*/,
new int[]{514,96,0,0,0,0,0}/*notes*/,
11/*difficulty*/,
0/*difficulty*/,
116.8/*pct*/,
610/*maxcombo*/);
test("lovelive3.png",LoveLiveReader.class,
282182/*score*/,
LOVELIVE_SS/*rank*/,
new int[]{573,45,4,3,8,0,0}/*notes*/,
11/*difficulty*/,
0/*difficulty*/,
115.9/*pct*/,
334/*maxcombo*/);
test("lovelive4.png",LoveLiveReader.class,
282182/*score*/,
LOVELIVE_SS/*rank*/,
new int[]{573,45,4,3,8,0,0}/*notes*/,
11/*difficulty*/,
0/*difficulty*/,
115.9/*pct*/,
334/*maxcombo*/);
test("lovelive5.png",LoveLiveReader.class,
19454/*score*/,
LOVELIVE_SS/*rank*/,
new int[]{117,11,1,0,0,0,0}/*notes*/,
2/*difficulty*/,
0/*difficulty*/,
117.5/*pct*/,
74/*maxcombo*/);
test("lovelive6.png",LoveLiveReader.class,
290746/*score*/,
LOVELIVE_SS/*rank*/,
new int[]{525,104,0,1,1,0,0}/*notes*/,
10/*difficulty*/,
0/*difficulty*/,
116.3/*pct*/,
427/*maxcombo*/);
test("lovelive7.png",LoveLiveReader.class,
0/*score*/,
LOVELIVE_D/*rank*/,
new int[]{0,0,0,0,0,0,0}/*notes*/,
11/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
0/*maxcombo*/);
test("lovelive8.png",LoveLiveReader.class,
140879/*score*/,
LOVELIVE_A/*rank*/,
new int[]{445,16,0,0,1,0,0}/*notes*/,
7/*difficulty*/,
0/*difficulty*/,
119.0/*pct*/,
237/*maxcombo*/);
test("lovelive9.png",LoveLiveReader.class,
183644/*score*/,
LOVELIVE_SSS/*rank*/,
new int[]{452,10,0,0,0,0,0}/*notes*/,
7/*difficulty*/,
0/*difficulty*/,
119.5/*pct*/,
462/*maxcombo*/);
test("lovelive10.png",LoveLiveReader.class,
143468/*score*/,
LOVELIVE_S/*rank*/,
new int[]{410,12,0,1,37,0,0}/*notes*/,
7/*difficulty*/,
0/*difficulty*/,
109.1/*pct*/,
334/*maxcombo*/);
test("lovelive11.png",LoveLiveReader.class,
100456/*score*/,
LOVELIVE_B/*rank*/,
new int[]{303,17,0,0,119,0,0}/*notes*/,
7/*difficulty*/,
0/*difficulty*/,
82.3/*pct*/,
235/*maxcombo*/);
test("lovelive12.png",LoveLiveReader.class,
70288/*score*/,
LOVELIVE_C/*rank*/,
new int[]{197,16,0,0,206,0,0}/*notes*/,
7/*difficulty*/,
0/*difficulty*/,
54.6/*pct*/,
213/*maxcombo*/);
test("popn1.png",PopnReader.class,
83520/*score*/,
POPN_A/*rank*/,
new int[]{495,238,54,44,0,0,0}/*notes*/,
36/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
78/*maxcombo*/,
"{failed:false}"/*other*/);
@ -423,7 +478,7 @@ public class ArcadeReader {
81259/*score*/,
POPN_B/*rank*/,
new int[]{482,310,91,36,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
112/*maxcombo*/,
"{failed:false}"/*other*/);
@ -431,7 +486,7 @@ public class ArcadeReader {
79269/*score*/,
POPN_B/*rank*/,
new int[]{481,396,112,37,0,0,0}/*notes*/,
41/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
99/*maxcombo*/,
"{failed:false}"/*other*/);
@ -439,7 +494,7 @@ public class ArcadeReader {
80911/*score*/,
POPN_B/*rank*/,
new int[]{485,322,89,40,0,0,0}/*notes*/,
41/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
157/*maxcombo*/,
"{failed:false}"/*other*/);
@ -447,7 +502,7 @@ public class ArcadeReader {
78495/*score*/,
POPN_B/*rank*/,
new int[]{425,297,127,35,0,0,0}/*notes*/,
41/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
127/*maxcombo*/,
"{failed:false}"/*other*/);
@ -455,7 +510,7 @@ public class ArcadeReader {
80173/*score*/,
POPN_B/*rank*/,
new int[]{438,305,101,26,0,0,0}/*notes*/,
41/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
153/*maxcombo*/,
"{failed:false}"/*other*/);
@ -463,7 +518,7 @@ public class ArcadeReader {
79907/*score*/,
POPN_B/*rank*/,
new int[]{474,369,107,34,0,0,0}/*notes*/,
39/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
122/*maxcombo*/,
"{failed:false}"/*other*/);
@ -471,7 +526,7 @@ public class ArcadeReader {
80814/*score*/,
POPN_B/*rank*/,
new int[]{496,286,96,50,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
103/*maxcombo*/,
"{failed:false}"/*other*/);
@ -479,7 +534,7 @@ public class ArcadeReader {
82848/*score*/,
POPN_A/*rank*/,
new int[]{528,322,80,28,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
202/*maxcombo*/,
"{failed:false}"/*other*/);
@ -487,7 +542,7 @@ public class ArcadeReader {
81631/*score*/,
POPN_B/*rank*/,
new int[]{532,342,98,32,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
145/*maxcombo*/,
"{failed:false}"/*other*/);
@ -495,7 +550,7 @@ public class ArcadeReader {
80875/*score*/,
POPN_B/*rank*/,
new int[]{500,310,102,36,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
123/*maxcombo*/,
"{failed:false}"/*other*/);
@ -503,7 +558,7 @@ public class ArcadeReader {
81600/*score*/,
POPN_B/*rank*/,
new int[]{524,339,98,33,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
199/*maxcombo*/,
"{failed:false}"/*other*/);
@ -511,7 +566,7 @@ public class ArcadeReader {
87204/*score*/,
POPN_A/*rank*/,
new int[]{665,293,55,18,0,0,0}/*notes*/,
40/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
420/*maxcombo*/,
"{failed:false}"/*other*/);
@ -519,7 +574,7 @@ public class ArcadeReader {
83279/*score*/,
POPN_A/*rank*/,
new int[]{493,285,78,27,0,0,0}/*notes*/,
41/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
332/*maxcombo*/,
"{failed:false}"/*other*/);
@ -527,7 +582,7 @@ public class ArcadeReader {
86786/*score*/,
POPN_A/*rank*/,
new int[]{439,215,32,9,0,0,0}/*notes*/,
37/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
276/*maxcombo*/,
"{failed:false}"/*other*/);
@ -535,7 +590,7 @@ public class ArcadeReader {
3019559/*score*/,
SDVX_D/*rank*/,
new int[]{13,59,31,495,34,56,502}/*notes*/,
18/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
233/*maxcombo*/,
"{failed:false}"/*other*/);
@ -543,7 +598,7 @@ public class ArcadeReader {
2060643/*score*/,
SDVX_D/*rank*/,
new int[]{0,3,2,160,3,0,109}/*notes*/,
6/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
87/*maxcombo*/,
"{failed:false}"/*other*/);
@ -551,7 +606,7 @@ public class ArcadeReader {
8759328/*score*/,
SDVX_A/*rank*/,
new int[]{14,88,141,1460,155,156,130}/*notes*/,
18/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
257/*maxcombo*/,
"{failed:false}"/*other*/);
@ -559,7 +614,7 @@ public class ArcadeReader {
9129755/*score*/,
SDVX_APLUS/*rank*/,
new int[]{7,84,96,1474,99,86,75}/*notes*/,
18/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
234/*maxcombo*/,
"{failed:false}"/*other*/);
@ -567,7 +622,7 @@ public class ArcadeReader {
9653667/*score*/,
SDVX_AAPLUS/*rank*/,
new int[]{1,53,88,1517,21,12,26}/*notes*/,
16/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
593/*maxcombo*/,
"{failed:false}"/*other*/);
@ -583,7 +638,7 @@ public class ArcadeReader {
9698351/*score*/,
SDVX_AA/*rank*/,
new int[]{2,70,142,1782,43,29,55}/*notes*/,
17/*difficulty*/,
0/*difficulty*/,
0.0/*pct*/,
372/*maxcombo*/,
"{failed:false}"/*other*/);

@ -112,7 +112,7 @@ public class DDRReader extends Reader{
}
}
public void interpretBoxes(Path img){
public void interpretBoxes(Path img,boolean testingMode){
/*String dataString = readAllBoxes(img);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
@ -167,6 +167,9 @@ public class DDRReader extends Reader{
}
Path output = Paths.get("result.png");
ImageIO.write(cutImg,"png",output.toFile());
if (testingMode) {
interpretOutput(new String[]{},new String[]{},sig_data);
} else {
String dataString = readAllBoxes(output);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = parseOutCommas(data[0]).split(Pattern.quote(","));
@ -177,6 +180,7 @@ public class DDRReader extends Reader{
System.out.println(Arrays.toString(en_data));
System.out.println(Arrays.toString(sig_data));
interpretOutput(ja_data,en_data,sig_data);
}
g.dispose();
} catch (IOException e) {
e.printStackTrace();
@ -275,19 +279,19 @@ public class DDRReader extends Reader{
if (failed) {
rank=15;/*F*/
} else
if (score>=999000) {rank=0;/*AAA*/} else
if (score>=990000) {rank=0;/*AAA*/} else
if (score>=950000) {rank=1;/*AA+*/} else
if (score>=900000) {rank=2;/*AA*/} else
if (score>=890000) {rank=3;/*AA-*/} else
//if (score>=890000) {rank=3;/*AA-*/} else
if (score>=850000) {rank=4;/*A+*/} else
if (score>=800000) {rank=5;/*A*/} else
if (score>=790000) {rank=6;/*A-*/} else
//if (score>=790000) {rank=6;/*A-*/} else
if (score>=750000) {rank=7;/*B+*/} else
if (score>=700000) {rank=8;/*B*/} else
if (score>=690000) {rank=9;/*B-*/} else
//if (score>=690000) {rank=9;/*B-*/} else
if (score>=650000) {rank=10;/*C+*/} else
if (score>=600000) {rank=11;/*C*/} else
if (score>=590000) {rank=12;/*C-*/} else
//if (score>=590000) {rank=12;/*C-*/} else
if (score>=550000) {rank=13;/*D+*/} else
{rank=14;/*D*/}
}break;

@ -90,7 +90,7 @@ public class ITGReader extends Reader{
}
}
public void interpretBoxes(Path img){
public void interpretBoxes(Path img, boolean testingMode){
/*String dataString = readAllBoxes(img);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
@ -127,12 +127,25 @@ public class ITGReader extends Reader{
subRegion.setRGB(0,0,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
ImageIO.write(subRegion,"png",new File("sub.png"));
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w);
if (i==10) {
if (new Color(originalImg.getRGB(432,300)).equals(Color.WHITE)&&
new Color(originalImg.getRGB(480,255)).equals(Color.WHITE)&&
new Color(originalImg.getRGB(430,254)).equals(Color.WHITE)&&
new Color(originalImg.getRGB(430,207)).equals(Color.WHITE)&&
new Color(originalImg.getRGB(480,207)).equals(Color.WHITE)&&
!new Color(originalImg.getRGB(480,304)).equals(Color.WHITE)) {
failed=true;
}
}
String val = interpretImage(subRegion,i);
sig_data[counter++]=val;
currentHeight+=readRegions.get(i).h+REGION_PADDING;
}
Path output = Paths.get("result.png");
ImageIO.write(cutImg,"png",output.toFile());
if (testingMode) {
interpretOutput(new String[]{},new String[]{},sig_data);
} else {
String dataString = readAllBoxes(output);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = parseOutCommas(data[0]).split(Pattern.quote(","));
@ -143,6 +156,7 @@ public class ITGReader extends Reader{
System.out.println(Arrays.toString(en_data));
System.out.println(Arrays.toString(sig_data));
interpretOutput(ja_data,en_data,sig_data);
}
g.dispose();
} catch (IOException e) {
e.printStackTrace();
@ -212,7 +226,7 @@ public class ITGReader extends Reader{
notes[5]=convertToInt(splitter);
}break;
case 7:{
pct=convertToDouble(splitter);
pct=Double.parseDouble(splitter[0]);
}break;
case 8:{
difficulty=convertToInt(splitter);
@ -221,9 +235,6 @@ public class ITGReader extends Reader{
other=convertToString(splitter);
}break;
case 10:{
if (convertToString(splitter).equals("F")) {
failed=true;
}
if (failed) {
rank=17;/*F*/
} else

@ -27,7 +27,7 @@ public class LoveLiveReader extends Reader{
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]
addRegion(new Box(509,604,190,54),NUMBER); //notes[2]
addRegion(new Box(509,606,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]
@ -44,7 +44,7 @@ public class LoveLiveReader extends Reader{
switch (region) {
case 0:{
final ColorRange TARGETCOLOR = new ColorRange(240,255,130,150,0,10);
final ColorRange SEEKINGCOLOR = new ColorRange(140,255,110,255,0,200);
final ColorRange SEEKINGCOLOR = new ColorRange(140,255,120,255,0,180);
final Color FINALCOLOR = Color.MAGENTA;
for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true);
@ -113,7 +113,7 @@ public class LoveLiveReader extends Reader{
}break;
case 10:{
final ColorRange TARGETCOLOR = new ColorRange(240,255,30,50,0,5);
final ColorRange SEEKINGCOLOR = new ColorRange(180,255,10,120,0,120);
final ColorRange SEEKINGCOLOR = new ColorRange(180,255,10,220,0,180);
final Color FINALCOLOR = Color.MAGENTA;
for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true);
@ -195,7 +195,7 @@ public class LoveLiveReader extends Reader{
return colorCount>amt;
}
public void interpretBoxes(Path img){
public void interpretBoxes(Path img,boolean testingMode){
/*String dataString = readAllBoxes(img);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
@ -273,6 +273,9 @@ public class LoveLiveReader extends Reader{
}
Path output = Paths.get("result.png");
ImageIO.write(cutImg,"png",output.toFile());
if (testingMode) {
interpretOutput(new String[]{},new String[]{},sig_data);
} else {
String dataString = readAllBoxes(output);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = parseOutCommas(data[0]).split(Pattern.quote(","));
@ -283,6 +286,7 @@ public class LoveLiveReader extends Reader{
System.out.println(Arrays.toString(en_data));
System.out.println(Arrays.toString(sig_data));
interpretOutput(ja_data,en_data,sig_data);
}
g.dispose();
} catch (IOException e) {
e.printStackTrace();
@ -313,7 +317,7 @@ public class LoveLiveReader extends Reader{
List<Glyph> glyphs = Glyph.split(cutImg);
glyphs.remove(glyphs.size()-3);
glyphs.remove(glyphs.size()-1);
String res = f.convertGlyphs(glyphs,true);
String res = f.convertGlyphs(glyphs);
return res.substring(0,glyphs.size()-1)+"."+res.substring(glyphs.size()-1,glyphs.size());
}
}

@ -51,8 +51,8 @@ public class PopnReader extends Reader{
}break;
case 1:{
process(arr,width,
200,255,0,10,200,255,
200,255,0,150,200,255);
230,255,0,10,230,255,
230,255,0,150,230,255);
}break;
case 2:{
process(arr,width,
@ -66,8 +66,8 @@ public class PopnReader extends Reader{
}break;
case 4:{
process(arr,width,
90,120,180,220,240,255,
90,255,180,255,0,255);
90,120,190,220,240,255,
90,255,190,255,0,255);
}break;
case 5:{
process(arr,width,
@ -117,7 +117,7 @@ public class PopnReader extends Reader{
}
}
public void interpretBoxes(Path img){
public void interpretBoxes(Path img,boolean testingMode){
/*String dataString = readAllBoxes(img);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
@ -169,6 +169,9 @@ public class PopnReader extends Reader{
}
Path output = Paths.get("result.png");
ImageIO.write(cutImg,"png",output.toFile());
if (testingMode) {
interpretOutput(new String[]{},new String[]{},sig_data);
} else {
String dataString = readAllBoxes(output);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = parseOutCommas(data[0]).split(Pattern.quote(","));
@ -179,6 +182,7 @@ public class PopnReader extends Reader{
System.out.println(Arrays.toString(en_data));
System.out.println(Arrays.toString(sig_data));
interpretOutput(ja_data,en_data,sig_data);
}
g.dispose();
} catch (IOException e) {
e.printStackTrace();
@ -200,7 +204,7 @@ public class PopnReader extends Reader{
case 4:{
Font f = Font.FONT_POPN_NOTECOUNT;
List<Glyph> glyphs = Glyph.split(cutImg);
return f.convertGlyphs(glyphs);
return f.convertGlyphs(glyphs,true);
}
case 5:{
Font f = Font.FONT_POPN_COMBO;

@ -58,7 +58,10 @@ public abstract class Reader{
}
return sb.toString();
}
public abstract void interpretBoxes(Path file);
public void interpretBoxes(Path file) {
interpretBoxes(file,false);
};
public abstract void interpretBoxes(Path file,boolean testingMode);
String readAllBoxes(Path img) {
try {
Process p = Runtime.getRuntime().exec(new String[]{"python3","runocr.py","ja",img.toAbsolutePath().toString()});
@ -354,10 +357,10 @@ public abstract class Reader{
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
if (obj == null) {
System.out.println("Null");
return false;
}
Reader other = (Reader) obj;
if (difficulty != other.difficulty)
return false;
@ -369,10 +372,13 @@ public abstract class Reader{
if (other.other != null)
return false;
} else
if (this.other.length()>0 && other.other.length()>0 && !this.other.equals(other.other))
if (this.other.length()>0 && other.other.length()>0 && !this.other.equals(other.other)) {
return false;
if (Double.doubleToLongBits(pct) != Double.doubleToLongBits(other.pct))
}
if (Double.doubleToLongBits(pct) != Double.doubleToLongBits(other.pct)) {
System.out.println("Doubles don't match!");
return false;
}
if (rank != other.rank)
return false;
if (score != other.score)

@ -298,7 +298,7 @@ public class SoundVoltexReader extends Reader{
}
}
public void interpretBoxes(Path img){
public void interpretBoxes(Path img,boolean testingMode){
/*String dataString = readAllBoxes(img);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
@ -347,6 +347,9 @@ public class SoundVoltexReader extends Reader{
}
Path output = Paths.get("result.png");
ImageIO.write(cutImg,"png",output.toFile());
if (testingMode) {
interpretOutput(new String[]{},new String[]{},sig_data);
} else {
String dataString = readAllBoxes(output);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = parseOutCommas(data[0]).split(Pattern.quote(","));
@ -357,6 +360,7 @@ public class SoundVoltexReader extends Reader{
System.out.println(Arrays.toString(en_data));
System.out.println(Arrays.toString(sig_data));
interpretOutput(ja_data,en_data,sig_data);
}
g.dispose();
} catch (IOException e) {
e.printStackTrace();

@ -18,7 +18,7 @@ public class TestReader extends Reader{
}
@Override
public void interpretBoxes(Path file) {
public void interpretBoxes(Path file,boolean testingMode) {
// TODO Auto-generated method stub
}

@ -190,6 +190,10 @@ public class Font {
if (debug) {
System.out.println("Glyph "+j+" has a score of "+bestScore+".");
}
} else {
if (debug) {
System.out.println(" Glyph "+j+" has a score of "+score+".");
}
}
}
sb.append(bestGlyph);

@ -1,21 +1,21 @@
20
29
0000111111111110000000001111111111110000001111111111111111000011111111111111110001111111111111111100011111111111111111001111111000001111111111111100000011111111111111000000001111111111110000000011111111111100000000111111111111000000001111111111110000000011111111111100000000111111111111000000001111111111110000000011111111111100000000111111111111000000001111111111110000000011111111111100000000111111111111000000011111111111111000000111111111111111000011111110111111111011111111000011111111111111110000111111111111111100000011111111111100000000111111111111000000000000111100000000
11
12
27
000001111100000111111000111111111011111111111111111111111111111111111111111111111111111100000111111000001111110000011111100000111111000001111110000011111100000111111000001111110000011111100000111111000001111110000011111100000111111000001111110000011111100000111111000001111110000011111100000111111
000000111110000000111111000011111111001111111111011111111111111111111111111111111111111111111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000111111000000110011
20
27
000011111111111100000000111111111111000000111111111111111100001111111111111111001111111111111111111011111111111111111110111111000000011111111111110000000011111111111100000000111111111111000000011111110000000000001111111100000000000011111111000000000011111111000000000001111111110000000001111111110000000000111111111100000000111111111100000000011111111111000000001111111100000000000011111111000000000011111111000000000000111111110000000000001111111111111111110011111111111111111110111111111111111111111111111111111111111111111111111111111111
21
29
000011111111111000000000111111111111100000011111111111111110000011111111111111111000011111111111111111100011111111001111111100011111100000011111100011111100000011111100000100000000011111100000000000000011111100000000001111111111100000000011111111111100000001111111111110000000001111111111110000000000111111111111100000000011111111111100000000000001111111100000000000000011111110000000000000011111110011110000000011111110111110000000011111111111111000000011111111111111100000011111110111111110001111111100011111111111111111100011111111111111111100000111111111111110000000111111111111110000000000011111100000000
22
000001111111111000000000111111111111000000011111111111111000001111111111111111000111111110011111111001111111100111111110011111100000011111100111111000000111111001111000000001111110011110000000011111100000000000000111111000000000000011111110000000000001111111000000000001111111110000000001111111111000000000111111111110000000111111111100000000011111111110000000001111111110000000000111111111100000000001111110000000000000011111100000000000001111111000000000000011111111111111111110111111111111111111111111111111111111111111111111111111111000
20
28
0000000000011111100000000000000001111110000000000000011111111110000000000001111111111000000000000111111111100000000000111111111110000000000111111111111000000000011111111111100000000111111111111110000000011111111111111000000001111110011111100000000111111001111110000001111110000111111000000111111000011111100000111111100001111110000011111110000111111000011111100000011111100001111110000011111110001111111111111111111110111111111111111111111111111111111111111111110111111111111111111111011111111111111111111000011111111111111111100000000000000111111000000000000000011111100000000000000001111110000000000000000111111000
19
00001111111111110000000011111111111100000011111111111111110000111111111111111100011111111111111111000111111100111111111011111100000000111110111111000000001111100011000000000111111000000000000001111110000000000111111111000000000111111111110000000011111111111000000000111111111110000000001111111111110000000011111111111100000000000000111111110000000000001111111100000000000000111111011100000000001111111111110000000011111111111100000000111111111111100000111111111111111100001111111101111111111111111110001111111111111111000001111111111111100000001111111111110000
22
27
000000000000001000000011111111111111000011111111111111110001111111111111111000111111111111111000011110000000000000001111000000000000001111100000000000000111110000000000000011111000000000000001111111111111100000111111111111110000011111111111111110001111111111111111000111111000001111111011110000000001111100000000000000111110000000000000011111000000000000000111100000000000000011110111100000000011111011110000000000111111111100000001111110111111000000111110011111111111111111000111111111111111000001111111111111000
000000000000111110000000000000000111111100000000000000111111110000000000000011111111000000000000111111111100000000000011111111110000000000011111111111000000000001111111111100000000001111111111110000000000111111111111000000000111111011111100000000111111001111110000000011111100111111000000001111110011111100000011111100001111110000001111110000111111000001111111000011111100000111111100001111110000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100111111111111111111100011111111111111111100000000000000111111000000000000000011111100000000000000001100110000
20
28
00011111111111111000000111111111111111000111111111111111111001111111111111111110011111111111111111000111111111111111100001111110000000000000011111100000000000000111111000000000000001111110000000000000011111111111111000000111111111111111000001111111111111111100011111111111111111000111111000011111111001111110000111111110000000000000011111100000000000000111111000000000000000111111000000000000001111110111100000000011111011111000000001111110111111100000011111101111111100011111111001111111111111111110011111111111111111000001111111111111100000011111111111111000
21
29
000000111111111110000000000111111111111000000011111111111111100000011111111111111110001111111111111111110001111111100111111110001111110000001111110001111110000001111110011111100000000000000011111100000000000000111111111111111110000111111111111111111000111111111111111111110111111111111111111110111111111100111111110111111111100111111110111111110000001111111111111110000001111111111111100000000111111111111100000000111111011111110000001111111001111110000001111111001111110000001111110001111111100111111110000111111111111111110000111111111111111110000011111111111111000000011111111111111000000000001111110000000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@ -81,21 +81,21 @@ public class sigPlace {
final static int TRANSPARENT = new Color(0,0,0,0).getRGB();
public static void main(String[] args) {
/*String fontName = "sdvx_largeScore";
String value = "301";
Path f = Paths.get("sdvx1.png");
/*String fontName = "lovelive_score";
String value = "325415";
Path f = Paths.get("tests","lovelive1.png");
BufferedImage img;
try {
img = ImageIO.read(f.toFile());
Box scoreBox = new Box(476,1075,242,57);
Box scoreBox = new Box(713,401,232,50);
int[] arr = img.getRGB(scoreBox.x, scoreBox.y, scoreBox.w, scoreBox.h, null, 0, scoreBox.w);
BufferedImage newImg = new BufferedImage(scoreBox.w,scoreBox.h,BufferedImage.TYPE_INT_ARGB);
int width=scoreBox.w;
final ColorRange TARGETCOLOR = new ColorRange(160,255,170,255,190,255);
final ColorRange SEEKINGCOLOR = new ColorRange(26,255,53,255,80,255);
final ColorRange TARGETCOLOR = new ColorRange(240,255,130,150,0,10);
final ColorRange SEEKINGCOLOR = new ColorRange(140,255,120,255,0,180);
final Color FINALCOLOR = Color.MAGENTA;
for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Loading…
Cancel
Save