From f2843d4d71deaa984ee4016fa7c528b16f02b0cb Mon Sep 17 00:00:00 2001 From: Andrea Date: Mon, 18 Oct 2021 20:23:46 +0100 Subject: [PATCH] Collections of changes to facilitate compilation on Linux and macOS. (PR #992) --- source/CmdLine.h | 2 +- source/Debugger/Debug.cpp | 2 +- source/Debugger/Debugger_Help.cpp | 4 ++-- source/Log.h | 6 ++++++ source/Memory.cpp | 2 +- source/Mockingboard.cpp | 2 +- source/Registry.h | 1 + source/Tfe/tfe.cpp | 2 +- source/Tfe/tfearch.cpp | 5 +++++ 9 files changed, 19 insertions(+), 7 deletions(-) diff --git a/source/CmdLine.h b/source/CmdLine.h index 6fe0c632..2e1034cd 100644 --- a/source/CmdLine.h +++ b/source/CmdLine.h @@ -1,6 +1,6 @@ #pragma once -#include "RgbMonitor.h" +#include "RGBMonitor.h" #include "Harddisk.h" #include "Disk.h" #include "Common.h" diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index dfd657f0..d9a53857 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -814,7 +814,7 @@ Update_t CmdProfile (int nArgs) if (ProfileSave()) { TCHAR sText[ CONSOLE_WIDTH ]; - ConsoleBufferPushFormat ( sText, " Saved: %s", g_FileNameProfile ); + ConsoleBufferPushFormat ( sText, " Saved: %s", g_FileNameProfile.c_str() ); } else ConsoleBufferPush( TEXT(" ERROR: Couldn't save file. (In use?)" ) ); diff --git a/source/Debugger/Debugger_Help.cpp b/source/Debugger/Debugger_Help.cpp index 953b9657..bc4c2479 100644 --- a/source/Debugger/Debugger_Help.cpp +++ b/source/Debugger/Debugger_Help.cpp @@ -1066,11 +1066,11 @@ Update_t CmdHelpSpecific (int nArgs) // Config - Load / Save case CMD_CONFIG_LOAD: ConsoleColorizePrint( sText, " Usage: [\"filename\"]" ); - ConsoleBufferPushFormat( sText, " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig ); + ConsoleBufferPushFormat( sText, " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig.c_str() ); break; case CMD_CONFIG_SAVE: ConsoleColorizePrint( sText, " Usage: [\"filename\"]" ); - ConsoleBufferPushFormat( sText, " Save debugger configuration to '%s', or the specificed file.", g_sFileNameConfig ); + ConsoleBufferPushFormat( sText, " Save debugger configuration to '%s', or the specificed file.", g_sFileNameConfig.c_str() ); break; // Config - Color case CMD_CONFIG_COLOR: diff --git a/source/Log.h b/source/Log.h index d952e69a..82935a6a 100644 --- a/source/Log.h +++ b/source/Log.h @@ -12,5 +12,11 @@ extern FILE* g_fh; // Filehandle for log file void LogInit(void); void LogDone(void); + +#ifdef _MSC_VER void LogOutput(LPCTSTR format, ...); void LogFileOutput(LPCTSTR format, ...); +#else +void LogOutput(LPCTSTR format, ...) __attribute__ ((format (printf, 1, 2))); +void LogFileOutput(LPCTSTR format, ...) __attribute__ ((format (printf, 1, 2))); +#endif diff --git a/source/Memory.cpp b/source/Memory.cpp index 681cbf27..b3c71683 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "SerialComms.h" #include "Speaker.h" #include "Tape.h" -#include "tfe/tfe.h" +#include "Tfe/tfe.h" #include "RGBMonitor.h" #include "z80emu.h" diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 58ec7111..d5b08886 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1041,7 +1041,7 @@ static void MB_Update(void) static bool MB_DSInit() { - LogFileOutput("MB_DSInit\n", g_bMBAvailable); + LogFileOutput("MB_DSInit\n"); #ifdef NO_DIRECT_X return false; diff --git a/source/Registry.h b/source/Registry.h index c4d2da12..9d3da777 100644 --- a/source/Registry.h +++ b/source/Registry.h @@ -1,4 +1,5 @@ #pragma once +#include "Card.h" #define REGLOAD(a, b) RegLoadValue(TEXT(REG_CONFIG), (a), TRUE, (b)) #define REGLOAD_DEFAULT(a, b, c) RegLoadValue(TEXT(REG_CONFIG), (a), TRUE, (b), (c)) diff --git a/source/Tfe/tfe.cpp b/source/Tfe/tfe.cpp index 17513d68..840296e0 100644 --- a/source/Tfe/tfe.cpp +++ b/source/Tfe/tfe.cpp @@ -1516,7 +1516,7 @@ bool tfe_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT vers throw std::string("Card: wrong version"); tfe_enabled = yamlLoadHelper.LoadBool(SS_YAML_KEY_ENABLED) ? true : false; - set_tfe_interface(yamlLoadHelper.LoadStringA(SS_YAML_KEY_NETWORK_INTERFACE)); + set_tfe_interface(yamlLoadHelper.LoadString(SS_YAML_KEY_NETWORK_INTERFACE)); tfe_started_tx = yamlLoadHelper.LoadBool(SS_YAML_KEY_STARTED_TX) ? true : false; tfe_cannot_use = yamlLoadHelper.LoadBool(SS_YAML_KEY_CANNOT_USE) ? true : false; diff --git a/source/Tfe/tfearch.cpp b/source/Tfe/tfearch.cpp index b07e1230..986f8b88 100644 --- a/source/Tfe/tfearch.cpp +++ b/source/Tfe/tfearch.cpp @@ -27,7 +27,12 @@ /* #define WPCAP */ +#ifdef _MSC_VER #include "pcap.h" +#else +// on Linux and Mac OS X, we use system's pcap.h, which needs to be included as <> +#include +#endif #include #include