From d0211379e0ff82d326b87e096629fdfb67dcc90b Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 10 Jun 2017 08:19:35 +0000 Subject: [PATCH] Get MSVC building again, DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@6174 1a8010ca-5511-0410-912e-c29ae57300e0 --- platform/Windows/msvc.mak | 50 ++++++++++++++++++++++++++++---- source/libxmp-lite/src/mix_all.c | 4 +-- source/libxmp-lite/src/mixer.c | 10 +++---- source/libxmp-lite/src/period.c | 8 ++--- source/libxmp-lite/src/player.c | 12 ++++---- source/libxmp-lite/src/scan.c | 6 ++-- 6 files changed, 64 insertions(+), 26 deletions(-) diff --git a/platform/Windows/msvc.mak b/platform/Windows/msvc.mak index 093bd1a78..602319255 100644 --- a/platform/Windows/msvc.mak +++ b/platform/Windows/msvc.mak @@ -35,6 +35,12 @@ ENET_OBJ=$(obj)\$(ENET) ENET_INC=$(ENET_ROOT)\include ENET_SRC=$(ENET_ROOT)\src +LIBXMPLITE=libxmp-lite +LIBXMPLITE_ROOT=$(source)\$(LIBXMPLITE) +LIBXMPLITE_OBJ=$(obj)\$(LIBXMPLITE) +LIBXMPLITE_INC=$(LIBXMPLITE_ROOT)\include +LIBXMPLITE_SRC=$(LIBXMPLITE_ROOT)\src + o=obj res=res asm=masm @@ -80,7 +86,7 @@ flags_cl=$(flags_cl) /arch:SSE flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386 !endif -ENGINEOPTS=/DUSE_OPENGL /DPOLYMER /DSTARTUP_WINDOW /DUSE_LIBPNG /DUSE_LIBVPX /DHAVE_VORBIS /DHAVE_XMP +ENGINEOPTS=/DUSE_OPENGL /DPOLYMER /DSTARTUP_WINDOW /DUSE_LIBPNG /DUSE_LIBVPX /DHAVE_VORBIS /DHAVE_LIBXMPLITE !ifdef CPLUSPLUS ENGINEOPTS=$(ENGINEOPTS) /TP @@ -95,11 +101,12 @@ AS=ml LINK=link /nologo /opt:ref MT=mt CFLAGS= /MT /J /nologo $(flags_cl) \ - /I$(DUKE3D_SRC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC) /I$(MACT_INC) /I$(AUDIOLIB_INC) /I$(ENET_INC) \ + /I$(DUKE3D_SRC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC) /I$(MACT_INC) /I$(AUDIOLIB_INC) /I$(ENET_INC) /I$(LIBXMPLITE_INC) \ /W2 $(ENGINEOPTS) \ /I$(PLATFORM)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_USEFOLDER /DSDL_TARGET=2 ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC) +LIBXMPLITE_CFLAGS=/I$(LIBXMPLITE_INC) /I$(LIBXMPLITE_INC)/libxmp-lite /I$(LIBXMPLITE_SRC) -DHAVE_ROUND -DLIBXMP_CORE_PLAYER -DBUILDING_STATIC AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC) LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \ @@ -185,6 +192,33 @@ ENET_OBJS=$(ENET_OBJ)\callbacks.$o \ $(ENET_OBJ)\win32.$o \ $(ENET_OBJ)\compress.$o +LIBXMPLITE_OBJS=$(LIBXMPLITE_OBJ)\control.$o \ + $(LIBXMPLITE_OBJ)\dataio.$o \ + $(LIBXMPLITE_OBJ)\effects.$o \ + $(LIBXMPLITE_OBJ)\filter.$o \ + $(LIBXMPLITE_OBJ)\format.$o \ + $(LIBXMPLITE_OBJ)\hio.$o \ + $(LIBXMPLITE_OBJ)\lfo.$o \ + $(LIBXMPLITE_OBJ)\load.$o \ + $(LIBXMPLITE_OBJ)\load_helpers.$o \ + $(LIBXMPLITE_OBJ)\memio.$o \ + $(LIBXMPLITE_OBJ)\mixer.$o \ + $(LIBXMPLITE_OBJ)\mix_all.$o \ + $(LIBXMPLITE_OBJ)\period.$o \ + $(LIBXMPLITE_OBJ)\player.$o \ + $(LIBXMPLITE_OBJ)\read_event.$o \ + $(LIBXMPLITE_OBJ)\scan.$o \ + $(LIBXMPLITE_OBJ)\smix.$o \ + $(LIBXMPLITE_OBJ)\virtual.$o \ + $(LIBXMPLITE_OBJ)\common.$o \ + $(LIBXMPLITE_OBJ)\itsex.$o \ + $(LIBXMPLITE_OBJ)\it_load.$o \ + $(LIBXMPLITE_OBJ)\mod_load.$o \ + $(LIBXMPLITE_OBJ)\s3m_load.$o \ + $(LIBXMPLITE_OBJ)\sample.$o \ + $(LIBXMPLITE_OBJ)\xm_load.$o + + AUDIOLIB_OBJS=$(AUDIOLIB_OBJ)\drivers.$o \ $(AUDIOLIB_OBJ)\fx_man.$o \ $(AUDIOLIB_OBJ)\multivoc.$o \ @@ -282,7 +316,7 @@ CHECKDIR_DUKE3D=@if not exist "$(DUKE3D_OBJ)" mkdir "$(DUKE3D_OBJ)" CHECKDIR_ENET=@if not exist "$(ENET_OBJ)" mkdir "$(ENET_OBJ)" CHECKDIR_MACT=@if not exist "$(MACT_OBJ)" mkdir "$(MACT_OBJ)" CHECKDIR_AUDIOLIB=@if not exist "$(AUDIOLIB_OBJ)" mkdir "$(AUDIOLIB_OBJ)" - +CHECKDIR_LIBXMPLITE=@if not exist "$(LIBXMPLITE_OBJ)" mkdir "$(LIBXMPLITE_OBJ)" EDUKE32_TARGET=$(root)\eduke32$(EXESUFFIX) MAPSTER32_TARGET=$(root)\mapster32$(EXESUFFIX) @@ -306,6 +340,10 @@ MAPSTER32_TARGET=$(root)\mapster32$(EXESUFFIX) $(CHECKDIR_ENET) $(CC) /c $(CFLAGS) $(ENET_CFLAGS) /Fo$@ $< +{$(LIBXMPLITE_SRC)}.c{$(LIBXMPLITE_OBJ)}.$o: + $(CHECKDIR_LIBXMPLITE) + $(CC) /c $(CFLAGS) $(LIBXMPLITE_CFLAGS) /Fo$@ $< + {$(AUDIOLIB_SRC)}.cpp{$(AUDIOLIB_OBJ)}.$o: $(CHECKDIR_AUDIOLIB) $(CC) /c $(CFLAGS) $(AUDIOLIB_CFLAGS) /Fo$@ $< @@ -332,7 +370,7 @@ MAPSTER32_TARGET=$(root)\mapster32$(EXESUFFIX) all: $(EDUKE32_TARGET) $(MAPSTER32_TARGET) -$(EDUKE32_TARGET): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(MACT_OBJS) $(ENET_OBJS) +$(EDUKE32_TARGET): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(MACT_OBJS) $(ENET_OBJS) $(LIBXMPLITE_OBJS) $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS) $(MT) -manifest $(DUKE3D_RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest @@ -346,6 +384,6 @@ $(MAPSTER32_TARGET): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) # PHONIES clean: - -del /Q $(EDUKE32_TARGET) $(MAPSTER32_TARGET) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(ENET_OBJS) $(MACT_OBJS) $(AUDIOLIB_OBJS) *.pdb $(root)\*.pdb $(root)\*.map $(root)\*.manifest - + -del /Q $(EDUKE32_TARGET) $(MAPSTER32_TARGET) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) *.pdb $(root)\*.pdb $(root)\*.map $(root)\*.manifest + -del /Q $(ENET_OBJS) $(LIBXMPLITE_OBJS) $(MACT_OBJS) $(AUDIOLIB_OBJS) veryclean: clean diff --git a/source/libxmp-lite/src/mix_all.c b/source/libxmp-lite/src/mix_all.c index 9b4302996..64904a3ec 100644 --- a/source/libxmp-lite/src/mix_all.c +++ b/source/libxmp-lite/src/mix_all.c @@ -149,8 +149,8 @@ #define VAR_NORM(x) \ register int smp_in; \ x *sptr = (x *)vi->sptr; \ - unsigned int pos = vi->pos; \ - int frac = (1 << SMIX_SHIFT) * (vi->pos - (int)vi->pos) + unsigned int pos = (unsigned int)vi->pos; \ + int frac = (int)((1 << SMIX_SHIFT) * (vi->pos - (int)vi->pos)) #define VAR_LINEAR_MONO(x) \ VAR_NORM(x); \ diff --git a/source/libxmp-lite/src/mixer.c b/source/libxmp-lite/src/mixer.c index 625352495..a919e9d6b 100644 --- a/source/libxmp-lite/src/mixer.c +++ b/source/libxmp-lite/src/mixer.c @@ -316,7 +316,7 @@ void libxmp_mixer_prepare(struct context_data *ctx) struct mixer_data *s = &ctx->s; int bytelen; - s->ticksize = s->freq * m->time_factor * m->rrate / p->bpm / 1000; + s->ticksize = (int)(s->freq * m->time_factor * m->rrate / p->bpm / 1000); bytelen = s->ticksize * sizeof(int); if (~s->format & XMP_FORMAT_MONO) { @@ -393,7 +393,7 @@ void libxmp_mixer_softmixer(struct context_data *ctx) continue; } - vi->pos0 = vi->pos; + vi->pos0 = (int)vi->pos; buf_pos = s->buf32; if (vi->pan == PAN_SURROUND) { @@ -406,7 +406,7 @@ void libxmp_mixer_softmixer(struct context_data *ctx) if (vi->smp < mod->smp) { xxs = &mod->xxs[vi->smp]; - c5spd = m->xtra[vi->smp].c5spd; + c5spd = (int) m->xtra[vi->smp].c5spd; } else { xxs = &ctx->smix.xxs[vi->smp - mod->smp]; c5spd = m->c4rate; @@ -465,7 +465,7 @@ void libxmp_mixer_softmixer(struct context_data *ctx) samples = 0; usmp = 1; } else { - int s = ceil(((double)vi->end - vi->pos) / step); + int s = (int) ceil(((double)vi->end - vi->pos) / step); /* ...inside the tick boundaries */ if (s > size) { s = size; @@ -523,7 +523,7 @@ void libxmp_mixer_softmixer(struct context_data *ctx) if (mix_fn != NULL) { mix_fn(vi, buf_pos, samples, - vol_l >> 8, vol_r >> 8, step * (1 << SMIX_SHIFT), rsize, delta_l, delta_r); + vol_l >> 8, vol_r >> 8, (int) step * (1 << SMIX_SHIFT), rsize, delta_l, delta_r); } buf_pos += mix_size; diff --git a/source/libxmp-lite/src/period.c b/source/libxmp-lite/src/period.c index 95a707d26..7728902a0 100644 --- a/source/libxmp-lite/src/period.c +++ b/source/libxmp-lite/src/period.c @@ -219,7 +219,7 @@ int libxmp_period_to_note(int p) return 0; } - return round(12.0 * log(PERIOD_BASE / p) / M_LN2) + 1; + return (int)round(12.0 * log(PERIOD_BASE / p) / M_LN2) + 1; } /* Get pitchbend from base note and amiga period */ @@ -234,14 +234,14 @@ int libxmp_period_to_bend(struct context_data *ctx, double p, int n, double adj) switch (m->period_type) { case PERIOD_LINEAR: - return 100 * (8 * (((240 - n) << 4) - p)); + return (int) (100 * (8 * (((240 - n) << 4) - p))); case PERIOD_CSPD: d = libxmp_note_to_period(ctx, n, 0, adj); - return round(100.0 * (1536.0 / M_LN2) * log(p / d)); + return (int) round(100.0 * (1536.0 / M_LN2) * log(p / d)); default: /* Amiga */ d = libxmp_note_to_period(ctx, n, 0, adj); - return round(100.0 * (1536.0 / M_LN2) * log(d / p)); + return (int) round(100.0 * (1536.0 / M_LN2) * log(d / p)); } } diff --git a/source/libxmp-lite/src/player.c b/source/libxmp-lite/src/player.c index e5cf892b0..a3dbfa456 100644 --- a/source/libxmp-lite/src/player.c +++ b/source/libxmp-lite/src/player.c @@ -925,12 +925,12 @@ static void process_frequency(struct context_data *ctx, int chn, int act) /* For xmp_get_frame_info() */ xc->info_pitchbend = linear_bend >> 7; - xc->info_period = period * 4096; + xc->info_period = (int) period * 4096; if (IS_PERIOD_MODRNG()) { CLAMP(xc->info_period, - libxmp_note_to_period(ctx, MAX_NOTE_MOD, xc->finetune, 0) * 4096, - libxmp_note_to_period(ctx, MIN_NOTE_MOD, xc->finetune, 0) * 4096); + (int) libxmp_note_to_period(ctx, MAX_NOTE_MOD, xc->finetune, 0) * 4096, + (int) libxmp_note_to_period(ctx, MIN_NOTE_MOD, xc->finetune, 0) * 4096); } else if (xc->info_period < (1 << 12)) { xc->info_period = (1 << 12); } @@ -1311,7 +1311,7 @@ static void play_channel(struct context_data *ctx, int chn) SET_NOTE(NOTE_RELEASE); } - xc->info_position = libxmp_virt_getvoicepos(ctx, chn); + xc->info_position = (int) libxmp_virt_getvoicepos(ctx, chn); } /* @@ -1847,8 +1847,8 @@ void xmp_get_frame_info(xmp_context opaque, struct xmp_frame_info *info) info->speed = p->speed; info->bpm = p->bpm; info->total_time = p->scan[p->sequence].time; - info->frame_time = p->frame_time * 1000; - info->time = p->current_time; + info->frame_time = (int) p->frame_time * 1000; + info->time = (int) p->current_time; info->buffer = s->buffer; info->total_size = XMP_MAX_FRAMESIZE; diff --git a/source/libxmp-lite/src/scan.c b/source/libxmp-lite/src/scan.c index 1bbbea82c..42b310659 100644 --- a/source/libxmp-lite/src/scan.c +++ b/source/libxmp-lite/src/scan.c @@ -90,7 +90,7 @@ static int scan_module(struct context_data *ctx, int ep, int chain) bpm = mod->bpm; speed = mod->spd; - base_time = m->rrate; + base_time = (int) m->rrate; #ifndef LIBXMP_CORE_PLAYER st26_speed = 0; #endif @@ -173,7 +173,7 @@ static int scan_module(struct context_data *ctx, int ep, int chain) info->gvl = gvl; info->bpm = bpm; info->speed = speed; - info->time = time + m->time_factor * frame_count * base_time / bpm; + info->time = (int) (time + m->time_factor * frame_count * base_time / bpm); #ifndef LIBXMP_CORE_PLAYER info->st26_speed = st26_speed; #endif @@ -485,7 +485,7 @@ end_module: time -= start_time; frame_count += row_count * speed; - return (time + m->time_factor * frame_count * base_time / bpm); + return (int) (time + m->time_factor * frame_count * base_time / bpm); } int libxmp_get_sequence(struct context_data *ctx, int ord)