dolphin/Source/Core/DiscIO/VolumeDisc.h
cristian64 789e516097 Core: Add Volume::GetSimulatedMemorySize().
The data structure of the `bi2.bin` file in which the simulated memory
size is set:

> **13.2  Disk header Information**
>
> this is loaded to the Address in `0x800000f4` when a disc is initialized by the IPL
>
> |  offset  | end | size | Description           |
> | :------: | --- | :--: | --------------------- |
> | `0x0000` |     |   4  | Debug-monitor Size    |
> | `0x0004` |     |   4  | Simulated Memory Size |
> | `0x0008` |     |   4  | Argument offset       |
> | `0x000c` |     |   4  | Debug flag            |
> | `0x0010` |     |   4  | Track Location        |
> | `0x0014` |     |   4  | Track size            |
> | `0x0018` |     |   4  | Countrycode           |
> | `0x001c` |     |   4  | ?                     |

See https://hitmen.c02.at/files/yagcd/yagcd/chap13.html#sec13.2.

Most GameCube games set the value to `24 MiB`, which matches the
physical memory size. Most Wii games set the value to `0 MiB` (unset).
The debug build of _Mario Kart: Double Dash!!_ is one game that sets the
value to `48 MiB`.
2026-06-29 22:36:29 +01:00

61 lines
2.2 KiB
C++

// Copyright 2020 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <array>
#include <optional>
#include <string>
#include "Common/CommonTypes.h"
#include "Common/Crypto/SHA1.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
class VolumeDisc : public Volume
{
public:
struct BootID
{
u32 magic; // 0x00 (Always BTID)
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 video_mode; // 0x2C unknown bitmask, resolutions + horizontal/vertical
uint8_t unknown3;
uint8_t type_3_compatible; // 0x2E (Type-3 compatible titles have this set to 1)
uint8_t unknown4;
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;
Country GetCountry(const Partition& partition = PARTITION_NONE) const override;
std::string GetMakerID(const Partition& partition = PARTITION_NONE) const override;
std::optional<u16> GetRevision(const Partition& partition = PARTITION_NONE) const override;
std::string GetInternalName(const Partition& partition = PARTITION_NONE) const override;
std::string GetApploaderDate(const Partition& partition) const override;
std::optional<u8> GetDiscNumber(const Partition& partition = PARTITION_NONE) const override;
u32 GetSimulatedMemorySize() const override;
bool IsNKit() const override;
protected:
Region RegionCodeToRegion(std::optional<u32> region_code) const;
void AddGamePartitionToSyncHash(Common::SHA1::Context* context) const;
};
static_assert(sizeof(VolumeDisc::BootID) == 480);
} // namespace DiscIO