Compare commits

...

3 Commits

Author SHA1 Message Date
Margen67 ae86c03db0
Merge af4dabe8b4 into 2385cc53a9 2024-03-19 19:55:34 +01:00
Adrian 2385cc53a9 [Emulator] Better handling of failed device mounting 2024-03-19 09:02:36 +01:00
Margen67 af4dabe8b4 Option cleanup (WIP)
cpu: Make it clear this does nothing since there's no backends other than x64.
native_2x_msaa: Disabling this only makes performance worse, and idiots think this disables anti-aliasing for some reason.
2024-03-12 22:54:40 -07:00
7 changed files with 68 additions and 19 deletions

View File

@ -226,7 +226,6 @@ class EmulatorWindow {
void GamepadHotKeys();
void ToggleGPUSetting(gpu_cvar index);
bool IsUseNexusForGameBarEnabled();
std::string BoolToString(bool value);
void DisplayHotKeysConfig();
void RunPreviouslyPlayedTitle();

View File

@ -9,7 +9,7 @@
#include "xenia/cpu/cpu_flags.h"
DEFINE_string(cpu, "any", "CPU backend [any, x64].", "CPU");
DEFINE_string(cpu, "any", "Does nothing. CPU backend [any, x64].", "CPU");
DEFINE_string(
load_module_map, "",
@ -31,6 +31,7 @@ DEFINE_bool(trace_function_data, false,
"Generate tracing for function result data.", "CPU");
DEFINE_bool(validate_hir, false,
"Only does anything on debug builds. "
"Perform validation checks on the HIR during compilation.", "CPU");
DEFINE_uint64(

View File

@ -45,7 +45,12 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) {
assembler_ = backend->CreateAssembler();
assembler_->Initialize();
bool validate = cvars::validate_hir;
bool validate =
#ifdef DEBUG
cvars::validate_hir;
#else
0;
#endif
// Merge blocks early. This will let us use more context in other passes.
// The CFG is required for simplification and dirtied by it.

View File

@ -336,7 +336,7 @@ const std::unique_ptr<vfs::Device> Emulator::CreateVfsDeviceBasedOnPath(
xe::ShowSimpleMessageBox(
xe::SimpleMessageBoxType::Error,
fmt::format(
"Unsupported format!"
"Unsupported format!\n"
"Xenia does not support running software in an archived format."));
}
return std::make_unique<vfs::DiscImageDevice>(mount_path, path);
@ -387,15 +387,15 @@ void Emulator::SetPersistentEmulatorFlags(uint64_t new_flags) {
X_STATUS Emulator::MountPath(const std::filesystem::path& path,
const std::string_view mount_path) {
auto device = CreateVfsDeviceBasedOnPath(path, mount_path);
if (!device->Initialize()) {
xe::FatalError(
if (!device || !device->Initialize()) {
XELOGE(
"Unable to mount the selected file, it is an unsupported format or "
"corrupted.");
return X_STATUS_NO_SUCH_FILE;
}
if (!file_system_->RegisterDevice(std::move(device))) {
xe::FatalError(fmt::format("Unable to register the input file to {}.",
xe::path_to_utf8(mount_path)));
XELOGE("Unable to register the input file to {}.",
xe::path_to_utf8(mount_path));
return X_STATUS_NO_SUCH_FILE;
}
@ -413,24 +413,27 @@ X_STATUS Emulator::MountPath(const std::filesystem::path& path,
X_STATUS Emulator::LaunchPath(const std::filesystem::path& path) {
// Launch based on file type.
// This is a silly guess based on file extension.
X_STATUS mount_result = X_STATUS_SUCCESS;
if (!path.has_extension()) {
// Likely an STFS container.
MountPath(path, "\\Device\\Cdrom0");
return LaunchStfsContainer(path);
mount_result = MountPath(path, "\\Device\\Cdrom0");
return mount_result ? mount_result : LaunchStfsContainer(path);
};
auto extension = xe::utf8::lower_ascii(xe::path_to_utf8(path.extension()));
if (extension == ".xex" || extension == ".elf" || extension == ".exe") {
// Treat as a naked xex file.
MountPath(path, "\\Device\\Harddisk0\\Partition1");
return LaunchXexFile(path);
mount_result = MountPath(path, "\\Device\\Harddisk0\\Partition1");
return mount_result ? mount_result : LaunchXexFile(path);
} else if (extension == ".zar") {
// Assume a disc image.
MountPath(path, "\\Device\\Cdrom0");
return LaunchDiscArchive(path);
mount_result = MountPath(path, "\\Device\\Cdrom0");
return mount_result ? mount_result : LaunchDiscArchive(path);
} else {
// Assume a disc image.
MountPath(path, "\\Device\\Cdrom0");
return LaunchDiscImage(path);
mount_result = MountPath(path, "\\Device\\Cdrom0");
return mount_result ? mount_result : LaunchDiscImage(path);
}
}
@ -495,7 +498,7 @@ X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) {
X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) {
std::unique_ptr<vfs::Device> device =
vfs::XContentContainerDevice::CreateContentDevice("", path);
if (!device->Initialize()) {
if (!device || !device->Initialize()) {
XELOGE("Failed to initialize device");
return X_STATUS_INVALID_PARAMETER;
}

View File

@ -447,7 +447,9 @@ bool D3D12RenderTargetCache::Initialize() {
// Using the cvar on emulator initialization so used pipelines are consistent
// across different titles launched in one emulator instance.
use_stencil_reference_output_ =
#ifdef DEBUG
cvars::native_stencil_value_output &&
#endif
provider.IsPSSpecifiedStencilReferenceSupported() &&
(cvars::native_stencil_value_output_d3d12_intel ||
provider.GetAdapterVendorID() !=
@ -464,6 +466,7 @@ bool D3D12RenderTargetCache::Initialize() {
// Check if 2x MSAA is supported or needs to be emulated with 4x MSAA
// instead.
#ifdef DEBUG
if (cvars::native_2x_msaa) {
msaa_2x_supported_ = true;
static const DXGI_FORMAT kRenderTargetDXGIFormats[] = {
@ -502,6 +505,42 @@ bool D3D12RenderTargetCache::Initialize() {
} else {
msaa_2x_supported_ = false;
}
#else // DEBUG
msaa_2x_supported_ = true;
static const DXGI_FORMAT kRenderTargetDXGIFormats[] = {
DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_SNORM,
DXGI_FORMAT_R32G32_FLOAT,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
DXGI_FORMAT_R10G10B10A2_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R16G16_FLOAT,
DXGI_FORMAT_R16G16_SNORM,
DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_D24_UNORM_S8_UINT,
// For ownership transfer.
DXGI_FORMAT_R16G16B16A16_UINT,
DXGI_FORMAT_R32G32_UINT,
DXGI_FORMAT_R16G16_UINT,
DXGI_FORMAT_R32_UINT,
};
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS multisample_quality_levels;
multisample_quality_levels.SampleCount = 2;
multisample_quality_levels.Flags =
D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE;
for (size_t i = 0; i < xe::countof(kRenderTargetDXGIFormats); ++i) {
multisample_quality_levels.Format = kRenderTargetDXGIFormats[i];
multisample_quality_levels.NumQualityLevels = 0;
if (FAILED(device->CheckFeatureSupport(
D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS,
&multisample_quality_levels,
sizeof(multisample_quality_levels))) ||
!multisample_quality_levels.NumQualityLevels) {
msaa_2x_supported_ = false;
break;
}
}
#endif // DEBUG
if (!msaa_2x_supported_) {
XELOGW(
"2x MSAA is not supported, emulated via top-left and bottom-right "

View File

@ -172,6 +172,7 @@ DEFINE_bool(
"GPU");
DEFINE_bool(
native_2x_msaa, true,
"Only does anything in debug builds."
"Use host 2x MSAA when available. Can be disabled for scalability testing "
"on host GPU APIs where 2x is not mandatory, in this case, 2 samples of 4x "
"MSAA will be used instead (with similar or worse quality and higher "
@ -179,6 +180,7 @@ DEFINE_bool(
"GPU");
DEFINE_bool(
native_stencil_value_output, true,
"Only does anything in debug builds."
"Use pixel shader stencil reference output where available for purposes "
"like copying between render targets. Can be disabled for scalability "
"testing, in this case, much more expensive drawing of 8 quads will be "

View File

@ -17,8 +17,8 @@
DEFINE_bool(
allow_plugins, false,
"Allows loading of plugins/trainers from plugins\\title_id\\plugin.xex."
"Plugin are homebrew xex modules which can be used for making mods "
"Allows loading of plugins/trainers from plugins\\title_id\\plugin.xex. "
"Plugin are homebrew xex modules which can be used for making mods. "
"This feature is experimental.",
"General");