MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / cdvdCreateNewNVM

Function cdvdCreateNewNVM

pcsx2/CDVD/CDVD.cpp:136–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static void cdvdCreateNewNVM()
137{
138 std::memset(s_nvram, 0, sizeof(s_nvram));
139
140 // Write NVM ILink area with dummy data (Age of Empires 2)
141 // Also write language data defaulting to English (Guitar Hero 2)
142 // Also write PStwo region defaults
143 const NVMLayout* nvmLayout = getNvmLayout();
144 if (((BiosVersion >> 8) == 2) && ((BiosVersion & 0xff) != 10)) // bios >= 200, except of 0x210 for PSX2 DESR
145 std::memcpy(&s_nvram[nvmLayout->regparams], PStwoRegionDefaults[BiosRegion], 12);
146
147 static constexpr u8 ILinkID_Data[8] = {0x00, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0x86};
148 std::memcpy(&s_nvram[nvmLayout->ilinkId], ILinkID_Data, sizeof(ILinkID_Data));
149 if (nvmlayouts[1].biosVer <= BiosVersion)
150 {
151 static constexpr u8 ILinkID_checksum[2] = {0x00, 0x18};
152 std::memcpy(&s_nvram[nvmLayout->ilinkId + 0x08], ILinkID_checksum, sizeof(ILinkID_checksum));
153 }
154
155 // Config sections first 16 bytes are generally blank expect the last byte which is PS1 mode stuff
156 // So let's ignore that and just write the PS2 mode stuff
157 std::memcpy(&s_nvram[nvmLayout->config1 + 0x10], biosLangDefaults[BiosRegion], 16);
158}
159
160static std::string cdvdGetNVRAMPath()
161{

Callers 1

cdvdLoadNVRAMFunction · 0.85

Calls 1

getNvmLayoutFunction · 0.85

Tested by

no test coverage detected