Initial framework for

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago
parent eee6185cdf
commit 4dd411c6d5
  1. 3
      ArcadeReader.java
  2. 6
      readers/DDRReader.java
  3. 40
      readers/LoveLiveReader.java
  4. 6
      readers/PopnReader.java
  5. 3
      readers/Reader.java
  6. 6
      readers/SoundVoltexReader.java
  7. BIN
      result.png
  8. 2
      sigPlace.java

@ -1,6 +1,7 @@
import java.nio.file.Path;
import readers.DDRReader;
import readers.LoveLiveReader;
import readers.PopnReader;
public class ArcadeReader {
@ -56,6 +57,6 @@ public class ArcadeReader {
*
*/
public static void retrieveData(Path img) {
new DDRReader().interpretBoxes(img);
new LoveLiveReader().interpretBoxes(img);
}
}

@ -251,4 +251,10 @@ public class DDRReader extends Reader{
//System.out.println(data[0]);
//System.out.println(data[2]);
}
@Override
String interpretOutput(String[] jp_data, String[] en_data) {
// TODO Auto-generated method stub
return null;
}
}

@ -79,18 +79,18 @@ public class LoveLiveReader extends Reader{
case 9:{
final ColorRange TARGETCOLOR = new ColorRange(0,10,155,190,95,145);
final ColorRange SEEKINGCOLOR = new ColorRange(0,200,155,240,95,240);
final Color FINALCOLOR = Color.MAGENTA;
final Color FINALCOLOR = Color.RED;
for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true);
if (TARGETCOLOR.colorInRange(col)) {
seek(arr,i,SEEKINGCOLOR,FINALCOLOR,width);
}
}
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,255,255);
final ColorRange SEEKINGCOLOR2 = new ColorRange(255,255,0,0,0,0);
final Color FINALCOLOR2 = new Color(TRANSPARENT,true);
for (int x=0;x<width;x++) {
//30 pixels from top.
if (arr[30*width+x]==Color.MAGENTA.getRGB()) {
if (arr[30*width+x]==Color.RED.getRGB()) {
System.out.println("Start Jump: "+x);
x=seek(arr,30*width+x,SEEKINGCOLOR2,FINALCOLOR2,width,x);
System.out.println("End Jump: "+x);
@ -98,7 +98,7 @@ public class LoveLiveReader extends Reader{
}
for (int i=0;i<arr.length;i++) {
Color col = new Color(arr[i],true);
if (!col.equals(Color.MAGENTA)) {
if (!col.equals(Color.RED)) {
arr[i]=TRANSPARENT;
}
}
@ -210,6 +210,7 @@ public class LoveLiveReader extends Reader{
trimAllData(en_data);
System.out.println(Arrays.toString(ja_data));
System.out.println(Arrays.toString(en_data));
interpretOutput(ja_data,en_data);
g.dispose();
} catch (IOException e) {
e.printStackTrace();
@ -217,4 +218,35 @@ public class LoveLiveReader extends Reader{
//System.out.println(data[0]);
//System.out.println(data[2]);
}
@Override
String interpretOutput(String[] jp_data,String[] en_data) {
//[6, 0, 218, 0, 218, 48, 6, 48, 32 5 4 1 5, 0.9670235803680689]
//For each data point we want to first see if it's within the correct rectangular bounds and from there parse it as such.
double accuracy[] = new double[readRegions.size()];
for (int i=0;i<en_data.length;i+=11) {
int spacing=0;
for (int j=0;j<readRegions.size();j++) {
if (Integer.parseInt(en_data[i+1])>=spacing&&Integer.parseInt(en_data[i+5])<=spacing+readRegions.get(j).h&&
accuracy[j]<Double.parseDouble(en_data[i+9])) {
System.out.print("[");
for (int k=0;k<10;k++) {
if (k!=0) {
System.out.print(",");
}
System.out.print(en_data[i+k]);
}
System.out.print("]");
System.out.println(" belongs to region "+j+".");
accuracy[j]=Double.parseDouble(en_data[i+9]);
break;
}
spacing+=readRegions.get(j).h+REGION_PADDING;
}
}
for (int i=0;i<jp_data.length;i+=10) {
}
return null;
}
}

@ -187,4 +187,10 @@ public class PopnReader extends Reader{
//System.out.println(data[0]);
//System.out.println(data[2]);
}
@Override
String interpretOutput(String[] jp_data, String[] en_data) {
// TODO Auto-generated method stub
return null;
}
}

@ -6,8 +6,6 @@ import java.util.ArrayList;
import java.util.List;
import java.awt.Color;
import javax.imageio.metadata.IIOInvalidTreeException;
public abstract class Reader{
int score;
int rank;
@ -42,6 +40,7 @@ public abstract class Reader{
}
return "";
}
abstract String interpretOutput(String[] jp_data,String[] en_data);
void trimAllData(String[] data) {
StringBuilder sb = new StringBuilder();
for (int i=0;i<data.length;i++) {

@ -400,4 +400,10 @@ public class SoundVoltexReader extends Reader{
//System.out.println(data[0]);
//System.out.println(data[2]);
}
@Override
String interpretOutput(String[] jp_data, String[] en_data) {
// TODO Auto-generated method stub
return null;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

@ -48,7 +48,7 @@ public class sigPlace {
"%FOOTER", Paths.get(REFDIR,"FOOTER.html"))
));
public static void main(String[] args) {
ArcadeReader.retrieveData(Paths.get("ddr1.jpg"));
ArcadeReader.retrieveData(Paths.get("lovelive1.png"));
/* Path secretFile = Paths.get(".clientsecret");
List<String> data;
try {

Loading…
Cancel
Save