From 1a97b4c6d792b9d51770b3f5a34a67bd26ef2cb9 Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Thu, 27 Feb 2025 21:09:25 +0100 Subject: [PATCH] RMG-Core: export symbols (TODO) --- Source/RMG-Core/Archive.cpp | 9 +- Source/RMG-Core/CMakeLists.txt | 6 -- .../RMG-Core/CachedRomHeaderAndSettings.cpp | 15 +-- Source/RMG-Core/Callback.cpp | 7 +- Source/RMG-Core/Cheats.cpp | 37 +++---- Source/RMG-Core/ConvertStringEncoding.cpp | 3 +- Source/RMG-Core/Core.cpp | 4 +- Source/RMG-Core/Directories.cpp | 43 ++++---- Source/RMG-Core/DiscordRpc.cpp | 7 +- Source/RMG-Core/Emulation.cpp | 15 +-- Source/RMG-Core/Error.cpp | 5 +- Source/RMG-Core/File.cpp | 7 +- Source/RMG-Core/Key.cpp | 5 +- Source/RMG-Core/Library.cpp | 8 +- Source/RMG-Core/Library.hpp | 2 + Source/RMG-Core/MediaLoader.cpp | 7 +- Source/RMG-Core/Netplay.cpp | 7 +- Source/RMG-Core/Plugins.cpp | 22 ++--- Source/RMG-Core/Rom.cpp | 11 ++- Source/RMG-Core/RomHeader.cpp | 3 +- Source/RMG-Core/RomSettings.cpp | 13 +-- Source/RMG-Core/SaveState.cpp | 21 ++-- Source/RMG-Core/Screenshot.cpp | 3 +- Source/RMG-Core/Settings.cpp | 97 ++++++++++--------- Source/RMG-Core/SpeedFactor.cpp | 5 +- Source/RMG-Core/SpeedLimiter.cpp | 5 +- Source/RMG-Core/String.cpp | 5 +- Source/RMG-Core/Version.cpp | 3 +- Source/RMG-Core/VidExt.cpp | 3 +- Source/RMG-Core/Video.cpp | 7 +- Source/RMG-Core/Volume.cpp | 11 ++- Source/RMG-Core/m64p/Api.cpp | 5 +- 32 files changed, 212 insertions(+), 189 deletions(-) diff --git a/Source/RMG-Core/Archive.cpp b/Source/RMG-Core/Archive.cpp index 3cee3a65a..ac83948ae 100644 --- a/Source/RMG-Core/Archive.cpp +++ b/Source/RMG-Core/Archive.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "Archive.hpp" +#include "Library.hpp" // TODO: move? #include "String.hpp" #include "Error.hpp" @@ -107,7 +108,7 @@ static int zlib_filefunc_testerror(voidpf opaque, voidpf stream) // Exported Functions // -bool CoreReadZipFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) +CORE_EXPORT bool CoreReadZipFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) { std::string error; std::fstream fileStream; @@ -245,7 +246,7 @@ bool CoreReadZipFile(std::filesystem::path file, std::filesystem::path& extracte return false; } -bool CoreRead7zipFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) +CORE_EXPORT bool CoreRead7zipFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) { std::string error; @@ -401,7 +402,7 @@ bool CoreRead7zipFile(std::filesystem::path file, std::filesystem::path& extract return false; } -bool CoreReadArchiveFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) +CORE_EXPORT bool CoreReadArchiveFile(std::filesystem::path file, std::filesystem::path& extractedFileName, bool& isDisk, std::vector& outBuffer) { std::string file_extension; @@ -431,7 +432,7 @@ bool CoreReadArchiveFile(std::filesystem::path file, std::filesystem::path& extr return true; } -bool CoreUnzip(std::filesystem::path file, std::filesystem::path path) +CORE_EXPORT bool CoreUnzip(std::filesystem::path file, std::filesystem::path path) { std::string error; std::filesystem::path targetPath; diff --git a/Source/RMG-Core/CMakeLists.txt b/Source/RMG-Core/CMakeLists.txt index 4dbd2fdfb..244b600da 100644 --- a/Source/RMG-Core/CMakeLists.txt +++ b/Source/RMG-Core/CMakeLists.txt @@ -5,12 +5,6 @@ project(RMG-Core) set(CMAKE_CXX_STANDARD 20) -# RMG-Core needs LTO disabled for windows -# else linking fails -if (WIN32) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) -endif(WIN32) - find_package(PkgConfig REQUIRED) pkg_check_modules(SDL2 REQUIRED sdl2) pkg_check_modules(MINIZIP REQUIRED minizip) diff --git a/Source/RMG-Core/CachedRomHeaderAndSettings.cpp b/Source/RMG-Core/CachedRomHeaderAndSettings.cpp index c0d08ffa0..e5dd0e612 100644 --- a/Source/RMG-Core/CachedRomHeaderAndSettings.cpp +++ b/Source/RMG-Core/CachedRomHeaderAndSettings.cpp @@ -11,6 +11,7 @@ #include "Directories.hpp" #include "RomSettings.hpp" #include "RomHeader.hpp" +#include "Library.hpp" // TODO: move? #include "File.hpp" #include @@ -90,7 +91,7 @@ static std::vector::iterator get_cache_entry_iter(std::filesystem: // Exported Functions // -void CoreReadRomHeaderAndSettingsCache(void) +CORE_EXPORT void CoreReadRomHeaderAndSettingsCache(void) { std::ifstream inputStream; char magicBuf[sizeof(CACHE_FILE_MAGIC)]; @@ -183,7 +184,7 @@ void CoreReadRomHeaderAndSettingsCache(void) inputStream.close(); } -bool CoreSaveRomHeaderAndSettingsCache(void) +CORE_EXPORT bool CoreSaveRomHeaderAndSettingsCache(void) { std::ofstream outputStream; wchar_t fileNameBuf[MAX_FILENAME_LEN]; @@ -282,7 +283,7 @@ bool CoreSaveRomHeaderAndSettingsCache(void) return true; } -bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType* type, CoreRomHeader* header, CoreRomSettings* defaultSettings, CoreRomSettings* settings) +CORE_EXPORT bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType* type, CoreRomHeader* header, CoreRomSettings* defaultSettings, CoreRomSettings* settings) { bool ret = false; auto iter = get_cache_entry_iter(file); @@ -355,7 +356,7 @@ bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType* return true; } -bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings defaultSettings, CoreRomSettings settings) +CORE_EXPORT bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings defaultSettings, CoreRomSettings settings) { l_CacheEntry cacheEntry; @@ -383,7 +384,7 @@ bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType t return true; } -bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings defaultSettings, CoreRomSettings settings) +CORE_EXPORT bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings defaultSettings, CoreRomSettings settings) { l_CacheEntry cachedEntry; @@ -414,7 +415,7 @@ bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomTyp return true; } -bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file) +CORE_EXPORT bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file) { CoreRomType type; CoreRomHeader header; @@ -441,7 +442,7 @@ bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file) return CoreUpdateCachedRomHeaderAndSettings(file, type, header, defaultSettings, settings); } -bool CoreClearRomHeaderAndSettingsCache(void) +CORE_EXPORT bool CoreClearRomHeaderAndSettingsCache(void) { l_CacheEntries.clear(); l_CacheEntriesChanged = true; diff --git a/Source/RMG-Core/Callback.cpp b/Source/RMG-Core/Callback.cpp index 5b044c44b..c7290c418 100644 --- a/Source/RMG-Core/Callback.cpp +++ b/Source/RMG-Core/Callback.cpp @@ -9,6 +9,7 @@ */ #define CORE_INTERNAL #include "ConvertStringEncoding.hpp" +#include "Library.hpp" // TODO: move? #include "Callback.hpp" #include @@ -82,7 +83,7 @@ void CoreStateCallback(void* context, m64p_core_param param, int value) // Exported Functions // -bool CoreSetupCallbacks(std::function debugCallbackFunc, +CORE_EXPORT bool CoreSetupCallbacks(std::function debugCallbackFunc, std::function stateCallbackFunc) { l_DebugCallbackFunc = debugCallbackFunc; @@ -99,12 +100,12 @@ bool CoreSetupCallbacks(std::function& cheats) +CORE_EXPORT bool CoreGetCurrentCheats(std::filesystem::path file, std::vector& cheats) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -639,13 +640,13 @@ bool CoreGetCurrentCheats(std::filesystem::path file, std::vector& ch return true; } -bool CoreParseCheat(const std::vector& lines, CoreCheat& cheat) +CORE_EXPORT bool CoreParseCheat(const std::vector& lines, CoreCheat& cheat) { int endIndex = 0; return parse_cheat(lines, 0, cheat, endIndex); } -bool CoreGetCheatLines(CoreCheat cheat, std::vector& codeLines, std::vector& optionLines) +CORE_EXPORT bool CoreGetCheatLines(CoreCheat cheat, std::vector& codeLines, std::vector& optionLines) { for (const CoreCheatCode& code : cheat.CheatCodes) { @@ -675,7 +676,7 @@ bool CoreGetCheatLines(CoreCheat cheat, std::vector& codeLines, std return true; } -bool CoreAddCheat(std::filesystem::path file, CoreCheat cheat) +CORE_EXPORT bool CoreAddCheat(std::filesystem::path file, CoreCheat cheat) { std::string error; CoreRomHeader romHeader; @@ -711,7 +712,7 @@ bool CoreAddCheat(std::filesystem::path file, CoreCheat cheat) return write_cheat_file(l_UserCheatFile, cheatFilePath); } -bool CoreUpdateCheat(std::filesystem::path file, CoreCheat oldCheat, CoreCheat newCheat) +CORE_EXPORT bool CoreUpdateCheat(std::filesystem::path file, CoreCheat oldCheat, CoreCheat newCheat) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -760,12 +761,12 @@ bool CoreUpdateCheat(std::filesystem::path file, CoreCheat oldCheat, CoreCheat n return write_cheat_file(l_UserCheatFile, cheatFilePath); } -bool CoreCanRemoveCheat(CoreCheat cheat) +CORE_EXPORT bool CoreCanRemoveCheat(CoreCheat cheat) { return std::find(l_UserCheatFile.Cheats.begin(), l_UserCheatFile.Cheats.end(), cheat) != l_UserCheatFile.Cheats.end(); } -bool CoreRemoveCheat(std::filesystem::path file, CoreCheat cheat) +CORE_EXPORT bool CoreRemoveCheat(std::filesystem::path file, CoreCheat cheat) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -793,7 +794,7 @@ bool CoreRemoveCheat(std::filesystem::path file, CoreCheat cheat) return write_cheat_file(l_UserCheatFile, cheatFilePath); } -bool CoreEnableCheat(std::filesystem::path file, CoreCheat cheat, bool enabled) +CORE_EXPORT bool CoreEnableCheat(std::filesystem::path file, CoreCheat cheat, bool enabled) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -817,7 +818,7 @@ bool CoreEnableCheat(std::filesystem::path file, CoreCheat cheat, bool enabled) return CoreSettingsSetValue(settingSection, settingKey, enabled); } -bool CoreIsCheatEnabled(std::filesystem::path file, CoreCheat cheat) +CORE_EXPORT bool CoreIsCheatEnabled(std::filesystem::path file, CoreCheat cheat) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -835,7 +836,7 @@ bool CoreIsCheatEnabled(std::filesystem::path file, CoreCheat cheat) return CoreSettingsGetBoolValue(settingSection, settingKey, false); } -bool CoreHasCheatOptionSet(std::filesystem::path file, CoreCheat cheat) +CORE_EXPORT bool CoreHasCheatOptionSet(std::filesystem::path file, CoreCheat cheat) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -853,7 +854,7 @@ bool CoreHasCheatOptionSet(std::filesystem::path file, CoreCheat cheat) return CoreSettingsGetIntValue(settingSection, settingKey, -1) != -1; } -bool CoreSetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOption option) +CORE_EXPORT bool CoreSetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOption option) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -871,7 +872,7 @@ bool CoreSetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOp return CoreSettingsSetValue(settingSection, settingKey, (int)option.Value); } -bool CoreGetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOption& option) +CORE_EXPORT bool CoreGetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOption& option) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -912,7 +913,7 @@ bool CoreGetCheatOption(std::filesystem::path file, CoreCheat cheat, CoreCheatOp return false; } -bool CoreResetCheatOption(std::filesystem::path file, CoreCheat cheat) +CORE_EXPORT bool CoreResetCheatOption(std::filesystem::path file, CoreCheat cheat) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -936,7 +937,7 @@ bool CoreResetCheatOption(std::filesystem::path file, CoreCheat cheat) return true; } -bool CoreApplyCheats(void) +CORE_EXPORT bool CoreApplyCheats(void) { std::string error; m64p_error ret; @@ -1028,7 +1029,7 @@ bool CoreApplyCheats(void) return true; } -bool CoreClearCheats(void) +CORE_EXPORT bool CoreClearCheats(void) { std::string error; m64p_error ret; @@ -1059,13 +1060,13 @@ bool CoreClearCheats(void) return true; } -bool CoreSetNetplayCheats(const std::vector& cheats) +CORE_EXPORT bool CoreSetNetplayCheats(const std::vector& cheats) { l_NetplayCheats = cheats; return true; } -bool CoreApplyNetplayCheats(void) +CORE_EXPORT bool CoreApplyNetplayCheats(void) { std::string error; m64p_error ret; @@ -1136,7 +1137,7 @@ bool CoreApplyNetplayCheats(void) return true; } -bool CorePressGamesharkButton(bool enabled) +CORE_EXPORT bool CorePressGamesharkButton(bool enabled) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/ConvertStringEncoding.cpp b/Source/RMG-Core/ConvertStringEncoding.cpp index 5fe2457c8..2b0564da6 100644 --- a/Source/RMG-Core/ConvertStringEncoding.cpp +++ b/Source/RMG-Core/ConvertStringEncoding.cpp @@ -9,6 +9,7 @@ */ #define CORE_INTERNAL #include "ConvertStringEncoding.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" #include @@ -19,7 +20,7 @@ // Exported Functions // -std::string CoreConvertStringEncoding(std::string str, CoreStringEncoding encoding) +CORE_EXPORT std::string CoreConvertStringEncoding(std::string str, CoreStringEncoding encoding) { std::string error; std::string encodingString; diff --git a/Source/RMG-Core/Core.cpp b/Source/RMG-Core/Core.cpp index e60824bc4..92b050167 100644 --- a/Source/RMG-Core/Core.cpp +++ b/Source/RMG-Core/Core.cpp @@ -86,7 +86,7 @@ static bool config_override_user_dirs(void) // Exported Functions // -bool CoreInit(void) +CORE_EXPORT bool CoreInit(void) { std::string error; std::filesystem::path core_file; @@ -180,7 +180,7 @@ bool CoreInit(void) return true; } -void CoreShutdown(void) +CORE_EXPORT void CoreShutdown(void) { CorePluginsShutdown(); diff --git a/Source/RMG-Core/Directories.cpp b/Source/RMG-Core/Directories.cpp index 5f0a16486..f424da2d9 100644 --- a/Source/RMG-Core/Directories.cpp +++ b/Source/RMG-Core/Directories.cpp @@ -9,6 +9,7 @@ */ #include "Directories.hpp" #include "Settings.hpp" +#include "Library.hpp" // TODO: move? #include "Config.hpp" #include "Error.hpp" @@ -130,7 +131,7 @@ static std::filesystem::path get_var_directory(std::string var, std::string appe // Exported Functions // -bool CoreCreateDirectories(void) +CORE_EXPORT bool CoreCreateDirectories(void) { std::string error; std::error_code errorCode; @@ -167,7 +168,7 @@ bool CoreCreateDirectories(void) return true; } -bool CoreGetPortableDirectoryMode(void) +CORE_EXPORT bool CoreGetPortableDirectoryMode(void) { #ifdef PORTABLE_INSTALL static std::optional portable; @@ -195,7 +196,7 @@ bool CoreGetPortableDirectoryMode(void) #endif // PORTABLE_INSTALL } -std::filesystem::path CoreGetLibraryDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetLibraryDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -221,7 +222,7 @@ std::filesystem::path CoreGetLibraryDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetCoreDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetCoreDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -248,7 +249,7 @@ std::filesystem::path CoreGetCoreDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetPluginDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetPluginDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -275,7 +276,7 @@ std::filesystem::path CoreGetPluginDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetUserConfigDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetUserConfigDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -296,7 +297,7 @@ std::filesystem::path CoreGetUserConfigDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetDefaultUserDataDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetDefaultUserDataDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -316,7 +317,7 @@ std::filesystem::path CoreGetDefaultUserDataDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetDefaultUserCacheDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetDefaultUserCacheDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -337,7 +338,7 @@ std::filesystem::path CoreGetDefaultUserCacheDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetDefaultSaveDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetDefaultSaveDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -359,7 +360,7 @@ std::filesystem::path CoreGetDefaultSaveDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetDefaultSaveStateDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetDefaultSaveStateDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -381,7 +382,7 @@ std::filesystem::path CoreGetDefaultSaveStateDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetDefaultScreenshotDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetDefaultScreenshotDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -403,7 +404,7 @@ std::filesystem::path CoreGetDefaultScreenshotDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetUserDataDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetUserDataDirectory(void) { if (!m64p::Config.IsHooked()) { @@ -413,7 +414,7 @@ std::filesystem::path CoreGetUserDataDirectory(void) return std::filesystem::path(m64p::Config.GetUserDataPath()); } -std::filesystem::path CoreGetUserCacheDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetUserCacheDirectory(void) { if (!m64p::Config.IsHooked()) { @@ -423,7 +424,7 @@ std::filesystem::path CoreGetUserCacheDirectory(void) return std::filesystem::path(m64p::Config.GetUserCachePath()); } -std::filesystem::path CoreGetSharedDataDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetSharedDataDirectory(void) { std::filesystem::path directory; #ifdef PORTABLE_INSTALL @@ -450,38 +451,38 @@ std::filesystem::path CoreGetSharedDataDirectory(void) return directory.make_preferred(); } -std::filesystem::path CoreGetSaveDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetSaveDirectory(void) { return CoreSettingsGetStringValue(SettingsID::Core_SaveSRAMPath); } -std::filesystem::path CoreGetSaveStateDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetSaveStateDirectory(void) { return CoreSettingsGetStringValue(SettingsID::Core_SaveStatePath); } -std::filesystem::path CoreGetScreenshotDirectory(void) +CORE_EXPORT std::filesystem::path CoreGetScreenshotDirectory(void) { return CoreSettingsGetStringValue(SettingsID::Core_ScreenshotPath); } #ifndef PORTABLE_INSTALL -void CoreSetLibraryPathOverride(std::filesystem::path path) +CORE_EXPORT void CoreSetLibraryPathOverride(std::filesystem::path path) { l_LibraryPathOverride = path; } -void CoreSetCorePathOverride(std::filesystem::path path) +CORE_EXPORT void CoreSetCorePathOverride(std::filesystem::path path) { l_CorePathOverride = path; } -void CoreSetPluginPathOverride(std::filesystem::path path) +CORE_EXPORT void CoreSetPluginPathOverride(std::filesystem::path path) { l_PluginPathOverride = path; } -void CoreSetSharedDataPathOverride(std::filesystem::path path) +CORE_EXPORT void CoreSetSharedDataPathOverride(std::filesystem::path path) { l_SharedDataPathOverride = path; } diff --git a/Source/RMG-Core/DiscordRpc.cpp b/Source/RMG-Core/DiscordRpc.cpp index ae25f67a5..95e3ee1a5 100644 --- a/Source/RMG-Core/DiscordRpc.cpp +++ b/Source/RMG-Core/DiscordRpc.cpp @@ -11,6 +11,7 @@ #include "DiscordRpc.hpp" #include "RomHeader.hpp" #include "Settings.hpp" +#include "Library.hpp" // TODO: move? #include <3rdParty/discord-rpc/include/discord_rpc.h> #include @@ -21,7 +22,7 @@ // Exported Functions // -void CoreDiscordRpcInit(void) +CORE_EXPORT void CoreDiscordRpcInit(void) { if (!CoreSettingsGetBoolValue(SettingsID::GUI_DiscordRpc)) { @@ -31,12 +32,12 @@ void CoreDiscordRpcInit(void) Discord_Initialize("801450412280119356", nullptr, 0, ""); } -void CoreDiscordRpcShutdown(void) +CORE_EXPORT void CoreDiscordRpcShutdown(void) { Discord_Shutdown(); } -void CoreDiscordRpcUpdate(bool inGame) +CORE_EXPORT void CoreDiscordRpcUpdate(bool inGame) { std::string smallImageKey; std::string largeImageKey; diff --git a/Source/RMG-Core/Emulation.cpp b/Source/RMG-Core/Emulation.cpp index b39ceedbd..7aebd7969 100644 --- a/Source/RMG-Core/Emulation.cpp +++ b/Source/RMG-Core/Emulation.cpp @@ -13,6 +13,7 @@ #include "Emulation.hpp" #include "RomHeader.hpp" #include "Settings.hpp" +#include "Library.hpp" // TODO: move? #include "Netplay.hpp" #include "Plugins.hpp" #include "Cheats.hpp" @@ -148,7 +149,7 @@ static void apply_pif_rom_settings(void) // Exported Functions // -bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64ddrom, +CORE_EXPORT bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64ddrom, std::string address, int port, int player) { std::string error; @@ -287,7 +288,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d return m64p_ret == M64ERR_SUCCESS; } -bool CoreStopEmulation(void) +CORE_EXPORT bool CoreStopEmulation(void) { std::string error; m64p_error ret; @@ -309,7 +310,7 @@ bool CoreStopEmulation(void) return ret == M64ERR_SUCCESS; } -bool CorePauseEmulation(void) +CORE_EXPORT bool CorePauseEmulation(void) { std::string error; m64p_error ret; @@ -343,7 +344,7 @@ bool CorePauseEmulation(void) return ret == M64ERR_SUCCESS; } -bool CoreResumeEmulation(void) +CORE_EXPORT bool CoreResumeEmulation(void) { std::string error; m64p_error ret; @@ -377,7 +378,7 @@ bool CoreResumeEmulation(void) return ret == M64ERR_SUCCESS; } -bool CoreResetEmulation(bool hard) +CORE_EXPORT bool CoreResetEmulation(bool hard) { std::string error; m64p_error ret; @@ -414,13 +415,13 @@ bool CoreResetEmulation(bool hard) return ret == M64ERR_SUCCESS; } -bool CoreIsEmulationRunning(void) +CORE_EXPORT bool CoreIsEmulationRunning(void) { m64p_emu_state state = M64EMU_STOPPED; return get_emulation_state(&state) && state == M64EMU_RUNNING; } -bool CoreIsEmulationPaused(void) +CORE_EXPORT bool CoreIsEmulationPaused(void) { m64p_emu_state state = M64EMU_STOPPED; return get_emulation_state(&state) && state == M64EMU_PAUSED; diff --git a/Source/RMG-Core/Error.cpp b/Source/RMG-Core/Error.cpp index 5164a39f6..0ea5c2a46 100644 --- a/Source/RMG-Core/Error.cpp +++ b/Source/RMG-Core/Error.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "Error.hpp" +#include "Library.hpp" // TODO: move? // // Local Variables @@ -19,12 +20,12 @@ static std::string l_ErrorMessage; // Exported Functions // -void CoreSetError(std::string error) +CORE_EXPORT void CoreSetError(std::string error) { l_ErrorMessage = error; } -std::string CoreGetError(void) +CORE_EXPORT std::string CoreGetError(void) { return l_ErrorMessage; } diff --git a/Source/RMG-Core/File.cpp b/Source/RMG-Core/File.cpp index 780d25487..96fd278a0 100644 --- a/Source/RMG-Core/File.cpp +++ b/Source/RMG-Core/File.cpp @@ -9,6 +9,7 @@ */ #define CORE_INTERNAL #include "Error.hpp" +#include "Library.hpp" // TODO: move? #include "File.hpp" #include @@ -25,7 +26,7 @@ // Exported Functions // -bool CoreReadFile(std::filesystem::path file, std::vector& outBuffer) +CORE_EXPORT bool CoreReadFile(std::filesystem::path file, std::vector& outBuffer) { std::string error; std::ifstream fileStream; @@ -60,7 +61,7 @@ bool CoreReadFile(std::filesystem::path file, std::vector& outBuffer) return true; } -bool CoreWriteFile(std::filesystem::path file, std::vector& buffer) +CORE_EXPORT bool CoreWriteFile(std::filesystem::path file, std::vector& buffer) { std::string error; std::ofstream fileStream; @@ -85,7 +86,7 @@ bool CoreWriteFile(std::filesystem::path file, std::vector& buffer) return true; } -CoreFileTime CoreGetFileTime(std::filesystem::path file) +CORE_EXPORT CoreFileTime CoreGetFileTime(std::filesystem::path file) { #ifdef _WIN32 BOOL ret; diff --git a/Source/RMG-Core/Key.cpp b/Source/RMG-Core/Key.cpp index 5b238a411..5611546f4 100644 --- a/Source/RMG-Core/Key.cpp +++ b/Source/RMG-Core/Key.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "Error.hpp" +#include "Library.hpp" // TODO: move? #include "Key.hpp" #include "m64p/Api.hpp" @@ -18,7 +19,7 @@ // Exported Functions // -bool CoreSetKeyUp(int key, int mod) +CORE_EXPORT bool CoreSetKeyUp(int key, int mod) { std::string error; m64p_error ret; @@ -39,7 +40,7 @@ bool CoreSetKeyUp(int key, int mod) return ret == M64ERR_SUCCESS; } -bool CoreSetKeyDown(int key, int mod) +CORE_EXPORT bool CoreSetKeyDown(int key, int mod) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/Library.cpp b/Source/RMG-Core/Library.cpp index da6c6aa23..c011f37ec 100644 --- a/Source/RMG-Core/Library.cpp +++ b/Source/RMG-Core/Library.cpp @@ -17,7 +17,7 @@ // Exported Functions // -CoreLibraryHandle CoreOpenLibrary(std::filesystem::path path) +CORE_EXPORT CoreLibraryHandle CoreOpenLibrary(std::filesystem::path path) { #ifdef _WIN32 return LoadLibraryW(path.wstring().c_str()); @@ -26,7 +26,7 @@ CoreLibraryHandle CoreOpenLibrary(std::filesystem::path path) #endif } -CoreLibrarySymbol CoreGetLibrarySymbol(CoreLibraryHandle handle, const char* symbol) +CORE_EXPORT CoreLibrarySymbol CoreGetLibrarySymbol(CoreLibraryHandle handle, const char* symbol) { #ifdef _WIN32 return GetProcAddress(handle, symbol); @@ -35,7 +35,7 @@ CoreLibrarySymbol CoreGetLibrarySymbol(CoreLibraryHandle handle, const char* sym #endif // Linux } -void CoreCloseLibrary(CoreLibraryHandle handle) +CORE_EXPORT void CoreCloseLibrary(CoreLibraryHandle handle) { #ifdef _WIN32 FreeLibrary(handle); @@ -44,7 +44,7 @@ void CoreCloseLibrary(CoreLibraryHandle handle) #endif // Linux } -std::string CoreGetLibraryError(void) +CORE_EXPORT std::string CoreGetLibraryError(void) { #ifdef _WIN32 DWORD err = GetLastError(); diff --git a/Source/RMG-Core/Library.hpp b/Source/RMG-Core/Library.hpp index 46adae20b..c9f8a8dd9 100644 --- a/Source/RMG-Core/Library.hpp +++ b/Source/RMG-Core/Library.hpp @@ -18,10 +18,12 @@ typedef HMODULE CoreLibraryHandle; typedef FARPROC CoreLibrarySymbol; #define CORE_LIBRARY_EXT_STR ".dll" +#define CORE_EXPORT __declspec(dllexport) #else // Unix typedef void* CoreLibraryHandle; typedef void* CoreLibrarySymbol; #define CORE_LIBRARY_EXT_STR ".so" +#define CORE_EXPORT __attribute__((visibility("default"))) #endif // _WIN32 // returns library handle for given filename, diff --git a/Source/RMG-Core/MediaLoader.cpp b/Source/RMG-Core/MediaLoader.cpp index dce8535c7..c1ea6c50d 100644 --- a/Source/RMG-Core/MediaLoader.cpp +++ b/Source/RMG-Core/MediaLoader.cpp @@ -11,6 +11,7 @@ #include "MediaLoader.hpp" #include "Settings.hpp" #include "Archive.hpp" +#include "Library.hpp" // TODO: move? #include "String.hpp" #include "Error.hpp" #include "File.hpp" @@ -115,7 +116,7 @@ static char* mediaLoader_get_gb_cart_rom(void*, int index) // Exported Functions // -bool CoreSetupMediaLoader(void) +CORE_EXPORT bool CoreSetupMediaLoader(void) { std::string error; m64p_error ret; @@ -144,7 +145,7 @@ bool CoreSetupMediaLoader(void) return ret == M64ERR_SUCCESS; } -void CoreResetMediaLoader(void) +CORE_EXPORT void CoreResetMediaLoader(void) { std::error_code errorCode; @@ -159,7 +160,7 @@ void CoreResetMediaLoader(void) l_DdDiskFile = ""; } -void CoreMediaLoaderSetDiskFile(std::filesystem::path disk) +CORE_EXPORT void CoreMediaLoaderSetDiskFile(std::filesystem::path disk) { std::error_code error_code; std::vector buf; diff --git a/Source/RMG-Core/Netplay.cpp b/Source/RMG-Core/Netplay.cpp index e25a9450c..221936a34 100644 --- a/Source/RMG-Core/Netplay.cpp +++ b/Source/RMG-Core/Netplay.cpp @@ -12,6 +12,7 @@ #include #endif // _WIN32 #include "Netplay.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" #include "m64p/Api.hpp" @@ -27,7 +28,7 @@ static bool l_HasInitNetplay = false; // Exported Functions // -bool CoreInitNetplay(std::string address, int port, int player) +CORE_EXPORT bool CoreInitNetplay(std::string address, int port, int player) { #ifdef NETPLAY std::string error; @@ -82,7 +83,7 @@ bool CoreInitNetplay(std::string address, int port, int player) #endif // NETPLAY } -bool CoreHasInitNetplay(void) +CORE_EXPORT bool CoreHasInitNetplay(void) { #ifdef NETPLAY return l_HasInitNetplay; @@ -91,7 +92,7 @@ bool CoreHasInitNetplay(void) #endif // NETPLAY } -bool CoreShutdownNetplay(void) +CORE_EXPORT bool CoreShutdownNetplay(void) { #ifdef NETPLAY std::string error; diff --git a/Source/RMG-Core/Plugins.cpp b/Source/RMG-Core/Plugins.cpp index 1f7d649cb..d656c3b54 100644 --- a/Source/RMG-Core/Plugins.cpp +++ b/Source/RMG-Core/Plugins.cpp @@ -403,7 +403,7 @@ static bool open_plugin_config(CorePluginType type, void* parent, bool romConfig // Exported Functions // -std::vector CoreGetAllPlugins(void) +CORE_EXPORT std::vector CoreGetAllPlugins(void) { std::vector plugins; std::string plugin_name; @@ -448,7 +448,7 @@ std::vector CoreGetAllPlugins(void) return plugins; } -bool CoreApplyPluginSettings(void) +CORE_EXPORT bool CoreApplyPluginSettings(void) { const std::array settings = { @@ -461,7 +461,7 @@ bool CoreApplyPluginSettings(void) return apply_plugin_settings(settings); } -bool CoreApplyRomPluginSettings(void) +CORE_EXPORT bool CoreApplyRomPluginSettings(void) { CoreRomSettings romSettings; @@ -481,7 +481,7 @@ bool CoreApplyRomPluginSettings(void) return apply_plugin_settings(settings); } -bool CoreArePluginsReady(void) +CORE_EXPORT bool CoreArePluginsReady(void) { std::string error; @@ -501,7 +501,7 @@ bool CoreArePluginsReady(void) return true; } -bool CorePluginsHasConfig(CorePluginType type) +CORE_EXPORT bool CorePluginsHasConfig(CorePluginType type) { std::string error; m64p::PluginApi* plugin; @@ -520,12 +520,12 @@ bool CorePluginsHasConfig(CorePluginType type) plugin->Config2 != nullptr; } -bool CorePluginsOpenConfig(CorePluginType type, void* parent) +CORE_EXPORT bool CorePluginsOpenConfig(CorePluginType type, void* parent) { return open_plugin_config(type, parent, false, ""); } -bool CorePluginsHasROMConfig(CorePluginType type) +CORE_EXPORT bool CorePluginsHasROMConfig(CorePluginType type) { m64p::PluginApi* plugin; @@ -536,12 +536,12 @@ bool CorePluginsHasROMConfig(CorePluginType type) plugin->Config2HasRomConfig() > 0; } -bool CorePluginsOpenROMConfig(CorePluginType type, void* parent, std::filesystem::path file) +CORE_EXPORT bool CorePluginsOpenROMConfig(CorePluginType type, void* parent, std::filesystem::path file) { return open_plugin_config(type, parent, true, file); } -bool CoreAttachPlugins(void) +CORE_EXPORT bool CoreAttachPlugins(void) { std::string error; m64p_error ret; @@ -575,7 +575,7 @@ bool CoreAttachPlugins(void) return ret == M64ERR_SUCCESS; } -bool CoreDetachPlugins(void) +CORE_EXPORT bool CoreDetachPlugins(void) { std::string error; m64p_error ret; @@ -602,7 +602,7 @@ bool CoreDetachPlugins(void) return ret == M64ERR_SUCCESS; } -bool CorePluginsShutdown(void) +CORE_EXPORT bool CorePluginsShutdown(void) { std::string error; m64p::PluginApi* plugin; diff --git a/Source/RMG-Core/Rom.cpp b/Source/RMG-Core/Rom.cpp index ba24202f8..f1cc94972 100644 --- a/Source/RMG-Core/Rom.cpp +++ b/Source/RMG-Core/Rom.cpp @@ -14,6 +14,7 @@ #include "RomSettings.hpp" #include "m64p/Api.hpp" #include "Archive.hpp" +#include "Library.hpp" // TODO: move? #include "Cheats.hpp" #include "String.hpp" #include "Error.hpp" @@ -38,7 +39,7 @@ static std::filesystem::path l_RomPath; // Exported Functions // -bool CoreOpenRom(std::filesystem::path file) +CORE_EXPORT bool CoreOpenRom(std::filesystem::path file) { std::string error; std::error_code error_code; @@ -159,12 +160,12 @@ bool CoreOpenRom(std::filesystem::path file) return l_HasRomOpen; } -bool CoreHasRomOpen(void) +CORE_EXPORT bool CoreHasRomOpen(void) { return l_HasRomOpen; } -bool CoreGetRomType(CoreRomType& type) +CORE_EXPORT bool CoreGetRomType(CoreRomType& type) { std::string error; @@ -180,7 +181,7 @@ bool CoreGetRomType(CoreRomType& type) return true; } -bool CoreGetRomPath(std::filesystem::path& path) +CORE_EXPORT bool CoreGetRomPath(std::filesystem::path& path) { std::string error; @@ -196,7 +197,7 @@ bool CoreGetRomPath(std::filesystem::path& path) return true; } -bool CoreCloseRom(void) +CORE_EXPORT bool CoreCloseRom(void) { std::string error; std::error_code errorCode; diff --git a/Source/RMG-Core/RomHeader.cpp b/Source/RMG-Core/RomHeader.cpp index 8aed7db4c..d83862abc 100644 --- a/Source/RMG-Core/RomHeader.cpp +++ b/Source/RMG-Core/RomHeader.cpp @@ -17,6 +17,7 @@ #include "ConvertStringEncoding.hpp" #include "RomHeader.hpp" #include "m64p/Api.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" // @@ -147,7 +148,7 @@ static CoreSystemType get_systemtype_from_countrycode(uint8_t countryCode) // Exported Functions // -bool CoreGetCurrentRomHeader(CoreRomHeader& header) +CORE_EXPORT bool CoreGetCurrentRomHeader(CoreRomHeader& header) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/RomSettings.cpp b/Source/RMG-Core/RomSettings.cpp index b1783227b..96afce178 100644 --- a/Source/RMG-Core/RomSettings.cpp +++ b/Source/RMG-Core/RomSettings.cpp @@ -11,6 +11,7 @@ #include "ConvertStringEncoding.hpp" #include "RomSettings.hpp" #include "Settings.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" #include "Rom.hpp" @@ -27,7 +28,7 @@ static bool l_HasDefaultRomSettings = false; // Exported Functions // -bool CoreGetCurrentRomSettings(CoreRomSettings& settings) +CORE_EXPORT bool CoreGetCurrentRomSettings(CoreRomSettings& settings) { std::string error; m64p_error ret; @@ -57,7 +58,7 @@ bool CoreGetCurrentRomSettings(CoreRomSettings& settings) return true; } -bool CoreStoreCurrentDefaultRomSettings(void) +CORE_EXPORT bool CoreStoreCurrentDefaultRomSettings(void) { CoreRomSettings settings; @@ -71,13 +72,13 @@ bool CoreStoreCurrentDefaultRomSettings(void) return true; } -bool CoreClearCurrentDefaultRomSettings(void) +CORE_EXPORT bool CoreClearCurrentDefaultRomSettings(void) { l_HasDefaultRomSettings = false; return true; } -bool CoreGetCurrentDefaultRomSettings(CoreRomSettings& settings) +CORE_EXPORT bool CoreGetCurrentDefaultRomSettings(CoreRomSettings& settings) { std::string error; @@ -93,7 +94,7 @@ bool CoreGetCurrentDefaultRomSettings(CoreRomSettings& settings) return true; } -bool CoreApplyRomSettings(CoreRomSettings settings) +CORE_EXPORT bool CoreApplyRomSettings(CoreRomSettings settings) { std::string error; m64p_error ret; @@ -143,7 +144,7 @@ bool CoreApplyRomSettings(CoreRomSettings settings) return ret == M64ERR_SUCCESS; } -bool CoreApplyRomSettingsOverlay(void) +CORE_EXPORT bool CoreApplyRomSettingsOverlay(void) { CoreRomSettings settings; diff --git a/Source/RMG-Core/SaveState.cpp b/Source/RMG-Core/SaveState.cpp index 8f1edb2ee..9a0e37988 100644 --- a/Source/RMG-Core/SaveState.cpp +++ b/Source/RMG-Core/SaveState.cpp @@ -10,6 +10,7 @@ #include "Directories.hpp" #include "RomSettings.hpp" #include "RomHeader.hpp" +#include "Library.hpp" // TODO: move? #include "SaveState.hpp" #include "Settings.hpp" #include "Error.hpp" @@ -39,7 +40,7 @@ static void str_replace_chars(std::string& str, const std::string replace, const // Exported Functions // -bool CoreSetSaveStateSlot(int slot) +CORE_EXPORT bool CoreSetSaveStateSlot(int slot) { std::string error; m64p_error ret; @@ -60,7 +61,7 @@ bool CoreSetSaveStateSlot(int slot) return ret == M64ERR_SUCCESS; } -int CoreGetSaveStateSlot(void) +CORE_EXPORT int CoreGetSaveStateSlot(void) { std::string error; m64p_error ret; @@ -82,7 +83,7 @@ int CoreGetSaveStateSlot(void) return slot; } -bool CoreIncreaseSaveStateSlot(void) +CORE_EXPORT bool CoreIncreaseSaveStateSlot(void) { std::string error; int slot; @@ -103,7 +104,7 @@ bool CoreIncreaseSaveStateSlot(void) return CoreSetSaveStateSlot(slot + 1); } -bool CoreDecreaseSaveStateSlot(void) +CORE_EXPORT bool CoreDecreaseSaveStateSlot(void) { std::string error; int slot; @@ -124,7 +125,7 @@ bool CoreDecreaseSaveStateSlot(void) return CoreSetSaveStateSlot(slot - 1); } -bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path) +CORE_EXPORT bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path) { // TODO: this should probably be an API function // in mupen64plus-core instead @@ -199,7 +200,7 @@ bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int sl return true; } -bool CoreGetSaveStatePath(int slot, std::filesystem::path& path) +CORE_EXPORT bool CoreGetSaveStatePath(int slot, std::filesystem::path& path) { CoreRomHeader romHeader; CoreRomSettings romSettings; @@ -215,7 +216,7 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path) return CoreGetSaveStatePath(romHeader, romSettings, slot, path); } -bool CoreSaveState(void) +CORE_EXPORT bool CoreSaveState(void) { std::string error; m64p_error ret; @@ -236,7 +237,7 @@ bool CoreSaveState(void) return ret == M64ERR_SUCCESS; } -bool CoreSaveState(std::filesystem::path file, CoreSaveStateType type) +CORE_EXPORT bool CoreSaveState(std::filesystem::path file, CoreSaveStateType type) { std::string error; m64p_error ret; @@ -257,7 +258,7 @@ bool CoreSaveState(std::filesystem::path file, CoreSaveStateType type) return ret == M64ERR_SUCCESS; } -bool CoreLoadSaveState(void) +CORE_EXPORT bool CoreLoadSaveState(void) { std::string error; m64p_error ret; @@ -278,7 +279,7 @@ bool CoreLoadSaveState(void) return ret == M64ERR_SUCCESS; } -bool CoreLoadSaveState(std::filesystem::path file) +CORE_EXPORT bool CoreLoadSaveState(std::filesystem::path file) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/Screenshot.cpp b/Source/RMG-Core/Screenshot.cpp index b9e81cc8b..f341c229e 100644 --- a/Source/RMG-Core/Screenshot.cpp +++ b/Source/RMG-Core/Screenshot.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "Screenshot.hpp" +#include "Library.hpp" // TODO: move? #include "m64p/Api.hpp" #include "Error.hpp" @@ -17,7 +18,7 @@ // Exported Functions // -bool CoreTakeScreenshot(void) +CORE_EXPORT bool CoreTakeScreenshot(void) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/Settings.cpp b/Source/RMG-Core/Settings.cpp index 39fdbd78a..5e87396e3 100644 --- a/Source/RMG-Core/Settings.cpp +++ b/Source/RMG-Core/Settings.cpp @@ -11,6 +11,7 @@ #include "Directories.hpp" #include "String.hpp" +#include "Library.hpp" // TODO: move? #include "Version.hpp" #include "Error.hpp" @@ -1646,7 +1647,7 @@ static bool string_to_string_list(std::string string, std::vector& // Exported Functions // -bool CoreSettingsSave(void) +CORE_EXPORT bool CoreSettingsSave(void) { std::string error; m64p_error ret; @@ -1667,7 +1668,7 @@ bool CoreSettingsSave(void) return ret == M64ERR_SUCCESS; } -bool CoreSettingsUpgrade(void) +CORE_EXPORT bool CoreSettingsUpgrade(void) { std::string settingsVersion; std::string settingsString; @@ -1720,7 +1721,7 @@ bool CoreSettingsUpgrade(void) return true; } -bool CoreSettingsSetupDefaults(void) +CORE_EXPORT bool CoreSettingsSetupDefaults(void) { l_Setting setting; bool ret = false; @@ -1785,12 +1786,12 @@ bool CoreSettingsSetupDefaults(void) return true; } -bool CoreSettingsSectionExists(std::string section) +CORE_EXPORT bool CoreSettingsSectionExists(std::string section) { return config_section_exists(section); } -bool CoreSettingsRevertSection(std::string section) +CORE_EXPORT bool CoreSettingsRevertSection(std::string section) { std::string error; m64p_error ret; @@ -1811,7 +1812,7 @@ bool CoreSettingsRevertSection(std::string section) return ret == M64ERR_SUCCESS; } -bool CoreSettingsDeleteSection(std::string section) +CORE_EXPORT bool CoreSettingsDeleteSection(std::string section) { std::string error; m64p_error ret; @@ -1839,37 +1840,37 @@ bool CoreSettingsDeleteSection(std::string section) return ret == M64ERR_SUCCESS; } -bool CoreSettingsKeyExists(std::string section, std::string key) +CORE_EXPORT bool CoreSettingsKeyExists(std::string section, std::string key) { return config_key_exists(section, key); } -bool CoreSettingsSetValue(SettingsID settingId, int value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, int value) { l_Setting setting = get_setting(settingId); return config_option_set(setting.Section, setting.Key, M64TYPE_INT, &value); } -bool CoreSettingsSetValue(SettingsID settingId, bool value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, bool value) { l_Setting setting = get_setting(settingId); int intValue = value ? 1 : 0; return config_option_set(setting.Section, setting.Key, M64TYPE_BOOL, &intValue); } -bool CoreSettingsSetValue(SettingsID settingId, float value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, float value) { l_Setting setting = get_setting(settingId); return config_option_set(setting.Section, setting.Key, M64TYPE_FLOAT, &value); } -bool CoreSettingsSetValue(SettingsID settingId, std::string value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string value) { l_Setting setting = get_setting(settingId); return config_option_set(setting.Section, setting.Key, M64TYPE_STRING, (void*)value.c_str()); } -bool CoreSettingsSetValue(SettingsID settingId, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::vector value) { std::string value_str; if (!int_list_to_string(value, value_str)) @@ -1879,7 +1880,7 @@ bool CoreSettingsSetValue(SettingsID settingId, std::vector value) return CoreSettingsSetValue(settingId, value_str); } -bool CoreSettingsSetValue(SettingsID settingId, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::vector value) { std::string value_str; if (!string_list_to_string(value, value_str)) @@ -1889,32 +1890,32 @@ bool CoreSettingsSetValue(SettingsID settingId, std::vector value) return CoreSettingsSetValue(settingId, value_str); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, int value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, int value) { l_Setting setting = get_setting(settingId); return config_option_set(section, setting.Key, M64TYPE_INT, &value); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, bool value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, bool value) { l_Setting setting = get_setting(settingId); int intValue = value ? 1 : 0; return config_option_set(section, setting.Key, M64TYPE_BOOL, &intValue); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, float value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, float value) { l_Setting setting = get_setting(settingId); return config_option_set(section, setting.Key, M64TYPE_FLOAT, &value); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::string value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::string value) { l_Setting setting = get_setting(settingId); return config_option_set(section, setting.Key, M64TYPE_STRING, (void*)value.c_str()); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector value) { std::string value_str; if (!int_list_to_string(value, value_str)) @@ -1924,7 +1925,7 @@ bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector return CoreSettingsSetValue(settingId, section, value_str); } -bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector value) { std::string value_str; if (!string_list_to_string(value, value_str)) @@ -1934,28 +1935,28 @@ bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector return CoreSettingsSetValue(settingId, section, value_str); } -bool CoreSettingsSetValue(std::string section, std::string key, int value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, int value) { return config_option_set(section, key, M64TYPE_INT, &value); } -bool CoreSettingsSetValue(std::string section, std::string key, bool value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, bool value) { int intValue = value ? 1 : 0; return config_option_set(section, key, M64TYPE_BOOL, &intValue); } -bool CoreSettingsSetValue(std::string section, std::string key, float value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, float value) { return config_option_set(section, key, M64TYPE_FLOAT, &value); } -bool CoreSettingsSetValue(std::string section, std::string key, std::string value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, std::string value) { return config_option_set(section, key, M64TYPE_STRING, (void*)value.c_str()); } -bool CoreSettingsSetValue(std::string section, std::string key, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, std::vector value) { std::string value_str; if (!int_list_to_string(value, value_str)) @@ -1965,7 +1966,7 @@ bool CoreSettingsSetValue(std::string section, std::string key, std::vector return CoreSettingsSetValue(section, key, value_str); } -bool CoreSettingsSetValue(std::string section, std::string key, std::vector value) +CORE_EXPORT bool CoreSettingsSetValue(std::string section, std::string key, std::vector value) { std::string value_str; if (!string_list_to_string(value, value_str)) @@ -1975,31 +1976,31 @@ bool CoreSettingsSetValue(std::string section, std::string key, std::vector(setting.DefaultValue); } -bool CoreSettingsGetDefaultBoolValue(SettingsID settingId) +CORE_EXPORT bool CoreSettingsGetDefaultBoolValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); return std::get(setting.DefaultValue); } -float CoreSettingsGetDefaultFloatValue(SettingsID settingId) +CORE_EXPORT float CoreSettingsGetDefaultFloatValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); return std::get(setting.DefaultValue); } -std::string CoreSettingsGetDefaultStringValue(SettingsID settingId) +CORE_EXPORT std::string CoreSettingsGetDefaultStringValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); return std::get(setting.DefaultValue); } -std::vector CoreSettingsGetDefaultIntListValue(SettingsID settingId) +CORE_EXPORT std::vector CoreSettingsGetDefaultIntListValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); std::string string = std::get(setting.DefaultValue); @@ -2011,7 +2012,7 @@ std::vector CoreSettingsGetDefaultIntListValue(SettingsID settingId) return intList; } -int CoreSettingsGetIntValue(SettingsID settingId) +CORE_EXPORT int CoreSettingsGetIntValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); int value = setting.DefaultValue.index() == 0 ? 0 : std::get(setting.DefaultValue); @@ -2019,7 +2020,7 @@ int CoreSettingsGetIntValue(SettingsID settingId) return value; } -bool CoreSettingsGetBoolValue(SettingsID settingId) +CORE_EXPORT bool CoreSettingsGetBoolValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); int value = setting.DefaultValue.index() == 0 ? 0 : (std::get(setting.DefaultValue) ? 1 : 0); @@ -2027,7 +2028,7 @@ bool CoreSettingsGetBoolValue(SettingsID settingId) return value > 0; } -float CoreSettingsGetFloatValue(SettingsID settingId) +CORE_EXPORT float CoreSettingsGetFloatValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); float value = setting.DefaultValue.index() == 0 ? 0.0f : std::get(setting.DefaultValue); @@ -2035,7 +2036,7 @@ float CoreSettingsGetFloatValue(SettingsID settingId) return value; } -std::string CoreSettingsGetStringValue(SettingsID settingId) +CORE_EXPORT std::string CoreSettingsGetStringValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); char value[STR_SIZE] = {0}; @@ -2043,19 +2044,19 @@ std::string CoreSettingsGetStringValue(SettingsID settingId) return std::string(value); } -std::vector CoreSettingsGetIntListValue(SettingsID settingId) +CORE_EXPORT std::vector CoreSettingsGetIntListValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); return CoreSettingsGetIntListValue(settingId, setting.Section); } -std::vector CoreSettingsGetStringListValue(SettingsID settingId) +CORE_EXPORT std::vector CoreSettingsGetStringListValue(SettingsID settingId) { l_Setting setting = get_setting(settingId); return CoreSettingsGetStringListValue(settingId, setting.Section); } -int CoreSettingsGetIntValue(SettingsID settingId, std::string section) +CORE_EXPORT int CoreSettingsGetIntValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); int value = setting.DefaultValue.index() == 0 ? 0 : std::get(setting.DefaultValue); @@ -2063,7 +2064,7 @@ int CoreSettingsGetIntValue(SettingsID settingId, std::string section) return value; } -bool CoreSettingsGetBoolValue(SettingsID settingId, std::string section) +CORE_EXPORT bool CoreSettingsGetBoolValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); int value = setting.DefaultValue.index() == 0 ? 0 : (std::get(setting.DefaultValue) ? 1 : 0); @@ -2071,7 +2072,7 @@ bool CoreSettingsGetBoolValue(SettingsID settingId, std::string section) return value; } -float CoreSettingsGetFloatValue(SettingsID settingId, std::string section) +CORE_EXPORT float CoreSettingsGetFloatValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); float value = setting.DefaultValue.index() == 0 ? 0.0f : std::get(setting.DefaultValue); @@ -2079,7 +2080,7 @@ float CoreSettingsGetFloatValue(SettingsID settingId, std::string section) return value; } -std::string CoreSettingsGetStringValue(SettingsID settingId, std::string section) +CORE_EXPORT std::string CoreSettingsGetStringValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); char value[STR_SIZE] = {0}; @@ -2087,7 +2088,7 @@ std::string CoreSettingsGetStringValue(SettingsID settingId, std::string section return std::string(value); } -std::vector CoreSettingsGetIntListValue(SettingsID settingId, std::string section) +CORE_EXPORT std::vector CoreSettingsGetIntListValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); std::vector value; @@ -2103,7 +2104,7 @@ std::vector CoreSettingsGetIntListValue(SettingsID settingId, std::string s return value; } -std::vector CoreSettingsGetStringListValue(SettingsID settingId, std::string section) +CORE_EXPORT std::vector CoreSettingsGetStringListValue(SettingsID settingId, std::string section) { l_Setting setting = get_setting(settingId); std::vector value; @@ -2120,35 +2121,35 @@ std::vector CoreSettingsGetStringListValue(SettingsID settingId, st } -int CoreSettingsGetIntValue(std::string section, std::string key, int defaultValue) +CORE_EXPORT int CoreSettingsGetIntValue(std::string section, std::string key, int defaultValue) { int value = defaultValue; config_option_get(section, key, M64TYPE_INT, &value, sizeof(value)); return value; } -bool CoreSettingsGetBoolValue(std::string section, std::string key, bool defaultValue) +CORE_EXPORT bool CoreSettingsGetBoolValue(std::string section, std::string key, bool defaultValue) { int value = defaultValue; config_option_get(section, key, M64TYPE_BOOL, &value, sizeof(value)); return value; } -float CoreSettingsGetFloatValue(std::string section, std::string key, float defaultValue) +CORE_EXPORT float CoreSettingsGetFloatValue(std::string section, std::string key, float defaultValue) { float value = defaultValue; config_option_get(section, key, M64TYPE_FLOAT, &value, sizeof(value)); return value; } -std::string CoreSettingsGetStringValue(std::string section, std::string key) +CORE_EXPORT std::string CoreSettingsGetStringValue(std::string section, std::string key) { char value[STR_SIZE] = {0}; config_option_get(section, key, M64TYPE_STRING, (char*)value, sizeof(value)); return std::string(value); } -std::vector CoreSettingsGetIntListValue(std::string section, std::string key) +CORE_EXPORT std::vector CoreSettingsGetIntListValue(std::string section, std::string key) { std::vector value; @@ -2163,7 +2164,7 @@ std::vector CoreSettingsGetIntListValue(std::string section, std::string ke return value; } -std::vector CoreSettingsGetStringListValue(std::string section, std::string key) +CORE_EXPORT std::vector CoreSettingsGetStringListValue(std::string section, std::string key) { std::vector value; diff --git a/Source/RMG-Core/SpeedFactor.cpp b/Source/RMG-Core/SpeedFactor.cpp index c7b13b46f..2d1e21611 100644 --- a/Source/RMG-Core/SpeedFactor.cpp +++ b/Source/RMG-Core/SpeedFactor.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "SpeedFactor.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" #include "m64p/Api.hpp" @@ -18,7 +19,7 @@ // Exported Functions // -int CoreGetSpeedFactor(void) +CORE_EXPORT int CoreGetSpeedFactor(void) { std::string error; m64p_error ret; @@ -40,7 +41,7 @@ int CoreGetSpeedFactor(void) return value; } -bool CoreSetSpeedFactor(int factor) +CORE_EXPORT bool CoreSetSpeedFactor(int factor) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/SpeedLimiter.cpp b/Source/RMG-Core/SpeedLimiter.cpp index 85a5de5a4..2f9a7c1cb 100644 --- a/Source/RMG-Core/SpeedLimiter.cpp +++ b/Source/RMG-Core/SpeedLimiter.cpp @@ -8,6 +8,7 @@ * along with this program. If not, see . */ #include "SpeedLimiter.hpp" +#include "Library.hpp" // TODO: move? #include "Error.hpp" #include "m64p/Api.hpp" @@ -18,7 +19,7 @@ // Exported Functions // -bool CoreIsSpeedLimiterEnabled(void) +CORE_EXPORT bool CoreIsSpeedLimiterEnabled(void) { std::string error; m64p_error ret; @@ -40,7 +41,7 @@ bool CoreIsSpeedLimiterEnabled(void) return value; } -bool CoreSetSpeedLimiterState(bool enabled) +CORE_EXPORT bool CoreSetSpeedLimiterState(bool enabled) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/String.cpp b/Source/RMG-Core/String.cpp index 0a18e4261..fa032c5a5 100644 --- a/Source/RMG-Core/String.cpp +++ b/Source/RMG-Core/String.cpp @@ -7,6 +7,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "Library.hpp" // TODO: move? #include "String.hpp" #include @@ -15,7 +16,7 @@ // Exported Function // -std::string CoreLowerString(std::string str) +CORE_EXPORT std::string CoreLowerString(std::string str) { std::string resultString = str; @@ -29,7 +30,7 @@ std::string CoreLowerString(std::string str) return resultString; } -bool CoreStringToInt(std::string str, int& num) +CORE_EXPORT bool CoreStringToInt(std::string str, int& num) { char* endptr; num = (int)std::strtol(str.c_str(), &endptr, 10); diff --git a/Source/RMG-Core/Version.cpp b/Source/RMG-Core/Version.cpp index 3abc5613b..decc6ba85 100644 --- a/Source/RMG-Core/Version.cpp +++ b/Source/RMG-Core/Version.cpp @@ -7,6 +7,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "Library.hpp" // TODO: move? #include "Version.hpp" #include "Config.hpp" @@ -14,7 +15,7 @@ // Exported Functions // -std::string CoreGetVersion(void) +CORE_EXPORT std::string CoreGetVersion(void) { return std::string(CORE_VERSION); } diff --git a/Source/RMG-Core/VidExt.cpp b/Source/RMG-Core/VidExt.cpp index 6c29763a8..0e2740fbf 100644 --- a/Source/RMG-Core/VidExt.cpp +++ b/Source/RMG-Core/VidExt.cpp @@ -7,6 +7,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "Library.hpp" // TODO: move? #include "VidExt.hpp" #include "Error.hpp" @@ -18,7 +19,7 @@ // Exported Functions // -bool CoreSetupVidExt(m64p_video_extension_functions functions) +CORE_EXPORT bool CoreSetupVidExt(m64p_video_extension_functions functions) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/Video.cpp b/Source/RMG-Core/Video.cpp index 86cfca6ca..44b01b020 100644 --- a/Source/RMG-Core/Video.cpp +++ b/Source/RMG-Core/Video.cpp @@ -7,6 +7,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "Library.hpp" // TODO: move? #include "Video.hpp" #include "Error.hpp" @@ -25,7 +26,7 @@ static std::mutex l_VideoMutex; // Exported Functions // -bool CoreGetVideoSize(int& width, int& height) +CORE_EXPORT bool CoreGetVideoSize(int& width, int& height) { const std::lock_guard guard(l_VideoMutex); std::string error; @@ -51,7 +52,7 @@ bool CoreGetVideoSize(int& width, int& height) return true; } -bool CoreSetVideoSize(int width, int height) +CORE_EXPORT bool CoreSetVideoSize(int width, int height) { const std::lock_guard guard(l_VideoMutex); std::string error; @@ -76,7 +77,7 @@ bool CoreSetVideoSize(int width, int height) return ret == M64ERR_SUCCESS; } -bool CoreToggleFullscreen(void) +CORE_EXPORT bool CoreToggleFullscreen(void) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/Volume.cpp b/Source/RMG-Core/Volume.cpp index 53b0febab..129eedf5b 100644 --- a/Source/RMG-Core/Volume.cpp +++ b/Source/RMG-Core/Volume.cpp @@ -7,6 +7,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "Library.hpp" // TODO: move? #include "Volume.hpp" #include "Error.hpp" @@ -16,7 +17,7 @@ // Exported Functions // -int CoreGetVolume(void) +CORE_EXPORT int CoreGetVolume(void) { std::string error; m64p_error ret; @@ -38,7 +39,7 @@ int CoreGetVolume(void) return volume; } -bool CoreSetVolume(int value) +CORE_EXPORT bool CoreSetVolume(int value) { std::string error; m64p_error ret; @@ -60,7 +61,7 @@ bool CoreSetVolume(int value) return ret == M64ERR_SUCCESS; } -bool CoreIncreaseVolume(void) +CORE_EXPORT bool CoreIncreaseVolume(void) { std::string error; int volume = 0; @@ -80,7 +81,7 @@ bool CoreIncreaseVolume(void) return CoreSetVolume(volume + 10); } -bool CoreDecreaseVolume(void) +CORE_EXPORT bool CoreDecreaseVolume(void) { std::string error; int volume = 0; @@ -100,7 +101,7 @@ bool CoreDecreaseVolume(void) return CoreSetVolume(volume - 10); } -bool CoreToggleMuteVolume(void) +CORE_EXPORT bool CoreToggleMuteVolume(void) { std::string error; m64p_error ret; diff --git a/Source/RMG-Core/m64p/Api.cpp b/Source/RMG-Core/m64p/Api.cpp index ac31c9d4c..722f842c2 100644 --- a/Source/RMG-Core/m64p/Api.cpp +++ b/Source/RMG-Core/m64p/Api.cpp @@ -8,9 +8,10 @@ * along with this program. If not, see . */ #include "Api.hpp" +#include "Library.hpp" namespace m64p { -m64p::CoreApi Core; -m64p::ConfigApi Config; +CORE_EXPORT m64p::CoreApi Core; +CORE_EXPORT m64p::ConfigApi Config; } // namespace m64p