Skip to content

Commit dc3cbf9

Browse files
dont actually keep spitting out a billion keys just have the code in the commits
1 parent 1d79bd1 commit dc3cbf9

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

src/Steps.cpp

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -392,42 +392,37 @@ void Steps::CalcEtternaMetadata() {
392392
RString Steps::GenerateChartKey(NoteData& nd, TimingData *td) {
393393
RString o = "X"; // I was thinking of using "C" to indicate chart.. however.. X is cooler... - Mina
394394
vector<int>& nerv = nd.GetNonEmptyRowVector();
395-
396-
for (int i = 0; i < 8; ++i) {
397-
unsigned int numThreads = max(std::thread::hardware_concurrency(), 1u) - i;
398-
std::vector<RString> keyParts;
399-
keyParts.reserve(numThreads);
400395

401-
size_t segmentSize = nerv.size() / numThreads;
402-
std::vector<std::thread> threads;
403-
threads.reserve(numThreads);
396+
unsigned int numThreads = max(std::thread::hardware_concurrency(), 1u);
397+
std::vector<RString> keyParts;
398+
keyParts.reserve(numThreads);
404399

405-
for (unsigned int curThread = 0; curThread < numThreads; curThread++)
406-
{
407-
keyParts.push_back("");
408-
size_t start = segmentSize * curThread;
409-
size_t end = start + segmentSize;
410-
if (curThread + 1 == numThreads)
411-
end = nerv.size();
400+
size_t segmentSize = nerv.size() / numThreads;
401+
std::vector<std::thread> threads;
402+
threads.reserve(numThreads);
412403

413-
threads.push_back(std::thread(&Steps::FillStringWithBPMs, this, start, end, std::ref(nerv), std::ref(nd), td, std::ref(keyParts[curThread])));
414-
}
404+
for (unsigned int curThread = 0; curThread < numThreads; curThread++)
405+
{
406+
keyParts.push_back("");
407+
size_t start = segmentSize * curThread;
408+
size_t end = start + segmentSize;
409+
if (curThread + 1 == numThreads)
410+
end = nerv.size();
415411

416-
for (auto& t : threads)
417-
{
418-
if (t.joinable())
419-
t.join();
420-
}
412+
threads.push_back(std::thread(&Steps::FillStringWithBPMs, this, start, end, std::ref(nerv), std::ref(nd), td, std::ref(keyParts[curThread])));
413+
}
421414

422-
// handle empty charts if they get to here -mina
423-
if (*keyParts.data() == "")
424-
return "";
415+
for (auto& t : threads)
416+
{
417+
if (t.joinable())
418+
t.join();
419+
}
425420

426-
LOG->Trace("Threads Used: %i, *keyparts.data() = %s", numThreads, *keyParts.data());
421+
// handle empty charts if they get to here -mina
422+
if (*keyParts.data() == "")
423+
return "";
427424

428-
if(i == 0)
429-
o.append(BinaryToHex(CryptManager::GetSHA1ForString(*keyParts.data())));
430-
}
425+
o.append(BinaryToHex(CryptManager::GetSHA1ForString(*keyParts.data())));
431426

432427
return o;
433428
}

0 commit comments

Comments
 (0)