config_mem.cpp 1.9 KB

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