Skip to content

Commit

Permalink
RMG-Core: fix compilation when compiling with netplay disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Dec 29, 2024
1 parent a8e4f05 commit 91feda3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions Source/RMG-Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set(RMG_CORE_SOURCES
SaveState.cpp
Callback.cpp
Settings.cpp
Netplay.cpp
Plugins.cpp
Version.cpp
Cheats.cpp
Expand Down Expand Up @@ -76,9 +77,6 @@ if (DISCORD_RPC)
endif(DISCORD_RPC)

if (NETPLAY)
list(APPEND RMG_CORE_SOURCES
Netplay.cpp
)
add_definitions(-DNETPLAY)
endif(NETPLAY)

Expand Down
12 changes: 12 additions & 0 deletions Source/RMG-Core/Netplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static bool l_HasInitNetplay = false;

bool CoreInitNetplay(std::string address, int port, int player)
{
#ifdef NETPLAY
std::string error;
m64p_error ret;
uint32_t id = 0;
Expand Down Expand Up @@ -76,15 +77,23 @@ bool CoreInitNetplay(std::string address, int port, int player)

l_HasInitNetplay = true;
return true;
#else
return false;
#endif // NETPLAY
}

bool CoreHasInitNetplay(void)
{
#ifdef NETPLAY
return l_HasInitNetplay;
#else
return false;
#endif // NETPLAY
}

bool CoreShutdownNetplay(void)
{
#ifdef NETPLAY
std::string error;
m64p_error ret;

Expand All @@ -99,4 +108,7 @@ bool CoreShutdownNetplay(void)

l_HasInitNetplay = false;
return true;
#else
return false;
#endif // NETPLAY
}

0 comments on commit 91feda3

Please sign in to comment.