Skip to content

Commit

Permalink
Merge pull request #11 from TheGreatRambler/dev
Browse files Browse the repository at this point in the history
v 2.0.1
  • Loading branch information
TheGreatRambler committed Jul 16, 2020
2 parents 59cd669 + f6f449b commit 55e1bd2
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 184 deletions.
58 changes: 0 additions & 58 deletions pc_application/source/dataHandling/applicationMemoryViewer.cpp

This file was deleted.

54 changes: 0 additions & 54 deletions pc_application/source/dataHandling/applicationMemoryViewer.hpp

This file was deleted.

8 changes: 8 additions & 0 deletions pc_application/source/dataHandling/dataProcessing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ class DataProcessing : public wxListCtrl {
void createSavestateHere();
void runFrame(uint8_t forAutoFrame, uint8_t updateFramebuffer, uint8_t includeFramebuffer);

uint8_t canRunAnotherFrame() {
if(currentRunFrame < allPlayers[viewingPlayerIndex]->at(currentSavestateHook)->inputs[viewingBranchIndex]->size() - 1) {
return true;
} else {
return false;
}
}

// TODO cache this
std::shared_ptr<std::vector<std::shared_ptr<ControllerData>>> getInputsList() const;

Expand Down
3 changes: 0 additions & 3 deletions pc_application/source/dataHandling/gameCorruptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,4 @@ END_EVENT_TABLE()

void GameCorruptor::onIdle(wxIdleEvent& event) {
// Check networkInstance for memory info and enable everything
if(!IsBeingDeleted()) {
event.RequestMore();
}
}
25 changes: 18 additions & 7 deletions pc_application/source/ui/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ MainWindow::MainWindow()
bottomUI = std::make_shared<BottomUI>(this, &mainSettings, buttonData, mainSizer, dataProcessingInstance, projectHandler);

autoFrameAdvanceTimer = new wxTimer(this);
Bind(wxEVT_TIMER, &MainWindow::onAutoFrameAdvanceTimer, this);
autoFrameTimerID = autoFrameAdvanceTimer->GetId();

wakeUpIdleTimer = new wxTimer(this);
wakeupIdleTimerID = wakeUpIdleTimer->GetId();

Bind(wxEVT_TIMER, &MainWindow::onTimer, this);

handleNetworkQueues();

Expand All @@ -80,6 +85,9 @@ MainWindow::MainWindow()
// Override the keypress handler
// add_events(Gdk::KEY_PRESS_MASK);
handlePreviousWindowTransform();

// Wake up idle 20 times a second
wakeUpIdleTimer->Start(50);
}

void MainWindow::onStart() {
Expand Down Expand Up @@ -135,8 +143,12 @@ void MainWindow::keyDownHandler(wxKeyEvent& event) {
}
}

void MainWindow::onAutoFrameAdvanceTimer(wxTimerEvent& event) {
sideUI->sendAutoRunData();
void MainWindow::onTimer(wxTimerEvent& event) {
if(event.GetId() == autoFrameTimerID) {
sideUI->sendAutoRunData();
} else if(event.GetId() == wakeupIdleTimerID) {
wxWakeUpIdle();
}
}

void MainWindow::handlePreviousWindowTransform() {
Expand Down Expand Up @@ -167,10 +179,6 @@ void MainWindow::onIdle(wxIdleEvent& event) {
PROCESS_NETWORK_CALLBACKS(networkInstance, RecieveApplicationConnected)
PROCESS_NETWORK_CALLBACKS(networkInstance, RecieveLogging)
PROCESS_NETWORK_CALLBACKS(networkInstance, RecieveMemoryRegion)

if(!IsBeingDeleted()) {
event.RequestMore();
}
}

void MainWindow::handleNetworkQueues() {
Expand Down Expand Up @@ -381,6 +389,9 @@ void MainWindow::onClose(wxCloseEvent& event) {
networkInstance->endNetwork();

delete wxLog::SetActiveTarget(NULL);

wakeUpIdleTimer->Stop();

delete autoFrameAdvanceTimer;

// TODO, this raises errors for some reason
Expand Down
6 changes: 5 additions & 1 deletion pc_application/source/ui/mainWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class MainWindow : public wxFrame {

// For sideUI
wxTimer* autoFrameAdvanceTimer;
wxTimer* wakeUpIdleTimer;

int autoFrameTimerID;
int wakeupIdleTimerID;

// Main logging window
wxLogWindow* logWindow;
Expand Down Expand Up @@ -87,7 +91,7 @@ class MainWindow : public wxFrame {
void onClose(wxCloseEvent& event);
void onIdle(wxIdleEvent& event);

void onAutoFrameAdvanceTimer(wxTimerEvent& event);
void onTimer(wxTimerEvent& event);

bool askForIP();
void handleNetworkQueues();
Expand Down

0 comments on commit 55e1bd2

Please sign in to comment.