Skip to content

Commit 5d07832

Browse files
committed
RMG-Core: add netplay bool to CoreStartEmulation to improve readability
1 parent 988c4f0 commit 5d07832

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Source/RMG-Core/Emulation.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
153153
m64p_error m64p_ret;
154154
bool netplay_ret = false;
155155
CoreRomType type;
156+
bool netplay = !address.empty();
156157

157158
if (!CoreOpenRom(n64rom))
158159
{
@@ -180,7 +181,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
180181
return false;
181182
}
182183

183-
if (!address.empty())
184+
if (netplay)
184185
{ // netplay cheats
185186
if (!CoreApplyNetplayCheats())
186187
{
@@ -230,7 +231,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
230231
#endif // DISCORD_RPC
231232

232233
#ifdef NETPLAY
233-
if (!address.empty())
234+
if (netplay)
234235
{
235236
netplay_ret = CoreInitNetplay(address, port, player);
236237
if (!netplay_ret)
@@ -242,7 +243,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
242243

243244
// only start emulation when initializing netplay
244245
// is successful or if there's no netplay requested
245-
if (address.empty() || netplay_ret)
246+
if (!netplay || netplay_ret)
246247
{
247248
m64p_ret = m64p::Core.DoCommand(M64CMD_EXECUTE, 0, nullptr);
248249
if (m64p_ret != M64ERR_SUCCESS)
@@ -253,7 +254,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
253254
}
254255

255256
#ifdef NETPLAY
256-
if (!address.empty() && netplay_ret)
257+
if (netplay && netplay_ret)
257258
{
258259
CoreShutdownNetplay();
259260
}
@@ -273,7 +274,7 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
273274
CoreDiscordRpcUpdate(false);
274275
#endif // DISCORD_RPC
275276

276-
if (address.empty() || netplay_ret)
277+
if (!netplay || netplay_ret)
277278
{
278279
// we need to set the emulation error last,
279280
// to prevent the other functions from

0 commit comments

Comments
 (0)