[Misc] Replaced const with constexpr where possible
This commit is contained in:
parent
a45a9d8704
commit
e94fad214b
|
@ -167,8 +167,8 @@ using xe::ui::UIEvent;
|
|||
using namespace xe::hid;
|
||||
using namespace xe::gpu;
|
||||
|
||||
const std::string kRecentlyPlayedTitlesFilename = "recent.toml";
|
||||
const std::string kBaseTitle = "Xenia-canary";
|
||||
constexpr std::string kRecentlyPlayedTitlesFilename = "recent.toml";
|
||||
constexpr std::string kBaseTitle = "Xenia-canary";
|
||||
|
||||
EmulatorWindow::EmulatorWindow(Emulator* emulator,
|
||||
ui::WindowedAppContext& app_context,
|
||||
|
@ -1011,9 +1011,9 @@ void EmulatorWindow::ToggleFullscreenOnDoubleClick() {
|
|||
// this function tests if user has double clicked.
|
||||
// if double click was achieved the fullscreen gets toggled
|
||||
const auto now = steady_clock::now(); // current mouse event time
|
||||
const int16_t mouse_down_max_threshold = 250;
|
||||
const int16_t mouse_up_max_threshold = 250;
|
||||
const int16_t mouse_up_down_max_delta = 100;
|
||||
constexpr int16_t mouse_down_max_threshold = 250;
|
||||
constexpr int16_t mouse_up_max_threshold = 250;
|
||||
constexpr int16_t mouse_up_down_max_delta = 100;
|
||||
// max delta to prevent 'chaining' of double clicks with next mouse events
|
||||
|
||||
const auto last_mouse_down_delta = diff_in_ms(now, last_mouse_down);
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace apu {
|
|||
|
||||
class AudioDriver {
|
||||
public:
|
||||
static const uint32_t kFrameFrequencyDefault = 48000;
|
||||
static const uint32_t kFrameChannelsDefault = 6;
|
||||
static const uint32_t kChannelSamplesDefault = 256;
|
||||
static const uint32_t kFrameSamplesMax =
|
||||
static constexpr uint32_t kFrameFrequencyDefault = 48000;
|
||||
static constexpr uint32_t kFrameChannelsDefault = 6;
|
||||
static constexpr uint32_t kChannelSamplesDefault = 256;
|
||||
static constexpr uint32_t kFrameSamplesMax =
|
||||
kFrameChannelsDefault * kChannelSamplesDefault;
|
||||
static const uint32_t kFrameSizeMax = sizeof(float) * kFrameSamplesMax;
|
||||
static constexpr uint32_t kFrameSizeMax = sizeof(float) * kFrameSamplesMax;
|
||||
|
||||
virtual ~AudioDriver();
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ bool XAudio2AudioDriver::InitializeObjects(Objects& objects) {
|
|||
|
||||
waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
|
||||
waveformat.Samples.wValidBitsPerSample = waveformat.Format.wBitsPerSample;
|
||||
static const DWORD kChannelMasks[] = {
|
||||
static constexpr DWORD kChannelMasks[] = {
|
||||
0,
|
||||
0,
|
||||
SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT,
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace xe {
|
|||
namespace apu {
|
||||
namespace xma {
|
||||
|
||||
static const uint32_t kMaxFrameLength = 0x7FFF;
|
||||
static constexpr uint32_t kMaxFrameLength = 0x7FFF;
|
||||
|
||||
// Get number of frames that /begin/ in this packet. This is valid only for XMA2
|
||||
// packets
|
||||
|
|
|
@ -32,7 +32,7 @@ class XmaRegisterFile {
|
|||
|
||||
static const XmaRegisterInfo* GetRegisterInfo(uint32_t index);
|
||||
|
||||
static const size_t kRegisterCount = (0xFFFF + 1) / 4;
|
||||
static constexpr size_t kRegisterCount = (0xFFFF + 1) / 4;
|
||||
uint32_t values[kRegisterCount];
|
||||
|
||||
uint32_t operator[](uint32_t reg) const { return values[reg]; }
|
||||
|
|
|
@ -168,7 +168,7 @@ static void ExceptionHandlerCallback(int signal_number, siginfo_t* signal_info,
|
|||
mcontext.gregs[REG_EFL] = greg_t(thread_context.eflags);
|
||||
uint32_t modified_register_index;
|
||||
// The order must match the order in X64Register.
|
||||
static const size_t kIntRegisterMap[] = {
|
||||
static constexpr size_t kIntRegisterMap[] = {
|
||||
REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP,
|
||||
REG_RSI, REG_RDI, REG_R8, REG_R9, REG_R10, REG_R11,
|
||||
REG_R12, REG_R13, REG_R14, REG_R15,
|
||||
|
|
|
@ -65,14 +65,14 @@ bool TruncateStdioFile(FILE* file, uint64_t length);
|
|||
|
||||
struct FileAccess {
|
||||
// Implies kFileReadData.
|
||||
static const uint32_t kGenericRead = 0x80000000;
|
||||
static constexpr uint32_t kGenericRead = 0x80000000;
|
||||
// Implies kFileWriteData.
|
||||
static const uint32_t kGenericWrite = 0x40000000;
|
||||
static const uint32_t kGenericExecute = 0x20000000;
|
||||
static const uint32_t kGenericAll = 0x10000000;
|
||||
static const uint32_t kFileReadData = 0x00000001;
|
||||
static const uint32_t kFileWriteData = 0x00000002;
|
||||
static const uint32_t kFileAppendData = 0x00000004;
|
||||
static constexpr uint32_t kGenericWrite = 0x40000000;
|
||||
static constexpr uint32_t kGenericExecute = 0x20000000;
|
||||
static constexpr uint32_t kGenericAll = 0x10000000;
|
||||
static constexpr uint32_t kFileReadData = 0x00000001;
|
||||
static constexpr uint32_t kFileWriteData = 0x00000002;
|
||||
static constexpr uint32_t kFileAppendData = 0x00000004;
|
||||
};
|
||||
|
||||
class FileHandle {
|
||||
|
|
|
@ -214,7 +214,7 @@ bool IsAndroidContentUri(const std::string_view source) {
|
|||
// still including // in the comparison to distinguish from a file with a name
|
||||
// starting from content: (as this is the main purpose of this code -
|
||||
// separating URIs from file paths) more clearly.
|
||||
static const char kContentSchema[] = "content://";
|
||||
static constexpr char kContentSchema[] = "content://";
|
||||
constexpr size_t kContentSchemaLength = xe::countof(kContentSchema) - 1;
|
||||
return source.size() >= kContentSchemaLength &&
|
||||
!xe_strncasecmp(source.data(), kContentSchema, kContentSchemaLength);
|
||||
|
|
|
@ -14,23 +14,23 @@
|
|||
|
||||
namespace xe::literals {
|
||||
|
||||
constexpr size_t operator""_KiB(unsigned long long int x) {
|
||||
constexpr size_t operator""_KiB(const unsigned long long int x) {
|
||||
return 1024ULL * x;
|
||||
}
|
||||
|
||||
constexpr size_t operator""_MiB(unsigned long long int x) {
|
||||
constexpr size_t operator""_MiB(const unsigned long long int x) {
|
||||
return 1024_KiB * x;
|
||||
}
|
||||
|
||||
constexpr size_t operator""_GiB(unsigned long long int x) {
|
||||
constexpr size_t operator""_GiB(const unsigned long long int x) {
|
||||
return 1024_MiB * x;
|
||||
}
|
||||
|
||||
constexpr size_t operator""_TiB(unsigned long long int x) {
|
||||
constexpr size_t operator""_TiB(const unsigned long long int x) {
|
||||
return 1024_GiB * x;
|
||||
}
|
||||
|
||||
constexpr size_t operator""_PiB(unsigned long long int x) {
|
||||
constexpr size_t operator""_PiB(const unsigned long long int x) {
|
||||
return 1024_TiB * x;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,10 +244,10 @@ class Logger {
|
|||
}
|
||||
|
||||
private:
|
||||
static const size_t kBufferSize = 8_MiB;
|
||||
static constexpr size_t kBufferSize = 8_MiB;
|
||||
uint8_t buffer_[kBufferSize];
|
||||
|
||||
static const size_t kBlockSize = 256;
|
||||
static constexpr size_t kBlockSize = 256;
|
||||
static const size_t kBlockCount = kBufferSize / kBlockSize;
|
||||
static const size_t kBlockIndexMask = kBlockCount - 1;
|
||||
|
||||
|
|
|
@ -181,12 +181,12 @@
|
|||
namespace xe {
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
const char kPathSeparator = '\\';
|
||||
constexpr char kPathSeparator = '\\';
|
||||
#else
|
||||
const char kPathSeparator = '/';
|
||||
constexpr char kPathSeparator = '/';
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
|
||||
const char kGuestPathSeparator = '\\';
|
||||
constexpr char kGuestPathSeparator = '\\';
|
||||
|
||||
} // namespace xe
|
||||
#if XE_ARCH_AMD64 == 1
|
||||
|
|
|
@ -516,7 +516,7 @@ TEST_CASE("create_and_close_file_mapping", "Virtual Memory Mapping") {
|
|||
|
||||
TEST_CASE("map_view", "[virtual_memory_mapping]") {
|
||||
auto path = fmt::format("xenia_test_{}", Clock::QueryHostTickCount());
|
||||
const size_t length = 0x100;
|
||||
constexpr size_t length = 0x100;
|
||||
auto memory = xe::memory::CreateFileMappingHandle(
|
||||
path, length, xe::memory::PageAccess::kReadWrite, true);
|
||||
REQUIRE(memory != xe::memory::kFileMappingHandleInvalid);
|
||||
|
@ -532,7 +532,7 @@ TEST_CASE("map_view", "[virtual_memory_mapping]") {
|
|||
}
|
||||
|
||||
TEST_CASE("read_write_view", "[virtual_memory_mapping]") {
|
||||
const size_t length = 0x100;
|
||||
constexpr size_t length = 0x100;
|
||||
auto path = fmt::format("xenia_test_{}", Clock::QueryHostTickCount());
|
||||
auto memory = xe::memory::CreateFileMappingHandle(
|
||||
path, length, xe::memory::PageAccess::kReadWrite, true);
|
||||
|
|
|
@ -404,19 +404,19 @@ class Timer : public WaitHandle {
|
|||
|
||||
#if XE_PLATFORM_WIN32
|
||||
struct ThreadPriority {
|
||||
static const int32_t kLowest = -2;
|
||||
static const int32_t kBelowNormal = -1;
|
||||
static const int32_t kNormal = 0;
|
||||
static const int32_t kAboveNormal = 1;
|
||||
static const int32_t kHighest = 2;
|
||||
static constexpr int32_t kLowest = -2;
|
||||
static constexpr int32_t kBelowNormal = -1;
|
||||
static constexpr int32_t kNormal = 0;
|
||||
static constexpr int32_t kAboveNormal = 1;
|
||||
static constexpr int32_t kHighest = 2;
|
||||
};
|
||||
#else
|
||||
struct ThreadPriority {
|
||||
static const int32_t kLowest = 1;
|
||||
static const int32_t kBelowNormal = 8;
|
||||
static const int32_t kNormal = 16;
|
||||
static const int32_t kAboveNormal = 24;
|
||||
static const int32_t kHighest = 32;
|
||||
static constexpr int32_t kLowest = 1;
|
||||
static constexpr int32_t kBelowNormal = 8;
|
||||
static constexpr int32_t kNormal = 16;
|
||||
static constexpr int32_t kAboveNormal = 24;
|
||||
static constexpr int32_t kHighest = 32;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -82,10 +82,10 @@ std::string upper_ascii(const std::string_view view) {
|
|||
|
||||
template <bool LOWER>
|
||||
inline size_t hash_fnv1a(const std::string_view view) {
|
||||
const size_t offset_basis = 0xCBF29CE484222325ull;
|
||||
constexpr size_t offset_basis = 0xCBF29CE484222325ull;
|
||||
// chrispy: constant capture errors on clang
|
||||
auto work = [](size_t hash, uint8_t byte_of_data) {
|
||||
const size_t prime = 0x00000100000001B3ull;
|
||||
constexpr size_t prime = 0x00000100000001B3ull;
|
||||
hash ^= byte_of_data;
|
||||
hash *= prime;
|
||||
return hash;
|
||||
|
|
|
@ -1737,7 +1737,7 @@ void X64Backend::PrepareForReentry(void* ctx) {
|
|||
bctx->current_stackpoint_depth = 0;
|
||||
}
|
||||
|
||||
const uint32_t mxcsr_table[8] = {
|
||||
constexpr uint32_t mxcsr_table[8] = {
|
||||
0x1F80, 0x7F80, 0x5F80, 0x3F80, 0x9F80, 0xFF80, 0xDF80, 0xBF80,
|
||||
};
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ constexpr unsigned int DEFAULT_FPU_MXCSR = 0x1F80;
|
|||
extern const uint32_t mxcsr_table[8];
|
||||
class X64Backend : public Backend {
|
||||
public:
|
||||
static const uint32_t kForceReturnAddress = 0x9FFF0000u;
|
||||
static constexpr uint32_t kForceReturnAddress = 0x9FFF0000u;
|
||||
|
||||
explicit X64Backend();
|
||||
~X64Backend() override;
|
||||
|
|
|
@ -79,13 +79,13 @@ class X64CodeCache : public CodeCache {
|
|||
protected:
|
||||
// All executable code falls within 0x80000000 to 0x9FFFFFFF, so we can
|
||||
// only map enough for lookups within that range.
|
||||
static const size_t kIndirectionTableSize = 0x1FFFFFFF;
|
||||
static const uintptr_t kIndirectionTableBase = 0x80000000;
|
||||
static constexpr size_t kIndirectionTableSize = 0x1FFFFFFF;
|
||||
static constexpr uintptr_t kIndirectionTableBase = 0x80000000;
|
||||
// The code range is 512MB, but we know the total code games will have is
|
||||
// pretty small (dozens of mb at most) and our expansion is reasonablish
|
||||
// so 256MB should be more than enough.
|
||||
static const size_t kGeneratedCodeSize = 0x0FFFFFFF;
|
||||
static const uintptr_t kGeneratedCodeExecuteBase = 0xA0000000;
|
||||
static constexpr size_t kGeneratedCodeSize = 0x0FFFFFFF;
|
||||
static constexpr uintptr_t kGeneratedCodeExecuteBase = 0xA0000000;
|
||||
// Used for writing when PageAccess::kExecuteReadWrite is not supported.
|
||||
static const uintptr_t kGeneratedCodeWriteBase =
|
||||
kGeneratedCodeExecuteBase + kGeneratedCodeSize + 1;
|
||||
|
@ -95,7 +95,7 @@ class X64CodeCache : public CodeCache {
|
|||
// in analysis triggering.
|
||||
// chrispy: raised this, some games that were compiled with low optimization
|
||||
// levels can exceed this
|
||||
static const size_t kMaximumFunctionCount = 1000000;
|
||||
static constexpr size_t kMaximumFunctionCount = 1000000;
|
||||
|
||||
struct UnwindReservation {
|
||||
size_t data_size = 0;
|
||||
|
|
|
@ -72,17 +72,17 @@ using xe::cpu::hir::HIRBuilder;
|
|||
using xe::cpu::hir::Instr;
|
||||
using namespace xe::literals;
|
||||
|
||||
static const size_t kMaxCodeSize = 1_MiB;
|
||||
static constexpr size_t kMaxCodeSize = 1_MiB;
|
||||
|
||||
// static const size_t kStashOffsetHigh = 32 + 32;
|
||||
|
||||
const uint32_t X64Emitter::gpr_reg_map_[X64Emitter::GPR_COUNT] = {
|
||||
constexpr uint32_t X64Emitter::gpr_reg_map_[X64Emitter::GPR_COUNT] = {
|
||||
Xbyak::Operand::RBX, Xbyak::Operand::R10, Xbyak::Operand::R11,
|
||||
Xbyak::Operand::R12, Xbyak::Operand::R13, Xbyak::Operand::R14,
|
||||
Xbyak::Operand::R15,
|
||||
};
|
||||
|
||||
const uint32_t X64Emitter::xmm_reg_map_[X64Emitter::XMM_COUNT] = {
|
||||
constexpr uint32_t X64Emitter::xmm_reg_map_[X64Emitter::XMM_COUNT] = {
|
||||
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
|
@ -1242,11 +1242,11 @@ void* X64Emitter::FindQwordConstantOffset(uint64_t qwordvalue) {
|
|||
return nullptr;
|
||||
}
|
||||
// First location to try and place constants.
|
||||
static const uintptr_t kConstDataLocation = 0x20000000;
|
||||
static constexpr uintptr_t kConstDataLocation = 0x20000000;
|
||||
static const uintptr_t kConstDataSize = sizeof(xmm_consts);
|
||||
|
||||
// Increment the location by this amount for every allocation failure.
|
||||
static const uintptr_t kConstDataIncrement = 0x00001000;
|
||||
static constexpr uintptr_t kConstDataIncrement = 0x00001000;
|
||||
|
||||
// This function places constant data that is used by the emitter later on.
|
||||
// Only called once and used by multiple instances of the emitter.
|
||||
|
|
|
@ -2100,7 +2100,7 @@ Value* HIRBuilder::CountLeadingZeros(Value* value) {
|
|||
ASSERT_INTEGER_TYPE(value);
|
||||
|
||||
if (value->IsConstantZero()) {
|
||||
static const uint8_t zeros[] = {
|
||||
static constexpr uint8_t zeros[] = {
|
||||
8,
|
||||
16,
|
||||
32,
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace cpu {
|
|||
namespace ppc {
|
||||
|
||||
constexpr size_t kNamePad = 11;
|
||||
const uint8_t kSpaces[kNamePad] = {0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20};
|
||||
constexpr uint8_t kSpaces[kNamePad] = {0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20};
|
||||
void PadStringBuffer(StringBuffer* str, size_t base, size_t pad);
|
||||
|
||||
void PrintDisasm_bcx(const PPCDecodeData& d, StringBuffer* str);
|
||||
|
|
|
@ -50,10 +50,10 @@ DEFINE_bool(
|
|||
|
||||
DECLARE_bool(allow_plugins);
|
||||
|
||||
static const uint8_t xe_xex2_retail_key[16] = {
|
||||
static constexpr uint8_t xe_xex2_retail_key[16] = {
|
||||
0x20, 0xB1, 0x85, 0xA5, 0x9D, 0x28, 0xFD, 0xC3,
|
||||
0x40, 0x58, 0x3F, 0xBB, 0x08, 0x96, 0xBF, 0x91};
|
||||
static const uint8_t xe_xex2_devkit_key[16] = {
|
||||
static constexpr uint8_t xe_xex2_devkit_key[16] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ bool XexModule::FindSaveRest() {
|
|||
// special codegen.
|
||||
// __savegprlr_14 to __savegprlr_31
|
||||
// __restgprlr_14 to __restgprlr_31
|
||||
static const uint32_t gprlr_code_values[] = {
|
||||
static constexpr uint32_t gprlr_code_values[] = {
|
||||
0x68FFC1F9, // __savegprlr_14
|
||||
0x70FFE1F9, // __savegprlr_15
|
||||
0x78FF01FA, // __savegprlr_16
|
||||
|
@ -1673,7 +1673,7 @@ bool XexModule::FindSaveRest() {
|
|||
};
|
||||
// __savefpr_14 to __savefpr_31
|
||||
// __restfpr_14 to __restfpr_31
|
||||
static const uint32_t fpr_code_values[] = {
|
||||
static constexpr uint32_t fpr_code_values[] = {
|
||||
0x70FFCCD9, // __savefpr_14
|
||||
0x78FFECD9, // __savefpr_15
|
||||
0x80FF0CDA, // __savefpr_16
|
||||
|
@ -1717,7 +1717,7 @@ bool XexModule::FindSaveRest() {
|
|||
// __savevmx_64 to __savevmx_127
|
||||
// __restvmx_14 to __restvmx_31
|
||||
// __restvmx_64 to __restvmx_127
|
||||
static const uint32_t vmx_code_values[] = {
|
||||
static constexpr uint32_t vmx_code_values[] = {
|
||||
0xE0FE6039, // __savevmx_14
|
||||
0xCE61CB7D, 0xF0FE6039, 0xCE61EB7D, 0x00FF6039, 0xCE610B7E, 0x10FF6039,
|
||||
0xCE612B7E, 0x20FF6039, 0xCE614B7E, 0x30FF6039, 0xCE616B7E, 0x40FF6039,
|
||||
|
|
|
@ -461,7 +461,7 @@ Emulator::FileSignatureType Emulator::GetFileSignature(
|
|||
}
|
||||
|
||||
const uint64_t file_size = std::filesystem::file_size(path);
|
||||
const int64_t header_size = 4;
|
||||
constexpr int64_t header_size = 4;
|
||||
|
||||
if (file_size < header_size) {
|
||||
return FileSignatureType::Unknown;
|
||||
|
|
|
@ -467,7 +467,7 @@ bool D3D12RenderTargetCache::Initialize() {
|
|||
// instead.
|
||||
if (cvars::native_2x_msaa) {
|
||||
msaa_2x_supported_ = true;
|
||||
static const DXGI_FORMAT kRenderTargetDXGIFormats[] = {
|
||||
static constexpr DXGI_FORMAT kRenderTargetDXGIFormats[] = {
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT,
|
||||
DXGI_FORMAT_R16G16B16A16_SNORM,
|
||||
DXGI_FORMAT_R32G32_FLOAT,
|
||||
|
|
|
@ -758,7 +758,7 @@ void D3D12TextureCache::WriteSampler(SamplerParameters parameters,
|
|||
D3D12_FILTER_REDUCTION_TYPE_STANDARD);
|
||||
desc.MaxAnisotropy = 1;
|
||||
}
|
||||
static const D3D12_TEXTURE_ADDRESS_MODE kAddressModeMap[] = {
|
||||
static constexpr D3D12_TEXTURE_ADDRESS_MODE kAddressModeMap[] = {
|
||||
/* kRepeat */ D3D12_TEXTURE_ADDRESS_MODE_WRAP,
|
||||
/* kMirroredRepeat */ D3D12_TEXTURE_ADDRESS_MODE_MIRROR,
|
||||
/* kClampToEdge */ D3D12_TEXTURE_ADDRESS_MODE_CLAMP,
|
||||
|
|
|
@ -3132,7 +3132,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
|
|||
|
||||
// Render targets and blending.
|
||||
state_desc.BlendState.IndependentBlendEnable = TRUE;
|
||||
static const D3D12_BLEND kBlendFactorMap[] = {
|
||||
static constexpr D3D12_BLEND kBlendFactorMap[] = {
|
||||
D3D12_BLEND_ZERO, D3D12_BLEND_ONE,
|
||||
D3D12_BLEND_SRC_COLOR, D3D12_BLEND_INV_SRC_COLOR,
|
||||
D3D12_BLEND_SRC_ALPHA, D3D12_BLEND_INV_SRC_ALPHA,
|
||||
|
@ -3142,7 +3142,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
|
|||
D3D12_BLEND_SRC_ALPHA_SAT,
|
||||
};
|
||||
// 8 entries for safety since 3 bits from the guest are passed directly.
|
||||
static const D3D12_BLEND_OP kBlendOpMap[] = {
|
||||
static constexpr D3D12_BLEND_OP kBlendOpMap[] = {
|
||||
D3D12_BLEND_OP_ADD, D3D12_BLEND_OP_SUBTRACT, D3D12_BLEND_OP_MIN,
|
||||
D3D12_BLEND_OP_MAX, D3D12_BLEND_OP_REV_SUBTRACT, D3D12_BLEND_OP_ADD,
|
||||
D3D12_BLEND_OP_ADD, D3D12_BLEND_OP_ADD};
|
||||
|
|
|
@ -77,8 +77,8 @@ reg::RB_DEPTHCONTROL GetNormalizedDepthControl(const RegisterFile& regs) {
|
|||
}
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_standard_multisample_quality_levels
|
||||
const int8_t kD3D10StandardSamplePositions2x[2][2] = {{4, 4}, {-4, -4}};
|
||||
const int8_t kD3D10StandardSamplePositions4x[4][2] = {
|
||||
constexpr int8_t kD3D10StandardSamplePositions2x[2][2] = {{4, 4}, {-4, -4}};
|
||||
constexpr int8_t kD3D10StandardSamplePositions4x[4][2] = {
|
||||
{-2, -6}, {6, -2}, {-6, 2}, {2, 6}};
|
||||
|
||||
void GetPreferredFacePolygonOffset(const RegisterFile& regs,
|
||||
|
|
|
@ -585,7 +585,7 @@ uint32_t DxbcShaderTranslator::FindOrAddSamplerBinding(
|
|||
name << "xe_sampler" << fetch_constant;
|
||||
if (aniso_filter == xenos::AnisoFilter::kDisabled ||
|
||||
aniso_filter == xenos::AnisoFilter::kUseFetchConst) {
|
||||
static const char kFilterSuffixes[] = {'p', 'l', 'b', 'f'};
|
||||
static constexpr char kFilterSuffixes[] = {'p', 'l', 'b', 'f'};
|
||||
name << '_' << kFilterSuffixes[uint32_t(mag_filter)]
|
||||
<< kFilterSuffixes[uint32_t(min_filter)]
|
||||
<< kFilterSuffixes[uint32_t(mip_filter)];
|
||||
|
@ -762,7 +762,7 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
|||
// sampling apparently round differently, so `mul` gives a value that would
|
||||
// be floored as expected, but the left/upper pixel is still sampled
|
||||
// instead.
|
||||
const float rounding_offset = 1.5f / 1024.0f;
|
||||
constexpr float rounding_offset = 1.5f / 1024.0f;
|
||||
switch (instr.dimension) {
|
||||
case xenos::FetchOpDimension::k1D:
|
||||
offsets[0] = instr.attributes.offset_x + rounding_offset;
|
||||
|
|
|
@ -173,7 +173,7 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
|
|||
: 1.0;
|
||||
uint64_t last_frame_time = Clock::QueryGuestTickCount();
|
||||
// Sleep for 90% of the vblank duration, spin for 10%
|
||||
const double duration_scalar = 0.90;
|
||||
constexpr double duration_scalar = 0.90;
|
||||
|
||||
while (frame_limiter_worker_running_) {
|
||||
register_file()->values[XE_GPU_REG_D1MODE_V_COUNTER] +=
|
||||
|
|
|
@ -13,14 +13,14 @@ namespace xe {
|
|||
namespace gpu {
|
||||
namespace reg {
|
||||
|
||||
const Register RB_COLOR_INFO::rt_register_indices[4] = {
|
||||
constexpr Register RB_COLOR_INFO::rt_register_indices[4] = {
|
||||
XE_GPU_REG_RB_COLOR_INFO,
|
||||
XE_GPU_REG_RB_COLOR1_INFO,
|
||||
XE_GPU_REG_RB_COLOR2_INFO,
|
||||
XE_GPU_REG_RB_COLOR3_INFO,
|
||||
};
|
||||
|
||||
const Register RB_BLENDCONTROL::rt_register_indices[4] = {
|
||||
constexpr Register RB_BLENDCONTROL::rt_register_indices[4] = {
|
||||
XE_GPU_REG_RB_BLENDCONTROL0,
|
||||
XE_GPU_REG_RB_BLENDCONTROL1,
|
||||
XE_GPU_REG_RB_BLENDCONTROL2,
|
||||
|
|
|
@ -121,11 +121,11 @@ constexpr SwizzleSource GetSwizzledAluSourceComponent(
|
|||
component_index));
|
||||
}
|
||||
inline char GetCharForComponentIndex(uint32_t i) {
|
||||
const static char kChars[] = {'x', 'y', 'z', 'w'};
|
||||
constexpr static char kChars[] = {'x', 'y', 'z', 'w'};
|
||||
return kChars[i];
|
||||
}
|
||||
inline char GetCharForSwizzle(SwizzleSource swizzle_source) {
|
||||
const static char kChars[] = {'x', 'y', 'z', 'w', '0', '1'};
|
||||
constexpr static char kChars[] = {'x', 'y', 'z', 'w', '0', '1'};
|
||||
return kChars[static_cast<uint32_t>(swizzle_source)];
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ spv::Id SpirvShaderTranslator::ProcessVectorAluOperation(
|
|||
EnsureBuildPointAvailable();
|
||||
|
||||
// Lookup table for variants of instructions with similar structure.
|
||||
static const unsigned int kOps[] = {
|
||||
static constexpr unsigned int kOps[] = {
|
||||
static_cast<unsigned int>(spv::OpNop), // kAdd
|
||||
static_cast<unsigned int>(spv::OpNop), // kMul
|
||||
static_cast<unsigned int>(spv::OpFOrdGreaterThanEqual), // kMax
|
||||
|
@ -883,7 +883,7 @@ spv::Id SpirvShaderTranslator::ProcessScalarAluOperation(
|
|||
EnsureBuildPointAvailable();
|
||||
|
||||
// Lookup table for variants of instructions with similar structure.
|
||||
static const unsigned int kOps[] = {
|
||||
static constexpr unsigned int kOps[] = {
|
||||
static_cast<unsigned int>(spv::OpFAdd), // kAdds
|
||||
static_cast<unsigned int>(spv::OpFAdd), // kAddsPrev
|
||||
static_cast<unsigned int>(spv::OpNop), // kMuls
|
||||
|
|
|
@ -2333,7 +2333,7 @@ size_t SpirvShaderTranslator::FindOrAddSamplerBinding(
|
|||
new_sampler_binding.mip_filter = mip_filter;
|
||||
new_sampler_binding.aniso_filter = aniso_filter;
|
||||
std::ostringstream name;
|
||||
static const char kFilterSuffixes[] = {'p', 'l', 'b', 'f'};
|
||||
static constexpr char kFilterSuffixes[] = {'p', 'l', 'b', 'f'};
|
||||
name << "xe_sampler" << fetch_constant << '_'
|
||||
<< kFilterSuffixes[uint32_t(mag_filter)]
|
||||
<< kFilterSuffixes[uint32_t(min_filter)]
|
||||
|
|
|
@ -60,7 +60,7 @@ void ConvertTexelCTX1ToR8G8(xenos::Endian endian, void* output,
|
|||
} block;
|
||||
static_assert(sizeof(block) == 8, "CTX1 block mismatch");
|
||||
|
||||
const uint32_t bytes_per_block = 8;
|
||||
constexpr uint32_t bytes_per_block = 8;
|
||||
CopySwapBlock(endian, block.data, input, bytes_per_block);
|
||||
|
||||
uint8_t cr[4] = {
|
||||
|
@ -84,7 +84,7 @@ void ConvertTexelCTX1ToR8G8(xenos::Endian endian, void* output,
|
|||
|
||||
void ConvertTexelDXT3AToDXT3(xenos::Endian endian, void* output,
|
||||
const void* input, size_t length) {
|
||||
const uint32_t bytes_per_block = 16;
|
||||
constexpr uint32_t bytes_per_block = 16;
|
||||
auto output_bytes = static_cast<uint8_t*>(output);
|
||||
CopySwapBlock(endian, &output_bytes[0], input, 8);
|
||||
std::memset(&output_bytes[8], 0, 8);
|
||||
|
|
|
@ -100,7 +100,7 @@ void TextureDump(const TextureInfo& src, void* buffer, size_t length) {
|
|||
|
||||
FILE* handle = filesystem::OpenFile(path, "wb");
|
||||
if (handle) {
|
||||
const char signature[4] = {'D', 'D', 'S', ' '};
|
||||
constexpr char signature[4] = {'D', 'D', 'S', ' '};
|
||||
fwrite(&signature, sizeof(signature), 1, handle);
|
||||
fwrite(&dds_header, sizeof(dds_header), 1, handle);
|
||||
fwrite(buffer, 1, length, handle);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace xe {
|
|||
namespace gpu {
|
||||
|
||||
// Trace file extension.
|
||||
static const char kTraceExtension[] = "xtr";
|
||||
static constexpr char kTraceExtension[] = "xtr";
|
||||
|
||||
// Any byte changes to the files should bump this version.
|
||||
// Only builds with matching versions will work.
|
||||
|
|
|
@ -47,11 +47,11 @@ namespace gpu {
|
|||
|
||||
using namespace xe::gpu::xenos;
|
||||
|
||||
static const ImVec4 kColorError =
|
||||
static constexpr ImVec4 kColorError =
|
||||
ImVec4(255 / 255.0f, 0 / 255.0f, 0 / 255.0f, 255 / 255.0f);
|
||||
static const ImVec4 kColorComment =
|
||||
static constexpr ImVec4 kColorComment =
|
||||
ImVec4(42 / 255.0f, 179 / 255.0f, 0 / 255.0f, 255 / 255.0f);
|
||||
static const ImVec4 kColorIgnored =
|
||||
static constexpr ImVec4 kColorIgnored =
|
||||
ImVec4(100 / 255.0f, 100 / 255.0f, 100 / 255.0f, 255 / 255.0f);
|
||||
|
||||
TraceViewer::TraceViewer(xe::ui::WindowedAppContext& app_context,
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace xe {
|
|||
namespace gpu {
|
||||
namespace ucode {
|
||||
|
||||
const AluScalarOpcodeInfo kAluScalarOpcodeInfos[64] = {
|
||||
constexpr AluScalarOpcodeInfo kAluScalarOpcodeInfos[64] = {
|
||||
{"adds", 1, true, kAluOpChangedStateNone},
|
||||
{"adds_prev", 1, false, kAluOpChangedStateNone},
|
||||
{"muls", 1, true, kAluOpChangedStateNone},
|
||||
|
@ -80,7 +80,7 @@ const AluScalarOpcodeInfo kAluScalarOpcodeInfos[64] = {
|
|||
{"opcode_63", 0, false, kAluOpChangedStateNone},
|
||||
};
|
||||
|
||||
const AluVectorOpcodeInfo kAluVectorOpcodeInfos[32] = {
|
||||
constexpr AluVectorOpcodeInfo kAluVectorOpcodeInfos[32] = {
|
||||
{"add", {0b1111, 0b1111}, kAluOpChangedStateNone},
|
||||
{"mul", {0b1111, 0b1111}, kAluOpChangedStateNone},
|
||||
{"max", {0b1111, 0b1111}, kAluOpChangedStateNone},
|
||||
|
|
|
@ -962,7 +962,7 @@ bool VulkanCommandProcessor::SetupContext() {
|
|||
swap_apply_gamma_pipeline_color_blend_state.pAttachments =
|
||||
&swap_apply_gamma_pipeline_color_blend_attachment_state;
|
||||
|
||||
static const VkDynamicState kSwapApplyGammaPipelineDynamicStates[] = {
|
||||
static constexpr VkDynamicState kSwapApplyGammaPipelineDynamicStates[] = {
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
};
|
||||
|
|
|
@ -2148,7 +2148,7 @@ bool VulkanPipelineCache::EnsurePipelineCreated(
|
|||
uint32_t color_rts_used =
|
||||
description.render_pass_key.depth_and_color_used >> 1;
|
||||
{
|
||||
static const VkBlendFactor kBlendFactorMap[] = {
|
||||
static constexpr VkBlendFactor kBlendFactorMap[] = {
|
||||
VK_BLEND_FACTOR_ZERO,
|
||||
VK_BLEND_FACTOR_ONE,
|
||||
VK_BLEND_FACTOR_SRC_COLOR,
|
||||
|
@ -2166,14 +2166,14 @@ bool VulkanPipelineCache::EnsurePipelineCreated(
|
|||
VK_BLEND_FACTOR_SRC_ALPHA_SATURATE,
|
||||
};
|
||||
// 8 entries for safety since 3 bits from the guest are passed directly.
|
||||
static const VkBlendOp kBlendOpMap[] = {VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_SUBTRACT,
|
||||
VK_BLEND_OP_MIN,
|
||||
VK_BLEND_OP_MAX,
|
||||
VK_BLEND_OP_REVERSE_SUBTRACT,
|
||||
VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_ADD};
|
||||
static constexpr VkBlendOp kBlendOpMap[] = {VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_SUBTRACT,
|
||||
VK_BLEND_OP_MIN,
|
||||
VK_BLEND_OP_MAX,
|
||||
VK_BLEND_OP_REVERSE_SUBTRACT,
|
||||
VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_ADD,
|
||||
VK_BLEND_OP_ADD};
|
||||
uint32_t color_rts_remaining = color_rts_used;
|
||||
uint32_t color_rt_index;
|
||||
while (xe::bit_scan_forward(color_rts_remaining, &color_rt_index)) {
|
||||
|
|
|
@ -556,7 +556,7 @@ bool VulkanRenderTargetCache::Initialize(uint32_t shared_memory_binding_count) {
|
|||
Shutdown();
|
||||
return false;
|
||||
}
|
||||
const std::pair<const uint32_t*, size_t> host_depth_store_shaders[] = {
|
||||
constexpr std::pair<const uint32_t*, size_t> host_depth_store_shaders[] = {
|
||||
{shaders::host_depth_store_1xmsaa_cs,
|
||||
sizeof(shaders::host_depth_store_1xmsaa_cs)},
|
||||
{shaders::host_depth_store_2xmsaa_cs,
|
||||
|
|
|
@ -773,7 +773,7 @@ VkSampler VulkanTextureCache::UseSampler(SamplerParameters parameters,
|
|||
sampler_create_info.mipmapMode = parameters.mag_linear
|
||||
? VK_SAMPLER_MIPMAP_MODE_LINEAR
|
||||
: VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||
static const VkSamplerAddressMode kAddressModeMap[] = {
|
||||
static constexpr VkSamplerAddressMode kAddressModeMap[] = {
|
||||
// kRepeat
|
||||
VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||
// kMirroredRepeat
|
||||
|
|
|
@ -383,7 +383,7 @@ void HidDemoApp::DrawUserInputGetKeystroke(uint32_t user_index, bool poll,
|
|||
{ui::VirtualKey::kXInputPadRThumbDownLeft, "R Thumb down & left"},
|
||||
};
|
||||
|
||||
const size_t maxLog = 128;
|
||||
constexpr size_t maxLog = 128;
|
||||
static std::array<std::forward_list<std::string>, MAX_USERS> event_logs;
|
||||
static std::array<uint64_t, MAX_USERS> last_event_times = {};
|
||||
|
||||
|
|
|
@ -680,11 +680,11 @@ bool SDLInputDriver::TestSDLVersion() const {
|
|||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
// SDL 2.0.9 or newer is required for simple rumble support and player
|
||||
// index.
|
||||
const Uint8 min_patchlevel = 9;
|
||||
constexpr Uint8 min_patchlevel = 9;
|
||||
#else
|
||||
// SDL 2.0.4 or newer is required to read game controller mappings from
|
||||
// file.
|
||||
const Uint8 min_patchlevel = 4;
|
||||
constexpr Uint8 min_patchlevel = 4;
|
||||
#endif
|
||||
|
||||
SDL_version ver = {};
|
||||
|
|
|
@ -44,7 +44,7 @@ class KernelModule : public XModule {
|
|||
std::string path_;
|
||||
|
||||
// Guest trampoline for GetProcAddress
|
||||
static const uint32_t kTrampolineSize = 400 * 8;
|
||||
static constexpr uint32_t kTrampolineSize = 400 * 8;
|
||||
uint32_t guest_trampoline_ = 0;
|
||||
uint32_t guest_trampoline_next_ = 0; // Next free entry to be generated.
|
||||
uint32_t guest_trampoline_size_ = 0;
|
||||
|
|
|
@ -221,7 +221,7 @@ dword_result_t XGetAVPack_entry() {
|
|||
DECLARE_XAM_EXPORT1(XGetAVPack, kNone, kStub);
|
||||
|
||||
uint32_t xeXGetGameRegion() {
|
||||
static uint32_t const table[] = {
|
||||
static uint32_t constexpr table[] = {
|
||||
0xFFFFu, 0x03FFu, 0x02FEu, 0x02FEu, 0x03FFu, 0x02FEu, 0x0201u, 0x03FFu,
|
||||
0x02FEu, 0x02FEu, 0x03FFu, 0x03FFu, 0x03FFu, 0x03FFu, 0x02FEu, 0x03FFu,
|
||||
0x00FFu, 0xFFFFu, 0x02FEu, 0x03FFu, 0x0102u, 0x03FFu, 0x03FFu, 0x02FEu,
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace xam {
|
|||
// Table lookups.
|
||||
|
||||
uint8_t xeXamGetOnlineCountryFromLocale(uint8_t id) {
|
||||
static uint8_t const table[] = {
|
||||
static uint8_t constexpr table[] = {
|
||||
2, 6, 5, 8, 13, 16, 19, 20, 21, 23, 25, 32, 34, 24, 37,
|
||||
39, 42, 46, 44, 50, 53, 56, 71, 74, 76, 75, 82, 84, 91, 93,
|
||||
109, 31, 90, 18, 101, 35, 103, 88, 236, 99, 4, 89, 45, 1,
|
||||
|
@ -120,7 +120,7 @@ const char16_t* xeXamGetLocaleString(uint8_t id) {
|
|||
}
|
||||
|
||||
uint8_t xeXamGetLocaleFromOnlineCountry(uint8_t id) {
|
||||
static uint8_t const table[] = {
|
||||
static uint8_t constexpr table[] = {
|
||||
0, 43, 0, 0, 40, 2, 1, 0, 3, 0, 0, 0, 0, 4, 0, 0, 5, 0, 33,
|
||||
6, 7, 8, 0, 9, 13, 10, 0, 0, 0, 0, 0, 31, 11, 0, 12, 35, 0, 14,
|
||||
0, 15, 0, 0, 16, 0, 18, 42, 17, 0, 0, 0, 19, 0, 0, 20, 0, 0, 21,
|
||||
|
@ -140,7 +140,7 @@ uint8_t xeXamGetLocaleFromOnlineCountry(uint8_t id) {
|
|||
}
|
||||
|
||||
uint8_t xeXamGetLanguageFromOnlineLanguage(uint8_t id) {
|
||||
static uint8_t const table[] = {
|
||||
static uint8_t constexpr table[] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 11, 12, 1, 1, 15, 16, 13, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -164,7 +164,7 @@ const char16_t* xeXamGetOnlineLanguageString(uint8_t id) {
|
|||
}
|
||||
|
||||
uint8_t xeXamGetCountryFromOnlineCountry(uint8_t id) {
|
||||
static uint8_t const table[] = {
|
||||
static uint8_t constexpr table[] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
|
@ -186,7 +186,7 @@ uint8_t xeXamGetCountryFromOnlineCountry(uint8_t id) {
|
|||
}
|
||||
|
||||
uint8_t xeXamGetLocaleFromCountry(uint8_t id) {
|
||||
static uint8_t const table[] = {
|
||||
static uint8_t constexpr table[] = {
|
||||
0, 43, 0, 0, 40, 2, 1, 0, 3, 0, 0, 0, 0, 4, 0, 0, 5, 0, 33,
|
||||
6, 7, 8, 0, 9, 13, 10, 0, 0, 0, 0, 0, 31, 11, 0, 12, 35, 0, 14,
|
||||
0, 15, 0, 0, 16, 0, 18, 42, 17, 0, 0, 0, 19, 0, 0, 20, 0, 0, 21,
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace xam {
|
|||
|
||||
bool xeXamIsUIActive();
|
||||
|
||||
static const std::string kXamModuleLoaderDataFileName = "launch_data.bin";
|
||||
static constexpr std::string kXamModuleLoaderDataFileName = "launch_data.bin";
|
||||
|
||||
class XamModule : public KernelModule {
|
||||
public:
|
||||
|
|
|
@ -451,25 +451,25 @@ DECLARE_XAM_EXPORT1(NetDll_WSASetEvent, kNetworking, kImplemented);
|
|||
|
||||
struct XnAddrStatus {
|
||||
// Address acquisition is not yet complete
|
||||
static const uint32_t XNET_GET_XNADDR_PENDING = 0x00000000;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_PENDING = 0x00000000;
|
||||
// XNet is uninitialized or no debugger found
|
||||
static const uint32_t XNET_GET_XNADDR_NONE = 0x00000001;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_NONE = 0x00000001;
|
||||
// Host has ethernet address (no IP address)
|
||||
static const uint32_t XNET_GET_XNADDR_ETHERNET = 0x00000002;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_ETHERNET = 0x00000002;
|
||||
// Host has statically assigned IP address
|
||||
static const uint32_t XNET_GET_XNADDR_STATIC = 0x00000004;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_STATIC = 0x00000004;
|
||||
// Host has DHCP assigned IP address
|
||||
static const uint32_t XNET_GET_XNADDR_DHCP = 0x00000008;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_DHCP = 0x00000008;
|
||||
// Host has PPPoE assigned IP address
|
||||
static const uint32_t XNET_GET_XNADDR_PPPOE = 0x00000010;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_PPPOE = 0x00000010;
|
||||
// Host has one or more gateways configured
|
||||
static const uint32_t XNET_GET_XNADDR_GATEWAY = 0x00000020;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_GATEWAY = 0x00000020;
|
||||
// Host has one or more DNS servers configured
|
||||
static const uint32_t XNET_GET_XNADDR_DNS = 0x00000040;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_DNS = 0x00000040;
|
||||
// Host is currently connected to online service
|
||||
static const uint32_t XNET_GET_XNADDR_ONLINE = 0x00000080;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_ONLINE = 0x00000080;
|
||||
// Network configuration requires troubleshooting
|
||||
static const uint32_t XNET_GET_XNADDR_TROUBLESHOOT = 0x00008000;
|
||||
static constexpr uint32_t XNET_GET_XNADDR_TROUBLESHOOT = 0x00008000;
|
||||
};
|
||||
|
||||
dword_result_t NetDll_XNetGetTitleXnAddr_entry(dword_t caller,
|
||||
|
|
|
@ -778,8 +778,9 @@ DECLARE_XBOXKRNL_EXPORT1(XeCryptHmacSha, kNone, kImplemented);
|
|||
// TODO: Array of keys we need
|
||||
|
||||
// Retail key 0x19
|
||||
static const uint8_t key19[] = {0xE1, 0xBC, 0x15, 0x9C, 0x73, 0xB1, 0xEA, 0xE9,
|
||||
0xAB, 0x31, 0x70, 0xF3, 0xAD, 0x47, 0xEB, 0xF3};
|
||||
static constexpr uint8_t key19[] = {0xE1, 0xBC, 0x15, 0x9C, 0x73, 0xB1,
|
||||
0xEA, 0xE9, 0xAB, 0x31, 0x70, 0xF3,
|
||||
0xAD, 0x47, 0xEB, 0xF3};
|
||||
|
||||
dword_result_t XeKeysHmacSha_entry(dword_t key_num, lpvoid_t inp_1,
|
||||
dword_t inp_1_size, lpvoid_t inp_2,
|
||||
|
|
|
@ -30,7 +30,7 @@ struct error_lookup_table {
|
|||
};
|
||||
|
||||
// TODO(gibbed): replace these with named error codes
|
||||
const uint32_t error_table_0x00000103[] = {
|
||||
constexpr uint32_t error_table_0x00000103[] = {
|
||||
0x000003E5, // 0x00000103
|
||||
0, //
|
||||
0x000000EA, // 0x00000105
|
||||
|
@ -44,7 +44,7 @@ const uint32_t error_table_0x00000103[] = {
|
|||
0x00000516, // 0x0000010D
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x40000002[] = {
|
||||
constexpr uint32_t error_table_0x40000002[] = {
|
||||
0x00000057, // 0x40000002
|
||||
0, //
|
||||
0, //
|
||||
|
@ -59,15 +59,15 @@ const uint32_t error_table_0x40000002[] = {
|
|||
0x00000518, // 0x4000000D
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x40020056[] = {
|
||||
constexpr uint32_t error_table_0x40020056[] = {
|
||||
0x00000720, // 0x40020056
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x400200AF[] = {
|
||||
constexpr uint32_t error_table_0x400200AF[] = {
|
||||
0x00000779, // 0x400200AF
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x80000001[] = {
|
||||
constexpr uint32_t error_table_0x80000001[] = {
|
||||
0x80000001, // 0x80000001
|
||||
0x000003E6, // 0x80000002
|
||||
0x80000003, // 0x80000003
|
||||
|
@ -107,12 +107,12 @@ const uint32_t error_table_0x80000001[] = {
|
|||
0x00000962, // 0x80000025
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x80000288[] = {
|
||||
constexpr uint32_t error_table_0x80000288[] = {
|
||||
0x0000048D, // 0x80000288
|
||||
0x0000048E, // 0x80000289
|
||||
};
|
||||
|
||||
const uint32_t error_table_0x80090300[] = {
|
||||
constexpr uint32_t error_table_0x80090300[] = {
|
||||
0x000005AA, // 0x80090300
|
||||
0x00000006, // 0x80090301
|
||||
0x00000001, // 0x80090302
|
||||
|
@ -165,7 +165,7 @@ const uint32_t error_table_0x80090300[] = {
|
|||
0x00000001, // 0x80090331
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0000001[] = {
|
||||
constexpr uint32_t error_table_0xC0000001[] = {
|
||||
0x0000001F, // 0xC0000001
|
||||
0x00000001, // 0xC0000002
|
||||
0x00000057, // 0xC0000003
|
||||
|
@ -579,7 +579,7 @@ const uint32_t error_table_0xC0000001[] = {
|
|||
0x00000712, // 0xC000019B
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0000202[] = {
|
||||
constexpr uint32_t error_table_0xC0000202[] = {
|
||||
0x00000572, // 0xC0000202
|
||||
0x0000003B, // 0xC0000203
|
||||
0x00000717, // 0xC0000204
|
||||
|
@ -815,7 +815,7 @@ const uint32_t error_table_0xC0000202[] = {
|
|||
0x00000052, // 0xC00002EA
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0020001[] = {
|
||||
constexpr uint32_t error_table_0xC0020001[] = {
|
||||
0x000006A4, // 0xC0020001
|
||||
0x000006A5, // 0xC0020002
|
||||
0x00000006, // 0xC0020003
|
||||
|
@ -917,7 +917,7 @@ const uint32_t error_table_0xC0020001[] = {
|
|||
0x0000077B, // 0xC0020063
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0030001[] = {
|
||||
constexpr uint32_t error_table_0xC0030001[] = {
|
||||
0x000006EC, // 0xC0030001
|
||||
0x000006ED, // 0xC0030002
|
||||
0x000006EE, // 0xC0030003
|
||||
|
@ -932,7 +932,7 @@ const uint32_t error_table_0xC0030001[] = {
|
|||
0x000006F7, // 0xC003000C
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0030059[] = {
|
||||
constexpr uint32_t error_table_0xC0030059[] = {
|
||||
0x00000723, // 0xC0030059
|
||||
0x00000724, // 0xC003005A
|
||||
0x00000725, // 0xC003005B
|
||||
|
@ -944,12 +944,12 @@ const uint32_t error_table_0xC0030059[] = {
|
|||
0x0000077E, // 0xC0030061
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0050003[] = {
|
||||
constexpr uint32_t error_table_0xC0050003[] = {
|
||||
0x0000045D, // 0xC0050003
|
||||
0x00000456, // 0xC0050004
|
||||
};
|
||||
|
||||
const uint32_t error_table_0xC0980001[] = {
|
||||
constexpr uint32_t error_table_0xC0980001[] = {
|
||||
0x00000037, // 0xC0980001
|
||||
0x00000037, // 0xC0980002
|
||||
0, //
|
||||
|
@ -961,7 +961,7 @@ const uint32_t error_table_0xC0980001[] = {
|
|||
};
|
||||
|
||||
#define MAKE_ENTRY(x) {x, xe::countof(error_table_##x), error_table_##x}
|
||||
const error_lookup_table error_tables[] = {
|
||||
constexpr error_lookup_table error_tables[] = {
|
||||
MAKE_ENTRY(0x00000103), MAKE_ENTRY(0x40000002), MAKE_ENTRY(0x40020056),
|
||||
MAKE_ENTRY(0x400200AF), MAKE_ENTRY(0x80000001), MAKE_ENTRY(0x80000288),
|
||||
MAKE_ENTRY(0x80090300), MAKE_ENTRY(0xC0000001), MAKE_ENTRY(0xC0000202),
|
||||
|
|
|
@ -29,14 +29,14 @@ namespace xboxkrnl {
|
|||
|
||||
struct CreateOptions {
|
||||
// https://processhacker.sourceforge.io/doc/ntioapi_8h.html
|
||||
static const uint32_t FILE_DIRECTORY_FILE = 0x00000001;
|
||||
static constexpr uint32_t FILE_DIRECTORY_FILE = 0x00000001;
|
||||
// Optimization - files access will be sequential, not random.
|
||||
static const uint32_t FILE_SEQUENTIAL_ONLY = 0x00000004;
|
||||
static const uint32_t FILE_SYNCHRONOUS_IO_ALERT = 0x00000010;
|
||||
static const uint32_t FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020;
|
||||
static const uint32_t FILE_NON_DIRECTORY_FILE = 0x00000040;
|
||||
static constexpr uint32_t FILE_SEQUENTIAL_ONLY = 0x00000004;
|
||||
static constexpr uint32_t FILE_SYNCHRONOUS_IO_ALERT = 0x00000010;
|
||||
static constexpr uint32_t FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020;
|
||||
static constexpr uint32_t FILE_NON_DIRECTORY_FILE = 0x00000040;
|
||||
// Optimization - file access will be random, not sequential.
|
||||
static const uint32_t FILE_RANDOM_ACCESS = 0x00000800;
|
||||
static constexpr uint32_t FILE_RANDOM_ACCESS = 0x00000800;
|
||||
};
|
||||
|
||||
dword_result_t NtCreateFile_entry(lpdword_t handle_out, dword_t desired_access,
|
||||
|
@ -625,7 +625,7 @@ dword_result_t NtDeviceIoControlFile_entry(
|
|||
// Called by XMountUtilityDrive cache-mounting code
|
||||
// (checks if the returned values look valid, values below seem to pass the
|
||||
// checks)
|
||||
const uint32_t cache_size = 0xFF000;
|
||||
constexpr uint32_t cache_size = 0xFF000;
|
||||
|
||||
if (io_control_code == X_IOCTL_DISK_GET_DRIVE_GEOMETRY) {
|
||||
if (output_buffer_len < 0x8) {
|
||||
|
|
|
@ -703,7 +703,7 @@ DECLARE_XBOXKRNL_EXPORT1(ExAllocatePoolWithTag, kMemory, kImplemented);
|
|||
|
||||
dword_result_t ExAllocatePool_entry(dword_t size,
|
||||
const ppc_context_t& context) {
|
||||
const uint32_t none = 0x656E6F4E; // 'None'
|
||||
constexpr uint32_t none = 0x656E6F4E; // 'None'
|
||||
return xeAllocatePoolTypeWithTag(context, size, none, 0);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(ExAllocatePool, kMemory, kImplemented);
|
||||
|
|
|
@ -52,9 +52,9 @@ struct XDPC {
|
|||
};
|
||||
|
||||
struct XAPC {
|
||||
static const uint32_t kSize = 40;
|
||||
static const uint32_t kDummyKernelRoutine = 0xF00DFF00;
|
||||
static const uint32_t kDummyRundownRoutine = 0xF00DFF01;
|
||||
static constexpr uint32_t kSize = 40;
|
||||
static constexpr uint32_t kDummyKernelRoutine = 0xF00DFF00;
|
||||
static constexpr uint32_t kDummyRundownRoutine = 0xF00DFF01;
|
||||
|
||||
// KAPC is 0x28(40) bytes? (what's passed to ExAllocatePoolWithTag)
|
||||
// This is 4b shorter than NT - looks like the reserved dword at +4 is gone.
|
||||
|
|
|
@ -1935,7 +1935,7 @@ bool PhysicalHeap::TriggerCallbacks(
|
|||
std::max(unwatch_last, physical_address_start + physical_length - 1);
|
||||
// Don't unprotect too much if not caring much about the region (limit to
|
||||
// 4 MB - somewhat random, but max 1024 iterations of the page loop).
|
||||
const uint32_t kMaxUnwatchExcess = 4 * 1024 * 1024;
|
||||
constexpr uint32_t kMaxUnwatchExcess = 4 * 1024 * 1024;
|
||||
unwatch_first = std::max(unwatch_first,
|
||||
physical_address_start & ~(kMaxUnwatchExcess - 1));
|
||||
unwatch_last =
|
||||
|
|
|
@ -61,7 +61,7 @@ bool apiscanner_loader::LoadTitleImports(const std::wstring& target) {
|
|||
|
||||
bool apiscanner_loader::ReadTarget() {
|
||||
// XXX Do a wildcard search for all xex files?
|
||||
const char path[] = "game:\\default.xex";
|
||||
constexpr char path[] = "game:\\default.xex";
|
||||
|
||||
kernel::XFile* file(nullptr);
|
||||
bool read_result(false);
|
||||
|
|
|
@ -484,7 +484,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
|
|||
bool back_buffer_acquired = false;
|
||||
bool back_buffer_bound = false;
|
||||
bool back_buffer_clear_needed = true;
|
||||
const float kBackBufferClearColor[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
constexpr float kBackBufferClearColor[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
// Draw the guest output.
|
||||
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
namespace xe {
|
||||
namespace ui {
|
||||
|
||||
const int kMaxVertices = 16 << 10;
|
||||
constexpr int kMaxVertices = 16 << 10;
|
||||
|
||||
const int kFontTextureWidth = 1024;
|
||||
const int kFontTextureHeight = 9;
|
||||
const int kFontCharWidth = 5;
|
||||
const int kFontCharHeight = 8;
|
||||
constexpr int kFontTextureWidth = 1024;
|
||||
constexpr int kFontTextureHeight = 9;
|
||||
constexpr int kFontCharWidth = 5;
|
||||
constexpr int kFontCharHeight = 8;
|
||||
|
||||
// The last texel is for solid color.
|
||||
const uint8_t kFontData[] = {
|
||||
constexpr uint8_t kFontData[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
static const uint8_t player_one_notification_icon[] = {
|
||||
static constexpr uint8_t player_one_notification_icon[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc8,
|
||||
0x08, 0x03, 0x00, 0x00, 0x00, 0x9a, 0x86, 0x5e, 0xac, 0x00, 0x00, 0x01,
|
||||
|
@ -843,8 +843,8 @@ static const uint8_t player_one_notification_icon[] = {
|
|||
0x58, 0xd4, 0xdc, 0x23, 0xab, 0x5a, 0xab, 0xca, 0x0c, 0x37, 0x15, 0x26,
|
||||
0x9a, 0xf0, 0x13, 0x17, 0x18, 0xe4, 0x66, 0x97, 0xad, 0xfd, 0xed, 0xe7,
|
||||
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
static const uint32_t player_one_notification_icon_len = 10092;
|
||||
static const uint8_t player_two_notification_icon[] = {
|
||||
static constexpr uint32_t player_one_notification_icon_len = 10092;
|
||||
static constexpr uint8_t player_two_notification_icon[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc8,
|
||||
0x08, 0x03, 0x00, 0x00, 0x00, 0x9a, 0x86, 0x5e, 0xac, 0x00, 0x00, 0x01,
|
||||
|
@ -1694,8 +1694,8 @@ static const uint8_t player_two_notification_icon[] = {
|
|||
0x59, 0xbf, 0xc7, 0x07, 0x68, 0x23, 0xbf, 0x02, 0x96, 0x37, 0xf1, 0x64,
|
||||
0x78, 0x21, 0xeb, 0x57, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
|
||||
0xae, 0x42, 0x60, 0x82};
|
||||
static const uint32_t player_two_notification_icon_len = 10180;
|
||||
static const uint8_t player_three_notification_icon[] = {
|
||||
static constexpr uint32_t player_two_notification_icon_len = 10180;
|
||||
static constexpr uint8_t player_three_notification_icon[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc8,
|
||||
0x08, 0x03, 0x00, 0x00, 0x00, 0x9a, 0x86, 0x5e, 0xac, 0x00, 0x00, 0x01,
|
||||
|
@ -2545,8 +2545,8 @@ static const uint8_t player_three_notification_icon[] = {
|
|||
0x6a, 0xe6, 0x6e, 0xa6, 0x2a, 0x4c, 0x7b, 0xcd, 0x81, 0x05, 0x6f, 0x71,
|
||||
0x02, 0xc0, 0x82, 0xc2, 0x2d, 0xcc, 0x87, 0x12, 0xac, 0x00, 0x00, 0x00,
|
||||
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
static const uint32_t player_three_notification_icon_len = 10185;
|
||||
static const uint8_t player_four_notification_icon[] = {
|
||||
static constexpr uint32_t player_three_notification_icon_len = 10185;
|
||||
static constexpr uint8_t player_four_notification_icon[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc8,
|
||||
0x08, 0x03, 0x00, 0x00, 0x00, 0x9a, 0x86, 0x5e, 0xac, 0x00, 0x00, 0x01,
|
||||
|
@ -3405,8 +3405,8 @@ static const uint8_t player_four_notification_icon[] = {
|
|||
0xc2, 0x8d, 0x78, 0xac, 0xb7, 0xf8, 0x07, 0xa4, 0x2c, 0x66, 0x66, 0x59,
|
||||
0xf3, 0x58, 0x68, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
|
||||
0x42, 0x60, 0x82};
|
||||
static const uint32_t player_four_notification_icon_len = 10287;
|
||||
static const uint8_t player_any_notification_icon[] = {
|
||||
static constexpr uint32_t player_four_notification_icon_len = 10287;
|
||||
static constexpr uint8_t player_any_notification_icon[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc8,
|
||||
0x08, 0x03, 0x00, 0x00, 0x00, 0x9a, 0x86, 0x5e, 0xac, 0x00, 0x00, 0x01,
|
||||
|
@ -4267,9 +4267,9 @@ static const uint8_t player_any_notification_icon[] = {
|
|||
0xb9, 0x01, 0x91, 0x58, 0x44, 0x55, 0x84, 0x09, 0x11, 0xf6, 0xec, 0xad,
|
||||
0xa6, 0xf0, 0x15, 0x17, 0xd8, 0xd1, 0xd1, 0x7d, 0x69, 0x7e, 0xcd, 0x46,
|
||||
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
static const uint32_t player_any_notification_icon_len = 10320;
|
||||
static constexpr uint32_t player_any_notification_icon_len = 10320;
|
||||
|
||||
static const uint8_t locked_achievement_icon_data[] = {
|
||||
static constexpr uint8_t locked_achievement_icon_data[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80,
|
||||
0x08, 0x06, 0x00, 0x00, 0x00, 0xc3, 0x3e, 0x61, 0xcb, 0x00, 0x00, 0x01,
|
||||
|
|
|
@ -68,7 +68,7 @@ bool Win32WindowedAppContext::Initialize() {
|
|||
// Create the message-only window for executing pending functions - using a
|
||||
// window instead of executing them between iterations so non-main message
|
||||
// loops, such as Windows modals, can execute pending functions too.
|
||||
static const WCHAR kPendingFunctionsWindowClassName[] =
|
||||
static constexpr WCHAR kPendingFunctionsWindowClassName[] =
|
||||
L"XeniaPendingFunctionsWindowClass";
|
||||
if (!pending_functions_window_class_registered_) {
|
||||
WNDCLASSEXW pending_functions_window_class = {};
|
||||
|
|
|
@ -45,10 +45,10 @@ static void write_process_memory(HANDLE process, uintptr_t offset,
|
|||
}
|
||||
}
|
||||
|
||||
static const unsigned char pattern_cmp_processorfeature_28_[] = {
|
||||
static constexpr unsigned char pattern_cmp_processorfeature_28_[] = {
|
||||
0x80, 0x3C, 0x25, 0x90,
|
||||
0x02, 0xFE, 0x7F, 0x00}; // cmp byte ptr ds:7FFE0290h, 0
|
||||
static const unsigned char pattern_replacement[] = {
|
||||
static constexpr unsigned char pattern_replacement[] = {
|
||||
0x48, 0x39, 0xe4, // cmp rsp, rsp = always Z
|
||||
0x0F, 0x1F, 0x44, 0x00, 0x00 // 5byte nop
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace vfs {
|
|||
|
||||
using namespace xe::literals;
|
||||
|
||||
const size_t kXESectorSize = 2_KiB;
|
||||
constexpr size_t kXESectorSize = 2_KiB;
|
||||
|
||||
DiscImageDevice::DiscImageDevice(const std::string_view mount_path,
|
||||
const std::filesystem::path& host_path)
|
||||
|
@ -70,7 +70,7 @@ Entry* DiscImageDevice::ResolvePath(const std::string_view path) {
|
|||
|
||||
DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) {
|
||||
// Find sector 32 of the game partition - try at a few points.
|
||||
static const size_t likely_offsets[] = {
|
||||
static constexpr size_t likely_offsets[] = {
|
||||
0x00000000, 0x0000FB20, 0x00020600, 0x02080000, 0x0FD90000,
|
||||
};
|
||||
bool magic_found = false;
|
||||
|
|
|
@ -278,12 +278,12 @@ static_assert_size(XContentAttributes, 1);
|
|||
|
||||
#pragma pack(push, 1)
|
||||
struct XContentMetadata {
|
||||
static const uint32_t kThumbLengthV1 = 0x4000;
|
||||
static const uint32_t kThumbLengthV2 = 0x3D00;
|
||||
static constexpr uint32_t kThumbLengthV1 = 0x4000;
|
||||
static constexpr uint32_t kThumbLengthV2 = 0x3D00;
|
||||
|
||||
static const uint32_t kNumLanguagesV1 = 9;
|
||||
static constexpr uint32_t kNumLanguagesV1 = 9;
|
||||
// metadata_version 2 adds 3 languages inside thumbnail/title_thumbnail space
|
||||
static const uint32_t kNumLanguagesV2 = 12;
|
||||
static constexpr uint32_t kNumLanguagesV2 = 12;
|
||||
|
||||
be<XContentType> content_type;
|
||||
be<uint32_t> metadata_version;
|
||||
|
|
|
@ -29,7 +29,7 @@ constexpr fourcc_t kPIRSSignature = make_fourcc("PIRS");
|
|||
|
||||
class XContentContainerDevice : public Device {
|
||||
public:
|
||||
const static uint32_t kBlockSize = 0x1000;
|
||||
constexpr static uint32_t kBlockSize = 0x1000;
|
||||
|
||||
static std::unique_ptr<Device> CreateContentDevice(
|
||||
const std::string_view mount_path,
|
||||
|
|
|
@ -212,7 +212,7 @@ SvodContainerDevice::Result SvodContainerDevice::ReadEntry(
|
|||
size_t last_record = -1;
|
||||
size_t last_offset = -1;
|
||||
while (remaining_size) {
|
||||
const size_t BLOCK_SIZE = 0x800;
|
||||
constexpr size_t BLOCK_SIZE = 0x800;
|
||||
|
||||
size_t offset, file_index;
|
||||
BlockToOffset(block_index, &offset, &file_index);
|
||||
|
@ -370,12 +370,12 @@ void SvodContainerDevice::BlockToOffset(size_t block, size_t* out_address,
|
|||
// consisting of 0x14388 data blocks, 0xCB Level0 hash tables, and 0x1
|
||||
// Level1 hash table.
|
||||
|
||||
const size_t BLOCK_SIZE = 0x800;
|
||||
const size_t HASH_BLOCK_SIZE = 0x1000;
|
||||
const size_t BLOCKS_PER_L0_HASH = 0x198;
|
||||
const size_t HASHES_PER_L1_HASH = 0xA1C4;
|
||||
const size_t BLOCKS_PER_FILE = 0x14388;
|
||||
const size_t MAX_FILE_SIZE = 0xA290000;
|
||||
constexpr size_t BLOCK_SIZE = 0x800;
|
||||
constexpr size_t HASH_BLOCK_SIZE = 0x1000;
|
||||
constexpr size_t BLOCKS_PER_L0_HASH = 0x198;
|
||||
constexpr size_t HASHES_PER_L1_HASH = 0xA1C4;
|
||||
constexpr size_t BLOCKS_PER_FILE = 0x14388;
|
||||
constexpr size_t MAX_FILE_SIZE = 0xA290000;
|
||||
const size_t BLOCK_OFFSET =
|
||||
header_->content_metadata.volume_descriptor.svod.start_data_block();
|
||||
|
||||
|
|
Loading…
Reference in New Issue