xb style.
This commit is contained in:
parent
5e08889d93
commit
14beb27ebc
|
@ -14,10 +14,6 @@
|
|||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::cpu::backend::x64;
|
||||
using namespace xe::cpu;
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef XENIA_CPU_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
#define XENIA_CPU_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/cpu/compiler/compiler_pass.h"
|
||||
|
||||
|
@ -20,7 +22,6 @@
|
|||
#include <llvm/ADT/BitVector.h>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#include <cmath>
|
||||
#include <llvm/ADT/BitVector.h>
|
||||
#endif // XE_COMPILER_MSVC
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_APP_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_APP_H_
|
||||
#ifndef XENIA_KERNEL_APP_H_
|
||||
#define XENIA_KERNEL_APP_H_
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
@ -53,4 +53,4 @@ class XAppManager {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_APP_H_
|
||||
#endif // XENIA_KERNEL_APP_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_
|
||||
#ifndef XENIA_KERNEL_APPS_APPS_H_
|
||||
#define XENIA_KERNEL_APPS_APPS_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
@ -23,4 +23,4 @@ void RegisterApps(KernelState* kernel_state, XAppManager* manager);
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_
|
||||
#endif // XENIA_KERNEL_APPS_APPS_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_
|
||||
#ifndef XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
@ -31,4 +31,4 @@ class XXGIApp : public XApp {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_
|
||||
#endif // XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_
|
||||
#ifndef XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
@ -31,4 +31,4 @@ class XXLiveBaseApp : public XApp {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_
|
||||
#endif // XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_
|
||||
#ifndef XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
@ -112,4 +112,4 @@ class XXMPApp : public XApp {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_
|
||||
#endif // XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_
|
||||
#ifndef XENIA_KERNEL_ASYNC_REQUEST_H_
|
||||
#define XENIA_KERNEL_ASYNC_REQUEST_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -50,4 +50,4 @@ class XAsyncRequest {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_
|
||||
#endif // XENIA_KERNEL_ASYNC_REQUEST_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_
|
||||
#ifndef XENIA_KERNEL_DISPATCHER_H_
|
||||
#define XENIA_KERNEL_DISPATCHER_H_
|
||||
|
||||
#include <mutex>
|
||||
|
||||
|
@ -44,4 +44,4 @@ class Dispatcher {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_
|
||||
#endif // XENIA_KERNEL_DISPATCHER_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_
|
||||
#ifndef XENIA_KERNEL_NATIVE_LIST_H_
|
||||
#define XENIA_KERNEL_NATIVE_LIST_H_
|
||||
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
@ -47,4 +47,4 @@ class NativeList {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_
|
||||
#endif // XENIA_KERNEL_NATIVE_LIST_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECT_TABLE_H_
|
||||
#define XENIA_KERNEL_OBJECT_TABLE_H_
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
@ -74,4 +74,4 @@ class ObjectTable {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_
|
||||
#endif // XENIA_KERNEL_OBJECT_TABLE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
@ -82,4 +82,4 @@ class XStaticEnumerator : public XEnumerator {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XEVENT_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XEVENT_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -44,4 +44,4 @@ class XEvent : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XEVENT_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XFILE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XFILE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
|
@ -130,4 +130,4 @@ class XFile : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XFILE_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
|
@ -35,4 +35,4 @@ class XKernelModule : public XModule {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XMODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XMODULE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -100,4 +100,4 @@ class XModule : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XMODULE_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XMUTANT_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XMUTANT_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -36,4 +36,4 @@ class XMutant : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XMUTANT_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
@ -49,4 +49,4 @@ class XNotifyListener : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XSEMAPHORE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XSEMAPHORE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -43,4 +43,4 @@ class XSemaphore : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XSEMAPHORE_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XTHREAD_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XTHREAD_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XTHREAD_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XTHREAD_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
@ -208,4 +208,4 @@ class XHostThread : public XThread {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XTHREAD_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XTHREAD_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XTIMER_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XTIMER_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XTIMER_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XTIMER_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -41,4 +41,4 @@ class XTimer : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_TIMER_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_TIMER_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -80,4 +80,4 @@ class XUserModule : public XModule {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_
|
||||
#endif // XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_
|
||||
#ifndef XENIA_KERNEL_USER_PROFILE_H_
|
||||
#define XENIA_KERNEL_USER_PROFILE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -196,4 +196,4 @@ class UserProfile {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_
|
||||
#endif // XENIA_KERNEL_USER_PROFILE_H_
|
||||
|
|
|
@ -78,7 +78,7 @@ inline uint64_t get_arg_64(PPCContext* ppc_context, uint8_t index) {
|
|||
uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8);
|
||||
return SHIM_MEM_64(stack_address);
|
||||
}
|
||||
}
|
||||
} // namespace util
|
||||
|
||||
#define SHIM_GET_ARG_8(n) util::get_arg_8(ppc_context, n)
|
||||
#define SHIM_GET_ARG_16(n) util::get_arg_16(ppc_context, n)
|
||||
|
@ -123,7 +123,8 @@ class Param {
|
|||
};
|
||||
template <>
|
||||
inline void Param::LoadValue<float>(Param::Init& init, float* out_value) {
|
||||
*out_value = float(init.ppc_context->f[1 + ++init.float_ordinal]);
|
||||
*out_value =
|
||||
static_cast<float>(init.ppc_context->f[1 + ++init.float_ordinal]);
|
||||
}
|
||||
template <>
|
||||
inline void Param::LoadValue<double>(Param::Init& init, double* out_value) {
|
||||
|
@ -322,10 +323,10 @@ 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", float(param));
|
||||
string_buffer.AppendFormat("%G", static_cast<float>(param));
|
||||
}
|
||||
inline void AppendParam(StringBuffer& string_buffer, double_t param) {
|
||||
string_buffer.AppendFormat("%G", double(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));
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include "third_party/crypto/rijndael-alg-fst.h"
|
||||
#include "third_party/crypto/rijndael-alg-fst.c"
|
||||
#include "third_party/mspack/lzx.h"
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XEX2_INFO_H_
|
||||
#define XENIA_KERNEL_XEX2_INFO_H_
|
||||
#ifndef XENIA_KERNEL_UTIL_XEX2_INFO_H_
|
||||
#define XENIA_KERNEL_UTIL_XEX2_INFO_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -91,7 +91,7 @@ enum xe_xex2_system_flags : uint32_t {
|
|||
XEX_SYSTEM_ALLOW_AVATAR_GET_METADATA_BY_XUID = 0x20000000,
|
||||
XEX_SYSTEM_ALLOW_CONTROLLER_SWAPPING = 0x40000000,
|
||||
XEX_SYSTEM_DASH_EXTENSIBILITY_MODULE = 0x80000000,
|
||||
// TODO: figure out how stored
|
||||
// TODO(benvanik): figure out how stored.
|
||||
/*XEX_SYSTEM_ALLOW_NETWORK_READ_CANCEL = 0x0,
|
||||
XEX_SYSTEM_UNINTERRUPTABLE_READS = 0x0,
|
||||
XEX_SYSTEM_REQUIRE_FULL_EXPERIENCE = 0x0,
|
||||
|
@ -645,4 +645,4 @@ struct X_IMAGE_EXPORT_DIRECTORY {
|
|||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XEX2_INFO_H_
|
||||
#endif // XENIA_KERNEL_UTIL_XEX2_INFO_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_MODULE_H_
|
||||
#define XENIA_KERNEL_MODULE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -41,4 +41,4 @@ class XboxkrnlModule : public XKernelModule {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#endif // XENIA_KERNEL_MODULE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#ifndef XENIA_KERNEL_ORDINALS_H_
|
||||
#define XENIA_KERNEL_ORDINALS_H_
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
|
||||
|
@ -21,4 +21,4 @@ enum {
|
|||
} // namespace ordinals
|
||||
#include "xenia/kernel/util/ordinal_table_post.inc"
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#endif // XENIA_KERNEL_ORDINALS_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#ifndef XENIA_KERNEL_PRIVATE_H_
|
||||
#define XENIA_KERNEL_PRIVATE_H_
|
||||
|
||||
#include "xenia/kernel/xboxkrnl_ordinals.h"
|
||||
|
||||
|
@ -58,4 +58,4 @@ void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#endif // XENIA_KERNEL_PRIVATE_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#ifndef XENIA_KERNEL_RTL_H_
|
||||
#define XENIA_KERNEL_RTL_H_
|
||||
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
|
@ -26,4 +26,4 @@ X_STATUS xeRtlInitializeCriticalSectionAndSpinCount(X_RTL_CRITICAL_SECTION* cs,
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#endif // XENIA_KERNEL_RTL_H_
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XOBJECT_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XOBJECT_H_
|
||||
#ifndef XENIA_KERNEL_XOBJECT_H_
|
||||
#define XENIA_KERNEL_XOBJECT_H_
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
@ -323,4 +323,4 @@ object_ref<T> retain_object(T* ptr) {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XOBJECT_H_
|
||||
#endif // XENIA_KERNEL_XOBJECT_H_
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -35,48 +35,46 @@ Blitter::~Blitter() = default;
|
|||
|
||||
bool Blitter::Initialize() {
|
||||
const std::string header =
|
||||
"\n\
|
||||
#version 450 \n\
|
||||
#extension GL_ARB_explicit_uniform_location : require \n\
|
||||
#extension GL_ARB_shading_language_420pack : require \n\
|
||||
precision highp float; \n\
|
||||
precision highp int; \n\
|
||||
layout(std140, column_major) uniform; \n\
|
||||
layout(std430, column_major) buffer; \n\
|
||||
";
|
||||
R"(
|
||||
#version 450
|
||||
#extension GL_ARB_explicit_uniform_location : require
|
||||
#extension GL_ARB_shading_language_420pack : require
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
layout(std140, column_major) uniform;
|
||||
layout(std430, column_major) buffer;
|
||||
)";
|
||||
const std::string vs_source = header +
|
||||
"\n\
|
||||
layout(location = 0) uniform vec4 src_uv; \n\
|
||||
out gl_PerVertex { \n\
|
||||
vec4 gl_Position; \n\
|
||||
float gl_PointSize; \n\
|
||||
float gl_ClipDistance[]; \n\
|
||||
}; \n\
|
||||
layout(location = 0) in vec2 vfetch_pos; \n\
|
||||
layout(location = 0) out vec2 vtx_uv; \n\
|
||||
void main() { \n\
|
||||
gl_Position = vec4(vfetch_pos.xy * vec2(2.0, -2.0) - vec2(1.0, -1.0), 0.0, 1.0); \n\
|
||||
vtx_uv = vfetch_pos.xy * src_uv.zw + src_uv.xy; \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 0) uniform vec4 src_uv;
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
float gl_PointSize;
|
||||
float gl_ClipDistance[];
|
||||
};
|
||||
layout(location = 0) in vec2 vfetch_pos;
|
||||
layout(location = 0) out vec2 vtx_uv;
|
||||
void main() {
|
||||
gl_Position = vec4(vfetch_pos.xy * vec2(2.0, -2.0) -
|
||||
vec2(1.0, -1.0), 0.0, 1.0);
|
||||
vtx_uv = vfetch_pos.xy * src_uv.zw + src_uv.xy;
|
||||
})";
|
||||
const std::string color_fs_source = header +
|
||||
"\n\
|
||||
layout(location = 1) uniform sampler2D src_texture; \n\
|
||||
layout(location = 0) in vec2 vtx_uv; \n\
|
||||
layout(location = 0) out vec4 oC; \n\
|
||||
void main() { \n\
|
||||
oC = texture(src_texture, vtx_uv); \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 1) uniform sampler2D src_texture;
|
||||
layout(location = 0) in vec2 vtx_uv;
|
||||
layout(location = 0) out vec4 oC;
|
||||
void main() {
|
||||
oC = texture(src_texture, vtx_uv);
|
||||
})";
|
||||
const std::string depth_fs_source = header +
|
||||
"\n\
|
||||
layout(location = 1) uniform sampler2D src_texture; \n\
|
||||
layout(location = 0) in vec2 vtx_uv; \n\
|
||||
layout(location = 0) out vec4 oC; \n\
|
||||
void main() { \n\
|
||||
gl_FragDepth = texture(src_texture, vtx_uv).r; \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 1) uniform sampler2D src_texture;
|
||||
layout(location = 0) in vec2 vtx_uv;
|
||||
layout(location = 0) out vec4 oC;
|
||||
void main() {
|
||||
gl_FragDepth = texture(src_texture, vtx_uv).r;
|
||||
})";
|
||||
|
||||
auto vs_source_str = vs_source.c_str();
|
||||
vertex_program_ = glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &vs_source_str);
|
||||
|
@ -165,7 +163,8 @@ struct SavedState {
|
|||
glGetIntegerv(GL_CULL_FACE_MODE, &cull_face);
|
||||
glGetIntegerv(GL_FRONT_FACE, &front_face);
|
||||
glGetIntegerv(GL_POLYGON_MODE, &polygon_mode);
|
||||
glGetBooleani_v(GL_COLOR_WRITEMASK, 0, (GLboolean*)&color_mask_0_enabled);
|
||||
glGetBooleani_v(GL_COLOR_WRITEMASK, 0,
|
||||
reinterpret_cast<GLboolean*>(&color_mask_0_enabled));
|
||||
blend_0_enabled = glIsEnabledi(GL_BLEND, 0);
|
||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_buffer);
|
||||
glGetFloati_v(GL_VIEWPORT, 0, viewport);
|
||||
|
@ -230,10 +229,11 @@ void Blitter::Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect,
|
|||
GLint src_texture_height;
|
||||
glGetTextureLevelParameteriv(src_texture, 0, GL_TEXTURE_HEIGHT,
|
||||
&src_texture_height);
|
||||
glProgramUniform4f(vertex_program_, 0, src_rect.x / float(src_texture_width),
|
||||
src_rect.y / float(src_texture_height),
|
||||
src_rect.width / float(src_texture_width),
|
||||
src_rect.height / float(src_texture_height));
|
||||
glProgramUniform4f(vertex_program_, 0,
|
||||
src_rect.x / static_cast<float>(src_texture_width),
|
||||
src_rect.y / static_cast<float>(src_texture_height),
|
||||
src_rect.width / static_cast<float>(src_texture_width),
|
||||
src_rect.height / static_cast<float>(src_texture_height));
|
||||
|
||||
// Useful for seeing the entire framebuffer/etc:
|
||||
// glProgramUniform4f(vertex_program_, 0, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "xenia/ui/gl/circular_buffer.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "xenia/ui/gl/gl4_elemental_renderer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "el/graphics/bitmap_fragment.h"
|
||||
#include "el/util/math.h"
|
||||
|
@ -93,45 +94,43 @@ bool GL4ElementalRenderer::Initialize() {
|
|||
}
|
||||
|
||||
const std::string header =
|
||||
"\n\
|
||||
#version 450 \n\
|
||||
#extension GL_ARB_bindless_texture : require \n\
|
||||
#extension GL_ARB_explicit_uniform_location : require \n\
|
||||
#extension GL_ARB_shading_language_420pack : require \n\
|
||||
precision highp float; \n\
|
||||
precision highp int; \n\
|
||||
layout(std140, column_major) uniform; \n\
|
||||
layout(std430, column_major) buffer; \n\
|
||||
";
|
||||
R"(
|
||||
#version 450
|
||||
#extension GL_ARB_bindless_texture : require
|
||||
#extension GL_ARB_explicit_uniform_location : require
|
||||
#extension GL_ARB_shading_language_420pack : require
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
layout(std140, column_major) uniform;
|
||||
layout(std430, column_major) buffer;
|
||||
)";
|
||||
const std::string vertex_shader_source = header +
|
||||
"\n\
|
||||
layout(location = 0) uniform mat4 projection_matrix; \n\
|
||||
layout(location = 0) in vec2 in_pos; \n\
|
||||
layout(location = 1) in vec4 in_color; \n\
|
||||
layout(location = 2) in vec2 in_uv; \n\
|
||||
layout(location = 0) out vec4 vtx_color; \n\
|
||||
layout(location = 1) out vec2 vtx_uv; \n\
|
||||
void main() { \n\
|
||||
gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); \n\
|
||||
vtx_color = in_color; \n\
|
||||
vtx_uv = in_uv; \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 0) uniform mat4 projection_matrix;
|
||||
layout(location = 0) in vec2 in_pos;
|
||||
layout(location = 1) in vec4 in_color;
|
||||
layout(location = 2) in vec2 in_uv;
|
||||
layout(location = 0) out vec4 vtx_color;
|
||||
layout(location = 1) out vec2 vtx_uv;
|
||||
void main() {
|
||||
gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0);
|
||||
vtx_color = in_color;
|
||||
vtx_uv = in_uv;
|
||||
})";
|
||||
const std::string fragment_shader_source = header +
|
||||
"\n\
|
||||
layout(location = 1, bindless_sampler) uniform sampler2D texture_sampler; \n\
|
||||
layout(location = 2) uniform float texture_mix; \n\
|
||||
layout(location = 0) in vec4 vtx_color; \n\
|
||||
layout(location = 1) in vec2 vtx_uv; \n\
|
||||
layout(location = 0) out vec4 oC; \n\
|
||||
void main() { \n\
|
||||
oC = vtx_color; \n\
|
||||
if (texture_mix > 0.0) { \n\
|
||||
vec4 color = texture(texture_sampler, vtx_uv); \n\
|
||||
oC *= color.rgba; \n\
|
||||
} \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 1, bindless_sampler) uniform sampler2D texture_sampler;
|
||||
layout(location = 2) uniform float texture_mix;
|
||||
layout(location = 0) in vec4 vtx_color;
|
||||
layout(location = 1) in vec2 vtx_uv;
|
||||
layout(location = 0) out vec4 oC;
|
||||
void main() {
|
||||
oC = vtx_color;
|
||||
if (texture_mix > 0.0) {
|
||||
vec4 color = texture(texture_sampler, vtx_uv);
|
||||
oC *= color.rgba;
|
||||
}
|
||||
})";
|
||||
|
||||
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
const char* vertex_shader_source_ptr = vertex_shader_source.c_str();
|
||||
|
@ -204,8 +203,8 @@ void GL4ElementalRenderer::BeginPaint(int render_target_w,
|
|||
glScissor(0, 0, render_target_w, render_target_h);
|
||||
|
||||
float left = 0.0f;
|
||||
float right = float(render_target_w);
|
||||
float bottom = float(render_target_h);
|
||||
float right = static_cast<float>(render_target_w);
|
||||
float bottom = static_cast<float>(render_target_h);
|
||||
float top = 0.0f;
|
||||
float z_near = -1.0f;
|
||||
float z_far = 1.0f;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace gl {
|
|||
|
||||
class GL4ElementalRenderer : public el::graphics::Renderer {
|
||||
public:
|
||||
GL4ElementalRenderer(GLContext* context);
|
||||
explicit GL4ElementalRenderer(GLContext* context);
|
||||
~GL4ElementalRenderer() override;
|
||||
|
||||
static std::unique_ptr<GL4ElementalRenderer> Create(GLContext* context);
|
||||
|
|
|
@ -449,7 +449,8 @@ void GLContext::BeginSwap() {
|
|||
SCOPE_profile_cpu_i("gpu", "xe::ui::gl::GLContext::BeginSwap");
|
||||
float clear_color[] = {238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.0f};
|
||||
if (FLAGS_random_clear_color) {
|
||||
clear_color[0] = rand() / (float)RAND_MAX;
|
||||
clear_color[0] =
|
||||
rand() / static_cast<float>(RAND_MAX); // NOLINT(runtime/threadsafe_fn)
|
||||
clear_color[1] = 1.0f;
|
||||
clear_color[2] = 0.0f;
|
||||
clear_color[3] = 1.0f;
|
||||
|
|
|
@ -49,7 +49,7 @@ class GLContext : public GraphicsContext {
|
|||
Blitter* blitter() { return &blitter_; }
|
||||
|
||||
private:
|
||||
GLContext(Window* target_window);
|
||||
explicit GLContext(Window* target_window);
|
||||
GLContext(Window* target_window, HGLRC glrc);
|
||||
|
||||
bool Initialize(Window* target_window);
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
#include "xenia/ui/gl/gl_profiler_display.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "third_party/microprofile/microprofileui.h"
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
|
@ -255,50 +258,48 @@ bool GLProfilerDisplay::SetupState() {
|
|||
|
||||
bool GLProfilerDisplay::SetupShaders() {
|
||||
const std::string header =
|
||||
"\n\
|
||||
#version 450 \n\
|
||||
#extension GL_ARB_bindless_texture : require \n\
|
||||
#extension GL_ARB_explicit_uniform_location : require \n\
|
||||
#extension GL_ARB_shading_language_420pack : require \n\
|
||||
precision highp float; \n\
|
||||
precision highp int; \n\
|
||||
layout(std140, column_major) uniform; \n\
|
||||
layout(std430, column_major) buffer; \n\
|
||||
";
|
||||
R"(
|
||||
#version 450
|
||||
#extension GL_ARB_bindless_texture : require
|
||||
#extension GL_ARB_explicit_uniform_location : require
|
||||
#extension GL_ARB_shading_language_420pack : require
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
layout(std140, column_major) uniform;
|
||||
layout(std430, column_major) buffer;
|
||||
)";
|
||||
const std::string vertex_shader_source = header +
|
||||
"\n\
|
||||
layout(location = 0) uniform mat4 projection_matrix; \n\
|
||||
layout(location = 0) in vec2 in_pos; \n\
|
||||
layout(location = 1) in vec4 in_color; \n\
|
||||
layout(location = 2) in vec2 in_uv; \n\
|
||||
layout(location = 0) out vec4 vtx_color; \n\
|
||||
layout(location = 1) out vec2 vtx_uv; \n\
|
||||
void main() { \n\
|
||||
gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); \n\
|
||||
vtx_color = in_color; \n\
|
||||
vtx_uv = in_uv; \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 0) uniform mat4 projection_matrix;
|
||||
layout(location = 0) in vec2 in_pos;
|
||||
layout(location = 1) in vec4 in_color;
|
||||
layout(location = 2) in vec2 in_uv;
|
||||
layout(location = 0) out vec4 vtx_color;
|
||||
layout(location = 1) out vec2 vtx_uv;
|
||||
void main() {
|
||||
gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0);
|
||||
vtx_color = in_color;
|
||||
vtx_uv = in_uv;
|
||||
})";
|
||||
const std::string fragment_shader_source = header +
|
||||
"\n\
|
||||
layout(location = 1, bindless_sampler) uniform sampler2D font_texture; \n\
|
||||
layout(location = 2) uniform float font_height; \n\
|
||||
layout(location = 0) in vec4 vtx_color; \n\
|
||||
layout(location = 1) in vec2 vtx_uv; \n\
|
||||
layout(location = 0) out vec4 oC; \n\
|
||||
void main() { \n\
|
||||
if (vtx_uv.x > 1.0) { \n\
|
||||
oC = vtx_color; \n\
|
||||
} else { \n\
|
||||
vec4 color = texture(font_texture, vtx_uv); \n\
|
||||
oC = color.rgba * vtx_color; \n\
|
||||
if (color.a < 0.5) { \n\
|
||||
vec4 c1 = texture(font_texture, vtx_uv + vec2(0.0, font_height)); \n\
|
||||
oC = vec4(0, 0, 0, c1.a); \n\
|
||||
} \n\
|
||||
} \n\
|
||||
} \n\
|
||||
";
|
||||
R"(
|
||||
layout(location = 1, bindless_sampler) uniform sampler2D font_texture;
|
||||
layout(location = 2) uniform float font_height;
|
||||
layout(location = 0) in vec4 vtx_color;
|
||||
layout(location = 1) in vec2 vtx_uv;
|
||||
layout(location = 0) out vec4 oC;
|
||||
void main() {
|
||||
if (vtx_uv.x > 1.0) {
|
||||
oC = vtx_color;
|
||||
} else {
|
||||
vec4 color = texture(font_texture, vtx_uv);
|
||||
oC = color.rgba * vtx_color;
|
||||
if (color.a < 0.5) {
|
||||
vec4 c1 = texture(font_texture, vtx_uv + vec2(0.0, font_height));
|
||||
oC = vec4(0, 0, 0, c1.a);
|
||||
}
|
||||
}
|
||||
})";
|
||||
|
||||
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
const char* vertex_shader_source_ptr = vertex_shader_source.c_str();
|
||||
|
@ -365,8 +366,8 @@ void GLProfilerDisplay::Begin() {
|
|||
glViewport(0, 0, width(), height());
|
||||
|
||||
float left = 0.0f;
|
||||
float right = float(width());
|
||||
float bottom = float(height());
|
||||
float right = static_cast<float>(width());
|
||||
float bottom = static_cast<float>(height());
|
||||
float top = 0.0f;
|
||||
float z_near = -1.0f;
|
||||
float z_far = 1.0f;
|
||||
|
@ -441,23 +442,23 @@ void GLProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color,
|
|||
if (type == BoxType::kFlat) {
|
||||
color =
|
||||
((color & 0xff) << 16) | ((color >> 16) & 0xff) | (0xff00ff00 & color);
|
||||
Q0(v, x, (float)x0);
|
||||
Q0(v, y, (float)y0);
|
||||
Q0(v, x, x0);
|
||||
Q0(v, y, y0);
|
||||
Q0(v, color, color);
|
||||
Q0(v, u, 2.0f);
|
||||
Q0(v, v, 2.0f);
|
||||
Q1(v, x, (float)x1);
|
||||
Q1(v, y, (float)y0);
|
||||
Q1(v, x, x1);
|
||||
Q1(v, y, y0);
|
||||
Q1(v, color, color);
|
||||
Q1(v, u, 2.0f);
|
||||
Q1(v, v, 2.0f);
|
||||
Q2(v, x, (float)x1);
|
||||
Q2(v, y, (float)y1);
|
||||
Q2(v, x, x1);
|
||||
Q2(v, y, y1);
|
||||
Q2(v, color, color);
|
||||
Q2(v, u, 2.0f);
|
||||
Q2(v, v, 2.0f);
|
||||
Q3(v, x, (float)x0);
|
||||
Q3(v, y, (float)y1);
|
||||
Q3(v, x, x0);
|
||||
Q3(v, y, y1);
|
||||
Q3(v, color, color);
|
||||
Q3(v, u, 2.0f);
|
||||
Q3(v, v, 2.0f);
|
||||
|
@ -477,23 +478,23 @@ void GLProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color,
|
|||
uint32_t b1 = 0xff & ((b + nMin) / 2);
|
||||
uint32_t color0 = (r0 << 0) | (g0 << 8) | (b0 << 16) | (0xff000000 & color);
|
||||
uint32_t color1 = (r1 << 0) | (g1 << 8) | (b1 << 16) | (0xff000000 & color);
|
||||
Q0(v, x, (float)x0);
|
||||
Q0(v, y, (float)y0);
|
||||
Q0(v, x, x0);
|
||||
Q0(v, y, y0);
|
||||
Q0(v, color, color0);
|
||||
Q0(v, u, 2.0f);
|
||||
Q0(v, v, 2.0f);
|
||||
Q1(v, x, (float)x1);
|
||||
Q1(v, y, (float)y0);
|
||||
Q1(v, x, x1);
|
||||
Q1(v, y, y0);
|
||||
Q1(v, color, color0);
|
||||
Q1(v, u, 3.0f);
|
||||
Q1(v, v, 2.0f);
|
||||
Q2(v, x, (float)x1);
|
||||
Q2(v, y, (float)y1);
|
||||
Q2(v, x, x1);
|
||||
Q2(v, y, y1);
|
||||
Q2(v, color, color1);
|
||||
Q2(v, u, 3.0f);
|
||||
Q2(v, v, 3.0f);
|
||||
Q3(v, x, (float)x0);
|
||||
Q3(v, y, (float)y1);
|
||||
Q3(v, x, x0);
|
||||
Q3(v, y, y1);
|
||||
Q3(v, color, color1);
|
||||
Q3(v, u, 2.0f);
|
||||
Q3(v, v, 3.0f);
|
||||
|
@ -532,8 +533,8 @@ void GLProfilerDisplay::DrawText(int x, int y, uint32_t color, const char* text,
|
|||
}
|
||||
|
||||
const float fOffsetU = 5.0f / 1024.0f;
|
||||
float fX = (float)x;
|
||||
float fY = (float)y;
|
||||
float fX = static_cast<float>(x);
|
||||
float fY = static_cast<float>(y);
|
||||
float fY2 = fY + (MICROPROFILE_TEXT_HEIGHT + 1);
|
||||
|
||||
auto v = BeginVertices(6 * text_length);
|
||||
|
@ -542,7 +543,7 @@ void GLProfilerDisplay::DrawText(int x, int y, uint32_t color, const char* text,
|
|||
((color >> 16) & 0xff);
|
||||
|
||||
for (size_t j = 0; j < text_length; ++j) {
|
||||
int16_t char_offset = font_description_.char_offsets[(int)*pStr++];
|
||||
int16_t char_offset = font_description_.char_offsets[*pStr++];
|
||||
float fOffset = char_offset / 1024.0f;
|
||||
Q0(v, x, fX);
|
||||
Q0(v, y, fY);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace gl {
|
|||
|
||||
class GLProfilerDisplay : public ProfilerDisplay {
|
||||
public:
|
||||
GLProfilerDisplay(xe::ui::Window* window);
|
||||
explicit GLProfilerDisplay(xe::ui::Window* window);
|
||||
virtual ~GLProfilerDisplay();
|
||||
|
||||
uint32_t width() const override;
|
||||
|
|
|
@ -43,7 +43,7 @@ class GraphicsContext {
|
|||
};
|
||||
|
||||
struct GraphicsContextLock {
|
||||
GraphicsContextLock(GraphicsContext* context) : context_(context) {
|
||||
explicit GraphicsContextLock(GraphicsContext* context) : context_(context) {
|
||||
context_->MakeCurrent();
|
||||
}
|
||||
~GraphicsContextLock() { context_->ClearCurrent(); }
|
||||
|
|
|
@ -17,7 +17,7 @@ class Window;
|
|||
|
||||
class UIEvent {
|
||||
public:
|
||||
UIEvent(Window* target = nullptr) : target_(target) {}
|
||||
explicit UIEvent(Window* target = nullptr) : target_(target) {}
|
||||
virtual ~UIEvent() = default;
|
||||
|
||||
Window* target() const { return target_; }
|
||||
|
|
|
@ -40,7 +40,7 @@ constexpr int32_t kMouseWheelDetent = 120;
|
|||
|
||||
class RootElement : public el::Element {
|
||||
public:
|
||||
RootElement(Window* owner) : owner_(owner) {}
|
||||
explicit RootElement(Window* owner) : owner_(owner) {}
|
||||
void OnInvalid() override { owner_->Invalidate(); }
|
||||
|
||||
private:
|
||||
|
@ -199,8 +199,9 @@ void Window::OnPaint(UIEvent& e) {
|
|||
++fps_frame_count_;
|
||||
uint64_t now_ns = xe::Clock::QueryHostSystemTime();
|
||||
if (now_ns > fps_update_time_ + 1000 * 10000) {
|
||||
fps_ = uint32_t(fps_frame_count_ /
|
||||
(double(now_ns - fps_update_time_) / 10000000.0));
|
||||
fps_ = static_cast<uint32_t>(
|
||||
fps_frame_count_ /
|
||||
(static_cast<double>(now_ns - fps_update_time_) / 10000000.0));
|
||||
fps_update_time_ = now_ns;
|
||||
fps_frame_count_ = 0;
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
TABLET_ENABLE_MULTITOUCHDATA;
|
||||
|
||||
case WM_MENUCOMMAND: {
|
||||
// TODO: Redirect this to MenuItem's on_selected delegate.
|
||||
// TODO(benvanik): Redirect this to MenuItem's on_selected delegate.
|
||||
MENUINFO menu_info = {0};
|
||||
menu_info.cbSize = sizeof(menu_info);
|
||||
menu_info.fMask = MIM_MENUDATA;
|
||||
|
@ -503,7 +503,7 @@ bool Win32Window::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
|
||||
bool Win32Window::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
auto e = KeyEvent(this, (int)wParam);
|
||||
auto e = KeyEvent(this, static_cast<int>(wParam));
|
||||
switch (message) {
|
||||
case WM_KEYDOWN:
|
||||
OnKeyDown(e);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace vfs {
|
|||
|
||||
class Device {
|
||||
public:
|
||||
Device(const std::string& path);
|
||||
explicit Device(const std::string& path);
|
||||
virtual ~Device();
|
||||
|
||||
virtual bool Initialize() = 0;
|
||||
|
|
|
@ -34,13 +34,13 @@ bool DiscImageDevice::Initialize() {
|
|||
ParseState state = {0};
|
||||
state.ptr = mmap_->data();
|
||||
state.size = mmap_->size();
|
||||
auto result = Verify(state);
|
||||
auto result = Verify(&state);
|
||||
if (result != Error::kSuccess) {
|
||||
XELOGE("Failed to verify disc image header: %d", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = ReadAllEntries(state, state.ptr + state.root_offset);
|
||||
result = ReadAllEntries(&state, state.ptr + state.root_offset);
|
||||
if (result != Error::kSuccess) {
|
||||
XELOGE("Failed to read all GDFX entries: %d", result);
|
||||
return false;
|
||||
|
@ -49,15 +49,15 @@ bool DiscImageDevice::Initialize() {
|
|||
return true;
|
||||
}
|
||||
|
||||
DiscImageDevice::Error DiscImageDevice::Verify(ParseState& state) {
|
||||
DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) {
|
||||
// Find sector 32 of the game partition - try at a few points.
|
||||
static const size_t likely_offsets[] = {
|
||||
0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000,
|
||||
};
|
||||
bool magic_found = false;
|
||||
for (size_t n = 0; n < xe::countof(likely_offsets); n++) {
|
||||
state.game_offset = likely_offsets[n];
|
||||
if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) {
|
||||
state->game_offset = likely_offsets[n];
|
||||
if (VerifyMagic(state, state->game_offset + (32 * kXESectorSize))) {
|
||||
magic_found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -68,27 +68,28 @@ DiscImageDevice::Error DiscImageDevice::Verify(ParseState& state) {
|
|||
}
|
||||
|
||||
// Read sector 32 to get FS state.
|
||||
if (state.size < state.game_offset + (32 * kXESectorSize)) {
|
||||
if (state->size < state->game_offset + (32 * kXESectorSize)) {
|
||||
return Error::kErrorReadError;
|
||||
}
|
||||
uint8_t* fs_ptr = state.ptr + state.game_offset + (32 * kXESectorSize);
|
||||
state.root_sector = xe::load<uint32_t>(fs_ptr + 20);
|
||||
state.root_size = xe::load<uint32_t>(fs_ptr + 24);
|
||||
state.root_offset = state.game_offset + (state.root_sector * kXESectorSize);
|
||||
if (state.root_size < 13 || state.root_size > 32 * 1024 * 1024) {
|
||||
uint8_t* fs_ptr = state->ptr + state->game_offset + (32 * kXESectorSize);
|
||||
state->root_sector = xe::load<uint32_t>(fs_ptr + 20);
|
||||
state->root_size = xe::load<uint32_t>(fs_ptr + 24);
|
||||
state->root_offset =
|
||||
state->game_offset + (state->root_sector * kXESectorSize);
|
||||
if (state->root_size < 13 || state->root_size > 32 * 1024 * 1024) {
|
||||
return Error::kErrorDamagedFile;
|
||||
}
|
||||
|
||||
return Error::kSuccess;
|
||||
}
|
||||
|
||||
bool DiscImageDevice::VerifyMagic(ParseState& state, size_t offset) {
|
||||
bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) {
|
||||
// Simple check to see if the given offset contains the magic value.
|
||||
return std::memcmp(state.ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0;
|
||||
return std::memcmp(state->ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0;
|
||||
}
|
||||
|
||||
DiscImageDevice::Error DiscImageDevice::ReadAllEntries(
|
||||
ParseState& state, const uint8_t* root_buffer) {
|
||||
ParseState* state, const uint8_t* root_buffer) {
|
||||
auto root_entry = new DiscImageEntry(this, nullptr, "", mmap_.get());
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry_ = std::unique_ptr<Entry>(root_entry);
|
||||
|
@ -100,7 +101,7 @@ DiscImageDevice::Error DiscImageDevice::ReadAllEntries(
|
|||
return Error::kSuccess;
|
||||
}
|
||||
|
||||
bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer,
|
||||
bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer,
|
||||
uint16_t entry_ordinal,
|
||||
DiscImageEntry* parent) {
|
||||
const uint8_t* p = buffer + (entry_ordinal * 4);
|
||||
|
@ -111,7 +112,7 @@ bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer,
|
|||
size_t length = xe::load<uint32_t>(p + 8);
|
||||
uint8_t attributes = xe::load<uint8_t>(p + 12);
|
||||
uint8_t name_length = xe::load<uint8_t>(p + 13);
|
||||
char* name = (char*)(p + 14);
|
||||
auto name = reinterpret_cast<const char*>(p + 14);
|
||||
|
||||
if (node_l && !ReadEntry(state, buffer, node_l, parent)) {
|
||||
return false;
|
||||
|
@ -135,20 +136,20 @@ bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer,
|
|||
entry->data_size_ = 0;
|
||||
if (length) {
|
||||
// Not a leaf - read in children.
|
||||
if (state.size < state.game_offset + (sector * kXESectorSize)) {
|
||||
if (state->size < state->game_offset + (sector * kXESectorSize)) {
|
||||
// Out of bounds read.
|
||||
return false;
|
||||
}
|
||||
// Read child list.
|
||||
uint8_t* folder_ptr =
|
||||
state.ptr + state.game_offset + (sector * kXESectorSize);
|
||||
state->ptr + state->game_offset + (sector * kXESectorSize);
|
||||
if (!ReadEntry(state, folder_ptr, 0, entry)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// File.
|
||||
entry->data_offset_ = state.game_offset + (sector * kXESectorSize);
|
||||
entry->data_offset_ = state->game_offset + (sector * kXESectorSize);
|
||||
entry->data_size_ = length;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ class DiscImageDevice : public Device {
|
|||
size_t root_size; // Size (bytes) of root.
|
||||
} ParseState;
|
||||
|
||||
Error Verify(ParseState& state);
|
||||
bool VerifyMagic(ParseState& state, size_t offset);
|
||||
Error ReadAllEntries(ParseState& state, const uint8_t* root_buffer);
|
||||
bool ReadEntry(ParseState& state, const uint8_t* buffer,
|
||||
Error Verify(ParseState* state);
|
||||
bool VerifyMagic(ParseState* state, size_t offset);
|
||||
Error ReadAllEntries(ParseState* state, const uint8_t* root_buffer);
|
||||
bool ReadEntry(ParseState* state, const uint8_t* buffer,
|
||||
uint16_t entry_ordinal, DiscImageEntry* parent);
|
||||
};
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ DiscImageEntry::DiscImageEntry(Device* device, Entry* parent, std::string path,
|
|||
|
||||
DiscImageEntry::~DiscImageEntry() = default;
|
||||
|
||||
X_STATUS DiscImageEntry::Open(KernelState* kernel_state,
|
||||
X_STATUS DiscImageEntry::Open(kernel::KernelState* kernel_state,
|
||||
uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) {
|
||||
*out_file =
|
||||
object_ref<XFile>(new DiscImageFile(kernel_state, desired_access, this));
|
||||
kernel::object_ref<kernel::XFile>* out_file) {
|
||||
*out_file = kernel::object_ref<kernel::XFile>(
|
||||
new DiscImageFile(kernel_state, desired_access, this));
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef XENIA_VFS_DEVICES_DISC_IMAGE_ENTRY_H_
|
||||
#define XENIA_VFS_DEVICES_DISC_IMAGE_ENTRY_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
|
@ -31,8 +32,8 @@ class DiscImageEntry : public Entry {
|
|||
size_t data_offset() const { return data_offset_; }
|
||||
size_t data_size() const { return data_size_; }
|
||||
|
||||
X_STATUS Open(KernelState* kernel_state, uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) override;
|
||||
X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file) override;
|
||||
|
||||
bool can_map() const override { return true; }
|
||||
std::unique_ptr<MappedMemory> OpenMapped(MappedMemory::Mode mode,
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
DiscImageFile::DiscImageFile(KernelState* kernel_state, uint32_t file_access,
|
||||
DiscImageEntry* entry)
|
||||
DiscImageFile::DiscImageFile(kernel::KernelState* kernel_state,
|
||||
uint32_t file_access, DiscImageEntry* entry)
|
||||
: XFile(kernel_state, file_access, entry), entry_(entry) {}
|
||||
|
||||
DiscImageFile::~DiscImageFile() = default;
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace vfs {
|
|||
|
||||
class DiscImageEntry;
|
||||
|
||||
class DiscImageFile : public XFile {
|
||||
class DiscImageFile : public kernel::XFile {
|
||||
public:
|
||||
DiscImageFile(KernelState* kernel_state, uint32_t file_access,
|
||||
DiscImageFile(kernel::KernelState* kernel_state, uint32_t file_access,
|
||||
DiscImageEntry* entry);
|
||||
~DiscImageFile() override;
|
||||
|
||||
|
|
|
@ -47,8 +47,9 @@ HostPathEntry* HostPathEntry::Create(Device* device, Entry* parent,
|
|||
return entry;
|
||||
}
|
||||
|
||||
X_STATUS HostPathEntry::Open(KernelState* kernel_state, uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) {
|
||||
X_STATUS HostPathEntry::Open(kernel::KernelState* kernel_state,
|
||||
uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file) {
|
||||
if (is_read_only() && (desired_access & (FileAccess::kFileWriteData |
|
||||
FileAccess::kFileAppendData))) {
|
||||
XELOGE("Attempting to open file for write access on read-only device");
|
||||
|
@ -60,8 +61,8 @@ X_STATUS HostPathEntry::Open(KernelState* kernel_state, uint32_t desired_access,
|
|||
// TODO(benvanik): pick correct response.
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
*out_file = object_ref<XFile>(new HostPathFile(kernel_state, desired_access,
|
||||
this, std::move(file_handle)));
|
||||
*out_file = kernel::object_ref<kernel::XFile>(new HostPathFile(
|
||||
kernel_state, desired_access, this, std::move(file_handle)));
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ class HostPathEntry : public Entry {
|
|||
|
||||
const std::wstring& local_path() { return local_path_; }
|
||||
|
||||
X_STATUS Open(KernelState* kernel_state, uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) override;
|
||||
X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file) override;
|
||||
|
||||
bool can_map() const override { return true; }
|
||||
std::unique_ptr<MappedMemory> OpenMapped(MappedMemory::Mode mode,
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace xe {
|
|||
namespace vfs {
|
||||
|
||||
HostPathFile::HostPathFile(
|
||||
KernelState* kernel_state, uint32_t file_access, HostPathEntry* entry,
|
||||
kernel::KernelState* kernel_state, uint32_t file_access,
|
||||
HostPathEntry* entry,
|
||||
std::unique_ptr<xe::filesystem::FileHandle> file_handle)
|
||||
: XFile(kernel_state, file_access, entry),
|
||||
file_handle_(std::move(file_handle)) {}
|
||||
|
|
|
@ -20,9 +20,9 @@ namespace vfs {
|
|||
|
||||
class HostPathEntry;
|
||||
|
||||
class HostPathFile : public XFile {
|
||||
class HostPathFile : public kernel::XFile {
|
||||
public:
|
||||
HostPathFile(KernelState* kernel_state, uint32_t file_access,
|
||||
HostPathFile(kernel::KernelState* kernel_state, uint32_t file_access,
|
||||
HostPathEntry* entry,
|
||||
std::unique_ptr<xe::filesystem::FileHandle> file_handle);
|
||||
~HostPathFile() override;
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
#include "xenia/vfs/devices/stfs_container_device.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/vfs/devices/stfs_container_entry.h"
|
||||
|
@ -16,14 +19,14 @@
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
#define XEGETUINT24BE(p) \
|
||||
(((uint32_t)xe::load_and_swap<uint8_t>((p) + 0) << 16) | \
|
||||
((uint32_t)xe::load_and_swap<uint8_t>((p) + 1) << 8) | \
|
||||
(uint32_t)xe::load_and_swap<uint8_t>((p) + 2))
|
||||
#define XEGETUINT24LE(p) \
|
||||
(((uint32_t)xe::load<uint8_t>((p) + 2) << 16) | \
|
||||
((uint32_t)xe::load<uint8_t>((p) + 1) << 8) | \
|
||||
(uint32_t)xe::load<uint8_t>((p) + 0))
|
||||
uint32_t load_uint24_be(const uint8_t* p) {
|
||||
return (static_cast<uint32_t>(p[0]) << 16) |
|
||||
(static_cast<uint32_t>(p[1]) << 8) | static_cast<uint32_t>(p[2]);
|
||||
}
|
||||
uint32_t load_uint24_le(const uint8_t* p) {
|
||||
return (static_cast<uint32_t>(p[2]) << 16) |
|
||||
(static_cast<uint32_t>(p[1]) << 8) | static_cast<uint32_t>(p[0]);
|
||||
}
|
||||
|
||||
StfsContainerDevice::StfsContainerDevice(const std::string& mount_path,
|
||||
const std::wstring& local_path)
|
||||
|
@ -150,8 +153,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries(
|
|||
}
|
||||
uint8_t filename_length_flags = xe::load_and_swap<uint8_t>(p + 0x28);
|
||||
// TODO(benvanik): use for allocation_size_?
|
||||
// uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29);
|
||||
uint32_t start_block_index = XEGETUINT24LE(p + 0x2F);
|
||||
// uint32_t allocated_block_count = load_uint24_le(p + 0x29);
|
||||
uint32_t start_block_index = load_uint24_le(p + 0x2F);
|
||||
uint16_t path_indicator = xe::load_and_swap<uint16_t>(p + 0x32);
|
||||
uint32_t file_size = xe::load_and_swap<uint32_t>(p + 0x34);
|
||||
uint32_t update_timestamp = xe::load_and_swap<uint32_t>(p + 0x38);
|
||||
|
@ -167,7 +170,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries(
|
|||
|
||||
auto entry = new StfsContainerEntry(
|
||||
this, parent_entry,
|
||||
std::string((char*)filename, filename_length_flags & 0x3F),
|
||||
std::string(reinterpret_cast<const char*>(filename),
|
||||
filename_length_flags & 0x3F),
|
||||
mmap_.get());
|
||||
// bit 0x40 = consecutive blocks (not fragmented?)
|
||||
if (filename_length_flags & 0x80) {
|
||||
|
@ -286,7 +290,7 @@ StfsContainerDevice::BlockHash StfsContainerDevice::GetBlockHash(
|
|||
const uint8_t* hash_data = map_ptr + BlockToOffset(table_index);
|
||||
const uint8_t* record_data = hash_data + record * 0x18;
|
||||
uint32_t info = xe::load_and_swap<uint8_t>(record_data + 0x14);
|
||||
uint32_t next_block_index = XEGETUINT24BE(record_data + 0x15);
|
||||
uint32_t next_block_index = load_uint24_be(record_data + 0x15);
|
||||
return {next_block_index, info};
|
||||
}
|
||||
|
||||
|
@ -300,12 +304,12 @@ bool StfsVolumeDescriptor::Read(const uint8_t* p) {
|
|||
reserved = xe::load_and_swap<uint8_t>(p + 0x01);
|
||||
block_separation = xe::load_and_swap<uint8_t>(p + 0x02);
|
||||
file_table_block_count = xe::load_and_swap<uint16_t>(p + 0x03);
|
||||
file_table_block_number = XEGETUINT24BE(p + 0x05);
|
||||
file_table_block_number = load_uint24_be(p + 0x05);
|
||||
std::memcpy(top_hash_table_hash, p + 0x08, 0x14);
|
||||
total_allocated_block_count = xe::load_and_swap<uint32_t>(p + 0x1C);
|
||||
total_unallocated_block_count = xe::load_and_swap<uint32_t>(p + 0x20);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
bool StfsHeader::Read(const uint8_t* p) {
|
||||
std::memcpy(license_entries, p + 0x22C, 0x100);
|
||||
|
|
|
@ -24,10 +24,10 @@ StfsContainerEntry::StfsContainerEntry(Device* device, Entry* parent,
|
|||
|
||||
StfsContainerEntry::~StfsContainerEntry() = default;
|
||||
|
||||
X_STATUS StfsContainerEntry::Open(KernelState* kernel_state,
|
||||
X_STATUS StfsContainerEntry::Open(kernel::KernelState* kernel_state,
|
||||
uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) {
|
||||
*out_file = object_ref<XFile>(
|
||||
kernel::object_ref<kernel::XFile>* out_file) {
|
||||
*out_file = kernel::object_ref<kernel::XFile>(
|
||||
new StfsContainerFile(kernel_state, desired_access, this));
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_ENTRY_H_
|
||||
#define XENIA_VFS_DEVICES_STFS_CONTAINER_ENTRY_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
|
@ -31,8 +32,8 @@ class StfsContainerEntry : public Entry {
|
|||
size_t data_offset() const { return data_offset_; }
|
||||
size_t data_size() const { return data_size_; }
|
||||
|
||||
X_STATUS Open(KernelState* kernel_state, uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) override;
|
||||
X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file) override;
|
||||
|
||||
struct BlockRecord {
|
||||
size_t offset;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
StfsContainerFile::StfsContainerFile(KernelState* kernel_state,
|
||||
StfsContainerFile::StfsContainerFile(kernel::KernelState* kernel_state,
|
||||
uint32_t file_access,
|
||||
StfsContainerEntry* entry)
|
||||
: XFile(kernel_state, file_access, entry), entry_(entry) {}
|
||||
|
@ -38,7 +38,7 @@ X_STATUS StfsContainerFile::ReadSync(void* buffer, size_t buffer_length,
|
|||
size_t end_block =
|
||||
std::min(entry_->block_list().size(),
|
||||
(size_t)ceil((byte_offset + real_length) / 4096.0));
|
||||
uint8_t* dest_ptr = (uint8_t*)buffer;
|
||||
uint8_t* dest_ptr = reinterpret_cast<uint8_t*>(buffer);
|
||||
size_t remaining_length = real_length;
|
||||
for (size_t n = start_block; n < end_block; n++) {
|
||||
auto& record = entry_->block_list()[n];
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace vfs {
|
|||
|
||||
class StfsContainerEntry;
|
||||
|
||||
class StfsContainerFile : public XFile {
|
||||
class StfsContainerFile : public kernel::XFile {
|
||||
public:
|
||||
StfsContainerFile(KernelState* kernel_state, uint32_t file_access,
|
||||
StfsContainerFile(kernel::KernelState* kernel_state, uint32_t file_access,
|
||||
StfsContainerEntry* entry);
|
||||
~StfsContainerFile() override;
|
||||
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace filesystem {
|
||||
class WildcardEngine;
|
||||
} // namespace filesystem
|
||||
namespace kernel {
|
||||
class KernelState;
|
||||
class XFile;
|
||||
|
@ -33,8 +30,6 @@ class XFile;
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
using namespace xe::kernel;
|
||||
|
||||
class Device;
|
||||
|
||||
// Matches http://source.winehq.org/source/include/winternl.h#1591.
|
||||
|
@ -110,8 +105,9 @@ class Entry {
|
|||
bool Delete();
|
||||
void Touch();
|
||||
|
||||
virtual X_STATUS Open(KernelState* kernel_state, uint32_t desired_access,
|
||||
object_ref<XFile>* out_file) = 0;
|
||||
virtual X_STATUS Open(kernel::KernelState* kernel_state,
|
||||
uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file) = 0;
|
||||
|
||||
virtual bool can_map() const { return false; }
|
||||
virtual std::unique_ptr<MappedMemory> OpenMapped(MappedMemory::Mode mode,
|
||||
|
|
|
@ -140,12 +140,10 @@ bool VirtualFileSystem::DeletePath(std::string path) {
|
|||
return parent->Delete(entry);
|
||||
}
|
||||
|
||||
X_STATUS VirtualFileSystem::OpenFile(KernelState* kernel_state,
|
||||
std::string path,
|
||||
FileDisposition creation_disposition,
|
||||
uint32_t desired_access,
|
||||
object_ref<XFile>* out_file,
|
||||
FileAction* out_action) {
|
||||
X_STATUS VirtualFileSystem::OpenFile(
|
||||
kernel::KernelState* kernel_state, std::string path,
|
||||
FileDisposition creation_disposition, uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file, FileAction* out_action) {
|
||||
// Cleanup access.
|
||||
if (desired_access & FileAccess::kGenericRead) {
|
||||
desired_access |= FileAccess::kFileReadData;
|
||||
|
|
|
@ -39,9 +39,10 @@ class VirtualFileSystem {
|
|||
Entry* CreatePath(std::string path, uint32_t attributes);
|
||||
bool DeletePath(std::string path);
|
||||
|
||||
X_STATUS OpenFile(KernelState* kernel_state, std::string path,
|
||||
X_STATUS OpenFile(kernel::KernelState* kernel_state, std::string path,
|
||||
FileDisposition creation_disposition,
|
||||
uint32_t desired_access, object_ref<XFile>* out_file,
|
||||
uint32_t desired_access,
|
||||
kernel::object_ref<kernel::XFile>* out_file,
|
||||
FileAction* out_action);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue