Log the screen layout that's being switched to

This commit is contained in:
Jesse Talavera 2024-05-28 17:35:10 -04:00
parent 019b7ae7da
commit 6120e4f247
3 changed files with 54 additions and 1 deletions

View File

@ -402,3 +402,48 @@ auto fmt::formatter<Platform::FileMode>::format(Platform::FileMode mode, format_
return formatter<std::vector<std::string_view>>::format(bits, ctx);
}
auto fmt::formatter<MelonDsDs::ScreenLayout>::format(MelonDsDs::ScreenLayout layout, format_context& ctx) const -> decltype(ctx.out()) {
string_view name;
switch (layout) {
case MelonDsDs::ScreenLayout::TopBottom:
name = "TopBottom";
break;
case MelonDsDs::ScreenLayout::BottomTop:
name = "BottomTop";
break;
case MelonDsDs::ScreenLayout::LeftRight:
name = "LeftRight";
break;
case MelonDsDs::ScreenLayout::RightLeft:
name = "RightLeft";
break;
case MelonDsDs::ScreenLayout::TopOnly:
name = "TopOnly";
break;
case MelonDsDs::ScreenLayout::BottomOnly:
name = "BottomOnly";
break;
case MelonDsDs::ScreenLayout::HybridTop:
name = "HybridTop";
break;
case MelonDsDs::ScreenLayout::HybridBottom:
name = "HybridBottom";
break;
case MelonDsDs::ScreenLayout::TurnLeft:
name = "TurnLeft";
break;
case MelonDsDs::ScreenLayout::TurnRight:
name = "TurnRight";
break;
case MelonDsDs::ScreenLayout::UpsideDown:
name = "UpsideDown";
break;
default:
name = "<unknown>";
break;
}
return formatter<string_view>::format(name, ctx);
}

View File

@ -34,6 +34,7 @@
#include <gfx/scaler/scaler.h>
#include "config/config.hpp"
#include "config/types.hpp"
namespace fmt {
template<>
@ -90,6 +91,11 @@ namespace fmt {
struct formatter<melonDS::Platform::FileMode> : formatter<std::vector<std::string_view>> {
auto format(melonDS::Platform::FileMode mode, format_context& ctx) const -> decltype(ctx.out());
};
template<>
struct formatter<MelonDsDs::ScreenLayout> : formatter<std::string_view> {
auto format(MelonDsDs::ScreenLayout layout, format_context& ctx) const -> decltype(ctx.out());
};
}
#endif //MELONDS_DS_FORMAT_HPP

View File

@ -24,6 +24,7 @@
#include "config/config.hpp"
#include "environment.hpp"
#include "format.hpp"
#include "libretro.hpp"
#include "math.hpp"
#include "screenlayout.hpp"
@ -132,7 +133,8 @@ void MelonDsDs::HandleInput(melonDS::NDS& nds, InputState& inputState, ScreenLay
if (inputState.CycleLayoutPressed()) {
// If the user wants to change the active screen layout...
screenLayout.NextLayout(); // ...update the screen layout to the next in the sequence.
retro::debug("Switched to screen layout {} of {}", screenLayout.LayoutIndex() + 1, screenLayout.NumberOfLayouts());
retro::debug("Switched to screen layout {} of {} ({})", screenLayout.LayoutIndex() + 1, screenLayout.NumberOfLayouts(), screenLayout.Layout());
// Add 1 to the index because we present the layout index as 1-based to the user.
}
}