Skip to content
Snippets Groups Projects
Commit 9af1969c authored by Fang Lu's avatar Fang Lu
Browse files

osufs - integrate hitobject parsing

NOT tested
parent 18e09f54
No related branches found
No related tags found
No related merge requests found
......@@ -629,6 +629,9 @@
201233671FCD4F4400FCBFC8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
......@@ -637,6 +640,9 @@
201233681FCD4F4400FCBFC8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
......
......@@ -195,6 +195,8 @@ osu_song osu_read_osu(const char *filename, mdev *dev, osu_meta *meta,
memset(&ret, 0xcc, sizeof(ret));
strncpy(ret.magic, "DEAD", 4);
ret.combo_colors_start = 0;
ret.storyboard = NULL;
sprintf(line, "%s/%s", cont->dirname, filename);
......@@ -279,7 +281,7 @@ int osu_parse_general(char *line, osu_song *song,
return 1;
}
// AudioFilename (String) specifies the location of the audio file relative to the current folder.
if (strcasecmp(key, "AudioFilename") == 0) {
if (0 && strcasecmp(key, "AudioFilename") == 0) {
if (cont->fs.find(val) == cont->fs.end()) {
printf("Allocating storage for audio %s\n", val);
uint32_t addr = meta->available_block;
......@@ -479,6 +481,7 @@ int osu_parse_difficulty(char *line, osu_song *song,
int osu_parse_events(char *line, osu_song *song,
mdev *dev, osu_meta *meta, osu_dir *cont) {
// Events section is in CSV format
return 0;
switch (line[0]) {
case '0': {
// Background image
......@@ -538,11 +541,24 @@ int osu_parse_colors(char *line, osu_song *song,
return 1;
}
if (strncasecmp(key, "Combo",5) != 0) {
int r, g, b;
if (strncasecmp(key, "SliderBody", 10) == 0) {
if (sscanf(val, "%d,%d,%d", &r, &g, &b) != 3) {
fprintf(stderr, "Warning: bad SliderBody color: %s\n", val);
return 1;
}
song->combo_slider_color[0] = r;
song->combo_slider_color[1] = g;
song->combo_slider_color[2] = b;
return 0;
}
if (strncasecmp(key, "Combo", 5) != 0) {
return 0;
}
int n = key[6] - '1', r, g, b;
int n = key[5] - '1';
if (sscanf(val, "%d,%d,%d", &r, &g, &b) != 3) {
fprintf(stderr, "Warning: bad combo color: %s\n", val);
return 1;
......
......@@ -74,7 +74,7 @@ int osu_parse_hit_object(char* line, osu_song* song){
break;
}
//update count and data block
if (song->storyboard){
if (!song->storyboard){
song->storyboard = (uint8_t *) malloc(4+4+32*temp_c);
*((uint32_t*)(song->storyboard)) = 0b01110010011001010110000101101100;
*((uint32_t*)(song->storyboard)+1) = temp_c;
......@@ -89,7 +89,9 @@ int osu_parse_hit_object(char* line, osu_song* song){
return 0;
}
void string_split(char* dup, const char* delim, vector<string> & v){
void string_split(char* line, const char* delim, vector<string> & v){
char dup[1024];
strncpy(dup, line, 1024);
char * token = strtok(dup, delim);
while(token != NULL){
v.push_back(string(token));
......
......@@ -228,11 +228,13 @@ extern "C" {
uint16_t stack_leniency; // 78 - 79
//for analyze side only
uint8_t combo_colors_count; // 80 - 80
uint8_t combo_colors_start; // 81 - 81
uint8_t *storyboard; // 82 - 89
uint8_t *storyboard; // 80 - 87
uint8_t combo_colors_count; // 88
uint8_t combo_colors_start; // 89
uint8_t combo_slider_color[3]; // 90 - 92
char _padding[230]; // 90 - 319
char _padding[227]; // 93 - 319
char title[64]; // 320 - 383
char artist[64]; // 384 - 447
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment