More style.
This commit is contained in:
parent
14beb27ebc
commit
a92566dfc5
|
@ -60,18 +60,18 @@ bool EmulatorWindow::Initialize() {
|
|||
|
||||
UpdateTitle();
|
||||
|
||||
window_->on_closed.AddListener([this](UIEvent& e) {
|
||||
window_->on_closed.AddListener([this](UIEvent* e) {
|
||||
loop_->Quit();
|
||||
|
||||
// TODO(benvanik): proper exit.
|
||||
XELOGI("User-initiated death!");
|
||||
exit(1);
|
||||
});
|
||||
loop_->on_quit.AddListener([this](UIEvent& e) { window_.reset(); });
|
||||
loop_->on_quit.AddListener([this](UIEvent* e) { window_.reset(); });
|
||||
|
||||
window_->on_key_down.AddListener([this](KeyEvent& e) {
|
||||
window_->on_key_down.AddListener([this](KeyEvent* e) {
|
||||
bool handled = true;
|
||||
switch (e.key_code()) {
|
||||
switch (e->key_code()) {
|
||||
case 0x6A: { // numpad *
|
||||
CpuTimeScalarReset();
|
||||
} break;
|
||||
|
@ -111,7 +111,7 @@ bool EmulatorWindow::Initialize() {
|
|||
|
||||
default: { handled = false; } break;
|
||||
}
|
||||
e.set_handled(handled);
|
||||
e->set_handled(handled);
|
||||
});
|
||||
|
||||
// Main menu.
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace xe {
|
|||
template <typename... Args>
|
||||
class Delegate {
|
||||
public:
|
||||
typedef std::function<void(Args&...)> Listener;
|
||||
typedef std::function<void(Args...)> Listener;
|
||||
|
||||
void AddListener(Listener const& listener) {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
|
@ -33,7 +33,7 @@ class Delegate {
|
|||
listeners_.clear();
|
||||
}
|
||||
|
||||
void operator()(Args&... args) {
|
||||
void operator()(Args... args) {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
for (auto& listener : listeners_) {
|
||||
listener(args...);
|
||||
|
|
|
@ -42,7 +42,9 @@ void format_log_line(char* buffer, size_t buffer_capacity,
|
|||
*(buffer_ptr++) = level_char;
|
||||
*(buffer_ptr++) = '>';
|
||||
*(buffer_ptr++) = ' ';
|
||||
buffer_ptr += sprintf(buffer_ptr, "%.4X", xe::threading::current_thread_id());
|
||||
buffer_ptr +=
|
||||
std::snprintf(buffer_ptr, buffer_capacity - (buffer_ptr - buffer), "%.4X",
|
||||
xe::threading::current_thread_id());
|
||||
*(buffer_ptr++) = ' ';
|
||||
|
||||
// Scribble args into the print buffer.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "xenia/cpu/backend/x64/x64_sequences.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -47,8 +48,10 @@ namespace x64 {
|
|||
using namespace Xbyak;
|
||||
|
||||
// TODO(benvanik): direct usings.
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
|
||||
using xe::cpu::hir::Instr;
|
||||
|
||||
typedef bool (*SequenceSelectFn)(X64Emitter&, const Instr*);
|
||||
std::unordered_map<uint32_t, SequenceSelectFn> sequence_table;
|
||||
|
@ -653,7 +656,7 @@ template <typename T, typename Tn, typename... Ts>
|
|||
void Register() {
|
||||
Register<T>();
|
||||
Register<Tn, Ts...>();
|
||||
};
|
||||
}
|
||||
#define EMITTER_OPCODE_TABLE(name, ...) \
|
||||
void Register_##name() { Register<__VA_ARGS__>(); }
|
||||
|
||||
|
@ -5447,8 +5450,8 @@ struct VECTOR_SHR_V128
|
|||
}
|
||||
}
|
||||
|
||||
// We've reached here if we don't have AVX2 and it's a variable shift
|
||||
// TODO: native version
|
||||
// We've reached here if we don't have AVX2 and it's a variable shift.
|
||||
// TODO(benvanik): native version.
|
||||
if (i.src2.is_constant) {
|
||||
e.LoadConstantXmm(e.xmm0, i.src2.constant());
|
||||
e.lea(e.r9, e.StashXmm(1, e.xmm0));
|
||||
|
@ -5535,8 +5538,7 @@ struct VECTOR_SHA_V128
|
|||
}
|
||||
e.vpsravd(i.dest, i.src1, e.xmm0);
|
||||
} else {
|
||||
// Emulated for now...
|
||||
// TODO: Native version
|
||||
// TODO(benvanik): native version.
|
||||
if (i.src2.is_constant) {
|
||||
e.LoadConstantXmm(e.xmm0, i.src2.constant());
|
||||
e.lea(e.r9, e.StashXmm(1, e.xmm0));
|
||||
|
@ -5684,7 +5686,7 @@ struct VECTOR_ROTATE_LEFT_V128
|
|||
// Merge:
|
||||
e.vpor(i.dest, e.xmm1);
|
||||
} else {
|
||||
// TODO: Non-AVX2 native version
|
||||
// TODO(benvanik): non-AVX2 native version.
|
||||
e.lea(e.r8, e.StashXmm(0, i.src1));
|
||||
e.lea(e.r9, e.StashXmm(1, i.src2));
|
||||
e.CallNativeSafe(reinterpret_cast<void*>(EmulateVectorRotateLeftI32));
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define XENIA_CPU_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/cpu/compiler/compiler_pass.h"
|
||||
|
|
|
@ -71,8 +71,8 @@ void DataFlowAnalysisPass::AnalyzeFlow(HIRBuilder* builder,
|
|||
|
||||
// Stash for value map. We may want to maintain this during building.
|
||||
auto arena = builder->arena();
|
||||
Value** value_map =
|
||||
(Value**)arena->Alloc(sizeof(Value*) * max_value_estimate);
|
||||
auto value_map = reinterpret_cast<Value**>(
|
||||
arena->Alloc(sizeof(Value*) * max_value_estimate));
|
||||
|
||||
// Allocate incoming bitvectors for use by blocks. We don't need outgoing
|
||||
// because they are only used during the block iteration.
|
||||
|
|
|
@ -44,7 +44,7 @@ bool FinalizationPass::Run(HIRBuilder* builder) {
|
|||
while (label) {
|
||||
if (!label->name) {
|
||||
const size_t label_len = 6 + 4 + 1;
|
||||
char* name = (char*)arena->Alloc(label_len);
|
||||
char* name = reinterpret_cast<char*>(arena->Alloc(label_len));
|
||||
snprintf(name, label_len, "_label%d", label->id);
|
||||
label->name = name;
|
||||
}
|
||||
|
|
|
@ -180,7 +180,8 @@ void RegisterAllocationPass::DumpUsage(const char* name) {
|
|||
auto usage_set = usage_sets_.all_sets[i];
|
||||
if (usage_set) {
|
||||
fprintf(stdout, "set %s:\n", usage_set->set->name);
|
||||
fprintf(stdout, " avail: %s\n", usage_set->availability.to_string().c_str());
|
||||
fprintf(stdout, " avail: %s\n",
|
||||
usage_set->availability.to_string().c_str());
|
||||
fprintf(stdout, " upcoming uses:\n");
|
||||
for (auto it = usage_set->upcoming_uses.begin();
|
||||
it != usage_set->upcoming_uses.end(); ++it) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/cpu/backend/machine_info.h"
|
||||
|
@ -24,7 +25,7 @@ namespace passes {
|
|||
|
||||
class RegisterAllocationPass : public CompilerPass {
|
||||
public:
|
||||
RegisterAllocationPass(const backend::MachineInfo* machine_info);
|
||||
explicit RegisterAllocationPass(const backend::MachineInfo* machine_info);
|
||||
~RegisterAllocationPass() override;
|
||||
|
||||
bool Run(hir::HIRBuilder* builder) override;
|
||||
|
|
|
@ -37,7 +37,7 @@ bool ValidationPass::Run(HIRBuilder* builder) {
|
|||
#if 0
|
||||
StringBuffer str;
|
||||
builder->Dump(&str);
|
||||
printf(str.GetString());
|
||||
printf("%s", str.GetString());
|
||||
fflush(stdout);
|
||||
str.Reset();
|
||||
#endif // 0
|
||||
|
|
|
@ -79,10 +79,10 @@ bool ValueReductionPass::Run(HIRBuilder* builder) {
|
|||
instr = block->instr_head;
|
||||
while (instr) {
|
||||
const OpcodeInfo* info = instr->opcode;
|
||||
OpcodeSignatureType dest_type = GET_OPCODE_SIG_TYPE_DEST(info->signature);
|
||||
OpcodeSignatureType src1_type = GET_OPCODE_SIG_TYPE_SRC1(info->signature);
|
||||
OpcodeSignatureType src2_type = GET_OPCODE_SIG_TYPE_SRC2(info->signature);
|
||||
OpcodeSignatureType src3_type = GET_OPCODE_SIG_TYPE_SRC3(info->signature);
|
||||
auto dest_type = GET_OPCODE_SIG_TYPE_DEST(info->signature);
|
||||
auto src1_type = GET_OPCODE_SIG_TYPE_SRC1(info->signature);
|
||||
auto src2_type = GET_OPCODE_SIG_TYPE_SRC2(info->signature);
|
||||
auto src3_type = GET_OPCODE_SIG_TYPE_SRC3(info->signature);
|
||||
if (src1_type == OPCODE_SIG_TYPE_V) {
|
||||
auto v = instr->src1.value;
|
||||
if (!v->last_use) {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_CONTEXT_INFO_H_
|
||||
#define XENIA_FRONTEND_CONTEXT_INFO_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_CONTEXT_INFO_H_
|
||||
#define XENIA_CPU_FRONTEND_CONTEXT_INFO_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
@ -38,4 +38,4 @@ class ContextInfo {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_CONTEXT_INFO_H_
|
||||
#endif // XENIA_CPU_FRONTEND_CONTEXT_INFO_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_CONTEXT_H_
|
||||
#define XENIA_FRONTEND_PPC_CONTEXT_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_CONTEXT_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_CONTEXT_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -229,4 +229,4 @@ static_assert(sizeof(PPCContext) % 64 == 0, "64b padded");
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_CONTEXT_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_CONTEXT_H_
|
||||
|
|
|
@ -17,117 +17,121 @@ namespace xe {
|
|||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s ???", i.type->name);
|
||||
void Disasm_0(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s ???", i->type->name);
|
||||
}
|
||||
|
||||
void Disasm__(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s", i.type->name);
|
||||
void Disasm__(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s", i->type->name);
|
||||
}
|
||||
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT, i.X.RB);
|
||||
void Disasm_X_FRT_FRB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d", i->X.Rc ? -7 : -8, i->type->name,
|
||||
i->X.Rc ? "." : "", i->X.RT, i->X.RB);
|
||||
}
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRB);
|
||||
void Disasm_A_FRT_FRB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d", i->A.Rc ? -7 : -8, i->type->name,
|
||||
i->A.Rc ? "." : "", i->A.FRT, i->A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d, f%d", i->A.Rc ? -7 : -8, i->type->name,
|
||||
i->A.Rc ? "." : "", i->A.FRT, i->A.FRA, i->A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB, i.A.FRC);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, f%d, f%d, f%d", i->A.Rc ? -7 : -8,
|
||||
i->type->name, i->A.Rc ? "." : "", i->A.FRT, i->A.FRA,
|
||||
i->A.FRB, i->A.FRC);
|
||||
}
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
void Disasm_X_RT_RA_RB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, r%d", i->type->name, i->X.RT, i->X.RA,
|
||||
i->X.RB);
|
||||
}
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA,
|
||||
i.X.RB);
|
||||
void Disasm_X_RT_RA0_RB(InstrData* i, StringBuffer* str) {
|
||||
if (i->X.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, r%d", i->type->name, i->X.RT, i->X.RA,
|
||||
i->X.RB);
|
||||
} else {
|
||||
str->AppendFormat("%-8s r%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
str->AppendFormat("%-8s r%d, 0, r%d", i->type->name, i->X.RT, i->X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
void Disasm_X_FRT_RA_RB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s f%d, r%d, r%d", i->type->name, i->X.RT, i->X.RA,
|
||||
i->X.RB);
|
||||
}
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->AppendFormat("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA,
|
||||
i.X.RB);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData* i, StringBuffer* str) {
|
||||
if (i->X.RA) {
|
||||
str->AppendFormat("%-8s f%d, r%d, r%d", i->type->name, i->X.RT, i->X.RA,
|
||||
i->X.RB);
|
||||
} else {
|
||||
str->AppendFormat("%-8s f%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
str->AppendFormat("%-8s f%d, 0, r%d", i->type->name, i->X.RT, i->X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
void Disasm_D_RT_RA_I(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i->type->name, i->D.RT, i->D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
}
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
void Disasm_D_RT_RA0_I(InstrData* i, StringBuffer* str) {
|
||||
if (i->D.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i->type->name, i->D.RT, i->D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
} else {
|
||||
str->AppendFormat("%-8s r%d, 0, %d", i.type->name, i.D.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
str->AppendFormat("%-8s r%d, 0, %d", i->type->name, i->D.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
void Disasm_D_FRT_RA_I(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s f%d, r%d, %d", i->type->name, i->D.RT, i->D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
}
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->AppendFormat("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
void Disasm_D_FRT_RA0_I(InstrData* i, StringBuffer* str) {
|
||||
if (i->D.RA) {
|
||||
str->AppendFormat("%-8s f%d, r%d, %d", i->type->name, i->D.RT, i->D.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
} else {
|
||||
str->AppendFormat("%-8s f%d, 0, %d", i.type->name, i.D.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i.D.DS));
|
||||
str->AppendFormat("%-8s f%d, 0, %d", i->type->name, i->D.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i->D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
|
||||
void Disasm_DS_RT_RA_I(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i->type->name, i->DS.RT, i->DS.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->DS.DS << 2));
|
||||
}
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.DS.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
|
||||
void Disasm_DS_RT_RA0_I(InstrData* i, StringBuffer* str) {
|
||||
if (i->DS.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d, %d", i->type->name, i->DS.RT, i->DS.RA,
|
||||
(int32_t)(int16_t)XEEXTS16(i->DS.DS << 2));
|
||||
} else {
|
||||
str->AppendFormat("%-8s r%d, 0, %d", i.type->name, i.DS.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
|
||||
str->AppendFormat("%-8s r%d, 0, %d", i->type->name, i->DS.RT,
|
||||
(int32_t)(int16_t)XEEXTS16(i->DS.DS << 2));
|
||||
}
|
||||
}
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d", i.type->name, i.D.RA);
|
||||
void Disasm_D_RA(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d", i->type->name, i->D.RA);
|
||||
}
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
void Disasm_X_RA_RB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, r%d", i->type->name, i->X.RA, i->X.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s%s r%d, r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA,
|
||||
i.XO.RB);
|
||||
void Disasm_XO_RT_RA_RB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s%s r%d, r%d, r%d", i->XO.Rc ? -7 : -8, i->type->name,
|
||||
i->XO.OE ? "o" : "", i->XO.Rc ? "." : "", i->XO.RT,
|
||||
i->XO.RA, i->XO.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s%s r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA);
|
||||
void Disasm_XO_RT_RA(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s%s r%d, r%d", i->XO.Rc ? -7 : -8, i->type->name,
|
||||
i->XO.OE ? "o" : "", i->XO.Rc ? "." : "", i->XO.RT,
|
||||
i->XO.RA);
|
||||
}
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
void Disasm_X_RA_RT_RB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, r%d", i->X.Rc ? -7 : -8, i->type->name,
|
||||
i->X.Rc ? "." : "", i->X.RA, i->X.RT, i->X.RB);
|
||||
}
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-7s. r%d, r%d, %.4Xh", i.type->name, i.D.RA, i.D.RT,
|
||||
i.D.DS);
|
||||
void Disasm_D_RA_RT_I(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-7s. r%d, r%d, %.4Xh", i->type->name, i->D.RA, i->D.RT,
|
||||
i->D.DS);
|
||||
}
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT);
|
||||
void Disasm_X_RA_RT(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d", i->X.Rc ? -7 : -8, i->type->name,
|
||||
i->X.Rc ? "." : "", i->X.RA, i->X.RT);
|
||||
}
|
||||
|
||||
#define OP(x) ((((uint32_t)(x)) & 0x3f) << 26)
|
||||
|
@ -139,90 +143,90 @@ void Disasm_X_RA_RT(InstrData& i, StringBuffer* str) {
|
|||
#define VX128_5(op, xop) (OP(op) | (((uint32_t)(xop)) & 0x10))
|
||||
#define VX128_P(op, xop) (OP(op) | (((uint32_t)(xop)) & 0x630))
|
||||
|
||||
#define VX128_VD128 (i.VX128.VD128l | (i.VX128.VD128h << 5))
|
||||
#define VX128_VD128 (i->VX128.VD128l | (i->VX128.VD128h << 5))
|
||||
#define VX128_VA128 \
|
||||
(i.VX128.VA128l | (i.VX128.VA128h << 5) | (i.VX128.VA128H << 6))
|
||||
#define VX128_VB128 (i.VX128.VB128l | (i.VX128.VB128h << 5))
|
||||
#define VX128_1_VD128 (i.VX128_1.VD128l | (i.VX128_1.VD128h << 5))
|
||||
#define VX128_2_VD128 (i.VX128_2.VD128l | (i.VX128_2.VD128h << 5))
|
||||
(i->VX128.VA128l | (i->VX128.VA128h << 5) | (i->VX128.VA128H << 6))
|
||||
#define VX128_VB128 (i->VX128.VB128l | (i->VX128.VB128h << 5))
|
||||
#define VX128_1_VD128 (i->VX128_1.VD128l | (i->VX128_1.VD128h << 5))
|
||||
#define VX128_2_VD128 (i->VX128_2.VD128l | (i->VX128_2.VD128h << 5))
|
||||
#define VX128_2_VA128 \
|
||||
(i.VX128_2.VA128l | (i.VX128_2.VA128h << 5) | (i.VX128_2.VA128H << 6))
|
||||
#define VX128_2_VB128 (i.VX128_2.VB128l | (i.VX128_2.VB128h << 5))
|
||||
#define VX128_2_VC (i.VX128_2.VC)
|
||||
#define VX128_3_VD128 (i.VX128_3.VD128l | (i.VX128_3.VD128h << 5))
|
||||
#define VX128_3_VB128 (i.VX128_3.VB128l | (i.VX128_3.VB128h << 5))
|
||||
#define VX128_3_IMM (i.VX128_3.IMM)
|
||||
#define VX128_4_VD128 (i.VX128_4.VD128l | (i.VX128_4.VD128h << 5))
|
||||
#define VX128_4_VB128 (i.VX128_4.VB128l | (i.VX128_4.VB128h << 5))
|
||||
#define VX128_5_VD128 (i.VX128_5.VD128l | (i.VX128_5.VD128h << 5))
|
||||
(i->VX128_2.VA128l | (i->VX128_2.VA128h << 5) | (i->VX128_2.VA128H << 6))
|
||||
#define VX128_2_VB128 (i->VX128_2.VB128l | (i->VX128_2.VB128h << 5))
|
||||
#define VX128_2_VC (i->VX128_2.VC)
|
||||
#define VX128_3_VD128 (i->VX128_3.VD128l | (i->VX128_3.VD128h << 5))
|
||||
#define VX128_3_VB128 (i->VX128_3.VB128l | (i->VX128_3.VB128h << 5))
|
||||
#define VX128_3_IMM (i->VX128_3.IMM)
|
||||
#define VX128_4_VD128 (i->VX128_4.VD128l | (i->VX128_4.VD128h << 5))
|
||||
#define VX128_4_VB128 (i->VX128_4.VB128l | (i->VX128_4.VB128h << 5))
|
||||
#define VX128_5_VD128 (i->VX128_5.VD128l | (i->VX128_5.VD128h << 5))
|
||||
#define VX128_5_VA128 \
|
||||
(i.VX128_5.VA128l | (i.VX128_5.VA128h << 5)) | (i.VX128_5.VA128H << 6)
|
||||
#define VX128_5_VB128 (i.VX128_5.VB128l | (i.VX128_5.VB128h << 5))
|
||||
#define VX128_5_SH (i.VX128_5.SH)
|
||||
#define VX128_R_VD128 (i.VX128_R.VD128l | (i.VX128_R.VD128h << 5))
|
||||
(i->VX128_5.VA128l | (i->VX128_5.VA128h << 5)) | (i->VX128_5.VA128H << 6)
|
||||
#define VX128_5_VB128 (i->VX128_5.VB128l | (i->VX128_5.VB128h << 5))
|
||||
#define VX128_5_SH (i->VX128_5.SH)
|
||||
#define VX128_R_VD128 (i->VX128_R.VD128l | (i->VX128_R.VD128h << 5))
|
||||
#define VX128_R_VA128 \
|
||||
(i.VX128_R.VA128l | (i.VX128_R.VA128h << 5) | (i.VX128_R.VA128H << 6))
|
||||
#define VX128_R_VB128 (i.VX128_R.VB128l | (i.VX128_R.VB128h << 5))
|
||||
(i->VX128_R.VA128l | (i->VX128_R.VA128h << 5) | (i->VX128_R.VA128H << 6))
|
||||
#define VX128_R_VB128 (i->VX128_R.VB128l | (i->VX128_R.VB128h << 5))
|
||||
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->AppendFormat("%-8s v%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA,
|
||||
i.X.RB);
|
||||
void Disasm_X_VX_RA0_RB(InstrData* i, StringBuffer* str) {
|
||||
if (i->X.RA) {
|
||||
str->AppendFormat("%-8s v%d, r%d, r%d", i->type->name, i->X.RT, i->X.RA,
|
||||
i->X.RB);
|
||||
} else {
|
||||
str->AppendFormat("%-8s v%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
str->AppendFormat("%-8s v%d, 0, r%d", i->type->name, i->X.RT, i->X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_1_VD128;
|
||||
if (i.VX128_1.RA) {
|
||||
str->AppendFormat("%-8s v%d, r%d, r%d", i.type->name, vd, i.VX128_1.RA,
|
||||
i.VX128_1.RB);
|
||||
if (i->VX128_1.RA) {
|
||||
str->AppendFormat("%-8s v%d, r%d, r%d", i->type->name, vd, i->VX128_1.RA,
|
||||
i->VX128_1.RB);
|
||||
} else {
|
||||
str->AppendFormat("%-8s v%d, 0, r%d", i.type->name, vd, i.VX128_1.RB);
|
||||
str->AppendFormat("%-8s v%d, 0, r%d", i->type->name, vd, i->VX128_1.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->AppendFormat("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
str->AppendFormat("%-8s v%d, v%d", i->type->name, vd, vb);
|
||||
}
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB_I(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t uimm = i.VX128_3.IMM;
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2Xh", i.type->name, vd, va, uimm);
|
||||
const uint32_t uimm = i->VX128_3.IMM;
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2Xh", i->type->name, vd, va, uimm);
|
||||
}
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d", i.type->name, i.VX.VD, i.VX.VA,
|
||||
i.VX.VB);
|
||||
void Disasm_VX_VD_VA_VB(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d", i->type->name, i->VX.VD, i->VX.VA,
|
||||
i->VX.VB);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VB(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d", i.type->name, vd, va, vb);
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d", i->type->name, vd, va, vb);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vd, vb);
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i->type->name, vd, va, vd, vb);
|
||||
}
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_2_VD128;
|
||||
const uint32_t va = VX128_2_VA128;
|
||||
const uint32_t vb = VX128_2_VB128;
|
||||
const uint32_t vc = i.VX128_2.VC;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vb, vc);
|
||||
const uint32_t vc = i->VX128_2.VC;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i->type->name, vd, va, vb, vc);
|
||||
}
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i.type->name, i.VXA.VD, i.VXA.VA,
|
||||
i.VXA.VB, i.VXA.VC);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, v%d", i->type->name, i->VXA.VD,
|
||||
i->VXA.VA, i->VXA.VB, i->VXA.VC);
|
||||
}
|
||||
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_sync(InstrData* i, StringBuffer* str) {
|
||||
const char* name;
|
||||
int L = i.X.RT & 3;
|
||||
int L = i->X.RT & 3;
|
||||
switch (L) {
|
||||
case 0:
|
||||
name = "hwsync";
|
||||
|
@ -239,9 +243,9 @@ void Disasm_sync(InstrData& i, StringBuffer* str) {
|
|||
str->AppendFormat("%-8s %.2X", name, L);
|
||||
}
|
||||
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_dcbf(InstrData* i, StringBuffer* str) {
|
||||
const char* name;
|
||||
switch (i.X.RT & 3) {
|
||||
switch (i->X.RT & 3) {
|
||||
case 0:
|
||||
name = "dcbf";
|
||||
break;
|
||||
|
@ -258,90 +262,90 @@ void Disasm_dcbf(InstrData& i, StringBuffer* str) {
|
|||
name = "dcbf.??";
|
||||
break;
|
||||
}
|
||||
str->AppendFormat("%-8s r%d, r%d", name, i.X.RA, i.X.RB);
|
||||
str->AppendFormat("%-8s r%d, r%d", name, i->X.RA, i->X.RB);
|
||||
}
|
||||
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_dcbz(InstrData* i, StringBuffer* str) {
|
||||
// or dcbz128 0x7C2007EC
|
||||
if (i.X.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
if (i->X.RA) {
|
||||
str->AppendFormat("%-8s r%d, r%d", i->type->name, i->X.RA, i->X.RB);
|
||||
} else {
|
||||
str->AppendFormat("%-8s 0, r%d", i.type->name, i.X.RB);
|
||||
str->AppendFormat("%-8s 0, r%d", i->type->name, i->X.RB);
|
||||
}
|
||||
}
|
||||
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, f%d, f%d", i.type->name, i.X.RT >> 2, i.X.RA,
|
||||
i.X.RB);
|
||||
void Disasm_fcmp(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, f%d, f%d", i->type->name, i->X.RT >> 2, i->X.RA,
|
||||
i->X.RB);
|
||||
}
|
||||
|
||||
void Disasm_mffsx(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, FPSCR", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT);
|
||||
void Disasm_mffsx(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s f%d, FPSCR", i->X.Rc ? -7 : -8, i->type->name,
|
||||
i->X.Rc ? "." : "", i->X.RT);
|
||||
}
|
||||
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str) {
|
||||
const char* name = i.I.LK ? "bl" : "b";
|
||||
void Disasm_bx(InstrData* i, StringBuffer* str) {
|
||||
const char* name = i->I.LK ? "bl" : "b";
|
||||
uint32_t nia;
|
||||
if (i.I.AA) {
|
||||
nia = (uint32_t)XEEXTS26(i.I.LI << 2);
|
||||
if (i->I.AA) {
|
||||
nia = (uint32_t)XEEXTS26(i->I.LI << 2);
|
||||
} else {
|
||||
nia = (uint32_t)(i.address + XEEXTS26(i.I.LI << 2));
|
||||
nia = (uint32_t)(i->address + XEEXTS26(i->I.LI << 2));
|
||||
}
|
||||
str->AppendFormat("%-8s %.8X", name, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str) {
|
||||
const char* s0 = i.B.LK ? "lr, " : "";
|
||||
void Disasm_bcx(InstrData* i, StringBuffer* str) {
|
||||
const char* s0 = i->B.LK ? "lr, " : "";
|
||||
const char* s1;
|
||||
if (!select_bits(i.B.BO, 2, 2)) {
|
||||
if (!select_bits(i->B.BO, 2, 2)) {
|
||||
s1 = "ctr, ";
|
||||
} else {
|
||||
s1 = "";
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.B.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.B.BI >> 2);
|
||||
if (!select_bits(i->B.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i->B.BI >> 2);
|
||||
}
|
||||
uint32_t nia;
|
||||
if (i.B.AA) {
|
||||
nia = (uint32_t)XEEXTS16(i.B.BD << 2);
|
||||
if (i->B.AA) {
|
||||
nia = (uint32_t)XEEXTS16(i->B.BD << 2);
|
||||
} else {
|
||||
nia = (uint32_t)(i.address + XEEXTS16(i.B.BD << 2));
|
||||
nia = (uint32_t)(i->address + XEEXTS16(i->B.BD << 2));
|
||||
}
|
||||
str->AppendFormat("%-8s %s%s%s%.8X", i.type->name, s0, s1, s2, nia);
|
||||
str->AppendFormat("%-8s %s%s%s%.8X", i->type->name, s0, s1, s2, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_bcctrx(InstrData* i, StringBuffer* str) {
|
||||
// TODO(benvanik): mnemonics
|
||||
const char* s0 = i.XL.LK ? "lr, " : "";
|
||||
const char* s0 = i->XL.LK ? "lr, " : "";
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
if (!select_bits(i->XL.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i->XL.BI >> 2);
|
||||
}
|
||||
str->AppendFormat("%-8s %s%sctr", i.type->name, s0, s2);
|
||||
str->AppendFormat("%-8s %s%sctr", i->type->name, s0, s2);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_bclrx(InstrData* i, StringBuffer* str) {
|
||||
const char* name = "bclr";
|
||||
if (i.code == 0x4E800020) {
|
||||
if (i->code == 0x4E800020) {
|
||||
name = "blr";
|
||||
}
|
||||
const char* s1;
|
||||
if (!select_bits(i.XL.BO, 2, 2)) {
|
||||
if (!select_bits(i->XL.BO, 2, 2)) {
|
||||
s1 = "ctr, ";
|
||||
} else {
|
||||
s1 = "";
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
if (!select_bits(i->XL.BO, 4, 4)) {
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i->XL.BI >> 2);
|
||||
}
|
||||
str->AppendFormat("%-8s %s%s", name, s1, s2);
|
||||
}
|
||||
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, cr", i.type->name, i.X.RT);
|
||||
void Disasm_mfcr(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, cr", i->type->name, i->X.RT);
|
||||
}
|
||||
const char* Disasm_spr_name(uint32_t n) {
|
||||
const char* reg = "???";
|
||||
|
@ -358,154 +362,154 @@ const char* Disasm_spr_name(uint32_t n) {
|
|||
}
|
||||
return reg;
|
||||
}
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
void Disasm_mfspr(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t n = ((i->XFX.spr & 0x1F) << 5) | ((i->XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->AppendFormat("%-8s r%d, %s", i.type->name, i.XFX.RT, reg);
|
||||
str->AppendFormat("%-8s r%d, %s", i->type->name, i->XFX.RT, reg);
|
||||
}
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
void Disasm_mtspr(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t n = ((i->XFX.spr & 0x1F) << 5) | ((i->XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->AppendFormat("%-8s %s, r%d", i.type->name, reg, i.XFX.RT);
|
||||
str->AppendFormat("%-8s %s, r%d", i->type->name, reg, i->XFX.RT);
|
||||
}
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, tb", i.type->name, i.XFX.RT);
|
||||
void Disasm_mftb(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, tb", i->type->name, i->XFX.RT);
|
||||
}
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d", i.type->name, i.X.RT);
|
||||
void Disasm_mfmsr(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d", i->type->name, i->X.RT);
|
||||
}
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, %d", i.type->name, i.X.RT,
|
||||
(i.X.RA & 16) ? 1 : 0);
|
||||
void Disasm_mtmsr(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s r%d, %d", i->type->name, i->X.RT,
|
||||
(i->X.RA & 16) ? 1 : 0);
|
||||
}
|
||||
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, r%d", i.type->name, i.X.RT >> 2,
|
||||
i.X.RT & 1, i.X.RA, i.X.RB);
|
||||
void Disasm_cmp(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, r%d", i->type->name, i->X.RT >> 2,
|
||||
i->X.RT & 1, i->X.RA, i->X.RB);
|
||||
}
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, %d", i.type->name, i.D.RT >> 2,
|
||||
i.D.RT & 1, i.D.RA, XEEXTS16(i.D.DS));
|
||||
void Disasm_cmpi(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, %d", i->type->name, i->D.RT >> 2,
|
||||
i->D.RT & 1, i->D.RA, XEEXTS16(i->D.DS));
|
||||
}
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, %.2X", i.type->name, i.D.RT >> 2,
|
||||
i.D.RT & 1, i.D.RA, XEEXTS16(i.D.DS));
|
||||
void Disasm_cmpli(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s cr%d, %.2X, r%d, %.2X", i->type->name, i->D.RT >> 2,
|
||||
i->D.RT & 1, i->D.RA, XEEXTS16(i->D.DS));
|
||||
}
|
||||
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str) {
|
||||
if (i.MD.idx == 0) {
|
||||
void Disasm_rld(InstrData* i, StringBuffer* str) {
|
||||
if (i->MD.idx == 0) {
|
||||
// XEDISASMR(rldiclx, 0x78000000, MD )
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, "rldicl",
|
||||
i.MD.Rc ? "." : "", i.MD.RA, i.MD.RT,
|
||||
(i.MD.SH5 << 5) | i.MD.SH, (i.MD.MB5 << 5) | i.MD.MB);
|
||||
} else if (i.MD.idx == 1) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MD.Rc ? -7 : -8, "rldicl",
|
||||
i->MD.Rc ? "." : "", i->MD.RA, i->MD.RT,
|
||||
(i->MD.SH5 << 5) | i->MD.SH, (i->MD.MB5 << 5) | i->MD.MB);
|
||||
} else if (i->MD.idx == 1) {
|
||||
// XEDISASMR(rldicrx, 0x78000004, MD )
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, "rldicr",
|
||||
i.MD.Rc ? "." : "", i.MD.RA, i.MD.RT,
|
||||
(i.MD.SH5 << 5) | i.MD.SH, (i.MD.MB5 << 5) | i.MD.MB);
|
||||
} else if (i.MD.idx == 2) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MD.Rc ? -7 : -8, "rldicr",
|
||||
i->MD.Rc ? "." : "", i->MD.RA, i->MD.RT,
|
||||
(i->MD.SH5 << 5) | i->MD.SH, (i->MD.MB5 << 5) | i->MD.MB);
|
||||
} else if (i->MD.idx == 2) {
|
||||
// XEDISASMR(rldicx, 0x78000008, MD )
|
||||
uint32_t sh = (i.MD.SH5 << 5) | i.MD.SH;
|
||||
uint32_t mb = (i.MD.MB5 << 5) | i.MD.MB;
|
||||
uint32_t sh = (i->MD.SH5 << 5) | i->MD.SH;
|
||||
uint32_t mb = (i->MD.MB5 << 5) | i->MD.MB;
|
||||
const char* name = (mb == 0x3E) ? "sldi" : "rldic";
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, name,
|
||||
i.MD.Rc ? "." : "", i.MD.RA, i.MD.RT, sh, mb);
|
||||
} else if (i.MDS.idx == 8) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MD.Rc ? -7 : -8, name,
|
||||
i->MD.Rc ? "." : "", i->MD.RA, i->MD.RT, sh, mb);
|
||||
} else if (i->MDS.idx == 8) {
|
||||
// XEDISASMR(rldclx, 0x78000010, MDS)
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MDS.Rc ? -7 : -8, "rldcl",
|
||||
i.MDS.Rc ? "." : "", i.MDS.RA, i.MDS.RT, i.MDS.RB,
|
||||
(i.MDS.MB5 << 5) | i.MDS.MB);
|
||||
} else if (i.MDS.idx == 9) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MDS.Rc ? -7 : -8, "rldcl",
|
||||
i->MDS.Rc ? "." : "", i->MDS.RA, i->MDS.RT, i->MDS.RB,
|
||||
(i->MDS.MB5 << 5) | i->MDS.MB);
|
||||
} else if (i->MDS.idx == 9) {
|
||||
// XEDISASMR(rldcrx, 0x78000012, MDS)
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MDS.Rc ? -7 : -8, "rldcr",
|
||||
i.MDS.Rc ? "." : "", i.MDS.RA, i.MDS.RT, i.MDS.RB,
|
||||
(i.MDS.MB5 << 5) | i.MDS.MB);
|
||||
} else if (i.MD.idx == 3) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MDS.Rc ? -7 : -8, "rldcr",
|
||||
i->MDS.Rc ? "." : "", i->MDS.RA, i->MDS.RT, i->MDS.RB,
|
||||
(i->MDS.MB5 << 5) | i->MDS.MB);
|
||||
} else if (i->MD.idx == 3) {
|
||||
// XEDISASMR(rldimix, 0x7800000C, MD )
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, "rldimi",
|
||||
i.MD.Rc ? "." : "", i.MD.RA, i.MD.RT,
|
||||
(i.MD.SH5 << 5) | i.MD.SH, (i.MD.MB5 << 5) | i.MD.MB);
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d", i->MD.Rc ? -7 : -8, "rldimi",
|
||||
i->MD.Rc ? "." : "", i->MD.RA, i->MD.RT,
|
||||
(i->MD.SH5 << 5) | i->MD.SH, (i->MD.MB5 << 5) | i->MD.MB);
|
||||
} else {
|
||||
assert_always();
|
||||
}
|
||||
}
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d, %d", i.M.Rc ? -7 : -8,
|
||||
i.type->name, i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH,
|
||||
i.M.MB, i.M.ME);
|
||||
void Disasm_rlwim(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d, %d, %d", i->M.Rc ? -7 : -8,
|
||||
i->type->name, i->M.Rc ? "." : "", i->M.RA, i->M.RT,
|
||||
i->M.SH, i->M.MB, i->M.ME);
|
||||
}
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, r%d, %d, %d", i.M.Rc ? -7 : -8,
|
||||
i.type->name, i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH,
|
||||
i.M.MB, i.M.ME);
|
||||
void Disasm_rlwnmx(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, r%d, %d, %d", i->M.Rc ? -7 : -8,
|
||||
i->type->name, i->M.Rc ? "." : "", i->M.RA, i->M.RT,
|
||||
i->M.SH, i->M.MB, i->M.ME);
|
||||
}
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
void Disasm_srawix(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d", i->X.Rc ? -7 : -8, i->type->name,
|
||||
i->X.Rc ? "." : "", i->X.RA, i->X.RT, i->X.RB);
|
||||
}
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d", i.XS.Rc ? -7 : -8, i.type->name,
|
||||
i.XS.Rc ? "." : "", i.XS.RA, i.XS.RT,
|
||||
(i.XS.SH5 << 5) | i.XS.SH);
|
||||
void Disasm_sradix(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%*s%s r%d, r%d, %d", i->XS.Rc ? -7 : -8, i->type->name,
|
||||
i->XS.Rc ? "." : "", i->XS.RA, i->XS.RT,
|
||||
(i->XS.SH5 << 5) | i->XS.SH);
|
||||
}
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = i.VX128_P.VD128l | (i.VX128_P.VD128h << 5);
|
||||
const uint32_t vb = i.VX128_P.VB128l | (i.VX128_P.VB128h << 5);
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i.type->name, vd, vb,
|
||||
i.VX128_P.PERMl | (i.VX128_P.PERMh << 5));
|
||||
void Disasm_vpermwi128(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = i->VX128_P.VD128l | (i->VX128_P.VD128h << 5);
|
||||
const uint32_t vb = i->VX128_P.VB128l | (i->VX128_P.VB128h << 5);
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i->type->name, vd, vb,
|
||||
i->VX128_P.PERMl | (i->VX128_P.PERMh << 5));
|
||||
}
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vrfin128(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->AppendFormat("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
str->AppendFormat("%-8s v%d, v%d", i->type->name, vd, vb);
|
||||
}
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vrlimi128(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_4_VD128;
|
||||
const uint32_t vb = VX128_4_VB128;
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X, %.2X", i.type->name, vd, vb,
|
||||
i.VX128_4.IMM, i.VX128_4.z);
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X, %.2X", i->type->name, vd, vb,
|
||||
i->VX128_4.IMM, i->VX128_4.z);
|
||||
}
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vsldoi128(InstrData* i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_5_VD128;
|
||||
const uint32_t va = VX128_5_VA128;
|
||||
const uint32_t vb = VX128_5_VB128;
|
||||
const uint32_t sh = i.VX128_5.SH;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, %.2X", i.type->name, vd, va, vb, sh);
|
||||
const uint32_t sh = i->VX128_5.SH;
|
||||
str->AppendFormat("%-8s v%d, v%d, v%d, %.2X", i->type->name, vd, va, vb, sh);
|
||||
}
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0xF);
|
||||
void Disasm_vspltb(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i->type->name, i->VX.VD, i->VX.VB,
|
||||
i->VX.VA & 0xF);
|
||||
}
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0x7);
|
||||
void Disasm_vsplth(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i->type->name, i->VX.VD, i->VX.VB,
|
||||
i->VX.VA & 0x7);
|
||||
}
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA);
|
||||
void Disasm_vspltw(InstrData* i, StringBuffer* str) {
|
||||
str->AppendFormat("%-8s v%d, v%d, %.2X", i->type->name, i->VX.VD, i->VX.VB,
|
||||
i->VX.VA);
|
||||
}
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vspltisb(InstrData* i, StringBuffer* str) {
|
||||
// 5bit -> 8bit sign extend
|
||||
int8_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xF0) : i.VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.2X", i.type->name, i.VX.VD, simm);
|
||||
int8_t simm = (i->VX.VA & 0x10) ? (i->VX.VA | 0xF0) : i->VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.2X", i->type->name, i->VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vspltish(InstrData* i, StringBuffer* str) {
|
||||
// 5bit -> 16bit sign extend
|
||||
int16_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFF0) : i.VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.4X", i.type->name, i.VX.VD, simm);
|
||||
int16_t simm = (i->VX.VA & 0x10) ? (i->VX.VA | 0xFFF0) : i->VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.4X", i->type->name, i->VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str) {
|
||||
void Disasm_vspltisw(InstrData* i, StringBuffer* str) {
|
||||
// 5bit -> 32bit sign extend
|
||||
int32_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFFFFFF0) : i.VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.8X", i.type->name, i.VX.VD, simm);
|
||||
int32_t simm = (i->VX.VA & 0x10) ? (i->VX.VA | 0xFFFFFFF0) : i->VX.VA;
|
||||
str->AppendFormat("%-8s v%d, %.8X", i->type->name, i->VX.VD, simm);
|
||||
}
|
||||
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str) {
|
||||
if (!i.type) {
|
||||
int DisasmPPC(InstrData* i, StringBuffer* str) {
|
||||
if (!i->type) {
|
||||
str->Append("???");
|
||||
} else {
|
||||
i.type->disasm(i, str);
|
||||
i->type->disasm(i, str);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_DISASM_H_
|
||||
#define XENIA_FRONTEND_PPC_DISASM_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_DISASM_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_DISASM_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
|
@ -17,10 +17,10 @@ namespace xe {
|
|||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str);
|
||||
int DisasmPPC(InstrData* i, StringBuffer* str);
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_DISASM_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_DISASM_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
#define XENIA_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
|
@ -22,12 +22,10 @@ namespace frontend {
|
|||
#define XEREGISTERINSTR(name, opcode) \
|
||||
RegisterInstrEmit(opcode, (InstrEmitFn)InstrEmit_##name);
|
||||
|
||||
//#define XEINSTRNOTIMPLEMENTED()
|
||||
#define XEINSTRNOTIMPLEMENTED() assert_always("Instruction not implemented");
|
||||
//#define XEINSTRNOTIMPLEMENTED() __debugbreak()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_EMIT_PRIVATE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_EMIT_H_
|
||||
#define XENIA_FRONTEND_PPC_EMIT_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_EMIT_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_EMIT_H_
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
|
||||
|
@ -26,4 +26,4 @@ void RegisterEmitCategoryMemory();
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_EMIT_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_EMIT_H_
|
||||
|
|
|
@ -987,7 +987,7 @@ int InstrEmit_vmrghw_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) {
|
|||
// (VD.z) = (VA.y)
|
||||
// (VD.w) = (VB.y)
|
||||
Value* v =
|
||||
f.Permute(f.LoadConstantUint32(PERMUTE_MASK(0, 0, 1, 0, 0, 1, 1, 1)),
|
||||
f.Permute(f.LoadConstantUint32(MakePermuteMask(0, 0, 1, 0, 0, 1, 1, 1)),
|
||||
f.LoadVR(va), f.LoadVR(vb), INT32_TYPE);
|
||||
f.StoreVR(vd, v);
|
||||
return 0;
|
||||
|
@ -1028,7 +1028,7 @@ int InstrEmit_vmrglw_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) {
|
|||
// (VD.z) = (VA.w)
|
||||
// (VD.w) = (VB.w)
|
||||
Value* v =
|
||||
f.Permute(f.LoadConstantUint32(PERMUTE_MASK(0, 2, 1, 2, 0, 3, 1, 3)),
|
||||
f.Permute(f.LoadConstantUint32(MakePermuteMask(0, 2, 1, 2, 0, 3, 1, 3)),
|
||||
f.LoadVR(va), f.LoadVR(vb), INT32_TYPE);
|
||||
f.StoreVR(vd, v);
|
||||
return 0;
|
||||
|
@ -1206,7 +1206,7 @@ XEEMITTER(vpermwi128, VX128_P(6, 528), VX128_P)(PPCHIRBuilder& f,
|
|||
const uint32_t vd = i.VX128_P.VD128l | (i.VX128_P.VD128h << 5);
|
||||
const uint32_t vb = i.VX128_P.VB128l | (i.VX128_P.VB128h << 5);
|
||||
uint32_t uimm = i.VX128_P.PERMl | (i.VX128_P.PERMh << 5);
|
||||
uint32_t mask = SWIZZLE_MASK(uimm >> 6, uimm >> 4, uimm >> 2, uimm >> 0);
|
||||
uint32_t mask = MakeSwizzleMask(uimm >> 6, uimm >> 4, uimm >> 2, uimm >> 0);
|
||||
Value* v = f.Swizzle(f.LoadVR(vb), INT32_TYPE, mask);
|
||||
f.StoreVR(vd, v);
|
||||
return 0;
|
||||
|
@ -1347,7 +1347,7 @@ XEEMITTER(vrlimi128, VX128_4(6, 1808), VX128_4)(PPCHIRBuilder& f,
|
|||
} else {
|
||||
v = f.LoadVR(vb);
|
||||
}
|
||||
if (blend_mask != PERMUTE_IDENTITY) {
|
||||
if (blend_mask != kIdentityPermuteMask) {
|
||||
v = f.Permute(f.LoadConstantUint32(blend_mask), v, f.LoadVR(vd),
|
||||
INT32_TYPE);
|
||||
}
|
||||
|
@ -2053,22 +2053,22 @@ XEEMITTER(vpkd3d128, VX128_4(6, 1552), VX128_4)(PPCHIRBuilder& f,
|
|||
}
|
||||
// http://hlssmod.net/he_code/public/pixelwriter.h
|
||||
// control = prev:0123 | new:4567
|
||||
uint32_t control = PERMUTE_IDENTITY; // original
|
||||
uint32_t control = kIdentityPermuteMask; // original
|
||||
switch (pack) {
|
||||
case 1: // VPACK_32
|
||||
// VPACK_32 & shift = 3 puts lower 32 bits in x (leftmost slot).
|
||||
switch (shift) {
|
||||
case 0:
|
||||
control = PERMUTE_MASK(0, 0, 0, 1, 0, 2, 1, 3);
|
||||
control = MakePermuteMask(0, 0, 0, 1, 0, 2, 1, 3);
|
||||
break;
|
||||
case 1:
|
||||
control = PERMUTE_MASK(0, 0, 0, 1, 1, 3, 0, 3);
|
||||
control = MakePermuteMask(0, 0, 0, 1, 1, 3, 0, 3);
|
||||
break;
|
||||
case 2:
|
||||
control = PERMUTE_MASK(0, 0, 1, 3, 0, 2, 0, 3);
|
||||
control = MakePermuteMask(0, 0, 1, 3, 0, 2, 0, 3);
|
||||
break;
|
||||
case 3:
|
||||
control = PERMUTE_MASK(1, 3, 0, 1, 0, 2, 0, 3);
|
||||
control = MakePermuteMask(1, 3, 0, 1, 0, 2, 0, 3);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(shift);
|
||||
|
@ -2078,16 +2078,16 @@ XEEMITTER(vpkd3d128, VX128_4(6, 1552), VX128_4)(PPCHIRBuilder& f,
|
|||
case 2: // 64bit
|
||||
switch (shift) {
|
||||
case 0:
|
||||
control = PERMUTE_MASK(0, 0, 0, 1, 1, 2, 1, 3);
|
||||
control = MakePermuteMask(0, 0, 0, 1, 1, 2, 1, 3);
|
||||
break;
|
||||
case 1:
|
||||
control = PERMUTE_MASK(0, 0, 1, 2, 1, 3, 0, 3);
|
||||
control = MakePermuteMask(0, 0, 1, 2, 1, 3, 0, 3);
|
||||
break;
|
||||
case 2:
|
||||
control = PERMUTE_MASK(1, 2, 1, 3, 0, 2, 0, 3);
|
||||
control = MakePermuteMask(1, 2, 1, 3, 0, 2, 0, 3);
|
||||
break;
|
||||
case 3:
|
||||
control = PERMUTE_MASK(1, 3, 0, 1, 0, 2, 0, 3);
|
||||
control = MakePermuteMask(1, 3, 0, 1, 0, 2, 0, 3);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(shift);
|
||||
|
@ -2097,16 +2097,16 @@ XEEMITTER(vpkd3d128, VX128_4(6, 1552), VX128_4)(PPCHIRBuilder& f,
|
|||
case 3: // 64bit
|
||||
switch (shift) {
|
||||
case 0:
|
||||
control = PERMUTE_MASK(0, 0, 0, 1, 1, 2, 1, 3);
|
||||
control = MakePermuteMask(0, 0, 0, 1, 1, 2, 1, 3);
|
||||
break;
|
||||
case 1:
|
||||
control = PERMUTE_MASK(0, 0, 1, 2, 1, 3, 0, 3);
|
||||
control = MakePermuteMask(0, 0, 1, 2, 1, 3, 0, 3);
|
||||
break;
|
||||
case 2:
|
||||
control = PERMUTE_MASK(1, 2, 1, 3, 0, 2, 0, 3);
|
||||
control = MakePermuteMask(1, 2, 1, 3, 0, 2, 0, 3);
|
||||
break;
|
||||
case 3:
|
||||
control = PERMUTE_MASK(0, 0, 0, 1, 0, 2, 1, 2);
|
||||
control = MakePermuteMask(0, 0, 0, 1, 0, 2, 1, 2);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(shift);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_FRONTEND_H_
|
||||
#define XENIA_FRONTEND_PPC_FRONTEND_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_FRONTEND_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_FRONTEND_H_
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
@ -64,4 +64,4 @@ class PPCFrontend {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_FRONTEND_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_FRONTEND_H_
|
||||
|
|
|
@ -106,7 +106,7 @@ bool PPCHIRBuilder::Emit(GuestFunction* function, uint32_t flags) {
|
|||
}
|
||||
comment_buffer_.Reset();
|
||||
comment_buffer_.AppendFormat("%.8X %.8X ", address, i.code);
|
||||
DisasmPPC(i, &comment_buffer_);
|
||||
DisasmPPC(&i, &comment_buffer_);
|
||||
Comment(comment_buffer_);
|
||||
first_instr = last_instr();
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#define XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
|
@ -26,7 +26,7 @@ class PPCHIRBuilder : public hir::HIRBuilder {
|
|||
using Value = xe::cpu::hir::Value;
|
||||
|
||||
public:
|
||||
PPCHIRBuilder(PPCFrontend* frontend);
|
||||
explicit PPCHIRBuilder(PPCFrontend* frontend);
|
||||
~PPCHIRBuilder() override;
|
||||
|
||||
void Reset() override;
|
||||
|
@ -109,4 +109,4 @@ class PPCHIRBuilder : public hir::HIRBuilder {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_INSTR_H_
|
||||
#define XENIA_FRONTEND_PPC_INSTR_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_INSTR_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_INSTR_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -497,7 +497,7 @@ class InstrDisasm {
|
|||
void Dump(std::string& out_str, size_t pad = 13);
|
||||
};
|
||||
|
||||
typedef void (*InstrDisasmFn)(InstrData& i, StringBuffer* str);
|
||||
typedef void (*InstrDisasmFn)(InstrData* i, StringBuffer* str);
|
||||
typedef void* InstrEmitFn;
|
||||
|
||||
class InstrType {
|
||||
|
@ -522,4 +522,4 @@ int RegisterInstrEmit(uint32_t code, InstrEmitFn emit);
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_INSTR_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_INSTR_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
#define XENIA_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -20,76 +20,76 @@ namespace xe {
|
|||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, StringBuffer* str);
|
||||
void Disasm__(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_0(InstrData* i, StringBuffer* str);
|
||||
void Disasm__(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData* i, StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData* i, StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str);
|
||||
void Disasm_sync(InstrData* i, StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData* i, StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData* i, StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bx(InstrData* i, StringBuffer* str);
|
||||
void Disasm_bcx(InstrData* i, StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData* i, StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfcr(InstrData* i, StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData* i, StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData* i, StringBuffer* str);
|
||||
void Disasm_mftb(InstrData* i, StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData* i, StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmp(InstrData* i, StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData* i, StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str);
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rld(InstrData* i, StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData* i, StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData* i, StringBuffer* str);
|
||||
void Disasm_srawix(InstrData* i, StringBuffer* str);
|
||||
void Disasm_sradix(InstrData* i, StringBuffer* str);
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vpermwi128(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData* i, StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData* i, StringBuffer* str);
|
||||
|
||||
namespace tables {
|
||||
|
||||
|
@ -1097,4 +1097,4 @@ static InstrType instr_table_scan[] = {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_INSTR_TABLES_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_SCANNER_H_
|
||||
#define XENIA_FRONTEND_PPC_SCANNER_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_SCANNER_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_SCANNER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -28,7 +28,7 @@ struct BlockInfo {
|
|||
|
||||
class PPCScanner {
|
||||
public:
|
||||
PPCScanner(PPCFrontend* frontend);
|
||||
explicit PPCScanner(PPCFrontend* frontend);
|
||||
~PPCScanner();
|
||||
|
||||
bool Scan(GuestFunction* function, DebugInfo* debug_info);
|
||||
|
@ -45,4 +45,4 @@ class PPCScanner {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_SCANNER_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_SCANNER_H_
|
||||
|
|
|
@ -33,9 +33,6 @@ namespace xe {
|
|||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace xe::cpu;
|
||||
|
||||
using xe::cpu::backend::Backend;
|
||||
using xe::cpu::compiler::Compiler;
|
||||
namespace passes = xe::cpu::compiler::passes;
|
||||
|
@ -208,7 +205,7 @@ bool PPCTranslator::Translate(GuestFunction* function,
|
|||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
void PPCTranslator::DumpSource(GuestFunction* function,
|
||||
StringBuffer* string_buffer) {
|
||||
|
@ -239,7 +236,7 @@ void PPCTranslator::DumpSource(GuestFunction* function,
|
|||
}
|
||||
|
||||
string_buffer->AppendFormat("%.8X %.8X ", address, i.code);
|
||||
DisasmPPC(i, string_buffer);
|
||||
DisasmPPC(&i, string_buffer);
|
||||
string_buffer->Append('\n');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_FRONTEND_PPC_TRANSLATOR_H_
|
||||
#define XENIA_FRONTEND_PPC_TRANSLATOR_H_
|
||||
#ifndef XENIA_CPU_FRONTEND_PPC_TRANSLATOR_H_
|
||||
#define XENIA_CPU_FRONTEND_PPC_TRANSLATOR_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -27,7 +27,7 @@ class PPCScanner;
|
|||
|
||||
class PPCTranslator {
|
||||
public:
|
||||
PPCTranslator(PPCFrontend* frontend);
|
||||
explicit PPCTranslator(PPCFrontend* frontend);
|
||||
~PPCTranslator();
|
||||
|
||||
bool Translate(GuestFunction* function, uint32_t debug_info_flags);
|
||||
|
@ -48,4 +48,4 @@ class PPCTranslator {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_FRONTEND_PPC_TRANSLATOR_H_
|
||||
#endif // XENIA_CPU_FRONTEND_PPC_TRANSLATOR_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_BLOCK_H_
|
||||
#define XENIA_HIR_BLOCK_H_
|
||||
#ifndef XENIA_CPU_HIR_BLOCK_H_
|
||||
#define XENIA_CPU_HIR_BLOCK_H_
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
|
||||
|
@ -70,4 +70,4 @@ class Block {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_BLOCK_H_
|
||||
#endif // XENIA_CPU_HIR_BLOCK_H_
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "xenia/profiling.h"
|
||||
|
||||
// Will scribble arena memory to hopefully find use before clears.
|
||||
//#define SCRIBBLE_ARENA_ON_RESET
|
||||
// #define SCRIBBLE_ARENA_ON_RESET
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
@ -243,7 +243,7 @@ void HIRBuilder::Dump(StringBuffer* str) {
|
|||
continue;
|
||||
}
|
||||
if (i->opcode == &OPCODE_COMMENT_info) {
|
||||
str->AppendFormat(" ; %s\n", (char*)i->src1.offset);
|
||||
str->AppendFormat(" ; %s\n", reinterpret_cast<char*>(i->src1.offset));
|
||||
i = i->next;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_HIR_BUILDER_H_
|
||||
#define XENIA_HIR_HIR_BUILDER_H_
|
||||
#ifndef XENIA_CPU_HIR_HIR_BUILDER_H_
|
||||
#define XENIA_CPU_HIR_HIR_BUILDER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -272,4 +272,4 @@ class HIRBuilder {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_HIR_BUILDER_H_
|
||||
#endif // XENIA_CPU_HIR_HIR_BUILDER_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_INSTR_H_
|
||||
#define XENIA_HIR_INSTR_H_
|
||||
#ifndef XENIA_CPU_HIR_INSTR_H_
|
||||
#define XENIA_CPU_HIR_INSTR_H_
|
||||
|
||||
#include "xenia/cpu/hir/opcodes.h"
|
||||
#include "xenia/cpu/hir/value.h"
|
||||
|
@ -65,4 +65,4 @@ class Instr {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_INSTR_H_
|
||||
#endif // XENIA_CPU_HIR_INSTR_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_LABEL_H_
|
||||
#define XENIA_HIR_LABEL_H_
|
||||
#ifndef XENIA_CPU_HIR_LABEL_H_
|
||||
#define XENIA_CPU_HIR_LABEL_H_
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
@ -32,4 +32,4 @@ class Label {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_LABEL_H_
|
||||
#endif // XENIA_CPU_HIR_LABEL_H_
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "xenia/cpu/hir/opcodes.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace hir {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_OPCODES_H_
|
||||
#define XENIA_HIR_OPCODES_H_
|
||||
#ifndef XENIA_CPU_HIR_OPCODES_H_
|
||||
#define XENIA_CPU_HIR_OPCODES_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -20,10 +20,12 @@ enum CallFlags {
|
|||
CALL_TAIL = (1 << 1),
|
||||
CALL_POSSIBLE_RETURN = (1 << 2),
|
||||
};
|
||||
|
||||
enum BranchFlags {
|
||||
BRANCH_LIKELY = (1 << 1),
|
||||
BRANCH_UNLIKELY = (1 << 2),
|
||||
};
|
||||
|
||||
enum RoundMode {
|
||||
// to zero/nearest/etc
|
||||
ROUND_TO_ZERO = 0,
|
||||
|
@ -31,31 +33,45 @@ enum RoundMode {
|
|||
ROUND_TO_MINUS_INFINITY,
|
||||
ROUND_TO_POSITIVE_INFINITY,
|
||||
};
|
||||
|
||||
enum LoadStoreFlags {
|
||||
LOAD_STORE_BYTE_SWAP = 1 << 0,
|
||||
};
|
||||
|
||||
enum PrefetchFlags {
|
||||
PREFETCH_LOAD = (1 << 1),
|
||||
PREFETCH_STORE = (1 << 2),
|
||||
};
|
||||
|
||||
enum ArithmeticFlags {
|
||||
ARITHMETIC_UNSIGNED = (1 << 2),
|
||||
ARITHMETIC_SATURATE = (1 << 3),
|
||||
};
|
||||
#define PERMUTE_MASK(sel_x, x, sel_y, y, sel_z, z, sel_w, w) \
|
||||
((((x)&0x3) << 0) | (sel_x << 2) | (((y)&0x3) << 8) | (sel_y << 10) | \
|
||||
(((z)&0x3) << 16) | (sel_z << 18) | (((w)&0x3) << 24) | (sel_w << 26))
|
||||
enum Permutes {
|
||||
PERMUTE_IDENTITY = PERMUTE_MASK(0, 0, 0, 1, 0, 2, 0, 3),
|
||||
|
||||
constexpr uint32_t MakePermuteMask(uint32_t sel_x, uint32_t x, uint32_t sel_y,
|
||||
uint32_t y, uint32_t sel_z, uint32_t z,
|
||||
uint32_t sel_w, uint32_t w) {
|
||||
return ((x & 0x3) << 0) | (sel_x << 2) | ((y & 0x3) << 8) | (sel_y << 10) |
|
||||
((z & 0x3) << 16) | (sel_z << 18) | ((w & 0x3) << 24) | (sel_w << 26);
|
||||
}
|
||||
|
||||
enum PermuteMasks : uint32_t {
|
||||
kIdentityPermuteMask = MakePermuteMask(0, 0, 0, 1, 0, 2, 0, 3),
|
||||
};
|
||||
#define SWIZZLE_MASK(x, y, z, w) \
|
||||
((((x)&0x3) << 0) | (((y)&0x3) << 2) | (((z)&0x3) << 4) | (((w)&0x3) << 6))
|
||||
|
||||
constexpr uint32_t MakeSwizzleMask(uint32_t x, uint32_t y, uint32_t z,
|
||||
uint32_t w) {
|
||||
return ((x & 0x3) << 0) | ((y & 0x3) << 2) | ((z & 0x3) << 4) |
|
||||
((w & 0x3) << 6);
|
||||
}
|
||||
|
||||
enum Swizzles {
|
||||
SWIZZLE_XYZW_TO_XYZW = SWIZZLE_MASK(0, 1, 2, 3),
|
||||
SWIZZLE_XYZW_TO_YZWX = SWIZZLE_MASK(1, 2, 3, 0),
|
||||
SWIZZLE_XYZW_TO_ZWXY = SWIZZLE_MASK(2, 3, 0, 1),
|
||||
SWIZZLE_XYZW_TO_WXYZ = SWIZZLE_MASK(3, 0, 1, 2),
|
||||
SWIZZLE_XYZW_TO_XYZW = MakeSwizzleMask(0, 1, 2, 3),
|
||||
SWIZZLE_XYZW_TO_YZWX = MakeSwizzleMask(1, 2, 3, 0),
|
||||
SWIZZLE_XYZW_TO_ZWXY = MakeSwizzleMask(2, 3, 0, 1),
|
||||
SWIZZLE_XYZW_TO_WXYZ = MakeSwizzleMask(3, 0, 1, 2),
|
||||
};
|
||||
|
||||
enum PackType : uint16_t {
|
||||
// Special types:
|
||||
PACK_TYPE_D3DCOLOR = 0,
|
||||
|
@ -82,6 +98,7 @@ enum PackType : uint16_t {
|
|||
PACK_TYPE_OUT_UNSATURATE = 0 << 15,
|
||||
PACK_TYPE_OUT_SATURATE = 1 << 15,
|
||||
};
|
||||
|
||||
inline bool IsPackToHi(uint32_t flags) {
|
||||
return (flags & PACK_TYPE_TO_HI) == PACK_TYPE_TO_HI;
|
||||
}
|
||||
|
@ -284,4 +301,4 @@ typedef struct {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_OPCODES_H_
|
||||
#endif // XENIA_CPU_HIR_OPCODES_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HIR_VALUE_H_
|
||||
#define XENIA_HIR_VALUE_H_
|
||||
#ifndef XENIA_CPU_HIR_VALUE_H_
|
||||
#define XENIA_CPU_HIR_VALUE_H_
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/base/assert.h"
|
||||
|
@ -105,14 +105,6 @@ class Value {
|
|||
Use* AddUse(Arena* arena, Instr* instr);
|
||||
void RemoveUse(Use* use);
|
||||
|
||||
int8_t get_constant(int8_t) const { return constant.i8; }
|
||||
int16_t get_constant(int16_t) const { return constant.i16; }
|
||||
int32_t get_constant(int32_t) const { return constant.i32; }
|
||||
int64_t get_constant(int64_t) const { return constant.i64; }
|
||||
float get_constant(float) const { return constant.f32; }
|
||||
double get_constant(double) const { return constant.f64; }
|
||||
vec128_t get_constant(vec128_t&) const { return constant.v128; }
|
||||
|
||||
void set_zero(TypeName new_type) {
|
||||
type = new_type;
|
||||
flags |= VALUE_IS_CONSTANT;
|
||||
|
@ -511,4 +503,4 @@ class Value {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HIR_VALUE_H_
|
||||
#endif // XENIA_CPU_HIR_VALUE_H_
|
||||
|
|
|
@ -17,7 +17,7 @@ using xe::cpu::frontend::PPCContext;
|
|||
|
||||
TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
|
||||
{
|
||||
uint32_t mask = PERMUTE_MASK(0, 0, 0, 1, 0, 2, 0, 3);
|
||||
uint32_t mask = MakePermuteMask(0, 0, 0, 1, 0, 2, 0, 3);
|
||||
TestFunction([mask](HIRBuilder& b) {
|
||||
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
|
||||
LoadVR(b, 5), INT32_TYPE));
|
||||
|
@ -34,7 +34,7 @@ TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
|
|||
});
|
||||
}
|
||||
{
|
||||
uint32_t mask = PERMUTE_MASK(1, 0, 1, 1, 1, 2, 1, 3);
|
||||
uint32_t mask = MakePermuteMask(1, 0, 1, 1, 1, 2, 1, 3);
|
||||
TestFunction([mask](HIRBuilder& b) {
|
||||
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
|
||||
LoadVR(b, 5), INT32_TYPE));
|
||||
|
@ -51,7 +51,7 @@ TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
|
|||
});
|
||||
}
|
||||
{
|
||||
uint32_t mask = PERMUTE_MASK(0, 3, 0, 2, 0, 1, 0, 0);
|
||||
uint32_t mask = MakePermuteMask(0, 3, 0, 2, 0, 1, 0, 0);
|
||||
TestFunction([mask](HIRBuilder& b) {
|
||||
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
|
||||
LoadVR(b, 5), INT32_TYPE));
|
||||
|
@ -68,7 +68,7 @@ TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
|
|||
});
|
||||
}
|
||||
{
|
||||
uint32_t mask = PERMUTE_MASK(1, 3, 1, 2, 1, 1, 1, 0);
|
||||
uint32_t mask = MakePermuteMask(1, 3, 1, 2, 1, 1, 1, 0);
|
||||
TestFunction([mask](HIRBuilder& b) {
|
||||
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
|
||||
LoadVR(b, 5), INT32_TYPE));
|
||||
|
|
|
@ -18,7 +18,7 @@ using xe::cpu::frontend::PPCContext;
|
|||
TEST_CASE("SWIZZLE_V128", "[instr]") {
|
||||
TestFunction([](HIRBuilder& b) {
|
||||
StoreVR(b, 3,
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(0, 1, 2, 3)));
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, MakeSwizzleMask(0, 1, 2, 3)));
|
||||
b.Return();
|
||||
})
|
||||
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
|
||||
|
@ -28,7 +28,7 @@ TEST_CASE("SWIZZLE_V128", "[instr]") {
|
|||
});
|
||||
TestFunction([](HIRBuilder& b) {
|
||||
StoreVR(b, 3,
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(3, 2, 1, 0)));
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, MakeSwizzleMask(3, 2, 1, 0)));
|
||||
b.Return();
|
||||
})
|
||||
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
|
||||
|
@ -38,7 +38,7 @@ TEST_CASE("SWIZZLE_V128", "[instr]") {
|
|||
});
|
||||
TestFunction([](HIRBuilder& b) {
|
||||
StoreVR(b, 3,
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(1, 1, 2, 2)));
|
||||
b.Swizzle(LoadVR(b, 4), INT32_TYPE, MakeSwizzleMask(1, 1, 2, 2)));
|
||||
b.Return();
|
||||
})
|
||||
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_TESTING_UTIL_H_
|
||||
#define XENIA_TESTING_UTIL_H_
|
||||
#ifndef XENIA_CPU_TESTING_UTIL_H_
|
||||
#define XENIA_CPU_TESTING_UTIL_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
|
@ -114,4 +116,4 @@ inline void StoreVR(hir::HIRBuilder& b, int reg, hir::Value* value) {
|
|||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_TESTING_UTIL_H_
|
||||
#endif // XENIA_CPU_TESTING_UTIL_H_
|
||||
|
|
|
@ -56,7 +56,8 @@ bool XexModule::GetOptHeader(const xex2_header* header, xe_xex2_header_keys key,
|
|||
} break;
|
||||
case 0x01: {
|
||||
// Pointer to the value on the optional header.
|
||||
*out_ptr = (void*)&opt_header.value;
|
||||
*out_ptr = const_cast<void*>(
|
||||
reinterpret_cast<const void*>(&opt_header.value));
|
||||
} break;
|
||||
default: {
|
||||
// Pointer to the header.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace xe {
|
||||
namespace debug {
|
||||
|
||||
using namespace xe::debug::proto;
|
||||
using namespace xe::debug::proto; // NOLINT(build/namespaces)
|
||||
|
||||
constexpr size_t kReceiveBufferSize = 1 * 1024 * 1024;
|
||||
constexpr size_t kTransmitBufferSize = 1 * 1024 * 1024;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/socket.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
|
|
@ -24,8 +24,11 @@ DEFINE_int32(debug_server_port, 9002, "Debugger XDP server TCP port.");
|
|||
namespace xe {
|
||||
namespace debug {
|
||||
|
||||
using namespace xe::debug::proto;
|
||||
using namespace xe::kernel;
|
||||
using namespace xe::debug::proto; // NOLINT(build/namespaces)
|
||||
|
||||
using xe::kernel::XModule;
|
||||
using xe::kernel::XObject;
|
||||
using xe::kernel::XThread;
|
||||
|
||||
constexpr size_t kReceiveBufferSize = 32 * 1024;
|
||||
constexpr size_t kReadBufferSize = 1 * 1024 * 1024;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/socket.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
@ -31,7 +33,7 @@ class Debugger;
|
|||
|
||||
class DebugServer {
|
||||
public:
|
||||
DebugServer(Debugger* debugger);
|
||||
explicit DebugServer(Debugger* debugger);
|
||||
~DebugServer();
|
||||
|
||||
Debugger* debugger() const { return debugger_; }
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <gflags/gflags.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
@ -44,9 +45,9 @@ DEFINE_bool(exit_with_debugger, true, "Exit whe the debugger disconnects.");
|
|||
namespace xe {
|
||||
namespace debug {
|
||||
|
||||
using namespace xe::kernel;
|
||||
|
||||
using xe::cpu::ThreadState;
|
||||
using xe::kernel::XObject;
|
||||
using xe::kernel::XThread;
|
||||
|
||||
Breakpoint::Breakpoint(Type type, uint32_t address)
|
||||
: type_(type), address_(address) {}
|
||||
|
@ -235,10 +236,10 @@ int Debugger::RemoveBreakpoint(Breakpoint* breakpoint) {
|
|||
}
|
||||
|
||||
void Debugger::FindBreakpoints(uint32_t address,
|
||||
std::vector<Breakpoint*>& out_breakpoints) {
|
||||
std::vector<Breakpoint*>* out_breakpoints) {
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
|
||||
out_breakpoints.clear();
|
||||
out_breakpoints->clear();
|
||||
|
||||
auto range = breakpoints_.equal_range(address);
|
||||
if (range.first == range.second) {
|
||||
|
@ -247,7 +248,7 @@ void Debugger::FindBreakpoints(uint32_t address,
|
|||
|
||||
for (auto it = range.first; it != range.second; ++it) {
|
||||
Breakpoint* breakpoint = it->second;
|
||||
out_breakpoints.push_back(breakpoint);
|
||||
out_breakpoints->push_back(breakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ enum class ExecutionState {
|
|||
|
||||
class Debugger {
|
||||
public:
|
||||
Debugger(Emulator* emulator);
|
||||
explicit Debugger(Emulator* emulator);
|
||||
~Debugger();
|
||||
|
||||
Emulator* emulator() const { return emulator_; }
|
||||
|
@ -69,7 +69,7 @@ class Debugger {
|
|||
int AddBreakpoint(Breakpoint* breakpoint);
|
||||
int RemoveBreakpoint(Breakpoint* breakpoint);
|
||||
void FindBreakpoints(uint32_t address,
|
||||
std::vector<Breakpoint*>& out_breakpoints);
|
||||
std::vector<Breakpoint*>* out_breakpoints);
|
||||
|
||||
// TODO(benvanik): utility functions for modification (make function ignored,
|
||||
// etc).
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace proto {
|
|||
|
||||
class PacketReader {
|
||||
public:
|
||||
PacketReader(size_t buffer_capacity) : buffer_(buffer_capacity) {}
|
||||
explicit PacketReader(size_t buffer_capacity) : buffer_(buffer_capacity) {}
|
||||
|
||||
const uint8_t* buffer() { return buffer_.data(); }
|
||||
size_t buffer_capacity() const { return buffer_.size(); }
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace proto {
|
|||
|
||||
class PacketWriter {
|
||||
public:
|
||||
PacketWriter(size_t buffer_capacity) : buffer_(buffer_capacity) {}
|
||||
explicit PacketWriter(size_t buffer_capacity) : buffer_(buffer_capacity) {}
|
||||
|
||||
uint8_t* buffer() { return buffer_.data(); }
|
||||
size_t buffer_capacity() const { return buffer_.size(); }
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace proto {
|
|||
|
||||
struct varint_t {
|
||||
varint_t() = default;
|
||||
varint_t(uint64_t value) : value_(value) {}
|
||||
varint_t(uint64_t value) : value_(value) {} // NOLINT(runtime/explicit)
|
||||
varint_t(const varint_t& other) : value_(other.value_) {}
|
||||
|
||||
operator uint64_t() const { return value_; }
|
||||
|
|
|
@ -42,9 +42,9 @@ bool MainWindow::Initialize() {
|
|||
|
||||
window_->on_closed.AddListener(std::bind(&MainWindow::OnClose, this));
|
||||
|
||||
window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) {
|
||||
window_->on_key_down.AddListener([this](xe::ui::KeyEvent* e) {
|
||||
bool handled = true;
|
||||
switch (e.key_code()) {
|
||||
switch (e->key_code()) {
|
||||
case 0x1B: { // VK_ESCAPE
|
||||
// Allow users to escape fullscreen (but not enter it).
|
||||
if (window_->is_fullscreen()) {
|
||||
|
@ -58,7 +58,7 @@ bool MainWindow::Initialize() {
|
|||
|
||||
default: { handled = false; } break;
|
||||
}
|
||||
e.set_handled(handled);
|
||||
e->set_handled(handled);
|
||||
});
|
||||
|
||||
// Main menu.
|
||||
|
@ -93,7 +93,7 @@ bool MainWindow::Initialize() {
|
|||
}
|
||||
|
||||
void MainWindow::BuildUI() {
|
||||
using namespace el::dsl;
|
||||
using namespace el::dsl; // NOLINT(build/namespaces)
|
||||
el::AnimationBlocker animation_blocker;
|
||||
|
||||
auto root_element = window_->root_element();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ui {
|
|||
|
||||
class MainWindow {
|
||||
public:
|
||||
MainWindow(Application* app);
|
||||
explicit MainWindow(Application* app);
|
||||
~MainWindow();
|
||||
|
||||
Application* app() const { return app_; }
|
||||
|
|
|
@ -24,7 +24,7 @@ class System;
|
|||
|
||||
class Module {
|
||||
public:
|
||||
Module(System* system) : system_(system) {}
|
||||
explicit Module(System* system) : system_(system) {}
|
||||
|
||||
bool is_dead() const { return is_dead_; }
|
||||
void set_dead(bool is_dead) { is_dead_ = is_dead; }
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace debug {
|
|||
namespace ui {
|
||||
namespace model {
|
||||
|
||||
using namespace xe::debug::proto;
|
||||
using namespace xe::debug::proto; // NOLINT(build/namespaces)
|
||||
|
||||
System::System(xe::ui::Loop* loop, DebugClient* client)
|
||||
: loop_(loop), client_(client) {
|
||||
|
|
|
@ -36,7 +36,7 @@ class View {
|
|||
virtual void Setup(xe::debug::DebugClient* client) = 0;
|
||||
|
||||
protected:
|
||||
View(std::string name) : name_(name) {}
|
||||
explicit View(std::string name) : name_(name) {}
|
||||
|
||||
std::string name_;
|
||||
el::LayoutBox root_element_;
|
||||
|
|
|
@ -22,7 +22,7 @@ CpuView::CpuView() : View("CPU") {}
|
|||
CpuView::~CpuView() = default;
|
||||
|
||||
el::Element* CpuView::BuildUI() {
|
||||
using namespace el::dsl;
|
||||
using namespace el::dsl; // NOLINT(build/namespaces)
|
||||
el::AnimationBlocker animation_blocker;
|
||||
|
||||
auto functions_node =
|
||||
|
@ -197,7 +197,7 @@ void CpuView::UpdateModuleList() {
|
|||
module_items->push_back(std::move(item));
|
||||
}
|
||||
if (is_first) {
|
||||
module_dropdown->set_value(int(module_items->size() - 1));
|
||||
module_dropdown->set_value(static_cast<int>(module_items->size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ void CpuView::UpdateThreadList() {
|
|||
thread_items->push_back(std::move(item));
|
||||
}
|
||||
if (is_first) {
|
||||
thread_dropdown->set_value(int(thread_items->size() - 1));
|
||||
thread_dropdown->set_value(static_cast<int>(thread_items->size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ GpuView::GpuView() : View("GPU") {}
|
|||
GpuView::~GpuView() = default;
|
||||
|
||||
el::Element* GpuView::BuildUI() {
|
||||
using namespace el::dsl;
|
||||
using namespace el::dsl; // NOLINT(build/namespaces)
|
||||
el::AnimationBlocker animation_blocker;
|
||||
|
||||
auto node = LabelNode("TODO");
|
||||
|
|
|
@ -483,7 +483,8 @@ void CommandProcessor::EnableReadPointerWriteBack(uint32_t ptr,
|
|||
// CP_RB_CNTL Ring Buffer Control 0x704
|
||||
// block_size = RB_BLKSZ, number of quadwords read between updates of the
|
||||
// read pointer.
|
||||
read_ptr_update_freq_ = (uint32_t)pow(2.0, (double)block_size) / 4;
|
||||
read_ptr_update_freq_ =
|
||||
static_cast<uint32_t>(pow(2.0, static_cast<double>(block_size)) / 4);
|
||||
}
|
||||
|
||||
void CommandProcessor::UpdateWritePointer(uint32_t value) {
|
||||
|
@ -1595,22 +1596,22 @@ bool CommandProcessor::IssueDraw() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CommandProcessor::SetShadowRegister(uint32_t& dest,
|
||||
bool CommandProcessor::SetShadowRegister(uint32_t* dest,
|
||||
uint32_t register_name) {
|
||||
uint32_t value = register_file_->values[register_name].u32;
|
||||
if (dest == value) {
|
||||
if (*dest == value) {
|
||||
return false;
|
||||
}
|
||||
dest = value;
|
||||
*dest = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandProcessor::SetShadowRegister(float& dest, uint32_t register_name) {
|
||||
bool CommandProcessor::SetShadowRegister(float* dest, uint32_t register_name) {
|
||||
float value = register_file_->values[register_name].f32;
|
||||
if (dest == value) {
|
||||
if (*dest == value) {
|
||||
return false;
|
||||
}
|
||||
dest = value;
|
||||
*dest = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1628,9 +1629,9 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateShaders(
|
|||
register_file_->values[XE_GPU_REG_SQ_PS_CONST].u32 == 0x00000000);
|
||||
|
||||
bool dirty = false;
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_su_sc_mode_cntl, XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(regs.sq_program_cntl, XE_GPU_REG_SQ_PROGRAM_CNTL);
|
||||
dirty |= SetShadowRegister(®s.pa_su_sc_mode_cntl,
|
||||
XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(®s.sq_program_cntl, XE_GPU_REG_SQ_PROGRAM_CNTL);
|
||||
dirty |= regs.vertex_shader != active_vertex_shader_;
|
||||
dirty |= regs.pixel_shader != active_pixel_shader_;
|
||||
dirty |= regs.prim_type != prim_type;
|
||||
|
@ -1769,17 +1770,17 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRenderTargets() {
|
|||
auto& regs = update_render_targets_regs_;
|
||||
|
||||
bool dirty = false;
|
||||
dirty |= SetShadowRegister(regs.rb_modecontrol, XE_GPU_REG_RB_MODECONTROL);
|
||||
dirty |= SetShadowRegister(regs.rb_surface_info, XE_GPU_REG_RB_SURFACE_INFO);
|
||||
dirty |= SetShadowRegister(regs.rb_color_info, XE_GPU_REG_RB_COLOR_INFO);
|
||||
dirty |= SetShadowRegister(regs.rb_color1_info, XE_GPU_REG_RB_COLOR1_INFO);
|
||||
dirty |= SetShadowRegister(regs.rb_color2_info, XE_GPU_REG_RB_COLOR2_INFO);
|
||||
dirty |= SetShadowRegister(regs.rb_color3_info, XE_GPU_REG_RB_COLOR3_INFO);
|
||||
dirty |= SetShadowRegister(regs.rb_color_mask, XE_GPU_REG_RB_COLOR_MASK);
|
||||
dirty |= SetShadowRegister(regs.rb_depthcontrol, XE_GPU_REG_RB_DEPTHCONTROL);
|
||||
dirty |= SetShadowRegister(®s.rb_modecontrol, XE_GPU_REG_RB_MODECONTROL);
|
||||
dirty |= SetShadowRegister(®s.rb_surface_info, XE_GPU_REG_RB_SURFACE_INFO);
|
||||
dirty |= SetShadowRegister(®s.rb_color_info, XE_GPU_REG_RB_COLOR_INFO);
|
||||
dirty |= SetShadowRegister(®s.rb_color1_info, XE_GPU_REG_RB_COLOR1_INFO);
|
||||
dirty |= SetShadowRegister(®s.rb_color2_info, XE_GPU_REG_RB_COLOR2_INFO);
|
||||
dirty |= SetShadowRegister(®s.rb_color3_info, XE_GPU_REG_RB_COLOR3_INFO);
|
||||
dirty |= SetShadowRegister(®s.rb_color_mask, XE_GPU_REG_RB_COLOR_MASK);
|
||||
dirty |= SetShadowRegister(®s.rb_depthcontrol, XE_GPU_REG_RB_DEPTHCONTROL);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_stencilrefmask, XE_GPU_REG_RB_STENCILREFMASK);
|
||||
dirty |= SetShadowRegister(regs.rb_depth_info, XE_GPU_REG_RB_DEPTH_INFO);
|
||||
SetShadowRegister(®s.rb_stencilrefmask, XE_GPU_REG_RB_STENCILREFMASK);
|
||||
dirty |= SetShadowRegister(®s.rb_depth_info, XE_GPU_REG_RB_DEPTH_INFO);
|
||||
if (!dirty) {
|
||||
return UpdateStatus::kCompatible;
|
||||
}
|
||||
|
@ -1893,30 +1894,30 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState() {
|
|||
auto& regs = update_viewport_state_regs_;
|
||||
|
||||
bool dirty = false;
|
||||
// dirty |= SetShadowRegister(state_regs.pa_cl_clip_cntl,
|
||||
// dirty |= SetShadowRegister(&state_regs.pa_cl_clip_cntl,
|
||||
// XE_GPU_REG_PA_CL_CLIP_CNTL);
|
||||
dirty |= SetShadowRegister(regs.rb_surface_info, XE_GPU_REG_RB_SURFACE_INFO);
|
||||
dirty |= SetShadowRegister(regs.pa_cl_vte_cntl, XE_GPU_REG_PA_CL_VTE_CNTL);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_su_sc_mode_cntl, XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(regs.pa_sc_window_offset,
|
||||
dirty |= SetShadowRegister(®s.rb_surface_info, XE_GPU_REG_RB_SURFACE_INFO);
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vte_cntl, XE_GPU_REG_PA_CL_VTE_CNTL);
|
||||
dirty |= SetShadowRegister(®s.pa_su_sc_mode_cntl,
|
||||
XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(®s.pa_sc_window_offset,
|
||||
XE_GPU_REG_PA_SC_WINDOW_OFFSET);
|
||||
dirty |= SetShadowRegister(regs.pa_sc_window_scissor_tl,
|
||||
dirty |= SetShadowRegister(®s.pa_sc_window_scissor_tl,
|
||||
XE_GPU_REG_PA_SC_WINDOW_SCISSOR_TL);
|
||||
dirty |= SetShadowRegister(regs.pa_sc_window_scissor_br,
|
||||
dirty |= SetShadowRegister(®s.pa_sc_window_scissor_br,
|
||||
XE_GPU_REG_PA_SC_WINDOW_SCISSOR_BR);
|
||||
dirty |= SetShadowRegister(regs.pa_cl_vport_xoffset,
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_xoffset,
|
||||
XE_GPU_REG_PA_CL_VPORT_XOFFSET);
|
||||
dirty |= SetShadowRegister(regs.pa_cl_vport_yoffset,
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_yoffset,
|
||||
XE_GPU_REG_PA_CL_VPORT_YOFFSET);
|
||||
dirty |= SetShadowRegister(regs.pa_cl_vport_zoffset,
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_zoffset,
|
||||
XE_GPU_REG_PA_CL_VPORT_ZOFFSET);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_cl_vport_xscale, XE_GPU_REG_PA_CL_VPORT_XSCALE);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_cl_vport_yscale, XE_GPU_REG_PA_CL_VPORT_YSCALE);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_cl_vport_zscale, XE_GPU_REG_PA_CL_VPORT_ZSCALE);
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_xscale,
|
||||
XE_GPU_REG_PA_CL_VPORT_XSCALE);
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_yscale,
|
||||
XE_GPU_REG_PA_CL_VPORT_YSCALE);
|
||||
dirty |= SetShadowRegister(®s.pa_cl_vport_zscale,
|
||||
XE_GPU_REG_PA_CL_VPORT_ZSCALE);
|
||||
|
||||
// Much of this state machine is extracted from:
|
||||
// https://github.com/freedreno/mesa/blob/master/src/mesa/drivers/dri/r200/r200_state.c
|
||||
|
@ -2051,13 +2052,13 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRasterizerState() {
|
|||
auto& regs = update_rasterizer_state_regs_;
|
||||
|
||||
bool dirty = false;
|
||||
dirty |=
|
||||
SetShadowRegister(regs.pa_su_sc_mode_cntl, XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(regs.pa_sc_screen_scissor_tl,
|
||||
dirty |= SetShadowRegister(®s.pa_su_sc_mode_cntl,
|
||||
XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(®s.pa_sc_screen_scissor_tl,
|
||||
XE_GPU_REG_PA_SC_SCREEN_SCISSOR_TL);
|
||||
dirty |= SetShadowRegister(regs.pa_sc_screen_scissor_br,
|
||||
dirty |= SetShadowRegister(®s.pa_sc_screen_scissor_br,
|
||||
XE_GPU_REG_PA_SC_SCREEN_SCISSOR_BR);
|
||||
dirty |= SetShadowRegister(regs.multi_prim_ib_reset_index,
|
||||
dirty |= SetShadowRegister(®s.multi_prim_ib_reset_index,
|
||||
XE_GPU_REG_VGT_MULTI_PRIM_IB_RESET_INDX);
|
||||
if (!dirty) {
|
||||
return UpdateStatus::kCompatible;
|
||||
|
@ -2149,17 +2150,17 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateBlendState() {
|
|||
|
||||
bool dirty = false;
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_blendcontrol[0], XE_GPU_REG_RB_BLENDCONTROL_0);
|
||||
SetShadowRegister(®s.rb_blendcontrol[0], XE_GPU_REG_RB_BLENDCONTROL_0);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_blendcontrol[1], XE_GPU_REG_RB_BLENDCONTROL_1);
|
||||
SetShadowRegister(®s.rb_blendcontrol[1], XE_GPU_REG_RB_BLENDCONTROL_1);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_blendcontrol[2], XE_GPU_REG_RB_BLENDCONTROL_2);
|
||||
SetShadowRegister(®s.rb_blendcontrol[2], XE_GPU_REG_RB_BLENDCONTROL_2);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_blendcontrol[3], XE_GPU_REG_RB_BLENDCONTROL_3);
|
||||
dirty |= SetShadowRegister(regs.rb_blend_rgba[0], XE_GPU_REG_RB_BLEND_RED);
|
||||
dirty |= SetShadowRegister(regs.rb_blend_rgba[1], XE_GPU_REG_RB_BLEND_GREEN);
|
||||
dirty |= SetShadowRegister(regs.rb_blend_rgba[2], XE_GPU_REG_RB_BLEND_BLUE);
|
||||
dirty |= SetShadowRegister(regs.rb_blend_rgba[3], XE_GPU_REG_RB_BLEND_ALPHA);
|
||||
SetShadowRegister(®s.rb_blendcontrol[3], XE_GPU_REG_RB_BLENDCONTROL_3);
|
||||
dirty |= SetShadowRegister(®s.rb_blend_rgba[0], XE_GPU_REG_RB_BLEND_RED);
|
||||
dirty |= SetShadowRegister(®s.rb_blend_rgba[1], XE_GPU_REG_RB_BLEND_GREEN);
|
||||
dirty |= SetShadowRegister(®s.rb_blend_rgba[2], XE_GPU_REG_RB_BLEND_BLUE);
|
||||
dirty |= SetShadowRegister(®s.rb_blend_rgba[3], XE_GPU_REG_RB_BLEND_ALPHA);
|
||||
if (!dirty) {
|
||||
return UpdateStatus::kCompatible;
|
||||
}
|
||||
|
@ -2234,9 +2235,9 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateDepthStencilState() {
|
|||
auto& regs = update_depth_stencil_state_regs_;
|
||||
|
||||
bool dirty = false;
|
||||
dirty |= SetShadowRegister(regs.rb_depthcontrol, XE_GPU_REG_RB_DEPTHCONTROL);
|
||||
dirty |= SetShadowRegister(®s.rb_depthcontrol, XE_GPU_REG_RB_DEPTHCONTROL);
|
||||
dirty |=
|
||||
SetShadowRegister(regs.rb_stencilrefmask, XE_GPU_REG_RB_STENCILREFMASK);
|
||||
SetShadowRegister(®s.rb_stencilrefmask, XE_GPU_REG_RB_STENCILREFMASK);
|
||||
if (!dirty) {
|
||||
return UpdateStatus::kCompatible;
|
||||
}
|
||||
|
@ -2891,7 +2892,8 @@ bool CommandProcessor::IssueCopy() {
|
|||
if (depth_clear_enabled && depth_target != kAnyTarget) {
|
||||
// Clear the current depth buffer.
|
||||
// TODO(benvanik): verify format.
|
||||
GLfloat depth = {(copy_depth_clear & 0xFFFFFF00) / float(0xFFFFFF00)};
|
||||
GLfloat depth = {(copy_depth_clear & 0xFFFFFF00) /
|
||||
static_cast<float>(0xFFFFFF00)};
|
||||
GLint stencil = copy_depth_clear & 0xFF;
|
||||
GLboolean old_depth_mask;
|
||||
GLint old_stencil_mask;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
@ -64,7 +65,7 @@ enum class SwapMode {
|
|||
|
||||
class CommandProcessor {
|
||||
public:
|
||||
CommandProcessor(GL4GraphicsSystem* graphics_system);
|
||||
explicit CommandProcessor(GL4GraphicsSystem* graphics_system);
|
||||
~CommandProcessor();
|
||||
|
||||
uint32_t counter() const { return counter_; }
|
||||
|
@ -299,8 +300,8 @@ class CommandProcessor {
|
|||
xe::ui::gl::CircularBuffer scratch_buffer_;
|
||||
|
||||
private:
|
||||
bool SetShadowRegister(uint32_t& dest, uint32_t register_name);
|
||||
bool SetShadowRegister(float& dest, uint32_t register_name);
|
||||
bool SetShadowRegister(uint32_t* dest, uint32_t register_name);
|
||||
bool SetShadowRegister(float* dest, uint32_t register_name);
|
||||
struct UpdateRenderTargetsRegisters {
|
||||
uint32_t rb_modecontrol;
|
||||
uint32_t rb_surface_info;
|
||||
|
|
|
@ -155,7 +155,7 @@ bool DrawBatcher::BeginDraw() {
|
|||
|
||||
GLsizei header_size = sizeof(CommonHeader);
|
||||
|
||||
// TODO(benvanik); consts sizing.
|
||||
// TODO(benvanik): consts sizing.
|
||||
// GLsizei float_consts_size = sizeof(float4) * 512;
|
||||
// GLsizei bool_consts_size = sizeof(uint32_t) * 8;
|
||||
// GLsizei loop_consts_size = sizeof(uint32_t) * 32;
|
||||
|
@ -286,9 +286,9 @@ bool DrawBatcher::Flush(FlushMode mode) {
|
|||
case PrimitiveType::kRectangleList:
|
||||
prim_type = GL_TRIANGLES;
|
||||
// Rect lists aren't culled. There may be other things they skip too.
|
||||
// assert_true((register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32
|
||||
// &
|
||||
// 0x3) == 0);
|
||||
// assert_true(
|
||||
// (register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32
|
||||
// & 0x3) == 0);
|
||||
break;
|
||||
case PrimitiveType::kQuadList:
|
||||
prim_type = GL_LINES_ADJACENCY;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_GPU_GL4_GL4_STATE_DATA_BUILDER_H_
|
||||
#define XENIA_GPU_GL4_GL4_STATE_DATA_BUILDER_H_
|
||||
#ifndef XENIA_GPU_GL4_DRAW_BATCHER_H_
|
||||
#define XENIA_GPU_GL4_DRAW_BATCHER_H_
|
||||
|
||||
#include "xenia/gpu/gl4/gl4_shader.h"
|
||||
#include "xenia/gpu/register_file.h"
|
||||
|
@ -53,7 +53,7 @@ class DrawBatcher {
|
|||
kReconfigure,
|
||||
};
|
||||
|
||||
DrawBatcher(RegisterFile* register_file);
|
||||
explicit DrawBatcher(RegisterFile* register_file);
|
||||
|
||||
bool Initialize(CircularBuffer* array_data_buffer);
|
||||
void Shutdown();
|
||||
|
@ -72,7 +72,7 @@ class DrawBatcher {
|
|||
}
|
||||
void set_alpha_test(bool enabled, uint32_t func, float ref) {
|
||||
active_draw_.header->alpha_test.x = enabled ? 1.0f : 0.0f;
|
||||
active_draw_.header->alpha_test.y = float(func);
|
||||
active_draw_.header->alpha_test.y = static_cast<float>(func);
|
||||
active_draw_.header->alpha_test.z = ref;
|
||||
}
|
||||
void set_texture_sampler(int index, GLuint64 handle) {
|
||||
|
@ -159,4 +159,4 @@ class DrawBatcher {
|
|||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_GPU_GL4_GL4_STATE_DATA_BUILDER_H_
|
||||
#endif // XENIA_GPU_GL4_DRAW_BATCHER_H_
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "xenia/gpu/gl4/gl4_graphics_system.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "xenia/base/clock.h"
|
||||
|
@ -74,7 +75,7 @@ X_STATUS GL4GraphicsSystem::Setup(cpu::Processor* processor,
|
|||
|
||||
// Watch for paint requests to do our swap.
|
||||
target_window->on_painting.AddListener(
|
||||
[this](xe::ui::UIEvent& e) { Swap(e); });
|
||||
[this](xe::ui::UIEvent* e) { Swap(e); });
|
||||
|
||||
// Create rendering control.
|
||||
// This must happen on the UI thread.
|
||||
|
@ -290,7 +291,7 @@ void GL4GraphicsSystem::MarkVblank() {
|
|||
DispatchInterruptCallback(0, 2);
|
||||
}
|
||||
|
||||
void GL4GraphicsSystem::Swap(xe::ui::UIEvent& e) {
|
||||
void GL4GraphicsSystem::Swap(xe::ui::UIEvent* e) {
|
||||
// Check for pending swap.
|
||||
auto& swap_state = command_processor_->swap_state();
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace gl4 {
|
|||
|
||||
class GL4GraphicsSystem : public GraphicsSystem {
|
||||
public:
|
||||
GL4GraphicsSystem(Emulator* emulator);
|
||||
explicit GL4GraphicsSystem(Emulator* emulator);
|
||||
~GL4GraphicsSystem() override;
|
||||
|
||||
std::unique_ptr<ui::GraphicsContext> CreateContext(
|
||||
|
@ -51,7 +51,7 @@ class GL4GraphicsSystem : public GraphicsSystem {
|
|||
|
||||
private:
|
||||
void MarkVblank();
|
||||
void Swap(xe::ui::UIEvent& e);
|
||||
void Swap(xe::ui::UIEvent* e);
|
||||
uint32_t ReadRegister(uint32_t addr);
|
||||
void WriteRegister(uint32_t addr, uint32_t value);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace xe {
|
|||
namespace gpu {
|
||||
namespace gl4 {
|
||||
|
||||
using namespace xe::gpu::xenos;
|
||||
using xe::gpu::xenos::VertexFormat;
|
||||
|
||||
GL4Shader::GL4Shader(ShaderType shader_type, uint64_t data_hash,
|
||||
const uint32_t* dword_ptr, uint32_t dword_count)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "xenia/gpu/gl4/gl4_shader_translator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
@ -19,7 +21,8 @@ namespace gpu {
|
|||
namespace gl4 {
|
||||
|
||||
using namespace xe::gpu::ucode;
|
||||
using namespace xe::gpu::xenos;
|
||||
|
||||
using xe::gpu::xenos::VertexFormat;
|
||||
|
||||
#define Append(...) output_.AppendFormat(__VA_ARGS__)
|
||||
|
||||
|
@ -68,7 +71,8 @@ void GL4ShaderTranslator::Reset(GL4Shader* shader) {
|
|||
}
|
||||
|
||||
std::string GL4ShaderTranslator::TranslateVertexShader(
|
||||
GL4Shader* vertex_shader, const xe_gpu_program_cntl_t& program_cntl) {
|
||||
GL4Shader* vertex_shader,
|
||||
const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
||||
Reset(vertex_shader);
|
||||
|
||||
// Normal shaders only, for now.
|
||||
|
@ -105,13 +109,13 @@ std::string GL4ShaderTranslator::TranslateVertexShader(
|
|||
|
||||
#if FLOW_CONTROL
|
||||
// Add temporary integer registers for loops that we may use.
|
||||
// Each loop uses an address, counter, and constant
|
||||
// TODO: Implement only for the used loops in the shader
|
||||
// Each loop uses an address, counter, and constant.
|
||||
// TODO(benvanik): Implement only for the used loops in the shader.
|
||||
for (uint32_t n = 0; n < 32; n++) {
|
||||
Append(" int i%d_cnt = 0;\n", n);
|
||||
Append(" int i%d_addr = 0;\n", n);
|
||||
}
|
||||
#endif
|
||||
#endif // FLOW_CONTROL
|
||||
|
||||
Append(" vec4 t;\n");
|
||||
Append(" vec4 pv;\n"); // Previous Vector result.
|
||||
|
@ -127,7 +131,7 @@ std::string GL4ShaderTranslator::TranslateVertexShader(
|
|||
}
|
||||
|
||||
std::string GL4ShaderTranslator::TranslatePixelShader(
|
||||
GL4Shader* pixel_shader, const xe_gpu_program_cntl_t& program_cntl) {
|
||||
GL4Shader* pixel_shader, const xenos::xe_gpu_program_cntl_t& program_cntl) {
|
||||
Reset(pixel_shader);
|
||||
|
||||
// We need an input VS to make decisions here.
|
||||
|
@ -161,7 +165,7 @@ std::string GL4ShaderTranslator::TranslatePixelShader(
|
|||
return output_.to_string();
|
||||
}
|
||||
|
||||
void GL4ShaderTranslator::AppendSrcReg(const instr_alu_t& op, int i) {
|
||||
void GL4ShaderTranslator::AppendSrcReg(const ucode::instr_alu_t& op, int i) {
|
||||
switch (i) {
|
||||
case 1: {
|
||||
int const_slot = 0;
|
||||
|
@ -184,9 +188,10 @@ void GL4ShaderTranslator::AppendSrcReg(const instr_alu_t& op, int i) {
|
|||
}
|
||||
}
|
||||
|
||||
void GL4ShaderTranslator::AppendSrcReg(const instr_alu_t& op, uint32_t num,
|
||||
uint32_t type, uint32_t swiz,
|
||||
uint32_t negate, int const_slot) {
|
||||
void GL4ShaderTranslator::AppendSrcReg(const ucode::instr_alu_t& op,
|
||||
uint32_t num, uint32_t type,
|
||||
uint32_t swiz, uint32_t negate,
|
||||
int const_slot) {
|
||||
if (negate) {
|
||||
Append("-");
|
||||
}
|
||||
|
@ -271,7 +276,7 @@ void GL4ShaderTranslator::PrintSrcReg(uint32_t num, uint32_t type,
|
|||
}
|
||||
}
|
||||
|
||||
void GL4ShaderTranslator::PrintVectorDstReg(const instr_alu_t& alu) {
|
||||
void GL4ShaderTranslator::PrintVectorDstReg(const ucode::instr_alu_t& alu) {
|
||||
Append("%s%u", alu.export_data ? "export" : "R", alu.vector_dest);
|
||||
auto mask = alu.scalar_write_mask;
|
||||
if (mask != 0xf) {
|
||||
|
@ -283,7 +288,7 @@ void GL4ShaderTranslator::PrintVectorDstReg(const instr_alu_t& alu) {
|
|||
}
|
||||
}
|
||||
|
||||
void GL4ShaderTranslator::PrintScalarDstReg(const instr_alu_t& alu) {
|
||||
void GL4ShaderTranslator::PrintScalarDstReg(const ucode::instr_alu_t& alu) {
|
||||
Append("%s%u", alu.export_data ? "export" : "R",
|
||||
alu.export_data ? alu.vector_dest : alu.scalar_dest);
|
||||
auto mask = alu.scalar_write_mask;
|
||||
|
@ -494,7 +499,7 @@ void GL4ShaderTranslator::AppendOpDestRegName(const ucode::instr_alu_t& op,
|
|||
}
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_ADDv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_ADDv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
Append(" + ");
|
||||
|
@ -503,7 +508,7 @@ bool GL4ShaderTranslator::TranslateALU_ADDv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MULv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MULv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
Append(" * ");
|
||||
|
@ -512,7 +517,7 @@ bool GL4ShaderTranslator::TranslateALU_MULv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MAXv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MAXv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
if (alu.src1_reg == alu.src2_reg && alu.src1_sel == alu.src2_sel &&
|
||||
alu.src1_swiz == alu.src2_swiz &&
|
||||
|
@ -530,7 +535,7 @@ bool GL4ShaderTranslator::TranslateALU_MAXv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MINv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MINv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("min(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -541,7 +546,7 @@ bool GL4ShaderTranslator::TranslateALU_MINv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_SETXXv(const instr_alu_t& alu,
|
||||
bool GL4ShaderTranslator::TranslateALU_SETXXv(const ucode::instr_alu_t& alu,
|
||||
const char* op) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("vec4((");
|
||||
|
@ -564,20 +569,20 @@ bool GL4ShaderTranslator::TranslateALU_SETXXv(const instr_alu_t& alu,
|
|||
EndAppendVectorOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETEv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXv(alu, "==");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXv(alu, ">");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTEv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXv(alu, ">=");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETNEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETNEv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXv(alu, "!=");
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_FRACv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_FRACv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("fract(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -586,7 +591,7 @@ bool GL4ShaderTranslator::TranslateALU_FRACv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_TRUNCv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_TRUNCv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("trunc(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -595,7 +600,7 @@ bool GL4ShaderTranslator::TranslateALU_TRUNCv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_FLOORv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_FLOORv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("floor(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -604,7 +609,7 @@ bool GL4ShaderTranslator::TranslateALU_FLOORv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MULADDv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MULADDv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -616,7 +621,7 @@ bool GL4ShaderTranslator::TranslateALU_MULADDv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDXXv(const instr_alu_t& alu,
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDXXv(const ucode::instr_alu_t& alu,
|
||||
const char* op) {
|
||||
BeginAppendVectorOp(alu);
|
||||
// TODO(benvanik): check argument order - could be 3 as compare and 1 and 2 as
|
||||
|
@ -649,17 +654,17 @@ bool GL4ShaderTranslator::TranslateALU_CNDXXv(const instr_alu_t& alu,
|
|||
EndAppendVectorOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDEv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_CNDXXv(alu, "==");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDGTEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDGTEv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_CNDXXv(alu, ">=");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDGTv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_CNDGTv(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_CNDXXv(alu, ">");
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT4v(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT4v(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("dot(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -670,7 +675,7 @@ bool GL4ShaderTranslator::TranslateALU_DOT4v(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT3v(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT3v(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("dot(vec4(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -681,7 +686,7 @@ bool GL4ShaderTranslator::TranslateALU_DOT3v(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT2ADDv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_DOT2ADDv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("dot(vec4(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -694,7 +699,7 @@ bool GL4ShaderTranslator::TranslateALU_DOT2ADDv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_CUBEv(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_CUBEv(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("cube(");
|
||||
AppendVectorOpSrcReg(alu, 1);
|
||||
|
@ -705,7 +710,7 @@ bool GL4ShaderTranslator::TranslateALU_CUBEv(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MAX4v(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MAX4v(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendVectorOp(alu);
|
||||
Append("max(");
|
||||
Append("max(");
|
||||
|
@ -793,7 +798,7 @@ bool GL4ShaderTranslator::TranslateALU_MOVAv(const ucode::instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_ADDs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_ADDs(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
Append(".x + ");
|
||||
|
@ -803,7 +808,8 @@ bool GL4ShaderTranslator::TranslateALU_ADDs(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_PREVs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_PREVs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
AppendSrcReg(alu, 3);
|
||||
Append(".x + ps");
|
||||
|
@ -811,7 +817,7 @@ bool GL4ShaderTranslator::TranslateALU_ADD_PREVs(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MULs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MULs(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
Append(".x * ");
|
||||
|
@ -821,7 +827,8 @@ bool GL4ShaderTranslator::TranslateALU_MULs(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_PREVs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_PREVs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
AppendSrcReg(alu, 3);
|
||||
Append(".x * ps");
|
||||
|
@ -831,7 +838,7 @@ bool GL4ShaderTranslator::TranslateALU_MUL_PREVs(const instr_alu_t& alu) {
|
|||
|
||||
// ...
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MAXs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MAXs(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
if ((alu.src3_swiz & 0x3) == (((alu.src3_swiz >> 2) + 1) & 0x3)) {
|
||||
// This is a mov.
|
||||
|
@ -847,7 +854,7 @@ bool GL4ShaderTranslator::TranslateALU_MAXs(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MINs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MINs(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
Append("min(");
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
|
@ -858,7 +865,7 @@ bool GL4ShaderTranslator::TranslateALU_MINs(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_SETXXs(const instr_alu_t& alu,
|
||||
bool GL4ShaderTranslator::TranslateALU_SETXXs(const ucode::instr_alu_t& alu,
|
||||
const char* op) {
|
||||
BeginAppendScalarOp(alu);
|
||||
Append("(");
|
||||
|
@ -867,16 +874,16 @@ bool GL4ShaderTranslator::TranslateALU_SETXXs(const instr_alu_t& alu,
|
|||
EndAppendScalarOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETEs(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXs(alu, "==");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTs(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXs(alu, ">");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETGTEs(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXs(alu, ">=");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SETNEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SETNEs(const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_SETXXs(alu, "!=");
|
||||
}
|
||||
|
||||
|
@ -907,7 +914,7 @@ bool GL4ShaderTranslator::TranslateALU_FLOORs(const ucode::instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_EXP_IEEE(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_EXP_IEEE(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
Append("pow(2.0, ");
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
|
@ -936,7 +943,8 @@ bool GL4ShaderTranslator::TranslateALU_LOG_IEEE(const ucode::instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_CLAMP(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_CLAMP(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
// if result == -inf result = -flt_max
|
||||
// if result == +inf result = flt_max
|
||||
BeginAppendScalarOp(alu);
|
||||
|
@ -946,7 +954,7 @@ bool GL4ShaderTranslator::TranslateALU_RECIP_CLAMP(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_FF(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_FF(const ucode::instr_alu_t& alu) {
|
||||
// if result == -inf result = -zero
|
||||
// if result == +inf result = zero
|
||||
BeginAppendScalarOp(alu);
|
||||
|
@ -956,7 +964,8 @@ bool GL4ShaderTranslator::TranslateALU_RECIP_FF(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_IEEE(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_RECIP_IEEE(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
Append("1.0 / ");
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
|
@ -1037,7 +1046,7 @@ bool GL4ShaderTranslator::TranslateALU_MOVA_FLOORs(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_SUBs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SUBs(const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
Append(".x - ");
|
||||
|
@ -1056,8 +1065,8 @@ bool GL4ShaderTranslator::TranslateALU_SUB_PREVs(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETXXs(const instr_alu_t& alu,
|
||||
const char* op) {
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETXXs(
|
||||
const ucode::instr_alu_t& alu, const char* op) {
|
||||
Append(" p = ");
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
Append(".x %s 0.0;\n", op);
|
||||
|
@ -1066,16 +1075,20 @@ bool GL4ShaderTranslator::TranslateALU_PRED_SETXXs(const instr_alu_t& alu,
|
|||
EndAppendScalarOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETEs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_PRED_SETXXs(alu, "==");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETNEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETNEs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_PRED_SETXXs(alu, "!=");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETGTs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETGTs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_PRED_SETXXs(alu, ">");
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETGTEs(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_PRED_SETGTEs(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_PRED_SETXXs(alu, ">=");
|
||||
}
|
||||
|
||||
|
@ -1105,7 +1118,8 @@ bool GL4ShaderTranslator::TranslateALU_PRED_SET_POPs(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_SQRT_IEEE(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SQRT_IEEE(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
Append("sqrt(");
|
||||
AppendScalarOpSrcReg(alu, 3);
|
||||
|
@ -1114,7 +1128,8 @@ bool GL4ShaderTranslator::TranslateALU_SQRT_IEEE(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_CONST_0(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_CONST_0(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
uint32_t src3_swiz = alu.src3_swiz & ~0x3C;
|
||||
uint32_t swiz_a = ((src3_swiz >> 6) - 1) & 0x3;
|
||||
|
@ -1130,11 +1145,13 @@ bool GL4ShaderTranslator::TranslateALU_MUL_CONST_0(const instr_alu_t& alu) {
|
|||
EndAppendScalarOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_CONST_1(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_MUL_CONST_1(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_MUL_CONST_0(alu);
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_CONST_0(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_CONST_0(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
uint32_t src3_swiz = alu.src3_swiz & ~0x3C;
|
||||
uint32_t swiz_a = ((src3_swiz >> 6) - 1) & 0x3;
|
||||
|
@ -1150,11 +1167,13 @@ bool GL4ShaderTranslator::TranslateALU_ADD_CONST_0(const instr_alu_t& alu) {
|
|||
EndAppendScalarOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_CONST_1(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_ADD_CONST_1(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
return TranslateALU_ADD_CONST_0(alu);
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_SUB_CONST_0(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SUB_CONST_0(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
BeginAppendScalarOp(alu);
|
||||
uint32_t src3_swiz = alu.src3_swiz & ~0x3C;
|
||||
uint32_t swiz_a = ((src3_swiz >> 6) - 1) & 0x3;
|
||||
|
@ -1170,7 +1189,8 @@ bool GL4ShaderTranslator::TranslateALU_SUB_CONST_0(const instr_alu_t& alu) {
|
|||
EndAppendScalarOp(alu);
|
||||
return true;
|
||||
}
|
||||
bool GL4ShaderTranslator::TranslateALU_SUB_CONST_1(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_SUB_CONST_1(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
// Handled as switch on scalar_opc.
|
||||
return TranslateALU_SUB_CONST_0(alu);
|
||||
}
|
||||
|
@ -1193,7 +1213,8 @@ bool GL4ShaderTranslator::TranslateALU_COS(const ucode::instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU_RETAIN_PREV(const instr_alu_t& alu) {
|
||||
bool GL4ShaderTranslator::TranslateALU_RETAIN_PREV(
|
||||
const ucode::instr_alu_t& alu) {
|
||||
// TODO(benvanik): figure out how this is used.
|
||||
// It seems like vector writes to export regs will use this to write 1's to
|
||||
// components (like w in position).
|
||||
|
@ -1203,7 +1224,7 @@ bool GL4ShaderTranslator::TranslateALU_RETAIN_PREV(const instr_alu_t& alu) {
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef bool (GL4ShaderTranslator::*TranslateFn)(const instr_alu_t& alu);
|
||||
typedef bool (GL4ShaderTranslator::*TranslateFn)(const ucode::instr_alu_t& alu);
|
||||
typedef struct {
|
||||
uint32_t num_srcs;
|
||||
const char* name;
|
||||
|
@ -1214,7 +1235,8 @@ typedef struct {
|
|||
#define ALU_INSTR_IMPL(opc, num_srcs) \
|
||||
{ num_srcs, #opc, &GL4ShaderTranslator::TranslateALU_##opc }
|
||||
|
||||
bool GL4ShaderTranslator::TranslateALU(const instr_alu_t* alu, int sync) {
|
||||
bool GL4ShaderTranslator::TranslateALU(const ucode::instr_alu_t* alu,
|
||||
int sync) {
|
||||
static TranslateInfo vector_alu_instrs[0x20] = {
|
||||
ALU_INSTR_IMPL(ADDv, 2), // 0
|
||||
ALU_INSTR_IMPL(MULv, 2), // 1
|
||||
|
@ -1446,8 +1468,8 @@ bool GL4ShaderTranslator::TranslateBlocks(GL4Shader* shader) {
|
|||
#endif // FLOW_CONTROL
|
||||
|
||||
// Process all execution blocks.
|
||||
instr_cf_t cfa;
|
||||
instr_cf_t cfb;
|
||||
ucode::instr_cf_t cfa;
|
||||
ucode::instr_cf_t cfb;
|
||||
auto data = shader->data();
|
||||
bool needs_break = false;
|
||||
for (uint32_t idx = 0; idx < shader->dword_count(); idx += 3) {
|
||||
|
@ -1496,7 +1518,7 @@ bool GL4ShaderTranslator::TranslateBlocks(GL4Shader* shader) {
|
|||
else if (cfb.opc == LOOP_END) {
|
||||
TranslateLoopEnd(cfb.loop);
|
||||
}
|
||||
#endif
|
||||
#endif // FLOW_CONTROL
|
||||
|
||||
if (cfa.opc == EXEC_END || cfb.opc == EXEC_END) {
|
||||
break;
|
||||
|
@ -1545,7 +1567,7 @@ static const struct {
|
|||
#undef INSTR
|
||||
};
|
||||
|
||||
bool GL4ShaderTranslator::TranslateExec(const instr_cf_exec_t& cf) {
|
||||
bool GL4ShaderTranslator::TranslateExec(const ucode::instr_cf_exec_t& cf) {
|
||||
Append(" // %s ADDR(0x%x) CNT(0x%x)", cf_instructions[cf.opc].name,
|
||||
cf.address, cf.count);
|
||||
if (cf.yeild) {
|
||||
|
@ -1616,7 +1638,8 @@ bool GL4ShaderTranslator::TranslateExec(const instr_cf_exec_t& cf) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
const instr_alu_t* alu = (const instr_alu_t*)(dwords_ + alu_off * 3);
|
||||
const ucode::instr_alu_t* alu =
|
||||
(const ucode::instr_alu_t*)(dwords_ + alu_off * 3);
|
||||
AppendPredPre(cf.is_cond_exec(), cf.pred_condition, alu->pred_select,
|
||||
alu->pred_condition);
|
||||
if (!TranslateALU(alu, sync)) {
|
||||
|
@ -1702,8 +1725,8 @@ bool GL4ShaderTranslator::TranslateLoopEnd(const ucode::instr_cf_loop_t& cf) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateVertexFetch(const instr_fetch_vtx_t* vtx,
|
||||
int sync) {
|
||||
bool GL4ShaderTranslator::TranslateVertexFetch(
|
||||
const ucode::instr_fetch_vtx_t* vtx, int sync) {
|
||||
static const struct {
|
||||
const char* name;
|
||||
} fetch_types[0xff] = {
|
||||
|
@ -1834,8 +1857,8 @@ bool GL4ShaderTranslator::TranslateVertexFetch(const instr_fetch_vtx_t* vtx,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GL4ShaderTranslator::TranslateTextureFetch(const instr_fetch_tex_t* tex,
|
||||
int sync) {
|
||||
bool GL4ShaderTranslator::TranslateTextureFetch(
|
||||
const ucode::instr_fetch_tex_t* tex, int sync) {
|
||||
int src_component_count = 0;
|
||||
const char* sampler_type;
|
||||
switch (tex->dimension) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "xenia/gpu/gl4/texture_cache.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
|
@ -22,7 +23,7 @@ namespace xe {
|
|||
namespace gpu {
|
||||
namespace gl4 {
|
||||
|
||||
using namespace xe::gpu::xenos;
|
||||
using xe::gpu::xenos::Endian;
|
||||
|
||||
struct TextureConfig {
|
||||
TextureFormat texture_format;
|
||||
|
|
|
@ -2201,12 +2201,12 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
|
|||
exit(1);
|
||||
}
|
||||
});
|
||||
window->on_closed.AddListener([&loop](xe::ui::UIEvent& e) {
|
||||
window->on_closed.AddListener([&loop](xe::ui::UIEvent* e) {
|
||||
loop->Quit();
|
||||
XELOGI("User-initiated death!");
|
||||
exit(1);
|
||||
});
|
||||
loop->on_quit.AddListener([&window](xe::ui::UIEvent& e) { window.reset(); });
|
||||
loop->on_quit.AddListener([&window](xe::ui::UIEvent* e) { window.reset(); });
|
||||
window->Resize(1920, 1200);
|
||||
|
||||
X_STATUS result = emulator->Setup(window.get());
|
||||
|
@ -2246,21 +2246,21 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
window->on_key_char.AddListener([graphics_system](xe::ui::KeyEvent& e) {
|
||||
window->on_key_char.AddListener([graphics_system](xe::ui::KeyEvent* e) {
|
||||
auto& io = ImGui::GetIO();
|
||||
if (e.key_code() > 0 && e.key_code() < 0x10000) {
|
||||
if (e.key_code() == 0x74 /* VK_F5 */) {
|
||||
if (e->key_code() > 0 && e->key_code() < 0x10000) {
|
||||
if (e->key_code() == 0x74 /* VK_F5 */) {
|
||||
graphics_system->ClearCaches();
|
||||
} else {
|
||||
io.AddInputCharacter(e.key_code());
|
||||
io.AddInputCharacter(e->key_code());
|
||||
}
|
||||
}
|
||||
e.set_handled(true);
|
||||
e->set_handled(true);
|
||||
});
|
||||
window->on_mouse_down.AddListener([](xe::ui::MouseEvent& e) {
|
||||
window->on_mouse_down.AddListener([](xe::ui::MouseEvent* e) {
|
||||
auto& io = ImGui::GetIO();
|
||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||
switch (e.button()) {
|
||||
io.MousePos = ImVec2(float(e->x()), float(e->y()));
|
||||
switch (e->button()) {
|
||||
case xe::ui::MouseEvent::Button::kLeft:
|
||||
io.MouseDown[0] = true;
|
||||
break;
|
||||
|
@ -2269,14 +2269,14 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
|
|||
break;
|
||||
}
|
||||
});
|
||||
window->on_mouse_move.AddListener([](xe::ui::MouseEvent& e) {
|
||||
window->on_mouse_move.AddListener([](xe::ui::MouseEvent* e) {
|
||||
auto& io = ImGui::GetIO();
|
||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||
io.MousePos = ImVec2(float(e->x()), float(e->y()));
|
||||
});
|
||||
window->on_mouse_up.AddListener([](xe::ui::MouseEvent& e) {
|
||||
window->on_mouse_up.AddListener([](xe::ui::MouseEvent* e) {
|
||||
auto& io = ImGui::GetIO();
|
||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||
switch (e.button()) {
|
||||
io.MousePos = ImVec2(float(e->x()), float(e->y()));
|
||||
switch (e->button()) {
|
||||
case xe::ui::MouseEvent::Button::kLeft:
|
||||
io.MouseDown[0] = false;
|
||||
break;
|
||||
|
@ -2285,13 +2285,13 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
|
|||
break;
|
||||
}
|
||||
});
|
||||
window->on_mouse_wheel.AddListener([](xe::ui::MouseEvent& e) {
|
||||
window->on_mouse_wheel.AddListener([](xe::ui::MouseEvent* e) {
|
||||
auto& io = ImGui::GetIO();
|
||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||
io.MouseWheel += float(e.dy() / 120.0f);
|
||||
io.MousePos = ImVec2(float(e->x()), float(e->y()));
|
||||
io.MouseWheel += float(e->dy() / 120.0f);
|
||||
});
|
||||
|
||||
window->on_painting.AddListener([&](xe::ui::UIEvent& e) {
|
||||
window->on_painting.AddListener([&](xe::ui::UIEvent* e) {
|
||||
static bool imgui_setup = false;
|
||||
if (!imgui_setup) {
|
||||
ImImpl_Setup();
|
||||
|
@ -2305,7 +2305,7 @@ int trace_viewer_main(const std::vector<std::wstring>& args) {
|
|||
last_ticks = current_ticks;
|
||||
|
||||
io.DisplaySize =
|
||||
ImVec2(float(e.target()->width()), float(e.target()->height()));
|
||||
ImVec2(float(e->target()->width()), float(e->target()->height()));
|
||||
|
||||
BYTE keystate[256];
|
||||
GetKeyboardState(keystate);
|
||||
|
|
|
@ -62,7 +62,7 @@ class GraphicsSystem {
|
|||
virtual void ClearCaches() {}
|
||||
|
||||
protected:
|
||||
GraphicsSystem(Emulator* emulator);
|
||||
explicit GraphicsSystem(Emulator* emulator);
|
||||
|
||||
Emulator* emulator_ = nullptr;
|
||||
Memory* memory_ = nullptr;
|
||||
|
|
|
@ -31,7 +31,7 @@ const RegisterInfo* RegisterFile::GetRegisterInfo(uint32_t index) {
|
|||
#undef XE_GPU_REGISTER
|
||||
default:
|
||||
return nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gpu
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
#include "xenia/gpu/texture_info.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "third_party/xxhash/xxhash.h"
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -82,7 +82,7 @@ struct EventCommand {
|
|||
|
||||
class TraceWriter {
|
||||
public:
|
||||
TraceWriter(uint8_t* membase);
|
||||
explicit TraceWriter(uint8_t* membase);
|
||||
~TraceWriter();
|
||||
|
||||
bool is_open() const { return file_ != nullptr; }
|
||||
|
|
|
@ -149,13 +149,13 @@ void print_export_comment(StringBuffer* output, uint32_t num, ShaderType type) {
|
|||
}
|
||||
}
|
||||
|
||||
#define INSTR(opc, num_srcs) \
|
||||
{ num_srcs, #opc }
|
||||
struct {
|
||||
uint32_t num_srcs;
|
||||
const char* name;
|
||||
} vector_instructions[0x20] =
|
||||
{
|
||||
#define INSTR(opc, num_srcs) \
|
||||
{ num_srcs, #opc }
|
||||
INSTR(ADDv, 2), // 0
|
||||
INSTR(MULv, 2), // 1
|
||||
INSTR(MAXv, 2), // 2
|
||||
|
@ -167,7 +167,7 @@ struct {
|
|||
INSTR(FRACv, 1), // 8
|
||||
INSTR(TRUNCv, 1), // 9
|
||||
INSTR(FLOORv, 1), // 10
|
||||
INSTR(MULADDv, 3), // 111
|
||||
INSTR(MULADDv, 3), // 11
|
||||
INSTR(CNDEv, 3), // 12
|
||||
INSTR(CNDGTEv, 3), // 13
|
||||
INSTR(CNDGTv, 3), // 14
|
||||
|
@ -229,16 +229,16 @@ struct {
|
|||
INSTR(KILLNEs, 1), // 38
|
||||
INSTR(KILLONEs, 1), // 39
|
||||
INSTR(SQRT_IEEE, 1), // 40
|
||||
{0, 0},
|
||||
INSTR(MUL_CONST_0, 2), // 42
|
||||
INSTR(MUL_CONST_1, 2), // 43
|
||||
INSTR(ADD_CONST_0, 2), // 44
|
||||
INSTR(ADD_CONST_1, 2), // 45
|
||||
INSTR(SUB_CONST_0, 2), // 46
|
||||
INSTR(SUB_CONST_1, 2), // 47
|
||||
INSTR(SIN, 1), // 48
|
||||
INSTR(COS, 1), // 49
|
||||
INSTR(RETAIN_PREV, 1), // 50
|
||||
{0, 0}, //
|
||||
INSTR(MUL_CONST_0, 2), // 42
|
||||
INSTR(MUL_CONST_1, 2), // 43
|
||||
INSTR(ADD_CONST_0, 2), // 44
|
||||
INSTR(ADD_CONST_1, 2), // 45
|
||||
INSTR(SUB_CONST_0, 2), // 46
|
||||
INSTR(SUB_CONST_1, 2), // 47
|
||||
INSTR(SIN, 1), // 48
|
||||
INSTR(COS, 1), // 49
|
||||
INSTR(RETAIN_PREV, 1), // 50
|
||||
#undef INSTR
|
||||
};
|
||||
|
||||
|
@ -701,7 +701,7 @@ struct {
|
|||
static void print_cf(StringBuffer* output, const instr_cf_t* cf, int level) {
|
||||
output->Append(levels[level]);
|
||||
|
||||
const uint16_t* words = (uint16_t*)cf;
|
||||
auto words = reinterpret_cast<const uint16_t*>(cf);
|
||||
output->AppendFormat(" %04x %04x %04x \t", words[0], words[1],
|
||||
words[2]);
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ class InputDriver {
|
|||
X_INPUT_KEYSTROKE* out_keystroke) = 0;
|
||||
|
||||
protected:
|
||||
InputDriver(InputSystem* input_system);
|
||||
explicit InputDriver(InputSystem* input_system);
|
||||
|
||||
InputSystem* input_system_;
|
||||
InputSystem* input_system_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace hid
|
||||
|
|
|
@ -29,7 +29,7 @@ class InputDriver;
|
|||
|
||||
class InputSystem {
|
||||
public:
|
||||
InputSystem(Emulator* emulator);
|
||||
explicit InputSystem(Emulator* emulator);
|
||||
~InputSystem();
|
||||
|
||||
static std::unique_ptr<InputSystem> Create(Emulator* emulator);
|
||||
|
@ -50,9 +50,9 @@ class InputSystem {
|
|||
X_INPUT_KEYSTROKE* out_keystroke);
|
||||
|
||||
private:
|
||||
Emulator* emulator_;
|
||||
Memory* memory_;
|
||||
cpu::Processor* processor_;
|
||||
Emulator* emulator_ = nullptr;
|
||||
Memory* memory_ = nullptr;
|
||||
cpu::Processor* processor_ = nullptr;
|
||||
|
||||
std::vector<std::unique_ptr<InputDriver>> drivers_;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace nop {
|
|||
|
||||
class NopInputDriver : public InputDriver {
|
||||
public:
|
||||
NopInputDriver(InputSystem* input_system);
|
||||
explicit NopInputDriver(InputSystem* input_system);
|
||||
~NopInputDriver() override;
|
||||
|
||||
X_STATUS Setup() override;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HID_WINKEY_WINKEY_DRIVER_H_
|
||||
#define XENIA_HID_WINKEY_WINKEY_DRIVER_H_
|
||||
#ifndef XENIA_HID_WINKEY_WINKEY_INPUT_DRIVER_H_
|
||||
#define XENIA_HID_WINKEY_WINKEY_INPUT_DRIVER_H_
|
||||
|
||||
#include "xenia/hid/input_driver.h"
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace winkey {
|
|||
|
||||
class WinKeyInputDriver : public InputDriver {
|
||||
public:
|
||||
WinKeyInputDriver(InputSystem* input_system);
|
||||
explicit WinKeyInputDriver(InputSystem* input_system);
|
||||
~WinKeyInputDriver() override;
|
||||
|
||||
X_STATUS Setup() override;
|
||||
|
@ -38,4 +38,4 @@ class WinKeyInputDriver : public InputDriver {
|
|||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HID_WINKEY_WINKEY_DRIVER_H_
|
||||
#endif // XENIA_HID_WINKEY_WINKEY_INPUT_DRIVER_H_
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
// Must be included before xinput.h to avoid windows.h conflicts:
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include <xinput.h>
|
||||
#include <xinput.h> // NOLINT(build/include_order)
|
||||
|
||||
#include "xenia/hid/hid_flags.h"
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_HID_XINPUT_XINPUT_DRIVER_H_
|
||||
#define XENIA_HID_XINPUT_XINPUT_DRIVER_H_
|
||||
#ifndef XENIA_HID_XINPUT_XINPUT_INPUT_DRIVER_H_
|
||||
#define XENIA_HID_XINPUT_XINPUT_INPUT_DRIVER_H_
|
||||
|
||||
#include "xenia/hid/input_driver.h"
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace xinput {
|
|||
|
||||
class XInputInputDriver : public InputDriver {
|
||||
public:
|
||||
XInputInputDriver(InputSystem* input_system);
|
||||
explicit XInputInputDriver(InputSystem* input_system);
|
||||
~XInputInputDriver() override;
|
||||
|
||||
X_STATUS Setup() override;
|
||||
|
@ -37,4 +37,4 @@ class XInputInputDriver : public InputDriver {
|
|||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HID_XINPUT_XINPUT_DRIVER_H_
|
||||
#endif // XENIA_HID_XINPUT_XINPUT_INPUT_DRIVER_H_
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace apps {
|
|||
|
||||
class XXGIApp : public XApp {
|
||||
public:
|
||||
XXGIApp(KernelState* kernel_state);
|
||||
explicit XXGIApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) override;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace apps {
|
|||
|
||||
class XXLiveBaseApp : public XApp {
|
||||
public:
|
||||
XXLiveBaseApp(KernelState* kernel_state);
|
||||
explicit XXLiveBaseApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) override;
|
||||
|
|
|
@ -66,7 +66,7 @@ class XXMPApp : public XApp {
|
|||
std::vector<std::unique_ptr<Song>> songs;
|
||||
};
|
||||
|
||||
XXMPApp(KernelState* kernel_state);
|
||||
explicit XXMPApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT XMPGetStatus(uint32_t status_ptr);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ struct XCONTENT_DATA {
|
|||
std::string file_name;
|
||||
|
||||
XCONTENT_DATA() = default;
|
||||
XCONTENT_DATA(const uint8_t* ptr) {
|
||||
explicit XCONTENT_DATA(const uint8_t* ptr) {
|
||||
device_id = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
content_type = xe::load_and_swap<uint32_t>(ptr + 4);
|
||||
display_name = xe::load_and_swap<std::wstring>(ptr + 8);
|
||||
|
|
|
@ -23,7 +23,7 @@ class NativeList;
|
|||
|
||||
class Dispatcher {
|
||||
public:
|
||||
Dispatcher(KernelState* kernel_state);
|
||||
explicit Dispatcher(KernelState* kernel_state);
|
||||
virtual ~Dispatcher();
|
||||
|
||||
KernelState* kernel_state() const { return kernel_state_; }
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
|
@ -337,8 +339,8 @@ object_ref<XUserModule> KernelState::LoadUserModule(const char* raw_name) {
|
|||
void KernelState::TerminateTitle(bool from_guest_thread) {
|
||||
std::lock_guard<xe::recursive_mutex> lock(object_mutex_);
|
||||
|
||||
// First: Call terminate routines
|
||||
// TODO: These might take arguments
|
||||
// First: call terminate routines.
|
||||
// TODO(benvanik): these might take arguments.
|
||||
// FIXME: Calling these will send some threads into kernel code and they'll
|
||||
// hold the lock when terminated! Do we need to wait for all threads to exit?
|
||||
/*
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
|
@ -86,7 +87,7 @@ struct TerminateNotification {
|
|||
|
||||
class KernelState {
|
||||
public:
|
||||
KernelState(Emulator* emulator);
|
||||
explicit KernelState(Emulator* emulator);
|
||||
~KernelState();
|
||||
|
||||
static KernelState* shared();
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace kernel {
|
|||
|
||||
class NativeList {
|
||||
public:
|
||||
NativeList(Memory* memory);
|
||||
explicit NativeList(Memory* memory);
|
||||
|
||||
void Insert(uint32_t list_entry_ptr);
|
||||
bool IsQueued(uint32_t list_entry_ptr);
|
||||
|
|
|
@ -61,8 +61,8 @@ X_STATUS ObjectTable::FindFreeSlot(uint32_t* out_slot) {
|
|||
uint32_t new_table_capacity = std::max(16 * 1024u, table_capacity_ * 2);
|
||||
size_t new_table_size = new_table_capacity * sizeof(ObjectTableEntry);
|
||||
size_t old_table_size = table_capacity_ * sizeof(ObjectTableEntry);
|
||||
ObjectTableEntry* new_table =
|
||||
(ObjectTableEntry*)realloc(table_, new_table_size);
|
||||
auto new_table =
|
||||
reinterpret_cast<ObjectTableEntry*>(realloc(table_, new_table_size));
|
||||
if (!new_table) {
|
||||
return X_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
@ -235,14 +235,14 @@ XObject* ObjectTable::LookupObject(X_HANDLE handle, bool already_locked) {
|
|||
}
|
||||
|
||||
void ObjectTable::GetObjectsByType(XObject::Type type,
|
||||
std::vector<object_ref<XObject>>& results) {
|
||||
std::vector<object_ref<XObject>>* results) {
|
||||
std::lock_guard<xe::recursive_mutex> lock(table_mutex_);
|
||||
for (uint32_t slot = 0; slot < table_capacity_; ++slot) {
|
||||
auto& entry = table_[slot];
|
||||
if (entry.object) {
|
||||
if (entry.object->type() == type) {
|
||||
entry.object->Retain();
|
||||
results.push_back(object_ref<XObject>(entry.object));
|
||||
results->push_back(object_ref<XObject>(entry.object));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -46,7 +47,7 @@ class ObjectTable {
|
|||
std::vector<object_ref<T>> GetObjectsByType(XObject::Type type) {
|
||||
std::vector<object_ref<T>> results;
|
||||
GetObjectsByType(
|
||||
type, *reinterpret_cast<std::vector<object_ref<XObject>>*>(&results));
|
||||
type, reinterpret_cast<std::vector<object_ref<XObject>>*>(&results));
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -59,7 +60,7 @@ class ObjectTable {
|
|||
ObjectTableEntry* LookupTable(X_HANDLE handle);
|
||||
XObject* LookupObject(X_HANDLE handle, bool already_locked);
|
||||
void GetObjectsByType(XObject::Type type,
|
||||
std::vector<object_ref<XObject>>& results);
|
||||
std::vector<object_ref<XObject>>* results);
|
||||
|
||||
X_HANDLE TranslateHandle(X_HANDLE handle);
|
||||
X_STATUS FindFreeSlot(uint32_t* out_slot);
|
||||
|
|
|
@ -27,11 +27,11 @@ void XEvent::Initialize(bool manual_reset, bool initial_state) {
|
|||
}
|
||||
}
|
||||
|
||||
void XEvent::InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header) {
|
||||
void XEvent::InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header) {
|
||||
assert_false(event_);
|
||||
|
||||
bool manual_reset;
|
||||
switch (header.type) {
|
||||
switch (header->type) {
|
||||
case 0x00: // EventNotificationObject (manual reset)
|
||||
manual_reset = true;
|
||||
break;
|
||||
|
@ -43,7 +43,7 @@ void XEvent::InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header) {
|
|||
return;
|
||||
}
|
||||
|
||||
bool initial_state = header.signal_state ? true : false;
|
||||
bool initial_state = header->signal_state ? true : false;
|
||||
Initialize(manual_reset, initial_state);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ struct X_KEVENT {
|
|||
|
||||
class XEvent : public XObject {
|
||||
public:
|
||||
XEvent(KernelState* kernel_state);
|
||||
explicit XEvent(KernelState* kernel_state);
|
||||
~XEvent() override;
|
||||
|
||||
void Initialize(bool manual_reset, bool initial_state);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header);
|
||||
|
||||
int32_t Set(uint32_t priority_increment, bool wait);
|
||||
int32_t Pulse(uint32_t priority_increment, bool wait);
|
||||
|
|
|
@ -60,9 +60,10 @@ X_STATUS XFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
|
|||
}
|
||||
}
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
auto end = reinterpret_cast<uint8_t*>(out_info) + length;
|
||||
const auto& entry_name = entry->name();
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name.size() > end) {
|
||||
if (reinterpret_cast<uint8_t*>(&out_info->file_name[0]) + entry_name.size() >
|
||||
end) {
|
||||
assert_always("Buffer overflow?");
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
#ifndef XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/vfs/device.h"
|
||||
#include "xenia/vfs/entry.h"
|
||||
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
@ -53,10 +54,10 @@ class X_FILE_DIRECTORY_INFORMATION {
|
|||
|
||||
void Write(uint8_t* base, uint32_t p) {
|
||||
uint8_t* dst = base + p;
|
||||
uint8_t* src = (uint8_t*)this;
|
||||
uint8_t* src = reinterpret_cast<uint8_t*>(this);
|
||||
X_FILE_DIRECTORY_INFORMATION* info;
|
||||
do {
|
||||
info = (X_FILE_DIRECTORY_INFORMATION*)src;
|
||||
info = reinterpret_cast<X_FILE_DIRECTORY_INFORMATION*>(src);
|
||||
xe::store_and_swap<uint32_t>(dst, info->next_entry_offset);
|
||||
xe::store_and_swap<uint32_t>(dst + 4, info->file_index);
|
||||
xe::store_and_swap<uint64_t>(dst + 8, info->creation_time);
|
||||
|
|
|
@ -23,7 +23,7 @@ void XMutant::Initialize(bool initial_owner) {
|
|||
mutant_ = xe::threading::Mutant::Create(initial_owner);
|
||||
}
|
||||
|
||||
void XMutant::InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header) {
|
||||
void XMutant::InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header) {
|
||||
assert_false(mutant_);
|
||||
|
||||
// Haven't seen this yet, but it's possible.
|
||||
|
|
|
@ -19,11 +19,11 @@ namespace kernel {
|
|||
|
||||
class XMutant : public XObject {
|
||||
public:
|
||||
XMutant(KernelState* kernel_state);
|
||||
explicit XMutant(KernelState* kernel_state);
|
||||
~XMutant() override;
|
||||
|
||||
void Initialize(bool initial_owner);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header);
|
||||
|
||||
X_STATUS ReleaseMutant(uint32_t priority_increment, bool abandon, bool wait);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace kernel {
|
|||
|
||||
class XNotifyListener : public XObject {
|
||||
public:
|
||||
XNotifyListener(KernelState* kernel_state);
|
||||
explicit XNotifyListener(KernelState* kernel_state);
|
||||
~XNotifyListener() override;
|
||||
|
||||
uint64_t mask() const { return mask_; }
|
||||
|
|
|
@ -25,7 +25,7 @@ void XSemaphore::Initialize(int32_t initial_count, int32_t maximum_count) {
|
|||
semaphore_ = xe::threading::Semaphore::Create(initial_count, maximum_count);
|
||||
}
|
||||
|
||||
void XSemaphore::InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header) {
|
||||
void XSemaphore::InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header) {
|
||||
assert_false(semaphore_);
|
||||
|
||||
auto semaphore = reinterpret_cast<X_KSEMAPHORE*>(native_ptr);
|
||||
|
|
|
@ -24,11 +24,11 @@ struct X_KSEMAPHORE {
|
|||
|
||||
class XSemaphore : public XObject {
|
||||
public:
|
||||
XSemaphore(KernelState* kernel_state);
|
||||
explicit XSemaphore(KernelState* kernel_state);
|
||||
~XSemaphore() override;
|
||||
|
||||
void Initialize(int32_t initial_count, int32_t maximum_count);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER& header);
|
||||
void InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header);
|
||||
|
||||
int32_t ReleaseSemaphore(int32_t release_count);
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@ DEFINE_bool(ignore_thread_affinities, true,
|
|||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
using namespace xe::cpu;
|
||||
|
||||
uint32_t next_xthread_id = 0;
|
||||
thread_local XThread* current_thread_tls = nullptr;
|
||||
xe::mutex critical_region_;
|
||||
|
@ -220,9 +218,9 @@ X_STATUS XThread::Create() {
|
|||
|
||||
// Allocate processor thread state.
|
||||
// This is thread safe.
|
||||
thread_state_ = new ThreadState(kernel_state()->processor(), thread_id_,
|
||||
ThreadStackType::kUserStack, 0,
|
||||
creation_params_.stack_size, pcr_address_);
|
||||
thread_state_ = new cpu::ThreadState(
|
||||
kernel_state()->processor(), thread_id_, cpu::ThreadStackType::kUserStack,
|
||||
0, creation_params_.stack_size, pcr_address_);
|
||||
XELOGI("XThread%04X (%X) Stack: %.8X-%.8X", handle(),
|
||||
thread_state_->thread_id(), thread_state_->stack_limit(),
|
||||
thread_state_->stack_base());
|
||||
|
@ -352,7 +350,7 @@ X_STATUS XThread::Exit(int exit_code) {
|
|||
// This may only be called on the thread itself.
|
||||
assert_true(XThread::GetCurrentThread() == this);
|
||||
|
||||
// TODO(benvanik); dispatch events? waiters? etc?
|
||||
// TODO(benvanik): dispatch events? waiters? etc?
|
||||
RundownAPCs();
|
||||
|
||||
// Set exit code.
|
||||
|
@ -380,7 +378,7 @@ X_STATUS XThread::Exit(int exit_code) {
|
|||
}
|
||||
|
||||
X_STATUS XThread::Terminate(int exit_code) {
|
||||
// TODO: Inform the profiler that this thread is exiting.
|
||||
// TODO(benvanik): inform the profiler that this thread is exiting.
|
||||
|
||||
// Set exit code.
|
||||
X_KTHREAD* thread = guest_object<X_KTHREAD>();
|
||||
|
@ -426,8 +424,9 @@ void XThread::Execute() {
|
|||
} else {
|
||||
// Run user code.
|
||||
uint64_t args[] = {creation_params_.start_context};
|
||||
exit_code = (int)kernel_state()->processor()->Execute(
|
||||
thread_state_, creation_params_.start_address, args, xe::countof(args));
|
||||
exit_code = static_cast<int>(kernel_state()->processor()->Execute(
|
||||
thread_state_, creation_params_.start_address, args,
|
||||
xe::countof(args)));
|
||||
// If we got here it means the execute completed without an exit being
|
||||
// called.
|
||||
// Treat the return code as an implicit exit code.
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace kernel {
|
|||
|
||||
class XTimer : public XObject {
|
||||
public:
|
||||
XTimer(KernelState* kernel_state);
|
||||
explicit XTimer(KernelState* kernel_state);
|
||||
~XTimer() override;
|
||||
|
||||
void Initialize(uint32_t timer_type);
|
||||
|
@ -41,4 +41,4 @@ class XTimer : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_TIMER_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XTIMER_H_
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/xex_module.h"
|
||||
|
@ -19,8 +21,6 @@
|
|||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
using namespace xe::cpu;
|
||||
|
||||
XUserModule::XUserModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, ModuleType::kUserModule, path) {}
|
||||
|
||||
|
@ -74,11 +74,11 @@ X_STATUS XUserModule::LoadFromFile(std::string path) {
|
|||
}
|
||||
|
||||
X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
Processor* processor = kernel_state()->processor();
|
||||
auto processor = kernel_state()->processor();
|
||||
|
||||
// Prepare the module for execution.
|
||||
// Runtime takes ownership.
|
||||
auto xex_module = std::make_unique<XexModule>(processor, kernel_state());
|
||||
auto xex_module = std::make_unique<cpu::XexModule>(processor, kernel_state());
|
||||
if (!xex_module->Load(name_, path_, addr, length)) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ uint32_t XUserModule::GetProcAddressByName(const char* name) {
|
|||
X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,
|
||||
uint32_t* out_section_size) {
|
||||
xex2_opt_resource_info* resource_header = nullptr;
|
||||
if (!XexModule::GetOptHeader(xex_header(), XEX_HEADER_RESOURCE_INFO,
|
||||
&resource_header)) {
|
||||
if (!cpu::XexModule::GetOptHeader(xex_header(), XEX_HEADER_RESOURCE_INFO,
|
||||
&resource_header)) {
|
||||
// No resources.
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
@ -198,11 +198,14 @@ X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
|
|||
break;
|
||||
case 0x01:
|
||||
// Return pointer to data stored in header value.
|
||||
field_value = uint32_t((uint8_t*)&opt_header.value - membase);
|
||||
field_value = static_cast<uint32_t>(
|
||||
reinterpret_cast<const uint8_t*>(&opt_header.value) - membase);
|
||||
break;
|
||||
default:
|
||||
// Data stored at offset to header.
|
||||
field_value = uint32_t((uint8_t*)header - membase) + opt_header.offset;
|
||||
field_value = static_cast<uint32_t>(
|
||||
reinterpret_cast<const uint8_t*>(header) - membase) +
|
||||
opt_header.offset;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -275,12 +278,13 @@ void XUserModule::Dump() {
|
|||
auto& opt_header = header->headers[i];
|
||||
|
||||
// Stash a pointer (although this isn't used in every case)
|
||||
void* opt_header_ptr = (uint8_t*)header + opt_header.offset;
|
||||
auto opt_header_ptr =
|
||||
reinterpret_cast<const uint8_t*>(header) + opt_header.offset;
|
||||
switch (opt_header.key) {
|
||||
case XEX_HEADER_RESOURCE_INFO: {
|
||||
printf(" XEX_HEADER_RESOURCE_INFO:\n");
|
||||
auto opt_resource_info =
|
||||
reinterpret_cast<xex2_opt_resource_info*>(opt_header_ptr);
|
||||
reinterpret_cast<const xex2_opt_resource_info*>(opt_header_ptr);
|
||||
|
||||
uint32_t count = (opt_resource_info->size - 4) / 16;
|
||||
for (uint32_t j = 0; j < count; j++) {
|
||||
|
@ -304,7 +308,7 @@ void XUserModule::Dump() {
|
|||
} break;
|
||||
case XEX_HEADER_BOUNDING_PATH: {
|
||||
auto opt_bound_path =
|
||||
reinterpret_cast<xex2_opt_bound_path*>(opt_header_ptr);
|
||||
reinterpret_cast<const xex2_opt_bound_path*>(opt_header_ptr);
|
||||
printf(" XEX_HEADER_BOUNDING_PATH: %s\n", opt_bound_path->path);
|
||||
} break;
|
||||
case XEX_HEADER_ORIGINAL_BASE_ADDRESS: {
|
||||
|
@ -343,15 +347,14 @@ void XUserModule::Dump() {
|
|||
}
|
||||
}
|
||||
|
||||
auto libraries = (uint8_t*)opt_import_libraries +
|
||||
opt_import_libraries->string_table_size + 12;
|
||||
auto libraries =
|
||||
reinterpret_cast<const uint8_t*>(opt_import_libraries) +
|
||||
opt_import_libraries->string_table_size + 12;
|
||||
uint32_t library_offset = 0;
|
||||
for (uint32_t l = 0; l < opt_import_libraries->library_count; l++) {
|
||||
auto library = reinterpret_cast<xex2_import_library*>(
|
||||
(uint8_t*)libraries + library_offset);
|
||||
auto library = reinterpret_cast<const xex2_import_library*>(
|
||||
libraries + library_offset);
|
||||
auto name = string_table[library->name_index];
|
||||
|
||||
// Okay. Dump it.
|
||||
printf(" %s - %d imports\n", name, (uint16_t)library->count);
|
||||
|
||||
// Manually byteswap these because of the bitfields.
|
||||
|
@ -372,7 +375,7 @@ void XUserModule::Dump() {
|
|||
} break;
|
||||
case XEX_HEADER_ORIGINAL_PE_NAME: {
|
||||
auto opt_pe_name =
|
||||
reinterpret_cast<xex2_opt_original_pe_name*>(opt_header_ptr);
|
||||
reinterpret_cast<const xex2_opt_original_pe_name*>(opt_header_ptr);
|
||||
printf(" XEX_HEADER_ORIGINAL_PE_NAME: %s\n", opt_pe_name->name);
|
||||
} break;
|
||||
case XEX_HEADER_STATIC_LIBRARIES: {
|
||||
|
@ -383,10 +386,11 @@ void XUserModule::Dump() {
|
|||
uint32_t count = (opt_static_libraries->size - 4) / 0x10;
|
||||
for (uint32_t l = 0; l < count; l++) {
|
||||
auto& library = opt_static_libraries->libraries[l];
|
||||
printf(
|
||||
" %-8s : %d.%d.%d.%d\n", library.name,
|
||||
(uint16_t)library.version_major, (uint16_t)library.version_minor,
|
||||
(uint16_t)library.version_build, (uint16_t)library.version_qfe);
|
||||
printf(" %-8s : %d.%d.%d.%d\n", library.name,
|
||||
static_cast<uint16_t>(library.version_major),
|
||||
static_cast<uint16_t>(library.version_minor),
|
||||
static_cast<uint16_t>(library.version_build),
|
||||
static_cast<uint16_t>(library.version_qfe));
|
||||
}
|
||||
} break;
|
||||
case XEX_HEADER_TLS_INFO: {
|
||||
|
@ -395,42 +399,46 @@ void XUserModule::Dump() {
|
|||
reinterpret_cast<const xex2_opt_tls_info*>(opt_header_ptr);
|
||||
|
||||
printf(" Slot Count: %d\n",
|
||||
(uint32_t)opt_tls_info->slot_count);
|
||||
static_cast<uint32_t>(opt_tls_info->slot_count));
|
||||
printf(" Raw Data Address: %.8X\n",
|
||||
(uint32_t)opt_tls_info->raw_data_address);
|
||||
printf(" Data Size: %d\n", (uint32_t)opt_tls_info->data_size);
|
||||
static_cast<uint32_t>(opt_tls_info->raw_data_address));
|
||||
printf(" Data Size: %d\n",
|
||||
static_cast<uint32_t>(opt_tls_info->data_size));
|
||||
printf(" Raw Data Size: %d\n",
|
||||
(uint32_t)opt_tls_info->raw_data_size);
|
||||
static_cast<uint32_t>(opt_tls_info->raw_data_size));
|
||||
} break;
|
||||
case XEX_HEADER_DEFAULT_STACK_SIZE: {
|
||||
printf(" XEX_HEADER_DEFAULT_STACK_SIZE: %d\n",
|
||||
(uint32_t)opt_header.value);
|
||||
static_cast<uint32_t>(opt_header.value));
|
||||
} break;
|
||||
case XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE: {
|
||||
printf(" XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE: %d\n",
|
||||
(uint32_t)opt_header.value);
|
||||
static_cast<uint32_t>(opt_header.value));
|
||||
} break;
|
||||
case XEX_HEADER_DEFAULT_HEAP_SIZE: {
|
||||
printf(" XEX_HEADER_DEFAULT_HEAP_SIZE: %d\n",
|
||||
(uint32_t)opt_header.value);
|
||||
static_cast<uint32_t>(opt_header.value));
|
||||
} break;
|
||||
case XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS: {
|
||||
printf(" XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS (TODO):\n");
|
||||
} break;
|
||||
case XEX_HEADER_SYSTEM_FLAGS: {
|
||||
printf(" XEX_HEADER_SYSTEM_FLAGS: %.8X\n", (uint32_t)opt_header.value);
|
||||
printf(" XEX_HEADER_SYSTEM_FLAGS: %.8X\n",
|
||||
static_cast<uint32_t>(opt_header.value));
|
||||
} break;
|
||||
case XEX_HEADER_EXECUTION_INFO: {
|
||||
printf(" XEX_HEADER_EXECUTION_INFO:\n");
|
||||
auto opt_exec_info =
|
||||
reinterpret_cast<const xex2_opt_execution_info*>(opt_header_ptr);
|
||||
|
||||
printf(" Media ID: %.8X\n", (uint32_t)opt_exec_info->media_id);
|
||||
printf(" Title ID: %.8X\n", (uint32_t)opt_exec_info->title_id);
|
||||
printf(" Savegame ID: %.8X\n", (uint32_t)opt_exec_info->title_id);
|
||||
printf(" Disc Number / Total: %d / %d\n",
|
||||
(uint8_t)opt_exec_info->disc_number,
|
||||
(uint8_t)opt_exec_info->disc_count);
|
||||
printf(" Media ID: %.8X\n",
|
||||
static_cast<uint32_t>(opt_exec_info->media_id));
|
||||
printf(" Title ID: %.8X\n",
|
||||
static_cast<uint32_t>(opt_exec_info->title_id));
|
||||
printf(" Savegame ID: %.8X\n",
|
||||
static_cast<uint32_t>(opt_exec_info->title_id));
|
||||
printf(" Disc Number / Total: %d / %d\n", opt_exec_info->disc_number,
|
||||
opt_exec_info->disc_count);
|
||||
} break;
|
||||
case XEX_HEADER_TITLE_WORKSPACE_SIZE: {
|
||||
printf(" XEX_HEADER_TITLE_WORKSPACE_SIZE: %d\n",
|
||||
|
@ -463,23 +471,21 @@ void XUserModule::Dump() {
|
|||
auto exe_address = xex_module()->xex_security_info()->load_address;
|
||||
auto e = memory()->TranslateVirtual<const X_IMAGE_EXPORT_DIRECTORY*>(
|
||||
exe_address + dir->offset);
|
||||
auto e_base = reinterpret_cast<uintptr_t>(e);
|
||||
|
||||
// e->AddressOfX RVAs are relative to the IMAGE_EXPORT_DIRECTORY!
|
||||
uint32_t* function_table =
|
||||
(uint32_t*)((uint64_t)e + e->AddressOfFunctions);
|
||||
|
||||
// Names relative to directory
|
||||
uint32_t* name_table = (uint32_t*)((uint64_t)e + e->AddressOfNames);
|
||||
|
||||
// Table of ordinals (by name)
|
||||
uint16_t* ordinal_table =
|
||||
(uint16_t*)((uint64_t)e + e->AddressOfNameOrdinals);
|
||||
|
||||
auto function_table =
|
||||
reinterpret_cast<const uint32_t*>(e_base + e->AddressOfFunctions);
|
||||
// Names relative to directory.
|
||||
auto name_table =
|
||||
reinterpret_cast<const uint32_t*>(e_base + e->AddressOfNames);
|
||||
// Table of ordinals (by name).
|
||||
auto ordinal_table = reinterpret_cast<const uint16_t*>(
|
||||
e_base + e->AddressOfNameOrdinals);
|
||||
for (uint32_t n = 0; n < e->NumberOfNames; n++) {
|
||||
const char* name = (const char*)((uint8_t*)e + name_table[n]);
|
||||
auto name = reinterpret_cast<const char*>(e_base + name_table[n]);
|
||||
uint16_t ordinal = ordinal_table[n];
|
||||
uint32_t addr = exe_address + function_table[ordinal];
|
||||
|
||||
printf(" %-28s - %.3X - %.8X\n", name, ordinal, addr);
|
||||
}
|
||||
} break;
|
||||
|
@ -515,14 +521,14 @@ void XUserModule::Dump() {
|
|||
uint32_t start_address = security_info->load_address + (page * page_size);
|
||||
uint32_t end_address = start_address + (page_descriptor.size * page_size);
|
||||
|
||||
printf(" %3d %s %3d pages %.8X - %.8X (%d bytes)\n", (int)page, type,
|
||||
page_descriptor.size, (int)start_address, (int)end_address,
|
||||
printf(" %3u %s %3u pages %.8X - %.8X (%d bytes)\n", page, type,
|
||||
page_descriptor.size, start_address, end_address,
|
||||
page_descriptor.size * page_size);
|
||||
page += page_descriptor.size;
|
||||
}
|
||||
|
||||
// Print out imports.
|
||||
// TODO: Figure out a way to remove dependency on old xex header.
|
||||
// TODO(benvanik): figure out a way to remove dependency on old xex header.
|
||||
auto old_header = xe_xex2_get_header(xex_module()->xex());
|
||||
|
||||
printf("Imports:\n");
|
||||
|
@ -533,7 +539,7 @@ void XUserModule::Dump() {
|
|||
size_t import_info_count;
|
||||
if (!xe_xex2_get_import_infos(xex_module()->xex(), library, &import_infos,
|
||||
&import_info_count)) {
|
||||
printf(" %s - %d imports\n", library->name, (int)import_info_count);
|
||||
printf(" %s - %lld imports\n", library->name, import_info_count);
|
||||
printf(" Version: %d.%d.%d.%d\n", library->version.major,
|
||||
library->version.minor, library->version.build,
|
||||
library->version.qfe);
|
||||
|
@ -582,12 +588,13 @@ void XUserModule::Dump() {
|
|||
}
|
||||
}
|
||||
}
|
||||
printf(" Total: %4u\n", uint32_t(import_info_count));
|
||||
float total_count = static_cast<float>(import_info_count) * 100.0f;
|
||||
printf(" Total: %4llu\n", import_info_count);
|
||||
printf(" Known: %3d%% (%d known, %d unknown)\n",
|
||||
(int)(known_count / (float)import_info_count * 100.0f),
|
||||
known_count, unknown_count);
|
||||
static_cast<int>(known_count / total_count), known_count,
|
||||
unknown_count);
|
||||
printf(" Implemented: %3d%% (%d implemented, %d unimplemented)\n",
|
||||
(int)(impl_count / (float)import_info_count * 100.0f), impl_count,
|
||||
static_cast<int>(impl_count / total_count), impl_count,
|
||||
unimpl_count);
|
||||
printf("\n");
|
||||
|
||||
|
@ -597,7 +604,7 @@ void XUserModule::Dump() {
|
|||
const char* name = "UNKNOWN";
|
||||
bool implemented = false;
|
||||
|
||||
Export* kernel_export = nullptr;
|
||||
cpu::Export* kernel_export = nullptr;
|
||||
if (kernel_state_->IsKernelModule(library->name)) {
|
||||
kernel_export =
|
||||
export_resolver->GetExportByOrdinal(library->name, info->ordinal);
|
||||
|
@ -608,11 +615,12 @@ void XUserModule::Dump() {
|
|||
} else {
|
||||
auto module = kernel_state_->GetModule(library->name);
|
||||
if (module && module->GetProcAddressByOrdinal(info->ordinal)) {
|
||||
// TODO: Name lookup
|
||||
// TODO(benvanik): name lookup.
|
||||
implemented = true;
|
||||
}
|
||||
}
|
||||
if (kernel_export && kernel_export->type == Export::Type::kVariable) {
|
||||
if (kernel_export &&
|
||||
kernel_export->type == cpu::Export::Type::kVariable) {
|
||||
printf(" V %.8X %.3X (%3d) %s %s\n", info->value_address,
|
||||
info->ordinal, info->ordinal, implemented ? " " : "!!", name);
|
||||
} else if (info->thunk_address) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define XENIA_KERNEL_UTIL_SHIM_UTILS_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/memory.h"
|
||||
|
@ -313,51 +314,51 @@ using pointer_result_t = shim::Result<uint32_t>;
|
|||
|
||||
namespace shim {
|
||||
|
||||
inline void AppendParam(StringBuffer& string_buffer, int_t param) {
|
||||
string_buffer.AppendFormat("%d", int32_t(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, int_t param) {
|
||||
string_buffer->AppendFormat("%d", int32_t(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, dword_t param) {
|
||||
string_buffer.AppendFormat("%.8X", uint32_t(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, dword_t param) {
|
||||
string_buffer->AppendFormat("%.8X", uint32_t(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, qword_t param) {
|
||||
string_buffer.AppendFormat("%.16llX", uint64_t(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, qword_t param) {
|
||||
string_buffer->AppendFormat("%.16llX", uint64_t(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, float_t param) {
|
||||
string_buffer.AppendFormat("%G", static_cast<float>(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, float_t param) {
|
||||
string_buffer->AppendFormat("%G", static_cast<float>(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, double_t param) {
|
||||
string_buffer.AppendFormat("%G", static_cast<double>(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, double_t param) {
|
||||
string_buffer->AppendFormat("%G", static_cast<double>(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, lpvoid_t param) {
|
||||
string_buffer.AppendFormat("%.8X", uint32_t(param));
|
||||
inline void AppendParam(StringBuffer* string_buffer, lpvoid_t param) {
|
||||
string_buffer->AppendFormat("%.8X", uint32_t(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, lpdword_t param) {
|
||||
string_buffer.AppendFormat("%.8X", param.guest_address());
|
||||
inline void AppendParam(StringBuffer* string_buffer, lpdword_t param) {
|
||||
string_buffer->AppendFormat("%.8X", param.guest_address());
|
||||
if (param) {
|
||||
string_buffer.AppendFormat("(%.8X)", param.value());
|
||||
string_buffer->AppendFormat("(%.8X)", param.value());
|
||||
}
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, lpqword_t param) {
|
||||
string_buffer.AppendFormat("%.8X", param.guest_address());
|
||||
inline void AppendParam(StringBuffer* string_buffer, lpqword_t param) {
|
||||
string_buffer->AppendFormat("%.8X", param.guest_address());
|
||||
if (param) {
|
||||
string_buffer.AppendFormat("(%.16llX)", param.value());
|
||||
string_buffer->AppendFormat("(%.16llX)", param.value());
|
||||
}
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, lpfloat_t param) {
|
||||
string_buffer.AppendFormat("%.8X", param.guest_address());
|
||||
inline void AppendParam(StringBuffer* string_buffer, lpfloat_t param) {
|
||||
string_buffer->AppendFormat("%.8X", param.guest_address());
|
||||
if (param) {
|
||||
string_buffer.AppendFormat("(%G)", param.value());
|
||||
string_buffer->AppendFormat("(%G)", param.value());
|
||||
}
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, lpdouble_t param) {
|
||||
string_buffer.AppendFormat("%.8X", param.guest_address());
|
||||
inline void AppendParam(StringBuffer* string_buffer, lpdouble_t param) {
|
||||
string_buffer->AppendFormat("%.8X", param.guest_address());
|
||||
if (param) {
|
||||
string_buffer.AppendFormat("(%G)", param.value());
|
||||
string_buffer->AppendFormat("(%G)", param.value());
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
void AppendParam(StringBuffer& string_buffer, pointer_t<T> param) {
|
||||
string_buffer.AppendFormat("%.8X", param.guest_address());
|
||||
void AppendParam(StringBuffer* string_buffer, pointer_t<T> param) {
|
||||
string_buffer->AppendFormat("%.8X", param.guest_address());
|
||||
}
|
||||
|
||||
enum class KernelModuleId {
|
||||
|
@ -379,7 +380,7 @@ template <size_t I = 0, typename... Ps>
|
|||
string_buffer.Append(", ");
|
||||
}
|
||||
auto param = std::get<I>(params);
|
||||
AppendParam(string_buffer, param);
|
||||
AppendParam(&string_buffer, param);
|
||||
AppendKernelCallParams<I + 1>(string_buffer, export_entry, params);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
using namespace xe::hid;
|
||||
using xe::hid::X_INPUT_CAPABILITIES;
|
||||
using xe::hid::X_INPUT_KEYSTROKE;
|
||||
using xe::hid::X_INPUT_STATE;
|
||||
using xe::hid::X_INPUT_VIBRATION;
|
||||
|
||||
constexpr uint32_t XINPUT_FLAG_GAMEPAD = 0x01;
|
||||
constexpr uint32_t XINPUT_FLAG_ANY_USER = 1 << 30;
|
||||
|
@ -69,7 +72,7 @@ SHIM_CALL XamInputGetCapabilities_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto caps = SHIM_STRUCT(X_INPUT_CAPABILITIES, caps_ptr);
|
||||
X_RESULT result = input_system->GetCapabilities(user_index, flags, caps);
|
||||
|
@ -100,7 +103,7 @@ SHIM_CALL XamInputGetCapabilitiesEx_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto caps = SHIM_STRUCT(X_INPUT_CAPABILITIES, caps_ptr);
|
||||
X_RESULT result = input_system->GetCapabilities(user_index, flags, caps);
|
||||
|
@ -128,7 +131,7 @@ SHIM_CALL XamInputGetState_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto input_state = SHIM_STRUCT(X_INPUT_STATE, state_ptr);
|
||||
X_RESULT result = input_system->GetState(user_index, input_state);
|
||||
|
@ -153,7 +156,7 @@ SHIM_CALL XamInputSetState_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto vibration = SHIM_STRUCT(X_INPUT_VIBRATION, vibration_ptr);
|
||||
X_RESULT result = input_system->SetState(user_index, vibration);
|
||||
|
@ -188,7 +191,7 @@ SHIM_CALL XamInputGetKeystroke_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto keystroke = SHIM_STRUCT(X_INPUT_KEYSTROKE, keystroke_ptr);
|
||||
X_RESULT result = input_system->GetKeystroke(user_index, flags, keystroke);
|
||||
|
@ -221,7 +224,7 @@ SHIM_CALL XamInputGetKeystrokeEx_shim(PPCContext* ppc_context,
|
|||
user_index = 0;
|
||||
}
|
||||
|
||||
InputSystem* input_system = kernel_state->emulator()->input_system();
|
||||
auto input_system = kernel_state->emulator()->input_system();
|
||||
|
||||
auto keystroke = SHIM_STRUCT(X_INPUT_KEYSTROKE, keystroke_ptr);
|
||||
X_RESULT result = input_system->GetKeystroke(user_index, flags, keystroke);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue