From 74b4ee66e3b5775f41526d76e7a16433b52f2627 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Sun, 22 Oct 2017 02:30:34 +0300 Subject: Fixed CMake build on macOS --- utils/dumpmiles/dumpmiles.cpp | 4 ++-- utils/gen_adldata/gen_adldata.cc | 3 ++- utils/gen_adldata/progs_cache.cpp | 2 +- utils/gen_adldata/progs_cache.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/utils/dumpmiles/dumpmiles.cpp b/utils/dumpmiles/dumpmiles.cpp index 832da93..e946c5d 100644 --- a/utils/dumpmiles/dumpmiles.cpp +++ b/utils/dumpmiles/dumpmiles.cpp @@ -32,9 +32,9 @@ static void LoadMiles(const char* fn) unsigned offset = *(unsigned*)&data[a*6+2]; if(gmnumber == 0xFF) break; - int gmno = gmnumber2==0x7F ? gmnumber+0x80 : gmnumber; + //int gmno = gmnumber2==0x7F ? gmnumber+0x80 : gmnumber; unsigned length = data[offset] + data[offset+1]*256; - signed char notenum = data[offset+2]; + //signed char notenum = data[offset+2]; std::printf("%02X %02X ", gmnumber,gmnumber2); //, offset); for(unsigned b=0; b #include #include +#include #include "ini/ini_processing.h" @@ -390,7 +391,7 @@ int main(int argc, char**argv) unsigned flags = (i->first.pseudo4op ? 1 : 0) | (info.nosound ? 2 : 0); fprintf(outFile, " {"); - fprintf(outFile, "%4d,%4d,%3d, %d, %6ld,%6ld,%lf", + fprintf(outFile, "%4d,%4d,%3d, %d, %6" PRId64 ",%6" PRId64 ",%lf", (unsigned) i->first.insno1, (unsigned) i->first.insno2, (int)(i->first.notenum), diff --git a/utils/gen_adldata/progs_cache.cpp b/utils/gen_adldata/progs_cache.cpp index 4aec9be..9a12b5c 100644 --- a/utils/gen_adldata/progs_cache.cpp +++ b/utils/gen_adldata/progs_cache.cpp @@ -102,5 +102,5 @@ size_t InsertNoSoundIns() // { 0x0F70700,0x0F70710, 0xFF,0xFF, 0x0,+0 }, insdata tmp1 = { {0x00, 0x10, 0x07, 0x07, 0xF7, 0xF7, 0x00, 0x00, 0xFF, 0xFF, 0x00}, 0, 0 }; struct ins tmp2 = { 0, 0, 0, false, 0.0 }; - return InsertIns(tmp1, tmp1, tmp2, "nosound"); + return InsertIns(tmp1, tmp1, tmp2, "nosound", ""); } diff --git a/utils/gen_adldata/progs_cache.h b/utils/gen_adldata/progs_cache.h index 007c3b4..9918e82 100644 --- a/utils/gen_adldata/progs_cache.h +++ b/utils/gen_adldata/progs_cache.h @@ -7,6 +7,7 @@ #include #include #include +#include #include struct insdata @@ -79,7 +80,7 @@ extern std::vector banknames; void SetBank(unsigned bank, unsigned patch, size_t insno); size_t InsertIns(const insdata &id, const insdata &id2, ins &in, - const std::string &name, const std::string &name2 = ""); + const std::string &name, const std::string &name2); size_t InsertNoSoundIns(); #endif // PROGS_H -- cgit v1.2.3 From 9de1ad18d5305f21cb6998bdd88144893d0e121d Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Sun, 22 Oct 2017 04:38:58 +0300 Subject: Fix MSVC CMake compilation TODO: Fix a freaking MSVC's "invalid comparator" assert given by std::map::lower_bound() call --- utils/gen_adldata/file_formats/load_op2.h | 2 +- utils/gen_adldata/progs_cache.cpp | 2 +- utils/gen_adldata/progs_cache.h | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'utils') diff --git a/utils/gen_adldata/file_formats/load_op2.h b/utils/gen_adldata/file_formats/load_op2.h index 58d6988..1e51563 100644 --- a/utils/gen_adldata/file_formats/load_op2.h +++ b/utils/gen_adldata/file_formats/load_op2.h @@ -86,7 +86,7 @@ static bool LoadDoom(const char *fn, unsigned bank, const char *prefix) Doom_opl_instr &ins = *(Doom_opl_instr *) &data[offset2]; - insdata tmp[2]; + insdata tmp[2] = {InsertNoSoundIns(), InsertNoSoundIns()}; tmp[0].diff = false; tmp[1].diff = true; for(unsigned index = 0; index < 2; ++index) diff --git a/utils/gen_adldata/progs_cache.cpp b/utils/gen_adldata/progs_cache.cpp index 9a12b5c..b51f4f8 100644 --- a/utils/gen_adldata/progs_cache.cpp +++ b/utils/gen_adldata/progs_cache.cpp @@ -100,7 +100,7 @@ size_t InsertIns( size_t InsertNoSoundIns() { // { 0x0F70700,0x0F70710, 0xFF,0xFF, 0x0,+0 }, - insdata tmp1 = { {0x00, 0x10, 0x07, 0x07, 0xF7, 0xF7, 0x00, 0x00, 0xFF, 0xFF, 0x00}, 0, 0 }; + insdata tmp1 = { {0x00, 0x10, 0x07, 0x07, 0xF7, 0xF7, 0x00, 0x00, 0xFF, 0xFF, 0x00}, 0, false}; struct ins tmp2 = { 0, 0, 0, false, 0.0 }; return InsertIns(tmp1, tmp1, tmp2, "nosound", ""); } diff --git a/utils/gen_adldata/progs_cache.h b/utils/gen_adldata/progs_cache.h index 9918e82..b0e63a4 100644 --- a/utils/gen_adldata/progs_cache.h +++ b/utils/gen_adldata/progs_cache.h @@ -17,9 +17,13 @@ struct insdata bool diff; bool operator==(const insdata &b) const { - return std::memcmp(data, b.data, 11) == 0 && finetune == b.finetune && diff == b.diff; + return (std::memcmp(data, b.data, 11) == 0) && (finetune == b.finetune) && (diff == b.diff); } - bool operator< (const insdata &b) const + bool operator!=(const insdata &b) const + { + return !operator==(b); + } + bool operator<(const insdata &b) const { int c = std::memcmp(data, b.data, 11); if(c != 0) return c < 0; @@ -27,9 +31,9 @@ struct insdata if(diff != b.diff) return (!diff) == (b.diff); return 0; } - bool operator!=(const insdata &b) const + bool operator>(const insdata &b) const { - return !operator==(b); + return !operator<(b) && operator!=(b); } }; -- cgit v1.2.3