Fixed formattingFixed formatting

Special DI Config bit is now only set when loading a Triforce game
Made logtype names unique
Removed GetPointer function and updated code to use GetSpanForAddress instead
Removed incorrect value from GBAPadGroup struct
Optimized the code in GetGameID that retrieves the Triforce game ID
This commit is contained in:
crediar 2025-08-03 13:00:58 +02:00
commit 05c2f5d09f
29 changed files with 303 additions and 330 deletions

View file

@ -113,7 +113,7 @@ LogManager::LogManager()
m_log[LogType::DSP_MAIL] = {"DSPMails", "DSP Mails"};
m_log[LogType::DSPINTERFACE] = {"DSP", "DSP Interface"};
m_log[LogType::DVDINTERFACE] = {"DVD", "DVD Interface"};
m_log[LogType::DVDINTERFACE_AMMB] = { "DVD", "AMMB Interface" };
m_log[LogType::DVDINTERFACE_AMMB] = {"DVD_AMMB", "AMMB Interface"};
m_log[LogType::DYNA_REC] = {"JIT", "JIT Dynamic Recompiler"};
m_log[LogType::EXPANSIONINTERFACE] = {"EXI", "Expansion Interface"};
m_log[LogType::FILEMON] = {"FileMon", "File Monitor"};
@ -145,9 +145,9 @@ LogManager::LogManager()
m_log[LogType::PROCESSORINTERFACE] = {"PI", "Processor Interface"};
m_log[LogType::POWERPC] = {"PowerPC", "PowerPC IBM CPU"};
m_log[LogType::SERIALINTERFACE] = {"SI", "Serial Interface"};
m_log[LogType::SERIALINTERFACE_AMBB] = { "SI", "AMBB Interface" };
m_log[LogType::SERIALINTERFACE_CARD] = { "SI", "CARD Interface" };
m_log[LogType::SERIALINTERFACE_JVSIO] = { "SI", "JVS-I/O" };
m_log[LogType::SERIALINTERFACE_AMBB] = {"SI_AMBB", "AMBB Interface"};
m_log[LogType::SERIALINTERFACE_CARD] = {"SI_CARD", "CARD Interface"};
m_log[LogType::SERIALINTERFACE_JVSIO] = {"SI_JVS", "JVS-I/O"};
m_log[LogType::SP1] = {"SP1", "Serial Port 1"};
m_log[LogType::SYMBOLS] = {"SYMBOLS", "Symbols"};
m_log[LogType::VIDEO] = {"Video", "Video Backend"};

View file

@ -37,8 +37,8 @@
#include "Core/ConfigManager.h"
#include "Core/FifoPlayer/FifoPlayer.h"
#include "Core/HLE/HLE.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/DVD/AMMediaboard.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/EXI/EXI_DeviceIPL.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/VideoInterface.h"

View file

@ -21,8 +21,8 @@
#include "Core/Core.h"
#include "Core/Debugger/BranchWatch.h"
#include "Core/HLE/HLE.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/DVD/AMMediaboard.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/EXI/EXI_DeviceIPL.h"
#include "Core/HW/Memmap.h"
#include "Core/IOS/DI/DI.h"

View file

@ -303,9 +303,9 @@ void Stop(Core::System& system) // - Hammertime!
system.GetFifo().ExitGpuLoop();
}
const ExpansionInterface::EXIDeviceType Type = Config::Get(Config::MAIN_SERIAL_PORT_1);
const ExpansionInterface::EXIDeviceType type = Config::Get(Config::MAIN_SERIAL_PORT_1);
if ((Type == ExpansionInterface::EXIDeviceType::Baseboard))
if ((type == ExpansionInterface::EXIDeviceType::Baseboard))
{
AMMediaboard::Shutdown();
}

View file

@ -219,7 +219,8 @@ void Init(void)
if (!File::Exists(sega_boot_filename))
{
PanicAlertFmt("Failed to open segaboot.gcm({}), which is required for test menus.", sega_boot_filename.c_str());
PanicAlertFmt("Failed to open segaboot.gcm({}), which is required for test menus.",
sega_boot_filename.c_str());
return;
}
@ -487,10 +488,10 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
memory.Write_U16(Common::swap16(0x0100), address);
break;
case MediaBoardStatus2:
memset(memory.GetPointer(address), 0, length);
memset(memory.GetSpanForAddress(address).data(), 0, length);
break;
case MediaBoardStatus3:
memset(memory.GetPointer(address), 0xFF, length);
memset(memory.GetSpanForAddress(address).data(), 0xFF, length);
// DIMM size (512MB)
memory.Write_U32(Common::swap32(0x20000000), address);
// GCAM signature
@ -526,7 +527,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if (offset == 0x00000000 && length == 0x80)
{
s_netcfg->Seek(0, File::SeekOrigin::Begin);
s_netcfg->ReadBytes(memory.GetPointer(address), length);
s_netcfg->ReadBytes(memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -534,7 +535,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if (offset == DIMMExtraSettings && length == 0x20)
{
s_extra->Seek(0, File::SeekOrigin::Begin);
s_extra->ReadBytes(memory.GetPointer(address), length);
s_extra->ReadBytes(memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -543,14 +544,14 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - DIMMMemory;
s_dimm->Seek(dimmoffset, File::SeekOrigin::Begin);
s_dimm->ReadBytes(memory.GetPointer(address), length);
s_dimm->ReadBytes(memory.GetSpanForAddress(address).data(), length);
return 0;
}
if (offset >= DIMMCommandVersion1 && offset < 0x1F900040)
{
u32 dimmoffset = offset - DIMMCommandVersion1;
memcpy(memory.GetPointer(address), s_media_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_media_buffer + dimmoffset, length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read MEDIA BOARD COMM AREA (1) ({:08x},{})", offset,
length);
@ -562,7 +563,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkBufferAddress4;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK BUFFER (4) ({:08x},{})", offset, length);
memcpy(memory.GetPointer(address), s_network_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_buffer + dimmoffset, length);
return 0;
}
@ -570,7 +571,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkBufferAddress5;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK BUFFER (5) ({:08x},{})", offset, length);
memcpy(memory.GetPointer(address), s_network_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_buffer + dimmoffset, length);
return 0;
}
@ -579,7 +580,8 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
u32 dimmoffset = offset - NetworkCommandAddress;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK COMMAND BUFFER ({:08x},{})", offset,
length);
memcpy(memory.GetPointer(address), s_network_command_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_command_buffer + dimmoffset,
length);
return 0;
}
@ -588,7 +590,8 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
u32 dimmoffset = offset - NetworkCommandAddress2;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK COMMAND BUFFER (2) ({:08x},{})", offset,
length);
memcpy(memory.GetPointer(address), s_network_command_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_command_buffer + dimmoffset,
length);
return 0;
}
@ -596,7 +599,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkBufferAddress1;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK BUFFER (1) ({:08x},{})", offset, length);
memcpy(memory.GetPointer(address), s_network_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_buffer + dimmoffset, length);
return 0;
}
@ -604,7 +607,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkBufferAddress2;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK BUFFER (2) ({:08x},{})", offset, length);
memcpy(memory.GetPointer(address), s_network_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_buffer + dimmoffset, length);
return 0;
}
@ -612,14 +615,14 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkBufferAddress3;
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read NETWORK BUFFER (3) ({:08x},{})", offset, length);
memcpy(memory.GetPointer(address), s_network_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_network_buffer + dimmoffset, length);
return 0;
}
if (offset >= DIMMCommandVersion2 && offset < 0x84000060)
{
u32 dimmoffset = offset - DIMMCommandVersion2;
memcpy(memory.GetPointer(address), s_media_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_media_buffer + dimmoffset, length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read MEDIA BOARD COMM AREA (2) ({:08x},{})", offset,
length);
@ -1024,7 +1027,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
s_media_buffer[3] |= 0x80; // Command complete flag
memset(memory.GetPointer(address), 0, length);
memset(memory.GetSpanForAddress(address).data(), 0, length);
ExpansionInterface::GenerateInterrupt(0x10);
return 0;
@ -1033,7 +1036,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if (offset >= DIMMCommandVersion2_2 && offset <= 0x89000200)
{
u32 dimmoffset = offset - DIMMCommandVersion2_2;
memcpy(memory.GetPointer(address), s_media_buffer + dimmoffset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_media_buffer + dimmoffset, length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Read MEDIA BOARD COMM AREA (3) ({:08x})", dimmoffset);
PrintMBBuffer(address, length);
@ -1045,14 +1048,14 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - DIMMMemory2;
s_dimm->Seek(dimmoffset, File::SeekOrigin::Begin);
s_dimm->ReadBytes(memory.GetPointer(address), length);
s_dimm->ReadBytes(memory.GetSpanForAddress(address).data(), length);
return 0;
}
if (offset == NetworkControl && length == 0x20)
{
s_netctrl->Seek(0, File::SeekOrigin::Begin);
s_netctrl->ReadBytes(memory.GetPointer(address), length);
s_netctrl->ReadBytes(memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -1070,13 +1073,13 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
DICMDBUF[1] &= ~0x00100000;
DICMDBUF[1] -= 0x20;
}
memcpy(memory.GetPointer(address), s_firmware + offset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_firmware + offset, length);
return 0;
}
if (s_dimm_disc)
{
memcpy(memory.GetPointer(address), s_dimm_disc + offset, length);
memcpy(memory.GetSpanForAddress(address).data(), s_dimm_disc + offset, length);
return 0;
}
@ -1104,7 +1107,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if ((offset >= 0x00400000) && (offset <= 0x600000))
{
u32 fwoffset = offset - 0x00400000;
memcpy(s_firmware + fwoffset, memory.GetPointer(address), length);
memcpy(s_firmware + fwoffset, memory.GetSpanForAddress(address).data(), length);
return 0;
}
}
@ -1112,21 +1115,21 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
// Network configuration
if ((offset == 0x00000000) && (length == 0x80))
{
FileWriteData(s_netcfg, 0, memory.GetPointer(address), length);
FileWriteData(s_netcfg, 0, memory.GetSpanForAddress(address).data(), length);
return 0;
}
// media crc check on/off
if ((offset == DIMMExtraSettings) && (length == 0x20))
{
FileWriteData(s_extra, 0, memory.GetPointer(address), length);
FileWriteData(s_extra, 0, memory.GetSpanForAddress(address).data(), length);
return 0;
}
// Backup memory (8MB)
if ((offset >= BackupMemory) && (offset <= 0x00800000))
{
FileWriteData(s_backup, 0, memory.GetPointer(address), length);
FileWriteData(s_backup, 0, memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -1134,7 +1137,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if ((offset >= DIMMMemory) && (offset <= 0x1F800000))
{
u32 dimmoffset = offset - DIMMMemory;
FileWriteData(s_dimm, dimmoffset, memory.GetPointer(address), length);
FileWriteData(s_dimm, dimmoffset, memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -1142,7 +1145,8 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkCommandAddress;
memcpy(s_network_command_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_network_command_buffer + dimmoffset, memory.GetSpanForAddress(address).data(),
length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write NETWORK COMMAND BUFFER ({:08x},{})", dimmoffset,
length);
@ -1154,7 +1158,8 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - NetworkCommandAddress2;
memcpy(s_network_command_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_network_command_buffer + dimmoffset, memory.GetSpanForAddress(address).data(),
length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write NETWORK COMMAND BUFFER (2) ({:08x},{})",
dimmoffset, length);
@ -1166,7 +1171,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - 0x1FA00000;
memcpy(s_network_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_network_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write NETWORK BUFFER (1) ({:08x},{})", dimmoffset,
length);
@ -1178,7 +1183,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - 0x1FD00000;
memcpy(s_network_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_network_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write NETWORK BUFFER (2) ({:08x},{})", dimmoffset,
length);
@ -1190,7 +1195,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
{
u32 dimmoffset = offset - 0x89100000;
memcpy(s_network_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_network_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write NETWORK BUFFER (3) ({:08x},{})", dimmoffset,
length);
@ -1201,7 +1206,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if ((offset >= DIMMCommandVersion1) && (offset <= 0x1F90003F))
{
u32 dimmoffset = offset - 0x1F900000;
memcpy(s_media_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_media_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
INFO_LOG_FMT(DVDINTERFACE_AMMB, "GC-AM: Write MEDIA BOARD COMM AREA (1) ({:08x},{})", offset,
length);
@ -1278,7 +1283,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
break;
}
memcpy(memory.GetPointer(address), s_media_buffer, length);
memcpy(memory.GetSpanForAddress(address).data(), s_media_buffer, length);
memset(s_media_buffer + 0x20, 0, 0x20);
@ -1287,7 +1292,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
}
else
{
memcpy(s_media_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_media_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
}
return 0;
}
@ -1299,7 +1304,7 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
dimmoffset);
PrintMBBuffer(address, length);
memcpy(s_media_buffer + dimmoffset, memory.GetPointer(address), length);
memcpy(s_media_buffer + dimmoffset, memory.GetSpanForAddress(address).data(), length);
return 0;
}
@ -1318,13 +1323,13 @@ u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32 address, u32 length)
if ((offset >= DIMMMemory2) && (offset <= 0xFF800000))
{
u32 dimmoffset = offset - 0xFF000000;
FileWriteData(s_dimm, dimmoffset, memory.GetPointer(address), length);
FileWriteData(s_dimm, dimmoffset, memory.GetSpanForAddress(address).data(), length);
return 0;
}
if ((offset == NetworkControl) && (length == 0x20))
{
FileWriteData(s_netctrl, 0, memory.GetPointer(address), length);
FileWriteData(s_netctrl, 0, memory.GetSpanForAddress(address).data(), length);
return 0;
}

View file

@ -27,8 +27,8 @@
#include "Core/CoreTiming.h"
#include "Core/DolphinAnalytics.h"
#include "Core/HW/AudioInterface.h"
#include "Core/HW/DVD/DVDMath.h"
#include "Core/HW/DVD/AMMediaboard.h"
#include "Core/HW/DVD/DVDMath.h"
#include "Core/HW/DVD/DVDThread.h"
#include "Core/HW/EXI/EXI_DeviceIPL.h"
#include "Core/HW/MMIO.h"
@ -270,8 +270,6 @@ void DVDInterface::Init()
m_DIIMMBUF = 0;
m_DICFG.Hex = 0;
m_DICFG.CONFIG = 1; // Disable bootrom descrambler
m_DICFG.Hex |= 8; /* The Triforce IPL checks this bit
to set the physical memory to either 50MB(unset) or 24MB(set) */
ResetDrive(false);
@ -292,6 +290,8 @@ void DVDInterface::Init()
// The Triforce IPL expects the cover to be closed
m_DICVR.Hex = 0;
m_DICFG.Hex |= 8; /* The Triforce IPL checks this bit
to set the physical memory to either 50MB(unset) or 24MB(set) */
}
}

View file

@ -154,11 +154,9 @@ void ExpansionInterfaceManager::Init(const Sram* override_sram)
}
m_channels[SlotToEXIChannel(Slot::SP1)]->AddDevice(sp1_device, SlotToEXIDevice(Slot::SP1));
m_channels[SlotToEXIChannel(Slot::SP2)]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_2),
SlotToEXIDevice(Slot::SP2));
m_event_type_change_device = core_timing.RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
m_event_type_update_interrupts =
core_timing.RegisterEvent("EXIUpdateInterrupts", UpdateInterruptsCallback);

View file

@ -16,7 +16,6 @@
#include "Core/HW/EXI/EXI_DeviceIPL.h"
#include "Core/HW/EXI/EXI_DeviceMemoryCard.h"
#include "Core/HW/EXI/EXI_DeviceModem.h"
#include "Core/HW/EXI/EXI_DeviceBaseboard.h"
#include "Core/HW/Memmap.h"
#include "Core/System.h"

View file

@ -1,4 +1,4 @@
// Copyright 2017 Dolphin Emulator Project
// Copyright 2013 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Core/HW/EXI/EXI_DeviceBaseboard.h"
@ -167,7 +167,7 @@ void CEXIBaseboard::DMAWrite(u32 addr, u32 size)
m_backup->Seek(m_backoffset, File::SeekOrigin::Begin);
m_backup->WriteBytes(memory.GetPointer(addr), size);
m_backup->WriteBytes(memory.GetSpanForAddress(addr).data(), size);
m_backup->Flush();
}
@ -183,7 +183,7 @@ void CEXIBaseboard::DMARead(u32 addr, u32 size)
m_backup->Flush();
m_backup->ReadBytes(memory.GetPointer(addr), size);
m_backup->ReadBytes(memory.GetSpanForAddress(addr).data(), size);
}
void CEXIBaseboard::TransferByte(u8& _byte)
@ -241,8 +241,8 @@ void CEXIBaseboard::TransferByte(u8& _byte)
case DMAOffsetLengthSet:
m_backup_dma_offset = (m_command[1] << 8) | m_command[2];
m_backup_dma_length = m_command[3];
NOTICE_LOG_FMT(SP1, "AM-BB: COMMAND: DMAOffsetLengthSet :{:04x} {:02x}", m_backup_dma_offset,
m_backup_dma_length);
NOTICE_LOG_FMT(SP1, "AM-BB: COMMAND: DMAOffsetLengthSet :{:04x} {:02x}",
m_backup_dma_offset, m_backup_dma_length);
_byte = 0x01;
break;
case ReadISR:

View file

@ -1,3 +1,5 @@
// Copyright 2013 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@ -10,15 +12,14 @@
#include "Common/CommonTypes.h"
#include "Common/Flag.h"
#include "Core/HW/EXI/EXI_Device.h"
#include "Common/IOFile.h"
#include "Core/HW/EXI/EXI_Device.h"
namespace Core
{
class System;
}
namespace ExpansionInterface
{
void GenerateInterrupt(int flag);
@ -36,9 +37,7 @@ public:
void DMAWrite(u32 addr, u32 size) override;
void DMARead(u32 addr, u32 size) override;
private:
enum Command
{
BackupOffsetSet = 0x01,

View file

@ -17,8 +17,7 @@ class Buttons;
enum class GBAPadGroup
{
DPad,
Buttons,
Triforce
Buttons
};
class GBAPad : public ControllerEmu::EmulatedController

View file

@ -526,25 +526,6 @@ std::span<u8> MemoryManager::GetSpanForAddress(u32 address) const
LR(ppc_state));
return {};
}
u8* MemoryManager::GetPointer(u32 address) const
{
// TODO: Should we be masking off more bits here? Can all devices access
// EXRAM?
address &= 0x3FFFFFFF;
if (address < GetRamSizeReal())
return m_ram + address;
if (m_exram)
{
if ((address >> 28) == 0x1 && (address & 0x0fffffff) < GetExRamSizeReal())
return m_exram + (address & GetExRamMask());
}
auto& ppc_state = m_system.GetPPCState();
PanicAlertFmt("Unknown Pointer {:#010x} PC {:#010x} LR {:#010x}", address, ppc_state.pc,
LR(ppc_state));
return nullptr;
}
u8 MemoryManager::Read_U8(u32 address) const
{

View file

@ -115,7 +115,6 @@ public:
// If the specified range is within a single valid memory region, returns a pointer to the start
// of the corresponding range in host memory. Otherwise, returns nullptr.
u8* GetPointerForRange(u32 address, size_t size) const;
u8* GetPointer(u32 address) const;
void CopyFromEmu(void* data, u32 address, size_t size) const;
void CopyToEmu(u32 address, const void* data, size_t size);
void Memset(u32 address, u8 value, size_t size);

View file

@ -16,11 +16,11 @@
#ifdef HAS_LIBMGBA
#include "Core/HW/SI/SI_DeviceGBAEmu.h"
#endif
#include "Core/HW/SI/SI_DeviceAMBaseboard.h"
#include "Core/HW/SI/SI_DeviceGCAdapter.h"
#include "Core/HW/SI/SI_DeviceGCController.h"
#include "Core/HW/SI/SI_DeviceGCSteeringWheel.h"
#include "Core/HW/SI/SI_DeviceKeyboard.h"
#include "Core/HW/SI/SI_DeviceAMBaseboard.h"
#include "Core/HW/SI/SI_DeviceNull.h"
#include "Core/HW/SystemTimers.h"
#include "Core/System.h"

View file

@ -27,17 +27,10 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const
std::unique_ptr<FileInfo> file_info = file_system->FindFileInfo("boot.id");
if (file_info && !file_info->IsDirectory())
{
u8* bootid_buffer = new u8[file_info->GetTotalSize()];
if (Read(file_info->GetOffset(), file_info->GetTotalSize(), bootid_buffer, partition))
if (Read(file_info->GetOffset() + 0x30, sizeof(id), reinterpret_cast<u8*>(id), partition))
{
memcpy(id, bootid_buffer + 0x30, sizeof(id));
delete[] bootid_buffer;
return DecodeString(id);
}
// Fall back to normal ID from header
delete[] bootid_buffer;
}
}

View file

@ -29,9 +29,11 @@ void GCPadEmu::CreateMainLayout()
0);
layout->addWidget(CreateGroupBox(tr("D-Pad"), Pad::GetGroup(GetPort(), PadGroup::DPad)), 1, 0);
if (Config::Get(Config::GetInfoForSIDevice(0)) == SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD)
if (Config::Get(Config::GetInfoForSIDevice(0)) ==
SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD)
{
layout->addWidget(CreateGroupBox(tr("Triforce"), Pad::GetGroup(GetPort(), PadGroup::Triforce)), 2, 0);
layout->addWidget(CreateGroupBox(tr("Triforce"), Pad::GetGroup(GetPort(), PadGroup::Triforce)),
2, 0);
}
layout->addWidget(

View file

@ -440,7 +440,8 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
case Type::MAPPING_GC_DANCEMAT:
case Type::MAPPING_GCPAD:
widget = new GCPadEmu(this);
if (Config::Get(Config::GetInfoForSIDevice(GetPort())) == SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD)
if (Config::Get(Config::GetInfoForSIDevice(GetPort())) ==
SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD)
{
setWindowTitle(tr("Triforce Baseboard at Port %1").arg(GetPort() + 1));
AddWidget(tr("Triforce Baseboard"), widget);

View file

@ -1152,15 +1152,18 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
const auto volume_type =
std::get<BootParameters::Disc>(parameters->parameters).volume->GetVolumeType();
const bool triforce_hardware_sp1 = Config::Get(Config::MAIN_SERIAL_PORT_1) == ExpansionInterface::EXIDeviceType::Baseboard;
const bool triforce_hardware_port_1 = Config::Get(Config::GetInfoForSIDevice(0)) == SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD;
const bool triforce_hardware_sp1 =
Config::Get(Config::MAIN_SERIAL_PORT_1) == ExpansionInterface::EXIDeviceType::Baseboard;
const bool triforce_hardware_port_1 = Config::Get(Config::GetInfoForSIDevice(0)) ==
SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD;
if (volume_type == DiscIO::Platform::Triforce)
{
if (!triforce_hardware_sp1 || !triforce_hardware_port_1)
{
ModalMessageBox::critical(
this, tr("Error"), tr("To boot a Triforce game, SP1 and Port 1 must be set to Triforce Baseboard."),
this, tr("Error"),
tr("To boot a Triforce game, SP1 and Port 1 must be set to Triforce Baseboard."),
QMessageBox::Ok);
HideRenderWidget();
return;
@ -1174,7 +1177,8 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
if (triforce_hardware_sp1 || triforce_hardware_port_1)
{
ModalMessageBox::warning(
this, tr("Warning"), tr("Non-Triforce games cannot be booted with Triforce hardware attached."),
this, tr("Warning"),
tr("Non-Triforce games cannot be booted with Triforce hardware attached."),
QMessageBox::Ok);
}
}

View file

@ -310,8 +310,8 @@ void MenuBar::AddToolsMenu()
m_pal_ipl =
gc_ipl->addAction(tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); });
m_dev_ipl =
gc_ipl->addAction(tr("Triforce"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::DEV); });
m_dev_ipl = gc_ipl->addAction(tr("Triforce"), this,
[this] { emit BootGameCubeIPL(DiscIO::Region::DEV); });
tools_menu->addAction(tr("Memory Card Manager"), this, [this] { emit ShowMemcardManager(); });

View file

@ -138,16 +138,10 @@ void GameCubePane::CreateWidgets()
}
// Add SP1 devices
for (const auto device : {
EXIDeviceType::None,
EXIDeviceType::Dummy,
EXIDeviceType::Ethernet,
EXIDeviceType::EthernetXLink,
EXIDeviceType::EthernetTapServer,
EXIDeviceType::EthernetBuiltIn,
EXIDeviceType::ModemTapServer,
EXIDeviceType::Baseboard
})
for (const auto device :
{EXIDeviceType::None, EXIDeviceType::Dummy, EXIDeviceType::Ethernet,
EXIDeviceType::EthernetXLink, EXIDeviceType::EthernetTapServer,
EXIDeviceType::EthernetBuiltIn, EXIDeviceType::ModemTapServer, EXIDeviceType::Baseboard})
{
m_slot_combos[ExpansionInterface::Slot::SP1]->addItem(tr(fmt::format("{:n}", device).c_str()),
static_cast<int>(device));

View file

@ -499,8 +499,7 @@ const std::string& GameFile::GetName(const Core::TitleDatabase& title_database)
if (IsModDescriptor())
return GetName(Variant::LongAndPossiblyCustom);
const std::string& database_name =
title_database.GetTitleName(m_gametdb_id, GetConfigLanguage());
const std::string& database_name = title_database.GetTitleName(m_gametdb_id, GetConfigLanguage());
return database_name.empty() ? GetName(Variant::LongAndPossiblyCustom) : database_name;
}