Added version field to config file.

This commit is contained in:
XMRig 2019-08-17 04:27:37 +07:00
parent fe832f510e
commit ed3a39dc74
6 changed files with 42 additions and 8 deletions

View file

@ -128,7 +128,7 @@ std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, cons
}
void xmrig::CpuConfig::read(const rapidjson::Value &value)
void xmrig::CpuConfig::read(const rapidjson::Value &value, uint32_t version)
{
if (value.IsObject()) {
m_enabled = Json::getBool(value, kEnabled, m_enabled);
@ -148,6 +148,10 @@ void xmrig::CpuConfig::read(const rapidjson::Value &value)
if (!m_threads.read(value)) {
generate();
}
if (version == 0) {
generateArgon2();
}
}
else if (value.IsBool() && value.IsFalse()) {
m_enabled = false;
@ -187,6 +191,16 @@ void xmrig::CpuConfig::generate()
m_threads.move(kRx, cpu->threads(Algorithm::RX_0));
m_threads.move(kRxWOW, cpu->threads(Algorithm::RX_WOW));
# endif
generateArgon2();
}
void xmrig::CpuConfig::generateArgon2()
{
# ifdef XMRIG_ALGO_ARGON2
m_threads.move(kArgon2, Cpu::info()->threads(Algorithm::AR2_CHUKWA));
# endif
}

View file

@ -49,7 +49,7 @@ public:
bool isHwAES() const;
rapidjson::Value toJSON(rapidjson::Document &doc) const;
std::vector<CpuLaunchData> get(const Miner *miner, const Algorithm &algorithm) const;
void read(const rapidjson::Value &value);
void read(const rapidjson::Value &value, uint32_t version);
inline bool isEnabled() const { return m_enabled; }
inline bool isHugePages() const { return m_hugePages; }
@ -61,6 +61,7 @@ public:
private:
void generate();
void generateArgon2();
void setAesMode(const rapidjson::Value &aesMode);
inline void setPriority(int priority) { m_priority = (priority >= -1 && priority <= 5) ? priority : -1; }