mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-29 17:19:54 -06:00
lay base for supporting different MP interfaces
This commit is contained in:
60
src/net/MPInterface.cpp
Normal file
60
src/net/MPInterface.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
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/.
|
||||
*/
|
||||
|
||||
#include "MPInterface.h"
|
||||
#include "LocalMP.h"
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
|
||||
class DummyMP : public MPInterface
|
||||
{
|
||||
public:
|
||||
void Process() override {}
|
||||
|
||||
void Begin(int inst) override {}
|
||||
void End(int inst) override {}
|
||||
|
||||
int SendPacket(int inst, u8* data, int len, u64 timestamp) override { return 0; }
|
||||
int RecvPacket(int inst, u8* data, u64* timestamp) override { return 0; }
|
||||
int SendCmd(int inst, u8* data, int len, u64 timestamp) override { return 0; }
|
||||
int SendReply(int inst, u8* data, int len, u64 timestamp, u16 aid) override { return 0; }
|
||||
int SendAck(int inst, u8* data, int len, u64 timestamp) override { return 0; }
|
||||
int RecvHostPacket(int inst, u8* data, u64* timestamp) override { return 0; }
|
||||
u16 RecvReplies(int inst, u8* data, u64 timestamp, u16 aidmask) override { return 0; }
|
||||
};
|
||||
|
||||
|
||||
std::unique_ptr<MPInterface> MPInterface::Current(std::make_unique<DummyMP>());
|
||||
|
||||
|
||||
void MPInterface::Set(MPInterfaceType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MPInterface_Local:
|
||||
Current = std::make_unique<LocalMP>();
|
||||
break;
|
||||
|
||||
default:
|
||||
Current = std::make_unique<DummyMP>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user