Skip to content

Commit

Permalink
Merge pull request #137 from Feodor0090/skinning-292
Browse files Browse the repository at this point in the history
New skinning
  • Loading branch information
Feodor0090 authored May 13, 2023
2 parents 8acee76 + 2d9e72b commit e09f067
Show file tree
Hide file tree
Showing 28 changed files with 1,618 additions and 990 deletions.
Binary file added res/beatmaps/wwwwww/audio.mp3
Binary file not shown.
161 changes: 161 additions & 0 deletions res/beatmaps/wwwwww/bm [skin test].osu
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
osu file format v128

[General]
AudioFilename: audio.mp3
AudioLeadIn: 0
PreviewTime: -1
Countdown: 1
SampleSet: Normal
StackLeniency: 0.7
Mode: 3
LetterboxInBreaks: 0
SpecialStyle: 0
WidescreenStoryboard: 1
SamplesMatchPlaybackRate: 1

[Editor]
DistanceSpacing: 1
BeatDivisor: 2
GridSize: 0
TimelineZoom: 1

[Metadata]
Title: Waai WaiWai WaiWaiWai! (Off Vocal ver.)
TitleUnicode: Waai WaiWai WaiWaiWai! (Off Vocal ver.)
Artist: YYY
ArtistUnicode: YYY
Creator: Feodor0090
Version: nmania skin test

[Difficulty]
HPDrainRate: 5
CircleSize: 7
OverallDifficulty: 5
ApproachRate: 5
SliderMultiplier: 0.9999999776482582
SliderTickRate: 1

[Events]

[TimingPoints]
906.8865422525632,428.57142857142856,4,1,0,100,1,0


[HitObjects]
0,192,906.8865422525632,1,0,1:0:0:100:
439,192,906.8865422525632,1,0,1:0:0:100:
74,192,1121.1722565382775,1,0,1:0:0:100:
366,192,1121.1722565382775,1,0,1:0:0:100:
147,192,1335.4579708239917,1,0,1:0:0:100:
293,192,1335.4579708239917,1,0,1:0:0:100:
220,192,1335.4579708239917,128,0,1764.0293993954203:1:0:0:100:
439,192,1764.0293993954203,1,0,1:0:0:100:
0,192,1764.0293993954203,1,0,1:0:0:100:
366,192,1978.3151136811346,1,0,1:0:0:100:
74,192,1978.3151136811346,1,0,1:0:0:100:
293,192,2192.600827966849,1,0,1:0:0:100:
147,192,2192.600827966849,1,0,1:0:0:100:
220,192,2192.600827966849,128,0,2621.1722565382775:1:0:0:100:
366,192,2621.1722565382775,128,0,3049.743685109706:1:0:0:100:
74,192,2621.1722565382775,128,0,3049.743685109706:1:0:0:100:
147,192,3049.743685109706,128,0,3478.315113681135:1:0:0:100:
293,192,3049.743685109706,128,0,3478.315113681135:1:0:0:100:
439,192,3049.743685109706,128,0,3478.315113681135:1:0:0:100:
0,192,3049.743685109706,128,0,3478.315113681135:1:0:0:100:
220,192,3478.315113681135,1,0,1:0:0:100:
220,192,3692.600827966849,1,0,1:0:0:100:
74,192,3906.8865422525632,1,0,1:0:0:100:
366,192,3906.8865422525632,1,0,1:0:0:100:
0,192,3906.8865422525632,128,0,4121.172256538277:1:0:0:100:
439,192,3906.8865422525632,128,0,4121.172256538277:1:0:0:100:
74,192,4121.172256538277,128,0,4335.457970823992:1:0:0:100:
366,192,4121.172256538277,128,0,4335.457970823992:1:0:0:100:
220,192,4335.457970823992,1,0,1:0:0:100:
0,192,4335.457970823992,128,0,4764.02939939542:1:0:0:100:
439,192,4335.457970823992,128,0,4764.02939939542:1:0:0:100:
74,192,4764.02939939542,1,0,1:0:0:100:
366,192,4764.02939939542,1,0,1:0:0:100:
220,192,4978.315113681134,1,0,1:0:0:100:
0,192,5192.600827966849,1,0,1:0:0:100:
74,192,5192.600827966849,1,0,1:0:0:100:
147,192,5192.600827966849,1,0,1:0:0:100:
439,192,5192.600827966849,1,0,1:0:0:100:
220,192,5406.886542252563,1,0,1:0:0:100:
439,192,5621.172256538277,1,0,1:0:0:100:
366,192,5621.172256538277,1,0,1:0:0:100:
293,192,5621.172256538277,1,0,1:0:0:100:
0,192,5621.172256538277,1,0,1:0:0:100:
220,192,5835.457970823992,1,0,1:0:0:100:
220,192,6049.743685109706,128,0,7335.457970823992:1:0:0:100:
0,192,6049.743685109706,1,0,1:0:0:100:
439,192,6049.743685109706,1,0,1:0:0:100:
293,192,6049.743685109706,1,0,1:0:0:100:
74,192,6478.315113681135,1,0,1:0:0:100:
366,192,6478.315113681135,1,0,1:0:0:100:
0,192,6906.886542252563,1,0,1:0:0:100:
147,192,6906.886542252563,1,0,1:0:0:100:
293,192,6906.886542252563,1,0,1:0:0:100:
439,192,6906.886542252563,1,0,1:0:0:100:
366,192,7335.457970823992,1,0,1:0:0:100:
74,192,7335.457970823992,1,0,1:0:0:100:
147,192,7764.02939939542,1,0,1:0:0:100:
220,192,7764.02939939542,1,0,1:0:0:100:
293,192,7764.02939939542,1,0,1:0:0:100:
74,192,7978.315113681135,1,0,1:0:0:100:
366,192,7978.315113681135,1,0,1:0:0:100:
0,192,8192.60082796685,1,0,1:0:0:100:
147,192,8192.60082796685,1,0,1:0:0:100:
293,192,8192.60082796685,1,0,1:0:0:100:
439,192,8192.60082796685,1,0,1:0:0:100:
74,192,8406.886542252563,1,0,1:0:0:100:
366,192,8406.886542252563,1,0,1:0:0:100:
147,192,8621.172256538277,1,0,1:0:0:100:
220,192,8621.172256538277,1,0,1:0:0:100:
293,192,8621.172256538277,1,0,1:0:0:100:
74,192,8835.45797082399,1,0,1:0:0:100:
366,192,8835.45797082399,1,0,1:0:0:100:
0,192,9049.743685109705,1,0,1:0:0:100:
439,192,9049.743685109705,1,0,1:0:0:100:
220,192,9049.743685109705,128,0,9478.315113681134:1:0:0:100:
147,192,9264.02939939542,1,0,1:0:0:100:
293,192,9264.02939939542,1,0,1:0:0:100:
0,192,9478.315113681134,128,0,9906.886542252563:1:0:0:100:
439,192,9478.315113681134,128,0,9906.886542252563:1:0:0:100:
74,192,9906.886542252563,128,0,10335.45797082399:1:0:0:100:
366,192,9906.886542252563,128,0,10335.45797082399:1:0:0:100:
293,192,10335.45797082399,128,0,10764.02939939542:1:0:0:100:
147,192,10335.45797082399,128,0,10764.02939939542:1:0:0:100:
220,192,10764.02939939542,128,0,11192.60082796685:1:0:0:100:
0,192,11621.172256538277,1,0,1:0:0:100:
366,192,12049.743685109706,1,0,1:0:0:100:
147,192,12478.315113681134,1,0,1:0:0:100:
0,192,12906.886542252563,1,0,1:0:0:100:
74,192,13335.45797082399,1,0,1:0:0:100:
439,192,13764.02939939542,1,0,1:0:0:100:
366,192,14192.600827966848,1,0,1:0:0:100:
147,192,14621.172256538277,1,0,1:0:0:100:
220,192,15049.743685109706,1,0,1:0:0:100:
366,192,15478.315113681134,1,0,1:0:0:100:
0,192,15906.886542252563,128,0,17621.172256538277:1:0:0:100:
293,192,16335.45797082399,1,0,1:0:0:100:
220,192,16764.02939939542,1,0,1:0:0:100:
147,192,17192.600827966846,1,0,1:0:0:100:
74,192,17621.172256538277,1,0,1:0:0:100:
439,192,17621.172256538277,128,0,19335.45797082399:1:0:0:100:
147,192,18049.743685109705,1,0,1:0:0:100:
220,192,18478.315113681136,1,0,1:0:0:100:
293,192,18906.886542252563,1,0,1:0:0:100:
366,192,19335.45797082399,1,0,1:0:0:100:
0,192,19764.02939939542,128,0,21478.315113681136:1:0:0:100:
74,192,20192.60082796685,128,0,21478.315113681136:1:0:0:100:
147,192,20621.172256538277,128,0,21478.315113681136:1:0:0:100:
220,192,21049.743685109705,128,0,21478.315113681136:1:0:0:100:
439,192,21906.886542252563,128,0,22335.45797082399:1:0:0:100:
366,192,21906.886542252563,1,0,1:0:0:100:
366,192,22335.45797082399,1,0,1:0:0:100:
439,192,22764.02939939542,128,0,23192.60082796685:1:0:0:100:
293,192,22764.02939939542,1,0,1:0:0:100:
293,192,23192.60082796685,1,0,1:0:0:100:
439,192,23621.172256538277,128,0,24049.743685109705:1:0:0:100:
220,192,23621.172256538277,1,0,1:0:0:100:
220,192,24049.743685109705,1,0,1:0:0:100:
42 changes: 31 additions & 11 deletions src/nmania/BeatmapManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Vector;

Expand All @@ -27,12 +28,15 @@ public final class BeatmapManager {
/**
* Loads the manager for specific URL.
*
* @param wd Absolute path to folder with file:///.
* @param wd Absolute path to folder with file:/// and trailing slash.
*/
public BeatmapManager(String wd) {
directory = wd;
}

/**
* Absolute path to folder with charts with file:/// and trailing slash.
*/
public final String directory;
private FileConnection fc;

Expand All @@ -59,9 +63,7 @@ public BeatmapSet FromBMSDirectory(String dir) throws IOException, InvalidBeatma
FileConnection bmsFc = null;
try {
bmsFc = (FileConnection) Connector.open(directory + dir, Connector.READ);
BeatmapSet bms = new BeatmapSet();
bms.wdPath = directory;
bms.folderName = dir;
BeatmapSet bms = new BeatmapSet(directory, dir, bakeEnum(bmsFc.list()));
String fm = null;
String all = ""; // ?dbg
{
Expand All @@ -87,13 +89,7 @@ public BeatmapSet FromBMSDirectory(String dir) throws IOException, InvalidBeatma
return null;
}
IRawBeatmap bm = RawBeatmapConverter.FromText(fm);
bms.image = bm.GetImage();
bms.title = bm.GetTitle();
bms.artist = bm.GetArtist();
bms.mapper = bm.GetMapper();
bms.audio = bm.GetAudio();
bms.timings = bm.GetTimingData();
bms.files = bakeEnum(bmsFc.list());
bms.Fill(bm);
bmsFc.close();
return bms;
} finally {
Expand Down Expand Up @@ -147,6 +143,30 @@ public static final String getStringFromFS(String path) {
}
}

public static final String getStringFromJAR(String path) {
try {
StringBuffer sb = new StringBuffer();
char[] chars = new char[1024];
InputStream stream = Nmania.class.getResourceAsStream(path);
if (stream == null)
return null;
InputStreamReader isr;
isr = new InputStreamReader(stream, "UTF-8");
while (true) {
int c = isr.read(chars);
if (c == -1)
break;
sb.append(chars, 0, c);
}
isr.close();
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
return null;
}

}

public static Image getImgFromFS(String path) {
InputStream is = null;
FileConnection fcon = null;
Expand Down
76 changes: 61 additions & 15 deletions src/nmania/BeatmapSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,39 @@
* @author Feodor0090
*
*/
public final class BeatmapSet {
public class BeatmapSet {
public int id;
public String title;
public String artist;
public String mapper;
public String image;
public String audio;
public String wdPath;
public String folderName;
public String[] files;
/**
* Absolute path to folder with charts with file:/// and trailing slash.
*/
public final String wdPath;
/**
* Name of folder with difficulties <b>with trailing slash</b>.
*/
public final String folderName;
protected String[] files;
public float[][] timings;

public BeatmapSet(String wdPath, String folderName, String[] files) {
this.wdPath = wdPath;
this.folderName = folderName;
this.files = files;
}

public void Fill(IRawBeatmap bm) {
image = bm.GetImage();
title = bm.GetTitle();
artist = bm.GetArtist();
mapper = bm.GetMapper();
audio = bm.GetAudio();
timings = bm.GetTimingData();
}

public boolean hasFile(String eqName) {
for (int i = 0; i < files.length; i++) {
if (eqName.endsWith(files[i]))
Expand Down Expand Up @@ -118,15 +139,26 @@ private String addNum(String name, int sub, String ext) {
return name + " (" + sub + ")." + ext;
}

public String[] ListAllReplays() {
public Vector ListAllReplays() {
Vector v = new Vector(files.length / 2, 8);
for (int i = 0; i < files.length; i++) {
if (files[i].endsWith(".osr") || files[i].endsWith(".nmr"))
if (files[i].endsWith(".osr") || files[i].endsWith(".nmr")) {
v.addElement(files[i]);
}
}
String[] arr = new String[v.size()];
v.copyInto(arr);
return arr;
return v;
}

public Vector ListAllDifficulties() {
Vector items = new Vector();
for (int i = 0; i < files.length; i++) {
String f = files[i];
if (f.endsWith(".osu") || f.endsWith(".nmbm")) {
items.addElement(f);
}
}

return items;
}

public String toString() {
Expand Down Expand Up @@ -163,20 +195,34 @@ public IExtendedReplay ReadReplay(String name) throws IOException {
return replay;
}

public static String GetDifficultyNameFast(String fileName) {
return fileName.substring(fileName.indexOf('[') + 1, fileName.lastIndexOf(']'));
}

/**
* Reads beatmap in this folder.
*
* @param fileName Name of difficulty file.
* @return Raw beatmap.
* @throws InvalidBeatmapTypeException If could not read.
*/
public final IRawBeatmap ReadBeatmap(String fileName) throws InvalidBeatmapTypeException {
String raw = BeatmapManager.getStringFromFS(ToGlobalPath(fileName));
public IRawBeatmap ReadBeatmap(String fileName) throws InvalidBeatmapTypeException {
String glpath = ToGlobalPath(fileName);
String raw;
if (glpath.startsWith("file:///"))
raw = BeatmapManager.getStringFromFS(glpath);
else if (glpath.startsWith("/"))
raw = BeatmapManager.getStringFromJAR(glpath);
else
raw = null;
IRawBeatmap rb = RawBeatmapConverter.FromText(raw);
return rb;
}

public static String GetDifficultyNameFast(String fileName) {
try {
return fileName.substring(fileName.indexOf('[') + 1, fileName.lastIndexOf(']'));
} catch (IndexOutOfBoundsException e) {
int pI = fileName.lastIndexOf('.');
if (pI == -1)
return fileName;
return fileName.substring(0, pI);
}
}
}
Loading

0 comments on commit e09f067

Please sign in to comment.