mirror of
				https://github.com/hedge-dev/XenonRecomp.git
				synced 2025-10-30 07:11:38 +00:00 
			
		
		
		
	Compare commits
	
		
			3 commits
		
	
	
		
			83a66b5cdb
			...
			26512bba55
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 26512bba55 | ||
|   | ddd128bcca | ||
|   | 32c2f49bec | 
					 2 changed files with 18 additions and 5 deletions
				
			
		|  | @ -1,6 +1,6 @@ | ||||||
| # XenonRecomp | # XenonRecomp | ||||||
| 
 | 
 | ||||||
| XenonRecomp is a tool that converts Xbox 360 executables into C++ code, which can then be recompiled for any platform. Currently, it only supports x86 platforms due to the use of x86 intrinsics. | XenonRecomp is a tool that converts Xbox 360 executables into C++ code, which can then be recompiled for any platform. | ||||||
| 
 | 
 | ||||||
| This project was heavily inspired by [N64: Recompiled](https://github.com/N64Recomp/N64Recomp), a similar tool for N64 executables. | This project was heavily inspired by [N64: Recompiled](https://github.com/N64Recomp/N64Recomp), a similar tool for N64 executables. | ||||||
| 
 | 
 | ||||||
|  | @ -20,7 +20,7 @@ Vector registers' endianness handling is more complicated. Instead of swapping i | ||||||
| 
 | 
 | ||||||
| The FPU expects denormalized numbers to remain unmodified, while VMX instructions always flush them. This is managed by storing the current floating-point state in the CPU state struct and enabling or disabling denormal flushing as necessary before executing each instruction. | The FPU expects denormalized numbers to remain unmodified, while VMX instructions always flush them. This is managed by storing the current floating-point state in the CPU state struct and enabling or disabling denormal flushing as necessary before executing each instruction. | ||||||
| 
 | 
 | ||||||
| Most VMX instructions are implemented using x86 intrinsics. Luckily, the number of AVX intrinsics used is relatively low, so adding support for other architectures using libraries like [SIMD Everywhere](https://github.com/simd-everywhere/simde) might be possible. | Most VMX instructions are implemented using x86 intrinsics. Support for ARM64 is implemented using [SIMD Everywhere](https://github.com/simd-everywhere/simde). | ||||||
| 
 | 
 | ||||||
| ### MMIO | ### MMIO | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,17 +2,30 @@ | ||||||
| 
 | 
 | ||||||
| #include <cassert> | #include <cassert> | ||||||
| 
 | 
 | ||||||
|  | #if defined(_MSC_VER)  // MSVC
 | ||||||
|  | #include <intrin.h> | ||||||
|  | #define BSWAP16(x) _byteswap_ushort(x) | ||||||
|  | #define BSWAP32(x) _byteswap_ulong(x) | ||||||
|  | #define BSWAP64(x) _byteswap_uint64(x) | ||||||
|  | #elif defined(__GNUC__) || defined(__clang__)  // GCC or Clang
 | ||||||
|  | #define BSWAP16(x) __builtin_bswap16(x) | ||||||
|  | #define BSWAP32(x) __builtin_bswap32(x) | ||||||
|  | #define BSWAP64(x) __builtin_bswap64(x) | ||||||
|  | #else | ||||||
|  | #error "Unsupported compiler" | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| template<typename T> | template<typename T> | ||||||
| inline T ByteSwap(T value) | inline T ByteSwap(T value) | ||||||
| { | { | ||||||
|     if constexpr (sizeof(T) == 1) |     if constexpr (sizeof(T) == 1) | ||||||
|         return value; |         return value; | ||||||
|     else if constexpr (sizeof(T) == 2) |     else if constexpr (sizeof(T) == 2) | ||||||
|         return static_cast<T>(__builtin_bswap16(static_cast<uint16_t>(value))); |         return static_cast<T>(BSWAP16(static_cast<uint16_t>(value))); | ||||||
|     else if constexpr (sizeof(T) == 4) |     else if constexpr (sizeof(T) == 4) | ||||||
|         return static_cast<T>(__builtin_bswap32(static_cast<uint32_t>(value))); |         return static_cast<T>(BSWAP32(static_cast<uint32_t>(value))); | ||||||
|     else if constexpr (sizeof(T) == 8) |     else if constexpr (sizeof(T) == 8) | ||||||
|         return static_cast<T>(__builtin_bswap64(static_cast<uint64_t>(value))); |         return static_cast<T>(BSWAP64(static_cast<uint64_t>(value))); | ||||||
| 
 | 
 | ||||||
|     assert(false && "Unexpected byte size."); |     assert(false && "Unexpected byte size."); | ||||||
|     return value; |     return value; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue