Spinner Test2

Improves Score accuracy
(still mostly wrong)

inital replay seek
This commit is contained in:
fd
2015-04-05 11:24:05 -04:00
parent fa9accfc88
commit 40e67cedc9
17 changed files with 348 additions and 92 deletions

View File

@@ -138,6 +138,11 @@ public class Replay {
loaded = true;
}
public void loadHeader() throws IOException {
OsuReader reader = new OsuReader(file);
loadHeader(reader);
reader.close();
}
/**
* Returns a ScoreData object encapsulating all game data.
* If score data already exists, the existing object will be returned
@@ -181,7 +186,7 @@ public class Replay {
private void loadHeader(OsuReader reader) throws IOException {
this.mode = reader.readByte();
this.version = reader.readInt();
System.out.println("Header:"+file.getName()+" "+mode+" "+version);
//System.out.println("Header:"+file.getName()+" "+mode+" "+version);
this.beatmapHash = reader.readString();
this.playerName = reader.readString();
this.replayHash = reader.readString();
@@ -203,6 +208,7 @@ public class Replay {
* @throws IOException
*/
private void loadData(OsuReader reader) throws IOException {
//System.out.println("Load Data");
// life data
String[] lifeData = reader.readString().split(",");
List<LifeFrame> lifeFrameList = new ArrayList<LifeFrame>(lifeData.length);
@@ -369,8 +375,8 @@ public class Replay {
@Override
public String toString() {
final int LINE_SPLIT = 5;
final int MAX_LINES = LINE_SPLIT * 10;
final int LINE_SPLIT = 1;
final int MAX_LINES = LINE_SPLIT * 99999999;
StringBuilder sb = new StringBuilder();
sb.append("File: "); sb.append(file.getName()); sb.append('\n');

View File

@@ -12,16 +12,22 @@ import java.io.IOException;
public class ReplayImporter {
public static void importAllReplaysFromDir(File dir) {
System.out.println(OsuGroupList.get().beatmapHashesToFile);
for (File replayToImport : dir.listFiles()) {
try {
Replay r = new Replay(replayToImport);
r.load();
r.loadHeader();
OsuFile oFile = OsuGroupList.get().getFileFromBeatmapHash(r.beatmapHash);
if(oFile != null){
File replaydir = Options.getReplayDir();
if (!replaydir.isDirectory()) {
if (!replaydir.mkdir()) {
ErrorHandler.error("Failed to create replay directory.", null, false);
return;
}
}
//ErrorHandler.error("Importing"+replayToImport+" forBeatmap:"+oFile, null, false);
ScoreData data = r.getScoreData(oFile);
File moveToFile = new File(Options.getReplayDir(),replayToImport.getName());
File moveToFile = new File(replaydir, replayToImport.getName());
System.out.println("Moving "+replayToImport+" to "+moveToFile);
if(
!replayToImport.renameTo(moveToFile)
@@ -35,7 +41,6 @@ public class ReplayImporter {
//ErrorHandler.error("Could not find beatmap for replay "+replayToImport, null, false);
}
} catch (IOException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
System.out.println(e);
}