Compare commits

...

30 Commits

Author SHA1 Message Date
KamFretoZ
ffe8d16df4 DiscordRPC: Add game icon support. 2024-08-21 12:28:56 -04:00
PCSX2 Bot
31b5672870 Qt: Update Base Translation 2024-08-20 10:11:20 +02:00
Florin9doi
777fc444ae USB: Rename singstar to usb_mic 2024-08-20 10:09:21 +02:00
Florin9doi
cd5c961dc4 USB: Konami ON-SAY microphone emulation 2024-08-20 10:09:21 +02:00
Florin9doi
c2ea8c4eab USB: Audio support for EyeToy 2024-08-20 10:09:21 +02:00
Florin9doi
d6507a945b USB: Merge Singstar and Logitech mics in a single device with 2 subtypes 2024-08-20 10:09:21 +02:00
PCSX2 Bot
f1abee5d0b Qt: Update Base Translation 2024-08-19 09:15:02 +02:00
Jordan
e4dccc237c Misc: Minor cleanup. (#11717)
Changes video max bitrate to 200,000kbps default audio from 160kbps to 192kbps and adds a missing name I forgot to add previously.
2024-08-19 09:14:27 +02:00
KamFretoZ
92d8c740d4 Qt: Fix a couple of theme switching glitches
Backport from: 6f9e8efee5
2024-08-19 08:54:35 +02:00
KamFretoZ
b6eddade00 Qt: Slightly increase game list title size 2024-08-19 08:54:35 +02:00
KamFretoZ
04fdd09d1e ImGuiFullscreen: Display checkmark on right of choice dialog
Backport from: f5815f3183
2024-08-19 08:54:35 +02:00
KamFretoZ
69574aecc6 ImGuiFullscreen: Fix choice popup selected drawing over border
Backport from 05f9f33ec6
2024-08-19 08:54:35 +02:00
KamFretoZ
c72d98d4cd FullscreenUI: Fix popup close resetting window scroll
Backport from 13a37418e6
2024-08-19 08:54:35 +02:00
Florin9doi
4f405adea9 USB: Store unique disk images for MSD and PictureParadise 2024-08-18 19:29:09 +02:00
Florin9doi
5217ec375d USB: Fix Konami Capture Eye assert 2024-08-18 19:27:48 +02:00
JordanTheToaster
10b264b9ec 3rdparty/imgui: Disable the nav menu
Courtesy to Fobes for figuring this out because I was not getting anywhere.
2024-08-16 11:27:24 -04:00
JordanTheToaster
dc741e95bd 3rdparty/imgui: General cleanup
Clean up and replacing obsolete functions.
2024-08-16 11:27:24 -04:00
PCSX2 Bot
a1ca0a9a02 Qt: Update Base Translation 2024-08-15 19:14:14 +02:00
lightningterror
c076c50b68 GS/DX11: Fix feedback write 1 null pointer crash.
We were using the wrong texture as the source, should be dTex when copying.
2024-08-15 10:26:27 +02:00
lightningterror
c688db8f08 GS/HW: Rename blend second pass to blend multi pass.
Easier if I want to add more passes.
2024-08-14 12:35:52 +02:00
PCSX2 Bot
469053de9b Qt: Update Base Translation 2024-08-13 19:42:38 +02:00
squidbus
185b85f86a Config: Use directory containing bundle as AppRoot on macOS. 2024-08-12 22:50:49 -04:00
PCSX2 Bot
11096a520e PAD: Update to latest controller database. 2024-08-12 19:01:26 -04:00
Florin9doi
07fd035aa2 USB: Set actual_length value for Get HID descriptor 2024-08-12 19:01:08 -04:00
seta-san
6bedcd768f Qt: Update Trilinear Filtering Description 2024-08-12 19:00:28 -04:00
weirdbeardgame
0c949db506 CMake: Added PACKAGE_MODE option
Set paths, add check in SetResourcesDir
2024-08-12 11:33:02 -04:00
PCSX2 Bot
4c5253c0f5 Qt: Update Base Translation 2024-08-11 07:46:00 +02:00
Mrlinkwii
325133e54c GameDB: add missing serial 2024-08-11 00:50:33 +02:00
JordanTheToaster
4113ac574d GameDB: ATV Offroad Fury 2 Fixes
Adds bilinear upscale nearest to fix garbage textures.
2024-08-11 00:47:48 +02:00
JordanTheToaster
2d6c687913 GSTextureCache: Extend Bilinear Upscale to dirty depth 2024-08-11 00:47:48 +02:00
43 changed files with 2180 additions and 1859 deletions

1
.gitignore vendored
View File

@@ -119,3 +119,4 @@ oprofile_data/
CMakeSettings.json
/ci-artifacts/
/out/
/.cache/

View File

@@ -28,7 +28,7 @@
//#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87+ disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This is automatically done by IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
//---- Disable all of Dear ImGui or don't implement standard windows/tools.

View File

@@ -1357,8 +1357,8 @@ typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitAr
#define ImGuiKey_NavKeyboardTweakFast ImGuiMod_Shift
#define ImGuiKey_NavGamepadTweakSlow ImGuiKey_GamepadL1
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
#define ImGuiKey_NavGamepadActivate ImGuiKey_GamepadFaceDown
#define ImGuiKey_NavGamepadCancel ImGuiKey_GamepadFaceRight
#define ImGuiKey_NavGamepadActivate (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceRight : ImGuiKey_GamepadFaceDown)
#define ImGuiKey_NavGamepadCancel (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceDown : ImGuiKey_GamepadFaceRight)
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft
#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceUp

View File

@@ -13005,6 +13005,9 @@ static void ImGui::NavUpdateWindowing()
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
const bool keyboard_next_window = allow_windowing && g.ConfigNavWindowingKeyNext && Shortcut(g.ConfigNavWindowingKeyNext, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways, owner_id);
const bool keyboard_prev_window = allow_windowing && g.ConfigNavWindowingKeyPrev && Shortcut(g.ConfigNavWindowingKeyPrev, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways, owner_id);
/*
Why do we need to patch ImGui to disable the nav menu...
const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, ImGuiInputFlags_None);
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && (keyboard_next_window || keyboard_prev_window); // Note: enabled even without NavEnableKeyboard!
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
@@ -13020,7 +13023,7 @@ static void ImGui::NavUpdateWindowing()
if (keyboard_next_window || keyboard_prev_window)
SetKeyOwnersForKeyChord((g.ConfigNavWindowingKeyNext | g.ConfigNavWindowingKeyPrev) & ImGuiMod_Mask_, owner_id);
}
*/
// Gamepad update
g.NavWindowingTimer += io.DeltaTime;
if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Gamepad)

View File

@@ -7169,6 +7169,12 @@ SCKA-20087:
nativeScaling: 2 # Fixes post processing smoothness and position.
memcardFilters:
- "SCKA-20086"
SCKA-20088:
name: "모두의 테니스"
name-en: "Everybody's Tennis"
region: "NTSC-K"
roundModes:
vu1RoundMode: 1 # Fixes the display of scores and text ingame.
SCKA-20089:
name: "BioHazard 4"
region: "NTSC-K"
@@ -10406,6 +10412,8 @@ SCUS-97211:
name: "ATV Offroad Fury 2"
region: "NTSC-U"
compat: 5
gsHWFixes:
bilinearUpscale: 2 # Fixes broken textures.
SCUS-97212:
name: "My Street"
region: "NTSC-U"
@@ -10523,6 +10531,8 @@ SCUS-97236:
SCUS-97238:
name: "ATV Offroad Fury 2 [Demo]"
region: "NTSC-U"
gsHWFixes:
bilinearUpscale: 2 # Fixes broken textures.
SCUS-97239:
name: "Jet X2O [Demo]"
region: "NTSC-U"
@@ -10929,6 +10939,8 @@ SCUS-97369:
name: "ATV Offroad Fury 2"
region: "NTSC-U"
compat: 5
gsHWFixes:
bilinearUpscale: 2 # Fixes broken textures.
SCUS-97370:
name: "NCAA Final Four 2004"
region: "NTSC-U"
@@ -11571,6 +11583,8 @@ SCUS-97509:
SCUS-97510:
name: "ATV Offroad Fury 2 [Greatest Hits]"
region: "NTSC-U"
gsHWFixes:
bilinearUpscale: 2 # Fixes broken textures.
SCUS-97511:
name: "SOCOM II - U.S. Navy SEALs [Greatest Hits]"
region: "NTSC-U"
@@ -17359,6 +17373,8 @@ SLES-51813:
SLES-51814:
name: "ATV Offroad Fury 2"
region: "PAL-E"
gsHWFixes:
bilinearUpscale: 2 # Fixes broken textures.
SLES-51815:
name: "Final Fantasy X-2"
region: "PAL-E"
@@ -67117,6 +67133,8 @@ SLUS-21638:
compat: 5
clampModes:
vuClampMode: 3 # Missing geometry with microVU.
memcardFilters:
- "SLUS-21620"
SLUS-21639:
name: "NASCAR 08"
region: "NTSC-U"

View File

@@ -1172,7 +1172,6 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
05000000a00500003232000001000000,8BitDo Zero,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
05000000a00500003232000008010000,8BitDo Zero,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00001890000011010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,
050000005e040000e002000030110000,8BitDo Zero 2,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Linux,
05000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
03000000c01100000355000011010000,Acrux Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
030000006f0e00008801000011010000,Afterglow Deluxe Nintendo Switch Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
@@ -1694,7 +1693,6 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
050000005e040000220b000013050000,Xbox One Elite 2 Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
050000005e040000050b000002090000,Xbox One Elite Series 2,a:b0,b:b1,back:b136,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
030000005e040000ea02000011050000,Xbox One S Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
050082795e040000e002000003090000,Xbox One S Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
060000005e040000ea0200000b050000,Xbox One S Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
060000005e040000ea0200000d050000,Xbox One S Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000005e040000120b000001050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,

View File

@@ -1,6 +1,8 @@
# Extra preprocessor definitions that will be added to all pcsx2 builds
set(PCSX2_DEFS "")
include(GNUInstallDirs)
#-------------------------------------------------------------------------------
# Misc option
#-------------------------------------------------------------------------------
@@ -8,6 +10,7 @@ option(ENABLE_TESTS "Enables building the unit tests" ON)
option(ENABLE_GSRUNNER "Enables building the GSRunner" OFF)
option(LTO_PCSX2_CORE "Enable LTO/IPO/LTCG on the subset of pcsx2 that benefits most from it but not anything else")
option(USE_VTUNE "Plug VTUNE to profile GS JIT.")
option(PACKAGE_MODE "Use this option to ease packaging of PCSX2 (developer/distribution option)")
#-------------------------------------------------------------------------------
# Graphical option
@@ -199,6 +202,15 @@ if(MSVC)
)
endif()
if(PACKAGE_MODE)
file(RELATIVE_PATH relative_datadir ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_DATADIR}/PCSX2)
# Compile all source codes with those defines
list(APPEND PCSX2_DEFS
PCSX2_APP_DATADIR="${relative_datadir}")
endif()
if(USE_VTUNE)
list(APPEND PCSX2_DEFS ENABLE_VTUNE)
endif()

View File

@@ -349,7 +349,7 @@ void GameListWidget::onCoverScaleChanged()
m_list_view->setSpacing(m_model->getCoverArtSpacing());
QFont font;
font.setPointSizeF(16.0f * m_model->getCoverScale());
font.setPointSizeF(20.0f * m_model->getCoverScale());
m_list_view->setFont(font);
}

View File

@@ -517,7 +517,10 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
"Bilinear (Forced Excluding Sprites): Will apply filtering to all surfaces, even if the game told the PS2 not to, except sprites."));
dialog->registerWidgetHelp(m_ui.trilinearFiltering, tr("Trilinear Filtering"), tr("Automatic (Default)"),
tr("Control the texture's trilinear filtering of the emulation."));
tr("Reduces blurriness of large textures applied to small, steeply angled surfaces by sampling colors from the two nearest Mipmaps. Requires Mipmapping to be 'on'.<br> "
"Off: Disables the feature.<br> "
"Trilinear (PS2): Applies Trilinear filtering to all surfaces that a game instructs the PS2 to.<br> "
"Trilinear (Forced): Applies Trilinear filtering to all surfaces, even if the game told the PS2 not to."));
dialog->registerWidgetHelp(m_ui.anisotropicFiltering, tr("Anisotropic Filtering"), tr("Off (Default)"),
tr("Reduces texture aliasing at extreme viewing angles."));

View File

@@ -1938,7 +1938,7 @@
<number>100</number>
</property>
<property name="maximum">
<number>100000</number>
<number>200000</number>
</property>
<property name="singleStep">
<number>100</number>

View File

@@ -20,6 +20,7 @@ namespace QtHost
} // namespace QtHost
static QString s_unthemed_style_name;
static QPalette s_unthemed_palette;
static bool s_unthemed_style_name_set;
const char* QtHost::GetDefaultThemeName()
@@ -37,6 +38,7 @@ void QtHost::UpdateApplicationTheme()
{
s_unthemed_style_name_set = true;
s_unthemed_style_name = QApplication::style()->objectName();
s_unthemed_palette = QApplication::palette();
}
SetStyleFromSettings();
@@ -49,7 +51,7 @@ void QtHost::SetStyleFromSettings()
// setPalette() shouldn't be necessary, as the documentation claims that setStyle() resets the palette, but it
// is here, to work around a bug in 6.4.x and 6.5.x where the palette doesn't restore after changing themes.
qApp->setPalette(QPalette());
qApp->setPalette(QPalette(s_unthemed_palette));
if (theme == "fusion")
{

File diff suppressed because it is too large Load Diff

View File

@@ -199,6 +199,7 @@ namespace Achievements
static std::string s_game_hash;
static std::string s_game_title;
static std::string s_game_icon;
static std::string s_game_icon_url;
static u32 s_game_crc;
static rc_client_user_game_summary_t s_game_summary;
static u32 s_game_id = 0;
@@ -401,6 +402,10 @@ const std::string& Achievements::GetRichPresenceString()
return s_rich_presence_string;
}
const std::string& Achievements::GetGameIconURL()
{
return s_game_icon_url;
}
bool Achievements::Initialize()
{
@@ -945,6 +950,7 @@ void Achievements::ClientLoadGameCallback(int result, const char* error_message,
s_has_leaderboards = has_leaderboards;
s_has_rich_presence = rc_client_has_rich_presence(client);
s_game_icon = {};
s_game_icon_url = {};
// ensure fullscreen UI is ready for notifications
MTGS::RunOnGSThread(&ImGuiManager::InitializeFullscreenUI);
@@ -966,6 +972,16 @@ void Achievements::ClientLoadGameCallback(int result, const char* error_message,
}
}
char icon_url[64];
if (int err = rc_client_game_get_image_url(info, icon_url, std::size(icon_url)); err == RC_OK)
{
s_game_icon_url = icon_url;
}
else
{
ReportRCError(err, "rc_client_game_get_image_url() failed: ");
}
UpdateGameSummary();
DisplayAchievementSummary();
@@ -990,6 +1006,7 @@ void Achievements::ClearGameInfo()
s_game_id = 0;
s_game_title = {};
s_game_icon = {};
s_game_icon_url = {};
s_has_achievements = false;
s_has_leaderboards = false;
s_has_rich_presence = false;

View File

@@ -108,6 +108,10 @@ namespace Achievements
/// Should be called with the lock held.
const std::string& GetRichPresenceString();
/// Returns the current game icon url.
/// Should be called with the lock held.
const std::string& GetGameIconURL();
/// Returns the RetroAchievements title for the current game.
/// Should be called with the lock held.
const std::string& GetGameTitle();

View File

@@ -379,8 +379,7 @@ set(pcsx2USBSources
USB/usb-lightgun/guncon2.cpp
USB/usb-mic/audiodev-cubeb.cpp
USB/usb-mic/usb-headset.cpp
USB/usb-mic/usb-mic-logitech.cpp
USB/usb-mic/usb-mic-singstar.cpp
USB/usb-mic/usb-mic.cpp
USB/usb-msd/usb-msd.cpp
USB/usb-pad/lg/lg_ff.cpp
USB/usb-pad/usb-buzz.cpp
@@ -418,7 +417,7 @@ set(pcsx2USBHeaders
USB/usb-mic/audiodev-noop.h
USB/usb-mic/audiodev.h
USB/usb-mic/usb-headset.h
USB/usb-mic/usb-mic-singstar.h
USB/usb-mic/usb-mic.h
USB/usb-msd/usb-msd.h
USB/usb-pad/lg/lg_ff.h
USB/usb-pad/usb-buzz.h
@@ -1282,6 +1281,16 @@ function(setup_main_executable target)
install(CODE "file(WRITE \"${CMAKE_SOURCE_DIR}/bin/qt.conf\" \"[Paths]\\nPlugins = ./QtPlugins\")")
endif()
if (UNIX AND NOT APPLE)
if (PACKAGE_MODE)
install(TARGETS pcsx2-qt DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/bin/resources DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/PCSX2)
else()
install(TARGETS pcsx2-qt DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif()
endif()
if(APPLE)
if(CMAKE_GENERATOR MATCHES "Xcode")
# If we're generating an xcode project, you can just add the shaders to the main pcsx2 target and xcode will deal with them properly

View File

@@ -592,7 +592,7 @@ struct Pcsx2Config
static constexpr int DEFAULT_VIDEO_CAPTURE_BITRATE = 6000;
static constexpr int DEFAULT_VIDEO_CAPTURE_WIDTH = 640;
static constexpr int DEFAULT_VIDEO_CAPTURE_HEIGHT = 480;
static constexpr int DEFAULT_AUDIO_CAPTURE_BITRATE = 160;
static constexpr int DEFAULT_AUDIO_CAPTURE_BITRATE = 192;
static const char* DEFAULT_CAPTURE_CONTAINER;
union

View File

@@ -1799,7 +1799,7 @@ public:
// TODO: ReadAndExpandBlock4_16
// ReadAndExpandBlock8H for AVX2 platforms with slow VPGATHERDD (Haswell, Zen, Zen2, Zen3)
// ReadAndExpandBlock8H for AVX2 platforms with slow VPGATHERDD (Haswell, Zen, Zen2, Zen3, Zen4)
// Also serves as the implementation for AVX / SSE
__forceinline static void ReadAndExpandBlock8H_32HSW(const u8* RESTRICT src, u8* RESTRICT dst, int dstpitch, const u32* RESTRICT pal)
{

View File

@@ -715,16 +715,16 @@ struct alignas(16) GSHWDrawConfig
AlphaPass alpha_second_pass;
struct BlendPass
struct BlendMultiPass
{
BlendState blend;
u8 blend_hw;
u8 dither;
bool enable;
};
static_assert(sizeof(BlendPass) == 8, "blend pass is 8 bytes");
static_assert(sizeof(BlendMultiPass) == 8, "blend multi pass is 8 bytes");
BlendPass blend_second_pass;
BlendMultiPass blend_multi_pass;
VSConstantBuffer cb_vs;
PSConstantBuffer cb_ps;

View File

@@ -1603,7 +1603,7 @@ void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
if (feedback_write_1)
{
StretchRect(sTex[0], full_r, sTex[2], dRect[2], m_convert.ps[static_cast<int>(ShaderConvert::YUV)].get(),
StretchRect(dTex, full_r, sTex[2], dRect[2], m_convert.ps[static_cast<int>(ShaderConvert::YUV)].get(),
m_merge.cb.get(), nullptr, linear);
}
}
@@ -2000,9 +2000,9 @@ bool GSDevice11::CreateImGuiResources()
// clang-format off
static constexpr D3D11_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)offsetof(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)offsetof(ImDrawVert, uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)offsetof(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
// clang-format on
@@ -2653,12 +2653,12 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
OMSetRenderTargets(hdr_rt ? hdr_rt : config.rt, config.ds, &config.scissor);
DrawIndexedPrimitive();
if (config.blend_second_pass.enable)
if (config.blend_multi_pass.enable)
{
config.ps.blend_hw = config.blend_second_pass.blend_hw;
config.ps.dither = config.blend_second_pass.dither;
config.ps.blend_hw = config.blend_multi_pass.blend_hw;
config.ps.dither = config.blend_multi_pass.dither;
SetupPS(config.ps, &config.cb_ps, config.sampler);
SetupOM(config.depth, OMBlendSelector(config.colormask, config.blend_second_pass.blend), config.blend_second_pass.blend.constant);
SetupOM(config.depth, OMBlendSelector(config.colormask, config.blend_multi_pass.blend), config.blend_multi_pass.blend.constant);
DrawIndexedPrimitive();
}

View File

@@ -3980,14 +3980,14 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
DrawIndexedPrimitive();
// blend second pass
if (config.blend_second_pass.enable)
if (config.blend_multi_pass.enable)
{
if (config.blend_second_pass.blend.constant_enable)
SetBlendConstants(config.blend_second_pass.blend.constant);
if (config.blend_multi_pass.blend.constant_enable)
SetBlendConstants(config.blend_multi_pass.blend.constant);
pipe.bs = config.blend_second_pass.blend;
pipe.ps.blend_hw = config.blend_second_pass.blend_hw;
pipe.ps.dither = config.blend_second_pass.dither;
pipe.bs = config.blend_multi_pass.blend;
pipe.ps.blend_hw = config.blend_multi_pass.blend_hw;
pipe.ps.dither = config.blend_multi_pass.dither;
if (BindDrawPipeline(pipe))
DrawIndexedPrimitive();
}

View File

@@ -4258,8 +4258,8 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
// HW blend can be done in multiple passes when there's no overlap.
// Blend second pass is only useful when texture barriers aren't supported.
// Speed wise Texture barriers > blend second pass > texture copies.
const bool blend_second_pass_support = !features.texture_barrier && no_prim_overlap && is_basic_blend;
const bool bmix1_second_pass = blend_second_pass_support && blend_mix1 && (alpha_c0_high_max_one || alpha_c2_high_one) && m_conf.ps.blend_d == 2;
const bool blend_multi_pass_support = !features.texture_barrier && no_prim_overlap && is_basic_blend;
const bool bmix1_second_pass = blend_multi_pass_support && blend_mix1 && (alpha_c0_high_max_one || alpha_c2_high_one) && m_conf.ps.blend_d == 2;
// We don't want to enable blend mix if we are doing a second pass, it's useless.
blend_mix &= !bmix1_second_pass;
@@ -4323,7 +4323,7 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
}
else
{
const bool ad_second_pass = blend_second_pass_support && alpha_c1_high_no_rta_correct && COLCLAMP.CLAMP &&
const bool ad_second_pass = blend_multi_pass_support && alpha_c1_high_no_rta_correct && COLCLAMP.CLAMP &&
(blend_flag & (BLEND_HW3 | BLEND_HW5 | BLEND_HW6 | BLEND_HW7 | BLEND_HW9));
switch (GSConfig.AccurateBlendingUnit)
@@ -4619,9 +4619,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
m_conf.ps.rta_correction = rt->m_rt_alpha_scale;
}
if (blend_second_pass_support)
if (blend_multi_pass_support)
{
const HWBlend blend_second_pass = GSDevice::GetBlend(blend_index);
const HWBlend blend_multi_pass = GSDevice::GetBlend(blend_index);
if (bmix1_second_pass)
{
// Alpha = As or Af.
@@ -4630,9 +4630,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
blend.src = GSDevice::CONST_ONE;
blend.dst = GSDevice::CONST_ONE;
// Render pass 2: Blend the result (Cd) from render pass 1 with alpha range of 0-2.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR);
m_conf.blend_second_pass.blend = {true, GSDevice::DST_COLOR, (m_conf.ps.blend_c == 2) ? GSDevice::CONST_COLOR : GSDevice::SRC1_COLOR, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, m_conf.ps.blend_c == 2, AFIX};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR);
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_COLOR, (m_conf.ps.blend_c == 2) ? GSDevice::CONST_COLOR : GSDevice::SRC1_COLOR, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, m_conf.ps.blend_c == 2, AFIX};
}
else if ((alpha_c0_high_max_one || alpha_c1_high_no_rta_correct || alpha_c2_high_one) && (blend_flag & BLEND_HW1))
{
@@ -4642,9 +4642,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
m_conf.ps.blend_hw = static_cast<u8>(HWBlendType::SRC_HALF_ONE_DST_FACTOR);
blend.dst = (m_conf.ps.blend_c == 1) ? GSDevice::DST_ALPHA : GSDevice::SRC1_COLOR;
// Render pass 2: Take result (Cd) from render pass 1 and double it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_second_pass.blend = {true, blend_second_pass.src, GSDevice::CONST_ONE, blend_second_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_multi_pass.blend = {true, blend_multi_pass.src, GSDevice::CONST_ONE, blend_multi_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW3))
{
@@ -4652,8 +4652,8 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
// Cs*Alpha, Cs*Alpha + Cd, Cd - Cs*Alpha.
// Render pass 1: Do Cs*Alpha, Cs*Alpha + Cd or Cd - Cs*Alpha on first pass.
// Render pass 2: Take result (Cd) from render pass 1 and either add or rev subtract Cs*Alpha based on the blend operation.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend = {true, blend_second_pass.src, GSDevice::CONST_ONE, blend_second_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend = {true, blend_multi_pass.src, GSDevice::CONST_ONE, blend_multi_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if ((alpha_c0_high_max_one || alpha_c2_high_one) && (blend_flag & BLEND_HW4))
{
@@ -4667,9 +4667,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
blend.dst = (m_conf.ps.blend_c == 2) ? GSDevice::CONST_COLOR : GSDevice::SRC1_COLOR;
blend.op = GSDevice::OP_ADD;
// Render pass 2: Add or subtract result of render pass 1(Cd) from Cs.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.dither = dither * GSConfig.Dithering;
m_conf.blend_second_pass.blend = {true, blend_second_pass.src, GSDevice::CONST_ONE, blend_second_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.dither = dither * GSConfig.Dithering;
m_conf.blend_multi_pass.blend = {true, blend_multi_pass.src, GSDevice::CONST_ONE, blend_multi_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW5))
{
@@ -4677,9 +4677,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
// Cd*Alpha - Cs*Alpha, Cs*Alpha - Cd*Alpha.
// Render pass 1: Do (Cd - Cs)*Alpha, (Cs - Cd)*Alpha or Cd*Alpha on first pass.
// Render pass 2: Take result (Cd) from render pass 1 and double it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_second_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW6))
{
@@ -4690,9 +4690,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
AFIX = 64;
blend.src = GSDevice::CONST_COLOR;
// Render pass 2: Take result (Cd) from render pass 1 and double it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_second_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW7))
{
@@ -4704,9 +4704,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
blend.dst = GSDevice::DST_ALPHA;
blend.op = GSDevice::OP_SUBTRACT;
// Render pass 2: Take result (Cd) from render pass 1 and double it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_second_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_COLOR, GSDevice::CONST_ONE, GSDevice::OP_ADD, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (blend_flag & BLEND_HW8)
{
@@ -4714,9 +4714,9 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
// Cs*(1 + Alpha).
// Render pass 1: Do Cs.
// Render pass 2: Try to double Cs, then take result (Cd) from render pass 1 and add Cs*Alpha to it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_DOUBLE);
m_conf.blend_second_pass.blend = {true, GSDevice::DST_ALPHA, GSDevice::CONST_ONE, blend_second_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend_hw = static_cast<u8>(HWBlendType::SRC_DOUBLE);
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_ALPHA, GSDevice::CONST_ONE, blend_multi_pass.op, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
else if (alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW9))
{
@@ -4724,12 +4724,12 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
// Cs*(1 - Alpha).
// Render pass 1: Do Cs*(1 - Alpha).
// Render pass 2: Take result (Cd) from render pass 1 and subtract Cs*Alpha from it.
m_conf.blend_second_pass.enable = true;
m_conf.blend_second_pass.blend = {true, GSDevice::DST_ALPHA, GSDevice::CONST_ONE, GSDevice::OP_REV_SUBTRACT, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
m_conf.blend_multi_pass.enable = true;
m_conf.blend_multi_pass.blend = {true, GSDevice::DST_ALPHA, GSDevice::CONST_ONE, GSDevice::OP_REV_SUBTRACT, GSDevice::CONST_ONE, GSDevice::CONST_ZERO, false, 0};
}
}
if (!m_conf.blend_second_pass.enable && blend_flag & BLEND_HW1)
if (!m_conf.blend_multi_pass.enable && blend_flag & BLEND_HW1)
{
m_conf.ps.blend_hw = static_cast<u8>(HWBlendType::SRC_ONE_DST_FACTOR);
}
@@ -4737,27 +4737,27 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
{
m_conf.ps.blend_hw = static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR);
}
else if (!m_conf.blend_second_pass.enable && alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW3))
else if (!m_conf.blend_multi_pass.enable && alpha_c1_high_no_rta_correct && (blend_flag & BLEND_HW3))
{
m_conf.ps.blend_hw = static_cast<u8>(HWBlendType::SRC_DOUBLE);
}
if (m_conf.ps.blend_c == 2 && (m_conf.ps.blend_hw == static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR)
|| m_conf.ps.blend_hw == static_cast<u8>(HWBlendType::SRC_HALF_ONE_DST_FACTOR)
|| m_conf.blend_second_pass.blend_hw == static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR)))
|| m_conf.blend_multi_pass.blend_hw == static_cast<u8>(HWBlendType::SRC_ALPHA_DST_FACTOR)))
{
m_conf.cb_ps.TA_MaxDepth_Af.a = static_cast<float>(AFIX) / 128.0f;
}
const GSDevice::BlendFactor src_factor_alpha = m_conf.blend_second_pass.enable ? GSDevice::CONST_ZERO : GSDevice::CONST_ONE;
const GSDevice::BlendFactor dst_factor_alpha = m_conf.blend_second_pass.enable ? GSDevice::CONST_ONE : GSDevice::CONST_ZERO;
const GSDevice::BlendFactor src_factor_alpha = m_conf.blend_multi_pass.enable ? GSDevice::CONST_ZERO : GSDevice::CONST_ONE;
const GSDevice::BlendFactor dst_factor_alpha = m_conf.blend_multi_pass.enable ? GSDevice::CONST_ONE : GSDevice::CONST_ZERO;
m_conf.blend = {true, blend.src, blend.dst, blend.op, src_factor_alpha, dst_factor_alpha, m_conf.ps.blend_c == 2, AFIX};
// Remove second color output when unused. Works around bugs in some drivers (e.g. Intel).
m_conf.ps.no_color1 = !GSDevice::IsDualSourceBlendFactor(m_conf.blend.src_factor) &&
!GSDevice::IsDualSourceBlendFactor(m_conf.blend.dst_factor) &&
!GSDevice::IsDualSourceBlendFactor(m_conf.blend_second_pass.blend.src_factor) &&
!GSDevice::IsDualSourceBlendFactor(m_conf.blend_second_pass.blend.dst_factor);
!GSDevice::IsDualSourceBlendFactor(m_conf.blend_multi_pass.blend.src_factor) &&
!GSDevice::IsDualSourceBlendFactor(m_conf.blend_multi_pass.blend.dst_factor);
}
// Notify the shader that it needs to invert rounding
@@ -5959,10 +5959,10 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
}
else
{
if (m_conf.blend_second_pass.enable)
if (m_conf.blend_multi_pass.enable)
{
m_conf.blend_second_pass.blend.src_factor_alpha = GSDevice::SRC1_ALPHA;
m_conf.blend_second_pass.blend.dst_factor_alpha = GSDevice::INV_SRC1_ALPHA;
m_conf.blend_multi_pass.blend.src_factor_alpha = GSDevice::SRC1_ALPHA;
m_conf.blend_multi_pass.blend.dst_factor_alpha = GSDevice::INV_SRC1_ALPHA;
}
else
{
@@ -6106,7 +6106,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
m_conf.ps.fba = m_context->FBA.FBA;
if (m_conf.ps.dither || m_conf.blend_second_pass.dither)
if (m_conf.ps.dither || m_conf.blend_multi_pass.dither)
{
const GIFRegDIMX& DIMX = m_draw_env->DIMX;
GL_DBG("DITHERING mode %d (%d)", (GSConfig.Dithering == 3) ? "Force 32bit" : ((GSConfig.Dithering == 0) ? "Disabled" : "Enabled"), GSConfig.Dithering);
@@ -6122,7 +6122,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
else if (GSConfig.Dithering > 2)
{
m_conf.ps.dither = GSConfig.Dithering;
m_conf.blend_second_pass.dither = GSConfig.Dithering;
m_conf.blend_multi_pass.dither = GSConfig.Dithering;
}
if (PRIM->FGE)

View File

@@ -6305,16 +6305,17 @@ void GSTextureCache::Target::Update(bool cannot_scale)
m_rt_alpha_scale = true;
}
ShaderConvert depth_shader = upscaled ? ShaderConvert::RGBA8_TO_FLOAT32_BILN : ShaderConvert::RGBA8_TO_FLOAT32;
const bool linear = upscaled && GSConfig.UserHacks_BilinearHack != GSBilinearDirtyMode::ForceNearest;
ShaderConvert depth_shader = linear ? ShaderConvert::RGBA8_TO_FLOAT32_BILN : ShaderConvert::RGBA8_TO_FLOAT32;
if (m_type == DepthStencil && GSLocalMemory::m_psm[m_TEX0.PSM].trbpp != 32)
{
switch (GSLocalMemory::m_psm[m_TEX0.PSM].trbpp)
{
case 24:
depth_shader = upscaled ? ShaderConvert::RGBA8_TO_FLOAT24_BILN : ShaderConvert::RGBA8_TO_FLOAT24;
depth_shader = linear ? ShaderConvert::RGBA8_TO_FLOAT24_BILN : ShaderConvert::RGBA8_TO_FLOAT24;
break;
case 16:
depth_shader = upscaled ? ShaderConvert::RGB5A1_TO_FLOAT16_BILN : ShaderConvert::RGB5A1_TO_FLOAT16;
depth_shader = linear ? ShaderConvert::RGB5A1_TO_FLOAT16_BILN : ShaderConvert::RGB5A1_TO_FLOAT16;
break;
default:
break;

View File

@@ -2088,9 +2088,9 @@ bool GSDeviceOGL::CreateImGuiProgram()
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)offsetof(ImDrawVert, pos));
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)offsetof(ImDrawVert, uv));
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)offsetof(ImDrawVert, col));
glBindVertexArray(GLState::vao);
return true;
@@ -2612,21 +2612,21 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
SendHWDraw(config, psel.ps.IsFeedbackLoop());
if (config.blend_second_pass.enable)
if (config.blend_multi_pass.enable)
{
if (config.blend.IsEffective(config.colormask))
{
OMSetBlendState(config.blend_second_pass.blend.enable, s_gl_blend_factors[config.blend_second_pass.blend.src_factor],
s_gl_blend_factors[config.blend_second_pass.blend.dst_factor], s_gl_blend_ops[config.blend_second_pass.blend.op],
s_gl_blend_factors[config.blend_second_pass.blend.src_factor_alpha], s_gl_blend_factors[config.blend_second_pass.blend.dst_factor_alpha],
config.blend_second_pass.blend.constant_enable, config.blend_second_pass.blend.constant);
OMSetBlendState(config.blend_multi_pass.blend.enable, s_gl_blend_factors[config.blend_multi_pass.blend.src_factor],
s_gl_blend_factors[config.blend_multi_pass.blend.dst_factor], s_gl_blend_ops[config.blend_multi_pass.blend.op],
s_gl_blend_factors[config.blend_multi_pass.blend.src_factor_alpha], s_gl_blend_factors[config.blend_multi_pass.blend.dst_factor_alpha],
config.blend_multi_pass.blend.constant_enable, config.blend_multi_pass.blend.constant);
}
else
{
OMSetBlendState();
}
psel.ps.blend_hw = config.blend_second_pass.blend_hw;
psel.ps.dither = config.blend_second_pass.dither;
psel.ps.blend_hw = config.blend_multi_pass.blend_hw;
psel.ps.dither = config.blend_multi_pass.dither;
SetupPipeline(psel);
SendHWDraw(config, psel.ps.IsFeedbackLoop());
}

View File

@@ -5826,14 +5826,14 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
SendHWDraw(config, draw_rt, config.require_one_barrier, config.require_full_barrier, skip_first_barrier);
// blend second pass
if (config.blend_second_pass.enable)
if (config.blend_multi_pass.enable)
{
if (config.blend_second_pass.blend.constant_enable)
SetBlendConstants(config.blend_second_pass.blend.constant);
if (config.blend_multi_pass.blend.constant_enable)
SetBlendConstants(config.blend_multi_pass.blend.constant);
pipe.bs = config.blend_second_pass.blend;
pipe.ps.blend_hw = config.blend_second_pass.blend_hw;
pipe.ps.dither = config.blend_second_pass.dither;
pipe.bs = config.blend_multi_pass.blend;
pipe.ps.blend_hw = config.blend_multi_pass.blend_hw;
pipe.ps.dither = config.blend_multi_pass.dither;
if (BindDrawPipeline(pipe))
{
// TODO: This probably should have barriers, in case we want to use it conditionally.

View File

@@ -81,6 +81,7 @@ namespace
#define FSUI_FSTR(str) fmt::runtime(Host::TranslateToStringView(TR_CONTEXT, str))
#define FSUI_NSTR(str) str
using ImGuiFullscreen::FocusResetType;
using ImGuiFullscreen::g_large_font;
using ImGuiFullscreen::g_layout_padding_left;
using ImGuiFullscreen::g_layout_padding_top;
@@ -134,6 +135,7 @@ using ImGuiFullscreen::ForceKeyNavEnabled;
using ImGuiFullscreen::GetCachedTexture;
using ImGuiFullscreen::GetCachedTextureAsync;
using ImGuiFullscreen::GetPlaceholderTexture;
using ImGuiFullscreen::GetQueuedFocusResetType;
using ImGuiFullscreen::HorizontalMenuItem;
using ImGuiFullscreen::IsFocusResetQueued;
using ImGuiFullscreen::IsGamepadInputSource;
@@ -655,7 +657,7 @@ void FullscreenUI::OnVMStarted()
return;
s_current_main_window = MainWindowType::None;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
});
}
@@ -723,7 +725,7 @@ void FullscreenUI::OpenPauseMenu()
ForceKeyNavEnabled();
s_current_main_window = MainWindowType::PauseMenu;
s_current_pause_submenu = PauseSubMenu::None;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
});
}
@@ -738,14 +740,14 @@ void FullscreenUI::ClosePauseMenu()
s_current_main_window = MainWindowType::None;
s_current_pause_submenu = PauseSubMenu::None;
s_pause_menu_was_open = false;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
void FullscreenUI::OpenPauseSubMenu(PauseSubMenu submenu)
{
s_current_main_window = MainWindowType::PauseMenu;
s_current_pause_submenu = submenu;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
void FullscreenUI::Shutdown(bool clear_state)
@@ -901,7 +903,7 @@ void FullscreenUI::ReturnToPreviousWindow()
if (VMManager::HasValidVM() && s_pause_menu_was_open)
{
s_current_main_window = MainWindowType::PauseMenu;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
else
{
@@ -976,7 +978,6 @@ void FullscreenUI::DoStartFile()
if (!path.empty())
DoStartPath(path);
QueueResetFocus();
CloseFileSelector();
};
@@ -1040,7 +1041,6 @@ void FullscreenUI::DoStartDisc()
FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Select Disc Drive"), false, std::move(options), [](s32, const std::string& path, bool) {
DoStartDisc(path);
CloseChoiceDialog();
QueueResetFocus();
});
}
@@ -1115,7 +1115,6 @@ void FullscreenUI::DoChangeDiscFromFile()
}
}
QueueResetFocus();
CloseFileSelector();
ReturnToPreviousWindow();
ClosePauseMenu();
@@ -1170,7 +1169,7 @@ void FullscreenUI::ConfirmShutdownIfMemcardBusy(std::function<void(bool)> callba
void FullscreenUI::SwitchToLanding()
{
s_current_main_window = MainWindowType::Landing;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
void FullscreenUI::DrawLandingTemplate(ImVec2* menu_pos, ImVec2* menu_size)
@@ -1267,7 +1266,7 @@ void FullscreenUI::DrawLandingWindow()
FSUI_CSTR("Launch a game from a file, disc, or starts the console without any disc inserted.")))
{
s_current_main_window = MainWindowType::StartGame;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
if (HorizontalMenuItem(GetCachedTexture("fullscreenui/applications-system.png"), FSUI_CSTR("Settings"),
@@ -1281,7 +1280,7 @@ void FullscreenUI::DrawLandingWindow()
(!AreAnyDialogsOpen() && WantsToCloseMenu()))
{
s_current_main_window = MainWindowType::Exit;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
}
EndHorizontalMenu();
@@ -1349,7 +1348,7 @@ void FullscreenUI::DrawStartGameWindow()
(!AreAnyDialogsOpen() && WantsToCloseMenu()))
{
s_current_main_window = MainWindowType::Landing;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
}
EndHorizontalMenu();
@@ -1395,7 +1394,7 @@ void FullscreenUI::DrawExitWindow()
WantsToCloseMenu())
{
s_current_main_window = MainWindowType::Landing;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
if (HorizontalMenuItem(GetCachedTexture("fullscreenui/exit.png"), FSUI_CSTR("Exit PCSX2"),
@@ -2701,7 +2700,7 @@ void FullscreenUI::SwitchToGameSettings(const std::string_view serial, u32 crc)
PopulatePatchesAndCheatsList(serial, crc);
s_current_main_window = MainWindowType::Settings;
s_settings_page = SettingsPage::Summary;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
void FullscreenUI::SwitchToGameSettings()
@@ -2844,7 +2843,7 @@ void FullscreenUI::DrawSettingsWindow()
{
index = (index == 0) ? (count - 1) : (index - 1);
s_settings_page = pages[index];
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
else if (ImGui::IsKeyPressed(ImGuiKey_GamepadDpadRight, true) ||
ImGui::IsKeyPressed(ImGuiKey_NavGamepadTweakFast, true) ||
@@ -2852,7 +2851,7 @@ void FullscreenUI::DrawSettingsWindow()
{
index = (index + 1) % count;
s_settings_page = pages[index];
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
}
@@ -2876,6 +2875,7 @@ void FullscreenUI::DrawSettingsWindow()
if (NavButton(icons[i], i == index, true, ITEM_WIDTH, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
{
s_settings_page = pages[i];
QueueResetFocus(FocusResetType::WindowChanged);
}
}
@@ -2886,7 +2886,12 @@ void FullscreenUI::DrawSettingsWindow()
// we have to do this here, because otherwise it uses target, and jumps a frame later.
if (IsFocusResetQueued())
ImGui::SetNextWindowScroll(ImVec2(0.0f, 0.0f));
if (FocusResetType focus_reset = GetQueuedFocusResetType(); focus_reset != FocusResetType::None &&
focus_reset != FocusResetType::PopupOpened &&
focus_reset != FocusResetType::PopupClosed)
{
ImGui::SetNextWindowScroll(ImVec2(0.0f, 0.0f));
}
if (BeginFullscreenWindow(
ImVec2(0.0f, heading_size.y),
@@ -3046,7 +3051,7 @@ void FullscreenUI::DrawSummarySettingsPage()
}
}
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupClosed);
CloseFileSelector();
};
@@ -5370,7 +5375,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIPrimaryColor, 0.9f));
if (ImGui::BeginChild("state_titlebar", heading_size, false, ImGuiWindowFlags_NavFlattened))
if (ImGui::BeginChild("state_titlebar", heading_size, ImGuiChildFlags_NavFlattened, 0))
{
BeginNavBar();
if (NavButton(ICON_PF_BACKWARD, true, true))
@@ -5391,7 +5396,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
bool close_handled = false;
if (s_save_state_selector_open &&
ImGui::BeginChild("state_list", ImVec2(io.DisplaySize.x, io.DisplaySize.y - LayoutScale(LAYOUT_FOOTER_HEIGHT) - heading_size.y),
false, ImGuiWindowFlags_NavFlattened))
ImGuiChildFlags_NavFlattened, 0))
{
BeginMenuButtons();
@@ -5517,7 +5522,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
{
s_save_state_selector_submenu_index = -1;
if (!closed)
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
ImGui::PopStyleColor(4);
@@ -5900,7 +5905,7 @@ void FullscreenUI::DrawGameListWindow()
else if (ImGui::IsKeyPressed(ImGuiKey_GamepadStart, false) || ImGui::IsKeyPressed(ImGuiKey_F2))
{
s_current_main_window = MainWindowType::GameListSettings;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
switch (s_game_list_view)
@@ -6318,7 +6323,7 @@ void FullscreenUI::DrawGameListSettingsWindow()
if (NavButton(ICON_PF_BACKWARD, true, true))
{
s_current_main_window = MainWindowType::GameList;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
NavTitle(FSUI_CSTR("Game List Settings"));
@@ -6339,7 +6344,7 @@ void FullscreenUI::DrawGameListSettingsWindow()
if (ImGui::IsWindowFocused() && WantsToCloseMenu())
{
s_current_main_window = MainWindowType::GameList;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
auto lock = Host::GetSettingsLock();
@@ -6495,7 +6500,7 @@ void FullscreenUI::SwitchToGameList()
auto lock = Host::GetSettingsLock();
PopulateGameListDirectoryCache(Host::Internal::GetBaseSettingsLayer());
}
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
GSTexture* FullscreenUI::GetGameListCover(const GameList::Entry* entry)
@@ -6665,7 +6670,7 @@ void FullscreenUI::SwitchToAchievementsWindow()
}
s_current_main_window = MainWindowType::Achievements;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
bool FullscreenUI::OpenLeaderboardsWindow()
@@ -6709,7 +6714,7 @@ void FullscreenUI::SwitchToLeaderboardsWindow()
}
s_current_main_window = MainWindowType::Leaderboards;
QueueResetFocus();
QueueResetFocus(FocusResetType::WindowChanged);
}
void FullscreenUI::DrawAchievementsSettingsPage(std::unique_lock<std::mutex>& settings_lock)

View File

@@ -85,7 +85,7 @@ namespace ImGuiFullscreen
static u32 s_menu_button_index = 0;
static u32 s_close_button_state = 0;
static bool s_focus_reset_queued = false;
static FocusResetType s_focus_reset_queued = FocusResetType::None;
static bool s_light_theme = false;
static LRUCache<std::string, std::shared_ptr<GSTexture>> s_texture_cache(128, true);
@@ -204,7 +204,7 @@ void ImGuiFullscreen::SetFonts(ImFont* standard_font, ImFont* medium_font, ImFon
bool ImGuiFullscreen::Initialize(const char* placeholder_image_path)
{
s_focus_reset_queued = true;
s_focus_reset_queued = FocusResetType::WindowChanged;
s_close_button_state = 0;
s_placeholder_texture = LoadTexture(placeholder_image_path);
@@ -552,22 +552,22 @@ void ImGuiFullscreen::PopResetLayout()
ImGui::PopStyleVar(12);
}
void ImGuiFullscreen::QueueResetFocus()
void ImGuiFullscreen::QueueResetFocus(FocusResetType type)
{
s_focus_reset_queued = true;
s_focus_reset_queued = type;
s_close_button_state = 0;
}
bool ImGuiFullscreen::ResetFocusHere()
{
if (!s_focus_reset_queued)
if (s_focus_reset_queued == FocusResetType::None)
return false;
// don't take focus from dialogs
if (ImGui::FindBlockingModal(ImGui::GetCurrentWindow()))
return false;
s_focus_reset_queued = false;
s_focus_reset_queued = FocusResetType::None;
ImGui::SetWindowFocus();
// only do the active selection magic when we're using keyboard/gamepad
@@ -575,6 +575,11 @@ bool ImGuiFullscreen::ResetFocusHere()
}
bool ImGuiFullscreen::IsFocusResetQueued()
{
return (s_focus_reset_queued != FocusResetType::None);
}
ImGuiFullscreen::FocusResetType ImGuiFullscreen::GetQueuedFocusResetType()
{
return s_focus_reset_queued;
}
@@ -590,6 +595,9 @@ void ImGuiFullscreen::ForceKeyNavEnabled()
bool ImGuiFullscreen::WantsToCloseMenu()
{
// Used for the key macros below.
ImGuiContext& g = *ImGui::GetCurrentContext();
// Wait for the Close button to be released, THEN pressed
if (s_close_button_state == 0)
{
@@ -679,7 +687,7 @@ bool ImGuiFullscreen::BeginFullscreenColumnWindow(float start, float end, const
ImGui::SetCursorPos(pos);
return ImGui::BeginChild(name, size, false, ImGuiWindowFlags_NavFlattened);
return ImGui::BeginChild(name, size, ImGuiChildFlags_NavFlattened, 0);
}
void ImGuiFullscreen::EndFullscreenColumnWindow()
@@ -1080,12 +1088,21 @@ bool ImGuiFullscreen::MenuHeadingButton(
}
bool ImGuiFullscreen::ActiveButton(const char* title, bool is_active, bool enabled, float height, ImFont* font)
{
return ActiveButtonWithRightText(title, nullptr, is_active, enabled, height, font);
}
bool ImGuiFullscreen::ActiveButtonWithRightText(const char* title, const char* right_title, bool is_active,
bool enabled, float height, ImFont* font)
{
if (is_active)
{
// don't draw over a prerendered border
const float border_size = ImGui::GetStyle().FrameBorderSize;
const ImVec2 border_size_v = ImVec2(border_size, border_size);
ImVec2 pos, size;
GetMenuButtonFrameBounds(height, &pos, &size);
ImGui::RenderFrame(pos, pos + size, ImGui::GetColorU32(UIPrimaryColor), false);
ImGui::RenderFrame(pos + border_size_v, pos + size - border_size_v, ImGui::GetColorU32(UIPrimaryColor), false);
}
ImRect bb;
@@ -1101,6 +1118,16 @@ bool ImGuiFullscreen::ActiveButton(const char* title, bool is_active, bool enabl
ImGui::PushFont(font);
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, title, nullptr, nullptr, ImVec2(0.0f, 0.0f), &title_bb);
if (right_title && *right_title)
{
const ImVec2 right_text_size = font->CalcTextSizeA(font->FontSize, title_bb.GetWidth(), 0.0f, right_title);
const ImVec2 right_text_start = ImVec2(title_bb.Max.x - right_text_size.x, title_bb.Min.y);
ImGui::RenderTextClipped(right_text_start, title_bb.Max, right_title, nullptr, &right_text_size, ImVec2(0.0f, 0.0f),
&title_bb);
}
ImGui::PopFont();
if (!enabled)
@@ -1921,7 +1948,7 @@ void ImGuiFullscreen::OpenFileSelector(std::string_view title, bool select_direc
s_file_selector_filters = std::move(filters);
SetFileSelectorDirectory(std::move(initial_directory));
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::CloseFileSelector()
@@ -1937,7 +1964,7 @@ void ImGuiFullscreen::CloseFileSelector()
std::string().swap(s_file_selector_current_directory);
s_file_selector_items.clear();
ImGui::CloseCurrentPopup();
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupClosed);
}
void ImGuiFullscreen::DrawFileSelector()
@@ -1972,8 +1999,8 @@ void ImGuiFullscreen::DrawFileSelector()
if (!s_file_selector_current_directory.empty())
{
MenuButton(fmt::format(ICON_FA_FOLDER_OPEN " {}", s_file_selector_current_directory).c_str(), nullptr, false,
LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
MenuButton(SmallString::from_format(ICON_FA_FOLDER_OPEN " {}", s_file_selector_current_directory).c_str(),
nullptr, false, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
}
if (s_file_selector_directory && !s_file_selector_current_directory.empty())
@@ -2011,7 +2038,7 @@ void ImGuiFullscreen::DrawFileSelector()
if (selected->is_file)
{
s_file_selector_callback(selected->full_path);
QueueResetFocus();
QueueResetFocus(FocusResetType::Other);
}
else
{
@@ -2036,7 +2063,7 @@ void ImGuiFullscreen::DrawFileSelector()
" <Parent Directory>")
{
SetFileSelectorDirectory(std::move(s_file_selector_items.front().full_path));
QueueResetFocus();
QueueResetFocus(FocusResetType::Other);
}
}
}
@@ -2057,7 +2084,7 @@ void ImGuiFullscreen::OpenChoiceDialog(std::string_view title, bool checkable, C
s_choice_dialog_title = fmt::format("{}##choice_dialog", title);
s_choice_dialog_options = std::move(options);
s_choice_dialog_callback = std::move(callback);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::CloseChoiceDialog()
@@ -2070,7 +2097,7 @@ void ImGuiFullscreen::CloseChoiceDialog()
std::string().swap(s_choice_dialog_title);
ChoiceDialogOptions().swap(s_choice_dialog_options);
ChoiceDialogCallback().swap(s_choice_dialog_callback);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupClosed);
}
void ImGuiFullscreen::DrawChoiceDialog()
@@ -2113,7 +2140,8 @@ void ImGuiFullscreen::DrawChoiceDialog()
{
auto& option = s_choice_dialog_options[i];
const std::string title(fmt::format("{0} {1}", option.second ? ICON_FA_CHECK_SQUARE : ICON_FA_SQUARE, option.first));
const SmallString title =
SmallString::from_format("{0} {1}", option.second ? ICON_FA_CHECK_SQUARE : ICON_FA_SQUARE, option.first);
if (MenuButton(title.c_str(), nullptr, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
{
choice = i;
@@ -2131,7 +2159,8 @@ void ImGuiFullscreen::DrawChoiceDialog()
title += ICON_FA_CHECK " ";
title += option.first;
if (ActiveButton(title.c_str(), option.second, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
if (ActiveButtonWithRightText(option.first.c_str(), option.second ? ICON_FA_CHECK : nullptr, option.second,
true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
{
choice = i;
for (s32 j = 0; j < static_cast<s32>(s_choice_dialog_options.size()); j++)
@@ -2187,7 +2216,7 @@ void ImGuiFullscreen::OpenInputStringDialog(
s_input_dialog_caption = std::move(caption);
s_input_dialog_ok_text = std::move(ok_button_text);
s_input_dialog_callback = std::move(callback);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::DrawInputDialog()
@@ -2296,7 +2325,7 @@ void ImGuiFullscreen::OpenConfirmMessageDialog(
s_message_dialog_callback = std::move(callback);
s_message_dialog_buttons[0] = std::move(yes_button_text);
s_message_dialog_buttons[1] = std::move(no_button_text);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::OpenInfoMessageDialog(
@@ -2309,7 +2338,7 @@ void ImGuiFullscreen::OpenInfoMessageDialog(
s_message_dialog_message = std::move(message);
s_message_dialog_callback = std::move(callback);
s_message_dialog_buttons[0] = std::move(button_text);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::OpenMessageDialog(std::string title, std::string message, MessageDialogCallback callback,
@@ -2324,7 +2353,7 @@ void ImGuiFullscreen::OpenMessageDialog(std::string title, std::string message,
s_message_dialog_buttons[0] = std::move(first_button_text);
s_message_dialog_buttons[1] = std::move(second_button_text);
s_message_dialog_buttons[2] = std::move(third_button_text);
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupOpened);
}
void ImGuiFullscreen::CloseMessageDialog()
@@ -2337,7 +2366,7 @@ void ImGuiFullscreen::CloseMessageDialog()
s_message_dialog_message = {};
s_message_dialog_buttons = {};
s_message_dialog_callback = {};
QueueResetFocus();
QueueResetFocus(FocusResetType::PopupClosed);
}
void ImGuiFullscreen::DrawMessageDialog()

View File

@@ -112,9 +112,18 @@ namespace ImGuiFullscreen
void PushResetLayout();
void PopResetLayout();
void QueueResetFocus();
enum class FocusResetType : u8
{
None,
PopupOpened,
PopupClosed,
WindowChanged,
Other,
};
void QueueResetFocus(FocusResetType type);
bool ResetFocusHere();
bool IsFocusResetQueued();
FocusResetType GetQueuedFocusResetType();
void ForceKeyNavEnabled();
bool WantsToCloseMenu();
@@ -158,6 +167,8 @@ namespace ImGuiFullscreen
bool MenuHeadingButton(const char* title, const char* value = nullptr, bool enabled = true, bool draw_line = true);
bool ActiveButton(const char* title, bool is_active, bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY,
ImFont* font = g_large_font);
bool ActiveButtonWithRightText(const char* title, const char* right_title, bool is_active, bool enabled = true,
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
bool MenuButton(const char* title, const char* summary, bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
bool MenuButtonWithoutSummary(const char* title, bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY,

View File

@@ -335,9 +335,9 @@ void ImGuiManager::SetStyle()
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.27f, 0.32f, 0.38f, 1.00f);
colors[ImGuiCol_Tab] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabHovered] = ImVec4(0.33f, 0.38f, 0.46f, 1.00f);
colors[ImGuiCol_TabActive] = ImVec4(0.27f, 0.32f, 0.38f, 1.00f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabSelected] = ImVec4(0.27f, 0.32f, 0.38f, 1.00f);
colors[ImGuiCol_TabDimmed] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabDimmedSelected] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);

View File

@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+
#include "common/CocoaTools.h"
#include "common/FileSystem.h"
#include "common/Path.h"
#include "common/SettingsInterface.h"
@@ -1859,7 +1860,15 @@ void Pcsx2Config::ClearInvalidPerGameConfiguration(SettingsInterface* si)
void EmuFolders::SetAppRoot()
{
const std::string program_path = FileSystem::GetProgramPath();
std::string program_path = FileSystem::GetProgramPath();
#ifdef __APPLE__
const auto bundle_path = CocoaTools::GetNonTranslocatedBundlePath();
if (bundle_path.has_value())
{
// On macOS, override with the bundle path if launched from a bundle.
program_path = bundle_path.value();
}
#endif
Console.WriteLnFmt("Program Path: {}", program_path);
AppRoot = Path::Canonicalize(Path::GetDirectory(program_path));
@@ -1870,12 +1879,17 @@ void EmuFolders::SetAppRoot()
bool EmuFolders::SetResourcesDirectory()
{
#ifndef __APPLE__
// On Windows/Linux, these are in the binary directory.
Resources = Path::Combine(AppRoot, "resources");
#ifndef __APPLE__
#ifndef PCSX2_APP_DATADIR
// On Windows/Linux, these are in the binary directory.
Resources = Path::Combine(AppRoot, "resources");
#else
Resources = Path::Canonicalize(Path::Combine(AppRoot, PCSX2_APP_DATADIR "/resources"));
#endif
#else
// On macOS, this is in the bundle resources directory.
Resources = Path::Canonicalize(Path::Combine(AppRoot, "../Resources"));
const std::string program_path = FileSystem::GetProgramPath();
Resources = Path::Canonicalize(Path::Combine(Path::GetDirectory(program_path), "../Resources"));
#endif
Console.WriteLnFmt("Resources Directory: {}", Resources);

View File

@@ -8,7 +8,7 @@
#include "usb-pad/usb-realplay.h"
#include "usb-hid/usb-hid.h"
#include "usb-mic/usb-headset.h"
#include "usb-mic/usb-mic-singstar.h"
#include "usb-mic/usb-mic.h"
#include "usb-msd/usb-msd.h"
#include "usb-pad/usb-pad.h"
#include "usb-pad/usb-trance-vibrator.h"
@@ -68,8 +68,7 @@ void RegisterDevice::Register()
return;
inst.Add(DEVTYPE_PAD, new usb_pad::PadDevice());
inst.Add(DEVTYPE_MSD, new usb_msd::MsdDevice());
inst.Add(DEVTYPE_SINGSTAR, new usb_mic::SingstarDevice());
inst.Add(DEVTYPE_LOGITECH_MIC, new usb_mic::LogitechMicDevice());
inst.Add(DEVTYPE_MICROPHONE, new usb_mic::MicrophoneDevice());
inst.Add(DEVTYPE_LOGITECH_HEADSET, new usb_mic::HeadsetDevice());
inst.Add(DEVTYPE_HIDKEYBOARD, new usb_hid::HIDKbdDevice());
inst.Add(DEVTYPE_HIDMOUSE, new usb_hid::HIDMouseDevice());

View File

@@ -26,8 +26,7 @@ enum DeviceType : s32
DEVTYPE_NONE = -1,
DEVTYPE_PAD = 0,
DEVTYPE_MSD,
DEVTYPE_SINGSTAR,
DEVTYPE_LOGITECH_MIC,
DEVTYPE_MICROPHONE,
DEVTYPE_LOGITECH_HEADSET,
DEVTYPE_HIDKEYBOARD,
DEVTYPE_HIDMOUSE,

View File

@@ -6,6 +6,8 @@
#include "usb-eyetoy-webcam.h"
#include "ov519.h"
#include "USB/qemu-usb/desc.h"
#include "USB/usb-mic/audio.h"
#include "USB/usb-mic/usb-mic.h"
#include "USB/USB.h"
#include "StateWrapper.h"
@@ -23,7 +25,7 @@ namespace usb_eyetoy
u32 subtype;
std::unique_ptr<VideoDevice> videodev;
// struct freeze {
USBDevice* mic;
uint8_t regs[0xFF]; //OV519
uint8_t i2c_regs[0xFF]; //OV764x
@@ -32,7 +34,6 @@ namespace usb_eyetoy
std::unique_ptr<unsigned char[]> mpeg_frame_data;
unsigned int mpeg_frame_size;
unsigned int mpeg_frame_offset;
// } f;
} EYETOYState;
static const USBDescStrings desc_strings = {
@@ -103,8 +104,11 @@ namespace usb_eyetoy
static void eyetoy_handle_reset(USBDevice* dev)
{
reset_controller(USB_CONTAINER_OF(dev, EYETOYState, dev));
reset_sensor(USB_CONTAINER_OF(dev, EYETOYState, dev));
EYETOYState* s = USB_CONTAINER_OF(dev, EYETOYState, dev);
reset_controller(s);
reset_sensor(s);
if (s->mic)
s->mic->klass.handle_reset(s->mic);
}
static void webcam_handle_control_eyetoy(USBDevice* dev, USBPacket* p, int request, int value, int index, int length, uint8_t* data)
@@ -328,10 +332,8 @@ namespace usb_eyetoy
}
else if (devep == 2)
{
// get audio
//Console.Warning("get audio %d\n", len);
memset(data, 0, std::min(p->buffer_size, max_ep_size));
usb_packet_copy(p, data, std::min(p->buffer_size, max_ep_size));
if (s->mic)
s->mic->klass.handle_data(s->mic, p);
}
break;
case USB_TOKEN_OUT:
@@ -367,14 +369,14 @@ namespace usb_eyetoy
break;
}
static const unsigned int max_ep_size = 960; // 961
static const unsigned int max_ep_size = 961;
u8 data[max_ep_size];
pxAssert(p->buffer_size <= max_ep_size);
static constexpr const u8 header[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28}; // 28 <> 29
std::memcpy(data, header, sizeof(header));
const u32 data_pk = std::min(p->buffer_size - static_cast<u32>(sizeof(header)), s->mpeg_frame_size);
const u32 data_pk = std::min(p->buffer_size - 1 - static_cast<u32>(sizeof(header)), s->mpeg_frame_size);
std::memcpy(data + sizeof(header), s->mpeg_frame_data.get(), data_pk);
usb_packet_copy(p, data, sizeof(header) + data_pk);
@@ -383,7 +385,7 @@ namespace usb_eyetoy
}
else if (s->mpeg_frame_offset < s->mpeg_frame_size)
{
const u32 data_pk = std::min(s->mpeg_frame_size - s->mpeg_frame_offset, p->buffer_size);
const u32 data_pk = std::min(s->mpeg_frame_size - s->mpeg_frame_offset, p->buffer_size - 1);
usb_packet_copy(p, s->mpeg_frame_data.get() + s->mpeg_frame_offset, data_pk);
s->mpeg_frame_offset += data_pk;
@@ -408,11 +410,18 @@ namespace usb_eyetoy
{
EYETOYState* s = USB_CONTAINER_OF(dev, EYETOYState, dev);
close_camera(s);
if (s->mic)
s->mic->klass.unrealize(s->mic);
delete s;
}
USBDevice* EyeToyWebCamDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
{
const usb_mic::MicrophoneDevice* mic_proxy =
static_cast<usb_mic::MicrophoneDevice*>(RegisterDevice::instance().Device(DEVTYPE_MICROPHONE));
if (!mic_proxy)
return nullptr;
std::unique_ptr<VideoDevice> videodev(VideoDevice::CreateInstance());
if (!videodev)
{
@@ -435,6 +444,8 @@ namespace usb_eyetoy
goto fail;
s->dev.klass.handle_control = webcam_handle_control_eyetoy;
s->dev.klass.handle_data = webcam_handle_data_eyetoy;
s->mic = mic_proxy->CreateDevice(si, port, 0, false, 16000, TypeName());
}
else if (subtype == TYPE_OV511P)
{
@@ -503,17 +514,42 @@ namespace usb_eyetoy
std::span<const char*> EyeToyWebCamDevice::SubTypes() const
{
static const char* subtypes[] = {
TRANSLATE_NOOP("USB", "Sony EyeToy"), TRANSLATE_NOOP("USB", "Konami Capture Eye")};
TRANSLATE_NOOP("USB", "Sony EyeToy"),
TRANSLATE_NOOP("USB", "Konami Capture Eye")
};
return subtypes;
}
std::span<const SettingInfo> EyeToyWebCamDevice::Settings(u32 subtype) const
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "device_name", TRANSLATE_NOOP("USB", "Device Name"),
TRANSLATE_NOOP("USB", "Selects the device to capture images from."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &VideoDevice::GetDeviceList},
};
return info;
switch (subtype)
{
case TYPE_EYETOY:
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "device_name", TRANSLATE_NOOP("USB", "Video Device"),
TRANSLATE_NOOP("USB", "Selects the device to capture images from."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &VideoDevice::GetDeviceList},
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Audio Device"),
TRANSLATE_NOOP("USB", "Selects the device to read audio from."), "", nullptr, nullptr, nullptr, nullptr,
nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::Integer, "input_latency", TRANSLATE_NOOP("USB", "Audio Latency"),
TRANSLATE_NOOP("USB", "Specifies the latency to the host input device."),
AudioDevice::DEFAULT_LATENCY_STR, "1", "1000", "1", TRANSLATE_NOOP("USB", "%dms"), nullptr, nullptr, 1.0f},
};
return info;
}
case TYPE_OV511P:
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "device_name", TRANSLATE_NOOP("USB", "Video Device"),
TRANSLATE_NOOP("USB", "Selects the device to capture images from."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &VideoDevice::GetDeviceList},
};
return info;
}
default:
return {};
}
}
} // namespace usb_eyetoy

View File

@@ -1,256 +0,0 @@
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+
#include "usb-mic-singstar.h"
#include "audio.h"
#include "USB/qemu-usb/desc.h"
#include "USB/qemu-usb/USBinternal.h"
namespace usb_mic
{
static const uint8_t logitech_mic_dev_descriptor[] = {
/* bLength */ 0x12, //(18)
/* bDescriptorType */ 0x01, //(1)
/* bcdUSB */ WBVAL(0x0110), //(272)
/* bDeviceClass */ 0x00, //(0)
/* bDeviceSubClass */ 0x00, //(0)
/* bDeviceProtocol */ 0x00, //(0)
/* bMaxPacketSize0 */ 0x08, //(8)
/* idVendor */ WBVAL(0x046D),
/* idProduct */ WBVAL(0x0000), //(0)
/* bcdDevice */ WBVAL(0x0001), //(1)
/* iManufacturer */ 0x01, //(1)
/* iProduct */ 0x02, //(2)
/* iSerialNumber */ 0x00, //(0) unused
/* bNumConfigurations */ 0x01, //(1)
};
static const uint8_t logitech_mic_config_descriptor[] = {
/* Configuration 1 */
0x09, /* bLength */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
WBVAL(0x00b1), /* wTotalLength */
0x02, /* bNumInterfaces */
0x01, /* bConfigurationValue */
0x00, /* iConfiguration */
USB_CONFIG_BUS_POWERED, /* bmAttributes */
USB_CONFIG_POWER_MA(90), /* bMaxPower */
/* Interface 0, Alternate Setting 0, Audio Control */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Control Interface */
AUDIO_CONTROL_INTERFACE_DESC_SZ(1), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */
WBVAL(0x0100), /* 1.00 */ /* bcdADC */
WBVAL(0x0028), /* wTotalLength */
0x01, /* bInCollection */
0x01, /* baInterfaceNr */
/* Audio Input Terminal */
AUDIO_INPUT_TERMINAL_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */
0x01, /* bTerminalID */
WBVAL(AUDIO_TERMINAL_MICROPHONE), /* wTerminalType */
0x02, /* bAssocTerminal */
0x02, /* bNrChannels */
WBVAL(AUDIO_CHANNEL_L | AUDIO_CHANNEL_R), /* wChannelConfig */
0x00, /* iChannelNames */
0x00, /* iTerminal */
/* Audio Output Terminal */
AUDIO_OUTPUT_TERMINAL_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */
0x02, /* bTerminalID */
WBVAL(AUDIO_TERMINAL_USB_STREAMING), /* wTerminalType */
0x01, /* bAssocTerminal */
0x03, /* bSourceID */
0x00, /* iTerminal */
/* Audio Feature Unit */
AUDIO_FEATURE_UNIT_DESC_SZ(2, 1), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_FEATURE_UNIT, /* bDescriptorSubtype */
0x03, /* bUnitID */
0x01, /* bSourceID */
0x01, /* bControlSize */
0x01, /* bmaControls(0) */
0x02, /* bmaControls(1) */
0x02, /* bmaControls(2) */
0x00, /* iTerminal */
/* Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Interface 1, Alternate Setting 1, Audio Streaming - Operational */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x01, /* bAlternateSetting */
0x01, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Streaming Interface */
AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */
0x02, /* bTerminalLink */
0x01, /* bDelay */
WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag */
/* Audio Type I Format */
AUDIO_FORMAT_TYPE_I_DESC_SZ(5), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */
AUDIO_FORMAT_TYPE_I, /* bFormatType */
0x01, /* bNrChannels */
0x02, /* bSubFrameSize */
0x10, /* bBitResolution */
0x05, /* bSamFreqType */
B3VAL(8000), /* tSamFreq 1 */
B3VAL(11025), /* tSamFreq 2 */
B3VAL(22050), /* tSamFreq 3 */
B3VAL(44100), /* tSamFreq 4 */
B3VAL(48000), /* tSamFreq 5 */
/* Endpoint - Standard Descriptor */
AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
USB_ENDPOINT_IN(1), /* bEndpointAddress */
USB_ENDPOINT_TYPE_ISOCHRONOUS | USB_ENDPOINT_SYNC_ASYNCHRONOUS, /* bmAttributes */
WBVAL(0x0064), /* wMaxPacketSize */
0x01, /* bInterval */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* Endpoint - Audio Streaming */
AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
0x01, /* bmAttributes */
0x00, /* bLockDelayUnits */
WBVAL(0x0000), /* wLockDelay */
/* Interface 1, Alternate Setting 2, Audio Streaming - ? */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x02, /* bAlternateSetting */
0x01, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Streaming Interface */
AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */
0x02, /* bTerminalLink */
0x01, /* bDelay */
WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag */
/* Audio Type I Format */
AUDIO_FORMAT_TYPE_I_DESC_SZ(5), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */
AUDIO_FORMAT_TYPE_I, /* bFormatType */
0x02, /* bNrChannels */
0x02, /* bSubFrameSize */
0x10, /* bBitResolution */
0x05, /* bSamFreqType */
B3VAL(8000), /* tSamFreq 1 */
B3VAL(11025), /* tSamFreq 2 */
B3VAL(22050), /* tSamFreq 3 */
B3VAL(44100), /* tSamFreq 4 */
B3VAL(48000), /* tSamFreq 5 */
/* Endpoint - Standard Descriptor */
AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
USB_ENDPOINT_IN(1), /* bEndpointAddress */
USB_ENDPOINT_TYPE_ISOCHRONOUS | USB_ENDPOINT_SYNC_ASYNCHRONOUS, /* bmAttributes */
WBVAL(0x00c8), /* wMaxPacketSize */
0x01, /* bInterval */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* Endpoint - Audio Streaming */
AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
0x01, /* bmAttributes */
0x00, /* bLockDelayUnits */
WBVAL(0x0000), /* wLockDelay */
/* Terminator */
0 /* bLength */
};
static const USBDescStrings lt_desc_strings = {
"",
"Logitech",
"USBMIC",
};
//Minified state
struct SINGSTARMICMINIState
{
USBDevice dev;
USBDesc desc;
USBDescDevice desc_dev;
};
USBDevice* LogitechMicDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
{
USBDevice* dev = SingstarDevice::CreateDevice(si, port, subtype, false, LogitechMicDevice::TypeName());
if (!dev)
return nullptr;
SINGSTARMICMINIState* s = USB_CONTAINER_OF(dev, SINGSTARMICMINIState, dev);
s->desc = {};
s->desc_dev = {};
s->desc.str = lt_desc_strings;
s->desc.full = &s->desc_dev;
if (usb_desc_parse_dev(logitech_mic_dev_descriptor, sizeof(logitech_mic_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(logitech_mic_config_descriptor, sizeof(logitech_mic_config_descriptor), s->desc_dev) < 0)
goto fail;
s->dev.klass.usb_desc = &s->desc;
s->dev.klass.product_desc = lt_desc_strings[2];
usb_desc_init(&s->dev);
return dev;
fail:
s->dev.klass.unrealize(dev);
return nullptr;
}
} // namespace usb_mic

View File

@@ -27,7 +27,7 @@
#include "USB/qemu-usb/qusb.h"
#include "USB/qemu-usb/desc.h"
#include "USB/qemu-usb/USBinternal.h"
#include "USB/usb-mic/usb-mic-singstar.h"
#include "USB/usb-mic/usb-mic.h"
#include "USB/usb-mic/audiodev.h"
#include "USB/usb-mic/audiodev-noop.h"
#include "USB/usb-mic/audiodev-cubeb.h"
@@ -55,13 +55,13 @@ namespace usb_mic
{
/*
* A USB audio device supports an arbitrary number of alternate
* interface settings for each interface. Each corresponds to a block
* diagram of parameterized blocks. This can thus refer to things like
* number of channels, data rates, or in fact completely different
* block diagrams. Alternative setting 0 is always the null block diagram,
* which is used by a disabled device.
*/
* A USB audio device supports an arbitrary number of alternate
* interface settings for each interface. Each corresponds to a block
* diagram of parameterized blocks. This can thus refer to things like
* number of channels, data rates, or in fact completely different
* block diagrams. Alternative setting 0 is always the null block diagram,
* which is used by a disabled device.
*/
enum usb_audio_altset : int8_t
{
ALTSET_OFF = 0x00, /* No endpoint */
@@ -93,15 +93,27 @@ namespace usb_mic
//uint8_t fifo[2][200]; //on-chip 400byte fifo
};
static const USBDescStrings desc_strings = {
static const USBDescStrings singstar_desc_strings = {
"",
"Nam Tai E&E Products Ltd.",
"USBMIC",
"310420811",
};
static const USBDescStrings logitech_desc_strings = {
"",
"Logitech",
"USBMIC",
};
static const USBDescStrings ak5370_desc_strings = {
"",
"AKM",
"AK5370"
};
/* descriptor dumped from a real singstar MIC adapter */
static const uint8_t singstar_mic_dev_descriptor[] = {
static const uint8_t singstar_dev_descriptor[] = {
/* bLength */ 0x12, //(18)
/* bDescriptorType */ 0x01, //(1)
/* bcdUSB */ WBVAL(0x0110), //(272)
@@ -116,11 +128,9 @@ namespace usb_mic
/* iProduct */ 0x02, //(2)
/* iSerialNumber */ 0x00, //(0) unused
/* bNumConfigurations */ 0x01, //(1)
};
static const uint8_t singstar_mic_config_descriptor[] = {
static const uint8_t singstar_config_descriptor[] = {
/* Configuration 1 */
0x09, /* bLength */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
@@ -196,7 +206,7 @@ namespace usb_mic
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Interface 1, Alternate Setting 1, Audio Streaming - Operational */
/* Interface 1, Alternate Setting 1, Audio Streaming - 1 channel */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
@@ -248,7 +258,7 @@ namespace usb_mic
0x00, /* bLockDelayUnits */
WBVAL(0x0000), /* wLockDelay */
/* Interface 1, Alternate Setting 2, Audio Streaming - ? */
/* Interface 1, Alternate Setting 2, Audio Streaming - 2 channels */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
@@ -304,8 +314,337 @@ namespace usb_mic
0 /* bLength */
};
static const uint8_t logitech_dev_descriptor[] = {
/* bLength */ 0x12, //(18)
/* bDescriptorType */ 0x01, //(1)
/* bcdUSB */ WBVAL(0x0110), //(272)
/* bDeviceClass */ 0x00, //(0)
/* bDeviceSubClass */ 0x00, //(0)
/* bDeviceProtocol */ 0x00, //(0)
/* bMaxPacketSize0 */ 0x08, //(8)
/* idVendor */ WBVAL(0x046D),
/* idProduct */ WBVAL(0x0000), //(0)
/* bcdDevice */ WBVAL(0x0001), //(1)
/* iManufacturer */ 0x01, //(1)
/* iProduct */ 0x02, //(2)
/* iSerialNumber */ 0x00, //(0) unused
/* bNumConfigurations */ 0x01, //(1)
};
static void singstar_mic_handle_reset(USBDevice* dev)
static const uint8_t logitech_config_descriptor[] = {
/* Configuration 1 */
0x09, /* bLength */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
WBVAL(0x00b1), /* wTotalLength */
0x02, /* bNumInterfaces */
0x01, /* bConfigurationValue */
0x00, /* iConfiguration */
USB_CONFIG_BUS_POWERED, /* bmAttributes */
USB_CONFIG_POWER_MA(90), /* bMaxPower */
/* Interface 0, Alternate Setting 0, Audio Control */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Control Interface */
AUDIO_CONTROL_INTERFACE_DESC_SZ(1), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */
WBVAL(0x0100), /* 1.00 */ /* bcdADC */
WBVAL(0x0028), /* wTotalLength */
0x01, /* bInCollection */
0x01, /* baInterfaceNr */
/* Audio Input Terminal */
AUDIO_INPUT_TERMINAL_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */
0x01, /* bTerminalID */
WBVAL(AUDIO_TERMINAL_MICROPHONE), /* wTerminalType */
0x02, /* bAssocTerminal */
0x02, /* bNrChannels */
WBVAL(AUDIO_CHANNEL_L | AUDIO_CHANNEL_R), /* wChannelConfig */
0x00, /* iChannelNames */
0x00, /* iTerminal */
/* Audio Output Terminal */
AUDIO_OUTPUT_TERMINAL_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */
0x02, /* bTerminalID */
WBVAL(AUDIO_TERMINAL_USB_STREAMING), /* wTerminalType */
0x01, /* bAssocTerminal */
0x03, /* bSourceID */
0x00, /* iTerminal */
/* Audio Feature Unit */
AUDIO_FEATURE_UNIT_DESC_SZ(2, 1), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_CONTROL_FEATURE_UNIT, /* bDescriptorSubtype */
0x03, /* bUnitID */
0x01, /* bSourceID */
0x01, /* bControlSize */
0x01, /* bmaControls(0) */
0x02, /* bmaControls(1) */
0x02, /* bmaControls(2) */
0x00, /* iTerminal */
/* Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Interface 1, Alternate Setting 1, Audio Streaming - 1 channel */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x01, /* bAlternateSetting */
0x01, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Streaming Interface */
AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */
0x02, /* bTerminalLink */
0x01, /* bDelay */
WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag */
/* Audio Type I Format */
AUDIO_FORMAT_TYPE_I_DESC_SZ(5), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */
AUDIO_FORMAT_TYPE_I, /* bFormatType */
0x01, /* bNrChannels */
0x02, /* bSubFrameSize */
0x10, /* bBitResolution */
0x05, /* bSamFreqType */
B3VAL(8000), /* tSamFreq 1 */
B3VAL(11025), /* tSamFreq 2 */
B3VAL(22050), /* tSamFreq 3 */
B3VAL(44100), /* tSamFreq 4 */
B3VAL(48000), /* tSamFreq 5 */
/* Endpoint - Standard Descriptor */
AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
USB_ENDPOINT_IN(1), /* bEndpointAddress */
USB_ENDPOINT_TYPE_ISOCHRONOUS | USB_ENDPOINT_SYNC_ASYNCHRONOUS, /* bmAttributes */
WBVAL(0x0064), /* wMaxPacketSize */
0x01, /* bInterval */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* Endpoint - Audio Streaming */
AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
0x01, /* bmAttributes */
0x00, /* bLockDelayUnits */
WBVAL(0x0000), /* wLockDelay */
/* Interface 1, Alternate Setting 2, Audio Streaming - 2 channels */
USB_INTERFACE_DESC_SIZE, /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x02, /* bAlternateSetting */
0x01, /* bNumEndpoints */
USB_CLASS_AUDIO, /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
0x00, /* iInterface */
/* Audio Streaming Interface */
AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */
0x02, /* bTerminalLink */
0x01, /* bDelay */
WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag */
/* Audio Type I Format */
AUDIO_FORMAT_TYPE_I_DESC_SZ(5), /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */
AUDIO_FORMAT_TYPE_I, /* bFormatType */
0x02, /* bNrChannels */
0x02, /* bSubFrameSize */
0x10, /* bBitResolution */
0x05, /* bSamFreqType */
B3VAL(8000), /* tSamFreq 1 */
B3VAL(11025), /* tSamFreq 2 */
B3VAL(22050), /* tSamFreq 3 */
B3VAL(44100), /* tSamFreq 4 */
B3VAL(48000), /* tSamFreq 5 */
/* Endpoint - Standard Descriptor */
AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
USB_ENDPOINT_IN(1), /* bEndpointAddress */
USB_ENDPOINT_TYPE_ISOCHRONOUS | USB_ENDPOINT_SYNC_ASYNCHRONOUS, /* bmAttributes */
WBVAL(0x00c8), /* wMaxPacketSize */
0x01, /* bInterval */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* Endpoint - Audio Streaming */
AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
0x01, /* bmAttributes */
0x00, /* bLockDelayUnits */
WBVAL(0x0000), /* wLockDelay */
/* Terminator */
0 /* bLength */
};
static const uint8_t ak5370_dev_descriptor[] = {
0x12, // bLength
0x01, // bDescriptorType (Device)
0x10, 0x01, // bcdUSB 1.10
0x00, // bDeviceClass (Use class information in the Interface Descriptors)
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
0x08, // bMaxPacketSize0 8
0x56, 0x05, // idVendor 0x0556
0x01, 0x00, // idProduct 0x0001
0x01, 0x00, // bcdDevice 0.01
0x01, // iManufacturer (String Index)
0x02, // iProduct (String Index)
0x00, // iSerialNumber (String Index)
0x01, // bNumConfigurations 1
};
static const uint8_t ak5370_config_descriptor[] = {
0x09, // bLength
0x02, // bDescriptorType (Configuration)
0x76, 0x00, // wTotalLength 118
0x02, // bNumInterfaces 2
0x01, // bConfigurationValue
0x00, // iConfiguration (String Index)
0x80, // bmAttributes
0x2D, // bMaxPower 90mA
0x09, // bLength
0x04, // bDescriptorType (Interface)
0x00, // bInterfaceNumber 0
0x00, // bAlternateSetting
0x00, // bNumEndpoints 0
0x01, // bInterfaceClass (Audio)
0x01, // bInterfaceSubClass (Audio Control)
0x00, // bInterfaceProtocol
0x00, // iInterface (String Index)
0x09, // bLength
0x24, // bDescriptorType (See Next Line)
0x01, // bDescriptorSubtype (CS_INTERFACE -> HEADER)
0x00, 0x01, // bcdADC 1.00
0x26, 0x00, // wTotalLength 38
0x01, // binCollection 0x01
0x01, // baInterfaceNr 1
0x0C, // bLength
0x24, // bDescriptorType (See Next Line)
0x02, // bDescriptorSubtype (CS_INTERFACE -> INPUT_TERMINAL)
0x01, // bTerminalID
0x01, 0x02, // wTerminalType (Microphone)
0x02, // bAssocTerminal
0x01, // bNrChannels 1
0x00, 0x00, // wChannelConfig
0x00, // iChannelNames
0x00, // iTerminal
0x09, // bLength
0x24, // bDescriptorType (See Next Line)
0x03, // bDescriptorSubtype (CS_INTERFACE -> OUTPUT_TERMINAL)
0x02, // bTerminalID
0x01, 0x01, // wTerminalType (USB Streaming)
0x01, // bAssocTerminal
0x03, // bSourceID
0x00, // iTerminal
0x08, // bLength
0x24, // bDescriptorType (See Next Line)
0x06, // bDescriptorSubtype (CS_INTERFACE -> FEATURE_UNIT)
0x03, // bUnitID
0x01, // bSourceID
0x01, // bControlSize 1
0x43, 0x00, // bmaControls[0] (Mute,Volume,Automatic)
0x09, // bLength
0x04, // bDescriptorType (Interface)
0x01, // bInterfaceNumber 1
0x00, // bAlternateSetting
0x00, // bNumEndpoints 0
0x01, // bInterfaceClass (Audio)
0x02, // bInterfaceSubClass (Audio Streaming)
0x00, // bInterfaceProtocol
0x00, // iInterface (String Index)
0x09, // bLength
0x04, // bDescriptorType (Interface)
0x01, // bInterfaceNumber 1
0x01, // bAlternateSetting
0x01, // bNumEndpoints 1
0x01, // bInterfaceClass (Audio)
0x02, // bInterfaceSubClass (Audio Streaming)
0x00, // bInterfaceProtocol
0x00, // iInterface (String Index)
0x07, // bLength
0x24, // bDescriptorType (See Next Line)
0x01, // bDescriptorSubtype (CS_INTERFACE -> AS_GENERAL)
0x02, // bTerminalLink
0x01, // bDelay 1
0x01, 0x00, // wFormatTag (PCM)
0x17, // bLength
0x24, // bDescriptorType (See Next Line)
0x02, // bDescriptorSubtype (CS_INTERFACE -> FORMAT_TYPE)
0x01, // bFormatType 1
0x01, // bNrChannels (Mono)
0x02, // bSubFrameSize 2
0x10, // bBitResolution 16
0x05, // bSamFreqType 5
0x40, 0x1F, 0x00, // tSamFreq[1] 8000 Hz
0x11, 0x2B, 0x00, // tSamFreq[2] 11025 Hz
0x22, 0x56, 0x00, // tSamFreq[3] 22050 Hz
0x44, 0xAC, 0x00, // tSamFreq[4] 44100 Hz
0x80, 0xBB, 0x00, // tSamFreq[5] 48000 Hz
0x07, // bLength
0x05, // bDescriptorType (See Next Line)
0x81, // bEndpointAddress (IN/D2H)
0x01, // bmAttributes (Isochronous, No Sync, Data EP)
0x64, 0x00, // wMaxPacketSize 100
0x01, // bInterval 1 (unit depends on device speed)
0x07, // bLength
0x25, // bDescriptorType (See Next Line)
0x01, // bDescriptorSubtype (CS_ENDPOINT -> EP_GENERAL)
0x01, // bmAttributes (Sampling Freq Control)
0x00, // bLockDelayUnits
0x00, 0x00, // wLockDelay 0
};
static void usb_mic_handle_reset(USBDevice* dev)
{
/* XXX: do it */
return;
@@ -320,9 +659,9 @@ namespace usb_mic
//0x0300 - feature bUnitID 0x03
static int usb_audio_get_control(SINGSTARMICState* s, uint8_t attrib, uint16_t cscn, uint16_t idif, int length, uint8_t* data)
{
uint8_t cs = cscn >> 8;
uint8_t cn = cscn - 1; /* -1 for the non-present master control */
uint32_t aid = ATTRIB_ID(cs, attrib, idif);
const uint8_t cs = cscn >> 8;
const uint8_t cn = cscn - 1; /* -1 for the non-present master control */
const uint32_t aid = ATTRIB_ID(cs, attrib, idif);
int ret = USB_RET_STALL;
switch (aid)
@@ -332,17 +671,16 @@ namespace usb_mic
ret = 1;
break;
case ATTRIB_ID(AUDIO_VOLUME_CONTROL, AUDIO_REQUEST_GET_CUR, 0x0300):
if (cn < 2)
if (cn < 2 || cn == 0xff)
{
//uint16_t vol = (s->f.vol[cn] * 0x8800 + 127) / 255 + 0x8000;
uint16_t vol = (s->f.vol[cn] * 0x8800 + 127) / 255 + 0x8000;
const uint16_t vol = (s->f.vol[cn == 1 ? 1 : 0] * 0x8800 + 127) / 255 + 0x8000;
data[0] = (uint8_t)(vol & 0xFF);
data[1] = vol >> 8;
ret = 2;
}
break;
case ATTRIB_ID(AUDIO_VOLUME_CONTROL, AUDIO_REQUEST_GET_MIN, 0x0300):
if (cn < 2)
if (cn < 2 || cn == 0xff)
{
data[0] = 0x01;
data[1] = 0x80;
@@ -352,7 +690,7 @@ namespace usb_mic
}
break;
case ATTRIB_ID(AUDIO_VOLUME_CONTROL, AUDIO_REQUEST_GET_MAX, 0x0300):
if (cn < 2)
if (cn < 2 || cn == 0xff)
{
data[0] = 0x00;
data[1] = 0x08;
@@ -362,7 +700,7 @@ namespace usb_mic
}
break;
case ATTRIB_ID(AUDIO_VOLUME_CONTROL, AUDIO_REQUEST_GET_RES, 0x0300):
if (cn < 2)
if (cn < 2 || cn == 0xff)
{
data[0] = 0x88;
data[1] = 0x00;
@@ -390,7 +728,7 @@ namespace usb_mic
ret = 0;
break;
case ATTRIB_ID(AUDIO_VOLUME_CONTROL, AUDIO_REQUEST_SET_CUR, 0x0300):
if (cn < 2)
if (cn < 2 || cn == 0xff)
{
uint16_t vol = data[0] + (data[1] << 8);
@@ -400,12 +738,25 @@ namespace usb_mic
if (vol > 255)
vol = 255;
if (s->f.vol[cn] != vol)
s->f.vol[cn] = (uint8_t)vol;
if (cn == 0xff)
{
if (s->f.vol[0] != vol)
s->f.vol[0] = (uint8_t)vol;
if (s->f.vol[1] != vol)
s->f.vol[1] = (uint8_t)vol;
}
else
{
if (s->f.vol[cn] != vol)
s->f.vol[cn] = (uint8_t)vol;
}
ret = 0;
}
break;
case ATTRIB_ID(AUDIO_AUTOMATIC_GAIN_CONTROL, AUDIO_REQUEST_SET_CUR, 0x0300):
ret = 0;
break;
}
return ret;
@@ -418,32 +769,41 @@ namespace usb_mic
uint32_t aid = ATTRIB_ID(cs, attrib, ep);
int ret = USB_RET_STALL;
//cs 1 cn 0xFF, ep 0x81 attrib 1
Console.Warning("singstar: ep control cs %x, cn %X, %X %X data:", cs, cn, attrib, ep);
Console.Warning("usb_mic: ep control: cs=0x%x, cn=0x%X, attrib=0x%X, ep=0x%X", cs, cn, attrib, ep);
/*for(int i=0; i<length; i++)
Console.Warning("%02X ", data[i]);
Console.Warning("\n");*/
Console.Warning("\n");*/
switch (aid)
{
case ATTRIB_ID(AUDIO_SAMPLING_FREQ_CONTROL, AUDIO_REQUEST_SET_CUR, 0x81):
if (cn == 0xFF)
{
s->f.srate[0] = data[0] | (data[1] << 8) | (data[2] << 16);
s->f.srate[1] = s->f.srate[0];
const uint32_t sr = data[0] | (data[1] << 8) | (data[2] << 16);
if (s->f.srate[0] != sr)
{
s->f.srate[0] = sr;
if (s->audsrc[0])
s->audsrc[0]->SetResampling(s->f.srate[0]);
if (s->audsrc[0])
s->audsrc[0]->SetResampling(s->f.srate[0]);
if (s->audsrc[1])
s->audsrc[1]->SetResampling(s->f.srate[1]);
}
if (s->f.srate[1] != sr)
{
s->f.srate[1] = sr;
if (s->audsrc[1])
s->audsrc[1]->SetResampling(s->f.srate[1]);
}
}
else if (cn < 2)
{
s->f.srate[cn] = data[0] | (data[1] << 8) | (data[2] << 16);
if (s->audsrc[cn])
s->audsrc[cn]->SetResampling(s->f.srate[cn]);
const uint32_t sr = data[0] | (data[1] << 8) | (data[2] << 16);
if (s->f.srate[cn] != sr)
{
s->f.srate[cn] = sr;
if (s->audsrc[cn])
s->audsrc[cn]->SetResampling(s->f.srate[cn]);
}
}
ret = 0;
break;
@@ -458,7 +818,7 @@ namespace usb_mic
return ret;
}
static void singstar_mic_set_interface(USBDevice* dev, int intf, int alt_old, int alt_new)
static void usb_mic_set_interface(USBDevice* dev, int intf, int alt_old, int alt_new)
{
SINGSTARMICState* s = USB_CONTAINER_OF(dev, SINGSTARMICState, dev);
s->f.intf = alt_new;
@@ -472,7 +832,7 @@ namespace usb_mic
#endif
}
static void singstar_mic_handle_control(USBDevice* dev, USBPacket* p, int request, int value, int index, int length, uint8_t* data)
static void usb_mic_handle_control(USBDevice* dev, USBPacket* p, int request, int value, int index, int length, uint8_t* data)
{
SINGSTARMICState* s = USB_CONTAINER_OF(dev, SINGSTARMICState, dev);
int ret = 0;
@@ -487,8 +847,8 @@ namespace usb_mic
switch (request)
{
/*
* Audio device specific request
*/
* Audio device specific request
*/
case ClassInterfaceRequest | AUDIO_REQUEST_GET_CUR:
case ClassInterfaceRequest | AUDIO_REQUEST_GET_MIN:
case ClassInterfaceRequest | AUDIO_REQUEST_GET_MAX:
@@ -496,7 +856,7 @@ namespace usb_mic
ret = usb_audio_get_control(s, request & 0xff, value, index, length, data);
if (ret < 0)
{
Console.Warning("singstar: fail: get control\n");
Console.Warning("usb_mic: fail: get control, req=%02x, val=%02x, idx=%02x, ret=%d", request, value, index, ret);
goto fail;
}
p->actual_length = ret;
@@ -509,7 +869,7 @@ namespace usb_mic
ret = usb_audio_set_control(s, request & 0xff, value, index, length, data);
if (ret < 0)
{
Console.Warning("singstar: fail: set control\n data:");
Console.Warning("usb_mic: fail: set control, req=%02x, val=%02x, idx=%02x", request, value, index);
goto fail;
}
break;
@@ -540,28 +900,25 @@ namespace usb_mic
return (int16_t)((int32_t)sample * vol / 0xFF);
}
static void singstar_mic_handle_data(USBDevice* dev, USBPacket* p)
static void usb_mic_handle_data(USBDevice* dev, USBPacket* p)
{
SINGSTARMICState* s = USB_CONTAINER_OF(dev, SINGSTARMICState, dev);
int ret = 0;
uint8_t devep = p->ep->nr;
switch (p->pid)
{
case USB_TOKEN_IN:
//Console.Warning("token in ep: %d len: %zd\n", devep, p->iov.size);
if (devep == 1)
{
//TODO
int outChns = s->f.intf == 1 ? 1 : 2;
int outChns = s->f.intf == 2 ? 2 : 1;
uint32_t frames, out_frames[2] = {0}, chn;
int16_t *src1, *src2;
int16_t* dst = (int16_t*)p->buffer_ptr;
size_t len = p->buffer_size;
// send only 1ms (bInterval) of samples
if (s->f.srate[0] == 48000 || s->f.srate[0] == 8000)
if (s->f.srate[0] == 48000 || s->f.srate[0] == 8000 || s->f.srate[0] == 16000)
len = std::min<u32>(p->buffer_size, outChns * sizeof(int16_t) * s->f.srate[0] / 1000);
//Divide 'len' bytes between 2 channels of 16 bits
@@ -661,7 +1018,7 @@ namespace usb_mic
if (!file)
{
char name[1024] = {0};
snprintf(name, sizeof(name), "singstar_%dch_%uHz.raw", outChns, s->f.srate[0]);
snprintf(name, sizeof(name), "usb_mic_%dch_%uHz.raw", outChns, s->f.srate[0]);
file = fopen(name, "wb");
}
@@ -679,7 +1036,7 @@ namespace usb_mic
}
static void singstar_mic_handle_destroy(USBDevice* dev)
static void usb_mic_handle_destroy(USBDevice* dev)
{
SINGSTARMICState* s = USB_CONTAINER_OF(dev, SINGSTARMICState, dev);
if (file)
@@ -701,13 +1058,20 @@ namespace usb_mic
delete s;
}
USBDevice* SingstarDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
USBDevice* MicrophoneDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
{
return CreateDevice(si, port, subtype, true, SingstarDevice::TypeName());
if (subtype >= MIC_COUNT)
return nullptr;
static const bool dual_mic = subtype == MIC_SINGSTAR;
return CreateDevice(si, port, subtype, dual_mic, 48000, MicrophoneDevice::TypeName());
}
USBDevice* SingstarDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype, bool dual_mic, const char* devtype) const
USBDevice* MicrophoneDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype, bool dual_mic, const int samplerate, const char* devtype) const
{
if (subtype >= MIC_COUNT)
return nullptr;
SINGSTARMICState* s = new SINGSTARMICState();
if (dual_mic)
@@ -773,54 +1137,74 @@ namespace usb_mic
Host::OSD_ERROR_DURATION);
goto fail;
}
s->audsrc[i]->SetResampling(samplerate);
}
}
s->desc.full = &s->desc_dev;
s->desc.str = desc_strings;
if (usb_desc_parse_dev(singstar_mic_dev_descriptor, sizeof(singstar_mic_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(singstar_mic_config_descriptor, sizeof(singstar_mic_config_descriptor), s->desc_dev) < 0)
goto fail;
switch (subtype)
{
case MIC_SINGSTAR:
s->desc.str = singstar_desc_strings;
if (usb_desc_parse_dev(singstar_dev_descriptor, sizeof(singstar_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(singstar_config_descriptor, sizeof(singstar_config_descriptor), s->desc_dev) < 0)
goto fail;
break;
case MIC_LOGITECH:
s->desc.str = logitech_desc_strings;
if (usb_desc_parse_dev(logitech_dev_descriptor, sizeof(logitech_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(logitech_config_descriptor, sizeof(logitech_config_descriptor), s->desc_dev) < 0)
goto fail;
break;
case MIC_KONAMI:
s->desc.str = ak5370_desc_strings;
if (usb_desc_parse_dev(ak5370_dev_descriptor, sizeof(ak5370_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(ak5370_config_descriptor, sizeof(ak5370_config_descriptor), s->desc_dev) < 0)
goto fail;
break;
}
s->dev.speed = USB_SPEED_FULL;
s->dev.klass.handle_attach = usb_desc_attach;
s->dev.klass.handle_reset = singstar_mic_handle_reset;
s->dev.klass.handle_control = singstar_mic_handle_control;
s->dev.klass.handle_data = singstar_mic_handle_data;
s->dev.klass.set_interface = singstar_mic_set_interface;
s->dev.klass.unrealize = singstar_mic_handle_destroy;
s->dev.klass.handle_reset = usb_mic_handle_reset;
s->dev.klass.handle_control = usb_mic_handle_control;
s->dev.klass.handle_data = usb_mic_handle_data;
s->dev.klass.set_interface = usb_mic_set_interface;
s->dev.klass.unrealize = usb_mic_handle_destroy;
s->dev.klass.usb_desc = &s->desc;
s->dev.klass.product_desc = desc_strings[2];
s->dev.klass.product_desc = singstar_desc_strings[2];
// set defaults
s->f.vol[0] = 240; /* 0 dB */
s->f.vol[1] = 240; /* 0 dB */
s->f.srate[0] = 48000;
s->f.srate[1] = 48000;
s->f.srate[0] = samplerate;
s->f.srate[1] = samplerate;
usb_desc_init(&s->dev);
usb_ep_init(&s->dev);
singstar_mic_handle_reset(&s->dev);
usb_mic_handle_reset(&s->dev);
return &s->dev;
fail:
singstar_mic_handle_destroy(&s->dev);
usb_mic_handle_destroy(&s->dev);
return nullptr;
}
const char* SingstarDevice::Name() const
const char* MicrophoneDevice::Name() const
{
return TRANSLATE_NOOP("USB", "Singstar");
return TRANSLATE_NOOP("USB", "Microphone");
}
const char* SingstarDevice::TypeName() const
const char* MicrophoneDevice::TypeName() const
{
return "singstar";
}
bool SingstarDevice::Freeze(USBDevice* dev, StateWrapper& sw) const
bool MicrophoneDevice::Freeze(USBDevice* dev, StateWrapper& sw) const
{
SINGSTARMICState* s = USB_CONTAINER_OF(dev, SINGSTARMICState, dev);
if (!sw.DoMarker("SINGSTARMICState"))
@@ -845,48 +1229,55 @@ namespace usb_mic
return !sw.HasError();
}
void SingstarDevice::UpdateSettings(USBDevice* dev, SettingsInterface& si) const
void MicrophoneDevice::UpdateSettings(USBDevice* dev, SettingsInterface& si) const
{
// TODO: Reload devices.
}
std::span<const SettingInfo> SingstarDevice::Settings(u32 subtype) const
std::span<const char*> MicrophoneDevice::SubTypes() const
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "player1_device_name", TRANSLATE_NOOP("USB", "Player 1 Device"),
TRANSLATE_NOOP("USB", "Selects the input for the first player."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::StringList, "player2_device_name", TRANSLATE_NOOP("USB", "Player 2 Device"),
TRANSLATE_NOOP("USB", "Selects the input for the second player."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::Integer, "input_latency", TRANSLATE_NOOP("USB", "Input Latency"),
TRANSLATE_NOOP("USB", "Specifies the latency to the host input device."),
AudioDevice::DEFAULT_LATENCY_STR, "1", "1000", "1", TRANSLATE_NOOP("USB", "%dms"), nullptr, nullptr, 1.0f},
static const char* subtypes[] = {
TRANSLATE_NOOP("USB", "Singstar"),
TRANSLATE_NOOP("USB", "Logitech"),
TRANSLATE_NOOP("USB", "Konami"),
};
return info;
return subtypes;
}
const char* LogitechMicDevice::TypeName() const
std::span<const SettingInfo> MicrophoneDevice::Settings(u32 subtype) const
{
return "logitech_usbmic";
}
const char* LogitechMicDevice::Name() const
{
return TRANSLATE_NOOP("USB", "Logitech USB Mic");
}
std::span<const SettingInfo> LogitechMicDevice::Settings(u32 subtype) const
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"),
TRANSLATE_NOOP("USB", "Selects the device to read audio from."), "", nullptr, nullptr, nullptr, nullptr,
nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::Integer, "input_latency", TRANSLATE_NOOP("USB", "Input Latency"),
TRANSLATE_NOOP("USB", "Specifies the latency to the host input device."),
AudioDevice::DEFAULT_LATENCY_STR, "1", "1000", "1", TRANSLATE_NOOP("USB", "%dms"), nullptr, nullptr, 1.0f},
};
return info;
switch (subtype)
{
case MIC_SINGSTAR:
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "player1_device_name", TRANSLATE_NOOP("USB", "Player 1 Device"),
TRANSLATE_NOOP("USB", "Selects the input for the first player."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::StringList, "player2_device_name", TRANSLATE_NOOP("USB", "Player 2 Device"),
TRANSLATE_NOOP("USB", "Selects the input for the second player."), "", nullptr, nullptr, nullptr,
nullptr, nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::Integer, "input_latency", TRANSLATE_NOOP("USB", "Input Latency"),
TRANSLATE_NOOP("USB", "Specifies the latency to the host input device."),
AudioDevice::DEFAULT_LATENCY_STR, "1", "1000", "1", TRANSLATE_NOOP("USB", "%dms"), nullptr, nullptr, 1.0f},
};
return info;
}
case MIC_LOGITECH:
case MIC_KONAMI:
default:
{
static constexpr const SettingInfo info[] = {
{SettingInfo::Type::StringList, "input_device_name", TRANSLATE_NOOP("USB", "Input Device"),
TRANSLATE_NOOP("USB", "Selects the device to read audio from."), "", nullptr, nullptr, nullptr, nullptr,
nullptr, &AudioDevice::GetInputDeviceList},
{SettingInfo::Type::Integer, "input_latency", TRANSLATE_NOOP("USB", "Input Latency"),
TRANSLATE_NOOP("USB", "Specifies the latency to the host input device."),
AudioDevice::DEFAULT_LATENCY_STR, "1", "1000", "1", TRANSLATE_NOOP("USB", "%dms"), nullptr, nullptr, 1.0f},
};
return info;
}
}
}
} // namespace usb_mic

View File

@@ -7,24 +7,24 @@
namespace usb_mic
{
class SingstarDevice : public DeviceProxy
enum MicrophoneType
{
MIC_SINGSTAR,
MIC_LOGITECH,
MIC_KONAMI,
MIC_COUNT,
};
class MicrophoneDevice : public DeviceProxy
{
public:
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype, bool dual_mic, const char* devtype) const;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype, bool dual_mic, const int samplerate, const char* devtype) const;
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
const char* Name() const override;
const char* TypeName() const override;
bool Freeze(USBDevice* dev, StateWrapper& sw) const override;
void UpdateSettings(USBDevice* dev, SettingsInterface& si) const override;
std::span<const SettingInfo> Settings(u32 subtype) const override;
};
class LogitechMicDevice final : public SingstarDevice
{
public:
USBDevice* CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const override;
const char* TypeName() const override;
const char* Name() const override;
std::span<const char*> SubTypes() const override;
std::span<const SettingInfo> Settings(u32 subtype) const override;
};
} // namespace usb_mic

View File

@@ -1108,7 +1108,37 @@ namespace usb_msd
{
MSDState* s = new MSDState();
std::string path(USB::GetConfigString(si, port, TypeName(), "ImagePath"));
std::string path;
s->dev.speed = USB_SPEED_FULL;
s->desc.full = &s->desc_dev;
switch (type)
{
case IOMEGA_ZIP_100:
path = USB::GetConfigString(si, port, TypeName(), "ImagePathMsd");
s->desc.str = zip100_desc_strings;
if (usb_desc_parse_dev(zip100_dev_descriptor, sizeof(zip100_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(zip100_config_descriptor, sizeof(zip100_config_descriptor), s->desc_dev) < 0)
goto fail;
s->dev.klass.handle_control = usb_msd_handle_control;
s->dev.klass.handle_data = usb_msd_handle_data;
break;
case SONY_MSAC_US1:
path = USB::GetConfigString(si, port, TypeName(), "ImagePathMsac");
s->desc.str = sony_msac_desc_strings;
if (usb_desc_parse_dev(sony_msac_dev_descriptor, sizeof(sony_msac_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(sony_msac_config_descriptor, sizeof(sony_msac_config_descriptor), s->desc_dev) < 0)
goto fail;
s->dev.klass.handle_control = usb_msac_handle_control;
s->dev.klass.handle_data = usb_msac_handle_data;
break;
default:
pxAssertMsg(false, "Unhandled type");
break;
}
if (path.empty() || !(s->file = FileSystem::OpenCFile(path.c_str(), "r+b")))
{
Host::AddOSDMessage(fmt::format(TRANSLATE_FS("USB", "usb-msd: Could not open image file '{}'"), path),
@@ -1123,33 +1153,6 @@ namespace usb_msd
s->file_size = sd.Size;
s->f.mtime = sd.ModificationTime;
s->f.last_cmd = -1;
s->dev.speed = USB_SPEED_FULL;
s->desc.full = &s->desc_dev;
switch (type)
{
case IOMEGA_ZIP_100:
s->desc.str = zip100_desc_strings;
if (usb_desc_parse_dev(zip100_dev_descriptor, sizeof(zip100_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(zip100_config_descriptor, sizeof(zip100_config_descriptor), s->desc_dev) < 0)
goto fail;
s->dev.klass.handle_control = usb_msd_handle_control;
s->dev.klass.handle_data = usb_msd_handle_data;
break;
case SONY_MSAC_US1:
s->desc.str = sony_msac_desc_strings;
if (usb_desc_parse_dev(sony_msac_dev_descriptor, sizeof(sony_msac_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(sony_msac_config_descriptor, sizeof(sony_msac_config_descriptor), s->desc_dev) < 0)
goto fail;
s->dev.klass.handle_control = usb_msac_handle_control;
s->dev.klass.handle_data = usb_msac_handle_data;
break;
default:
pxAssertMsg(false, "Unhandled type");
break;
}
s->dev.klass.cancel_packet = usb_msd_cancel_io;
s->dev.klass.handle_attach = usb_desc_attach;
@@ -1221,10 +1224,26 @@ namespace usb_msd
std::span<const SettingInfo> MsdDevice::Settings(u32 subtype) const
{
static constexpr const SettingInfo settings[] = {
{SettingInfo::Type::Path, "ImagePath", TRANSLATE_NOOP("USB", "Image Path"),
TRANSLATE_NOOP("USB", "Sets the path to image which will back the virtual mass storage device.")},
};
return settings;
switch (subtype)
{
case IOMEGA_ZIP_100:
{
static constexpr const SettingInfo settings[] = {
{SettingInfo::Type::Path, "ImagePathMsd", TRANSLATE_NOOP("USB", "Image Path"),
TRANSLATE_NOOP("USB", "Sets the path to image which will back the virtual mass storage device.")},
};
return settings;
}
case SONY_MSAC_US1:
{
static constexpr const SettingInfo settings[] = {
{SettingInfo::Type::Path, "ImagePathMsac", TRANSLATE_NOOP("USB", "Image Path"),
TRANSLATE_NOOP("USB", "Sets the path to image which will back the virtual mass storage device.")},
};
return settings;
}
default:
return {};
}
}
} // namespace usb_msd

View File

@@ -133,7 +133,8 @@ namespace usb_pad
{
case USB_DT_REPORT:
ret = sizeof(hid_report_descriptor);
memcpy(data, hid_report_descriptor, ret);
std::memcpy(data, hid_report_descriptor, ret);
p->actual_length = ret;
break;
}
break;

View File

@@ -166,7 +166,8 @@ namespace usb_pad
{
case USB_DT_REPORT:
ret = sizeof(hid_report_descriptor);
memcpy(data, hid_report_descriptor, ret);
std::memcpy(data, hid_report_descriptor, ret);
p->actual_length = ret;
break;
}
break;

View File

@@ -216,7 +216,8 @@ namespace usb_pad
{
case USB_DT_REPORT:
ret = sizeof(hid_report_descriptor);
memcpy(data, hid_report_descriptor, ret);
std::memcpy(data, hid_report_descriptor, ret);
p->actual_length = ret;
break;
}
break;

View File

@@ -4,7 +4,7 @@
#include "Host.h"
#include "USB/usb-pad/usb-pad.h"
#include "USB/qemu-usb/desc.h"
#include "USB/usb-mic/usb-mic-singstar.h"
#include "USB/usb-mic/usb-mic.h"
#include "USB/USB.h"
#include "common/Console.h"
@@ -296,7 +296,7 @@ namespace usb_pad
{
case USB_DT_REPORT:
ret = sizeof(hid_report_descriptor);
memcpy(data, hid_report_descriptor, ret);
std::memcpy(data, hid_report_descriptor, ret);
p->actual_length = ret;
break;
default:
@@ -308,7 +308,6 @@ namespace usb_pad
if (length > 0)
{
p->actual_length = 0;
//p->status = USB_RET_SUCCESS;
}
break;
case SET_IDLE:
@@ -389,12 +388,12 @@ namespace usb_pad
USBDevice* SeamicDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
{
const usb_mic::SingstarDevice* mic_proxy =
static_cast<usb_mic::SingstarDevice*>(RegisterDevice::instance().Device(DEVTYPE_SINGSTAR));
const usb_mic::MicrophoneDevice* mic_proxy =
static_cast<usb_mic::MicrophoneDevice*>(RegisterDevice::instance().Device(DEVTYPE_MICROPHONE));
if (!mic_proxy)
return nullptr;
USBDevice* mic = mic_proxy->CreateDevice(si, port, 0, false, TypeName());
USBDevice* mic = mic_proxy->CreateDevice(si, port, 0, false, 48000, TypeName());
if (!mic)
return nullptr;

View File

@@ -3608,15 +3608,21 @@ void VMManager::UpdateDiscordPresence(bool update_session_time)
// https://discord.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields
DiscordRichPresence rp = {};
rp.largeImageKey = "4k-pcsx2";
rp.largeImageText = "PCSX2 Emulator";
rp.largeImageText = "PCSX2 PS2 Emulator";
rp.startTimestamp = s_discord_presence_time_epoch;
rp.details = s_title.empty() ? TRANSLATE("VMManager","No Game Running") : s_title.c_str();
std::string state_string;
if (Achievements::HasRichPresence())
{
auto lock = Achievements::GetLock();
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
rp.state = state_string.c_str();
rp.largeImageKey = Achievements::GetGameIconURL().c_str();
rp.largeImageText = s_title.c_str();
}
Discord_UpdatePresence(&rp);

View File

@@ -390,8 +390,7 @@
<ClCompile Include="USB\usb-lightgun\guncon2.cpp" />
<ClCompile Include="USB\usb-mic\audiodev-cubeb.cpp" />
<ClCompile Include="USB\usb-mic\usb-headset.cpp" />
<ClCompile Include="USB\usb-mic\usb-mic-logitech.cpp" />
<ClCompile Include="USB\usb-mic\usb-mic-singstar.cpp" />
<ClCompile Include="USB\usb-mic\usb-mic.cpp" />
<ClCompile Include="USB\usb-msd\usb-msd.cpp" />
<ClCompile Include="USB\usb-pad\lg\lg_ff.cpp" />
<ClCompile Include="USB\usb-pad\usb-buzz.cpp" />
@@ -844,7 +843,7 @@
<ClInclude Include="USB\usb-mic\audiodev-noop.h" />
<ClInclude Include="USB\usb-mic\audiodev.h" />
<ClInclude Include="USB\usb-mic\usb-headset.h" />
<ClInclude Include="USB\usb-mic\usb-mic-singstar.h" />
<ClInclude Include="USB\usb-mic\usb-mic.h" />
<ClInclude Include="USB\usb-msd\usb-msd.h" />
<ClInclude Include="USB\usb-pad\lg\lg_ff.h" />
<ClInclude Include="USB\usb-pad\usb-buzz.h" />

View File

@@ -1178,10 +1178,7 @@
<ClCompile Include="USB\usb-mic\usb-headset.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
<ClCompile Include="USB\usb-mic\usb-mic-logitech.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
<ClCompile Include="USB\usb-mic\usb-mic-singstar.cpp">
<ClCompile Include="USB\usb-mic\usb-mic.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
<ClCompile Include="USB\usb-hid\usb-hid.cpp">
@@ -2127,7 +2124,7 @@
<ClInclude Include="USB\usb-mic\usb-headset.h">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClInclude>
<ClInclude Include="USB\usb-mic\usb-mic-singstar.h">
<ClInclude Include="USB\usb-mic\usb-mic.h">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClInclude>
<ClInclude Include="USB\usb-mic\audio.h">