Linux tweaks.
This commit is contained in:
parent
19299fad4b
commit
8b0d4fb51c
|
@ -1 +1 @@
|
||||||
Subproject commit c004e383e1621d6bbdbdb9b2cb1d8eb9369aed6e
|
Subproject commit 7c9845040311ae8a1964f6d4f6a4eef3530bb3d7
|
|
@ -28,6 +28,17 @@ the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`)
|
||||||
To redirect output, use the following command flags:
|
To redirect output, use the following command flags:
|
||||||
`--flagfile=$(SolutionDir)scratch\flags.txt 2>&1 1>$(SolutionDir)scratch\stdout.txt`
|
`--flagfile=$(SolutionDir)scratch\flags.txt 2>&1 1>$(SolutionDir)scratch\stdout.txt`
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
Linux support is extremely experimental and incomplete.
|
||||||
|
|
||||||
|
Only tested with GCC 4.9 on Ubuntu 14. [CodeLite](http://codelite.org) is the
|
||||||
|
IDE of choice and `xb premake` will spit out files for that. Make also works via
|
||||||
|
`xb build`.
|
||||||
|
|
||||||
|
Currently building requires that CC == CXX == g++. If you know a way around this
|
||||||
|
(to force .c files to be built with g++) let me know.
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
To make life easier you can use `--flagfile=myflags.txt` to specify all
|
To make life easier you can use `--flagfile=myflags.txt` to specify all
|
||||||
|
|
12
premake5.lua
12
premake5.lua
|
@ -36,7 +36,7 @@ filter("configurations:Checked")
|
||||||
})
|
})
|
||||||
flags({"Symbols"})
|
flags({"Symbols"})
|
||||||
runtime("Debug")
|
runtime("Debug")
|
||||||
filter("configurations:Checked", "platforms:Windows")
|
filter({"configurations:Checked", "platforms:Windows"})
|
||||||
buildoptions({
|
buildoptions({
|
||||||
"/RTCsu", -- Full Run-Time Checks.
|
"/RTCsu", -- Full Run-Time Checks.
|
||||||
})
|
})
|
||||||
|
@ -69,6 +69,7 @@ filter("platforms:Linux")
|
||||||
toolset("clang")
|
toolset("clang")
|
||||||
buildoptions({
|
buildoptions({
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
|
"-mlzcnt", -- Assume lzcnt supported.
|
||||||
})
|
})
|
||||||
|
|
||||||
filter("platforms:Windows")
|
filter("platforms:Windows")
|
||||||
|
@ -151,7 +152,6 @@ solution("xenia")
|
||||||
include("src/xenia/app")
|
include("src/xenia/app")
|
||||||
include("src/xenia/apu")
|
include("src/xenia/apu")
|
||||||
include("src/xenia/apu/nop")
|
include("src/xenia/apu/nop")
|
||||||
include("src/xenia/apu/xaudio2")
|
|
||||||
include("src/xenia/base")
|
include("src/xenia/base")
|
||||||
include("src/xenia/cpu")
|
include("src/xenia/cpu")
|
||||||
include("src/xenia/cpu/backend/x64")
|
include("src/xenia/cpu/backend/x64")
|
||||||
|
@ -161,13 +161,17 @@ solution("xenia")
|
||||||
include("src/xenia/gpu/gl4")
|
include("src/xenia/gpu/gl4")
|
||||||
include("src/xenia/hid")
|
include("src/xenia/hid")
|
||||||
include("src/xenia/hid/nop")
|
include("src/xenia/hid/nop")
|
||||||
include("src/xenia/hid/winkey")
|
|
||||||
include("src/xenia/hid/xinput")
|
|
||||||
include("src/xenia/kernel")
|
include("src/xenia/kernel")
|
||||||
include("src/xenia/ui")
|
include("src/xenia/ui")
|
||||||
include("src/xenia/ui/gl")
|
include("src/xenia/ui/gl")
|
||||||
include("src/xenia/vfs")
|
include("src/xenia/vfs")
|
||||||
|
|
||||||
|
if os.is("windows") then
|
||||||
|
include("src/xenia/apu/xaudio2")
|
||||||
|
include("src/xenia/hid/winkey")
|
||||||
|
include("src/xenia/hid/xinput")
|
||||||
|
end
|
||||||
|
|
||||||
include("third_party/capstone.lua")
|
include("third_party/capstone.lua")
|
||||||
include("third_party/elemental-forms")
|
include("third_party/elemental-forms")
|
||||||
include("third_party/glew.lua")
|
include("third_party/glew.lua")
|
||||||
|
|
|
@ -12,7 +12,6 @@ project("xenia-app")
|
||||||
"gflags",
|
"gflags",
|
||||||
"xenia-apu",
|
"xenia-apu",
|
||||||
"xenia-apu-nop",
|
"xenia-apu-nop",
|
||||||
"xenia-apu-xaudio2",
|
|
||||||
"xenia-base",
|
"xenia-base",
|
||||||
"xenia-core",
|
"xenia-core",
|
||||||
"xenia-cpu",
|
"xenia-cpu",
|
||||||
|
@ -21,8 +20,6 @@ project("xenia-app")
|
||||||
"xenia-gpu",
|
"xenia-gpu",
|
||||||
"xenia-gpu-gl4",
|
"xenia-gpu-gl4",
|
||||||
"xenia-hid-nop",
|
"xenia-hid-nop",
|
||||||
"xenia-hid-winkey",
|
|
||||||
"xenia-hid-xinput",
|
|
||||||
"xenia-kernel",
|
"xenia-kernel",
|
||||||
"xenia-ui",
|
"xenia-ui",
|
||||||
"xenia-ui-gl",
|
"xenia-ui-gl",
|
||||||
|
@ -49,6 +46,12 @@ project("xenia-app")
|
||||||
project_root.."/third_party/elemental-forms",
|
project_root.."/third_party/elemental-forms",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("platforms:Windows")
|
||||||
|
links({
|
||||||
|
"xenia-apu-xaudio2",
|
||||||
|
"xenia-hid-winkey",
|
||||||
|
"xenia-hid-xinput",
|
||||||
|
})
|
||||||
filter("configurations:Checked")
|
filter("configurations:Checked")
|
||||||
local libav_root = "../third_party/libav-xma-bin/lib/Debug"
|
local libav_root = "../third_party/libav-xma-bin/lib/Debug"
|
||||||
linkoptions({
|
linkoptions({
|
||||||
|
|
|
@ -102,17 +102,17 @@ inline int32_t atomic_dec(volatile int32_t* value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) {
|
inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) {
|
||||||
return __sync_val_compare_and_swap(*value, value, new_value);
|
return __sync_val_compare_and_swap(value, *value, new_value);
|
||||||
}
|
}
|
||||||
inline int64_t atomic_exchange(int64_t new_value, volatile int64_t* value) {
|
inline int64_t atomic_exchange(int64_t new_value, volatile int64_t* value) {
|
||||||
return __sync_val_compare_and_swap(*value, value, new_value);
|
return __sync_val_compare_and_swap(value, *value, new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32_t atomic_exchange_add(int32_t amount, volatile int32_t* value) {
|
inline int32_t atomic_exchange_add(int32_t amount, volatile int32_t* value) {
|
||||||
return __sync_fetch_and_add(amount, value);
|
return __sync_fetch_and_add(value, amount);
|
||||||
}
|
}
|
||||||
inline int64_t atomic_exchange_add(int64_t amount, volatile int64_t* value) {
|
inline int64_t atomic_exchange_add(int64_t amount, volatile int64_t* value) {
|
||||||
return __sync_fetch_and_add(amount, value);
|
return __sync_fetch_and_add(value, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool atomic_cas(int32_t old_value, int32_t new_value,
|
inline bool atomic_cas(int32_t old_value, int32_t new_value,
|
||||||
|
|
|
@ -31,15 +31,7 @@ namespace xe {
|
||||||
do { \
|
do { \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#if XE_COMPILER_GNUC
|
void log_line(const char level_char, const char* fmt, ...);
|
||||||
#define XE_LOG_LINE_ATTRIBUTE __attribute__((format(printf, 5, 6)))
|
|
||||||
#else
|
|
||||||
#define XE_LOG_LINE_ATTRIBUTE
|
|
||||||
#endif // XE_COMPILER_GNUC
|
|
||||||
void log_line(const char level_char, const char* fmt,
|
|
||||||
...) XE_LOG_LINE_ATTRIBUTE;
|
|
||||||
#undef XE_LOG_LINE_ATTRIBUTE
|
|
||||||
|
|
||||||
void handle_fatal(const char* fmt, ...);
|
void handle_fatal(const char* fmt, ...);
|
||||||
|
|
||||||
#if XE_OPTION_ENABLE_LOGGING
|
#if XE_OPTION_ENABLE_LOGGING
|
||||||
|
|
|
@ -39,11 +39,11 @@ std::unique_ptr<MappedMemory> MappedMemory::Open(const std::wstring& path,
|
||||||
const char* mode_str;
|
const char* mode_str;
|
||||||
int prot;
|
int prot;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case Mode::READ:
|
case Mode::kRead:
|
||||||
mode_str = "rb";
|
mode_str = "rb";
|
||||||
prot = PROT_READ;
|
prot = PROT_READ;
|
||||||
break;
|
break;
|
||||||
case Mode::READ_WRITE:
|
case Mode::kReadWrite:
|
||||||
mode_str = "r+b";
|
mode_str = "r+b";
|
||||||
prot = PROT_READ | PROT_WRITE;
|
prot = PROT_READ | PROT_WRITE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9,20 +9,34 @@
|
||||||
|
|
||||||
#include "xenia/base/string.h"
|
#include "xenia/base/string.h"
|
||||||
|
|
||||||
|
// TODO(benvanik): when GCC finally gets codecvt, use that.
|
||||||
|
#if XE_PLATFORM_LINUX
|
||||||
|
#define NO_CODECVT 1
|
||||||
|
#else
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
#endif // XE_PLATFORM_LINUX
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
|
||||||
std::string to_string(const std::wstring& source) {
|
std::string to_string(const std::wstring& source) {
|
||||||
|
#if NO_CODECVT
|
||||||
|
return std::string(source.begin(), source.end());
|
||||||
|
#else
|
||||||
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
||||||
return converter.to_bytes(source);
|
return converter.to_bytes(source);
|
||||||
|
#endif // XE_PLATFORM_LINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring to_wstring(const std::string& source) {
|
std::wstring to_wstring(const std::string& source) {
|
||||||
|
#if NO_CODECVT
|
||||||
|
return std::wstring(source.begin(), source.end());
|
||||||
|
#else
|
||||||
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
||||||
return converter.from_bytes(source);
|
return converter.from_bytes(source);
|
||||||
|
#endif // XE_PLATFORM_LINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string::size_type find_first_of_case(const std::string& target,
|
std::string::size_type find_first_of_case(const std::string& target,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2015 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xenia/base/threading.h"
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
namespace threading {
|
||||||
|
|
||||||
|
void MaybeYield() { pthread_yield(); }
|
||||||
|
|
||||||
|
} // namespace threading
|
||||||
|
} // namespace xe
|
|
@ -30,8 +30,6 @@ void set_name(std::thread::native_handle_type handle, const std::string& name) {
|
||||||
pthread_setname_np(pthread_self(), name.c_str());
|
pthread_setname_np(pthread_self(), name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaybeYield() { pthread_yield_np(); }
|
|
||||||
|
|
||||||
void Sleep(std::chrono::microseconds duration) {
|
void Sleep(std::chrono::microseconds duration) {
|
||||||
timespec rqtp = {duration.count() / 1000000, duration.count() % 1000};
|
timespec rqtp = {duration.count() / 1000000, duration.count() % 1000};
|
||||||
nanosleep(&rqtp, nullptr);
|
nanosleep(&rqtp, nullptr);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "xenia/cpu/backend/x64/x64_assembler.h"
|
#include "xenia/cpu/backend/x64/x64_assembler.h"
|
||||||
|
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
#include "third_party/capstone/include/capstone.h"
|
#include "third_party/capstone/include/capstone.h"
|
||||||
#include "third_party/capstone/include/x86.h"
|
#include "third_party/capstone/include/x86.h"
|
||||||
#include "xenia/base/reset_scope.h"
|
#include "xenia/base/reset_scope.h"
|
||||||
|
|
|
@ -61,10 +61,10 @@ bool X64Backend::Initialize() {
|
||||||
machine_info_.supports_extended_load_store = false;
|
machine_info_.supports_extended_load_store = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
machine_info_.register_sets[0] = {
|
machine_info_.register_sets[0] = (MachineInfo::RegisterSet){
|
||||||
0, "gpr", MachineInfo::RegisterSet::INT_TYPES, X64Emitter::GPR_COUNT,
|
0, "gpr", MachineInfo::RegisterSet::INT_TYPES, X64Emitter::GPR_COUNT,
|
||||||
};
|
};
|
||||||
machine_info_.register_sets[1] = {
|
machine_info_.register_sets[1] = (MachineInfo::RegisterSet){
|
||||||
1, "xmm", MachineInfo::RegisterSet::FLOAT_TYPES |
|
1, "xmm", MachineInfo::RegisterSet::FLOAT_TYPES |
|
||||||
MachineInfo::RegisterSet::VEC_TYPES,
|
MachineInfo::RegisterSet::VEC_TYPES,
|
||||||
X64Emitter::XMM_COUNT,
|
X64Emitter::XMM_COUNT,
|
||||||
|
|
|
@ -2019,7 +2019,7 @@ struct LOAD_MMIO_I32
|
||||||
auto read_address = uint32_t(i.src2.value);
|
auto read_address = uint32_t(i.src2.value);
|
||||||
e.mov(e.r8, uint64_t(mmio_range->callback_context));
|
e.mov(e.r8, uint64_t(mmio_range->callback_context));
|
||||||
e.mov(e.r9d, read_address);
|
e.mov(e.r9d, read_address);
|
||||||
e.CallNativeSafe(mmio_range->read);
|
e.CallNativeSafe(reinterpret_cast<void*>(mmio_range->read));
|
||||||
e.bswap(e.eax);
|
e.bswap(e.eax);
|
||||||
e.mov(i.dest, e.eax);
|
e.mov(i.dest, e.eax);
|
||||||
if (IsTracingData()) {
|
if (IsTracingData()) {
|
||||||
|
@ -2050,7 +2050,7 @@ struct STORE_MMIO_I32
|
||||||
e.mov(e.r10d, i.src3);
|
e.mov(e.r10d, i.src3);
|
||||||
e.bswap(e.r10d);
|
e.bswap(e.r10d);
|
||||||
}
|
}
|
||||||
e.CallNativeSafe(mmio_range->write);
|
e.CallNativeSafe(reinterpret_cast<void*>(mmio_range->write));
|
||||||
if (IsTracingData()) {
|
if (IsTracingData()) {
|
||||||
if (i.src3.is_constant) {
|
if (i.src3.is_constant) {
|
||||||
e.mov(e.r8d, i.src3.constant());
|
e.mov(e.r8d, i.src3.constant());
|
||||||
|
@ -6461,7 +6461,7 @@ struct PACK : Sequence<PACK, I<OPCODE_PACK, V128Op, V128Op, V128Op>> {
|
||||||
e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMPackFLOAT16_2));
|
e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMPackFLOAT16_2));
|
||||||
} else {
|
} else {
|
||||||
e.lea(e.r8, e.StashXmm(0, i.src1));
|
e.lea(e.r8, e.StashXmm(0, i.src1));
|
||||||
e.CallNativeSafe(EmulateFLOAT16_2);
|
e.CallNativeSafe(reinterpret_cast<void*>(EmulateFLOAT16_2));
|
||||||
e.vmovaps(i.dest, e.xmm0);
|
e.vmovaps(i.dest, e.xmm0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6488,7 +6488,7 @@ struct PACK : Sequence<PACK, I<OPCODE_PACK, V128Op, V128Op, V128Op>> {
|
||||||
e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMPackFLOAT16_4));
|
e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMPackFLOAT16_4));
|
||||||
} else {
|
} else {
|
||||||
e.lea(e.r8, e.StashXmm(0, i.src1));
|
e.lea(e.r8, e.StashXmm(0, i.src1));
|
||||||
e.CallNativeSafe(EmulateFLOAT16_4);
|
e.CallNativeSafe(reinterpret_cast<void*>(EmulateFLOAT16_4));
|
||||||
e.vmovaps(i.dest, e.xmm0);
|
e.vmovaps(i.dest, e.xmm0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6787,7 +6787,7 @@ struct UNPACK : Sequence<UNPACK, I<OPCODE_UNPACK, V128Op, V128Op>> {
|
||||||
e.vpor(i.dest, e.GetXmmConstPtr(XMM0001));
|
e.vpor(i.dest, e.GetXmmConstPtr(XMM0001));
|
||||||
} else {
|
} else {
|
||||||
e.lea(e.r8, e.StashXmm(0, i.src1));
|
e.lea(e.r8, e.StashXmm(0, i.src1));
|
||||||
e.CallNativeSafe(EmulateFLOAT16_2);
|
e.CallNativeSafe(reinterpret_cast<void*>(EmulateFLOAT16_2));
|
||||||
e.vmovaps(i.dest, e.xmm0);
|
e.vmovaps(i.dest, e.xmm0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6821,7 +6821,7 @@ struct UNPACK : Sequence<UNPACK, I<OPCODE_UNPACK, V128Op, V128Op>> {
|
||||||
e.vcvtph2ps(i.dest, i.dest);
|
e.vcvtph2ps(i.dest, i.dest);
|
||||||
} else {
|
} else {
|
||||||
e.lea(e.r8, e.StashXmm(0, i.src1));
|
e.lea(e.r8, e.StashXmm(0, i.src1));
|
||||||
e.CallNativeSafe(EmulateFLOAT16_4);
|
e.CallNativeSafe(reinterpret_cast<void*>(EmulateFLOAT16_4));
|
||||||
e.vmovaps(i.dest, e.xmm0);
|
e.vmovaps(i.dest, e.xmm0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "xenia/base/vec128.h"
|
#include "xenia/base/vec128.h"
|
||||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||||
#include "xenia/cpu/processor.h"
|
#include "xenia/cpu/processor.h"
|
||||||
|
@ -61,35 +63,36 @@ void TraceString(void* raw_context, const char* str) {
|
||||||
|
|
||||||
void TraceContextLoadI8(void* raw_context, uint64_t offset, uint8_t value) {
|
void TraceContextLoadI8(void* raw_context, uint64_t offset, uint8_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%d (%X) = ctx i8 +%llu\n", (int8_t)value, value, offset);
|
DPRINT("%d (%X) = ctx i8 +%" PRIu64 "\n", (int8_t)value, value, offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadI16(void* raw_context, uint64_t offset, uint16_t value) {
|
void TraceContextLoadI16(void* raw_context, uint64_t offset, uint16_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%d (%X) = ctx i16 +%llu\n", (int16_t)value, value, offset);
|
DPRINT("%d (%X) = ctx i16 +%" PRIu64 "\n", (int16_t)value, value, offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadI32(void* raw_context, uint64_t offset, uint32_t value) {
|
void TraceContextLoadI32(void* raw_context, uint64_t offset, uint32_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%d (%X) = ctx i32 +%llu\n", (int32_t)value, value, offset);
|
DPRINT("%d (%X) = ctx i32 +%" PRIu64 "\n", (int32_t)value, value, offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadI64(void* raw_context, uint64_t offset, uint64_t value) {
|
void TraceContextLoadI64(void* raw_context, uint64_t offset, uint64_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%lld (%llX) = ctx i64 +%llu\n", (int64_t)value, value, offset);
|
DPRINT("%" PRId64 " (%" PRIX64 ") = ctx i64 +%" PRIu64 "\n", (int64_t)value,
|
||||||
|
value, offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadF32(void* raw_context, uint64_t offset, __m128 value) {
|
void TraceContextLoadF32(void* raw_context, uint64_t offset, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%e (%X) = ctx f32 +%llu\n", xe::m128_f32<0>(value),
|
DPRINT("%e (%X) = ctx f32 +%" PRIu64 "\n", xe::m128_f32<0>(value),
|
||||||
xe::m128_i32<0>(value), offset);
|
xe::m128_i32<0>(value), offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadF64(void* raw_context, uint64_t offset,
|
void TraceContextLoadF64(void* raw_context, uint64_t offset,
|
||||||
const double* value) {
|
const double* value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
auto v = _mm_loadu_pd(value);
|
auto v = _mm_loadu_pd(value);
|
||||||
DPRINT("%le (%llX) = ctx f64 +%llu\n", xe::m128_f64<0>(v), xe::m128_i64<0>(v),
|
DPRINT("%le (%" PRIX64 ") = ctx f64 +%" PRIu64 "\n", xe::m128_f64<0>(v),
|
||||||
offset);
|
xe::m128_i64<0>(v), offset);
|
||||||
}
|
}
|
||||||
void TraceContextLoadV128(void* raw_context, uint64_t offset, __m128 value) {
|
void TraceContextLoadV128(void* raw_context, uint64_t offset, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("[%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X] = ctx v128 +%llu\n",
|
DPRINT("[%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X] = ctx v128 +%" PRIu64 "\n",
|
||||||
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
||||||
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
||||||
xe::m128_i32<2>(value), xe::m128_i32<3>(value), offset);
|
xe::m128_i32<2>(value), xe::m128_i32<3>(value), offset);
|
||||||
|
@ -97,38 +100,40 @@ void TraceContextLoadV128(void* raw_context, uint64_t offset, __m128 value) {
|
||||||
|
|
||||||
void TraceContextStoreI8(void* raw_context, uint64_t offset, uint8_t value) {
|
void TraceContextStoreI8(void* raw_context, uint64_t offset, uint8_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx i8 +%llu = %d (%X)\n", offset, (int8_t)value, value);
|
DPRINT("ctx i8 +%" PRIu64 " = %d (%X)\n", offset, (int8_t)value, value);
|
||||||
}
|
}
|
||||||
void TraceContextStoreI16(void* raw_context, uint64_t offset, uint16_t value) {
|
void TraceContextStoreI16(void* raw_context, uint64_t offset, uint16_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx i16 +%llu = %d (%X)\n", offset, (int16_t)value, value);
|
DPRINT("ctx i16 +%" PRIu64 " = %d (%X)\n", offset, (int16_t)value, value);
|
||||||
}
|
}
|
||||||
void TraceContextStoreI32(void* raw_context, uint64_t offset, uint32_t value) {
|
void TraceContextStoreI32(void* raw_context, uint64_t offset, uint32_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx i32 +%llu = %d (%X)\n", offset, (int32_t)value, value);
|
DPRINT("ctx i32 +%" PRIu64 " = %d (%X)\n", offset, (int32_t)value, value);
|
||||||
}
|
}
|
||||||
void TraceContextStoreI64(void* raw_context, uint64_t offset, uint64_t value) {
|
void TraceContextStoreI64(void* raw_context, uint64_t offset, uint64_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx i64 +%llu = %lld (%llX)\n", offset, (int64_t)value, value);
|
DPRINT("ctx i64 +%" PRIu64 " = %" PRId64 " (%" PRIX64 ")\n", offset,
|
||||||
|
(int64_t)value, value);
|
||||||
}
|
}
|
||||||
void TraceContextStoreF32(void* raw_context, uint64_t offset, __m128 value) {
|
void TraceContextStoreF32(void* raw_context, uint64_t offset, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx f32 +%llu = %e (%X)\n", offset, xe::m128_f32<0>(value),
|
DPRINT("ctx f32 +%" PRIu64 " = %e (%X)\n", offset, xe::m128_f32<0>(value),
|
||||||
xe::m128_i32<0>(value));
|
xe::m128_i32<0>(value));
|
||||||
}
|
}
|
||||||
void TraceContextStoreF64(void* raw_context, uint64_t offset,
|
void TraceContextStoreF64(void* raw_context, uint64_t offset,
|
||||||
const double* value) {
|
const double* value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
auto v = _mm_loadu_pd(value);
|
auto v = _mm_loadu_pd(value);
|
||||||
DPRINT("ctx f64 +%llu = %le (%llX)\n", offset, xe::m128_f64<0>(v),
|
DPRINT("ctx f64 +%" PRIu64 " = %le (%" PRIX64 ")\n", offset,
|
||||||
xe::m128_i64<0>(v));
|
xe::m128_f64<0>(v), xe::m128_i64<0>(v));
|
||||||
}
|
}
|
||||||
void TraceContextStoreV128(void* raw_context, uint64_t offset, __m128 value) {
|
void TraceContextStoreV128(void* raw_context, uint64_t offset, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("ctx v128 +%llu = [%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X]\n", offset,
|
DPRINT("ctx v128 +%" PRIu64 " = [%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X]\n",
|
||||||
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
offset, xe::m128_f32<0>(value), xe::m128_f32<1>(value),
|
||||||
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
xe::m128_f32<2>(value), xe::m128_f32<3>(value), xe::m128_i32<0>(value),
|
||||||
xe::m128_i32<2>(value), xe::m128_i32<3>(value));
|
xe::m128_i32<1>(value), xe::m128_i32<2>(value),
|
||||||
|
xe::m128_i32<3>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceMemoryLoadI8(void* raw_context, uint32_t address, uint8_t value) {
|
void TraceMemoryLoadI8(void* raw_context, uint32_t address, uint8_t value) {
|
||||||
|
@ -145,7 +150,8 @@ void TraceMemoryLoadI32(void* raw_context, uint32_t address, uint32_t value) {
|
||||||
}
|
}
|
||||||
void TraceMemoryLoadI64(void* raw_context, uint32_t address, uint64_t value) {
|
void TraceMemoryLoadI64(void* raw_context, uint32_t address, uint64_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%lld (%llX) = load.i64 %.8X\n", (int64_t)value, value, address);
|
DPRINT("%" PRId64 " (%" PRIX64 ") = load.i64 %.8X\n", (int64_t)value, value,
|
||||||
|
address);
|
||||||
}
|
}
|
||||||
void TraceMemoryLoadF32(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryLoadF32(void* raw_context, uint32_t address, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
|
@ -154,7 +160,7 @@ void TraceMemoryLoadF32(void* raw_context, uint32_t address, __m128 value) {
|
||||||
}
|
}
|
||||||
void TraceMemoryLoadF64(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryLoadF64(void* raw_context, uint32_t address, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("%le (%llX) = load.f64 %.8X\n", xe::m128_f64<0>(value),
|
DPRINT("%le (%" PRIX64 ") = load.f64 %.8X\n", xe::m128_f64<0>(value),
|
||||||
xe::m128_i64<0>(value), address);
|
xe::m128_i64<0>(value), address);
|
||||||
}
|
}
|
||||||
void TraceMemoryLoadV128(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryLoadV128(void* raw_context, uint32_t address, __m128 value) {
|
||||||
|
@ -179,7 +185,8 @@ void TraceMemoryStoreI32(void* raw_context, uint32_t address, uint32_t value) {
|
||||||
}
|
}
|
||||||
void TraceMemoryStoreI64(void* raw_context, uint32_t address, uint64_t value) {
|
void TraceMemoryStoreI64(void* raw_context, uint32_t address, uint64_t value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("store.i64 %.8X = %lld (%llX)\n", address, (int64_t)value, value);
|
DPRINT("store.i64 %.8X = %" PRId64 " (%" PRIX64 ")\n", address,
|
||||||
|
(int64_t)value, value);
|
||||||
}
|
}
|
||||||
void TraceMemoryStoreF32(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryStoreF32(void* raw_context, uint32_t address, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
|
@ -188,8 +195,8 @@ void TraceMemoryStoreF32(void* raw_context, uint32_t address, __m128 value) {
|
||||||
}
|
}
|
||||||
void TraceMemoryStoreF64(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryStoreF64(void* raw_context, uint32_t address, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
DPRINT("store.f64 %.8X = %le (%llX)\n", address, xe::m128_f64<0>(value),
|
DPRINT("store.f64 %.8X = %le (%" PRIX64 ")\n", address,
|
||||||
xe::m128_i64<0>(value));
|
xe::m128_f64<0>(value), xe::m128_i64<0>(value));
|
||||||
}
|
}
|
||||||
void TraceMemoryStoreV128(void* raw_context, uint32_t address, __m128 value) {
|
void TraceMemoryStoreV128(void* raw_context, uint32_t address, __m128 value) {
|
||||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||||
|
|
|
@ -79,7 +79,7 @@ bool ElfModule::Load(const std::string& name, const std::string& path,
|
||||||
XELOGE(
|
XELOGE(
|
||||||
"ELF: Could not load ELF because target machine is not PPC! (target: "
|
"ELF: Could not load ELF because target machine is not PPC! (target: "
|
||||||
"%d)",
|
"%d)",
|
||||||
hdr->e_machine);
|
uint32_t(hdr->e_machine));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ bool ElfModule::Load(const std::string& name, const std::string& path,
|
||||||
// Allocate and copy into memory.
|
// Allocate and copy into memory.
|
||||||
// Base address @ 0x80000000
|
// Base address @ 0x80000000
|
||||||
uint32_t virtual_addr = phdr[i].p_vaddr < 0x80000000
|
uint32_t virtual_addr = phdr[i].p_vaddr < 0x80000000
|
||||||
? phdr[i].p_vaddr + 0x80000000
|
? uint32_t(phdr[i].p_vaddr) + 0x80000000
|
||||||
: phdr[i].p_vaddr;
|
: uint32_t(phdr[i].p_vaddr);
|
||||||
if (!memory()
|
if (!memory()
|
||||||
->LookupHeap(virtual_addr)
|
->LookupHeap(virtual_addr)
|
||||||
->AllocFixed(
|
->AllocFixed(
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/cpu/frontend/ppc_context.h"
|
#include "xenia/cpu/frontend/ppc_context.h"
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
@ -64,7 +65,7 @@ bool PPCContext::CompareRegWithString(const char* name, const char* value,
|
||||||
if (sscanf(name, "r%d", &n) == 1) {
|
if (sscanf(name, "r%d", &n) == 1) {
|
||||||
uint64_t expected = ParseInt64(value);
|
uint64_t expected = ParseInt64(value);
|
||||||
if (this->r[n] != expected) {
|
if (this->r[n] != expected) {
|
||||||
snprintf(out_value, out_value_size, "%016llX", this->r[n]);
|
snprintf(out_value, out_value_size, "%016" PRIX64, this->r[n]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -98,9 +99,9 @@ void InstrOperand::Dump(std::string& out_str) {
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (imm.is_signed) {
|
if (imm.is_signed) {
|
||||||
snprintf(buffer, max_count, "%lld", (int64_t)imm.value);
|
snprintf(buffer, max_count, "%" PRId64, (int64_t)imm.value);
|
||||||
} else {
|
} else {
|
||||||
snprintf(buffer, max_count, "0x%.16llX", imm.value);
|
snprintf(buffer, max_count, "0x%.16" PRIX64, imm.value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/cpu/hir/hir_builder.h"
|
#include "xenia/cpu/hir/hir_builder.h"
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ void HIRBuilder::DumpValue(StringBuffer* str, Value* value) {
|
||||||
str->AppendFormat("%X", value->constant.i32);
|
str->AppendFormat("%X", value->constant.i32);
|
||||||
break;
|
break;
|
||||||
case INT64_TYPE:
|
case INT64_TYPE:
|
||||||
str->AppendFormat("%llX", value->constant.i64);
|
str->AppendFormat("%" PRIX64, value->constant.i64);
|
||||||
break;
|
break;
|
||||||
case FLOAT32_TYPE:
|
case FLOAT32_TYPE:
|
||||||
str->AppendFormat("%F", value->constant.f32);
|
str->AppendFormat("%F", value->constant.f32);
|
||||||
|
|
|
@ -322,11 +322,23 @@ void Value::MulHi(Value* other, bool is_unsigned) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INT64_TYPE:
|
case INT64_TYPE:
|
||||||
|
#if XE_COMPILER_MSVC
|
||||||
if (is_unsigned) {
|
if (is_unsigned) {
|
||||||
constant.i64 = __umulh(constant.i64, other->constant.i64);
|
constant.i64 = __umulh(constant.i64, other->constant.i64);
|
||||||
} else {
|
} else {
|
||||||
constant.i64 = __mulh(constant.i64, other->constant.i64);
|
constant.i64 = __mulh(constant.i64, other->constant.i64);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (is_unsigned) {
|
||||||
|
constant.i64 = static_cast<uint64_t>(
|
||||||
|
static_cast<unsigned __int128>(constant.i64) *
|
||||||
|
static_cast<unsigned __int128>(other->constant.i64));
|
||||||
|
} else {
|
||||||
|
constant.i64 =
|
||||||
|
static_cast<uint64_t>(static_cast<__int128>(constant.i64) *
|
||||||
|
static_cast<__int128>(other->constant.i64));
|
||||||
|
}
|
||||||
|
#endif // XE_COMPILER_MSVC
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert_unhandled_case(type);
|
assert_unhandled_case(type);
|
||||||
|
@ -440,7 +452,7 @@ void Value::Abs() {
|
||||||
break;
|
break;
|
||||||
case VEC128_TYPE:
|
case VEC128_TYPE:
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
constant.v128.f32[i] = std::fabsf(constant.v128.f32[i]);
|
constant.v128.f32[i] = std::abs(constant.v128.f32[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -452,7 +464,7 @@ void Value::Abs() {
|
||||||
void Value::Sqrt() {
|
void Value::Sqrt() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FLOAT32_TYPE:
|
case FLOAT32_TYPE:
|
||||||
constant.f32 = 1.0f / std::sqrtf(constant.f32);
|
constant.f32 = 1.0f / std::sqrt(constant.f32);
|
||||||
break;
|
break;
|
||||||
case FLOAT64_TYPE:
|
case FLOAT64_TYPE:
|
||||||
constant.f64 = 1.0 / std::sqrt(constant.f64);
|
constant.f64 = 1.0 / std::sqrt(constant.f64);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/cpu/thread_state.h"
|
#include "xenia/cpu/thread_state.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "xenia/base/assert.h"
|
#include "xenia/base/assert.h"
|
||||||
|
@ -85,7 +86,7 @@ ThreadState::ThreadState(Processor* processor, uint32_t thread_id,
|
||||||
|
|
||||||
// Allocate with 64b alignment.
|
// Allocate with 64b alignment.
|
||||||
context_ =
|
context_ =
|
||||||
reinterpret_cast<PPCContext*>(_aligned_malloc(sizeof(PPCContext), 64));
|
reinterpret_cast<PPCContext*>(aligned_alloc(64, sizeof(PPCContext)));
|
||||||
assert_true(((uint64_t)context_ & 0x3F) == 0);
|
assert_true(((uint64_t)context_ & 0x3F) == 0);
|
||||||
std::memset(context_, 0, sizeof(PPCContext));
|
std::memset(context_, 0, sizeof(PPCContext));
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ ThreadState::~ThreadState() {
|
||||||
thread_state_ = nullptr;
|
thread_state_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_aligned_free(context_);
|
free(context_);
|
||||||
if (stack_allocated_) {
|
if (stack_allocated_) {
|
||||||
memory()->LookupHeap(stack_address_)->Decommit(stack_address_, stack_size_);
|
memory()->LookupHeap(stack_address_)->Decommit(stack_address_, stack_size_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define XENIA_GPU_REGISTER_FILE_H_
|
#define XENIA_GPU_REGISTER_FILE_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/gpu/sampler_info.h"
|
#include "xenia/gpu/sampler_info.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "third_party/xxhash/xxhash.h"
|
#include "third_party/xxhash/xxhash.h"
|
||||||
|
|
|
@ -187,8 +187,8 @@ void TextureInfo::CalculateTextureSizes2D(const xe_gpu_texture_fetch_t& fetch) {
|
||||||
format_info->block_height;
|
format_info->block_height;
|
||||||
|
|
||||||
// Tiles are 32x32 blocks. All textures must be multiples of tile dimensions.
|
// Tiles are 32x32 blocks. All textures must be multiples of tile dimensions.
|
||||||
uint32_t tile_width = uint32_t(std::ceilf(block_width / 32.0f));
|
uint32_t tile_width = uint32_t(std::ceil(block_width / 32.0f));
|
||||||
uint32_t tile_height = uint32_t(std::ceilf(block_height / 32.0f));
|
uint32_t tile_height = uint32_t(std::ceil(block_height / 32.0f));
|
||||||
size_2d.block_width = tile_width * 32;
|
size_2d.block_width = tile_width * 32;
|
||||||
size_2d.block_height = tile_height * 32;
|
size_2d.block_height = tile_height * 32;
|
||||||
|
|
||||||
|
@ -229,8 +229,8 @@ void TextureInfo::CalculateTextureSizesCube(
|
||||||
format_info->block_height;
|
format_info->block_height;
|
||||||
|
|
||||||
// Tiles are 32x32 blocks. All textures must be multiples of tile dimensions.
|
// Tiles are 32x32 blocks. All textures must be multiples of tile dimensions.
|
||||||
uint32_t tile_width = uint32_t(std::ceilf(block_width / 32.0f));
|
uint32_t tile_width = uint32_t(std::ceil(block_width / 32.0f));
|
||||||
uint32_t tile_height = uint32_t(std::ceilf(block_height / 32.0f));
|
uint32_t tile_height = uint32_t(std::ceil(block_height / 32.0f));
|
||||||
size_cube.block_width = tile_width * 32;
|
size_cube.block_width = tile_width * 32;
|
||||||
size_cube.block_height = tile_height * 32;
|
size_cube.block_height = tile_height * 32;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef XENIA_GPU_TEXTURE_INFO_H_
|
#ifndef XENIA_GPU_TEXTURE_INFO_H_
|
||||||
#define XENIA_GPU_TEXTURE_INFO_H_
|
#define XENIA_GPU_TEXTURE_INFO_H_
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "xenia/base/assert.h"
|
#include "xenia/base/assert.h"
|
||||||
|
|
|
@ -44,16 +44,10 @@ struct X_LDR_DATA_TABLE_ENTRY {
|
||||||
xe::be<uint32_t> time_date_stamp; // 0x50
|
xe::be<uint32_t> time_date_stamp; // 0x50
|
||||||
xe::be<uint32_t> loaded_imports; // 0x54
|
xe::be<uint32_t> loaded_imports; // 0x54
|
||||||
xe::be<uint32_t> xex_header_base; // 0x58
|
xe::be<uint32_t> xex_header_base; // 0x58
|
||||||
|
// X_ANSI_STRING load_file_name; // 0x5C
|
||||||
union {
|
|
||||||
X_ANSI_STRING load_file_name; // 0x5C
|
|
||||||
|
|
||||||
struct {
|
|
||||||
xe::be<uint32_t> closure_root; // 0x5C
|
xe::be<uint32_t> closure_root; // 0x5C
|
||||||
xe::be<uint32_t> traversal_parent; // 0x60
|
xe::be<uint32_t> traversal_parent; // 0x60
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class XModule : public XObject {
|
class XModule : public XObject {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -189,7 +189,7 @@ class XThread : public XObject {
|
||||||
int32_t priority_ = 0;
|
int32_t priority_ = 0;
|
||||||
uint32_t affinity_ = 0;
|
uint32_t affinity_ = 0;
|
||||||
|
|
||||||
std::atomic<uint32_t> irql_ = 0;
|
std::atomic<uint32_t> irql_ = {0};
|
||||||
xe::mutex apc_lock_;
|
xe::mutex apc_lock_;
|
||||||
NativeList* apc_list_ = nullptr;
|
NativeList* apc_list_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -405,7 +405,7 @@ struct xe_xex2_loader_info_t {
|
||||||
xe_xex2_media_flags media_flags;
|
xe_xex2_media_flags media_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum xe_xex2_section_type : uint32_t {
|
enum xe_xex2_section_type {
|
||||||
XEX_SECTION_CODE = 1,
|
XEX_SECTION_CODE = 1,
|
||||||
XEX_SECTION_DATA = 2,
|
XEX_SECTION_DATA = 2,
|
||||||
XEX_SECTION_READONLY_DATA = 3,
|
XEX_SECTION_READONLY_DATA = 3,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "xenia/base/threading.h"
|
#include "xenia/base/threading.h"
|
||||||
|
@ -162,10 +163,7 @@ class XObject {
|
||||||
int32_t as_type = -1);
|
int32_t as_type = -1);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static object_ref<T> GetNativeObject(KernelState* kernel_state,
|
static object_ref<T> GetNativeObject(KernelState* kernel_state,
|
||||||
void* native_ptr, int32_t as_type = -1) {
|
void* native_ptr, int32_t as_type = -1);
|
||||||
return object_ref<T>(reinterpret_cast<T*>(
|
|
||||||
GetNativeObject(kernel_state, native_ptr, as_type).release()));
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual xe::threading::WaitHandle* GetWaitHandle() { return nullptr; }
|
virtual xe::threading::WaitHandle* GetWaitHandle() { return nullptr; }
|
||||||
|
|
||||||
|
@ -208,9 +206,9 @@ template <typename T>
|
||||||
class object_ref {
|
class object_ref {
|
||||||
public:
|
public:
|
||||||
object_ref() noexcept : value_(nullptr) {}
|
object_ref() noexcept : value_(nullptr) {}
|
||||||
object_ref(nullptr_t) noexcept // NOLINT(runtime/explicit)
|
object_ref(std::nullptr_t) noexcept // NOLINT(runtime/explicit)
|
||||||
: value_(nullptr) {}
|
: value_(nullptr) {}
|
||||||
object_ref& operator=(nullptr_t) noexcept {
|
object_ref& operator=(std::nullptr_t) noexcept {
|
||||||
reset();
|
reset();
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
@ -250,9 +248,7 @@ class object_ref {
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(object_ref& right) noexcept {
|
void swap(object_ref& right) noexcept { std::swap(value_, right.value_); }
|
||||||
std::_Swap_adl(value_, right.value_);
|
|
||||||
}
|
|
||||||
|
|
||||||
~object_ref() noexcept {
|
~object_ref() noexcept {
|
||||||
if (value_) {
|
if (value_) {
|
||||||
|
@ -298,22 +294,22 @@ class object_ref {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Ty>
|
template <class _Ty>
|
||||||
bool operator==(const object_ref<_Ty>& _Left, nullptr_t) noexcept {
|
bool operator==(const object_ref<_Ty>& _Left, std::nullptr_t) noexcept {
|
||||||
return (_Left.get() == reinterpret_cast<_Ty*>(0));
|
return (_Left.get() == reinterpret_cast<_Ty*>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty>
|
template <class _Ty>
|
||||||
bool operator==(nullptr_t, const object_ref<_Ty>& _Right) noexcept {
|
bool operator==(std::nullptr_t, const object_ref<_Ty>& _Right) noexcept {
|
||||||
return (reinterpret_cast<_Ty*>(0) == _Right.get());
|
return (reinterpret_cast<_Ty*>(0) == _Right.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty>
|
template <class _Ty>
|
||||||
bool operator!=(const object_ref<_Ty>& _Left, nullptr_t _Right) noexcept {
|
bool operator!=(const object_ref<_Ty>& _Left, std::nullptr_t _Right) noexcept {
|
||||||
return (!(_Left == _Right));
|
return (!(_Left == _Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty>
|
template <class _Ty>
|
||||||
bool operator!=(nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
|
bool operator!=(std::nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
|
||||||
return (!(_Left == _Right));
|
return (!(_Left == _Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +319,13 @@ object_ref<T> retain_object(T* ptr) {
|
||||||
return object_ref<T>(ptr);
|
return object_ref<T>(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
object_ref<T> XObject::GetNativeObject(KernelState* kernel_state,
|
||||||
|
void* native_ptr, int32_t as_type) {
|
||||||
|
return object_ref<T>(reinterpret_cast<T*>(
|
||||||
|
GetNativeObject(kernel_state, native_ptr, as_type).release()));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace kernel
|
} // namespace kernel
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
#define MICROPROFILE_USE_THREAD_NAME_CALLBACK 1
|
#define MICROPROFILE_USE_THREAD_NAME_CALLBACK 1
|
||||||
#define MICROPROFILE_WEBSERVER_MAXFRAMES 3
|
#define MICROPROFILE_WEBSERVER_MAXFRAMES 3
|
||||||
#define MICROPROFILE_PRINTF XELOGI
|
#define MICROPROFILE_PRINTF XELOGI
|
||||||
#define MICROPROFILE_WEBSERVER 1
|
#define MICROPROFILE_WEBSERVER 0
|
||||||
#define MICROPROFILE_DEBUG 0
|
#define MICROPROFILE_DEBUG 0
|
||||||
#if MICROPROFILE_WEBSERVER
|
|
||||||
#include <winsock.h> // NOLINT(build/include_order)
|
|
||||||
#endif // MICROPROFILE_WEBSERVER
|
|
||||||
#include "third_party/microprofile/microprofile.h"
|
#include "third_party/microprofile/microprofile.h"
|
||||||
#include "third_party/microprofile/microprofileui.h"
|
|
||||||
|
|
||||||
#include "xenia/profiling.h"
|
#include "xenia/profiling.h"
|
||||||
|
|
||||||
|
#if XE_OPTION_PROFILING
|
||||||
|
#include "third_party/microprofile/microprofileui.h"
|
||||||
|
#endif // XE_OPTION_PROFILING
|
||||||
|
|
||||||
DEFINE_bool(show_profiler, false, "Show profiling UI by default.");
|
DEFINE_bool(show_profiler, false, "Show profiling UI by default.");
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
|
|
@ -14,9 +14,11 @@
|
||||||
|
|
||||||
#include "xenia/base/string.h"
|
#include "xenia/base/string.h"
|
||||||
|
|
||||||
#define XE_OPTION_PROFILING 1
|
|
||||||
#if XE_PLATFORM_WIN32
|
#if XE_PLATFORM_WIN32
|
||||||
|
#define XE_OPTION_PROFILING 1
|
||||||
#define XE_OPTION_PROFILING_UI 1
|
#define XE_OPTION_PROFILING_UI 1
|
||||||
|
#else
|
||||||
|
#define XE_OPTION_PROFILING 0
|
||||||
#endif // XE_PLATFORM_WIN32
|
#endif // XE_PLATFORM_WIN32
|
||||||
|
|
||||||
#if XE_OPTION_PROFILING
|
#if XE_OPTION_PROFILING
|
||||||
|
@ -115,8 +117,10 @@ namespace xe {
|
||||||
do { \
|
do { \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
|
#ifndef MICROPROFILE_TEXT_WIDTH
|
||||||
#define MICROPROFILE_TEXT_WIDTH 1
|
#define MICROPROFILE_TEXT_WIDTH 1
|
||||||
#define MICROPROFILE_TEXT_HEIGHT 1
|
#define MICROPROFILE_TEXT_HEIGHT 1
|
||||||
|
#endif // !MICROPROFILE_TEXT_WIDTH
|
||||||
|
|
||||||
#endif // XE_OPTION_PROFILING
|
#endif // XE_OPTION_PROFILING
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/ui/gl/gl4_elemental_renderer.h"
|
#include "xenia/ui/gl/gl4_elemental_renderer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "third_party/microprofile/microprofile.h"
|
||||||
#include "third_party/microprofile/microprofileui.h"
|
#include "third_party/microprofile/microprofileui.h"
|
||||||
|
|
||||||
#include "xenia/base/assert.h"
|
#include "xenia/base/assert.h"
|
||||||
|
|
|
@ -198,7 +198,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries(
|
||||||
size_t remaining_size = file_size;
|
size_t remaining_size = file_size;
|
||||||
uint32_t info = 0x80;
|
uint32_t info = 0x80;
|
||||||
while (remaining_size && block_index && info >= 0x80) {
|
while (remaining_size && block_index && info >= 0x80) {
|
||||||
size_t block_size = std::min(0x1000ull, remaining_size);
|
size_t block_size =
|
||||||
|
std::min(static_cast<size_t>(0x1000), remaining_size);
|
||||||
size_t offset = BlockToOffset(ComputeBlockNumber(block_index));
|
size_t offset = BlockToOffset(ComputeBlockNumber(block_index));
|
||||||
entry->block_list_.push_back({offset, block_size});
|
entry->block_list_.push_back({offset, block_size});
|
||||||
remaining_size -= block_size;
|
remaining_size -= block_size;
|
||||||
|
|
|
@ -10116,7 +10116,8 @@ GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* query opengl extensions string */
|
/* query opengl extensions string */
|
||||||
extStart = glewExperimental ? "" : glGetString(GL_EXTENSIONS);
|
extStart = glewExperimental ? (const GLubyte*)""
|
||||||
|
: (const GLubyte*)glGetString(GL_EXTENSIONS);
|
||||||
if (extStart == 0)
|
if (extStart == 0)
|
||||||
extStart = (const GLubyte*)"";
|
extStart = (const GLubyte*)"";
|
||||||
extEnd = extStart + _glewStrLen(extStart);
|
extEnd = extStart + _glewStrLen(extStart);
|
||||||
|
|
|
@ -41,3 +41,12 @@ project("capstone")
|
||||||
"capstone/arch/X86/*.inc",
|
"capstone/arch/X86/*.inc",
|
||||||
})
|
})
|
||||||
force_compile_as_cc({"capstone/**.c"})
|
force_compile_as_cc({"capstone/**.c"})
|
||||||
|
|
||||||
|
filter("platforms:Linux")
|
||||||
|
-- Capstone code is... not fantastic.
|
||||||
|
buildoptions({
|
||||||
|
"-Wno-error=write-strings",
|
||||||
|
"-Wno-write-string",
|
||||||
|
"-Wno-deprecated",
|
||||||
|
"-w",
|
||||||
|
})
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4fdbd5fe789da92fd5e23240c63ed5aa2cba5ed2
|
Subproject commit 0b0d51fa4afcf00f67770cf52fc4db7abb6a8cbb
|
|
@ -476,8 +476,12 @@ class BaseBuildCommand(Command):
|
||||||
self.parser.add_argument(
|
self.parser.add_argument(
|
||||||
'--force', action='store_true',
|
'--force', action='store_true',
|
||||||
help='Forces a full rebuild.')
|
help='Forces a full rebuild.')
|
||||||
|
self.parser.add_argument(
|
||||||
|
'--no-premake', action='store_true',
|
||||||
|
help='Skips running premake before building.')
|
||||||
|
|
||||||
def execute(self, args, pass_args, cwd):
|
def execute(self, args, pass_args, cwd):
|
||||||
|
if not args['no_premake']:
|
||||||
print('- running premake...')
|
print('- running premake...')
|
||||||
run_platform_premake()
|
run_platform_premake()
|
||||||
print('')
|
print('')
|
||||||
|
@ -500,7 +504,7 @@ class BaseBuildCommand(Command):
|
||||||
else:
|
else:
|
||||||
# TODO(benvanik): allow gcc?
|
# TODO(benvanik): allow gcc?
|
||||||
os.environ['CXX'] = 'clang++-3.8'
|
os.environ['CXX'] = 'clang++-3.8'
|
||||||
os.environ['CC'] = 'clang-3.8'
|
os.environ['CC'] = 'clang++-3.8'
|
||||||
result = shell_call([
|
result = shell_call([
|
||||||
'make',
|
'make',
|
||||||
'-Cbuild/',
|
'-Cbuild/',
|
||||||
|
|
Loading…
Reference in New Issue