Skip to content

Commit

Permalink
Improve Eval Screen Screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Nov 15, 2018
1 parent ae000d7 commit 508f50b
Showing 1 changed file with 40 additions and 22 deletions.
62 changes: 40 additions & 22 deletions src/ScreenEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,30 +763,48 @@ ScreenEvaluation::Input(const InputEventPlus& input)
CodeDetector::EnteredCode(input.GameI.controller,
CODE_SAVE_SCREENSHOT2)) {
PlayerNumber pn = input.pn;
if (!m_bSavedScreenshot[pn] && // only allow one screenshot
PROFILEMAN->IsPersistentProfile(pn)) {
Profile* pProfile = PROFILEMAN->GetProfile(pn);
RString sDir =
PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
RString sFileName =
StepMania::SaveScreenshot(sDir, true, true, "", "");

if (!sFileName.empty()) {
RString sPath = sDir + sFileName;

const HighScore& hs =
m_pStageStats->m_player[pn].m_HighScore;
Screenshot screenshot;
screenshot.sFileName = sFileName;
screenshot.sMD5 =
BinaryToHex(CRYPTMAN->GetMD5ForFile(sPath));
screenshot.highScore = hs;
pProfile->AddScreenshot(screenshot);
bool bHoldingShift =
(INPUTFILTER->IsBeingPressed(
DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) ||
INPUTFILTER->IsBeingPressed(
DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)));
RString sDir;
RString sFileName;
// To save a screenshot to your own profile you must hold shift
// and press the button it saves compressed so you don't end up
// with an inflated profile size
// Otherwise, you can tap away at the screenshot button without holding shift.
if (bHoldingShift && PROFILEMAN->IsPersistentProfile(pn))
{
if (!m_bSavedScreenshot[pn])
{
Profile* pProfile = PROFILEMAN->GetProfile(pn);
sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) +
"Screenshots/";
sFileName =
StepMania::SaveScreenshot(sDir, bHoldingShift, true, "", "");
if (!sFileName.empty()) {
RString sPath = sDir + sFileName;

const HighScore& hs =
m_pStageStats->m_player[pn].m_HighScore;
Screenshot screenshot;
screenshot.sFileName = sFileName;
screenshot.sMD5 =
BinaryToHex(CRYPTMAN->GetMD5ForFile(sPath));
screenshot.highScore = hs;
pProfile->AddScreenshot(screenshot);
}
m_bSavedScreenshot[pn] = true;
}

m_bSavedScreenshot[pn] = true;
return true; // handled
}
else
{
sDir = "Screenshots/";
sFileName =
StepMania::SaveScreenshot(sDir, bHoldingShift, true, "", "");
}
return true; // handled
}
}

Expand Down

0 comments on commit 508f50b

Please sign in to comment.