Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ void wait_with_teachy_tv(ProControllerContext& context, uint64_t TEACHY_DELAY){
pbf_press_button(context, BUTTON_A, 200ms, 2300ms);
pbf_move_left_joystick(context, {+1, 0}, 200ms, 2300ms);
pbf_press_button(context, BUTTON_A, 200ms, 300ms);
pbf_press_button(context, BUTTON_A, 200ms, std::chrono::milliseconds(TEACHY_DELAY));
pbf_press_button(context, BUTTON_A, 200ms, 367ms); // the "static fuzz" that adds RNG advances doesn't kick in right away
pbf_wait(context, std::chrono::milliseconds(TEACHY_DELAY));
// close teachy tv -> close bag -> reset start menu cursor position - > close start menu
pbf_press_button(context, BUTTON_B, 200ms, 2300ms);
pbf_press_button(context, BUTTON_B, 200ms, 2300ms);
pbf_move_left_joystick(context, {0, +1}, 200ms, 300ms);
pbf_move_left_joystick(context, {0, +1}, 200ms, 300ms);
pbf_press_button(context, BUTTON_B, 200ms, 300ms);
// total non-teachy delay duration: 13700ms
// total non-teachy delay duration: 14067ms
}


Expand Down Expand Up @@ -384,10 +385,10 @@ void check_timings(
console
);
}
if (SEED_DELAY < 29500){
if (SEED_DELAY < 30000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"The title screen delay cannot be less than 29.5s. Check your seed calibration.",
"The title screen delay cannot be less than 30s. Check your seed delay and calibration.",
console
);
}
Expand All @@ -397,7 +398,7 @@ void check_timings(
if (INGAME_DELAY < 7500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Starters: the in-game delay cannot be less than 7500ms (900 advances). Check your in-game advances and calibration.",
"Starters: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -406,7 +407,7 @@ void check_timings(
if (INGAME_DELAY < 7500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Magikarp: the in-game delay cannot be less than 7500ms (900 advances). Check your in-game advances and calibration.",
"Magikarp: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -417,7 +418,7 @@ void check_timings(
if (INGAME_DELAY < 4500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Hitmonchan/Hitmonlee: the in-game delay cannot be less than 4500ms (540 advances). Check your in-game advances and calibration.",
"Hitmonchan/Hitmonlee: the in-game delay cannot be less than 4500ms (380 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -426,7 +427,7 @@ void check_timings(
if (INGAME_DELAY < 4000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Eevee: the in-game delay cannot be less than 4000ms (480 advances). Check your in-game advances and calibration.",
"Eevee: the in-game delay cannot be less than 4000ms (320 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -435,7 +436,7 @@ void check_timings(
if (INGAME_DELAY < 7500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Lapras: the in-game delay cannot be less than 7500ms (900 advances). Check your in-game advances and calibration.",
"Lapras: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -447,7 +448,7 @@ void check_timings(
if (INGAME_DELAY < 6000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Fossils: the in-game delay cannot be less than 6000ms (720 advances). Check your in-game advances and calibration.",
"Fossils: the in-game delay cannot be less than 6000ms (560 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -462,7 +463,7 @@ void check_timings(
if (INGAME_DELAY < 8500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Game Corner: the in-game delay cannot be less than 8500ms (1020 advances). Check your in-game advances and calibration.",
"Game Corner: the in-game delay cannot be less than 8500ms (860 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -471,7 +472,7 @@ void check_timings(
if (INGAME_DELAY < 12000) {
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Togepi: the in-game delay cannot be less than 12000ms (1440 advances). Check your in-game advances and calibration.",
"Togepi: the in-game delay cannot be less than 12000ms (1280 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -480,7 +481,7 @@ void check_timings(
if (INGAME_DELAY < 5000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Static Encounter: the in-game delay cannot be less than 5000ms (600 advances). Check your in-game advances and calibration.",
"Static Encounter: the in-game delay cannot be less than 5000ms (440 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -489,7 +490,7 @@ void check_timings(
if (INGAME_DELAY < 16000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Snorlax: the in-game delay cannot be less than 16000ms (1920 advances). Check your in-game advances and calibration.",
"Snorlax: the in-game delay cannot be less than 16000ms (1760 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -498,7 +499,7 @@ void check_timings(
if (INGAME_DELAY < 4500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Mewtwo: the in-game delay cannot be less than 4500ms (540 advances). Check your in-game advances and calibration.",
"Mewtwo: the in-game delay cannot be less than 4500ms (380 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -507,7 +508,7 @@ void check_timings(
if (INGAME_DELAY < 4000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Ho-oh: the in-game delay cannot be less than 4000ms (480 advances). Check your in-game advances and calibration.",
"Ho-oh: the in-game delay cannot be less than 4000ms (320 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -516,7 +517,7 @@ void check_timings(
if (INGAME_DELAY < 13000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Hypno: the in-game delay cannot be less than 13000ms (1560 advances). Check your in-game advances and calibration.",
"Hypno: the in-game delay cannot be less than 13000ms (1400 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -525,13 +526,13 @@ void check_timings(
if (!SAFARI_ZONE && INGAME_DELAY < 8500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Sweet Scent: the in-game delay cannot be less than 8500ms (1020 advances). Check your in-game advances and calibration.",
"Sweet Scent: the in-game delay cannot be less than 8500ms (1372 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}else if (SAFARI_ZONE && INGAME_DELAY < 9500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Sweet Scent: the in-game delay cannot be less than 9500ms (1140 advances). Check your in-game advances and calibration.",
"Sweet Scent: the in-game delay cannot be less than 9500ms (1492 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand All @@ -540,69 +541,69 @@ void check_timings(
if (INGAME_DELAY < 6500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Rock Smash: the in-game delay cannot be less than 7000ms (840 advances). Check your in-game advances and calibration.",
"Rock Smash: the in-game delay cannot be less than 7000ms (1192 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
case PokemonFRLG_RngTarget::fishing:
if (INGAME_DELAY < 5500){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Fishing: the in-game delay cannot be less than 5500ms (660 advances). Check your in-game advances and calibration.",
"Fishing: the in-game delay cannot be less than 5500ms (500 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizonecenter:
if (INGAME_DELAY < 30500){
if (INGAME_DELAY < 39000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone Center: in-game delay cannot be less than 30500ms (3660 advances). Check your in-game advances and calibration.",
"Safari Zone Center: in-game delay cannot be less than 39000ms (5032 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizoneeast:
if (INGAME_DELAY < 36500){
if (INGAME_DELAY < 45000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone East: in-game delay cannot be less than 36500ms (4380 advances). Check your in-game advances and calibration.",
"Safari Zone East: in-game delay cannot be less than 45000ms (5752 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizonenorth:
if (INGAME_DELAY < 47500){
if (INGAME_DELAY < 46000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone North: in-game delay cannot be less than 47500ms (5700 advances). Check your in-game advances and calibration.",
"Safari Zone North: in-game delay cannot be less than 46000ms (5872 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizonewest:
if (INGAME_DELAY < 61500){
if (INGAME_DELAY < 60000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone West: in-game delay cannot be less than 52000ms (7380 advances). Check your in-game advances and calibration.",
"Safari Zone West: in-game delay cannot be less than 60000ms (7552 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizonesurf:
if (INGAME_DELAY < 40500){
if (INGAME_DELAY < 46000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone Surfing: in-game delay cannot be less than 40500ms (4860 advances). Check your in-game advances and calibration.",
"Safari Zone Surfing: in-game delay cannot be less than 46000ms (5872 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
return;
case PokemonFRLG_RngTarget::safarizonefish:
if (INGAME_DELAY < 30000){
if (INGAME_DELAY < 35000){
OperationFailedException::fire(
ErrorReport::NO_ERROR_REPORT,
"Safari Zone Fishing: in-game delay cannot be less than 30000ms (3600 advances). Check your in-game advances and calibration.",
"Safari Zone Fishing: in-game delay cannot be less than 35000ms (4040 advances). Check your in-game advances and calibration or pick a new target.",
console
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ GiftRng::GiftRng()
, ADVANCES(
"<b>Advances:</b><br>The total number of RNG advances for your target.",
LockMode::LOCK_WHILE_RUNNING,
10000, 600, 1000000000 // default, min
10000, 520, 1000000000 // default, min, max
)
// , CONTINUE_SCREEN_FRAMES(
// "<b>Continue Screen Frames:</b><br>The number of RNG advances to pass on the continue screen.<br>This should be less than the total number of advances above.",
Expand Down Expand Up @@ -521,7 +521,9 @@ void GiftRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext&

uint64_t CONTINUE_SCREEN_FRAMES = 200;

const int64_t FIXED_SEED_OFFSET = -845; // milliseconds. approximate;
const int64_t FIXED_SEED_OFFSET = -845; // milliseconds, approximate
const int64_t FIXED_ADVANCES_OFFSET = 160; // frames, approximate

double SEED_CALIBRATION_FRAMES = RNG_CALIBRATION.seed_calibration / FRAME_DURATION;
double ADVANCES_CALIBRATION = RNG_CALIBRATION.advances_calibration;
double CONTINUE_SCREEN_ADJUSTMENT = RNG_CALIBRATION.csf_calibration;
Expand Down Expand Up @@ -608,13 +610,13 @@ void GiftRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext&
double seed_bump = SEED_BUMPS[ADVANCE_HISTORY.results.size() % 5];
SEED_CALIBRATION_FRAMES += seed_bump;

double CALIBRATED_ADVANCES = ADVANCES + ADVANCES_CALIBRATION;
double CALIBRATED_ADVANCES = ADVANCES + ADVANCES_CALIBRATION + FIXED_ADVANCES_OFFSET;
double INGAME_ADVANCES = CALIBRATED_ADVANCES - CONTINUE_SCREEN_FRAMES - CONTINUE_SCREEN_ADJUSTMENT;

double TEACHY_ADVANCES = 0;
bool should_use_teachy_tv = USE_TEACHY_TV && (INGAME_ADVANCES > 5000); // don't use Teachy TV for short in-game advance targets
bool should_use_teachy_tv = USE_TEACHY_TV && (INGAME_ADVANCES > 10000); // don't use Teachy TV for short in-game advance targets
if (should_use_teachy_tv) {
TEACHY_ADVANCES = std::floor((INGAME_ADVANCES - 5000) / 313) * 313;
TEACHY_ADVANCES = std::floor((INGAME_ADVANCES - 2500) / 313) * 313;
}

env.log("Seed calibration (frames): " + std::to_string(SEED_CALIBRATION_FRAMES));
Expand All @@ -624,7 +626,7 @@ void GiftRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext&
uint64_t CALIBRATED_SEED_DELAY = uint64_t(std::round(SEED_DELAY + FIXED_SEED_OFFSET + FRAME_DURATION * SEED_CALIBRATION_FRAMES));
uint64_t CONTINUE_SCREEN_DELAY = uint64_t(std::round(FRAME_DURATION * (CONTINUE_SCREEN_FRAMES + CONTINUE_SCREEN_ADJUSTMENT)));
uint64_t TEACHY_DELAY = uint64_t(TEACHY_ADVANCES * FRAME_DURATION / 313);
uint64_t INGAME_DELAY = uint64_t(std::round(FRAME_DURATION * (INGAME_ADVANCES - TEACHY_ADVANCES) / 2)) - (should_use_teachy_tv ? 13700 : 0);
uint64_t INGAME_DELAY = uint64_t(std::round(FRAME_DURATION * (INGAME_ADVANCES - TEACHY_ADVANCES) / 2)) - (should_use_teachy_tv ? 14067 : 0);

env.log("Title screen duration: " + std::to_string(CALIBRATED_SEED_DELAY) + "ms");
env.log("Continue screen duration: " + std::to_string(CONTINUE_SCREEN_DELAY) + "ms");
Expand All @@ -635,6 +637,8 @@ void GiftRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext&
env.log("In-game duration: " + std::to_string(INGAME_DELAY) + "ms");
}

check_timings(env.console, TARGET, CALIBRATED_SEED_DELAY, CONTINUE_SCREEN_DELAY, INGAME_DELAY, false);

env.log("Resetting Game...");
reset_and_perform_blind_sequence(
env.console, context, TARGET,
Expand Down
Loading
Loading