SDVX parsing (#1)

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent 2ef51c46b1
commit d3c671a37a
  1. 3
      ArcadeReader.java
  2. 1
      readers/DDRReader.java
  3. 48
      readers/Reader.java
  4. 76
      readers/SoundVoltexReader.java
  5. BIN
      result.png
  6. 2
      sigPlace.java

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

@ -244,6 +244,7 @@ public class DDRReader 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();

@ -14,10 +14,10 @@ public abstract class Reader{
int rank;
int[] notes = new int[7];
int difficulty;
String title;
String title="";
double pct;
int maxcombo;
String other;
String other="";
List<Box> readRegions = new ArrayList<>();
final int TRANSPARENT = new Color(0,0,0,0).getRGB();
String readAllBoxes(Path img) {
@ -199,11 +199,11 @@ public abstract class Reader{
char[][] number_alternatives={
/*0*/{'0','o','O','e'},
/*1*/{'1','\\','/','I','i'},
/*2*/{'2'},
/*2*/{'2','己'},
/*3*/{'3'},
/*4*/{'4'},
/*5*/{'5'},
/*6*/{'6','b'},
/*6*/{'6','b','G'},
/*7*/{'7','z','Z'},
/*8*/{'8','B'},
/*9*/{'9','g','y',},
@ -213,6 +213,46 @@ public abstract class Reader{
return String.join("\n",data).replaceFirst(Pattern.quote("\n"),"");
}
double convertToDouble(String[]data){return convertToDouble("",data);}
double convertToDouble(String prefix,String[] data) {
int numb=0;
int decimal=0;
boolean decimalFound=false;
for (int i=0;i<data.length;i++) {
String s = data[i];
int j=0;
if (i==1) {
j=prefix.length();
} else {
j=0;
}
//System.out.println("["+s+"]"+" starts at "+j);
for (;j<s.length();j++) {
if (s.charAt(j)=='.'||s.charAt(j)==',') {
decimalFound=true;
}
letter_iterator:
for (int k=0;k<number_alternatives.length;k++) {
for (int l=0;l<number_alternatives[k].length;l++) {
if (s.charAt(j)==number_alternatives[k][l]) {
if (!decimalFound) {
numb*=10;
numb+=k;
} else {
decimal*=10;
decimal+=k;
}
//System.out.println(" "+s.charAt(j)+" found for "+k+".");
break letter_iterator;
}
}
}
}
}
return Double.parseDouble(Integer.toString(numb)+"."+Integer.toString(decimal));
}
int convertToInt(String[]data){return convertToInt("",data);}
int convertToInt(String prefix,String[] data) {

@ -393,6 +393,7 @@ public class SoundVoltexReader 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();
@ -403,7 +404,78 @@ public class SoundVoltexReader extends Reader{
@Override
void interpretResults(String[] finalData) {
// TODO Auto-generated method stub
for (int i=0;i<finalData.length;i++) {
String[] splitter = finalData[i].split(Pattern.quote("\n"));
switch (i) {
case 0:{
title=convertToString(splitter);
}break;
case 1:{
score=convertToInt(splitter);
}break;
case 2:{
int score2=convertToInt(splitter);
score=convertToInt(new String[]{Integer.toString(score),Integer.toString(score2)});
}break;
case 3:{
other+="ex:"+Integer.toString(convertToInt("EX SCORE",splitter))+",";
}break;
case 4:{
pct=convertToDouble("EFFECTIVE RATE",splitter);//We're lucky excessive and effective rate have the same number of characters...
}break;
case 5:{
notes[0]=convertToInt("ERROR",splitter);
}break;
case 6:{
notes[1]=convertToInt("NEAR",splitter);
}break;
case 7:{
notes[2]=convertToInt("CRITICAL",splitter);
}break;
case 8:{
notes[3]=convertToInt("S-CRITICAL",splitter);
}break;
case 9:{
notes[4]=convertToInt("CRITICAL",splitter);
}break;
case 10:{
notes[5]=convertToInt("NEAR",splitter);
}break;
case 11:{
notes[6]=convertToInt("ERROR",splitter);
}break;
case 12:{
other+="chip_scritical:"+Integer.toString(convertToInt("S-Critical",splitter))+",";
}break;
case 13:{
other+="chip_critical:"+Integer.toString(convertToInt("Critical",splitter))+",";
}break;
case 14:{
other+="chip_near:"+Integer.toString(convertToInt("NEAR",splitter))+",";
}break;
case 15:{
other+="chip_error:"+Integer.toString(convertToInt("ERROR",splitter))+",";
}break;
case 16:{
other+="long_scritical:"+Integer.toString(convertToInt("S-Critical",splitter))+",";
}break;
case 17:{
other+="long_error:"+Integer.toString(convertToInt("ERROR",splitter))+",";
}break;
case 18:{
other+="vol_scritical:"+Integer.toString(convertToInt("S-CRITICAL",splitter))+",";
}break;
case 19:{
other+="vol_error:"+Integer.toString(convertToInt("ERROR",splitter))+",";
}break;
case 20:{
maxcombo=convertToInt("MAXIMUM CHAIN",splitter);
}break;
case 21:{
difficulty=convertToInt("EXH",splitter);
}break;
}
}
System.out.println(this);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 20 KiB

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

Loading…
Cancel
Save