Skip to content

Commit

Permalink
Fix scheduler breaking code entry. Disable report for user error in A…
Browse files Browse the repository at this point in the history
…utoDA. Fix the SwSh LotoFarmer.
  • Loading branch information
Mysticial committed Feb 2, 2025
1 parent ffa195e commit b7e421f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SerialPrograms/Source/CommonFramework/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace PokemonAutomation{
const bool IS_BETA_VERSION = false;
const int PROGRAM_VERSION_MAJOR = 0;
const int PROGRAM_VERSION_MINOR = 51;
const int PROGRAM_VERSION_PATCH = 3;
const int PROGRAM_VERSION_PATCH = 4;

const std::string PROGRAM_VERSION_BASE =
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +
Expand Down
12 changes: 9 additions & 3 deletions SerialPrograms/Source/Controllers/SuperscalarScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ bool SuperscalarScheduler::iterate_schedule(const Cancellable* cancellable){
}

if (m_state_changes.empty()){
// cout << "State is empty." << endl;
m_device_sent_time = m_device_issue_time;
return false;
}
Expand Down Expand Up @@ -149,7 +150,7 @@ void SuperscalarScheduler::issue_wait_for_all(const Cancellable* cancellable){
process_schedule(cancellable);
}
void SuperscalarScheduler::issue_nop(const Cancellable* cancellable, WallDuration delay){
if (delay == WallDuration::zero()){
if (delay <= WallDuration::zero()){
return;
}
if (m_pending_clear.load(std::memory_order_acquire)){
Expand All @@ -160,8 +161,9 @@ void SuperscalarScheduler::issue_nop(const Cancellable* cancellable, WallDuratio
// << ", sent_time = " << std::chrono::duration_cast<Milliseconds>((m_device_sent_time - m_local_start)).count()
// << ", max_free_time = " << std::chrono::duration_cast<Milliseconds>((m_max_free_time - m_local_start)).count()
// << endl;
m_state_changes.insert(m_device_issue_time);
m_device_issue_time += delay;
WallClock next_issue_time = m_device_issue_time + delay;
m_state_changes.insert(next_issue_time);
m_device_issue_time = next_issue_time;
m_max_free_time = std::max(m_max_free_time, m_device_issue_time);
m_local_last_activity = current_time();
process_schedule(cancellable);
Expand Down Expand Up @@ -200,6 +202,10 @@ void SuperscalarScheduler::issue_to_resource(
);
}

delay = std::max(delay, WallDuration::zero());
hold = std::max(hold, WallDuration::zero());
cooldown = std::max(cooldown, WallDuration::zero());

// cout << "issue_to_resource(): delay = " << std::chrono::duration_cast<Milliseconds>(delay).count()
// << ", hold = " << std::chrono::duration_cast<Milliseconds>(hold).count()
// << ", cooldown = " << std::chrono::duration_cast<Milliseconds>(cooldown).count()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ StateMachineAction run_caught_screen(
if (state == StateMachineAction::RESET_RECOVER){
throw_and_log<FatalProgramException>(
stream.logger(),
ErrorReport::SEND_ERROR_REPORT,
ErrorReport::NO_ERROR_REPORT,
"Unable to take " + Pokemon::STRING_POKEMON + ". Did you forget to disable nicknames?",
stream
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void LotoFarmer::program(SingleSwitchProgramEnvironment& env, SwitchControllerCo
home_roll_date_enter_game_autorollback(env.console, context, year);
pbf_mash_button(context, BUTTON_B, 90);

pbf_press_button(context, BUTTON_A, 10, 70);
pbf_press_button(context, BUTTON_A, 10, 90);
pbf_press_button(context, BUTTON_B, 10, 70);
pbf_press_dpad(context, DPAD_DOWN, 10, 5);
pbf_mash_button(context, BUTTON_ZL, 490);
Expand Down

0 comments on commit b7e421f

Please sign in to comment.