aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--include/adlmidi.h4
-rw-r--r--src/adlmidi.cpp28
-rw-r--r--src/adlmidi_load.cpp20
-rw-r--r--src/adlmidi_midiplay.cpp24
-rw-r--r--src/adlmidi_mus2mid.c8
-rw-r--r--src/adlmidi_private.hpp5
-rw-r--r--src/adlmidi_xmi2mid.c8
-rw-r--r--utils/dumpbank/dumpbank.cpp30
-rw-r--r--utils/gen_adldata/file_formats/load_op2.h20
-rw-r--r--utils/gen_adldata/ini/ini_processing.cpp9
-rw-r--r--utils/gen_adldata/ini/ini_processing_variant.h2
-rw-r--r--utils/midiplay/adlmidiplay.cpp1
13 files changed, 107 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fb870c..4728a30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,7 +74,9 @@ if(WITH_EMBEDDED_BANKS)
${libADLMIDI_SOURCE_DIR}/src/nukedopl3.c
${libADLMIDI_SOURCE_DIR}/src/dbopl.cpp
)
- target_link_libraries(gen_adldata pthread)
+ if(NOT MSVC)
+ target_link_libraries(gen_adldata pthread)
+ endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("Turned on C++11 on GCC")
target_compile_options(gen_adldata PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)
@@ -157,7 +159,11 @@ if(WITH_MIDIPLAY)
)
if(WIN32)
- target_link_libraries(adlmidiplay ADLMIDI ${SDL2_LIBRARY} pthread)
+ if(MSVC)
+ target_link_libraries(adlmidiplay ADLMIDI ${SDL2_LIBRARY})
+ else()
+ target_link_libraries(adlmidiplay ADLMIDI ${SDL2_LIBRARY} pthread)
+ endif()
else()
target_link_libraries(adlmidiplay ADLMIDI ${SDL2_LIBRARY} pthread dl)
endif()
diff --git a/include/adlmidi.h b/include/adlmidi.h
index c82ef63..145b5dd 100644
--- a/include/adlmidi.h
+++ b/include/adlmidi.h
@@ -60,9 +60,9 @@ struct ADL_MIDIPlayer
double maxdelay;
/* For internal usage */
- int stored_samples; /* num of collected samples */
+ ssize_t stored_samples; /* num of collected samples */
short backup_samples[1024]; /* Backup sample storage. */
- int backup_samples_size; /* Backup sample storage. */
+ ssize_t backup_samples_size; /* Backup sample storage. */
/* For internal usage */
void *adl_midiPlayer;
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index d16fab5..7f8564b 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -56,11 +56,11 @@ ADLMIDI_EXPORT struct ADL_MIDIPlayer *adl_init(long sample_rate)
player->opl.NumCards = midi_device->NumCards;
player->opl.AdlBank = midi_device->AdlBank;
player->opl.NumFourOps = midi_device->NumFourOps;
- player->opl.LogarithmicVolumes = (bool)midi_device->LogarithmicVolumes;
- player->opl.HighTremoloMode = (bool)midi_device->HighTremoloMode;
- player->opl.HighVibratoMode = (bool)midi_device->HighVibratoMode;
- player->opl.AdlPercussionMode = (bool)midi_device->AdlPercussionMode;
- player->opl.ScaleModulators = (bool)midi_device->ScaleModulators;
+ player->opl.LogarithmicVolumes = (midi_device->LogarithmicVolumes != 0);
+ player->opl.HighTremoloMode = (midi_device->HighTremoloMode != 0);
+ player->opl.HighVibratoMode = (midi_device->HighVibratoMode != 0);
+ player->opl.AdlPercussionMode = (midi_device->AdlPercussionMode != 0);
+ player->opl.ScaleModulators = (midi_device->ScaleModulators != 0);
player->ChooseDevice("none");
adlRefreshNumCards(midi_device);
return midi_device;
@@ -147,7 +147,7 @@ ADLMIDI_EXPORT void adl_setPercMode(ADL_MIDIPlayer *device, int percmod)
if(!device) return;
device->AdlPercussionMode = static_cast<unsigned int>(percmod);
- reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.AdlPercussionMode = (bool)device->AdlPercussionMode;
+ reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.AdlPercussionMode = (device->AdlPercussionMode != 0);
}
ADLMIDI_EXPORT void adl_setHVibrato(ADL_MIDIPlayer *device, int hvibro)
@@ -155,7 +155,7 @@ ADLMIDI_EXPORT void adl_setHVibrato(ADL_MIDIPlayer *device, int hvibro)
if(!device) return;
device->HighVibratoMode = static_cast<unsigned int>(hvibro);
- reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.HighVibratoMode = (bool)device->HighVibratoMode;
+ reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.HighVibratoMode = (device->HighVibratoMode != 0);
}
ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
@@ -163,7 +163,7 @@ ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
if(!device) return;
device->HighTremoloMode = static_cast<unsigned int>(htremo);
- reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.HighTremoloMode = (bool)device->HighTremoloMode;
+ reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.HighTremoloMode = (device->HighTremoloMode != 0);
}
ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
@@ -171,7 +171,7 @@ ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
if(!device) return;
device->ScaleModulators = static_cast<unsigned int>(smod);
- reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.ScaleModulators = (bool)device->ScaleModulators;
+ reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.ScaleModulators = (device->ScaleModulators != 0);
}
ADLMIDI_EXPORT void adl_setLoopEnabled(ADL_MIDIPlayer *device, int loopEn)
@@ -185,7 +185,7 @@ ADLMIDI_EXPORT void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int
if(!device) return;
device->LogarithmicVolumes = static_cast<unsigned int>(logvol);
- reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.LogarithmicVolumes = (bool)device->LogarithmicVolumes;
+ reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.LogarithmicVolumes = (device->LogarithmicVolumes != 0);
}
ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int volumeModel)
@@ -386,8 +386,8 @@ inline static void SendStereoAudio(ADL_MIDIPlayer *device,
size_t appendSize = inSamples - maxSamples;
memcpy(device->backup_samples + device->backup_samples_size,
maxSamples + _in, appendSize * sizeof(short));
- device->backup_samples_size += appendSize;
- device->stored_samples += appendSize;
+ device->backup_samples_size += (ssize_t)appendSize;
+ device->stored_samples += (ssize_t)appendSize;
}
}
#endif
@@ -421,7 +421,7 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
ate++;
}
- left -= ate;
+ left -= (int)ate;
gotten_len += ate;
if(ate < device->backup_samples_size)
@@ -500,7 +500,7 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
SendStereoAudio(device, sampleCount, in_generatedStereo, out_buf.data(), gotten_len, out);
}
- left -= in_generatedPhys;
+ left -= (int)in_generatedPhys;
gotten_len += (in_generatedPhys) - device->stored_samples;
}
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp
index c5884a5..1c0e7ef 100644
--- a/src/adlmidi_load.cpp
+++ b/src/adlmidi_load.cpp
@@ -391,11 +391,11 @@ bool MIDIplay::LoadMIDI(MIDIplay::fileReader &fr)
config->stored_samples = 0;
config->backup_samples_size = 0;
- opl.AdlPercussionMode = config->AdlPercussionMode;
- opl.HighTremoloMode = config->HighTremoloMode;
- opl.HighVibratoMode = config->HighVibratoMode;
- opl.ScaleModulators = config->ScaleModulators;
- opl.LogarithmicVolumes = config->LogarithmicVolumes;
+ opl.AdlPercussionMode = (config->AdlPercussionMode != 0);
+ opl.HighTremoloMode = (config->HighTremoloMode != 0);
+ opl.HighVibratoMode = (config->HighVibratoMode != 0);
+ opl.ScaleModulators = (config->ScaleModulators != 0);
+ opl.LogarithmicVolumes = (config->LogarithmicVolumes != 0);
opl.ChangeVolumeRangesModel(static_cast<ADLMIDI_VolumeModels>(config->VolumeModel));
if(config->VolumeModel == ADLMIDI_VolumeModel_AUTO)
@@ -596,7 +596,7 @@ riffskip:
fr.seeku(mus_start, SEEK_SET);
TrackCount = 1;
- DeltaTicks = ticks;
+ DeltaTicks = (size_t)ticks;
opl.AdlBank = ~0u; // Ignore AdlBank number, use dynamic banks instead
//std::printf("CMF deltas %u ticks %u, basictempo = %u\n", deltas, ticks, basictempo);
opl.LogarithmicVolumes = true;
@@ -648,8 +648,8 @@ InvFmt:
}
/*size_t Fmt =*/ ReadBEint(HeaderBuf + 8, 2);
- TrackCount = ReadBEint(HeaderBuf + 10, 2);
- DeltaTicks = ReadBEint(HeaderBuf + 12, 2);
+ TrackCount = (size_t)ReadBEint(HeaderBuf + 10, 2);
+ DeltaTicks = (size_t)ReadBEint(HeaderBuf + 12, 2);
}
}
@@ -661,7 +661,7 @@ InvFmt:
//Tempo = 1000000l * InvDeltaTicks;
Tempo = fraction<uint64_t>(1, static_cast<uint64_t>(DeltaTicks));
static const unsigned char EndTag[4] = {0xFF, 0x2F, 0x00, 0x00};
- int totalGotten = 0;
+ size_t totalGotten = 0;
for(size_t tk = 0; tk < TrackCount; ++tk)
{
@@ -738,7 +738,7 @@ InvFmt:
if(std::memcmp(HeaderBuf, "MTrk", 4) != 0)
goto InvFmt;
- TrackLength = ReadBEint(HeaderBuf + 4, 4);
+ TrackLength = (size_t)ReadBEint(HeaderBuf + 4, 4);
}
// Read track data
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index d473806..e10436b 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -115,7 +115,7 @@ void MIDIplay::AdlChannel::AddAge(int64_t ms)
{
if(users.empty())
koff_time_until_neglible =
- std::max(koff_time_until_neglible - ms, static_cast<int64_t>(-0x1FFFFFFFl));
+ std::max(int64_t(koff_time_until_neglible - ms), static_cast<int64_t>(-0x1FFFFFFFl));
else
{
koff_time_until_neglible = 0;
@@ -212,7 +212,7 @@ void MIDIplay::realTime_ResetState()
chan.bendsense = 2 / 8192.0;
chan.vibpos = 0.0;
chan.vibdepth = 0.5 / 127.0;
- chan.vibdelay = 0.0;
+ chan.vibdelay = 0;
chan.lastlrpn = 0;
chan.lastmrpn = 0;
chan.nrpn = false;
@@ -578,7 +578,7 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value)
break;
case 103:
- cmf_percussion_mode = value;
+ cmf_percussion_mode = (value != 0);
break; // CMF (ctrl 0x67) rhythm mode
default:
@@ -622,8 +622,8 @@ void MIDIplay::realTime_BankChangeMSB(uint8_t channel, uint8_t msb)
void MIDIplay::realTime_BankChange(uint8_t channel, uint16_t bank)
{
channel = channel % 16;
- Ch[channel].bank_lsb = uint8_t(bank & 0xFFFF);
- Ch[channel].bank_msb = uint8_t((bank >> 16) & 0xFFFF);
+ Ch[channel].bank_lsb = uint8_t(bank & 0xFF);
+ Ch[channel].bank_msb = uint8_t((bank >> 8) & 0xFF);
}
@@ -925,7 +925,7 @@ void MIDIplay::HandleEvent(size_t tk)
{
uint64_t length = ReadVarLen(tk);
//std::string data( length?(const char*) &TrackData[tk][CurrentPosition.track[tk].ptr]:0, length );
- CurrentPosition.track[tk].ptr += length;
+ CurrentPosition.track[tk].ptr += (size_t)length;
//UI.PrintLn("SysEx %02X: %u bytes", byte, length/*, data.c_str()*/);
return;
}
@@ -935,8 +935,8 @@ void MIDIplay::HandleEvent(size_t tk)
// Special event FF
uint8_t evtype = TrackData[tk][CurrentPosition.track[tk].ptr++];
uint64_t length = ReadVarLen(tk);
- std::string data(length ? (const char *) &TrackData[tk][CurrentPosition.track[tk].ptr] : 0, length);
- CurrentPosition.track[tk].ptr += length;
+ std::string data(length ? (const char *) &TrackData[tk][CurrentPosition.track[tk].ptr] : 0, (size_t)length);
+ CurrentPosition.track[tk].ptr += (size_t)length;
if(evtype == 0x2F)
{
@@ -1022,7 +1022,7 @@ void MIDIplay::HandleEvent(size_t tk)
CurrentPosition.track[tk].ptr-1, (unsigned)tk, byte,
TrackData[tk][CurrentPosition.track[tk].ptr]);*/
uint8_t MidCh = byte & 0x0F, EvType = byte >> 4;
- MidCh += current_device[tk];
+ MidCh += (uint8_t)current_device[tk];
CurrentPosition.track[tk].status = byte;
switch(EvType)
@@ -1105,9 +1105,9 @@ long MIDIplay::CalculateAdlChannelGoodness(unsigned c, uint16_t ins, uint16_t) c
s -= 4000;
if(!j->second.sustained)
- s -= j->second.kon_time_until_neglible;
+ s -= (long)j->second.kon_time_until_neglible;
else
- s -= j->second.kon_time_until_neglible / 2;
+ s -= (long)(j->second.kon_time_until_neglible / 2);
MIDIchannel::activenotemap_t::const_iterator
k = Ch[j->first.MidCh].activenotes.find(j->first.note);
@@ -1344,7 +1344,7 @@ void MIDIplay::SetRPN(unsigned MidCh, unsigned value, bool MSB)
case 0x010A + 1*0x10000 + 1*0x20000: // Vibrato delay in millisecons
Ch[MidCh].vibdelay =
- value ? long(0.2092 * std::exp(0.0795 * value)) : 0.0;
+ value ? int64_t(0.2092 * std::exp(0.0795 * (double)value)) : 0;
break;
default:/* UI.PrintLn("%s %04X <- %d (%cSB) (ch %u)",
diff --git a/src/adlmidi_mus2mid.c b/src/adlmidi_mus2mid.c
index 8462cd9..7d0d94e 100644
--- a/src/adlmidi_mus2mid.c
+++ b/src/adlmidi_mus2mid.c
@@ -130,7 +130,7 @@ struct mus_ctx {
#define DST_CHUNK 8192
static void resize_dst(struct mus_ctx *ctx) {
- uint32_t pos = ctx->dst_ptr - ctx->dst;
+ uint32_t pos = (uint32_t)(ctx->dst_ptr - ctx->dst);
ctx->dst = realloc(ctx->dst, ctx->dstsize + DST_CHUNK);
ctx->dstsize += DST_CHUNK;
ctx->dstrem += DST_CHUNK;
@@ -178,11 +178,11 @@ static void skipdst(struct mus_ctx *ctx, int32_t pos) {
newpos = ctx->dst_ptr - ctx->dst;
while (ctx->dstsize < newpos)
resize_dst(ctx);
- ctx->dstrem = ctx->dstsize - newpos;
+ ctx->dstrem = (uint32_t)(ctx->dstsize - newpos);
}
static uint32_t getdstpos(struct mus_ctx *ctx) {
- return (ctx->dst_ptr - ctx->dst);
+ return (uint32_t)(ctx->dst_ptr - ctx->dst);
}
/* writes a variable length integer to a buffer, and returns bytes written */
@@ -422,7 +422,7 @@ int AdlMidi_mus2midi(uint8_t *in, uint32_t insize,
if (event & 128) {
delta_time = 0;
do {
- delta_time = (delta_time * 128 + (*cur & 127)) * (140.0 / frequency);
+ delta_time = (int32_t)((delta_time * 128 + (*cur & 127)) * (140.0 / (double)frequency));
} while ((*cur++ & 128));
} else {
delta_time = 0;
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index c33a4d9..cb91616 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -44,6 +44,7 @@
#else
typedef __int32 ssize_t;
#endif
+ #define NOMINMAX //Don't override std::min and std::max
#endif
#include <windows.h>
#endif
@@ -352,7 +353,7 @@ public:
fp = std::fopen(path, "rb");
#else
wchar_t widePath[MAX_PATH];
- int size = MultiByteToWideChar(CP_UTF8, 0, path, std::strlen(path), widePath, MAX_PATH);
+ int size = MultiByteToWideChar(CP_UTF8, 0, path, (int)std::strlen(path), widePath, MAX_PATH);
widePath[size] = '\0';
fp = _wfopen(widePath, L"rb");
#endif
@@ -396,7 +397,7 @@ public:
}
}
- inline void seeku(unsigned long pos, int rel_to)
+ inline void seeku(uint64_t pos, int rel_to)
{
seek(static_cast<long>(pos), rel_to);
}
diff --git a/src/adlmidi_xmi2mid.c b/src/adlmidi_xmi2mid.c
index 9c93957..083b5ed 100644
--- a/src/adlmidi_xmi2mid.c
+++ b/src/adlmidi_xmi2mid.c
@@ -119,7 +119,7 @@ static void copy(struct xmi_ctx *ctx, char *b, uint32_t len)
#define DST_CHUNK 8192
static void resize_dst(struct xmi_ctx *ctx) {
- uint32_t pos = ctx->dst_ptr - ctx->dst;
+ uint32_t pos = (uint32_t)(ctx->dst_ptr - ctx->dst);
ctx->dst = realloc(ctx->dst, ctx->dstsize + DST_CHUNK);
ctx->dstsize += DST_CHUNK;
ctx->dstrem += DST_CHUNK;
@@ -175,7 +175,7 @@ static void skipdst(struct xmi_ctx *ctx, int32_t pos) {
newpos = ctx->dst_ptr - ctx->dst;
while (ctx->dstsize < newpos)
resize_dst(ctx);
- ctx->dstrem = ctx->dstsize - newpos;
+ ctx->dstrem = (uint32_t)(ctx->dstsize - newpos);
}
static uint32_t getsrcsize(struct xmi_ctx *ctx) {
@@ -183,11 +183,11 @@ static uint32_t getsrcsize(struct xmi_ctx *ctx) {
}
static uint32_t getsrcpos(struct xmi_ctx *ctx) {
- return (ctx->src_ptr - ctx->src);
+ return (uint32_t)(ctx->src_ptr - ctx->src);
}
static uint32_t getdstpos(struct xmi_ctx *ctx) {
- return (ctx->dst_ptr - ctx->dst);
+ return (uint32_t)(ctx->dst_ptr - ctx->dst);
}
/* This is a default set of patches to convert from MT32 to GM
diff --git a/utils/dumpbank/dumpbank.cpp b/utils/dumpbank/dumpbank.cpp
index 6996681..aad3e7b 100644
--- a/utils/dumpbank/dumpbank.cpp
+++ b/utils/dumpbank/dumpbank.cpp
@@ -5,19 +5,29 @@
#include <vector>
#include <cstring>
+#ifndef _MSC_VER
+#define PACKED_STRUCT __attribute__((packed))
+#else
+#define PACKED_STRUCT
+#endif
+
+#ifdef _MSC_VER
+#pragma pack(push,1)
+#endif
+
struct BNK1_header
{
char maj_vers, min_vers;
char signature[6]; // "ADLIB-"
unsigned short ins_used, ins_entries;
unsigned name_list, inst_data;
-} __attribute__((packed));
+} PACKED_STRUCT;
struct BNK1_record
{
unsigned short index;
unsigned char used;
char name[9];
-} __attribute__((packed));
+} PACKED_STRUCT;
struct OPL2_op
{
unsigned char key_scale_lvl;
@@ -33,14 +43,14 @@ struct OPL2_op
unsigned char pitch_vib;
unsigned char env_scaling;
unsigned char connection;
-} __attribute__((packed));
+} PACKED_STRUCT;
struct BNK1_instrument
{
unsigned char sound_mode;
unsigned char voice_num;
OPL2_op ops[2];
unsigned char waveforms[2];
-} __attribute__((packed)); // conventional Ad Lib instrument maker bankfile patch
+} PACKED_STRUCT; // conventional Ad Lib instrument maker bankfile patch
struct BNK2_header
{
@@ -49,7 +59,7 @@ struct BNK2_header
char filler[10];
unsigned short ins_entries, ins_used;
int lostSpace;
-} __attribute__((packed));
+} PACKED_STRUCT;
struct BNK2_record
{
char O3_sig[3];
@@ -57,13 +67,13 @@ struct BNK2_record
char used;
int attrib, dataOffset;
unsigned short blockSize, allocBSize;
-} __attribute__((packed));
+} PACKED_STRUCT;
struct OPL3_op
{
unsigned char AVEKMMMM, KKLLLLLL;
unsigned char AAAADDDD, SSSSRRRR;
unsigned char DxxxxWWW, xxxxxxxx;
-} __attribute__((packed));
+} PACKED_STRUCT;
struct BNK2_instrument
{
OPL3_op ops[4];
@@ -71,7 +81,11 @@ struct BNK2_instrument
unsigned char xxP24NNN;
unsigned char TTTTTTTT;
unsigned char xxxxxxxx;
-} __attribute__((packed)); // Ad Lib Gold instrument maker bankfile patch
+} PACKED_STRUCT; // Ad Lib Gold instrument maker bankfile patch
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
static void LoadBNK1(const std::vector<unsigned char>& data)
{
diff --git a/utils/gen_adldata/file_formats/load_op2.h b/utils/gen_adldata/file_formats/load_op2.h
index 30a118f..58d6988 100644
--- a/utils/gen_adldata/file_formats/load_op2.h
+++ b/utils/gen_adldata/file_formats/load_op2.h
@@ -3,7 +3,16 @@
#include "../progs_cache.h"
-#pragma pack(push, 1)
+#ifndef _MSC_VER
+#define PACKED_STRUCT __attribute__((packed))
+#else
+#define PACKED_STRUCT
+#endif
+
+#ifdef _MSC_VER
+#pragma pack(push,1)
+#endif
+
struct Doom_OPL2instrument
{
unsigned char trem_vibr_1; /* OP 1: tremolo/vibrato/sustain/KSR/multi */
@@ -21,8 +30,7 @@ struct Doom_OPL2instrument
unsigned char level_2; /* OP 2: output level */
unsigned char unused;
short basenote; /* base note offset */
-} __attribute__((packed));
-#pragma pack(pop)
+} PACKED_STRUCT;
struct Doom_opl_instr
{
@@ -34,7 +42,11 @@ struct Doom_opl_instr
unsigned char finetune;
unsigned char note;
struct Doom_OPL2instrument patchdata[2];
-} __attribute__((packed));
+} PACKED_STRUCT;
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
static bool LoadDoom(const char *fn, unsigned bank, const char *prefix)
diff --git a/utils/gen_adldata/ini/ini_processing.cpp b/utils/gen_adldata/ini/ini_processing.cpp
index 2f15821..4ef43fc 100644
--- a/utils/gen_adldata/ini/ini_processing.cpp
+++ b/utils/gen_adldata/ini/ini_processing.cpp
@@ -30,6 +30,7 @@ DEALINGS IN THE SOFTWARE.
#include "ini_processing.h"
#include <cstdio>
+#include <cctype>
#include <cstring>
#include <cstdlib>
#include <clocale>
@@ -37,6 +38,14 @@ DEALINGS IN THE SOFTWARE.
#include <algorithm>
#include <assert.h>
#ifdef _WIN32
+ #ifdef _MSC_VER
+ #ifdef _WIN64
+ typedef __int64 ssize_t;
+ #else
+ typedef __int32 ssize_t;
+ #endif
+ #define NOMINMAX //Don't override std::min and std::max
+ #endif
#include <windows.h>
#endif
diff --git a/utils/gen_adldata/ini/ini_processing_variant.h b/utils/gen_adldata/ini/ini_processing_variant.h
index 34f999a..3395e4e 100644
--- a/utils/gen_adldata/ini/ini_processing_variant.h
+++ b/utils/gen_adldata/ini/ini_processing_variant.h
@@ -32,6 +32,8 @@ INI Processor and target value (to be compatible with QSettings)
#include <string>
#include <cstring>
+#include <algorithm>
+#include <cctype>
#include <cstdlib>
#ifdef INI_PROCESSING_ALLOW_QT_TYPES
#include <QString>
diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp
index 7c8766d..9fb9033 100644
--- a/utils/midiplay/adlmidiplay.cpp
+++ b/utils/midiplay/adlmidiplay.cpp
@@ -2,6 +2,7 @@
#include <vector>
#include <string>
#include <cstdio>
+#include <cctype>
#include <cstdlib>
#include <cstring>
#include <deque>