Fixing most clang-format errors.

This commit is contained in:
Ben Vanik 2015-05-03 10:27:50 -07:00
parent 6b22d35bfc
commit d1ee1512b9
39 changed files with 540 additions and 550 deletions

View File

@ -12,9 +12,7 @@
namespace xdb {
namespace sym {
Symbol* MapSymbolDatabase::Lookup(uint32_t address) {
return nullptr;
}
Symbol* MapSymbolDatabase::Lookup(uint32_t address) { return nullptr; }
} // namespace sym
} // namespace xdb

View File

@ -12,8 +12,6 @@
#include <gflags/gflags.h>
DECLARE_string(apu);
#endif // XENIA_APU_APU_PRIVATE_H_

View File

@ -17,10 +17,7 @@ using namespace xe;
using namespace xe::apu;
using namespace xe::cpu;
AudioDriver::AudioDriver(Emulator* emulator)
: emulator_(emulator), memory_(emulator->memory()) {}
AudioDriver::AudioDriver(Emulator* emulator) :
emulator_(emulator), memory_(emulator->memory()) {
}
AudioDriver::~AudioDriver() {
}
AudioDriver::~AudioDriver() {}

View File

@ -11,23 +11,17 @@
#include "xenia/apu/apu-private.h"
using namespace xe;
using namespace xe::apu;
using namespace xe::apu::nop;
NopAudioSystem::NopAudioSystem(Emulator* emulator) : AudioSystem(emulator) {}
NopAudioSystem::NopAudioSystem(Emulator* emulator) :
AudioSystem(emulator) {
}
NopAudioSystem::~NopAudioSystem() {}
NopAudioSystem::~NopAudioSystem() {
}
X_STATUS NopAudioSystem::CreateDriver(size_t index, HANDLE wait_handle, AudioDriver** out_driver) {
X_STATUS NopAudioSystem::CreateDriver(size_t index, HANDLE wait_handle,
AudioDriver** out_driver) {
return X_STATUS_NOT_IMPLEMENTED;
}
void NopAudioSystem::DestroyDriver(AudioDriver* driver) {
assert_always();
}
void NopAudioSystem::DestroyDriver(AudioDriver* driver) { assert_always(); }

View File

@ -18,19 +18,15 @@ using namespace xe;
using namespace xe::apu;
using namespace xe::apu::xaudio2;
XAudio2AudioSystem::XAudio2AudioSystem(Emulator* emulator)
: AudioSystem(emulator) {}
XAudio2AudioSystem::XAudio2AudioSystem(Emulator* emulator) :
AudioSystem(emulator) {
}
XAudio2AudioSystem::~XAudio2AudioSystem() {}
XAudio2AudioSystem::~XAudio2AudioSystem() {
}
void XAudio2AudioSystem::Initialize() { AudioSystem::Initialize(); }
void XAudio2AudioSystem::Initialize() {
AudioSystem::Initialize();
}
X_STATUS XAudio2AudioSystem::CreateDriver(size_t index, HANDLE wait, AudioDriver** out_driver) {
X_STATUS XAudio2AudioSystem::CreateDriver(size_t index, HANDLE wait,
AudioDriver** out_driver) {
assert_not_null(out_driver);
auto driver = new XAudio2AudioDriver(emulator_, wait);
driver->Initialize();

View File

@ -7,7 +7,6 @@
******************************************************************************
*/
namespace {
enum KeyType {
@ -36,16 +35,15 @@ union InstrKey {
};
uint32_t value;
operator uint32_t() const {
return value;
}
operator uint32_t() const { return value; }
InstrKey() : value(0) {}
InstrKey(uint32_t v) : value(v) {}
InstrKey(const Instr* i) : value(0) {
opcode = i->opcode->num;
uint32_t sig = i->opcode->signature;
dest = GET_OPCODE_SIG_TYPE_DEST(sig) ? OPCODE_SIG_TYPE_V + i->dest->type : 0;
dest =
GET_OPCODE_SIG_TYPE_DEST(sig) ? OPCODE_SIG_TYPE_V + i->dest->type : 0;
src1 = GET_OPCODE_SIG_TYPE_SRC1(sig);
if (src1 == OPCODE_SIG_TYPE_V) {
src1 += i->src1.value->type;
@ -60,11 +58,8 @@ union InstrKey {
}
}
template <Opcode OPCODE,
KeyType DEST = KEY_TYPE_X,
KeyType SRC1 = KEY_TYPE_X,
KeyType SRC2 = KEY_TYPE_X,
KeyType SRC3 = KEY_TYPE_X>
template <Opcode OPCODE, KeyType DEST = KEY_TYPE_X, KeyType SRC1 = KEY_TYPE_X,
KeyType SRC2 = KEY_TYPE_X, KeyType SRC3 = KEY_TYPE_X>
struct Construct {
static const uint32_t value =
(OPCODE) | (DEST << 8) | (SRC1 << 13) | (SRC2 << 18) | (SRC3 << 23);
@ -89,26 +84,32 @@ struct Op : OpBase {
struct VoidOp : Op<VoidOp, KEY_TYPE_X> {
protected:
template <typename T, KeyType KEY_TYPE> friend struct Op;
template <hir::Opcode OPCODE, typename... Ts> friend struct I;
template <typename T, KeyType KEY_TYPE>
friend struct Op;
template <hir::Opcode OPCODE, typename... Ts>
friend struct I;
void Load(const Instr::Op& op) {}
};
struct OffsetOp : Op<OffsetOp, KEY_TYPE_O> {
uint64_t value;
protected:
template <typename T, KeyType KEY_TYPE> friend struct Op;
template <hir::Opcode OPCODE, typename... Ts> friend struct I;
void Load(const Instr::Op& op) {
this->value = op.offset;
}
template <typename T, KeyType KEY_TYPE>
friend struct Op;
template <hir::Opcode OPCODE, typename... Ts>
friend struct I;
void Load(const Instr::Op& op) { this->value = op.offset; }
};
struct SymbolOp : Op<SymbolOp, KEY_TYPE_S> {
FunctionInfo* value;
protected:
template <typename T, KeyType KEY_TYPE> friend struct Op;
template <hir::Opcode OPCODE, typename... Ts> friend struct I;
template <typename T, KeyType KEY_TYPE>
friend struct Op;
template <hir::Opcode OPCODE, typename... Ts>
friend struct I;
bool Load(const Instr::Op& op) {
this->value = op.symbol_info;
return true;
@ -117,15 +118,17 @@ protected:
struct LabelOp : Op<LabelOp, KEY_TYPE_L> {
hir::Label* value;
protected:
template <typename T, KeyType KEY_TYPE> friend struct Op;
template <hir::Opcode OPCODE, typename... Ts> friend struct I;
void Load(const Instr::Op& op) {
this->value = op.label;
}
template <typename T, KeyType KEY_TYPE>
friend struct Op;
template <hir::Opcode OPCODE, typename... Ts>
friend struct I;
void Load(const Instr::Op& op) { this->value = op.label; }
};
template <typename T, KeyType KEY_TYPE, typename REG_TYPE, typename CONST_TYPE, int TAG = -1>
template <typename T, KeyType KEY_TYPE, typename REG_TYPE, typename CONST_TYPE,
int TAG = -1>
struct ValueOp : Op<ValueOp<T, KEY_TYPE, REG_TYPE, CONST_TYPE, TAG>, KEY_TYPE> {
typedef REG_TYPE reg_type;
static const int tag = TAG;
@ -136,9 +139,7 @@ struct ValueOp : Op<ValueOp<T, KEY_TYPE, REG_TYPE, CONST_TYPE, TAG>, KEY_TYPE> {
assert_true(!is_constant);
return reg_;
}
operator const REG_TYPE&() const {
return reg();
}
operator const REG_TYPE&() const { return reg(); }
bool IsEqual(const T& b) const {
if (is_constant && b.is_constant) {
return reinterpret_cast<const T*>(this)->constant() == b.constant();
@ -157,18 +158,10 @@ struct ValueOp : Op<ValueOp<T, KEY_TYPE, REG_TYPE, CONST_TYPE, TAG>, KEY_TYPE> {
return false;
}
}
bool operator== (const T& b) const {
return IsEqual(b);
}
bool operator!= (const T& b) const {
return !IsEqual(b);
}
bool operator== (const Xbyak::Reg& b) const {
return IsEqual(b);
}
bool operator!= (const Xbyak::Reg& b) const {
return !IsEqual(b);
}
bool operator==(const T& b) const { return IsEqual(b); }
bool operator!=(const T& b) const { return !IsEqual(b); }
bool operator==(const Xbyak::Reg& b) const { return IsEqual(b); }
bool operator!=(const Xbyak::Reg& b) const { return !IsEqual(b); }
void Load(const Instr::Op& op) {
const Value* value = op.value;
this->value = value;
@ -177,6 +170,7 @@ struct ValueOp : Op<ValueOp<T, KEY_TYPE, REG_TYPE, CONST_TYPE, TAG>, KEY_TYPE> {
X64Emitter::SetupReg(value, reg_);
}
}
protected:
REG_TYPE reg_;
};
@ -255,30 +249,34 @@ struct TagTable {
Instr::Op op;
} table[16];
template <typename T, typename std::enable_if<T::key_type == KEY_TYPE_X>::type* = nullptr>
template <typename T,
typename std::enable_if<T::key_type == KEY_TYPE_X>::type* = nullptr>
bool CheckTag(const Instr::Op& op) {
return true;
}
template <typename T, typename std::enable_if<T::key_type == KEY_TYPE_L>::type* = nullptr>
template <typename T,
typename std::enable_if<T::key_type == KEY_TYPE_L>::type* = nullptr>
bool CheckTag(const Instr::Op& op) {
return true;
}
template <typename T, typename std::enable_if<T::key_type == KEY_TYPE_O>::type* = nullptr>
template <typename T,
typename std::enable_if<T::key_type == KEY_TYPE_O>::type* = nullptr>
bool CheckTag(const Instr::Op& op) {
return true;
}
template <typename T, typename std::enable_if<T::key_type == KEY_TYPE_S>::type* = nullptr>
template <typename T,
typename std::enable_if<T::key_type == KEY_TYPE_S>::type* = nullptr>
bool CheckTag(const Instr::Op& op) {
return true;
}
template <typename T, typename std::enable_if<T::key_type >= KEY_TYPE_V_I8>::type* = nullptr>
template <typename T, typename std::enable_if<T::key_type >=
KEY_TYPE_V_I8>::type* = nullptr>
bool CheckTag(const Instr::Op& op) {
const Value* value = op.value;
if (T::tag == -1) {
return true;
}
if (table[T::tag].valid &&
table[T::tag].op.value != value) {
if (table[T::tag].valid && table[T::tag].op.value != value) {
return false;
}
table[T::tag].valid = true;
@ -292,6 +290,7 @@ struct DestField;
template <typename DEST>
struct DestField<DEST> {
DEST dest;
protected:
bool LoadDest(const Instr* i, TagTable& tag_table) {
Instr::Op op;
@ -306,9 +305,7 @@ protected:
template <>
struct DestField<VoidOp> {
protected:
bool LoadDest(const Instr* i, TagTable& tag_table) {
return true;
}
bool LoadDest(const Instr* i, TagTable& tag_table) { return true; }
};
template <hir::Opcode OPCODE, typename... Ts>
@ -317,14 +314,16 @@ template <hir::Opcode OPCODE, typename DEST>
struct I<OPCODE, DEST> : DestField<DEST> {
typedef DestField<DEST> BASE;
static const hir::Opcode opcode = OPCODE;
static const uint32_t key = InstrKey::Construct<OPCODE, DEST::key_type>::value;
static const uint32_t key =
InstrKey::Construct<OPCODE, DEST::key_type>::value;
static const KeyType dest_type = DEST::key_type;
const Instr* instr;
protected:
template <typename... Ti> friend struct SequenceFields;
template <typename... Ti>
friend struct SequenceFields;
bool Load(const Instr* i, TagTable& tag_table) {
if (InstrKey(i).value == key &&
BASE::LoadDest(i, tag_table)) {
if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table)) {
instr = i;
return true;
}
@ -335,16 +334,18 @@ template <hir::Opcode OPCODE, typename DEST, typename SRC1>
struct I<OPCODE, DEST, SRC1> : DestField<DEST> {
typedef DestField<DEST> BASE;
static const hir::Opcode opcode = OPCODE;
static const uint32_t key = InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type>::value;
static const uint32_t key =
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type>::value;
static const KeyType dest_type = DEST::key_type;
static const KeyType src1_type = SRC1::key_type;
const Instr* instr;
SRC1 src1;
protected:
template <typename... Ti> friend struct SequenceFields;
template <typename... Ti>
friend struct SequenceFields;
bool Load(const Instr* i, TagTable& tag_table) {
if (InstrKey(i).value == key &&
BASE::LoadDest(i, tag_table) &&
if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) &&
tag_table.CheckTag<SRC1>(i->src1)) {
instr = i;
src1.Load(i->src1);
@ -357,18 +358,20 @@ template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2>
struct I<OPCODE, DEST, SRC1, SRC2> : DestField<DEST> {
typedef DestField<DEST> BASE;
static const hir::Opcode opcode = OPCODE;
static const uint32_t key = InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type, SRC2::key_type>::value;
static const uint32_t key = InstrKey::Construct<
OPCODE, DEST::key_type, SRC1::key_type, SRC2::key_type>::value;
static const KeyType dest_type = DEST::key_type;
static const KeyType src1_type = SRC1::key_type;
static const KeyType src2_type = SRC2::key_type;
const Instr* instr;
SRC1 src1;
SRC2 src2;
protected:
template <typename... Ti> friend struct SequenceFields;
template <typename... Ti>
friend struct SequenceFields;
bool Load(const Instr* i, TagTable& tag_table) {
if (InstrKey(i).value == key &&
BASE::LoadDest(i, tag_table) &&
if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) &&
tag_table.CheckTag<SRC1>(i->src1) &&
tag_table.CheckTag<SRC2>(i->src2)) {
instr = i;
@ -379,11 +382,14 @@ protected:
return false;
}
};
template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2, typename SRC3>
template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2,
typename SRC3>
struct I<OPCODE, DEST, SRC1, SRC2, SRC3> : DestField<DEST> {
typedef DestField<DEST> BASE;
static const hir::Opcode opcode = OPCODE;
static const uint32_t key = InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type, SRC2::key_type, SRC3::key_type>::value;
static const uint32_t key =
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type,
SRC2::key_type, SRC3::key_type>::value;
static const KeyType dest_type = DEST::key_type;
static const KeyType src1_type = SRC1::key_type;
static const KeyType src2_type = SRC2::key_type;
@ -392,11 +398,12 @@ struct I<OPCODE, DEST, SRC1, SRC2, SRC3> : DestField<DEST> {
SRC1 src1;
SRC2 src2;
SRC3 src3;
protected:
template <typename... Ti> friend struct SequenceFields;
template <typename... Ti>
friend struct SequenceFields;
bool Load(const Instr* i, TagTable& tag_table) {
if (InstrKey(i).value == key &&
BASE::LoadDest(i, tag_table) &&
if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) &&
tag_table.CheckTag<SRC1>(i->src1) &&
tag_table.CheckTag<SRC2>(i->src2) &&
tag_table.CheckTag<SRC3>(i->src3)) {
@ -415,8 +422,10 @@ struct SequenceFields;
template <typename I1>
struct SequenceFields<I1> {
I1 i1;
protected:
template <typename SEQ, typename... Ti> friend struct Sequence;
template <typename SEQ, typename... Ti>
friend struct Sequence;
bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) {
if (i1.Load(i, tag_table)) {
*new_tail = i->next;
@ -428,8 +437,10 @@ protected:
template <typename I1, typename I2>
struct SequenceFields<I1, I2> : SequenceFields<I1> {
I2 i2;
protected:
template <typename SEQ, typename... Ti> friend struct Sequence;
template <typename SEQ, typename... Ti>
friend struct Sequence;
bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) {
if (SequenceFields<I1>::Check(i, tag_table, new_tail)) {
auto ni = i->next;
@ -444,8 +455,10 @@ protected:
template <typename I1, typename I2, typename I3>
struct SequenceFields<I1, I2, I3> : SequenceFields<I1, I2> {
I3 i3;
protected:
template <typename SEQ, typename... Ti> friend struct Sequence;
template <typename SEQ, typename... Ti>
friend struct Sequence;
bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) {
if (SequenceFields<I1, I2>::Check(i, tag_table, new_tail)) {
auto ni = i->next;
@ -460,8 +473,10 @@ protected:
template <typename I1, typename I2, typename I3, typename I4>
struct SequenceFields<I1, I2, I3, I4> : SequenceFields<I1, I2, I3> {
I4 i4;
protected:
template <typename SEQ, typename... Ti> friend struct Sequence;
template <typename SEQ, typename... Ti>
friend struct Sequence;
bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) {
if (SequenceFields<I1, I2, I3>::Check(i, tag_table, new_tail)) {
auto ni = i->next;
@ -476,8 +491,10 @@ protected:
template <typename I1, typename I2, typename I3, typename I4, typename I5>
struct SequenceFields<I1, I2, I3, I4, I5> : SequenceFields<I1, I2, I3, I4> {
I5 i5;
protected:
template <typename SEQ, typename... Ti> friend struct Sequence;
template <typename SEQ, typename... Ti>
friend struct Sequence;
bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) {
if (SequenceFields<I1, I2, I3, I4>::Check(i, tag_table, new_tail)) {
auto ni = i->next;
@ -539,8 +556,7 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
template <typename REG_FN>
static void EmitUnaryOp(
X64Emitter& e, const EmitArgType& i,
static void EmitUnaryOp(X64Emitter& e, const EmitArgType& i,
const REG_FN& reg_fn) {
if (i.src1.is_constant) {
e.mov(i.dest, i.src1.constant());
@ -554,9 +570,9 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
template <typename REG_REG_FN, typename REG_CONST_FN>
static void EmitCommutativeBinaryOp(
X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) {
static void EmitCommutativeBinaryOp(X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn,
const REG_CONST_FN& reg_const_fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
if (i.dest == i.src2) {
@ -596,9 +612,9 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
}
template <typename REG_REG_FN, typename REG_CONST_FN>
static void EmitAssociativeBinaryOp(
X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) {
static void EmitAssociativeBinaryOp(X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn,
const REG_CONST_FN& reg_const_fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
if (i.dest == i.src2) {
@ -645,8 +661,8 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
template <typename FN>
static void EmitCommutativeBinaryXmmOp(
X64Emitter& e, const EmitArgType& i, const FN& fn) {
static void EmitCommutativeBinaryXmmOp(X64Emitter& e, const EmitArgType& i,
const FN& fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
e.LoadConstantXmm(e.xmm0, i.src1.constant());
@ -660,8 +676,8 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
template <typename FN>
static void EmitAssociativeBinaryXmmOp(
X64Emitter& e, const EmitArgType& i, const FN& fn) {
static void EmitAssociativeBinaryXmmOp(X64Emitter& e, const EmitArgType& i,
const FN& fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
e.LoadConstantXmm(e.xmm0, i.src1.constant());
@ -675,9 +691,9 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
template <typename REG_REG_FN, typename REG_CONST_FN>
static void EmitCommutativeCompareOp(
X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) {
static void EmitCommutativeCompareOp(X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn,
const REG_CONST_FN& reg_const_fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
if (i.src1.ConstantFitsIn32Reg()) {
@ -700,13 +716,14 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
}
template <typename REG_REG_FN, typename REG_CONST_FN>
static void EmitAssociativeCompareOp(
X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) {
static void EmitAssociativeCompareOp(X64Emitter& e, const EmitArgType& i,
const REG_REG_FN& reg_reg_fn,
const REG_CONST_FN& reg_const_fn) {
if (i.src1.is_constant) {
assert_true(!i.src2.is_constant);
if (i.src1.ConstantFitsIn32Reg()) {
reg_const_fn(e, i.dest, i.src2, static_cast<int32_t>(i.src1.constant()), true);
reg_const_fn(e, i.dest, i.src2, static_cast<int32_t>(i.src1.constant()),
true);
} else {
auto temp = GetTempReg<typename decltype(i.src1)::reg_type>(e);
e.mov(temp, i.src1.constant());
@ -714,7 +731,8 @@ struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
}
} else if (i.src2.is_constant) {
if (i.src2.ConstantFitsIn32Reg()) {
reg_const_fn(e, i.dest, i.src1, static_cast<int32_t>(i.src2.constant()), false);
reg_const_fn(e, i.dest, i.src1, static_cast<int32_t>(i.src2.constant()),
false);
} else {
auto temp = GetTempReg<typename decltype(i.src2)::reg_type>(e);
e.mov(temp, i.src2.constant());
@ -747,9 +765,7 @@ void Register() {
Register<Tn, Ts...>();
};
#define EMITTER_OPCODE_TABLE(name, ...) \
void Register_##name() { \
Register<__VA_ARGS__>(); \
}
void Register_##name() { Register<__VA_ARGS__>(); }
#define MATCH(...) __VA_ARGS__
#define EMITTER(name, match) struct name : SingleSequence<name, match>

View File

@ -50,8 +50,7 @@ int DebugAgent::SetupTracing(const std::string& trace_file, uint64_t capacity) {
auto file_path = xe::to_wstring(trace_file);
file_ = CreateFile(file_path.c_str(), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY,
nullptr);
FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (!file_) {
XELOGE("Could not open trace file for writing");
return 1;

View File

@ -48,7 +48,8 @@ class Blitter {
GLuint dest_texture, Rect2D dest_rect);
private:
void Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect, GLenum filter);
void Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect,
GLenum filter);
GLuint vertex_program_;
GLuint color_fragment_program_;

View File

@ -2106,8 +2106,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateBlendState() {
draw_batcher_.Flush(DrawBatcher::FlushMode::kStateChange);
static const GLenum blend_map[] = {
/* 0 */ GL_ZERO,
static const GLenum blend_map[] = {/* 0 */ GL_ZERO,
/* 1 */ GL_ONE,
/* 2 */ GL_ZERO, // ?
/* 3 */ GL_ZERO, // ?
@ -2125,8 +2124,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateBlendState() {
/* 15 */ GL_ONE_MINUS_CONSTANT_ALPHA,
/* 16 */ GL_SRC_ALPHA_SATURATE,
};
static const GLenum blend_op_map[] = {
/* 0 */ GL_FUNC_ADD,
static const GLenum blend_op_map[] = {/* 0 */ GL_FUNC_ADD,
/* 1 */ GL_FUNC_SUBTRACT,
/* 2 */ GL_MIN,
/* 3 */ GL_MAX,
@ -2183,8 +2181,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateDepthStencilState() {
draw_batcher_.Flush(DrawBatcher::FlushMode::kStateChange);
static const GLenum compare_func_map[] = {
/* 0 */ GL_NEVER,
static const GLenum compare_func_map[] = {/* 0 */ GL_NEVER,
/* 1 */ GL_LESS,
/* 2 */ GL_EQUAL,
/* 3 */ GL_LEQUAL,
@ -2193,8 +2190,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateDepthStencilState() {
/* 6 */ GL_GEQUAL,
/* 7 */ GL_ALWAYS,
};
static const GLenum stencil_op_map[] = {
/* 0 */ GL_KEEP,
static const GLenum stencil_op_map[] = {/* 0 */ GL_KEEP,
/* 1 */ GL_ZERO,
/* 2 */ GL_REPLACE,
/* 3 */ GL_INCR_WRAP,

View File

@ -1497,13 +1497,20 @@ static const struct {
} cf_instructions[] = {
#define INSTR(opc, fxn) \
{ #opc }
INSTR(NOP, print_cf_nop), INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec), INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec), INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec), INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop), INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call), INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc), INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(NOP, print_cf_nop),
INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec),
INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec),
INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec),
INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop),
INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call),
INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc),
INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec),
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
#undef INSTR

View File

@ -44,7 +44,8 @@ class GLContext {
GLsizei length, const GLchar* message);
static void GLAPIENTRY
DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message, GLvoid* user_param);
GLsizei length, const GLchar* message,
GLvoid* user_param);
HWND hwnd_;
HDC dc_;

View File

@ -212,7 +212,8 @@ void TextureInfo::CalculateTextureSizes2D(const xe_gpu_texture_fetch_t& fetch) {
output_length = size_2d.output_pitch * block_height;
}
void TextureInfo::CalculateTextureSizesCube(const xe_gpu_texture_fetch_t& fetch) {
void TextureInfo::CalculateTextureSizesCube(
const xe_gpu_texture_fetch_t& fetch) {
assert_true(fetch.size_stack.depth + 1 == 6);
size_cube.logical_width = 1 + fetch.size_stack.width;
size_cube.logical_height = 1 + fetch.size_stack.height;

View File

@ -1062,8 +1062,7 @@ void DrawShaderUI(xe::ui::MainWindow* window, TracePlayer& player,
// glBlendFuncSeparatei(i, src_blend, dest_blend, src_blend_alpha,
// dest_blend_alpha);
void DrawBlendMode(uint32_t src_blend, uint32_t dest_blend, uint32_t blend_op) {
static const char* kBlendNames[] = {
/* 0 */ "ZERO",
static const char* kBlendNames[] = {/* 0 */ "ZERO",
/* 1 */ "ONE",
/* 2 */ "UNK2", // ?
/* 3 */ "UNK3", // ?

View File

@ -63,9 +63,10 @@ struct Output {
};
static const char* levels[] = {
"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t",
"\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t", "x", "x", "x",
"x", "x", "x",
"", "\t", "\t\t", "\t\t\t",
"\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t", "\t\t\t\t\t\t\t",
"\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t", "x", "x",
"x", "x", "x", "x",
};
/*
@ -155,8 +156,7 @@ void print_export_comment(Output* output, uint32_t num, ShaderType type) {
struct {
uint32_t num_srcs;
const char* name;
} vector_instructions[0x20] =
{
} vector_instructions[0x20] = {
#define INSTR(opc, num_srcs) \
{ num_srcs, #opc }
INSTR(ADDv, 2), // 0
@ -677,13 +677,20 @@ struct {
} cf_instructions[] = {
#define INSTR(opc, fxn) \
{ #opc, fxn }
INSTR(NOP, print_cf_nop), INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec), INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec), INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec), INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop), INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call), INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc), INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(NOP, print_cf_nop),
INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec),
INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec),
INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec),
INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop),
INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call),
INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc),
INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec),
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
#undef INSTR

View File

@ -12,8 +12,6 @@
#include <gflags/gflags.h>
DECLARE_string(hid);
#endif // XENIA_HID_HID_PRIVATE_H_

View File

@ -64,8 +64,7 @@ X_STATUS DiscImageEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
if (!entry) {
return X_STATUS_NO_SUCH_FILE;
}
}
else {
} else {
if (restart) {
it_ = gdfx_entry_->children.begin();
}

View File

@ -18,9 +18,7 @@ namespace fs {
HostPathFile::HostPathFile(KernelState* kernel_state, Mode mode,
HostPathEntry* entry, HANDLE file_handle)
: entry_(entry),
file_handle_(file_handle),
XFile(kernel_state, mode) {}
: entry_(entry), file_handle_(file_handle), XFile(kernel_state, mode) {}
HostPathFile::~HostPathFile() {
CloseHandle(file_handle_);

View File

@ -30,9 +30,7 @@ Entry::Entry(Device* device, const std::string& path)
Entry::~Entry() = default;
bool Entry::is_read_only() const {
return device_->is_read_only();
}
bool Entry::is_read_only() const { return device_->is_read_only(); }
} // namespace fs
} // namespace kernel

View File

@ -39,8 +39,7 @@ class FileSystem {
int RegisterDevice(const std::string& path, Device* device);
int RegisterHostPathDevice(const std::string& path,
const std::wstring& local_path,
bool read_only);
const std::wstring& local_path, bool read_only);
int RegisterDiscImageDevice(const std::string& path,
const std::wstring& local_path);
int RegisterSTFSContainerDevice(const std::string& path,

View File

@ -16,8 +16,7 @@ XEnumerator::XEnumerator(KernelState* kernel_state, size_t item_capacity,
size_t item_size)
: XObject(kernel_state, kTypeEnumerator),
item_capacity_(item_capacity),
item_size_(item_size)
{}
item_size_(item_size) {}
XEnumerator::~XEnumerator() = default;

View File

@ -424,8 +424,9 @@ void XThread::DeliverAPCs(void* data) {
// kernel_routine(apc_address, &normal_routine, &normal_context,
// &system_arg1, &system_arg2)
uint64_t kernel_args[] = {
apc_address, thread->scratch_address_ + 0, thread->scratch_address_ + 4,
thread->scratch_address_ + 8, thread->scratch_address_ + 12,
apc_address, thread->scratch_address_ + 0,
thread->scratch_address_ + 4, thread->scratch_address_ + 8,
thread->scratch_address_ + 12,
};
processor->ExecuteInterrupt(0, kernel_routine, kernel_args,
xe::countof(kernel_args));

View File

@ -33,7 +33,8 @@ SHIM_CALL XMsgInProcessCall_shim(PPCContext* ppc_state, KernelState* state) {
SHIM_SET_RETURN_32(result);
}
SHIM_CALL XMsgSystemProcessCall_shim(PPCContext* ppc_state, KernelState* state) {
SHIM_CALL XMsgSystemProcessCall_shim(PPCContext* ppc_state,
KernelState* state) {
uint32_t app = SHIM_GET_ARG_32(0);
uint32_t message = SHIM_GET_ARG_32(1);
uint32_t buffer = SHIM_GET_ARG_32(2);

View File

@ -416,7 +416,8 @@ SHIM_CALL XamWriteGamerTile_shim(PPCContext* ppc_state, KernelState* state) {
}
}
SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, KernelState* state) {
SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state,
KernelState* state) {
uint32_t handle_ptr = SHIM_GET_ARG_32(0);
XELOGD("XamSessionCreateHandle(%.8X)", handle_ptr);
@ -426,7 +427,8 @@ SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, KernelState* state)
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state, KernelState* state) {
SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state,
KernelState* state) {
uint32_t handle = SHIM_GET_ARG_32(0);
uint32_t obj_ptr = SHIM_GET_ARG_32(1);

View File

@ -224,15 +224,24 @@ const static struct {
uint32_t virtual_address_end;
uint32_t target_address;
} map_info[] = {
0x00000000, 0x3FFFFFFF, 0x00000000, // (1024mb) - virtual 4k pages
0x40000000, 0x7EFFFFFF, 0x40000000, // (1024mb) - virtual 64k pages (cont)
0x7F000000, 0x7F0FFFFF, 0x00000000, // (1mb) - GPU writeback
0x7F100000, 0x7FFFFFFF, 0x00100000, // (15mb) - XPS?
0x80000000, 0x8FFFFFFF, 0x80000000, // (256mb) - xex 64k pages
0x90000000, 0x9FFFFFFF, 0x80000000, // (256mb) - xex 4k pages
0xA0000000, 0xBFFFFFFF, 0x00000000, // (512mb) - physical 64k pages
0xC0000000, 0xDFFFFFFF, 0x00000000, // - physical 16mb pages
0xE0000000, 0xFFFFFFFF, 0x00000000, // - physical 4k pages
0x00000000, 0x3FFFFFFF,
0x00000000, // (1024mb) - virtual 4k pages
0x40000000, 0x7EFFFFFF,
0x40000000, // (1024mb) - virtual 64k pages (cont)
0x7F000000, 0x7F0FFFFF,
0x00000000, // (1mb) - GPU writeback
0x7F100000, 0x7FFFFFFF,
0x00100000, // (15mb) - XPS?
0x80000000, 0x8FFFFFFF,
0x80000000, // (256mb) - xex 64k pages
0x90000000, 0x9FFFFFFF,
0x80000000, // (256mb) - xex 4k pages
0xA0000000, 0xBFFFFFFF,
0x00000000, // (512mb) - physical 64k pages
0xC0000000, 0xDFFFFFFF,
0x00000000, // - physical 16mb pages
0xE0000000, 0xFFFFFFFF,
0x00000000, // - physical 4k pages
};
int Memory::MapViews(uint8_t* mapping_base) {
assert_true(xe::countof(map_info) == xe::countof(views_.all_views));

View File

@ -28,9 +28,7 @@ void apiscanner_logger::operator()(const LogType type, const char* szMessage) {
}
apiscanner_loader::apiscanner_loader()
: export_resolver(nullptr)
, memory_(nullptr)
{
: export_resolver(nullptr), memory_(nullptr) {
export_resolver = std::make_unique<xe::cpu::ExportResolver>();
kernel::XamModule::RegisterExportTable(export_resolver.get());
@ -40,8 +38,7 @@ apiscanner_loader::apiscanner_loader()
memory_->Initialize();
}
apiscanner_loader::~apiscanner_loader()
{
apiscanner_loader::~apiscanner_loader() {
if (export_resolver != nullptr) {
export_resolver.reset();
}
@ -62,7 +59,6 @@ bool apiscanner_loader::LoadTitleImports(const std::wstring& target) {
return ReadTarget();
}
bool apiscanner_loader::ReadTarget() {
// XXX Do a wildcard search for all xex files?
const char path[] = "game:\\default.xex";
@ -91,8 +87,7 @@ bool apiscanner_loader::ReadTarget() {
if (read_result) {
loaded_titles.push_back(res);
}
}
else {
} else {
kernel::XFileInfo file_info;
if (fs_entry->QueryInfo(&file_info)) {
if (file) {
@ -141,8 +136,7 @@ bool apiscanner_loader::ReadTarget() {
}
bool apiscanner_loader::ExtractImports(const void* addr, const size_t length,
title& info)
{
title& info) {
// Load the XEX into memory and decrypt.
xe_xex2_options_t xex_options = {0};
xe_xex2_ref xex_(xe_xex2_load(memory_.get(), addr, length, xex_options));
@ -163,7 +157,6 @@ bool apiscanner_loader::ExtractImports(const void* addr, const size_t length,
size_t import_info_count;
if (!xe_xex2_get_import_infos(xex_, library, &import_infos,
&import_info_count)) {
for (size_t m = 0; m < import_info_count; m++) {
const xe_xex2_import_info_t* import_info = &import_infos[m];

View File

@ -22,19 +22,14 @@
namespace xe {
namespace tools {
class apiscanner_logger
{
class apiscanner_logger {
public:
enum LogType {
LT_WARNING,
LT_ERROR
};
enum LogType { LT_WARNING, LT_ERROR };
void operator()(const LogType type, const char* szMessage);
};
class apiscanner_loader
{
class apiscanner_loader {
private:
kernel::fs::FileSystem file_system;
apiscanner_logger log;
@ -47,8 +42,7 @@ namespace tools {
bool LoadTitleImports(const std::wstring& target);
struct title
{
struct title {
uint32_t title_id;
std::vector<std::string> imports;
};
@ -64,4 +58,3 @@ namespace tools {
} // tools
} // xe

View File

@ -16,7 +16,6 @@ namespace tools {
DEFINE_string(target, "", "List of file to extract imports from");
int api_scanner_main(std::vector<std::wstring>& args) {
// XXX we need gflags to split multiple flags into arrays for us
if (args.size() == 2 || !FLAGS_target.empty()) {

View File

@ -18,11 +18,9 @@ namespace xe {
#pragma pack(push, 4)
typedef uint32_t X_HANDLE;
#define X_INVALID_HANDLE_VALUE ((X_HANDLE)-1)
// TODO(benvanik): type all of this so we get some safety.
// NT_STATUS (STATUS_*)
@ -170,7 +168,6 @@ enum X_FILE_ATTRIBUTES {
X_FILE_ATTRIBUTE_ENCRYPTED = 0x4000,
};
// http://code.google.com/p/vdash/source/browse/trunk/vdash/include/kernel.h
enum X_FILE_INFORMATION_CLASS {
XFileDirectoryInformation = 1,
@ -252,12 +249,8 @@ private:
const char* buffer;
public:
X_ANSI_STRING() {
Zero();
}
X_ANSI_STRING(const uint8_t* base, uint32_t p) {
Read(base, p);
}
X_ANSI_STRING() { Zero(); }
X_ANSI_STRING(const uint8_t* base, uint32_t p) { Read(base, p); }
void Read(const uint8_t* base, uint32_t p) {
length = xe::load_and_swap<uint16_t>(base + p);
maximum_length = xe::load_and_swap<uint16_t>(base + p + 2);
@ -289,11 +282,9 @@ public:
};
// static_assert_size(X_ANSI_STRING, 8);
// Values seem to be all over the place - GUIDs?
typedef uint32_t XNotificationID;
// http://ffplay360.googlecode.com/svn/trunk/Common/XTLOnPC.h
struct X_VIDEO_MODE {
be<uint32_t> display_width;