hxcmod-player: Avoid playback error on platforms where char is unsigned

This commit is contained in:
Matthias Ringwald 2017-08-09 22:08:16 +02:00
parent 8a7f815b85
commit afc6fe184c
2 changed files with 5 additions and 4 deletions

View File

@ -231,7 +231,7 @@ static void worknote( note * nptr, hxcmod_channel * cptr,char t,modcontext * mod
if( period || _sample ) if( period || _sample )
{ {
cptr->sampdata =(char *) mod->sampledata[cptr->sampnum]; cptr->sampdata = mod->sampledata[cptr->sampnum];
cptr->length = mod->song.samples[cptr->sampnum].length; cptr->length = mod->song.samples[cptr->sampnum].length;
cptr->reppnt = mod->song.samples[cptr->sampnum].reppnt; cptr->reppnt = mod->song.samples[cptr->sampnum].reppnt;
cptr->replen = mod->song.samples[cptr->sampnum].replen; cptr->replen = mod->song.samples[cptr->sampnum].replen;
@ -984,7 +984,7 @@ int hxcmod_load( modcontext * modctx, void * mod_data, int mod_data_size )
if (sptr->length == 0) continue; if (sptr->length == 0) continue;
modctx->sampledata[i] = (char*)modmemory; modctx->sampledata[i] = (mchar*)modmemory;
modmemory += sptr->length; modmemory += sptr->length;
if (sptr->replen + sptr->reppnt > sptr->length) if (sptr->replen + sptr->reppnt > sptr->length)

View File

@ -30,6 +30,7 @@ extern "C" {
// Basic type // Basic type
typedef unsigned char muchar; typedef unsigned char muchar;
typedef signed char mchar;
typedef unsigned short muint; typedef unsigned short muint;
typedef short mint; typedef short mint;
typedef unsigned long mulong; typedef unsigned long mulong;
@ -75,7 +76,7 @@ typedef struct {
// HxCMod Internal structures // HxCMod Internal structures
// //
typedef struct { typedef struct {
char * sampdata; mchar * sampdata;
muint sampnum; muint sampnum;
muint length; muint length;
muint reppnt; muint reppnt;
@ -112,7 +113,7 @@ typedef struct {
typedef struct { typedef struct {
module song; module song;
char * sampledata[31]; mchar * sampledata[31];
note * patterndata[128]; note * patterndata[128];
mulong playrate; mulong playrate;