Skip to content

Commit

Permalink
bugfix and readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
sverx committed Feb 2, 2020
1 parent db2b569 commit 7a6287e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ There are actually deinterlacers out there which can display the drop shadows co

You can test your SEGA Master System and SEGA MegaDrive/Genesis (*port A only*) pads, your console PAUSE and RESET keys, and your console ports too. If no key is pressed/held/released in approx 3 seconds, the test will end.

### Paddle Tests

You can test your SEGA Master System (Japanese) Paddle(s) in either port. If the knob isn't rotated or paddle key is not pressed/held/released in approx 3 seconds the test will end. PAUSE will also end the test. If paddle wasn't connected when the Test Suite started, you can connect that while in the main menu and press PAUSE to restart it, to have that detected. If two paddles are connected when the Test Suite starts, paddle test will be run immediatelym but it won't be possible to leave the test.

### System Info

You can read some info about your system. In detail:
Expand Down
44 changes: 22 additions & 22 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ void load_menu_assets (void) {

unsigned int filter_paddle(unsigned int value) {
if (some_paddle_connected & 0x01)
value&=~PORT_A_KEY_2;
value&=~(PORT_A_KEY_2|PORT_A_KEY_UP|PORT_A_KEY_DOWN|PORT_A_KEY_LEFT|PORT_A_KEY_RIGHT);
if (some_paddle_connected & 0x02)
value&=~PORT_B_KEY_2;
value&=~(PORT_B_KEY_2|PORT_B_KEY_UP|PORT_B_KEY_DOWN|PORT_B_KEY_LEFT|PORT_B_KEY_RIGHT);
return (value);
}

Expand Down Expand Up @@ -905,7 +905,7 @@ void paddle_test (bool stay_forever) {

SMS_resetPauseRequest(); // there might be a previous pending request
SMS_displayOn();
while(should_stay) {
while(stay_forever || should_stay) {
SMS_waitForVBlank();
SMS_copySpritestoSAT();

Expand All @@ -928,36 +928,36 @@ void paddle_test (bool stay_forever) {

// press key
if (kp & PORT_A_KEY_1)
SMS_setBGPaletteColor(COLOR_PADDLE_A_1,HILIT_COLOR);
SMS_setBGPaletteColor(COLOR_PADDLE_A_1,HILIT_COLOR), stay_cnt=0;
if (kp & PORT_B_KEY_1)
SMS_setBGPaletteColor(COLOR_PADDLE_B_1,HILIT_COLOR);
SMS_setBGPaletteColor(COLOR_PADDLE_B_1,HILIT_COLOR), stay_cnt=0;

// release key
if (kr & PORT_A_KEY_1)
SMS_setBGPaletteColor(COLOR_PADDLE_A_1,BLACK);
SMS_setBGPaletteColor(COLOR_PADDLE_A_1,BLACK), stay_cnt=0;
if (kr & PORT_B_KEY_1)
SMS_setBGPaletteColor(COLOR_PADDLE_B_1,BLACK);
SMS_setBGPaletteColor(COLOR_PADDLE_B_1,BLACK), stay_cnt=0;

// moving paddle 1
if ((MAX(p1,old_p1)-MIN(p1,old_p1))>PADDLE_THRESHOLD) {
SMS_setBGPaletteColor(COLOR_PADDLE_A,HILIT_COLOR);
stay_cnt=0;
} else
if ((MAX(p1,old_p1)-MIN(p1,old_p1))>PADDLE_THRESHOLD)
SMS_setBGPaletteColor(COLOR_PADDLE_A,HILIT_COLOR), stay_cnt=0;
else
SMS_setBGPaletteColor(COLOR_PADDLE_A,BLACK);

// moving paddle 2
if ((MAX(p2,old_p2)-MIN(p2,old_p2))>PADDLE_THRESHOLD) {
SMS_setBGPaletteColor(COLOR_PADDLE_B,HILIT_COLOR);
stay_cnt=0;
} else
SMS_setBGPaletteColor(COLOR_PADDLE_B,BLACK);
if ((MAX(p2,old_p2)-MIN(p2,old_p2))>PADDLE_THRESHOLD)
SMS_setBGPaletteColor(COLOR_PADDLE_B,HILIT_COLOR), stay_cnt=0;
else
SMS_setBGPaletteColor(COLOR_PADDLE_B,BLACK);

if ((((kp | kr) & ~CARTRIDGE_SLOT)==0) && ((filter_paddle(SMS_getKeysHeld()) & ~CARTRIDGE_SLOT)==0) && (!stay_forever)) {
if (++stay_cnt>APPROX_3_SECS)
should_stay=false;
} else
stay_cnt=0;

// if no action for 3 seconds, leave
if (++stay_cnt>APPROX_3_SECS)
should_stay=false;

// if PAUSE pressed, leave
if (SMS_queryPauseRequested())
SMS_resetPauseRequest(), should_stay=false;

}
}

Expand Down

0 comments on commit 7a6287e

Please sign in to comment.