prepare some stuff (also fix copyright headers)

This commit is contained in:
Arisotura 2024-08-07 11:37:13 +02:00
parent 9dbb4babfa
commit 0ad1fa8514
7 changed files with 59 additions and 8 deletions

View File

@ -187,16 +187,16 @@ void EmuInstance::deleteWindow(int id, bool close)
emuThread->detachWindow(win); emuThread->detachWindow(win);
if (close)
win->close();
windowList[id] = nullptr; windowList[id] = nullptr;
numWindows--; numWindows--;
if (topWindow == win) topWindow = nullptr; if (topWindow == win) topWindow = nullptr;
if (mainWindow == win) mainWindow = nullptr; if (mainWindow == win) mainWindow = nullptr;
if ((!mainWindow) && !deleting) if (close)
win->close();
if ((!mainWindow) && (!deleting))
{ {
// if we closed this instance's main window, delete the instance // if we closed this instance's main window, delete the instance
deleteEmuInstance(instanceID); deleteEmuInstance(instanceID);

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016-2022 melonDS team Copyright 2016-2024 melonDS team
This file is part of melonDS. This file is part of melonDS.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016-2022 melonDS team Copyright 2016-2024 melonDS team
This file is part of melonDS. This file is part of melonDS.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016-2022 melonDS team Copyright 2016-2024 melonDS team
This file is part of melonDS. This file is part of melonDS.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016-2022 melonDS team Copyright 2016-2024 melonDS team
This file is part of melonDS. This file is part of melonDS.

View File

@ -4,6 +4,7 @@ add_library(net-utils STATIC
Net_Slirp.cpp Net_Slirp.cpp
PacketDispatcher.cpp PacketDispatcher.cpp
LocalMP.cpp LocalMP.cpp
MPInterface.h
) )
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

50
src/net/MPInterface.h Normal file
View File

@ -0,0 +1,50 @@
/*
Copyright 2016-2024 melonDS team
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef MPINTERFACE_H
#define MPINTERFACE_H
#include "types.h"
namespace melonDS
{
class MPInterface
{
public:
[[nodiscard]] int GetRecvTimeout() const noexcept { return RecvTimeout; }
void SetRecvTimeout(int timeout) noexcept { RecvTimeout = timeout; }
virtual void Begin(int inst) = 0;
virtual void End(int inst) = 0;
virtual int SendPacket(int inst, u8* data, int len, u64 timestamp) = 0;
virtual int RecvPacket(int inst, u8* data, u64* timestamp) = 0;
virtual int SendCmd(int inst, u8* data, int len, u64 timestamp) = 0;
virtual int SendReply(int inst, u8* data, int len, u64 timestamp, u16 aid) = 0;
virtual int SendAck(int inst, u8* data, int len, u64 timestamp) = 0;
virtual int RecvHostPacket(int inst, u8* data, u64* timestamp) = 0;
virtual u16 RecvReplies(int inst, u8* data, u64 timestamp, u16 aidmask) = 0;
protected:
int RecvTimeout = 25;
};
}
#endif // MPINTERFACE_H