* Taseditor: much better method of "Auto-adjust Input due to lag"
* Taseditor: truncated Greenzone is drawn by pale colors, not just white
This commit is contained in:
parent
75047b9e7e
commit
4474dc875d
|
@ -311,9 +311,9 @@ void NewProject()
|
|||
if (DialogBoxParam(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_NEWPROJECT), taseditor_window.hwndTasEditor, NewProjectProc, (LPARAM)¶ms) > 0)
|
||||
{
|
||||
FCEUMOV_CreateCleanMovie();
|
||||
|
||||
// apply selected options
|
||||
SetInputType(currMovieData, params.input_type);
|
||||
ApplyMovieInputConfig();
|
||||
if (params.copy_current_input)
|
||||
// copy input from current snapshot (from history)
|
||||
history.GetCurrentSnapshot().toMovie(currMovieData);
|
||||
|
|
|
@ -58,7 +58,6 @@ void GREENZONE::free()
|
|||
void GREENZONE::reset()
|
||||
{
|
||||
free();
|
||||
lag_history.resize(currMovieData.getNumRecords());
|
||||
}
|
||||
void GREENZONE::update()
|
||||
{
|
||||
|
@ -80,7 +79,7 @@ void GREENZONE::CollectCurrentState()
|
|||
if ((int)savestates.size() < greenZoneCount)
|
||||
savestates.resize(greenZoneCount);
|
||||
if ((int)lag_history.size() < greenZoneCount)
|
||||
lag_history.resize(greenZoneCount);
|
||||
lag_history.resize(greenZoneCount, 0);
|
||||
|
||||
// if frame changed - log savestate
|
||||
storeTasSavestate(currFrameCounter);
|
||||
|
@ -89,22 +88,30 @@ void GREENZONE::CollectCurrentState()
|
|||
{
|
||||
// lagFlag indicates that lag was in previous frame
|
||||
int old_lagFlag = lag_history[currFrameCounter - 1];
|
||||
if (lagFlag)
|
||||
lag_history[currFrameCounter - 1] = 1;
|
||||
else
|
||||
lag_history[currFrameCounter - 1] = 0;
|
||||
int saved_currFrameCounter = currFrameCounter;
|
||||
// Auto-adjust Input due to lag
|
||||
if (taseditor_config.adjust_input_due_to_lag)
|
||||
{
|
||||
if (old_lagFlag && !lagFlag)
|
||||
{
|
||||
// there's no more lag on previous frame - shift input up
|
||||
lag_history.erase(lag_history.begin() + (currFrameCounter - 1));
|
||||
editor.AdjustUp(currFrameCounter - 1);
|
||||
// make sure the Playback cursor always rewinds too
|
||||
if (currFrameCounter == saved_currFrameCounter)
|
||||
InvalidateAndCheck(currFrameCounter - 1);
|
||||
} else if (!old_lagFlag && lagFlag)
|
||||
{
|
||||
// there's new lag on previous frame - shift input down
|
||||
lag_history.insert(lag_history.begin() + (currFrameCounter - 1), 1);
|
||||
editor.AdjustDown(currFrameCounter - 1);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (lagFlag)
|
||||
lag_history[currFrameCounter - 1] = 1;
|
||||
else
|
||||
lag_history[currFrameCounter - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +214,7 @@ void GREENZONE::ClearSavestate(int index)
|
|||
std::vector<uint8> tmp;
|
||||
savestates[index].swap(tmp);
|
||||
}
|
||||
// this function is used by Bookmark Unleash procedure
|
||||
// this function is used by Bookmark Deploy procedure
|
||||
void GREENZONE::WriteSavestate(int frame, std::vector<uint8>& savestate)
|
||||
{
|
||||
if ((int)savestates.size() <= frame)
|
||||
|
@ -233,6 +240,8 @@ void GREENZONE::save(EMUFILE *os, bool really_save)
|
|||
write32le(greenZoneCount, os);
|
||||
// compress and write lag history
|
||||
int len = lag_history.size();
|
||||
if (len > currMovieData.getNumRecords())
|
||||
len = currMovieData.getNumRecords();
|
||||
uLongf comprlen = (len>>9)+12 + len;
|
||||
std::vector<uint8> cbuf(comprlen);
|
||||
compress(&cbuf[0], &comprlen, &lag_history[0], len);
|
||||
|
@ -333,9 +342,9 @@ bool GREENZONE::load(EMUFILE *is, bool really_load)
|
|||
greenZoneCount = size;
|
||||
savestates.resize(greenZoneCount);
|
||||
// read and uncompress lag history
|
||||
lag_history.resize(greenZoneCount);
|
||||
uLongf destlen = currMovieData.getNumRecords();
|
||||
lag_history.resize(destlen, 0);
|
||||
int comprlen;
|
||||
uLongf destlen = greenZoneCount;
|
||||
if (!read32le(&comprlen, is)) goto error;
|
||||
if (comprlen <= 0) goto error;
|
||||
std::vector<uint8> cbuf(comprlen);
|
||||
|
@ -489,7 +498,7 @@ int GREENZONE::GetSize()
|
|||
}
|
||||
bool GREENZONE::GetLagHistoryAtFrame(int frame)
|
||||
{
|
||||
if (frame < greenZoneCount && frame < (int)lag_history.size())
|
||||
if (frame < (int)lag_history.size())
|
||||
return lag_history[frame] != 0;
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -1256,7 +1256,6 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
case CDDS_SUBITEMPREPAINT:
|
||||
cell_x = msg->iSubItem;
|
||||
cell_y = msg->nmcd.dwItemSpec;
|
||||
|
||||
if (cell_x > COLUMN_ICONS)
|
||||
{
|
||||
// text color
|
||||
|
@ -1286,7 +1285,7 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
}
|
||||
} else if (cell_y == currFrameCounter || cell_y == (playback.GetFlashingPauseFrame() - 1))
|
||||
{
|
||||
// current frame
|
||||
// this is current frame
|
||||
if (markers_manager.GetMarker(cell_y) && (drag_mode != DRAG_MODE_MARKER || marker_drag_framenum != cell_y))
|
||||
{
|
||||
msg->clrTextBk = (taseditor_config.bind_markers) ? CUR_BINDMARKED_FRAMENUM_COLOR : CUR_MARKED_FRAMENUM_COLOR;
|
||||
|
@ -1296,14 +1295,13 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
}
|
||||
} else if (markers_manager.GetMarker(cell_y) && (drag_mode != DRAG_MODE_MARKER || marker_drag_framenum != cell_y))
|
||||
{
|
||||
// marked frame
|
||||
// this is marked frame
|
||||
msg->clrTextBk = (taseditor_config.bind_markers) ? BINDMARKED_FRAMENUM_COLOR : MARKED_FRAMENUM_COLOR;
|
||||
} else
|
||||
{
|
||||
if(cell_y < greenzone.GetSize())
|
||||
} else if (cell_y < greenzone.GetSize())
|
||||
{
|
||||
if (!greenzone.SavestateIsEmpty(cell_y))
|
||||
{
|
||||
// the frame is normal Greenzone frame
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = LAG_FRAMENUM_COLOR;
|
||||
else
|
||||
|
@ -1313,12 +1311,26 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY4TH) && !greenzone.SavestateIsEmpty((cell_y & EVERY4TH) + 4))
|
||||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY2ND) && !greenzone.SavestateIsEmpty((cell_y & EVERY2ND) + 2)))
|
||||
{
|
||||
// the frame is in a gap (in Greenzone tail)
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = PALE_LAG_FRAMENUM_COLOR;
|
||||
else
|
||||
msg->clrTextBk = PALE_GREENZONE_FRAMENUM_COLOR;
|
||||
} else msg->clrTextBk = NORMAL_FRAMENUM_COLOR;
|
||||
} else msg->clrTextBk = NORMAL_FRAMENUM_COLOR;
|
||||
} else
|
||||
{
|
||||
// the frame is above Greenzone tail
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_FRAMENUM_COLOR;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_FRAMENUM_COLOR;
|
||||
}
|
||||
} else
|
||||
{
|
||||
// the frame is below Greenzone head
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_FRAMENUM_COLOR;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_FRAMENUM_COLOR;
|
||||
}
|
||||
} else if ((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 0 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 2)
|
||||
{
|
||||
|
@ -1338,12 +1350,13 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
msg->clrTextBk = UNDOHINT_INPUT_COLOR1;
|
||||
} else if (cell_y == currFrameCounter || cell_y == (playback.GetFlashingPauseFrame() - 1))
|
||||
{
|
||||
// current frame
|
||||
// this is current frame
|
||||
msg->clrTextBk = CUR_INPUT_COLOR1;
|
||||
} else if (cell_y < greenzone.GetSize())
|
||||
{
|
||||
if (!greenzone.SavestateIsEmpty(cell_y))
|
||||
{
|
||||
// the frame is normal Greenzone frame
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = LAG_INPUT_COLOR1;
|
||||
else
|
||||
|
@ -1353,12 +1366,27 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY4TH) && !greenzone.SavestateIsEmpty((cell_y & EVERY4TH) + 4))
|
||||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY2ND) && !greenzone.SavestateIsEmpty((cell_y & EVERY2ND) + 2)))
|
||||
{
|
||||
// the frame is in a gap (in Greenzone tail)
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = PALE_LAG_INPUT_COLOR1;
|
||||
else
|
||||
msg->clrTextBk = PALE_GREENZONE_INPUT_COLOR1;
|
||||
} else msg->clrTextBk = NORMAL_INPUT_COLOR1;
|
||||
} else msg->clrTextBk = NORMAL_INPUT_COLOR1;
|
||||
} else
|
||||
{
|
||||
// the frame is above Greenzone tail
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_INPUT_COLOR1;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_INPUT_COLOR1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
// the frame is below Greenzone head
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_INPUT_COLOR1;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_INPUT_COLOR1;
|
||||
}
|
||||
} else if ((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 1 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 3)
|
||||
{
|
||||
// pad 2 or 4
|
||||
|
@ -1377,12 +1405,13 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
msg->clrTextBk = UNDOHINT_INPUT_COLOR2;
|
||||
} else if (cell_y == currFrameCounter || cell_y == (playback.GetFlashingPauseFrame() - 1))
|
||||
{
|
||||
// current frame
|
||||
// this is current frame
|
||||
msg->clrTextBk = CUR_INPUT_COLOR2;
|
||||
} else if (cell_y < greenzone.GetSize())
|
||||
{
|
||||
if (!greenzone.SavestateIsEmpty(cell_y))
|
||||
{
|
||||
// the frame is normal Greenzone frame
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = LAG_INPUT_COLOR2;
|
||||
else
|
||||
|
@ -1392,12 +1421,27 @@ LONG PIANO_ROLL::CustomDraw(NMLVCUSTOMDRAW* msg)
|
|||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY4TH) && !greenzone.SavestateIsEmpty((cell_y & EVERY4TH) + 4))
|
||||
|| (!greenzone.SavestateIsEmpty(cell_y & EVERY2ND) && !greenzone.SavestateIsEmpty((cell_y & EVERY2ND) + 2)))
|
||||
{
|
||||
// the frame is in a gap (in Greenzone tail)
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = PALE_LAG_INPUT_COLOR2;
|
||||
else
|
||||
msg->clrTextBk = PALE_GREENZONE_INPUT_COLOR2;
|
||||
} else msg->clrTextBk = NORMAL_INPUT_COLOR2;
|
||||
} else msg->clrTextBk = NORMAL_INPUT_COLOR2;
|
||||
} else
|
||||
{
|
||||
// the frame is above Greenzone tail
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_INPUT_COLOR2;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_INPUT_COLOR2;
|
||||
}
|
||||
} else
|
||||
{
|
||||
// the frame is below Greenzone head
|
||||
if (greenzone.GetLagHistoryAtFrame(cell_y))
|
||||
msg->clrTextBk = VERY_PALE_LAG_INPUT_COLOR2;
|
||||
else
|
||||
msg->clrTextBk = VERY_PALE_GREENZONE_INPUT_COLOR2;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -112,6 +112,10 @@ enum DRAG_MODES
|
|||
#define PALE_GREENZONE_INPUT_COLOR1 0xD3F9D2
|
||||
#define PALE_GREENZONE_INPUT_COLOR2 0xBAEBBA
|
||||
|
||||
#define VERY_PALE_GREENZONE_FRAMENUM_COLOR 0xF2FFF2
|
||||
#define VERY_PALE_GREENZONE_INPUT_COLOR1 0xE9FCE9
|
||||
#define VERY_PALE_GREENZONE_INPUT_COLOR2 0xDDF5DD
|
||||
|
||||
#define LAG_FRAMENUM_COLOR 0xDDDCFF
|
||||
#define LAG_INPUT_COLOR1 0xD2D0F0
|
||||
#define LAG_INPUT_COLOR2 0xC9C6E8
|
||||
|
@ -120,6 +124,10 @@ enum DRAG_MODES
|
|||
#define PALE_LAG_INPUT_COLOR1 0xDADAF4
|
||||
#define PALE_LAG_INPUT_COLOR2 0xCFCEEA
|
||||
|
||||
#define VERY_PALE_LAG_FRAMENUM_COLOR 0xF1F1FF
|
||||
#define VERY_PALE_LAG_INPUT_COLOR1 0xEDEDFA
|
||||
#define VERY_PALE_LAG_INPUT_COLOR2 0xE7E7F5
|
||||
|
||||
#define CUR_FRAMENUM_COLOR 0xFCF1CE
|
||||
#define CUR_INPUT_COLOR1 0xF8EBB6
|
||||
#define CUR_INPUT_COLOR2 0xE6DDA5
|
||||
|
|
Loading…
Reference in New Issue