/// <summary> /// Produce <see cref="DeviceStatusFlags"/> containing updated <see cref="ShowTitleScreenFlags"/> for a given <see cref="Device"/>. /// </summary> /// <param name="device">The <see cref="Device"/> whose updated flags are desired.</param> /// <param name="newTitleScreenFlags">New <see cref="ShowTitleScreenFlags"/> to apply to <paramref name="device"/>.</param> /// <returns>A new set of <see cref="DeviceStatusFlags"/> with updated ShowTitleScreenFlags for <paramref name="device"/>.</returns> internal static DeviceStatusFlags UpdateStatusFlags(this Device device, ShowTitleScreenFlags newTitleScreenFlags) { var deviceStatusFlags = device.DeviceStatusFlags & ~DeviceStatusFlags.ShowTitleScreenMask; deviceStatusFlags |= newTitleScreenFlags.ToDeviceStatusFlagsLo(); return(deviceStatusFlags); }
public void DeviceStatusFlagsLo_ToShowTitleScreenFlags_ReturnsExpectedFlags(DeviceStatusFlagsLo statusFlagsLo, ShowTitleScreenFlags expectedShowTitleScreenFlags) { var actualShowTitleScreenFlags = statusFlagsLo.ToShowTitleScreenFlags(); // NOTE: Implementation coerces 'reserved' to 'on power up'. Replicate this here. if (expectedShowTitleScreenFlags == ShowTitleScreenFlags.Reserved) { expectedShowTitleScreenFlags = ShowTitleScreenFlags.OnPowerUp; } Assert.Equal(expectedShowTitleScreenFlags, actualShowTitleScreenFlags); }
/// <summary> /// Places save menu position flags into the more generic <see cref="DeviceStatusFlagsLo"/> bit array. /// </summary> /// <param name="showTitleScreen">The <see cref="ShowTitleScreenFlags"/> to convert.</param> /// <returns>The flags placed in a <see cref="DeviceStatusFlagsLo"/> bit array.</returns> internal static DeviceStatusFlagsLo ToDeviceStatusFlagsLo(this ShowTitleScreenFlags showTitleScreen) { var deviceStatusFlags = (DeviceStatusFlagsLo)((ulong)showTitleScreen << DeviceStatusFlagsLoHelpers.ShowTitleScreenBitsOffset); return(deviceStatusFlags); }
/// <summary> /// Converts <see cref="ShowTitleScreenFlags"/> into a display string. /// </summary> /// <param name="showTitleScreen">The <see cref="ShowTitleScreenFlags"/> value to convert.</param> /// <returns>A display string for the value.</returns> internal static string ToDisplayString(this ShowTitleScreenFlags showTitleScreen) { return(ModeToStringsTable[showTitleScreen]); }