[D3D12] Switch from gflags to cvars
This commit is contained in:
16
src/xenia/kernel/kernel_flags.cc
Normal file
16
src/xenia/kernel/kernel_flags.cc
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/kernel_flags.h"
|
||||
|
||||
DEFINE_bool(headless, false,
|
||||
"Don't display any UI, using defaults for prompts as needed.",
|
||||
"Other");
|
||||
DEFINE_bool(log_high_frequency_kernel_calls, false,
|
||||
"Log kernel calls with the kHighFrequency tag.", "Kernel");
|
||||
17
src/xenia/kernel/kernel_flags.h
Normal file
17
src/xenia/kernel/kernel_flags.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_KERNEL_FLAGS_H_
|
||||
#define XENIA_KERNEL_KERNEL_FLAGS_H_
|
||||
#include "xenia/base/cvar.h"
|
||||
|
||||
DECLARE_bool(headless);
|
||||
DECLARE_bool(log_high_frequency_kernel_calls);
|
||||
|
||||
#endif // XENIA_KERNEL_KERNEL_FLAGS_H_
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
@@ -29,9 +27,6 @@
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
DEFINE_bool(headless, false,
|
||||
"Don't display any UI, using defaults for prompts as needed.");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#ifndef XENIA_KERNEL_KERNEL_STATE_H_
|
||||
#define XENIA_KERNEL_KERNEL_STATE_H_
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
@@ -20,6 +18,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/bit_map.h"
|
||||
#include "xenia/base/cvar.h"
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/util/native_list.h"
|
||||
@@ -39,8 +38,6 @@ class Processor;
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
DECLARE_bool(headless);
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@ project("xenia-kernel")
|
||||
})
|
||||
defines({
|
||||
})
|
||||
includedirs({
|
||||
project_root.."/third_party/gflags/src",
|
||||
})
|
||||
recursive_platform_files()
|
||||
files({
|
||||
"debug_visualizers.natvis",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "xenia/kernel/xfile.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
DEFINE_bool(xex_apply_patches, true, "Apply XEX patches.");
|
||||
DEFINE_bool(xex_apply_patches, true, "Apply XEX patches.", "Kernel");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -102,7 +102,7 @@ X_STATUS UserModule::LoadFromFile(std::string path) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (FLAGS_xex_apply_patches) {
|
||||
if (cvars::xex_apply_patches) {
|
||||
// Search for xexp patch file
|
||||
auto patch_entry = kernel_state()->file_system()->ResolvePath(path_ + "p");
|
||||
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
|
||||
DEFINE_bool(log_high_frequency_kernel_calls, false,
|
||||
"Log kernel calls with the kHighFrequency tag.");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace shim {
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#ifndef XENIA_KERNEL_UTIL_SHIM_UTILS_H_
|
||||
#define XENIA_KERNEL_UTIL_SHIM_UTILS_H_
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
@@ -21,10 +19,9 @@
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/cpu/ppc/ppc_context.h"
|
||||
#include "xenia/kernel/kernel_flags.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
||||
DECLARE_bool(log_high_frequency_kernel_calls);
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
@@ -482,7 +479,7 @@ xe::cpu::Export* RegisterExport(R (*fn)(Ps&...), const char* name,
|
||||
auto params = std::make_tuple<Ps...>(Ps(init)...);
|
||||
if (export_entry->tags & xe::cpu::ExportTag::kLog &&
|
||||
(!(export_entry->tags & xe::cpu::ExportTag::kHighFrequency) ||
|
||||
FLAGS_log_high_frequency_kernel_calls)) {
|
||||
cvars::log_high_frequency_kernel_calls)) {
|
||||
PrintKernelCall(export_entry, params);
|
||||
}
|
||||
auto result =
|
||||
@@ -516,7 +513,7 @@ xe::cpu::Export* RegisterExport(void (*fn)(Ps&...), const char* name,
|
||||
auto params = std::make_tuple<Ps...>(Ps(init)...);
|
||||
if (export_entry->tags & xe::cpu::ExportTag::kLog &&
|
||||
(!(export_entry->tags & xe::cpu::ExportTag::kHighFrequency) ||
|
||||
FLAGS_log_high_frequency_kernel_calls)) {
|
||||
cvars::log_high_frequency_kernel_calls)) {
|
||||
PrintKernelCall(export_entry, params);
|
||||
}
|
||||
KernelTrampoline(FN, std::forward<std::tuple<Ps...>>(params),
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_flags.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
@@ -43,7 +44,7 @@ dword_result_t XamShowNuiTroubleshooterUI(unknown_t unk1, unknown_t unk2,
|
||||
// unk1 is 0xFF - possibly user index?
|
||||
// unk2, unk3 appear to always be zero.
|
||||
|
||||
if (FLAGS_headless) {
|
||||
if (cvars::headless) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "third_party/imgui/imgui.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_flags.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
@@ -111,7 +112,7 @@ dword_result_t XamShowMessageBoxUI(dword_t user_index, lpwstring_t title_ptr,
|
||||
}
|
||||
|
||||
uint32_t chosen_button;
|
||||
if (FLAGS_headless) {
|
||||
if (cvars::headless) {
|
||||
// Auto-pick the focused button.
|
||||
chosen_button = active_button;
|
||||
} else {
|
||||
@@ -231,7 +232,7 @@ dword_result_t XamShowKeyboardUI(dword_t user_index, dword_t flags,
|
||||
return X_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (FLAGS_headless) {
|
||||
if (cvars::headless) {
|
||||
// Redirect default_text back into the buffer.
|
||||
std::memset(buffer, 0, buffer_length * 2);
|
||||
if (default_text) {
|
||||
@@ -309,7 +310,7 @@ dword_result_t XamShowDeviceSelectorUI(dword_t user_index, dword_t content_type,
|
||||
DECLARE_XAM_EXPORT1(XamShowDeviceSelectorUI, kUI, kImplemented);
|
||||
|
||||
void XamShowDirtyDiscErrorUI(dword_t user_index) {
|
||||
if (FLAGS_headless) {
|
||||
if (cvars::headless) {
|
||||
assert_always();
|
||||
exit(1);
|
||||
return;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/clock.h"
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/clock.h"
|
||||
@@ -47,7 +45,7 @@ void KeDebugMonitorCallback(cpu::ppc::PPCContext* ppc_context,
|
||||
|
||||
XELOGI("KeDebugMonitorCallback(%u, %08x)", static_cast<uint32_t>(id), arg);
|
||||
|
||||
if (!FLAGS_kernel_pix) {
|
||||
if (!cvars::kernel_pix) {
|
||||
SHIM_SET_RETURN_32(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/clock.h"
|
||||
@@ -27,18 +25,19 @@
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
DEFINE_string(cl, "", "Specify additional command-line provided to guest.");
|
||||
DEFINE_string(cl, "", "Specify additional command-line provided to guest.",
|
||||
"Kernel");
|
||||
|
||||
DEFINE_bool(kernel_debug_monitor, false, "Enable debug monitor.");
|
||||
DEFINE_bool(kernel_cert_monitor, false, "Enable cert monitor.");
|
||||
DEFINE_bool(kernel_pix, false, "Enable PIX.");
|
||||
DEFINE_bool(kernel_debug_monitor, false, "Enable debug monitor.", "Kernel");
|
||||
DEFINE_bool(kernel_cert_monitor, false, "Enable cert monitor.", "Kernel");
|
||||
DEFINE_bool(kernel_pix, false, "Enable PIX.", "Kernel");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
bool XboxkrnlModule::SendPIXCommand(const char* cmd) {
|
||||
if (!FLAGS_kernel_pix) {
|
||||
if (!cvars::kernel_pix) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
// Offset 0x18 is a 4b pointer to a handler function that seems to take two
|
||||
// arguments. If we wanted to see what would happen we could fake that.
|
||||
uint32_t pKeDebugMonitorData;
|
||||
if (!FLAGS_kernel_debug_monitor) {
|
||||
if (!cvars::kernel_debug_monitor) {
|
||||
pKeDebugMonitorData = memory_->SystemHeapAlloc(4);
|
||||
auto lpKeDebugMonitorData = memory_->TranslateVirtual(pKeDebugMonitorData);
|
||||
xe::store_and_swap<uint32_t>(lpKeDebugMonitorData, 0);
|
||||
@@ -125,7 +124,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
// KeCertMonitorData (?*)
|
||||
// Always set to zero, ignored.
|
||||
uint32_t pKeCertMonitorData;
|
||||
if (!FLAGS_kernel_cert_monitor) {
|
||||
if (!cvars::kernel_cert_monitor) {
|
||||
pKeCertMonitorData = memory_->SystemHeapAlloc(4);
|
||||
auto lpKeCertMonitorData = memory_->TranslateVirtual(pKeCertMonitorData);
|
||||
xe::store_and_swap<uint32_t>(lpKeCertMonitorData, 0);
|
||||
@@ -187,8 +186,8 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
// Always set to "default.xex" (with quotes) for now.
|
||||
// TODO(gibbed): set this to the actual module name.
|
||||
std::string command_line("\"default.xex\"");
|
||||
if (FLAGS_cl.length()) {
|
||||
command_line += " " + FLAGS_cl;
|
||||
if (cvars::cl.length()) {
|
||||
command_line += " " + cvars::cl;
|
||||
}
|
||||
uint32_t command_line_length =
|
||||
xe::align(static_cast<uint32_t>(command_line.length()) + 1, 1024u);
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_video.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
@@ -24,9 +22,11 @@
|
||||
|
||||
DEFINE_int32(kernel_display_gamma_type, 1,
|
||||
"Display gamma type: 0 - linear, 1 - sRGB, 2 - TV (BT.709), "
|
||||
"3 - power specified via kernel_display_gamma_power.");
|
||||
"3 - power specified via kernel_display_gamma_power.",
|
||||
"Kernel");
|
||||
DEFINE_double(kernel_display_gamma_power, 2.22222233,
|
||||
"Display gamma to use with kernel_display_gamma_type 3.");
|
||||
"Display gamma to use with kernel_display_gamma_type 3.",
|
||||
"Kernel");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -51,8 +51,8 @@ void VdGetCurrentDisplayGamma(lpdword_t type_ptr, lpfloat_t power_ptr) {
|
||||
// 3 - use the power written to *power_ptr.
|
||||
// Anything else - linear.
|
||||
// Used in D3D SetGammaRamp/SetPWLGamma to adjust the ramp for the display.
|
||||
*type_ptr = uint32_t(FLAGS_kernel_display_gamma_type);
|
||||
*power_ptr = float(FLAGS_kernel_display_gamma_power);
|
||||
*type_ptr = uint32_t(cvars::kernel_display_gamma_type);
|
||||
*power_ptr = float(cvars::kernel_display_gamma_power);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(VdGetCurrentDisplayGamma, kVideo, kStub);
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#ifdef XE_PLATFORM_WIN32
|
||||
@@ -33,9 +31,9 @@
|
||||
#include "xenia/kernel/xmutant.h"
|
||||
|
||||
DEFINE_bool(ignore_thread_priorities, true,
|
||||
"Ignores game-specified thread priorities.");
|
||||
"Ignores game-specified thread priorities.", "Kernel");
|
||||
DEFINE_bool(ignore_thread_affinities, true,
|
||||
"Ignores game-specified thread affinities.");
|
||||
"Ignores game-specified thread affinities.", "Kernel");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -416,7 +414,7 @@ X_STATUS XThread::Create() {
|
||||
return X_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (!FLAGS_ignore_thread_affinities) {
|
||||
if (!cvars::ignore_thread_affinities) {
|
||||
thread_->set_affinity_mask(proc_mask);
|
||||
}
|
||||
|
||||
@@ -698,7 +696,7 @@ void XThread::SetPriority(int32_t increment) {
|
||||
} else {
|
||||
target_priority = xe::threading::ThreadPriority::kNormal;
|
||||
}
|
||||
if (!FLAGS_ignore_thread_priorities) {
|
||||
if (!cvars::ignore_thread_priorities) {
|
||||
thread_->set_priority(target_priority);
|
||||
}
|
||||
}
|
||||
@@ -719,7 +717,7 @@ void XThread::SetAffinity(uint32_t affinity) {
|
||||
}
|
||||
SetActiveCpu(GetFakeCpuNumber(affinity));
|
||||
affinity_ = affinity;
|
||||
if (!FLAGS_ignore_thread_affinities) {
|
||||
if (!cvars::ignore_thread_affinities) {
|
||||
thread_->set_affinity_mask(affinity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user