summaryrefslogtreecommitdiffstats
path: root/src/core/hle/config_mem.cpp
blob: d8ba9e6cff703a93a33fb8b8f7f402a0c94bc4c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#include "common/common_types.h"
#include "common/log.h"

#include "core/hle/config_mem.h"

////////////////////////////////////////////////////////////////////////////////////////////////////

namespace ConfigMem {

enum {
    KERNEL_VERSIONREVISION  = 0x1FF80001,
    KERNEL_VERSIONMINOR     = 0x1FF80002,
    KERNEL_VERSIONMAJOR     = 0x1FF80003,
    UPDATEFLAG              = 0x1FF80004,
    NSTID                   = 0x1FF80008,
    SYSCOREVER              = 0x1FF80010,
    UNITINFO                = 0x1FF80014,
    KERNEL_CTRSDKVERSION    = 0x1FF80018,
    APPMEMTYPE              = 0x1FF80030,
    APPMEMALLOC             = 0x1FF80040,
    FIRM_VERSIONREVISION    = 0x1FF80061,
    FIRM_VERSIONMINOR       = 0x1FF80062,
    FIRM_VERSIONMAJOR       = 0x1FF80063,
    FIRM_SYSCOREVER         = 0x1FF80064,
    FIRM_CTRSDKVERSION      = 0x1FF80068,
};

template <typename T>
inline void Read(T &var, const u32 addr) {
    switch (addr) {

    // Bit 0 set for Retail
    case UNITINFO:
        var = 0x00000001;
        break;

    // Set app memory size to 64MB?
    case APPMEMALLOC:
        var = 0x04000000;
        break;

    // Unknown - normally set to: 0x08000000 - (APPMEMALLOC + *0x1FF80048)
    // (Total FCRAM size - APPMEMALLOC - *0x1FF80048)
    case 0x1FF80044:
        var = 0x08000000 - (0x04000000 + 0x1400000);
        break;

    // Unknown - normally set to: 0x1400000 (20MB)
    case 0x1FF80048:
        var = 0x1400000;
        break;

    default:
        LOG_ERROR(Kernel, "unknown addr=0x%08X", addr);
    }
}

// Explicitly instantiate template functions because we aren't defining this in the header:

template void Read<u64>(u64 &var, const u32 addr);
template void Read<u32>(u32 &var, const u32 addr);
template void Read<u16>(u16 &var, const u32 addr);
template void Read<u8>(u8 &var, const u32 addr);


} // namespace