All tests now passing! (#7)

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent 64e7841139
commit 73224cb44d
  1. 12
      ArcadeReader.java
  2. 4
      readers/PopnReader.java
  3. 7
      readers/SoundVoltexReader.java
  4. 19
      readers/fonts/Font.java
  5. 14
      readers/fonts/popn_noteCount
  6. BIN
      result.png
  7. 14
      sigPlace.java
  8. BIN
      sub.png
  9. BIN
      test.png

@ -613,7 +613,7 @@ public class ArcadeReader {
test("sdvx4.png",SoundVoltexReader.class, test("sdvx4.png",SoundVoltexReader.class,
9129755/*score*/, 9129755/*score*/,
SDVX_APLUS/*rank*/, SDVX_APLUS/*rank*/,
new int[]{7,84,96,1474,99,86,75}/*notes*/, new int[]{7,84,94,1474,99,86,75}/*notes*/,
0/*difficulty*/, 0/*difficulty*/,
0.0/*pct*/, 0.0/*pct*/,
234/*maxcombo*/, 234/*maxcombo*/,
@ -627,20 +627,20 @@ public class ArcadeReader {
593/*maxcombo*/, 593/*maxcombo*/,
"{ex:4119,chip_scritical:173,chip_critical:109,chip_near:65,chip_error:4,long_scritical:375,long_error:1,vol_scritical:969,vol_error:22,failed:false}"/*other*/); "{ex:4119,chip_scritical:173,chip_critical:109,chip_near:65,chip_error:4,long_scritical:375,long_error:1,vol_scritical:969,vol_error:22,failed:false}"/*other*/);
test("sdvx6.png",SoundVoltexReader.class, test("sdvx6.png",SoundVoltexReader.class,
9698351/*score*/, 9498351/*score*/,
SDVX_AA/*rank*/, SDVX_AA/*rank*/,
new int[]{2,70,142,1782,43,29,55}/*notes*/, new int[]{2,70,142,1782,43,29,55}/*notes*/,
17/*difficulty*/, 0/*difficulty*/,
0.0/*pct*/, 0.0/*pct*/,
372/*maxcombo*/, 372/*maxcombo*/,
"{ex:5525,chip_scritical:341,chip_critical:185,chip_near:99,chip_error:8,long_scritical:345,long_error:17,vol_scritical:1096,vol_error:32,failed:true}"/*other*/); "{ex:5525,chip_scritical:341,chip_critical:185,chip_near:99,chip_error:8,long_scritical:345,long_error:17,vol_scritical:1096,vol_error:32,failed:false}"/*other*/);
test("sdvx7.png",SoundVoltexReader.class, test("sdvx7.png",SoundVoltexReader.class,
9698351/*score*/, 9498351/*score*/,
SDVX_AA/*rank*/, SDVX_AA/*rank*/,
new int[]{2,70,142,1782,43,29,55}/*notes*/, new int[]{2,70,142,1782,43,29,55}/*notes*/,
0/*difficulty*/, 0/*difficulty*/,
0.0/*pct*/, 0.0/*pct*/,
372/*maxcombo*/, 372/*maxcombo*/,
"{ex:5525,chip_scritical:341,chip_critical:185,chip_near:99,chip_error:8,long_scritical:345,long_error:17,vol_scritical:1096,vol_error:32,failed:true}"/*other*/); "{ex:5525,chip_scritical:341,chip_critical:185,chip_near:99,chip_error:8,long_scritical:345,long_error:17,vol_scritical:1096,vol_error:32,failed:false}"/*other*/);
} }
} }

@ -57,7 +57,7 @@ public class PopnReader extends Reader{
case 2:{ case 2:{
process(arr,width, process(arr,width,
240,255,180,225,0,10, 240,255,180,225,0,10,
240,255,180,255,0,140); 240,255,170,255,0,145);
}break; }break;
case 3:{ case 3:{
process(arr,width, process(arr,width,
@ -67,7 +67,7 @@ public class PopnReader extends Reader{
case 4:{ case 4:{
process(arr,width, process(arr,width,
90,120,190,220,240,255, 90,120,190,220,240,255,
90,255,190,255,0,255); 85,255,165,255,220,255);
}break; }break;
case 5:{ case 5:{
process(arr,width, process(arr,width,

@ -110,7 +110,7 @@ public class SoundVoltexReader extends Reader{
}break; }break;
case 3:{ case 3:{
final ColorRange TARGETCOLOR = new ColorRange(230,255,180,255,20,255); final ColorRange TARGETCOLOR = new ColorRange(230,255,180,255,20,255);
final ColorRange SEEKINGCOLOR = new ColorRange(200,255,180,255,15,255); final ColorRange SEEKINGCOLOR = new ColorRange(180,255,140,255,15,255);
final Color FINALCOLOR = Color.MAGENTA; final Color FINALCOLOR = Color.MAGENTA;
for (int i=0;i<arr.length;i++) { for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true); Color col = new Color(arr[i],true);
@ -340,7 +340,8 @@ public class SoundVoltexReader extends Reader{
currentHeight+=readRegions.get(i).h+REGION_PADDING; currentHeight+=readRegions.get(i).h+REGION_PADDING;
} }
//695,933 140,8,8 //695,933 140,8,8
if (new Color(originalImg.getRGB(695,933)).equals(new Color(140,8,8))) { final ColorRange failRange = new ColorRange(135,180,0,15,0,15);
if (failRange.colorInRange(new Color(originalImg.getRGB(695,933)))) {
failed=true; failed=true;
} }
//912,1204 //912,1204
@ -388,7 +389,7 @@ public class SoundVoltexReader extends Reader{
case 3:{ case 3:{
Font f = Font.FONT_SDVX_EXSCORE; Font f = Font.FONT_SDVX_EXSCORE;
List<Glyph> glyphs = Glyph.split(cutImg); List<Glyph> glyphs = Glyph.split(cutImg);
return f.convertGlyphs(glyphs,true); return f.convertGlyphs(glyphs);
} }
case 5: case 5:
case 6: case 6:

@ -159,8 +159,8 @@ public class Font {
Glyph g_a = glyphs.get(i); Glyph g_a = glyphs.get(i);
Glyph g_b = data[j]; Glyph g_b = data[j];
int score=0; int score=0;
for (int x=0;x<g_b.width;x++) { for (int x=0;x<g_a.width;x++) {
for (int y=0;y<g_b.height;y++) { for (int y=0;y<g_a.height;y++) {
boolean found=false; boolean found=false;
//We can be up to 1 pixel off and still be valid. //We can be up to 1 pixel off and still be valid.
inner: inner:
@ -168,9 +168,9 @@ public class Font {
for (int yy=-1;yy<=1;yy++) { for (int yy=-1;yy<=1;yy++) {
int a_x=x+xx; int a_x=x+xx;
int a_y=y+yy; int a_y=y+yy;
if (a_x>=0&&a_x<g_a.width&&a_y>=0&&a_y<g_a.height) { if (a_x>=0&&a_x<g_b.width&&a_y>=0&&a_y<g_b.height) {
int a_index=a_y*g_a.width+a_x; int a_index=a_y*g_b.width+a_x;
if (g_a.data[a_index]==g_b.data[y*g_b.width+x]) { if (g_a.data[y*g_a.width+x]==g_b.data[a_index]) {
found=true; found=true;
break inner; break inner;
} }
@ -180,10 +180,19 @@ public class Font {
if (found) { if (found) {
score++; score++;
} else { } else {
if (debug) {
System.out.print("-");
}
score-=2; score-=2;
} }
} }
} }
if (g_b.width-g_a.width>2) {
score-=(g_b.width-g_a.width)*g_b.height;
} else
if (g_b.height-g_a.height>2) {
score-=(g_b.height-g_a.height)*g_b.width;
}
if (score>bestScore) { if (score>bestScore) {
bestScore=score; bestScore=score;
bestGlyph=j; bestGlyph=j;

@ -1,24 +1,24 @@
23 23
28 28
00000000011100001110000000000111111111111111100000001111111111111111000000111111111111111110000001111100000011111110000011111000000111111100011111110000001111111000111110000000001111110001111100000000000111100011111000000000001111000111110000000000011110001111100000000011111100111111000000001111111001111110000000011111110011111100000000111111100111111000000001111111001111110000000011111110011111100000000111111011111111000000001111110111111110000000011111101111111100000000111111011111111000000001111110001111110000000111111100001111111111111111000000011111111111111110000000111111111111111100000000001111111111000000000000011111111110000000 00000000011111111110000000000000111111111100000000000011111111111111000000111111111111111110000111111111111111111110001111111111111111111100011111110000001111111001111111000000011111110011111110000000111111100111111000000000111111001111110000000001111110011111100000000011111100111111000000000111111001111110000000011111110011111100000000111111100111111000000001111111001111110000000011111111111111100000000111111111111111000000001111110111111110000000011111101111111100000000111111011111111000000001111110111111110000000111111101111111100000001111111000111111111111111111110001111111111111111100000011111111111111111000000011111111111111110000
14 14
28 28
01110000000000011111111110000111111111100001111111111000000011111110000000111111100000000111111000000001111110000000011111100000000111111000000001111110000000011111000000001111110000000011111100000000111111000000001111110000000011111100000000111111000000001111110000000011111100000000111111000000001111110000000011111110001111111111111111111111111111111111111111111111111111110011111111111100 01110000000000011111111110000111111111100001111111111000000011111110000000111111100000000111111000000001111110000000011111100000000111111000000001111110000000011111000000001111110000000011111100000000111111000000001111110000000011111100000000111111000000001111110000000011111100000000111111000000001111110000000011111110001111111111111111111111111111111111111111111111111111110011111111111100
21 21
28 28
000000000100000000000000011111111111111110000011111111111111110000011111111111111111000111111100000011111000111111100000011111000111111000000011111000111100000000011111000111100000000011111000111100000000011111000111100000000011111000111100000001111100000011100001111111100000011100001111111100000000000001111110000000000000011111100000000000000011111100000000000000111110000000000000011111100000000000000111111100000011000000111111100000011000011111110000001111000111111110000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 000000000100000000000000011111111111111110000011111111111111110000011111111111111111000111111100000011111000111111100000011111000111111000000011111000111100000000011111000111100000000011111000111100000000011111000111100000000011111000111100000001111100000011100001111111100000011100001111111100000000000001111110000000000000011111100000000000000011111100000000000000111110000000000000011111100000000000000111111100000011000000111111100000011000011111110000001111000111111110000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
19 21
28 28
0011000000000001100011111111111111111101111111111111111110111111111111111111011111100000001111101111110000000111110111100000000011111011100000000001111100000000000000111110000000000000011111000000000000001111100000000000000111100011111111111111100001111111111111110000111111111111111100000000000011111111000000000001111111100000000000011111110000000000000011111000000000000001111100000000000000111110111000000000011111111110000000001111111111111111111111111111111111111111111011111111111111110000111111111111000000011111111111100000 001111111111111111000001111111111111111000011111111111111111100011111111111111111111011111111111111111111011111111111111111111011111100000001111111011111100000000111111011111100000000111111011110000000000111111000000000000000111111000000000000001111100000000000000001111100000011111111111111000000011111111111111100000011111111111111100000011111111111111100000000000001111111111000000000000001111111000000000000001111111000000000000000111111011100000000000111111111111100000001111111111111100000001111111111111111111111111100011111111111111111000011111111111111111000011111111111111111000
23 23
26 26
0000000111100000000000000000001111000000000000000000011110000000000000000001111100000000000000001111110000000000000000011111100000011100000000111111000000111000000001110000000111110000000111100000001111100000001111000000011111000000011110000000111110000001111000000001111100001111110000000011111000011111100000000111110000111111000000011111100000001111111111111111111100000000000111111110000000000000001111111100000000000000011111111000000000000000111111110000000000000001111111100000000000000011111111000000000000000111111110000000000000011111111111000000000000111111111110000000000001111111111100 0000000111100000000000000000001111000000000000000000011110000000000000000001111100000000000000001111110000000000000000011111100000011100000000111111000000111000000001110000000111110000000111100000001111100000001111000000011111000000011110000000111110000001111000000001111100001111110000000011111000011111100000000111110000111111000000011111100000001111111111111111111100000000000111111110000000000000001111111100000000000000011111111000000000000000111111110000000000000001111111100000000000000011111111000000000000000111111110000000000000011111111111000000000000111111111110000000000001111111111100
23 24
26 28
0000011111111111111111000000111111111111111111000001111111111111111110000011111111111111111100000111110000000111110000111111100000000010000001111111000000000100000011111110000000000000000111111100000000000000001111111000000000000000011111110000000000000000111111111111000000000001111111111111111000000011111111111111110000000111111111111111100000000000000000000111111000000000000000001111110000000000000000011111100000000000000000111111000000000000000001111110000000000000000011111100000000000000000111111011111000000000001110000000111111111111111100000001111111111111111000000011111111111111110000 000000111111111111111111000000111111111111111111000011111111111111111111000011111111111111111111000011111111111111111111000011111111111111111111000111111110000001111110000111111100000000111000000111111100000000111000000111111100000000000000000111111110000000000000000111111111111110000000000111111111111110000000000111111111111111110000000111111111111111111000000111111111111111111000000111111111111111111110000000000000001111111110000000000000000011111110000000000000000011111110000111000000000001111110001111000000000011111110111111111000000011111110111111111000000011111110111111111111111111111000001111111111111111110000001111111111111111110000000111111111111111110000
23 23
28 28
00000000011100001110000000000111111111111111100000001111111111111111000000111111111111111110000001111100000011111110000011111000000111111100011111110000000111110000111110000000000000000001111100000000000000000011111000000000000000000111111000000000000000011111111111111111000000111111111111111111110001111111111111111111100011111111111111111111000111111100000001111110001111111000000011111101111111100000000111111011111111000000001111110111111110000000011111101111111100000000111111011111111000000001111110001111110000000111111100001111111111111111000000011111111111111110000000111111111111111100000000001111111111000000000000011111111110000000 00000000011111111110000000000000111111111100000000000011111111111111000000111111111111111110000001111111111111111110000011111111111111111100011111110000001111111001111111000000000000000011111110000000000000000111111000000000000000001111111000000000000000011111111111111111000000111111111111111110000001111111111111111111100011111111111111111111000111111111111111111110001111111111111111111101111111110000000111111011111111000000001111110111111110000000011111101111111100000000111111011111111000000001111110111111111000000111111101111111110000001111111000111111111111111111110001111111111111111100000011111111111111111000000011111111111111110000
21 21
28 28
011000000000000000001011111111111111111111011111111111111111111011111111111111111111111111000000001111111111111000000001111111111111000000001111111111100000000001111110000000000000001111110000000000000001111110000000000000011111110000000000000011110000000000000001111110000000000000001111110000000000000011111000000000000000011111000000000000000011111000000000000011111110000000000000011111100000000000000011111100000000000000011111100000000000000111110000000000000011111100000000000000111111100000000000000111111100000000000000111110000000000000000111110000000000000000111110000000000000 011000000000000000001011111111111111111111011111111111111111111011111111111111111111111111000000001111111111111000000001111111111111000000001111111111100000000001111110000000000000001111110000000000000001111110000000000000011111110000000000000011110000000000000001111110000000000000001111110000000000000011111000000000000000011111000000000000000011111000000000000011111110000000000000011111100000000000000011111100000000000000011111100000000000000111110000000000000011111100000000000000111111100000000000000111111100000000000000111110000000000000000111110000000000000000111110000000000000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@ -22,6 +22,7 @@ import java.awt.Color;
import readers.Box; import readers.Box;
import readers.fonts.Font; import readers.fonts.Font;
import readers.ColorRange; import readers.ColorRange;
import readers.PopnReader;
public class sigPlace { public class sigPlace {
@ -81,21 +82,21 @@ public class sigPlace {
final static int TRANSPARENT = new Color(0,0,0,0).getRGB(); final static int TRANSPARENT = new Color(0,0,0,0).getRGB();
public static void main(String[] args) { public static void main(String[] args) {
/*String fontName = "sdvx_EXScore"; /*String fontName = "popn_noteCount";
String value = "05525"; String value = "36";
Path f = Paths.get("tests","sdvx6.png"); Path f = Paths.get("tests","popn2.png");
BufferedImage img; BufferedImage img;
try { try {
img = ImageIO.read(f.toFile()); img = ImageIO.read(f.toFile());
Box scoreBox = new Box(630,1142,110,16); Box scoreBox = new Box(1060,800,157,40);
int[] arr = img.getRGB(scoreBox.x, scoreBox.y, scoreBox.w, scoreBox.h, null, 0, scoreBox.w); 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); BufferedImage newImg = new BufferedImage(scoreBox.w,scoreBox.h,BufferedImage.TYPE_INT_ARGB);
int width=scoreBox.w; int width=scoreBox.w;
final ColorRange TARGETCOLOR = new ColorRange(230,255,180,255,20,255); final ColorRange TARGETCOLOR = new ColorRange(90,120,190,220,240,255);
final ColorRange SEEKINGCOLOR = new ColorRange(200,255,180,255,15,255); final ColorRange SEEKINGCOLOR = new ColorRange(85,255,165,255,220,255);
final Color FINALCOLOR = Color.MAGENTA; final Color FINALCOLOR = Color.MAGENTA;
for (int i=0;i<arr.length;i++) { for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true); Color col = new Color(arr[i],true);
@ -116,6 +117,7 @@ public class sigPlace {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
}*/ }*/
//new PopnReader().interpretBoxes(Paths.get("tests","popn8.png"),true);
ArcadeReader.runTests(); ArcadeReader.runTests();
/* Path secretFile = Paths.get(".clientsecret"); /* Path secretFile = Paths.get(".clientsecret");
List<String> data; List<String> data;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 461 B

Loading…
Cancel
Save