config_mem.cpp 1.9 KB

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