mirror of https://github.com/PCSX2/pcsx2.git
recording: Added some more useful logs and cleaned up some TODOs
This commit is contained in:
parent
eb7030cf12
commit
c12c6ed149
|
@ -178,9 +178,11 @@ void InputRecording::Play(wxString FileName, bool fromSaveState)
|
|||
recordingConLog(L"[REC]: Information on CD in Movie file is Different.\n");
|
||||
}
|
||||
}
|
||||
// TODO - probably output more informatiion on it
|
||||
state = REPLAY;
|
||||
recordingConLog(wxString::Format(L"[REC]: Replaying movie - [%s]\n", FileName));
|
||||
recordingConLog(wxString::Format(L"Recording File Version: %d\n", InputRecordingData.getHeader().version));
|
||||
recordingConLog(wxString::Format(L"Associated Game Name / ISO Filename: %s\n", InputRecordingData.getHeader().gameName));
|
||||
recordingConLog(wxString::Format(L"Author: %s\n", InputRecordingData.getHeader().author));
|
||||
recordingConLog(wxString::Format(L"MaxFrame: %d\n", InputRecordingData.getMaxFrame()));
|
||||
recordingConLog(wxString::Format(L"UndoCount: %d\n", InputRecordingData.getUndoCount()));
|
||||
}
|
||||
|
|
|
@ -49,12 +49,16 @@ bool InputRecordingFile::Open(const wxString path, bool fNewOpen, bool fromSaveS
|
|||
}
|
||||
filename = path;
|
||||
|
||||
// TODO - from power on its fine
|
||||
// problems seem to be be based in how we are saving the savestate
|
||||
if (fNewOpen) {
|
||||
if (fromSaveState) {
|
||||
savestate.fromSavestate = true;
|
||||
// TODO - Check if existing, if so rename
|
||||
// TODO - Return save-state data back into the movie file eventually.
|
||||
FILE* ssFileCheck = wxFopen(path + "_SaveState.p2s", "r");
|
||||
if (ssFileCheck != NULL) {
|
||||
wxCopyFile(path + "_SaveState.p2s", path + "_SaveState.p2s.bak", false);
|
||||
}
|
||||
fclose(ssFileCheck);
|
||||
StateCopy_SaveToFile(path + "_SaveState.p2s");
|
||||
}
|
||||
else {
|
||||
|
@ -66,7 +70,8 @@ bool InputRecordingFile::Open(const wxString path, bool fNewOpen, bool fromSaveS
|
|||
|
||||
bool InputRecordingFile::Close()
|
||||
{
|
||||
if (recordingFile == NULL)return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
writeHeader();
|
||||
writeSaveState();
|
||||
fclose(recordingFile);
|
||||
|
@ -77,11 +82,12 @@ bool InputRecordingFile::Close()
|
|||
|
||||
bool InputRecordingFile::writeSaveState() {
|
||||
if (recordingFile == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(recordingFile, SEEKPOINT_SAVESTATE, SEEK_SET);
|
||||
if (fwrite(&savestate.fromSavestate, sizeof(bool), 1, recordingFile) != 1) return false;
|
||||
if (fwrite(&savestate.fromSavestate, sizeof(bool), 1, recordingFile) != 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -90,15 +96,16 @@ bool InputRecordingFile::writeSaveState() {
|
|||
//----------------------------------
|
||||
bool InputRecordingFile::writeKeyBuf(const uint & frame, const uint port, const uint bufIndex, const u8 & buf)
|
||||
{
|
||||
if (recordingFile == NULL)return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
|
||||
long seek = _getBlockSeekPoint(frame) + BLOCK_HEADER_SIZE + 18 * port + bufIndex;
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0){
|
||||
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0)
|
||||
return false;
|
||||
}
|
||||
if (fwrite(&buf, 1, 1, recordingFile) != 1) {
|
||||
if (fwrite(&buf, 1, 1, recordingFile) != 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
fflush(recordingFile);
|
||||
return true;
|
||||
}
|
||||
|
@ -108,15 +115,15 @@ bool InputRecordingFile::writeKeyBuf(const uint & frame, const uint port, const
|
|||
//----------------------------------
|
||||
bool InputRecordingFile::readKeyBuf(u8 & result,const uint & frame, const uint port, const uint bufIndex)
|
||||
{
|
||||
if (recordingFile == NULL)return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
|
||||
long seek = _getBlockSeekPoint(frame) + BLOCK_HEADER_SIZE + 18 * port + bufIndex;
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0) {
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0)
|
||||
return false;
|
||||
}
|
||||
if (fread(&result, 1, 1, recordingFile) != 1) {
|
||||
if (fread(&result, 1, 1, recordingFile) != 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -126,16 +133,22 @@ bool InputRecordingFile::readKeyBuf(u8 & result,const uint & frame, const uint p
|
|||
void InputRecordingFile::getPadData(PadData & result, unsigned long frame)
|
||||
{
|
||||
result.fExistKey = false;
|
||||
if (recordingFile == NULL)return;
|
||||
if (recordingFile == NULL)
|
||||
return;
|
||||
|
||||
long seek = _getBlockSeekPoint(frame) + BLOCK_HEADER_SIZE;
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0)return;
|
||||
if (fread(result.buf, 1, BLOCK_DATA_SIZE, recordingFile) == 0)return;
|
||||
if (fseek(recordingFile, seek, SEEK_SET) != 0)
|
||||
return;
|
||||
if (fread(result.buf, 1, BLOCK_DATA_SIZE, recordingFile) == 0)
|
||||
return;
|
||||
|
||||
result.fExistKey = true;
|
||||
}
|
||||
|
||||
bool InputRecordingFile::DeletePadData(unsigned long frame)
|
||||
{
|
||||
if (recordingFile == NULL)return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
|
||||
for (unsigned long i = frame; i < MaxFrame - 1; i++)
|
||||
{
|
||||
|
@ -157,8 +170,10 @@ bool InputRecordingFile::DeletePadData(unsigned long frame)
|
|||
|
||||
bool InputRecordingFile::InsertPadData(unsigned long frame, const PadData& key)
|
||||
{
|
||||
if (recordingFile == NULL)return false;
|
||||
if (!key.fExistKey)return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
if (!key.fExistKey)
|
||||
return false;
|
||||
|
||||
for (unsigned long i = MaxFrame - 1; i >= frame; i--)
|
||||
{
|
||||
|
@ -185,12 +200,15 @@ bool InputRecordingFile::InsertPadData(unsigned long frame, const PadData& key)
|
|||
|
||||
bool InputRecordingFile::UpdatePadData(unsigned long frame, const PadData& key)
|
||||
{
|
||||
if (recordingFile == NULL) return false;
|
||||
if (!key.fExistKey) return false;
|
||||
if (recordingFile == NULL)
|
||||
return false;
|
||||
if (!key.fExistKey)
|
||||
return false;
|
||||
|
||||
long seek = _getBlockSeekPoint(frame) + BLOCK_HEADER_SIZE;
|
||||
fseek(recordingFile, seek, SEEK_SET);
|
||||
if (fwrite(key.buf, 1, BLOCK_DATA_SIZE, recordingFile) == 0) return false;
|
||||
if (fwrite(key.buf, 1, BLOCK_DATA_SIZE, recordingFile) == 0)
|
||||
return false;
|
||||
|
||||
fflush(recordingFile);
|
||||
return true;
|
||||
|
@ -251,7 +269,8 @@ void InputRecordingFile::updateFrameMax(unsigned long frame)
|
|||
void InputRecordingFile::addUndoCount()
|
||||
{
|
||||
UndoCount++;
|
||||
if (recordingFile == NULL)return;
|
||||
if (recordingFile == NULL)
|
||||
return;
|
||||
fseek(recordingFile, SEEKPOINT_UNDOCOUNT, SEEK_SET);
|
||||
fwrite(&UndoCount, 4, 1, recordingFile);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ wxBEGIN_EVENT_TABLE(VirtualPad, wxFrame)
|
|||
EVT_CLOSE(VirtualPad::OnClose)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
// TODO - Problems:
|
||||
// Controller inputs dont update UI, add a refresh method or something
|
||||
// TODO - Problems / Potential improvements:
|
||||
// - The UI doesn't update to manual controller inputs and actually overrides the controller when opened (easily noticable with analog stick)
|
||||
// - This is less than ideal, but it's going to take a rather large / focused refactor, in it's current state the virtual pad does what it needs to do (precise inputs, frame by frame)
|
||||
VirtualPad::VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, int controllerPort, const wxPoint& pos, const wxSize& size, long style) :
|
||||
wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
|
||||
{
|
||||
|
@ -56,7 +57,7 @@ VirtualPad::VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, i
|
|||
// Initialize class members
|
||||
VirtualPad::controllerPort = controllerPort;
|
||||
|
||||
// NOTE: Order MATTERS, these match the map-key array defined in PadData.h
|
||||
// NOTE: Order MATTERS, these match enum defined in PadData.h
|
||||
wxToggleButton* tempButtons[16] = {
|
||||
// Pressure sensitive buttons
|
||||
upButton, rightButton, leftButton, downButton,
|
||||
|
@ -67,6 +68,7 @@ VirtualPad::VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, i
|
|||
selectButton, startButton};
|
||||
std::copy(std::begin(tempButtons), std::end(tempButtons), std::begin(buttons));
|
||||
|
||||
// NOTE: Order MATTERS, these match enum defined in PadData.h
|
||||
wxSpinCtrl* tempPressureButtons[16] = {
|
||||
// Pressure sensitive buttons
|
||||
upButtonPressure, rightButtonPressure, leftButtonPressure, downButtonPressure,
|
||||
|
@ -74,9 +76,11 @@ VirtualPad::VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, i
|
|||
l1ButtonPressure, l2ButtonPressure, r1ButtonPressure, r2ButtonPressure};
|
||||
std::copy(std::begin(tempPressureButtons), std::end(tempPressureButtons), std::begin(buttonsPressure));
|
||||
|
||||
// NOTE: Order MATTERS, these match enum defined in PadData.h
|
||||
wxSlider* tempAnalogSliders[4] = { leftAnalogXVal, leftAnalogYVal, rightAnalogXVal, rightAnalogYVal };
|
||||
std::copy(std::begin(tempAnalogSliders), std::end(tempAnalogSliders), std::begin(analogSliders));
|
||||
|
||||
// NOTE: Order MATTERS, these match enum defined in PadData.h
|
||||
wxSpinCtrl* tempAnalogVals[4] = { leftAnalogXValPrecise, leftAnalogYValPrecise, rightAnalogXValPrecise, rightAnalogYValPrecise };
|
||||
std::copy(std::begin(tempAnalogVals), std::end(tempAnalogVals), std::begin(analogVals));
|
||||
|
||||
|
|
|
@ -800,7 +800,6 @@ void MainEmuFrame::Menu_Recording_New_Click(wxCommandEvent &event)
|
|||
// From Power-On
|
||||
else if (NewRecordingFrame->getFrom() == 1)
|
||||
{
|
||||
// TODO extensively test this
|
||||
g_InputRecording.Create(NewRecordingFrame->getFile(), false, NewRecordingFrame->getAuthor());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue