mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
fixups
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -3,25 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace File
|
||||
{
|
||||
class IOFile;
|
||||
}
|
||||
|
||||
enum GameType
|
||||
{
|
||||
FZeroAX = 1,
|
||||
@@ -67,8 +52,6 @@ enum InquiryType
|
||||
Version2 = 0x29484100,
|
||||
};
|
||||
|
||||
#define SocketCheck(x) (x <= 0x3F ? x : 0)
|
||||
|
||||
namespace AMMediaboard
|
||||
{
|
||||
|
||||
@@ -228,8 +211,8 @@ enum SocketStatusCodes
|
||||
void Init();
|
||||
void FirmwareMap(bool on);
|
||||
u8* InitDIMM(u32 size);
|
||||
void InitKeys(u32 KeyA, u32 KeyB, u32 KeyC);
|
||||
u32 ExecuteCommand(std::array<u32, 3>& DICMDBUF, u32* DIIMMBUF, u32 Address, u32 Length);
|
||||
void InitKeys(u32 key_a, u32 key_b, u32 key_c);
|
||||
u32 ExecuteCommand(std::array<u32, 3>& dicmd_buf, u32* diimm_buf, u32 address, u32 length);
|
||||
u32 GetGameType();
|
||||
u32 GetMediaType();
|
||||
bool GetTestMenu();
|
||||
|
||||
@@ -3,28 +3,19 @@
|
||||
|
||||
#include "Core/HW/EXI/EXI_DeviceBaseboard.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/Buffer.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/BootManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
#include "Core/ConfigLoaders/BaseConfigLoader.h"
|
||||
#include "Core/ConfigLoaders/NetPlayConfigLoader.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/DVD/AMMediaboard.h"
|
||||
@@ -35,30 +26,18 @@
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SI/SI.h"
|
||||
#include "Core/HW/SI/SI_Device.h"
|
||||
#include "Core/HW/Sram.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/WiiRoot.h"
|
||||
|
||||
#include "DiscIO/Enums.h"
|
||||
|
||||
static bool s_interrupt_set = false;
|
||||
static u32 s_irq_timer = 0;
|
||||
static u32 s_irq_status = 0;
|
||||
|
||||
static u16 CheckSum(u8* data, u32 length)
|
||||
static u16 CheckSum(const u8* data, u32 length)
|
||||
{
|
||||
u16 check = 0;
|
||||
|
||||
for (u32 i = 0; i < length; i++)
|
||||
{
|
||||
check += data[i];
|
||||
}
|
||||
|
||||
return check;
|
||||
return std::accumulate(data, data + length, 0);
|
||||
}
|
||||
|
||||
namespace ExpansionInterface
|
||||
@@ -75,7 +54,7 @@ void GenerateInterrupt(int flag)
|
||||
system.GetExpansionInterface().UpdateInterrupts();
|
||||
}
|
||||
|
||||
CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system), m_position(0)
|
||||
CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system)
|
||||
{
|
||||
std::string backup_filename(fmt::format("{}tribackup_{}.bin", File::GetUserPath(D_TRIUSER_IDX),
|
||||
SConfig::GetInstance().GetGameID()));
|
||||
@@ -110,12 +89,12 @@ CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system), m_posit
|
||||
m_backup.ReadBytes(data.data(), data.size());
|
||||
|
||||
// Set FIRM version
|
||||
reinterpret_cast<u16&>(data[0x12]) = 0x1703;
|
||||
reinterpret_cast<u16&>(data[0x212]) = 0x1703;
|
||||
Common::BitCastPtr<u16>(data.data() + 0x12) = 0x1703;
|
||||
Common::BitCastPtr<u16>(data.data() + 0x212) = 0x1703;
|
||||
|
||||
// Update checksum
|
||||
reinterpret_cast<u16&>(data[0x0A]) = Common::swap16(CheckSum(&data[0xC], 0x1F4));
|
||||
reinterpret_cast<u16&>(data[0x20A]) = Common::swap16(CheckSum(&data[0x20C], 0x1F4));
|
||||
Common::BitCastPtr<u16>(data.data() + 0x0A) = Common::swap16(CheckSum(&data[0xC], 0x1F4));
|
||||
Common::BitCastPtr<u16>(data.data() + 0x20A) = Common::swap16(CheckSum(&data[0x20C], 0x1F4));
|
||||
|
||||
m_backup.Seek(0, File::SeekOrigin::Begin);
|
||||
m_backup.WriteBytes(data.data(), data.size());
|
||||
@@ -148,12 +127,10 @@ bool CEXIBaseboard::IsInterruptSet()
|
||||
DEBUG_LOG_FMT(SP1, "AM-BB: IRQ");
|
||||
if (++s_irq_timer > 12)
|
||||
s_interrupt_set = false;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEXIBaseboard::DMAWrite(u32 addr, u32 size)
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace ExpansionInterface
|
||||
{
|
||||
void GenerateInterrupt(int flag);
|
||||
|
||||
class CEXIBaseboard : public IEXIDevice
|
||||
class CEXIBaseboard final : public IEXIDevice
|
||||
{
|
||||
public:
|
||||
explicit CEXIBaseboard(Core::System& system);
|
||||
virtual ~CEXIBaseboard();
|
||||
~CEXIBaseboard() override;
|
||||
|
||||
void SetCS(int cs) override;
|
||||
bool IsInterruptSet() override;
|
||||
@@ -46,11 +46,11 @@ private:
|
||||
WriteLANCNT = 0xFF,
|
||||
};
|
||||
|
||||
u32 m_position;
|
||||
u32 m_backup_dma_offset;
|
||||
u32 m_backup_dma_length;
|
||||
u8 m_command[4];
|
||||
u16 m_backup_offset;
|
||||
u32 m_position = 0;
|
||||
u32 m_backup_dma_offset = 0;
|
||||
u32 m_backup_dma_length = 0;
|
||||
std::array<u8, 4> m_command{};
|
||||
u16 m_backup_offset = 0;
|
||||
File::IOFile m_backup;
|
||||
|
||||
protected:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,12 +19,11 @@ namespace SerialInterface
|
||||
class JVSIOMessage
|
||||
{
|
||||
public:
|
||||
u32 m_ptr;
|
||||
u32 m_last_start;
|
||||
u32 m_csum;
|
||||
u8 m_msg[0x80];
|
||||
u32 m_ptr = 0;
|
||||
u32 m_last_start = 0;
|
||||
u32 m_csum = 0;
|
||||
std::array<u8, 0x80> m_msg;
|
||||
|
||||
JVSIOMessage();
|
||||
void Start(int node);
|
||||
void AddData(const u8* dst, size_t len, int sync);
|
||||
void AddData(const void* data, size_t len);
|
||||
|
||||
@@ -28,9 +28,9 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const
|
||||
// Construct game ID from the BTID
|
||||
id[0] = 'G';
|
||||
|
||||
memcpy(id + 1, boot_id->gameId + 2, 2);
|
||||
memcpy(id + 1, boot_id->game_id.data() + 2, 2);
|
||||
|
||||
switch (boot_id->regionFlags)
|
||||
switch (boot_id->region_flags)
|
||||
{
|
||||
default:
|
||||
case 0x02: // JAPAN
|
||||
@@ -83,7 +83,7 @@ Country VolumeDisc::GetCountry(const Partition& partition) const
|
||||
{
|
||||
const BootID* boot_id = static_cast<const VolumeGC*>(this)->GetTriforceBootID();
|
||||
|
||||
switch (boot_id->regionFlags)
|
||||
switch (boot_id->region_flags)
|
||||
{
|
||||
default:
|
||||
case 0x02: // JAPAN
|
||||
@@ -166,7 +166,7 @@ std::string VolumeDisc::GetInternalName(const Partition& partition) const
|
||||
if (GetVolumeType() == Platform::Triforce)
|
||||
{
|
||||
const BootID* boot_id = static_cast<const VolumeGC*>(this)->GetTriforceBootID();
|
||||
return DecodeString(boot_id->gameName);
|
||||
return DecodeString(boot_id->game_name);
|
||||
}
|
||||
|
||||
if (!Read(0x20, sizeof(name), reinterpret_cast<u8*>(&name), partition))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
@@ -18,25 +19,25 @@ public:
|
||||
struct BootID
|
||||
{
|
||||
u32 magic; // 0x00 (Always BTID)
|
||||
uint32_t unknown0[3];
|
||||
uint32_t unknown1[4];
|
||||
char mediaboardType[4]; // 0x20 (GCAM for Triforce)
|
||||
std::array<uint32_t, 3> unknown0;
|
||||
std::array<uint32_t, 4> unknown1;
|
||||
std::array<char, 4> mediaboard_type; // 0x20 (GCAM for Triforce)
|
||||
uint32_t unknown2;
|
||||
uint16_t year; // 0x28
|
||||
uint8_t month; // 0x2A
|
||||
uint8_t day; // 0x2B
|
||||
uint8_t videoMode; // 0x2C unknown bitmask, resolutions + horizontal/vertical
|
||||
uint16_t year; // 0x28
|
||||
uint8_t month; // 0x2A
|
||||
uint8_t day; // 0x2B
|
||||
uint8_t video_mode; // 0x2C unknown bitmask, resolutions + horizontal/vertical
|
||||
uint8_t unknown3;
|
||||
uint8_t type3Compatible; // 0x2E (Type-3 compatible titles have this set to 1)
|
||||
uint8_t type_3_compatible; // 0x2E (Type-3 compatible titles have this set to 1)
|
||||
uint8_t unknown4;
|
||||
char gameId[8]; // 0x30
|
||||
uint32_t regionFlags; // 0x38
|
||||
uint32_t unknown6[9];
|
||||
char manufacturer[0x20]; // 0x60
|
||||
char gameName[0x20]; // 0x80
|
||||
char gameExecutable[0x20]; // 0xA0
|
||||
char testExecutable[0x20]; // 0xC0
|
||||
char creditTypes[8][0x20]; // 0xE0
|
||||
std::array<char, 8> game_id; // 0x30
|
||||
uint32_t region_flags; // 0x38
|
||||
std::array<uint32_t, 9> unknown6;
|
||||
std::array<char, 0x20> manufacturer; // 0x60
|
||||
std::array<char, 0x20> game_name; // 0x80
|
||||
std::array<char, 0x20> game_executable; // 0xA0
|
||||
std::array<char, 0x20> test_executable; // 0xC0
|
||||
std::array<std::array<char, 0x20>, 8> credit_types; // 0xE0
|
||||
};
|
||||
|
||||
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override;
|
||||
@@ -53,4 +54,6 @@ protected:
|
||||
void AddGamePartitionToSyncHash(Common::SHA1::Context* context) const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(VolumeDisc::BootID) == 480);
|
||||
|
||||
} // namespace DiscIO
|
||||
|
||||
@@ -92,7 +92,7 @@ Region VolumeGC::GetRegion() const
|
||||
{
|
||||
if (m_is_triforce)
|
||||
{
|
||||
switch (m_triforce_header.regionFlags)
|
||||
switch (m_triforce_header.region_flags)
|
||||
{
|
||||
default:
|
||||
case 0x02: // JAPAN
|
||||
|
||||
Reference in New Issue
Block a user