diff options
Diffstat (limited to 'src/core/hle/config_mem.cpp')
| -rw-r--r-- | src/core/hle/config_mem.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp new file mode 100644 index 000000000..48aa878cc --- /dev/null +++ b/src/core/hle/config_mem.cpp | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/common_types.h" | ||
| 6 | #include "common/log.h" | ||
| 7 | |||
| 8 | #include "core/hle/config_mem.h" | ||
| 9 | |||
| 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 11 | |||
| 12 | namespace ConfigMem { | ||
| 13 | |||
| 14 | enum { | ||
| 15 | KERNEL_VERSIONREVISION = 0x1FF80001, | ||
| 16 | KERNEL_VERSIONMINOR = 0x1FF80002, | ||
| 17 | KERNEL_VERSIONMAJOR = 0x1FF80003, | ||
| 18 | UPDATEFLAG = 0x1FF80004, | ||
| 19 | NSTID = 0x1FF80008, | ||
| 20 | SYSCOREVER = 0x1FF80010, | ||
| 21 | UNITINFO = 0x1FF80014, | ||
| 22 | KERNEL_CTRSDKVERSION = 0x1FF80018, | ||
| 23 | APPMEMTYPE = 0x1FF80030, | ||
| 24 | APPMEMALLOC = 0x1FF80040, | ||
| 25 | FIRM_VERSIONREVISION = 0x1FF80061, | ||
| 26 | FIRM_VERSIONMINOR = 0x1FF80062, | ||
| 27 | FIRM_VERSIONMAJOR = 0x1FF80063, | ||
| 28 | FIRM_SYSCOREVER = 0x1FF80064, | ||
| 29 | FIRM_CTRSDKVERSION = 0x1FF80068, | ||
| 30 | }; | ||
| 31 | |||
| 32 | template <typename T> | ||
| 33 | inline void Read(T &var, const u32 addr) { | ||
| 34 | switch (addr) { | ||
| 35 | |||
| 36 | // Bit 0 set for Retail | ||
| 37 | case UNITINFO: | ||
| 38 | var = 0x00000001; | ||
| 39 | break; | ||
| 40 | |||
| 41 | // Set app memory size to 64MB? | ||
| 42 | case APPMEMALLOC: | ||
| 43 | var = 0x04000000; | ||
| 44 | break; | ||
| 45 | |||
| 46 | // Unknown - normally set to: 0x08000000 - (APPMEMALLOC + *0x1FF80048) | ||
| 47 | // (Total FCRAM size - APPMEMALLOC - *0x1FF80048) | ||
| 48 | case 0x1FF80044: | ||
| 49 | var = 0x08000000 - (0x04000000 + 0x1400000); | ||
| 50 | break; | ||
| 51 | |||
| 52 | // Unknown - normally set to: 0x1400000 (20MB) | ||
| 53 | case 0x1FF80048: | ||
| 54 | var = 0x1400000; | ||
| 55 | break; | ||
| 56 | |||
| 57 | default: | ||
| 58 | ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 63 | |||
| 64 | template void Read<u64>(u64 &var, const u32 addr); | ||
| 65 | template void Read<u32>(u32 &var, const u32 addr); | ||
| 66 | template void Read<u16>(u16 &var, const u32 addr); | ||
| 67 | template void Read<u8>(u8 &var, const u32 addr); | ||
| 68 | |||
| 69 | |||
| 70 | } // namespace | ||