mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-29 06:28:30 +00:00
simplified mod
This commit is contained in:
@@ -1471,15 +1471,11 @@ void jar_mod_fillbuffer( modcontext * modctx, short * outbuffer, unsigned long n
|
||||
}
|
||||
}
|
||||
|
||||
void jar_mod_unload( modcontext * modctx)
|
||||
//resets internals for mod context
|
||||
static void jar_mod_reset( modcontext * modctx)
|
||||
{
|
||||
if(modctx)
|
||||
{
|
||||
if(modctx->modfile)
|
||||
{
|
||||
free(modctx->modfile);
|
||||
modctx->modfile = 0;
|
||||
}
|
||||
memclear(&modctx->song, 0, sizeof(modctx->song));
|
||||
memclear(&modctx->sampledata, 0, sizeof(modctx->sampledata));
|
||||
memclear(&modctx->patterndata, 0, sizeof(modctx->patterndata));
|
||||
@@ -1493,20 +1489,32 @@ void jar_mod_unload( modcontext * modctx)
|
||||
modctx->patternticksaim = 0;
|
||||
modctx->sampleticksconst = 0;
|
||||
modctx->loopcount = 0;
|
||||
|
||||
modctx->samplenb = 0;
|
||||
|
||||
memclear(modctx->channels, 0, sizeof(modctx->channels));
|
||||
|
||||
modctx->number_of_channels = 0;
|
||||
|
||||
modctx->mod_loaded = 0;
|
||||
|
||||
modctx->last_r_sample = 0;
|
||||
modctx->last_l_sample = 0;
|
||||
|
||||
jar_mod_init(modctx);
|
||||
}
|
||||
}
|
||||
|
||||
void jar_mod_unload( modcontext * modctx)
|
||||
{
|
||||
if(modctx)
|
||||
{
|
||||
if(modctx->modfile)
|
||||
{
|
||||
free(modctx->modfile);
|
||||
modctx->modfile = 0;
|
||||
}
|
||||
jar_mod_reset(modctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
mulong jar_mod_load_file(modcontext * modctx, char* filename)
|
||||
{
|
||||
mulong fsize = 0;
|
||||
@@ -1567,12 +1575,8 @@ void jar_mod_seek_start(modcontext * ctx)
|
||||
{
|
||||
if(ctx)
|
||||
{
|
||||
char* tmpmodfile = ctx->modfile;
|
||||
long size = ctx->modfilesize;
|
||||
jar_mod_init(ctx);
|
||||
jar_mod_load(ctx, tmpmodfile, size);
|
||||
ctx->modfilesize = size;
|
||||
ctx->modfile = tmpmodfile;
|
||||
jar_mod_reset(ctx);
|
||||
jar_mod_load(ctx, ctx->modfile, ctx->modfilesize);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user