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
7 changes: 5 additions & 2 deletions src/rcheevos/rc_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,15 @@ static int rc_condset_has_hittargets(const rc_condset_t* condset)

/* pause and reset conditions may have hittargets and won't be classified as hittarget conditions.
* measured conditions may also have hittargets.
* other conditions may have hittarget conditions in an AndNext/OrNext chain.
* basically, check everything other than hittarget (explicitly known) and indirect (cannot have).
*/
if (condset->num_pause_conditions || condset->num_reset_conditions || condset->num_measured_conditions) {
if (condset->num_pause_conditions || condset->num_reset_conditions || condset->num_measured_conditions || condset->num_other_conditions) {
const rc_condition_t* condition = rc_condset_get_conditions((rc_condset_t*)condset);
/* ASSERT: don't need to add num_hittarget_conditions because it must be 0 per earlier check */
const rc_condition_t* stop = condition + condset->num_pause_conditions
+ condset->num_reset_conditions + condset->num_measured_conditions;
+ condset->num_reset_conditions + condset->num_measured_conditions
+ condset->num_other_conditions;
for (; condition < stop; ++condition) {
if (condition->required_hits)
return 1;
Expand Down
7 changes: 4 additions & 3 deletions test/rcheevos/test_rc_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,15 @@ void test_redundant_conditions() {
TEST_PARAMS2(test_validate_trigger, "0xH0001=7.1._R:0xH0000=0_T:0xH0000=1", "");
}

void test_redundant_hitcounts() {
void test_resetif_hittargets() {
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0", "Condition 1: No captured hits to reset");
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0_0xH0001=1.1.", "");
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0_M:0xH0001=1.1.", "");
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0.1._0xH0001=1.1.", "Condition 1: Hit target of 1 is redundant on ResetIf");
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0.2._0xH0001=1.1.", "");

TEST_PARAMS2(test_validate_trigger, "I:0xG1234&536870911_R:0xG0000=4294967294_0xH2222=1.1.", "");
TEST_PARAMS2(test_validate_trigger, "N:0xH0001=4.1._T:0xH0001=5_R:0xH0001<2", "");
TEST_PARAMS2(test_validate_trigger, "R:0xH0000!=0S0xH0001=1.1.S0xH0002=1", "");
}

void test_variable_operand_errors() {
Expand Down Expand Up @@ -490,7 +491,7 @@ void test_rc_validate(void) {
test_dependent_conditions();
test_conflicting_conditions();
test_redundant_conditions();
test_redundant_hitcounts();
test_resetif_hittargets();
test_variable_operand_errors();
test_remember_recall_errors();
test_error_priorities();
Expand Down
Loading