void load_epilogue(struct context_data *ctx) { struct player_data *p = &ctx->p; struct module_data *m = &ctx->m; struct xmp_module *mod = &m->mod; int i, j; mod->gvl = m->gvol; /* Sanity check for module parameters */ CLAMP(mod->len, 0, XMP_MAX_MOD_LENGTH); CLAMP(mod->pat, 0, 256); CLAMP(mod->ins, 0, 255); CLAMP(mod->smp, 0, MAX_SAMPLES); CLAMP(mod->chn, 0, XMP_MAX_CHANNELS); /* Fix cases where the restart value is invalid e.g. kc_fall8.xm * from http://aminet.net/mods/mvp/mvp_0002.lha (reported by * Ralf Hoffmann <*****@*****.**>) */ if (mod->rst >= mod->len) { mod->rst = 0; } /* Sanity check for tempo and BPM */ if (mod->spd <= 0 || mod->spd > 255) { mod->spd = 6; } CLAMP(mod->bpm, XMP_MIN_BPM, 255); /* Set appropriate values for instrument volumes and subinstrument * global volumes when QUIRK_INSVOL is not set, to keep volume values * consistent if the user inspects struct xmp_module. We can later * set volumes in the loaders and eliminate the quirk. */ for (i = 0; i < mod->ins; i++) { if (~m->quirk & QUIRK_INSVOL) { mod->xxi[i].vol = m->volbase; } for (j = 0; j < mod->xxi[i].nsm; j++) { if (~m->quirk & QUIRK_INSVOL) { mod->xxi[i].sub[j].gvl = m->volbase; } } } /* Sanity check for envelopes */ for (i = 0; i < mod->ins; i++) { check_envelope(&mod->xxi[i].aei); check_envelope(&mod->xxi[i].fei); check_envelope(&mod->xxi[i].pei); } p->flags = p->player_flags; #ifndef LIBXMP_CORE_PLAYER module_quirks(ctx); #endif }
void load_epilogue(struct context_data *ctx) { struct player_data *p = &ctx->p; struct module_data *m = &ctx->m; struct xmp_module *mod = &m->mod; int i, j; mod->gvl = m->gvolbase; /* Fix cases where the restart value is invalid e.g. kc_fall8.xm * from http://aminet.net/mods/mvp/mvp_0002.lha (reported by * Ralf Hoffmann <*****@*****.**>) */ if (mod->rst >= mod->len) { mod->rst = 0; } /* Sanity check */ if (mod->spd == 0) { mod->spd = 6; } if (mod->bpm == 0) { mod->bpm = 125; } /* Set appropriate values for instrument volumes and subinstrument * global volumes when QUIRK_INSVOL is not set, to keep volume values * consistent if the user inspects struct xmp_module. We can later * set volumes in the loaders and eliminate the quirk. */ for (i = 0; i < mod->ins; i++) { if (~m->quirk & QUIRK_INSVOL) { mod->xxi[i].vol = m->volbase; } for (j = 0; j < mod->xxi[i].nsm; j++) { if (~m->quirk & QUIRK_INSVOL) { mod->xxi[i].sub[j].gvl = m->volbase; } } } /* Sanity check for envelopes */ for (i = 0; i < mod->ins; i++) { check_envelope(&mod->xxi[i].aei); check_envelope(&mod->xxi[i].fei); check_envelope(&mod->xxi[i].pei); } p->flags = p->player_flags; module_quirks(ctx); }