--- adplug-git-66b19f653.old/src/rol.cpp +++ adplug-git-66b19f653/src/rol.cpp @@ -184,6 +184,8 @@ //--------------------------------------------------------- bool CrolPlayer::load(const std::string & filename, const CFileProvider & fp) { + char *cp, *xp; + int nn; binistream *f = fp.open(filename); if (!f) @@ -225,8 +227,24 @@ return false; } - f->readString(mpROLHeader->comment, ROL_COMMENT_SIZE); - mpROLHeader->comment[ROL_COMMENT_SIZE - 1] = 0; + f->readString (mpROLHeader->comment, ROL_COMMENT_SIZE); + xp = NULL; + for (cp = (char *) filename.c_str(); *cp != '\0'; cp++) + { + if (*cp == '/') xp = cp; + } + + cp = (char *) filename.c_str(); + if (xp != NULL) cp = xp+1; + strncpy (mpROLHeader->comment, cp, ROL_COMMENT_SIZE); + mpROLHeader->comment [ROL_COMMENT_SIZE - 1] = 0; + + if ((nn = strlen (cp = mpROLHeader->comment)) > 4) + { + cp = &cp [nn - 4]; + if (!strcmp (cp, ".rol") || !strcmp (cp, ".ROL")) *cp = '\0'; + } + mpROLHeader->ticks_per_beat = static_cast(f->readInt(2)); mpROLHeader->beats_per_measure = static_cast(f->readInt(2)); mpROLHeader->edit_scale_y = static_cast(f->readInt(2));