Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,8 @@ healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# CMake
build*/
cmake-build*/
CMakeUserPresets.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "3rdparty/XbSymbolDatabase"]
path = 3rdparty/XbSymbolDatabase
url = https://github.com/Cxbx-Reloaded/XbSymbolDatabase.git
[submodule "3rdparty/ida-sdk"]
path = 3rdparty/ida-sdk
url = https://github.com/HexRaysSA/ida-sdk.git
2 changes: 1 addition & 1 deletion 3rdparty/byte_order.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace xe {
#define XENIA_BASE_BYTE_SWAP_16 _byteswap_ushort
#define XENIA_BASE_BYTE_SWAP_32 _byteswap_ulong
#define XENIA_BASE_BYTE_SWAP_64 _byteswap_uint64
#elif XE_PLATFORM_MAC
#elif defined(XE_PLATFORM_MAC) || defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define XENIA_BASE_BYTE_SWAP_16 OSSwapInt16
#define XENIA_BASE_BYTE_SWAP_32 OSSwapInt32
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/excrypt
Submodule excrypt updated 1 files
+34 −15 src/excrypt_aes.c
1 change: 1 addition & 0 deletions 3rdparty/ida-sdk
Submodule ida-sdk added at 234861
104 changes: 59 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)

project(idaxex)
# ---------------------------------------------------------------------------
# IDA SDK
#
# The loader builds against the official IDA SDK
# (https://github.com/HexRaysSA/ida-sdk), vendored as the 3rdparty/ida-sdk
# submodule. That repository ships its own CMake package
# (find_package(idasdk)) together with the link stub libraries, so no separate
# SDK download or IDASDK environment variable is needed -- just make sure the
# submodules are checked out (git submodule update --init --recursive).
# ---------------------------------------------------------------------------
set(IDAXEX_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ida-sdk")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
if(NOT EXISTS "${IDAXEX_SDK_ROOT}/src/include/pro.h")
message(FATAL_ERROR
"IDA SDK submodule not found at ${IDAXEX_SDK_ROOT}. "
"Run: git submodule update --init --recursive")
endif()

if(DEFINED ENV{IDASDK})
file(TO_CMAKE_PATH "$ENV{IDASDK}" _IDASDK_ROOT)
set(_IDASDK_BOOTSTRAP "")
if(EXISTS "${_IDASDK_ROOT}/src/cmake/bootstrap.cmake")
set(_IDASDK_BOOTSTRAP "${_IDASDK_ROOT}/src/cmake/bootstrap.cmake")
elseif(EXISTS "${_IDASDK_ROOT}/ida-cmake/bootstrap.cmake")
set(_IDASDK_BOOTSTRAP "${_IDASDK_ROOT}/ida-cmake/bootstrap.cmake")
endif()
# idasdk_init.cmake resolves the SDK, makes find_package(idasdk) reachable, and
# pre-selects MSVC on Windows. It must be included before project().
set(ENV{IDASDK} "${IDAXEX_SDK_ROOT}/src")
include("${IDAXEX_SDK_ROOT}/src/cmake/idasdk_init.cmake")

if(NOT _IDASDK_BOOTSTRAP)
message(FATAL_ERROR "Could not find ida-cmake bootstrap under $ENV{IDASDK}")
endif()
project(idaxex CXX C)

include("${_IDASDK_BOOTSTRAP}")
find_package(idasdk REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)

foreach(_IDAXEX_QT_HELPER_TARGET IN ITEMS
build_qt
qt6_external
qt6_external-download
qt6_external-configure
qt6_external-build
qt6_external-install
)
if(TARGET ${_IDAXEX_QT_HELPER_TARGET})
set_target_properties(${_IDAXEX_QT_HELPER_TARGET} PROPERTIES
EXCLUDE_FROM_ALL TRUE
EXCLUDE_FROM_DEFAULT_BUILD TRUE
EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE
EXCLUDE_FROM_DEFAULT_BUILD_RELEASE TRUE
EXCLUDE_FROM_DEFAULT_BUILD_RELWITHDEBINFO TRUE
EXCLUDE_FROM_DEFAULT_BUILD_MINSIZEREL TRUE
)
endif()
endforeach()
else()
message(FATAL_ERROR "Set IDASDK to an IDA SDK root before configuring idaxex")
# `cmake --build` writes the loader into the build tree (build/bin/loaders/).
# `cmake --install` (below) is what copies it into IDA's directory. This must
# be set before find_package(), which bakes the output location into
# ida_add_loader().
if(NOT DEFINED IDABIN AND NOT DEFINED ENV{IDABIN})
set(IDABIN "${CMAKE_BINARY_DIR}/bin")
endif()

find_package(idasdk REQUIRED)

ida_add_loader(idaxex
SOURCES
idaloader.cpp
Expand Down Expand Up @@ -72,17 +66,37 @@ ida_add_loader(idaxex
3rdparty/excrypt/src
3rdparty/XbSymbolDatabase/include
3rdparty/XbSymbolDatabase/src/OOVPADatabase
${_IDASDK_ROOT}/src/ldr/pe
${_IDASDK_ROOT}/ldr/pe
DEFINES
IDALDR=1
)

# excrypt's AES path uses x86 AES-NI intrinsics (wmmintrin.h); enable them on
# x86/x64 only. MSVC exposes the intrinsics without an explicit switch.
if((IDA_X64 OR IDA_X86) AND NOT MSVC)
target_compile_options(idaxex PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-maes>)
endif()
target_compile_options(idaxex PRIVATE
$<$<AND:$<NOT:$<C_COMPILER_ID:MSVC>>,$<COMPILE_LANGUAGE:C>>:-maes>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:MSVC>>,$<COMPILE_LANGUAGE:CXX>>:-maes>
$<$<CXX_COMPILER_ID:Clang>:-Wno-non-pod-varargs>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-non-pod-varargs>
)
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-non-pod-varargs>)

ida_disable_warnings(idaxex)

# `cmake --install build` installs the loader so IDA picks it up automatically.
# Default the install prefix to IDA's per-user directory (loaders/ subdir):
# ~/.idapro/loaders on Linux/macOS
# %APPDATA%\Hex-Rays\IDA Pro\loaders on Windows
# Pass -DCMAKE_INSTALL_PREFIX=<dir> to install elsewhere (e.g. an IDA
# installation directory); the loader always lands in <prefix>/loaders.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(WIN32)
set(_idaxex_userdir "$ENV{APPDATA}/Hex-Rays/IDA Pro")
else()
set(_idaxex_userdir "$ENV{HOME}/.idapro")
endif()
set(CMAKE_INSTALL_PREFIX "${_idaxex_userdir}" CACHE PATH
"Install location (IDA directory)" FORCE)
endif()

install(FILES "$<TARGET_FILE:idaxex>" DESTINATION "loaders")

# xex1tool: standalone command-line companion (does not use the IDA SDK).
add_subdirectory(xex1tool)
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# idaxex

idaxex is a native loader plugin for IDA Pro 9.3, adding support for loading Xbox 360 XEX and Xbox XBE executables.
idaxex is a native loader plugin for IDA Pro 9.4, adding support for loading Xbox 360 XEX and Xbox XBE executables.

Originally started as an [IDAPython loader](https://github.com/emoose/reversing/blob/master/xbox360.py), work was continued as a native DLL to solve the shortcomings of it.

Expand Down Expand Up @@ -41,24 +41,33 @@ For PPC Altivec analysis, the PPCAltivec plugin remains a useful companion: http

## Building

Make sure to clone repo recursively for excrypt submodule to get pulled in.
Dependencies are pulled in as submodules, so clone recursively:

**Windows**
```
git clone --recursive https://github.com/emoose/idaxex.git
# or, if already cloned:
git submodule update --init --recursive
```

- Point `IDASDK` environment variable at your IDA SDK 9.3 root.
- Run CMake to generate the VS solution: `cmake -B build -G "Visual Studio 18 2026"`
- Build with `cmake --build build` or use the `idaxex.slnx` file.
- idaxex.dll will be built at `$IDASDK\src\bin\loaders\idaxex.dll`
Then build with the Ninja generator from the repo root:

**Linux**
```
cmake -S . -B build -G Ninja
cmake --build build
```

- Use the IDA SDK 9.3 CMake bootstrap from `src/cmake/bootstrap.cmake` if your SDK tree has it, or the standalone [ida-cmake](https://github.com/allthingsida/ida-cmake) bootstrap if you keep that package separately.
- Make sure `IDASDK` points at the SDK root.
- Run `cmake -S . -B build` from the repo root.
- Run `cmake --build build`.
- To build `xex1tool`, run `cmake -S xex1tool -B xex1tool/build` and `cmake --build xex1tool/build`.
This builds the loader at `build/bin/loaders/` (`idaxex.dll` on Windows,
`idaxex.so` on Linux, `idaxex.dylib` on macOS). To install it into IDA's
per-user directory so it's picked up automatically, run:

On newer IDA SDKs, `libida.so` may be the correct library name in place of `libida64.so`.
```
cmake --install build
```

- **Windows:** run the commands from a Visual Studio Developer Command Prompt
(or any shell where `cl.exe` is on `PATH`).
- To build `xex1tool`, run `cmake -S xex1tool -B xex1tool/build -G Ninja` and
`cmake --build xex1tool/build`.

## Credits
Based on work by the Xenia project, XEX2.bt by Anthony, xextool 0.1 by xor37h, Xex Loader & x360_imports.idc by xorloser, xkelib, XeCLI, and probably many others I forgot to name.
Expand Down
3 changes: 3 additions & 0 deletions formats/xex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class XEXFile
#ifndef IDALDR
#ifdef _MSC_VER
read = (read_fn)fread; seek = (seek_fn)_fseeki64; tell = (tell_fn)_ftelli64; dbgmsg = stdio_msg;
#elif defined(__APPLE__)
// On macOS/BSD off_t is already 64-bit, so fseeko/ftello are the 64-bit variants.
read = (read_fn)fread; seek = (seek_fn)fseeko; tell = (tell_fn)ftello; dbgmsg = stdio_msg;
#else
read = (read_fn)fread; seek = (seek_fn)fseeko64; tell = (tell_fn)ftello64; dbgmsg = stdio_msg;
#endif
Expand Down
4 changes: 2 additions & 2 deletions idaloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <segregs.hpp>

struct exehdr {}; // needed for pe.h
#include <pe.h>
#include <common.h>
#include <ldr/pe/pe.h>
#include <ldr/pe/common.h>

#include <filesystem>
#include <list>
Expand Down
4 changes: 2 additions & 2 deletions idaloader_xbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <segregs.hpp>

struct exehdr {}; // needed for pe.h
#include <pe.h>
#include <common.h>
#include <ldr/pe/pe.h>
#include <ldr/pe/common.h>

#include <filesystem>
#include <list>
Expand Down
31 changes: 0 additions & 31 deletions idaxex.sln

This file was deleted.

103 changes: 0 additions & 103 deletions idaxex.vcxproj

This file was deleted.

Loading