Skip to content

Commit

Permalink
remove "stealth" ReplaysLED option
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlee337 committed Sep 25, 2024
1 parent 65cc19e commit c50cb6b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion common/include/CommonConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct NIN_CFG
unsigned char Unused;
unsigned int UseUSB; // 0 for SD, 1 for USB
unsigned int MeleeCodeOptions[MELEE_CODES_MAX_ID + 1]; // IDs are 0 indexed so add 1
unsigned int ReplaysLED; // 0: On, 1: Stealth, 2: None
unsigned int ReplaysLED; // 0: On, 1: Off
} NIN_CFG;

enum ninconfigbitpos
Expand Down
21 changes: 8 additions & 13 deletions kernel/SlippiFileWriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ u32 driveTimer;
// flag for drive led timer
bool driveTimerSet;

// replays LED setting, 0: always on, 1: flash on insert and file end, 2: do not use
u32 replaysLED;
// replays LED setting
bool replaysLED;

void SlippiFileWriterInit()
{
replaysLED = ConfigGetReplaysLED();
if (replaysLED < 2)
replaysLED = ConfigGetReplaysLED() == 0;
if (replaysLED)
{
// Move to a more appropriate place later
// Enables Drive LED
Expand Down Expand Up @@ -192,8 +192,6 @@ void completeFile(FIL *file, SlpGameReader *reader, u32 writtenByteCount)

f_lseek(file, 11);
FRESULT fileWriteResult = f_write(file, &writtenByteCount, 4, &wrote);
if (replaysLED == 1 && fileWriteResult == FR_OK)
flashLED();
f_sync(file);
}

Expand Down Expand Up @@ -241,9 +239,6 @@ static u32 SlippiHandlerThread(void *arg)
memReadPos = SlippiRestoreReadPos();

mounted = true;

if (replaysLED == 1)
flashLED();
}
else
{
Expand Down Expand Up @@ -284,7 +279,7 @@ static u32 SlippiHandlerThread(void *arg)
mdelay(LED_FLASH_TIME_MS - THREAD_CYCLE_TIME_MS - 100); // short enough so we can recover with running out of LED time.
continue;
}
else if (replaysLED == 0)
if (replaysLED)
flashLED();

hasFile = true;
Expand All @@ -294,7 +289,7 @@ static u32 SlippiHandlerThread(void *arg)

if (reader.lastReadResult.bytesRead == 0)
{
if (replaysLED == 0)
if (replaysLED)
flashLED();
continue;
}
Expand All @@ -305,15 +300,15 @@ static u32 SlippiHandlerThread(void *arg)
{
// we can reach this state if the user inserts a usb device during a game.
// skip over and don't write anything until we see the start of a new game
if (replaysLED == 0)
if (replaysLED)
flashLED();
memReadPos += reader.lastReadResult.bytesRead;
continue;
}

UINT wrote;
FRESULT writeResult = f_write(&currentFile, readBuf, reader.lastReadResult.bytesRead, &wrote);
if (replaysLED == 0 && writeResult == FR_OK && wrote > 0)
if (replaysLED && writeResult == FR_OK && wrote > 0)
flashLED();
f_sync(&currentFile);

Expand Down
2 changes: 1 addition & 1 deletion kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ int _main( int argc, char *argv[] )
BootStatus(CONFIG_INIT, s_size, s_cnt);
ConfigInit();

bool slippi_replays_led = ConfigGetConfig(NIN_CFG_SLIPPI_REPLAYS) && ConfigGetReplaysLED() < 2;
bool slippi_replays_led = ConfigGetConfig(NIN_CFG_SLIPPI_REPLAYS) && ConfigGetReplaysLED() == 0;
access_led = ConfigGetConfig(NIN_CFG_LED) && !slippi_replays_led;

if (ConfigGetConfig(NIN_CFG_SLIPPI_PORT_A))
Expand Down
10 changes: 3 additions & 7 deletions loader/source/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ static const char *desc_slippi_replays_led[] = {
" Drive LED will stay lit as long",
" as a replay device is inserted",
" and working properly.",
" [Stealth]",
" Drive LED will flash when a",
" replay device is inserted and",
" when a replay is completed at the",
" end of a game.",
"",
" [No]",
" Drive LED will not be used to",
" indicate replay device status.",
Expand Down Expand Up @@ -1281,7 +1277,7 @@ static void Menu_Settings_InputHandler(MenuCtx *ctx)
break;
case NIN_SLIPPI_REPLAYS_LED:
ncfg->ReplaysLED++;
if (ncfg->ReplaysLED > 2)
if (ncfg->ReplaysLED > 1)
ncfg->ReplaysLED = 0;
break;
case NIN_SLIPPI_PORT_A:
Expand Down Expand Up @@ -1459,7 +1455,7 @@ static void Menu_Settings_Redraw(MenuCtx *ctx)
{
// Slippi Replays LED
PrintFormat(MENU_SIZE, BLACK, MENU_POS_X + SETTINGS_X_START, SettingY(ListLoopIndex),
"%-18s:%-4s", "Slippi Replays LED", ncfg->ReplaysLED == 0 ? "Yes" : ncfg->ReplaysLED == 1 ? "Stealth" : "No");
"%-18s:%-4s", "Slippi Replays LED", ncfg->ReplaysLED == 0 ? "Yes" : "No");
}
ListLoopIndex += 2;

Expand Down

0 comments on commit c50cb6b

Please sign in to comment.