Preliminary implementation of the Triforce Baseboard
This commit is contained in:
parent
c55785a9d1
commit
208edc015d
|
@ -203,6 +203,8 @@ add_library(core
|
|||
HW/EXI/EXI_DeviceAD16.h
|
||||
HW/EXI/EXI_DeviceAGP.cpp
|
||||
HW/EXI/EXI_DeviceAGP.h
|
||||
HW/EXI/EXI_DeviceBaseboard.cpp
|
||||
HW/EXI/EXI_DeviceBaseboard.h
|
||||
HW/EXI/EXI_DeviceDummy.cpp
|
||||
HW/EXI/EXI_DeviceDummy.h
|
||||
HW/EXI/EXI_DeviceEthernet.cpp
|
||||
|
|
|
@ -306,6 +306,7 @@ void SConfig::LoadDefaults()
|
|||
|
||||
auto& system = Core::System::GetInstance();
|
||||
system.SetIsWii(false);
|
||||
system.SetIsTriforce(false);
|
||||
|
||||
ResetRunningGameMetadata();
|
||||
}
|
||||
|
@ -329,6 +330,7 @@ struct SetGameMetadata
|
|||
{
|
||||
*region = disc.volume->GetRegion();
|
||||
system.SetIsWii(disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc);
|
||||
system.SetIsTriforce(disc.volume->GetVolumeType() == DiscIO::Platform::Triforce);
|
||||
config->m_disc_booted_from_game_list = true;
|
||||
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
||||
return true;
|
||||
|
|
|
@ -66,6 +66,18 @@ void ExpansionInterfaceManager::AddMemoryCard(Slot slot)
|
|||
m_channels[SlotToEXIChannel(slot)]->AddDevice(memorycard_device, SlotToEXIDevice(slot));
|
||||
}
|
||||
|
||||
void ExpansionInterfaceManager::AddSP1Device()
|
||||
{
|
||||
EXIDeviceType sp1_device = EXIDeviceType::Baseboard;
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (system.IsTriforce())
|
||||
{
|
||||
sp1_device = Config::Get(Config::MAIN_SERIAL_PORT_1);
|
||||
}
|
||||
|
||||
m_channels[0]->AddDevice(sp1_device, SlotToEXIDevice(Slot::SP1));
|
||||
}
|
||||
|
||||
u8 SlotToEXIChannel(Slot slot)
|
||||
{
|
||||
switch (slot)
|
||||
|
@ -145,6 +157,7 @@ void ExpansionInterfaceManager::Init(const Sram* override_sram)
|
|||
AddMemoryCard(slot);
|
||||
|
||||
m_channels[0]->AddDevice(EXIDeviceType::MaskROM, 1);
|
||||
AddSP1Device();
|
||||
m_channels[SlotToEXIChannel(Slot::SP1)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_1),
|
||||
SlotToEXIDevice(Slot::SP1));
|
||||
m_channels[SlotToEXIChannel(Slot::SP2)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_2),
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
|
||||
private:
|
||||
void AddMemoryCard(Slot slot);
|
||||
void AddSP1Device();
|
||||
|
||||
static void ChangeDeviceCallback(Core::System& system, u64 userdata, s64 cycles_late);
|
||||
static void UpdateInterruptsCallback(Core::System& system, u64 userdata, s64 cycles_late);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "Common/MsgHandler.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceAD16.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceAGP.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceBaseboard.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceDummy.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceEthernet.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceGecko.h"
|
||||
|
@ -171,7 +172,10 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, const EXIDevi
|
|||
result = std::make_unique<CEXIAgp>(system, slot);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::AMBaseboard:
|
||||
case EXIDeviceType::Baseboard:
|
||||
result = std::make_unique<CEXIBaseboard>(system);
|
||||
break;
|
||||
|
||||
case EXIDeviceType::None:
|
||||
default:
|
||||
result = std::make_unique<IEXIDevice>(system);
|
||||
|
|
|
@ -30,9 +30,7 @@ enum class EXIDeviceType : int
|
|||
AD16,
|
||||
Microphone,
|
||||
Ethernet,
|
||||
// Was used for Triforce in the past, but the implementation is no longer in Dolphin.
|
||||
// It's kept here so that values below will stay constant.
|
||||
AMBaseboard,
|
||||
Baseboard,
|
||||
Gecko,
|
||||
// Only used when creating a device by EXIDevice_Create.
|
||||
// Converted to MemoryCard internally.
|
||||
|
@ -98,7 +96,7 @@ struct fmt::formatter<ExpansionInterface::EXIDeviceType>
|
|||
_trans("AD16"),
|
||||
_trans("Microphone"),
|
||||
_trans("Broadband Adapter (TAP)"),
|
||||
_trans("Triforce AM Baseboard"),
|
||||
_trans("Triforce Baseboard"),
|
||||
_trans("USB Gecko"),
|
||||
_trans("GCI Folder"),
|
||||
_trans("Advance Game Port"),
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
// Copyright 2013 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Core/HW/EXI/EXI_DeviceBaseboard.h"
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system)
|
||||
{
|
||||
}
|
||||
|
||||
void CEXIBaseboard::SetCS(int cs)
|
||||
{
|
||||
if (cs)
|
||||
m_position = 0;
|
||||
}
|
||||
|
||||
bool CEXIBaseboard::IsPresent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXIBaseboard::TransferByte(u8& byte)
|
||||
{
|
||||
if (m_position == 0)
|
||||
{
|
||||
m_command = byte;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_command)
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
static constexpr std::array<u8, 4> ID = {0x06, 0x04, 0x10, 0x00};
|
||||
byte = ID[(m_position - 2) & 3];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ERROR_LOG_FMT(EXPANSIONINTERFACE, "EXI BASEBOARD: Unhandled command {:#x} {:#x}", m_command,
|
||||
m_position);
|
||||
}
|
||||
}
|
||||
m_position++;
|
||||
}
|
||||
|
||||
void CEXIBaseboard::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(m_position);
|
||||
p.Do(m_command);
|
||||
}
|
||||
} // namespace ExpansionInterface
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2013 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Core/HW/EXI/EXI_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace ExpansionInterface
|
||||
{
|
||||
class CEXIBaseboard : public IEXIDevice
|
||||
{
|
||||
public:
|
||||
CEXIBaseboard(Core::System& system);
|
||||
void SetCS(int cs) override;
|
||||
bool IsPresent() const override;
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
||||
private:
|
||||
// STATE_TO_SAVE
|
||||
u32 m_position = 0;
|
||||
u32 m_command = 0;
|
||||
|
||||
void TransferByte(u8& byte) override;
|
||||
};
|
||||
} // namespace ExpansionInterface
|
|
@ -99,7 +99,7 @@ static size_t s_state_writes_in_queue;
|
|||
static std::condition_variable s_state_write_queue_is_empty;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
constexpr u32 STATE_VERSION = 172; // Last changed in PR 13385
|
||||
constexpr u32 STATE_VERSION = 173; // Last changed in PR 10084
|
||||
|
||||
// Increase this if the StateExtendedHeader definition changes
|
||||
constexpr u32 EXTENDED_HEADER_VERSION = 1; // Last changed in PR 12217
|
||||
|
|
|
@ -141,10 +141,12 @@ public:
|
|||
bool IsMMUMode() const { return m_mmu_enabled; }
|
||||
bool IsPauseOnPanicMode() const { return m_pause_on_panic_enabled; }
|
||||
bool IsMIOS() const { return m_is_mios; }
|
||||
bool IsTriforce() const { return m_is_triforce; }
|
||||
bool IsWii() const { return m_is_wii; }
|
||||
bool IsBranchWatchIgnoreApploader() { return m_branch_watch_ignore_apploader; }
|
||||
|
||||
void SetIsMIOS(bool is_mios) { m_is_mios = is_mios; }
|
||||
void SetIsTriforce(bool is_triforce) { m_is_triforce = is_triforce; }
|
||||
void SetIsWii(bool is_wii) { m_is_wii = is_wii; }
|
||||
void SetIsBranchWatchIgnoreApploader(bool enable) { m_branch_watch_ignore_apploader = enable; }
|
||||
|
||||
|
@ -205,6 +207,7 @@ private:
|
|||
bool m_mmu_enabled = false;
|
||||
bool m_pause_on_panic_enabled = false;
|
||||
bool m_is_mios = false;
|
||||
bool m_is_triforce = false;
|
||||
bool m_is_wii = false;
|
||||
bool m_branch_watch_ignore_apploader = false;
|
||||
};
|
||||
|
|
|
@ -281,6 +281,7 @@
|
|||
<ClInclude Include="Core\HW\EXI\EXI_Device.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceAD16.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceAGP.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceBaseboard.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceDummy.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceEthernet.h" />
|
||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceGecko.h" />
|
||||
|
@ -948,6 +949,7 @@
|
|||
<ClCompile Include="Core\HW\EXI\EXI_Device.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceAD16.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceAGP.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceBaseboard.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceDummy.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceEthernet.cpp" />
|
||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
||||
|
|
Loading…
Reference in New Issue