mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00:00
Preliminary implementation of the Triforce Baseboard
This commit is contained in:
parent
2baa09d5b4
commit
660232a12c
11 changed files with 115 additions and 6 deletions
|
@ -203,6 +203,8 @@ add_library(core
|
||||||
HW/EXI/EXI_DeviceAD16.h
|
HW/EXI/EXI_DeviceAD16.h
|
||||||
HW/EXI/EXI_DeviceAGP.cpp
|
HW/EXI/EXI_DeviceAGP.cpp
|
||||||
HW/EXI/EXI_DeviceAGP.h
|
HW/EXI/EXI_DeviceAGP.h
|
||||||
|
HW/EXI/EXI_DeviceBaseboard.cpp
|
||||||
|
HW/EXI/EXI_DeviceBaseboard.h
|
||||||
HW/EXI/EXI_DeviceDummy.cpp
|
HW/EXI/EXI_DeviceDummy.cpp
|
||||||
HW/EXI/EXI_DeviceDummy.h
|
HW/EXI/EXI_DeviceDummy.h
|
||||||
HW/EXI/EXI_DeviceEthernet.cpp
|
HW/EXI/EXI_DeviceEthernet.cpp
|
||||||
|
|
|
@ -307,6 +307,7 @@ void SConfig::LoadDefaults()
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
system.SetIsWii(false);
|
system.SetIsWii(false);
|
||||||
|
system.SetIsTriforce(false);
|
||||||
|
|
||||||
ResetRunningGameMetadata();
|
ResetRunningGameMetadata();
|
||||||
}
|
}
|
||||||
|
@ -330,6 +331,7 @@ struct SetGameMetadata
|
||||||
{
|
{
|
||||||
*region = disc.volume->GetRegion();
|
*region = disc.volume->GetRegion();
|
||||||
system.SetIsWii(disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc);
|
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->m_disc_booted_from_game_list = true;
|
||||||
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -66,6 +66,18 @@ void ExpansionInterfaceManager::AddMemoryCard(Slot slot)
|
||||||
m_channels[SlotToEXIChannel(slot)]->AddDevice(memorycard_device, SlotToEXIDevice(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)
|
u8 SlotToEXIChannel(Slot slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
@ -145,6 +157,7 @@ void ExpansionInterfaceManager::Init(const Sram* override_sram)
|
||||||
AddMemoryCard(slot);
|
AddMemoryCard(slot);
|
||||||
|
|
||||||
m_channels[0]->AddDevice(EXIDeviceType::MaskROM, 1);
|
m_channels[0]->AddDevice(EXIDeviceType::MaskROM, 1);
|
||||||
|
AddSP1Device();
|
||||||
m_channels[SlotToEXIChannel(Slot::SP1)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_1),
|
m_channels[SlotToEXIChannel(Slot::SP1)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_1),
|
||||||
SlotToEXIDevice(Slot::SP1));
|
SlotToEXIDevice(Slot::SP1));
|
||||||
m_channels[SlotToEXIChannel(Slot::SP2)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_2),
|
m_channels[SlotToEXIChannel(Slot::SP2)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_2),
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddMemoryCard(Slot slot);
|
void AddMemoryCard(Slot slot);
|
||||||
|
void AddSP1Device();
|
||||||
|
|
||||||
static void ChangeDeviceCallback(Core::System& system, u64 userdata, s64 cycles_late);
|
static void ChangeDeviceCallback(Core::System& system, u64 userdata, s64 cycles_late);
|
||||||
static void UpdateInterruptsCallback(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 "Common/MsgHandler.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceAD16.h"
|
#include "Core/HW/EXI/EXI_DeviceAD16.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceAGP.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_DeviceDummy.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernet.h"
|
#include "Core/HW/EXI/EXI_DeviceEthernet.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceGecko.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);
|
result = std::make_unique<CEXIAgp>(system, slot);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIDeviceType::AMBaseboard:
|
case EXIDeviceType::Baseboard:
|
||||||
|
result = std::make_unique<CEXIBaseboard>(system);
|
||||||
|
break;
|
||||||
|
|
||||||
case EXIDeviceType::None:
|
case EXIDeviceType::None:
|
||||||
default:
|
default:
|
||||||
result = std::make_unique<IEXIDevice>(system);
|
result = std::make_unique<IEXIDevice>(system);
|
||||||
|
|
|
@ -30,9 +30,7 @@ enum class EXIDeviceType : int
|
||||||
AD16,
|
AD16,
|
||||||
Microphone,
|
Microphone,
|
||||||
Ethernet,
|
Ethernet,
|
||||||
// Was used for Triforce in the past, but the implementation is no longer in Dolphin.
|
Baseboard,
|
||||||
// It's kept here so that values below will stay constant.
|
|
||||||
AMBaseboard,
|
|
||||||
Gecko,
|
Gecko,
|
||||||
// Only used when creating a device by EXIDevice_Create.
|
// Only used when creating a device by EXIDevice_Create.
|
||||||
// Converted to MemoryCard internally.
|
// Converted to MemoryCard internally.
|
||||||
|
@ -98,7 +96,7 @@ struct fmt::formatter<ExpansionInterface::EXIDeviceType>
|
||||||
_trans("AD16"),
|
_trans("AD16"),
|
||||||
_trans("Microphone"),
|
_trans("Microphone"),
|
||||||
_trans("Broadband Adapter (TAP)"),
|
_trans("Broadband Adapter (TAP)"),
|
||||||
_trans("Triforce AM Baseboard"),
|
_trans("Triforce Baseboard"),
|
||||||
_trans("USB Gecko"),
|
_trans("USB Gecko"),
|
||||||
_trans("GCI Folder"),
|
_trans("GCI Folder"),
|
||||||
_trans("Advance Game Port"),
|
_trans("Advance Game Port"),
|
||||||
|
|
57
Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp
Normal file
57
Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp
Normal file
|
@ -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
|
27
Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h
Normal file
27
Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h
Normal file
|
@ -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;
|
static std::condition_variable s_state_write_queue_is_empty;
|
||||||
|
|
||||||
// Don't forget to increase this after doing changes on the savestate system
|
// 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
|
// Increase this if the StateExtendedHeader definition changes
|
||||||
constexpr u32 EXTENDED_HEADER_VERSION = 1; // Last changed in PR 12217
|
constexpr u32 EXTENDED_HEADER_VERSION = 1; // Last changed in PR 12217
|
||||||
|
|
|
@ -141,10 +141,12 @@ public:
|
||||||
bool IsMMUMode() const { return m_mmu_enabled; }
|
bool IsMMUMode() const { return m_mmu_enabled; }
|
||||||
bool IsPauseOnPanicMode() const { return m_pause_on_panic_enabled; }
|
bool IsPauseOnPanicMode() const { return m_pause_on_panic_enabled; }
|
||||||
bool IsMIOS() const { return m_is_mios; }
|
bool IsMIOS() const { return m_is_mios; }
|
||||||
|
bool IsTriforce() const { return m_is_triforce; }
|
||||||
bool IsWii() const { return m_is_wii; }
|
bool IsWii() const { return m_is_wii; }
|
||||||
bool IsBranchWatchIgnoreApploader() { return m_branch_watch_ignore_apploader; }
|
bool IsBranchWatchIgnoreApploader() { return m_branch_watch_ignore_apploader; }
|
||||||
|
|
||||||
void SetIsMIOS(bool is_mios) { m_is_mios = is_mios; }
|
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 SetIsWii(bool is_wii) { m_is_wii = is_wii; }
|
||||||
void SetIsBranchWatchIgnoreApploader(bool enable) { m_branch_watch_ignore_apploader = enable; }
|
void SetIsBranchWatchIgnoreApploader(bool enable) { m_branch_watch_ignore_apploader = enable; }
|
||||||
|
|
||||||
|
@ -205,6 +207,7 @@ private:
|
||||||
bool m_mmu_enabled = false;
|
bool m_mmu_enabled = false;
|
||||||
bool m_pause_on_panic_enabled = false;
|
bool m_pause_on_panic_enabled = false;
|
||||||
bool m_is_mios = false;
|
bool m_is_mios = false;
|
||||||
|
bool m_is_triforce = false;
|
||||||
bool m_is_wii = false;
|
bool m_is_wii = false;
|
||||||
bool m_branch_watch_ignore_apploader = 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_Device.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceAD16.h" />
|
<ClInclude Include="Core\HW\EXI\EXI_DeviceAD16.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceAGP.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_DeviceDummy.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceEthernet.h" />
|
<ClInclude Include="Core\HW\EXI\EXI_DeviceEthernet.h" />
|
||||||
<ClInclude Include="Core\HW\EXI\EXI_DeviceGecko.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_Device.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceAD16.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI_DeviceAD16.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceAGP.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_DeviceDummy.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceEthernet.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI_DeviceEthernet.cpp" />
|
||||||
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
<ClCompile Include="Core\HW\EXI\EXI_DeviceGecko.cpp" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue